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
office365/sharepoint/portal/group_site_manager.py
rikeshtailor/Office365-REST-Python-Client
0
9312
<reponame>rikeshtailor/Office365-REST-Python-Client from office365.runtime.client_object import ClientObject from office365.runtime.client_result import ClientResult from office365.runtime.http.http_method import HttpMethod from office365.runtime.queries.service_operation_query import ServiceOperationQuery from office365.runtime.resource_path import ResourcePath from office365.sharepoint.portal.group_creation_params import GroupCreationInformation from office365.sharepoint.portal.group_site_info import GroupSiteInfo class GroupSiteManager(ClientObject): def __init__(self, context): super(GroupSiteManager, self).__init__(context, ResourcePath("GroupSiteManager"), None) def create_group_ex(self, display_name, alias, is_public, optional_params=None): """ Create a modern site :param str display_name: :param str alias: :param bool is_public: :param office365.sharepoint.portal.group_creation_params.GroupCreationParams or None optional_params: """ payload = GroupCreationInformation(display_name, alias, is_public, optional_params) result = ClientResult(self.context, GroupSiteInfo()) qry = ServiceOperationQuery(self, "CreateGroupEx", None, payload, None, result) self.context.add_query(qry) return result def delete(self, site_url): """ Deletes a SharePoint Team site :type site_url: str """ payload = { "siteUrl": site_url } qry = ServiceOperationQuery(self, "Delete", None, payload) self.context.add_query(qry) return self def get_status(self, group_id): """Get the status of a SharePoint site :type group_id: str """ result = ClientResult(self.context, GroupSiteInfo()) qry = ServiceOperationQuery(self, "GetSiteStatus", None, {'groupId': group_id}, None, result) self.context.add_query(qry) def _construct_status_request(request): request.method = HttpMethod.Get request.url += "?groupId='{0}'".format(group_id) self.context.before_execute(_construct_status_request) return result
[ 1, 529, 276, 1112, 420, 29958, 5357, 267, 400, 737, 272, 29914, 27247, 29941, 29953, 29945, 29899, 1525, 1254, 29899, 11980, 29899, 4032, 13, 3166, 8034, 29941, 29953, 29945, 29889, 15634, 29889, 4645, 29918, 3318, 1053, 12477, 2061, 13, 3166, 8034, 29941, 29953, 29945, 29889, 15634, 29889, 4645, 29918, 2914, 1053, 12477, 3591, 13, 3166, 8034, 29941, 29953, 29945, 29889, 15634, 29889, 1124, 29889, 1124, 29918, 5696, 1053, 9056, 4062, 13, 3166, 8034, 29941, 29953, 29945, 29889, 15634, 29889, 339, 6358, 29889, 5509, 29918, 16453, 29918, 1972, 1053, 6692, 10925, 3010, 13, 3166, 8034, 29941, 29953, 29945, 29889, 15634, 29889, 10314, 29918, 2084, 1053, 18981, 2605, 13, 3166, 8034, 29941, 29953, 29945, 29889, 13653, 3149, 29889, 25089, 29889, 2972, 29918, 1037, 362, 29918, 7529, 1053, 6431, 9832, 362, 20350, 13, 3166, 8034, 29941, 29953, 29945, 29889, 13653, 3149, 29889, 25089, 29889, 2972, 29918, 2746, 29918, 3888, 1053, 6431, 17033, 3401, 13, 13, 13, 1990, 6431, 17033, 3260, 29898, 4032, 2061, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 3030, 1125, 13, 4706, 2428, 29898, 4782, 17033, 3260, 29892, 1583, 467, 1649, 2344, 12035, 4703, 29892, 18981, 2605, 703, 4782, 17033, 3260, 4968, 6213, 29897, 13, 13, 1678, 822, 1653, 29918, 2972, 29918, 735, 29898, 1311, 29892, 2479, 29918, 978, 29892, 13995, 29892, 338, 29918, 3597, 29892, 13136, 29918, 7529, 29922, 8516, 1125, 13, 4706, 9995, 13, 4706, 6204, 263, 5400, 3268, 13, 13, 4706, 584, 3207, 851, 2479, 29918, 978, 29901, 13, 4706, 584, 3207, 851, 13995, 29901, 13, 4706, 584, 3207, 6120, 338, 29918, 3597, 29901, 13, 4706, 584, 3207, 8034, 29941, 29953, 29945, 29889, 13653, 3149, 29889, 25089, 29889, 2972, 29918, 1037, 362, 29918, 7529, 29889, 4782, 9832, 362, 9629, 470, 6213, 13136, 29918, 7529, 29901, 13, 4706, 9995, 13, 4706, 20092, 353, 6431, 9832, 362, 20350, 29898, 4990, 29918, 978, 29892, 13995, 29892, 338, 29918, 3597, 29892, 13136, 29918, 7529, 29897, 13, 4706, 1121, 353, 12477, 3591, 29898, 1311, 29889, 4703, 29892, 6431, 17033, 3401, 3101, 13, 4706, 3855, 719, 353, 6692, 10925, 3010, 29898, 1311, 29892, 376, 4391, 4782, 1252, 613, 6213, 29892, 20092, 29892, 6213, 29892, 1121, 29897, 13, 4706, 1583, 29889, 4703, 29889, 1202, 29918, 1972, 29898, 29939, 719, 29897, 13, 4706, 736, 1121, 13, 13, 1678, 822, 5217, 29898, 1311, 29892, 3268, 29918, 2271, 1125, 13, 4706, 9995, 13, 4706, 897, 1026, 267, 263, 26849, 5228, 8583, 3268, 13, 13, 4706, 584, 1853, 3268, 29918, 2271, 29901, 851, 13, 4706, 9995, 13, 4706, 20092, 353, 426, 13, 9651, 376, 2746, 5983, 1115, 3268, 29918, 2271, 13, 4706, 500, 13, 4706, 3855, 719, 353, 6692, 10925, 3010, 29898, 1311, 29892, 376, 12498, 613, 6213, 29892, 20092, 29897, 13, 4706, 1583, 29889, 4703, 29889, 1202, 29918, 1972, 29898, 29939, 719, 29897, 13, 4706, 736, 1583, 13, 13, 1678, 822, 679, 29918, 4882, 29898, 1311, 29892, 2318, 29918, 333, 1125, 13, 4706, 9995, 2577, 278, 4660, 310, 263, 26849, 5228, 3268, 13, 13, 4706, 584, 1853, 2318, 29918, 333, 29901, 851, 13, 4706, 9995, 13, 4706, 1121, 353, 12477, 3591, 29898, 1311, 29889, 4703, 29892, 6431, 17033, 3401, 3101, 13, 4706, 3855, 719, 353, 6692, 10925, 3010, 29898, 1311, 29892, 376, 2577, 17033, 5709, 613, 6213, 29892, 11117, 9688, 2396, 2318, 29918, 333, 1118, 6213, 29892, 1121, 29897, 13, 4706, 1583, 29889, 4703, 29889, 1202, 29918, 1972, 29898, 29939, 719, 29897, 13, 13, 4706, 822, 903, 11433, 29918, 4882, 29918, 3827, 29898, 3827, 1125, 13, 9651, 2009, 29889, 5696, 353, 9056, 4062, 29889, 2577, 13, 9651, 2009, 29889, 2271, 4619, 376, 29973, 9688, 2433, 29912, 29900, 10162, 1642, 4830, 29898, 2972, 29918, 333, 29897, 13, 13, 4706, 1583, 29889, 4703, 29889, 11083, 29918, 7978, 7373, 11433, 29918, 4882, 29918, 3827, 29897, 13, 4706, 736, 1121, 13, 2 ]
python/cracking_codes_with_python/k_columnar_transposition_cipher_hack.py
MerrybyPractice/book-challanges-and-tutorials
0
48975
# Columnar Transposition Hack per Cracking Codes with Python # https://www.nostarch.com/crackingcodes/ (BSD Licensed) import pyperclip from j_detect_english import is_english from g_decrypt_columnar_transposition_cipher import decrypt_message as decrypt def hack_transposition(text): print('Press Ctrl-C to quit at any time.') print('Hacking...') for key in range(1, len(text)): print('Trying key #%s...' % (key)) print() print('...') decrypted_text = decrypt(key, text) print() print('...') if is_english(decrypted_text): print() print('Possible encryption hack:') print('Key %s: %s' % (key, decrypted_text[:100])) print() print('Enter D if done, anything else to continue the hack:') response = input('>') if response.strip().upper().startswith('D'): return decrypted_text return None def main(text): hacked_text = hack_transposition(text) if hacked_text == None: print('Failed to hack the Columnar Transposition Encryption') else: print('Copying hacked string to clipboard:') print(hacked_text) pyperclip.copy(hacked_text) if __name__ == '__main__': text = input('What would you like to decrypt? ') main(text)
[ 1, 396, 12481, 279, 4103, 3283, 379, 547, 639, 14279, 384, 292, 315, 2631, 411, 5132, 13, 29937, 2045, 597, 1636, 29889, 6582, 1279, 29889, 510, 29914, 29883, 22282, 292, 18137, 29914, 313, 29933, 7230, 10413, 21144, 29897, 13, 13, 5215, 11451, 546, 24049, 29871, 13, 3166, 432, 29918, 4801, 522, 29918, 996, 1674, 1053, 338, 29918, 996, 1674, 13, 3166, 330, 29918, 7099, 4641, 29918, 4914, 279, 29918, 3286, 3283, 29918, 455, 8096, 1053, 1602, 4641, 29918, 4906, 408, 1602, 4641, 29871, 13, 13, 1753, 15833, 29918, 3286, 3283, 29898, 726, 1125, 29871, 13, 29871, 1596, 877, 10923, 315, 11742, 29899, 29907, 304, 23283, 472, 738, 931, 29889, 1495, 13, 13, 29871, 1596, 877, 29950, 547, 292, 856, 1495, 13, 29871, 363, 1820, 297, 3464, 29898, 29896, 29892, 7431, 29898, 726, 22164, 29871, 13, 13, 1678, 1596, 877, 15870, 292, 1820, 396, 29995, 29879, 856, 29915, 1273, 313, 1989, 876, 13, 1678, 1596, 580, 13, 1678, 1596, 877, 856, 1495, 13, 1678, 1602, 14740, 29918, 726, 353, 1602, 4641, 29898, 1989, 29892, 1426, 29897, 13, 1678, 1596, 580, 13, 1678, 1596, 877, 856, 1495, 13, 13, 1678, 565, 338, 29918, 996, 1674, 29898, 7099, 14740, 29918, 726, 1125, 29871, 13, 13, 418, 1596, 580, 13, 418, 1596, 877, 9135, 1687, 20956, 15833, 29901, 1495, 13, 418, 1596, 877, 2558, 1273, 29879, 29901, 1273, 29879, 29915, 1273, 313, 1989, 29892, 1602, 14740, 29918, 726, 7503, 29896, 29900, 29900, 12622, 13, 418, 1596, 580, 13, 418, 1596, 877, 10399, 360, 565, 2309, 29892, 3099, 1683, 304, 6773, 278, 15833, 29901, 1495, 13, 418, 2933, 353, 1881, 877, 29958, 1495, 13, 13, 418, 565, 2933, 29889, 17010, 2141, 21064, 2141, 27382, 2541, 877, 29928, 29374, 13, 4706, 736, 1602, 14740, 29918, 726, 13, 13, 29871, 736, 6213, 1678, 13, 13, 1753, 1667, 29898, 726, 1125, 29871, 13, 13, 29871, 15833, 287, 29918, 726, 353, 15833, 29918, 3286, 3283, 29898, 726, 29897, 13, 13, 29871, 565, 15833, 287, 29918, 726, 1275, 6213, 29901, 29871, 13, 1678, 1596, 877, 17776, 304, 15833, 278, 12481, 279, 4103, 3283, 11346, 14272, 1495, 13, 29871, 1683, 29901, 29871, 13, 1678, 1596, 877, 11882, 292, 15833, 287, 1347, 304, 20102, 3377, 29901, 1495, 13, 1678, 1596, 29898, 29882, 547, 287, 29918, 726, 29897, 13, 1678, 11451, 546, 24049, 29889, 8552, 29898, 29882, 547, 287, 29918, 726, 29897, 259, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 29871, 13, 13, 29871, 1426, 353, 1881, 877, 5618, 723, 366, 763, 304, 1602, 4641, 29973, 25710, 13, 13, 29871, 1667, 29898, 726, 29897, 13, 2 ]
btree.py
chrisconley/python-data-structures
0
1607164
from collections import deque class BinarySearchTree: def __init__(self): self.root = None def get(self, key): return self._get(self.root, key) def _get(self, node, key): if node is None: return None if key < node.key: return self._get(node.left, key) elif key > node.key: return self._get(node.right, key) else: return node.value def put(self, key, value): self.root = self._put(self.root, key, value) def _put(self, node, key, value): if node is None: return _Node(key, value, 1) if key < node.key: node.left = self._put(node.left, key, value) elif key > node.key: node.right = self._put(node.right, key, value) else: node.value = value node.num_nodes = self._size(node.left) + self._size(node.right) + 1 return node def delete(self, key): self.root = self._delete(self.root, key) def _delete(self, node, key): if node is None: return None if key < node.key: node.left = self._delete(node.left, key) elif key > node.key: node.right = self._delete(node.right, key) else: if node.right is None: return node.left if node.left is None: return node.right tmp = node node = self._min(tmp.right) node.right = self._delete_min(tmp.right) node.left = tmp.left node.num_nodes = self._size(node.left) + self._size(node.right) + 1 return node def _delete_min(self, node): if node.left is None: return node.right node.left = self._delete_min(node.left) node.num_nodes = self._size(node.left) + self._size(node.right) + 1 return node def _min(self, node): if node.left is None: return node return self._min(node.left) @property def size(self): return self._size(self.root) def _size(self, node): return node.size if node else 0 def serialize(self): height = self.height queue = deque([(self.root, 0)]) result = [] while len(queue) > 0: parent, level = queue.popleft() ret = parent and parent.key if level == -1: result.append(parent) continue result.append(ret) if level != height-1: if parent.left is None: queue.append((None, -1)) else: queue.append((parent.left, level+1)) if parent.right is None: queue.append((None, -1)) else: queue.append((parent.right, level+1)) return result @property def height(self): return self._height(self.root) def _height(self, node): if node is not None: if node.left is None and node.right is None: return 1 else: return 1 + max(self._height(node.left), self._height(node.right)) else: return 0 class _Node: def __init__(self, key, value, num_nodes): self.key = key self.value = value self.num_nodes = num_nodes self.left, self.right = None, None @property def size(self): return self.num_nodes
[ 1, 515, 16250, 1053, 316, 802, 13, 13, 13, 1990, 29479, 7974, 9643, 29901, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 1583, 29889, 4632, 353, 6213, 13, 13, 1678, 822, 679, 29898, 1311, 29892, 1820, 1125, 13, 4706, 736, 1583, 3032, 657, 29898, 1311, 29889, 4632, 29892, 1820, 29897, 13, 13, 1678, 822, 903, 657, 29898, 1311, 29892, 2943, 29892, 1820, 1125, 13, 4706, 565, 2943, 338, 6213, 29901, 13, 9651, 736, 6213, 13, 4706, 565, 1820, 529, 2943, 29889, 1989, 29901, 13, 9651, 736, 1583, 3032, 657, 29898, 3177, 29889, 1563, 29892, 1820, 29897, 13, 4706, 25342, 1820, 1405, 2943, 29889, 1989, 29901, 13, 9651, 736, 1583, 3032, 657, 29898, 3177, 29889, 1266, 29892, 1820, 29897, 13, 4706, 1683, 29901, 13, 9651, 736, 2943, 29889, 1767, 13, 13, 1678, 822, 1925, 29898, 1311, 29892, 1820, 29892, 995, 1125, 13, 4706, 1583, 29889, 4632, 353, 1583, 3032, 649, 29898, 1311, 29889, 4632, 29892, 1820, 29892, 995, 29897, 13, 13, 1678, 822, 903, 649, 29898, 1311, 29892, 2943, 29892, 1820, 29892, 995, 1125, 13, 4706, 565, 2943, 338, 6213, 29901, 13, 9651, 736, 903, 4247, 29898, 1989, 29892, 995, 29892, 29871, 29896, 29897, 13, 4706, 565, 1820, 529, 2943, 29889, 1989, 29901, 13, 9651, 2943, 29889, 1563, 353, 1583, 3032, 649, 29898, 3177, 29889, 1563, 29892, 1820, 29892, 995, 29897, 13, 4706, 25342, 1820, 1405, 2943, 29889, 1989, 29901, 13, 9651, 2943, 29889, 1266, 353, 1583, 3032, 649, 29898, 3177, 29889, 1266, 29892, 1820, 29892, 995, 29897, 13, 4706, 1683, 29901, 13, 9651, 2943, 29889, 1767, 353, 995, 13, 4706, 2943, 29889, 1949, 29918, 18010, 353, 1583, 3032, 2311, 29898, 3177, 29889, 1563, 29897, 718, 1583, 3032, 2311, 29898, 3177, 29889, 1266, 29897, 718, 29871, 29896, 13, 4706, 736, 2943, 13, 13, 1678, 822, 5217, 29898, 1311, 29892, 1820, 1125, 13, 4706, 1583, 29889, 4632, 353, 1583, 3032, 8143, 29898, 1311, 29889, 4632, 29892, 1820, 29897, 13, 13, 1678, 822, 903, 8143, 29898, 1311, 29892, 2943, 29892, 1820, 1125, 13, 4706, 565, 2943, 338, 6213, 29901, 13, 9651, 736, 6213, 13, 4706, 565, 1820, 529, 2943, 29889, 1989, 29901, 13, 9651, 2943, 29889, 1563, 353, 1583, 3032, 8143, 29898, 3177, 29889, 1563, 29892, 1820, 29897, 13, 4706, 25342, 1820, 1405, 2943, 29889, 1989, 29901, 13, 9651, 2943, 29889, 1266, 353, 1583, 3032, 8143, 29898, 3177, 29889, 1266, 29892, 1820, 29897, 13, 4706, 1683, 29901, 13, 9651, 565, 2943, 29889, 1266, 338, 6213, 29901, 13, 18884, 736, 2943, 29889, 1563, 13, 9651, 565, 2943, 29889, 1563, 338, 6213, 29901, 13, 18884, 736, 2943, 29889, 1266, 13, 9651, 13128, 353, 2943, 13, 9651, 2943, 353, 1583, 3032, 1195, 29898, 7050, 29889, 1266, 29897, 13, 9651, 2943, 29889, 1266, 353, 1583, 3032, 8143, 29918, 1195, 29898, 7050, 29889, 1266, 29897, 13, 9651, 2943, 29889, 1563, 353, 13128, 29889, 1563, 13, 4706, 2943, 29889, 1949, 29918, 18010, 353, 1583, 3032, 2311, 29898, 3177, 29889, 1563, 29897, 718, 1583, 3032, 2311, 29898, 3177, 29889, 1266, 29897, 718, 29871, 29896, 13, 4706, 736, 2943, 13, 13, 1678, 822, 903, 8143, 29918, 1195, 29898, 1311, 29892, 2943, 1125, 13, 4706, 565, 2943, 29889, 1563, 338, 6213, 29901, 13, 9651, 736, 2943, 29889, 1266, 13, 4706, 2943, 29889, 1563, 353, 1583, 3032, 8143, 29918, 1195, 29898, 3177, 29889, 1563, 29897, 13, 4706, 2943, 29889, 1949, 29918, 18010, 353, 1583, 3032, 2311, 29898, 3177, 29889, 1563, 29897, 718, 1583, 3032, 2311, 29898, 3177, 29889, 1266, 29897, 718, 29871, 29896, 13, 4706, 736, 2943, 13, 13, 1678, 822, 903, 1195, 29898, 1311, 29892, 2943, 1125, 13, 4706, 565, 2943, 29889, 1563, 338, 6213, 29901, 13, 9651, 736, 2943, 13, 4706, 736, 1583, 3032, 1195, 29898, 3177, 29889, 1563, 29897, 13, 13, 1678, 732, 6799, 13, 1678, 822, 2159, 29898, 1311, 1125, 13, 4706, 736, 1583, 3032, 2311, 29898, 1311, 29889, 4632, 29897, 13, 13, 1678, 822, 903, 2311, 29898, 1311, 29892, 2943, 1125, 13, 4706, 736, 2943, 29889, 2311, 565, 2943, 1683, 29871, 29900, 13, 13, 1678, 822, 28755, 29898, 1311, 1125, 13, 4706, 3171, 353, 1583, 29889, 3545, 13, 4706, 9521, 353, 316, 802, 4197, 29898, 1311, 29889, 4632, 29892, 29871, 29900, 29897, 2314, 13, 4706, 1121, 353, 5159, 13, 4706, 1550, 7431, 29898, 9990, 29897, 1405, 29871, 29900, 29901, 13, 9651, 3847, 29892, 3233, 353, 9521, 29889, 7323, 1563, 580, 13, 9651, 3240, 353, 3847, 322, 3847, 29889, 1989, 13, 9651, 565, 3233, 1275, 448, 29896, 29901, 13, 18884, 1121, 29889, 4397, 29898, 3560, 29897, 13, 18884, 6773, 13, 9651, 1121, 29889, 4397, 29898, 2267, 29897, 13, 9651, 565, 3233, 2804, 3171, 29899, 29896, 29901, 13, 18884, 565, 3847, 29889, 1563, 338, 6213, 29901, 13, 462, 1678, 9521, 29889, 4397, 3552, 8516, 29892, 448, 29896, 876, 13, 18884, 1683, 29901, 13, 462, 1678, 9521, 29889, 4397, 3552, 3560, 29889, 1563, 29892, 3233, 29974, 29896, 876, 13, 18884, 565, 3847, 29889, 1266, 338, 6213, 29901, 13, 462, 1678, 9521, 29889, 4397, 3552, 8516, 29892, 448, 29896, 876, 13, 18884, 1683, 29901, 13, 462, 1678, 9521, 29889, 4397, 3552, 3560, 29889, 1266, 29892, 3233, 29974, 29896, 876, 13, 13, 4706, 736, 1121, 13, 13, 1678, 732, 6799, 13, 1678, 822, 3171, 29898, 1311, 1125, 13, 4706, 736, 1583, 3032, 3545, 29898, 1311, 29889, 4632, 29897, 13, 13, 1678, 822, 903, 3545, 29898, 1311, 29892, 2943, 1125, 13, 4706, 565, 2943, 338, 451, 6213, 29901, 13, 9651, 565, 2943, 29889, 1563, 338, 6213, 322, 2943, 29889, 1266, 338, 6213, 29901, 13, 18884, 736, 29871, 29896, 13, 9651, 1683, 29901, 13, 18884, 736, 29871, 29896, 718, 4236, 29898, 1311, 3032, 3545, 29898, 3177, 29889, 1563, 511, 1583, 3032, 3545, 29898, 3177, 29889, 1266, 876, 13, 4706, 1683, 29901, 13, 9651, 736, 29871, 29900, 13, 13, 1990, 903, 4247, 29901, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1820, 29892, 995, 29892, 954, 29918, 18010, 1125, 13, 4706, 1583, 29889, 1989, 353, 1820, 13, 4706, 1583, 29889, 1767, 353, 995, 13, 4706, 1583, 29889, 1949, 29918, 18010, 353, 954, 29918, 18010, 13, 4706, 1583, 29889, 1563, 29892, 1583, 29889, 1266, 353, 6213, 29892, 6213, 13, 13, 1678, 732, 6799, 13, 1678, 822, 2159, 29898, 1311, 1125, 13, 4706, 736, 1583, 29889, 1949, 29918, 18010, 2 ]
pastebin/migrations/0006_auto_20170129_1502.py
johannessarpola/django-pastebin
0
47244
<reponame>johannessarpola/django-pastebin<filename>pastebin/migrations/0006_auto_20170129_1502.py<gh_stars>0 # -*- coding: utf-8 -*- # Generated by Django 1.11a1 on 2017-01-29 15:02 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('pastebin', '0005_auto_20170129_1333'), ] operations = [ migrations.AlterField( model_name='paste', name='creation_date', field=models.DateTimeField(verbose_name='creation date'), ), migrations.AlterField( model_name='paste', name='expiry_date', field=models.DateTimeField(verbose_name='expiration date'), ), ]
[ 1, 529, 276, 1112, 420, 29958, 29926, 1148, 812, 404, 6834, 2963, 29914, 14095, 29899, 16179, 2109, 29966, 9507, 29958, 16179, 2109, 29914, 26983, 800, 29914, 29900, 29900, 29900, 29953, 29918, 6921, 29918, 29906, 29900, 29896, 29955, 29900, 29896, 29906, 29929, 29918, 29896, 29945, 29900, 29906, 29889, 2272, 29966, 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, 29874, 29896, 373, 29871, 29906, 29900, 29896, 29955, 29899, 29900, 29896, 29899, 29906, 29929, 29871, 29896, 29945, 29901, 29900, 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, 16179, 2109, 742, 525, 29900, 29900, 29900, 29945, 29918, 6921, 29918, 29906, 29900, 29896, 29955, 29900, 29896, 29906, 29929, 29918, 29896, 29941, 29941, 29941, 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, 16179, 742, 13, 9651, 1024, 2433, 1037, 362, 29918, 1256, 742, 13, 9651, 1746, 29922, 9794, 29889, 11384, 3073, 29898, 369, 15828, 29918, 978, 2433, 1037, 362, 2635, 5477, 13, 4706, 10353, 13, 4706, 9725, 800, 29889, 2499, 357, 3073, 29898, 13, 9651, 1904, 29918, 978, 2433, 16179, 742, 13, 9651, 1024, 2433, 4548, 16129, 29918, 1256, 742, 13, 9651, 1746, 29922, 9794, 29889, 11384, 3073, 29898, 369, 15828, 29918, 978, 2433, 4548, 12232, 2635, 5477, 13, 4706, 10353, 13, 1678, 4514, 13, 2 ]
3_2_HelloWorld.py
Asurada2015/TensorFlowactual-combat_code
4
159118
<reponame>Asurada2015/TensorFlowactual-combat_code #%% # Copyright 2015 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================== from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets("MNIST_data/", one_hot=True) print(mnist.train.images.shape, mnist.train.labels.shape) print(mnist.test.images.shape, mnist.test.labels.shape) print(mnist.validation.images.shape, mnist.validation.labels.shape) """(55000, 784) (55000, 10) (10000, 784) (10000, 10) (5000, 784) (5000, 10)""" import tensorflow as tf sess = tf.InteractiveSession() x = tf.placeholder(tf.float32, [None, 784]) # 数据类型,数据的格式,none表示不限制输入数据的条目,784表示每条输入是一个784维的数据 # W = tf.Variable(tf.zeros([784, 10])) b = tf.Variable(tf.zeros([10])) y = tf.nn.softmax(tf.matmul(x, W) + b) # 关于这里二维数组和一维数组相加的事情,我还纠结了半天 y_ = tf.placeholder(tf.float32, [None, 10]) cross_entropy = tf.reduce_mean(-tf.reduce_sum(y_ * tf.log(y), reduction_indices=[1])) train_step = tf.train.GradientDescentOptimizer(0.5).minimize(cross_entropy) tf.global_variables_initializer().run() for i in range(1000): batch_xs, batch_ys = mnist.train.next_batch(100) train_step.run({x: batch_xs, y_: batch_ys}) correct_prediction = tf.equal(tf.argmax(y, 1), tf.argmax(y_, 1)) accuracy = tf.reduce_mean(tf.cast(correct_prediction, tf.float32)) print(accuracy.eval({x: mnist.test.images, y_: mnist.test.labels}))
[ 1, 529, 276, 1112, 420, 29958, 2887, 332, 1114, 29906, 29900, 29896, 29945, 29914, 29911, 6073, 17907, 19304, 29899, 510, 10222, 29918, 401, 13, 29937, 7686, 13, 29937, 14187, 1266, 29871, 29906, 29900, 29896, 29945, 450, 323, 6073, 17907, 13189, 943, 29889, 2178, 26863, 2538, 9841, 29889, 13, 29937, 13, 29937, 10413, 21144, 1090, 278, 13380, 19245, 29892, 10079, 29871, 29906, 29889, 29900, 313, 1552, 376, 29931, 293, 1947, 1496, 13, 29937, 366, 1122, 451, 671, 445, 934, 5174, 297, 752, 13036, 411, 278, 19245, 29889, 13, 29937, 887, 1122, 4017, 263, 3509, 310, 278, 19245, 472, 13, 29937, 13, 29937, 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, 1275, 9166, 9166, 9166, 9166, 4936, 2751, 13, 3166, 26110, 29889, 19057, 29889, 12631, 29879, 29889, 23521, 391, 1053, 1881, 29918, 1272, 13, 23521, 391, 353, 1881, 29918, 1272, 29889, 949, 29918, 1272, 29918, 7224, 703, 29924, 29940, 9047, 29918, 1272, 29914, 613, 697, 29918, 8711, 29922, 5574, 29897, 13, 13, 2158, 29898, 23521, 391, 29889, 14968, 29889, 8346, 29889, 12181, 29892, 28597, 391, 29889, 14968, 29889, 21134, 29889, 12181, 29897, 13, 2158, 29898, 23521, 391, 29889, 1688, 29889, 8346, 29889, 12181, 29892, 28597, 391, 29889, 1688, 29889, 21134, 29889, 12181, 29897, 13, 2158, 29898, 23521, 391, 29889, 18157, 29889, 8346, 29889, 12181, 29892, 28597, 391, 29889, 18157, 29889, 21134, 29889, 12181, 29897, 13, 15945, 29908, 29898, 29945, 29945, 29900, 29900, 29900, 29892, 29871, 29955, 29947, 29946, 29897, 313, 29945, 29945, 29900, 29900, 29900, 29892, 29871, 29896, 29900, 29897, 13, 259, 313, 29896, 29900, 29900, 29900, 29900, 29892, 29871, 29955, 29947, 29946, 29897, 313, 29896, 29900, 29900, 29900, 29900, 29892, 29871, 29896, 29900, 29897, 13, 259, 313, 29945, 29900, 29900, 29900, 29892, 29871, 29955, 29947, 29946, 29897, 313, 29945, 29900, 29900, 29900, 29892, 29871, 29896, 29900, 5513, 15945, 13, 5215, 26110, 408, 15886, 13, 29879, 404, 353, 15886, 29889, 4074, 4925, 7317, 580, 13, 29916, 353, 15886, 29889, 27074, 29898, 13264, 29889, 7411, 29941, 29906, 29892, 518, 8516, 29892, 29871, 29955, 29947, 29946, 2314, 13, 29937, 29871, 30354, 30763, 30832, 30883, 30214, 30354, 30763, 30210, 31168, 30607, 30214, 9290, 30746, 30858, 30413, 31175, 31072, 31573, 30752, 30354, 30763, 30210, 31217, 30895, 30214, 29955, 29947, 29946, 30746, 30858, 31951, 31217, 31573, 30752, 30392, 30287, 30502, 29955, 29947, 29946, 234, 190, 183, 30210, 30354, 30763, 13, 29937, 13, 29956, 353, 15886, 29889, 16174, 29898, 13264, 29889, 3298, 359, 4197, 29955, 29947, 29946, 29892, 29871, 29896, 29900, 12622, 13, 29890, 353, 15886, 29889, 16174, 29898, 13264, 29889, 3298, 359, 4197, 29896, 29900, 12622, 13, 29891, 353, 15886, 29889, 15755, 29889, 2695, 3317, 29898, 13264, 29889, 2922, 16109, 29898, 29916, 29892, 399, 29897, 718, 289, 29897, 29871, 396, 29871, 31057, 30909, 30810, 30755, 30685, 234, 190, 183, 30354, 31263, 30503, 30287, 234, 190, 183, 30354, 31263, 30990, 30666, 30210, 30745, 30993, 30214, 30672, 31994, 234, 189, 163, 31320, 30743, 232, 144, 141, 30408, 13, 13, 13, 29891, 29918, 353, 15886, 29889, 27074, 29898, 13264, 29889, 7411, 29941, 29906, 29892, 518, 8516, 29892, 29871, 29896, 29900, 2314, 13, 19128, 29918, 296, 14441, 353, 15886, 29889, 17469, 29918, 12676, 6278, 13264, 29889, 17469, 29918, 2083, 29898, 29891, 29918, 334, 15886, 29889, 1188, 29898, 29891, 511, 20376, 29918, 513, 1575, 11759, 29896, 12622, 13, 13, 14968, 29918, 10568, 353, 15886, 29889, 14968, 29889, 25584, 993, 4002, 1760, 20624, 326, 3950, 29898, 29900, 29889, 29945, 467, 1195, 326, 675, 29898, 19128, 29918, 296, 14441, 29897, 13, 13, 13264, 29889, 10945, 29918, 20897, 29918, 11228, 3950, 2141, 3389, 580, 13, 13, 1454, 474, 297, 3464, 29898, 29896, 29900, 29900, 29900, 1125, 13, 1678, 9853, 29918, 10351, 29892, 9853, 29918, 952, 353, 28597, 391, 29889, 14968, 29889, 4622, 29918, 16175, 29898, 29896, 29900, 29900, 29897, 13, 1678, 7945, 29918, 10568, 29889, 3389, 3319, 29916, 29901, 9853, 29918, 10351, 29892, 343, 29918, 29901, 9853, 29918, 952, 1800, 13, 13, 15728, 29918, 11965, 2463, 353, 15886, 29889, 11745, 29898, 13264, 29889, 1191, 3317, 29898, 29891, 29892, 29871, 29896, 511, 15886, 29889, 1191, 3317, 29898, 29891, 3383, 29871, 29896, 876, 13, 13, 562, 2764, 4135, 353, 15886, 29889, 17469, 29918, 12676, 29898, 13264, 29889, 4384, 29898, 15728, 29918, 11965, 2463, 29892, 15886, 29889, 7411, 29941, 29906, 876, 13, 13, 2158, 29898, 562, 2764, 4135, 29889, 14513, 3319, 29916, 29901, 28597, 391, 29889, 1688, 29889, 8346, 29892, 343, 29918, 29901, 28597, 391, 29889, 1688, 29889, 21134, 20073, 13, 2 ]
DQN DDQN Dueling/network.py
eayvali/DeepRL
2
21356
# -*- coding: utf-8 -*- """ Created on Sun Jan 19 23:19:43 2020 @author: elif.ayvali """ import torch import torch.nn as nn import torch.nn.functional as F from collections import OrderedDict class deep_Q_net(nn.Module): """Actor (Policy) Model.""" def __init__(self, state_size, action_size, seed): """Initialize parameters and build model. Params ====== state_size (int): Dimension of each state action_size (int): Dimension of each action seed (int): Random seed fc1_units (int): Number of nodes in first hidden layer fc2_units (int): Number of nodes in second hidden layer """ super(deep_Q_net, self).__init__() self.seed = torch.manual_seed(seed) self.dqn_net = nn.Sequential(OrderedDict([ ('fc1', nn.Linear(state_size, 256)), ('relu1', nn.ReLU()), ('fc2', nn.Linear(256, 128)), ('relu2', nn.ReLU()), ('fc3', nn.Linear(128, 64)), ('relu3', nn.ReLU()), ('fc4', nn.Linear(64, action_size)) ])) def forward(self, state): """Build a network that maps state -> action values.""" return self.dqn_net(state) class dueling_Q_net(nn.Module): """Actor (Policy) Model.""" def __init__(self, state_size, action_size, seed): """Params ====== state_size (int): Dimension of each state action_size (int): Dimension of each action seed (int): Random seed """ super(dueling_Q_net, self).__init__() self.feature_modules = nn.Sequential(OrderedDict([ ('fc1', nn.Linear(state_size, 256)), ('relu1', nn.ReLU()), ('fc2', nn.Linear(256, 128)), ('relu2', nn.ReLU()), ('fc3', nn.Linear(128, 64)), ])) self.value_modules = nn.Sequential(OrderedDict([ ('fc_v1', nn.Linear(64, 32)), ('relu)v1', nn.ReLU()), ('fc_v2', nn.Linear(32, 1)), ])) self.advantage_modules = nn.Sequential(OrderedDict([ ('fc_a1', nn.Linear(64, 32)), ('relu_a1', nn.ReLU()), ('fc_a2', nn.Linear(32, action_size)), ])) def forward(self, state): #Get common features common_layers=self.feature_modules(state) advantage=self.advantage_modules(common_layers)# batch_size x action_size value=self.value_modules(common_layers) #batch_size x 1 return value + advantage - advantage.mean(dim=1).unsqueeze(1)
[ 1, 396, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 15945, 29908, 13, 20399, 373, 8991, 2627, 29871, 29896, 29929, 29871, 29906, 29941, 29901, 29896, 29929, 29901, 29946, 29941, 29871, 29906, 29900, 29906, 29900, 13, 13, 29992, 8921, 29901, 25342, 29889, 388, 791, 29875, 13, 15945, 29908, 13, 13, 5215, 4842, 305, 13, 5215, 4842, 305, 29889, 15755, 408, 302, 29876, 13, 5215, 4842, 305, 29889, 15755, 29889, 2220, 284, 408, 383, 13, 3166, 16250, 1053, 8170, 287, 21533, 13, 13, 13, 1990, 6483, 29918, 29984, 29918, 1212, 29898, 15755, 29889, 7355, 1125, 13, 1678, 9995, 29909, 2801, 313, 15644, 29897, 8125, 1213, 15945, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 2106, 29918, 2311, 29892, 3158, 29918, 2311, 29892, 16717, 1125, 13, 4706, 9995, 6644, 6646, 4128, 322, 2048, 1904, 29889, 13, 4706, 1459, 2232, 13, 4706, 1275, 2751, 13, 9651, 2106, 29918, 2311, 313, 524, 1125, 4792, 2673, 310, 1269, 2106, 13, 9651, 3158, 29918, 2311, 313, 524, 1125, 4792, 2673, 310, 1269, 3158, 13, 9651, 16717, 313, 524, 1125, 16968, 16717, 13, 9651, 285, 29883, 29896, 29918, 348, 1169, 313, 524, 1125, 9681, 310, 7573, 297, 937, 7934, 7546, 13, 9651, 285, 29883, 29906, 29918, 348, 1169, 313, 524, 1125, 9681, 310, 7573, 297, 1473, 7934, 7546, 13, 4706, 9995, 13, 4706, 2428, 29898, 24535, 29918, 29984, 29918, 1212, 29892, 1583, 467, 1649, 2344, 1649, 580, 13, 4706, 1583, 29889, 26776, 353, 4842, 305, 29889, 11288, 29918, 26776, 29898, 26776, 29897, 13, 1669, 13, 4706, 1583, 29889, 29881, 29939, 29876, 29918, 1212, 353, 302, 29876, 29889, 16941, 2556, 29898, 7514, 287, 21533, 4197, 13, 18884, 6702, 13801, 29896, 742, 302, 29876, 29889, 12697, 29898, 3859, 29918, 2311, 29892, 29871, 29906, 29945, 29953, 8243, 13, 18884, 6702, 2674, 29884, 29896, 742, 302, 29876, 29889, 1123, 29931, 29965, 25739, 13, 18884, 6702, 13801, 29906, 742, 302, 29876, 29889, 12697, 29898, 29906, 29945, 29953, 29892, 29871, 29896, 29906, 29947, 8243, 13, 18884, 6702, 2674, 29884, 29906, 742, 302, 29876, 29889, 1123, 29931, 29965, 25739, 13, 18884, 6702, 13801, 29941, 742, 302, 29876, 29889, 12697, 29898, 29896, 29906, 29947, 29892, 29871, 29953, 29946, 8243, 13, 18884, 6702, 2674, 29884, 29941, 742, 302, 29876, 29889, 1123, 29931, 29965, 25739, 13, 18884, 6702, 13801, 29946, 742, 302, 29876, 29889, 12697, 29898, 29953, 29946, 29892, 3158, 29918, 2311, 876, 13, 18884, 4514, 876, 4706, 13, 13, 13, 1678, 822, 6375, 29898, 1311, 29892, 2106, 1125, 13, 4706, 9995, 8893, 263, 3564, 393, 11053, 2106, 1599, 3158, 1819, 1213, 15945, 13, 4706, 736, 1583, 29889, 29881, 29939, 29876, 29918, 1212, 29898, 3859, 29897, 13, 13, 13, 13, 1990, 868, 14067, 29918, 29984, 29918, 1212, 29898, 15755, 29889, 7355, 1125, 13, 1678, 9995, 29909, 2801, 313, 15644, 29897, 8125, 1213, 15945, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 2106, 29918, 2311, 29892, 3158, 29918, 2311, 29892, 16717, 1125, 13, 4706, 9995, 9629, 13, 4706, 1275, 2751, 13, 9651, 2106, 29918, 2311, 313, 524, 1125, 4792, 2673, 310, 1269, 2106, 13, 9651, 3158, 29918, 2311, 313, 524, 1125, 4792, 2673, 310, 1269, 3158, 13, 9651, 16717, 313, 524, 1125, 16968, 16717, 13, 4706, 9995, 13, 4706, 2428, 29898, 700, 14067, 29918, 29984, 29918, 1212, 29892, 1583, 467, 1649, 2344, 1649, 580, 13, 632, 13, 4706, 1583, 29889, 14394, 29918, 7576, 353, 302, 29876, 29889, 16941, 2556, 29898, 7514, 287, 21533, 4197, 13, 4706, 6702, 13801, 29896, 742, 302, 29876, 29889, 12697, 29898, 3859, 29918, 2311, 29892, 29871, 29906, 29945, 29953, 8243, 13, 4706, 6702, 2674, 29884, 29896, 742, 302, 29876, 29889, 1123, 29931, 29965, 25739, 13, 4706, 6702, 13801, 29906, 742, 302, 29876, 29889, 12697, 29898, 29906, 29945, 29953, 29892, 29871, 29896, 29906, 29947, 8243, 13, 4706, 6702, 2674, 29884, 29906, 742, 302, 29876, 29889, 1123, 29931, 29965, 25739, 13, 4706, 6702, 13801, 29941, 742, 302, 29876, 29889, 12697, 29898, 29896, 29906, 29947, 29892, 29871, 29953, 29946, 8243, 13, 4706, 4514, 876, 4706, 13, 13, 4706, 1583, 29889, 1767, 29918, 7576, 353, 302, 29876, 29889, 16941, 2556, 29898, 7514, 287, 21533, 4197, 13, 4706, 6702, 13801, 29918, 29894, 29896, 742, 302, 29876, 29889, 12697, 29898, 29953, 29946, 29892, 29871, 29941, 29906, 8243, 13, 4706, 6702, 2674, 29884, 29897, 29894, 29896, 742, 302, 29876, 29889, 1123, 29931, 29965, 25739, 308, 13, 4706, 6702, 13801, 29918, 29894, 29906, 742, 302, 29876, 29889, 12697, 29898, 29941, 29906, 29892, 29871, 29896, 8243, 13, 4706, 4514, 876, 4706, 13, 13, 4706, 1583, 29889, 17263, 8501, 29918, 7576, 353, 302, 29876, 29889, 16941, 2556, 29898, 7514, 287, 21533, 4197, 13, 4706, 6702, 13801, 29918, 29874, 29896, 742, 302, 29876, 29889, 12697, 29898, 29953, 29946, 29892, 29871, 29941, 29906, 8243, 13, 4706, 6702, 2674, 29884, 29918, 29874, 29896, 742, 302, 29876, 29889, 1123, 29931, 29965, 25739, 4706, 13, 4706, 6702, 13801, 29918, 29874, 29906, 742, 302, 29876, 29889, 12697, 29898, 29941, 29906, 29892, 3158, 29918, 2311, 8243, 13, 4706, 4514, 876, 4706, 13, 268, 13, 13, 1678, 822, 6375, 29898, 1311, 29892, 2106, 1125, 13, 4706, 396, 2577, 3619, 5680, 13, 4706, 3619, 29918, 29277, 29922, 1311, 29889, 14394, 29918, 7576, 29898, 3859, 29897, 13, 4706, 10631, 29922, 1311, 29889, 17263, 8501, 29918, 7576, 29898, 9435, 29918, 29277, 29897, 29937, 9853, 29918, 2311, 921, 3158, 29918, 2311, 13, 4706, 995, 29922, 1311, 29889, 1767, 29918, 7576, 29898, 9435, 29918, 29277, 29897, 396, 16175, 29918, 2311, 921, 29871, 29896, 29871, 13, 4706, 736, 995, 718, 10631, 448, 10631, 29889, 12676, 29898, 6229, 29922, 29896, 467, 6948, 802, 29872, 911, 29898, 29896, 29897, 13, 2 ]
javascript/forms.py
uadson/studies
0
99561
<reponame>uadson/studies<gh_stars>0 from django import forms class CalcImcForm(forms.Form): peso = forms.CharField( required=False) altura = forms.CharField( required=False)
[ 1, 529, 276, 1112, 420, 29958, 29884, 328, 1100, 29914, 18082, 583, 29966, 12443, 29918, 303, 1503, 29958, 29900, 13, 3166, 9557, 1053, 7190, 13, 13, 1990, 3037, 29883, 1888, 29883, 2500, 29898, 9514, 29889, 2500, 1125, 13, 1678, 8928, 29877, 353, 7190, 29889, 27890, 29898, 13, 4706, 3734, 29922, 8824, 29897, 13, 1678, 5272, 2002, 353, 7190, 29889, 27890, 29898, 13, 4706, 3734, 29922, 8824, 29897, 2 ]
src/bot/handlers/essence_part_handler.py
nchursin/claimant
3
34211
from typing import Optional, List from aiogram import types, Dispatcher, filters from aiogram.dispatcher import FSMContext from aiogram.dispatcher.filters.state import StatesGroup, State from aiogram.types import ReplyKeyboardMarkup from handlers.common_actions_handlers import process_manual_enter, process_option_selection, \ process_complete_part_editing, claim_tmp_option_chosen, show_claim_tmp_example from keyboards import emojis, get_common_start_kb, get_next_actions_kb, get_claim_parts_kb from repository import Repository from statistics import collect_statistic CLAIM_PART: str = "essence" class EssencePart(StatesGroup): waiting_for_user_action = State() waiting_for_option_chosen = State() @collect_statistic(event_name="essence:start") async def essence_start(message: types.Message, state: FSMContext): repository: Repository = Repository() claim_data: dict = repository.get_claim_data(message.from_user.id) required_parts: List[str] = ["story"] if claim_data.get("claim_data") is None or \ not any([part_name in claim_data["claim_data"].keys() for part_name in required_parts]): claim_parts_kb: ReplyKeyboardMarkup = get_claim_parts_kb(message.from_user.id) await message.reply("Пожалуйста, сперва заполните раздел 'фабула'.", reply_markup=claim_parts_kb) return await EssencePart.waiting_for_user_action.set() start_kb: ReplyKeyboardMarkup = get_common_start_kb() await message.reply("Опишите суть нарушения. " "Введите, почему вы считаете, что ваши права нарушают. " "Или выберите одну из следующий опций.", reply_markup=start_kb) @collect_statistic(event_name="essence:show_example") async def show_example(message: types.Message, state: FSMContext): await show_claim_tmp_example(message, CLAIM_PART) async def action_selected(message: types.Message, state: FSMContext): option: Optional[str] = message.text if option.endswith("выбрать из списка") or option.endswith("добавить еще из списка"): await process_option_selection(message, CLAIM_PART, EssencePart) return if option.endswith("закончить заполнение"): await process_complete_part_editing(message, state, CLAIM_PART) return await process_manual_enter(message, state, EssencePart) async def option_chosen(callback_query: types.CallbackQuery, state: FSMContext): await claim_tmp_option_chosen(callback_query, state, CLAIM_PART) async def finish_option_choosing(callback_query: types.CallbackQuery): await callback_query.answer() await EssencePart.waiting_for_user_action.set() next_actions_kb: ReplyKeyboardMarkup = get_next_actions_kb() await callback_query.message.answer("Введите свой вариант самостоятельно. " "Или выберите дальнейшее действие с помощью клавиатуры", reply_markup=next_actions_kb) def register_handlers(dp: Dispatcher): dp.register_message_handler(essence_start, filters.Regexp(f"^{emojis.key} суть нарушения")) dp.register_message_handler(show_example, filters.Regexp(f"^{emojis.red_question_mark} показать пример"), state=EssencePart.states) dp.register_message_handler(action_selected, state=EssencePart.waiting_for_user_action) dp.register_callback_query_handler( option_chosen, filters.Text(startswith="option"), state=EssencePart.waiting_for_option_chosen ) dp.register_callback_query_handler(finish_option_choosing, filters.Text(equals="complete options"), state=EssencePart.waiting_for_option_chosen)
[ 1, 515, 19229, 1053, 28379, 29892, 2391, 13, 13, 3166, 7468, 13342, 1053, 4072, 29892, 3295, 5041, 261, 29892, 18094, 13, 3166, 7468, 13342, 29889, 13369, 261, 1053, 383, 17061, 2677, 13, 3166, 7468, 13342, 29889, 13369, 261, 29889, 26705, 29889, 3859, 1053, 3900, 4782, 29892, 4306, 13, 3166, 7468, 13342, 29889, 8768, 1053, 10088, 368, 2558, 3377, 9802, 786, 13, 13, 3166, 25795, 29889, 9435, 29918, 7387, 29918, 3179, 9306, 1053, 1889, 29918, 11288, 29918, 5893, 29892, 1889, 29918, 3385, 29918, 21731, 29892, 320, 13, 1678, 1889, 29918, 8835, 29918, 1595, 29918, 5628, 292, 29892, 5995, 29918, 7050, 29918, 3385, 29918, 305, 7749, 29892, 1510, 29918, 29883, 8342, 29918, 7050, 29918, 4773, 13, 3166, 1820, 24691, 1053, 953, 3848, 275, 29892, 679, 29918, 9435, 29918, 2962, 29918, 21066, 29892, 679, 29918, 4622, 29918, 7387, 29918, 21066, 29892, 679, 29918, 29883, 8342, 29918, 20895, 29918, 21066, 13, 3166, 9810, 1053, 830, 7036, 13, 3166, 13964, 1053, 6314, 29918, 6112, 4695, 13, 13, 13875, 7833, 29918, 26092, 29901, 851, 353, 376, 404, 663, 29908, 13, 13, 13, 1990, 11044, 663, 7439, 29898, 855, 1078, 4782, 1125, 13, 1678, 10534, 29918, 1454, 29918, 1792, 29918, 2467, 353, 4306, 580, 13, 1678, 10534, 29918, 1454, 29918, 3385, 29918, 305, 7749, 353, 4306, 580, 13, 13, 13, 29992, 15914, 29918, 6112, 4695, 29898, 3696, 29918, 978, 543, 404, 663, 29901, 2962, 1159, 13, 12674, 822, 3686, 663, 29918, 2962, 29898, 4906, 29901, 4072, 29889, 3728, 29892, 2106, 29901, 383, 17061, 2677, 1125, 13, 1678, 9810, 29901, 830, 7036, 353, 830, 7036, 580, 13, 1678, 5995, 29918, 1272, 29901, 9657, 353, 9810, 29889, 657, 29918, 29883, 8342, 29918, 1272, 29898, 4906, 29889, 3166, 29918, 1792, 29889, 333, 29897, 13, 1678, 3734, 29918, 20895, 29901, 2391, 29961, 710, 29962, 353, 6796, 24098, 3108, 13, 1678, 565, 5995, 29918, 1272, 29889, 657, 703, 29883, 8342, 29918, 1272, 1159, 338, 6213, 470, 320, 13, 9651, 451, 738, 4197, 1595, 29918, 978, 297, 5995, 29918, 1272, 3366, 29883, 8342, 29918, 1272, 16862, 8149, 580, 363, 760, 29918, 978, 297, 3734, 29918, 20895, 29962, 1125, 13, 4706, 5995, 29918, 20895, 29918, 21066, 29901, 10088, 368, 2558, 3377, 9802, 786, 353, 679, 29918, 29883, 8342, 29918, 20895, 29918, 21066, 29898, 4906, 29889, 3166, 29918, 1792, 29889, 333, 29897, 13, 4706, 7272, 2643, 29889, 3445, 368, 703, 20093, 2711, 1844, 29977, 1229, 29892, 531, 7043, 846, 1077, 9518, 12897, 3212, 1216, 29944, 525, 8685, 3378, 684, 4286, 613, 13, 462, 9651, 8908, 29918, 3502, 786, 29922, 29883, 8342, 29918, 20895, 29918, 21066, 29897, 13, 4706, 736, 13, 13, 1678, 7272, 11044, 663, 7439, 29889, 10685, 292, 29918, 1454, 29918, 1792, 29918, 2467, 29889, 842, 580, 13, 1678, 1369, 29918, 21066, 29901, 10088, 368, 2558, 3377, 9802, 786, 353, 679, 29918, 9435, 29918, 2962, 29918, 21066, 580, 13, 1678, 7272, 2643, 29889, 3445, 368, 703, 30038, 1668, 1911, 730, 3404, 1413, 665, 1086, 16789, 29889, 376, 13, 462, 4706, 376, 30012, 1521, 956, 730, 29892, 733, 1093, 1805, 2771, 25354, 29919, 730, 29892, 4281, 8935, 1911, 23172, 665, 1086, 4604, 4394, 29889, 376, 13, 462, 4706, 376, 30054, 644, 2771, 3759, 23314, 3288, 1864, 1866, 19139, 16059, 10645, 15071, 19602, 13, 462, 4706, 8908, 29918, 3502, 786, 29922, 2962, 29918, 21066, 29897, 13, 13, 13, 29992, 15914, 29918, 6112, 4695, 29898, 3696, 29918, 978, 543, 404, 663, 29901, 4294, 29918, 4773, 1159, 13, 12674, 822, 1510, 29918, 4773, 29898, 4906, 29901, 4072, 29889, 3728, 29892, 2106, 29901, 383, 17061, 2677, 1125, 13, 1678, 7272, 1510, 29918, 29883, 8342, 29918, 7050, 29918, 4773, 29898, 4906, 29892, 315, 4375, 7833, 29918, 26092, 29897, 13, 13, 13, 12674, 822, 3158, 29918, 8391, 29898, 4906, 29901, 4072, 29889, 3728, 29892, 2106, 29901, 383, 17061, 2677, 1125, 13, 1678, 2984, 29901, 28379, 29961, 710, 29962, 353, 2643, 29889, 726, 13, 1678, 565, 2984, 29889, 1975, 2541, 703, 4938, 8355, 1413, 1866, 27768, 2494, 1159, 470, 2984, 29889, 1975, 2541, 703, 1802, 3102, 1221, 1413, 1694, 2402, 1866, 27768, 2494, 29908, 1125, 13, 4706, 7272, 1889, 29918, 3385, 29918, 21731, 29898, 4906, 29892, 315, 4375, 7833, 29918, 26092, 29892, 11044, 663, 7439, 29897, 13, 4706, 736, 13, 1678, 565, 2984, 29889, 1975, 2541, 703, 1902, 6587, 1499, 1413, 1077, 9518, 16990, 29908, 1125, 13, 4706, 7272, 1889, 29918, 8835, 29918, 1595, 29918, 5628, 292, 29898, 4906, 29892, 2106, 29892, 315, 4375, 7833, 29918, 26092, 29897, 13, 4706, 736, 13, 13, 1678, 7272, 1889, 29918, 11288, 29918, 5893, 29898, 4906, 29892, 2106, 29892, 11044, 663, 7439, 29897, 13, 13, 13, 12674, 822, 2984, 29918, 305, 7749, 29898, 14035, 29918, 1972, 29901, 4072, 29889, 10717, 3010, 29892, 2106, 29901, 383, 17061, 2677, 1125, 13, 1678, 7272, 5995, 29918, 7050, 29918, 3385, 29918, 305, 7749, 29898, 14035, 29918, 1972, 29892, 2106, 29892, 315, 4375, 7833, 29918, 26092, 29897, 13, 13, 13, 12674, 822, 8341, 29918, 3385, 29918, 1859, 14556, 29898, 14035, 29918, 1972, 29901, 4072, 29889, 10717, 3010, 1125, 13, 1678, 7272, 6939, 29918, 1972, 29889, 12011, 580, 13, 1678, 7272, 11044, 663, 7439, 29889, 10685, 292, 29918, 1454, 29918, 1792, 29918, 2467, 29889, 842, 580, 13, 1678, 2446, 29918, 7387, 29918, 21066, 29901, 10088, 368, 2558, 3377, 9802, 786, 353, 679, 29918, 4622, 29918, 7387, 29918, 21066, 580, 13, 1678, 7272, 6939, 29918, 1972, 29889, 4906, 29889, 12011, 703, 30012, 1521, 956, 730, 24913, 8935, 641, 745, 29932, 8761, 6428, 13735, 29889, 376, 13, 462, 462, 4706, 376, 30054, 644, 2771, 3759, 23314, 3574, 693, 8150, 29656, 20046, 29919, 531, 24794, 9860, 9955, 21252, 15934, 613, 13, 462, 462, 4706, 8908, 29918, 3502, 786, 29922, 4622, 29918, 7387, 29918, 21066, 29897, 13, 13, 13, 1753, 6036, 29918, 3179, 9306, 29898, 6099, 29901, 3295, 5041, 261, 1125, 13, 1678, 270, 29886, 29889, 9573, 29918, 4906, 29918, 13789, 29898, 404, 663, 29918, 2962, 29892, 18094, 29889, 4597, 4548, 29898, 29888, 29908, 998, 331, 3848, 275, 29889, 1989, 29913, 3404, 1413, 665, 1086, 16789, 5783, 13, 1678, 270, 29886, 29889, 9573, 29918, 4906, 29918, 13789, 29898, 4294, 29918, 4773, 29892, 13, 462, 18884, 18094, 29889, 4597, 4548, 29898, 29888, 29908, 998, 331, 3848, 275, 29889, 1127, 29918, 12470, 29918, 3502, 29913, 25511, 1413, 1695, 5508, 4968, 13, 462, 18884, 2106, 29922, 29923, 893, 663, 7439, 29889, 28631, 29897, 13, 1678, 270, 29886, 29889, 9573, 29918, 4906, 29918, 13789, 29898, 2467, 29918, 8391, 29892, 2106, 29922, 29923, 893, 663, 7439, 29889, 10685, 292, 29918, 1454, 29918, 1792, 29918, 2467, 29897, 13, 1678, 270, 29886, 29889, 9573, 29918, 14035, 29918, 1972, 29918, 13789, 29898, 13, 4706, 2984, 29918, 305, 7749, 29892, 13, 4706, 18094, 29889, 1626, 29898, 27382, 2541, 543, 3385, 4968, 13, 4706, 2106, 29922, 29923, 893, 663, 7439, 29889, 10685, 292, 29918, 1454, 29918, 3385, 29918, 305, 7749, 13, 1678, 1723, 13, 13, 1678, 270, 29886, 29889, 9573, 29918, 14035, 29918, 1972, 29918, 13789, 29898, 4951, 728, 29918, 3385, 29918, 1859, 14556, 29892, 13, 462, 462, 539, 18094, 29889, 1626, 29898, 10954, 543, 8835, 3987, 4968, 13, 462, 462, 539, 2106, 29922, 29923, 893, 663, 7439, 29889, 10685, 292, 29918, 1454, 29918, 3385, 29918, 305, 7749, 29897, 13, 2 ]
piccel/ui/__init__.py
lesca-research/piccel
2
188313
from .generated import access_ui from .generated import data_sheet_ui from .generated import form_item_ui from .generated import form_ui from .generated import item_boolean_checkboxes_ui from .generated import item_choice_radio_ui from .generated import item_datetime_ui from .generated import item_single_line_ui from .generated import item_text_multi_line_ui from .generated import login_ui from .generated import progress_bar_ui from .generated import resources from .generated import section_ui from .generated import selector_ui from .generated import text_editor_ui from .generated import workbook_ui from .generated import workbook_creation_ui from .generated import sheet_creation_ui # from .generated import dynamic_vlist_ui # from .generated import dynamic_vlist_item_ui from .generated import form_editor_widget_ui from .generated import form_editor_file_ui from .generated import form_editor_sheet_ui from .generated import form_edit_ui from .generated import section_edit_ui from .generated import item_edit_ui from .generated import choice_edit_ui from .generated import variable_edit_ui from .generated import section_transition_edit_ui from . import widgets from . import main_qss
[ 1, 515, 869, 13525, 1053, 2130, 29918, 1481, 13, 3166, 869, 13525, 1053, 848, 29918, 9855, 29918, 1481, 13, 3166, 869, 13525, 1053, 883, 29918, 667, 29918, 1481, 13, 3166, 869, 13525, 1053, 883, 29918, 1481, 13, 3166, 869, 13525, 1053, 2944, 29918, 20054, 29918, 12348, 267, 29918, 1481, 13, 3166, 869, 13525, 1053, 2944, 29918, 16957, 29918, 13399, 29918, 1481, 13, 3166, 869, 13525, 1053, 2944, 29918, 12673, 29918, 1481, 13, 3166, 869, 13525, 1053, 2944, 29918, 14369, 29918, 1220, 29918, 1481, 13, 3166, 869, 13525, 1053, 2944, 29918, 726, 29918, 9910, 29918, 1220, 29918, 1481, 13, 3166, 869, 13525, 1053, 6464, 29918, 1481, 13, 3166, 869, 13525, 1053, 6728, 29918, 1646, 29918, 1481, 13, 3166, 869, 13525, 1053, 7788, 13, 3166, 869, 13525, 1053, 4004, 29918, 1481, 13, 3166, 869, 13525, 1053, 11764, 29918, 1481, 13, 3166, 869, 13525, 1053, 1426, 29918, 15204, 29918, 1481, 13, 3166, 869, 13525, 1053, 664, 2909, 29918, 1481, 13, 3166, 869, 13525, 1053, 664, 2909, 29918, 1037, 362, 29918, 1481, 13, 3166, 869, 13525, 1053, 9869, 29918, 1037, 362, 29918, 1481, 13, 29937, 515, 869, 13525, 1053, 7343, 29918, 29894, 1761, 29918, 1481, 13, 29937, 515, 869, 13525, 1053, 7343, 29918, 29894, 1761, 29918, 667, 29918, 1481, 13, 3166, 869, 13525, 1053, 883, 29918, 15204, 29918, 8030, 29918, 1481, 13, 3166, 869, 13525, 1053, 883, 29918, 15204, 29918, 1445, 29918, 1481, 13, 3166, 869, 13525, 1053, 883, 29918, 15204, 29918, 9855, 29918, 1481, 13, 3166, 869, 13525, 1053, 883, 29918, 5628, 29918, 1481, 13, 3166, 869, 13525, 1053, 4004, 29918, 5628, 29918, 1481, 13, 3166, 869, 13525, 1053, 2944, 29918, 5628, 29918, 1481, 13, 3166, 869, 13525, 1053, 7348, 29918, 5628, 29918, 1481, 13, 3166, 869, 13525, 1053, 2286, 29918, 5628, 29918, 1481, 13, 3166, 869, 13525, 1053, 4004, 29918, 20543, 29918, 5628, 29918, 1481, 13, 3166, 869, 1053, 11109, 29879, 13, 3166, 869, 1053, 1667, 29918, 29939, 893, 13, 2 ]
locan/data/hulls/__init__.py
super-resolution/Locan
8
9558
<filename>locan/data/hulls/__init__.py """ Hull objects of localization data. Submodules: ----------- .. autosummary:: :toctree: ./ hull alpha_shape """ from locan.data.hulls.alpha_shape import * from locan.data.hulls.hull import * __all__ = [] __all__.extend(hull.__all__) __all__.extend(alpha_shape.__all__)
[ 1, 529, 9507, 29958, 2029, 273, 29914, 1272, 29914, 29882, 913, 29879, 29914, 1649, 2344, 26914, 2272, 13, 15945, 29908, 13, 29950, 913, 3618, 310, 1887, 2133, 848, 29889, 13, 13, 4035, 7576, 29901, 13, 1378, 5634, 13, 13, 636, 1120, 359, 398, 5219, 1057, 13, 259, 584, 517, 312, 929, 29901, 11431, 13, 13, 259, 298, 913, 13, 259, 15595, 29918, 12181, 13, 13, 15945, 29908, 13, 13, 3166, 1180, 273, 29889, 1272, 29889, 29882, 913, 29879, 29889, 2312, 29918, 12181, 1053, 334, 13, 3166, 1180, 273, 29889, 1272, 29889, 29882, 913, 29879, 29889, 29882, 913, 1053, 334, 13, 13, 1649, 497, 1649, 353, 5159, 13, 1649, 497, 26914, 21843, 29898, 29882, 913, 17255, 497, 1649, 29897, 13, 1649, 497, 26914, 21843, 29898, 2312, 29918, 12181, 17255, 497, 1649, 29897, 13, 2 ]
09-PiDay2022/IBM_quantum_randomness.py
StrangeGirlMurph/CodingProjects
0
175546
from qiskit import * from qiskit import IBMQ from qiskit.tools.monitor import job_monitor from qiskit.providers.ibmq import least_busy def random_qubit(): IBMQ.load_account() provider = IBMQ.get_provider("ibm-q") small_devices = provider.backends( filters=lambda x: x.configuration().n_qubits == 5 and not x.configuration().simulator ) qcomp = least_busy(small_devices) qr = QuantumRegister(1) cr = ClassicalRegister(1) circuit = QuantumCircuit(qr, cr) circuit.h(0) circuit.measure(0, 0) job = execute(circuit, backend=qcomp, shots=1) job_monitor(job) return str(list(job.result().get_counts().keys())[0]) print(random_qubit())
[ 1, 515, 3855, 3873, 277, 1053, 334, 13, 3166, 3855, 3873, 277, 1053, 15731, 25566, 13, 3166, 3855, 3873, 277, 29889, 8504, 29889, 3712, 2105, 1053, 4982, 29918, 3712, 2105, 13, 3166, 3855, 3873, 277, 29889, 771, 29454, 29889, 747, 28466, 1053, 3203, 29918, 8262, 29891, 13, 13, 13, 1753, 4036, 29918, 339, 2966, 7295, 13, 1678, 15731, 25566, 29889, 1359, 29918, 10149, 580, 13, 1678, 13113, 353, 15731, 25566, 29889, 657, 29918, 18121, 703, 29690, 29899, 29939, 1159, 13, 13, 1678, 2319, 29918, 3359, 1575, 353, 13113, 29889, 1627, 1975, 29898, 13, 4706, 18094, 29922, 2892, 921, 29901, 921, 29889, 13305, 2141, 29876, 29918, 339, 14836, 1275, 29871, 29945, 13, 4706, 322, 451, 921, 29889, 13305, 2141, 3601, 9183, 13, 1678, 1723, 13, 1678, 3855, 2388, 353, 3203, 29918, 8262, 29891, 29898, 9278, 29918, 3359, 1575, 29897, 13, 13, 1678, 3855, 29878, 353, 22746, 398, 15213, 29898, 29896, 29897, 13, 1678, 2181, 353, 4134, 936, 15213, 29898, 29896, 29897, 13, 1678, 11369, 353, 22746, 398, 23495, 3121, 29898, 29939, 29878, 29892, 2181, 29897, 13, 13, 1678, 11369, 29889, 29882, 29898, 29900, 29897, 13, 1678, 11369, 29889, 26658, 29898, 29900, 29892, 29871, 29900, 29897, 13, 13, 1678, 4982, 353, 6222, 29898, 6034, 3121, 29892, 14998, 29922, 29939, 2388, 29892, 528, 1862, 29922, 29896, 29897, 13, 1678, 4982, 29918, 3712, 2105, 29898, 9057, 29897, 13, 13, 1678, 736, 851, 29898, 1761, 29898, 9057, 29889, 2914, 2141, 657, 29918, 2798, 29879, 2141, 8149, 3101, 29961, 29900, 2314, 13, 13, 13, 2158, 29898, 8172, 29918, 339, 2966, 3101, 13, 2 ]
moredata/enricher/elasticsearch_connector/__init__.py
thomassonobe/more-data
0
57654
from .elasticsearch_connector import * from .index_handler import * from .policy_handler import *
[ 1, 515, 869, 295, 20291, 29918, 11958, 2801, 1053, 334, 13, 3166, 869, 2248, 29918, 13789, 1053, 334, 13, 3166, 869, 22197, 29918, 13789, 1053, 334, 13, 2 ]
scripts/03_glove_build_counts.py
svlandeg/sense2vec
1,140
124120
<reponame>svlandeg/sense2vec<gh_stars>1000+ #!/usr/bin/env python import os from pathlib import Path from wasabi import msg import typer def main( # fmt: off glove_dir: str = typer.Argument(..., help="Directory containing the GloVe build"), in_dir: str = typer.Argument(..., help="Directory with preprocessed .s2v files"), out_dir: str = typer.Argument(..., help="Path to output directory"), min_count: int = typer.Option(5, "--min-count", "-c", help="Minimum count for inclusion in vocab"), memory: float = typer.Option(4.0, "--memory", "-m", help="Soft limit for memory consumption, in GB"), window_size: int = typer.Option(15, "--window-size", "-w", help="Number of context words on either side"), verbose: int = typer.Option(2, "--verbose", "-v", help="Set verbosity: 0, 1, or 2"), # fmt: on ): """ Step 3: Build vocabulary and frequency counts Expects a directory of preprocessed .s2v input files and will use GloVe to collect unigram counts and construct and shuffle cooccurrence data. See here for installation instructions: https://github.com/stanfordnlp/GloVe Note that this script will call into GloVe and expects you to pass in the GloVe build directory (/build if you run the Makefile). The commands will also be printed if you want to run them separately. """ input_path = Path(in_dir) output_path = Path(out_dir) if not Path(glove_dir).exists(): msg.fail("Can't find GloVe build directory", glove_dir, exits=1) if not input_path.exists() or not input_path.is_dir(): msg.fail("Not a valid input directory", in_dir, exits=1) input_files = [str(fp) for fp in input_path.iterdir() if fp.suffix == ".s2v"] if not input_files: msg.fail("No .s2v files found in input directory", in_dir, exits=1) msg.info(f"Using {len(input_files)} input files") if not output_path.exists(): output_path.mkdir(parents=True) msg.good(f"Created output directory {out_dir}") vocab_file = output_path / f"vocab.txt" cooc_file = output_path / f"cooccurrence.bin" cooc_shuffle_file = output_path / f"cooccurrence.shuf.bin" msg.info("Creating vocabulary counts") cmd = ( f"cat {' '.join(input_files)} | {glove_dir}/vocab_count " f"-min-count {min_count} -verbose {verbose} > {vocab_file}" ) print(cmd) vocab_cmd = os.system(cmd) if vocab_cmd != 0 or not Path(vocab_file).exists(): msg.fail("Failed creating vocab counts", exits=1) msg.good("Created vocab counts", vocab_file) msg.info("Creating cooccurrence statistics") cmd = ( f"cat {' '.join(input_files)} | {glove_dir}/cooccur -memory {memory} " f"-vocab-file {vocab_file} -verbose {verbose} " f"-window-size {window_size} > {cooc_file}" ) print(cmd) cooccur_cmd = os.system(cmd) if cooccur_cmd != 0 or not Path(cooc_file).exists(): msg.fail("Failed creating cooccurrence statistics", exits=1) msg.good("Created cooccurrence statistics", cooc_file) msg.info("Shuffling cooccurrence file") cmd = ( f"{glove_dir}/shuffle -memory {memory} -verbose {verbose} " f"< {cooc_file} > {cooc_shuffle_file}" ) print(cmd) shuffle_cmd = os.system(cmd) if shuffle_cmd != 0 or not Path(cooc_shuffle_file).exists(): msg.fail("Failed to shuffle cooccurrence file", exits=1) msg.good("Shuffled cooccurrence file", cooc_shuffle_file) if __name__ == "__main__": typer.run(main)
[ 1, 529, 276, 1112, 420, 29958, 4501, 28328, 29887, 29914, 29879, 1947, 29906, 2003, 29966, 12443, 29918, 303, 1503, 29958, 29896, 29900, 29900, 29900, 29974, 13, 29937, 14708, 4855, 29914, 2109, 29914, 6272, 3017, 13, 5215, 2897, 13, 3166, 2224, 1982, 1053, 10802, 13, 3166, 471, 19266, 1053, 10191, 13, 5215, 7911, 546, 13, 13, 13, 1753, 1667, 29898, 13, 1678, 396, 19200, 29901, 1283, 13, 1678, 15482, 345, 29918, 3972, 29901, 851, 353, 7911, 546, 29889, 15730, 29898, 16361, 1371, 543, 9882, 6943, 278, 21806, 29963, 29872, 2048, 4968, 13, 1678, 297, 29918, 3972, 29901, 851, 353, 7911, 546, 29889, 15730, 29898, 16361, 1371, 543, 9882, 411, 758, 5014, 287, 869, 29879, 29906, 29894, 2066, 4968, 13, 1678, 714, 29918, 3972, 29901, 851, 353, 7911, 546, 29889, 15730, 29898, 16361, 1371, 543, 2605, 304, 1962, 3884, 4968, 13, 1678, 1375, 29918, 2798, 29901, 938, 353, 7911, 546, 29889, 8375, 29898, 29945, 29892, 376, 489, 1195, 29899, 2798, 613, 11663, 29883, 613, 1371, 543, 8140, 12539, 2302, 363, 28694, 297, 7931, 370, 4968, 13, 1678, 3370, 29901, 5785, 353, 7911, 546, 29889, 8375, 29898, 29946, 29889, 29900, 29892, 376, 489, 14834, 613, 11663, 29885, 613, 1371, 543, 6295, 615, 4046, 363, 3370, 27430, 29892, 297, 19289, 4968, 13, 1678, 3474, 29918, 2311, 29901, 938, 353, 7911, 546, 29889, 8375, 29898, 29896, 29945, 29892, 376, 489, 7165, 29899, 2311, 613, 11663, 29893, 613, 1371, 543, 4557, 310, 3030, 3838, 373, 2845, 2625, 4968, 13, 1678, 26952, 29901, 938, 353, 7911, 546, 29889, 8375, 29898, 29906, 29892, 376, 489, 369, 15828, 613, 11663, 29894, 613, 1371, 543, 2697, 9750, 359, 537, 29901, 29871, 29900, 29892, 29871, 29896, 29892, 470, 29871, 29906, 4968, 13, 1678, 396, 19200, 29901, 373, 13, 1125, 13, 1678, 9995, 13, 1678, 16696, 29871, 29941, 29901, 8878, 7931, 370, 352, 653, 322, 10868, 18139, 13, 13, 1678, 1222, 1103, 29879, 263, 3884, 310, 758, 5014, 287, 869, 29879, 29906, 29894, 1881, 2066, 322, 674, 671, 21806, 29963, 29872, 304, 13, 1678, 6314, 443, 335, 2572, 18139, 322, 3386, 322, 528, 21897, 1302, 15693, 26841, 848, 29889, 2823, 1244, 13, 1678, 363, 11161, 11994, 29901, 2045, 597, 3292, 29889, 510, 29914, 14411, 4006, 12938, 29886, 29914, 29954, 417, 29963, 29872, 13, 13, 1678, 3940, 393, 445, 2471, 674, 1246, 964, 21806, 29963, 29872, 322, 23347, 366, 304, 1209, 297, 278, 13, 1678, 21806, 29963, 29872, 2048, 3884, 20374, 4282, 565, 366, 1065, 278, 8561, 1445, 467, 450, 8260, 674, 13, 1678, 884, 367, 13350, 565, 366, 864, 304, 1065, 963, 16949, 29889, 13, 1678, 9995, 13, 1678, 1881, 29918, 2084, 353, 10802, 29898, 262, 29918, 3972, 29897, 13, 1678, 1962, 29918, 2084, 353, 10802, 29898, 449, 29918, 3972, 29897, 13, 1678, 565, 451, 10802, 29898, 29887, 417, 345, 29918, 3972, 467, 9933, 7295, 13, 4706, 10191, 29889, 14057, 703, 6028, 29915, 29873, 1284, 21806, 29963, 29872, 2048, 3884, 613, 15482, 345, 29918, 3972, 29892, 429, 1169, 29922, 29896, 29897, 13, 1678, 565, 451, 1881, 29918, 2084, 29889, 9933, 580, 470, 451, 1881, 29918, 2084, 29889, 275, 29918, 3972, 7295, 13, 4706, 10191, 29889, 14057, 703, 3664, 263, 2854, 1881, 3884, 613, 297, 29918, 3972, 29892, 429, 1169, 29922, 29896, 29897, 13, 1678, 1881, 29918, 5325, 353, 518, 710, 29898, 18091, 29897, 363, 285, 29886, 297, 1881, 29918, 2084, 29889, 1524, 3972, 580, 565, 285, 29886, 29889, 2146, 600, 861, 1275, 11393, 29879, 29906, 29894, 3108, 13, 1678, 565, 451, 1881, 29918, 5325, 29901, 13, 4706, 10191, 29889, 14057, 703, 3782, 869, 29879, 29906, 29894, 2066, 1476, 297, 1881, 3884, 613, 297, 29918, 3972, 29892, 429, 1169, 29922, 29896, 29897, 13, 1678, 10191, 29889, 3888, 29898, 29888, 29908, 15156, 426, 2435, 29898, 2080, 29918, 5325, 2915, 1881, 2066, 1159, 13, 1678, 565, 451, 1962, 29918, 2084, 29889, 9933, 7295, 13, 4706, 1962, 29918, 2084, 29889, 11256, 3972, 29898, 862, 1237, 29922, 5574, 29897, 13, 4706, 10191, 29889, 16773, 29898, 29888, 29908, 20399, 1962, 3884, 426, 449, 29918, 3972, 27195, 13, 13, 1678, 7931, 370, 29918, 1445, 353, 1962, 29918, 2084, 847, 285, 29908, 29894, 542, 370, 29889, 3945, 29908, 13, 1678, 1302, 542, 29918, 1445, 353, 1962, 29918, 2084, 847, 285, 29908, 1111, 15693, 26841, 29889, 2109, 29908, 13, 1678, 1302, 542, 29918, 845, 21897, 29918, 1445, 353, 1962, 29918, 2084, 847, 285, 29908, 1111, 15693, 26841, 29889, 845, 1137, 29889, 2109, 29908, 13, 13, 1678, 10191, 29889, 3888, 703, 9832, 1218, 7931, 370, 352, 653, 18139, 1159, 13, 1678, 9920, 353, 313, 13, 4706, 285, 29908, 4117, 11117, 15300, 7122, 29898, 2080, 29918, 5325, 2915, 891, 426, 29887, 417, 345, 29918, 3972, 6822, 29894, 542, 370, 29918, 2798, 376, 13, 4706, 285, 29908, 29899, 1195, 29899, 2798, 426, 1195, 29918, 2798, 29913, 448, 369, 15828, 426, 369, 15828, 29913, 1405, 426, 29894, 542, 370, 29918, 1445, 5038, 13, 1678, 1723, 13, 1678, 1596, 29898, 9006, 29897, 13, 1678, 7931, 370, 29918, 9006, 353, 2897, 29889, 5205, 29898, 9006, 29897, 13, 1678, 565, 7931, 370, 29918, 9006, 2804, 29871, 29900, 470, 451, 10802, 29898, 29894, 542, 370, 29918, 1445, 467, 9933, 7295, 13, 4706, 10191, 29889, 14057, 703, 17776, 4969, 7931, 370, 18139, 613, 429, 1169, 29922, 29896, 29897, 13, 1678, 10191, 29889, 16773, 703, 20399, 7931, 370, 18139, 613, 7931, 370, 29918, 1445, 29897, 13, 13, 1678, 10191, 29889, 3888, 703, 9832, 1218, 1302, 15693, 26841, 13964, 1159, 13, 1678, 9920, 353, 313, 13, 4706, 285, 29908, 4117, 11117, 15300, 7122, 29898, 2080, 29918, 5325, 2915, 891, 426, 29887, 417, 345, 29918, 3972, 6822, 1111, 542, 2764, 448, 14834, 426, 14834, 29913, 376, 13, 4706, 285, 29908, 29899, 29894, 542, 370, 29899, 1445, 426, 29894, 542, 370, 29918, 1445, 29913, 448, 369, 15828, 426, 369, 15828, 29913, 376, 13, 4706, 285, 29908, 29899, 7165, 29899, 2311, 426, 7165, 29918, 2311, 29913, 1405, 426, 1111, 542, 29918, 1445, 5038, 13, 1678, 1723, 13, 1678, 1596, 29898, 9006, 29897, 13, 1678, 1302, 542, 2764, 29918, 9006, 353, 2897, 29889, 5205, 29898, 9006, 29897, 13, 1678, 565, 1302, 542, 2764, 29918, 9006, 2804, 29871, 29900, 470, 451, 10802, 29898, 1111, 542, 29918, 1445, 467, 9933, 7295, 13, 4706, 10191, 29889, 14057, 703, 17776, 4969, 1302, 15693, 26841, 13964, 613, 429, 1169, 29922, 29896, 29897, 13, 1678, 10191, 29889, 16773, 703, 20399, 1302, 15693, 26841, 13964, 613, 1302, 542, 29918, 1445, 29897, 13, 13, 1678, 10191, 29889, 3888, 703, 2713, 3096, 1847, 1302, 15693, 26841, 934, 1159, 13, 1678, 9920, 353, 313, 13, 4706, 285, 29908, 29912, 29887, 417, 345, 29918, 3972, 6822, 845, 21897, 448, 14834, 426, 14834, 29913, 448, 369, 15828, 426, 369, 15828, 29913, 376, 13, 4706, 285, 29908, 29966, 426, 1111, 542, 29918, 1445, 29913, 1405, 426, 1111, 542, 29918, 845, 21897, 29918, 1445, 5038, 13, 1678, 1723, 13, 1678, 1596, 29898, 9006, 29897, 13, 1678, 528, 21897, 29918, 9006, 353, 2897, 29889, 5205, 29898, 9006, 29897, 13, 1678, 565, 528, 21897, 29918, 9006, 2804, 29871, 29900, 470, 451, 10802, 29898, 1111, 542, 29918, 845, 21897, 29918, 1445, 467, 9933, 7295, 13, 4706, 10191, 29889, 14057, 703, 17776, 304, 528, 21897, 1302, 15693, 26841, 934, 613, 429, 1169, 29922, 29896, 29897, 13, 1678, 10191, 29889, 16773, 703, 2713, 3096, 839, 1302, 15693, 26841, 934, 613, 1302, 542, 29918, 845, 21897, 29918, 1445, 29897, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 7911, 546, 29889, 3389, 29898, 3396, 29897, 13, 2 ]
Lib/vanilla/vanillaGradientButton.py
miguelsousa/vanilla
21
97761
from AppKit import * from vanillaButton import ImageButton class GradientButton(ImageButton): nsBezelStyle = NSSmallSquareBezelStyle
[ 1, 515, 2401, 13117, 1053, 334, 13, 3166, 1109, 2911, 3125, 1053, 7084, 3125, 13, 13, 13, 1990, 19295, 993, 3125, 29898, 2940, 3125, 1125, 13, 13, 1678, 17534, 3629, 10533, 5568, 353, 405, 1799, 29885, 497, 29903, 4718, 3629, 10533, 5568, 13, 13, 2 ]
ui_test/user_flows.py
uktrade/dit-contact-forms
2
156652
from ui_test.selectors.questionnaire import QUESTIONNAIRE from ui_test.selectors.form import FORM def select_questionnaire(browser, options): for key, value in options.items(): browser.find_by_css(QUESTIONNAIRE[key][value]).click() browser.find_by_css(QUESTIONNAIRE["continue"]).click() def submit_form(browser, options): browser.find_by_css(FORM["message"]).first.type(options["message"]) browser.find_by_css(FORM["name"]).first.type(options["name"]) browser.find_by_css(FORM["email"]).first.type(options["email"]) browser.find_by_css(FORM["accept_terms"]).click() browser.find_by_css(QUESTIONNAIRE["continue"]).click()
[ 1, 515, 14313, 29918, 1688, 29889, 2622, 943, 29889, 12470, 15421, 1053, 660, 4462, 1254, 2725, 3521, 29902, 1525, 13, 3166, 14313, 29918, 1688, 29889, 2622, 943, 29889, 689, 1053, 383, 12054, 13, 13, 13, 1753, 1831, 29918, 12470, 15421, 29898, 15965, 29892, 3987, 1125, 13, 1678, 363, 1820, 29892, 995, 297, 3987, 29889, 7076, 7295, 13, 4706, 4714, 29889, 2886, 29918, 1609, 29918, 4268, 29898, 14130, 2725, 3521, 29902, 1525, 29961, 1989, 3816, 1767, 14664, 3808, 580, 13, 4706, 4714, 29889, 2886, 29918, 1609, 29918, 4268, 29898, 14130, 2725, 3521, 29902, 1525, 3366, 19878, 3108, 467, 3808, 580, 13, 13, 13, 1753, 9752, 29918, 689, 29898, 15965, 29892, 3987, 1125, 13, 1678, 4714, 29889, 2886, 29918, 1609, 29918, 4268, 29898, 19094, 3366, 4906, 3108, 467, 4102, 29889, 1853, 29898, 6768, 3366, 4906, 20068, 13, 1678, 4714, 29889, 2886, 29918, 1609, 29918, 4268, 29898, 19094, 3366, 978, 3108, 467, 4102, 29889, 1853, 29898, 6768, 3366, 978, 20068, 13, 1678, 4714, 29889, 2886, 29918, 1609, 29918, 4268, 29898, 19094, 3366, 5269, 3108, 467, 4102, 29889, 1853, 29898, 6768, 3366, 5269, 20068, 13, 1678, 4714, 29889, 2886, 29918, 1609, 29918, 4268, 29898, 19094, 3366, 16044, 29918, 357, 1516, 3108, 467, 3808, 580, 13, 1678, 4714, 29889, 2886, 29918, 1609, 29918, 4268, 29898, 14130, 2725, 3521, 29902, 1525, 3366, 19878, 3108, 467, 3808, 580, 13, 2 ]
pybomberman/__init__.py
pybomberman/pybomberman
2
32978
from .map import Map print("Soon... https://github.com/pybomberman/pybomberman")
[ 1, 515, 869, 1958, 1053, 7315, 13, 13, 2158, 703, 29903, 6150, 856, 2045, 597, 3292, 29889, 510, 29914, 2272, 29890, 290, 495, 1171, 29914, 2272, 29890, 290, 495, 1171, 1159, 13, 2 ]
base_python/tests/test_flatten.py
cogment/cogment-verse
23
106746
<reponame>cogment/cogment-verse # Copyright 2021 AI Redefined Inc. <<EMAIL>> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from data_pb2 import Space from cogment_verse.spaces import flattened_dimensions def test_flattened_dimensions_discrete(): assert flattened_dimensions(Space(properties=[Space.Property(discrete=Space.Discrete(num=2))])) == 2 assert ( flattened_dimensions( Space( properties=[ Space.Property( discrete=Space.Discrete( labels=["brake", "accelerate", "do nothing"], num=2, # Will be ignored as there are more labels ) ) ] ) ) == 3 ) assert ( flattened_dimensions( Space( properties=[ Space.Property(discrete=Space.Discrete(labels=["brake", "accelerate", "do nothing"], num=12)) ] ) ) == 12 ) assert ( flattened_dimensions( Space( properties=[ Space.Property(key="a", discrete=Space.Discrete(labels=["brake", "accelerate", "do nothing"])), Space.Property(key="b", discrete=Space.Discrete(num=5)), ] ) ) == 8 ) def test_flattened_dimensions_box(): assert flattened_dimensions(Space(properties=[Space.Property(box=Space.Box(shape=[2]))])) == 2 assert flattened_dimensions(Space(properties=[Space.Property(box=Space.Box(shape=[4]))])) == 4 assert flattened_dimensions(Space(properties=[Space.Property(box=Space.Box(shape=[2, 3, 4]))])) == 24 assert ( flattened_dimensions( Space( properties=[ Space.Property(key="a", box=Space.Box(shape=[10])), Space.Property(key="b", box=Space.Box(shape=[2, 3, 4])), ] ) ) == 34 ) def test_flattened_dimensions_mixed(): assert ( flattened_dimensions( Space( properties=[ Space.Property(key="a", box=Space.Box(shape=[10])), Space.Property(key="b", discrete=Space.Discrete(labels=["brake", "accelerate", "do nothing"])), Space.Property(key="c", box=Space.Box(shape=[2, 3, 4])), ] ) ) == 37 )
[ 1, 529, 276, 1112, 420, 29958, 29883, 468, 358, 29914, 29883, 468, 358, 29899, 3901, 13, 29937, 14187, 1266, 29871, 29906, 29900, 29906, 29896, 319, 29902, 4367, 5598, 9266, 29889, 3532, 26862, 6227, 6778, 13, 29937, 13, 29937, 10413, 21144, 1090, 278, 13380, 19245, 29892, 10079, 29871, 29906, 29889, 29900, 313, 1552, 376, 29931, 293, 1947, 1496, 13, 29937, 366, 1122, 451, 671, 445, 934, 5174, 297, 752, 13036, 411, 278, 19245, 29889, 13, 29937, 887, 1122, 4017, 263, 3509, 310, 278, 19245, 472, 13, 29937, 13, 29937, 1678, 1732, 597, 1636, 29889, 4288, 29889, 990, 29914, 506, 11259, 29914, 27888, 1430, 1660, 29899, 29906, 29889, 29900, 13, 29937, 13, 29937, 25870, 3734, 491, 22903, 4307, 470, 15502, 304, 297, 5007, 29892, 7047, 13, 29937, 13235, 1090, 278, 19245, 338, 13235, 373, 385, 376, 3289, 8519, 29908, 350, 3289, 3235, 29892, 13, 29937, 399, 1806, 8187, 2692, 399, 1718, 29934, 13566, 29059, 6323, 8707, 29928, 22122, 29903, 8079, 13764, 29979, 476, 22255, 29892, 2845, 4653, 470, 2411, 2957, 29889, 13, 29937, 2823, 278, 19245, 363, 278, 2702, 4086, 14765, 1076, 11239, 322, 13, 29937, 27028, 1090, 278, 19245, 29889, 13, 13, 3166, 848, 29918, 24381, 29906, 1053, 14121, 13, 3166, 274, 468, 358, 29918, 3901, 29889, 22854, 1053, 1652, 8606, 287, 29918, 6229, 5580, 13, 13, 13, 1753, 1243, 29918, 1579, 8606, 287, 29918, 6229, 5580, 29918, 2218, 9084, 7295, 13, 1678, 4974, 1652, 8606, 287, 29918, 6229, 5580, 29898, 14936, 29898, 11330, 11759, 14936, 29889, 4854, 29898, 2218, 9084, 29922, 14936, 29889, 4205, 9084, 29898, 1949, 29922, 29906, 876, 12622, 1275, 29871, 29906, 13, 13, 1678, 4974, 313, 13, 4706, 1652, 8606, 287, 29918, 6229, 5580, 29898, 13, 9651, 14121, 29898, 13, 18884, 4426, 11759, 13, 462, 1678, 14121, 29889, 4854, 29898, 13, 462, 4706, 19554, 29922, 14936, 29889, 4205, 9084, 29898, 13, 462, 9651, 11073, 29922, 3366, 2634, 446, 613, 376, 562, 2242, 261, 403, 613, 376, 1867, 3078, 12436, 13, 462, 9651, 954, 29922, 29906, 29892, 29871, 396, 2811, 367, 17262, 408, 727, 526, 901, 11073, 13, 462, 4706, 1723, 13, 462, 1678, 1723, 13, 18884, 4514, 13, 9651, 1723, 13, 4706, 1723, 13, 4706, 1275, 29871, 29941, 13, 1678, 1723, 13, 13, 1678, 4974, 313, 13, 4706, 1652, 8606, 287, 29918, 6229, 5580, 29898, 13, 9651, 14121, 29898, 13, 18884, 4426, 11759, 13, 462, 1678, 14121, 29889, 4854, 29898, 2218, 9084, 29922, 14936, 29889, 4205, 9084, 29898, 21134, 29922, 3366, 2634, 446, 613, 376, 562, 2242, 261, 403, 613, 376, 1867, 3078, 12436, 954, 29922, 29896, 29906, 876, 13, 18884, 4514, 13, 9651, 1723, 13, 4706, 1723, 13, 4706, 1275, 29871, 29896, 29906, 13, 1678, 1723, 13, 13, 1678, 4974, 313, 13, 4706, 1652, 8606, 287, 29918, 6229, 5580, 29898, 13, 9651, 14121, 29898, 13, 18884, 4426, 11759, 13, 462, 1678, 14121, 29889, 4854, 29898, 1989, 543, 29874, 613, 19554, 29922, 14936, 29889, 4205, 9084, 29898, 21134, 29922, 3366, 2634, 446, 613, 376, 562, 2242, 261, 403, 613, 376, 1867, 3078, 20068, 511, 13, 462, 1678, 14121, 29889, 4854, 29898, 1989, 543, 29890, 613, 19554, 29922, 14936, 29889, 4205, 9084, 29898, 1949, 29922, 29945, 8243, 13, 18884, 4514, 13, 9651, 1723, 13, 4706, 1723, 13, 4706, 1275, 29871, 29947, 13, 1678, 1723, 13, 13, 13, 1753, 1243, 29918, 1579, 8606, 287, 29918, 6229, 5580, 29918, 1884, 7295, 13, 1678, 4974, 1652, 8606, 287, 29918, 6229, 5580, 29898, 14936, 29898, 11330, 11759, 14936, 29889, 4854, 29898, 1884, 29922, 14936, 29889, 3313, 29898, 12181, 11759, 29906, 12622, 12622, 1275, 29871, 29906, 13, 13, 1678, 4974, 1652, 8606, 287, 29918, 6229, 5580, 29898, 14936, 29898, 11330, 11759, 14936, 29889, 4854, 29898, 1884, 29922, 14936, 29889, 3313, 29898, 12181, 11759, 29946, 12622, 12622, 1275, 29871, 29946, 13, 13, 1678, 4974, 1652, 8606, 287, 29918, 6229, 5580, 29898, 14936, 29898, 11330, 11759, 14936, 29889, 4854, 29898, 1884, 29922, 14936, 29889, 3313, 29898, 12181, 11759, 29906, 29892, 29871, 29941, 29892, 29871, 29946, 12622, 12622, 1275, 29871, 29906, 29946, 13, 13, 1678, 4974, 313, 13, 4706, 1652, 8606, 287, 29918, 6229, 5580, 29898, 13, 9651, 14121, 29898, 13, 18884, 4426, 11759, 13, 462, 1678, 14121, 29889, 4854, 29898, 1989, 543, 29874, 613, 3800, 29922, 14936, 29889, 3313, 29898, 12181, 11759, 29896, 29900, 2314, 511, 13, 462, 1678, 14121, 29889, 4854, 29898, 1989, 543, 29890, 613, 3800, 29922, 14936, 29889, 3313, 29898, 12181, 11759, 29906, 29892, 29871, 29941, 29892, 29871, 29946, 2314, 511, 13, 18884, 4514, 13, 9651, 1723, 13, 4706, 1723, 13, 4706, 1275, 29871, 29941, 29946, 13, 1678, 1723, 13, 13, 13, 1753, 1243, 29918, 1579, 8606, 287, 29918, 6229, 5580, 29918, 29885, 11925, 7295, 13, 1678, 4974, 313, 13, 4706, 1652, 8606, 287, 29918, 6229, 5580, 29898, 13, 9651, 14121, 29898, 13, 18884, 4426, 11759, 13, 462, 1678, 14121, 29889, 4854, 29898, 1989, 543, 29874, 613, 3800, 29922, 14936, 29889, 3313, 29898, 12181, 11759, 29896, 29900, 2314, 511, 13, 462, 1678, 14121, 29889, 4854, 29898, 1989, 543, 29890, 613, 19554, 29922, 14936, 29889, 4205, 9084, 29898, 21134, 29922, 3366, 2634, 446, 613, 376, 562, 2242, 261, 403, 613, 376, 1867, 3078, 20068, 511, 13, 462, 1678, 14121, 29889, 4854, 29898, 1989, 543, 29883, 613, 3800, 29922, 14936, 29889, 3313, 29898, 12181, 11759, 29906, 29892, 29871, 29941, 29892, 29871, 29946, 2314, 511, 13, 18884, 4514, 13, 9651, 1723, 13, 4706, 1723, 13, 4706, 1275, 29871, 29941, 29955, 13, 1678, 1723, 13, 2 ]
cbh.py
jensengroup/fragreact
2
33656
<reponame>jensengroup/fragreact<gh_stars>1-10 #!/usr/bin/env python import numpy as np import re from rdkit import Chem from rdkit.Chem import rdMolDescriptors from itertools import combinations import copy def print_smiles(smiles_list, human=False): smiles_dict = count_smiles(smiles_list) keys = smiles_dict.keys() keys.sort() out = [] for key in keys: out += [str(smiles_dict[key]) + " " + key] return " ".join(out) def print_reaction(reactants, products, human=False): if not human: reaction = ">>".join([".".join(reactants), ".".join(products)]) else: reactants = print_smiles(reactants) products = print_smiles(products) reaction = reactants+ ">>"+ products return reaction def canonical(smiles): """ SMILES provided is canonical, so the output should be the same no matter how a particular molecule is input """ m = Chem.MolFromSmiles(smiles) smiles = Chem.MolToSmiles(m) return smiles def kekulize(smiles): m = Chem.MolFromSmiles(smiles) Chem.Kekulize(m) smiles = Chem.MolToSmiles(m, kekuleSmiles=True) return smiles def count_hydrogens(smiles): """ """ m = Chem.MolFromSmiles(smiles) n_hydrogen = 0 for a in m.GetAtoms(): n_hydrogen += a.GetTotalNumHs() # print a.GetAtomicNum() # print a.GetTotalNumHs() # print a.GetNumExplicitHs() # print a.GetNumImplicitHs() return n_hydrogen def count_smiles(smiles_list): """ Count SMILES by creating a dictionary with SMILES as keys, point to the number of that particular SMILES. e.i. dict[smiles] = # of smiles """ smiles_dict = {} components, components_count = np.unique(smiles_list, return_counts=True) for comp, count in zip(components, components_count): smiles_dict[comp] = count return smiles_dict def substract_smiles(A, B): """ A - B = Cp + Cn where Cp has positive results and Cn has negative results """ if isinstance(A, str): A = A.split(".") if isinstance(B, str): B = B.split(".") Cp = [] Cn = [] A = count_smiles(A) B = count_smiles(B) for key in np.unique(list(A.keys()) + list(B.keys())): if key not in A: Cn += [key] * B[key] continue if key not in B: Cp += [key] * A[key] continue diff = A[key] - B[key] if diff == 0: continue elif diff > 0: Cp += [key]*diff elif diff < 0: Cn += [key]*abs(diff) return Cp, Cn def tuning(left_side, right_side): corrected_left = [] corrected_right = [] left_side = count_smiles(left_side) right_side = count_smiles(right_side) for key in np.unique(list(left_side.keys()) + list(right_side.keys())): if key not in left_side: print("hello") quit() if key not in right_side: print("hello2") quit() diff = right_side[key] - left_side[key] if diff == 0: continue elif diff > 0: corrected_left += [key] * diff elif diff < 0: corrected_right += [key] * diff return corrected_left, corrected_right def get_bond_type(m, a, b): # NOTE # If m is not kekulized then bonds can be AROMATIC # which is a problem for the component schemes try: bond_type = str(m.GetBondBetweenAtoms(a, b).GetBondType()) except AttributeError: return False if bond_type == "SINGLE": bond = "" elif bond_type == "DOUBLE": bond = "=" elif bond_type == "TRIPLE": bond = "#" else: bond = False return bond def get_atoms(smiles, ignore_hydrogen=True): smiles = kekulize(smiles) p = re.compile(r"[A-Z][a-z]?") atoms = p.findall(smiles) if ignore_hydrogen: atoms = [atom for atom in atoms if atom != "H"] return atoms def add_neighbours(mol, substructures): substructures = list(substructures) for j, idx in enumerate(substructures): for i in idx: A = mol.GetAtomWithIdx(i) for B in A.GetNeighbors(): k = B.GetIdx() substructures[j] += (k,) return substructures def get_components_neighbors(mol, atoms): atoms = list(atoms) for idx in atoms: idx, = idx A = mol.GetAtomWithIdx(idx) for B in A.GetNeighbors(): idx_b = B.GetIdx() atom = B.GetAtomicNum() charge = B.GetFormalCharge() bond = Chem.GetBondBetweenAtoms(mol, idx, idx_b) return def get_components(smiles, smart, kekulize=True, add=False): m = Chem.MolFromSmiles(smiles) smart = Chem.MolFromSmarts(smart) if kekulize: Chem.Kekulize(m) substructures = m.GetSubstructMatches(smart) components = [] if add: substructures = add_neighbours(m, substructures) for sub in substructures: if add: m_new = copy.copy(m) m_new = Chem.RWMol(m_new) for B, C in combinations(sub[1:], 2): m_new.RemoveBond(B, C) else: m_new = m component = Chem.MolFragmentToSmiles(m_new, atomsToUse=sub, isomericSmiles=True, kekuleSmiles=True, canonical=True) A = m.GetAtomWithIdx(sub[0]) mc = Chem.MolFromSmiles(component) n_atoms = mc.GetNumAtoms() n_bonds = len(mc.GetBonds()) component = Chem.MolToSmiles(mc) if "+" in component or "-" in component or "H" in component: # Very awful hack to fix the charged molecules and their explicit # hydrogens charges = np.zeros(n_atoms, dtype=int) for idx in range(n_atoms): atom = mc.GetAtomWithIdx(idx) atom.SetNumExplicitHs(0) charge = atom.GetFormalCharge() charges[idx] = charge atom.SetFormalCharge(0) component = Chem.MolToSmiles(mc, canonical=False) component = component.replace("[", "").replace("]","") mc = Chem.MolFromSmiles(component) for idx, charge in zip(range(n_atoms), charges): atom = mc.GetAtomWithIdx(idx) charge = int(charge) atom.SetFormalCharge(charge) component = Chem.MolToSmiles(mc) if n_atoms <= n_bonds: mw = Chem.RWMol(m) if len(sub) == 3: mw.RemoveBond(sub[0], sub[-1]) elif len(sub) == 4 or len(sub) == 5: for i in range(0, n_atoms): for j in range(i+1, n_atoms): if i == 1 or j == 1: continue mw.RemoveBond(sub[i], sub[j]) component = Chem.MolFragmentToSmiles(mw, atomsToUse=sub, isomericSmiles=True, kekuleSmiles=True, canonical=True) if "1" in component: quit("Error connectivity") else: component = Chem.MolToSmiles(mc) # charge = Chem.GetFormalCharge(mc) # # if not charge == 0: # # NOTE # # Lots of lots of if case down this road # # n_atoms = mc.GetNumAtoms() # # for i in range(n_atoms): # # atom = mc.GetAtomWithIdx(i) # charge = atom.GetFormalCharge() # # if not charge == 0: # atom.SetFormalCharge(0) component = canonical(component) components += [component] return components def get_components_scheme1(smiles, kekulize=True): c1 = "[*]~[*]" if "+" in smiles or "-" in smiles: pass else: return get_components(smiles, c1) # The code below doesn't get charges return get_components(smiles, c1) c1 = Chem.MolFromSmarts(c1) m = Chem.MolFromSmiles(smiles) if kekulize: Chem.Kekulize(m) substructures = m.GetSubstructMatches(c1) components = [] for sub in substructures: a, b = sub ab = get_bond_type(m, a, b) a = m.GetAtomWithIdx(a).GetSymbol() b = m.GetAtomWithIdx(b).GetSymbol() component = a + ab + b components.append(component) components = [canonical(component) for component in components] return components def get_components_scheme2(smiles, kekulize=True): c1 = "[D2]" c2 = "[*]~[D2]~[*]" c3 = "[*]~[D3](~[*])~[*]" c4 = "[*]~[*](~[*])(~[*])~[*]" # if "+" in smiles or "-" in smiles: # pass # else: components = [] components += get_components(smiles, c1, add=True) # components += get_components(smiles, c2) components += get_components(smiles, c3) components += get_components(smiles, c4) return components c2 = Chem.MolFromSmarts(c2) c3 = Chem.MolFromSmarts(c3) c4 = Chem.MolFromSmarts(c4) m = Chem.MolFromSmiles(smiles) if kekulize: Chem.Kekulize(m) substructures = m.GetSubstructMatches(c2) components = [] for sub in substructures: a, b, c = sub ab = get_bond_type(m, a, b) bc = get_bond_type(m, b, c) a = m.GetAtomWithIdx(a).GetSymbol() b = m.GetAtomWithIdx(b).GetSymbol() c = m.GetAtomWithIdx(c).GetSymbol() component = a + ab + b + bc + c components.append(component) substructures = m.GetSubstructMatches(c3) for sub in substructures: a, b, c, d = sub ab = get_bond_type(m, a, b) bc = get_bond_type(m, b, c) bd = get_bond_type(m, b, d) a = m.GetAtomWithIdx(a).GetSymbol() b = m.GetAtomWithIdx(b).GetSymbol() c = m.GetAtomWithIdx(c).GetSymbol() d = m.GetAtomWithIdx(d).GetSymbol() component = a + ab + b + "(" + bc + c + ")" + bd + d components.append(component) substructures = m.GetSubstructMatches(c4) for sub in substructures: a, b, c, d, e = sub ab = get_bond_type(m, a, b) bc = get_bond_type(m, b, c) bd = get_bond_type(m, b, d) be = get_bond_type(m, b, e) a = m.GetAtomWithIdx(a).GetSymbol() b = m.GetAtomWithIdx(b).GetSymbol() c = m.GetAtomWithIdx(c).GetSymbol() d = m.GetAtomWithIdx(d).GetSymbol() e = m.GetAtomWithIdx(e).GetSymbol() component = a + ab + b component += "(" + bc + c + ")" component += "(" + bd + d + ")" component += be + e components.append(component) components = [canonical(component) for component in components] return components def decompontent(smiles, scheme=1): if scheme == 1: decompontent_scheme = decompontent_scheme1 elif scheme == 2: decompontent_scheme = decompontent_scheme2 left, right = decompontent_scheme(smiles) return left, right def decompontent_scheme1(smiles): """ Tune the equation A (bb) => aa where A (target) is big smiles aa (scheme1 components) is scheme2 components bb (atoms) is additional bonds required, to have equald bonds on each side this is done for each A which consists of len(aa) > 0 """ components = get_components_scheme1(smiles) if len(components) == 0: return [], [] bonds_leftside = get_atoms(smiles) bonds_rightside = [] for component in components: bonds_rightside += get_atoms(component) left, right = tuning(bonds_leftside, bonds_rightside) right += components return left, right def decompontent_scheme2(smiles): """ Tune the equation A (bb) => aa where A (target) is big smiles aa (scheme2 components) is scheme2 components bb (single bonds) is additional bonds required, to have equald bonds on each side this is done for each A which consists of len(aa) > 0 """ components = get_components_scheme2(smiles) if len(components) == 0: return [], [] bonds_leftside = get_components_scheme1(smiles) bonds_rightside = [] for component in components: bonds_rightside += get_components_scheme1(component) left, right = tuning(bonds_leftside, bonds_rightside) right += components if not check_atoms([smiles] + left, right): print("Error in fragreact tuneing:", smiles) print([smiles], left, right) quit() return left, right def resultant(reactants, products, scheme=1): """ assummed that smiles lists are both split(".") and canonical at this point """ reactants_leftside = [] reactants_rightside = [] products_leftside = [] products_rightside = [] reactants_missing = [] products_missing = [] if scheme == 1: decompontent_scheme = decompontent_scheme1 elif scheme == 2: decompontent_scheme = decompontent_scheme2 for reactant in reactants: left, right = decompontent_scheme(reactant) if len(left) == 0 and len(right) == 0: reactants_missing += [reactant] reactants_leftside += left reactants_rightside += right for product in products: left, right = decompontent_scheme(product) if len(left) == 0 and len(right) == 0: products_missing += [product] products_leftside += left products_rightside += right left_positive, left_negative = substract_smiles(products_leftside, reactants_leftside) right_positive, right_negative = substract_smiles(products_rightside, reactants_rightside) left = left_positive + right_negative + reactants_missing right = right_positive + left_negative + products_missing left, right = substract_smiles(left, right) hydrogens_left = 0 hydrogens_right = 0 for each in left: hydrogens_left += count_hydrogens(each) for each in right: hydrogens_right += count_hydrogens(each) tune_hydrogens = hydrogens_left - hydrogens_right if tune_hydrogens < 0: left += ['[H+]']*abs(tune_hydrogens) if tune_hydrogens > 0: right += ['[H+]']*tune_hydrogens return left, right def split_smiles(smiles, num_sep=None): """ number seperator num_sep (e.g. 3xCC, num_spe="x") """ if type(smiles) == type(""): smiles_list = smiles.split(".") else: smiles_list = smiles for i, smiles in enumerate(smiles_list): smiles = smiles.split(".") if len(smiles) > 1: smiles_list[i] = smiles[0] smiles_list += smiles[1:] if num_sep: for i, smiles in enumerate(smiles_list): if num_sep in smiles: num, smiles = smiles.split(num_sep) num = int(num) smiles_list[i] = smiles smiles_list += [smiles]*(num-1) return smiles_list def cbh_n(reactants, products, scheme, do_canonical=True): """ Use connectivity-based hieracy for reaction (reactants -> products) in: reactants -- list of SMILES products -- list of SMILES scheme -- int level of connecitivty out: left -- list of smiles for the reactant part of the CBHn reaction right -- list of smiles for the product part of the CBHn reaction """ if do_canonical: reactants = [canonical(smiles) for smiles in reactants] products = [canonical(smiles) for smiles in products] left, right = resultant(reactants, products, scheme=scheme) return left, right def check_atoms(reactants, products): """ Check the validity of the reaction. Reaction should have eq. no. of atoms for both reactants and products. """ ratoms = [get_atoms(smiles) for smiles in reactants] patoms = [get_atoms(smiles) for smiles in products] # flatten ratoms = sum(ratoms, []) patoms = sum(patoms, []) ratoms.sort() patoms.sort() return ratoms == patoms def check_reaction(reactants, products): """ """ if isinstance(reactants, list): reactants = ".".join(reactants) if isinstance(products, list): products = ".".join(products) reactants = Chem.MolFromSmiles(reactants) products = Chem.MolFromSmiles(products) return rdMolDescriptors.CalcMolFormula(reactants) == rdMolDescriptors.CalcMolFormula(products)
[ 1, 529, 276, 1112, 420, 29958, 29926, 14762, 2972, 29914, 29888, 1431, 8423, 29966, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 29937, 14708, 4855, 29914, 2109, 29914, 6272, 3017, 13, 13, 5215, 12655, 408, 7442, 13, 5215, 337, 13, 3166, 364, 29881, 7354, 1053, 12677, 13, 3166, 364, 29881, 7354, 29889, 1451, 331, 1053, 364, 29881, 29924, 324, 4002, 924, 943, 13, 13, 3166, 4256, 8504, 1053, 18240, 13, 5215, 3509, 13, 13, 1753, 1596, 29918, 3844, 5475, 29898, 3844, 5475, 29918, 1761, 29892, 5199, 29922, 8824, 1125, 13, 13, 1678, 1560, 5475, 29918, 8977, 353, 2302, 29918, 3844, 5475, 29898, 3844, 5475, 29918, 1761, 29897, 13, 1678, 6611, 353, 1560, 5475, 29918, 8977, 29889, 8149, 580, 13, 1678, 6611, 29889, 6605, 580, 13, 13, 1678, 714, 353, 5159, 13, 13, 1678, 363, 1820, 297, 6611, 29901, 13, 4706, 714, 4619, 518, 710, 29898, 3844, 5475, 29918, 8977, 29961, 1989, 2314, 718, 376, 376, 718, 1820, 29962, 13, 13, 1678, 736, 376, 11393, 7122, 29898, 449, 29897, 13, 13, 13, 1753, 1596, 29918, 276, 2467, 29898, 8423, 1934, 29892, 9316, 29892, 5199, 29922, 8824, 1125, 13, 13, 1678, 565, 451, 5199, 29901, 13, 4706, 19848, 353, 376, 6778, 1642, 7122, 29898, 3366, 1213, 29889, 7122, 29898, 8423, 1934, 511, 376, 1213, 29889, 7122, 29898, 14456, 29897, 2314, 13, 13, 1678, 1683, 29901, 13, 4706, 7657, 1934, 353, 1596, 29918, 3844, 5475, 29898, 8423, 1934, 29897, 13, 4706, 9316, 353, 1596, 29918, 3844, 5475, 29898, 14456, 29897, 13, 4706, 19848, 353, 29871, 7657, 1934, 29974, 376, 6778, 17969, 9316, 13, 13, 1678, 736, 19848, 13, 13, 13, 1753, 24420, 29898, 3844, 5475, 1125, 13, 1678, 9995, 13, 1678, 317, 10403, 17101, 4944, 338, 24420, 29892, 577, 278, 1962, 881, 367, 278, 1021, 694, 4383, 13, 1678, 920, 263, 3153, 13206, 29883, 1297, 338, 1881, 13, 1678, 9995, 13, 1678, 286, 353, 12677, 29889, 29924, 324, 4591, 12636, 5475, 29898, 3844, 5475, 29897, 13, 1678, 1560, 5475, 353, 12677, 29889, 29924, 324, 1762, 12636, 5475, 29898, 29885, 29897, 13, 1678, 736, 1560, 5475, 13, 13, 13, 1753, 413, 1416, 352, 675, 29898, 3844, 5475, 1125, 13, 1678, 286, 353, 12677, 29889, 29924, 324, 4591, 12636, 5475, 29898, 3844, 5475, 29897, 13, 1678, 12677, 29889, 29968, 1416, 352, 675, 29898, 29885, 29897, 13, 1678, 1560, 5475, 353, 12677, 29889, 29924, 324, 1762, 12636, 5475, 29898, 29885, 29892, 413, 1416, 1297, 12636, 5475, 29922, 5574, 29897, 13, 1678, 736, 1560, 5475, 13, 13, 1753, 2302, 29918, 29882, 2941, 9102, 575, 29898, 3844, 5475, 1125, 13, 1678, 9995, 9995, 13, 1678, 286, 353, 12677, 29889, 29924, 324, 4591, 12636, 5475, 29898, 3844, 5475, 29897, 13, 13, 1678, 302, 29918, 29882, 11279, 1885, 353, 29871, 29900, 13, 13, 1678, 363, 263, 297, 286, 29889, 2577, 4178, 4835, 7295, 13, 4706, 302, 29918, 29882, 11279, 1885, 4619, 263, 29889, 2577, 11536, 8009, 29950, 29879, 580, 13, 4706, 396, 1596, 263, 29889, 2577, 4178, 25426, 8009, 580, 13, 4706, 396, 1596, 263, 29889, 2577, 11536, 8009, 29950, 29879, 580, 13, 4706, 396, 1596, 263, 29889, 2577, 8009, 9544, 4019, 29950, 29879, 580, 13, 4706, 396, 1596, 263, 29889, 2577, 8009, 24192, 4019, 29950, 29879, 580, 13, 13, 1678, 736, 302, 29918, 29882, 11279, 1885, 13, 13, 1753, 2302, 29918, 3844, 5475, 29898, 3844, 5475, 29918, 1761, 1125, 13, 1678, 9995, 13, 1678, 3917, 317, 10403, 17101, 491, 4969, 263, 8600, 411, 317, 10403, 17101, 408, 6611, 29892, 1298, 304, 278, 13, 1678, 1353, 310, 393, 3153, 317, 10403, 17101, 29889, 13, 13, 1678, 321, 29889, 29875, 29889, 9657, 29961, 3844, 5475, 29962, 353, 396, 310, 1560, 5475, 13, 13, 1678, 9995, 13, 13, 1678, 1560, 5475, 29918, 8977, 353, 6571, 13, 13, 1678, 7117, 29892, 7117, 29918, 2798, 353, 7442, 29889, 13092, 29898, 3844, 5475, 29918, 1761, 29892, 736, 29918, 2798, 29879, 29922, 5574, 29897, 13, 13, 1678, 363, 752, 29892, 2302, 297, 14319, 29898, 14036, 29892, 7117, 29918, 2798, 1125, 13, 4706, 1560, 5475, 29918, 8977, 29961, 2388, 29962, 353, 2302, 13, 13, 1678, 736, 1560, 5475, 29918, 8977, 13, 13, 13, 1753, 1014, 4440, 29918, 3844, 5475, 29898, 29909, 29892, 350, 1125, 13, 1678, 9995, 13, 1678, 319, 448, 350, 353, 315, 29886, 718, 315, 29876, 13, 13, 1678, 988, 315, 29886, 756, 6374, 2582, 13, 1678, 322, 315, 29876, 756, 8178, 2582, 13, 13, 1678, 9995, 13, 1678, 565, 338, 8758, 29898, 29909, 29892, 851, 1125, 319, 353, 319, 29889, 5451, 17350, 1159, 13, 1678, 565, 338, 8758, 29898, 29933, 29892, 851, 1125, 350, 353, 350, 29889, 5451, 17350, 1159, 13, 13, 1678, 315, 29886, 353, 5159, 13, 1678, 315, 29876, 353, 5159, 13, 1678, 319, 353, 2302, 29918, 3844, 5475, 29898, 29909, 29897, 13, 1678, 350, 353, 2302, 29918, 3844, 5475, 29898, 29933, 29897, 13, 1678, 363, 1820, 297, 7442, 29889, 13092, 29898, 1761, 29898, 29909, 29889, 8149, 3101, 718, 1051, 29898, 29933, 29889, 8149, 22130, 29901, 13, 13, 4706, 565, 1820, 451, 297, 319, 29901, 13, 9651, 315, 29876, 4619, 518, 1989, 29962, 334, 350, 29961, 1989, 29962, 13, 9651, 6773, 13, 13, 4706, 565, 1820, 451, 297, 350, 29901, 13, 9651, 315, 29886, 4619, 518, 1989, 29962, 334, 319, 29961, 1989, 29962, 13, 9651, 6773, 13, 13, 4706, 2923, 353, 319, 29961, 1989, 29962, 448, 350, 29961, 1989, 29962, 13, 13, 4706, 565, 2923, 1275, 29871, 29900, 29901, 13, 9651, 6773, 13, 4706, 25342, 2923, 1405, 29871, 29900, 29901, 13, 9651, 315, 29886, 4619, 518, 1989, 14178, 12765, 13, 4706, 25342, 2923, 529, 29871, 29900, 29901, 13, 9651, 315, 29876, 4619, 518, 1989, 14178, 6897, 29898, 12765, 29897, 13, 13, 1678, 736, 315, 29886, 29892, 315, 29876, 13, 13, 13, 1753, 18515, 292, 29898, 1563, 29918, 2975, 29892, 1492, 29918, 2975, 1125, 13, 13, 1678, 24114, 29918, 1563, 353, 5159, 13, 1678, 24114, 29918, 1266, 353, 5159, 13, 13, 1678, 2175, 29918, 2975, 353, 2302, 29918, 3844, 5475, 29898, 1563, 29918, 2975, 29897, 13, 1678, 1492, 29918, 2975, 353, 2302, 29918, 3844, 5475, 29898, 1266, 29918, 2975, 29897, 13, 13, 1678, 363, 1820, 297, 7442, 29889, 13092, 29898, 1761, 29898, 1563, 29918, 2975, 29889, 8149, 3101, 718, 1051, 29898, 1266, 29918, 2975, 29889, 8149, 22130, 29901, 13, 13, 4706, 565, 1820, 451, 297, 2175, 29918, 2975, 29901, 13, 9651, 1596, 703, 12199, 1159, 13, 9651, 23283, 580, 13, 13, 4706, 565, 1820, 451, 297, 1492, 29918, 2975, 29901, 13, 9651, 1596, 703, 12199, 29906, 1159, 13, 9651, 23283, 580, 13, 13, 4706, 2923, 353, 1492, 29918, 2975, 29961, 1989, 29962, 448, 2175, 29918, 2975, 29961, 1989, 29962, 13, 13, 4706, 565, 2923, 1275, 29871, 29900, 29901, 13, 9651, 6773, 13, 13, 4706, 25342, 2923, 1405, 29871, 29900, 29901, 13, 9651, 24114, 29918, 1563, 4619, 518, 1989, 29962, 334, 2923, 13, 13, 4706, 25342, 2923, 529, 29871, 29900, 29901, 13, 9651, 24114, 29918, 1266, 4619, 518, 1989, 29962, 334, 2923, 13, 13, 1678, 736, 24114, 29918, 1563, 29892, 24114, 29918, 1266, 13, 13, 13, 1753, 679, 29918, 29890, 898, 29918, 1853, 29898, 29885, 29892, 263, 29892, 289, 1125, 13, 13, 1678, 396, 6058, 29923, 13, 1678, 396, 960, 286, 338, 451, 413, 1416, 352, 1891, 769, 289, 13788, 508, 367, 319, 3491, 1299, 2965, 13, 1678, 396, 607, 338, 263, 1108, 363, 278, 4163, 27715, 13, 13, 1678, 1018, 29901, 13, 4706, 21224, 29918, 1853, 353, 851, 29898, 29885, 29889, 2577, 29933, 898, 29933, 300, 1452, 4178, 4835, 29898, 29874, 29892, 289, 467, 2577, 29933, 898, 1542, 3101, 13, 13, 1678, 5174, 23833, 2392, 29901, 13, 4706, 736, 7700, 13, 13, 1678, 565, 21224, 29918, 1853, 1275, 376, 29903, 4214, 1307, 1115, 13, 4706, 21224, 353, 5124, 13, 13, 1678, 25342, 21224, 29918, 1853, 1275, 376, 3970, 7466, 1307, 1115, 13, 4706, 21224, 353, 376, 543, 13, 13, 1678, 25342, 21224, 29918, 1853, 1275, 376, 29911, 3960, 29925, 1307, 1115, 13, 4706, 21224, 353, 12305, 29908, 13, 13, 1678, 1683, 29901, 13, 4706, 21224, 353, 7700, 13, 13, 1678, 736, 21224, 13, 13, 13, 1753, 679, 29918, 271, 4835, 29898, 3844, 5475, 29892, 11455, 29918, 29882, 11279, 1885, 29922, 5574, 1125, 13, 13, 1678, 1560, 5475, 353, 413, 1416, 352, 675, 29898, 3844, 5475, 29897, 13, 13, 1678, 282, 353, 337, 29889, 12198, 29898, 29878, 29908, 29961, 29909, 29899, 29999, 3816, 29874, 29899, 29920, 29962, 29973, 1159, 13, 1678, 28422, 353, 282, 29889, 2886, 497, 29898, 3844, 5475, 29897, 13, 13, 1678, 565, 11455, 29918, 29882, 11279, 1885, 29901, 13, 4706, 28422, 353, 518, 8678, 363, 12301, 297, 28422, 565, 12301, 2804, 376, 29950, 3108, 13, 13, 1678, 736, 28422, 13, 13, 13, 1753, 788, 29918, 484, 1141, 29890, 2470, 29898, 29885, 324, 29892, 1014, 4984, 1973, 1125, 13, 13, 1678, 1014, 4984, 1973, 353, 1051, 29898, 1491, 4984, 1973, 29897, 13, 13, 1678, 363, 432, 29892, 22645, 297, 26985, 29898, 1491, 4984, 1973, 1125, 13, 4706, 363, 474, 297, 22645, 29901, 13, 9651, 319, 353, 6062, 29889, 2577, 4178, 290, 3047, 1204, 29916, 29898, 29875, 29897, 13, 9651, 363, 350, 297, 319, 29889, 2577, 8139, 1141, 29890, 943, 7295, 13, 18884, 413, 353, 350, 29889, 2577, 1204, 29916, 580, 13, 18884, 1014, 4984, 1973, 29961, 29926, 29962, 4619, 313, 29895, 29892, 29897, 13, 13, 1678, 736, 1014, 4984, 1973, 13, 13, 13, 1753, 679, 29918, 14036, 29918, 484, 1141, 29890, 943, 29898, 29885, 324, 29892, 28422, 1125, 13, 13, 1678, 28422, 353, 1051, 29898, 271, 4835, 29897, 13, 13, 1678, 363, 22645, 297, 28422, 29901, 13, 4706, 22645, 29892, 353, 22645, 13, 4706, 319, 353, 6062, 29889, 2577, 4178, 290, 3047, 1204, 29916, 29898, 13140, 29897, 13, 13, 4706, 363, 350, 297, 319, 29889, 2577, 8139, 1141, 29890, 943, 7295, 13, 13, 9651, 22645, 29918, 29890, 353, 350, 29889, 2577, 1204, 29916, 580, 13, 9651, 12301, 353, 350, 29889, 2577, 4178, 25426, 8009, 580, 13, 9651, 8323, 353, 350, 29889, 2577, 2500, 284, 5914, 479, 580, 13, 9651, 21224, 353, 12677, 29889, 2577, 29933, 898, 29933, 300, 1452, 4178, 4835, 29898, 29885, 324, 29892, 22645, 29892, 22645, 29918, 29890, 29897, 13, 13, 1678, 736, 13, 13, 13, 1753, 679, 29918, 14036, 29898, 3844, 5475, 29892, 15040, 29892, 413, 1416, 352, 675, 29922, 5574, 29892, 788, 29922, 8824, 1125, 13, 13, 1678, 286, 353, 12677, 29889, 29924, 324, 4591, 12636, 5475, 29898, 3844, 5475, 29897, 13, 1678, 15040, 353, 12677, 29889, 29924, 324, 4591, 12636, 5708, 29898, 3844, 442, 29897, 13, 13, 1678, 565, 413, 1416, 352, 675, 29901, 13, 4706, 12677, 29889, 29968, 1416, 352, 675, 29898, 29885, 29897, 13, 13, 1678, 1014, 4984, 1973, 353, 286, 29889, 2577, 4035, 4984, 9652, 267, 29898, 3844, 442, 29897, 13, 13, 1678, 7117, 353, 5159, 13, 13, 1678, 565, 788, 29901, 13, 4706, 1014, 4984, 1973, 353, 788, 29918, 484, 1141, 29890, 2470, 29898, 29885, 29892, 1014, 4984, 1973, 29897, 13, 13, 13, 1678, 363, 1014, 297, 1014, 4984, 1973, 29901, 13, 13, 13, 4706, 565, 788, 29901, 13, 9651, 286, 29918, 1482, 353, 3509, 29889, 8552, 29898, 29885, 29897, 13, 9651, 286, 29918, 1482, 353, 12677, 29889, 29934, 26735, 324, 29898, 29885, 29918, 1482, 29897, 13, 13, 9651, 363, 350, 29892, 315, 297, 18240, 29898, 1491, 29961, 29896, 29901, 1402, 29871, 29906, 1125, 13, 18884, 286, 29918, 1482, 29889, 15941, 29933, 898, 29898, 29933, 29892, 315, 29897, 13, 4706, 1683, 29901, 13, 9651, 286, 29918, 1482, 353, 286, 13, 13, 4706, 4163, 353, 12677, 29889, 29924, 324, 8752, 1762, 12636, 5475, 29898, 29885, 29918, 1482, 29892, 13, 9651, 28422, 1762, 11403, 29922, 1491, 29892, 13, 9651, 338, 12392, 293, 12636, 5475, 29922, 5574, 29892, 13, 9651, 413, 1416, 1297, 12636, 5475, 29922, 5574, 29892, 13, 9651, 24420, 29922, 5574, 29897, 13, 13, 4706, 319, 353, 286, 29889, 2577, 4178, 290, 3047, 1204, 29916, 29898, 1491, 29961, 29900, 2314, 13, 13, 4706, 286, 29883, 353, 12677, 29889, 29924, 324, 4591, 12636, 5475, 29898, 9700, 29897, 13, 13, 4706, 302, 29918, 271, 4835, 353, 286, 29883, 29889, 2577, 8009, 4178, 4835, 580, 13, 4706, 302, 29918, 29890, 13788, 353, 7431, 29898, 14047, 29889, 2577, 29933, 13788, 3101, 13, 13, 4706, 4163, 353, 12677, 29889, 29924, 324, 1762, 12636, 5475, 29898, 14047, 29897, 13, 13, 4706, 565, 376, 13578, 297, 4163, 470, 11663, 29908, 297, 4163, 470, 376, 29950, 29908, 297, 4163, 29901, 13, 13, 9651, 396, 18064, 28893, 15833, 304, 2329, 278, 20139, 13206, 21337, 322, 1009, 6261, 13, 9651, 396, 27246, 9102, 575, 13, 13, 9651, 21090, 353, 7442, 29889, 3298, 359, 29898, 29876, 29918, 271, 4835, 29892, 26688, 29922, 524, 29897, 13, 13, 9651, 363, 22645, 297, 3464, 29898, 29876, 29918, 271, 4835, 1125, 13, 18884, 12301, 353, 286, 29883, 29889, 2577, 4178, 290, 3047, 1204, 29916, 29898, 13140, 29897, 13, 18884, 12301, 29889, 2697, 8009, 9544, 4019, 29950, 29879, 29898, 29900, 29897, 13, 18884, 8323, 353, 12301, 29889, 2577, 2500, 284, 5914, 479, 580, 13, 18884, 21090, 29961, 13140, 29962, 353, 8323, 13, 18884, 12301, 29889, 2697, 2500, 284, 5914, 479, 29898, 29900, 29897, 13, 13, 9651, 4163, 353, 12677, 29889, 29924, 324, 1762, 12636, 5475, 29898, 14047, 29892, 24420, 29922, 8824, 29897, 13, 9651, 4163, 353, 4163, 29889, 6506, 703, 29961, 613, 376, 2564, 6506, 703, 29962, 3284, 1159, 13, 13, 9651, 286, 29883, 353, 12677, 29889, 29924, 324, 4591, 12636, 5475, 29898, 9700, 29897, 13, 13, 9651, 363, 22645, 29892, 8323, 297, 14319, 29898, 3881, 29898, 29876, 29918, 271, 4835, 511, 21090, 1125, 13, 18884, 12301, 353, 286, 29883, 29889, 2577, 4178, 290, 3047, 1204, 29916, 29898, 13140, 29897, 13, 18884, 8323, 353, 938, 29898, 23367, 29897, 13, 18884, 12301, 29889, 2697, 2500, 284, 5914, 479, 29898, 23367, 29897, 13, 13, 9651, 4163, 353, 12677, 29889, 29924, 324, 1762, 12636, 5475, 29898, 14047, 29897, 13, 13, 13, 4706, 565, 302, 29918, 271, 4835, 5277, 302, 29918, 29890, 13788, 29901, 13, 13, 9651, 286, 29893, 353, 12677, 29889, 29934, 26735, 324, 29898, 29885, 29897, 13, 13, 9651, 565, 7431, 29898, 1491, 29897, 1275, 29871, 29941, 29901, 13, 18884, 286, 29893, 29889, 15941, 29933, 898, 29898, 1491, 29961, 29900, 1402, 1014, 14352, 29896, 2314, 13, 13, 9651, 25342, 7431, 29898, 1491, 29897, 1275, 29871, 29946, 470, 7431, 29898, 1491, 29897, 1275, 29871, 29945, 29901, 13, 18884, 363, 474, 297, 3464, 29898, 29900, 29892, 302, 29918, 271, 4835, 1125, 13, 462, 1678, 363, 432, 297, 3464, 29898, 29875, 29974, 29896, 29892, 302, 29918, 271, 4835, 1125, 13, 462, 4706, 565, 474, 1275, 29871, 29896, 470, 432, 1275, 29871, 29896, 29901, 6773, 13, 462, 4706, 286, 29893, 29889, 15941, 29933, 898, 29898, 1491, 29961, 29875, 1402, 1014, 29961, 29926, 2314, 13, 13, 9651, 4163, 353, 12677, 29889, 29924, 324, 8752, 1762, 12636, 5475, 29898, 29885, 29893, 29892, 13, 18884, 28422, 1762, 11403, 29922, 1491, 29892, 13, 18884, 338, 12392, 293, 12636, 5475, 29922, 5574, 29892, 13, 18884, 413, 1416, 1297, 12636, 5475, 29922, 5574, 29892, 13, 18884, 24420, 29922, 5574, 29897, 13, 13, 9651, 565, 376, 29896, 29908, 297, 4163, 29901, 13, 18884, 23283, 703, 2392, 4511, 2068, 1159, 13, 13, 4706, 1683, 29901, 13, 9651, 4163, 353, 12677, 29889, 29924, 324, 1762, 12636, 5475, 29898, 14047, 29897, 13, 13, 4706, 396, 8323, 353, 12677, 29889, 2577, 2500, 284, 5914, 479, 29898, 14047, 29897, 13, 4706, 396, 13, 4706, 396, 565, 451, 8323, 1275, 29871, 29900, 29901, 13, 4706, 396, 268, 396, 6058, 29923, 13, 4706, 396, 268, 396, 365, 1862, 310, 14568, 310, 565, 1206, 1623, 445, 6520, 13, 4706, 396, 13, 4706, 396, 268, 302, 29918, 271, 4835, 353, 286, 29883, 29889, 2577, 8009, 4178, 4835, 580, 13, 4706, 396, 13, 4706, 396, 268, 363, 474, 297, 3464, 29898, 29876, 29918, 271, 4835, 1125, 13, 4706, 396, 13, 4706, 396, 308, 12301, 353, 286, 29883, 29889, 2577, 4178, 290, 3047, 1204, 29916, 29898, 29875, 29897, 13, 4706, 396, 308, 8323, 353, 12301, 29889, 2577, 2500, 284, 5914, 479, 580, 13, 4706, 396, 13, 4706, 396, 308, 565, 451, 8323, 1275, 29871, 29900, 29901, 13, 4706, 396, 632, 12301, 29889, 2697, 2500, 284, 5914, 479, 29898, 29900, 29897, 13, 13, 4706, 4163, 353, 24420, 29898, 9700, 29897, 13, 4706, 7117, 4619, 518, 9700, 29962, 13, 13, 1678, 736, 7117, 13, 13, 13, 1753, 679, 29918, 14036, 29918, 816, 2004, 29896, 29898, 3844, 5475, 29892, 413, 1416, 352, 675, 29922, 5574, 1125, 13, 13, 1678, 274, 29896, 353, 14704, 29930, 29962, 30022, 29961, 29930, 18017, 13, 13, 1678, 565, 376, 13578, 297, 1560, 5475, 470, 11663, 29908, 297, 1560, 5475, 29901, 13, 4706, 1209, 13, 1678, 1683, 29901, 13, 4706, 736, 679, 29918, 14036, 29898, 3844, 5475, 29892, 274, 29896, 29897, 13, 13, 1678, 396, 450, 775, 2400, 1838, 29915, 29873, 679, 21090, 13, 1678, 736, 679, 29918, 14036, 29898, 3844, 5475, 29892, 274, 29896, 29897, 13, 13, 1678, 274, 29896, 353, 12677, 29889, 29924, 324, 4591, 12636, 5708, 29898, 29883, 29896, 29897, 13, 1678, 286, 353, 12677, 29889, 29924, 324, 4591, 12636, 5475, 29898, 3844, 5475, 29897, 13, 13, 1678, 565, 413, 1416, 352, 675, 29901, 13, 4706, 12677, 29889, 29968, 1416, 352, 675, 29898, 29885, 29897, 13, 13, 1678, 1014, 4984, 1973, 353, 286, 29889, 2577, 4035, 4984, 9652, 267, 29898, 29883, 29896, 29897, 13, 13, 1678, 7117, 353, 5159, 13, 13, 1678, 363, 1014, 297, 1014, 4984, 1973, 29901, 13, 13, 4706, 263, 29892, 289, 353, 1014, 13, 13, 4706, 633, 353, 679, 29918, 29890, 898, 29918, 1853, 29898, 29885, 29892, 263, 29892, 289, 29897, 13, 13, 4706, 263, 353, 286, 29889, 2577, 4178, 290, 3047, 1204, 29916, 29898, 29874, 467, 2577, 14730, 580, 13, 4706, 289, 353, 286, 29889, 2577, 4178, 290, 3047, 1204, 29916, 29898, 29890, 467, 2577, 14730, 580, 13, 13, 4706, 4163, 353, 263, 718, 633, 718, 289, 13, 4706, 7117, 29889, 4397, 29898, 9700, 29897, 13, 13, 1678, 7117, 353, 518, 3068, 265, 936, 29898, 9700, 29897, 363, 4163, 297, 7117, 29962, 13, 13, 1678, 736, 7117, 13, 13, 13, 1753, 679, 29918, 14036, 29918, 816, 2004, 29906, 29898, 3844, 5475, 29892, 413, 1416, 352, 675, 29922, 5574, 1125, 13, 13, 1678, 274, 29896, 353, 14704, 29928, 29906, 18017, 13, 1678, 274, 29906, 353, 14704, 29930, 29962, 30022, 29961, 29928, 29906, 29962, 30022, 29961, 29930, 18017, 13, 1678, 274, 29941, 353, 14704, 29930, 29962, 30022, 29961, 29928, 29941, 850, 30022, 29961, 29930, 2314, 30022, 29961, 29930, 18017, 13, 1678, 274, 29946, 353, 14704, 29930, 29962, 30022, 29961, 29930, 850, 30022, 29961, 29930, 2314, 29898, 30022, 29961, 29930, 2314, 30022, 29961, 29930, 18017, 13, 13, 1678, 396, 565, 376, 13578, 297, 1560, 5475, 470, 11663, 29908, 297, 1560, 5475, 29901, 13, 1678, 396, 268, 1209, 13, 1678, 396, 1683, 29901, 13, 1678, 7117, 353, 5159, 13, 1678, 7117, 4619, 679, 29918, 14036, 29898, 3844, 5475, 29892, 274, 29896, 29892, 788, 29922, 5574, 29897, 13, 1678, 396, 7117, 4619, 679, 29918, 14036, 29898, 3844, 5475, 29892, 274, 29906, 29897, 13, 1678, 7117, 4619, 679, 29918, 14036, 29898, 3844, 5475, 29892, 274, 29941, 29897, 13, 1678, 7117, 4619, 679, 29918, 14036, 29898, 3844, 5475, 29892, 274, 29946, 29897, 13, 13, 1678, 736, 7117, 13, 13, 1678, 274, 29906, 353, 12677, 29889, 29924, 324, 4591, 12636, 5708, 29898, 29883, 29906, 29897, 13, 1678, 274, 29941, 353, 12677, 29889, 29924, 324, 4591, 12636, 5708, 29898, 29883, 29941, 29897, 13, 1678, 274, 29946, 353, 12677, 29889, 29924, 324, 4591, 12636, 5708, 29898, 29883, 29946, 29897, 13, 13, 1678, 286, 353, 12677, 29889, 29924, 324, 4591, 12636, 5475, 29898, 3844, 5475, 29897, 13, 13, 1678, 565, 413, 1416, 352, 675, 29901, 13, 4706, 12677, 29889, 29968, 1416, 352, 675, 29898, 29885, 29897, 13, 13, 1678, 1014, 4984, 1973, 353, 286, 29889, 2577, 4035, 4984, 9652, 267, 29898, 29883, 29906, 29897, 13, 13, 1678, 7117, 353, 5159, 13, 13, 1678, 363, 1014, 297, 1014, 4984, 1973, 29901, 13, 13, 4706, 263, 29892, 289, 29892, 274, 353, 1014, 13, 13, 4706, 633, 353, 679, 29918, 29890, 898, 29918, 1853, 29898, 29885, 29892, 263, 29892, 289, 29897, 13, 4706, 289, 29883, 353, 679, 29918, 29890, 898, 29918, 1853, 29898, 29885, 29892, 289, 29892, 274, 29897, 13, 13, 4706, 263, 353, 286, 29889, 2577, 4178, 290, 3047, 1204, 29916, 29898, 29874, 467, 2577, 14730, 580, 13, 4706, 289, 353, 286, 29889, 2577, 4178, 290, 3047, 1204, 29916, 29898, 29890, 467, 2577, 14730, 580, 13, 4706, 274, 353, 286, 29889, 2577, 4178, 290, 3047, 1204, 29916, 29898, 29883, 467, 2577, 14730, 580, 13, 13, 4706, 4163, 353, 263, 718, 633, 718, 289, 718, 289, 29883, 718, 274, 13, 4706, 7117, 29889, 4397, 29898, 9700, 29897, 13, 13, 1678, 1014, 4984, 1973, 353, 286, 29889, 2577, 4035, 4984, 9652, 267, 29898, 29883, 29941, 29897, 13, 13, 1678, 363, 1014, 297, 1014, 4984, 1973, 29901, 13, 13, 4706, 263, 29892, 289, 29892, 274, 29892, 270, 353, 1014, 13, 13, 4706, 633, 353, 679, 29918, 29890, 898, 29918, 1853, 29898, 29885, 29892, 263, 29892, 289, 29897, 13, 4706, 289, 29883, 353, 679, 29918, 29890, 898, 29918, 1853, 29898, 29885, 29892, 289, 29892, 274, 29897, 13, 4706, 289, 29881, 353, 679, 29918, 29890, 898, 29918, 1853, 29898, 29885, 29892, 289, 29892, 270, 29897, 13, 13, 4706, 263, 353, 286, 29889, 2577, 4178, 290, 3047, 1204, 29916, 29898, 29874, 467, 2577, 14730, 580, 13, 4706, 289, 353, 286, 29889, 2577, 4178, 290, 3047, 1204, 29916, 29898, 29890, 467, 2577, 14730, 580, 13, 4706, 274, 353, 286, 29889, 2577, 4178, 290, 3047, 1204, 29916, 29898, 29883, 467, 2577, 14730, 580, 13, 4706, 270, 353, 286, 29889, 2577, 4178, 290, 3047, 1204, 29916, 29898, 29881, 467, 2577, 14730, 580, 13, 13, 4706, 4163, 353, 263, 718, 633, 718, 289, 718, 376, 703, 718, 289, 29883, 718, 274, 718, 376, 5513, 718, 289, 29881, 718, 270, 13, 4706, 7117, 29889, 4397, 29898, 9700, 29897, 13, 13, 1678, 1014, 4984, 1973, 353, 286, 29889, 2577, 4035, 4984, 9652, 267, 29898, 29883, 29946, 29897, 13, 13, 1678, 363, 1014, 297, 1014, 4984, 1973, 29901, 13, 13, 4706, 263, 29892, 289, 29892, 274, 29892, 270, 29892, 321, 353, 1014, 13, 13, 4706, 633, 353, 679, 29918, 29890, 898, 29918, 1853, 29898, 29885, 29892, 263, 29892, 289, 29897, 13, 4706, 289, 29883, 353, 679, 29918, 29890, 898, 29918, 1853, 29898, 29885, 29892, 289, 29892, 274, 29897, 13, 4706, 289, 29881, 353, 679, 29918, 29890, 898, 29918, 1853, 29898, 29885, 29892, 289, 29892, 270, 29897, 13, 4706, 367, 353, 679, 29918, 29890, 898, 29918, 1853, 29898, 29885, 29892, 289, 29892, 321, 29897, 13, 13, 4706, 263, 353, 286, 29889, 2577, 4178, 290, 3047, 1204, 29916, 29898, 29874, 467, 2577, 14730, 580, 13, 4706, 289, 353, 286, 29889, 2577, 4178, 290, 3047, 1204, 29916, 29898, 29890, 467, 2577, 14730, 580, 13, 4706, 274, 353, 286, 29889, 2577, 4178, 290, 3047, 1204, 29916, 29898, 29883, 467, 2577, 14730, 580, 13, 4706, 270, 353, 286, 29889, 2577, 4178, 290, 3047, 1204, 29916, 29898, 29881, 467, 2577, 14730, 580, 13, 4706, 321, 353, 286, 29889, 2577, 4178, 290, 3047, 1204, 29916, 29898, 29872, 467, 2577, 14730, 580, 13, 13, 4706, 4163, 353, 263, 718, 633, 718, 289, 13, 4706, 4163, 4619, 376, 703, 718, 289, 29883, 718, 274, 718, 376, 5513, 13, 4706, 4163, 4619, 376, 703, 718, 289, 29881, 718, 270, 718, 376, 5513, 13, 4706, 4163, 4619, 367, 718, 321, 13, 13, 4706, 7117, 29889, 4397, 29898, 9700, 29897, 13, 13, 1678, 7117, 353, 518, 3068, 265, 936, 29898, 9700, 29897, 363, 4163, 297, 7117, 29962, 13, 13, 1678, 736, 7117, 13, 13, 13, 1753, 316, 2388, 609, 296, 29898, 3844, 5475, 29892, 11380, 29922, 29896, 1125, 13, 13, 1678, 565, 11380, 1275, 29871, 29896, 29901, 316, 2388, 609, 296, 29918, 816, 2004, 353, 316, 2388, 609, 296, 29918, 816, 2004, 29896, 13, 1678, 25342, 11380, 1275, 29871, 29906, 29901, 316, 2388, 609, 296, 29918, 816, 2004, 353, 316, 2388, 609, 296, 29918, 816, 2004, 29906, 13, 13, 1678, 2175, 29892, 1492, 353, 316, 2388, 609, 296, 29918, 816, 2004, 29898, 3844, 5475, 29897, 13, 13, 1678, 736, 2175, 29892, 1492, 13, 13, 13, 1753, 316, 2388, 609, 296, 29918, 816, 2004, 29896, 29898, 3844, 5475, 1125, 13, 1678, 9995, 13, 1678, 323, 1540, 278, 6306, 13, 1678, 319, 313, 1327, 29897, 1149, 29099, 13, 13, 1678, 988, 13, 1678, 319, 313, 5182, 29897, 338, 4802, 1560, 5475, 13, 1678, 29099, 313, 816, 2004, 29896, 7117, 29897, 338, 11380, 29906, 7117, 13, 1678, 289, 29890, 313, 271, 4835, 29897, 338, 5684, 289, 13788, 3734, 29892, 304, 505, 1592, 2741, 289, 13788, 373, 1269, 2625, 13, 13, 1678, 445, 338, 2309, 363, 1269, 319, 607, 11624, 310, 7431, 29898, 7340, 29897, 1405, 29871, 29900, 13, 13, 1678, 9995, 13, 13, 1678, 7117, 353, 679, 29918, 14036, 29918, 816, 2004, 29896, 29898, 3844, 5475, 29897, 13, 13, 1678, 565, 7431, 29898, 14036, 29897, 1275, 29871, 29900, 29901, 13, 4706, 736, 19997, 5159, 13, 13, 1678, 289, 13788, 29918, 1563, 2975, 353, 679, 29918, 271, 4835, 29898, 3844, 5475, 29897, 13, 1678, 289, 13788, 29918, 1266, 2975, 353, 5159, 13, 13, 1678, 363, 4163, 297, 7117, 29901, 13, 4706, 289, 13788, 29918, 1266, 2975, 4619, 679, 29918, 271, 4835, 29898, 9700, 29897, 13, 13, 1678, 2175, 29892, 1492, 353, 18515, 292, 29898, 29890, 13788, 29918, 1563, 2975, 29892, 289, 13788, 29918, 1266, 2975, 29897, 13, 13, 1678, 1492, 4619, 7117, 13, 13, 1678, 736, 2175, 29892, 1492, 13, 13, 13, 1753, 316, 2388, 609, 296, 29918, 816, 2004, 29906, 29898, 3844, 5475, 1125, 13, 1678, 9995, 13, 1678, 323, 1540, 278, 6306, 13, 1678, 319, 313, 1327, 29897, 1149, 29099, 13, 13, 1678, 988, 13, 1678, 319, 313, 5182, 29897, 338, 4802, 1560, 5475, 13, 1678, 29099, 313, 816, 2004, 29906, 7117, 29897, 338, 11380, 29906, 7117, 13, 1678, 289, 29890, 313, 14369, 289, 13788, 29897, 338, 5684, 289, 13788, 3734, 29892, 304, 505, 1592, 2741, 289, 13788, 373, 1269, 2625, 13, 13, 1678, 445, 338, 2309, 363, 1269, 319, 607, 11624, 310, 7431, 29898, 7340, 29897, 1405, 29871, 29900, 13, 13, 1678, 9995, 13, 13, 1678, 7117, 353, 679, 29918, 14036, 29918, 816, 2004, 29906, 29898, 3844, 5475, 29897, 13, 13, 1678, 565, 7431, 29898, 14036, 29897, 1275, 29871, 29900, 29901, 13, 4706, 736, 19997, 5159, 13, 13, 1678, 289, 13788, 29918, 1563, 2975, 353, 679, 29918, 14036, 29918, 816, 2004, 29896, 29898, 3844, 5475, 29897, 13, 1678, 289, 13788, 29918, 1266, 2975, 353, 5159, 13, 13, 1678, 363, 4163, 297, 7117, 29901, 13, 4706, 289, 13788, 29918, 1266, 2975, 4619, 679, 29918, 14036, 29918, 816, 2004, 29896, 29898, 9700, 29897, 13, 13, 1678, 2175, 29892, 1492, 353, 18515, 292, 29898, 29890, 13788, 29918, 1563, 2975, 29892, 289, 13788, 29918, 1266, 2975, 29897, 13, 13, 1678, 1492, 4619, 7117, 13, 13, 1678, 565, 451, 1423, 29918, 271, 4835, 4197, 3844, 5475, 29962, 718, 2175, 29892, 1492, 1125, 13, 4706, 1596, 703, 2392, 297, 13855, 8423, 260, 1540, 292, 29901, 613, 1560, 5475, 29897, 13, 4706, 1596, 4197, 3844, 5475, 1402, 2175, 29892, 1492, 29897, 13, 4706, 23283, 580, 13, 13, 13, 1678, 736, 2175, 29892, 1492, 13, 13, 13, 1753, 1121, 424, 29898, 8423, 1934, 29892, 9316, 29892, 11380, 29922, 29896, 1125, 13, 1678, 9995, 13, 1678, 3836, 2168, 393, 1560, 5475, 8857, 526, 1716, 6219, 17350, 1159, 322, 24420, 472, 445, 1298, 13, 13, 1678, 9995, 13, 13, 1678, 7657, 1934, 29918, 1563, 2975, 353, 5159, 13, 1678, 7657, 1934, 29918, 1266, 2975, 353, 5159, 13, 1678, 9316, 29918, 1563, 2975, 353, 5159, 13, 1678, 9316, 29918, 1266, 2975, 353, 5159, 13, 13, 1678, 7657, 1934, 29918, 27259, 353, 5159, 13, 1678, 9316, 29918, 27259, 353, 5159, 13, 13, 1678, 565, 11380, 1275, 29871, 29896, 29901, 13, 4706, 316, 2388, 609, 296, 29918, 816, 2004, 353, 316, 2388, 609, 296, 29918, 816, 2004, 29896, 13, 1678, 25342, 11380, 1275, 29871, 29906, 29901, 13, 4706, 316, 2388, 609, 296, 29918, 816, 2004, 353, 316, 2388, 609, 296, 29918, 816, 2004, 29906, 13, 13, 1678, 363, 7657, 424, 297, 7657, 1934, 29901, 13, 4706, 2175, 29892, 1492, 353, 316, 2388, 609, 296, 29918, 816, 2004, 29898, 8423, 424, 29897, 13, 13, 4706, 565, 7431, 29898, 1563, 29897, 1275, 29871, 29900, 322, 7431, 29898, 1266, 29897, 1275, 29871, 29900, 29901, 13, 9651, 7657, 1934, 29918, 27259, 4619, 518, 8423, 424, 29962, 13, 13, 4706, 7657, 1934, 29918, 1563, 2975, 4619, 2175, 13, 4706, 7657, 1934, 29918, 1266, 2975, 4619, 1492, 13, 13, 1678, 363, 3234, 297, 9316, 29901, 13, 4706, 2175, 29892, 1492, 353, 316, 2388, 609, 296, 29918, 816, 2004, 29898, 4704, 29897, 13, 13, 4706, 565, 7431, 29898, 1563, 29897, 1275, 29871, 29900, 322, 7431, 29898, 1266, 29897, 1275, 29871, 29900, 29901, 13, 9651, 9316, 29918, 27259, 4619, 518, 4704, 29962, 13, 13, 4706, 9316, 29918, 1563, 2975, 4619, 2175, 13, 4706, 9316, 29918, 1266, 2975, 4619, 1492, 13, 13, 1678, 2175, 29918, 1066, 3321, 29892, 2175, 29918, 22198, 353, 1014, 4440, 29918, 3844, 5475, 29898, 14456, 29918, 1563, 2975, 29892, 7657, 1934, 29918, 1563, 2975, 29897, 13, 1678, 1492, 29918, 1066, 3321, 29892, 1492, 29918, 22198, 353, 1014, 4440, 29918, 3844, 5475, 29898, 14456, 29918, 1266, 2975, 29892, 7657, 1934, 29918, 1266, 2975, 29897, 13, 13, 1678, 2175, 353, 2175, 29918, 1066, 3321, 718, 1492, 29918, 22198, 718, 7657, 1934, 29918, 27259, 13, 1678, 1492, 353, 1492, 29918, 1066, 3321, 718, 2175, 29918, 22198, 718, 9316, 29918, 27259, 13, 13, 1678, 2175, 29892, 1492, 353, 1014, 4440, 29918, 3844, 5475, 29898, 1563, 29892, 1492, 29897, 13, 13, 1678, 27246, 9102, 575, 29918, 1563, 353, 29871, 29900, 13, 1678, 27246, 9102, 575, 29918, 1266, 353, 29871, 29900, 13, 13, 1678, 363, 1269, 297, 2175, 29901, 13, 4706, 27246, 9102, 575, 29918, 1563, 4619, 2302, 29918, 29882, 2941, 9102, 575, 29898, 4204, 29897, 13, 13, 1678, 363, 1269, 297, 1492, 29901, 13, 4706, 27246, 9102, 575, 29918, 1266, 4619, 2302, 29918, 29882, 2941, 9102, 575, 29898, 4204, 29897, 13, 13, 1678, 260, 1540, 29918, 29882, 2941, 9102, 575, 353, 27246, 9102, 575, 29918, 1563, 448, 27246, 9102, 575, 29918, 1266, 13, 13, 1678, 565, 260, 1540, 29918, 29882, 2941, 9102, 575, 529, 29871, 29900, 29901, 13, 4706, 2175, 4619, 6024, 29961, 29950, 29974, 29962, 2033, 29930, 6897, 29898, 29873, 1540, 29918, 29882, 2941, 9102, 575, 29897, 13, 13, 1678, 565, 260, 1540, 29918, 29882, 2941, 9102, 575, 1405, 29871, 29900, 29901, 13, 4706, 1492, 4619, 6024, 29961, 29950, 29974, 29962, 2033, 29930, 29873, 1540, 29918, 29882, 2941, 9102, 575, 13, 13, 1678, 736, 2175, 29892, 1492, 13, 13, 13, 1753, 6219, 29918, 3844, 5475, 29898, 3844, 5475, 29892, 954, 29918, 19570, 29922, 8516, 1125, 13, 1678, 9995, 13, 1678, 1353, 409, 546, 1061, 954, 29918, 19570, 313, 29872, 29889, 29887, 29889, 29871, 29941, 29916, 4174, 29892, 954, 29918, 5965, 543, 29916, 1159, 13, 1678, 9995, 13, 13, 1678, 565, 1134, 29898, 3844, 5475, 29897, 1275, 1134, 703, 29908, 1125, 13, 4706, 1560, 5475, 29918, 1761, 353, 1560, 5475, 29889, 5451, 17350, 1159, 13, 13, 1678, 1683, 29901, 13, 4706, 1560, 5475, 29918, 1761, 353, 1560, 5475, 13, 4706, 363, 474, 29892, 1560, 5475, 297, 26985, 29898, 3844, 5475, 29918, 1761, 1125, 13, 9651, 1560, 5475, 353, 1560, 5475, 29889, 5451, 17350, 1159, 13, 9651, 565, 7431, 29898, 3844, 5475, 29897, 1405, 29871, 29896, 29901, 13, 18884, 1560, 5475, 29918, 1761, 29961, 29875, 29962, 353, 1560, 5475, 29961, 29900, 29962, 13, 18884, 1560, 5475, 29918, 1761, 4619, 1560, 5475, 29961, 29896, 17531, 13, 13, 1678, 565, 954, 29918, 19570, 29901, 13, 4706, 363, 474, 29892, 1560, 5475, 297, 26985, 29898, 3844, 5475, 29918, 1761, 1125, 13, 9651, 565, 954, 29918, 19570, 297, 1560, 5475, 29901, 13, 18884, 954, 29892, 1560, 5475, 353, 1560, 5475, 29889, 5451, 29898, 1949, 29918, 19570, 29897, 13, 18884, 954, 353, 938, 29898, 1949, 29897, 13, 13, 18884, 1560, 5475, 29918, 1761, 29961, 29875, 29962, 353, 1560, 5475, 13, 18884, 1560, 5475, 29918, 1761, 4619, 518, 3844, 5475, 14178, 29898, 1949, 29899, 29896, 29897, 13, 13, 1678, 736, 1560, 5475, 29918, 1761, 13, 13, 13, 1753, 26324, 29882, 29918, 29876, 29898, 8423, 1934, 29892, 9316, 29892, 11380, 29892, 437, 29918, 3068, 265, 936, 29922, 5574, 1125, 13, 1678, 9995, 13, 1678, 4803, 4511, 2068, 29899, 6707, 6128, 4135, 363, 19848, 313, 8423, 1934, 1599, 9316, 29897, 13, 13, 1678, 297, 29901, 13, 4706, 7657, 1934, 1192, 1051, 310, 317, 10403, 17101, 13, 4706, 9316, 1192, 1051, 310, 317, 10403, 17101, 13, 4706, 11380, 1192, 938, 3233, 310, 1826, 20752, 440, 1017, 13, 13, 1678, 714, 29901, 13, 4706, 2175, 1192, 1051, 310, 1560, 5475, 363, 278, 7657, 424, 760, 310, 278, 315, 29933, 29950, 29876, 19848, 13, 4706, 1492, 1192, 1051, 310, 1560, 5475, 363, 278, 3234, 760, 310, 278, 315, 29933, 29950, 29876, 19848, 13, 1678, 9995, 13, 13, 1678, 565, 437, 29918, 3068, 265, 936, 29901, 13, 4706, 7657, 1934, 353, 518, 3068, 265, 936, 29898, 3844, 5475, 29897, 363, 1560, 5475, 297, 7657, 1934, 29962, 13, 4706, 9316, 353, 518, 3068, 265, 936, 29898, 3844, 5475, 29897, 363, 1560, 5475, 297, 9316, 29962, 13, 13, 1678, 2175, 29892, 1492, 353, 1121, 424, 29898, 8423, 1934, 29892, 9316, 29892, 11380, 29922, 816, 2004, 29897, 13, 13, 1678, 736, 2175, 29892, 1492, 13, 13, 13, 1753, 1423, 29918, 271, 4835, 29898, 8423, 1934, 29892, 9316, 1125, 13, 1678, 9995, 13, 1678, 5399, 278, 2854, 537, 310, 278, 19848, 29889, 13, 13, 1678, 830, 2467, 881, 505, 11594, 29889, 694, 29889, 310, 28422, 363, 1716, 7657, 1934, 322, 9316, 29889, 13, 13, 1678, 9995, 13, 13, 1678, 7548, 4835, 353, 518, 657, 29918, 271, 4835, 29898, 3844, 5475, 29897, 363, 1560, 5475, 297, 7657, 1934, 29962, 13, 1678, 2373, 4835, 353, 518, 657, 29918, 271, 4835, 29898, 3844, 5475, 29897, 363, 1560, 5475, 297, 9316, 29962, 13, 13, 1678, 396, 1652, 8606, 13, 1678, 7548, 4835, 353, 2533, 29898, 3605, 4835, 29892, 518, 2314, 13, 1678, 2373, 4835, 353, 2533, 29898, 5031, 4835, 29892, 518, 2314, 13, 13, 1678, 7548, 4835, 29889, 6605, 580, 13, 1678, 2373, 4835, 29889, 6605, 580, 13, 13, 1678, 736, 7548, 4835, 1275, 2373, 4835, 13, 13, 1753, 1423, 29918, 276, 2467, 29898, 8423, 1934, 29892, 9316, 1125, 13, 1678, 9995, 13, 1678, 9995, 13, 1678, 565, 338, 8758, 29898, 8423, 1934, 29892, 1051, 1125, 7657, 1934, 353, 376, 1213, 29889, 7122, 29898, 8423, 1934, 29897, 13, 1678, 565, 338, 8758, 29898, 14456, 29892, 1051, 1125, 9316, 353, 376, 1213, 29889, 7122, 29898, 14456, 29897, 13, 13, 1678, 7657, 1934, 353, 12677, 29889, 29924, 324, 4591, 12636, 5475, 29898, 8423, 1934, 29897, 13, 1678, 9316, 353, 12677, 29889, 29924, 324, 4591, 12636, 5475, 29898, 14456, 29897, 13, 1678, 736, 364, 29881, 29924, 324, 4002, 924, 943, 29889, 7856, 29883, 29924, 324, 2500, 2497, 29898, 8423, 1934, 29897, 1275, 364, 29881, 29924, 324, 4002, 924, 943, 29889, 7856, 29883, 29924, 324, 2500, 2497, 29898, 14456, 29897, 13, 13, 13, 13, 2 ]
mlcomp/parallelm/pipeline/component_dir_helper.py
lisapm/mlpiper
7
198337
<filename>mlcomp/parallelm/pipeline/component_dir_helper.py<gh_stars>1-10 import pkg_resources import logging import os from parallelm.common.base import Base class ComponentDirHelper(Base): def __init__(self, pkg, main_program): """ Extract component directory outside of egg, so an external command can run :param main_program: The main program to run. E.g. main.py :param pkg: The package the main_program is in, this is required in order to extract the files of the componenbt outisde the egg """ super(ComponentDirHelper, self).__init__(logging.getLogger(self.logger_name())) self._logger.debug("pkg: {}, main_program: {}".format(pkg, main_program)) self._pkg = pkg self._main_program = main_program def extract_component_out_of_egg(self): """ The artifact dir will contain all the files needed to run the R code. This method will copy the files outside of the egg into the artifact dir :return: """ # TODO: check what happens if we have a directory inside the component dir ll = pkg_resources.resource_listdir(self._pkg, "") for file_name in ll: real_file_name = pkg_resources.resource_filename(self._pkg, file_name) self._logger.debug("file: {}".format(file_name)) self._logger.debug("real_file: {}".format(real_file_name)) # Finding the directory we need to CD into base_file = os.path.basename(self._main_program) self._logger.debug("base_file: ".format(base_file)) real_file_name = pkg_resources.resource_filename(self._pkg, base_file) component_extracted_dir = os.path.dirname(real_file_name) self._logger.debug("Extraction dir: {}".format(component_extracted_dir)) self._logger.debug("Done building artifact dir:") self._logger.debug("======================") return component_extracted_dir
[ 1, 529, 9507, 29958, 828, 2388, 29914, 23482, 29885, 29914, 13096, 5570, 29914, 9700, 29918, 3972, 29918, 20907, 29889, 2272, 29966, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 5215, 282, 9415, 29918, 13237, 13, 5215, 12183, 13, 5215, 2897, 13, 13, 3166, 8943, 29885, 29889, 9435, 29889, 3188, 1053, 7399, 13, 13, 13, 1990, 15924, 9170, 10739, 29898, 5160, 1125, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 282, 9415, 29892, 1667, 29918, 8860, 1125, 13, 4706, 9995, 13, 4706, 7338, 1461, 4163, 3884, 5377, 310, 19710, 29892, 577, 385, 7029, 1899, 508, 1065, 13, 13, 4706, 584, 3207, 1667, 29918, 8860, 29901, 450, 1667, 1824, 304, 1065, 29889, 382, 29889, 29887, 29889, 1667, 29889, 2272, 13, 4706, 584, 3207, 282, 9415, 29901, 450, 3577, 278, 1667, 29918, 8860, 338, 297, 29892, 445, 338, 3734, 297, 1797, 304, 6597, 278, 2066, 310, 278, 2964, 264, 3116, 13, 462, 1678, 714, 275, 311, 278, 19710, 13, 4706, 9995, 13, 4706, 2428, 29898, 5308, 9170, 10739, 29892, 1583, 467, 1649, 2344, 12035, 21027, 29889, 657, 16363, 29898, 1311, 29889, 21707, 29918, 978, 22130, 13, 4706, 1583, 3032, 21707, 29889, 8382, 703, 15865, 29901, 24335, 1667, 29918, 8860, 29901, 6571, 1642, 4830, 29898, 15865, 29892, 1667, 29918, 8860, 876, 13, 4706, 1583, 3032, 15865, 353, 282, 9415, 13, 4706, 1583, 3032, 3396, 29918, 8860, 353, 1667, 29918, 8860, 13, 13, 1678, 822, 6597, 29918, 9700, 29918, 449, 29918, 974, 29918, 387, 29887, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 450, 24238, 4516, 674, 1712, 599, 278, 2066, 4312, 304, 1065, 278, 390, 775, 29889, 13, 4706, 910, 1158, 674, 3509, 278, 2066, 5377, 310, 278, 19710, 964, 278, 24238, 4516, 13, 4706, 584, 2457, 29901, 13, 4706, 9995, 13, 13, 4706, 396, 14402, 29901, 1423, 825, 5930, 565, 591, 505, 263, 3884, 2768, 278, 4163, 4516, 13, 4706, 11148, 353, 282, 9415, 29918, 13237, 29889, 10314, 29918, 1761, 3972, 29898, 1311, 3032, 15865, 29892, 20569, 13, 4706, 363, 934, 29918, 978, 297, 11148, 29901, 13, 9651, 1855, 29918, 1445, 29918, 978, 353, 282, 9415, 29918, 13237, 29889, 10314, 29918, 9507, 29898, 1311, 3032, 15865, 29892, 934, 29918, 978, 29897, 13, 9651, 1583, 3032, 21707, 29889, 8382, 703, 1445, 29901, 418, 6571, 1642, 4830, 29898, 1445, 29918, 978, 876, 13, 9651, 1583, 3032, 21707, 29889, 8382, 703, 6370, 29918, 1445, 29901, 6571, 1642, 4830, 29898, 6370, 29918, 1445, 29918, 978, 876, 13, 13, 4706, 396, 383, 4015, 278, 3884, 591, 817, 304, 7307, 964, 13, 4706, 2967, 29918, 1445, 353, 2897, 29889, 2084, 29889, 6500, 3871, 29898, 1311, 3032, 3396, 29918, 8860, 29897, 13, 4706, 1583, 3032, 21707, 29889, 8382, 703, 3188, 29918, 1445, 29901, 11393, 4830, 29898, 3188, 29918, 1445, 876, 13, 4706, 1855, 29918, 1445, 29918, 978, 353, 282, 9415, 29918, 13237, 29889, 10314, 29918, 9507, 29898, 1311, 3032, 15865, 29892, 2967, 29918, 1445, 29897, 13, 4706, 4163, 29918, 21111, 287, 29918, 3972, 353, 2897, 29889, 2084, 29889, 25721, 29898, 6370, 29918, 1445, 29918, 978, 29897, 13, 4706, 1583, 3032, 21707, 29889, 8382, 703, 5647, 13857, 4516, 29901, 6571, 1642, 4830, 29898, 9700, 29918, 21111, 287, 29918, 3972, 876, 13, 4706, 1583, 3032, 21707, 29889, 8382, 703, 25632, 5214, 24238, 4516, 29901, 1159, 13, 4706, 1583, 3032, 21707, 29889, 8382, 703, 9166, 2751, 26359, 29897, 13, 4706, 736, 4163, 29918, 21111, 287, 29918, 3972, 13, 13, 13, 2 ]
test.py
nerdingitout/STT--
0
28057
<gh_stars>0 import pandas as pd import json import csv # importing the module import json # Opening JSON file with open('response.json') as json_file: data = json.load(json_file) # for reading nested data [0] represents # the index value of the list print(data['results'][0]['alternatives']['transcript']) # for printing the key-value pair of # nested dictionary for looop can be used print("\nPrinting nested dicitonary as a key-value pair\n") for i in data['people1']: print("Name:", i['name']) print("Website:", i['website']) print("From:", i['from']) print() #def json_csv(filename): # with open(filename) as data_file: #opening json file # data = json.load(data_file) #loading json data # normalized_df = pd.json_normalize(data) # print(normalized_df['results'][0]) # normalized_df.to_csv('my_csv_file.csv',index=False) # return pd.DataFrame(data['results']) json_csv('response.json') #calling the json_csv function, paramter is the source json file #file = open('response.json') #obj = json.load(file) #for element in obj['results']: # for alternative in element['alternatives']: # for stamp in alternative['timestamps']: # name, value1, value2 = stamp # print(stamp)
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 5215, 11701, 408, 10518, 13, 5215, 4390, 13, 5215, 11799, 13, 13, 13, 13, 29937, 28348, 278, 3883, 29871, 13, 5215, 4390, 29871, 13, 259, 13, 29937, 4673, 292, 4663, 934, 29871, 13, 2541, 1722, 877, 5327, 29889, 3126, 1495, 408, 4390, 29918, 1445, 29901, 29871, 13, 1678, 848, 353, 4390, 29889, 1359, 29898, 3126, 29918, 1445, 29897, 29871, 13, 259, 13, 1678, 396, 363, 5183, 9322, 848, 518, 29900, 29962, 11524, 29871, 13, 1678, 396, 278, 2380, 995, 310, 278, 1051, 29871, 13, 1678, 1596, 29898, 1272, 1839, 9902, 2033, 29961, 29900, 22322, 26123, 5056, 16215, 3286, 924, 11287, 29871, 13, 539, 13, 1678, 396, 363, 14010, 278, 1820, 29899, 1767, 5101, 310, 29871, 13, 1678, 396, 9322, 8600, 363, 658, 26793, 508, 367, 1304, 29871, 13, 1678, 1596, 14182, 29876, 11816, 292, 9322, 12124, 277, 265, 653, 408, 263, 1820, 29899, 1767, 5101, 29905, 29876, 1159, 29871, 13, 1678, 363, 474, 297, 848, 1839, 25719, 29896, 2033, 29901, 29871, 13, 4706, 1596, 703, 1170, 29901, 613, 474, 1839, 978, 11287, 29871, 13, 4706, 1596, 703, 3609, 2746, 29901, 613, 474, 1839, 22942, 11287, 29871, 13, 4706, 1596, 703, 4591, 29901, 613, 474, 1839, 3166, 11287, 29871, 13, 4706, 1596, 580, 29871, 13, 13, 13, 29937, 1753, 4390, 29918, 7638, 29898, 9507, 1125, 13, 29937, 1678, 411, 1722, 29898, 9507, 29897, 408, 848, 29918, 1445, 29901, 396, 3150, 292, 4390, 934, 13, 29937, 4706, 848, 353, 4390, 29889, 1359, 29898, 1272, 29918, 1445, 29897, 396, 13234, 4390, 848, 13, 29937, 4706, 4226, 1891, 29918, 2176, 353, 10518, 29889, 3126, 29918, 8945, 675, 29898, 1272, 29897, 13, 29937, 4706, 1596, 29898, 8945, 1891, 29918, 2176, 1839, 9902, 2033, 29961, 29900, 2314, 13, 29937, 4706, 4226, 1891, 29918, 2176, 29889, 517, 29918, 7638, 877, 1357, 29918, 7638, 29918, 1445, 29889, 7638, 742, 2248, 29922, 8824, 29897, 13, 29937, 1678, 736, 10518, 29889, 17271, 29898, 1272, 1839, 9902, 11287, 13, 13, 3126, 29918, 7638, 877, 5327, 29889, 3126, 1495, 396, 4804, 292, 278, 4390, 29918, 7638, 740, 29892, 1828, 357, 338, 278, 2752, 4390, 934, 29871, 13, 13, 29937, 1445, 353, 1722, 877, 5327, 29889, 3126, 1495, 13, 29937, 5415, 353, 4390, 29889, 1359, 29898, 1445, 29897, 13, 29937, 1454, 1543, 297, 5446, 1839, 9902, 2033, 29901, 13, 29937, 29871, 363, 8671, 297, 1543, 1839, 26123, 5056, 2033, 29901, 13, 29937, 1678, 363, 25214, 297, 8671, 1839, 9346, 342, 15092, 2033, 29901, 13, 29937, 418, 1024, 29892, 995, 29896, 29892, 995, 29906, 353, 25214, 13, 29937, 418, 1596, 29898, 303, 1160, 29897, 13, 2 ]
vulnerable_people_form/integrations/google_analytics.py
uk-gov-mirror/alphagov.govuk-shielded-vulnerable-people-service
3
125960
import requests import sentry_sdk from flask import current_app def track_event(category, action, label=None, value=0): data = { "v": "1", # API Version. "tid": current_app.config["GA_TRACKING_ID"], # Tracking ID / Property ID. # Anonymous Client Identifier. Ideally, this should be a UUID that # is associated with particular user, device, or browser instance. "cid": "555", "t": "event", # Event hit type. "ec": category, # Event category. "ea": action, # Event action. "el": label, # Event label. "ev": value, # Event value, must be an integer "ua": "Opera/9.80 (Windows NT 6.0) Presto/2.12.388 Version/12.14", } response = requests.post("https://www.google-analytics.com/collect", data=data) # If the request fails, this will raise a RequestException. Depending # on your application's needs, this may be a non-error and can be caught # by the caller. response.raise_for_status() def track_nhs_userinfo_and_form_answers_differs(): try: track_event("NHS info retrieved via oidc and form differs", "registration") except Exception as e: sentry_sdk.capture_exception(e) def track_nhs_number_and_form_value_differs(): try: track_event("NHS number retrieved via oidc and that in form differs", "registration") except Exception as e: sentry_sdk.capture_exception(e)
[ 1, 1053, 7274, 13, 5215, 2665, 719, 29918, 15348, 13, 3166, 29784, 1053, 1857, 29918, 932, 13, 13, 13, 1753, 5702, 29918, 3696, 29898, 7320, 29892, 3158, 29892, 3858, 29922, 8516, 29892, 995, 29922, 29900, 1125, 13, 1678, 848, 353, 426, 13, 4706, 376, 29894, 1115, 376, 29896, 613, 29871, 396, 3450, 10079, 29889, 13, 4706, 376, 17681, 1115, 1857, 29918, 932, 29889, 2917, 3366, 12739, 29918, 5659, 11375, 4214, 29918, 1367, 12436, 29871, 396, 17026, 292, 3553, 847, 9079, 3553, 29889, 13, 4706, 396, 530, 11428, 12477, 20286, 29889, 13001, 635, 29892, 445, 881, 367, 263, 501, 11150, 393, 13, 4706, 396, 338, 6942, 411, 3153, 1404, 29892, 4742, 29892, 470, 4714, 2777, 29889, 13, 4706, 376, 25232, 1115, 376, 29945, 29945, 29945, 613, 13, 4706, 376, 29873, 1115, 376, 3696, 613, 29871, 396, 6864, 7124, 1134, 29889, 13, 4706, 376, 687, 1115, 7663, 29892, 29871, 396, 6864, 7663, 29889, 13, 4706, 376, 11248, 1115, 3158, 29892, 29871, 396, 6864, 3158, 29889, 13, 4706, 376, 295, 1115, 3858, 29892, 29871, 396, 6864, 3858, 29889, 13, 4706, 376, 5750, 1115, 995, 29892, 29871, 396, 6864, 995, 29892, 1818, 367, 385, 6043, 13, 4706, 376, 3357, 1115, 376, 7094, 29874, 29914, 29929, 29889, 29947, 29900, 313, 7685, 405, 29911, 29871, 29953, 29889, 29900, 29897, 1588, 4778, 29914, 29906, 29889, 29896, 29906, 29889, 29941, 29947, 29947, 10079, 29914, 29896, 29906, 29889, 29896, 29946, 613, 13, 1678, 500, 13, 1678, 2933, 353, 7274, 29889, 2490, 703, 991, 597, 1636, 29889, 3608, 29899, 7054, 22026, 29889, 510, 29914, 15914, 613, 848, 29922, 1272, 29897, 13, 13, 1678, 396, 960, 278, 2009, 8465, 29892, 445, 674, 12020, 263, 10729, 2451, 29889, 28277, 13, 1678, 396, 373, 596, 2280, 29915, 29879, 4225, 29892, 445, 1122, 367, 263, 1661, 29899, 2704, 322, 508, 367, 12624, 13, 1678, 396, 491, 278, 24959, 29889, 13, 1678, 2933, 29889, 22692, 29918, 1454, 29918, 4882, 580, 13, 13, 13, 1753, 5702, 29918, 29876, 9499, 29918, 1792, 3888, 29918, 392, 29918, 689, 29918, 550, 17538, 29918, 12765, 414, 7295, 13, 1678, 1018, 29901, 13, 4706, 5702, 29918, 3696, 703, 29940, 14851, 5235, 27387, 3025, 288, 333, 29883, 322, 883, 2923, 414, 613, 376, 1727, 8306, 1159, 13, 1678, 5174, 8960, 408, 321, 29901, 13, 4706, 2665, 719, 29918, 15348, 29889, 17885, 545, 29918, 11739, 29898, 29872, 29897, 13, 13, 13, 1753, 5702, 29918, 29876, 9499, 29918, 4537, 29918, 392, 29918, 689, 29918, 1767, 29918, 12765, 414, 7295, 13, 1678, 1018, 29901, 13, 4706, 5702, 29918, 3696, 703, 29940, 14851, 1353, 27387, 3025, 288, 333, 29883, 322, 393, 297, 883, 2923, 414, 613, 376, 1727, 8306, 1159, 13, 1678, 5174, 8960, 408, 321, 29901, 13, 4706, 2665, 719, 29918, 15348, 29889, 17885, 545, 29918, 11739, 29898, 29872, 29897, 13, 2 ]
assignment3/code/q4.1.py
liusida/ds2
0
121156
# requirements.txt: # pyro 1.6.0 # torch 1.8.0 import pyro from pyro.distributions import Normal,Gamma,InverseGamma,Bernoulli,Poisson import matplotlib.pyplot as plt # import pyro.poutine as poutine pyro.set_rng_seed(101) def normal_density_estimation(obs, N): assert obs is None or N==obs.shape[0] loc = pyro.sample("loc", Normal(0,1)) inverse_scale = pyro.sample("inverse_scale", Gamma(3,2)) with pyro.plate("n", N): data = pyro.sample(f"data", Normal(loc, 1/inverse_scale), obs=obs) return data if __name__ == "__main__": # simple test data = normal_density_estimation(None, 100000) plt.hist(data.detach().numpy(), bins="auto") plt.show()
[ 1, 396, 11780, 29889, 3945, 29901, 13, 29937, 11451, 307, 29871, 29896, 29889, 29953, 29889, 29900, 13, 29937, 4842, 305, 29871, 29896, 29889, 29947, 29889, 29900, 13, 13, 5215, 11451, 307, 13, 3166, 11451, 307, 29889, 27691, 29879, 1053, 21981, 29892, 6642, 29892, 797, 3901, 6642, 29892, 29933, 824, 5059, 492, 29892, 9837, 17387, 13, 5215, 22889, 29889, 2272, 5317, 408, 14770, 13, 29937, 1053, 11451, 307, 29889, 29886, 449, 457, 408, 282, 449, 457, 13, 2272, 307, 29889, 842, 29918, 29878, 865, 29918, 26776, 29898, 29896, 29900, 29896, 29897, 13, 13, 1753, 4226, 29918, 21518, 537, 29918, 342, 7715, 29898, 26290, 29892, 405, 1125, 13, 1678, 4974, 20881, 338, 6213, 470, 405, 1360, 26290, 29889, 12181, 29961, 29900, 29962, 13, 1678, 1180, 353, 11451, 307, 29889, 11249, 703, 2029, 613, 21981, 29898, 29900, 29892, 29896, 876, 13, 1678, 16402, 29918, 7052, 353, 11451, 307, 29889, 11249, 703, 262, 3901, 29918, 7052, 613, 402, 2735, 29898, 29941, 29892, 29906, 876, 13, 1678, 411, 11451, 307, 29889, 2341, 703, 29876, 613, 405, 1125, 13, 4706, 848, 353, 11451, 307, 29889, 11249, 29898, 29888, 29908, 1272, 613, 21981, 29898, 2029, 29892, 29871, 29896, 29914, 262, 3901, 29918, 7052, 511, 20881, 29922, 26290, 29897, 13, 1678, 736, 848, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 396, 2560, 1243, 13, 1678, 848, 353, 4226, 29918, 21518, 537, 29918, 342, 7715, 29898, 8516, 29892, 29871, 29896, 29900, 29900, 29900, 29900, 29900, 29897, 13, 1678, 14770, 29889, 29882, 391, 29898, 1272, 29889, 4801, 496, 2141, 23749, 3285, 289, 1144, 543, 6921, 1159, 13, 1678, 14770, 29889, 4294, 580, 2 ]
openrave/docs/source/tutorials/openravepy_examples/simple_environment_loading.py
jdsika/TUM_HOly
2
88903
<gh_stars>1-10 """Loads up an environment, attaches a viewer, loads a scene, and requests information about the robot. """ from openravepy import * env = Environment() # create openrave environment env.SetViewer('qtcoin') # attach viewer (optional) env.Load('data/lab1.env.xml') # load a simple scene robot = env.GetRobots()[0] # get the first robot with env: # lock the environment since robot will be used raveLogInfo("Robot "+robot.GetName()+" has "+repr(robot.GetDOF())+" joints with values:\n"+repr(robot.GetDOFValues())) robot.SetDOFValues([0.5],[0]) # set joint 0 to value 0.5 T = robot.GetLinks()[1].GetTransform() # get the transform of link 1 raveLogInfo("The transformation of link 1 is:\n"+repr(T))
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 15945, 29908, 5896, 29879, 701, 385, 5177, 29892, 10641, 267, 263, 6316, 556, 29892, 15376, 263, 9088, 29892, 322, 7274, 2472, 1048, 278, 19964, 29889, 13, 15945, 29908, 13, 3166, 1722, 336, 345, 2272, 1053, 334, 13, 6272, 353, 16738, 580, 396, 1653, 1722, 336, 345, 5177, 13, 6272, 29889, 2697, 29963, 15580, 877, 17915, 1111, 262, 1495, 396, 10641, 6316, 556, 313, 25253, 29897, 13, 6272, 29889, 5896, 877, 1272, 29914, 8205, 29896, 29889, 6272, 29889, 3134, 1495, 396, 2254, 263, 2560, 9088, 13, 307, 7451, 353, 8829, 29889, 2577, 21860, 1862, 580, 29961, 29900, 29962, 396, 679, 278, 937, 19964, 13, 13, 2541, 8829, 29901, 396, 7714, 278, 5177, 1951, 19964, 674, 367, 1304, 13, 1678, 1153, 345, 3403, 3401, 703, 21860, 327, 15691, 307, 7451, 29889, 2577, 1170, 580, 13578, 756, 15691, 276, 558, 29898, 307, 7451, 29889, 2577, 3970, 29943, 3101, 13578, 14002, 29879, 411, 1819, 3583, 29876, 17969, 276, 558, 29898, 307, 7451, 29889, 2577, 3970, 29943, 9065, 22130, 13, 1678, 19964, 29889, 2697, 3970, 29943, 9065, 4197, 29900, 29889, 29945, 16272, 29900, 2314, 396, 731, 14002, 29871, 29900, 304, 995, 29871, 29900, 29889, 29945, 13, 1678, 323, 353, 19964, 29889, 2577, 6595, 29879, 580, 29961, 29896, 1822, 2577, 13372, 580, 396, 679, 278, 4327, 310, 1544, 29871, 29896, 13, 1678, 1153, 345, 3403, 3401, 703, 1576, 13852, 310, 1544, 29871, 29896, 338, 3583, 29876, 17969, 276, 558, 29898, 29911, 876, 13, 2 ]
TestMatrices.py
Tsyrema/Computing-the-Distance-Matrix-and-the-Covariance-Matrix-of-Data
0
108405
# script to test your computation code # do not change this file from ComputeMatrices import compute_distance_naive, \ compute_distance_smart, compute_correlation_naive, \ compute_correlation_smart import numpy as np from sklearn.datasets import load_iris # my computation def my_comp_distance(X): N = X.shape[0] D = X[0].shape[0] M = np.zeros([N,N]) return M # an example code for testing def main(): iris = load_iris() X = iris.data distance_true = my_comp_distance(X) distance_loop = compute_distance_naive(X) distance_cool = compute_distance_smart(X) print np.allclose(distance_true, distance_loop) print np.allclose(distance_true, distance_cool) if __name__ == "__main__": main()
[ 1, 396, 2471, 304, 1243, 596, 16287, 775, 13, 29937, 437, 451, 1735, 445, 934, 13, 13, 3166, 11796, 29872, 29924, 8141, 1575, 1053, 10272, 29918, 19244, 29918, 1056, 573, 29892, 320, 13, 1678, 10272, 29918, 19244, 29918, 3844, 442, 29892, 10272, 29918, 2616, 23445, 29918, 1056, 573, 29892, 320, 13, 1678, 10272, 29918, 2616, 23445, 29918, 3844, 442, 13, 5215, 12655, 408, 7442, 13, 3166, 2071, 19668, 29889, 14538, 1691, 1053, 2254, 29918, 381, 275, 13, 13, 29937, 590, 16287, 13, 1753, 590, 29918, 2388, 29918, 19244, 29898, 29990, 1125, 13, 1678, 405, 353, 1060, 29889, 12181, 29961, 29900, 29962, 13, 1678, 360, 353, 1060, 29961, 29900, 1822, 12181, 29961, 29900, 29962, 13, 13, 1678, 341, 353, 7442, 29889, 3298, 359, 4197, 29940, 29892, 29940, 2314, 13, 13, 1678, 736, 341, 13, 13, 29937, 385, 1342, 775, 363, 6724, 13, 1753, 1667, 7295, 13, 1678, 3805, 275, 353, 2254, 29918, 381, 275, 580, 13, 1678, 1060, 353, 3805, 275, 29889, 1272, 13, 13, 1678, 5418, 29918, 3009, 353, 590, 29918, 2388, 29918, 19244, 29898, 29990, 29897, 13, 1678, 5418, 29918, 7888, 353, 10272, 29918, 19244, 29918, 1056, 573, 29898, 29990, 29897, 13, 1678, 5418, 29918, 1111, 324, 353, 10272, 29918, 19244, 29918, 3844, 442, 29898, 29990, 29897, 13, 13, 1678, 1596, 7442, 29889, 497, 5358, 29898, 19244, 29918, 3009, 29892, 5418, 29918, 7888, 29897, 13, 1678, 1596, 7442, 29889, 497, 5358, 29898, 19244, 29918, 3009, 29892, 5418, 29918, 1111, 324, 29897, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 1667, 580, 13, 2 ]
sailfish/solvers/scdg_1d.py
Javk5pakfa/sailfish
1
94987
<reponame>Javk5pakfa/sailfish """ An n-th order discontinuous Galerkin solver for 1D scalar advection. """ from typing import NamedTuple from numpy.polynomial.legendre import leggauss, Legendre from sailfish.mesh import PlanarCartesianMesh from sailfish.solver import SolverBase class CellData: """ Gauss weights, quadrature points, and tabulated Legendre polonomials. This class works for n-th order Gaussian quadrature in 1D. """ def __init__(self, order=1): import numpy as np if order <= 0: raise ValueError("cell order must be at least 1") def leg(x, n, m=0): c = [(2 * n + 1) ** 0.5 if i is n else 0.0 for i in range(n + 1)] return Legendre(c).deriv(m)(x) f = [-1.0, 1.0] # xsi-coordinate of faces g, w = leggauss(order) self.gauss_points = g self.weights = w self.phi_faces = np.array([[leg(x, n, m=0) for n in range(order)] for x in f]) self.phi_value = np.array([[leg(x, n, m=0) for n in range(order)] for x in g]) self.phi_deriv = np.array([[leg(x, n, m=1) for n in range(order)] for x in g]) self.order = order def to_weights(self, ux): w = self.weights p = self.phi_value o = self.order return [sum(ux[j] * p[j][n] * w[j] for j in range(o)) * 0.5 for n in range(o)] def sample(self, uw, j): return dot(uw, self.phi_value[j]) @property def num_points(self): return self.order def dot(u, p): return sum(u[i] * p[i] for i in range(u.shape[0])) def rhs(physics, uw, cell, dx, uwdot): import numpy as np if physics.equation == "advection": wavespeed = physics.wavespeed def flux(ux): return wavespeed * ux def upwind(ul, ur): if wavespeed > 0.0: return flux(ul) else: return flux(ur) elif physics.equation == "burgers": def flux(ux): return 0.5 * ux * ux def upwind(ul, ur): al = ul ar = ur if al > 0.0 and ar > 0.0: return flux(ul) elif al < 0.0 and ar < 0.0: return flux(ur) else: return 0.0 nz = uw.shape[0] pv = cell.phi_value pf = cell.phi_faces pd = cell.phi_deriv w = cell.weights h = [-1.0, 1.0] for i in range(nz): im1 = (i - 1 + nz) % nz ip1 = (i + 1 + nz) % nz uimh_l = dot(uw[im1], pf[1]) uimh_r = dot(uw[i], pf[0]) uiph_l = dot(uw[i], pf[1]) uiph_r = dot(uw[ip1], pf[0]) fimh = upwind(uimh_l, uimh_r) fiph = upwind(uiph_l, uiph_r) fs = [fimh, fiph] ux = [cell.sample(uw[i], j) for j in range(cell.order)] fx = [flux(u) for u in ux] for n in range(cell.order): udot_s = -sum(fs[j] * pf[j][n] * h[j] for j in range(2)) / dx udot_v = +sum(fx[j] * pd[j][n] * w[j] for j in range(cell.num_points)) / dx uwdot[i, n] = udot_s + udot_v class Options(NamedTuple): order: int = 1 integrator: str = "rk2" class Physics(NamedTuple): wavespeed: float = 1.0 equation: str = "advection" # or burgers class Solver(SolverBase): """ An n-th order, discontinuous Galerkin solver for 1D scalar advection. Time-advance integrator options: - :code:`rk1`: Forward Euler - :code:`rk2`: SSP-RK2 of Shu & Osher (1988; Eq. 2.15) - :code:`rk3`: SSP-RK3 of Shu & Osher (1988; Eq. 2.18) - :code:`rk3-sr02`: four-stage 3rd Order SSP-4RK3 of Spiteri & Ruuth (2002) """ def __init__( self, setup=None, mesh=None, time=0.0, solution=None, num_patches=1, mode="cpu", physics=dict(), options=dict(), ): import numpy as np options = Options(**options) physics = Physics(**physics) cell = CellData(order=options.order) if num_patches != 1: raise ValueError("only works on one patch") if type(mesh) != PlanarCartesianMesh: raise ValueError("only the planar cartesian mesh is supported") if mode != "cpu": raise ValueError("only cpu mode is supported") if setup.boundary_condition != "periodic": raise ValueError("only periodic boundaries are supported") if physics.equation not in ["advection", "burgers"]: raise ValueError("physics.equation must be advection or burgers") if options.integrator not in ["rk1", "rk2", "rk3", "rk3-sr02"]: raise ValueError("options.integrator must be rk1|rk2|rk3|rk3-sr02") if options.order <= 0: raise ValueError("option.order must be greater than 0") if solution is None: num_zones = mesh.shape[0] xf = mesh.faces(0, num_zones) # face coordinates px = np.zeros([num_zones, cell.num_points, 1]) ux = np.zeros([num_zones, cell.num_points, 1]) uw = np.zeros([num_zones, cell.order, 1]) dx = mesh.dx for i in range(num_zones): for j in range(cell.num_points): xsi = cell.gauss_points[j] xj = xf[i] + (xsi + 1.0) * 0.5 * dx setup.primitive(time, xj, px[i, j]) ux[...] = px[...] # the conserved variable is also the primitive for i in range(num_zones): uw[i] = cell.to_weights(ux[i]) self.conserved_w = uw else: self.conserved_w = solution self.t = time self.mesh = mesh self.cell = cell self._options = options self._physics = physics @property def solution(self): return self.conserved_w @property def primitive(self): return self.conserved_w[:, 0] @property def time(self): return self.t @property def maximum_cfl(self): return 1.0 @property def options(self): return self._options._asdict() @property def physics(self): return self._physics._asdict() @property def maximum_cfl(self): k = self.cell.order - 1 if self._options.integrator == "rk1": return 1.0 / (2 * k + 1) if self._options.integrator == "rk2": return 1.0 / (2 * k + 1) if self._options.integrator == "rk3": return 1.0 / (2 * k + 1) if self._options.integrator == "rk3-sr02": return 2.0 / (2 * k + 1) def maximum_wavespeed(self): if self._physics.equation == "advection": return abs(self._physics.wavespeed) elif self._physics.equation == "burgers": return abs(self.conserved_w[:, 0]).max() def advance(self, dt): import numpy as np def udot(u): udot = np.zeros_like(u) rhs(self._physics, u, self.cell, self.mesh.dx, udot) return udot if self._options.integrator == "rk1": u = self.conserved_w u += dt * udot(u) if self._options.integrator == "rk2": b1 = 0.0 b2 = 0.5 u = u0 = self.conserved_w.copy() u = u0 * b1 + (1.0 - b1) * (u + dt * udot(u)) u = u0 * b2 + (1.0 - b2) * (u + dt * udot(u)) if self._options.integrator == "rk3": b1 = 0.0 b2 = 3.0 / 4.0 b3 = 1.0 / 3.0 u = u0 = self.conserved_w.copy() u = u0 * b1 + (1.0 - b1) * (u + dt * udot(u)) u = u0 * b2 + (1.0 - b2) * (u + dt * udot(u)) u = u0 * b3 + (1.0 - b3) * (u + dt * udot(u)) if self._options.integrator == "rk3-sr02": u = u0 = self.conserved_w.copy() u = u0 + 0.5 * dt * udot(u) u = u + 0.5 * dt * udot(u) u = 2.0 / 3.0 * u0 + 1.0 / 3.0 * (u + 0.5 * dt * udot(u)) u = u + 0.5 * dt * udot(u) self.conserved_w = u self.t += dt
[ 1, 529, 276, 1112, 420, 29958, 29967, 485, 29895, 29945, 29886, 557, 5444, 29914, 29879, 737, 15161, 13, 15945, 29908, 13, 2744, 302, 29899, 386, 1797, 766, 20621, 681, 5208, 5968, 262, 899, 369, 363, 29871, 29896, 29928, 17336, 594, 345, 428, 29889, 13, 15945, 29908, 13, 13, 3166, 19229, 1053, 405, 2795, 23215, 552, 13, 3166, 12655, 29889, 3733, 9222, 29889, 1397, 9030, 1053, 454, 1505, 11214, 29892, 5682, 9030, 13, 3166, 14892, 15161, 29889, 4467, 29882, 1053, 8402, 279, 25233, 18970, 29924, 12094, 13, 3166, 14892, 15161, 29889, 2929, 369, 1053, 4956, 369, 5160, 13, 13, 13, 1990, 19413, 1469, 29901, 13, 1678, 9995, 13, 1678, 402, 11214, 18177, 29892, 15448, 1535, 3291, 29892, 322, 4434, 7964, 5682, 9030, 1248, 4917, 616, 29879, 29889, 13, 13, 1678, 910, 770, 1736, 363, 302, 29899, 386, 1797, 22477, 15448, 1535, 297, 29871, 29896, 29928, 29889, 13, 1678, 9995, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1797, 29922, 29896, 1125, 13, 4706, 1053, 12655, 408, 7442, 13, 13, 4706, 565, 1797, 5277, 29871, 29900, 29901, 13, 9651, 12020, 7865, 2392, 703, 3729, 1797, 1818, 367, 472, 3203, 29871, 29896, 1159, 13, 13, 4706, 822, 2814, 29898, 29916, 29892, 302, 29892, 286, 29922, 29900, 1125, 13, 9651, 274, 353, 17288, 29906, 334, 302, 718, 29871, 29896, 29897, 3579, 29871, 29900, 29889, 29945, 565, 474, 338, 302, 1683, 29871, 29900, 29889, 29900, 363, 474, 297, 3464, 29898, 29876, 718, 29871, 29896, 4638, 13, 9651, 736, 5682, 9030, 29898, 29883, 467, 672, 440, 29898, 29885, 5033, 29916, 29897, 13, 13, 4706, 285, 353, 21069, 29896, 29889, 29900, 29892, 29871, 29896, 29889, 29900, 29962, 29871, 396, 921, 1039, 29899, 29302, 310, 17240, 13, 4706, 330, 29892, 281, 353, 454, 1505, 11214, 29898, 2098, 29897, 13, 4706, 1583, 29889, 29887, 11214, 29918, 9748, 353, 330, 13, 4706, 1583, 29889, 705, 5861, 353, 281, 13, 4706, 1583, 29889, 2876, 29918, 8726, 353, 7442, 29889, 2378, 4197, 29961, 1397, 29898, 29916, 29892, 302, 29892, 286, 29922, 29900, 29897, 363, 302, 297, 3464, 29898, 2098, 4638, 363, 921, 297, 285, 2314, 13, 4706, 1583, 29889, 2876, 29918, 1767, 353, 7442, 29889, 2378, 4197, 29961, 1397, 29898, 29916, 29892, 302, 29892, 286, 29922, 29900, 29897, 363, 302, 297, 3464, 29898, 2098, 4638, 363, 921, 297, 330, 2314, 13, 4706, 1583, 29889, 2876, 29918, 672, 440, 353, 7442, 29889, 2378, 4197, 29961, 1397, 29898, 29916, 29892, 302, 29892, 286, 29922, 29896, 29897, 363, 302, 297, 3464, 29898, 2098, 4638, 363, 921, 297, 330, 2314, 13, 4706, 1583, 29889, 2098, 353, 1797, 13, 13, 1678, 822, 304, 29918, 705, 5861, 29898, 1311, 29892, 318, 29916, 1125, 13, 4706, 281, 353, 1583, 29889, 705, 5861, 13, 4706, 282, 353, 1583, 29889, 2876, 29918, 1767, 13, 4706, 288, 353, 1583, 29889, 2098, 13, 4706, 736, 518, 2083, 29898, 1314, 29961, 29926, 29962, 334, 282, 29961, 29926, 3816, 29876, 29962, 334, 281, 29961, 29926, 29962, 363, 432, 297, 3464, 29898, 29877, 876, 334, 29871, 29900, 29889, 29945, 363, 302, 297, 3464, 29898, 29877, 4638, 13, 13, 1678, 822, 4559, 29898, 1311, 29892, 318, 29893, 29892, 432, 1125, 13, 4706, 736, 8329, 29898, 7262, 29892, 1583, 29889, 2876, 29918, 1767, 29961, 29926, 2314, 13, 13, 1678, 732, 6799, 13, 1678, 822, 954, 29918, 9748, 29898, 1311, 1125, 13, 4706, 736, 1583, 29889, 2098, 13, 13, 13, 1753, 8329, 29898, 29884, 29892, 282, 1125, 13, 1678, 736, 2533, 29898, 29884, 29961, 29875, 29962, 334, 282, 29961, 29875, 29962, 363, 474, 297, 3464, 29898, 29884, 29889, 12181, 29961, 29900, 12622, 13, 13, 13, 1753, 29365, 29898, 25105, 29892, 318, 29893, 29892, 3038, 29892, 15414, 29892, 318, 29893, 6333, 1125, 13, 1678, 1053, 12655, 408, 7442, 13, 13, 1678, 565, 17558, 29889, 2573, 1275, 376, 328, 345, 428, 1115, 13, 4706, 20037, 412, 287, 353, 17558, 29889, 29893, 5989, 412, 287, 13, 13, 4706, 822, 19389, 29898, 1314, 1125, 13, 9651, 736, 20037, 412, 287, 334, 318, 29916, 13, 13, 4706, 822, 701, 14800, 29898, 352, 29892, 5065, 1125, 13, 9651, 565, 20037, 412, 287, 1405, 29871, 29900, 29889, 29900, 29901, 13, 18884, 736, 19389, 29898, 352, 29897, 13, 9651, 1683, 29901, 13, 18884, 736, 19389, 29898, 332, 29897, 13, 13, 1678, 25342, 17558, 29889, 2573, 1275, 376, 3074, 414, 1115, 13, 13, 4706, 822, 19389, 29898, 1314, 1125, 13, 9651, 736, 29871, 29900, 29889, 29945, 334, 318, 29916, 334, 318, 29916, 13, 13, 4706, 822, 701, 14800, 29898, 352, 29892, 5065, 1125, 13, 9651, 394, 353, 9238, 13, 9651, 564, 353, 5065, 13, 13, 9651, 565, 394, 1405, 29871, 29900, 29889, 29900, 322, 564, 1405, 29871, 29900, 29889, 29900, 29901, 13, 18884, 736, 19389, 29898, 352, 29897, 13, 9651, 25342, 394, 529, 29871, 29900, 29889, 29900, 322, 564, 529, 29871, 29900, 29889, 29900, 29901, 13, 18884, 736, 19389, 29898, 332, 29897, 13, 9651, 1683, 29901, 13, 18884, 736, 29871, 29900, 29889, 29900, 13, 13, 1678, 302, 29920, 353, 318, 29893, 29889, 12181, 29961, 29900, 29962, 13, 1678, 282, 29894, 353, 3038, 29889, 2876, 29918, 1767, 13, 1678, 282, 29888, 353, 3038, 29889, 2876, 29918, 8726, 13, 1678, 10518, 353, 3038, 29889, 2876, 29918, 672, 440, 13, 1678, 281, 353, 3038, 29889, 705, 5861, 13, 1678, 298, 353, 21069, 29896, 29889, 29900, 29892, 29871, 29896, 29889, 29900, 29962, 13, 13, 1678, 363, 474, 297, 3464, 29898, 29876, 29920, 1125, 13, 4706, 527, 29896, 353, 313, 29875, 448, 29871, 29896, 718, 302, 29920, 29897, 1273, 302, 29920, 13, 4706, 10377, 29896, 353, 313, 29875, 718, 29871, 29896, 718, 302, 29920, 29897, 1273, 302, 29920, 13, 13, 4706, 318, 326, 29882, 29918, 29880, 353, 8329, 29898, 7262, 29961, 326, 29896, 1402, 282, 29888, 29961, 29896, 2314, 13, 4706, 318, 326, 29882, 29918, 29878, 353, 8329, 29898, 7262, 29961, 29875, 1402, 282, 29888, 29961, 29900, 2314, 13, 4706, 14313, 561, 29918, 29880, 353, 8329, 29898, 7262, 29961, 29875, 1402, 282, 29888, 29961, 29896, 2314, 13, 4706, 14313, 561, 29918, 29878, 353, 8329, 29898, 7262, 29961, 666, 29896, 1402, 282, 29888, 29961, 29900, 2314, 13, 4706, 285, 326, 29882, 353, 701, 14800, 29898, 29884, 326, 29882, 29918, 29880, 29892, 318, 326, 29882, 29918, 29878, 29897, 13, 4706, 5713, 561, 353, 701, 14800, 29898, 1481, 561, 29918, 29880, 29892, 14313, 561, 29918, 29878, 29897, 13, 13, 4706, 18920, 353, 518, 29888, 326, 29882, 29892, 5713, 561, 29962, 13, 4706, 318, 29916, 353, 518, 3729, 29889, 11249, 29898, 7262, 29961, 29875, 1402, 432, 29897, 363, 432, 297, 3464, 29898, 3729, 29889, 2098, 4638, 13, 4706, 285, 29916, 353, 518, 1579, 1314, 29898, 29884, 29897, 363, 318, 297, 318, 29916, 29962, 13, 13, 4706, 363, 302, 297, 3464, 29898, 3729, 29889, 2098, 1125, 13, 9651, 318, 6333, 29918, 29879, 353, 448, 2083, 29898, 5847, 29961, 29926, 29962, 334, 282, 29888, 29961, 29926, 3816, 29876, 29962, 334, 298, 29961, 29926, 29962, 363, 432, 297, 3464, 29898, 29906, 876, 847, 15414, 13, 9651, 318, 6333, 29918, 29894, 353, 718, 2083, 29898, 11093, 29961, 29926, 29962, 334, 10518, 29961, 29926, 3816, 29876, 29962, 334, 281, 29961, 29926, 29962, 363, 432, 297, 3464, 29898, 3729, 29889, 1949, 29918, 9748, 876, 847, 15414, 13, 9651, 318, 29893, 6333, 29961, 29875, 29892, 302, 29962, 353, 318, 6333, 29918, 29879, 718, 318, 6333, 29918, 29894, 13, 13, 13, 1990, 25186, 29898, 22175, 23215, 552, 1125, 13, 1678, 1797, 29901, 938, 353, 29871, 29896, 13, 1678, 3990, 1061, 29901, 851, 353, 376, 29878, 29895, 29906, 29908, 13, 13, 13, 1990, 29837, 29898, 22175, 23215, 552, 1125, 13, 1678, 20037, 412, 287, 29901, 5785, 353, 29871, 29896, 29889, 29900, 13, 1678, 6306, 29901, 851, 353, 376, 328, 345, 428, 29908, 29871, 396, 470, 26072, 414, 13, 13, 13, 1990, 4956, 369, 29898, 13296, 369, 5160, 1125, 13, 1678, 9995, 13, 1678, 530, 302, 29899, 386, 1797, 29892, 766, 20621, 681, 5208, 5968, 262, 899, 369, 363, 29871, 29896, 29928, 17336, 594, 345, 428, 29889, 13, 13, 1678, 5974, 29899, 17263, 749, 3990, 1061, 3987, 29901, 13, 13, 1678, 448, 584, 401, 18078, 29878, 29895, 29896, 6998, 1152, 1328, 382, 8584, 13, 1678, 448, 584, 401, 18078, 29878, 29895, 29906, 6998, 317, 5550, 29899, 29934, 29968, 29906, 310, 1383, 29884, 669, 438, 845, 261, 313, 29896, 29929, 29947, 29947, 29936, 12345, 29889, 29871, 29906, 29889, 29896, 29945, 29897, 13, 1678, 448, 584, 401, 18078, 29878, 29895, 29941, 6998, 317, 5550, 29899, 29934, 29968, 29941, 310, 1383, 29884, 669, 438, 845, 261, 313, 29896, 29929, 29947, 29947, 29936, 12345, 29889, 29871, 29906, 29889, 29896, 29947, 29897, 13, 1678, 448, 584, 401, 18078, 29878, 29895, 29941, 29899, 21935, 29900, 29906, 6998, 3023, 29899, 19190, 29871, 29941, 5499, 8170, 317, 5550, 29899, 29946, 29934, 29968, 29941, 310, 1706, 1524, 29875, 669, 9723, 2806, 313, 29906, 29900, 29900, 29906, 29897, 13, 1678, 9995, 13, 13, 1678, 822, 4770, 2344, 12035, 13, 4706, 1583, 29892, 13, 4706, 6230, 29922, 8516, 29892, 13, 4706, 27716, 29922, 8516, 29892, 13, 4706, 931, 29922, 29900, 29889, 29900, 29892, 13, 4706, 1650, 29922, 8516, 29892, 13, 4706, 954, 29918, 5041, 267, 29922, 29896, 29892, 13, 4706, 4464, 543, 21970, 613, 13, 4706, 17558, 29922, 8977, 3285, 13, 4706, 3987, 29922, 8977, 3285, 13, 268, 1125, 13, 4706, 1053, 12655, 408, 7442, 13, 13, 4706, 3987, 353, 25186, 29898, 1068, 6768, 29897, 13, 4706, 17558, 353, 29837, 29898, 1068, 25105, 29897, 13, 4706, 3038, 353, 19413, 1469, 29898, 2098, 29922, 6768, 29889, 2098, 29897, 13, 13, 4706, 565, 954, 29918, 5041, 267, 2804, 29871, 29896, 29901, 13, 9651, 12020, 7865, 2392, 703, 6194, 1736, 373, 697, 13261, 1159, 13, 13, 4706, 565, 1134, 29898, 4467, 29882, 29897, 2804, 8402, 279, 25233, 18970, 29924, 12094, 29901, 13, 9651, 12020, 7865, 2392, 703, 6194, 278, 3814, 279, 7774, 18970, 27716, 338, 6969, 1159, 13, 13, 4706, 565, 4464, 2804, 376, 21970, 1115, 13, 9651, 12020, 7865, 2392, 703, 6194, 26403, 4464, 338, 6969, 1159, 13, 13, 4706, 565, 6230, 29889, 9917, 653, 29918, 16122, 2804, 376, 19145, 293, 1115, 13, 9651, 12020, 7865, 2392, 703, 6194, 29591, 24371, 526, 6969, 1159, 13, 13, 4706, 565, 17558, 29889, 2573, 451, 297, 6796, 328, 345, 428, 613, 376, 3074, 414, 3108, 29901, 13, 9651, 12020, 7865, 2392, 703, 25105, 29889, 2573, 1818, 367, 594, 345, 428, 470, 26072, 414, 1159, 13, 13, 4706, 565, 3987, 29889, 14146, 1061, 451, 297, 6796, 29878, 29895, 29896, 613, 376, 29878, 29895, 29906, 613, 376, 29878, 29895, 29941, 613, 376, 29878, 29895, 29941, 29899, 21935, 29900, 29906, 3108, 29901, 13, 9651, 12020, 7865, 2392, 703, 6768, 29889, 14146, 1061, 1818, 367, 364, 29895, 29896, 29989, 29878, 29895, 29906, 29989, 29878, 29895, 29941, 29989, 29878, 29895, 29941, 29899, 21935, 29900, 29906, 1159, 13, 13, 4706, 565, 3987, 29889, 2098, 5277, 29871, 29900, 29901, 13, 9651, 12020, 7865, 2392, 703, 3385, 29889, 2098, 1818, 367, 7621, 1135, 29871, 29900, 1159, 13, 13, 4706, 565, 1650, 338, 6213, 29901, 13, 9651, 954, 29918, 29920, 2873, 353, 27716, 29889, 12181, 29961, 29900, 29962, 13, 9651, 921, 29888, 353, 27716, 29889, 8726, 29898, 29900, 29892, 954, 29918, 29920, 2873, 29897, 29871, 396, 3700, 10350, 13, 9651, 282, 29916, 353, 7442, 29889, 3298, 359, 4197, 1949, 29918, 29920, 2873, 29892, 3038, 29889, 1949, 29918, 9748, 29892, 29871, 29896, 2314, 13, 9651, 318, 29916, 353, 7442, 29889, 3298, 359, 4197, 1949, 29918, 29920, 2873, 29892, 3038, 29889, 1949, 29918, 9748, 29892, 29871, 29896, 2314, 13, 9651, 318, 29893, 353, 7442, 29889, 3298, 359, 4197, 1949, 29918, 29920, 2873, 29892, 3038, 29889, 2098, 29892, 29871, 29896, 2314, 13, 9651, 15414, 353, 27716, 29889, 8235, 13, 13, 9651, 363, 474, 297, 3464, 29898, 1949, 29918, 29920, 2873, 1125, 13, 18884, 363, 432, 297, 3464, 29898, 3729, 29889, 1949, 29918, 9748, 1125, 13, 462, 1678, 921, 1039, 353, 3038, 29889, 29887, 11214, 29918, 9748, 29961, 29926, 29962, 13, 462, 1678, 921, 29926, 353, 921, 29888, 29961, 29875, 29962, 718, 313, 29916, 1039, 718, 29871, 29896, 29889, 29900, 29897, 334, 29871, 29900, 29889, 29945, 334, 15414, 13, 462, 1678, 6230, 29889, 9469, 3321, 29898, 2230, 29892, 921, 29926, 29892, 282, 29916, 29961, 29875, 29892, 432, 2314, 13, 13, 9651, 318, 29916, 29961, 17361, 353, 282, 29916, 29961, 17361, 29871, 396, 278, 21929, 1490, 2286, 338, 884, 278, 19269, 13, 13, 9651, 363, 474, 297, 3464, 29898, 1949, 29918, 29920, 2873, 1125, 13, 18884, 318, 29893, 29961, 29875, 29962, 353, 3038, 29889, 517, 29918, 705, 5861, 29898, 1314, 29961, 29875, 2314, 13, 9651, 1583, 29889, 535, 643, 1490, 29918, 29893, 353, 318, 29893, 13, 4706, 1683, 29901, 13, 9651, 1583, 29889, 535, 643, 1490, 29918, 29893, 353, 1650, 13, 13, 4706, 1583, 29889, 29873, 353, 931, 13, 4706, 1583, 29889, 4467, 29882, 353, 27716, 13, 4706, 1583, 29889, 3729, 353, 3038, 13, 4706, 1583, 3032, 6768, 353, 3987, 13, 4706, 1583, 3032, 25105, 353, 17558, 13, 13, 1678, 732, 6799, 13, 1678, 822, 1650, 29898, 1311, 1125, 13, 4706, 736, 1583, 29889, 535, 643, 1490, 29918, 29893, 13, 13, 1678, 732, 6799, 13, 1678, 822, 19269, 29898, 1311, 1125, 13, 4706, 736, 1583, 29889, 535, 643, 1490, 29918, 29893, 7503, 29892, 29871, 29900, 29962, 13, 13, 1678, 732, 6799, 13, 1678, 822, 931, 29898, 1311, 1125, 13, 4706, 736, 1583, 29889, 29873, 13, 13, 1678, 732, 6799, 13, 1678, 822, 7472, 29918, 29883, 1579, 29898, 1311, 1125, 13, 4706, 736, 29871, 29896, 29889, 29900, 13, 13, 1678, 732, 6799, 13, 1678, 822, 3987, 29898, 1311, 1125, 13, 4706, 736, 1583, 3032, 6768, 3032, 294, 8977, 580, 13, 13, 1678, 732, 6799, 13, 1678, 822, 17558, 29898, 1311, 1125, 13, 4706, 736, 1583, 3032, 25105, 3032, 294, 8977, 580, 13, 13, 1678, 732, 6799, 13, 1678, 822, 7472, 29918, 29883, 1579, 29898, 1311, 1125, 13, 4706, 413, 353, 1583, 29889, 3729, 29889, 2098, 448, 29871, 29896, 13, 13, 4706, 565, 1583, 3032, 6768, 29889, 14146, 1061, 1275, 376, 29878, 29895, 29896, 1115, 13, 9651, 736, 29871, 29896, 29889, 29900, 847, 313, 29906, 334, 413, 718, 29871, 29896, 29897, 13, 4706, 565, 1583, 3032, 6768, 29889, 14146, 1061, 1275, 376, 29878, 29895, 29906, 1115, 13, 9651, 736, 29871, 29896, 29889, 29900, 847, 313, 29906, 334, 413, 718, 29871, 29896, 29897, 13, 4706, 565, 1583, 3032, 6768, 29889, 14146, 1061, 1275, 376, 29878, 29895, 29941, 1115, 13, 9651, 736, 29871, 29896, 29889, 29900, 847, 313, 29906, 334, 413, 718, 29871, 29896, 29897, 13, 4706, 565, 1583, 3032, 6768, 29889, 14146, 1061, 1275, 376, 29878, 29895, 29941, 29899, 21935, 29900, 29906, 1115, 13, 9651, 736, 29871, 29906, 29889, 29900, 847, 313, 29906, 334, 413, 718, 29871, 29896, 29897, 13, 13, 1678, 822, 7472, 29918, 29893, 5989, 412, 287, 29898, 1311, 1125, 13, 4706, 565, 1583, 3032, 25105, 29889, 2573, 1275, 376, 328, 345, 428, 1115, 13, 9651, 736, 6425, 29898, 1311, 3032, 25105, 29889, 29893, 5989, 412, 287, 29897, 13, 4706, 25342, 1583, 3032, 25105, 29889, 2573, 1275, 376, 3074, 414, 1115, 13, 9651, 736, 6425, 29898, 1311, 29889, 535, 643, 1490, 29918, 29893, 7503, 29892, 29871, 29900, 14664, 3317, 580, 13, 13, 1678, 822, 6564, 29898, 1311, 29892, 11636, 1125, 13, 4706, 1053, 12655, 408, 7442, 13, 13, 4706, 822, 318, 6333, 29898, 29884, 1125, 13, 9651, 318, 6333, 353, 7442, 29889, 3298, 359, 29918, 4561, 29898, 29884, 29897, 13, 9651, 29365, 29898, 1311, 3032, 25105, 29892, 318, 29892, 1583, 29889, 3729, 29892, 1583, 29889, 4467, 29882, 29889, 8235, 29892, 318, 6333, 29897, 13, 9651, 736, 318, 6333, 13, 13, 4706, 565, 1583, 3032, 6768, 29889, 14146, 1061, 1275, 376, 29878, 29895, 29896, 1115, 13, 9651, 318, 353, 1583, 29889, 535, 643, 1490, 29918, 29893, 13, 9651, 318, 4619, 11636, 334, 318, 6333, 29898, 29884, 29897, 13, 13, 4706, 565, 1583, 3032, 6768, 29889, 14146, 1061, 1275, 376, 29878, 29895, 29906, 1115, 13, 9651, 289, 29896, 353, 29871, 29900, 29889, 29900, 13, 9651, 289, 29906, 353, 29871, 29900, 29889, 29945, 13, 9651, 318, 353, 318, 29900, 353, 1583, 29889, 535, 643, 1490, 29918, 29893, 29889, 8552, 580, 13, 9651, 318, 353, 318, 29900, 334, 289, 29896, 718, 313, 29896, 29889, 29900, 448, 289, 29896, 29897, 334, 313, 29884, 718, 11636, 334, 318, 6333, 29898, 29884, 876, 13, 9651, 318, 353, 318, 29900, 334, 289, 29906, 718, 313, 29896, 29889, 29900, 448, 289, 29906, 29897, 334, 313, 29884, 718, 11636, 334, 318, 6333, 29898, 29884, 876, 13, 13, 4706, 565, 1583, 3032, 6768, 29889, 14146, 1061, 1275, 376, 29878, 29895, 29941, 1115, 13, 9651, 289, 29896, 353, 29871, 29900, 29889, 29900, 13, 9651, 289, 29906, 353, 29871, 29941, 29889, 29900, 847, 29871, 29946, 29889, 29900, 13, 9651, 289, 29941, 353, 29871, 29896, 29889, 29900, 847, 29871, 29941, 29889, 29900, 13, 9651, 318, 353, 318, 29900, 353, 1583, 29889, 535, 643, 1490, 29918, 29893, 29889, 8552, 580, 13, 9651, 318, 353, 318, 29900, 334, 289, 29896, 718, 313, 29896, 29889, 29900, 448, 289, 29896, 29897, 334, 313, 29884, 718, 11636, 334, 318, 6333, 29898, 29884, 876, 13, 9651, 318, 353, 318, 29900, 334, 289, 29906, 718, 313, 29896, 29889, 29900, 448, 289, 29906, 29897, 334, 313, 29884, 718, 11636, 334, 318, 6333, 29898, 29884, 876, 13, 9651, 318, 353, 318, 29900, 334, 289, 29941, 718, 313, 29896, 29889, 29900, 448, 289, 29941, 29897, 334, 313, 29884, 718, 11636, 334, 318, 6333, 29898, 29884, 876, 13, 13, 4706, 565, 1583, 3032, 6768, 29889, 14146, 1061, 1275, 376, 29878, 29895, 29941, 29899, 21935, 29900, 29906, 1115, 13, 9651, 318, 353, 318, 29900, 353, 1583, 29889, 535, 643, 1490, 29918, 29893, 29889, 8552, 580, 13, 9651, 318, 353, 318, 29900, 718, 29871, 29900, 29889, 29945, 334, 11636, 334, 318, 6333, 29898, 29884, 29897, 13, 9651, 318, 353, 318, 718, 29871, 29900, 29889, 29945, 334, 11636, 334, 318, 6333, 29898, 29884, 29897, 13, 9651, 318, 353, 29871, 29906, 29889, 29900, 847, 29871, 29941, 29889, 29900, 334, 318, 29900, 718, 29871, 29896, 29889, 29900, 847, 29871, 29941, 29889, 29900, 334, 313, 29884, 718, 29871, 29900, 29889, 29945, 334, 11636, 334, 318, 6333, 29898, 29884, 876, 13, 9651, 318, 353, 318, 718, 29871, 29900, 29889, 29945, 334, 11636, 334, 318, 6333, 29898, 29884, 29897, 13, 13, 4706, 1583, 29889, 535, 643, 1490, 29918, 29893, 353, 318, 13, 4706, 1583, 29889, 29873, 4619, 11636, 13, 2 ]
pychron/lasers/power/composite_calibration_manager.py
ASUPychron/pychron
31
2675
<reponame>ASUPychron/pychron # =============================================================================== # Copyright 2012 <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. # =============================================================================== # ============= enthought library imports ======================= from __future__ import absolute_import from traits.api import HasTraits, Instance, DelegatesTo, Button, List, Any, Float from traitsui.api import View, Item, VGroup, HGroup, Group, spring, TabularEditor # ============= standard library imports ======================== import pickle import os from numpy import polyval # ============= local library imports ========================== from pychron.managers.manager import Manager from pychron.database.selectors.power_calibration_selector import ( PowerCalibrationSelector, ) from pychron.database.adapters.power_calibration_adapter import PowerCalibrationAdapter from pychron.paths import paths from pychron.graph.graph import Graph from pychron.hardware.meter_calibration import MeterCalibration """ use a dbselector to select data """ class BoundsSelector(HasTraits): graph = Instance(Graph) def traits_view(self): v = View( Item("graph", show_label=False, style="custom"), buttons=["OK", "Cancel"], kind="livemodal", ) return v class CompositeCalibrationManager(Manager): db = Instance(PowerCalibrationAdapter) selector = Instance(PowerCalibrationSelector) append = Button replace = Button load_graph = Button save = Button selected_calibrations = List selected = Any results = DelegatesTo("selector") graph = Instance(Graph) dclicked = Any parent_name = "FusionsDiode" power = Float input = Float def _power_changed(self): pc = self._load_calibration() pc if pc is not None: self.input, _ = pc.get_input(self.power) def _load_calibration(self): try: p = self._get_calibration_path() with open(p, "rb") as f: pc = pickle.load(f) except: return return pc def _dclicked_changed(self): s = self.selected if s is not None: s.bounds = None s.load_graph() s.graph.add_range_selector() bc = BoundsSelector(graph=s.graph) info = bc.edit_traits() if info.result: bounds = s.graph.plots[0].default_index.metadata["selections"] s.bounds = bounds s.calibration_bounds = ( polyval(s.coefficients, bounds[0]), polyval(s.coefficients, bounds[1]), ) def _append_fired(self): s = self.selector.selected if s is not None: for si in s: trs = list(si.traits().keys()).remove("graph") self.selected_calibrations.append(si.clone_traits(traits=trs)) def _replace_fired(self): s = self.selector.selected trs = list(s.traits().keys()).remove("graph") self.selected_calibrations = s.clone_traits(traits=trs) def _save_fired(self): self._dump_calibration() def _dump_calibration(self): pc = MeterCalibration() coeffs = [] bounds = [] for s in self.selected_calibrations: coeffs.append(s.coefficients) bounds.append(s.calibration_bounds) pc.coefficients = coeffs pc.bounds = bounds p = self._get_calibration_path() self.info("saving calibration to {}".format(p)) with open(p, "wb") as f: pickle.dump(pc, f) def _get_calibration_path(self): p = os.path.join( paths.hidden_dir, "{}_power_calibration".format(self.parent_name) ) return p def _load_graph_fired(self): g = self.graph g.clear() # g.new_plot(zoom=True, pan=True, # padding=[40, 10, 10, 40] # ) has_bounds = False for i, s in enumerate(self.selected_calibrations): if s.bounds: has_bounds = True elif has_bounds: g.clear() self._plot_factory(g) self.warning_dialog("{} does not have its bounds set".format(s.rid)) break s.load_graph(graph=g, new_plot=i == 0) g.redraw() def traits_view(self): selector_grp = Group(Item("selector", style="custom", show_label=False)) transfer_grp = VGroup( spring, VGroup(Item("append", show_label=False), Item("replace", show_label=False)), spring, ) editor = TabularEditor( adapter=self.selector.tabular_adapter(), editable=False, dclicked="object.dclicked", selected="object.selected", ) selected_grp = Item("selected_calibrations", editor=editor, show_label=False) data_tab = Group( HGroup(selector_grp, transfer_grp, selected_grp), show_border=True, label="Data", ) process_tab = Group( HGroup( Item("power"), Item("input", format_str=" %0.3f ", style="readonly"), spring, Item("save", show_label=False), Item("load_graph", show_label=False), ), Item("graph", style="custom", show_label=False), show_border=True, label="Process", ) v = View( VGroup(data_tab, process_tab), resizable=True, title="Composite {} Power Calibration".format(self.parent_name), ) return v def _graph_default(self): g = Graph( container_dict={ # 'fill_padding':True, # 'bgcolor':'red', "padding": 5 } ) self._plot_factory(g) return g def _plot_factory(self, graph): graph.new_plot( zoom=True, pan=True, padding=[50, 10, 10, 40], xtitle="Setpoint (%)", ytitle="Measured Power (W)", ) def _db_default(self): if self.parent_name == "FusionsDiode": name = paths.diodelaser_db else: name = paths.co2laser_db db = PowerCalibrationAdapter(name=name, kind="sqlite") db.connect() return db def _selector_default(self): return self.db._selector_factory() if __name__ == "__main__": ccm = CompositeCalibrationManager() ccm.configure_traits() # ============= EOF =============================================
[ 1, 529, 276, 1112, 420, 29958, 3289, 4897, 3376, 1617, 29914, 2272, 5904, 13, 29937, 1275, 9166, 9166, 9166, 9166, 4936, 2751, 29922, 13, 29937, 14187, 1266, 29871, 29906, 29900, 29896, 29906, 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, 259, 1732, 597, 1636, 29889, 4288, 29889, 990, 29914, 506, 11259, 29914, 27888, 1430, 1660, 29899, 29906, 29889, 29900, 13, 29937, 13, 29937, 25870, 3734, 491, 22903, 4307, 470, 15502, 304, 297, 5007, 29892, 7047, 13, 29937, 13235, 1090, 278, 19245, 338, 13235, 373, 385, 376, 3289, 8519, 29908, 350, 3289, 3235, 29892, 13, 29937, 399, 1806, 8187, 2692, 399, 1718, 29934, 13566, 29059, 6323, 8707, 29928, 22122, 29903, 8079, 13764, 29979, 476, 22255, 29892, 2845, 4653, 470, 2411, 2957, 29889, 13, 29937, 2823, 278, 19245, 363, 278, 2702, 4086, 14765, 1076, 11239, 322, 13, 29937, 27028, 1090, 278, 19245, 29889, 13, 29937, 1275, 9166, 9166, 9166, 9166, 4936, 2751, 29922, 13, 13, 29937, 1275, 4936, 25512, 875, 29882, 1774, 3489, 24802, 1275, 9166, 2751, 29922, 13, 3166, 4770, 29888, 9130, 1649, 1053, 8380, 29918, 5215, 13, 3166, 1020, 1169, 29889, 2754, 1053, 11699, 5323, 1169, 29892, 2799, 749, 29892, 897, 1397, 1078, 1762, 29892, 11025, 29892, 2391, 29892, 3139, 29892, 27842, 13, 3166, 1020, 1169, 1481, 29889, 2754, 1053, 4533, 29892, 10976, 29892, 478, 4782, 29892, 379, 4782, 29892, 6431, 29892, 6709, 29892, 11090, 1070, 15280, 13, 13, 29937, 1275, 4936, 25512, 3918, 3489, 24802, 1275, 9166, 2751, 1360, 13, 5215, 5839, 280, 13, 5215, 2897, 13, 3166, 12655, 1053, 15680, 791, 13, 13, 29937, 1275, 4936, 25512, 1887, 3489, 24802, 29871, 1275, 9166, 4936, 13, 3166, 282, 3376, 1617, 29889, 1171, 18150, 29889, 12847, 1053, 15629, 13, 3166, 282, 3376, 1617, 29889, 9803, 29889, 2622, 943, 29889, 13519, 29918, 1052, 26218, 29918, 14357, 1053, 313, 13, 1678, 9206, 7856, 26218, 10378, 29892, 13, 29897, 13, 3166, 282, 3376, 1617, 29889, 9803, 29889, 328, 481, 2153, 29889, 13519, 29918, 1052, 26218, 29918, 21412, 1053, 9206, 7856, 26218, 6168, 13, 3166, 282, 3376, 1617, 29889, 24772, 1053, 10898, 13, 3166, 282, 3376, 1617, 29889, 4262, 29889, 4262, 1053, 12367, 13, 3166, 282, 3376, 1617, 29889, 6800, 2519, 29889, 29391, 29918, 1052, 26218, 1053, 19333, 7856, 26218, 13, 13, 15945, 29908, 13, 1509, 263, 4833, 14357, 304, 1831, 848, 13, 15945, 29908, 13, 13, 13, 1990, 350, 3885, 10378, 29898, 14510, 5323, 1169, 1125, 13, 1678, 3983, 353, 2799, 749, 29898, 9527, 29897, 13, 13, 1678, 822, 1020, 1169, 29918, 1493, 29898, 1311, 1125, 13, 4706, 325, 353, 4533, 29898, 13, 9651, 10976, 703, 4262, 613, 1510, 29918, 1643, 29922, 8824, 29892, 3114, 543, 6341, 4968, 13, 9651, 9828, 29922, 3366, 8949, 613, 376, 19420, 12436, 13, 9651, 2924, 543, 17843, 331, 397, 284, 613, 13, 4706, 1723, 13, 4706, 736, 325, 13, 13, 13, 1990, 24497, 568, 7856, 26218, 3260, 29898, 3260, 1125, 13, 1678, 4833, 353, 2799, 749, 29898, 21472, 7856, 26218, 6168, 29897, 13, 1678, 11764, 353, 2799, 749, 29898, 21472, 7856, 26218, 10378, 29897, 13, 13, 1678, 9773, 353, 11025, 13, 1678, 5191, 353, 11025, 13, 1678, 2254, 29918, 4262, 353, 11025, 13, 1678, 4078, 353, 11025, 13, 13, 1678, 4629, 29918, 1052, 4626, 800, 353, 2391, 13, 1678, 4629, 353, 3139, 13, 13, 1678, 2582, 353, 897, 1397, 1078, 1762, 703, 14357, 1159, 13, 13, 1678, 3983, 353, 2799, 749, 29898, 9527, 29897, 13, 13, 1678, 270, 3808, 287, 353, 3139, 13, 13, 1678, 3847, 29918, 978, 353, 376, 29943, 375, 1080, 12130, 356, 29908, 13, 13, 1678, 3081, 353, 27842, 13, 1678, 1881, 353, 27842, 13, 13, 1678, 822, 903, 13519, 29918, 15033, 29898, 1311, 1125, 13, 4706, 22844, 353, 1583, 3032, 1359, 29918, 1052, 26218, 580, 13, 4706, 22844, 13, 4706, 565, 22844, 338, 451, 6213, 29901, 13, 9651, 1583, 29889, 2080, 29892, 903, 353, 22844, 29889, 657, 29918, 2080, 29898, 1311, 29889, 13519, 29897, 13, 13, 1678, 822, 903, 1359, 29918, 1052, 26218, 29898, 1311, 1125, 13, 4706, 1018, 29901, 13, 9651, 282, 353, 1583, 3032, 657, 29918, 1052, 26218, 29918, 2084, 580, 13, 9651, 411, 1722, 29898, 29886, 29892, 376, 6050, 1159, 408, 285, 29901, 13, 18884, 22844, 353, 5839, 280, 29889, 1359, 29898, 29888, 29897, 13, 4706, 5174, 29901, 13, 9651, 736, 13, 13, 4706, 736, 22844, 13, 13, 1678, 822, 903, 29881, 3808, 287, 29918, 15033, 29898, 1311, 1125, 13, 4706, 269, 353, 1583, 29889, 8391, 13, 4706, 565, 269, 338, 451, 6213, 29901, 13, 9651, 269, 29889, 23687, 353, 6213, 13, 9651, 269, 29889, 1359, 29918, 4262, 580, 13, 9651, 269, 29889, 4262, 29889, 1202, 29918, 3881, 29918, 14357, 580, 13, 13, 9651, 289, 29883, 353, 350, 3885, 10378, 29898, 4262, 29922, 29879, 29889, 4262, 29897, 13, 13, 9651, 5235, 353, 289, 29883, 29889, 5628, 29918, 3018, 1169, 580, 13, 9651, 565, 5235, 29889, 2914, 29901, 13, 18884, 13451, 353, 269, 29889, 4262, 29889, 26762, 29961, 29900, 1822, 4381, 29918, 2248, 29889, 19635, 3366, 344, 5942, 3108, 13, 18884, 269, 29889, 23687, 353, 13451, 13, 18884, 269, 29889, 1052, 26218, 29918, 23687, 353, 313, 13, 462, 1678, 15680, 791, 29898, 29879, 29889, 1111, 8462, 29879, 29892, 13451, 29961, 29900, 11724, 13, 462, 1678, 15680, 791, 29898, 29879, 29889, 1111, 8462, 29879, 29892, 13451, 29961, 29896, 11724, 13, 18884, 1723, 13, 13, 1678, 822, 903, 4397, 29918, 29888, 2859, 29898, 1311, 1125, 13, 4706, 269, 353, 1583, 29889, 14357, 29889, 8391, 13, 4706, 565, 269, 338, 451, 6213, 29901, 13, 9651, 363, 1354, 297, 269, 29901, 13, 18884, 534, 29879, 353, 1051, 29898, 1039, 29889, 3018, 1169, 2141, 8149, 16655, 5992, 703, 4262, 1159, 13, 18884, 1583, 29889, 8391, 29918, 1052, 4626, 800, 29889, 4397, 29898, 1039, 29889, 16513, 29918, 3018, 1169, 29898, 3018, 1169, 29922, 509, 29879, 876, 13, 13, 1678, 822, 903, 6506, 29918, 29888, 2859, 29898, 1311, 1125, 13, 4706, 269, 353, 1583, 29889, 14357, 29889, 8391, 13, 4706, 534, 29879, 353, 1051, 29898, 29879, 29889, 3018, 1169, 2141, 8149, 16655, 5992, 703, 4262, 1159, 13, 4706, 1583, 29889, 8391, 29918, 1052, 4626, 800, 353, 269, 29889, 16513, 29918, 3018, 1169, 29898, 3018, 1169, 29922, 509, 29879, 29897, 13, 13, 1678, 822, 903, 7620, 29918, 29888, 2859, 29898, 1311, 1125, 13, 4706, 1583, 3032, 15070, 29918, 1052, 26218, 580, 13, 13, 1678, 822, 903, 15070, 29918, 1052, 26218, 29898, 1311, 1125, 13, 4706, 22844, 353, 19333, 7856, 26218, 580, 13, 4706, 1302, 12352, 29879, 353, 5159, 13, 4706, 13451, 353, 5159, 13, 4706, 363, 269, 297, 1583, 29889, 8391, 29918, 1052, 4626, 800, 29901, 13, 9651, 1302, 12352, 29879, 29889, 4397, 29898, 29879, 29889, 1111, 8462, 29879, 29897, 13, 9651, 13451, 29889, 4397, 29898, 29879, 29889, 1052, 26218, 29918, 23687, 29897, 13, 4706, 22844, 29889, 1111, 8462, 29879, 353, 1302, 12352, 29879, 13, 4706, 22844, 29889, 23687, 353, 13451, 13, 13, 4706, 282, 353, 1583, 3032, 657, 29918, 1052, 26218, 29918, 2084, 580, 13, 4706, 1583, 29889, 3888, 703, 29879, 5555, 1208, 26218, 304, 6571, 1642, 4830, 29898, 29886, 876, 13, 4706, 411, 1722, 29898, 29886, 29892, 376, 29893, 29890, 1159, 408, 285, 29901, 13, 9651, 5839, 280, 29889, 15070, 29898, 6739, 29892, 285, 29897, 13, 13, 1678, 822, 903, 657, 29918, 1052, 26218, 29918, 2084, 29898, 1311, 1125, 13, 4706, 282, 353, 2897, 29889, 2084, 29889, 7122, 29898, 13, 9651, 10898, 29889, 10892, 29918, 3972, 29892, 29850, 2403, 13519, 29918, 1052, 26218, 1642, 4830, 29898, 1311, 29889, 3560, 29918, 978, 29897, 13, 4706, 1723, 13, 4706, 736, 282, 13, 13, 1678, 822, 903, 1359, 29918, 4262, 29918, 29888, 2859, 29898, 1311, 1125, 13, 13, 4706, 330, 353, 1583, 29889, 4262, 13, 4706, 330, 29889, 8551, 580, 13, 4706, 396, 4706, 330, 29889, 1482, 29918, 5317, 29898, 2502, 290, 29922, 5574, 29892, 7243, 29922, 5574, 29892, 13, 4706, 396, 462, 259, 7164, 11759, 29946, 29900, 29892, 29871, 29896, 29900, 29892, 29871, 29896, 29900, 29892, 29871, 29946, 29900, 29962, 13, 4706, 396, 462, 259, 1723, 13, 4706, 756, 29918, 23687, 353, 7700, 13, 4706, 363, 474, 29892, 269, 297, 26985, 29898, 1311, 29889, 8391, 29918, 1052, 4626, 800, 1125, 13, 9651, 565, 269, 29889, 23687, 29901, 13, 18884, 756, 29918, 23687, 353, 5852, 13, 9651, 25342, 756, 29918, 23687, 29901, 13, 18884, 330, 29889, 8551, 580, 13, 18884, 1583, 3032, 5317, 29918, 14399, 29898, 29887, 29897, 13, 18884, 1583, 29889, 27392, 29918, 15901, 703, 8875, 947, 451, 505, 967, 13451, 731, 1642, 4830, 29898, 29879, 29889, 2429, 876, 13, 18884, 2867, 13, 13, 9651, 269, 29889, 1359, 29918, 4262, 29898, 4262, 29922, 29887, 29892, 716, 29918, 5317, 29922, 29875, 1275, 29871, 29900, 29897, 13, 13, 4706, 330, 29889, 1127, 1610, 580, 13, 13, 1678, 822, 1020, 1169, 29918, 1493, 29898, 1311, 1125, 13, 4706, 11764, 29918, 629, 29886, 353, 6431, 29898, 2001, 703, 14357, 613, 3114, 543, 6341, 613, 1510, 29918, 1643, 29922, 8824, 876, 13, 4706, 6782, 29918, 629, 29886, 353, 478, 4782, 29898, 13, 9651, 6709, 29892, 13, 9651, 478, 4782, 29898, 2001, 703, 4397, 613, 1510, 29918, 1643, 29922, 8824, 511, 10976, 703, 6506, 613, 1510, 29918, 1643, 29922, 8824, 8243, 13, 9651, 6709, 29892, 13, 4706, 1723, 13, 4706, 6920, 353, 11090, 1070, 15280, 29898, 13, 9651, 13304, 29922, 1311, 29889, 14357, 29889, 9456, 29918, 21412, 3285, 13, 9651, 3863, 519, 29922, 8824, 29892, 13, 9651, 270, 3808, 287, 543, 3318, 29889, 29881, 3808, 287, 613, 13, 9651, 4629, 543, 3318, 29889, 8391, 613, 13, 4706, 1723, 13, 4706, 4629, 29918, 629, 29886, 353, 10976, 703, 8391, 29918, 1052, 4626, 800, 613, 6920, 29922, 15204, 29892, 1510, 29918, 1643, 29922, 8824, 29897, 13, 4706, 848, 29918, 3891, 353, 6431, 29898, 13, 9651, 379, 4782, 29898, 14357, 29918, 629, 29886, 29892, 6782, 29918, 629, 29886, 29892, 4629, 29918, 629, 29886, 511, 13, 9651, 1510, 29918, 11466, 29922, 5574, 29892, 13, 9651, 3858, 543, 1469, 613, 13, 4706, 1723, 13, 13, 4706, 1889, 29918, 3891, 353, 6431, 29898, 13, 9651, 379, 4782, 29898, 13, 18884, 10976, 703, 13519, 4968, 13, 18884, 10976, 703, 2080, 613, 3402, 29918, 710, 543, 1678, 1273, 29900, 29889, 29941, 29888, 259, 9162, 3114, 543, 949, 6194, 4968, 13, 18884, 6709, 29892, 13, 18884, 10976, 703, 7620, 613, 1510, 29918, 1643, 29922, 8824, 511, 13, 18884, 10976, 703, 1359, 29918, 4262, 613, 1510, 29918, 1643, 29922, 8824, 511, 13, 9651, 10353, 13, 9651, 10976, 703, 4262, 613, 3114, 543, 6341, 613, 1510, 29918, 1643, 29922, 8824, 511, 13, 9651, 1510, 29918, 11466, 29922, 5574, 29892, 13, 9651, 3858, 543, 7032, 613, 13, 4706, 1723, 13, 13, 4706, 325, 353, 4533, 29898, 13, 9651, 478, 4782, 29898, 1272, 29918, 3891, 29892, 1889, 29918, 3891, 511, 13, 9651, 620, 13902, 29922, 5574, 29892, 13, 9651, 3611, 543, 1523, 1066, 568, 6571, 9206, 3037, 26218, 1642, 4830, 29898, 1311, 29889, 3560, 29918, 978, 511, 13, 4706, 1723, 13, 4706, 736, 325, 13, 13, 1678, 822, 903, 4262, 29918, 4381, 29898, 1311, 1125, 13, 4706, 330, 353, 12367, 29898, 13, 9651, 5639, 29918, 8977, 3790, 13, 18884, 396, 462, 462, 29871, 525, 5589, 29918, 12791, 2396, 5574, 29892, 13, 18884, 396, 462, 462, 29871, 525, 16264, 2780, 22099, 1127, 742, 13, 18884, 376, 12791, 1115, 29871, 29945, 13, 9651, 500, 13, 4706, 1723, 13, 4706, 1583, 3032, 5317, 29918, 14399, 29898, 29887, 29897, 13, 4706, 736, 330, 13, 13, 1678, 822, 903, 5317, 29918, 14399, 29898, 1311, 29892, 3983, 1125, 13, 4706, 3983, 29889, 1482, 29918, 5317, 29898, 13, 9651, 19342, 29922, 5574, 29892, 13, 9651, 7243, 29922, 5574, 29892, 13, 9651, 7164, 11759, 29945, 29900, 29892, 29871, 29896, 29900, 29892, 29871, 29896, 29900, 29892, 29871, 29946, 29900, 1402, 13, 632, 486, 1740, 543, 2697, 3149, 313, 10997, 613, 13, 9651, 343, 3257, 543, 6816, 294, 2955, 9206, 313, 29956, 19123, 13, 4706, 1723, 13, 13, 1678, 822, 903, 2585, 29918, 4381, 29898, 1311, 1125, 13, 13, 4706, 565, 1583, 29889, 3560, 29918, 978, 1275, 376, 29943, 375, 1080, 12130, 356, 1115, 13, 9651, 1024, 353, 10898, 29889, 29881, 2660, 295, 29440, 29918, 2585, 13, 4706, 1683, 29901, 13, 9651, 1024, 353, 10898, 29889, 1111, 29906, 3333, 261, 29918, 2585, 13, 4706, 4833, 353, 9206, 7856, 26218, 6168, 29898, 978, 29922, 978, 29892, 2924, 543, 22793, 1159, 13, 4706, 4833, 29889, 6915, 580, 13, 4706, 736, 4833, 13, 13, 1678, 822, 903, 14357, 29918, 4381, 29898, 1311, 1125, 13, 4706, 736, 1583, 29889, 2585, 3032, 14357, 29918, 14399, 580, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 274, 4912, 353, 24497, 568, 7856, 26218, 3260, 580, 13, 1678, 274, 4912, 29889, 17591, 29918, 3018, 1169, 580, 13, 29937, 1275, 4936, 25512, 382, 9800, 1275, 9166, 9166, 4936, 25512, 13, 2 ]
library/modulemanager.py
l29ah/vk4xmpp
77
94195
<reponame>l29ah/vk4xmpp # coding: utf-8 # This file is a part of VK4XMPP transport # © simpleApps, 2015. """ Manages python modules as xmpppy handlers """ __author__ = "mrDoctorWho <<EMAIL>>" __version__ = "1.1" import os from writer import * from __main__ import Component, TransportFeatures, UserFeatures def proxy(func): def wrapper(type, *args): if type: for (handler, typ, ns, makefirst) in args: if isinstance(ns, list): while ns: func(type, handler, typ, ns.pop(), makefirst=makefirst) else: func(type, handler, typ, ns, makefirst=makefirst) return wrapper @proxy def register(*args, **kwargs): Component.RegisterHandler(*args, **kwargs) @proxy def unregister(*args, **kwargs): Component.UnregisterHandler(*args) def addFeatures(features, list=TransportFeatures): for feature in features: list.add(feature) def removeFeatures(features, list=TransportFeatures): for feature in features: if feature in list: list.remove(feature) class ModuleManager(object): """ A complete module manager. You can easy load, reload and unload any module using it. Modules are different from extensions: While extensions works in main globals() and have their callbacks, modules works in their own globals() and they're not affect to the core. Unfortunately, most of modules are not protected from harm so they may have affect on the connection """ loaded = set([]) @staticmethod def getFeatures(module): return getattr(module, "MOD_FEATURES_USER", []) @classmethod def __register(cls, module): register(module.MOD_TYPE, *module.MOD_HANDLERS) addFeatures(module.MOD_FEATURES) addFeatures(cls.getFeatures(module), UserFeatures) cls.loaded.add(module.__name__) @classmethod def __unregister(cls, module): unregister(module.MOD_TYPE, *module.MOD_HANDLERS) removeFeatures(module.MOD_FEATURES) removeFeatures(cls.getFeatures(module), UserFeatures) cls.loaded.remove(module.__name__) @classmethod def list(cls): modules = [] for file in os.listdir("modules"): name, ext = os.path.splitext(file) if ext == ".py": modules.append(name) return modules @classmethod def __load(cls, name, reload_=False): try: if reload_: module = sys.modules[name] cls.__unregister(module) module = reload(module) else: module = __import__(name, globals(), locals()) except Exception: crashLog("modulemanager.load") module = None return module @classmethod def load(cls, list=[]): result = [] errors = [] for name in list: loaded = name in cls.loaded module = cls.__load(name, loaded) if not module: errors.append(name) continue result.append(name) cls.__register(module) return (result, errors) @classmethod def unload(cls, list=[]): result = [] for name in list: if name in sys.modules: cls.__unregister(sys.modules[name]) del sys.modules[name] result.append(name) return result
[ 1, 529, 276, 1112, 420, 29958, 29880, 29906, 29929, 801, 29914, 29894, 29895, 29946, 29916, 29885, 407, 13, 29937, 14137, 29901, 23616, 29899, 29947, 13, 29937, 910, 934, 338, 263, 760, 310, 478, 29968, 29946, 29990, 3580, 29925, 8608, 13, 29937, 29871, 30211, 2560, 2052, 29879, 29892, 29871, 29906, 29900, 29896, 29945, 29889, 13, 13, 15945, 29908, 13, 2517, 1179, 3017, 10585, 408, 921, 29885, 407, 2272, 25795, 13, 15945, 29908, 13, 13, 1649, 8921, 1649, 353, 376, 29885, 29878, 6132, 2801, 22110, 3532, 26862, 6227, 6778, 29908, 13, 1649, 3259, 1649, 353, 376, 29896, 29889, 29896, 29908, 13, 13, 5215, 2897, 13, 3166, 9227, 1053, 334, 13, 3166, 4770, 3396, 1649, 1053, 15924, 29892, 15710, 8263, 3698, 29892, 4911, 8263, 3698, 13, 13, 13, 1753, 10166, 29898, 9891, 1125, 13, 12, 1753, 14476, 29898, 1853, 29892, 334, 5085, 1125, 13, 12, 12, 361, 1134, 29901, 13, 12, 12, 12, 1454, 313, 13789, 29892, 2393, 29892, 17534, 29892, 1207, 4102, 29897, 297, 6389, 29901, 13, 12, 12, 12, 12, 361, 338, 8758, 29898, 1983, 29892, 1051, 1125, 13, 12, 12, 12, 12, 12, 8000, 17534, 29901, 13, 12, 12, 12, 12, 12, 12, 9891, 29898, 1853, 29892, 7834, 29892, 2393, 29892, 17534, 29889, 7323, 3285, 1207, 4102, 29922, 5675, 4102, 29897, 13, 12, 12, 12, 12, 2870, 29901, 13, 12, 12, 12, 12, 12, 9891, 29898, 1853, 29892, 7834, 29892, 2393, 29892, 17534, 29892, 1207, 4102, 29922, 5675, 4102, 29897, 13, 12, 2457, 14476, 13, 13, 13, 29992, 14701, 13, 1753, 6036, 10456, 5085, 29892, 3579, 19290, 1125, 13, 12, 5308, 29889, 15213, 4598, 10456, 5085, 29892, 3579, 19290, 29897, 13, 13, 13, 29992, 14701, 13, 1753, 443, 9573, 10456, 5085, 29892, 3579, 19290, 1125, 13, 12, 5308, 29889, 2525, 9573, 4598, 10456, 5085, 29897, 13, 13, 13, 1753, 788, 8263, 3698, 29898, 22100, 29892, 1051, 29922, 27395, 8263, 3698, 1125, 13, 12, 1454, 4682, 297, 5680, 29901, 13, 12, 12, 1761, 29889, 1202, 29898, 14394, 29897, 13, 13, 13, 1753, 3349, 8263, 3698, 29898, 22100, 29892, 1051, 29922, 27395, 8263, 3698, 1125, 13, 12, 1454, 4682, 297, 5680, 29901, 13, 12, 12, 361, 4682, 297, 1051, 29901, 13, 12, 12, 12, 1761, 29889, 5992, 29898, 14394, 29897, 13, 13, 13, 1990, 15591, 3260, 29898, 3318, 1125, 13, 13, 12, 15945, 29908, 13, 12, 29909, 4866, 3883, 8455, 29889, 13, 12, 3492, 508, 4780, 2254, 29892, 19763, 322, 443, 1359, 738, 3883, 773, 372, 29889, 13, 12, 2111, 2540, 526, 1422, 515, 17752, 29901, 13, 12, 8809, 488, 17752, 1736, 297, 1667, 13149, 1338, 580, 322, 505, 1009, 6939, 29879, 29892, 13, 12, 7576, 1736, 297, 1009, 1914, 13149, 1338, 580, 322, 896, 29915, 276, 451, 6602, 304, 278, 7136, 29889, 13, 12, 2525, 7524, 29892, 1556, 310, 10585, 526, 451, 6364, 515, 10311, 13, 12, 12, 578, 896, 1122, 505, 6602, 373, 278, 3957, 13, 12, 15945, 29908, 13, 13, 12, 15638, 353, 731, 4197, 2314, 13, 13, 12, 29992, 7959, 5696, 13, 12, 1753, 679, 8263, 3698, 29898, 5453, 1125, 13, 12, 12, 2457, 679, 5552, 29898, 5453, 29892, 376, 6720, 29928, 29918, 16359, 1299, 11499, 29903, 29918, 11889, 613, 518, 2314, 13, 13, 12, 29992, 1990, 5696, 13, 12, 1753, 4770, 9573, 29898, 25932, 29892, 3883, 1125, 13, 12, 12, 9573, 29898, 5453, 29889, 6720, 29928, 29918, 11116, 29892, 334, 5453, 29889, 6720, 29928, 29918, 29950, 9468, 29931, 23598, 29897, 13, 12, 12, 1202, 8263, 3698, 29898, 5453, 29889, 6720, 29928, 29918, 16359, 1299, 11499, 29903, 29897, 13, 12, 12, 1202, 8263, 3698, 29898, 25932, 29889, 657, 8263, 3698, 29898, 5453, 511, 4911, 8263, 3698, 29897, 13, 12, 12, 25932, 29889, 15638, 29889, 1202, 29898, 5453, 17255, 978, 1649, 29897, 13, 13, 12, 29992, 1990, 5696, 13, 12, 1753, 4770, 348, 9573, 29898, 25932, 29892, 3883, 1125, 13, 12, 12, 348, 9573, 29898, 5453, 29889, 6720, 29928, 29918, 11116, 29892, 334, 5453, 29889, 6720, 29928, 29918, 29950, 9468, 29931, 23598, 29897, 13, 12, 12, 5992, 8263, 3698, 29898, 5453, 29889, 6720, 29928, 29918, 16359, 1299, 11499, 29903, 29897, 13, 12, 12, 5992, 8263, 3698, 29898, 25932, 29889, 657, 8263, 3698, 29898, 5453, 511, 4911, 8263, 3698, 29897, 13, 12, 12, 25932, 29889, 15638, 29889, 5992, 29898, 5453, 17255, 978, 1649, 29897, 13, 13, 12, 29992, 1990, 5696, 13, 12, 1753, 1051, 29898, 25932, 1125, 13, 12, 12, 7576, 353, 5159, 13, 12, 12, 1454, 934, 297, 2897, 29889, 1761, 3972, 703, 7576, 29908, 1125, 13, 12, 12, 12, 978, 29892, 1294, 353, 2897, 29889, 2084, 29889, 23579, 568, 486, 29898, 1445, 29897, 13, 12, 12, 12, 361, 1294, 1275, 11393, 2272, 1115, 13, 12, 12, 12, 12, 7576, 29889, 4397, 29898, 978, 29897, 13, 12, 12, 2457, 10585, 13, 13, 12, 29992, 1990, 5696, 13, 12, 1753, 4770, 1359, 29898, 25932, 29892, 1024, 29892, 19763, 29918, 29922, 8824, 1125, 13, 12, 12, 2202, 29901, 13, 12, 12, 12, 361, 19763, 29918, 29901, 13, 12, 12, 12, 12, 5453, 353, 10876, 29889, 7576, 29961, 978, 29962, 13, 12, 12, 12, 12, 25932, 17255, 348, 9573, 29898, 5453, 29897, 13, 12, 12, 12, 12, 5453, 353, 19763, 29898, 5453, 29897, 13, 12, 12, 12, 2870, 29901, 13, 12, 12, 12, 12, 5453, 353, 4770, 5215, 12035, 978, 29892, 13149, 1338, 3285, 1180, 1338, 3101, 13, 12, 12, 19499, 8960, 29901, 13, 12, 12, 12, 7283, 1161, 3403, 703, 5453, 12847, 29889, 1359, 1159, 13, 12, 12, 12, 5453, 353, 6213, 13, 12, 12, 2457, 3883, 13, 13, 12, 29992, 1990, 5696, 13, 12, 1753, 2254, 29898, 25932, 29892, 1051, 29922, 2636, 1125, 13, 12, 12, 2914, 353, 5159, 13, 12, 12, 12523, 353, 5159, 13, 12, 12, 1454, 1024, 297, 1051, 29901, 13, 12, 12, 12, 15638, 353, 1024, 297, 1067, 29879, 29889, 15638, 13, 12, 12, 12, 5453, 353, 1067, 29879, 17255, 1359, 29898, 978, 29892, 7500, 29897, 13, 12, 12, 12, 361, 451, 3883, 29901, 13, 12, 12, 12, 12, 12523, 29889, 4397, 29898, 978, 29897, 13, 12, 12, 12, 12, 19878, 13, 13, 12, 12, 12, 2914, 29889, 4397, 29898, 978, 29897, 13, 12, 12, 12, 25932, 17255, 9573, 29898, 5453, 29897, 13, 12, 12, 2457, 313, 2914, 29892, 4436, 29897, 13, 13, 12, 29992, 1990, 5696, 13, 12, 1753, 443, 1359, 29898, 25932, 29892, 1051, 29922, 2636, 1125, 13, 12, 12, 2914, 353, 5159, 13, 12, 12, 1454, 1024, 297, 1051, 29901, 13, 12, 12, 12, 361, 1024, 297, 10876, 29889, 7576, 29901, 13, 12, 12, 12, 12, 25932, 17255, 348, 9573, 29898, 9675, 29889, 7576, 29961, 978, 2314, 13, 12, 12, 12, 12, 6144, 10876, 29889, 7576, 29961, 978, 29962, 13, 12, 12, 12, 12, 2914, 29889, 4397, 29898, 978, 29897, 13, 12, 12, 2457, 1121, 13, 2 ]
appengine-compat/exported_appengine_sdk/google/storage/speckle/proto/jdbc_type.py
speedplane/python-compat-runtime
26
6849
#!/usr/bin/env python # # Copyright 2007 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # """Python equivalent of jdbc_type.h. Python definition of the JDBC type constant values defined in Java class java.sql.Types. Since the values don't fall into the range allowed by a protocol buffer enum, we use Python constants instead. If you update this, update jdbc_type.py also. """ BIT = -7 TINYINT = -6 SMALLINT = 5 INTEGER = 4 BIGINT = -5 FLOAT = 6 REAL = 7 DOUBLE = 8 NUMERIC = 2 DECIMAL = 3 CHAR = 1 VARCHAR = 12 LONGVARCHAR = -1 DATE = 91 TIME = 92 TIMESTAMP = 93 BINARY = -2 VARBINARY = -3 LONGVARBINARY = -4 NULL = 0 OTHER = 1111 JAVA_OBJECT = 2000 DISTINCT = 2001 STRUCT = 2002 ARRAY = 2003 BLOB = 2004 CLOB = 2005 REF = 2006 DATALINK = 70 BOOLEAN = 16 ROWID = -8 NCHAR = -15 NVARCHAR = -9 LONGNVARCHAR = -16 NCLOB = 2011 SQLXML = 2009
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 13, 29937, 13, 29937, 14187, 1266, 29871, 29906, 29900, 29900, 29955, 5087, 9266, 29889, 13, 29937, 13, 29937, 10413, 21144, 1090, 278, 13380, 19245, 29892, 10079, 29871, 29906, 29889, 29900, 313, 1552, 376, 29931, 293, 1947, 1496, 13, 29937, 366, 1122, 451, 671, 445, 934, 5174, 297, 752, 13036, 411, 278, 19245, 29889, 13, 29937, 887, 1122, 4017, 263, 3509, 310, 278, 19245, 472, 13, 29937, 13, 29937, 268, 1732, 597, 1636, 29889, 4288, 29889, 990, 29914, 506, 11259, 29914, 27888, 1430, 1660, 29899, 29906, 29889, 29900, 13, 29937, 13, 29937, 25870, 3734, 491, 22903, 4307, 470, 15502, 304, 297, 5007, 29892, 7047, 13, 29937, 13235, 1090, 278, 19245, 338, 13235, 373, 385, 376, 3289, 8519, 29908, 350, 3289, 3235, 29892, 13, 29937, 399, 1806, 8187, 2692, 399, 1718, 29934, 13566, 29059, 6323, 8707, 29928, 22122, 29903, 8079, 13764, 29979, 476, 22255, 29892, 2845, 4653, 470, 2411, 2957, 29889, 13, 29937, 2823, 278, 19245, 363, 278, 2702, 4086, 14765, 1076, 11239, 322, 13, 29937, 27028, 1090, 278, 19245, 29889, 13, 29937, 13, 13, 13, 15945, 29908, 11980, 7126, 310, 432, 11140, 29918, 1853, 29889, 29882, 29889, 13, 13, 11980, 5023, 310, 278, 435, 22840, 1134, 4868, 1819, 3342, 297, 3355, 770, 13, 1645, 29889, 2850, 29889, 10562, 29889, 29871, 4001, 278, 1819, 1016, 29915, 29873, 6416, 964, 278, 3464, 6068, 491, 13, 29874, 9608, 6835, 14115, 29892, 591, 671, 5132, 17727, 2012, 29889, 13, 13, 3644, 366, 2767, 445, 29892, 2767, 432, 11140, 29918, 1853, 29889, 2272, 884, 29889, 13, 15945, 29908, 13, 13, 13, 13, 13, 22698, 353, 448, 29955, 13, 29911, 1177, 29979, 10192, 353, 448, 29953, 13, 29903, 1529, 2208, 10192, 353, 29871, 29945, 13, 1177, 4330, 17070, 353, 29871, 29946, 13, 29933, 6259, 10192, 353, 448, 29945, 13, 29943, 3927, 1299, 353, 29871, 29953, 13, 1525, 1964, 353, 29871, 29955, 13, 3970, 7466, 1307, 353, 29871, 29947, 13, 13967, 1001, 2965, 353, 29871, 29906, 13, 2287, 29907, 2260, 29931, 353, 29871, 29941, 13, 11282, 353, 29871, 29896, 13, 29963, 15364, 353, 29871, 29896, 29906, 13, 29931, 20614, 29963, 15364, 353, 448, 29896, 13, 6248, 353, 29871, 29929, 29896, 13, 15307, 353, 29871, 29929, 29906, 13, 15307, 1254, 19297, 353, 29871, 29929, 29941, 13, 29933, 1177, 19926, 353, 448, 29906, 13, 26865, 29933, 1177, 19926, 353, 448, 29941, 13, 29931, 20614, 26865, 29933, 1177, 19926, 353, 448, 29946, 13, 10074, 353, 29871, 29900, 13, 2891, 4448, 353, 29871, 29896, 29896, 29896, 29896, 13, 29967, 26612, 29918, 14824, 17637, 353, 29871, 29906, 29900, 29900, 29900, 13, 4571, 1254, 28852, 353, 29871, 29906, 29900, 29900, 29896, 13, 10810, 29965, 1783, 353, 29871, 29906, 29900, 29900, 29906, 13, 1718, 22800, 353, 29871, 29906, 29900, 29900, 29941, 13, 29933, 28902, 353, 29871, 29906, 29900, 29900, 29946, 13, 29907, 28902, 353, 29871, 29906, 29900, 29900, 29945, 13, 25866, 353, 29871, 29906, 29900, 29900, 29953, 13, 25832, 1964, 1177, 29968, 353, 29871, 29955, 29900, 13, 8456, 29949, 1307, 2190, 353, 29871, 29896, 29953, 13, 1672, 19292, 353, 448, 29947, 13, 29940, 11282, 353, 448, 29896, 29945, 13, 29940, 29963, 15364, 353, 448, 29929, 13, 29931, 20614, 29940, 29963, 15364, 353, 448, 29896, 29953, 13, 15868, 28902, 353, 29871, 29906, 29900, 29896, 29896, 13, 4176, 9165, 353, 29871, 29906, 29900, 29900, 29929, 13, 2 ]
vertexLite/views.py
FelixTheC/onlineOrderForm
0
182004
<reponame>FelixTheC/onlineOrderForm from django.forms import formset_factory from django.shortcuts import redirect from django.urls import reverse from django.views.generic import UpdateView from extras.views import PDFView from extras.views import ThanksForOderView from orderForm.own_decorator import hash_is_allowed from orderForm.own_mixins import HashRequiredMixin from extras.views import customer_deliver_address_function from survey.forms import BaseArticleForm from orderForm.own_mixins import ProveHashMixin from .forms import VertexLiteCreateForm from .forms import VLArticleForm from .forms import VLPaymentOptionForm from .models import VertexLiteOrderModel @hash_is_allowed def vertexLiteForm(request, hash): return redirect(reverse('vertex_lite:vertex_lite_customer_form', kwargs={'hash': hash, 'pk': hash[14:]} )) class CustomerVertexLiteUpdate(HashRequiredMixin, ProveHashMixin, UpdateView): model = VertexLiteOrderModel form_class = VertexLiteCreateForm template_name = 'vertexLiteForm.html' formset_error = '' def get_context_data(self, **kwargs): context = super(CustomerVertexLiteUpdate, self).get_context_data(**kwargs) ArticleFormSet = formset_factory(VLArticleForm, extra=4) initial = [] if self.object.battery_size: for i in range(0, len(self.object.battery_size.split('$')) - 1): initial.append({'battery_size': self.object.battery_size.split('$')[i], 'number_of_collars': self.object.number_of_collars.split('$')[i], 'nom_collar_circumference': self.object.nom_collar_circumference.split('$')[i], }) context['com_type_gl'] = self.object.globalstar context['com_type_ir'] = self.object.iridium context['com_type_gsm'] = self.object.gsm context['com_type_none'] = self.object.store_on_board context['telno'] = self.object.gsm_customer_sim_telephone_no context['pin'] = self.object.gsm_customer_sim_pin context['puk'] = self.object.gsm_customer_sim_puk context['formset'] = ArticleFormSet(initial=initial) context['formset_error'] = self.formset_error return context def get_initial(self): initial = super(CustomerVertexLiteUpdate, self).get_initial() return initial def get_success_url(self, **kwargs): return reverse('vertex_lite:vertex_lite_delivery_form', kwargs={'hash': self.kwargs['hash'], 'pk': self.kwargs['pk']}) def form_valid(self, form): article_form_set = formset_factory(VLArticleForm, min_num=1, validate_min=True, formset=BaseArticleForm) data = { 'form-TOTAL_FORMS': '4', 'form-INITIAL_FORMS': '0', 'form-MAX_NUM_FORMS': '0', 'form-0-battery_size': self.request.POST['form-0-battery_size'], 'form-0-number_of_collars': self.request.POST['form-0-number_of_collars'], 'form-0-nom_collar_circumference': self.request.POST['form-0-nom_collar_circumference'], 'form-1-battery_size': self.request.POST['form-1-battery_size'], 'form-1-number_of_collars': self.request.POST['form-1-number_of_collars'], 'form-1-nom_collar_circumference': self.request.POST['form-1-nom_collar_circumference'], 'form-2-battery_size': self.request.POST['form-2-battery_size'], 'form-2-number_of_collars': self.request.POST['form-2-number_of_collars'], 'form-2-nom_collar_circumference': self.request.POST['form-2-nom_collar_circumference'], 'form-3-battery_size': self.request.POST['form-3-battery_size'], 'form-3-number_of_collars': self.request.POST['form-3-number_of_collars'], 'form-3-nom_collar_circumference': self.request.POST['form-3-nom_collar_circumference'], } formset = article_form_set(data) batterie_sizes_string = '' num_collars_string = '' circumference_string = '' if formset.is_valid(): for f in formset.cleaned_data: if len(f) > 1 is not None: batterie_sizes_string += f['battery_size'] + '$' num_collars_string += str(f['number_of_collars']) + '$' circumference_string += f['nom_collar_circumference'] + '$' else: self.formset_error = 'error' return super(CustomerVertexLiteUpdate, self).form_invalid(form) instance = form.save(commit=False) instance.number_of_collars = num_collars_string instance.battery_size = batterie_sizes_string instance.nom_collar_circumference = circumference_string instance.save() return super(CustomerVertexLiteUpdate, self).form_valid(form) def form_invalid(self, form): return super(CustomerVertexLiteUpdate, self).form_invalid(form) def customer_deliver_address(request, hash, pk): return customer_deliver_address_function(request, hash, pk, VertexLiteOrderModel, 'vertex_lite:thanks', VLPaymentOptionForm) class ThanksView(ThanksForOderView): def __init__(self): super(ThanksView, self).__init__(VertexLiteOrderModel, 'vertexlite_thanks.html') class VertexLitePDFView(PDFView): def __init__(self): super(VertexLitePDFView, self).__init__(VertexLiteOrderModel, 'vertexLiteHtml4Pdf.html', 'order_from')
[ 1, 529, 276, 1112, 420, 29958, 29943, 295, 861, 1576, 29907, 29914, 14627, 7514, 2500, 13, 3166, 9557, 29889, 9514, 1053, 883, 842, 29918, 14399, 13, 3166, 9557, 29889, 12759, 7582, 29879, 1053, 6684, 13, 3166, 9557, 29889, 26045, 1053, 11837, 13, 3166, 9557, 29889, 7406, 29889, 19206, 1053, 10318, 1043, 13, 3166, 429, 10678, 29889, 7406, 1053, 11328, 1043, 13, 3166, 429, 10678, 29889, 7406, 1053, 1834, 2831, 29949, 672, 1043, 13, 3166, 1797, 2500, 29889, 776, 29918, 19557, 1061, 1053, 6608, 29918, 275, 29918, 24622, 13, 3166, 1797, 2500, 29889, 776, 29918, 28084, 1144, 1053, 11874, 19347, 29924, 861, 262, 13, 3166, 429, 10678, 29889, 7406, 1053, 11962, 29918, 6144, 2147, 29918, 7328, 29918, 2220, 13, 3166, 18994, 29889, 9514, 1053, 7399, 9986, 2512, 2500, 13, 3166, 1797, 2500, 29889, 776, 29918, 28084, 1144, 1053, 1019, 345, 10438, 29924, 861, 262, 13, 3166, 869, 9514, 1053, 1798, 4776, 29931, 568, 4391, 2500, 13, 3166, 869, 9514, 1053, 478, 29931, 9986, 2512, 2500, 13, 3166, 869, 9514, 1053, 478, 13208, 388, 358, 8375, 2500, 13, 3166, 869, 9794, 1053, 1798, 4776, 29931, 568, 7514, 3195, 13, 13, 13, 29992, 8568, 29918, 275, 29918, 24622, 13, 1753, 12688, 29931, 568, 2500, 29898, 3827, 29892, 6608, 1125, 13, 1678, 736, 6684, 29898, 24244, 877, 369, 4776, 29918, 29880, 568, 29901, 369, 4776, 29918, 29880, 568, 29918, 15539, 29918, 689, 742, 13, 462, 18884, 9049, 5085, 3790, 29915, 8568, 2396, 6608, 29892, 13, 462, 462, 4706, 525, 20571, 2396, 6608, 29961, 29896, 29946, 29901, 12258, 13, 462, 462, 876, 13, 13, 13, 1990, 21886, 22479, 29931, 568, 6422, 29898, 10438, 19347, 29924, 861, 262, 29892, 1019, 345, 10438, 29924, 861, 262, 29892, 10318, 1043, 1125, 13, 1678, 1904, 353, 1798, 4776, 29931, 568, 7514, 3195, 13, 1678, 883, 29918, 1990, 353, 1798, 4776, 29931, 568, 4391, 2500, 13, 1678, 4472, 29918, 978, 353, 525, 369, 4776, 29931, 568, 2500, 29889, 1420, 29915, 13, 1678, 883, 842, 29918, 2704, 353, 6629, 13, 13, 1678, 822, 679, 29918, 4703, 29918, 1272, 29898, 1311, 29892, 3579, 19290, 1125, 13, 4706, 3030, 353, 2428, 29898, 15122, 22479, 29931, 568, 6422, 29892, 1583, 467, 657, 29918, 4703, 29918, 1272, 29898, 1068, 19290, 29897, 13, 4706, 21746, 2500, 2697, 353, 883, 842, 29918, 14399, 29898, 29963, 29931, 9986, 2512, 2500, 29892, 4805, 29922, 29946, 29897, 13, 4706, 2847, 353, 5159, 13, 4706, 565, 1583, 29889, 3318, 29889, 29890, 2620, 29891, 29918, 2311, 29901, 13, 9651, 363, 474, 297, 3464, 29898, 29900, 29892, 7431, 29898, 1311, 29889, 3318, 29889, 29890, 2620, 29891, 29918, 2311, 29889, 5451, 877, 29938, 8785, 448, 29871, 29896, 1125, 13, 18884, 2847, 29889, 4397, 3319, 29915, 29890, 2620, 29891, 29918, 2311, 2396, 1583, 29889, 3318, 29889, 29890, 2620, 29891, 29918, 2311, 29889, 5451, 877, 29938, 29861, 29875, 1402, 13, 462, 18884, 525, 4537, 29918, 974, 29918, 22017, 1503, 2396, 1583, 29889, 3318, 29889, 4537, 29918, 974, 29918, 22017, 1503, 29889, 5451, 877, 29938, 29861, 29875, 1402, 13, 462, 18884, 525, 11522, 29918, 1054, 4675, 29918, 6034, 398, 1659, 2396, 1583, 29889, 3318, 29889, 11522, 29918, 1054, 4675, 29918, 6034, 398, 1659, 29889, 5451, 877, 29938, 29861, 29875, 1402, 5615, 13, 4706, 3030, 1839, 510, 29918, 1853, 29918, 3820, 2033, 353, 1583, 29889, 3318, 29889, 10945, 8508, 13, 4706, 3030, 1839, 510, 29918, 1853, 29918, 381, 2033, 353, 1583, 29889, 3318, 29889, 381, 333, 1974, 13, 4706, 3030, 1839, 510, 29918, 1853, 29918, 3174, 29885, 2033, 353, 1583, 29889, 3318, 29889, 3174, 29885, 13, 4706, 3030, 1839, 510, 29918, 1853, 29918, 9290, 2033, 353, 1583, 29889, 3318, 29889, 8899, 29918, 265, 29918, 3377, 13, 4706, 3030, 1839, 28497, 1217, 2033, 353, 1583, 29889, 3318, 29889, 3174, 29885, 29918, 15539, 29918, 3601, 29918, 15494, 6710, 29918, 1217, 13, 4706, 3030, 1839, 12687, 2033, 353, 1583, 29889, 3318, 29889, 3174, 29885, 29918, 15539, 29918, 3601, 29918, 12687, 13, 4706, 3030, 1839, 29886, 2679, 2033, 353, 1583, 29889, 3318, 29889, 3174, 29885, 29918, 15539, 29918, 3601, 29918, 29886, 2679, 13, 4706, 3030, 1839, 689, 842, 2033, 353, 21746, 2500, 2697, 29898, 11228, 29922, 11228, 29897, 13, 4706, 3030, 1839, 689, 842, 29918, 2704, 2033, 353, 1583, 29889, 689, 842, 29918, 2704, 13, 4706, 736, 3030, 13, 13, 1678, 822, 679, 29918, 11228, 29898, 1311, 1125, 13, 4706, 2847, 353, 2428, 29898, 15122, 22479, 29931, 568, 6422, 29892, 1583, 467, 657, 29918, 11228, 580, 13, 4706, 736, 2847, 13, 13, 1678, 822, 679, 29918, 8698, 29918, 2271, 29898, 1311, 29892, 3579, 19290, 1125, 13, 4706, 736, 11837, 877, 369, 4776, 29918, 29880, 568, 29901, 369, 4776, 29918, 29880, 568, 29918, 29881, 27657, 29918, 689, 742, 9049, 5085, 3790, 29915, 8568, 2396, 1583, 29889, 19290, 1839, 8568, 7464, 13, 462, 462, 18884, 525, 20571, 2396, 1583, 29889, 19290, 1839, 20571, 2033, 1800, 13, 13, 1678, 822, 883, 29918, 3084, 29898, 1311, 29892, 883, 1125, 13, 4706, 4274, 29918, 689, 29918, 842, 353, 883, 842, 29918, 14399, 29898, 29963, 29931, 9986, 2512, 2500, 29892, 1375, 29918, 1949, 29922, 29896, 29892, 12725, 29918, 1195, 29922, 5574, 29892, 883, 842, 29922, 5160, 9986, 2512, 2500, 29897, 13, 4706, 848, 353, 426, 13, 9651, 525, 689, 29899, 29911, 2891, 1964, 29918, 22051, 4345, 2396, 525, 29946, 742, 13, 9651, 525, 689, 29899, 26019, 25758, 29918, 22051, 4345, 2396, 525, 29900, 742, 13, 9651, 525, 689, 29899, 12648, 29918, 13967, 29918, 22051, 4345, 2396, 525, 29900, 742, 13, 9651, 525, 689, 29899, 29900, 29899, 29890, 2620, 29891, 29918, 2311, 2396, 1583, 29889, 3827, 29889, 5438, 1839, 689, 29899, 29900, 29899, 29890, 2620, 29891, 29918, 2311, 7464, 13, 9651, 525, 689, 29899, 29900, 29899, 4537, 29918, 974, 29918, 22017, 1503, 2396, 1583, 29889, 3827, 29889, 5438, 1839, 689, 29899, 29900, 29899, 4537, 29918, 974, 29918, 22017, 1503, 7464, 13, 9651, 525, 689, 29899, 29900, 29899, 11522, 29918, 1054, 4675, 29918, 6034, 398, 1659, 2396, 1583, 29889, 3827, 29889, 5438, 1839, 689, 29899, 29900, 29899, 11522, 29918, 1054, 4675, 29918, 6034, 398, 1659, 7464, 13, 9651, 525, 689, 29899, 29896, 29899, 29890, 2620, 29891, 29918, 2311, 2396, 1583, 29889, 3827, 29889, 5438, 1839, 689, 29899, 29896, 29899, 29890, 2620, 29891, 29918, 2311, 7464, 13, 9651, 525, 689, 29899, 29896, 29899, 4537, 29918, 974, 29918, 22017, 1503, 2396, 1583, 29889, 3827, 29889, 5438, 1839, 689, 29899, 29896, 29899, 4537, 29918, 974, 29918, 22017, 1503, 7464, 13, 9651, 525, 689, 29899, 29896, 29899, 11522, 29918, 1054, 4675, 29918, 6034, 398, 1659, 2396, 1583, 29889, 3827, 29889, 5438, 1839, 689, 29899, 29896, 29899, 11522, 29918, 1054, 4675, 29918, 6034, 398, 1659, 7464, 13, 9651, 525, 689, 29899, 29906, 29899, 29890, 2620, 29891, 29918, 2311, 2396, 1583, 29889, 3827, 29889, 5438, 1839, 689, 29899, 29906, 29899, 29890, 2620, 29891, 29918, 2311, 7464, 13, 9651, 525, 689, 29899, 29906, 29899, 4537, 29918, 974, 29918, 22017, 1503, 2396, 1583, 29889, 3827, 29889, 5438, 1839, 689, 29899, 29906, 29899, 4537, 29918, 974, 29918, 22017, 1503, 7464, 13, 9651, 525, 689, 29899, 29906, 29899, 11522, 29918, 1054, 4675, 29918, 6034, 398, 1659, 2396, 1583, 29889, 3827, 29889, 5438, 1839, 689, 29899, 29906, 29899, 11522, 29918, 1054, 4675, 29918, 6034, 398, 1659, 7464, 13, 9651, 525, 689, 29899, 29941, 29899, 29890, 2620, 29891, 29918, 2311, 2396, 1583, 29889, 3827, 29889, 5438, 1839, 689, 29899, 29941, 29899, 29890, 2620, 29891, 29918, 2311, 7464, 13, 9651, 525, 689, 29899, 29941, 29899, 4537, 29918, 974, 29918, 22017, 1503, 2396, 1583, 29889, 3827, 29889, 5438, 1839, 689, 29899, 29941, 29899, 4537, 29918, 974, 29918, 22017, 1503, 7464, 13, 9651, 525, 689, 29899, 29941, 29899, 11522, 29918, 1054, 4675, 29918, 6034, 398, 1659, 2396, 1583, 29889, 3827, 29889, 5438, 1839, 689, 29899, 29941, 29899, 11522, 29918, 1054, 4675, 29918, 6034, 398, 1659, 7464, 13, 4706, 500, 13, 4706, 883, 842, 353, 4274, 29918, 689, 29918, 842, 29898, 1272, 29897, 13, 4706, 10193, 347, 29918, 29879, 7093, 29918, 1807, 353, 6629, 13, 4706, 954, 29918, 22017, 1503, 29918, 1807, 353, 6629, 13, 4706, 9942, 1659, 29918, 1807, 353, 6629, 13, 4706, 565, 883, 842, 29889, 275, 29918, 3084, 7295, 13, 9651, 363, 285, 297, 883, 842, 29889, 14941, 287, 29918, 1272, 29901, 13, 462, 1678, 565, 7431, 29898, 29888, 29897, 1405, 29871, 29896, 338, 451, 6213, 29901, 13, 462, 4706, 10193, 347, 29918, 29879, 7093, 29918, 1807, 4619, 285, 1839, 29890, 2620, 29891, 29918, 2311, 2033, 718, 14180, 29915, 13, 462, 4706, 954, 29918, 22017, 1503, 29918, 1807, 4619, 851, 29898, 29888, 1839, 4537, 29918, 974, 29918, 22017, 1503, 11287, 718, 14180, 29915, 13, 462, 4706, 9942, 1659, 29918, 1807, 4619, 285, 1839, 11522, 29918, 1054, 4675, 29918, 6034, 398, 1659, 2033, 718, 14180, 29915, 13, 4706, 1683, 29901, 13, 9651, 1583, 29889, 689, 842, 29918, 2704, 353, 525, 2704, 29915, 13, 9651, 736, 2428, 29898, 15122, 22479, 29931, 568, 6422, 29892, 1583, 467, 689, 29918, 20965, 29898, 689, 29897, 13, 4706, 2777, 353, 883, 29889, 7620, 29898, 15060, 29922, 8824, 29897, 13, 4706, 2777, 29889, 4537, 29918, 974, 29918, 22017, 1503, 353, 954, 29918, 22017, 1503, 29918, 1807, 13, 4706, 2777, 29889, 29890, 2620, 29891, 29918, 2311, 353, 10193, 347, 29918, 29879, 7093, 29918, 1807, 13, 4706, 2777, 29889, 11522, 29918, 1054, 4675, 29918, 6034, 398, 1659, 353, 9942, 1659, 29918, 1807, 13, 4706, 2777, 29889, 7620, 580, 13, 4706, 736, 2428, 29898, 15122, 22479, 29931, 568, 6422, 29892, 1583, 467, 689, 29918, 3084, 29898, 689, 29897, 13, 13, 1678, 822, 883, 29918, 20965, 29898, 1311, 29892, 883, 1125, 13, 4706, 736, 2428, 29898, 15122, 22479, 29931, 568, 6422, 29892, 1583, 467, 689, 29918, 20965, 29898, 689, 29897, 13, 13, 13, 1753, 11962, 29918, 6144, 2147, 29918, 7328, 29898, 3827, 29892, 6608, 29892, 282, 29895, 1125, 13, 1678, 736, 11962, 29918, 6144, 2147, 29918, 7328, 29918, 2220, 29898, 3827, 29892, 6608, 29892, 282, 29895, 29892, 1798, 4776, 29931, 568, 7514, 3195, 29892, 525, 369, 4776, 29918, 29880, 568, 29901, 386, 1331, 742, 478, 13208, 388, 358, 8375, 2500, 29897, 13, 13, 13, 1990, 1834, 1043, 29898, 16894, 2831, 29949, 672, 1043, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 2428, 29898, 16894, 1043, 29892, 1583, 467, 1649, 2344, 12035, 22479, 29931, 568, 7514, 3195, 29892, 525, 369, 4776, 29880, 568, 29918, 386, 1331, 29889, 1420, 1495, 13, 13, 13, 1990, 1798, 4776, 29931, 568, 8493, 1043, 29898, 8493, 1043, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 2428, 29898, 22479, 29931, 568, 8493, 1043, 29892, 1583, 467, 1649, 2344, 12035, 22479, 29931, 568, 7514, 3195, 29892, 525, 369, 4776, 29931, 568, 10922, 29946, 29925, 2176, 29889, 1420, 742, 525, 2098, 29918, 3166, 1495, 2 ]
DFS/BinaryTreeMaxPathSum.py
karan2808/Python-Data-Structures-and-Algorithms
2
53631
class Solution: def __init__(self): self.result = None def findMax(self, root): if root == None: return 0 # find max for left and right node left = self.findMax(root.left) right = self.findMax(root.right) # can either go straight down i.e. from root to one of the children and downwards maxStraight = max(max(left, right) + root.val, root.val) # or can come to root from either of the child nodes and go to other child node maxCurved = max(left + right + root.val, maxStraight) # update the result self.result = max(self.result, maxCurved) # can only return max straight, since we're going upwards return maxStraight def maxPathSum(self, root): if root == None: return 0 self.result = float('-inf') self.findMax(root) return self.result # Definition for a binary tree node. class TreeNode: def __init__(self, val=0, left=None, right=None): self.val = val self.left = left self.right = right def main(): root = TreeNode(5) root.left = TreeNode(2) root.right = TreeNode(7) root.left.left = TreeNode(1) root.left.right = TreeNode(3) root.right.left = TreeNode(5) root.right.right = TreeNode(9) mySol = Solution() print("The max path sum in the binary tree is " + str(mySol.maxPathSum(root))) if __name__ == "__main__": main()
[ 1, 770, 24380, 29901, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 1583, 29889, 2914, 353, 6213, 13, 13, 1678, 822, 1284, 7976, 29898, 1311, 29892, 3876, 1125, 13, 4706, 565, 3876, 1275, 6213, 29901, 13, 9651, 736, 29871, 29900, 13, 13, 4706, 396, 1284, 4236, 363, 2175, 322, 1492, 2943, 13, 4706, 2175, 353, 1583, 29889, 2886, 7976, 29898, 4632, 29889, 1563, 29897, 13, 4706, 1492, 353, 1583, 29889, 2886, 7976, 29898, 4632, 29889, 1266, 29897, 13, 13, 4706, 396, 508, 2845, 748, 7812, 1623, 474, 29889, 29872, 29889, 515, 3876, 304, 697, 310, 278, 4344, 322, 1623, 2935, 13, 4706, 4236, 855, 336, 523, 353, 4236, 29898, 3317, 29898, 1563, 29892, 1492, 29897, 718, 3876, 29889, 791, 29892, 3876, 29889, 791, 29897, 13, 13, 4706, 396, 470, 508, 2041, 304, 3876, 515, 2845, 310, 278, 2278, 7573, 322, 748, 304, 916, 2278, 2943, 13, 4706, 4236, 23902, 1490, 353, 4236, 29898, 1563, 718, 1492, 718, 3876, 29889, 791, 29892, 4236, 855, 336, 523, 29897, 13, 13, 4706, 396, 2767, 278, 1121, 13, 4706, 1583, 29889, 2914, 353, 4236, 29898, 1311, 29889, 2914, 29892, 4236, 23902, 1490, 29897, 13, 13, 4706, 396, 508, 871, 736, 4236, 7812, 29892, 1951, 591, 29915, 276, 2675, 701, 2935, 13, 4706, 736, 4236, 855, 336, 523, 13, 13, 1678, 822, 4236, 2605, 11139, 29898, 1311, 29892, 3876, 1125, 13, 4706, 565, 3876, 1275, 6213, 29901, 13, 9651, 736, 29871, 29900, 13, 13, 4706, 1583, 29889, 2914, 353, 5785, 877, 29899, 7192, 1495, 13, 4706, 1583, 29889, 2886, 7976, 29898, 4632, 29897, 13, 4706, 736, 1583, 29889, 2914, 13, 13, 29937, 21940, 363, 263, 7581, 5447, 2943, 29889, 13, 13, 13, 1990, 15472, 4247, 29901, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 659, 29922, 29900, 29892, 2175, 29922, 8516, 29892, 1492, 29922, 8516, 1125, 13, 4706, 1583, 29889, 791, 353, 659, 13, 4706, 1583, 29889, 1563, 353, 2175, 13, 4706, 1583, 29889, 1266, 353, 1492, 13, 13, 13, 1753, 1667, 7295, 13, 1678, 3876, 353, 15472, 4247, 29898, 29945, 29897, 13, 1678, 3876, 29889, 1563, 353, 15472, 4247, 29898, 29906, 29897, 13, 1678, 3876, 29889, 1266, 353, 15472, 4247, 29898, 29955, 29897, 13, 1678, 3876, 29889, 1563, 29889, 1563, 353, 15472, 4247, 29898, 29896, 29897, 13, 1678, 3876, 29889, 1563, 29889, 1266, 353, 15472, 4247, 29898, 29941, 29897, 13, 1678, 3876, 29889, 1266, 29889, 1563, 353, 15472, 4247, 29898, 29945, 29897, 13, 1678, 3876, 29889, 1266, 29889, 1266, 353, 15472, 4247, 29898, 29929, 29897, 13, 1678, 590, 13296, 353, 24380, 580, 13, 1678, 1596, 703, 1576, 4236, 2224, 2533, 297, 278, 7581, 5447, 338, 376, 718, 851, 29898, 1357, 13296, 29889, 3317, 2605, 11139, 29898, 4632, 4961, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 1667, 580, 13, 2 ]
Processing.py
Ruframapi/reconoSERTest
0
145596
<filename>Processing.py """ File Processing without Spark. Just to take a look. """ import sys import os import json import re import random import nltk import datetime from nltk.tokenize import TweetTokenizer from nltk.corpus import stopwords from nltk.util import skipgrams def main(): filepath = sys.argv[1] processing_type = sys.argv[2] # "user_count, user_filter, user_filter_reviews, user_filter_with_reviews_2" filter_number = int(sys.argv[3]) if not os.path.isfile(filepath): print("File path {} does not exist. Exiting...".format(filepath)) sys.exit() if processing_type == "user_count": user_count(filepath) elif processing_type == "user_filter": user_filter(filepath,filter_number) elif processing_type == "user_filter_reviews": user_filter_with_reviews(filepath,filter_number) elif processing_type == "user_filter_reviews_2": user_filter_with_reviews_2(filepath,filter_number) else: print("Wrong second argument (Processing type)") sys.exit() def user_filter_with_reviews(filepath,filter_number): """For those user with more than -filter_number- reviews the comments are extracted""" filename = "UserFilter"+ str(filter_number) + ".json" with open(filename, 'r', encoding="utf8", errors='ignore') as fp: data=fp.read() dict_users = json.loads(data) filename = "UserFilter"+ str(filter_number) + "-Reviews.json" with open(filepath, encoding="utf8", errors='ignore') as fp: cnt = 0 excnt = 0 text_to_write = "" #for i in xrange(6): # f.next() for line in fp: excnt += 1 if excnt % 100000 == 0: print(excnt) if "review/userId" in line: actualuser = line.replace('review/userId:', '').strip() if "review/text:" in line: if actualuser in dict_users: review = cleanhtml(line.replace('review/text:', '').strip()) review = tokenize(review) text_to_write = text_to_write + actualuser + " || " + json.dumps(review) + "\n" cnt += 1 if cnt == 10000: print("cnt {} excnt {}".format(cnt,excnt)) with open(filename, 'a') as fw: fw.write(text_to_write) cnt = 1 text_to_write = "" def user_filter_with_reviews_2(filepath,filter_number): """ Found filter with reviews 2 """ filename = "UserFilter"+ str(filter_number) + "-Random3.json" with open(filename, 'r', encoding="utf8", errors='ignore') as fp: data=fp.read() dict_users = json.loads(data) dict_total_training = {} dict_total_testing = {} cnt = 1 print(datetime.datetime.now().time()) filename = "UserFilter"+ str(filter_number) + "-Reviews.json" with open(filename, encoding="utf8", errors='ignore') as fp: for line in fp: list_line=line.split("||") user = list_line[0].strip() if user in dict_users: if user not in dict_total_training: dict_total_training[user] = {"reviews": []} if user not in dict_total_testing: dict_total_testing[user] = {"reviews": []} if random.random() < 0.5: word_list_training = json.loads(list_line[1].strip()) dict_total_training[user]["reviews"].extend(word_list_training) else: word_list_testing = json.loads(list_line[1].strip()) dict_total_testing[user]["reviews"].append(word_list_testing) #dict_total[user]["pos"].extend(pos_tagger(word_list)) cnt += 1 if cnt % 100000 == 0: print(datetime.datetime.now().time()) list_total_training = [] for key in dict_total_training: dictdemo = {} dictdemo["user"] = key dictdemo["reviews"] = dict_total_training[key]["reviews"] list_total_training.append(dictdemo) dict_total_training = {} filename = "UserFilter"+ str(filter_number) + "-Training-Random3.json" with open(filename, 'w') as fp: json.dump(list_total_training, fp, indent=4) list_total_training = [] list_total_testing = [] for key in dict_total_testing: dictdemo = {} dictdemo["user"] = key dictdemo["reviews"] = dict_total_testing[key]["reviews"] list_total_testing.append(dictdemo) dict_total_testing = {} filename = "UserFilter"+ str(filter_number) + "-Testing-Random3.json" with open(filename, 'w') as fp: json.dump(list_total_testing, fp, indent=4) def user_filter(filepath,filter_number): """ Found users with more than -filter_number- reviews """ with open(filepath, 'r', encoding="utf8", errors='ignore') as fp: data=fp.read() dict_users = json.loads(data) dict_users_filter = dict(filter(lambda elem: elem[1] >= filter_number ,dict_users.items())) len10p = round(len(dict_users_filter)*0.03) dict_users_filter_rand = dict(random.sample(dict_users_filter.items(), len10p)) filename = "UserFilter"+ str(filter_number) + "-Random3.json" with open(filename, 'w') as fp: json.dump(dict_users_filter_rand, fp, indent=4) def user_count(filepath): """ Count the number of reviews per user""" bag_of_users = {} with open(filepath, encoding="utf8", errors='ignore') as fp: cnt = 0 for line in fp: if "review/userId" in line: readuser = line.replace('review/userId:', '').strip() record_user_cnt(readuser, bag_of_users) cnt += 1 if cnt == 100000: print("line {}".format(line)) cnt = 1 #break sorted_users = order_bag_of_users(bag_of_users, desc=True) with open('userReviewCount.json', 'w') as fp: json.dump(sorted_users, fp, indent=4) def order_bag_of_users(bag_of_users, desc=False): """Order by number of reviews""" users = [(user, cnt) for user, cnt in bag_of_users.items()] users_sort = sorted(users, key=lambda x: x[1], reverse=desc) print("User with more reviews {}".format(users_sort[:10])) return dict(users_sort) def record_user_cnt(user, bag_of_users): """Record the reviews count """ if user != '': if user in bag_of_users: bag_of_users[user] += 1 else: bag_of_users[user] = 1 def cleanhtml(raw_html): """Delete HTML Tags""" cleanr = re.compile('<.*?>') cleantext = re.sub(cleanr, '', raw_html) return cleantext def pos_tagger(s): """POS""" return [i[1] for i in nltk.pos_tag(s)] def tokenize(s): """Tokenizer""" s = s.lower() token = TweetTokenizer() return token.tokenize(s) if __name__ == '__main__': main()
[ 1, 529, 9507, 29958, 7032, 292, 29889, 2272, 13, 15945, 29908, 13, 2283, 10554, 292, 1728, 20814, 29889, 3387, 304, 2125, 263, 1106, 29889, 13, 13, 15945, 29908, 13, 13, 5215, 10876, 13, 5215, 2897, 13, 5215, 4390, 13, 5215, 337, 13, 5215, 4036, 13, 5215, 302, 1896, 29895, 13, 5215, 12865, 13, 3166, 302, 1896, 29895, 29889, 6979, 675, 1053, 323, 16668, 6066, 3950, 13, 3166, 302, 1896, 29895, 29889, 2616, 13364, 1053, 5040, 9303, 13, 3166, 302, 1896, 29895, 29889, 4422, 1053, 14383, 1393, 29879, 13, 13, 13, 1753, 1667, 7295, 13, 268, 13, 1678, 934, 2084, 353, 10876, 29889, 19218, 29961, 29896, 29962, 13, 1678, 9068, 29918, 1853, 353, 10876, 29889, 19218, 29961, 29906, 29962, 396, 376, 1792, 29918, 2798, 29892, 1404, 29918, 4572, 29892, 1404, 29918, 4572, 29918, 276, 7406, 29892, 1404, 29918, 4572, 29918, 2541, 29918, 276, 7406, 29918, 29906, 29908, 13, 1678, 4175, 29918, 4537, 353, 938, 29898, 9675, 29889, 19218, 29961, 29941, 2314, 29871, 13, 13, 1678, 565, 451, 2897, 29889, 2084, 29889, 275, 1445, 29898, 1445, 2084, 1125, 13, 4706, 1596, 703, 2283, 2224, 6571, 947, 451, 1863, 29889, 1222, 11407, 856, 1642, 4830, 29898, 1445, 2084, 876, 13, 4706, 10876, 29889, 13322, 580, 13, 13, 1678, 565, 9068, 29918, 1853, 1275, 376, 1792, 29918, 2798, 1115, 13, 4706, 1404, 29918, 2798, 29898, 1445, 2084, 29897, 13, 1678, 25342, 9068, 29918, 1853, 1275, 376, 1792, 29918, 4572, 1115, 13, 4706, 1404, 29918, 4572, 29898, 1445, 2084, 29892, 4572, 29918, 4537, 29897, 13, 1678, 25342, 9068, 29918, 1853, 1275, 376, 1792, 29918, 4572, 29918, 276, 7406, 1115, 13, 4706, 1404, 29918, 4572, 29918, 2541, 29918, 276, 7406, 29898, 1445, 2084, 29892, 4572, 29918, 4537, 29897, 539, 13, 1678, 25342, 9068, 29918, 1853, 1275, 376, 1792, 29918, 4572, 29918, 276, 7406, 29918, 29906, 1115, 13, 4706, 1404, 29918, 4572, 29918, 2541, 29918, 276, 7406, 29918, 29906, 29898, 1445, 2084, 29892, 4572, 29918, 4537, 29897, 4706, 13, 1678, 1683, 29901, 13, 4706, 1596, 703, 29956, 29373, 1473, 2980, 313, 7032, 292, 1134, 25760, 13, 4706, 10876, 29889, 13322, 580, 13, 13, 1753, 1404, 29918, 4572, 29918, 2541, 29918, 276, 7406, 29898, 1445, 2084, 29892, 4572, 29918, 4537, 1125, 13, 1678, 9995, 2831, 1906, 1404, 411, 901, 1135, 448, 4572, 29918, 4537, 29899, 21804, 278, 6589, 526, 23892, 15945, 29908, 13, 13, 1678, 10422, 353, 376, 2659, 5072, 17969, 851, 29898, 4572, 29918, 4537, 29897, 718, 11393, 3126, 29908, 13, 1678, 411, 1722, 29898, 9507, 29892, 525, 29878, 742, 8025, 543, 9420, 29947, 613, 4436, 2433, 17281, 1495, 408, 285, 29886, 29901, 13, 4706, 848, 29922, 18091, 29889, 949, 580, 13, 13, 1678, 9657, 29918, 7193, 353, 4390, 29889, 18132, 29898, 1272, 29897, 13, 1678, 10422, 353, 376, 2659, 5072, 17969, 851, 29898, 4572, 29918, 4537, 29897, 718, 11663, 1123, 7406, 29889, 3126, 29908, 13, 13, 1678, 411, 1722, 29898, 1445, 2084, 29892, 8025, 543, 9420, 29947, 613, 4436, 2433, 17281, 1495, 408, 285, 29886, 29901, 13, 4706, 274, 593, 353, 29871, 29900, 13, 4706, 5566, 593, 353, 29871, 29900, 13, 4706, 1426, 29918, 517, 29918, 3539, 353, 5124, 13, 13, 4706, 396, 1454, 474, 297, 921, 3881, 29898, 29953, 1125, 13, 4706, 396, 1678, 285, 29889, 4622, 580, 13, 13, 4706, 363, 1196, 297, 285, 29886, 29901, 13, 9651, 5566, 593, 4619, 29871, 29896, 13, 9651, 565, 5566, 593, 1273, 29871, 29896, 29900, 29900, 29900, 29900, 29900, 1275, 29871, 29900, 29901, 13, 18884, 1596, 29898, 735, 20047, 29897, 13, 13, 9651, 565, 376, 27828, 29914, 29721, 29908, 297, 1196, 29901, 13, 18884, 3935, 1792, 353, 1196, 29889, 6506, 877, 27828, 29914, 29721, 29901, 742, 525, 2824, 17010, 580, 13, 632, 13, 9651, 565, 376, 27828, 29914, 726, 6160, 297, 1196, 29901, 13, 18884, 565, 3935, 1792, 297, 9657, 29918, 7193, 29901, 13, 462, 1678, 9076, 353, 5941, 1420, 29898, 1220, 29889, 6506, 877, 27828, 29914, 726, 29901, 742, 525, 2824, 17010, 3101, 13, 462, 1678, 9076, 353, 5993, 675, 29898, 27828, 29897, 13, 462, 1678, 1426, 29918, 517, 29918, 3539, 353, 1426, 29918, 517, 29918, 3539, 718, 3935, 1792, 718, 376, 3830, 376, 718, 4390, 29889, 29881, 17204, 29898, 27828, 29897, 718, 6634, 29876, 29908, 13, 462, 1678, 274, 593, 4619, 29871, 29896, 13, 13, 462, 1678, 565, 274, 593, 1275, 29871, 29896, 29900, 29900, 29900, 29900, 29901, 13, 462, 4706, 1596, 703, 20047, 6571, 5566, 593, 6571, 1642, 4830, 29898, 20047, 29892, 735, 20047, 876, 13, 462, 4706, 411, 1722, 29898, 9507, 29892, 525, 29874, 1495, 408, 285, 29893, 29901, 13, 462, 9651, 285, 29893, 29889, 3539, 29898, 726, 29918, 517, 29918, 3539, 29897, 13, 462, 4706, 274, 593, 353, 29871, 29896, 13, 462, 4706, 1426, 29918, 517, 29918, 3539, 353, 5124, 13, 462, 308, 13, 1753, 1404, 29918, 4572, 29918, 2541, 29918, 276, 7406, 29918, 29906, 29898, 1445, 2084, 29892, 4572, 29918, 4537, 1125, 13, 1678, 9995, 7460, 4175, 411, 21804, 29871, 29906, 9995, 13, 1678, 10422, 353, 376, 2659, 5072, 17969, 851, 29898, 4572, 29918, 4537, 29897, 718, 11663, 17875, 29941, 29889, 3126, 29908, 13, 1678, 411, 1722, 29898, 9507, 29892, 525, 29878, 742, 8025, 543, 9420, 29947, 613, 4436, 2433, 17281, 1495, 408, 285, 29886, 29901, 13, 4706, 848, 29922, 18091, 29889, 949, 580, 13, 268, 13, 1678, 9657, 29918, 7193, 353, 4390, 29889, 18132, 29898, 1272, 29897, 13, 1678, 9657, 29918, 7827, 29918, 26495, 353, 6571, 13, 1678, 9657, 29918, 7827, 29918, 13424, 353, 6571, 13, 13, 1678, 274, 593, 353, 29871, 29896, 13, 1678, 1596, 29898, 12673, 29889, 12673, 29889, 3707, 2141, 2230, 3101, 13, 1678, 10422, 353, 376, 2659, 5072, 17969, 851, 29898, 4572, 29918, 4537, 29897, 718, 11663, 1123, 7406, 29889, 3126, 29908, 13, 1678, 411, 1722, 29898, 9507, 29892, 8025, 543, 9420, 29947, 613, 4436, 2433, 17281, 1495, 408, 285, 29886, 29901, 13, 4706, 363, 1196, 297, 285, 29886, 29901, 13, 9651, 1051, 29918, 1220, 29922, 1220, 29889, 5451, 703, 8876, 1159, 13, 9651, 1404, 353, 1051, 29918, 1220, 29961, 29900, 1822, 17010, 580, 13, 9651, 565, 1404, 297, 9657, 29918, 7193, 29901, 13, 18884, 565, 1404, 451, 297, 9657, 29918, 7827, 29918, 26495, 29901, 13, 462, 1678, 9657, 29918, 7827, 29918, 26495, 29961, 1792, 29962, 353, 8853, 276, 7406, 1115, 5159, 29913, 13, 18884, 565, 1404, 451, 297, 9657, 29918, 7827, 29918, 13424, 29901, 13, 462, 1678, 9657, 29918, 7827, 29918, 13424, 29961, 1792, 29962, 353, 8853, 276, 7406, 1115, 5159, 29913, 13, 13, 18884, 565, 4036, 29889, 8172, 580, 529, 29871, 29900, 29889, 29945, 29901, 13, 462, 1678, 1734, 29918, 1761, 29918, 26495, 353, 4390, 29889, 18132, 29898, 1761, 29918, 1220, 29961, 29896, 1822, 17010, 3101, 13, 462, 1678, 9657, 29918, 7827, 29918, 26495, 29961, 1792, 29962, 3366, 276, 7406, 16862, 21843, 29898, 1742, 29918, 1761, 29918, 26495, 29897, 13, 18884, 1683, 29901, 13, 462, 1678, 1734, 29918, 1761, 29918, 13424, 353, 4390, 29889, 18132, 29898, 1761, 29918, 1220, 29961, 29896, 1822, 17010, 3101, 13, 462, 1678, 9657, 29918, 7827, 29918, 13424, 29961, 1792, 29962, 3366, 276, 7406, 16862, 4397, 29898, 1742, 29918, 1761, 29918, 13424, 29897, 13, 462, 13, 18884, 396, 8977, 29918, 7827, 29961, 1792, 29962, 3366, 1066, 16862, 21843, 29898, 1066, 29918, 4039, 914, 29898, 1742, 29918, 1761, 876, 13, 632, 13, 9651, 274, 593, 4619, 29871, 29896, 13, 9651, 565, 274, 593, 1273, 29871, 29896, 29900, 29900, 29900, 29900, 29900, 1275, 29871, 29900, 29901, 13, 18884, 1596, 29898, 12673, 29889, 12673, 29889, 3707, 2141, 2230, 3101, 13, 13, 1678, 1051, 29918, 7827, 29918, 26495, 353, 5159, 13, 1678, 363, 1820, 297, 9657, 29918, 7827, 29918, 26495, 29901, 13, 4706, 9657, 17482, 353, 6571, 13, 4706, 9657, 17482, 3366, 1792, 3108, 353, 1820, 13, 4706, 9657, 17482, 3366, 276, 7406, 3108, 353, 9657, 29918, 7827, 29918, 26495, 29961, 1989, 29962, 3366, 276, 7406, 3108, 13, 4706, 1051, 29918, 7827, 29918, 26495, 29889, 4397, 29898, 8977, 17482, 29897, 13, 308, 13, 1678, 9657, 29918, 7827, 29918, 26495, 353, 6571, 13, 13, 1678, 10422, 353, 376, 2659, 5072, 17969, 851, 29898, 4572, 29918, 4537, 29897, 718, 11663, 5323, 2827, 29899, 17875, 29941, 29889, 3126, 29908, 13, 1678, 411, 1722, 29898, 9507, 29892, 525, 29893, 1495, 408, 285, 29886, 29901, 13, 4706, 4390, 29889, 15070, 29898, 1761, 29918, 7827, 29918, 26495, 29892, 285, 29886, 29892, 29871, 29536, 29922, 29946, 29897, 13, 13, 1678, 1051, 29918, 7827, 29918, 26495, 353, 5159, 13, 13, 13, 1678, 1051, 29918, 7827, 29918, 13424, 353, 5159, 13, 1678, 363, 1820, 297, 9657, 29918, 7827, 29918, 13424, 29901, 13, 4706, 9657, 17482, 353, 6571, 13, 4706, 9657, 17482, 3366, 1792, 3108, 353, 1820, 13, 4706, 9657, 17482, 3366, 276, 7406, 3108, 353, 9657, 29918, 7827, 29918, 13424, 29961, 1989, 29962, 3366, 276, 7406, 3108, 13, 4706, 1051, 29918, 7827, 29918, 13424, 29889, 4397, 29898, 8977, 17482, 29897, 13, 13, 1678, 9657, 29918, 7827, 29918, 13424, 353, 6571, 13, 13, 1678, 10422, 353, 376, 2659, 5072, 17969, 851, 29898, 4572, 29918, 4537, 29897, 718, 11663, 3057, 292, 29899, 17875, 29941, 29889, 3126, 29908, 13, 1678, 411, 1722, 29898, 9507, 29892, 525, 29893, 1495, 408, 285, 29886, 29901, 13, 4706, 4390, 29889, 15070, 29898, 1761, 29918, 7827, 29918, 13424, 29892, 285, 29886, 29892, 29871, 29536, 29922, 29946, 29897, 13, 13, 1753, 1404, 29918, 4572, 29898, 1445, 2084, 29892, 4572, 29918, 4537, 1125, 13, 1678, 9995, 7460, 4160, 411, 901, 1135, 448, 4572, 29918, 4537, 29899, 21804, 9995, 13, 1678, 411, 1722, 29898, 1445, 2084, 29892, 525, 29878, 742, 8025, 543, 9420, 29947, 613, 4436, 2433, 17281, 1495, 408, 285, 29886, 29901, 13, 4706, 848, 29922, 18091, 29889, 949, 580, 13, 13, 1678, 9657, 29918, 7193, 353, 4390, 29889, 18132, 29898, 1272, 29897, 13, 1678, 9657, 29918, 7193, 29918, 4572, 353, 9657, 29898, 4572, 29898, 2892, 21268, 29901, 21268, 29961, 29896, 29962, 6736, 4175, 29918, 4537, 1919, 8977, 29918, 7193, 29889, 7076, 22130, 13, 13, 1678, 7431, 29896, 29900, 29886, 353, 4513, 29898, 2435, 29898, 8977, 29918, 7193, 29918, 4572, 11877, 29900, 29889, 29900, 29941, 29897, 13, 268, 13, 1678, 9657, 29918, 7193, 29918, 4572, 29918, 9502, 353, 9657, 29898, 8172, 29889, 11249, 29898, 8977, 29918, 7193, 29918, 4572, 29889, 7076, 3285, 7431, 29896, 29900, 29886, 876, 13, 13, 1678, 10422, 353, 376, 2659, 5072, 17969, 851, 29898, 4572, 29918, 4537, 29897, 718, 11663, 17875, 29941, 29889, 3126, 29908, 13, 1678, 411, 1722, 29898, 9507, 29892, 525, 29893, 1495, 408, 285, 29886, 29901, 13, 4706, 4390, 29889, 15070, 29898, 8977, 29918, 7193, 29918, 4572, 29918, 9502, 29892, 285, 29886, 29892, 29871, 29536, 29922, 29946, 29897, 13, 13, 1753, 1404, 29918, 2798, 29898, 1445, 2084, 1125, 13, 1678, 9995, 3917, 278, 1353, 310, 21804, 639, 1404, 15945, 29908, 13, 1678, 19548, 29918, 974, 29918, 7193, 353, 6571, 13, 1678, 411, 1722, 29898, 1445, 2084, 29892, 8025, 543, 9420, 29947, 613, 4436, 2433, 17281, 1495, 408, 285, 29886, 29901, 13, 4706, 274, 593, 353, 29871, 29900, 13, 4706, 363, 1196, 297, 285, 29886, 29901, 13, 9651, 565, 376, 27828, 29914, 29721, 29908, 297, 1196, 29901, 13, 18884, 1303, 1792, 353, 1196, 29889, 6506, 877, 27828, 29914, 29721, 29901, 742, 525, 2824, 17010, 580, 13, 18884, 2407, 29918, 1792, 29918, 20047, 29898, 949, 1792, 29892, 19548, 29918, 974, 29918, 7193, 29897, 13, 18884, 274, 593, 4619, 29871, 29896, 13, 462, 13, 9651, 565, 274, 593, 1275, 29871, 29896, 29900, 29900, 29900, 29900, 29900, 29901, 13, 18884, 1596, 703, 1220, 6571, 1642, 4830, 29898, 1220, 876, 13, 18884, 274, 593, 353, 29871, 29896, 13, 18884, 396, 8690, 13, 1678, 12705, 29918, 7193, 353, 1797, 29918, 23156, 29918, 974, 29918, 7193, 29898, 23156, 29918, 974, 29918, 7193, 29892, 5153, 29922, 5574, 29897, 13, 268, 13, 1678, 411, 1722, 877, 1792, 1123, 1493, 3981, 29889, 3126, 742, 525, 29893, 1495, 408, 285, 29886, 29901, 13, 4706, 4390, 29889, 15070, 29898, 24582, 29918, 7193, 29892, 285, 29886, 29892, 29871, 29536, 29922, 29946, 29897, 13, 13, 13, 1753, 1797, 29918, 23156, 29918, 974, 29918, 7193, 29898, 23156, 29918, 974, 29918, 7193, 29892, 5153, 29922, 8824, 1125, 13, 1678, 9995, 7514, 491, 1353, 310, 21804, 15945, 29908, 13, 1678, 4160, 353, 17288, 1792, 29892, 274, 593, 29897, 363, 1404, 29892, 274, 593, 297, 19548, 29918, 974, 29918, 7193, 29889, 7076, 580, 29962, 13, 1678, 4160, 29918, 6605, 353, 12705, 29898, 7193, 29892, 1820, 29922, 2892, 921, 29901, 921, 29961, 29896, 1402, 11837, 29922, 14273, 29897, 13, 1678, 1596, 703, 2659, 411, 901, 21804, 6571, 1642, 4830, 29898, 7193, 29918, 6605, 7503, 29896, 29900, 12622, 13, 1678, 736, 9657, 29898, 7193, 29918, 6605, 29897, 13, 13, 13, 1753, 2407, 29918, 1792, 29918, 20047, 29898, 1792, 29892, 19548, 29918, 974, 29918, 7193, 1125, 13, 1678, 9995, 9182, 278, 21804, 2302, 9995, 13, 1678, 565, 1404, 2804, 525, 2396, 13, 4706, 565, 1404, 297, 19548, 29918, 974, 29918, 7193, 29901, 13, 9651, 19548, 29918, 974, 29918, 7193, 29961, 1792, 29962, 4619, 29871, 29896, 13, 4706, 1683, 29901, 13, 9651, 19548, 29918, 974, 29918, 7193, 29961, 1792, 29962, 353, 29871, 29896, 13, 13, 1753, 5941, 1420, 29898, 1610, 29918, 1420, 1125, 13, 1678, 9995, 12498, 4544, 917, 15945, 29908, 13, 1678, 5941, 29878, 353, 337, 29889, 12198, 877, 29966, 5575, 17382, 1495, 13, 1678, 5941, 726, 353, 337, 29889, 1491, 29898, 14941, 29878, 29892, 15516, 10650, 29918, 1420, 29897, 13, 1678, 736, 5941, 726, 13, 13, 1753, 926, 29918, 4039, 914, 29898, 29879, 1125, 13, 1678, 9995, 24815, 15945, 29908, 13, 1678, 736, 518, 29875, 29961, 29896, 29962, 363, 474, 297, 302, 1896, 29895, 29889, 1066, 29918, 4039, 29898, 29879, 4638, 13, 13, 1753, 5993, 675, 29898, 29879, 1125, 13, 1678, 9995, 6066, 3950, 15945, 29908, 13, 1678, 269, 353, 269, 29889, 13609, 580, 13, 1678, 5993, 353, 323, 16668, 6066, 3950, 580, 13, 1678, 736, 5993, 29889, 6979, 675, 29898, 29879, 29897, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 1667, 580, 2 ]
twenty47/__init__.py
gary-dalton/Twenty47
0
77220
<reponame>gary-dalton/Twenty47 from flask import Flask, flash from flask.ext.mongoengine import MongoEngine from flask_wtf.csrf import CsrfProtect from flask_mail import Mail import blinker app = Flask(__name__) #app.config.from_object(__name__) # Load the config app.config.from_pyfile('local.config.py') #app.config.from_envvar('config', silent=True) db = MongoEngine(app) mail = Mail(app) csrf = CsrfProtect() csrf.init_app(app) """ Register my signals """ twenty47_signals = blinker.Namespace() subscription_updated = twenty47_signals.signal("subscription-updated") subscription_pending = twenty47_signals.signal("subscription-pending") sns_error = twenty47_signals.signal("sns-error") dispatch_created = twenty47_signals.signal("dispatch-created") if app.config['DEBUG']: def debug(*args): pass #debug = flash else: def debug(*args): pass def register_blueprints(app): # Prevents circular imports from twenty47.views import dispatch app.register_blueprint(dispatch) from twenty47.admin import admin app.register_blueprint(admin) from twenty47.admin_dispatch import admin_dispatch app.register_blueprint(admin_dispatch) from twenty47.subscriber import subscriber app.register_blueprint(subscriber) def subscribe_to_signals(app): import signals register_blueprints(app) subscribe_to_signals(app) if __name__ == '__main__': app.run()
[ 1, 529, 276, 1112, 420, 29958, 29887, 653, 29899, 12293, 880, 29914, 27418, 6478, 29946, 29955, 13, 3166, 29784, 1053, 2379, 1278, 29892, 11013, 13, 3166, 29784, 29889, 1062, 29889, 29885, 7443, 10599, 1053, 18294, 12412, 13, 3166, 29784, 29918, 29893, 13264, 29889, 2395, 9600, 1053, 24277, 9600, 1184, 371, 312, 13, 3166, 29784, 29918, 2549, 1053, 18623, 13, 5215, 1999, 682, 261, 13, 13, 932, 353, 2379, 1278, 22168, 978, 1649, 29897, 13, 29937, 932, 29889, 2917, 29889, 3166, 29918, 3318, 22168, 978, 1649, 29897, 13, 13, 29937, 16012, 278, 2295, 13, 932, 29889, 2917, 29889, 3166, 29918, 2272, 1445, 877, 2997, 29889, 2917, 29889, 2272, 1495, 13, 29937, 932, 29889, 2917, 29889, 3166, 29918, 6272, 1707, 877, 2917, 742, 17436, 29922, 5574, 29897, 13, 13, 2585, 353, 18294, 12412, 29898, 932, 29897, 13, 2549, 353, 18623, 29898, 932, 29897, 13, 2395, 9600, 353, 24277, 9600, 1184, 371, 312, 580, 13, 2395, 9600, 29889, 2344, 29918, 932, 29898, 932, 29897, 13, 13, 15945, 29908, 13, 15213, 590, 18470, 13, 15945, 29908, 13, 7516, 6478, 29946, 29955, 29918, 4530, 1338, 353, 1999, 682, 261, 29889, 23335, 580, 13, 1491, 22371, 29918, 21402, 353, 10081, 29946, 29955, 29918, 4530, 1338, 29889, 25436, 703, 1491, 22371, 29899, 21402, 1159, 13, 1491, 22371, 29918, 29886, 2548, 353, 10081, 29946, 29955, 29918, 4530, 1338, 29889, 25436, 703, 1491, 22371, 29899, 29886, 2548, 1159, 13, 29879, 1983, 29918, 2704, 353, 10081, 29946, 29955, 29918, 4530, 1338, 29889, 25436, 703, 29879, 1983, 29899, 2704, 1159, 13, 13369, 29918, 11600, 353, 10081, 29946, 29955, 29918, 4530, 1338, 29889, 25436, 703, 13369, 29899, 11600, 1159, 13, 13, 13, 361, 623, 29889, 2917, 1839, 18525, 2033, 29901, 13, 1678, 822, 4744, 10456, 5085, 1125, 13, 4706, 1209, 13, 1678, 396, 8382, 353, 11013, 13, 2870, 29901, 13, 1678, 822, 4744, 10456, 5085, 1125, 13, 4706, 1209, 13, 13, 1753, 6036, 29918, 9539, 2158, 29879, 29898, 932, 1125, 13, 1678, 396, 4721, 794, 29879, 19308, 24802, 13, 1678, 515, 10081, 29946, 29955, 29889, 7406, 1053, 13916, 13, 1678, 623, 29889, 9573, 29918, 9539, 2158, 29898, 13369, 29897, 13, 1678, 515, 10081, 29946, 29955, 29889, 6406, 1053, 4113, 13, 1678, 623, 29889, 9573, 29918, 9539, 2158, 29898, 6406, 29897, 13, 1678, 515, 10081, 29946, 29955, 29889, 6406, 29918, 13369, 1053, 4113, 29918, 13369, 13, 1678, 623, 29889, 9573, 29918, 9539, 2158, 29898, 6406, 29918, 13369, 29897, 13, 1678, 515, 10081, 29946, 29955, 29889, 1491, 7588, 495, 1053, 21696, 495, 13, 1678, 623, 29889, 9573, 29918, 9539, 2158, 29898, 1491, 7588, 495, 29897, 13, 268, 13, 1753, 1014, 13086, 29918, 517, 29918, 4530, 1338, 29898, 932, 1125, 13, 1678, 1053, 18470, 13, 268, 13, 268, 13, 9573, 29918, 9539, 2158, 29879, 29898, 932, 29897, 13, 19496, 29918, 517, 29918, 4530, 1338, 29898, 932, 29897, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 623, 29889, 3389, 580, 13, 2 ]
similarityworkbench/bin/mcs/Cmcs.py
gitanna/chemminetools
2
98957
#!/usr/bin/python # -*- coding: utf-8 -*- # This file was automatically generated by SWIG (http://www.swig.org). # Version 1.3.35 # # Don't modify this file, modify the SWIG interface instead. # This file is compatible with both classic and new-style classes. import _Cmcs import new new_instancemethod = new.instancemethod try: _swig_property = property except NameError: pass # Python < 2.2 doesn't have 'property'. def _swig_setattr_nondynamic( self, class_type, name, value, static=1, ): if name == 'thisown': return self.this.own(value) if name == 'this': if type(value).__name__ == 'PySwigObject': self.__dict__[name] = value return method = class_type.__swig_setmethods__.get(name, None) if method: return method(self, value) if not static or hasattr(self, name): self.__dict__[name] = value else: raise AttributeError('You cannot add attributes to %s' % self) def _swig_setattr( self, class_type, name, value, ): return _swig_setattr_nondynamic(self, class_type, name, value, 0) def _swig_getattr(self, class_type, name): if name == 'thisown': return self.this.own() method = class_type.__swig_getmethods__.get(name, None) if method: return method(self) raise AttributeError, name def _swig_repr(self): try: strthis = 'proxy of ' + self.this.__repr__() except: strthis = '' return '<%s.%s; %s >' % (self.__class__.__module__, self.__class__.__name__, strthis) import types try: _object = types.ObjectType _newclass = 1 except AttributeError: class _object: pass _newclass = 0 del types max = _Cmcs.max read_graph = _Cmcs.read_graph parse_sdf = _Cmcs.parse_sdf get_best = _Cmcs.get_best is_null = _Cmcs.is_null set_timeout = _Cmcs.set_timeout
[ 1, 18787, 4855, 29914, 2109, 29914, 4691, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 13, 29937, 910, 934, 471, 6336, 5759, 491, 25289, 6259, 313, 1124, 597, 1636, 29889, 2774, 335, 29889, 990, 467, 13, 29937, 10079, 29871, 29896, 29889, 29941, 29889, 29941, 29945, 13, 29937, 13, 29937, 3872, 29915, 29873, 6623, 445, 934, 29892, 6623, 278, 25289, 6259, 5067, 2012, 29889, 13, 29937, 910, 934, 338, 15878, 411, 1716, 22037, 322, 716, 29899, 3293, 4413, 29889, 13, 13, 5215, 903, 29907, 29885, 2395, 13, 5215, 716, 13, 1482, 29918, 2611, 4564, 331, 959, 353, 716, 29889, 2611, 4564, 331, 959, 13, 2202, 29901, 13, 1678, 903, 2774, 335, 29918, 6799, 353, 2875, 13, 19499, 4408, 2392, 29901, 13, 1678, 1209, 29871, 396, 5132, 529, 29871, 29906, 29889, 29906, 1838, 29915, 29873, 505, 525, 6799, 4286, 13, 13, 13, 1753, 903, 2774, 335, 29918, 842, 5552, 29918, 29876, 898, 8739, 29898, 13, 1678, 1583, 29892, 13, 1678, 770, 29918, 1853, 29892, 13, 1678, 1024, 29892, 13, 1678, 995, 29892, 13, 1678, 2294, 29922, 29896, 29892, 13, 268, 1125, 13, 13, 1678, 565, 1024, 1275, 525, 1366, 776, 2396, 13, 4706, 736, 1583, 29889, 1366, 29889, 776, 29898, 1767, 29897, 13, 1678, 565, 1024, 1275, 525, 1366, 2396, 13, 4706, 565, 1134, 29898, 1767, 467, 1649, 978, 1649, 1275, 525, 19737, 29903, 9192, 2061, 2396, 13, 9651, 1583, 17255, 8977, 1649, 29961, 978, 29962, 353, 995, 13, 9651, 736, 13, 1678, 1158, 353, 770, 29918, 1853, 17255, 2774, 335, 29918, 842, 23515, 26914, 657, 29898, 978, 29892, 6213, 29897, 13, 1678, 565, 1158, 29901, 13, 4706, 736, 1158, 29898, 1311, 29892, 995, 29897, 13, 1678, 565, 451, 2294, 470, 756, 5552, 29898, 1311, 29892, 1024, 1125, 13, 4706, 1583, 17255, 8977, 1649, 29961, 978, 29962, 353, 995, 13, 1678, 1683, 29901, 13, 4706, 12020, 23833, 2392, 877, 3492, 2609, 788, 8393, 304, 1273, 29879, 29915, 1273, 1583, 29897, 13, 13, 13, 1753, 903, 2774, 335, 29918, 842, 5552, 29898, 13, 1678, 1583, 29892, 13, 1678, 770, 29918, 1853, 29892, 13, 1678, 1024, 29892, 13, 1678, 995, 29892, 13, 268, 1125, 13, 13, 1678, 736, 903, 2774, 335, 29918, 842, 5552, 29918, 29876, 898, 8739, 29898, 1311, 29892, 770, 29918, 1853, 29892, 1024, 29892, 995, 29892, 29871, 29900, 29897, 13, 13, 13, 1753, 903, 2774, 335, 29918, 657, 5552, 29898, 1311, 29892, 770, 29918, 1853, 29892, 1024, 1125, 13, 1678, 565, 1024, 1275, 525, 1366, 776, 2396, 13, 4706, 736, 1583, 29889, 1366, 29889, 776, 580, 13, 1678, 1158, 353, 770, 29918, 1853, 17255, 2774, 335, 29918, 657, 23515, 26914, 657, 29898, 978, 29892, 6213, 29897, 13, 1678, 565, 1158, 29901, 13, 4706, 736, 1158, 29898, 1311, 29897, 13, 1678, 12020, 23833, 2392, 29892, 1024, 13, 13, 13, 1753, 903, 2774, 335, 29918, 276, 558, 29898, 1311, 1125, 13, 1678, 1018, 29901, 13, 4706, 851, 1366, 353, 525, 14701, 310, 525, 718, 1583, 29889, 1366, 17255, 276, 558, 1649, 580, 13, 1678, 5174, 29901, 13, 4706, 851, 1366, 353, 6629, 13, 1678, 736, 12801, 29995, 29879, 29889, 29995, 29879, 29936, 1273, 29879, 1405, 29915, 1273, 313, 1311, 17255, 1990, 1649, 17255, 5453, 1649, 29892, 13, 462, 632, 1583, 17255, 1990, 1649, 17255, 978, 1649, 29892, 851, 1366, 29897, 13, 13, 13, 5215, 4072, 13, 2202, 29901, 13, 1678, 903, 3318, 353, 4072, 29889, 2061, 1542, 13, 1678, 903, 1482, 1990, 353, 29871, 29896, 13, 19499, 23833, 2392, 29901, 13, 13, 13, 1678, 770, 903, 3318, 29901, 13, 13, 4706, 1209, 13, 13, 13, 1678, 903, 1482, 1990, 353, 29871, 29900, 13, 6144, 4072, 13, 13, 3317, 353, 903, 29907, 29885, 2395, 29889, 3317, 13, 949, 29918, 4262, 353, 903, 29907, 29885, 2395, 29889, 949, 29918, 4262, 13, 5510, 29918, 29879, 2176, 353, 903, 29907, 29885, 2395, 29889, 5510, 29918, 29879, 2176, 13, 657, 29918, 13318, 353, 903, 29907, 29885, 2395, 29889, 657, 29918, 13318, 13, 275, 29918, 4304, 353, 903, 29907, 29885, 2395, 29889, 275, 29918, 4304, 13, 842, 29918, 15619, 353, 903, 29907, 29885, 2395, 29889, 842, 29918, 15619, 13, 13, 2 ]
alpa/timer.py
TarzanZhao/alpa
0
1609155
"""Global timer for profiling.""" import time from typing import Callable do_sync = True class _Timer: """An internal timer.""" def __init__(self, name: str): self.name = name self.started = False self.start_time = None self.costs = [] # Loop timer self.ever_suspended = False self.accum_cost = 0.0 def start(self, sync_func: Callable = None): """Start the timer.""" assert not self.started, "timer has already been started" if sync_func and do_sync: sync_func() self.start_time = time.time() self.started = True def suspend(self, sync_func: Callable = None): """Suspend the timer in a loop.""" assert self.started self.ever_suspended = True # we accumulate on the accum_cost if sync_func and do_sync: sync_func() self.accum_cost += time.time() - self.start_time self.started = False def stop(self, sync_func: Callable = None): """Stop the timer.""" if self.ever_suspended: assert not self.started, ( f"Stop the timer {self.name} before suspending it.") else: assert self.started, ( f"timer {self.name} is not started nor ever suspended.") if sync_func and do_sync: sync_func() if self.ever_suspended: self.costs.append(self.accum_cost) self.accum_cost = 0.0 else: cost = time.time() - self.start_time self.costs.append(cost) self.started = False def reset(self): """Reset timer.""" self.costs = [] self.accum_cost = 0.0 self.started = False self.ever_suspended = False def elapsed(self, mode: str = "average"): """Calculate the elapsed time.""" if not self.costs: return 0.0 if mode == "average": return sum(self.costs) / len(self.costs) elif mode == "sum": return sum(self.costs) else: raise RuntimeError("Supported mode is: average | sum") def log(self, mode: str = "average", normalizer: float = 1.0): """Log a timer's cost in different modes.""" assert normalizer > 0.0 string = "time (ms)" elapsed = self.elapsed(mode) * 1000.0 / normalizer string += f" | {self.name}: {elapsed:.2f}" print(string, flush=True) class Timers: """A group of timers.""" def __init__(self): self.timers = {} def __call__(self, name: str): if name not in self.timers: self.timers[name] = _Timer(name) return self.timers[name] def __contains__(self, name: str): return name in self.timers def log(self, names: str, normalizer: float = 1.0): """Log a group of timers.""" assert normalizer > 0.0 string = "time (ms)" for name in names: elapsed_time = self.timers[name].elapsed() * 1000.0 / normalizer string += f" | {name}: {elapsed_time:.2f}" print(string, flush=True) timers = Timers()
[ 1, 9995, 12756, 12237, 363, 20077, 292, 1213, 15945, 13, 5215, 931, 13, 3166, 19229, 1053, 8251, 519, 13, 13, 1867, 29918, 16593, 353, 5852, 13, 13, 13, 1990, 903, 14745, 29901, 13, 1678, 9995, 2744, 7463, 12237, 1213, 15945, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1024, 29901, 851, 1125, 13, 4706, 1583, 29889, 978, 353, 1024, 13, 4706, 1583, 29889, 2962, 287, 353, 7700, 13, 4706, 1583, 29889, 2962, 29918, 2230, 353, 6213, 13, 4706, 1583, 29889, 18253, 29879, 353, 5159, 13, 13, 4706, 396, 21493, 12237, 13, 4706, 1583, 29889, 1310, 29918, 29879, 375, 29886, 2760, 353, 7700, 13, 4706, 1583, 29889, 5753, 398, 29918, 18253, 353, 29871, 29900, 29889, 29900, 13, 13, 1678, 822, 1369, 29898, 1311, 29892, 16523, 29918, 9891, 29901, 8251, 519, 353, 6213, 1125, 13, 4706, 9995, 4763, 278, 12237, 1213, 15945, 13, 4706, 4974, 451, 1583, 29889, 2962, 287, 29892, 376, 20404, 756, 2307, 1063, 4687, 29908, 13, 4706, 565, 16523, 29918, 9891, 322, 437, 29918, 16593, 29901, 13, 9651, 16523, 29918, 9891, 580, 13, 4706, 1583, 29889, 2962, 29918, 2230, 353, 931, 29889, 2230, 580, 13, 4706, 1583, 29889, 2962, 287, 353, 5852, 13, 13, 1678, 822, 8872, 355, 29898, 1311, 29892, 16523, 29918, 9891, 29901, 8251, 519, 353, 6213, 1125, 13, 4706, 9995, 29903, 375, 14081, 278, 12237, 297, 263, 2425, 1213, 15945, 13, 4706, 4974, 1583, 29889, 2962, 287, 13, 4706, 1583, 29889, 1310, 29918, 29879, 375, 29886, 2760, 353, 5852, 13, 13, 4706, 396, 591, 18414, 5987, 373, 278, 18414, 29918, 18253, 13, 4706, 565, 16523, 29918, 9891, 322, 437, 29918, 16593, 29901, 13, 9651, 16523, 29918, 9891, 580, 13, 4706, 1583, 29889, 5753, 398, 29918, 18253, 4619, 931, 29889, 2230, 580, 448, 1583, 29889, 2962, 29918, 2230, 13, 4706, 1583, 29889, 2962, 287, 353, 7700, 13, 13, 1678, 822, 5040, 29898, 1311, 29892, 16523, 29918, 9891, 29901, 8251, 519, 353, 6213, 1125, 13, 4706, 9995, 16329, 278, 12237, 1213, 15945, 13, 4706, 565, 1583, 29889, 1310, 29918, 29879, 375, 29886, 2760, 29901, 13, 9651, 4974, 451, 1583, 29889, 2962, 287, 29892, 313, 13, 18884, 285, 29908, 16329, 278, 12237, 426, 1311, 29889, 978, 29913, 1434, 8872, 2548, 372, 23157, 13, 4706, 1683, 29901, 13, 9651, 4974, 1583, 29889, 2962, 287, 29892, 313, 13, 18884, 285, 29908, 20404, 426, 1311, 29889, 978, 29913, 338, 451, 4687, 3643, 3926, 8872, 2760, 23157, 13, 4706, 565, 16523, 29918, 9891, 322, 437, 29918, 16593, 29901, 13, 9651, 16523, 29918, 9891, 580, 13, 4706, 565, 1583, 29889, 1310, 29918, 29879, 375, 29886, 2760, 29901, 13, 9651, 1583, 29889, 18253, 29879, 29889, 4397, 29898, 1311, 29889, 5753, 398, 29918, 18253, 29897, 13, 9651, 1583, 29889, 5753, 398, 29918, 18253, 353, 29871, 29900, 29889, 29900, 13, 4706, 1683, 29901, 13, 9651, 3438, 353, 931, 29889, 2230, 580, 448, 1583, 29889, 2962, 29918, 2230, 13, 9651, 1583, 29889, 18253, 29879, 29889, 4397, 29898, 18253, 29897, 13, 4706, 1583, 29889, 2962, 287, 353, 7700, 13, 13, 1678, 822, 10092, 29898, 1311, 1125, 13, 4706, 9995, 27175, 12237, 1213, 15945, 13, 4706, 1583, 29889, 18253, 29879, 353, 5159, 13, 4706, 1583, 29889, 5753, 398, 29918, 18253, 353, 29871, 29900, 29889, 29900, 13, 4706, 1583, 29889, 2962, 287, 353, 7700, 13, 4706, 1583, 29889, 1310, 29918, 29879, 375, 29886, 2760, 353, 7700, 13, 13, 1678, 822, 560, 28170, 29898, 1311, 29892, 4464, 29901, 851, 353, 376, 12483, 482, 29908, 1125, 13, 4706, 9995, 27065, 403, 278, 560, 28170, 931, 1213, 15945, 13, 4706, 565, 451, 1583, 29889, 18253, 29879, 29901, 13, 9651, 736, 29871, 29900, 29889, 29900, 13, 4706, 565, 4464, 1275, 376, 12483, 482, 1115, 13, 9651, 736, 2533, 29898, 1311, 29889, 18253, 29879, 29897, 847, 7431, 29898, 1311, 29889, 18253, 29879, 29897, 13, 4706, 25342, 4464, 1275, 376, 2083, 1115, 13, 9651, 736, 2533, 29898, 1311, 29889, 18253, 29879, 29897, 13, 4706, 1683, 29901, 13, 9651, 12020, 24875, 2392, 703, 14039, 287, 4464, 338, 29901, 6588, 891, 2533, 1159, 13, 13, 1678, 822, 1480, 29898, 1311, 29892, 4464, 29901, 851, 353, 376, 12483, 482, 613, 4226, 3950, 29901, 5785, 353, 29871, 29896, 29889, 29900, 1125, 13, 4706, 9995, 3403, 263, 12237, 29915, 29879, 3438, 297, 1422, 18893, 1213, 15945, 13, 4706, 4974, 4226, 3950, 1405, 29871, 29900, 29889, 29900, 13, 4706, 1347, 353, 376, 2230, 313, 1516, 5513, 13, 13, 4706, 560, 28170, 353, 1583, 29889, 295, 28170, 29898, 8513, 29897, 334, 29871, 29896, 29900, 29900, 29900, 29889, 29900, 847, 4226, 3950, 13, 4706, 1347, 4619, 285, 29908, 891, 426, 1311, 29889, 978, 6177, 426, 295, 28170, 29901, 29889, 29906, 29888, 5038, 13, 4706, 1596, 29898, 1807, 29892, 28371, 29922, 5574, 29897, 13, 13, 13, 1990, 7870, 414, 29901, 13, 1678, 9995, 29909, 2318, 310, 5335, 414, 1213, 15945, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 1583, 29889, 9346, 414, 353, 6571, 13, 13, 1678, 822, 4770, 4804, 12035, 1311, 29892, 1024, 29901, 851, 1125, 13, 4706, 565, 1024, 451, 297, 1583, 29889, 9346, 414, 29901, 13, 9651, 1583, 29889, 9346, 414, 29961, 978, 29962, 353, 903, 14745, 29898, 978, 29897, 13, 4706, 736, 1583, 29889, 9346, 414, 29961, 978, 29962, 13, 13, 1678, 822, 4770, 11516, 12035, 1311, 29892, 1024, 29901, 851, 1125, 13, 4706, 736, 1024, 297, 1583, 29889, 9346, 414, 13, 13, 1678, 822, 1480, 29898, 1311, 29892, 2983, 29901, 851, 29892, 4226, 3950, 29901, 5785, 353, 29871, 29896, 29889, 29900, 1125, 13, 4706, 9995, 3403, 263, 2318, 310, 5335, 414, 1213, 15945, 13, 4706, 4974, 4226, 3950, 1405, 29871, 29900, 29889, 29900, 13, 4706, 1347, 353, 376, 2230, 313, 1516, 5513, 13, 4706, 363, 1024, 297, 2983, 29901, 13, 9651, 560, 28170, 29918, 2230, 353, 1583, 29889, 9346, 414, 29961, 978, 1822, 295, 28170, 580, 334, 29871, 29896, 29900, 29900, 29900, 29889, 29900, 847, 4226, 3950, 13, 9651, 1347, 4619, 285, 29908, 891, 426, 978, 6177, 426, 295, 28170, 29918, 2230, 29901, 29889, 29906, 29888, 5038, 13, 4706, 1596, 29898, 1807, 29892, 28371, 29922, 5574, 29897, 13, 13, 13, 9346, 414, 353, 7870, 414, 580, 13, 2 ]
AcimdesTrainingServer.py
IvanDerdicDer/Acimdes
0
97326
import random from typing import List import NeuralNetwork as nn import os import multiprocessing as mp import threading as thrd import pickle import time class Cards: def __init__(self): self.cards = [] for _ in range(4): temp = random.sample(range(8), 8) for j in temp: self.cards.append(j) def lastcard(self): last = self.cards[-1] self.cards.pop() return last class Player: def __init__(self, username, nn: nn.NeuralNetwork): self.username = username self.cardsInHand = [] self.takenCards = [0]*8 self.score = 0 self.isLast = False self.isFirst = False self.takesTheHand = False self.playingNetwork = nn def __str__(self): return self.username def __eq__(self, other): if isinstance(other, str): return self.username == other if isinstance(other, Player): return self.username == other.username return False def throwcard(self, n): card = self.cardsInHand[n] self.cardsInHand.pop(n) return card class Game: def __init__(self, players: List[Player]): self.cardsRoman = ['VII', 'VIII', 'IX', 'X', 'D', 'B', 'K', 'A'] self.allowedInput: List[str] = ['0', '1', '2', '3', 'end'] self.players: List[Player] = players self.players[random.randint(0, 3)].isFirst = True self.cards: Cards = Cards() self.dealCards(self.cards, self.players) @staticmethod def generateInputList(cardsInHand: list[int], hand: list[int], takenCards: list[int], scoreUs: int, scoreThem: int): inputList = cardsInHand.copy() while len(inputList) < 4: inputList.append(-1) inputList += hand while len(inputList) < 19: inputList.append(-1) inputList += takenCards + [scoreUs, scoreThem] return inputList @staticmethod def draw(cards, players): for i in players: i.cardsInHand.append(cards.lastcard()) @staticmethod def dealCards(cards, players): for _ in range(2): for j in range(4): players[j].cardsInHand.append(cards.lastcard()) players[j].cardsInHand.append(cards.lastcard()) @staticmethod def sortPlayers(players: List[Player]): for _ in range(4): if players[0].isFirst: break else: temp_p = players[0] players.pop(0) players.append(temp_p) def canPlayerContinue(self, cardToBeat, first, i): if (cardToBeat not in self.players[0].cardsInHand and not first and i == self.players[0] and 0 not in self.players[0].cardsInHand): return True return False def printHand(self, hand, first): handOut = '| ' if not first: print("Bačene karte: ") for n in hand: handOut += self.cardsRoman[n] + ' | ' print(handOut) def printPlayer(self, i): cardsInHandOut = '| ' print(i.__str__()) for n in i.cardsInHand: cardsInHandOut += self.cardsRoman[n] + ' | ' print("Ruka: " + cardsInHandOut) return i.playingNetwork.runNetwork() def printOrder(self): print("Redoslijed igre: ") for i in self.players: print(f"\t- {i}") @staticmethod def cardTakesTheHand(thrownCard, cardToBeat, i, players): if thrownCard == cardToBeat or thrownCard == 0: for j in players: j.takesTheHand = False j.isFirst = False i.takesTheHand = True i.isFirst = True @staticmethod def pointSum(hand, players): sumPoints = 0 for i in hand: if i == 3 or i == 7: sumPoints += 10 for i in players: if i.takesTheHand: i.score += sumPoints players[players.index(i)-2].score += sumPoints for j in hand: i.takenCards[j] += 1 players[players.index(i) - 2].takenCards[j] += 1 break def pointReset(self): for i in self.players: i.score = 0 def contDeal(self, firstPlayer): if len(self.cards.cards) != 0: for i in range(min(4-len(firstPlayer.cardsInHand), int(len(self.cards.cards)/4))): self.draw(self.cards, self.players) def checkCardInput(self, cardToThrow, cardToBeat, first, a, i, firstPlayer): if cardToThrow not in self.allowedInput: #print(f"Nedozvoljeni ulaz.") return False if cardToThrow == 'end': if i != firstPlayer or first: #print("Trenutno nije moguće završiti rundu!") return False return True if int(cardToThrow) > (3-a): #print(f"Odabrana karta nije unutar raspona.") return False try: if i.cardsInHand[int(cardToThrow)] != cardToBeat and i.cardsInHand[int(cardToThrow)] != 0 and not first and i == firstPlayer: #print(f"Odabrana karta nije ispravna.") return False except: return False return True @property def handplay(self): hand = [] killCommand = False breakHand = False first = True cardToBeat = None i: Player for i in self.players: i.cardsInHand.sort() # Sortiranje igrača self.sortPlayers(self.players) firstPlayer = self.players[0] # Početak ruke if len(firstPlayer.cardsInHand) != 0: # self.printOrder() # Krugovi for a in range(4): if len(self.cards.cards)%2: killCommand = True break # Igrači for i in self.players: # Provjera može li prvi igrač nastaviti ruku breakHand = self.canPlayerContinue(cardToBeat, first, i) if breakHand: # self.printHand(hand, first) break # self.printHand(hand, first) #print(self.generateInputList(i.cardsInHand, hand, i.takenCards, i.score, self.players[self.players.index(i)-1].score)) cardToThrowList = i.playingNetwork.runNetwork(self.generateInputList(i.cardsInHand, hand, i.takenCards, i.score, self.players[self.players.index(i)-1].score)) cardToThrow = cardToThrowList.index(max(cardToThrowList)) if cardToThrow == 4: cardToThrow = "end" # print(f"{os.getpid()} {cardToThrow}") # Provjera da li je ulaz dobar if not self.checkCardInput(str(cardToThrow), cardToBeat, first, a, i, firstPlayer): breakHand = True killCommand = True break if cardToThrow == 'end': breakHand = True break # Postavlja kartu za uzimanje thrownCard = i.throwcard(int(cardToThrow)) if first: cardToBeat = thrownCard first = False print(f"{os.getpid()} {i.username} {thrownCard}") # Provjerava da li bačena karta uzima ruku self.cardTakesTheHand(thrownCard, cardToBeat, i, self.players) # Bačene karte hand.append(thrownCard) if breakHand: print("Runda je završila.") break # Zbrajanje bodova self.pointSum(hand, self.players) # Dijeljenje karata self.contDeal(firstPlayer) if killCommand: print(f"Remainig cards: {self.cards.cards}") return True if not breakHand: print("Runda je završila.") pass return False else: print(f"Remainig cards: {self.cards.cards}") return True def playgame(self): self.pointReset() # print("[STARTING]Starting game.") # print(f"Timovi: \n\t-{self.players[0]} i {self.players[2]}\n\t-{self.players[1]} i {self.players[3]}") timeStart = time.time() while not self.handplay: pass f = open("generationResults.txt", "ab") save = [] if self.players[0].score > self.players[1].score: save.append(self.players[0].playingNetwork.neuralNetwork) save.append(self.players[2].playingNetwork.neuralNetwork) save.append(self.players[0].score + 1 + time.time() - timeStart - len(self.cards.cards)) elif self.players[0].score < self.players[1].score: save.append(self.players[1].playingNetwork.neuralNetwork) save.append(self.players[3].playingNetwork.neuralNetwork) save.append(self.players[1].score + 1 + time.time() - timeStart - len(self.cards.cards)) else: if self.players[0].takesTheHand + self.players[2].takesTheHand: save.append(self.players[0].playingNetwork.neuralNetwork) save.append(self.players[2].playingNetwork.neuralNetwork) save.append(self.players[0].score + 1 + time.time() - timeStart - len(self.cards.cards)) else: save.append(self.players[1].playingNetwork.neuralNetwork) save.append(self.players[3].playingNetwork.neuralNetwork) save.append(self.players[1].score + 1 + time.time() - timeStart - len(self.cards.cards)) pickle.dump(save, f) f.close() def runGame(x: Game): x.playgame() if __name__ == "__main__": # random.seed(2) trainingTimeStart = time.time() print(f"Generation: 0") genTimeStart = time.time() numberOfGames = 25 numberOfPlayers = numberOfGames * 4 botPlayers = [Player("bot" + str(i), nn.NeuralNetwork()) for i in range(numberOfPlayers)] for i in range(numberOfPlayers): botPlayers[i].playingNetwork.addInputLayer(29) botPlayers[i].playingNetwork.addLayer(15) botPlayers[i].playingNetwork.addLayer(15) botPlayers[i].playingNetwork.addLayer(5) numberOfGeneration = 1000 games = [Game([botPlayers.pop() for _ in range(4)]) for _ in range(numberOfGames)] pool = mp.Pool() results = pool.map(runGame, games) print(f"Time of generation 0: {time.time() - genTimeStart}") """processes = [] for i in games: processes.append(mp.Process(target=i.playgame)) processes[-1].start() processes[-1].join()""" """threads = [] for i in games: threads.append(thrd.Thread(target=i.playgame)) threads[-1].start() threads[-1].join()""" for i in range(numberOfGeneration): print(f"Generation: {i + 1}") genTimeStart = time.time() generationResults = [] f = open("generationResults.txt", "rb") for _ in range(numberOfGames): try: generationResults.append(pickle.load(f)) except: pass f.close() f = open("generationResults.txt", "w") f.close() bestInGeneration = generationResults[0] for j in generationResults: if j[2] > bestInGeneration[2]: bestInGeneration = j botPlayers = [Player("bot" + str(j) + "_" + str(i), nn.NeuralNetwork()) for j in range(numberOfPlayers)] for j in range(numberOfPlayers): if j < numberOfPlayers/2: botPlayers[j].playingNetwork.neuralNetwork = bestInGeneration[0] else: botPlayers[j].playingNetwork.neuralNetwork = bestInGeneration[1] random.shuffle(botPlayers) games = [Game([botPlayers.pop() for _ in range(4)]) for _ in range(numberOfGames)] pool = mp.Pool() results = pool.map(runGame, games) print(f"Time of generation {i+1}: {time.time() - genTimeStart}") """threads = [] for j in games: threads.append(thrd.Thread(target=j.playgame)) threads[-1].start() threads[-1].join()""" """processes = [] for j in games: processes.append(mp.Process(target=j.playgame)) processes[-1].start() processes[-1].join()""" print(f"Training time: {time.time() - trainingTimeStart}") generationResults = [] f = open("generationResults.txt", "rb") for _ in range(numberOfGames): generationResults.append(pickle.load(f)) f.close() bestInGeneration = generationResults[0] for j in generationResults: if j[2] > bestInGeneration[2]: bestInGeneration = j f.close() f = open("generationResults.txt", "wb") pickle.dump(bestInGeneration, f) f.close()
[ 1, 1053, 4036, 30004, 13, 3166, 19229, 1053, 2391, 30004, 13, 5215, 2448, 3631, 13724, 408, 302, 29876, 30004, 13, 5215, 2897, 30004, 13, 5215, 6674, 307, 985, 292, 408, 22326, 30004, 13, 5215, 3244, 292, 408, 1468, 29881, 30004, 13, 5215, 5839, 280, 30004, 13, 5215, 931, 30004, 13, 30004, 13, 1990, 315, 3163, 29901, 30004, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 30004, 13, 4706, 1583, 29889, 28160, 353, 5159, 30004, 13, 4706, 363, 903, 297, 3464, 29898, 29946, 1125, 30004, 13, 9651, 5694, 353, 4036, 29889, 11249, 29898, 3881, 29898, 29947, 511, 29871, 29947, 8443, 13, 9651, 363, 432, 297, 5694, 29901, 30004, 13, 18884, 1583, 29889, 28160, 29889, 4397, 29898, 29926, 8443, 13, 30004, 13, 1678, 822, 1833, 7543, 29898, 1311, 1125, 30004, 13, 4706, 1833, 353, 1583, 29889, 28160, 14352, 29896, 29962, 30004, 13, 4706, 1583, 29889, 28160, 29889, 7323, 26471, 13, 4706, 736, 1833, 30004, 13, 30004, 13, 30004, 13, 1990, 14574, 29901, 30004, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 8952, 29892, 302, 29876, 29901, 302, 29876, 29889, 8139, 3631, 13724, 1125, 30004, 13, 4706, 1583, 29889, 6786, 353, 8952, 30004, 13, 4706, 1583, 29889, 28160, 797, 3481, 353, 5159, 30004, 13, 4706, 1583, 29889, 29873, 9424, 29907, 3163, 353, 518, 29900, 14178, 29947, 30004, 13, 4706, 1583, 29889, 13628, 353, 29871, 29900, 30004, 13, 4706, 1583, 29889, 275, 8897, 353, 7700, 30004, 13, 4706, 1583, 29889, 275, 6730, 353, 7700, 30004, 13, 4706, 1583, 29889, 29873, 6926, 1576, 3481, 353, 7700, 30004, 13, 4706, 1583, 29889, 1456, 292, 13724, 353, 302, 29876, 30004, 13, 30004, 13, 1678, 822, 4770, 710, 12035, 1311, 1125, 30004, 13, 4706, 736, 1583, 29889, 6786, 30004, 13, 30004, 13, 1678, 822, 4770, 1837, 12035, 1311, 29892, 916, 1125, 30004, 13, 4706, 565, 338, 8758, 29898, 1228, 29892, 851, 1125, 30004, 13, 9651, 736, 1583, 29889, 6786, 1275, 916, 30004, 13, 30004, 13, 4706, 565, 338, 8758, 29898, 1228, 29892, 14574, 1125, 30004, 13, 9651, 736, 1583, 29889, 6786, 1275, 916, 29889, 6786, 30004, 13, 4706, 736, 7700, 30004, 13, 30004, 13, 1678, 822, 3183, 7543, 29898, 1311, 29892, 302, 1125, 30004, 13, 4706, 5881, 353, 1583, 29889, 28160, 797, 3481, 29961, 29876, 29962, 30004, 13, 4706, 1583, 29889, 28160, 797, 3481, 29889, 7323, 29898, 29876, 8443, 13, 4706, 736, 5881, 30004, 13, 30004, 13, 30004, 13, 1990, 8448, 29901, 30004, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 10769, 29901, 2391, 29961, 9075, 29962, 1125, 30004, 13, 4706, 1583, 29889, 28160, 29934, 2480, 353, 6024, 29963, 2687, 742, 525, 29963, 5287, 742, 525, 6415, 742, 525, 29990, 742, 525, 29928, 742, 525, 29933, 742, 525, 29968, 742, 525, 29909, 2033, 30004, 13, 4706, 1583, 29889, 24622, 4290, 29901, 2391, 29961, 710, 29962, 353, 6024, 29900, 742, 525, 29896, 742, 525, 29906, 742, 525, 29941, 742, 525, 355, 2033, 30004, 13, 4706, 1583, 29889, 1456, 414, 29901, 2391, 29961, 9075, 29962, 353, 10769, 30004, 13, 4706, 1583, 29889, 1456, 414, 29961, 8172, 29889, 9502, 524, 29898, 29900, 29892, 29871, 29941, 29897, 1822, 275, 6730, 353, 5852, 30004, 13, 4706, 1583, 29889, 28160, 29901, 315, 3163, 353, 315, 3163, 26471, 13, 4706, 1583, 29889, 311, 284, 29907, 3163, 29898, 1311, 29889, 28160, 29892, 1583, 29889, 1456, 414, 8443, 13, 30004, 13, 1678, 732, 7959, 5696, 30004, 13, 1678, 822, 5706, 4290, 1293, 29898, 28160, 797, 3481, 29901, 1051, 29961, 524, 1402, 1361, 29901, 1051, 29961, 524, 1402, 4586, 29907, 3163, 29901, 1051, 29961, 524, 1402, 8158, 15922, 29901, 938, 29892, 8158, 1349, 331, 29901, 938, 1125, 30004, 13, 4706, 1881, 1293, 353, 15889, 797, 3481, 29889, 8552, 26471, 13, 4706, 1550, 7431, 29898, 2080, 1293, 29897, 529, 29871, 29946, 29901, 30004, 13, 9651, 1881, 1293, 29889, 4397, 6278, 29896, 8443, 13, 4706, 1881, 1293, 4619, 1361, 30004, 13, 4706, 1550, 7431, 29898, 2080, 1293, 29897, 529, 29871, 29896, 29929, 29901, 30004, 13, 9651, 1881, 1293, 29889, 4397, 6278, 29896, 8443, 13, 4706, 1881, 1293, 4619, 4586, 29907, 3163, 718, 518, 13628, 15922, 29892, 8158, 1349, 331, 29962, 30004, 13, 4706, 736, 1881, 1293, 30004, 13, 30004, 13, 1678, 732, 7959, 5696, 30004, 13, 1678, 822, 4216, 29898, 28160, 29892, 10769, 1125, 30004, 13, 4706, 363, 474, 297, 10769, 29901, 30004, 13, 9651, 474, 29889, 28160, 797, 3481, 29889, 4397, 29898, 28160, 29889, 4230, 7543, 3101, 30004, 13, 30004, 13, 1678, 732, 7959, 5696, 30004, 13, 1678, 822, 5376, 29907, 3163, 29898, 28160, 29892, 10769, 1125, 30004, 13, 4706, 363, 903, 297, 3464, 29898, 29906, 1125, 30004, 13, 9651, 363, 432, 297, 3464, 29898, 29946, 1125, 30004, 13, 18884, 10769, 29961, 29926, 1822, 28160, 797, 3481, 29889, 4397, 29898, 28160, 29889, 4230, 7543, 3101, 30004, 13, 18884, 10769, 29961, 29926, 1822, 28160, 797, 3481, 29889, 4397, 29898, 28160, 29889, 4230, 7543, 3101, 30004, 13, 30004, 13, 1678, 732, 7959, 5696, 30004, 13, 1678, 822, 2656, 13454, 414, 29898, 1456, 414, 29901, 2391, 29961, 9075, 29962, 1125, 30004, 13, 4706, 363, 903, 297, 3464, 29898, 29946, 1125, 30004, 13, 9651, 565, 10769, 29961, 29900, 1822, 275, 6730, 29901, 30004, 13, 18884, 2867, 30004, 13, 9651, 1683, 29901, 30004, 13, 18884, 5694, 29918, 29886, 353, 10769, 29961, 29900, 29962, 30004, 13, 18884, 10769, 29889, 7323, 29898, 29900, 8443, 13, 18884, 10769, 29889, 4397, 29898, 7382, 29918, 29886, 8443, 13, 30004, 13, 1678, 822, 508, 9075, 1323, 14150, 29898, 1311, 29892, 5881, 1762, 3629, 271, 29892, 937, 29892, 474, 1125, 30004, 13, 4706, 565, 313, 7543, 1762, 3629, 271, 451, 297, 1583, 29889, 1456, 414, 29961, 29900, 1822, 28160, 797, 3481, 322, 451, 937, 322, 474, 1275, 1583, 29889, 1456, 414, 29961, 29900, 29962, 322, 30004, 13, 462, 29900, 451, 297, 1583, 29889, 1456, 414, 29961, 29900, 1822, 28160, 797, 3481, 1125, 30004, 13, 9651, 736, 5852, 30004, 13, 4706, 736, 7700, 30004, 13, 30004, 13, 1678, 822, 1596, 3481, 29898, 1311, 29892, 1361, 29892, 937, 1125, 30004, 13, 4706, 1361, 3744, 353, 525, 29989, 525, 30004, 13, 4706, 565, 451, 937, 29901, 30004, 13, 9651, 1596, 703, 29933, 29874, 30026, 1600, 10856, 371, 29901, 376, 8443, 13, 30004, 13, 9651, 363, 302, 297, 1361, 29901, 30004, 13, 18884, 1361, 3744, 4619, 1583, 29889, 28160, 29934, 2480, 29961, 29876, 29962, 718, 525, 891, 525, 30004, 13, 9651, 1596, 29898, 3179, 3744, 8443, 13, 30004, 13, 1678, 822, 1596, 9075, 29898, 1311, 29892, 474, 1125, 30004, 13, 4706, 15889, 797, 3481, 3744, 353, 525, 29989, 525, 30004, 13, 4706, 1596, 29898, 29875, 17255, 710, 1649, 3101, 30004, 13, 4706, 363, 302, 297, 474, 29889, 28160, 797, 3481, 29901, 30004, 13, 9651, 15889, 797, 3481, 3744, 4619, 1583, 29889, 28160, 29934, 2480, 29961, 29876, 29962, 718, 525, 891, 525, 30004, 13, 4706, 1596, 703, 29934, 22971, 29901, 376, 718, 15889, 797, 3481, 3744, 8443, 13, 4706, 736, 474, 29889, 1456, 292, 13724, 29889, 3389, 13724, 26471, 13, 30004, 13, 1678, 822, 1596, 7514, 29898, 1311, 1125, 30004, 13, 4706, 1596, 703, 9039, 359, 7267, 287, 8919, 276, 29901, 376, 8443, 13, 4706, 363, 474, 297, 1583, 29889, 1456, 414, 29901, 30004, 13, 9651, 1596, 29898, 29888, 26732, 29873, 29899, 426, 29875, 27195, 30004, 13, 30004, 13, 1678, 732, 7959, 5696, 30004, 13, 1678, 822, 5881, 29911, 6926, 1576, 3481, 29898, 386, 4708, 13200, 29892, 5881, 1762, 3629, 271, 29892, 474, 29892, 10769, 1125, 30004, 13, 4706, 565, 12005, 13200, 1275, 5881, 1762, 3629, 271, 470, 12005, 13200, 1275, 29871, 29900, 29901, 30004, 13, 9651, 363, 432, 297, 10769, 29901, 30004, 13, 18884, 432, 29889, 29873, 6926, 1576, 3481, 353, 7700, 30004, 13, 18884, 432, 29889, 275, 6730, 353, 7700, 30004, 13, 9651, 474, 29889, 29873, 6926, 1576, 3481, 353, 5852, 30004, 13, 9651, 474, 29889, 275, 6730, 353, 5852, 30004, 13, 30004, 13, 1678, 732, 7959, 5696, 30004, 13, 1678, 822, 1298, 11139, 29898, 3179, 29892, 10769, 1125, 30004, 13, 4706, 2533, 20325, 353, 29871, 29900, 30004, 13, 4706, 363, 474, 297, 1361, 29901, 30004, 13, 9651, 565, 474, 1275, 29871, 29941, 470, 474, 1275, 29871, 29955, 29901, 30004, 13, 18884, 2533, 20325, 4619, 29871, 29896, 29900, 30004, 13, 4706, 363, 474, 297, 10769, 29901, 30004, 13, 9651, 565, 474, 29889, 29873, 6926, 1576, 3481, 29901, 30004, 13, 18884, 474, 29889, 13628, 4619, 2533, 20325, 30004, 13, 18884, 10769, 29961, 1456, 414, 29889, 2248, 29898, 29875, 6817, 29906, 1822, 13628, 4619, 2533, 20325, 30004, 13, 18884, 363, 432, 297, 1361, 29901, 30004, 13, 462, 1678, 474, 29889, 29873, 9424, 29907, 3163, 29961, 29926, 29962, 4619, 29871, 29896, 30004, 13, 462, 1678, 10769, 29961, 1456, 414, 29889, 2248, 29898, 29875, 29897, 448, 29871, 29906, 1822, 29873, 9424, 29907, 3163, 29961, 29926, 29962, 4619, 29871, 29896, 30004, 13, 18884, 2867, 30004, 13, 30004, 13, 1678, 822, 1298, 27175, 29898, 1311, 1125, 30004, 13, 4706, 363, 474, 297, 1583, 29889, 1456, 414, 29901, 30004, 13, 9651, 474, 29889, 13628, 353, 29871, 29900, 30004, 13, 30004, 13, 1678, 822, 640, 2772, 284, 29898, 1311, 29892, 937, 9075, 1125, 30004, 13, 4706, 565, 7431, 29898, 1311, 29889, 28160, 29889, 28160, 29897, 2804, 29871, 29900, 29901, 30004, 13, 9651, 363, 474, 297, 3464, 29898, 1195, 29898, 29946, 29899, 2435, 29898, 4102, 9075, 29889, 28160, 797, 3481, 511, 938, 29898, 2435, 29898, 1311, 29889, 28160, 29889, 28160, 6802, 29946, 876, 1125, 30004, 13, 18884, 1583, 29889, 4012, 29898, 1311, 29889, 28160, 29892, 1583, 29889, 1456, 414, 8443, 13, 30004, 13, 1678, 822, 1423, 13200, 4290, 29898, 1311, 29892, 5881, 1762, 29473, 29892, 5881, 1762, 3629, 271, 29892, 937, 29892, 263, 29892, 474, 29892, 937, 9075, 1125, 30004, 13, 4706, 565, 5881, 1762, 29473, 451, 297, 1583, 29889, 24622, 4290, 29901, 30004, 13, 9651, 396, 2158, 29898, 29888, 29908, 29940, 287, 2112, 1555, 4142, 29875, 318, 21051, 23157, 30004, 13, 9651, 736, 7700, 30004, 13, 30004, 13, 4706, 565, 5881, 1762, 29473, 1275, 525, 355, 2396, 30004, 13, 9651, 565, 474, 2804, 937, 9075, 470, 937, 29901, 30004, 13, 18884, 396, 2158, 703, 29911, 1267, 329, 1217, 302, 7253, 13160, 29884, 25344, 503, 485, 29878, 30039, 4812, 17048, 29884, 29991, 1159, 30004, 13, 18884, 736, 7700, 30004, 13, 9651, 736, 5852, 30004, 13, 30004, 13, 4706, 565, 938, 29898, 7543, 1762, 29473, 29897, 1405, 313, 29941, 29899, 29874, 1125, 30004, 13, 9651, 396, 2158, 29898, 29888, 29908, 29949, 29881, 370, 661, 29874, 413, 16979, 302, 7253, 443, 329, 279, 22641, 1112, 29874, 23157, 30004, 13, 9651, 736, 7700, 30004, 13, 4706, 1018, 29901, 30004, 13, 9651, 565, 474, 29889, 28160, 797, 3481, 29961, 524, 29898, 7543, 1762, 29473, 4638, 2804, 5881, 1762, 3629, 271, 322, 474, 29889, 28160, 797, 3481, 29961, 524, 29898, 7543, 1762, 29473, 4638, 2804, 29871, 29900, 322, 451, 937, 322, 474, 1275, 937, 9075, 29901, 30004, 13, 18884, 396, 2158, 29898, 29888, 29908, 29949, 29881, 370, 661, 29874, 413, 16979, 302, 7253, 338, 29886, 5705, 1056, 23157, 30004, 13, 18884, 736, 7700, 30004, 13, 4706, 5174, 29901, 30004, 13, 9651, 736, 7700, 30004, 13, 30004, 13, 4706, 736, 5852, 30004, 13, 30004, 13, 1678, 732, 6799, 30004, 13, 1678, 822, 1361, 1456, 29898, 1311, 1125, 30004, 13, 4706, 1361, 353, 5159, 30004, 13, 4706, 12088, 6255, 353, 7700, 30004, 13, 4706, 2867, 3481, 353, 7700, 30004, 13, 4706, 937, 353, 5852, 30004, 13, 4706, 5881, 1762, 3629, 271, 353, 6213, 30004, 13, 30004, 13, 4706, 474, 29901, 14574, 30004, 13, 4706, 363, 474, 297, 1583, 29889, 1456, 414, 29901, 30004, 13, 9651, 474, 29889, 28160, 797, 3481, 29889, 6605, 26471, 13, 4706, 396, 20025, 381, 16754, 8919, 336, 30026, 29874, 30004, 13, 4706, 1583, 29889, 6605, 13454, 414, 29898, 1311, 29889, 1456, 414, 8443, 13, 30004, 13, 4706, 937, 9075, 353, 1583, 29889, 1456, 414, 29961, 29900, 29962, 30004, 13, 30004, 13, 4706, 396, 3929, 30026, 300, 557, 5796, 446, 30004, 13, 4706, 565, 7431, 29898, 4102, 9075, 29889, 28160, 797, 3481, 29897, 2804, 29871, 29900, 29901, 30004, 13, 9651, 396, 1583, 29889, 2158, 7514, 26471, 13, 9651, 396, 476, 11124, 6895, 30004, 13, 9651, 363, 263, 297, 3464, 29898, 29946, 1125, 30004, 13, 18884, 565, 7431, 29898, 1311, 29889, 28160, 29889, 28160, 29897, 29995, 29906, 29901, 30004, 13, 462, 1678, 12088, 6255, 353, 5852, 30004, 13, 462, 1678, 2867, 30004, 13, 18884, 396, 306, 3874, 24397, 30004, 13, 18884, 363, 474, 297, 1583, 29889, 1456, 414, 29901, 30004, 13, 462, 1678, 396, 9133, 29926, 1572, 2730, 11590, 619, 544, 1403, 8919, 336, 30026, 11777, 485, 4812, 5796, 2120, 30004, 13, 462, 1678, 2867, 3481, 353, 1583, 29889, 3068, 9075, 1323, 14150, 29898, 7543, 1762, 3629, 271, 29892, 937, 29892, 474, 8443, 13, 462, 1678, 565, 2867, 3481, 29901, 30004, 13, 462, 4706, 396, 1583, 29889, 2158, 3481, 29898, 3179, 29892, 937, 8443, 13, 462, 4706, 2867, 30004, 13, 30004, 13, 462, 1678, 396, 1583, 29889, 2158, 3481, 29898, 3179, 29892, 937, 8443, 13, 462, 1678, 396, 2158, 29898, 1311, 29889, 17158, 4290, 1293, 29898, 29875, 29889, 28160, 797, 3481, 29892, 1361, 29892, 474, 29889, 29873, 9424, 29907, 3163, 29892, 474, 29889, 13628, 29892, 1583, 29889, 1456, 414, 29961, 1311, 29889, 1456, 414, 29889, 2248, 29898, 29875, 6817, 29896, 1822, 13628, 876, 30004, 13, 462, 1678, 5881, 1762, 29473, 1293, 353, 474, 29889, 1456, 292, 13724, 29889, 3389, 13724, 29898, 1311, 29889, 17158, 4290, 1293, 29898, 29875, 29889, 28160, 797, 3481, 29892, 1361, 29892, 474, 29889, 29873, 9424, 29907, 3163, 29892, 474, 29889, 13628, 29892, 1583, 29889, 1456, 414, 29961, 1311, 29889, 1456, 414, 29889, 2248, 29898, 29875, 6817, 29896, 1822, 13628, 876, 30004, 13, 462, 1678, 5881, 1762, 29473, 353, 5881, 1762, 29473, 1293, 29889, 2248, 29898, 3317, 29898, 7543, 1762, 29473, 1293, 876, 30004, 13, 462, 1678, 565, 5881, 1762, 29473, 1275, 29871, 29946, 29901, 30004, 13, 462, 4706, 5881, 1762, 29473, 353, 376, 355, 19451, 13, 462, 1678, 396, 1596, 29898, 29888, 29908, 29912, 359, 29889, 657, 5935, 28296, 426, 7543, 1762, 29473, 27195, 30004, 13, 462, 1678, 396, 9133, 29926, 1572, 1146, 619, 1444, 318, 21051, 437, 1646, 30004, 13, 462, 1678, 565, 451, 1583, 29889, 3198, 13200, 4290, 29898, 710, 29898, 7543, 1762, 29473, 511, 5881, 1762, 3629, 271, 29892, 937, 29892, 263, 29892, 474, 29892, 937, 9075, 1125, 30004, 13, 462, 4706, 2867, 3481, 353, 5852, 30004, 13, 462, 4706, 12088, 6255, 353, 5852, 30004, 13, 462, 4706, 2867, 30004, 13, 30004, 13, 462, 1678, 565, 5881, 1762, 29473, 1275, 525, 355, 2396, 30004, 13, 462, 4706, 2867, 3481, 353, 5852, 30004, 13, 462, 4706, 2867, 30004, 13, 30004, 13, 462, 1678, 396, 4918, 485, 29880, 1764, 413, 442, 29884, 4022, 27296, 326, 16754, 30004, 13, 462, 1678, 12005, 13200, 353, 474, 29889, 20539, 7543, 29898, 524, 29898, 7543, 1762, 29473, 876, 30004, 13, 462, 1678, 565, 937, 29901, 30004, 13, 462, 4706, 5881, 1762, 3629, 271, 353, 12005, 13200, 30004, 13, 462, 4706, 937, 353, 7700, 30004, 13, 30004, 13, 462, 1678, 1596, 29898, 29888, 29908, 29912, 359, 29889, 657, 5935, 28296, 426, 29875, 29889, 6786, 29913, 426, 386, 4708, 13200, 27195, 30004, 13, 30004, 13, 462, 1678, 396, 9133, 6846, 879, 1146, 619, 9922, 30026, 2386, 413, 16979, 27296, 2946, 5796, 2120, 30004, 13, 462, 1678, 1583, 29889, 7543, 29911, 6926, 1576, 3481, 29898, 386, 4708, 13200, 29892, 5881, 1762, 3629, 271, 29892, 474, 29892, 1583, 29889, 1456, 414, 8443, 13, 30004, 13, 462, 1678, 396, 6000, 30026, 1600, 10856, 371, 30004, 13, 462, 1678, 1361, 29889, 4397, 29898, 386, 4708, 13200, 8443, 13, 30004, 13, 18884, 565, 2867, 3481, 29901, 30004, 13, 462, 1678, 1596, 703, 29934, 8917, 1444, 503, 485, 29878, 30039, 4233, 23157, 30004, 13, 462, 1678, 2867, 30004, 13, 30004, 13, 30004, 13, 9651, 396, 796, 2634, 8931, 1324, 13004, 4273, 30004, 13, 9651, 1583, 29889, 3149, 11139, 29898, 3179, 29892, 1583, 29889, 1456, 414, 8443, 13, 30004, 13, 9651, 396, 360, 823, 295, 4142, 1324, 10856, 532, 30004, 13, 9651, 1583, 29889, 1285, 2772, 284, 29898, 4102, 9075, 8443, 13, 9651, 565, 12088, 6255, 29901, 30004, 13, 18884, 1596, 29898, 29888, 29908, 7301, 475, 335, 15889, 29901, 426, 1311, 29889, 28160, 29889, 28160, 27195, 30004, 13, 18884, 736, 5852, 30004, 13, 30004, 13, 9651, 565, 451, 2867, 3481, 29901, 30004, 13, 18884, 1596, 703, 29934, 8917, 1444, 503, 485, 29878, 30039, 4233, 23157, 30004, 13, 18884, 1209, 30004, 13, 9651, 736, 7700, 30004, 13, 4706, 1683, 29901, 30004, 13, 9651, 1596, 29898, 29888, 29908, 7301, 475, 335, 15889, 29901, 426, 1311, 29889, 28160, 29889, 28160, 27195, 30004, 13, 9651, 736, 5852, 30004, 13, 30004, 13, 1678, 822, 1708, 11802, 29898, 1311, 1125, 30004, 13, 30004, 13, 4706, 1583, 29889, 3149, 27175, 26471, 13, 30004, 13, 4706, 396, 1596, 703, 29961, 25826, 4214, 29962, 4763, 292, 3748, 23157, 30004, 13, 4706, 396, 1596, 29898, 29888, 29908, 13711, 6895, 29901, 320, 29876, 29905, 29873, 29899, 29912, 1311, 29889, 1456, 414, 29961, 29900, 12258, 474, 426, 1311, 29889, 1456, 414, 29961, 29906, 29962, 1012, 29876, 29905, 29873, 29899, 29912, 1311, 29889, 1456, 414, 29961, 29896, 12258, 474, 426, 1311, 29889, 1456, 414, 29961, 29941, 12258, 1159, 30004, 13, 4706, 931, 4763, 353, 931, 29889, 2230, 26471, 13, 4706, 1550, 451, 1583, 29889, 3179, 1456, 29901, 30004, 13, 9651, 1209, 30004, 13, 30004, 13, 4706, 285, 353, 1722, 703, 4738, 362, 12191, 29889, 3945, 613, 376, 370, 1159, 30004, 13, 4706, 4078, 353, 5159, 30004, 13, 30004, 13, 4706, 565, 1583, 29889, 1456, 414, 29961, 29900, 1822, 13628, 1405, 1583, 29889, 1456, 414, 29961, 29896, 1822, 13628, 29901, 30004, 13, 9651, 4078, 29889, 4397, 29898, 1311, 29889, 1456, 414, 29961, 29900, 1822, 1456, 292, 13724, 29889, 484, 3631, 13724, 8443, 13, 9651, 4078, 29889, 4397, 29898, 1311, 29889, 1456, 414, 29961, 29906, 1822, 1456, 292, 13724, 29889, 484, 3631, 13724, 8443, 13, 9651, 4078, 29889, 4397, 29898, 1311, 29889, 1456, 414, 29961, 29900, 1822, 13628, 718, 29871, 29896, 718, 931, 29889, 2230, 580, 448, 931, 4763, 448, 7431, 29898, 1311, 29889, 28160, 29889, 28160, 876, 30004, 13, 4706, 25342, 1583, 29889, 1456, 414, 29961, 29900, 1822, 13628, 529, 1583, 29889, 1456, 414, 29961, 29896, 1822, 13628, 29901, 30004, 13, 9651, 4078, 29889, 4397, 29898, 1311, 29889, 1456, 414, 29961, 29896, 1822, 1456, 292, 13724, 29889, 484, 3631, 13724, 8443, 13, 9651, 4078, 29889, 4397, 29898, 1311, 29889, 1456, 414, 29961, 29941, 1822, 1456, 292, 13724, 29889, 484, 3631, 13724, 8443, 13, 9651, 4078, 29889, 4397, 29898, 1311, 29889, 1456, 414, 29961, 29896, 1822, 13628, 718, 29871, 29896, 718, 931, 29889, 2230, 580, 448, 931, 4763, 448, 7431, 29898, 1311, 29889, 28160, 29889, 28160, 876, 30004, 13, 4706, 1683, 29901, 30004, 13, 9651, 565, 1583, 29889, 1456, 414, 29961, 29900, 1822, 29873, 6926, 1576, 3481, 718, 1583, 29889, 1456, 414, 29961, 29906, 1822, 29873, 6926, 1576, 3481, 29901, 30004, 13, 18884, 4078, 29889, 4397, 29898, 1311, 29889, 1456, 414, 29961, 29900, 1822, 1456, 292, 13724, 29889, 484, 3631, 13724, 8443, 13, 18884, 4078, 29889, 4397, 29898, 1311, 29889, 1456, 414, 29961, 29906, 1822, 1456, 292, 13724, 29889, 484, 3631, 13724, 8443, 13, 18884, 4078, 29889, 4397, 29898, 1311, 29889, 1456, 414, 29961, 29900, 1822, 13628, 718, 29871, 29896, 718, 931, 29889, 2230, 580, 448, 931, 4763, 448, 7431, 29898, 1311, 29889, 28160, 29889, 28160, 876, 30004, 13, 9651, 1683, 29901, 30004, 13, 18884, 4078, 29889, 4397, 29898, 1311, 29889, 1456, 414, 29961, 29896, 1822, 1456, 292, 13724, 29889, 484, 3631, 13724, 8443, 13, 18884, 4078, 29889, 4397, 29898, 1311, 29889, 1456, 414, 29961, 29941, 1822, 1456, 292, 13724, 29889, 484, 3631, 13724, 8443, 13, 18884, 4078, 29889, 4397, 29898, 1311, 29889, 1456, 414, 29961, 29896, 1822, 13628, 718, 29871, 29896, 718, 931, 29889, 2230, 580, 448, 931, 4763, 448, 7431, 29898, 1311, 29889, 28160, 29889, 28160, 876, 30004, 13, 30004, 13, 4706, 5839, 280, 29889, 15070, 29898, 7620, 29892, 285, 8443, 13, 4706, 285, 29889, 5358, 26471, 13, 30004, 13, 1753, 1065, 14199, 29898, 29916, 29901, 8448, 1125, 30004, 13, 1678, 921, 29889, 1456, 11802, 26471, 13, 30004, 13, 30004, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 30004, 13, 1678, 396, 4036, 29889, 26776, 29898, 29906, 8443, 13, 30004, 13, 1678, 6694, 2481, 4763, 353, 931, 29889, 2230, 26471, 13, 30004, 13, 1678, 1596, 29898, 29888, 29908, 5631, 362, 29901, 29871, 29900, 1159, 30004, 13, 1678, 2531, 2481, 4763, 353, 931, 29889, 2230, 26471, 13, 30004, 13, 1678, 1353, 2776, 29954, 1280, 353, 29871, 29906, 29945, 30004, 13, 1678, 1353, 2776, 13454, 414, 353, 1353, 2776, 29954, 1280, 334, 29871, 29946, 30004, 13, 30004, 13, 1678, 9225, 13454, 414, 353, 518, 9075, 703, 7451, 29908, 718, 851, 29898, 29875, 511, 302, 29876, 29889, 8139, 3631, 13724, 3101, 363, 474, 297, 3464, 29898, 4537, 2776, 13454, 414, 4638, 30004, 13, 1678, 363, 474, 297, 3464, 29898, 4537, 2776, 13454, 414, 1125, 30004, 13, 4706, 9225, 13454, 414, 29961, 29875, 1822, 1456, 292, 13724, 29889, 1202, 4290, 14420, 29898, 29906, 29929, 8443, 13, 4706, 9225, 13454, 414, 29961, 29875, 1822, 1456, 292, 13724, 29889, 1202, 14420, 29898, 29896, 29945, 8443, 13, 4706, 9225, 13454, 414, 29961, 29875, 1822, 1456, 292, 13724, 29889, 1202, 14420, 29898, 29896, 29945, 8443, 13, 4706, 9225, 13454, 414, 29961, 29875, 1822, 1456, 292, 13724, 29889, 1202, 14420, 29898, 29945, 8443, 13, 30004, 13, 1678, 1353, 2776, 5631, 362, 353, 29871, 29896, 29900, 29900, 29900, 30004, 13, 30004, 13, 1678, 8090, 353, 518, 14199, 4197, 7451, 13454, 414, 29889, 7323, 580, 363, 903, 297, 3464, 29898, 29946, 29897, 2314, 363, 903, 297, 3464, 29898, 4537, 2776, 29954, 1280, 4638, 30004, 13, 30004, 13, 1678, 11565, 353, 22326, 29889, 11426, 26471, 13, 1678, 2582, 353, 11565, 29889, 1958, 29898, 3389, 14199, 29892, 8090, 8443, 13, 30004, 13, 1678, 1596, 29898, 29888, 29908, 2481, 310, 12623, 29871, 29900, 29901, 426, 2230, 29889, 2230, 580, 448, 2531, 2481, 4763, 27195, 30004, 13, 30004, 13, 1678, 9995, 5014, 267, 353, 5159, 30004, 13, 1678, 363, 474, 297, 8090, 29901, 30004, 13, 4706, 10174, 29889, 4397, 29898, 1526, 29889, 7032, 29898, 5182, 29922, 29875, 29889, 1456, 11802, 876, 30004, 13, 4706, 10174, 14352, 29896, 1822, 2962, 26471, 13, 4706, 10174, 14352, 29896, 1822, 7122, 580, 15945, 19451, 13, 30004, 13, 1678, 9995, 28993, 353, 5159, 30004, 13, 1678, 363, 474, 297, 8090, 29901, 30004, 13, 4706, 9717, 29889, 4397, 29898, 386, 5499, 29889, 4899, 29898, 5182, 29922, 29875, 29889, 1456, 11802, 876, 30004, 13, 4706, 9717, 14352, 29896, 1822, 2962, 26471, 13, 4706, 9717, 14352, 29896, 1822, 7122, 580, 15945, 19451, 13, 30004, 13, 1678, 363, 474, 297, 3464, 29898, 4537, 2776, 5631, 362, 1125, 30004, 13, 4706, 1596, 29898, 29888, 29908, 5631, 362, 29901, 426, 29875, 718, 29871, 29896, 27195, 30004, 13, 4706, 2531, 2481, 4763, 353, 931, 29889, 2230, 26471, 13, 4706, 12623, 12191, 353, 5159, 30004, 13, 4706, 285, 353, 1722, 703, 4738, 362, 12191, 29889, 3945, 613, 376, 6050, 1159, 30004, 13, 4706, 363, 903, 297, 3464, 29898, 4537, 2776, 29954, 1280, 1125, 30004, 13, 9651, 1018, 29901, 30004, 13, 18884, 12623, 12191, 29889, 4397, 29898, 23945, 280, 29889, 1359, 29898, 29888, 876, 30004, 13, 9651, 5174, 29901, 30004, 13, 18884, 1209, 30004, 13, 4706, 285, 29889, 5358, 26471, 13, 4706, 285, 353, 1722, 703, 4738, 362, 12191, 29889, 3945, 613, 376, 29893, 1159, 30004, 13, 4706, 285, 29889, 5358, 26471, 13, 4706, 1900, 797, 5631, 362, 353, 12623, 12191, 29961, 29900, 29962, 30004, 13, 4706, 363, 432, 297, 12623, 12191, 29901, 30004, 13, 9651, 565, 432, 29961, 29906, 29962, 1405, 1900, 797, 5631, 362, 29961, 29906, 5387, 30004, 13, 18884, 1900, 797, 5631, 362, 353, 432, 30004, 13, 30004, 13, 4706, 9225, 13454, 414, 353, 518, 9075, 703, 7451, 29908, 718, 851, 29898, 29926, 29897, 718, 11119, 29908, 718, 851, 29898, 29875, 511, 302, 29876, 29889, 8139, 3631, 13724, 3101, 363, 432, 297, 3464, 29898, 4537, 2776, 13454, 414, 4638, 30004, 13, 4706, 363, 432, 297, 3464, 29898, 4537, 2776, 13454, 414, 1125, 30004, 13, 9651, 565, 432, 529, 1353, 2776, 13454, 414, 29914, 29906, 29901, 30004, 13, 18884, 9225, 13454, 414, 29961, 29926, 1822, 1456, 292, 13724, 29889, 484, 3631, 13724, 353, 1900, 797, 5631, 362, 29961, 29900, 29962, 30004, 13, 9651, 1683, 29901, 30004, 13, 18884, 9225, 13454, 414, 29961, 29926, 1822, 1456, 292, 13724, 29889, 484, 3631, 13724, 353, 1900, 797, 5631, 362, 29961, 29896, 29962, 30004, 13, 30004, 13, 4706, 4036, 29889, 845, 21897, 29898, 7451, 13454, 414, 8443, 13, 30004, 13, 4706, 8090, 353, 518, 14199, 4197, 7451, 13454, 414, 29889, 7323, 580, 363, 903, 297, 3464, 29898, 29946, 29897, 2314, 363, 903, 297, 3464, 29898, 4537, 2776, 29954, 1280, 4638, 30004, 13, 30004, 13, 4706, 11565, 353, 22326, 29889, 11426, 26471, 13, 4706, 2582, 353, 11565, 29889, 1958, 29898, 3389, 14199, 29892, 8090, 8443, 13, 30004, 13, 4706, 1596, 29898, 29888, 29908, 2481, 310, 12623, 426, 29875, 29974, 29896, 6177, 426, 2230, 29889, 2230, 580, 448, 2531, 2481, 4763, 27195, 30004, 13, 30004, 13, 4706, 9995, 28993, 353, 5159, 30004, 13, 4706, 363, 432, 297, 8090, 29901, 30004, 13, 9651, 9717, 29889, 4397, 29898, 386, 5499, 29889, 4899, 29898, 5182, 29922, 29926, 29889, 1456, 11802, 876, 30004, 13, 9651, 9717, 14352, 29896, 1822, 2962, 26471, 13, 9651, 9717, 14352, 29896, 1822, 7122, 580, 15945, 19451, 13, 30004, 13, 4706, 9995, 5014, 267, 353, 5159, 30004, 13, 4706, 363, 432, 297, 8090, 29901, 30004, 13, 9651, 10174, 29889, 4397, 29898, 1526, 29889, 7032, 29898, 5182, 29922, 29926, 29889, 1456, 11802, 876, 30004, 13, 9651, 10174, 14352, 29896, 1822, 2962, 26471, 13, 9651, 10174, 14352, 29896, 1822, 7122, 580, 15945, 19451, 13, 30004, 13, 1678, 1596, 29898, 29888, 29908, 5323, 2827, 931, 29901, 426, 2230, 29889, 2230, 580, 448, 6694, 2481, 4763, 27195, 30004, 13, 30004, 13, 1678, 12623, 12191, 353, 5159, 30004, 13, 1678, 285, 353, 1722, 703, 4738, 362, 12191, 29889, 3945, 613, 376, 6050, 1159, 30004, 13, 1678, 363, 903, 297, 3464, 29898, 4537, 2776, 29954, 1280, 1125, 30004, 13, 4706, 12623, 12191, 29889, 4397, 29898, 23945, 280, 29889, 1359, 29898, 29888, 876, 30004, 13, 1678, 285, 29889, 5358, 26471, 13, 1678, 1900, 797, 5631, 362, 353, 12623, 12191, 29961, 29900, 29962, 30004, 13, 1678, 363, 432, 297, 12623, 12191, 29901, 30004, 13, 4706, 565, 432, 29961, 29906, 29962, 1405, 1900, 797, 5631, 362, 29961, 29906, 5387, 30004, 13, 9651, 1900, 797, 5631, 362, 353, 432, 30004, 13, 1678, 285, 29889, 5358, 26471, 13, 1678, 285, 353, 1722, 703, 4738, 362, 12191, 29889, 3945, 613, 376, 29893, 29890, 1159, 30004, 13, 1678, 5839, 280, 29889, 15070, 29898, 13318, 797, 5631, 362, 29892, 285, 8443, 13, 1678, 285, 29889, 5358, 580, 2 ]
solutions/807/807-kir3i.py
iknoom/LeetCode-Solutions
4
101366
<reponame>iknoom/LeetCode-Solutions<filename>solutions/807/807-kir3i.py class Solution: def maxIncreaseKeepingSkyline(self, grid): skyline = [] for v_line in grid: skyline.append([max(v_line)] * len(grid)) for x, h_line in enumerate(list(zip(*grid))): max_h = max(h_line) for y in range(len(skyline)): skyline[y][x] = min(skyline[y][x], max_h) ans = sum([sum(l) for l in skyline]) - sum([sum(l) for l in grid]) return ans
[ 1, 529, 276, 1112, 420, 29958, 638, 1217, 290, 29914, 3226, 300, 3399, 29899, 13296, 17925, 29966, 9507, 29958, 2929, 17925, 29914, 29947, 29900, 29955, 29914, 29947, 29900, 29955, 29899, 14166, 29941, 29875, 29889, 2272, 13, 1990, 24380, 29901, 13, 1678, 822, 4236, 797, 1037, 559, 9598, 26819, 29903, 3459, 1220, 29898, 1311, 29892, 6856, 1125, 13, 4706, 14744, 1220, 353, 5159, 13, 13, 4706, 363, 325, 29918, 1220, 297, 6856, 29901, 13, 9651, 14744, 1220, 29889, 4397, 4197, 3317, 29898, 29894, 29918, 1220, 4638, 334, 7431, 29898, 7720, 876, 13, 13, 4706, 363, 921, 29892, 298, 29918, 1220, 297, 26985, 29898, 1761, 29898, 7554, 10456, 7720, 876, 1125, 13, 9651, 4236, 29918, 29882, 353, 4236, 29898, 29882, 29918, 1220, 29897, 13, 9651, 363, 343, 297, 3464, 29898, 2435, 29898, 7912, 1220, 22164, 13, 18884, 14744, 1220, 29961, 29891, 3816, 29916, 29962, 353, 1375, 29898, 7912, 1220, 29961, 29891, 3816, 29916, 1402, 4236, 29918, 29882, 29897, 13, 13, 4706, 6063, 353, 2533, 4197, 2083, 29898, 29880, 29897, 363, 301, 297, 14744, 1220, 2314, 448, 2533, 4197, 2083, 29898, 29880, 29897, 363, 301, 297, 6856, 2314, 13, 4706, 736, 6063, 2 ]
cds_migrator_kit/circulation/__init__.py
kprzerwa/cds-migrator-kit
0
81310
<reponame>kprzerwa/cds-migrator-kit # -*- coding: utf-8 -*- # # This file is part of Invenio. # Copyright (C) 2015-2018 CERN. # # cds-migrator-kit is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. """CDS Migrator Circulation module.""" import click from flask.cli import with_appcontext from .items.cli import libraries, items from .users.cli import users @click.group() def circulation(): """CDS Migrator Circulation commands.""" @circulation.command() @click.argument('users_json', type=click.Path(exists=True)) @with_appcontext def borrowers(users_json): """Load users from JSON files and output ILS Records.""" users(users_json) @circulation.command() @click.argument('libraries_json', type=click.Path(exists=True)) @with_appcontext def libraries(libraries_json): """Load libraries from JSON files and output ILS Records.""" libraries(libraries_json) @circulation.command() @click.argument('items_json_folder', type=click.Path(exists=True)) @click.argument('locations_json', type=click.Path(exists=True)) @with_appcontext def items(items_json_folder, locations_json): """Load items from JSON files. :param str items_json_folder: The path to the JSON dump of the legacy items :param str locations_json: The path to the JSON records of the new ILS libraries (already migrated) """ items(items_json_folder, locations_json)
[ 1, 529, 276, 1112, 420, 29958, 29895, 558, 3298, 2766, 29914, 2252, 29879, 29899, 26983, 1061, 29899, 7354, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 29937, 13, 29937, 910, 934, 338, 760, 310, 512, 854, 601, 29889, 13, 29937, 14187, 1266, 313, 29907, 29897, 29871, 29906, 29900, 29896, 29945, 29899, 29906, 29900, 29896, 29947, 315, 1001, 29940, 29889, 13, 29937, 13, 29937, 274, 6289, 29899, 26983, 1061, 29899, 7354, 338, 3889, 7047, 29936, 366, 508, 2654, 391, 2666, 372, 322, 29914, 272, 6623, 372, 13, 29937, 1090, 278, 4958, 310, 278, 341, 1806, 19245, 29936, 1074, 365, 2965, 1430, 1660, 934, 363, 901, 4902, 29889, 13, 13, 15945, 29908, 6530, 29903, 341, 4481, 1061, 25079, 1810, 362, 3883, 1213, 15945, 13, 13, 5215, 2828, 13, 3166, 29784, 29889, 11303, 1053, 411, 29918, 932, 4703, 13, 3166, 869, 7076, 29889, 11303, 1053, 9562, 29892, 4452, 13, 3166, 869, 7193, 29889, 11303, 1053, 4160, 13, 13, 13, 29992, 3808, 29889, 2972, 580, 13, 1753, 18342, 362, 7295, 13, 1678, 9995, 6530, 29903, 341, 4481, 1061, 25079, 1810, 362, 8260, 1213, 15945, 13, 13, 13, 29992, 19052, 1810, 362, 29889, 6519, 580, 13, 29992, 3808, 29889, 23516, 877, 7193, 29918, 3126, 742, 1134, 29922, 3808, 29889, 2605, 29898, 9933, 29922, 5574, 876, 13, 29992, 2541, 29918, 932, 4703, 13, 1753, 27942, 414, 29898, 7193, 29918, 3126, 1125, 13, 1678, 9995, 5896, 4160, 515, 4663, 2066, 322, 1962, 306, 8547, 7983, 1213, 15945, 13, 1678, 4160, 29898, 7193, 29918, 3126, 29897, 13, 13, 13, 29992, 19052, 1810, 362, 29889, 6519, 580, 13, 29992, 3808, 29889, 23516, 877, 492, 8464, 29918, 3126, 742, 1134, 29922, 3808, 29889, 2605, 29898, 9933, 29922, 5574, 876, 13, 29992, 2541, 29918, 932, 4703, 13, 1753, 9562, 29898, 492, 8464, 29918, 3126, 1125, 13, 1678, 9995, 5896, 9562, 515, 4663, 2066, 322, 1962, 306, 8547, 7983, 1213, 15945, 13, 1678, 9562, 29898, 492, 8464, 29918, 3126, 29897, 13, 13, 13, 29992, 19052, 1810, 362, 29889, 6519, 580, 13, 29992, 3808, 29889, 23516, 877, 7076, 29918, 3126, 29918, 12083, 742, 1134, 29922, 3808, 29889, 2605, 29898, 9933, 29922, 5574, 876, 13, 29992, 3808, 29889, 23516, 877, 2029, 800, 29918, 3126, 742, 1134, 29922, 3808, 29889, 2605, 29898, 9933, 29922, 5574, 876, 13, 29992, 2541, 29918, 932, 4703, 13, 1753, 4452, 29898, 7076, 29918, 3126, 29918, 12083, 29892, 14354, 29918, 3126, 1125, 13, 1678, 9995, 5896, 4452, 515, 4663, 2066, 29889, 13, 13, 1678, 584, 3207, 851, 4452, 29918, 3126, 29918, 12083, 29901, 450, 2224, 304, 278, 4663, 16766, 310, 278, 25000, 4452, 13, 1678, 584, 3207, 851, 14354, 29918, 3126, 29901, 450, 2224, 304, 278, 4663, 6475, 310, 278, 716, 306, 8547, 13, 18884, 9562, 313, 284, 2040, 9725, 630, 29897, 13, 1678, 9995, 13, 1678, 4452, 29898, 7076, 29918, 3126, 29918, 12083, 29892, 14354, 29918, 3126, 29897, 13, 2 ]
onadata/apps/logger/management/commands/set_xform_surveys_with_geopoints.py
childhelpline/myhelpline
1
135766
#!/usr/bin/env python # vim: ai ts=4 sts=4 et sw=4 fileencoding=utf-8 from django.core.management.base import BaseCommand from django.utils.translation import ugettext_lazy from onadata.apps.logger.models.xform import XForm from onadata.libs.utils.model_tools import queryset_iterator class Command(BaseCommand): help = ugettext_lazy("Import a folder of XForms for ODK.") def handle(self, *args, **kwargs): xforms = XForm.objects.all() total = xforms.count() count = 0 for xform in queryset_iterator(XForm.objects.all()): has_geo = xform.geocoded_submission_count() > 0 try: xform.instances_with_geopoints = has_geo xform.save() except Exception as e: self.stderr.write(e) else: count += 1 self.stdout.write("%d of %d forms processed." % (count, total))
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 13, 29937, 325, 326, 29901, 7468, 18696, 29922, 29946, 380, 29879, 29922, 29946, 634, 2381, 29922, 29946, 934, 22331, 29922, 9420, 29899, 29947, 13, 13, 3166, 9557, 29889, 3221, 29889, 21895, 29889, 3188, 1053, 7399, 6255, 13, 3166, 9557, 29889, 13239, 29889, 3286, 18411, 1053, 318, 657, 726, 29918, 433, 1537, 13, 13, 3166, 373, 7221, 29889, 13371, 29889, 21707, 29889, 9794, 29889, 29916, 689, 1053, 1060, 2500, 13, 3166, 373, 7221, 29889, 10254, 29889, 13239, 29889, 4299, 29918, 8504, 1053, 2346, 842, 29918, 17609, 13, 13, 13, 1990, 10516, 29898, 5160, 6255, 1125, 13, 1678, 1371, 353, 318, 657, 726, 29918, 433, 1537, 703, 17518, 263, 4138, 310, 1060, 12605, 363, 438, 17359, 23157, 13, 13, 1678, 822, 4386, 29898, 1311, 29892, 334, 5085, 29892, 3579, 19290, 1125, 13, 4706, 921, 9514, 353, 1060, 2500, 29889, 12650, 29889, 497, 580, 13, 4706, 3001, 353, 921, 9514, 29889, 2798, 580, 13, 4706, 2302, 353, 29871, 29900, 13, 4706, 363, 921, 689, 297, 2346, 842, 29918, 17609, 29898, 29990, 2500, 29889, 12650, 29889, 497, 580, 1125, 13, 9651, 756, 29918, 24756, 353, 921, 689, 29889, 479, 542, 6797, 29918, 1491, 6737, 29918, 2798, 580, 1405, 29871, 29900, 13, 9651, 1018, 29901, 13, 18884, 921, 689, 29889, 2611, 2925, 29918, 2541, 29918, 479, 459, 2461, 29879, 353, 756, 29918, 24756, 13, 18884, 921, 689, 29889, 7620, 580, 13, 9651, 5174, 8960, 408, 321, 29901, 13, 18884, 1583, 29889, 303, 20405, 29889, 3539, 29898, 29872, 29897, 13, 9651, 1683, 29901, 13, 18884, 2302, 4619, 29871, 29896, 13, 4706, 1583, 29889, 25393, 29889, 3539, 11702, 29881, 310, 1273, 29881, 7190, 19356, 1213, 1273, 313, 2798, 29892, 3001, 876, 13, 2 ]
bookings/views.py
nintran1995/python-example
0
180096
from django.shortcuts import render from django.http import HttpResponse from django.template import loader from .models import Boarding from django.http import HttpResponseRedirect from django.urls import reverse from django.views import generic class IndexView(generic.ListView): model = Boarding template_name = 'bookings/index.html' def search(request, boarding_zip_code, boarding_start, boarding_end, boarding_size): # selected_choice = question.choice_set.get(pk=request.POST['choice']) # return HttpResponse("You're looking at question %s." % boarding_zip_code) boardings = Boarding.objects.filter( size=boarding_size).order_by('-start_date')[:5] return render(request, 'bookings/search.html', { 'boardings': boardings, })
[ 1, 515, 9557, 29889, 12759, 7582, 29879, 1053, 4050, 13, 3166, 9557, 29889, 1124, 1053, 9056, 5103, 13, 3166, 9557, 29889, 6886, 1053, 23466, 13, 3166, 869, 9794, 1053, 12590, 292, 13, 3166, 9557, 29889, 1124, 1053, 9056, 5103, 24735, 13, 3166, 9557, 29889, 26045, 1053, 11837, 13, 3166, 9557, 29889, 7406, 1053, 10035, 13, 13, 13, 1990, 11374, 1043, 29898, 19206, 29889, 15660, 1125, 13, 1678, 1904, 353, 12590, 292, 13, 1678, 4472, 29918, 978, 353, 525, 2909, 886, 29914, 2248, 29889, 1420, 29915, 13, 13, 13, 1753, 2740, 29898, 3827, 29892, 7613, 292, 29918, 7554, 29918, 401, 29892, 7613, 292, 29918, 2962, 29892, 7613, 292, 29918, 355, 29892, 7613, 292, 29918, 2311, 1125, 13, 1678, 396, 4629, 29918, 16957, 353, 1139, 29889, 16957, 29918, 842, 29889, 657, 29898, 20571, 29922, 3827, 29889, 5438, 1839, 16957, 11287, 13, 1678, 396, 736, 9056, 5103, 703, 3492, 29915, 276, 3063, 472, 1139, 1273, 29879, 1213, 1273, 7613, 292, 29918, 7554, 29918, 401, 29897, 13, 1678, 7613, 886, 353, 12590, 292, 29889, 12650, 29889, 4572, 29898, 13, 4706, 2159, 29922, 3377, 292, 29918, 2311, 467, 2098, 29918, 1609, 877, 29899, 2962, 29918, 1256, 1495, 7503, 29945, 29962, 13, 1678, 736, 4050, 29898, 3827, 29892, 525, 2909, 886, 29914, 4478, 29889, 1420, 742, 426, 13, 4706, 525, 3377, 886, 2396, 7613, 886, 29892, 13, 1678, 5615, 13, 2 ]
trialbot/data/datasets/tabular_dataset.py
zxteloiv/TrialBot
3
1616063
from .file_dataset import FileDataset class TabSepFileDataset(FileDataset): def get_example(self, i): line = super(TabSepFileDataset, self).get_example(i) parts = line.rstrip('\r\n').split('\t') return tuple(parts)
[ 1, 515, 869, 1445, 29918, 24713, 1053, 3497, 16390, 24541, 13, 13, 1990, 11090, 29903, 1022, 2283, 16390, 24541, 29898, 2283, 16390, 24541, 1125, 13, 1678, 822, 679, 29918, 4773, 29898, 1311, 29892, 474, 1125, 13, 4706, 1196, 353, 2428, 29898, 8863, 29903, 1022, 2283, 16390, 24541, 29892, 1583, 467, 657, 29918, 4773, 29898, 29875, 29897, 13, 4706, 5633, 353, 1196, 29889, 29878, 17010, 28909, 29878, 29905, 29876, 2824, 5451, 28909, 29873, 1495, 13, 4706, 736, 18761, 29898, 20895, 29897, 13, 13, 13, 2 ]
custom_components/tastyigniter/binary_sensor.py
djtimca/hatastyigniter
0
111306
"""Definition and setup of the TastyIgniter Binary Sensors for Home Assistant.""" import logging import time from homeassistant.helpers.update_coordinator import ( CoordinatorEntity, DataUpdateCoordinator, UpdateFailed, ) from homeassistant.components.binary_sensor import BinarySensorEntity from homeassistant.const import ATTR_NAME from homeassistant.components.sensor import ENTITY_ID_FORMAT from . import TastyIgniterCoordinator from .const import ATTR_IDENTIFIERS, ATTR_MANUFACTURER, ATTR_MODEL, DOMAIN, COORDINATOR _LOGGER = logging.getLogger(__name__) async def async_setup_entry(hass, entry, async_add_entities): """Set up the binary sensor platforms.""" coordinator = hass.data[DOMAIN][entry.entry_id][COORDINATOR] sensors = [] for location in coordinator.data["locations"]: sensors.append( TastyIgniterSensor( coordinator, location, "mdi:food", "ti_location", ) ) async_add_entities(sensors) class TastyIgniterSensor(BinarySensorEntity): """Defines a TastyIgniter Binary sensor.""" def __init__( self, coordinator: TastyIgniterCoordinator, location: dict, icon: str, device_identifier: str, ): """Initialize Entities.""" self._name = f"TI - {location['location_name']}" self._location_id = location["location_id"] self._unique_id = f"ti_{self._location_id}" self._state = None self._icon = icon self._device_identifier = device_identifier self.coordinator = coordinator self._location = location self.attrs = {} @property def should_poll(self) -> bool: """No need to poll. Coordinator notifies entity of updates.""" return False @property def available(self) -> bool: """Return if entity is available.""" return self.coordinator.last_update_success @property def unique_id(self): """Return the unique Home Assistant friendly identifier for this entity.""" return self._unique_id @property def name(self): """Return the friendly name of this entity.""" return self._name @property def icon(self): """Return the icon for this entity.""" return self._icon @property def device_state_attributes(self): """Return the attributes.""" telephone = self._location["location_telephone"].replace("-","") telephone = telephone.replace(" ","") telephone = telephone.replace("(","") telephone = telephone.replace(")","") if len(telephone) == 10: telephone = f"+1{telephone}" else: telephone = "" self.attrs["phone"] = telephone return self.attrs @property def device_info(self): """Define the device based on device_identifier.""" device_name = "TastyIgniter" device_model = "Order Alerts" return { ATTR_IDENTIFIERS: {(DOMAIN, self._device_identifier)}, ATTR_NAME: device_name, ATTR_MANUFACTURER: "TastyIgniter", ATTR_MODEL: device_model, } @property def is_on(self) -> bool: """Return the state.""" order_data = self.coordinator.data["orders"] if order_data.get(self._location_id): return True else: return False async def async_update(self): """Update TastyIgniter Binary Sensor Entity.""" await self.coordinator.async_request_refresh() async def async_added_to_hass(self): """Subscribe to updates.""" self.async_on_remove( self.coordinator.async_add_listener(self.async_write_ha_state) )
[ 1, 9995, 14683, 322, 6230, 310, 278, 323, 579, 29891, 17273, 1524, 29479, 317, 575, 943, 363, 8778, 4007, 22137, 1213, 15945, 13, 13, 5215, 12183, 13, 5215, 931, 13, 13, 3166, 3271, 465, 22137, 29889, 3952, 6774, 29889, 5504, 29918, 1111, 4194, 1061, 1053, 313, 13, 1678, 3189, 4194, 1061, 6691, 29892, 13, 1678, 3630, 6422, 7967, 4194, 1061, 29892, 13, 1678, 10318, 17776, 29892, 13, 29897, 13, 3166, 3271, 465, 22137, 29889, 14036, 29889, 19541, 29918, 29879, 6073, 1053, 29479, 29903, 6073, 6691, 13, 3166, 3271, 465, 22137, 29889, 3075, 1053, 15531, 5659, 29918, 5813, 13, 3166, 3271, 465, 22137, 29889, 14036, 29889, 29879, 6073, 1053, 12524, 29911, 11937, 29918, 1367, 29918, 19094, 1299, 13, 3166, 869, 1053, 323, 579, 29891, 17273, 1524, 7967, 4194, 1061, 13, 3166, 869, 3075, 1053, 15531, 5659, 29918, 1367, 3919, 29902, 3738, 23598, 29892, 15531, 5659, 29918, 1529, 11601, 4519, 1783, 4574, 1001, 29892, 15531, 5659, 29918, 20387, 29931, 29892, 11662, 29032, 29892, 4810, 25593, 1177, 1299, 1955, 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, 6251, 29892, 7465, 29918, 1202, 29918, 296, 1907, 1125, 13, 1678, 9995, 2697, 701, 278, 7581, 23530, 21796, 1213, 15945, 13, 13, 1678, 6615, 1061, 353, 298, 465, 29889, 1272, 29961, 3970, 29032, 3816, 8269, 29889, 8269, 29918, 333, 3816, 3217, 25593, 1177, 1299, 1955, 29962, 13, 1678, 4771, 943, 353, 5159, 13, 13, 1678, 363, 4423, 297, 6615, 1061, 29889, 1272, 3366, 2029, 800, 3108, 29901, 13, 4706, 4771, 943, 29889, 4397, 29898, 13, 9651, 323, 579, 29891, 17273, 1524, 29903, 6073, 29898, 13, 18884, 6615, 1061, 29892, 13, 18884, 4423, 29892, 13, 18884, 376, 3487, 29875, 29901, 1181, 397, 613, 13, 18884, 376, 2034, 29918, 5479, 613, 13, 9651, 1723, 13, 4706, 1723, 13, 13, 1678, 7465, 29918, 1202, 29918, 296, 1907, 29898, 23149, 943, 29897, 13, 13, 13, 1990, 323, 579, 29891, 17273, 1524, 29903, 6073, 29898, 25196, 29903, 6073, 6691, 1125, 13, 1678, 9995, 3206, 1475, 263, 323, 579, 29891, 17273, 1524, 29479, 23530, 1213, 15945, 13, 13, 1678, 822, 4770, 2344, 12035, 13, 4706, 1583, 29892, 29871, 13, 4706, 6615, 1061, 29901, 323, 579, 29891, 17273, 1524, 7967, 4194, 1061, 29892, 29871, 13, 4706, 4423, 29901, 9657, 29892, 13, 4706, 9849, 29901, 851, 29892, 13, 4706, 4742, 29918, 25378, 29901, 851, 29892, 13, 308, 1125, 13, 4706, 9995, 6644, 6646, 4284, 1907, 1213, 15945, 13, 13, 4706, 1583, 3032, 978, 353, 285, 29908, 24301, 448, 426, 5479, 1839, 5479, 29918, 978, 2033, 5038, 13, 4706, 1583, 3032, 5479, 29918, 333, 353, 4423, 3366, 5479, 29918, 333, 3108, 13, 4706, 1583, 3032, 13092, 29918, 333, 353, 285, 29908, 2034, 648, 1311, 3032, 5479, 29918, 333, 5038, 13, 4706, 1583, 3032, 3859, 353, 6213, 13, 4706, 1583, 3032, 4144, 353, 9849, 13, 4706, 1583, 3032, 10141, 29918, 25378, 353, 4742, 29918, 25378, 13, 4706, 1583, 29889, 1111, 4194, 1061, 353, 6615, 1061, 13, 4706, 1583, 3032, 5479, 353, 4423, 13, 13, 4706, 1583, 29889, 5552, 29879, 353, 6571, 13, 13, 1678, 732, 6799, 13, 1678, 822, 881, 29918, 29886, 3028, 29898, 1311, 29897, 1599, 6120, 29901, 13, 4706, 9995, 3782, 817, 304, 21180, 29889, 3189, 4194, 1061, 451, 11057, 7855, 310, 11217, 1213, 15945, 13, 4706, 736, 7700, 13, 13, 1678, 732, 6799, 13, 1678, 822, 3625, 29898, 1311, 29897, 1599, 6120, 29901, 13, 4706, 9995, 11609, 565, 7855, 338, 3625, 1213, 15945, 13, 4706, 736, 1583, 29889, 1111, 4194, 1061, 29889, 4230, 29918, 5504, 29918, 8698, 13, 13, 1678, 732, 6799, 13, 1678, 822, 5412, 29918, 333, 29898, 1311, 1125, 13, 4706, 9995, 11609, 278, 5412, 8778, 4007, 22137, 19780, 15882, 363, 445, 7855, 1213, 15945, 13, 4706, 736, 1583, 3032, 13092, 29918, 333, 13, 13, 1678, 732, 6799, 13, 1678, 822, 1024, 29898, 1311, 1125, 13, 4706, 9995, 11609, 278, 19780, 1024, 310, 445, 7855, 1213, 15945, 13, 4706, 736, 1583, 3032, 978, 13, 13, 1678, 732, 6799, 13, 1678, 822, 9849, 29898, 1311, 1125, 13, 4706, 9995, 11609, 278, 9849, 363, 445, 7855, 1213, 15945, 13, 4706, 736, 1583, 3032, 4144, 13, 13, 1678, 732, 6799, 13, 1678, 822, 4742, 29918, 3859, 29918, 15697, 29898, 1311, 1125, 13, 4706, 9995, 11609, 278, 8393, 1213, 15945, 13, 4706, 4382, 6710, 353, 1583, 3032, 5479, 3366, 5479, 29918, 15494, 6710, 16862, 6506, 703, 29899, 3284, 1159, 13, 4706, 4382, 6710, 353, 4382, 6710, 29889, 6506, 703, 28796, 1159, 13, 4706, 4382, 6710, 353, 4382, 6710, 29889, 6506, 703, 29898, 3284, 1159, 13, 4706, 4382, 6710, 353, 4382, 6710, 29889, 6506, 703, 29897, 3284, 1159, 13, 4706, 565, 7431, 29898, 15494, 6710, 29897, 1275, 29871, 29896, 29900, 29901, 13, 9651, 4382, 6710, 353, 285, 17969, 29896, 29912, 15494, 6710, 5038, 13, 4706, 1683, 29901, 13, 9651, 4382, 6710, 353, 5124, 13, 13, 4706, 1583, 29889, 5552, 29879, 3366, 6710, 3108, 353, 4382, 6710, 13, 13, 4706, 736, 1583, 29889, 5552, 29879, 13, 13, 1678, 732, 6799, 13, 1678, 822, 4742, 29918, 3888, 29898, 1311, 1125, 13, 4706, 9995, 3206, 457, 278, 4742, 2729, 373, 4742, 29918, 25378, 1213, 15945, 13, 13, 4706, 4742, 29918, 978, 353, 376, 29911, 579, 29891, 17273, 1524, 29908, 13, 4706, 4742, 29918, 4299, 353, 376, 7514, 28861, 29879, 29908, 13, 13, 4706, 736, 426, 13, 9651, 15531, 5659, 29918, 1367, 3919, 29902, 3738, 23598, 29901, 426, 29898, 3970, 29032, 29892, 1583, 3032, 10141, 29918, 25378, 19230, 13, 9651, 15531, 5659, 29918, 5813, 29901, 4742, 29918, 978, 29892, 13, 9651, 15531, 5659, 29918, 1529, 11601, 4519, 1783, 4574, 1001, 29901, 376, 29911, 579, 29891, 17273, 1524, 613, 13, 9651, 15531, 5659, 29918, 20387, 29931, 29901, 4742, 29918, 4299, 29892, 13, 4706, 500, 13, 13, 1678, 732, 6799, 13, 1678, 822, 338, 29918, 265, 29898, 1311, 29897, 1599, 6120, 29901, 13, 4706, 9995, 11609, 278, 2106, 1213, 15945, 13, 4706, 1797, 29918, 1272, 353, 1583, 29889, 1111, 4194, 1061, 29889, 1272, 3366, 20488, 3108, 13, 308, 13, 4706, 565, 1797, 29918, 1272, 29889, 657, 29898, 1311, 3032, 5479, 29918, 333, 1125, 13, 9651, 736, 5852, 13, 4706, 1683, 29901, 13, 9651, 736, 7700, 13, 13, 1678, 7465, 822, 7465, 29918, 5504, 29898, 1311, 1125, 13, 4706, 9995, 6422, 323, 579, 29891, 17273, 1524, 29479, 317, 6073, 14945, 1213, 15945, 13, 4706, 7272, 1583, 29889, 1111, 4194, 1061, 29889, 12674, 29918, 3827, 29918, 22379, 580, 13, 308, 13, 1678, 7465, 822, 7465, 29918, 23959, 29918, 517, 29918, 29882, 465, 29898, 1311, 1125, 13, 4706, 9995, 4035, 13086, 304, 11217, 1213, 15945, 13, 4706, 1583, 29889, 12674, 29918, 265, 29918, 5992, 29898, 13, 9651, 1583, 29889, 1111, 4194, 1061, 29889, 12674, 29918, 1202, 29918, 25894, 29898, 1311, 29889, 12674, 29918, 3539, 29918, 2350, 29918, 3859, 29897, 13, 4706, 1723, 13, 2 ]
poetry/console/commands/self/update.py
mgasner/poetry
0
7786
<reponame>mgasner/poetry<gh_stars>0 import hashlib import os import shutil import subprocess import sys import tarfile from functools import cmp_to_key from gzip import GzipFile try: from urllib.error import HTTPError from urllib.request import urlopen except ImportError: from urllib2 import HTTPError from urllib2 import urlopen from cleo import argument from cleo import option from ..command import Command class SelfUpdateCommand(Command): name = "update" description = "Updates poetry to the latest version." arguments = [argument("version", "The version to update to.", optional=True)] options = [option("preview", None, "Install prereleases.")] BASE_URL = "https://github.com/sdispater/poetry/releases/download" @property def home(self): from poetry.utils._compat import Path from poetry.utils.appdirs import expanduser home = Path(expanduser("~")) return home / ".poetry" @property def lib(self): return self.home / "lib" @property def lib_backup(self): return self.home / "lib-backup" def handle(self): from poetry.__version__ import __version__ from poetry.repositories.pypi_repository import PyPiRepository from poetry.semver import Version from poetry.utils._compat import Path current = Path(__file__) try: current.relative_to(self.home) except ValueError: raise RuntimeError( "Poetry was not installed with the recommended installer. " "Cannot update automatically." ) version = self.argument("version") if not version: version = ">=" + __version__ repo = PyPiRepository(fallback=False) packages = repo.find_packages( "poetry", version, allow_prereleases=self.option("preview") ) if not packages: self.line("No release found for the specified version") return packages.sort( key=cmp_to_key( lambda x, y: 0 if x.version == y.version else int(x.version < y.version or -1) ) ) release = None for package in packages: if package.is_prerelease(): if self.option("preview"): release = package break continue release = package break if release is None: self.line("No new release found") return if release.version == Version.parse(__version__): self.line("You are using the latest version") return self.update(release) def update(self, release): version = release.version self.line("Updating to <info>{}</info>".format(version)) if self.lib_backup.exists(): shutil.rmtree(str(self.lib_backup)) # Backup the current installation if self.lib.exists(): shutil.copytree(str(self.lib), str(self.lib_backup)) shutil.rmtree(str(self.lib)) try: self._update(version) except Exception: if not self.lib_backup.exists(): raise shutil.copytree(str(self.lib_backup), str(self.lib)) shutil.rmtree(str(self.lib_backup)) raise finally: if self.lib_backup.exists(): shutil.rmtree(str(self.lib_backup)) self.line("") self.line("") self.line( "<info>Poetry</info> (<comment>{}</comment>) is installed now. Great!".format( version ) ) def _update(self, version): from poetry.utils.helpers import temporary_directory platform = sys.platform if platform == "linux2": platform = "linux" checksum = "poetry-{}-{}.sha256sum".format(version, platform) try: r = urlopen(self.BASE_URL + "/{}/{}".format(version, checksum)) except HTTPError as e: if e.code == 404: raise RuntimeError("Could not find {} file".format(checksum)) raise checksum = r.read().decode() # We get the payload from the remote host name = "poetry-{}-{}.tar.gz".format(version, platform) try: r = urlopen(self.BASE_URL + "/{}/{}".format(version, name)) except HTTPError as e: if e.code == 404: raise RuntimeError("Could not find {} file".format(name)) raise meta = r.info() size = int(meta["Content-Length"]) current = 0 block_size = 8192 bar = self.progress_bar(max=size) bar.set_format(" - Downloading <info>{}</> <comment>%percent%%</>".format(name)) bar.start() sha = hashlib.sha256() with temporary_directory(prefix="poetry-updater-") as dir_: tar = os.path.join(dir_, name) with open(tar, "wb") as f: while True: buffer = r.read(block_size) if not buffer: break current += len(buffer) f.write(buffer) sha.update(buffer) bar.set_progress(current) bar.finish() # Checking hashes if checksum != sha.hexdigest(): raise RuntimeError( "Hashes for {} do not match: {} != {}".format( name, checksum, sha.hexdigest() ) ) gz = GzipFile(tar, mode="rb") try: with tarfile.TarFile(tar, fileobj=gz, format=tarfile.PAX_FORMAT) as f: f.extractall(str(self.lib)) finally: gz.close() def process(self, *args): return subprocess.check_output(list(args), stderr=subprocess.STDOUT) def _bin_path(self, base_path, bin): if sys.platform == "win32": return (base_path / "Scripts" / bin).with_suffix(".exe") return base_path / "bin" / bin
[ 1, 529, 276, 1112, 420, 29958, 29885, 25496, 1089, 29914, 1129, 27184, 29966, 12443, 29918, 303, 1503, 29958, 29900, 13, 5215, 6608, 1982, 13, 5215, 2897, 13, 5215, 528, 4422, 13, 5215, 1014, 5014, 13, 5215, 10876, 13, 5215, 9913, 1445, 13, 13, 3166, 2090, 312, 8789, 1053, 274, 1526, 29918, 517, 29918, 1989, 13, 3166, 330, 7554, 1053, 402, 7554, 2283, 13, 13, 2202, 29901, 13, 1678, 515, 3142, 1982, 29889, 2704, 1053, 7331, 2392, 13, 1678, 515, 3142, 1982, 29889, 3827, 1053, 5065, 417, 2238, 13, 19499, 16032, 2392, 29901, 13, 1678, 515, 3142, 1982, 29906, 1053, 7331, 2392, 13, 1678, 515, 3142, 1982, 29906, 1053, 5065, 417, 2238, 13, 13, 3166, 4531, 29877, 1053, 2980, 13, 3166, 4531, 29877, 1053, 2984, 13, 13, 3166, 6317, 6519, 1053, 10516, 13, 13, 13, 1990, 21782, 6422, 6255, 29898, 6255, 1125, 13, 13, 1678, 1024, 353, 376, 5504, 29908, 13, 1678, 6139, 353, 376, 3373, 15190, 22309, 304, 278, 9281, 1873, 1213, 13, 13, 1678, 6273, 353, 518, 23516, 703, 3259, 613, 376, 1576, 1873, 304, 2767, 304, 19602, 13136, 29922, 5574, 4638, 13, 1678, 3987, 353, 518, 3385, 703, 25347, 613, 6213, 29892, 376, 23271, 544, 406, 17836, 29889, 13531, 13, 13, 1678, 350, 8127, 29918, 4219, 353, 376, 991, 597, 3292, 29889, 510, 29914, 29879, 2218, 29886, 1008, 29914, 1129, 27184, 29914, 276, 17836, 29914, 10382, 29908, 13, 13, 1678, 732, 6799, 13, 1678, 822, 3271, 29898, 1311, 1125, 13, 4706, 515, 22309, 29889, 13239, 3032, 12667, 1053, 10802, 13, 4706, 515, 22309, 29889, 13239, 29889, 932, 3972, 29879, 1053, 7985, 1792, 13, 13, 4706, 3271, 353, 10802, 29898, 18837, 1792, 703, 30022, 5783, 13, 13, 4706, 736, 3271, 847, 11393, 1129, 27184, 29908, 13, 13, 1678, 732, 6799, 13, 1678, 822, 4303, 29898, 1311, 1125, 13, 4706, 736, 1583, 29889, 5184, 847, 376, 1982, 29908, 13, 13, 1678, 732, 6799, 13, 1678, 822, 4303, 29918, 1627, 786, 29898, 1311, 1125, 13, 4706, 736, 1583, 29889, 5184, 847, 376, 1982, 29899, 1627, 786, 29908, 13, 13, 1678, 822, 4386, 29898, 1311, 1125, 13, 4706, 515, 22309, 17255, 3259, 1649, 1053, 4770, 3259, 1649, 13, 4706, 515, 22309, 29889, 276, 1066, 20106, 29889, 29886, 1478, 29875, 29918, 19033, 1053, 10772, 12197, 11481, 13, 4706, 515, 22309, 29889, 12846, 369, 1053, 10079, 13, 4706, 515, 22309, 29889, 13239, 3032, 12667, 1053, 10802, 13, 13, 4706, 1857, 353, 10802, 22168, 1445, 1649, 29897, 13, 4706, 1018, 29901, 13, 9651, 1857, 29889, 22925, 29918, 517, 29898, 1311, 29889, 5184, 29897, 13, 4706, 5174, 7865, 2392, 29901, 13, 9651, 12020, 24875, 2392, 29898, 13, 18884, 376, 9837, 27184, 471, 451, 5130, 411, 278, 13622, 27786, 29889, 376, 13, 18884, 376, 29089, 2767, 6336, 1213, 13, 9651, 1723, 13, 13, 4706, 1873, 353, 1583, 29889, 23516, 703, 3259, 1159, 13, 4706, 565, 451, 1873, 29901, 13, 9651, 1873, 353, 376, 29958, 543, 718, 4770, 3259, 1649, 13, 13, 4706, 13761, 353, 10772, 12197, 11481, 29898, 11950, 1627, 29922, 8824, 29897, 13, 4706, 9741, 353, 13761, 29889, 2886, 29918, 8318, 29898, 13, 9651, 376, 1129, 27184, 613, 1873, 29892, 2758, 29918, 558, 406, 17836, 29922, 1311, 29889, 3385, 703, 25347, 1159, 13, 4706, 1723, 13, 4706, 565, 451, 9741, 29901, 13, 9651, 1583, 29889, 1220, 703, 3782, 6507, 1476, 363, 278, 6790, 1873, 1159, 13, 9651, 736, 13, 13, 4706, 9741, 29889, 6605, 29898, 13, 9651, 1820, 29922, 21058, 29918, 517, 29918, 1989, 29898, 13, 18884, 14013, 921, 29892, 343, 29901, 29871, 29900, 13, 18884, 565, 921, 29889, 3259, 1275, 343, 29889, 3259, 13, 18884, 1683, 938, 29898, 29916, 29889, 3259, 529, 343, 29889, 3259, 470, 448, 29896, 29897, 13, 9651, 1723, 13, 4706, 1723, 13, 13, 4706, 6507, 353, 6213, 13, 4706, 363, 3577, 297, 9741, 29901, 13, 9651, 565, 3577, 29889, 275, 29918, 558, 406, 1511, 7295, 13, 18884, 565, 1583, 29889, 3385, 703, 25347, 29908, 1125, 13, 462, 1678, 6507, 353, 3577, 13, 13, 462, 1678, 2867, 13, 13, 18884, 6773, 13, 13, 9651, 6507, 353, 3577, 13, 13, 9651, 2867, 13, 13, 4706, 565, 6507, 338, 6213, 29901, 13, 9651, 1583, 29889, 1220, 703, 3782, 716, 6507, 1476, 1159, 13, 9651, 736, 13, 13, 4706, 565, 6507, 29889, 3259, 1275, 10079, 29889, 5510, 22168, 3259, 1649, 1125, 13, 9651, 1583, 29889, 1220, 703, 3492, 526, 773, 278, 9281, 1873, 1159, 13, 9651, 736, 13, 13, 4706, 1583, 29889, 5504, 29898, 14096, 29897, 13, 13, 1678, 822, 2767, 29898, 1311, 29892, 6507, 1125, 13, 4706, 1873, 353, 6507, 29889, 3259, 13, 4706, 1583, 29889, 1220, 703, 3373, 26747, 304, 529, 3888, 29958, 8875, 829, 3888, 29958, 1642, 4830, 29898, 3259, 876, 13, 13, 4706, 565, 1583, 29889, 1982, 29918, 1627, 786, 29889, 9933, 7295, 13, 9651, 528, 4422, 29889, 1758, 8336, 29898, 710, 29898, 1311, 29889, 1982, 29918, 1627, 786, 876, 13, 13, 4706, 396, 7437, 786, 278, 1857, 11161, 13, 4706, 565, 1583, 29889, 1982, 29889, 9933, 7295, 13, 9651, 528, 4422, 29889, 8552, 8336, 29898, 710, 29898, 1311, 29889, 1982, 511, 851, 29898, 1311, 29889, 1982, 29918, 1627, 786, 876, 13, 9651, 528, 4422, 29889, 1758, 8336, 29898, 710, 29898, 1311, 29889, 1982, 876, 13, 13, 4706, 1018, 29901, 13, 9651, 1583, 3032, 5504, 29898, 3259, 29897, 13, 4706, 5174, 8960, 29901, 13, 9651, 565, 451, 1583, 29889, 1982, 29918, 1627, 786, 29889, 9933, 7295, 13, 18884, 12020, 13, 13, 9651, 528, 4422, 29889, 8552, 8336, 29898, 710, 29898, 1311, 29889, 1982, 29918, 1627, 786, 511, 851, 29898, 1311, 29889, 1982, 876, 13, 9651, 528, 4422, 29889, 1758, 8336, 29898, 710, 29898, 1311, 29889, 1982, 29918, 1627, 786, 876, 13, 13, 9651, 12020, 13, 4706, 7146, 29901, 13, 9651, 565, 1583, 29889, 1982, 29918, 1627, 786, 29889, 9933, 7295, 13, 18884, 528, 4422, 29889, 1758, 8336, 29898, 710, 29898, 1311, 29889, 1982, 29918, 1627, 786, 876, 13, 13, 4706, 1583, 29889, 1220, 703, 1159, 13, 4706, 1583, 29889, 1220, 703, 1159, 13, 4706, 1583, 29889, 1220, 29898, 13, 9651, 9872, 3888, 29958, 9837, 27184, 829, 3888, 29958, 313, 29966, 9342, 29958, 8875, 829, 9342, 12948, 338, 5130, 1286, 29889, 7027, 29991, 1642, 4830, 29898, 13, 18884, 1873, 13, 9651, 1723, 13, 4706, 1723, 13, 13, 1678, 822, 903, 5504, 29898, 1311, 29892, 1873, 1125, 13, 4706, 515, 22309, 29889, 13239, 29889, 3952, 6774, 1053, 13201, 29918, 12322, 13, 13, 4706, 7481, 353, 10876, 29889, 12120, 13, 4706, 565, 7481, 1275, 376, 9389, 29906, 1115, 13, 9651, 7481, 353, 376, 9389, 29908, 13, 13, 4706, 1423, 2083, 353, 376, 1129, 27184, 29899, 29912, 7402, 29912, 1836, 17051, 29906, 29945, 29953, 2083, 1642, 4830, 29898, 3259, 29892, 7481, 29897, 13, 13, 4706, 1018, 29901, 13, 9651, 364, 353, 5065, 417, 2238, 29898, 1311, 29889, 25416, 29918, 4219, 718, 5591, 29912, 6822, 8875, 1642, 4830, 29898, 3259, 29892, 1423, 2083, 876, 13, 4706, 5174, 7331, 2392, 408, 321, 29901, 13, 9651, 565, 321, 29889, 401, 1275, 29871, 29946, 29900, 29946, 29901, 13, 18884, 12020, 24875, 2392, 703, 23323, 451, 1284, 6571, 934, 1642, 4830, 29898, 3198, 2083, 876, 13, 13, 9651, 12020, 13, 13, 4706, 1423, 2083, 353, 364, 29889, 949, 2141, 13808, 580, 13, 13, 4706, 396, 1334, 679, 278, 20092, 515, 278, 7592, 3495, 13, 4706, 1024, 353, 376, 1129, 27184, 29899, 29912, 7402, 29912, 1836, 12637, 29889, 18828, 1642, 4830, 29898, 3259, 29892, 7481, 29897, 13, 4706, 1018, 29901, 13, 9651, 364, 353, 5065, 417, 2238, 29898, 1311, 29889, 25416, 29918, 4219, 718, 5591, 29912, 6822, 8875, 1642, 4830, 29898, 3259, 29892, 1024, 876, 13, 4706, 5174, 7331, 2392, 408, 321, 29901, 13, 9651, 565, 321, 29889, 401, 1275, 29871, 29946, 29900, 29946, 29901, 13, 18884, 12020, 24875, 2392, 703, 23323, 451, 1284, 6571, 934, 1642, 4830, 29898, 978, 876, 13, 13, 9651, 12020, 13, 13, 4706, 12700, 353, 364, 29889, 3888, 580, 13, 4706, 2159, 353, 938, 29898, 7299, 3366, 3916, 29899, 6513, 20068, 13, 4706, 1857, 353, 29871, 29900, 13, 4706, 2908, 29918, 2311, 353, 29871, 29947, 29896, 29929, 29906, 13, 13, 4706, 2594, 353, 1583, 29889, 18035, 29918, 1646, 29898, 3317, 29922, 2311, 29897, 13, 4706, 2594, 29889, 842, 29918, 4830, 703, 448, 9943, 13234, 529, 3888, 29958, 8875, 829, 29958, 529, 9342, 29958, 29995, 25376, 7686, 829, 29958, 1642, 4830, 29898, 978, 876, 13, 4706, 2594, 29889, 2962, 580, 13, 13, 4706, 528, 29874, 353, 6608, 1982, 29889, 17051, 29906, 29945, 29953, 580, 13, 4706, 411, 13201, 29918, 12322, 29898, 13506, 543, 1129, 27184, 29899, 786, 29881, 1008, 29899, 1159, 408, 4516, 29918, 29901, 13, 9651, 9913, 353, 2897, 29889, 2084, 29889, 7122, 29898, 3972, 3383, 1024, 29897, 13, 9651, 411, 1722, 29898, 12637, 29892, 376, 29893, 29890, 1159, 408, 285, 29901, 13, 18884, 1550, 5852, 29901, 13, 462, 1678, 6835, 353, 364, 29889, 949, 29898, 1271, 29918, 2311, 29897, 13, 462, 1678, 565, 451, 6835, 29901, 13, 462, 4706, 2867, 13, 13, 462, 1678, 1857, 4619, 7431, 29898, 9040, 29897, 13, 462, 1678, 285, 29889, 3539, 29898, 9040, 29897, 13, 462, 1678, 528, 29874, 29889, 5504, 29898, 9040, 29897, 13, 13, 462, 1678, 2594, 29889, 842, 29918, 18035, 29898, 3784, 29897, 13, 13, 9651, 2594, 29889, 4951, 728, 580, 13, 13, 9651, 396, 5399, 292, 6608, 267, 13, 9651, 565, 1423, 2083, 2804, 528, 29874, 29889, 20970, 7501, 342, 7295, 13, 18884, 12020, 24875, 2392, 29898, 13, 462, 1678, 376, 10438, 267, 363, 6571, 437, 451, 1993, 29901, 6571, 2804, 6571, 1642, 4830, 29898, 13, 462, 4706, 1024, 29892, 1423, 2083, 29892, 528, 29874, 29889, 20970, 7501, 342, 580, 13, 462, 1678, 1723, 13, 18884, 1723, 13, 13, 9651, 330, 29920, 353, 402, 7554, 2283, 29898, 12637, 29892, 4464, 543, 6050, 1159, 13, 9651, 1018, 29901, 13, 18884, 411, 9913, 1445, 29889, 29911, 279, 2283, 29898, 12637, 29892, 934, 5415, 29922, 18828, 29892, 3402, 29922, 12637, 1445, 29889, 29925, 6604, 29918, 19094, 1299, 29897, 408, 285, 29901, 13, 462, 1678, 285, 29889, 21111, 497, 29898, 710, 29898, 1311, 29889, 1982, 876, 13, 9651, 7146, 29901, 13, 18884, 330, 29920, 29889, 5358, 580, 13, 13, 1678, 822, 1889, 29898, 1311, 29892, 334, 5085, 1125, 13, 4706, 736, 1014, 5014, 29889, 3198, 29918, 4905, 29898, 1761, 29898, 5085, 511, 380, 20405, 29922, 1491, 5014, 29889, 1254, 3970, 2692, 29897, 13, 13, 1678, 822, 903, 2109, 29918, 2084, 29898, 1311, 29892, 2967, 29918, 2084, 29892, 9016, 1125, 13, 4706, 565, 10876, 29889, 12120, 1275, 376, 5080, 29941, 29906, 1115, 13, 9651, 736, 313, 3188, 29918, 2084, 847, 376, 4081, 29879, 29908, 847, 9016, 467, 2541, 29918, 2146, 600, 861, 17350, 8097, 1159, 13, 13, 4706, 736, 2967, 29918, 2084, 847, 376, 2109, 29908, 847, 9016, 13, 2 ]
Backend/models/risklayerPrognosis.py
dbvis-ukon/coronavis
15
6542
from db import db class RisklayerPrognosis(db.Model): __tablename__ = 'risklayer_prognosis' datenbestand = db.Column(db.TIMESTAMP, primary_key=True, nullable=False) prognosis = db.Column(db.Float, nullable=False) # class RisklayerPrognosisSchema(SQLAlchemyAutoSchema): # class Meta: # strict = True # model = RisklayerPrognosis # # timestamp = fields.Timestamp(data_key="datenbestand") # prognosis = fields.Number(data_key="prognosis")
[ 1, 515, 4833, 1053, 4833, 13, 13, 13, 1990, 390, 3873, 13148, 1184, 5138, 19263, 29898, 2585, 29889, 3195, 1125, 13, 1678, 4770, 3891, 2435, 420, 1649, 353, 525, 3780, 6321, 2747, 29918, 771, 5138, 19263, 29915, 13, 13, 1678, 1418, 264, 13318, 392, 353, 4833, 29889, 4409, 29898, 2585, 29889, 15307, 1254, 19297, 29892, 7601, 29918, 1989, 29922, 5574, 29892, 1870, 519, 29922, 8824, 29897, 13, 1678, 410, 5138, 19263, 353, 4833, 29889, 4409, 29898, 2585, 29889, 11031, 29892, 1870, 519, 29922, 8824, 29897, 13, 13, 29937, 770, 390, 3873, 13148, 1184, 5138, 19263, 12763, 29898, 4176, 2499, 305, 6764, 12300, 12763, 1125, 13, 29937, 268, 770, 20553, 29901, 13, 29937, 308, 9406, 353, 5852, 13, 29937, 308, 1904, 353, 390, 3873, 13148, 1184, 5138, 19263, 13, 29937, 13, 29937, 14334, 353, 4235, 29889, 27939, 29898, 1272, 29918, 1989, 543, 10207, 13318, 392, 1159, 13, 29937, 268, 410, 5138, 19263, 353, 4235, 29889, 4557, 29898, 1272, 29918, 1989, 543, 771, 5138, 19263, 1159, 13, 2 ]
falkon/kernels/distance_kernel.py
vishalbelsare/falkon
130
91717
from typing import Union, Optional, Dict import torch from falkon import sparse from falkon.kernels.diff_kernel import DiffKernel from falkon.la_helpers.square_norm_fn import square_norm_diff from falkon.options import FalkonOptions from falkon.sparse import SparseTensor SQRT3 = 1.7320508075688772 SQRT5 = 2.23606797749979 def validate_sigma(sigma: Union[float, torch.Tensor]) -> torch.Tensor: if isinstance(sigma, torch.Tensor): # Sigma is a 1-item tensor ('single') try: sigma.item() return sigma except ValueError: pass # Sigma is a vector ('diag') if sigma.dim() == 1 or sigma.shape[1] == 1: return sigma.reshape(-1) else: # TODO: Better error raise ValueError("sigma must be a scalar or a vector.") else: try: return torch.tensor([float(sigma)], dtype=torch.float64) except TypeError: raise TypeError("Sigma must be a scalar or a tensor.") def _sq_dist(mat1, mat2, norm_mat1, norm_mat2, out: Optional[torch.Tensor]) -> torch.Tensor: if mat1.dim() == 3: if out is None: out = torch.baddbmm(norm_mat1, mat1, mat2.transpose(-2, -1), alpha=-2, beta=1) # b*n*m else: out = torch.baddbmm(norm_mat1, mat1, mat2.transpose(-2, -1), alpha=-2, beta=1, out=out) # b*n*m else: if out is None: out = torch.addmm(norm_mat1, mat1, mat2.transpose(-2, -1), alpha=-2, beta=1) # n*m else: out = torch.addmm(norm_mat1, mat1, mat2.transpose(-2, -1), alpha=-2, beta=1, out=out) # n*m out.add_(norm_mat2.transpose(-2, -1)) out.clamp_min_(1e-20) return out def _sparse_sq_dist(X1_csr: SparseTensor, X2_csr: SparseTensor, X1: SparseTensor, X2: SparseTensor, out: torch.Tensor) -> torch.Tensor: sq1 = torch.empty(X1_csr.size(0), dtype=X1_csr.dtype, device=X1_csr.device) sparse.sparse_square_norm(X1_csr, sq1) # TODO: This must be implemented for CUDA tensors sq1 = sq1.reshape(-1, 1) sq2 = torch.empty(X2_csr.size(0), dtype=X2_csr.dtype, device=X2_csr.device) sparse.sparse_square_norm(X2_csr, sq2) sq2 = sq2.reshape(-1, 1) sparse.sparse_matmul(X1, X2, out) out.mul_(-2.0) out.add_(sq1.to(device=X1.device)) out.add_(sq2.to(device=X2.device).t()) out.clamp_min_(1e-20) return out def rbf_core(mat1, mat2, out: Optional[torch.Tensor], sigma): """ Note 1: if out is None, then this function will be differentiable wrt all three remaining inputs. Note 2: this function can deal with batched inputs Parameters ---------- sigma mat1 mat2 out Returns ------- """ mat1_div_sig = mat1 / sigma mat2_div_sig = mat2 / sigma norm_sq_mat1 = square_norm_diff(mat1_div_sig, -1, True) # b*n*1 or n*1 norm_sq_mat2 = square_norm_diff(mat2_div_sig, -1, True) # b*m*1 or m*1 out = _sq_dist(mat1_div_sig, mat2_div_sig, norm_sq_mat1, norm_sq_mat2, out) out.mul_(-0.5) out.exp_() return out def rbf_core_sparse(mat1: SparseTensor, mat2: SparseTensor, mat1_csr: SparseTensor, mat2_csr: SparseTensor, out: torch.Tensor, sigma) -> torch.Tensor: gamma = 0.5 / (sigma ** 2) out = _sparse_sq_dist(X1_csr=mat1_csr, X2_csr=mat2_csr, X1=mat1, X2=mat2, out=out) out.mul_(-gamma) out.exp_() return out def laplacian_core(mat1, mat2, out: Optional[torch.Tensor], sigma): mat1_div_sig = mat1 / sigma mat2_div_sig = mat2 / sigma norm_sq_mat1 = square_norm_diff(mat1_div_sig, -1, True) # b*n*1 norm_sq_mat2 = square_norm_diff(mat2_div_sig, -1, True) # b*m*1 orig_out = out out = _sq_dist(mat1_div_sig, mat2_div_sig, norm_sq_mat1, norm_sq_mat2, out) out.sqrt_() # Laplacian: sqrt of squared-difference # The gradient calculation needs the output of sqrt_ if orig_out is None: # TODO: We could be more explicit in the parameters about whether the gradient is or isn't needed out = out.neg() else: out.neg_() out.exp_() return out def laplacian_core_sparse(mat1: SparseTensor, mat2: SparseTensor, mat1_csr: SparseTensor, mat2_csr: SparseTensor, out: torch.Tensor, sigma) -> torch.Tensor: gamma = 1 / sigma out = _sparse_sq_dist(X1_csr=mat1_csr, X2_csr=mat2_csr, X1=mat1, X2=mat2, out=out) out.sqrt_() out.mul_(-gamma) out.exp_() return out def matern_core(mat1, mat2, out: Optional[torch.Tensor], sigma, nu): if nu == 0.5: return laplacian_core(mat1, mat2, out, sigma) elif nu == float('inf'): return rbf_core(mat1, mat2, out, sigma) orig_out = out mat1_div_sig = mat1 / sigma mat2_div_sig = mat2 / sigma norm_sq_mat1 = square_norm_diff(mat1_div_sig, -1, True) # b*n*1 norm_sq_mat2 = square_norm_diff(mat2_div_sig, -1, True) # b*m*1 out = _sq_dist(mat1_div_sig, mat2_div_sig, norm_sq_mat1, norm_sq_mat2, out) if nu == 1.5: # (1 + sqrt(3)*D) * exp(-sqrt(3)*D)) out.sqrt_() if orig_out is None: # TODO: We could be more explicit in the parameters about whether the gradient is or isn't needed out = out.mul(SQRT3) else: out.mul_(SQRT3) out_neg = torch.neg(out) # extra n*m block out_neg.exp_() out.add_(1.0).mul_(out_neg) elif nu == 2.5: # (1 + sqrt(5)*D + (sqrt(5)*D)^2 / 3 ) * exp(-sqrt(5)*D) out_sqrt = torch.sqrt(out) if orig_out is None: # TODO: We could be more explicit in the parameters about whether the gradient is or isn't needed out_sqrt = out_sqrt.mul(SQRT5) else: out_sqrt.mul_(SQRT5) out.mul_(5.0 / 3.0).add_(out_sqrt).add_(1.0) out_sqrt.neg_().exp_() out.mul_(out_sqrt) return out def matern_core_sparse(mat1: SparseTensor, mat2: SparseTensor, mat1_csr: SparseTensor, mat2_csr: SparseTensor, out: torch.Tensor, sigma, nu) -> torch.Tensor: if nu == 0.5: return laplacian_core_sparse(mat1, mat2, mat1_csr, mat2_csr, out, sigma) elif nu == float('inf'): return rbf_core_sparse(mat1, mat2, mat1_csr, mat2_csr, out, sigma) gamma = 1 / (sigma ** 2) out = _sparse_sq_dist(X1_csr=mat1_csr, X2_csr=mat2_csr, X1=mat1, X2=mat2, out=out) out.mul_(gamma) # For certain nu = 1.5, 2.5 we will need an extra n*m block if nu == 1.5: # (1 + sqrt(3)*D) * exp(-sqrt(3)*D)) out.sqrt_() out.mul_(SQRT3) out_neg = torch.neg(out) out_neg.exp_() out.add_(1.0).mul_(out_neg) elif nu == 2.5: # (1 + sqrt(5)*D + (sqrt(5)*D)^2 / 3 ) * exp(-sqrt(5)*D) out_sqrt = torch.sqrt(out) out_sqrt.mul_(SQRT5) out.mul_(5.0 / 3.0).add_(out_sqrt).add_(1.0) out_sqrt.neg_().exp_() out.mul_(out_sqrt) return out class GaussianKernel(DiffKernel): r"""Class for computing the Gaussian kernel and related kernel-vector products The Gaussian kernel is one of the most common and effective kernel embeddings since it is infinite dimensional, and governed by a single parameter. The kernel length-scale determines the width of the Gaussian distribution which is placed on top of each point. A larger sigma corresponds to a wide Gaussian, so that the relative influence of far away points will be high for computing the kernel at a given datum. On the opposite side of the spectrum, a small sigma means that only nearby points will influence the kernel. Parameters ----------- sigma The length-scale of the kernel. This can be a scalar, and then it corresponds to the standard deviation of the Gaussian distribution from which the kernel is derived. If `sigma` is a vector of size `d` (where `d` is the dimensionality of the data), it is interpreted as the diagonal standard deviation of the Gaussian distribution. It can also be a matrix of size `d*d` where `d`, in which case sigma will be the precision matrix (inverse covariance). opt Additional options to be forwarded to the matrix-vector multiplication routines. Examples -------- Creating a Gaussian kernel with a single length-scale. Operations on this kernel will not use KeOps. >>> K = GaussianKernel(sigma=3.0, opt=FalkonOptions(keops_active="no")) Creating a Gaussian kernel with a different length-scale per dimension >>> K = GaussianKernel(sigma=torch.tensor([1.0, 3.5, 7.0])) Creating a Gaussian kernel object with full covariance matrix (randomly chosen) >>> mat = torch.randn(3, 3, dtype=torch.float64) >>> sym_mat = mat @ mat.T >>> K = GaussianKernel(sigma=sym_mat) >>> K GaussianKernel(sigma=tensor([[ 2.0909, 0.0253, -0.2490], [ 0.0253, 0.3399, -0.5158], [-0.2490, -0.5158, 4.4922]], dtype=torch.float64)) #random Notes ----- The Gaussian kernel with a single length-scale follows .. math:: k(x, x') = \exp{-\dfrac{\lVert x - x' \rVert^2}{2\sigma^2}} When the length-scales are specified as a matrix, the RBF kernel is determined by .. math:: k(x, x') = \exp{-\dfrac{1}{2}x\Sigma x'} In both cases, the actual computation follows a different path, working on the expanded norm. """ kernel_name = "gaussian" core_fn = rbf_core def __init__(self, sigma: Union[float, torch.Tensor], opt: Optional[FalkonOptions] = None): self.sigma = validate_sigma(sigma) super().__init__(self.kernel_name, opt, core_fn=GaussianKernel.core_fn, sigma=self.sigma) def _keops_mmv_impl(self, X1, X2, v, kernel, out, opt: FalkonOptions): formula = 'Exp(SqDist(x1 / g, x2 / g) * IntInv(-2)) * v' aliases = [ 'x1 = Vi(%d)' % (X1.shape[1]), 'x2 = Vj(%d)' % (X2.shape[1]), 'v = Vj(%d)' % (v.shape[1]), 'g = Pm(%d)' % (self.sigma.shape[0]) ] other_vars = [self.sigma.to(device=X1.device, dtype=X1.dtype)] return self.keops_mmv(X1, X2, v, out, formula, aliases, other_vars, opt) def extra_mem(self) -> Dict[str, float]: return { # Data-matrix / sigma in prepare + Data-matrix / sigma in apply 'nd': 2, 'md': 1, # Norm results in prepare 'm': 1, 'n': 1, } def detach(self) -> 'GaussianKernel': detached_params = self._detach_params() return GaussianKernel(detached_params["sigma"], opt=self.params) # noinspection PyMethodOverriding def compute_sparse(self, X1: SparseTensor, X2: SparseTensor, out: torch.Tensor, X1_csr: SparseTensor, X2_csr: SparseTensor) -> torch.Tensor: if len(self.sigma) > 1: raise NotImplementedError("Sparse kernel is only implemented for scalar sigmas.") dev_kernel_tensor_params = self._move_kernel_params(X1) return rbf_core_sparse(X1, X2, X1_csr, X2_csr, out, dev_kernel_tensor_params["sigma"]) def __repr__(self): return f"GaussianKernel(sigma={self.sigma})" def __str__(self): return f"Gaussian kernel<{self.sigma}>" class LaplacianKernel(DiffKernel): r"""Class for computing the Laplacian kernel, and related kernel-vector products. The Laplacian kernel is similar to the Gaussian kernel, but less sensitive to changes in the parameter `sigma`. Parameters ---------- sigma The length-scale of the Laplacian kernel Notes ----- The Laplacian kernel is determined by the following formula .. math:: k(x, x') = \exp{-\frac{\lVert x - x' \rVert}{\sigma}} """ kernel_name = "laplacian" def __init__(self, sigma: Union[float, torch.Tensor], opt: Optional[FalkonOptions] = None): self.sigma = validate_sigma(sigma) super().__init__(self.kernel_name, opt, core_fn=laplacian_core, sigma=self.sigma) def _keops_mmv_impl(self, X1, X2, v, kernel, out, opt: FalkonOptions): formula = 'Exp(-Sqrt(SqDist(x1 / g, x2 / g))) * v' aliases = [ 'x1 = Vi(%d)' % (X1.shape[1]), 'x2 = Vj(%d)' % (X2.shape[1]), 'v = Vj(%d)' % (v.shape[1]), 'g = Pm(%d)' % (self.sigma.shape[0]) ] other_vars = [self.sigma.to(device=X1.device, dtype=X1.dtype)] return self.keops_mmv(X1, X2, v, out, formula, aliases, other_vars, opt) def extra_mem(self) -> Dict[str, float]: return { # Data-matrix / sigma in prepare + Data-matrix / sigma in apply 'nd': 2, 'md': 1, # Norm results in prepare 'm': 1, 'n': 1, } def detach(self) -> 'LaplacianKernel': detached_params = self._detach_params() return LaplacianKernel(detached_params["sigma"], opt=self.params) # noinspection PyMethodOverriding def compute_sparse(self, X1: SparseTensor, X2: SparseTensor, out: torch.Tensor, X1_csr: SparseTensor, X2_csr: SparseTensor) -> torch.Tensor: if len(self.sigma) > 1: raise NotImplementedError("Sparse kernel is only implemented for scalar sigmas.") dev_kernel_tensor_params = self._move_kernel_params(X1) return laplacian_core_sparse(X1, X2, X1_csr, X2_csr, out, dev_kernel_tensor_params["sigma"]) def __repr__(self): return f"LaplacianKernel(sigma={self.sigma})" def __str__(self): return f"Laplaciankernel<{self.sigma}>" class MaternKernel(DiffKernel): r"""Class for computing the Matern kernel, and related kernel-vector products. The Matern kernels define a generic class of kernel functions which includes the Laplacian and Gaussian kernels. The class is parametrized by 'nu'. When `nu = 0.5` this kernel is equivalent to the Laplacian kernel, when `nu = float('inf')`, the Matern kernel is equivalent to the Gaussian kernel. This class implements the Matern kernel only for the values of nu which have a closed form solution, which are 0.5, 1.5, 2.5, and infinity. Parameters ---------- sigma The length-scale of the Matern kernel. The length-scale can be either a scalar or a vector. Matrix-valued length-scales are not allowed for the Matern kernel. nu The parameter of the Matern kernel. It should be one of `0.5`, `1.5`, `2.5` or `inf`. Notes ----- While for `nu = float('inf')` this kernel is equivalent to the :class:`GaussianKernel`, the implementation is more general and using the :class:`GaussianKernel` directly may be computationally more efficient. """ _valid_nu_values = frozenset({0.5, 1.5, 2.5, float('inf')}) def __init__(self, sigma: Union[float, torch.Tensor], nu: Union[float, torch.Tensor], opt: Optional[FalkonOptions] = None): self.sigma = validate_sigma(sigma) self.nu = self.validate_nu(nu) self.kernel_name = f"{self.nu:.1f}-matern" super().__init__(self.kernel_name, opt, core_fn=matern_core, sigma=self.sigma, nu=self.nu) def _keops_mmv_impl(self, X1, X2, v, kernel, out, opt: FalkonOptions): if self.nu == 0.5: formula = 'Exp(-Norm2(x1 / s - x2 / s)) * v' elif self.nu == 1.5: formula = ('(IntCst(1) + Sqrt(IntCst(3)) * Norm2(x1 / s - x2 / s)) * ' '(Exp(-Sqrt(IntCst(3)) * Norm2(x1 / s - x2 / s)) * v)') elif self.nu == 2.5: formula = ('(IntCst(1) + Sqrt(IntCst(5)) * Norm2(x1 / s - x2 / s) + ' '(IntInv(3) * IntCst(5)) * SqNorm2(x1 / s - x2 / s)) * ' '(Exp(-Sqrt(IntCst(5)) * Norm2(x1 / s - x2 / s)) * v)') elif self.nu == float('inf'): formula = 'Exp(IntInv(-2) * SqDist(x1 / s, x2 / s)) * v' else: raise RuntimeError(f"Unrecognized value of nu ({self.nu}). " f"The onnly allowed values are 0.5, 1.5, 2.5, inf.") aliases = [ 'x1 = Vi(%d)' % (X1.shape[1]), 'x2 = Vj(%d)' % (X2.shape[1]), 'v = Vj(%d)' % (v.shape[1]), 's = Pm(%d)' % (self.sigma.shape[0]) ] other_vars = [self.sigma.to(device=X1.device, dtype=X1.dtype)] return self.keops_mmv(X1, X2, v, out, formula, aliases, other_vars, opt) def extra_mem(self) -> Dict[str, float]: extra_mem = { # Data-matrix / sigma 'nd': 1, 'md': 1, # Norm results in prepare 'm': 1, 'n': 1, } if self.nu in {1.5, 2.5}: # Extra kernel block in transform extra_mem['nm'] = 1 return extra_mem def detach(self) -> 'MaternKernel': detached_params = self._detach_params() return MaternKernel(detached_params["sigma"], detached_params["nu"], opt=self.params) @staticmethod def validate_nu(nu: Union[torch.Tensor, float]) -> float: if isinstance(nu, torch.Tensor): if nu.requires_grad: raise ValueError("The nu parameter of the Matern kernel is not differentiable, " "and must not require gradients.") try: out_nu = round(nu.item(), ndigits=2) except ValueError: raise ValueError("nu=%s is not convertible to a scalar." % (nu)) elif isinstance(nu, float): out_nu = round(nu, ndigits=2) else: raise TypeError(f"nu must be a float or a tensor, not a {type(nu)}") if out_nu not in MaternKernel._valid_nu_values: raise ValueError(f"The given value of nu = {out_nu} can only take " f"values {MaternKernel._valid_nu_values}.") return out_nu # noinspection PyMethodOverriding def compute_sparse(self, X1: SparseTensor, X2: SparseTensor, out: torch.Tensor, X1_csr: SparseTensor, X2_csr: SparseTensor) -> torch.Tensor: if len(self.sigma) > 1: raise NotImplementedError("Sparse kernel is only implemented for scalar sigmas.") dev_kernel_tensor_params = self._move_kernel_params(X1) return matern_core_sparse(X1, X2, X1_csr, X2_csr, out, dev_kernel_tensor_params["sigma"], self.nu) def __repr__(self): return f"MaternKernel(sigma={self.sigma}, nu={self.nu:.1f})" def __str__(self): return f"Matern kernel<{self.sigma}, {self.nu:.1f}>"
[ 1, 515, 19229, 1053, 7761, 29892, 28379, 29892, 360, 919, 13, 13, 5215, 4842, 305, 13, 13, 3166, 285, 2235, 265, 1053, 29234, 13, 3166, 285, 2235, 265, 29889, 22178, 1379, 29889, 12765, 29918, 17460, 1053, 360, 2593, 29968, 5851, 13, 3166, 285, 2235, 265, 29889, 433, 29918, 3952, 6774, 29889, 17619, 29918, 12324, 29918, 9144, 1053, 6862, 29918, 12324, 29918, 12765, 13, 3166, 285, 2235, 265, 29889, 6768, 1053, 383, 2235, 265, 5856, 13, 3166, 285, 2235, 265, 29889, 29879, 5510, 1053, 317, 5510, 29911, 6073, 13, 13, 29903, 29984, 13079, 29941, 353, 29871, 29896, 29889, 29955, 29941, 29906, 29900, 29945, 29900, 29947, 29900, 29955, 29945, 29953, 29947, 29947, 29955, 29955, 29906, 13, 29903, 29984, 13079, 29945, 353, 29871, 29906, 29889, 29906, 29941, 29953, 29900, 29953, 29955, 29929, 29955, 29955, 29946, 29929, 29929, 29955, 29929, 13, 13, 13, 1753, 12725, 29918, 3754, 29898, 3754, 29901, 7761, 29961, 7411, 29892, 4842, 305, 29889, 29911, 6073, 2314, 1599, 4842, 305, 29889, 29911, 6073, 29901, 13, 1678, 565, 338, 8758, 29898, 3754, 29892, 4842, 305, 29889, 29911, 6073, 1125, 13, 4706, 396, 317, 2934, 338, 263, 29871, 29896, 29899, 667, 12489, 6702, 14369, 1495, 13, 4706, 1018, 29901, 13, 9651, 269, 2934, 29889, 667, 580, 13, 9651, 736, 269, 2934, 13, 4706, 5174, 7865, 2392, 29901, 13, 9651, 1209, 13, 4706, 396, 317, 2934, 338, 263, 4608, 6702, 6051, 351, 1495, 13, 4706, 565, 269, 2934, 29889, 6229, 580, 1275, 29871, 29896, 470, 269, 2934, 29889, 12181, 29961, 29896, 29962, 1275, 29871, 29896, 29901, 13, 9651, 736, 269, 2934, 29889, 690, 14443, 6278, 29896, 29897, 13, 4706, 1683, 29901, 13, 9651, 396, 14402, 29901, 26965, 1059, 13, 9651, 12020, 7865, 2392, 703, 3754, 1818, 367, 263, 17336, 470, 263, 4608, 23157, 13, 1678, 1683, 29901, 13, 4706, 1018, 29901, 13, 9651, 736, 4842, 305, 29889, 20158, 4197, 7411, 29898, 3754, 29897, 1402, 26688, 29922, 7345, 305, 29889, 7411, 29953, 29946, 29897, 13, 4706, 5174, 20948, 29901, 13, 9651, 12020, 20948, 703, 10142, 1818, 367, 263, 17336, 470, 263, 12489, 23157, 13, 13, 13, 1753, 903, 3044, 29918, 5721, 29898, 2922, 29896, 29892, 1775, 29906, 29892, 6056, 29918, 2922, 29896, 29892, 6056, 29918, 2922, 29906, 29892, 714, 29901, 28379, 29961, 7345, 305, 29889, 29911, 6073, 2314, 1599, 4842, 305, 29889, 29911, 6073, 29901, 13, 1678, 565, 1775, 29896, 29889, 6229, 580, 1275, 29871, 29941, 29901, 13, 4706, 565, 714, 338, 6213, 29901, 13, 9651, 714, 353, 4842, 305, 29889, 29890, 1202, 29890, 4317, 29898, 12324, 29918, 2922, 29896, 29892, 1775, 29896, 29892, 1775, 29906, 29889, 3286, 4220, 6278, 29906, 29892, 448, 29896, 511, 15595, 10457, 29906, 29892, 21762, 29922, 29896, 29897, 29871, 396, 289, 29930, 29876, 29930, 29885, 13, 4706, 1683, 29901, 13, 9651, 714, 353, 4842, 305, 29889, 29890, 1202, 29890, 4317, 29898, 12324, 29918, 2922, 29896, 29892, 1775, 29896, 29892, 1775, 29906, 29889, 3286, 4220, 6278, 29906, 29892, 448, 29896, 511, 15595, 10457, 29906, 29892, 21762, 29922, 29896, 29892, 13, 462, 18884, 714, 29922, 449, 29897, 29871, 396, 289, 29930, 29876, 29930, 29885, 13, 1678, 1683, 29901, 13, 4706, 565, 714, 338, 6213, 29901, 13, 9651, 714, 353, 4842, 305, 29889, 1202, 4317, 29898, 12324, 29918, 2922, 29896, 29892, 1775, 29896, 29892, 1775, 29906, 29889, 3286, 4220, 6278, 29906, 29892, 448, 29896, 511, 15595, 10457, 29906, 29892, 21762, 29922, 29896, 29897, 29871, 396, 302, 29930, 29885, 13, 4706, 1683, 29901, 13, 9651, 714, 353, 4842, 305, 29889, 1202, 4317, 29898, 12324, 29918, 2922, 29896, 29892, 1775, 29896, 29892, 1775, 29906, 29889, 3286, 4220, 6278, 29906, 29892, 448, 29896, 511, 15595, 10457, 29906, 29892, 21762, 29922, 29896, 29892, 13, 462, 795, 714, 29922, 449, 29897, 29871, 396, 302, 29930, 29885, 13, 1678, 714, 29889, 1202, 23538, 12324, 29918, 2922, 29906, 29889, 3286, 4220, 6278, 29906, 29892, 448, 29896, 876, 13, 1678, 714, 29889, 695, 1160, 29918, 1195, 23538, 29896, 29872, 29899, 29906, 29900, 29897, 13, 1678, 736, 714, 13, 13, 13, 1753, 903, 29879, 5510, 29918, 3044, 29918, 5721, 29898, 29990, 29896, 29918, 2395, 29878, 29901, 317, 5510, 29911, 6073, 29892, 1060, 29906, 29918, 2395, 29878, 29901, 317, 5510, 29911, 6073, 29892, 13, 462, 1678, 1060, 29896, 29901, 317, 5510, 29911, 6073, 29892, 1060, 29906, 29901, 317, 5510, 29911, 6073, 29892, 13, 462, 1678, 714, 29901, 4842, 305, 29889, 29911, 6073, 29897, 1599, 4842, 305, 29889, 29911, 6073, 29901, 13, 1678, 18074, 29896, 353, 4842, 305, 29889, 6310, 29898, 29990, 29896, 29918, 2395, 29878, 29889, 2311, 29898, 29900, 511, 26688, 29922, 29990, 29896, 29918, 2395, 29878, 29889, 29881, 1853, 29892, 4742, 29922, 29990, 29896, 29918, 2395, 29878, 29889, 10141, 29897, 13, 1678, 29234, 29889, 29879, 5510, 29918, 17619, 29918, 12324, 29898, 29990, 29896, 29918, 2395, 29878, 29892, 18074, 29896, 29897, 29871, 396, 14402, 29901, 910, 1818, 367, 8762, 363, 315, 29965, 7698, 25187, 943, 13, 1678, 18074, 29896, 353, 18074, 29896, 29889, 690, 14443, 6278, 29896, 29892, 29871, 29896, 29897, 13, 1678, 18074, 29906, 353, 4842, 305, 29889, 6310, 29898, 29990, 29906, 29918, 2395, 29878, 29889, 2311, 29898, 29900, 511, 26688, 29922, 29990, 29906, 29918, 2395, 29878, 29889, 29881, 1853, 29892, 4742, 29922, 29990, 29906, 29918, 2395, 29878, 29889, 10141, 29897, 13, 1678, 29234, 29889, 29879, 5510, 29918, 17619, 29918, 12324, 29898, 29990, 29906, 29918, 2395, 29878, 29892, 18074, 29906, 29897, 13, 1678, 18074, 29906, 353, 18074, 29906, 29889, 690, 14443, 6278, 29896, 29892, 29871, 29896, 29897, 13, 1678, 29234, 29889, 29879, 5510, 29918, 2922, 16109, 29898, 29990, 29896, 29892, 1060, 29906, 29892, 714, 29897, 13, 1678, 714, 29889, 16109, 29918, 6278, 29906, 29889, 29900, 29897, 13, 1678, 714, 29889, 1202, 23538, 3044, 29896, 29889, 517, 29898, 10141, 29922, 29990, 29896, 29889, 10141, 876, 13, 1678, 714, 29889, 1202, 23538, 3044, 29906, 29889, 517, 29898, 10141, 29922, 29990, 29906, 29889, 10141, 467, 29873, 3101, 13, 1678, 714, 29889, 695, 1160, 29918, 1195, 23538, 29896, 29872, 29899, 29906, 29900, 29897, 13, 1678, 736, 714, 13, 13, 13, 1753, 364, 1635, 29918, 3221, 29898, 2922, 29896, 29892, 1775, 29906, 29892, 714, 29901, 28379, 29961, 7345, 305, 29889, 29911, 6073, 1402, 269, 2934, 1125, 13, 1678, 9995, 13, 1678, 3940, 29871, 29896, 29901, 565, 714, 338, 6213, 29892, 769, 445, 740, 674, 367, 17473, 519, 281, 2273, 599, 2211, 9886, 10970, 29889, 13, 1678, 3940, 29871, 29906, 29901, 445, 740, 508, 5376, 411, 9853, 287, 10970, 13, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 1678, 269, 2934, 13, 1678, 1775, 29896, 13, 1678, 1775, 29906, 13, 1678, 714, 13, 13, 1678, 16969, 13, 1678, 448, 22158, 13, 13, 1678, 9995, 13, 1678, 1775, 29896, 29918, 4563, 29918, 18816, 353, 1775, 29896, 847, 269, 2934, 13, 1678, 1775, 29906, 29918, 4563, 29918, 18816, 353, 1775, 29906, 847, 269, 2934, 13, 1678, 6056, 29918, 3044, 29918, 2922, 29896, 353, 6862, 29918, 12324, 29918, 12765, 29898, 2922, 29896, 29918, 4563, 29918, 18816, 29892, 448, 29896, 29892, 5852, 29897, 29871, 396, 289, 29930, 29876, 29930, 29896, 470, 302, 29930, 29896, 13, 1678, 6056, 29918, 3044, 29918, 2922, 29906, 353, 6862, 29918, 12324, 29918, 12765, 29898, 2922, 29906, 29918, 4563, 29918, 18816, 29892, 448, 29896, 29892, 5852, 29897, 29871, 396, 289, 29930, 29885, 29930, 29896, 470, 286, 29930, 29896, 13, 13, 1678, 714, 353, 903, 3044, 29918, 5721, 29898, 2922, 29896, 29918, 4563, 29918, 18816, 29892, 1775, 29906, 29918, 4563, 29918, 18816, 29892, 6056, 29918, 3044, 29918, 2922, 29896, 29892, 6056, 29918, 3044, 29918, 2922, 29906, 29892, 714, 29897, 13, 1678, 714, 29889, 16109, 29918, 6278, 29900, 29889, 29945, 29897, 13, 1678, 714, 29889, 4548, 29918, 580, 13, 1678, 736, 714, 13, 13, 13, 1753, 364, 1635, 29918, 3221, 29918, 29879, 5510, 29898, 2922, 29896, 29901, 317, 5510, 29911, 6073, 29892, 1775, 29906, 29901, 317, 5510, 29911, 6073, 29892, 13, 462, 1678, 1775, 29896, 29918, 2395, 29878, 29901, 317, 5510, 29911, 6073, 29892, 1775, 29906, 29918, 2395, 29878, 29901, 317, 5510, 29911, 6073, 29892, 13, 462, 1678, 714, 29901, 4842, 305, 29889, 29911, 6073, 29892, 269, 2934, 29897, 1599, 4842, 305, 29889, 29911, 6073, 29901, 13, 1678, 330, 2735, 353, 29871, 29900, 29889, 29945, 847, 313, 3754, 3579, 29871, 29906, 29897, 13, 1678, 714, 353, 903, 29879, 5510, 29918, 3044, 29918, 5721, 29898, 29990, 29896, 29918, 2395, 29878, 29922, 2922, 29896, 29918, 2395, 29878, 29892, 1060, 29906, 29918, 2395, 29878, 29922, 2922, 29906, 29918, 2395, 29878, 29892, 1060, 29896, 29922, 2922, 29896, 29892, 1060, 29906, 29922, 2922, 29906, 29892, 714, 29922, 449, 29897, 13, 1678, 714, 29889, 16109, 29918, 6278, 4283, 29897, 13, 1678, 714, 29889, 4548, 29918, 580, 13, 1678, 736, 714, 13, 13, 13, 1753, 425, 13974, 28445, 29918, 3221, 29898, 2922, 29896, 29892, 1775, 29906, 29892, 714, 29901, 28379, 29961, 7345, 305, 29889, 29911, 6073, 1402, 269, 2934, 1125, 13, 1678, 1775, 29896, 29918, 4563, 29918, 18816, 353, 1775, 29896, 847, 269, 2934, 13, 1678, 1775, 29906, 29918, 4563, 29918, 18816, 353, 1775, 29906, 847, 269, 2934, 13, 1678, 6056, 29918, 3044, 29918, 2922, 29896, 353, 6862, 29918, 12324, 29918, 12765, 29898, 2922, 29896, 29918, 4563, 29918, 18816, 29892, 448, 29896, 29892, 5852, 29897, 29871, 396, 289, 29930, 29876, 29930, 29896, 13, 1678, 6056, 29918, 3044, 29918, 2922, 29906, 353, 6862, 29918, 12324, 29918, 12765, 29898, 2922, 29906, 29918, 4563, 29918, 18816, 29892, 448, 29896, 29892, 5852, 29897, 29871, 396, 289, 29930, 29885, 29930, 29896, 13, 1678, 1677, 29918, 449, 353, 714, 13, 1678, 714, 353, 903, 3044, 29918, 5721, 29898, 2922, 29896, 29918, 4563, 29918, 18816, 29892, 1775, 29906, 29918, 4563, 29918, 18816, 29892, 6056, 29918, 3044, 29918, 2922, 29896, 29892, 6056, 29918, 3044, 29918, 2922, 29906, 29892, 714, 29897, 13, 1678, 714, 29889, 3676, 29918, 580, 29871, 396, 20298, 433, 28445, 29901, 18074, 2273, 310, 10674, 1965, 29899, 29881, 17678, 13, 1678, 396, 450, 16030, 13944, 4225, 278, 1962, 310, 18074, 2273, 29918, 13, 1678, 565, 1677, 29918, 449, 338, 6213, 29901, 29871, 396, 14402, 29901, 1334, 1033, 367, 901, 6261, 297, 278, 4128, 1048, 3692, 278, 16030, 338, 470, 3508, 29915, 29873, 4312, 13, 4706, 714, 353, 714, 29889, 10052, 580, 13, 1678, 1683, 29901, 13, 4706, 714, 29889, 10052, 29918, 580, 13, 1678, 714, 29889, 4548, 29918, 580, 13, 1678, 736, 714, 13, 13, 13, 1753, 425, 13974, 28445, 29918, 3221, 29918, 29879, 5510, 29898, 2922, 29896, 29901, 317, 5510, 29911, 6073, 29892, 1775, 29906, 29901, 317, 5510, 29911, 6073, 29892, 13, 462, 3986, 1775, 29896, 29918, 2395, 29878, 29901, 317, 5510, 29911, 6073, 29892, 1775, 29906, 29918, 2395, 29878, 29901, 317, 5510, 29911, 6073, 29892, 13, 462, 3986, 714, 29901, 4842, 305, 29889, 29911, 6073, 29892, 269, 2934, 29897, 1599, 4842, 305, 29889, 29911, 6073, 29901, 13, 1678, 330, 2735, 353, 29871, 29896, 847, 269, 2934, 13, 1678, 714, 353, 903, 29879, 5510, 29918, 3044, 29918, 5721, 29898, 29990, 29896, 29918, 2395, 29878, 29922, 2922, 29896, 29918, 2395, 29878, 29892, 1060, 29906, 29918, 2395, 29878, 29922, 2922, 29906, 29918, 2395, 29878, 29892, 1060, 29896, 29922, 2922, 29896, 29892, 1060, 29906, 29922, 2922, 29906, 29892, 714, 29922, 449, 29897, 13, 1678, 714, 29889, 3676, 29918, 580, 13, 1678, 714, 29889, 16109, 29918, 6278, 4283, 29897, 13, 1678, 714, 29889, 4548, 29918, 580, 13, 1678, 736, 714, 13, 13, 13, 1753, 1775, 824, 29918, 3221, 29898, 2922, 29896, 29892, 1775, 29906, 29892, 714, 29901, 28379, 29961, 7345, 305, 29889, 29911, 6073, 1402, 269, 2934, 29892, 4948, 1125, 13, 1678, 565, 4948, 1275, 29871, 29900, 29889, 29945, 29901, 13, 4706, 736, 425, 13974, 28445, 29918, 3221, 29898, 2922, 29896, 29892, 1775, 29906, 29892, 714, 29892, 269, 2934, 29897, 13, 1678, 25342, 4948, 1275, 5785, 877, 7192, 29374, 13, 4706, 736, 364, 1635, 29918, 3221, 29898, 2922, 29896, 29892, 1775, 29906, 29892, 714, 29892, 269, 2934, 29897, 13, 1678, 1677, 29918, 449, 353, 714, 13, 1678, 1775, 29896, 29918, 4563, 29918, 18816, 353, 1775, 29896, 847, 269, 2934, 13, 1678, 1775, 29906, 29918, 4563, 29918, 18816, 353, 1775, 29906, 847, 269, 2934, 13, 1678, 6056, 29918, 3044, 29918, 2922, 29896, 353, 6862, 29918, 12324, 29918, 12765, 29898, 2922, 29896, 29918, 4563, 29918, 18816, 29892, 448, 29896, 29892, 5852, 29897, 29871, 396, 289, 29930, 29876, 29930, 29896, 13, 1678, 6056, 29918, 3044, 29918, 2922, 29906, 353, 6862, 29918, 12324, 29918, 12765, 29898, 2922, 29906, 29918, 4563, 29918, 18816, 29892, 448, 29896, 29892, 5852, 29897, 29871, 396, 289, 29930, 29885, 29930, 29896, 13, 13, 1678, 714, 353, 903, 3044, 29918, 5721, 29898, 2922, 29896, 29918, 4563, 29918, 18816, 29892, 1775, 29906, 29918, 4563, 29918, 18816, 29892, 6056, 29918, 3044, 29918, 2922, 29896, 29892, 6056, 29918, 3044, 29918, 2922, 29906, 29892, 714, 29897, 13, 1678, 565, 4948, 1275, 29871, 29896, 29889, 29945, 29901, 13, 4706, 396, 313, 29896, 718, 18074, 2273, 29898, 29941, 11877, 29928, 29897, 334, 1518, 6278, 3676, 29898, 29941, 11877, 29928, 876, 13, 4706, 714, 29889, 3676, 29918, 580, 13, 4706, 565, 1677, 29918, 449, 338, 6213, 29901, 29871, 396, 14402, 29901, 1334, 1033, 367, 901, 6261, 297, 278, 4128, 1048, 3692, 278, 16030, 338, 470, 3508, 29915, 29873, 4312, 13, 9651, 714, 353, 714, 29889, 16109, 29898, 29903, 29984, 13079, 29941, 29897, 13, 4706, 1683, 29901, 13, 9651, 714, 29889, 16109, 23538, 29903, 29984, 13079, 29941, 29897, 13, 4706, 714, 29918, 10052, 353, 4842, 305, 29889, 10052, 29898, 449, 29897, 29871, 396, 4805, 302, 29930, 29885, 2908, 13, 4706, 714, 29918, 10052, 29889, 4548, 29918, 580, 13, 4706, 714, 29889, 1202, 23538, 29896, 29889, 29900, 467, 16109, 23538, 449, 29918, 10052, 29897, 13, 1678, 25342, 4948, 1275, 29871, 29906, 29889, 29945, 29901, 13, 4706, 396, 313, 29896, 718, 18074, 2273, 29898, 29945, 11877, 29928, 718, 313, 3676, 29898, 29945, 11877, 29928, 4887, 29906, 847, 29871, 29941, 1723, 334, 1518, 6278, 3676, 29898, 29945, 11877, 29928, 29897, 13, 4706, 714, 29918, 3676, 353, 4842, 305, 29889, 3676, 29898, 449, 29897, 13, 4706, 565, 1677, 29918, 449, 338, 6213, 29901, 29871, 396, 14402, 29901, 1334, 1033, 367, 901, 6261, 297, 278, 4128, 1048, 3692, 278, 16030, 338, 470, 3508, 29915, 29873, 4312, 13, 9651, 714, 29918, 3676, 353, 714, 29918, 3676, 29889, 16109, 29898, 29903, 29984, 13079, 29945, 29897, 13, 4706, 1683, 29901, 13, 9651, 714, 29918, 3676, 29889, 16109, 23538, 29903, 29984, 13079, 29945, 29897, 13, 4706, 714, 29889, 16109, 23538, 29945, 29889, 29900, 847, 29871, 29941, 29889, 29900, 467, 1202, 23538, 449, 29918, 3676, 467, 1202, 23538, 29896, 29889, 29900, 29897, 13, 4706, 714, 29918, 3676, 29889, 10052, 29918, 2141, 4548, 29918, 580, 13, 4706, 714, 29889, 16109, 23538, 449, 29918, 3676, 29897, 13, 13, 1678, 736, 714, 13, 13, 13, 1753, 1775, 824, 29918, 3221, 29918, 29879, 5510, 29898, 2922, 29896, 29901, 317, 5510, 29911, 6073, 29892, 1775, 29906, 29901, 317, 5510, 29911, 6073, 29892, 13, 462, 539, 1775, 29896, 29918, 2395, 29878, 29901, 317, 5510, 29911, 6073, 29892, 1775, 29906, 29918, 2395, 29878, 29901, 317, 5510, 29911, 6073, 29892, 13, 462, 539, 714, 29901, 4842, 305, 29889, 29911, 6073, 29892, 269, 2934, 29892, 4948, 29897, 1599, 4842, 305, 29889, 29911, 6073, 29901, 13, 1678, 565, 4948, 1275, 29871, 29900, 29889, 29945, 29901, 13, 4706, 736, 425, 13974, 28445, 29918, 3221, 29918, 29879, 5510, 29898, 2922, 29896, 29892, 1775, 29906, 29892, 1775, 29896, 29918, 2395, 29878, 29892, 1775, 29906, 29918, 2395, 29878, 29892, 714, 29892, 269, 2934, 29897, 13, 1678, 25342, 4948, 1275, 5785, 877, 7192, 29374, 13, 4706, 736, 364, 1635, 29918, 3221, 29918, 29879, 5510, 29898, 2922, 29896, 29892, 1775, 29906, 29892, 1775, 29896, 29918, 2395, 29878, 29892, 1775, 29906, 29918, 2395, 29878, 29892, 714, 29892, 269, 2934, 29897, 13, 1678, 330, 2735, 353, 29871, 29896, 847, 313, 3754, 3579, 29871, 29906, 29897, 13, 1678, 714, 353, 903, 29879, 5510, 29918, 3044, 29918, 5721, 29898, 29990, 29896, 29918, 2395, 29878, 29922, 2922, 29896, 29918, 2395, 29878, 29892, 1060, 29906, 29918, 2395, 29878, 29922, 2922, 29906, 29918, 2395, 29878, 29892, 1060, 29896, 29922, 2922, 29896, 29892, 1060, 29906, 29922, 2922, 29906, 29892, 714, 29922, 449, 29897, 13, 1678, 714, 29889, 16109, 23538, 4283, 29897, 13, 13, 1678, 396, 1152, 3058, 4948, 353, 29871, 29896, 29889, 29945, 29892, 29871, 29906, 29889, 29945, 591, 674, 817, 385, 4805, 302, 29930, 29885, 2908, 13, 1678, 565, 4948, 1275, 29871, 29896, 29889, 29945, 29901, 13, 4706, 396, 313, 29896, 718, 18074, 2273, 29898, 29941, 11877, 29928, 29897, 334, 1518, 6278, 3676, 29898, 29941, 11877, 29928, 876, 13, 4706, 714, 29889, 3676, 29918, 580, 13, 4706, 714, 29889, 16109, 23538, 29903, 29984, 13079, 29941, 29897, 13, 4706, 714, 29918, 10052, 353, 4842, 305, 29889, 10052, 29898, 449, 29897, 13, 4706, 714, 29918, 10052, 29889, 4548, 29918, 580, 13, 4706, 714, 29889, 1202, 23538, 29896, 29889, 29900, 467, 16109, 23538, 449, 29918, 10052, 29897, 13, 1678, 25342, 4948, 1275, 29871, 29906, 29889, 29945, 29901, 13, 4706, 396, 313, 29896, 718, 18074, 2273, 29898, 29945, 11877, 29928, 718, 313, 3676, 29898, 29945, 11877, 29928, 4887, 29906, 847, 29871, 29941, 1723, 334, 1518, 6278, 3676, 29898, 29945, 11877, 29928, 29897, 13, 4706, 714, 29918, 3676, 353, 4842, 305, 29889, 3676, 29898, 449, 29897, 13, 4706, 714, 29918, 3676, 29889, 16109, 23538, 29903, 29984, 13079, 29945, 29897, 13, 4706, 714, 29889, 16109, 23538, 29945, 29889, 29900, 847, 29871, 29941, 29889, 29900, 467, 1202, 23538, 449, 29918, 3676, 467, 1202, 23538, 29896, 29889, 29900, 29897, 13, 4706, 714, 29918, 3676, 29889, 10052, 29918, 2141, 4548, 29918, 580, 13, 4706, 714, 29889, 16109, 23538, 449, 29918, 3676, 29897, 13, 1678, 736, 714, 13, 13, 13, 1990, 22477, 29968, 5851, 29898, 26023, 29968, 5851, 1125, 13, 1678, 364, 15945, 29908, 2385, 363, 20602, 278, 22477, 8466, 322, 4475, 8466, 29899, 8111, 9316, 13, 13, 1678, 450, 22477, 8466, 338, 697, 310, 278, 1556, 3619, 322, 11828, 8466, 8297, 29881, 886, 13, 1678, 1951, 372, 338, 10362, 22112, 29892, 322, 4095, 287, 491, 263, 2323, 3443, 29889, 450, 8466, 3309, 29899, 7052, 13, 1678, 3683, 1475, 278, 2920, 310, 278, 22477, 4978, 607, 338, 7180, 373, 2246, 310, 1269, 1298, 29889, 13, 1678, 319, 7200, 269, 2934, 16161, 304, 263, 9377, 22477, 29892, 577, 393, 278, 6198, 9949, 310, 2215, 3448, 13, 1678, 3291, 674, 367, 1880, 363, 20602, 278, 8466, 472, 263, 2183, 1418, 398, 29889, 13, 1678, 1551, 278, 11564, 2625, 310, 278, 18272, 29892, 263, 2319, 269, 2934, 2794, 393, 871, 20810, 3291, 674, 13, 1678, 9949, 278, 8466, 29889, 13, 13, 1678, 12662, 2699, 13, 1678, 448, 28400, 13, 1678, 269, 2934, 13, 4706, 450, 3309, 29899, 7052, 310, 278, 8466, 29889, 13, 4706, 910, 508, 367, 263, 17336, 29892, 322, 769, 372, 16161, 304, 278, 3918, 29522, 13, 4706, 310, 278, 22477, 4978, 515, 607, 278, 8466, 338, 10723, 29889, 13, 4706, 960, 421, 3754, 29952, 338, 263, 4608, 310, 2159, 421, 29881, 29952, 313, 3062, 421, 29881, 29952, 338, 278, 22112, 537, 310, 278, 848, 511, 372, 338, 13, 4706, 21551, 408, 278, 19640, 3918, 29522, 310, 278, 22477, 4978, 29889, 13, 4706, 739, 508, 884, 367, 263, 4636, 310, 29871, 2159, 421, 29881, 29930, 29881, 29952, 988, 421, 29881, 1673, 297, 607, 1206, 269, 2934, 674, 367, 278, 16716, 13, 4706, 4636, 313, 262, 3901, 18838, 279, 8837, 467, 13, 1678, 3523, 13, 4706, 3462, 3245, 3987, 304, 367, 6375, 287, 304, 278, 4636, 29899, 8111, 21666, 13, 4706, 6745, 1475, 29889, 13, 13, 1678, 1222, 9422, 13, 1678, 448, 26589, 13, 1678, 26221, 263, 22477, 8466, 411, 263, 2323, 3309, 29899, 7052, 29889, 6607, 800, 373, 445, 8466, 674, 451, 13, 1678, 671, 4813, 29949, 567, 29889, 13, 13, 1678, 8653, 476, 353, 22477, 29968, 5851, 29898, 3754, 29922, 29941, 29889, 29900, 29892, 3523, 29922, 29943, 2235, 265, 5856, 29898, 446, 3554, 29918, 4925, 543, 1217, 5783, 13, 13, 1678, 26221, 263, 22477, 8466, 411, 263, 1422, 3309, 29899, 7052, 639, 9927, 13, 13, 1678, 8653, 476, 353, 22477, 29968, 5851, 29898, 3754, 29922, 7345, 305, 29889, 20158, 4197, 29896, 29889, 29900, 29892, 29871, 29941, 29889, 29945, 29892, 29871, 29955, 29889, 29900, 12622, 13, 13, 1678, 26221, 263, 22477, 8466, 1203, 411, 2989, 18838, 279, 8837, 4636, 313, 8172, 368, 10434, 29897, 13, 13, 1678, 8653, 1775, 353, 4842, 305, 29889, 9502, 29876, 29898, 29941, 29892, 29871, 29941, 29892, 26688, 29922, 7345, 305, 29889, 7411, 29953, 29946, 29897, 13, 1678, 8653, 5016, 29918, 2922, 353, 1775, 732, 1775, 29889, 29911, 13, 1678, 8653, 476, 353, 22477, 29968, 5851, 29898, 3754, 29922, 11967, 29918, 2922, 29897, 13, 1678, 8653, 476, 13, 1678, 22477, 29968, 5851, 29898, 3754, 29922, 20158, 4197, 29961, 29871, 29906, 29889, 29900, 29929, 29900, 29929, 29892, 259, 29900, 29889, 29900, 29906, 29945, 29941, 29892, 448, 29900, 29889, 29906, 29946, 29929, 29900, 1402, 13, 9651, 518, 29871, 29900, 29889, 29900, 29906, 29945, 29941, 29892, 259, 29900, 29889, 29941, 29941, 29929, 29929, 29892, 448, 29900, 29889, 29945, 29896, 29945, 29947, 1402, 13, 9651, 21069, 29900, 29889, 29906, 29946, 29929, 29900, 29892, 448, 29900, 29889, 29945, 29896, 29945, 29947, 29892, 259, 29946, 29889, 29946, 29929, 29906, 29906, 20526, 26688, 29922, 7345, 305, 29889, 7411, 29953, 29946, 876, 29871, 396, 8172, 13, 13, 13, 1678, 8695, 13, 1678, 448, 807, 13, 1678, 450, 22477, 8466, 411, 263, 2323, 3309, 29899, 7052, 4477, 13, 13, 1678, 6317, 5844, 1057, 13, 13, 4706, 413, 29898, 29916, 29892, 921, 1495, 353, 320, 4548, 29912, 2612, 10779, 741, 29880, 9114, 921, 448, 921, 29915, 320, 29878, 9114, 29985, 29906, 1157, 29906, 29905, 3754, 29985, 29906, 930, 13, 13, 13, 1678, 1932, 278, 3309, 29899, 19529, 267, 526, 6790, 408, 263, 4636, 29892, 278, 390, 28062, 8466, 338, 10087, 491, 13, 13, 1678, 6317, 5844, 1057, 13, 13, 4706, 413, 29898, 29916, 29892, 921, 1495, 353, 320, 4548, 29912, 2612, 10779, 29912, 29896, 1157, 29906, 29913, 29916, 29905, 10142, 921, 10827, 13, 13, 13, 1678, 512, 1716, 4251, 29892, 278, 3935, 16287, 4477, 263, 1422, 2224, 29892, 1985, 373, 278, 17832, 13, 1678, 6056, 29889, 13, 1678, 9995, 13, 1678, 8466, 29918, 978, 353, 376, 29887, 17019, 29908, 13, 1678, 7136, 29918, 9144, 353, 364, 1635, 29918, 3221, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 269, 2934, 29901, 7761, 29961, 7411, 29892, 4842, 305, 29889, 29911, 6073, 1402, 3523, 29901, 28379, 29961, 29943, 2235, 265, 5856, 29962, 353, 6213, 1125, 13, 4706, 1583, 29889, 3754, 353, 12725, 29918, 3754, 29898, 3754, 29897, 13, 13, 4706, 2428, 2141, 1649, 2344, 12035, 1311, 29889, 17460, 29918, 978, 29892, 3523, 29892, 7136, 29918, 9144, 29922, 29954, 17019, 29968, 5851, 29889, 3221, 29918, 9144, 29892, 269, 2934, 29922, 1311, 29889, 3754, 29897, 13, 13, 1678, 822, 903, 446, 3554, 29918, 4317, 29894, 29918, 13699, 29898, 1311, 29892, 1060, 29896, 29892, 1060, 29906, 29892, 325, 29892, 8466, 29892, 714, 29892, 3523, 29901, 383, 2235, 265, 5856, 1125, 13, 4706, 7063, 353, 525, 9544, 29898, 29903, 29939, 13398, 29898, 29916, 29896, 847, 330, 29892, 921, 29906, 847, 330, 29897, 334, 3159, 12165, 6278, 29906, 876, 334, 325, 29915, 13, 4706, 14430, 2129, 353, 518, 13, 9651, 525, 29916, 29896, 353, 10630, 29414, 29881, 16029, 1273, 313, 29990, 29896, 29889, 12181, 29961, 29896, 11724, 13, 9651, 525, 29916, 29906, 353, 478, 29926, 29414, 29881, 16029, 1273, 313, 29990, 29906, 29889, 12181, 29961, 29896, 11724, 13, 9651, 525, 29894, 353, 478, 29926, 29414, 29881, 16029, 1273, 313, 29894, 29889, 12181, 29961, 29896, 11724, 13, 9651, 525, 29887, 353, 349, 29885, 29414, 29881, 16029, 1273, 313, 1311, 29889, 3754, 29889, 12181, 29961, 29900, 2314, 13, 4706, 4514, 13, 4706, 916, 29918, 16908, 353, 518, 1311, 29889, 3754, 29889, 517, 29898, 10141, 29922, 29990, 29896, 29889, 10141, 29892, 26688, 29922, 29990, 29896, 29889, 29881, 1853, 4638, 13, 13, 4706, 736, 1583, 29889, 446, 3554, 29918, 4317, 29894, 29898, 29990, 29896, 29892, 1060, 29906, 29892, 325, 29892, 714, 29892, 7063, 29892, 14430, 2129, 29892, 916, 29918, 16908, 29892, 3523, 29897, 13, 13, 1678, 822, 4805, 29918, 6954, 29898, 1311, 29897, 1599, 360, 919, 29961, 710, 29892, 5785, 5387, 13, 4706, 736, 426, 13, 9651, 396, 3630, 29899, 5344, 847, 269, 2934, 297, 19012, 718, 3630, 29899, 5344, 847, 269, 2934, 297, 3394, 13, 9651, 525, 299, 2396, 29871, 29906, 29892, 13, 9651, 525, 3487, 2396, 29871, 29896, 29892, 13, 9651, 396, 5655, 2582, 297, 19012, 13, 9651, 525, 29885, 2396, 29871, 29896, 29892, 13, 9651, 525, 29876, 2396, 29871, 29896, 29892, 13, 4706, 500, 13, 13, 1678, 822, 1439, 496, 29898, 1311, 29897, 1599, 525, 29954, 17019, 29968, 5851, 2396, 13, 4706, 1439, 3791, 29918, 7529, 353, 1583, 3032, 4801, 496, 29918, 7529, 580, 13, 4706, 736, 22477, 29968, 5851, 29898, 4801, 3791, 29918, 7529, 3366, 3754, 12436, 3523, 29922, 1311, 29889, 7529, 29897, 13, 13, 1678, 396, 694, 1144, 27988, 10772, 4062, 3563, 2429, 292, 13, 1678, 822, 10272, 29918, 29879, 5510, 29898, 1311, 29892, 1060, 29896, 29901, 317, 5510, 29911, 6073, 29892, 1060, 29906, 29901, 317, 5510, 29911, 6073, 29892, 714, 29901, 4842, 305, 29889, 29911, 6073, 29892, 13, 462, 539, 1060, 29896, 29918, 2395, 29878, 29901, 317, 5510, 29911, 6073, 29892, 1060, 29906, 29918, 2395, 29878, 29901, 317, 5510, 29911, 6073, 29897, 1599, 4842, 305, 29889, 29911, 6073, 29901, 13, 4706, 565, 7431, 29898, 1311, 29889, 3754, 29897, 1405, 29871, 29896, 29901, 13, 9651, 12020, 2216, 1888, 2037, 287, 2392, 703, 29903, 5510, 8466, 338, 871, 8762, 363, 17336, 4365, 8247, 23157, 13, 4706, 2906, 29918, 17460, 29918, 20158, 29918, 7529, 353, 1583, 3032, 11631, 29918, 17460, 29918, 7529, 29898, 29990, 29896, 29897, 13, 4706, 736, 364, 1635, 29918, 3221, 29918, 29879, 5510, 29898, 29990, 29896, 29892, 1060, 29906, 29892, 1060, 29896, 29918, 2395, 29878, 29892, 1060, 29906, 29918, 2395, 29878, 29892, 714, 29892, 2906, 29918, 17460, 29918, 20158, 29918, 7529, 3366, 3754, 20068, 13, 13, 1678, 822, 4770, 276, 558, 12035, 1311, 1125, 13, 4706, 736, 285, 29908, 29954, 17019, 29968, 5851, 29898, 3754, 3790, 1311, 29889, 3754, 1800, 29908, 13, 13, 1678, 822, 4770, 710, 12035, 1311, 1125, 13, 4706, 736, 285, 29908, 29954, 17019, 8466, 29966, 29912, 1311, 29889, 3754, 29913, 11903, 13, 13, 13, 1990, 20298, 433, 28445, 29968, 5851, 29898, 26023, 29968, 5851, 1125, 13, 1678, 364, 15945, 29908, 2385, 363, 20602, 278, 20298, 433, 28445, 8466, 29892, 322, 4475, 8466, 29899, 8111, 9316, 29889, 13, 13, 1678, 450, 20298, 433, 28445, 8466, 338, 2788, 304, 278, 22477, 8466, 29892, 541, 3109, 20502, 304, 3620, 13, 1678, 297, 278, 3443, 421, 3754, 1412, 13, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 1678, 269, 2934, 13, 4706, 450, 3309, 29899, 7052, 310, 278, 20298, 433, 28445, 8466, 13, 13, 1678, 8695, 13, 1678, 448, 807, 13, 1678, 450, 20298, 433, 28445, 8466, 338, 10087, 491, 278, 1494, 7063, 13, 13, 1678, 6317, 5844, 1057, 13, 13, 4706, 413, 29898, 29916, 29892, 921, 1495, 353, 320, 4548, 29912, 2612, 1154, 741, 29880, 9114, 921, 448, 921, 29915, 320, 29878, 9114, 3331, 3754, 930, 13, 13, 1678, 9995, 13, 1678, 8466, 29918, 978, 353, 376, 6984, 433, 28445, 29908, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 269, 2934, 29901, 7761, 29961, 7411, 29892, 4842, 305, 29889, 29911, 6073, 1402, 3523, 29901, 28379, 29961, 29943, 2235, 265, 5856, 29962, 353, 6213, 1125, 13, 4706, 1583, 29889, 3754, 353, 12725, 29918, 3754, 29898, 3754, 29897, 13, 13, 4706, 2428, 2141, 1649, 2344, 12035, 1311, 29889, 17460, 29918, 978, 29892, 3523, 29892, 7136, 29918, 9144, 29922, 6984, 433, 28445, 29918, 3221, 29892, 269, 2934, 29922, 1311, 29889, 3754, 29897, 13, 13, 1678, 822, 903, 446, 3554, 29918, 4317, 29894, 29918, 13699, 29898, 1311, 29892, 1060, 29896, 29892, 1060, 29906, 29892, 325, 29892, 8466, 29892, 714, 29892, 3523, 29901, 383, 2235, 265, 5856, 1125, 13, 4706, 7063, 353, 525, 9544, 6278, 29903, 29939, 2273, 29898, 29903, 29939, 13398, 29898, 29916, 29896, 847, 330, 29892, 921, 29906, 847, 330, 4961, 334, 325, 29915, 13, 4706, 14430, 2129, 353, 518, 13, 9651, 525, 29916, 29896, 353, 10630, 29414, 29881, 16029, 1273, 313, 29990, 29896, 29889, 12181, 29961, 29896, 11724, 13, 9651, 525, 29916, 29906, 353, 478, 29926, 29414, 29881, 16029, 1273, 313, 29990, 29906, 29889, 12181, 29961, 29896, 11724, 13, 9651, 525, 29894, 353, 478, 29926, 29414, 29881, 16029, 1273, 313, 29894, 29889, 12181, 29961, 29896, 11724, 13, 9651, 525, 29887, 353, 349, 29885, 29414, 29881, 16029, 1273, 313, 1311, 29889, 3754, 29889, 12181, 29961, 29900, 2314, 13, 4706, 4514, 13, 4706, 916, 29918, 16908, 353, 518, 1311, 29889, 3754, 29889, 517, 29898, 10141, 29922, 29990, 29896, 29889, 10141, 29892, 26688, 29922, 29990, 29896, 29889, 29881, 1853, 4638, 13, 13, 4706, 736, 1583, 29889, 446, 3554, 29918, 4317, 29894, 29898, 29990, 29896, 29892, 1060, 29906, 29892, 325, 29892, 714, 29892, 7063, 29892, 14430, 2129, 29892, 916, 29918, 16908, 29892, 3523, 29897, 13, 13, 1678, 822, 4805, 29918, 6954, 29898, 1311, 29897, 1599, 360, 919, 29961, 710, 29892, 5785, 5387, 13, 4706, 736, 426, 13, 9651, 396, 3630, 29899, 5344, 847, 269, 2934, 297, 19012, 718, 3630, 29899, 5344, 847, 269, 2934, 297, 3394, 13, 9651, 525, 299, 2396, 29871, 29906, 29892, 13, 9651, 525, 3487, 2396, 29871, 29896, 29892, 13, 9651, 396, 5655, 2582, 297, 19012, 13, 9651, 525, 29885, 2396, 29871, 29896, 29892, 13, 9651, 525, 29876, 2396, 29871, 29896, 29892, 13, 4706, 500, 13, 13, 1678, 822, 1439, 496, 29898, 1311, 29897, 1599, 525, 29931, 481, 433, 28445, 29968, 5851, 2396, 13, 4706, 1439, 3791, 29918, 7529, 353, 1583, 3032, 4801, 496, 29918, 7529, 580, 13, 4706, 736, 20298, 433, 28445, 29968, 5851, 29898, 4801, 3791, 29918, 7529, 3366, 3754, 12436, 3523, 29922, 1311, 29889, 7529, 29897, 13, 13, 1678, 396, 694, 1144, 27988, 10772, 4062, 3563, 2429, 292, 13, 1678, 822, 10272, 29918, 29879, 5510, 29898, 1311, 29892, 1060, 29896, 29901, 317, 5510, 29911, 6073, 29892, 1060, 29906, 29901, 317, 5510, 29911, 6073, 29892, 714, 29901, 4842, 305, 29889, 29911, 6073, 29892, 13, 462, 539, 1060, 29896, 29918, 2395, 29878, 29901, 317, 5510, 29911, 6073, 29892, 1060, 29906, 29918, 2395, 29878, 29901, 317, 5510, 29911, 6073, 29897, 1599, 4842, 305, 29889, 29911, 6073, 29901, 13, 4706, 565, 7431, 29898, 1311, 29889, 3754, 29897, 1405, 29871, 29896, 29901, 13, 9651, 12020, 2216, 1888, 2037, 287, 2392, 703, 29903, 5510, 8466, 338, 871, 8762, 363, 17336, 4365, 8247, 23157, 13, 4706, 2906, 29918, 17460, 29918, 20158, 29918, 7529, 353, 1583, 3032, 11631, 29918, 17460, 29918, 7529, 29898, 29990, 29896, 29897, 13, 4706, 736, 425, 13974, 28445, 29918, 3221, 29918, 29879, 5510, 29898, 29990, 29896, 29892, 1060, 29906, 29892, 1060, 29896, 29918, 2395, 29878, 29892, 1060, 29906, 29918, 2395, 29878, 29892, 714, 29892, 2906, 29918, 17460, 29918, 20158, 29918, 7529, 3366, 3754, 20068, 13, 13, 1678, 822, 4770, 276, 558, 12035, 1311, 1125, 13, 4706, 736, 285, 29908, 29931, 481, 433, 28445, 29968, 5851, 29898, 3754, 3790, 1311, 29889, 3754, 1800, 29908, 13, 13, 1678, 822, 4770, 710, 12035, 1311, 1125, 13, 4706, 736, 285, 29908, 29931, 481, 433, 455, 804, 5851, 29966, 29912, 1311, 29889, 3754, 29913, 11903, 13, 13, 13, 1990, 5345, 824, 29968, 5851, 29898, 26023, 29968, 5851, 1125, 13, 1678, 364, 15945, 29908, 2385, 363, 20602, 278, 5345, 824, 8466, 29892, 322, 4475, 8466, 29899, 8111, 9316, 29889, 13, 13, 1678, 450, 5345, 824, 413, 824, 1379, 4529, 263, 10035, 770, 310, 8466, 3168, 607, 7805, 278, 13, 1678, 20298, 433, 28445, 322, 22477, 413, 824, 1379, 29889, 450, 770, 338, 25011, 7485, 287, 491, 525, 3433, 4286, 1932, 421, 3433, 353, 29871, 29900, 29889, 29945, 29952, 13, 1678, 445, 8466, 338, 7126, 304, 278, 20298, 433, 28445, 8466, 29892, 746, 421, 3433, 353, 5785, 877, 7192, 1495, 1673, 278, 13, 1678, 5345, 824, 8466, 338, 7126, 304, 278, 22477, 8466, 29889, 13, 13, 1678, 910, 770, 10703, 278, 5345, 824, 8466, 871, 363, 278, 1819, 310, 4948, 607, 505, 263, 5764, 13, 1678, 883, 1650, 29892, 607, 526, 29871, 29900, 29889, 29945, 29892, 29871, 29896, 29889, 29945, 29892, 29871, 29906, 29889, 29945, 29892, 322, 27971, 29889, 13, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 1678, 269, 2934, 13, 4706, 450, 3309, 29899, 7052, 310, 278, 5345, 824, 8466, 29889, 450, 3309, 29899, 7052, 508, 367, 2845, 263, 17336, 13, 4706, 470, 263, 4608, 29889, 22513, 29899, 4387, 287, 3309, 29899, 19529, 267, 526, 451, 6068, 363, 278, 5345, 824, 8466, 29889, 13, 1678, 4948, 13, 4706, 450, 3443, 310, 278, 5345, 824, 8466, 29889, 739, 881, 367, 697, 310, 421, 29900, 29889, 29945, 1673, 421, 29896, 29889, 29945, 1673, 421, 29906, 29889, 29945, 29952, 470, 13, 4706, 421, 7192, 1412, 13, 13, 1678, 8695, 13, 1678, 448, 807, 13, 1678, 5806, 363, 421, 3433, 353, 5785, 877, 7192, 21434, 445, 8466, 338, 7126, 304, 278, 584, 1990, 18078, 29954, 17019, 29968, 5851, 1673, 13, 1678, 278, 5314, 338, 901, 2498, 322, 773, 278, 584, 1990, 18078, 29954, 17019, 29968, 5851, 29952, 4153, 13, 1678, 1122, 367, 16287, 635, 901, 8543, 29889, 13, 13, 1678, 9995, 13, 1678, 903, 3084, 29918, 3433, 29918, 5975, 353, 14671, 29920, 575, 300, 3319, 29900, 29889, 29945, 29892, 29871, 29896, 29889, 29945, 29892, 29871, 29906, 29889, 29945, 29892, 5785, 877, 7192, 1495, 1800, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 13, 462, 269, 2934, 29901, 7761, 29961, 7411, 29892, 4842, 305, 29889, 29911, 6073, 1402, 13, 462, 4948, 29901, 7761, 29961, 7411, 29892, 4842, 305, 29889, 29911, 6073, 1402, 13, 462, 3523, 29901, 28379, 29961, 29943, 2235, 265, 5856, 29962, 353, 6213, 1125, 13, 4706, 1583, 29889, 3754, 353, 12725, 29918, 3754, 29898, 3754, 29897, 13, 4706, 1583, 29889, 3433, 353, 1583, 29889, 15480, 29918, 3433, 29898, 3433, 29897, 13, 4706, 1583, 29889, 17460, 29918, 978, 353, 285, 29908, 29912, 1311, 29889, 3433, 29901, 29889, 29896, 29888, 7402, 2922, 824, 29908, 13, 4706, 2428, 2141, 1649, 2344, 12035, 1311, 29889, 17460, 29918, 978, 29892, 3523, 29892, 7136, 29918, 9144, 29922, 2922, 824, 29918, 3221, 29892, 269, 2934, 29922, 1311, 29889, 3754, 29892, 4948, 29922, 1311, 29889, 3433, 29897, 13, 13, 1678, 822, 903, 446, 3554, 29918, 4317, 29894, 29918, 13699, 29898, 1311, 29892, 1060, 29896, 29892, 1060, 29906, 29892, 325, 29892, 8466, 29892, 714, 29892, 3523, 29901, 383, 2235, 265, 5856, 1125, 13, 4706, 565, 1583, 29889, 3433, 1275, 29871, 29900, 29889, 29945, 29901, 13, 9651, 7063, 353, 525, 9544, 6278, 29940, 555, 29906, 29898, 29916, 29896, 847, 269, 448, 921, 29906, 847, 269, 876, 334, 325, 29915, 13, 4706, 25342, 1583, 29889, 3433, 1275, 29871, 29896, 29889, 29945, 29901, 13, 9651, 7063, 353, 6702, 29898, 2928, 29907, 303, 29898, 29896, 29897, 718, 317, 29939, 2273, 29898, 2928, 29907, 303, 29898, 29941, 876, 334, 5655, 29906, 29898, 29916, 29896, 847, 269, 448, 921, 29906, 847, 269, 876, 334, 525, 13, 462, 539, 525, 29898, 9544, 6278, 29903, 29939, 2273, 29898, 2928, 29907, 303, 29898, 29941, 876, 334, 5655, 29906, 29898, 29916, 29896, 847, 269, 448, 921, 29906, 847, 269, 876, 334, 325, 29897, 1495, 13, 4706, 25342, 1583, 29889, 3433, 1275, 29871, 29906, 29889, 29945, 29901, 13, 9651, 7063, 353, 6702, 29898, 2928, 29907, 303, 29898, 29896, 29897, 718, 317, 29939, 2273, 29898, 2928, 29907, 303, 29898, 29945, 876, 334, 5655, 29906, 29898, 29916, 29896, 847, 269, 448, 921, 29906, 847, 269, 29897, 718, 525, 13, 462, 539, 525, 29898, 2928, 12165, 29898, 29941, 29897, 334, 3159, 29907, 303, 29898, 29945, 876, 334, 317, 29939, 29940, 555, 29906, 29898, 29916, 29896, 847, 269, 448, 921, 29906, 847, 269, 876, 334, 525, 13, 462, 539, 525, 29898, 9544, 6278, 29903, 29939, 2273, 29898, 2928, 29907, 303, 29898, 29945, 876, 334, 5655, 29906, 29898, 29916, 29896, 847, 269, 448, 921, 29906, 847, 269, 876, 334, 325, 29897, 1495, 13, 4706, 25342, 1583, 29889, 3433, 1275, 5785, 877, 7192, 29374, 13, 9651, 7063, 353, 525, 9544, 29898, 2928, 12165, 6278, 29906, 29897, 334, 317, 29939, 13398, 29898, 29916, 29896, 847, 269, 29892, 921, 29906, 847, 269, 876, 334, 325, 29915, 13, 4706, 1683, 29901, 13, 9651, 12020, 24875, 2392, 29898, 29888, 29908, 2525, 29423, 1891, 995, 310, 4948, 21313, 1311, 29889, 3433, 7690, 376, 13, 462, 1669, 285, 29908, 1576, 373, 29876, 368, 6068, 1819, 526, 29871, 29900, 29889, 29945, 29892, 29871, 29896, 29889, 29945, 29892, 29871, 29906, 29889, 29945, 29892, 3041, 23157, 13, 4706, 14430, 2129, 353, 518, 13, 9651, 525, 29916, 29896, 353, 10630, 29414, 29881, 16029, 1273, 313, 29990, 29896, 29889, 12181, 29961, 29896, 11724, 13, 9651, 525, 29916, 29906, 353, 478, 29926, 29414, 29881, 16029, 1273, 313, 29990, 29906, 29889, 12181, 29961, 29896, 11724, 13, 9651, 525, 29894, 353, 478, 29926, 29414, 29881, 16029, 1273, 313, 29894, 29889, 12181, 29961, 29896, 11724, 13, 9651, 525, 29879, 353, 349, 29885, 29414, 29881, 16029, 1273, 313, 1311, 29889, 3754, 29889, 12181, 29961, 29900, 2314, 13, 4706, 4514, 13, 4706, 916, 29918, 16908, 353, 518, 1311, 29889, 3754, 29889, 517, 29898, 10141, 29922, 29990, 29896, 29889, 10141, 29892, 26688, 29922, 29990, 29896, 29889, 29881, 1853, 4638, 13, 13, 4706, 736, 1583, 29889, 446, 3554, 29918, 4317, 29894, 29898, 29990, 29896, 29892, 1060, 29906, 29892, 325, 29892, 714, 29892, 7063, 29892, 14430, 2129, 29892, 916, 29918, 16908, 29892, 3523, 29897, 13, 13, 1678, 822, 4805, 29918, 6954, 29898, 1311, 29897, 1599, 360, 919, 29961, 710, 29892, 5785, 5387, 13, 4706, 4805, 29918, 6954, 353, 426, 13, 9651, 396, 3630, 29899, 5344, 847, 269, 2934, 13, 9651, 525, 299, 2396, 29871, 29896, 29892, 13, 9651, 525, 3487, 2396, 29871, 29896, 29892, 13, 9651, 396, 5655, 2582, 297, 19012, 13, 9651, 525, 29885, 2396, 29871, 29896, 29892, 13, 9651, 525, 29876, 2396, 29871, 29896, 29892, 13, 4706, 500, 13, 4706, 565, 1583, 29889, 3433, 297, 426, 29896, 29889, 29945, 29892, 29871, 29906, 29889, 29945, 6177, 13, 9651, 396, 7338, 336, 8466, 2908, 297, 4327, 13, 9651, 4805, 29918, 6954, 1839, 22882, 2033, 353, 29871, 29896, 13, 4706, 736, 4805, 29918, 6954, 13, 13, 1678, 822, 1439, 496, 29898, 1311, 29897, 1599, 525, 9782, 824, 29968, 5851, 2396, 13, 4706, 1439, 3791, 29918, 7529, 353, 1583, 3032, 4801, 496, 29918, 7529, 580, 13, 4706, 736, 5345, 824, 29968, 5851, 29898, 4801, 3791, 29918, 7529, 3366, 3754, 12436, 1439, 3791, 29918, 7529, 3366, 3433, 12436, 3523, 29922, 1311, 29889, 7529, 29897, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 12725, 29918, 3433, 29898, 3433, 29901, 7761, 29961, 7345, 305, 29889, 29911, 6073, 29892, 5785, 2314, 1599, 5785, 29901, 13, 4706, 565, 338, 8758, 29898, 3433, 29892, 4842, 305, 29889, 29911, 6073, 1125, 13, 9651, 565, 4948, 29889, 276, 339, 2658, 29918, 5105, 29901, 13, 18884, 12020, 7865, 2392, 703, 1576, 4948, 3443, 310, 278, 5345, 824, 8466, 338, 451, 17473, 519, 29892, 376, 13, 462, 462, 376, 392, 1818, 451, 1996, 4656, 10070, 23157, 13, 9651, 1018, 29901, 13, 18884, 714, 29918, 3433, 353, 4513, 29898, 3433, 29889, 667, 3285, 29871, 299, 335, 1169, 29922, 29906, 29897, 13, 9651, 5174, 7865, 2392, 29901, 13, 18884, 12020, 7865, 2392, 703, 3433, 16328, 29879, 338, 451, 3588, 1821, 304, 263, 17336, 1213, 1273, 313, 3433, 876, 13, 4706, 25342, 338, 8758, 29898, 3433, 29892, 5785, 1125, 13, 9651, 714, 29918, 3433, 353, 4513, 29898, 3433, 29892, 29871, 299, 335, 1169, 29922, 29906, 29897, 13, 4706, 1683, 29901, 13, 9651, 12020, 20948, 29898, 29888, 29908, 3433, 1818, 367, 263, 5785, 470, 263, 12489, 29892, 451, 263, 426, 1853, 29898, 3433, 2915, 1159, 13, 4706, 565, 714, 29918, 3433, 451, 297, 5345, 824, 29968, 5851, 3032, 3084, 29918, 3433, 29918, 5975, 29901, 13, 9651, 12020, 7865, 2392, 29898, 29888, 29908, 1576, 2183, 995, 310, 4948, 353, 426, 449, 29918, 3433, 29913, 508, 871, 2125, 376, 13, 462, 632, 285, 29908, 5975, 426, 9782, 824, 29968, 5851, 3032, 3084, 29918, 3433, 29918, 5975, 1836, 1159, 13, 4706, 736, 714, 29918, 3433, 13, 13, 1678, 396, 694, 1144, 27988, 10772, 4062, 3563, 2429, 292, 13, 1678, 822, 10272, 29918, 29879, 5510, 29898, 1311, 29892, 1060, 29896, 29901, 317, 5510, 29911, 6073, 29892, 1060, 29906, 29901, 317, 5510, 29911, 6073, 29892, 714, 29901, 4842, 305, 29889, 29911, 6073, 29892, 13, 462, 539, 1060, 29896, 29918, 2395, 29878, 29901, 317, 5510, 29911, 6073, 29892, 1060, 29906, 29918, 2395, 29878, 29901, 317, 5510, 29911, 6073, 29897, 1599, 4842, 305, 29889, 29911, 6073, 29901, 13, 4706, 565, 7431, 29898, 1311, 29889, 3754, 29897, 1405, 29871, 29896, 29901, 13, 9651, 12020, 2216, 1888, 2037, 287, 2392, 703, 29903, 5510, 8466, 338, 871, 8762, 363, 17336, 4365, 8247, 23157, 13, 4706, 2906, 29918, 17460, 29918, 20158, 29918, 7529, 353, 1583, 3032, 11631, 29918, 17460, 29918, 7529, 29898, 29990, 29896, 29897, 13, 4706, 736, 1775, 824, 29918, 3221, 29918, 29879, 5510, 29898, 29990, 29896, 29892, 1060, 29906, 29892, 1060, 29896, 29918, 2395, 29878, 29892, 1060, 29906, 29918, 2395, 29878, 29892, 714, 29892, 2906, 29918, 17460, 29918, 20158, 29918, 7529, 3366, 3754, 12436, 13, 462, 462, 29871, 1583, 29889, 3433, 29897, 13, 13, 1678, 822, 4770, 276, 558, 12035, 1311, 1125, 13, 4706, 736, 285, 29908, 9782, 824, 29968, 5851, 29898, 3754, 3790, 1311, 29889, 3754, 1118, 4948, 3790, 1311, 29889, 3433, 29901, 29889, 29896, 29888, 1800, 29908, 13, 13, 1678, 822, 4770, 710, 12035, 1311, 1125, 13, 4706, 736, 285, 29908, 9782, 824, 8466, 29966, 29912, 1311, 29889, 3754, 1118, 426, 1311, 29889, 3433, 29901, 29889, 29896, 29888, 29913, 11903, 13, 2 ]
scripts/graph.py
maurizioabba/rose
488
56323
#!/usr/bin/env python # ############################################################################### # # Author: <NAME> # Date: 8/24/2006 # File: graph.py # Purpose: Plots ROSE performance data # ############################################################################### import sys import os import string import getopt import csv import math from gclass import * from optparse import * ############################################################################### def getHash(rawData): """ """ hash = dict([ (rawData[i],rawData[i+1]) for i in range(0,len(rawData)-1,2) ]) return hash ############################################################################## def generateGraph(reader,fout,xKey,yExclude,yInclude,separator): """ """ if yInclude != []: keys = yInclude for row in reader: hash = getHash(row) data = "" if yInclude == [] and yExclude != []: keys = hash.keys() keys.remove(xKey) for y in yExclude: keys.remove(y) for key in keys: data = data + separator + hash[key] fout.write(hash[xKey] + data + '\n') return keys ############################################################################### def csv2gnuplot(inputs,output,xKey,yExclude,yInclude,xlabel,ylabel, Format,height,width,pointsize,with, yMin,yMax,xMin,xMax): """ """ fout = open(output + ".dat",'a') for i in inputs: reader = csv.reader(open(i,'r'),doublequote=True,skipinitialspace=True) keys = generateGraph(reader,fout,xKey,yExclude,yInclude,"\t") # gnuplot formatting index = 0 fscriptout = open(output + ".plt",'a') while index < len(keys): if index > 0: fscriptout.write("re") fscriptout.write("plot \"" + output + ".dat" +"\" using 1:" + str(index + 2) + ' ') if with != "": fscriptout.write("smooth csplines ") fscriptout.write("title \"" + keys[index] + "\"" + ' ') fscriptout.write("with " + with + '\n') else: fscriptout.write("title \"" + keys[index] + "\"" + '\n') index += 1 # while if Format != "": fscriptout.write("set terminal " + Format + '\n') fscriptout.write("set output \"" + output + '.' + Format + "\"\n") if xMin != "" or xMax != "": fscriptout.write("set xrange [" + xMin + ':' + xMax + "]\n") if yMin != "" or yMax != "": fscriptout.write("set yrange [" + yMin + ':' + yMax + "]\n") if xlabel != "": fscriptout.write("set xlabel \"" + xlabel + "\"\n") else: fscriptout.write("set xlabel \"" + xKey + "\"\n") if ylabel != "": fscriptout.write("set ylabel \"" + ylabel + "\"\n") # if fscriptout.write("set key below\nset key box\n") fscriptout.write("set size " + width + ',' + height + '\n') fscriptout.write("set pointsize " + pointsize + '\n') fscriptout.write("replot\n") # end gnuplot formatting return # cvs2gnuplot() ############################################################################### def csv2excel(inputs,output,xKey,yExclude): """ """ fout = open(output + ".csv",'a') for i in inputs: reader = csv.reader(open(i,'r'),doublequote=True,skipinitialspace=True) generateGraph(reader,fout,xKey,yExclude,',') return ############################################################################### def csv2matlab(inputs,output,xKey,yExclude,xlabel,ylabel,height,width,Format): """ """ fout = open(output + ".dat",'a') # Matlab data for i in inputs: reader = csv.reader(open(i,'r'),doublequote=True,skipinitialspace=True) keys = generateGraph(reader,fout,xKey,yExclude," ") # Matlab script fscriptout = open(output + ".m",'a') index = 2 ceilSqrt = int(math.ceil(math.sqrt(len(keys)))) if xlabel == "": xlabel = xKey fscriptout.write("load " + output + ".dat" + '\n') fscriptout.write("set(gcf,'position',[0 0 " + str(width) + ' ' + str(height) + "])\n") fscriptout.write("x = " + output + "(:,1)\n") while index < len(keys) + 2: fscriptout.write("y" + str(index) + " = " + output + "(:," + str(index) + ")\n") fscriptout.write("xlabel('" + xlabel + "')\n") fscriptout.write("ylabel('" + ylabel + "')\n") #fscriptout.write("ylabel('" + keys[index - 2] + "')\n") fscriptout.write("subplot(" + str(ceilSqrt) + ',' + str(ceilSqrt) + ',' + str(index - 1) + ") ; ") fscriptout.write("plot(x,y" + str(index) + ",'o')\n") fscriptout.write("legend('" + keys[index - 2] + "')\n") index += 1 if Format != "": fscriptout.write("set(gcf,'PaperPositionMode','auto')\n") fscriptout.write("print(gcf,'-d" + Format + "'," + '\'' + output + '.' + Format + "')\n") fscriptout.write("quit\n") # Matlab script return ############################################################################### def cmdOptionParse(parser): """ cmdOptionParse(): Parses command-line arguments and redirects to appropriate functions. arguments: parser -- a optparse object that stores command-line arguments """ # parse out options and input file arguments (options,inputs) = parser.parse_args() if inputs == []: sys.stderr.write("Error: No input file(s) specified\n") sys.exit(1) if options.output != "": output = options.output.split('.')[0] else: sys.stderr.write("Error: No output file name specified\n") sys.exit(1) if options.list: print "Supported formats:" print "1. Gnuplot (.dat .plt) -fgnuplot" print "2. MS Excel (.csv) -fexcel" print "3. Matlab (.dat) -fmatlab" sys.exit(0) if options.x == "": sys.stderr.write("Error: X-Axis data not specified, please specify with -x\n") sys.exit(1) # if, error checking if options.format == "gnuplot": if options.e != [] and options.y != []: sys.stderr.write("Error: Options -e and -y may not be used concurrently\n") sys.exit(1) csv2gnuplot(inputs,output,options.x,options.e,options.y, options.xlabel,options.ylabel,options.Format, options.Height,options.Width,options.pointsize, options.with,options.ymin,options.ymax, options.xmin,options.xmax) if options.rehash != "" and options.granularity != "": rehash(output + ".dat",string.atoi(options.granularity),'\t') elif options.rehash != "" and options.granularity == "": sys.stderr.write("Error: You must specifiy -g or --granularity with --rehash\n") sys.exit(1) if options.run: args = [] args.append("") args.append(output + ".plt") os.execvp("gnuplot",args) # if # if elif options.format == "excel": csv2excel(inputs,options.output,options.x,options.e) elif options.format == "matlab": csv2matlab(inputs,options.output,options.x,options.e, options.xlabel,options.ylabel, options.Height,options.Width, options.Format) if options.run: args = [] args.append("") args.append("-nodesktop") args.append("-r") args.append(output) os.execvp("matlab",args) else: sys.stderr.write("Error: Unrecognized output format\n") return ############################################################################### def cmdOptionInit(arguments): """ cmdOptionInit(): Initializes command-line parser optparse object. Specifies which option flags behave in what way according to optparse. arguments: arguments -- sys.argv list of command-line arguments variables: parser -- optparse, OptionParser() """ parser = OptionParser() parser.set_usage("graph.py <input file> [options]") parser.add_option("-f","--format",help="Output file format", metavar="%FORMAT%") parser.add_option("-F","--Format",help="Secondard output format", metavar="%FORMAT%",default="") parser.add_option("-l","--list", help="List supported output formats", action="store_true") parser.add_option("-o","--output",help="Output file name",metavar="%FILE%", default="") parser.add_option("-r","--run",help="Run plotting tool",action="store_true") parser.add_option("-x",help="X Axis Key Data",metavar="<XKEY>",default="") parser.add_option("-y",help="Include Y Axis Data",metavar="<KEY>", action="append",default=[]) parser.add_option("-e",help="Exclude Y Axis Data",metavar="<KEY>", action="append",default=[]) parser.add_option("-g","--granularity", help="granularity range for data manipulation", metavar="<#>",default="") parser.add_option("-w","--with",help="With lines,points,etc.", metavar="%WITH%",default="") parser.add_option("-H","--Height",help="Output Height default=1", metavar="<H#>",default="1") parser.add_option("-W","--Width",help="Output Width default=1", metavar="<W#>",default="1") parser.add_option("-P","--pointsize",help="Set pointsize default=1", metavar="<P#>",default="1") parser.add_option("--rehash",help="Rehash Data",metavar="%MODE%", default="") parser.add_option("--xlabel",help="X-Axis Label",metavar="%LABEL%", default="") parser.add_option("--xmin",help="Minimum X range value",metavar="<#>", default="") parser.add_option("--xmax",help="Maximum X range value",metavar="<#>", default="") parser.add_option("--ylabel",help="Y-Axis Label",metavar="%LABEL%", default="") parser.add_option("--ymin",help="Minimum Y range value",metavar="<#>", default="") parser.add_option("--ymax",help="Maximum Y range value",metavar="<#>", default="") return parser ############################################################################### ############################################################################### parser = cmdOptionInit(sys.argv) cmdOptionParse(parser) # control flow: # main->cmdOptionInit->main->cmdOptionParse->csv2{}->generateGraph<->getHash()
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 13, 29937, 13, 13383, 13383, 13383, 13383, 7346, 4136, 2277, 29937, 13, 29937, 13, 29937, 13361, 29901, 529, 5813, 29958, 13, 29937, 4712, 29901, 29871, 29947, 29914, 29906, 29946, 29914, 29906, 29900, 29900, 29953, 13, 29937, 3497, 29901, 3983, 29889, 2272, 13, 29937, 15247, 4220, 29901, 1858, 1862, 16641, 1660, 4180, 848, 29871, 13, 29937, 13, 13383, 13383, 13383, 13383, 7346, 4136, 2277, 29937, 13, 13, 5215, 10876, 13, 5215, 2897, 13, 5215, 1347, 13, 5215, 679, 3670, 13, 5215, 11799, 13, 5215, 5844, 13, 3166, 330, 1990, 1053, 334, 13, 3166, 3523, 5510, 1053, 334, 13, 13, 13383, 13383, 13383, 13383, 7346, 4136, 2277, 29937, 13, 13, 1753, 679, 10438, 29898, 1610, 1469, 1125, 13, 29871, 9995, 13, 29871, 9995, 13, 13, 29871, 6608, 353, 9657, 4197, 313, 1610, 1469, 29961, 29875, 1402, 1610, 1469, 29961, 29875, 29974, 29896, 2314, 363, 474, 297, 3464, 29898, 29900, 29892, 2435, 29898, 1610, 1469, 6817, 29896, 29892, 29906, 29897, 29871, 2314, 13, 13, 29871, 736, 6608, 13, 13, 13383, 13383, 13383, 13383, 7346, 4136, 2277, 13, 13, 1753, 5706, 9527, 29898, 16950, 29892, 29888, 449, 29892, 29916, 2558, 29892, 29891, 1252, 2325, 29892, 29891, 29419, 29892, 344, 17954, 1125, 13, 29871, 9995, 13, 29871, 9995, 13, 13, 29871, 565, 343, 29419, 2804, 5159, 29901, 13, 1678, 6611, 353, 343, 29419, 13, 259, 13, 29871, 363, 1948, 297, 9591, 29901, 13, 1678, 6608, 353, 679, 10438, 29898, 798, 29897, 13, 1678, 848, 353, 5124, 13, 13, 1678, 565, 343, 29419, 1275, 5159, 322, 343, 1252, 2325, 2804, 5159, 29901, 13, 418, 6611, 353, 6608, 29889, 8149, 580, 13, 418, 6611, 29889, 5992, 29898, 29916, 2558, 29897, 13, 13, 418, 363, 343, 297, 343, 1252, 2325, 29901, 13, 4706, 6611, 29889, 5992, 29898, 29891, 29897, 13, 13, 1678, 363, 1820, 297, 6611, 29901, 13, 418, 848, 353, 848, 718, 28128, 718, 6608, 29961, 1989, 29962, 13, 13, 1678, 285, 449, 29889, 3539, 29898, 8568, 29961, 29916, 2558, 29962, 718, 848, 718, 11297, 29876, 1495, 13, 13, 29871, 736, 6611, 13, 13, 13383, 13383, 13383, 13383, 7346, 4136, 2277, 29937, 13, 13, 1753, 11799, 29906, 18713, 5317, 29898, 2080, 29879, 29892, 4905, 29892, 29916, 2558, 29892, 29891, 1252, 2325, 29892, 29891, 29419, 29892, 29916, 1643, 29892, 29891, 1643, 29892, 13, 12, 12, 5809, 29892, 3545, 29892, 2103, 29892, 3149, 2311, 29892, 2541, 29892, 13, 12, 12, 29891, 8140, 29892, 29891, 7976, 29892, 29916, 8140, 29892, 29916, 7976, 1125, 13, 29871, 9995, 13, 29871, 9995, 13, 13, 29871, 285, 449, 353, 1722, 29898, 4905, 718, 11393, 4130, 613, 29915, 29874, 1495, 13, 259, 13, 29871, 363, 474, 297, 10970, 29901, 13, 1678, 9591, 353, 11799, 29889, 16950, 29898, 3150, 29898, 29875, 5501, 29878, 5477, 8896, 1396, 29922, 5574, 29892, 11014, 11228, 3493, 29922, 5574, 29897, 13, 1678, 6611, 353, 5706, 9527, 29898, 16950, 29892, 29888, 449, 29892, 29916, 2558, 29892, 29891, 1252, 2325, 29892, 29891, 29419, 1699, 29905, 29873, 1159, 13, 13, 29871, 396, 330, 3433, 5317, 15998, 13, 29871, 2380, 353, 29871, 29900, 13, 29871, 285, 2154, 449, 353, 1722, 29898, 4905, 718, 11393, 572, 29873, 613, 29915, 29874, 1495, 13, 13, 29871, 1550, 2380, 529, 7431, 29898, 8149, 1125, 13, 1678, 565, 2380, 1405, 29871, 29900, 29901, 13, 418, 285, 2154, 449, 29889, 3539, 703, 276, 1159, 13, 13, 1678, 285, 2154, 449, 29889, 3539, 703, 5317, 13218, 29908, 718, 1962, 718, 11393, 4130, 29908, 718, 29908, 5931, 773, 29871, 29896, 6160, 718, 29871, 13, 12, 710, 29898, 2248, 718, 29871, 29906, 29897, 718, 525, 25710, 29871, 13, 13, 1678, 565, 411, 2804, 376, 1115, 13, 418, 285, 2154, 449, 29889, 3539, 703, 3844, 6983, 5939, 572, 1475, 16521, 13, 418, 285, 2154, 449, 29889, 3539, 703, 3257, 13218, 29908, 718, 6611, 29961, 2248, 29962, 718, 376, 5931, 29908, 718, 525, 25710, 29871, 13, 418, 285, 2154, 449, 29889, 3539, 703, 2541, 376, 718, 411, 718, 11297, 29876, 1495, 13, 1678, 1683, 29901, 13, 418, 285, 2154, 449, 29889, 3539, 703, 3257, 13218, 29908, 718, 6611, 29961, 2248, 29962, 718, 376, 5931, 29908, 718, 11297, 29876, 1495, 13, 13, 1678, 2380, 4619, 29871, 29896, 13, 29871, 396, 1550, 13, 13, 29871, 565, 19191, 2804, 376, 1115, 13, 1678, 285, 2154, 449, 29889, 3539, 703, 842, 8638, 376, 718, 19191, 718, 11297, 29876, 1495, 13, 1678, 285, 2154, 449, 29889, 3539, 703, 842, 1962, 13218, 29908, 718, 1962, 718, 525, 6169, 718, 19191, 718, 376, 5931, 29905, 29876, 1159, 13, 13, 29871, 565, 921, 8140, 2804, 5124, 470, 921, 7976, 2804, 376, 1115, 13, 1678, 285, 2154, 449, 29889, 3539, 703, 842, 921, 3881, 6796, 718, 921, 8140, 718, 525, 11283, 718, 921, 7976, 718, 376, 10725, 29876, 1159, 13, 13, 29871, 565, 343, 8140, 2804, 5124, 470, 343, 7976, 2804, 376, 1115, 13, 1678, 285, 2154, 449, 29889, 3539, 703, 842, 343, 3881, 6796, 718, 343, 8140, 718, 525, 11283, 718, 343, 7976, 718, 376, 10725, 29876, 1159, 29871, 13, 259, 13, 29871, 565, 921, 1643, 2804, 376, 1115, 13, 1678, 285, 2154, 449, 29889, 3539, 703, 842, 921, 1643, 13218, 29908, 718, 921, 1643, 718, 376, 5931, 29905, 29876, 1159, 13, 29871, 1683, 29901, 13, 1678, 285, 2154, 449, 29889, 3539, 703, 842, 921, 1643, 13218, 29908, 718, 921, 2558, 718, 376, 5931, 29905, 29876, 1159, 13, 13, 29871, 565, 343, 1643, 2804, 376, 1115, 13, 1678, 285, 2154, 449, 29889, 3539, 703, 842, 343, 1643, 13218, 29908, 718, 343, 1643, 718, 376, 5931, 29905, 29876, 1159, 13, 29871, 396, 565, 13, 29871, 13, 29871, 285, 2154, 449, 29889, 3539, 703, 842, 1820, 2400, 29905, 29876, 842, 1820, 3800, 29905, 29876, 1159, 29871, 13, 29871, 285, 2154, 449, 29889, 3539, 703, 842, 2159, 376, 718, 2920, 718, 525, 5501, 718, 3171, 718, 11297, 29876, 1495, 13, 29871, 285, 2154, 449, 29889, 3539, 703, 842, 1298, 2311, 376, 718, 1298, 2311, 718, 11297, 29876, 1495, 13, 29871, 285, 2154, 449, 29889, 3539, 703, 276, 5317, 29905, 29876, 1159, 13, 13, 29871, 396, 1095, 330, 3433, 5317, 15998, 13, 13, 29871, 736, 13, 29871, 396, 274, 4270, 29906, 18713, 5317, 580, 13, 13, 13383, 13383, 13383, 13383, 7346, 4136, 2277, 29937, 13, 13, 1753, 11799, 29906, 24633, 29898, 2080, 29879, 29892, 4905, 29892, 29916, 2558, 29892, 29891, 1252, 2325, 1125, 13, 29871, 9995, 13, 29871, 9995, 13, 29871, 285, 449, 353, 1722, 29898, 4905, 718, 11393, 7638, 613, 29915, 29874, 1495, 13, 13, 29871, 363, 474, 297, 10970, 29901, 13, 1678, 9591, 353, 11799, 29889, 16950, 29898, 3150, 29898, 29875, 5501, 29878, 5477, 8896, 1396, 29922, 5574, 29892, 11014, 11228, 3493, 29922, 5574, 29897, 13, 1678, 5706, 9527, 29898, 16950, 29892, 29888, 449, 29892, 29916, 2558, 29892, 29891, 1252, 2325, 29892, 742, 1495, 13, 13, 29871, 736, 13, 13, 13383, 13383, 13383, 13383, 7346, 4136, 2277, 29937, 13, 13, 1753, 11799, 29906, 2922, 8205, 29898, 2080, 29879, 29892, 4905, 29892, 29916, 2558, 29892, 29891, 1252, 2325, 29892, 29916, 1643, 29892, 29891, 1643, 29892, 3545, 29892, 2103, 29892, 5809, 1125, 13, 29871, 9995, 13, 29871, 9995, 13, 13, 29871, 285, 449, 353, 1722, 29898, 4905, 718, 11393, 4130, 613, 29915, 29874, 1495, 13, 259, 13, 29871, 396, 5345, 8205, 848, 13, 29871, 363, 474, 297, 10970, 29901, 13, 1678, 9591, 353, 11799, 29889, 16950, 29898, 3150, 29898, 29875, 5501, 29878, 5477, 8896, 1396, 29922, 5574, 29892, 11014, 11228, 3493, 29922, 5574, 29897, 13, 1678, 6611, 353, 5706, 9527, 29898, 16950, 29892, 29888, 449, 29892, 29916, 2558, 29892, 29891, 1252, 2325, 1699, 29871, 16521, 13, 13, 29871, 396, 5345, 8205, 2471, 13, 29871, 285, 2154, 449, 353, 1722, 29898, 4905, 718, 11393, 29885, 613, 29915, 29874, 1495, 13, 29871, 2380, 353, 29871, 29906, 13, 29871, 2257, 309, 29903, 29939, 2273, 353, 938, 29898, 755, 29889, 27696, 29898, 755, 29889, 3676, 29898, 2435, 29898, 8149, 13697, 13, 13, 29871, 565, 921, 1643, 1275, 376, 1115, 13, 1678, 921, 1643, 353, 921, 2558, 13, 13, 29871, 285, 2154, 449, 29889, 3539, 703, 1359, 376, 718, 1962, 718, 11393, 4130, 29908, 718, 11297, 29876, 1495, 13, 29871, 285, 2154, 449, 29889, 3539, 703, 842, 29898, 29887, 6854, 5501, 3283, 742, 29961, 29900, 29871, 29900, 376, 718, 851, 29898, 2103, 29897, 718, 525, 525, 718, 29871, 13, 12, 12, 12, 710, 29898, 3545, 29897, 718, 376, 29962, 2144, 29876, 1159, 13, 29871, 285, 2154, 449, 29889, 3539, 703, 29916, 353, 376, 718, 1962, 718, 376, 8137, 29892, 29896, 2144, 29876, 1159, 13, 13, 29871, 1550, 2380, 529, 7431, 29898, 8149, 29897, 718, 29871, 29906, 29901, 13, 1678, 285, 2154, 449, 29889, 3539, 703, 29891, 29908, 718, 851, 29898, 2248, 29897, 718, 376, 353, 376, 718, 1962, 718, 376, 8137, 1699, 29871, 13, 12, 12, 12, 29974, 851, 29898, 2248, 29897, 718, 376, 2144, 29876, 1159, 13, 1678, 285, 2154, 449, 29889, 3539, 703, 29916, 1643, 877, 29908, 718, 921, 1643, 718, 376, 1495, 29905, 29876, 1159, 13, 1678, 285, 2154, 449, 29889, 3539, 703, 29891, 1643, 877, 29908, 718, 343, 1643, 718, 376, 1495, 29905, 29876, 1159, 13, 1678, 396, 29888, 2154, 449, 29889, 3539, 703, 29891, 1643, 877, 29908, 718, 6611, 29961, 2248, 448, 29871, 29906, 29962, 718, 376, 1495, 29905, 29876, 1159, 13, 1678, 285, 2154, 449, 29889, 3539, 703, 1491, 5317, 703, 718, 851, 29898, 27696, 29903, 29939, 2273, 29897, 718, 525, 5501, 718, 851, 29898, 27696, 29903, 29939, 2273, 29897, 718, 29871, 13, 12, 12, 12, 3788, 718, 851, 29898, 2248, 448, 29871, 29896, 29897, 718, 16521, 2056, 16521, 13, 1678, 285, 2154, 449, 29889, 3539, 703, 5317, 29898, 29916, 29892, 29891, 29908, 718, 851, 29898, 2248, 29897, 718, 376, 5501, 29877, 1495, 29905, 29876, 1159, 13, 1678, 285, 2154, 449, 29889, 3539, 703, 26172, 877, 29908, 718, 6611, 29961, 2248, 448, 29871, 29906, 29962, 718, 376, 1495, 29905, 29876, 1159, 13, 1678, 2380, 4619, 29871, 29896, 13, 13, 29871, 565, 19191, 2804, 376, 1115, 13, 1678, 285, 2154, 449, 29889, 3539, 703, 842, 29898, 29887, 6854, 5501, 29925, 7202, 8003, 6818, 3788, 6921, 1495, 29905, 29876, 1159, 13, 1678, 285, 2154, 449, 29889, 3539, 703, 2158, 29898, 29887, 6854, 5501, 29899, 29881, 29908, 718, 19191, 718, 376, 742, 29908, 718, 11297, 4907, 718, 29871, 13, 12, 12, 12, 4905, 718, 525, 6169, 718, 19191, 718, 376, 1495, 29905, 29876, 1159, 13, 1678, 285, 2154, 449, 29889, 3539, 703, 28358, 29905, 29876, 1159, 13, 29871, 396, 5345, 8205, 2471, 13, 13, 29871, 736, 13, 13, 13383, 13383, 13383, 13383, 7346, 4136, 2277, 29937, 13, 13, 1753, 9920, 8375, 12914, 29898, 16680, 1125, 13, 29871, 9995, 13, 1678, 9920, 8375, 12914, 7295, 13, 12, 29925, 1503, 267, 1899, 29899, 1220, 6273, 322, 28937, 304, 8210, 3168, 29889, 13, 13, 12, 25699, 29901, 13, 12, 16680, 1192, 263, 3523, 5510, 1203, 393, 14422, 1899, 29899, 1220, 6273, 13, 29871, 9995, 13, 13, 29871, 396, 6088, 714, 3987, 322, 1881, 934, 6273, 13, 29871, 313, 6768, 29892, 2080, 29879, 29897, 353, 13812, 29889, 5510, 29918, 5085, 580, 13, 13, 29871, 565, 10970, 1275, 5159, 29901, 13, 1678, 10876, 29889, 303, 20405, 29889, 3539, 703, 2392, 29901, 1939, 1881, 934, 29898, 29879, 29897, 6790, 29905, 29876, 1159, 13, 1678, 10876, 29889, 13322, 29898, 29896, 29897, 13, 13, 29871, 565, 3987, 29889, 4905, 2804, 376, 1115, 13, 1678, 1962, 353, 3987, 29889, 4905, 29889, 5451, 12839, 29861, 29900, 29962, 13, 29871, 1683, 29901, 13, 1678, 10876, 29889, 303, 20405, 29889, 3539, 703, 2392, 29901, 1939, 1962, 934, 1024, 6790, 29905, 29876, 1159, 13, 1678, 10876, 29889, 13322, 29898, 29896, 29897, 13, 13, 29871, 565, 3987, 29889, 1761, 29901, 13, 1678, 1596, 376, 14039, 287, 21971, 6160, 13, 1678, 1596, 376, 29896, 29889, 402, 3433, 5317, 14544, 4130, 869, 572, 29873, 29897, 448, 16434, 3433, 5317, 29908, 13, 1678, 1596, 376, 29906, 29889, 10888, 11388, 14544, 7638, 29897, 448, 29888, 24633, 29908, 13, 1678, 1596, 376, 29941, 29889, 5345, 8205, 14544, 4130, 29897, 448, 29888, 2922, 8205, 29908, 13, 1678, 10876, 29889, 13322, 29898, 29900, 29897, 13, 13, 29871, 565, 3987, 29889, 29916, 1275, 376, 1115, 13, 1678, 10876, 29889, 303, 20405, 29889, 3539, 703, 2392, 29901, 1060, 29899, 16070, 848, 451, 6790, 29892, 3113, 6084, 411, 448, 29916, 29905, 29876, 1159, 13, 1678, 10876, 29889, 13322, 29898, 29896, 29897, 13, 29871, 396, 565, 29892, 1059, 8454, 13, 13, 29871, 565, 3987, 29889, 4830, 1275, 376, 18713, 5317, 1115, 13, 1678, 565, 3987, 29889, 29872, 2804, 5159, 322, 3987, 29889, 29891, 2804, 5159, 29901, 13, 418, 10876, 29889, 303, 20405, 29889, 3539, 703, 2392, 29901, 25186, 448, 29872, 322, 448, 29891, 1122, 451, 367, 1304, 21984, 368, 29905, 29876, 1159, 13, 418, 10876, 29889, 13322, 29898, 29896, 29897, 13, 13, 1678, 11799, 29906, 18713, 5317, 29898, 2080, 29879, 29892, 4905, 29892, 6768, 29889, 29916, 29892, 6768, 29889, 29872, 29892, 6768, 29889, 29891, 29892, 13, 12, 12, 6768, 29889, 29916, 1643, 29892, 6768, 29889, 29891, 1643, 29892, 6768, 29889, 5809, 29892, 13, 12, 12, 6768, 29889, 7011, 29892, 6768, 29889, 6110, 29892, 6768, 29889, 3149, 2311, 29892, 13, 12, 12, 6768, 29889, 2541, 29892, 6768, 29889, 962, 262, 29892, 6768, 29889, 29891, 3317, 29892, 13, 12, 12, 6768, 29889, 29916, 1195, 29892, 6768, 29889, 29916, 3317, 29897, 13, 13, 1678, 565, 3987, 29889, 276, 8568, 2804, 5124, 322, 3987, 29889, 629, 273, 1070, 537, 2804, 376, 1115, 13, 418, 337, 8568, 29898, 4905, 718, 11393, 4130, 613, 1807, 29889, 1219, 29875, 29898, 6768, 29889, 629, 273, 1070, 537, 511, 12764, 29873, 1495, 13, 1678, 25342, 3987, 29889, 276, 8568, 2804, 5124, 322, 3987, 29889, 629, 273, 1070, 537, 1275, 376, 1115, 13, 418, 10876, 29889, 303, 20405, 29889, 3539, 703, 2392, 29901, 887, 1818, 1580, 6832, 29891, 448, 29887, 470, 1192, 629, 273, 1070, 537, 411, 1192, 276, 8568, 29905, 29876, 1159, 13, 418, 10876, 29889, 13322, 29898, 29896, 29897, 13, 13, 1678, 565, 3987, 29889, 3389, 29901, 13, 418, 6389, 353, 5159, 13, 418, 6389, 29889, 4397, 703, 1159, 13, 418, 6389, 29889, 4397, 29898, 4905, 718, 11393, 572, 29873, 1159, 13, 418, 2897, 29889, 4258, 29894, 29886, 703, 18713, 5317, 613, 5085, 29897, 13, 1678, 396, 565, 13, 29871, 396, 565, 13, 29871, 25342, 3987, 29889, 4830, 1275, 376, 24633, 1115, 13, 1678, 11799, 29906, 24633, 29898, 2080, 29879, 29892, 6768, 29889, 4905, 29892, 6768, 29889, 29916, 29892, 6768, 29889, 29872, 29897, 13, 29871, 25342, 3987, 29889, 4830, 1275, 376, 2922, 8205, 1115, 13, 1678, 11799, 29906, 2922, 8205, 29898, 2080, 29879, 29892, 6768, 29889, 4905, 29892, 6768, 29889, 29916, 29892, 6768, 29889, 29872, 29892, 13, 12, 12, 6768, 29889, 29916, 1643, 29892, 6768, 29889, 29891, 1643, 29892, 13, 12, 12, 6768, 29889, 7011, 29892, 6768, 29889, 6110, 29892, 13, 12, 12, 6768, 29889, 5809, 29897, 13, 13, 1678, 565, 3987, 29889, 3389, 29901, 13, 418, 6389, 353, 5159, 13, 418, 6389, 29889, 4397, 703, 1159, 13, 418, 6389, 29889, 4397, 703, 29899, 18010, 6883, 1159, 13, 418, 6389, 29889, 4397, 703, 29899, 29878, 1159, 13, 418, 6389, 29889, 4397, 29898, 4905, 29897, 13, 418, 2897, 29889, 4258, 29894, 29886, 703, 2922, 8205, 613, 5085, 29897, 13, 29871, 1683, 29901, 13, 1678, 10876, 29889, 303, 20405, 29889, 3539, 703, 2392, 29901, 853, 29423, 1891, 1962, 3402, 29905, 29876, 1159, 13, 13, 29871, 736, 13, 13, 13383, 13383, 13383, 13383, 7346, 4136, 2277, 29937, 13, 13, 1753, 9920, 8375, 6644, 29898, 25699, 1125, 13, 29871, 9995, 13, 1678, 9920, 8375, 6644, 7295, 13, 12, 15514, 7093, 1899, 29899, 1220, 13812, 3523, 5510, 1203, 29889, 12048, 11057, 607, 2984, 13, 12, 15764, 23389, 297, 825, 982, 5034, 304, 3523, 5510, 29889, 13, 13, 12, 25699, 29901, 13, 12, 25699, 1192, 10876, 29889, 19218, 1051, 310, 1899, 29899, 1220, 6273, 13, 13, 12, 20897, 29901, 13, 12, 16680, 1192, 3523, 5510, 29892, 10831, 11726, 580, 13, 29871, 9995, 13, 29871, 13812, 353, 10831, 11726, 580, 13, 13, 29871, 13812, 29889, 842, 29918, 21125, 703, 4262, 29889, 2272, 529, 2080, 934, 29958, 518, 6768, 29962, 1159, 13, 13, 29871, 13812, 29889, 1202, 29918, 3385, 703, 29899, 29888, 3284, 489, 4830, 613, 8477, 543, 6466, 934, 3402, 613, 13, 12, 12, 12, 2527, 485, 279, 543, 29995, 19094, 1299, 29995, 1159, 13, 29871, 13812, 29889, 1202, 29918, 3385, 703, 29899, 29943, 3284, 489, 5809, 613, 8477, 543, 11863, 538, 1962, 3402, 613, 13, 12, 12, 12, 2527, 485, 279, 543, 29995, 19094, 1299, 29995, 613, 4381, 543, 1159, 13, 29871, 13812, 29889, 1202, 29918, 3385, 703, 29899, 29880, 3284, 489, 1761, 613, 1371, 543, 1293, 6969, 1962, 21971, 613, 13, 12, 12, 12, 2467, 543, 8899, 29918, 3009, 1159, 13, 29871, 13812, 29889, 1202, 29918, 3385, 703, 29899, 29877, 3284, 489, 4905, 613, 8477, 543, 6466, 934, 1024, 613, 2527, 485, 279, 543, 29995, 7724, 29995, 613, 13, 12, 12, 12, 4381, 543, 1159, 13, 29871, 13812, 29889, 1202, 29918, 3385, 703, 29899, 29878, 3284, 489, 3389, 613, 8477, 543, 6558, 6492, 1259, 5780, 613, 2467, 543, 8899, 29918, 3009, 1159, 13, 29871, 13812, 29889, 1202, 29918, 3385, 703, 29899, 29916, 613, 8477, 543, 29990, 319, 11497, 7670, 3630, 613, 2527, 485, 279, 543, 29966, 29990, 10818, 28341, 4381, 543, 1159, 13, 29871, 13812, 29889, 1202, 29918, 3385, 703, 29899, 29891, 613, 8477, 543, 29419, 612, 319, 11497, 3630, 613, 2527, 485, 279, 543, 29966, 10818, 28341, 13, 12, 12, 12, 2467, 543, 4397, 613, 4381, 11759, 2314, 13, 29871, 13812, 29889, 1202, 29918, 3385, 703, 29899, 29872, 613, 8477, 543, 1252, 2325, 612, 319, 11497, 3630, 613, 2527, 485, 279, 543, 29966, 10818, 28341, 13, 12, 12, 12, 2467, 543, 4397, 613, 4381, 11759, 2314, 13, 29871, 13812, 29889, 1202, 29918, 3385, 703, 29899, 29887, 3284, 489, 629, 273, 1070, 537, 613, 13, 12, 12, 12, 8477, 543, 629, 273, 1070, 537, 3464, 363, 848, 11525, 2785, 613, 13, 12, 12, 12, 2527, 485, 279, 543, 29966, 29937, 28341, 4381, 543, 1159, 13, 29871, 13812, 29889, 1202, 29918, 3385, 703, 29899, 29893, 3284, 489, 2541, 613, 8477, 543, 3047, 3454, 29892, 9748, 29892, 7070, 19602, 13, 12, 12, 12, 2527, 485, 279, 543, 29995, 29956, 13054, 29995, 613, 4381, 543, 1159, 13, 29871, 13812, 29889, 1202, 29918, 3385, 703, 29899, 29950, 3284, 489, 7011, 613, 8477, 543, 6466, 22907, 2322, 29922, 29896, 613, 13, 12, 12, 12, 2527, 485, 279, 543, 29966, 29950, 29937, 28341, 4381, 543, 29896, 1159, 13, 29871, 13812, 29889, 1202, 29918, 3385, 703, 29899, 29956, 3284, 489, 6110, 613, 8477, 543, 6466, 21485, 2322, 29922, 29896, 613, 13, 12, 12, 12, 2527, 485, 279, 543, 29966, 29956, 29937, 28341, 4381, 543, 29896, 1159, 13, 29871, 13812, 29889, 1202, 29918, 3385, 703, 29899, 29925, 3284, 489, 3149, 2311, 613, 8477, 543, 2697, 1298, 2311, 2322, 29922, 29896, 613, 13, 12, 12, 12, 2527, 485, 279, 543, 29966, 29925, 29937, 28341, 4381, 543, 29896, 1159, 13, 29871, 13812, 29889, 1202, 29918, 3385, 703, 489, 276, 8568, 613, 8477, 543, 1123, 8568, 3630, 613, 2527, 485, 279, 543, 29995, 20387, 29995, 613, 13, 12, 12, 12, 4381, 543, 1159, 13, 29871, 13812, 29889, 1202, 29918, 3385, 703, 489, 29916, 1643, 613, 8477, 543, 29990, 29899, 16070, 15796, 613, 2527, 485, 279, 543, 29995, 24461, 6670, 29995, 613, 13, 12, 12, 12, 4381, 543, 1159, 13, 29871, 13812, 29889, 1202, 29918, 3385, 703, 489, 29916, 1195, 613, 8477, 543, 8140, 12539, 1060, 3464, 995, 613, 2527, 485, 279, 543, 29966, 29937, 28341, 13, 12, 12, 12, 4381, 543, 1159, 13, 29871, 13812, 29889, 1202, 29918, 3385, 703, 489, 29916, 3317, 613, 8477, 543, 7976, 12539, 1060, 3464, 995, 613, 2527, 485, 279, 543, 29966, 29937, 28341, 13, 12, 12, 12, 4381, 543, 1159, 13, 29871, 13812, 29889, 1202, 29918, 3385, 703, 489, 29891, 1643, 613, 8477, 543, 29979, 29899, 16070, 15796, 613, 2527, 485, 279, 543, 29995, 24461, 6670, 29995, 613, 13, 12, 12, 12, 4381, 543, 1159, 13, 29871, 13812, 29889, 1202, 29918, 3385, 703, 489, 962, 262, 613, 8477, 543, 8140, 12539, 612, 3464, 995, 613, 2527, 485, 279, 543, 29966, 29937, 28341, 13, 12, 12, 12, 4381, 543, 1159, 13, 29871, 13812, 29889, 1202, 29918, 3385, 703, 489, 29891, 3317, 613, 8477, 543, 7976, 12539, 612, 3464, 995, 613, 2527, 485, 279, 543, 29966, 29937, 28341, 13, 12, 12, 12, 4381, 543, 1159, 13, 13, 29871, 736, 13812, 13, 13, 13383, 13383, 13383, 13383, 7346, 4136, 2277, 29937, 13, 13383, 13383, 13383, 13383, 7346, 4136, 2277, 29937, 13, 13, 16680, 353, 9920, 8375, 6644, 29898, 9675, 29889, 19218, 29897, 13, 9006, 8375, 12914, 29898, 16680, 29897, 13, 13, 29937, 2761, 4972, 29901, 29871, 13, 29937, 1667, 976, 9006, 8375, 6644, 976, 3396, 976, 9006, 8375, 12914, 976, 7638, 29906, 8875, 976, 17158, 9527, 29966, 976, 657, 10438, 580, 13, 2 ]
scripts/migrate_to_rapidpro/fix_auto_baby_switch_data.py
praekeltfoundation/ndoh-hub
0
176707
import asyncio import csv import os import time from datetime import datetime, timedelta import aiohttp import psycopg2 from six.moves import urllib_parse CONCURRENCY = 10 HUB_OUTPUT_FILE = "hub_babyswitches.csv" RAPIDPRO_OUTPUT_FILE = "rapidpro_babyswitch_updates.csv" LIMIT = 10_000_000 RAPIDPRO_URL = "https://rapidpro.prd.momconnect.co.za/" RAPIDPRO_TOKEN = os.environ["RAPIDPRO_TOKEN"] HUB_DB_PASSWORD = os.environ["HUB_PASS"] total = 0 excluded = 0 start, d_print = time.time(), time.time() async def get_rapidpro_contact(session, contact_id): url = urllib_parse.urljoin(RAPIDPRO_URL, f"/api/v2/contacts.json?uuid={contact_id}") headers = { "Authorization": f"TOKEN {RAPIDPRO_TOKEN}", "Content-Type": "application/json", "Connection": "Keep-Alive", } async with session.get(url, headers=headers) as response: response_body = await response.json() if response_body["results"]: return response_body["results"][0] return None def in_postbirth_group(contact): for group in contact["groups"]: if "post" in group["name"].lower(): return True return False def get_contact_msisdn(contact): for urn in contact["urns"]: if "whatsapp" in urn: return "+" + urn.split(":")[1] def get_baby_dob_field(fields): for i in range(1, 4): dob_field = f"baby_dob{i}" if not fields[dob_field]: return dob_field def get_babyswitches(conn): babyswitches = {} cursor = conn.cursor("baby_switches") print("Fetching Baby Switches...") cursor.execute( f""" select contact_id, timestamp from eventstore_babyswitch order by timestamp asc limit {LIMIT} """ ) # 158680 total = 0 start, d_print = time.time(), time.time() for (contact_id, timestamp) in cursor: babyswitches[contact_id] = timestamp if time.time() - d_print > 1: print( f"\rFetched {total} babyswitches at " f"{total/(time.time() - start):.0f}/s", end="", ) d_print = time.time() total += 1 print(f"\nFetched {total} babyswitches in {time.time() - start:.0f}s") print("-------------------------------------------") return babyswitches def get_optouts(conn): optouts = {} print("Fetching Optouts...") cursor = conn.cursor("optouts") cursor.execute( f""" select contact_id, timestamp from eventstore_optout order by timestamp asc limit {LIMIT} """ ) # 255855 total = 0 start, d_print = time.time(), time.time() for (contact_id, timestamp) in cursor: optouts[contact_id] = timestamp if time.time() - d_print > 1: print( f"\rFetched {total} optouts at " f"{total/(time.time() - start):.0f}/s", end="", ) d_print = time.time() total += 1 print(f"\nFetched {total} optouts in {time.time() - start:.0f}s") print("-------------------------------------------") return optouts def get_registrations(conn, babyswitches, optouts): registrations = [] print("Fetching Prebirth Registrations...") cursor = conn.cursor("prebirth_registrations") cursor.execute( f""" select contact_id, timestamp from eventstore_prebirthregistration where edd < '2021-04-20' order by timestamp asc limit {LIMIT} """ ) # 216808 total = 0 start, d_print = time.time(), time.time() for (contact_id, timestamp) in cursor: if contact_id in babyswitches and timestamp < babyswitches[contact_id]: continue if contact_id in optouts and timestamp < optouts[contact_id]: continue registrations.append(contact_id) if time.time() - d_print > 1: print( f"\rFetched {total} registrations at " f"{total/(time.time() - start):.0f}/s", end="", ) d_print = time.time() total += 1 print(f"\nFetched {total} registrations in {time.time() - start:.0f}s") print("-------------------------------------------") return registrations async def process_registration(session, contact_id, hub_writer, rp_writer): global total global excluded global d_print global start total += 1 contact = await get_rapidpro_contact(session, contact_id) if contact: msisdn = get_contact_msisdn(contact) in_group = in_postbirth_group(contact) if ( in_group or not msisdn or contact["fields"].get("preferred_channel") != "WhatsApp" ): excluded += 1 else: baby_dob_field = get_baby_dob_field(contact["fields"]) edd = str(contact["fields"]["edd"]).replace("Z", "") try: dob = datetime.fromisoformat(edd) + timedelta(days=14) except (TypeError, ValueError): excluded += 1 return rp_writer.writerow( { "contact_id": contact_id, "baby_dob_field": baby_dob_field, "baby_dob": dob.isoformat(), } ) # write to csv for jembi and hub hub_writer.writerow( { "contact_id": contact_id, "msisdn": msisdn, "timestamp": datetime.now().isoformat(), } ) if time.time() - d_print > 1: print( f"\rProcessed {total}({excluded}) registrations at " f"{total/(time.time() - start):.0f}/s", end="", ) d_print = time.time() async def bounded_process_registration(session, contact_id, hub_writer, rp_writer, sem): async with sem: await process_registration(session, contact_id, hub_writer, rp_writer) async def process_registrations(registrations): global total global start sema = asyncio.Semaphore(CONCURRENCY) print("Processing Registrations...") with open(HUB_OUTPUT_FILE, "w", newline="") as hub_target, open( RAPIDPRO_OUTPUT_FILE, "w", newline="" ) as rp_target: hub_writer = csv.DictWriter( hub_target, fieldnames=["contact_id", "msisdn", "timestamp"] ) hub_writer.writeheader() rp_writer = csv.DictWriter( rp_target, fieldnames=["contact_id", "baby_dob_field", "baby_dob"] ) rp_writer.writeheader() connector = aiohttp.TCPConnector(limit=CONCURRENCY) async with aiohttp.ClientSession(connector=connector) as session: tasks = [] for contact_id in registrations: tasks.append( bounded_process_registration( session, contact_id, hub_writer, rp_writer, sema ) ) await asyncio.gather(*tasks) print(f"\nProcessed {total} registrations in {time.time() - start:.0f}s") if __name__ == "__main__": conn = psycopg2.connect( dbname="hub", user="hub", password=<PASSWORD>, host="localhost", port=7000 ) babyswitches = get_babyswitches(conn) optouts = get_optouts(conn) registrations = get_registrations(conn, babyswitches, optouts) asyncio.run(process_registrations(registrations))
[ 1, 1053, 408, 948, 3934, 13, 5215, 11799, 13, 5215, 2897, 13, 5215, 931, 13, 3166, 12865, 1053, 12865, 29892, 5335, 287, 2554, 13, 13, 5215, 263, 601, 1124, 13, 5215, 6529, 29891, 9708, 29887, 29906, 13, 3166, 4832, 29889, 13529, 267, 1053, 3142, 1982, 29918, 5510, 13, 13, 6007, 22484, 29934, 1430, 29907, 29979, 353, 29871, 29896, 29900, 13, 29950, 7466, 29918, 12015, 12336, 29918, 7724, 353, 376, 29882, 431, 29918, 29890, 370, 952, 29893, 2335, 267, 29889, 7638, 29908, 13, 29934, 3301, 1367, 8618, 29918, 12015, 12336, 29918, 7724, 353, 376, 2390, 333, 771, 29918, 29890, 370, 952, 29893, 2335, 29918, 786, 15190, 29889, 7638, 29908, 13, 13, 5265, 26349, 353, 29871, 29896, 29900, 29918, 29900, 29900, 29900, 29918, 29900, 29900, 29900, 13, 29934, 3301, 1367, 8618, 29918, 4219, 353, 376, 991, 597, 2390, 333, 771, 29889, 558, 29881, 29889, 29885, 290, 6915, 29889, 1111, 29889, 1362, 12975, 13, 29934, 3301, 1367, 8618, 29918, 4986, 29968, 1430, 353, 2897, 29889, 21813, 3366, 29934, 3301, 1367, 8618, 29918, 4986, 29968, 1430, 3108, 13, 13, 29950, 7466, 29918, 4051, 29918, 25711, 17013, 353, 2897, 29889, 21813, 3366, 29950, 7466, 29918, 25711, 3108, 13, 13, 7827, 353, 29871, 29900, 13, 735, 13347, 353, 29871, 29900, 13, 2962, 29892, 270, 29918, 2158, 353, 931, 29889, 2230, 3285, 931, 29889, 2230, 580, 13, 13, 13, 12674, 822, 679, 29918, 2390, 333, 771, 29918, 12346, 29898, 7924, 29892, 6958, 29918, 333, 1125, 13, 1678, 3142, 353, 3142, 1982, 29918, 5510, 29889, 2271, 7122, 29898, 29934, 3301, 1367, 8618, 29918, 4219, 29892, 285, 23901, 2754, 29914, 29894, 29906, 29914, 12346, 29879, 29889, 3126, 29973, 25118, 3790, 12346, 29918, 333, 27195, 13, 1678, 9066, 353, 426, 13, 4706, 376, 25471, 1115, 285, 29908, 4986, 29968, 1430, 426, 29934, 3301, 1367, 8618, 29918, 4986, 29968, 1430, 17671, 13, 4706, 376, 3916, 29899, 1542, 1115, 376, 6214, 29914, 3126, 613, 13, 4706, 376, 5350, 1115, 376, 9598, 1022, 29899, 29909, 9258, 613, 13, 1678, 500, 13, 1678, 7465, 411, 4867, 29889, 657, 29898, 2271, 29892, 9066, 29922, 13662, 29897, 408, 2933, 29901, 13, 4706, 2933, 29918, 2587, 353, 7272, 2933, 29889, 3126, 580, 13, 13, 4706, 565, 2933, 29918, 2587, 3366, 9902, 3108, 29901, 13, 9651, 736, 2933, 29918, 2587, 3366, 9902, 3108, 29961, 29900, 29962, 13, 13, 4706, 736, 6213, 13, 13, 13, 1753, 297, 29918, 2490, 29890, 7515, 29918, 2972, 29898, 12346, 1125, 13, 1678, 363, 2318, 297, 6958, 3366, 13155, 3108, 29901, 13, 4706, 565, 376, 2490, 29908, 297, 2318, 3366, 978, 16862, 13609, 7295, 13, 9651, 736, 5852, 13, 13, 1678, 736, 7700, 13, 13, 13, 1753, 679, 29918, 12346, 29918, 1516, 275, 5200, 29898, 12346, 1125, 13, 1678, 363, 5065, 29876, 297, 6958, 3366, 595, 29879, 3108, 29901, 13, 4706, 565, 376, 1332, 1446, 932, 29908, 297, 5065, 29876, 29901, 13, 9651, 736, 376, 13578, 718, 5065, 29876, 29889, 5451, 703, 29901, 1159, 29961, 29896, 29962, 13, 13, 13, 1753, 679, 29918, 29890, 10798, 29918, 11152, 29918, 2671, 29898, 9621, 1125, 13, 1678, 363, 474, 297, 3464, 29898, 29896, 29892, 29871, 29946, 1125, 13, 4706, 20129, 29918, 2671, 353, 285, 29908, 29890, 10798, 29918, 11152, 29912, 29875, 5038, 13, 4706, 565, 451, 4235, 29961, 11152, 29918, 2671, 5387, 13, 9651, 736, 20129, 29918, 2671, 13, 13, 13, 1753, 679, 29918, 29890, 370, 952, 29893, 2335, 267, 29898, 13082, 1125, 13, 1678, 289, 370, 952, 29893, 2335, 267, 353, 6571, 13, 1678, 10677, 353, 11009, 29889, 18127, 703, 29890, 10798, 29918, 15123, 267, 1159, 13, 1678, 1596, 703, 20927, 292, 26835, 28176, 267, 856, 1159, 13, 1678, 10677, 29889, 7978, 29898, 13, 4706, 285, 15945, 29908, 13, 4706, 1831, 6958, 29918, 333, 29892, 14334, 13, 4706, 515, 1741, 8899, 29918, 29890, 370, 952, 29893, 2335, 13, 4706, 1797, 491, 14334, 12066, 13, 4706, 4046, 426, 5265, 26349, 29913, 13, 4706, 9995, 13, 1678, 1723, 29871, 396, 29871, 29896, 29945, 29947, 29953, 29947, 29900, 13, 1678, 3001, 353, 29871, 29900, 13, 1678, 1369, 29892, 270, 29918, 2158, 353, 931, 29889, 2230, 3285, 931, 29889, 2230, 580, 13, 1678, 363, 313, 12346, 29918, 333, 29892, 14334, 29897, 297, 10677, 29901, 13, 4706, 289, 370, 952, 29893, 2335, 267, 29961, 12346, 29918, 333, 29962, 353, 14334, 13, 13, 4706, 565, 931, 29889, 2230, 580, 448, 270, 29918, 2158, 1405, 29871, 29896, 29901, 13, 9651, 1596, 29898, 13, 18884, 285, 26732, 29878, 20927, 287, 426, 7827, 29913, 289, 370, 952, 29893, 2335, 267, 472, 376, 13, 18884, 285, 29908, 29912, 7827, 14571, 2230, 29889, 2230, 580, 448, 1369, 1125, 29889, 29900, 29888, 6822, 29879, 613, 13, 18884, 1095, 543, 613, 13, 9651, 1723, 13, 9651, 270, 29918, 2158, 353, 931, 29889, 2230, 580, 13, 4706, 3001, 4619, 29871, 29896, 13, 1678, 1596, 29898, 29888, 26732, 29876, 20927, 287, 426, 7827, 29913, 289, 370, 952, 29893, 2335, 267, 297, 426, 2230, 29889, 2230, 580, 448, 1369, 29901, 29889, 29900, 29888, 29913, 29879, 1159, 13, 1678, 1596, 703, 2683, 2683, 1378, 5634, 1159, 13, 1678, 736, 289, 370, 952, 29893, 2335, 267, 13, 13, 13, 1753, 679, 29918, 3670, 17718, 29898, 13082, 1125, 13, 1678, 3523, 17718, 353, 6571, 13, 13, 1678, 1596, 703, 20927, 292, 20693, 17718, 856, 1159, 13, 1678, 10677, 353, 11009, 29889, 18127, 703, 3670, 17718, 1159, 13, 1678, 10677, 29889, 7978, 29898, 13, 4706, 285, 15945, 29908, 13, 4706, 1831, 6958, 29918, 333, 29892, 14334, 13, 4706, 515, 1741, 8899, 29918, 3670, 449, 13, 4706, 1797, 491, 14334, 12066, 13, 4706, 4046, 426, 5265, 26349, 29913, 13, 4706, 9995, 13, 1678, 1723, 29871, 396, 29871, 29906, 29945, 29945, 29947, 29945, 29945, 13, 1678, 3001, 353, 29871, 29900, 13, 1678, 1369, 29892, 270, 29918, 2158, 353, 931, 29889, 2230, 3285, 931, 29889, 2230, 580, 13, 1678, 363, 313, 12346, 29918, 333, 29892, 14334, 29897, 297, 10677, 29901, 13, 4706, 3523, 17718, 29961, 12346, 29918, 333, 29962, 353, 14334, 13, 13, 4706, 565, 931, 29889, 2230, 580, 448, 270, 29918, 2158, 1405, 29871, 29896, 29901, 13, 9651, 1596, 29898, 13, 18884, 285, 26732, 29878, 20927, 287, 426, 7827, 29913, 3523, 17718, 472, 376, 285, 29908, 29912, 7827, 14571, 2230, 29889, 2230, 580, 448, 1369, 1125, 29889, 29900, 29888, 6822, 29879, 613, 13, 18884, 1095, 543, 613, 13, 9651, 1723, 13, 9651, 270, 29918, 2158, 353, 931, 29889, 2230, 580, 13, 4706, 3001, 4619, 29871, 29896, 13, 1678, 1596, 29898, 29888, 26732, 29876, 20927, 287, 426, 7827, 29913, 3523, 17718, 297, 426, 2230, 29889, 2230, 580, 448, 1369, 29901, 29889, 29900, 29888, 29913, 29879, 1159, 13, 1678, 1596, 703, 2683, 2683, 1378, 5634, 1159, 13, 1678, 736, 3523, 17718, 13, 13, 13, 1753, 679, 29918, 29238, 800, 29898, 13082, 29892, 289, 370, 952, 29893, 2335, 267, 29892, 3523, 17718, 1125, 13, 1678, 21557, 800, 353, 5159, 13, 13, 1678, 1596, 703, 20927, 292, 4721, 29890, 7515, 2169, 2132, 800, 856, 1159, 13, 1678, 10677, 353, 11009, 29889, 18127, 703, 1457, 29890, 7515, 29918, 29238, 800, 1159, 13, 1678, 10677, 29889, 7978, 29898, 13, 4706, 285, 15945, 29908, 13, 4706, 1831, 6958, 29918, 333, 29892, 14334, 13, 4706, 515, 1741, 8899, 29918, 1457, 29890, 7515, 1727, 8306, 13, 4706, 988, 1226, 29881, 529, 525, 29906, 29900, 29906, 29896, 29899, 29900, 29946, 29899, 29906, 29900, 29915, 13, 4706, 1797, 491, 14334, 12066, 13, 4706, 4046, 426, 5265, 26349, 29913, 13, 4706, 9995, 13, 1678, 1723, 29871, 396, 29871, 29906, 29896, 29953, 29947, 29900, 29947, 13, 1678, 3001, 353, 29871, 29900, 13, 1678, 1369, 29892, 270, 29918, 2158, 353, 931, 29889, 2230, 3285, 931, 29889, 2230, 580, 13, 1678, 363, 313, 12346, 29918, 333, 29892, 14334, 29897, 297, 10677, 29901, 13, 4706, 565, 6958, 29918, 333, 297, 289, 370, 952, 29893, 2335, 267, 322, 14334, 529, 289, 370, 952, 29893, 2335, 267, 29961, 12346, 29918, 333, 5387, 13, 9651, 6773, 13, 4706, 565, 6958, 29918, 333, 297, 3523, 17718, 322, 14334, 529, 3523, 17718, 29961, 12346, 29918, 333, 5387, 13, 9651, 6773, 13, 4706, 21557, 800, 29889, 4397, 29898, 12346, 29918, 333, 29897, 13, 13, 4706, 565, 931, 29889, 2230, 580, 448, 270, 29918, 2158, 1405, 29871, 29896, 29901, 13, 9651, 1596, 29898, 13, 18884, 285, 26732, 29878, 20927, 287, 426, 7827, 29913, 21557, 800, 472, 376, 13, 18884, 285, 29908, 29912, 7827, 14571, 2230, 29889, 2230, 580, 448, 1369, 1125, 29889, 29900, 29888, 6822, 29879, 613, 13, 18884, 1095, 543, 613, 13, 9651, 1723, 13, 9651, 270, 29918, 2158, 353, 931, 29889, 2230, 580, 13, 4706, 3001, 4619, 29871, 29896, 13, 1678, 1596, 29898, 29888, 26732, 29876, 20927, 287, 426, 7827, 29913, 21557, 800, 297, 426, 2230, 29889, 2230, 580, 448, 1369, 29901, 29889, 29900, 29888, 29913, 29879, 1159, 13, 1678, 1596, 703, 2683, 2683, 1378, 5634, 1159, 13, 1678, 736, 21557, 800, 13, 13, 13, 12674, 822, 1889, 29918, 1727, 8306, 29898, 7924, 29892, 6958, 29918, 333, 29892, 19766, 29918, 13236, 29892, 364, 29886, 29918, 13236, 1125, 13, 1678, 5534, 3001, 13, 1678, 5534, 429, 13347, 13, 1678, 5534, 270, 29918, 2158, 13, 1678, 5534, 1369, 13, 13, 1678, 3001, 4619, 29871, 29896, 13, 13, 1678, 6958, 353, 7272, 679, 29918, 2390, 333, 771, 29918, 12346, 29898, 7924, 29892, 6958, 29918, 333, 29897, 13, 13, 1678, 565, 6958, 29901, 13, 4706, 10887, 275, 5200, 353, 679, 29918, 12346, 29918, 1516, 275, 5200, 29898, 12346, 29897, 13, 13, 4706, 297, 29918, 2972, 353, 297, 29918, 2490, 29890, 7515, 29918, 2972, 29898, 12346, 29897, 13, 4706, 565, 313, 13, 9651, 297, 29918, 2972, 13, 9651, 470, 451, 10887, 275, 5200, 13, 9651, 470, 6958, 3366, 9621, 16862, 657, 703, 1457, 14373, 29918, 12719, 1159, 2804, 376, 8809, 1446, 2052, 29908, 13, 308, 1125, 13, 9651, 429, 13347, 4619, 29871, 29896, 13, 4706, 1683, 29901, 13, 9651, 24354, 29918, 11152, 29918, 2671, 353, 679, 29918, 29890, 10798, 29918, 11152, 29918, 2671, 29898, 12346, 3366, 9621, 20068, 13, 9651, 1226, 29881, 353, 851, 29898, 12346, 3366, 9621, 3108, 3366, 287, 29881, 3108, 467, 6506, 703, 29999, 613, 20569, 13, 9651, 1018, 29901, 13, 18884, 20129, 353, 12865, 29889, 3166, 10718, 4830, 29898, 287, 29881, 29897, 718, 5335, 287, 2554, 29898, 16700, 29922, 29896, 29946, 29897, 13, 9651, 5174, 313, 1542, 2392, 29892, 7865, 2392, 1125, 13, 18884, 429, 13347, 4619, 29871, 29896, 13, 18884, 736, 13, 13, 9651, 364, 29886, 29918, 13236, 29889, 13236, 340, 29898, 13, 18884, 426, 13, 462, 1678, 376, 12346, 29918, 333, 1115, 6958, 29918, 333, 29892, 13, 462, 1678, 376, 29890, 10798, 29918, 11152, 29918, 2671, 1115, 24354, 29918, 11152, 29918, 2671, 29892, 13, 462, 1678, 376, 29890, 10798, 29918, 11152, 1115, 20129, 29889, 10718, 4830, 3285, 13, 18884, 500, 13, 9651, 1723, 13, 13, 9651, 396, 2436, 304, 11799, 363, 432, 1590, 29875, 322, 19766, 13, 9651, 19766, 29918, 13236, 29889, 13236, 340, 29898, 13, 18884, 426, 13, 462, 1678, 376, 12346, 29918, 333, 1115, 6958, 29918, 333, 29892, 13, 462, 1678, 376, 1516, 275, 5200, 1115, 10887, 275, 5200, 29892, 13, 462, 1678, 376, 16394, 1115, 12865, 29889, 3707, 2141, 10718, 4830, 3285, 13, 18884, 500, 13, 9651, 1723, 13, 13, 1678, 565, 931, 29889, 2230, 580, 448, 270, 29918, 2158, 1405, 29871, 29896, 29901, 13, 4706, 1596, 29898, 13, 9651, 285, 26732, 29878, 7032, 287, 426, 7827, 2119, 29912, 735, 13347, 1800, 21557, 800, 472, 376, 13, 9651, 285, 29908, 29912, 7827, 14571, 2230, 29889, 2230, 580, 448, 1369, 1125, 29889, 29900, 29888, 6822, 29879, 613, 13, 9651, 1095, 543, 613, 13, 4706, 1723, 13, 4706, 270, 29918, 2158, 353, 931, 29889, 2230, 580, 13, 13, 13, 12674, 822, 12635, 29918, 5014, 29918, 1727, 8306, 29898, 7924, 29892, 6958, 29918, 333, 29892, 19766, 29918, 13236, 29892, 364, 29886, 29918, 13236, 29892, 3031, 1125, 13, 1678, 7465, 411, 3031, 29901, 13, 4706, 7272, 1889, 29918, 1727, 8306, 29898, 7924, 29892, 6958, 29918, 333, 29892, 19766, 29918, 13236, 29892, 364, 29886, 29918, 13236, 29897, 13, 13, 13, 12674, 822, 1889, 29918, 29238, 800, 29898, 29238, 800, 1125, 13, 1678, 5534, 3001, 13, 1678, 5534, 1369, 13, 13, 1678, 269, 2603, 353, 408, 948, 3934, 29889, 28516, 12451, 487, 29898, 6007, 22484, 29934, 1430, 29907, 29979, 29897, 13, 13, 1678, 1596, 703, 7032, 292, 2169, 2132, 800, 856, 1159, 13, 1678, 411, 1722, 29898, 29950, 7466, 29918, 12015, 12336, 29918, 7724, 29892, 376, 29893, 613, 25899, 543, 1159, 408, 19766, 29918, 5182, 29892, 1722, 29898, 13, 4706, 390, 3301, 1367, 8618, 29918, 12015, 12336, 29918, 7724, 29892, 376, 29893, 613, 25899, 13776, 13, 1678, 1723, 408, 364, 29886, 29918, 5182, 29901, 13, 4706, 19766, 29918, 13236, 353, 11799, 29889, 21533, 10507, 29898, 13, 9651, 19766, 29918, 5182, 29892, 1746, 7039, 29922, 3366, 12346, 29918, 333, 613, 376, 1516, 275, 5200, 613, 376, 16394, 3108, 13, 4706, 1723, 13, 4706, 19766, 29918, 13236, 29889, 3539, 6672, 580, 13, 4706, 364, 29886, 29918, 13236, 353, 11799, 29889, 21533, 10507, 29898, 13, 9651, 364, 29886, 29918, 5182, 29892, 1746, 7039, 29922, 3366, 12346, 29918, 333, 613, 376, 29890, 10798, 29918, 11152, 29918, 2671, 613, 376, 29890, 10798, 29918, 11152, 3108, 13, 4706, 1723, 13, 4706, 364, 29886, 29918, 13236, 29889, 3539, 6672, 580, 13, 13, 4706, 1826, 2801, 353, 263, 601, 1124, 29889, 29911, 6271, 20971, 2801, 29898, 13400, 29922, 6007, 22484, 29934, 1430, 29907, 29979, 29897, 13, 4706, 7465, 411, 263, 601, 1124, 29889, 4032, 7317, 29898, 11958, 2801, 29922, 11958, 2801, 29897, 408, 4867, 29901, 13, 9651, 9595, 353, 5159, 13, 9651, 363, 6958, 29918, 333, 297, 21557, 800, 29901, 13, 18884, 9595, 29889, 4397, 29898, 13, 462, 1678, 12635, 29918, 5014, 29918, 1727, 8306, 29898, 13, 462, 4706, 4867, 29892, 6958, 29918, 333, 29892, 19766, 29918, 13236, 29892, 364, 29886, 29918, 13236, 29892, 269, 2603, 13, 462, 1678, 1723, 13, 18884, 1723, 13, 13, 9651, 7272, 408, 948, 3934, 29889, 29887, 1624, 10456, 20673, 29897, 13, 4706, 1596, 29898, 29888, 26732, 29876, 7032, 287, 426, 7827, 29913, 21557, 800, 297, 426, 2230, 29889, 2230, 580, 448, 1369, 29901, 29889, 29900, 29888, 29913, 29879, 1159, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 11009, 353, 6529, 29891, 9708, 29887, 29906, 29889, 6915, 29898, 13, 4706, 4833, 978, 543, 29882, 431, 613, 1404, 543, 29882, 431, 613, 4800, 29922, 29966, 25711, 17013, 10202, 3495, 543, 7640, 613, 2011, 29922, 29955, 29900, 29900, 29900, 13, 1678, 1723, 13, 1678, 289, 370, 952, 29893, 2335, 267, 353, 679, 29918, 29890, 370, 952, 29893, 2335, 267, 29898, 13082, 29897, 13, 1678, 3523, 17718, 353, 679, 29918, 3670, 17718, 29898, 13082, 29897, 13, 1678, 21557, 800, 353, 679, 29918, 29238, 800, 29898, 13082, 29892, 289, 370, 952, 29893, 2335, 267, 29892, 3523, 17718, 29897, 13, 13, 1678, 408, 948, 3934, 29889, 3389, 29898, 5014, 29918, 29238, 800, 29898, 29238, 800, 876, 13, 2 ]
packer/python/packerTest1.py
RalphBrynard/sophos_attack_range
0
175864
from packerlicious import builder, provisioner, Template template = Template() template.add_builder( builder.vmware-iso( ) ) { "description": "Packer Windows Server 2016 build template file.", "_comment": "Template file provides framework for subsequent packer builds.", "variables": { "os-iso-path": "[nfsdatastore01] os/microsoft/server/2016/windows2016_noprompt.iso" }, "builders": [ { "type": "vsphere-iso", "vcenter_server": "{{user `vsphere-server`}}", "username": "{{user `vsphere-user`}}", "password": "{{user `vsphere-password`}}", "datacenter": "{{user `vsphere-datacenter`}}", "cluster": "{{user `vsphere-cluster`}}", "datastore": "{{user `vsphere-datastore`}}", "folder": "{{user `vsphere-folder`}}", "insecure_connection": "{{user `insecure-connection`}}", "communicator": "winrm", "winrm_username": "Administrator", "winrm_password": "<PASSWORD>", "winrm_timeout": "15m", "convert_to_template": "true", "vm_name": "windows2016.gold", "guest_os_type": "windows9Server64Guest", "CPUs": 2, "RAM": 4096, "RAM_reserve_all": true, "firmware": "efi", "cdrom_type": "sata", "storage": [ { "disk_size": 61440, "disk_thin_provisioned": true } ], "disk_controller_type": "pvscsi", "network_adapters": [ { "network": "{{user `vsphere-network`}}", "network_card": "vmxnet3" } ], "notes": "{{user `vm-notes`}}", "iso_paths": [ "{{user `os-iso-path`}}", "[] /vmimages/tools-isoimages/windows.iso" ], "floppy_files": [ "server_standard/autounattend.xml", "../drivers/pvscsi-win8/pvscsi.cat", "../drivers/pvscsi-win8/pvscsi.inf", "../drivers/pvscsi-win8/pvscsi.sys", "../drivers/pvscsi-win8/txtsetup.oem", "../scripts/2016/00-vmtools.ps1", "../scripts/2016/01-initialize.ps1", "../scripts/2016/03-systemsettings.ps1", "../scripts/2016/95-enablerdp.ps1" ], "shutdown_command": "shutdown /f /s /t 10 /d p:4:1 /c \"Packer Complete\"" } ], "provisioners": [ { "type": "powershell", "scripts": [ "../scripts/2016/03-systemsettings.ps1", "../scripts/2016/95-enablerdp.ps1" ] }, { "type": "windows-restart", "restart_timeout": "30m" }, { "type": "windows-update", "search_criteria": "IsInstalled=0", "filters": [ "exclude:$_.Title -like '*Preview*'", "include:$true" ] } ] }
[ 1, 515, 4870, 261, 506, 2738, 1053, 12856, 29892, 25161, 261, 29892, 25663, 13, 6886, 353, 25663, 580, 13, 6886, 29889, 1202, 29918, 16409, 29898, 13, 1678, 12856, 29889, 6925, 2519, 29899, 10718, 29898, 13, 308, 13, 1678, 1723, 13, 29897, 13, 13, 13, 29912, 13, 12, 29908, 8216, 1115, 376, 16638, 261, 3852, 5656, 29871, 29906, 29900, 29896, 29953, 2048, 4472, 934, 19602, 13, 12, 29908, 29918, 9342, 1115, 376, 6733, 934, 8128, 6890, 363, 15352, 4870, 261, 23315, 19602, 13, 12, 29908, 20897, 1115, 426, 13, 12, 12, 29908, 359, 29899, 10718, 29899, 2084, 1115, 14704, 29876, 5847, 4130, 579, 487, 29900, 29896, 29962, 2897, 29914, 4994, 29914, 2974, 29914, 29906, 29900, 29896, 29953, 29914, 10499, 29906, 29900, 29896, 29953, 29918, 29876, 459, 456, 415, 29889, 10718, 29908, 13, 12, 1118, 13, 13, 12, 29908, 4282, 414, 1115, 518, 13, 12, 12, 29912, 13, 12, 12, 12, 29908, 1853, 1115, 376, 4270, 9085, 29899, 10718, 613, 13, 13, 12, 12, 12, 29908, 29894, 5064, 29918, 2974, 1115, 376, 6224, 1792, 421, 4270, 9085, 29899, 2974, 29952, 930, 613, 13, 12, 12, 12, 29908, 6786, 1115, 376, 6224, 1792, 421, 4270, 9085, 29899, 1792, 29952, 930, 613, 13, 12, 12, 12, 29908, 5630, 1115, 376, 6224, 1792, 421, 4270, 9085, 29899, 5630, 29952, 930, 613, 13, 12, 12, 12, 29908, 1272, 5064, 1115, 376, 6224, 1792, 421, 4270, 9085, 29899, 1272, 5064, 29952, 930, 613, 13, 12, 12, 12, 29908, 19594, 1115, 376, 6224, 1792, 421, 4270, 9085, 29899, 19594, 29952, 930, 613, 13, 12, 12, 12, 29908, 4130, 579, 487, 1115, 376, 6224, 1792, 421, 4270, 9085, 29899, 4130, 579, 487, 29952, 930, 613, 13, 12, 12, 12, 29908, 12083, 1115, 376, 6224, 1792, 421, 4270, 9085, 29899, 12083, 29952, 930, 613, 13, 12, 12, 12, 29908, 262, 24216, 29918, 9965, 1115, 376, 6224, 1792, 421, 262, 24216, 29899, 9965, 29952, 930, 613, 13, 13, 12, 12, 12, 29908, 27820, 1061, 1115, 376, 5080, 1758, 613, 13, 12, 12, 12, 29908, 5080, 1758, 29918, 6786, 1115, 376, 12754, 2132, 1061, 613, 13, 12, 12, 12, 29908, 5080, 1758, 29918, 5630, 1115, 9872, 25711, 17013, 28341, 13, 12, 12, 12, 29908, 5080, 1758, 29918, 15619, 1115, 376, 29896, 29945, 29885, 613, 13, 13, 12, 12, 12, 29908, 13441, 29918, 517, 29918, 6886, 1115, 376, 3009, 613, 12, 13, 13, 12, 12, 12, 29908, 6925, 29918, 978, 1115, 376, 10499, 29906, 29900, 29896, 29953, 29889, 29887, 1025, 613, 13, 12, 12, 12, 29908, 2543, 342, 29918, 359, 29918, 1853, 1115, 376, 10499, 29929, 6004, 29953, 29946, 9485, 342, 613, 13, 12, 12, 12, 13, 12, 12, 12, 29908, 6271, 15922, 1115, 29871, 29906, 29892, 13, 12, 12, 12, 29908, 25058, 1115, 29871, 29946, 29900, 29929, 29953, 29892, 13, 12, 12, 12, 29908, 25058, 29918, 690, 7143, 29918, 497, 1115, 1565, 29892, 13, 12, 12, 12, 29908, 29888, 3568, 2519, 1115, 376, 1389, 29875, 613, 13, 12, 12, 12, 29908, 2252, 456, 29918, 1853, 1115, 376, 29879, 532, 613, 13, 13, 12, 12, 12, 29908, 12925, 1115, 518, 13, 12, 12, 12, 12, 29912, 13, 12, 12, 12, 12, 12, 29908, 20960, 29918, 2311, 1115, 29871, 29953, 29896, 29946, 29946, 29900, 29892, 13, 12, 12, 12, 12, 12, 29908, 20960, 29918, 386, 262, 29918, 771, 4924, 287, 1115, 1565, 13, 12, 12, 12, 12, 29913, 13, 12, 12, 12, 1402, 13, 12, 12, 12, 29908, 20960, 29918, 8299, 29918, 1853, 1115, 376, 29886, 29894, 1557, 1039, 613, 13, 13, 12, 12, 12, 29908, 11618, 29918, 328, 481, 2153, 1115, 518, 13, 12, 12, 12, 12, 29912, 13, 12, 12, 12, 12, 12, 29908, 11618, 1115, 376, 6224, 1792, 421, 4270, 9085, 29899, 11618, 29952, 930, 613, 13, 12, 12, 12, 12, 12, 29908, 11618, 29918, 7543, 1115, 376, 6925, 29916, 1212, 29941, 29908, 13, 12, 12, 12, 12, 29913, 13, 12, 12, 12, 1402, 13, 13, 12, 12, 12, 29908, 16953, 1115, 376, 6224, 1792, 421, 6925, 29899, 16953, 29952, 930, 613, 13, 13, 12, 12, 12, 29908, 10718, 29918, 24772, 1115, 518, 13, 12, 12, 12, 12, 29908, 6224, 1792, 421, 359, 29899, 10718, 29899, 2084, 29952, 930, 613, 13, 12, 12, 12, 12, 29908, 2636, 847, 6925, 8346, 29914, 8504, 29899, 10718, 8346, 29914, 10499, 29889, 10718, 29908, 13, 12, 12, 12, 1402, 13, 13, 12, 12, 12, 29908, 29888, 417, 23717, 29918, 5325, 1115, 518, 13, 12, 12, 12, 12, 29908, 2974, 29918, 15770, 29914, 1300, 1309, 27601, 29889, 3134, 613, 13, 12, 12, 12, 12, 29908, 6995, 24477, 874, 29914, 29886, 29894, 1557, 1039, 29899, 5080, 29947, 29914, 29886, 29894, 1557, 1039, 29889, 4117, 613, 13, 12, 12, 12, 12, 29908, 6995, 24477, 874, 29914, 29886, 29894, 1557, 1039, 29899, 5080, 29947, 29914, 29886, 29894, 1557, 1039, 29889, 7192, 613, 13, 12, 12, 12, 12, 29908, 6995, 24477, 874, 29914, 29886, 29894, 1557, 1039, 29899, 5080, 29947, 29914, 29886, 29894, 1557, 1039, 29889, 9675, 613, 13, 12, 12, 12, 12, 29908, 6995, 24477, 874, 29914, 29886, 29894, 1557, 1039, 29899, 5080, 29947, 29914, 3945, 14669, 29889, 21942, 613, 13, 12, 12, 12, 12, 29908, 6995, 16713, 29914, 29906, 29900, 29896, 29953, 29914, 29900, 29900, 29899, 6925, 8504, 29889, 567, 29896, 613, 13, 12, 12, 12, 12, 29908, 6995, 16713, 29914, 29906, 29900, 29896, 29953, 29914, 29900, 29896, 29899, 24926, 29889, 567, 29896, 613, 13, 12, 12, 12, 12, 29908, 6995, 16713, 29914, 29906, 29900, 29896, 29953, 29914, 29900, 29941, 29899, 5205, 11027, 29889, 567, 29896, 613, 13, 12, 12, 12, 12, 29908, 6995, 16713, 29914, 29906, 29900, 29896, 29953, 29914, 29929, 29945, 29899, 264, 370, 1358, 6099, 29889, 567, 29896, 29908, 13, 12, 12, 12, 1402, 13, 13, 12, 12, 12, 29908, 845, 329, 3204, 29918, 6519, 1115, 376, 845, 329, 3204, 847, 29888, 847, 29879, 847, 29873, 29871, 29896, 29900, 847, 29881, 282, 29901, 29946, 29901, 29896, 847, 29883, 13218, 16638, 261, 25034, 5931, 29908, 13, 12, 12, 29913, 13, 12, 1402, 13, 12, 29908, 771, 4924, 414, 1115, 518, 13, 12, 12, 29912, 13, 12, 12, 12, 29908, 1853, 1115, 376, 12248, 27456, 613, 13, 12, 12, 12, 29908, 16713, 1115, 518, 13, 12, 12, 12, 12, 29908, 6995, 16713, 29914, 29906, 29900, 29896, 29953, 29914, 29900, 29941, 29899, 5205, 11027, 29889, 567, 29896, 613, 13, 12, 12, 12, 12, 29908, 6995, 16713, 29914, 29906, 29900, 29896, 29953, 29914, 29929, 29945, 29899, 264, 370, 1358, 6099, 29889, 567, 29896, 29908, 13, 12, 12, 12, 29962, 13, 12, 12, 1118, 13, 12, 12, 29912, 13, 12, 12, 12, 29908, 1853, 1115, 376, 10499, 29899, 5060, 442, 613, 13, 12, 12, 12, 29908, 5060, 442, 29918, 15619, 1115, 376, 29941, 29900, 29885, 29908, 13, 12, 12, 1118, 13, 12, 12, 29912, 13, 12, 12, 12, 29908, 1853, 1115, 376, 10499, 29899, 5504, 613, 13, 12, 12, 12, 29908, 4478, 29918, 29883, 21977, 1115, 376, 3624, 3379, 4212, 29922, 29900, 613, 13, 12, 12, 12, 29908, 26705, 1115, 518, 13, 12, 12, 12, 12, 29908, 735, 2325, 17178, 5396, 7030, 448, 4561, 525, 29930, 6572, 1493, 29930, 29915, 613, 13, 18884, 376, 2856, 17178, 3009, 29908, 13, 12, 12, 12, 29962, 13, 12, 12, 29913, 13, 12, 29962, 13, 29913, 2 ]
.travis/tests.py
frogunder/salt-winrepo-ng
0
184897
<gh_stars>0 #!/usr/bin/env python2.7 # -*- coding: utf-8 -*- import getopt import git import pycurl as curl import sys import traceback import yaml, glob, os from jinja2 import Template from pprint import pprint from StringIO import StringIO from urlparse import urlparse reload(sys) sys.setdefaultencoding('utf8') test_status = True head = git.Repo(".").commit("HEAD") changed = [i for i in head.stats.files.keys() if '.sls' in i] def printd(message=None, extra_debug_data=None): global debug try: if debug: sys.stderr.write(message) sys.stderr.write("\t--\t") pprint(extra_debug_data, stream=sys.stderr) return None except Exception: pass def usage(): print(""" Use either of these flags! -h | --help_ Show this help_ -t | --travis Run in travis (ignores files that have not been changed in last commit) -c | --cron Run in cron mode (Checks -d | --debug Run in debug mode (Prints more info) """) try: opts, args = getopt.getopt( sys.argv[1:], "tcdh", ["travis", "cron", "debug", "help_"]) opts = dict(opts) except getopt.GetoptError: usage() sys.exit(2) travis, cron, debug, help_ = (False, False, False, False) try: if opts.has_key('-t') or opts.has_key('--travis'): travis = True if opts.has_key('-c') or opts.has_key('--cron'): cron = True if opts.has_key('-d') or opts.has_key('--debug'): debug = True from pprint import pprint printd("ploop", {'extra':'debug', 'data': None}) if opts.has_key('-h') or opts.has_key('--help_'): help_ = True except KeyError: pass printd("opts, args", (opts, args)) printd("travis, cron, debug, help_ ", (travis, cron, debug, help_)) if help_ or len(opts) < 1 and len(args) < 1: usage() exit(0) ################## def process_each(softwares): global test_status # pprint(softwares) for s, software in softwares.items(): try: if software.get('skip_urltest', False): continue except KeyError: pass for v, version in software.items(): try: if version.get('skip_urltest', False): continue except KeyError: pass # Testing each non-salt URL for availability scheme = urlparse(version['installer']).scheme if scheme in ['http', 'https']: headers = StringIO() printd("version['installer']", version['installer']) C = curl.Curl() C.setopt(curl.URL, version['installer']) C.setopt(curl.NOBODY, True) C.setopt(curl.FOLLOWLOCATION, True) C.setopt(curl.CONNECTTIMEOUT, 2) C.setopt(curl.TIMEOUT, 5) C.setopt(C.HEADERFUNCTION, headers.write) try: C.perform() # assert C.getinfo(curl.HTTP_CODE) != 404, "[ERROR]\tURL returned code 404. File Missing? " http_code = C.getinfo(curl.HTTP_CODE) # print(headers.getvalue().split('\r\n')[1:]) try: content_type = dict([tuple(l.split(': ', 1)) for l in headers.getvalue().split('\r\n')[1:] if ':' in l])['Content-Type'] except: content_type = 'None/None' printd("content_type:", content_type) if http_code == 404: # This build is failing ! print("PROBLEM HERE (404) : %s -- %s -- %s " % (s, v, version['installer'])) test_status = False if 'application/' not in content_type and 'binary/' not in content_type: print("PROBLEM HERE (Bad content type) : %s -- %s -- %s -- %s " % (s, v, version['installer'], content_type)) # print(headers.getvalue().split()) else: print("VALID : %s" % version['installer']) except curl.error as e: errno, errstr = e printd("errno, errstr", (errno, errstr)) if errno == 28: print('[ERROR]\tConnection timeout or no server | ' 'errno: ' + str(errno) + ' | ' + errstr) pass C.close() if travis: our_files = changed else: our_files = glob.glob('*.sls') for cpuarch in ['AMD64', 'x86']: try: print("--------(arch: %s)--------" % cpuarch) if len(our_files) == 0: print("No files to check. No problem.") continue for file in our_files: try: print("---( " + file + " )---") with open(file, 'r') as stream: template = stream.read() t = Template(template) yml = t.render(grains={'cpuarch': cpuarch}) data = yaml.load(yml, Loader=yaml.FullLoader) process_each(data) except Exception: exc = sys.exc_info()[0] print("[EXCEPTION] " + str(exc)) traceback.print_exc() pass print("-" * 80) except Exception: exc = sys.exc_info()[0] print("[EXCEPTION] " + str(exc)) traceback.print_exc() pass assert test_status, "BUILD FAILING. You can grep for 'PROBLEM HERE' to find " \ "out how to fix this." print("Everything went smoothly. No errors were found. Happy deployment!")
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 29937, 14708, 4855, 29914, 2109, 29914, 6272, 3017, 29906, 29889, 29955, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 13, 5215, 679, 3670, 13, 5215, 6315, 13, 5215, 282, 11078, 2271, 408, 11051, 13, 5215, 10876, 13, 5215, 9637, 1627, 13, 5215, 343, 8807, 29892, 13149, 29892, 2897, 13, 3166, 432, 262, 1764, 29906, 1053, 25663, 13, 3166, 282, 2158, 1053, 282, 2158, 13, 3166, 1714, 5971, 1053, 1714, 5971, 13, 3166, 3142, 5510, 1053, 3142, 5510, 13, 13, 28120, 29898, 9675, 29897, 13, 9675, 29889, 842, 4381, 22331, 877, 9420, 29947, 1495, 13, 13, 1688, 29918, 4882, 353, 5852, 13, 13, 2813, 353, 6315, 29889, 5612, 29877, 703, 1213, 467, 15060, 703, 23252, 1159, 13, 15033, 353, 518, 29875, 363, 474, 297, 2343, 29889, 16202, 29889, 5325, 29889, 8149, 580, 565, 15300, 2536, 29879, 29915, 297, 474, 29962, 13, 13, 13, 1753, 1596, 29881, 29898, 4906, 29922, 8516, 29892, 4805, 29918, 8382, 29918, 1272, 29922, 8516, 1125, 13, 1678, 5534, 4744, 13, 1678, 1018, 29901, 13, 4706, 565, 4744, 29901, 13, 9651, 10876, 29889, 303, 20405, 29889, 3539, 29898, 4906, 29897, 13, 9651, 10876, 29889, 303, 20405, 29889, 3539, 14182, 29873, 489, 29905, 29873, 1159, 13, 9651, 282, 2158, 29898, 17833, 29918, 8382, 29918, 1272, 29892, 4840, 29922, 9675, 29889, 303, 20405, 29897, 13, 9651, 736, 6213, 13, 1678, 5174, 8960, 29901, 13, 4706, 1209, 13, 13, 13, 1753, 8744, 7295, 13, 1678, 1596, 703, 15945, 13, 1678, 4803, 2845, 310, 1438, 13449, 29991, 13, 4706, 448, 29882, 891, 1192, 8477, 29918, 268, 7704, 445, 1371, 29918, 13, 4706, 448, 29873, 891, 1192, 3018, 1730, 259, 7525, 297, 1020, 1730, 313, 647, 2361, 2066, 393, 505, 451, 1063, 3939, 297, 1833, 9063, 29897, 13, 4706, 448, 29883, 891, 1192, 29883, 1617, 268, 7525, 297, 18863, 4464, 29871, 313, 5596, 29879, 29871, 13, 4706, 448, 29881, 891, 1192, 8382, 1678, 7525, 297, 4744, 4464, 313, 4040, 9466, 901, 5235, 29897, 13, 1678, 5124, 1159, 13, 13, 13, 2202, 29901, 13, 1678, 29111, 29892, 6389, 353, 679, 3670, 29889, 657, 3670, 29898, 13, 4706, 10876, 29889, 19218, 29961, 29896, 29901, 1402, 376, 29873, 2252, 29882, 613, 6796, 3018, 1730, 613, 376, 29883, 1617, 613, 376, 8382, 613, 376, 8477, 29918, 20068, 13, 1678, 29111, 353, 9657, 29898, 25707, 29897, 13, 19499, 679, 3670, 29889, 2577, 3670, 2392, 29901, 13, 1678, 8744, 580, 13, 1678, 10876, 29889, 13322, 29898, 29906, 29897, 13, 3018, 1730, 29892, 18863, 29892, 4744, 29892, 1371, 29918, 353, 313, 8824, 29892, 7700, 29892, 7700, 29892, 7700, 29897, 13, 13, 2202, 29901, 13, 1678, 565, 29111, 29889, 5349, 29918, 1989, 877, 29899, 29873, 1495, 470, 29111, 29889, 5349, 29918, 1989, 877, 489, 3018, 1730, 29374, 13, 4706, 1020, 1730, 353, 5852, 13, 1678, 565, 29111, 29889, 5349, 29918, 1989, 877, 29899, 29883, 1495, 470, 29111, 29889, 5349, 29918, 1989, 877, 489, 29883, 1617, 29374, 13, 4706, 18863, 353, 5852, 13, 1678, 565, 29111, 29889, 5349, 29918, 1989, 877, 29899, 29881, 1495, 470, 29111, 29889, 5349, 29918, 1989, 877, 489, 8382, 29374, 13, 4706, 4744, 353, 5852, 13, 4706, 515, 282, 2158, 1053, 282, 2158, 13, 4706, 1596, 29881, 703, 29886, 7888, 613, 11117, 17833, 22099, 8382, 742, 525, 1272, 2396, 6213, 1800, 13, 1678, 565, 29111, 29889, 5349, 29918, 1989, 877, 29899, 29882, 1495, 470, 29111, 29889, 5349, 29918, 1989, 877, 489, 8477, 29918, 29374, 13, 4706, 1371, 29918, 353, 5852, 13, 19499, 7670, 2392, 29901, 13, 1678, 1209, 13, 2158, 29881, 703, 25707, 29892, 6389, 613, 313, 25707, 29892, 6389, 876, 13, 2158, 29881, 703, 3018, 1730, 29892, 18863, 29892, 4744, 29892, 1371, 29918, 9162, 313, 3018, 1730, 29892, 18863, 29892, 4744, 29892, 1371, 29918, 876, 13, 13, 361, 1371, 29918, 470, 7431, 29898, 25707, 29897, 529, 29871, 29896, 322, 7431, 29898, 5085, 29897, 529, 29871, 29896, 29901, 13, 1678, 8744, 580, 13, 1678, 6876, 29898, 29900, 29897, 13, 13, 13383, 2277, 13, 13, 13, 1753, 1889, 29918, 4204, 29898, 2695, 4495, 267, 1125, 13, 1678, 5534, 1243, 29918, 4882, 13, 1678, 396, 282, 2158, 29898, 2695, 4495, 267, 29897, 13, 1678, 363, 269, 29892, 7047, 297, 4964, 4495, 267, 29889, 7076, 7295, 13, 4706, 1018, 29901, 13, 9651, 565, 7047, 29889, 657, 877, 11014, 29918, 2271, 1688, 742, 7700, 1125, 13, 18884, 6773, 13, 4706, 5174, 7670, 2392, 29901, 13, 9651, 1209, 13, 4706, 363, 325, 29892, 1873, 297, 7047, 29889, 7076, 7295, 13, 9651, 1018, 29901, 13, 18884, 565, 1873, 29889, 657, 877, 11014, 29918, 2271, 1688, 742, 7700, 1125, 13, 462, 1678, 6773, 13, 9651, 5174, 7670, 2392, 29901, 13, 18884, 1209, 13, 9651, 396, 4321, 292, 1269, 1661, 29899, 29879, 1997, 3988, 363, 20847, 3097, 13, 9651, 11380, 353, 3142, 5510, 29898, 3259, 1839, 6252, 261, 2033, 467, 816, 2004, 13, 9651, 565, 11380, 297, 6024, 1124, 742, 525, 991, 2033, 29901, 13, 18884, 9066, 353, 1714, 5971, 580, 13, 18884, 1596, 29881, 703, 3259, 1839, 6252, 261, 2033, 613, 1873, 1839, 6252, 261, 11287, 13, 18884, 315, 353, 11051, 29889, 29907, 2271, 580, 13, 18884, 315, 29889, 28393, 29898, 18963, 29889, 4219, 29892, 1873, 1839, 6252, 261, 11287, 13, 18884, 315, 29889, 28393, 29898, 18963, 29889, 6632, 8456, 29928, 29979, 29892, 5852, 29897, 13, 18884, 315, 29889, 28393, 29898, 18963, 29889, 5800, 2208, 9806, 16652, 8098, 29892, 5852, 29897, 13, 18884, 315, 29889, 28393, 29898, 18963, 29889, 6007, 8186, 1783, 15307, 12015, 29892, 29871, 29906, 29897, 13, 18884, 315, 29889, 28393, 29898, 18963, 29889, 15307, 12015, 29892, 29871, 29945, 29897, 13, 18884, 315, 29889, 28393, 29898, 29907, 29889, 23252, 1001, 29943, 28700, 29892, 9066, 29889, 3539, 29897, 13, 18884, 1018, 29901, 13, 462, 1678, 315, 29889, 19826, 580, 13, 462, 1678, 396, 4974, 315, 29889, 657, 3888, 29898, 18963, 29889, 10493, 29918, 16524, 29897, 2804, 29871, 29946, 29900, 29946, 29892, 14704, 11432, 10725, 29873, 4219, 4133, 775, 29871, 29946, 29900, 29946, 29889, 3497, 4750, 292, 29973, 376, 13, 462, 1678, 1732, 29918, 401, 353, 315, 29889, 657, 3888, 29898, 18963, 29889, 10493, 29918, 16524, 29897, 13, 462, 1678, 396, 1596, 29898, 13662, 29889, 657, 1767, 2141, 5451, 28909, 29878, 29905, 29876, 29861, 29896, 29901, 2314, 13, 462, 1678, 1018, 29901, 13, 462, 4706, 2793, 29918, 1853, 353, 9657, 4197, 23583, 29898, 29880, 29889, 5451, 877, 29901, 13420, 29871, 29896, 876, 363, 301, 297, 9066, 29889, 657, 1767, 2141, 5451, 28909, 29878, 29905, 29876, 29861, 29896, 17531, 565, 525, 11283, 297, 301, 2314, 1839, 3916, 29899, 1542, 2033, 13, 462, 1678, 5174, 29901, 13, 462, 4706, 2793, 29918, 1853, 353, 525, 8516, 29914, 8516, 29915, 13, 462, 1678, 1596, 29881, 703, 3051, 29918, 1853, 29901, 613, 2793, 29918, 1853, 29897, 13, 462, 1678, 565, 1732, 29918, 401, 1275, 29871, 29946, 29900, 29946, 29901, 13, 462, 4706, 396, 910, 2048, 338, 17581, 1738, 13, 462, 4706, 1596, 703, 8618, 29933, 1307, 29924, 379, 27267, 313, 29946, 29900, 29946, 29897, 584, 1273, 29879, 1192, 1273, 29879, 1192, 1273, 29879, 376, 1273, 313, 29879, 29892, 325, 29892, 1873, 1839, 6252, 261, 25901, 13, 462, 4706, 1243, 29918, 4882, 353, 7700, 13, 462, 1678, 565, 525, 6214, 22208, 451, 297, 2793, 29918, 1853, 322, 525, 19541, 22208, 451, 297, 2793, 29918, 1853, 29901, 13, 462, 4706, 1596, 703, 8618, 29933, 1307, 29924, 379, 27267, 313, 22050, 2793, 1134, 29897, 584, 1273, 29879, 1192, 1273, 29879, 1192, 1273, 29879, 1192, 1273, 29879, 376, 1273, 313, 29879, 29892, 325, 29892, 1873, 1839, 6252, 261, 7464, 2793, 29918, 1853, 876, 13, 462, 4706, 396, 1596, 29898, 13662, 29889, 657, 1767, 2141, 5451, 3101, 13, 462, 1678, 1683, 29901, 13, 462, 4706, 1596, 703, 26707, 584, 1273, 29879, 29908, 1273, 1873, 1839, 6252, 261, 11287, 13, 18884, 5174, 11051, 29889, 2704, 408, 321, 29901, 13, 462, 1678, 4589, 1217, 29892, 4589, 710, 353, 321, 13, 462, 1678, 1596, 29881, 703, 3127, 1217, 29892, 4589, 710, 613, 313, 3127, 1217, 29892, 4589, 710, 876, 13, 462, 1678, 565, 4589, 1217, 1275, 29871, 29906, 29947, 29901, 13, 462, 4706, 1596, 877, 29961, 11432, 10725, 29873, 5350, 11815, 470, 694, 1923, 891, 525, 13, 462, 795, 525, 3127, 1217, 29901, 525, 718, 851, 29898, 3127, 1217, 29897, 718, 525, 891, 525, 718, 4589, 710, 29897, 13, 462, 4706, 1209, 13, 18884, 315, 29889, 5358, 580, 13, 13, 13, 361, 1020, 1730, 29901, 13, 1678, 1749, 29918, 5325, 353, 3939, 13, 2870, 29901, 13, 1678, 1749, 29918, 5325, 353, 13149, 29889, 23705, 877, 10521, 2536, 29879, 1495, 13, 13, 13, 1454, 26403, 1279, 297, 6024, 5194, 29928, 29953, 29946, 742, 525, 29916, 29947, 29953, 2033, 29901, 13, 1678, 1018, 29901, 268, 13, 4706, 1596, 703, 1378, 29898, 1279, 29901, 1273, 29879, 29897, 1378, 29908, 1273, 26403, 1279, 29897, 13, 4706, 565, 7431, 29898, 473, 29918, 5325, 29897, 1275, 29871, 29900, 29901, 13, 9651, 1596, 703, 3782, 2066, 304, 1423, 29889, 1939, 1108, 23157, 13, 9651, 6773, 13, 4706, 363, 934, 297, 1749, 29918, 5325, 29901, 13, 9651, 1018, 29901, 13, 18884, 1596, 703, 5634, 29898, 376, 718, 934, 718, 376, 1723, 5634, 1159, 13, 18884, 411, 1722, 29898, 1445, 29892, 525, 29878, 1495, 408, 4840, 29901, 13, 462, 1678, 4472, 353, 4840, 29889, 949, 580, 13, 18884, 260, 353, 25663, 29898, 6886, 29897, 13, 18884, 343, 828, 353, 260, 29889, 9482, 29898, 3874, 1144, 3790, 29915, 21970, 1279, 2396, 26403, 1279, 1800, 13, 18884, 848, 353, 343, 8807, 29889, 1359, 29898, 21053, 29892, 4309, 1664, 29922, 25162, 29889, 13658, 10036, 29897, 13, 18884, 1889, 29918, 4204, 29898, 1272, 29897, 13, 9651, 5174, 8960, 29901, 13, 18884, 5566, 353, 10876, 29889, 735, 29883, 29918, 3888, 580, 29961, 29900, 29962, 13, 18884, 1596, 703, 29961, 5746, 4741, 7982, 2725, 29962, 376, 718, 851, 29898, 735, 29883, 876, 13, 18884, 9637, 1627, 29889, 2158, 29918, 735, 29883, 580, 13, 18884, 1209, 13, 4706, 1596, 703, 29899, 29908, 334, 29871, 29947, 29900, 29897, 13, 1678, 5174, 8960, 29901, 13, 4706, 5566, 353, 10876, 29889, 735, 29883, 29918, 3888, 580, 29961, 29900, 29962, 13, 4706, 1596, 703, 29961, 5746, 4741, 7982, 2725, 29962, 376, 718, 851, 29898, 735, 29883, 876, 13, 4706, 9637, 1627, 29889, 2158, 29918, 735, 29883, 580, 13, 4706, 1209, 13, 29871, 13, 9294, 1243, 29918, 4882, 29892, 376, 29933, 25282, 13515, 6227, 4214, 29889, 887, 508, 12680, 363, 525, 8618, 29933, 1307, 29924, 379, 27267, 29915, 304, 1284, 376, 320, 13, 462, 1678, 376, 449, 920, 304, 2329, 445, 1213, 13, 2158, 703, 26526, 1918, 3512, 10597, 368, 29889, 1939, 4436, 892, 1476, 29889, 28569, 18209, 29991, 1159, 13, 2 ]
tools/pca_outcore.py
escorciav/deep-action-proposals
28
16618
<filename>tools/pca_outcore.py #!/usr/bin/env python """ PCA done via matrix multiplication out-of-core. """ import argparse import time import h5py import hickle as hkl import numpy as np def input_parse(): description = 'Compute PCA with A.T * A computation out of core' p = argparse.ArgumentParser(description=description) p.add_argument('dsfile', help='HDF5-file with features') p.add_argument('pcafile', help='HDF5-file with PCA results') p.add_argument('-ll', '--log_loop', default=500, type=int, help='Verbose in terms of number of videos') return p def main(dsfile, pcafile, t_size=16, t_stride=8, source='c3d_features', log_loop=100): print time.ctime(), 'start: loading hdf5' fid = h5py.File(dsfile, 'r') video_names = fid.keys() feat_dim = fid[video_names[0]][source].shape[1] print time.ctime(), 'finish: loading hdf5' print time.ctime(), 'start: compute mean' x_mean, n = np.zeros((1, feat_dim), dtype=np.float32), 0 for i, v in fid.iteritems(): feat = v[source][:] n += feat.shape[0] x_mean += feat.sum(axis=0) x_mean /= n print time.ctime(), 'finish: compute mean' def compute_ATA(chunk, f=fid, source=source, mean=x_mean): feat_dim = f[chunk[0]][source].shape[1] ATA_c = np.zeros((feat_dim, feat_dim), dtype=np.float32) for i in chunk: feat_c = f[i][source][:] feat_c_ = feat_c - mean ATA_c += np.dot(feat_c_.T, feat_c_) return ATA_c print time.ctime(), 'start: out-of-core matrix multiplication' j, n_videos = 0, len(video_names) ATA = np.zeros((feat_dim, feat_dim), dtype=np.float32) for i, v in fid.iteritems(): feat = v[source][:] feat_ = feat - x_mean ATA += np.dot(feat_.T, feat_) j += 1 if j % log_loop == 0: print time.ctime(), 'Iteration {}/{}'.format(j, n_videos) print time.ctime(), 'finish: out-of-core matrix multiplication' # SVD print time.ctime(), 'start: SVD in memory' U, S, _ = np.linalg.svd(ATA) print time.ctime(), 'finish: SVD in memory' print time.ctime(), 'serializing ...' hkl.dump({'x_mean': x_mean, 'U': U, 'S': S, 'n_samples': n}, pcafile) if __name__ == '__main__': p = input_parse() args = p.parse_args() main(**vars(args))
[ 1, 529, 9507, 29958, 8504, 29914, 29886, 1113, 29918, 449, 3221, 29889, 2272, 13, 29937, 14708, 4855, 29914, 2109, 29914, 6272, 3017, 13, 15945, 29908, 13, 13, 29925, 5454, 2309, 3025, 4636, 21666, 714, 29899, 974, 29899, 3221, 29889, 13, 13, 15945, 29908, 13, 5215, 1852, 5510, 13, 5215, 931, 13, 13, 5215, 298, 29945, 2272, 13, 5215, 298, 860, 280, 408, 298, 6321, 13, 5215, 12655, 408, 7442, 13, 13, 13, 1753, 1881, 29918, 5510, 7295, 13, 1678, 6139, 353, 525, 20606, 29872, 349, 5454, 411, 319, 29889, 29911, 334, 319, 16287, 714, 310, 7136, 29915, 13, 1678, 282, 353, 1852, 5510, 29889, 15730, 11726, 29898, 8216, 29922, 8216, 29897, 13, 1678, 282, 29889, 1202, 29918, 23516, 877, 6289, 1445, 742, 1371, 2433, 29950, 4037, 29945, 29899, 1445, 411, 5680, 1495, 13, 1678, 282, 29889, 1202, 29918, 23516, 877, 29886, 1113, 1445, 742, 1371, 2433, 29950, 4037, 29945, 29899, 1445, 411, 349, 5454, 2582, 1495, 13, 1678, 282, 29889, 1202, 29918, 23516, 877, 29899, 645, 742, 525, 489, 1188, 29918, 7888, 742, 2322, 29922, 29945, 29900, 29900, 29892, 1134, 29922, 524, 29892, 13, 462, 259, 1371, 2433, 6565, 15828, 297, 4958, 310, 1353, 310, 19707, 1495, 13, 1678, 736, 282, 13, 13, 13, 1753, 1667, 29898, 6289, 1445, 29892, 282, 1113, 1445, 29892, 260, 29918, 2311, 29922, 29896, 29953, 29892, 260, 29918, 303, 2426, 29922, 29947, 29892, 2752, 2433, 29883, 29941, 29881, 29918, 22100, 742, 13, 308, 1480, 29918, 7888, 29922, 29896, 29900, 29900, 1125, 13, 1678, 1596, 931, 29889, 312, 603, 3285, 525, 2962, 29901, 8363, 298, 2176, 29945, 29915, 13, 1678, 25947, 353, 298, 29945, 2272, 29889, 2283, 29898, 6289, 1445, 29892, 525, 29878, 1495, 13, 1678, 4863, 29918, 7039, 353, 25947, 29889, 8149, 580, 13, 1678, 1238, 271, 29918, 6229, 353, 25947, 29961, 9641, 29918, 7039, 29961, 29900, 29962, 3816, 4993, 1822, 12181, 29961, 29896, 29962, 13, 1678, 1596, 931, 29889, 312, 603, 3285, 525, 4951, 728, 29901, 8363, 298, 2176, 29945, 29915, 13, 13, 1678, 1596, 931, 29889, 312, 603, 3285, 525, 2962, 29901, 10272, 2099, 29915, 13, 1678, 921, 29918, 12676, 29892, 302, 353, 7442, 29889, 3298, 359, 3552, 29896, 29892, 1238, 271, 29918, 6229, 511, 26688, 29922, 9302, 29889, 7411, 29941, 29906, 511, 29871, 29900, 13, 1678, 363, 474, 29892, 325, 297, 25947, 29889, 1524, 7076, 7295, 13, 4706, 1238, 271, 353, 325, 29961, 4993, 3816, 17531, 13, 4706, 302, 4619, 1238, 271, 29889, 12181, 29961, 29900, 29962, 13, 4706, 921, 29918, 12676, 4619, 1238, 271, 29889, 2083, 29898, 8990, 29922, 29900, 29897, 13, 1678, 921, 29918, 12676, 847, 29922, 302, 13, 1678, 1596, 931, 29889, 312, 603, 3285, 525, 4951, 728, 29901, 10272, 2099, 29915, 13, 13, 1678, 822, 10272, 29918, 8254, 29898, 29812, 29892, 285, 29922, 29888, 333, 29892, 2752, 29922, 4993, 29892, 2099, 29922, 29916, 29918, 12676, 1125, 13, 4706, 1238, 271, 29918, 6229, 353, 285, 29961, 29812, 29961, 29900, 29962, 3816, 4993, 1822, 12181, 29961, 29896, 29962, 13, 4706, 319, 6040, 29918, 29883, 353, 7442, 29889, 3298, 359, 3552, 1725, 271, 29918, 6229, 29892, 1238, 271, 29918, 6229, 511, 26688, 29922, 9302, 29889, 7411, 29941, 29906, 29897, 13, 4706, 363, 474, 297, 19875, 29901, 13, 9651, 1238, 271, 29918, 29883, 353, 285, 29961, 29875, 3816, 4993, 3816, 17531, 13, 9651, 1238, 271, 29918, 29883, 29918, 353, 1238, 271, 29918, 29883, 448, 2099, 13, 9651, 319, 6040, 29918, 29883, 4619, 7442, 29889, 6333, 29898, 1725, 271, 29918, 29883, 5396, 29911, 29892, 1238, 271, 29918, 29883, 19925, 13, 4706, 736, 319, 6040, 29918, 29883, 13, 13, 1678, 1596, 931, 29889, 312, 603, 3285, 525, 2962, 29901, 714, 29899, 974, 29899, 3221, 4636, 21666, 29915, 13, 1678, 432, 29892, 302, 29918, 29894, 7958, 353, 29871, 29900, 29892, 7431, 29898, 9641, 29918, 7039, 29897, 13, 1678, 319, 6040, 353, 7442, 29889, 3298, 359, 3552, 1725, 271, 29918, 6229, 29892, 1238, 271, 29918, 6229, 511, 26688, 29922, 9302, 29889, 7411, 29941, 29906, 29897, 13, 1678, 363, 474, 29892, 325, 297, 25947, 29889, 1524, 7076, 7295, 13, 4706, 1238, 271, 353, 325, 29961, 4993, 3816, 17531, 13, 4706, 1238, 271, 29918, 353, 1238, 271, 448, 921, 29918, 12676, 13, 4706, 319, 6040, 4619, 7442, 29889, 6333, 29898, 1725, 271, 5396, 29911, 29892, 1238, 271, 19925, 13, 4706, 432, 4619, 29871, 29896, 13, 13, 4706, 565, 432, 1273, 1480, 29918, 7888, 1275, 29871, 29900, 29901, 13, 9651, 1596, 931, 29889, 312, 603, 3285, 525, 13463, 362, 6571, 29914, 8875, 4286, 4830, 29898, 29926, 29892, 302, 29918, 29894, 7958, 29897, 13, 1678, 1596, 931, 29889, 312, 603, 3285, 525, 4951, 728, 29901, 714, 29899, 974, 29899, 3221, 4636, 21666, 29915, 13, 13, 1678, 396, 317, 10699, 13, 1678, 1596, 931, 29889, 312, 603, 3285, 525, 2962, 29901, 317, 10699, 297, 3370, 29915, 13, 1678, 501, 29892, 317, 29892, 903, 353, 7442, 29889, 29880, 979, 29887, 29889, 4501, 29881, 29898, 8254, 29897, 13, 1678, 1596, 931, 29889, 312, 603, 3285, 525, 4951, 728, 29901, 317, 10699, 297, 3370, 29915, 13, 13, 1678, 1596, 931, 29889, 312, 603, 3285, 525, 15550, 5281, 2023, 29915, 13, 1678, 298, 6321, 29889, 15070, 3319, 29915, 29916, 29918, 12676, 2396, 921, 29918, 12676, 29892, 525, 29965, 2396, 501, 29892, 525, 29903, 2396, 317, 29892, 525, 29876, 29918, 27736, 2396, 302, 1118, 282, 1113, 1445, 29897, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 282, 353, 1881, 29918, 5510, 580, 13, 1678, 6389, 353, 282, 29889, 5510, 29918, 5085, 580, 13, 1678, 1667, 29898, 1068, 16908, 29898, 5085, 876, 13, 2 ]
src/response.py
technomunk/bottica
2
179123
# Response messages. import random from discord.ext import commands SUCCESSES = ( "Success", "Done", ":100:", ":ok:", ":smile::+1:", ) FAILS = ( "Fail", "Bump", "Poop", ":poop:", ":frowning::-1:", ) JEALOUS = ( "Who's this?", "Who is that?", "What are they doing here?", "Are you cheating on me?", "But what am I to you?", ) REACTIONS = { "command_seen": "👀", "command_failed": "❌", "command_succeeded": "✅", "mention": ["💋", "👧", "🤖", "🕵️‍♀️", "👩‍💻", "🤹‍♀️"], "jealousy": ["🌭", "🕵️‍♀️", "🤡", "💩", "💢"], } DEFAULT_TIMEOUT = 10 async def random_fail(ctx: commands.Context): return await ctx.reply(random.choice(FAILS), delete_after=DEFAULT_TIMEOUT) async def random_success(ctx: commands.Context): return await ctx.reply(random.choice(SUCCESSES), delete_after=DEFAULT_TIMEOUT)
[ 1, 396, 13291, 7191, 29889, 13, 13, 5215, 4036, 13, 13, 3166, 2313, 536, 29889, 1062, 1053, 8260, 13, 13, 14605, 4174, 2890, 1660, 29903, 353, 313, 13, 1678, 376, 14191, 613, 13, 1678, 376, 25632, 613, 13, 1678, 29242, 29896, 29900, 29900, 29901, 613, 13, 1678, 29242, 554, 29901, 613, 13, 1678, 29242, 3844, 488, 1057, 29974, 29896, 29901, 613, 13, 29897, 13, 13, 4519, 6227, 29903, 353, 313, 13, 1678, 376, 16243, 613, 13, 1678, 376, 29933, 3427, 613, 13, 1678, 376, 9837, 459, 613, 13, 1678, 29242, 1129, 459, 29901, 613, 13, 1678, 29242, 29888, 798, 1076, 1057, 29899, 29896, 29901, 613, 13, 29897, 13, 13, 29967, 29923, 1964, 29949, 3308, 353, 313, 13, 1678, 376, 22110, 29915, 29879, 445, 29973, 613, 13, 1678, 376, 22110, 338, 393, 29973, 613, 13, 1678, 376, 5618, 526, 896, 2599, 1244, 29973, 613, 13, 1678, 376, 17506, 366, 923, 1218, 373, 592, 29973, 613, 13, 1678, 376, 6246, 825, 626, 306, 304, 366, 29973, 613, 13, 29897, 13, 13, 1525, 24705, 29903, 353, 426, 13, 1678, 376, 6519, 29918, 28026, 1115, 376, 243, 162, 148, 131, 613, 13, 1678, 376, 6519, 29918, 26061, 1115, 376, 229, 160, 143, 613, 13, 1678, 376, 6519, 29918, 29879, 1682, 3947, 287, 1115, 376, 31681, 613, 13, 1678, 376, 358, 291, 1115, 6796, 243, 162, 149, 142, 613, 376, 243, 162, 148, 170, 613, 376, 243, 162, 167, 153, 613, 376, 243, 162, 152, 184, 30598, 30722, 31464, 30598, 613, 376, 243, 162, 148, 172, 30722, 243, 162, 149, 190, 613, 376, 243, 162, 167, 188, 30722, 31464, 30598, 12436, 13, 1678, 376, 1324, 20521, 29891, 1115, 6796, 243, 162, 143, 176, 613, 376, 243, 162, 152, 184, 30598, 30722, 31464, 30598, 613, 376, 243, 162, 167, 164, 613, 376, 243, 162, 149, 172, 613, 376, 243, 162, 149, 165, 12436, 13, 29913, 13, 13, 23397, 29918, 15307, 12015, 353, 29871, 29896, 29900, 13, 13, 13, 12674, 822, 4036, 29918, 14057, 29898, 13073, 29901, 8260, 29889, 2677, 1125, 13, 1678, 736, 7272, 12893, 29889, 3445, 368, 29898, 8172, 29889, 16957, 29898, 4519, 6227, 29903, 511, 5217, 29918, 7045, 29922, 23397, 29918, 15307, 12015, 29897, 13, 13, 13, 12674, 822, 4036, 29918, 8698, 29898, 13073, 29901, 8260, 29889, 2677, 1125, 13, 1678, 736, 7272, 12893, 29889, 3445, 368, 29898, 8172, 29889, 16957, 29898, 14605, 4174, 2890, 1660, 29903, 511, 5217, 29918, 7045, 29922, 23397, 29918, 15307, 12015, 29897, 13, 2 ]
test/test.py
bciar/ppp-web
2
1696
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Unit tests.""" import os import unittest from copy import copy from webui.app import create_app class TestRoutes(unittest.TestCase): """Test routes.""" ignore_routes = ('/static/<path:filename>',) ignore_end_patterns = ('>',) def setUp(self): """Set up: Put Flask app in test mode.""" app = create_app() self.initial_app = copy(app) app.testing = True self.app = app.test_client() @staticmethod def valid_route(route): """Validate route. Args: route (str): Route url pattern. Returns: bool: True if valid, else False. """ if route in TestRoutes.ignore_routes \ or route.endswith(TestRoutes.ignore_end_patterns): return False return True def test_routes(self): """Smoke test routes to ensure no runtime errors..""" routes = [route.rule for route in self.initial_app.url_map.iter_rules() if self.valid_route(route.rule)] for route in routes: self.app.get(route) if __name__ == '__main__': from test.utils.doctest_unittest_runner import doctest_unittest_runner TEST_DIR = os.path.dirname(os.path.realpath(__file__)) + '/' doctest_unittest_runner(test_dir=TEST_DIR, relative_path_to_root='../', package_names=['webui', 'test'])
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 29941, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 15945, 29908, 8325, 6987, 1213, 15945, 13, 5215, 2897, 13, 5215, 443, 27958, 13, 3166, 3509, 1053, 3509, 13, 13, 3166, 1856, 1481, 29889, 932, 1053, 1653, 29918, 932, 13, 13, 13, 1990, 4321, 24254, 267, 29898, 348, 27958, 29889, 3057, 8259, 1125, 13, 1678, 9995, 3057, 12049, 1213, 15945, 13, 13, 1678, 11455, 29918, 27894, 353, 6702, 29914, 7959, 29914, 29966, 2084, 29901, 9507, 29958, 742, 29897, 13, 1678, 11455, 29918, 355, 29918, 11037, 29879, 353, 6702, 29958, 742, 29897, 13, 13, 1678, 822, 731, 3373, 29898, 1311, 1125, 13, 4706, 9995, 2697, 701, 29901, 12065, 2379, 1278, 623, 297, 1243, 4464, 1213, 15945, 13, 4706, 623, 353, 1653, 29918, 932, 580, 13, 4706, 1583, 29889, 11228, 29918, 932, 353, 3509, 29898, 932, 29897, 13, 4706, 623, 29889, 13424, 353, 5852, 13, 4706, 1583, 29889, 932, 353, 623, 29889, 1688, 29918, 4645, 580, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 2854, 29918, 13134, 29898, 13134, 1125, 13, 4706, 9995, 7211, 403, 5782, 29889, 13, 13, 4706, 826, 3174, 29901, 13, 9651, 5782, 313, 710, 1125, 12034, 3142, 4766, 29889, 13, 13, 4706, 16969, 29901, 13, 9651, 6120, 29901, 5852, 565, 2854, 29892, 1683, 7700, 29889, 13, 4706, 9995, 13, 4706, 565, 5782, 297, 4321, 24254, 267, 29889, 17281, 29918, 27894, 320, 13, 18884, 470, 5782, 29889, 1975, 2541, 29898, 3057, 24254, 267, 29889, 17281, 29918, 355, 29918, 11037, 29879, 1125, 13, 9651, 736, 7700, 13, 4706, 736, 5852, 13, 13, 1678, 822, 1243, 29918, 27894, 29898, 1311, 1125, 13, 4706, 9995, 29903, 4346, 446, 1243, 12049, 304, 9801, 694, 10073, 4436, 636, 15945, 29908, 13, 4706, 12049, 353, 518, 13134, 29889, 7491, 363, 5782, 297, 1583, 29889, 11228, 29918, 932, 29889, 2271, 29918, 1958, 29889, 1524, 29918, 19238, 580, 13, 462, 29871, 565, 1583, 29889, 3084, 29918, 13134, 29898, 13134, 29889, 7491, 4638, 13, 4706, 363, 5782, 297, 12049, 29901, 13, 9651, 1583, 29889, 932, 29889, 657, 29898, 13134, 29897, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 515, 1243, 29889, 13239, 29889, 1867, 312, 342, 29918, 348, 27958, 29918, 27492, 1053, 437, 312, 342, 29918, 348, 27958, 29918, 27492, 13, 1678, 17067, 1254, 29918, 9464, 353, 2897, 29889, 2084, 29889, 25721, 29898, 359, 29889, 2084, 29889, 6370, 2084, 22168, 1445, 1649, 876, 718, 8207, 29915, 13, 1678, 437, 312, 342, 29918, 348, 27958, 29918, 27492, 29898, 1688, 29918, 3972, 29922, 18267, 29918, 9464, 29892, 6198, 29918, 2084, 29918, 517, 29918, 4632, 2433, 6995, 742, 13, 462, 9651, 3577, 29918, 7039, 29922, 1839, 2676, 1481, 742, 525, 1688, 11287, 13, 2 ]
dcgan/utils/train.py
Ontheway361/ak47GAN
0
30840
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import sys import time import torch import numpy as np import torchvision import torch.nn as nn import torch.optim as optim import matplotlib.pyplot as plt from torch.utils.data import DataLoader from utils import * from IPython import embed class DCGAN(object): def __init__(self, args): self.args = args self.model = dict() self.data = dict() self.rescache = dict() self.device = args.use_gpu and torch.cuda.is_available() def _report_settings(self): ''' Report the settings ''' str = '-' * 16 print('%sEnvironment Versions%s' % (str, str)) print("- Python : {}".format(sys.version.strip().split('|')[0])) print("- PyTorch : {}".format(torch.__version__)) print("- TorchVison: {}".format(torchvision.__version__)) print("- USE_GPU : {}".format(self.device)) print('-' * 52) def _model_loader(self): self.model['generator'] = Generator(self.args.in_dim, self.args.gchannels) self.model['discriminator'] = Discriminator(self.args.dchannels) self.model['criterion'] = nn.BCELoss() self.model['opti_gene'] = optim.Adam(self.model['generator'].parameters(), \ lr=self.args.base_lr, betas=(self.args.beta, 0.999)) self.model['opti_disc'] = optim.Adam(self.model['discriminator'].parameters(), \ lr=self.args.base_lr, betas=(self.args.beta, 0.999)) # self.model['scheduler'] = torch.optim.lr_scheduler.MultiStepLR( # self.model['optimizer'], milestones=[12, 20, 30, 45], gamma=self.args.gamma) if self.device: self.model['generator'] = self.model['generator'].cuda() self.model['discriminator'] = self.model['discriminator'].cuda() if len(self.args.gpu_ids) > 1: self.model['generator'] = torch.nn.DataParallel(self.model['generator'], device_ids=self.args.gpu_ids) self.model['discriminator'] = torch.nn.DataParallel(self.model['discriminator'], device_ids=self.args.gpu_ids) torch.backends.cudnn.benchmark = True print('Parallel mode was going ...') else: print('Single-gpu mode was going ...') else: print('CPU mode was going ...') if len(self.args.resume) > 2: checkpoint = torch.load(self.args.resume, map_location=lambda storage, loc: storage) self.args.start = checkpoint['epoch'] self.model['generator'].load_state_dict(checkpoint['generator']) self.model['discriminator'].load_state_dict(checkpoint['discriminator']) print('Resuming the train process at %3d epoches ...' % self.args.start) print('Model loading was finished ...') def _data_loader(self): self.data['train_loader'] = DataLoader( CelebA(args=self.args), batch_size = self.args.batch_size, \ shuffle = True,\ num_workers= self.args.workers) self.data['fixed_noise'] = torch.randn(64, self.args.in_dim ,1, 1) if self.device: self.data['fixed_noise'] = self.data['fixed_noise'].cuda() self.rescache['gloss'] = [] self.rescache['dloss'] = [] self.rescache['fake'] = [] print('Data loading was finished ...') def _model_train(self, epoch = 0): total_dloss, total_gloss = 0, 0 for idx, imgs in enumerate(self.data['train_loader']): # update discriminator self.model['discriminator'].train() self.model['generator'].eval() imgs.requires_grad = False if self.device: imgs = imgs.cuda() b_size = imgs.size(0) self.model['discriminator'].zero_grad() gty = torch.full((b_size,), 1) if self.device: gty = gty.cuda() predy = self.model['discriminator'](imgs).view(-1) dloss_real = self.model['criterion'](predy, gty) dloss_real.backward() noise = torch.randn(b_size, self.args.in_dim, 1, 1) if self.device: noise = noise.cuda() fake = self.model['generator'](noise) gty.fill_(0) # TODO predy = self.model['discriminator'](fake.detach()).view(-1) dloss_fake = self.model['criterion'](predy, gty) dloss_fake.backward() self.model['opti_disc'].step() d_loss_real = dloss_real.mean().item() d_loss_fake = dloss_fake.mean().item() d_loss = d_loss_real + d_loss_fake self.rescache['dloss'].append(d_loss) total_dloss += d_loss # update generator self.model['generator'].train() self.model['discriminator'].eval() self.model['generator'].zero_grad() gty.fill_(1) # TODO predy = self.model['discriminator'](fake).view(-1) gloss = self.model['criterion'](predy, gty) gloss.backward() self.model['opti_gene'].step() g_loss = gloss.mean().item() self.rescache['gloss'].append(g_loss) total_gloss += g_loss if (idx + 1) % self.args.print_freq == 0: print('epoch : %2d|%2d, iter : %4d|%4d, dloss : %.4f, gloss : %.4f' % \ (epoch, self.args.epoches, idx+1, len(self.data['train_loader']), \ np.mean(self.rescache['dloss']), np.mean(self.rescache['gloss']))) if (idx + 1) % self.args.monitor_freq == 0: with torch.no_grad(): self.model['generator'].eval() fake = self.model['generator'](self.data['fixed_noise']).detach().cpu() self.rescache['fake'].append(fake) return total_dloss, total_gloss def _main_loop(self): min_loss = 1e3 for epoch in range(self.args.start, self.args.epoches + 1): start_time = time.time() dloss, gloss = self._model_train(epoch) train_loss = dloss + gloss # self.model['scheduler'].step() end_time = time.time() print('Single epoch cost time : %.2f mins' % ((end_time - start_time)/60)) if not os.path.exists(self.args.save_to): os.mkdir(self.args.save_to) if (min_loss > train_loss) and (not self.args.is_debug): print('%snew SOTA was found%s' % ('*'*16, '*'*16)) min_loss = train_loss filename = os.path.join(self.args.save_to, 'sota.pth.tar') torch.save({ 'epoch' : epoch, 'generator' : self.model['generator'].state_dict(), 'discriminator' : self.model['discriminator'].state_dict(), 'loss' : min_loss, }, filename) if (epoch % self.args.save_freq == 0) and (not self.args.is_debug): filename = os.path.join(self.args.save_to, 'epoch_'+str(epoch)+'.pth.tar') torch.save({ 'epoch' : epoch, 'generator' : self.model['generator'].state_dict(), 'discriminator' : self.model['discriminator'].state_dict(), 'loss' : train_loss, }, filename) if self.args.is_debug: break def _visual_res(self): ''' Visual the training process ''' # gloss and dloss plt.figure(figsize=(10,5)) plt.title("Generator and Discriminator Loss During Training") plt.plot(self.rescache['gloss'], label="gloss") plt.plot(self.rescache['dloss'], label="dloss") plt.xlabel("iterations") plt.ylabel("loss") plt.legend() plt.savefig('loss.jpg', dpi=400) # save the fake-images np.save('fake.npy', self.rescache['fake']) def train_runner(self): self._report_settings() self._model_loader() self._data_loader() self._main_loop() self._visual_res() if __name__ == "__main__": faceu = DCGAN(training_args()) faceu.train_runner()
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 29941, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 13, 5215, 2897, 13, 5215, 10876, 13, 5215, 931, 13, 5215, 4842, 305, 13, 5215, 12655, 408, 7442, 13, 5215, 4842, 305, 4924, 13, 5215, 4842, 305, 29889, 15755, 408, 302, 29876, 13, 5215, 4842, 305, 29889, 20640, 408, 5994, 13, 5215, 22889, 29889, 2272, 5317, 408, 14770, 13, 13, 3166, 4842, 305, 29889, 13239, 29889, 1272, 1053, 3630, 10036, 13, 13, 13, 13, 3166, 3667, 29879, 1053, 334, 13, 13, 3166, 5641, 1656, 1053, 8297, 13, 13, 13, 1990, 360, 11135, 2190, 29898, 3318, 1125, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 6389, 1125, 13, 4706, 1583, 29889, 5085, 353, 6389, 13, 4706, 1583, 29889, 4299, 29871, 353, 9657, 580, 13, 4706, 1583, 29889, 1272, 259, 353, 9657, 580, 13, 4706, 1583, 29889, 690, 8173, 353, 9657, 580, 13, 4706, 1583, 29889, 10141, 353, 6389, 29889, 1509, 29918, 29887, 3746, 322, 4842, 305, 29889, 29883, 6191, 29889, 275, 29918, 16515, 580, 13, 13, 13, 1678, 822, 903, 12276, 29918, 11027, 29898, 1311, 1125, 13, 4706, 14550, 13969, 278, 6055, 14550, 13, 13, 4706, 851, 353, 17411, 29915, 334, 29871, 29896, 29953, 13, 4706, 1596, 877, 29995, 29879, 18649, 10138, 1080, 29995, 29879, 29915, 1273, 313, 710, 29892, 851, 876, 13, 4706, 1596, 703, 29899, 5132, 1678, 584, 6571, 1642, 4830, 29898, 9675, 29889, 3259, 29889, 17010, 2141, 5451, 877, 29989, 29861, 29900, 12622, 13, 4706, 1596, 703, 29899, 10772, 29911, 25350, 259, 584, 6571, 1642, 4830, 29898, 7345, 305, 17255, 3259, 1649, 876, 13, 4706, 1596, 703, 29899, 4794, 305, 29963, 2285, 29901, 6571, 1642, 4830, 29898, 7345, 305, 4924, 17255, 3259, 1649, 876, 13, 4706, 1596, 703, 29899, 501, 1660, 29918, 29954, 7056, 259, 584, 6571, 1642, 4830, 29898, 1311, 29889, 10141, 876, 13, 4706, 1596, 877, 29899, 29915, 334, 29871, 29945, 29906, 29897, 13, 13, 13, 1678, 822, 903, 4299, 29918, 12657, 29898, 1311, 1125, 13, 13, 4706, 1583, 29889, 4299, 1839, 27959, 2033, 353, 3251, 1061, 29898, 1311, 29889, 5085, 29889, 262, 29918, 6229, 29892, 1583, 29889, 5085, 29889, 29887, 305, 12629, 29897, 13, 4706, 1583, 29889, 4299, 1839, 2218, 29883, 20386, 1061, 2033, 353, 8565, 20386, 1061, 29898, 1311, 29889, 5085, 29889, 29881, 305, 12629, 29897, 13, 4706, 1583, 29889, 4299, 1839, 29883, 5385, 291, 2033, 353, 302, 29876, 29889, 29933, 4741, 29931, 2209, 580, 13, 4706, 1583, 29889, 4299, 1839, 3670, 29875, 29918, 29887, 1600, 2033, 353, 5994, 29889, 3253, 314, 29898, 1311, 29889, 4299, 1839, 27959, 13359, 16744, 3285, 320, 13, 462, 462, 462, 301, 29878, 29922, 1311, 29889, 5085, 29889, 3188, 29918, 29212, 29892, 1010, 294, 7607, 1311, 29889, 5085, 29889, 3571, 29892, 29871, 29900, 29889, 29929, 29929, 29929, 876, 13, 4706, 1583, 29889, 4299, 1839, 3670, 29875, 29918, 2218, 29883, 2033, 353, 5994, 29889, 3253, 314, 29898, 1311, 29889, 4299, 1839, 2218, 29883, 20386, 1061, 13359, 16744, 3285, 320, 13, 462, 462, 462, 301, 29878, 29922, 1311, 29889, 5085, 29889, 3188, 29918, 29212, 29892, 1010, 294, 7607, 1311, 29889, 5085, 29889, 3571, 29892, 29871, 29900, 29889, 29929, 29929, 29929, 876, 13, 4706, 396, 1583, 29889, 4299, 1839, 816, 14952, 2033, 353, 4842, 305, 29889, 20640, 29889, 29212, 29918, 816, 14952, 29889, 15329, 14448, 29519, 29898, 13, 4706, 396, 462, 1669, 1583, 29889, 4299, 1839, 20640, 3950, 7464, 2316, 342, 2873, 11759, 29896, 29906, 29892, 29871, 29906, 29900, 29892, 29871, 29941, 29900, 29892, 29871, 29946, 29945, 1402, 330, 2735, 29922, 1311, 29889, 5085, 29889, 4283, 29897, 13, 4706, 565, 1583, 29889, 10141, 29901, 13, 9651, 1583, 29889, 4299, 1839, 27959, 2033, 353, 1583, 29889, 4299, 1839, 27959, 13359, 29883, 6191, 580, 13, 9651, 1583, 29889, 4299, 1839, 2218, 29883, 20386, 1061, 2033, 353, 1583, 29889, 4299, 1839, 2218, 29883, 20386, 1061, 13359, 29883, 6191, 580, 13, 9651, 565, 7431, 29898, 1311, 29889, 5085, 29889, 29887, 3746, 29918, 4841, 29897, 1405, 29871, 29896, 29901, 13, 18884, 1583, 29889, 4299, 1839, 27959, 2033, 353, 4842, 305, 29889, 15755, 29889, 1469, 2177, 6553, 29898, 1311, 29889, 4299, 1839, 27959, 7464, 4742, 29918, 4841, 29922, 1311, 29889, 5085, 29889, 29887, 3746, 29918, 4841, 29897, 13, 18884, 1583, 29889, 4299, 1839, 2218, 29883, 20386, 1061, 2033, 353, 4842, 305, 29889, 15755, 29889, 1469, 2177, 6553, 29898, 1311, 29889, 4299, 1839, 2218, 29883, 20386, 1061, 7464, 4742, 29918, 4841, 29922, 1311, 29889, 5085, 29889, 29887, 3746, 29918, 4841, 29897, 13, 18884, 4842, 305, 29889, 1627, 1975, 29889, 29883, 566, 15755, 29889, 1785, 16580, 353, 5852, 13, 18884, 1596, 877, 2177, 6553, 4464, 471, 2675, 2023, 1495, 13, 9651, 1683, 29901, 13, 18884, 1596, 877, 15771, 29899, 29887, 3746, 4464, 471, 2675, 2023, 1495, 13, 4706, 1683, 29901, 13, 9651, 1596, 877, 6271, 29965, 4464, 471, 2675, 2023, 1495, 13, 13, 4706, 565, 7431, 29898, 1311, 29889, 5085, 29889, 690, 2017, 29897, 1405, 29871, 29906, 29901, 13, 9651, 1423, 3149, 353, 4842, 305, 29889, 1359, 29898, 1311, 29889, 5085, 29889, 690, 2017, 29892, 2910, 29918, 5479, 29922, 2892, 8635, 29892, 1180, 29901, 8635, 29897, 13, 9651, 1583, 29889, 5085, 29889, 2962, 353, 1423, 3149, 1839, 1022, 2878, 2033, 13, 9651, 1583, 29889, 4299, 1839, 27959, 13359, 1359, 29918, 3859, 29918, 8977, 29898, 3198, 3149, 1839, 27959, 11287, 13, 9651, 1583, 29889, 4299, 1839, 2218, 29883, 20386, 1061, 13359, 1359, 29918, 3859, 29918, 8977, 29898, 3198, 3149, 1839, 2218, 29883, 20386, 1061, 11287, 13, 9651, 1596, 877, 1666, 9929, 278, 7945, 1889, 472, 1273, 29941, 29881, 21502, 6609, 2023, 29915, 1273, 1583, 29889, 5085, 29889, 2962, 29897, 13, 4706, 1596, 877, 3195, 8363, 471, 7743, 2023, 1495, 13, 13, 13, 1678, 822, 903, 1272, 29918, 12657, 29898, 1311, 1125, 13, 13, 4706, 1583, 29889, 1272, 1839, 14968, 29918, 12657, 2033, 353, 3630, 10036, 29898, 13, 462, 462, 4706, 315, 6146, 29890, 29909, 29898, 5085, 29922, 1311, 29889, 5085, 511, 13, 462, 462, 4706, 9853, 29918, 2311, 353, 1583, 29889, 5085, 29889, 16175, 29918, 2311, 29892, 320, 13, 462, 462, 4706, 528, 21897, 1678, 353, 5852, 2053, 13, 462, 462, 4706, 954, 29918, 1287, 414, 29922, 1583, 29889, 5085, 29889, 1287, 414, 29897, 13, 4706, 1583, 29889, 1272, 1839, 20227, 29918, 1217, 895, 2033, 353, 4842, 305, 29889, 9502, 29876, 29898, 29953, 29946, 29892, 1583, 29889, 5085, 29889, 262, 29918, 6229, 1919, 29896, 29892, 29871, 29896, 29897, 13, 4706, 565, 1583, 29889, 10141, 29901, 13, 9651, 1583, 29889, 1272, 1839, 20227, 29918, 1217, 895, 2033, 353, 1583, 29889, 1272, 1839, 20227, 29918, 1217, 895, 13359, 29883, 6191, 580, 13, 4706, 1583, 29889, 690, 8173, 1839, 3820, 2209, 2033, 353, 5159, 13, 4706, 1583, 29889, 690, 8173, 1839, 29881, 6758, 2033, 353, 5159, 13, 4706, 1583, 29889, 690, 8173, 1839, 29888, 1296, 2033, 29871, 353, 5159, 13, 4706, 1596, 877, 1469, 8363, 471, 7743, 2023, 1495, 13, 13, 13, 1678, 822, 903, 4299, 29918, 14968, 29898, 1311, 29892, 21502, 305, 353, 29871, 29900, 1125, 13, 13, 4706, 3001, 29918, 29881, 6758, 29892, 3001, 29918, 3820, 2209, 353, 29871, 29900, 29892, 29871, 29900, 13, 4706, 363, 22645, 29892, 527, 3174, 297, 26985, 29898, 1311, 29889, 1272, 1839, 14968, 29918, 12657, 2033, 1125, 13, 632, 13, 9651, 396, 2767, 2313, 20386, 1061, 13, 9651, 1583, 29889, 4299, 1839, 2218, 29883, 20386, 1061, 13359, 14968, 580, 13, 9651, 1583, 29889, 4299, 1839, 27959, 13359, 14513, 580, 13, 9651, 527, 3174, 29889, 276, 339, 2658, 29918, 5105, 353, 7700, 13, 9651, 565, 1583, 29889, 10141, 29901, 13, 18884, 527, 3174, 353, 527, 3174, 29889, 29883, 6191, 580, 13, 9651, 289, 29918, 2311, 353, 527, 3174, 29889, 2311, 29898, 29900, 29897, 13, 9651, 1583, 29889, 4299, 1839, 2218, 29883, 20386, 1061, 13359, 9171, 29918, 5105, 580, 13, 9651, 330, 1017, 353, 4842, 305, 29889, 8159, 3552, 29890, 29918, 2311, 29892, 511, 29871, 29896, 29897, 13, 9651, 565, 1583, 29889, 10141, 29901, 13, 18884, 330, 1017, 353, 330, 1017, 29889, 29883, 6191, 580, 13, 9651, 4450, 29891, 353, 1583, 29889, 4299, 1839, 2218, 29883, 20386, 1061, 29915, 850, 2492, 29879, 467, 1493, 6278, 29896, 29897, 13, 9651, 270, 6758, 29918, 6370, 353, 1583, 29889, 4299, 1839, 29883, 5385, 291, 29915, 850, 11965, 29891, 29892, 330, 1017, 29897, 13, 9651, 270, 6758, 29918, 6370, 29889, 1627, 1328, 580, 13, 13, 9651, 11462, 353, 4842, 305, 29889, 9502, 29876, 29898, 29890, 29918, 2311, 29892, 1583, 29889, 5085, 29889, 262, 29918, 6229, 29892, 29871, 29896, 29892, 29871, 29896, 29897, 13, 9651, 565, 1583, 29889, 10141, 29901, 13, 18884, 11462, 353, 11462, 29889, 29883, 6191, 580, 13, 9651, 25713, 353, 1583, 29889, 4299, 1839, 27959, 29915, 850, 1217, 895, 29897, 13, 9651, 330, 1017, 29889, 5589, 23538, 29900, 29897, 259, 396, 14402, 13, 9651, 4450, 29891, 353, 1583, 29889, 4299, 1839, 2218, 29883, 20386, 1061, 29915, 850, 29888, 1296, 29889, 4801, 496, 16655, 1493, 6278, 29896, 29897, 13, 9651, 270, 6758, 29918, 29888, 1296, 353, 1583, 29889, 4299, 1839, 29883, 5385, 291, 29915, 850, 11965, 29891, 29892, 330, 1017, 29897, 13, 9651, 270, 6758, 29918, 29888, 1296, 29889, 1627, 1328, 580, 13, 9651, 1583, 29889, 4299, 1839, 3670, 29875, 29918, 2218, 29883, 13359, 10568, 580, 13, 632, 13, 9651, 270, 29918, 6758, 29918, 6370, 353, 270, 6758, 29918, 6370, 29889, 12676, 2141, 667, 580, 13, 9651, 270, 29918, 6758, 29918, 29888, 1296, 353, 270, 6758, 29918, 29888, 1296, 29889, 12676, 2141, 667, 580, 13, 9651, 270, 29918, 6758, 353, 270, 29918, 6758, 29918, 6370, 718, 270, 29918, 6758, 29918, 29888, 1296, 13, 9651, 1583, 29889, 690, 8173, 1839, 29881, 6758, 13359, 4397, 29898, 29881, 29918, 6758, 29897, 13, 9651, 3001, 29918, 29881, 6758, 4619, 270, 29918, 6758, 13, 632, 13, 9651, 396, 2767, 15299, 13, 9651, 1583, 29889, 4299, 1839, 27959, 13359, 14968, 580, 13, 9651, 1583, 29889, 4299, 1839, 2218, 29883, 20386, 1061, 13359, 14513, 580, 13, 9651, 1583, 29889, 4299, 1839, 27959, 13359, 9171, 29918, 5105, 580, 13, 9651, 330, 1017, 29889, 5589, 23538, 29896, 29897, 259, 396, 14402, 13, 9651, 4450, 29891, 353, 1583, 29889, 4299, 1839, 2218, 29883, 20386, 1061, 29915, 850, 29888, 1296, 467, 1493, 6278, 29896, 29897, 13, 9651, 3144, 2209, 353, 1583, 29889, 4299, 1839, 29883, 5385, 291, 29915, 850, 11965, 29891, 29892, 330, 1017, 29897, 13, 9651, 3144, 2209, 29889, 1627, 1328, 580, 13, 9651, 1583, 29889, 4299, 1839, 3670, 29875, 29918, 29887, 1600, 13359, 10568, 580, 13, 632, 13, 9651, 330, 29918, 6758, 353, 3144, 2209, 29889, 12676, 2141, 667, 580, 13, 9651, 1583, 29889, 690, 8173, 1839, 3820, 2209, 13359, 4397, 29898, 29887, 29918, 6758, 29897, 13, 632, 13, 9651, 3001, 29918, 3820, 2209, 4619, 330, 29918, 6758, 13, 9651, 565, 313, 13140, 718, 29871, 29896, 29897, 1273, 1583, 29889, 5085, 29889, 2158, 29918, 29888, 7971, 1275, 29871, 29900, 29901, 13, 18884, 1596, 877, 1022, 2878, 584, 1273, 29906, 29881, 29989, 29995, 29906, 29881, 29892, 4256, 584, 1273, 29946, 29881, 29989, 29995, 29946, 29881, 29892, 270, 6758, 584, 18695, 29946, 29888, 29892, 3144, 2209, 584, 18695, 29946, 29888, 29915, 1273, 320, 13, 462, 418, 313, 1022, 2878, 29892, 1583, 29889, 5085, 29889, 1022, 2878, 267, 29892, 22645, 29974, 29896, 29892, 7431, 29898, 1311, 29889, 1272, 1839, 14968, 29918, 12657, 2033, 511, 320, 13, 462, 539, 7442, 29889, 12676, 29898, 1311, 29889, 690, 8173, 1839, 29881, 6758, 2033, 511, 7442, 29889, 12676, 29898, 1311, 29889, 690, 8173, 1839, 3820, 2209, 2033, 4961, 13, 13, 9651, 565, 313, 13140, 718, 29871, 29896, 29897, 1273, 1583, 29889, 5085, 29889, 3712, 2105, 29918, 29888, 7971, 1275, 29871, 29900, 29901, 13, 18884, 411, 4842, 305, 29889, 1217, 29918, 5105, 7295, 13, 462, 1678, 1583, 29889, 4299, 1839, 27959, 13359, 14513, 580, 13, 462, 1678, 25713, 353, 1583, 29889, 4299, 1839, 27959, 29915, 850, 1311, 29889, 1272, 1839, 20227, 29918, 1217, 895, 2033, 467, 4801, 496, 2141, 21970, 580, 13, 18884, 1583, 29889, 690, 8173, 1839, 29888, 1296, 13359, 4397, 29898, 29888, 1296, 29897, 13, 13, 4706, 736, 3001, 29918, 29881, 6758, 29892, 3001, 29918, 3820, 2209, 13, 13, 13, 1678, 822, 903, 3396, 29918, 7888, 29898, 1311, 1125, 13, 13, 4706, 1375, 29918, 6758, 353, 29871, 29896, 29872, 29941, 13, 308, 13, 4706, 363, 21502, 305, 297, 3464, 29898, 1311, 29889, 5085, 29889, 2962, 29892, 1583, 29889, 5085, 29889, 1022, 2878, 267, 718, 29871, 29896, 1125, 13, 13, 9651, 1369, 29918, 2230, 353, 931, 29889, 2230, 580, 13, 9651, 270, 6758, 29892, 3144, 2209, 353, 1583, 3032, 4299, 29918, 14968, 29898, 1022, 2878, 29897, 13, 9651, 7945, 29918, 6758, 353, 270, 6758, 718, 3144, 2209, 13, 9651, 396, 1583, 29889, 4299, 1839, 816, 14952, 13359, 10568, 580, 13, 9651, 1095, 29918, 2230, 353, 931, 29889, 2230, 580, 13, 9651, 1596, 877, 15771, 21502, 305, 3438, 931, 584, 18695, 29906, 29888, 286, 1144, 29915, 1273, 5135, 355, 29918, 2230, 448, 1369, 29918, 2230, 6802, 29953, 29900, 876, 13, 13, 9651, 565, 451, 2897, 29889, 2084, 29889, 9933, 29898, 1311, 29889, 5085, 29889, 7620, 29918, 517, 1125, 13, 18884, 2897, 29889, 11256, 3972, 29898, 1311, 29889, 5085, 29889, 7620, 29918, 517, 29897, 13, 13, 9651, 565, 313, 1195, 29918, 6758, 1405, 7945, 29918, 6758, 29897, 322, 313, 1333, 1583, 29889, 5085, 29889, 275, 29918, 8382, 1125, 13, 18884, 1596, 877, 29995, 29879, 1482, 317, 2891, 29909, 471, 1476, 29995, 29879, 29915, 1273, 6702, 29930, 29915, 29930, 29896, 29953, 29892, 525, 29930, 29915, 29930, 29896, 29953, 876, 13, 18884, 1375, 29918, 6758, 353, 7945, 29918, 6758, 13, 18884, 10422, 353, 2897, 29889, 2084, 29889, 7122, 29898, 1311, 29889, 5085, 29889, 7620, 29918, 517, 29892, 525, 29879, 4616, 29889, 29886, 386, 29889, 12637, 1495, 13, 18884, 4842, 305, 29889, 7620, 3319, 13, 462, 1678, 525, 1022, 2878, 29915, 308, 584, 21502, 305, 29892, 13, 462, 1678, 525, 27959, 29915, 268, 584, 1583, 29889, 4299, 1839, 27959, 13359, 3859, 29918, 8977, 3285, 13, 462, 1678, 525, 2218, 29883, 20386, 1061, 29915, 584, 1583, 29889, 4299, 1839, 2218, 29883, 20386, 1061, 13359, 3859, 29918, 8977, 3285, 13, 462, 1678, 525, 6758, 29915, 3986, 584, 1375, 29918, 6758, 29892, 13, 18884, 2981, 10422, 29897, 13, 13, 9651, 565, 313, 1022, 2878, 1273, 1583, 29889, 5085, 29889, 7620, 29918, 29888, 7971, 1275, 29871, 29900, 29897, 322, 313, 1333, 1583, 29889, 5085, 29889, 275, 29918, 8382, 1125, 13, 18884, 10422, 353, 2897, 29889, 2084, 29889, 7122, 29898, 1311, 29889, 5085, 29889, 7620, 29918, 517, 29892, 525, 1022, 2878, 29918, 18717, 710, 29898, 1022, 2878, 7240, 4286, 29886, 386, 29889, 12637, 1495, 13, 18884, 4842, 305, 29889, 7620, 3319, 13, 462, 1678, 525, 1022, 2878, 29915, 308, 584, 21502, 305, 29892, 13, 462, 1678, 525, 27959, 29915, 268, 584, 1583, 29889, 4299, 1839, 27959, 13359, 3859, 29918, 8977, 3285, 13, 462, 1678, 525, 2218, 29883, 20386, 1061, 29915, 584, 1583, 29889, 4299, 1839, 2218, 29883, 20386, 1061, 13359, 3859, 29918, 8977, 3285, 13, 462, 1678, 525, 6758, 29915, 3986, 584, 7945, 29918, 6758, 29892, 13, 18884, 2981, 10422, 29897, 13, 13, 9651, 565, 1583, 29889, 5085, 29889, 275, 29918, 8382, 29901, 13, 18884, 2867, 13, 13, 268, 13, 1678, 822, 903, 20119, 29918, 690, 29898, 1311, 1125, 13, 4706, 14550, 9249, 278, 6694, 1889, 14550, 13, 308, 13, 4706, 396, 3144, 2209, 322, 270, 6758, 13, 4706, 14770, 29889, 4532, 29898, 1003, 2311, 7607, 29896, 29900, 29892, 29945, 876, 13, 4706, 14770, 29889, 3257, 703, 21575, 322, 8565, 20386, 1061, 365, 2209, 7133, 26101, 1159, 13, 4706, 14770, 29889, 5317, 29898, 1311, 29889, 690, 8173, 1839, 3820, 2209, 7464, 3858, 543, 3820, 2209, 1159, 13, 4706, 14770, 29889, 5317, 29898, 1311, 29889, 690, 8173, 1839, 29881, 6758, 7464, 3858, 543, 29881, 6758, 1159, 13, 4706, 14770, 29889, 29916, 1643, 703, 1524, 800, 1159, 13, 4706, 14770, 29889, 29891, 1643, 703, 6758, 1159, 13, 4706, 14770, 29889, 26172, 580, 13, 4706, 14770, 29889, 7620, 1003, 877, 6758, 29889, 6173, 742, 270, 1631, 29922, 29946, 29900, 29900, 29897, 13, 308, 13, 4706, 396, 4078, 278, 25713, 29899, 8346, 13, 4706, 7442, 29889, 7620, 877, 29888, 1296, 29889, 29876, 2272, 742, 1583, 29889, 690, 8173, 1839, 29888, 1296, 11287, 13, 308, 13, 268, 13, 268, 13, 1678, 822, 7945, 29918, 27492, 29898, 1311, 1125, 13, 13, 4706, 1583, 3032, 12276, 29918, 11027, 580, 13, 13, 4706, 1583, 3032, 4299, 29918, 12657, 580, 13, 13, 4706, 1583, 3032, 1272, 29918, 12657, 580, 13, 13, 4706, 1583, 3032, 3396, 29918, 7888, 580, 13, 308, 13, 4706, 1583, 3032, 20119, 29918, 690, 580, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 13, 1678, 3700, 29884, 353, 360, 11135, 2190, 29898, 26495, 29918, 5085, 3101, 13, 1678, 3700, 29884, 29889, 14968, 29918, 27492, 580, 13, 2 ]
projects/migrations/0003_projectport_container_port.py
kilinger/marathon-rocketchat-hubot
1
184119
<reponame>kilinger/marathon-rocketchat-hubot # -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('projects', '0002_auto_20160122_0305'), ] operations = [ migrations.AddField( model_name='projectport', name='container_port', field=models.IntegerField(default=5000), preserve_default=False, ), ]
[ 1, 529, 276, 1112, 420, 29958, 16757, 5621, 29914, 3034, 25206, 29899, 20821, 3486, 271, 29899, 29882, 431, 327, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 3166, 4770, 29888, 9130, 1649, 1053, 29104, 29918, 20889, 1338, 13, 13, 3166, 9557, 29889, 2585, 1053, 9725, 800, 29892, 4733, 13, 13, 13, 1990, 341, 16783, 29898, 26983, 800, 29889, 29924, 16783, 1125, 13, 13, 1678, 9962, 353, 518, 13, 4706, 6702, 16418, 742, 525, 29900, 29900, 29900, 29906, 29918, 6921, 29918, 29906, 29900, 29896, 29953, 29900, 29896, 29906, 29906, 29918, 29900, 29941, 29900, 29945, 5477, 13, 1678, 4514, 13, 13, 1678, 6931, 353, 518, 13, 4706, 9725, 800, 29889, 2528, 3073, 29898, 13, 9651, 1904, 29918, 978, 2433, 4836, 637, 742, 13, 9651, 1024, 2433, 7611, 29918, 637, 742, 13, 9651, 1746, 29922, 9794, 29889, 7798, 3073, 29898, 4381, 29922, 29945, 29900, 29900, 29900, 511, 13, 9651, 19905, 29918, 4381, 29922, 8824, 29892, 13, 4706, 10353, 13, 1678, 4514, 13, 2 ]
test.py
sbcshop/PiRelay-8
2
4654
<reponame>sbcshop/PiRelay-8<filename>test.py<gh_stars>1-10 from PiRelay8 import Relay import time r1 = Relay("RELAY1") r2 = Relay("RELAY2") r3 = Relay("RELAY3") r4 = Relay("RELAY4") r5 = Relay("RELAY5") r6 = Relay("RELAY6") r7 = Relay("RELAY7") r8 = Relay("RELAY8") r1.off() r2.off() r3.off() r4.off() r5.off() r6.off() r7.off() r8.off() r1.on() time.sleep(0.5) r1.off() time.sleep(0.5) r2.on() time.sleep(0.5) r2.off() time.sleep(0.5) r3.on() time.sleep(0.5) r3.off() time.sleep(0.5) r4.on() time.sleep(0.5) r4.off() time.sleep(0.5) r5.on() time.sleep(0.5) r5.off() time.sleep(0.5) r6.on() time.sleep(0.5) r6.off() time.sleep(0.5) r7.on() time.sleep(0.5) r7.off() time.sleep(0.5) r8.on() time.sleep(0.5) r8.off() time.sleep(0.5)
[ 1, 529, 276, 1112, 420, 29958, 29879, 12328, 19032, 29914, 12197, 9662, 388, 29899, 29947, 29966, 9507, 29958, 1688, 29889, 2272, 29966, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 3166, 7362, 9662, 388, 29947, 1053, 6376, 388, 30004, 13, 5215, 931, 30004, 13, 30004, 13, 29878, 29896, 353, 6376, 388, 703, 1525, 18799, 29896, 1159, 30004, 13, 29878, 29906, 353, 6376, 388, 703, 1525, 18799, 29906, 1159, 30004, 13, 29878, 29941, 353, 6376, 388, 703, 1525, 18799, 29941, 1159, 30004, 13, 29878, 29946, 353, 6376, 388, 703, 1525, 18799, 29946, 1159, 30004, 13, 29878, 29945, 353, 6376, 388, 703, 1525, 18799, 29945, 1159, 30004, 13, 29878, 29953, 353, 6376, 388, 703, 1525, 18799, 29953, 1159, 30004, 13, 29878, 29955, 353, 6376, 388, 703, 1525, 18799, 29955, 1159, 30004, 13, 29878, 29947, 353, 6376, 388, 703, 1525, 18799, 29947, 1159, 30004, 13, 30004, 13, 30004, 13, 29878, 29896, 29889, 2696, 26471, 13, 29878, 29906, 29889, 2696, 26471, 13, 29878, 29941, 29889, 2696, 26471, 13, 29878, 29946, 29889, 2696, 26471, 13, 29878, 29945, 29889, 2696, 26471, 13, 29878, 29953, 29889, 2696, 26471, 13, 29878, 29955, 29889, 2696, 26471, 13, 29878, 29947, 29889, 2696, 26471, 13, 30004, 13, 29878, 29896, 29889, 265, 26471, 13, 2230, 29889, 17059, 29898, 29900, 29889, 29945, 8443, 13, 29878, 29896, 29889, 2696, 26471, 13, 2230, 29889, 17059, 29898, 29900, 29889, 29945, 8443, 13, 30004, 13, 29878, 29906, 29889, 265, 26471, 13, 2230, 29889, 17059, 29898, 29900, 29889, 29945, 8443, 13, 29878, 29906, 29889, 2696, 26471, 13, 2230, 29889, 17059, 29898, 29900, 29889, 29945, 8443, 13, 30004, 13, 29878, 29941, 29889, 265, 26471, 13, 2230, 29889, 17059, 29898, 29900, 29889, 29945, 8443, 13, 29878, 29941, 29889, 2696, 26471, 13, 2230, 29889, 17059, 29898, 29900, 29889, 29945, 8443, 13, 30004, 13, 29878, 29946, 29889, 265, 26471, 13, 2230, 29889, 17059, 29898, 29900, 29889, 29945, 8443, 13, 29878, 29946, 29889, 2696, 26471, 13, 2230, 29889, 17059, 29898, 29900, 29889, 29945, 8443, 13, 30004, 13, 29878, 29945, 29889, 265, 26471, 13, 2230, 29889, 17059, 29898, 29900, 29889, 29945, 8443, 13, 29878, 29945, 29889, 2696, 26471, 13, 2230, 29889, 17059, 29898, 29900, 29889, 29945, 8443, 13, 30004, 13, 29878, 29953, 29889, 265, 26471, 13, 2230, 29889, 17059, 29898, 29900, 29889, 29945, 8443, 13, 29878, 29953, 29889, 2696, 26471, 13, 2230, 29889, 17059, 29898, 29900, 29889, 29945, 8443, 13, 30004, 13, 29878, 29955, 29889, 265, 26471, 13, 2230, 29889, 17059, 29898, 29900, 29889, 29945, 8443, 13, 29878, 29955, 29889, 2696, 26471, 13, 2230, 29889, 17059, 29898, 29900, 29889, 29945, 8443, 13, 30004, 13, 29878, 29947, 29889, 265, 26471, 13, 2230, 29889, 17059, 29898, 29900, 29889, 29945, 8443, 13, 29878, 29947, 29889, 2696, 26471, 13, 2230, 29889, 17059, 29898, 29900, 29889, 29945, 8443, 13, 2 ]
src/median_of_medians.py
SynerClust/SynerClust
7
70112
<reponame>SynerClust/SynerClust import math import numpy def pivot(l, left, right): # right should be len(l)-1 """ Returns the position of the median of medians. Left and right values should be the start and end positions of the part of the array to use. """ if (right - left < 5): return partition5(l, left, right) for i in xrange(left, right + 1, 5): # maybe right+1 subRight = i + 4 if subRight > right: subRight = right median5 = partition5(l, i, subRight) tmp = numpy.copy(l[median5]) l[median5] = l[left + int(math.floor((i - left) / 5))] l[left + int(math.floor((i - left)/5))] = tmp return pivot(l, left, left + ((right - left) / 5)) # no ceil((right-left)/5.0-1) because /5 already takes floor # return select(l, left, left + ((right - left) / 5), left + (right - left) / 10) # no ceil((right-left)/5.0-1) because /5 already takes floor def partition5(l, left, right): """ Insertion Sort of list of at most 5 elements and return the position of the median. """ j = left for i in xrange(left, right + 1): t = numpy.copy(l[i]) for j in xrange(i, left - 1, -1): if l[j - 1][0] < t[0]: break l[j] = l[j - 1] l[j] = t return int(math.floor((left + right) / 2)) def select(l, left, right, n): while(True): if left == right: return left pivotIndex = pivot(l, left, right) pivotIndex = partition(l, left, right - 1, pivotIndex) if (n == pivotIndex): return n elif n < pivotIndex: right = pivotIndex - 1 left = pivotIndex + 1 def partition(l, left, right, pivotIndex): # right is included pivotValue = numpy.copy(l[pivotIndex]) l[pivotIndex] = l[right] l[right] = pivotValue storeIndex = left tmp = 0 for i in xrange(left, right): if l[i][0] < pivotValue[0]: tmp = l[storeIndex] l[storeIndex] = l[i] l[i] = tmp storeIndex += 1 l[right] = l[storeIndex] l[storeIndex] = pivotValue return storeIndex def for2DArray(l): return pivot(l, 0, l.shape[0]-1)
[ 1, 529, 276, 1112, 420, 29958, 29216, 261, 6821, 504, 29914, 29216, 261, 6821, 504, 13, 5215, 5844, 13, 5215, 12655, 13, 13, 1753, 24438, 29898, 29880, 29892, 2175, 29892, 1492, 1125, 29871, 396, 1492, 881, 367, 7431, 29898, 29880, 6817, 29896, 13, 12, 15945, 29908, 13, 12, 11609, 29879, 278, 2602, 310, 278, 19194, 310, 1612, 5834, 29889, 13, 12, 8091, 322, 1492, 1819, 881, 367, 278, 1369, 322, 1095, 11909, 310, 278, 760, 310, 278, 1409, 304, 671, 29889, 13, 12, 15945, 29908, 13, 12, 361, 313, 1266, 448, 2175, 529, 29871, 29945, 1125, 13, 12, 12, 2457, 8877, 29945, 29898, 29880, 29892, 2175, 29892, 1492, 29897, 13, 13, 12, 1454, 474, 297, 921, 3881, 29898, 1563, 29892, 1492, 718, 29871, 29896, 29892, 29871, 29945, 1125, 29871, 396, 5505, 1492, 29974, 29896, 13, 12, 12, 1491, 7341, 353, 474, 718, 29871, 29946, 13, 12, 12, 361, 1014, 7341, 1405, 1492, 29901, 13, 12, 12, 12, 1491, 7341, 353, 1492, 13, 12, 12, 2168, 713, 29945, 353, 8877, 29945, 29898, 29880, 29892, 474, 29892, 1014, 7341, 29897, 13, 12, 12, 13, 12, 12, 7050, 353, 12655, 29889, 8552, 29898, 29880, 29961, 2168, 713, 29945, 2314, 13, 12, 12, 29880, 29961, 2168, 713, 29945, 29962, 353, 301, 29961, 1563, 718, 938, 29898, 755, 29889, 14939, 3552, 29875, 448, 2175, 29897, 847, 29871, 29945, 28166, 13, 12, 12, 29880, 29961, 1563, 718, 938, 29898, 755, 29889, 14939, 3552, 29875, 448, 2175, 6802, 29945, 28166, 353, 13128, 13, 12, 12, 2457, 24438, 29898, 29880, 29892, 2175, 29892, 2175, 718, 5135, 1266, 448, 2175, 29897, 847, 29871, 29945, 876, 29871, 396, 694, 2257, 309, 3552, 1266, 29899, 1563, 6802, 29945, 29889, 29900, 29899, 29896, 29897, 1363, 847, 29945, 2307, 4893, 11904, 13, 29937, 29871, 12, 2457, 1831, 29898, 29880, 29892, 2175, 29892, 2175, 718, 5135, 1266, 448, 2175, 29897, 847, 29871, 29945, 511, 2175, 718, 313, 1266, 448, 2175, 29897, 847, 29871, 29896, 29900, 29897, 29871, 396, 694, 2257, 309, 3552, 1266, 29899, 1563, 6802, 29945, 29889, 29900, 29899, 29896, 29897, 1363, 847, 29945, 2307, 4893, 11904, 13, 13, 1753, 8877, 29945, 29898, 29880, 29892, 2175, 29892, 1492, 1125, 13, 12, 15945, 29908, 13, 12, 17491, 291, 20025, 310, 1051, 310, 472, 1556, 29871, 29945, 3161, 322, 736, 278, 2602, 310, 278, 19194, 29889, 13, 12, 15945, 29908, 13, 12, 29926, 353, 2175, 13, 12, 1454, 474, 297, 921, 3881, 29898, 1563, 29892, 1492, 718, 29871, 29896, 1125, 13, 12, 12, 29873, 353, 12655, 29889, 8552, 29898, 29880, 29961, 29875, 2314, 13, 12, 12, 1454, 432, 297, 921, 3881, 29898, 29875, 29892, 2175, 448, 29871, 29896, 29892, 448, 29896, 1125, 13, 12, 12, 12, 361, 301, 29961, 29926, 448, 29871, 29896, 3816, 29900, 29962, 529, 260, 29961, 29900, 5387, 13, 12, 12, 12, 12, 8690, 13, 12, 12, 12, 29880, 29961, 29926, 29962, 353, 301, 29961, 29926, 448, 29871, 29896, 29962, 13, 12, 12, 29880, 29961, 29926, 29962, 353, 260, 13, 12, 2457, 938, 29898, 755, 29889, 14939, 3552, 1563, 718, 1492, 29897, 847, 29871, 29906, 876, 13, 13, 1753, 1831, 29898, 29880, 29892, 2175, 29892, 1492, 29892, 302, 1125, 13, 12, 8000, 29898, 5574, 1125, 13, 12, 12, 361, 2175, 1275, 1492, 29901, 13, 12, 12, 12, 2457, 2175, 13, 12, 12, 29886, 11002, 3220, 353, 24438, 29898, 29880, 29892, 2175, 29892, 1492, 29897, 13, 12, 12, 29886, 11002, 3220, 353, 8877, 29898, 29880, 29892, 2175, 29892, 1492, 448, 29871, 29896, 29892, 24438, 3220, 29897, 13, 12, 12, 361, 313, 29876, 1275, 24438, 3220, 1125, 13, 12, 12, 12, 2457, 302, 13, 12, 12, 23681, 302, 529, 24438, 3220, 29901, 13, 12, 12, 12, 1266, 353, 24438, 3220, 448, 29871, 29896, 13, 12, 12, 12, 1563, 353, 24438, 3220, 718, 29871, 29896, 13, 13, 1753, 8877, 29898, 29880, 29892, 2175, 29892, 1492, 29892, 24438, 3220, 1125, 29871, 396, 1492, 338, 5134, 13, 12, 29886, 11002, 1917, 353, 12655, 29889, 8552, 29898, 29880, 29961, 29886, 11002, 3220, 2314, 13, 12, 29880, 29961, 29886, 11002, 3220, 29962, 353, 301, 29961, 1266, 29962, 13, 12, 29880, 29961, 1266, 29962, 353, 24438, 1917, 13, 12, 8899, 3220, 353, 2175, 13, 12, 7050, 353, 29871, 29900, 13, 13, 12, 1454, 474, 297, 921, 3881, 29898, 1563, 29892, 1492, 1125, 13, 12, 12, 361, 301, 29961, 29875, 3816, 29900, 29962, 529, 24438, 1917, 29961, 29900, 5387, 13, 12, 12, 12, 7050, 353, 301, 29961, 8899, 3220, 29962, 13, 12, 12, 12, 29880, 29961, 8899, 3220, 29962, 353, 301, 29961, 29875, 29962, 13, 12, 12, 12, 29880, 29961, 29875, 29962, 353, 13128, 13, 12, 12, 12, 8899, 3220, 4619, 29871, 29896, 13, 13, 12, 29880, 29961, 1266, 29962, 353, 301, 29961, 8899, 3220, 29962, 13, 12, 29880, 29961, 8899, 3220, 29962, 353, 24438, 1917, 13, 12, 2457, 3787, 3220, 13, 13, 1753, 363, 29906, 29928, 2588, 29898, 29880, 1125, 13, 12, 2457, 24438, 29898, 29880, 29892, 29871, 29900, 29892, 301, 29889, 12181, 29961, 29900, 29962, 29899, 29896, 29897, 2 ]
soluciones/df_concatenar.py
carlosviveros/Soluciones
1
120260
"""AyudaEnPython: https://www.facebook.com/groups/ayudapython TODO: add docstring and tests. """ import pandas as pd from prototools import retrieve_argname, tabulate, red HEADERS = ["Source", "A", "B", "C"] source_1 = pd.DataFrame( { "A": [1, 2, 3], "B": [4, 5, 6], "C": [7, 8, 9] } ) source_2 = pd.DataFrame( { "A": [10, 11, 12], "B": [13, 14, 15], "C": [16, 17, 18] } ) def concatenar(a, b): a["Source"] = retrieve_argname(a) b["Source"] = retrieve_argname(b) df = pd.concat([a, b], ignore_index=True) return df.reindex(columns=HEADERS) df = concatenar(source_1, source_2) data = df.values.tolist() print(tabulate( data, headless=True, headers=HEADERS, border_type="double", title="Dataset", color=red, ))
[ 1, 9995, 29909, 29891, 6191, 2369, 11980, 29901, 2045, 597, 1636, 29889, 15445, 29889, 510, 29914, 13155, 29914, 388, 566, 481, 1656, 13, 13, 4986, 3970, 29901, 788, 1574, 1807, 322, 6987, 29889, 13, 15945, 29908, 13, 5215, 11701, 408, 10518, 13, 3166, 410, 4260, 8789, 1053, 10563, 29918, 1191, 978, 29892, 4434, 5987, 29892, 2654, 13, 13, 23252, 23598, 353, 6796, 4435, 613, 376, 29909, 613, 376, 29933, 613, 376, 29907, 3108, 13, 13, 4993, 29918, 29896, 353, 10518, 29889, 17271, 29898, 13, 1678, 426, 13, 4706, 376, 29909, 1115, 518, 29896, 29892, 29871, 29906, 29892, 29871, 29941, 1402, 13, 4706, 376, 29933, 1115, 518, 29946, 29892, 29871, 29945, 29892, 29871, 29953, 1402, 13, 4706, 376, 29907, 1115, 518, 29955, 29892, 29871, 29947, 29892, 29871, 29929, 29962, 13, 1678, 500, 13, 29897, 13, 4993, 29918, 29906, 353, 10518, 29889, 17271, 29898, 13, 1678, 426, 13, 4706, 376, 29909, 1115, 518, 29896, 29900, 29892, 29871, 29896, 29896, 29892, 29871, 29896, 29906, 1402, 13, 4706, 376, 29933, 1115, 518, 29896, 29941, 29892, 29871, 29896, 29946, 29892, 29871, 29896, 29945, 1402, 13, 4706, 376, 29907, 1115, 518, 29896, 29953, 29892, 29871, 29896, 29955, 29892, 29871, 29896, 29947, 29962, 13, 1678, 500, 13, 29897, 13, 13, 13, 1753, 16125, 279, 29898, 29874, 29892, 289, 1125, 13, 1678, 263, 3366, 4435, 3108, 353, 10563, 29918, 1191, 978, 29898, 29874, 29897, 13, 1678, 289, 3366, 4435, 3108, 353, 10563, 29918, 1191, 978, 29898, 29890, 29897, 13, 1678, 4489, 353, 10518, 29889, 17685, 4197, 29874, 29892, 289, 1402, 11455, 29918, 2248, 29922, 5574, 29897, 13, 1678, 736, 4489, 29889, 276, 2248, 29898, 13099, 29922, 23252, 23598, 29897, 13, 13, 13, 2176, 353, 16125, 279, 29898, 4993, 29918, 29896, 29892, 2752, 29918, 29906, 29897, 13, 1272, 353, 4489, 29889, 5975, 29889, 25027, 391, 580, 13, 2158, 29898, 3891, 5987, 29898, 13, 1678, 848, 29892, 13, 1678, 2343, 2222, 29922, 5574, 29892, 13, 1678, 9066, 29922, 23252, 23598, 29892, 13, 1678, 5139, 29918, 1853, 543, 8896, 613, 13, 1678, 3611, 543, 16390, 24541, 613, 13, 1678, 2927, 29922, 1127, 29892, 13, 876, 2 ]
squares.py
SrujanAakurathi/Programming-Assignments
0
77537
""" Given an integer number n, define a function named printDict() which can print a dictionary where the keys are numbers between 1 and n (both included) and the values are square of keys. The function printDict() doesn't take any argument. Input Format: The first line contains the number n. Output Format: Print the dictionary in one line. Example: Input: 5 Output: {1: 1, 2: 4, 3: 9, 4: 16, 5: 25} NOTE: You are supposed to write the code for the function printDict() only. The function has already been called in the main part of the code. """ def printDict(): n = int(input()) d = {} for i in range(n): d[i+1] = (i+1)**2 print(d, end = " ") printDict()
[ 1, 9995, 13, 13, 11221, 385, 6043, 1353, 302, 29892, 4529, 263, 740, 4257, 1596, 21533, 580, 607, 508, 1596, 263, 8600, 988, 278, 6611, 526, 3694, 1546, 29871, 29896, 322, 302, 313, 20313, 5134, 29897, 322, 278, 1819, 526, 6862, 310, 6611, 29889, 13, 1576, 740, 1596, 21533, 580, 1838, 29915, 29873, 2125, 738, 2980, 29889, 13, 13, 4290, 19191, 29901, 13, 1576, 937, 1196, 3743, 278, 1353, 302, 29889, 13, 13, 6466, 19191, 29901, 13, 11816, 278, 8600, 297, 697, 1196, 29889, 13, 13, 14023, 29901, 13, 13, 4290, 29901, 13, 29945, 13, 13, 6466, 29901, 13, 29912, 29896, 29901, 29871, 29896, 29892, 29871, 29906, 29901, 29871, 29946, 29892, 29871, 29941, 29901, 29871, 29929, 29892, 29871, 29946, 29901, 29871, 29896, 29953, 29892, 29871, 29945, 29901, 29871, 29906, 29945, 29913, 13, 13, 12256, 29923, 29901, 887, 526, 7424, 304, 2436, 278, 775, 363, 278, 740, 1596, 21533, 580, 871, 29889, 450, 740, 756, 2307, 1063, 2000, 297, 278, 1667, 760, 310, 278, 775, 29889, 29871, 13, 13, 15945, 29908, 13, 13, 13, 1753, 1596, 21533, 7295, 13, 29871, 302, 353, 938, 29898, 2080, 3101, 13, 29871, 270, 353, 6571, 13, 29871, 363, 474, 297, 3464, 29898, 29876, 1125, 13, 1678, 270, 29961, 29875, 29974, 29896, 29962, 353, 313, 29875, 29974, 29896, 29897, 1068, 29906, 13, 29871, 1596, 29898, 29881, 29892, 1095, 353, 376, 16521, 13, 2158, 21533, 580, 13, 2 ]
src/triage/component/postmodeling/contrast/utils/aux_funcs.py
silvrwolfboy/triage-1
0
1614161
<reponame>silvrwolfboy/triage-1<filename>src/triage/component/postmodeling/contrast/utils/aux_funcs.py ''' A4uxiliary functions and helpers: This set of functions are helper functions to format data (i.e., prediction matrices, etc.) for plotting. This functions are called in both Model class and ModelGroup class in evaluation.py. ''' from sqlalchemy import create_engine from sqlalchemy.sql import text from collections import namedtuple import yaml ModelEvaluator = namedtuple('ModelEvaluator', ('model_group_id', 'model_id')) def create_pgconn(credentials_yaml): ''' Create SQL connection object using a psycopg2 cursor and abiding to new dssg/dsapp db user configuration. Arguments: - credentials_yaml: .yaml file with db credentials ''' with open(credentials_yaml) as f: configs = yaml.load(f) try: conn = create_engine("postgresql://{user}:{password}@{host}:{port}/{dbname}".format(**configs)) except: print("Error connecting to db.") return conn def get_models_ids(audited_model_group_ids, conn): ''' This helper functions will retrieve the model_id's from a set of model_group_ids and will instantiate each model into the ModelEvaluator class. Aguments: - audited_model_group_ids: List of model_group_ids (ideally from Audition's output) - conn: sql engine This function will return a list of ModelEvaluator objects ''' query = conn.execute(text(""" SELECT model_group_id, model_id FROM model_metadata.models WHERE model_group_id = ANY(:ids); """), ids=audited_model_group_ids) return [ModelEvaluator._make(row) for row in query]
[ 1, 529, 276, 1112, 420, 29958, 25590, 13416, 29893, 4369, 19415, 29914, 3626, 482, 29899, 29896, 29966, 9507, 29958, 4351, 29914, 3626, 482, 29914, 9700, 29914, 2490, 4299, 292, 29914, 9996, 579, 29914, 13239, 29914, 2993, 29918, 7692, 2395, 29889, 2272, 13, 12008, 13, 29909, 29946, 1314, 2638, 653, 3168, 322, 1371, 414, 29901, 13, 13, 4013, 731, 310, 3168, 526, 16876, 3168, 304, 3402, 848, 29871, 13, 29898, 29875, 29889, 29872, 1696, 18988, 13516, 29892, 2992, 1846, 363, 6492, 1259, 29889, 910, 3168, 13, 598, 2000, 297, 1716, 8125, 770, 322, 8125, 4782, 770, 297, 29871, 13, 24219, 362, 29889, 2272, 29889, 13, 12008, 13, 13, 3166, 4576, 284, 305, 6764, 1053, 1653, 29918, 10599, 13, 3166, 4576, 284, 305, 6764, 29889, 2850, 1053, 1426, 13, 3166, 16250, 1053, 4257, 23583, 13, 5215, 343, 8807, 13, 13, 13, 3195, 29923, 4387, 1061, 353, 4257, 23583, 877, 3195, 29923, 4387, 1061, 742, 29871, 13, 462, 965, 6702, 4299, 29918, 2972, 29918, 333, 742, 525, 4299, 29918, 333, 8785, 13, 13, 13, 1753, 1653, 29918, 4061, 13082, 29898, 11944, 9409, 29918, 25162, 1125, 13, 1678, 14550, 13, 1678, 6204, 3758, 3957, 1203, 773, 263, 6529, 29891, 9708, 29887, 29906, 10677, 322, 633, 4821, 304, 716, 13, 1678, 270, 893, 29887, 29914, 6289, 932, 4833, 1404, 5285, 29889, 29871, 13, 13, 1678, 11842, 9331, 29901, 13, 4706, 448, 16140, 29918, 25162, 29901, 869, 25162, 934, 411, 4833, 16140, 13, 1678, 14550, 13, 1678, 411, 1722, 29898, 11944, 9409, 29918, 25162, 29897, 408, 285, 29901, 13, 4706, 2295, 29879, 353, 343, 8807, 29889, 1359, 29898, 29888, 29897, 13, 1678, 1018, 29901, 13, 4706, 11009, 353, 1653, 29918, 10599, 703, 29272, 597, 29912, 1792, 6177, 29912, 5630, 29913, 28312, 3069, 6177, 29912, 637, 6822, 29912, 2585, 978, 29913, 1642, 4830, 29898, 1068, 2917, 29879, 876, 13, 1678, 5174, 29901, 13, 4706, 1596, 703, 2392, 16791, 304, 4833, 23157, 13, 13, 1678, 736, 11009, 29871, 13, 13, 13, 1753, 679, 29918, 9794, 29918, 4841, 29898, 15052, 1573, 29918, 4299, 29918, 2972, 29918, 4841, 29892, 11009, 1125, 13, 1678, 14550, 13, 1678, 910, 16876, 3168, 674, 10563, 278, 1904, 29918, 333, 29915, 29879, 515, 263, 731, 13, 1678, 310, 1904, 29918, 2972, 29918, 4841, 322, 674, 25112, 1269, 1904, 964, 278, 29871, 13, 1678, 8125, 29923, 4387, 1061, 770, 29889, 29871, 13, 13, 1678, 4059, 9331, 29901, 13, 4706, 448, 12990, 1573, 29918, 4299, 29918, 2972, 29918, 4841, 29901, 2391, 310, 1904, 29918, 2972, 29918, 4841, 29871, 13, 3986, 313, 680, 635, 515, 8612, 654, 29915, 29879, 1962, 29897, 13, 4706, 448, 11009, 29901, 4576, 6012, 13, 13, 1678, 910, 740, 674, 736, 263, 1051, 310, 8125, 29923, 4387, 1061, 3618, 13, 1678, 14550, 13, 13, 1678, 2346, 353, 11009, 29889, 7978, 29898, 726, 703, 15945, 13, 1678, 5097, 1904, 29918, 2972, 29918, 333, 29892, 13, 965, 1904, 29918, 333, 13, 1678, 3895, 1904, 29918, 19635, 29889, 9794, 13, 1678, 5754, 1904, 29918, 2972, 29918, 333, 353, 13764, 29979, 8137, 4841, 416, 13, 1678, 5124, 4968, 18999, 29922, 15052, 1573, 29918, 4299, 29918, 2972, 29918, 4841, 29897, 13, 13, 1678, 736, 518, 3195, 29923, 4387, 1061, 3032, 5675, 29898, 798, 29897, 363, 1948, 297, 2346, 29962, 13, 2 ]
scripts/create_targets.py
pjsier/horoscope-markov
0
66936
import sys from datetime import date, timedelta SIGN_IDS = list(range(1, 13)) if __name__ == "__main__": start_date = date(2019, 1, 1) end_date = date.today() for date_diff in range(0, (end_date - start_date).days + 1): date_str = (start_date + timedelta(days=date_diff)).strftime("%Y%m%d") for sign_id in SIGN_IDS: sys.stdout.write(f"{date_str}/{sign_id}\n")
[ 1, 1053, 10876, 13, 3166, 12865, 1053, 2635, 29892, 5335, 287, 2554, 13, 13, 5425, 20728, 29918, 1367, 29903, 353, 1051, 29898, 3881, 29898, 29896, 29892, 29871, 29896, 29941, 876, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 1369, 29918, 1256, 353, 2635, 29898, 29906, 29900, 29896, 29929, 29892, 29871, 29896, 29892, 29871, 29896, 29897, 13, 1678, 1095, 29918, 1256, 353, 2635, 29889, 27765, 580, 13, 1678, 363, 2635, 29918, 12765, 297, 3464, 29898, 29900, 29892, 313, 355, 29918, 1256, 448, 1369, 29918, 1256, 467, 16700, 718, 29871, 29896, 1125, 13, 4706, 2635, 29918, 710, 353, 313, 2962, 29918, 1256, 718, 5335, 287, 2554, 29898, 16700, 29922, 1256, 29918, 12765, 8106, 710, 615, 603, 11702, 29979, 29995, 29885, 29995, 29881, 1159, 13, 4706, 363, 1804, 29918, 333, 297, 317, 17298, 29918, 1367, 29903, 29901, 13, 9651, 10876, 29889, 25393, 29889, 3539, 29898, 29888, 29908, 29912, 1256, 29918, 710, 6822, 29912, 4530, 29918, 333, 1012, 29876, 1159, 13, 2 ]
lib/python2.7/site-packages/braintree/coinbase_account.py
ervinpepic/E-commerce
2
95242
<reponame>ervinpepic/E-commerce import braintree from braintree.resource import Resource class CoinbaseAccount(Resource): def __init__(self, gateway, attributes): Resource.__init__(self, gateway, attributes) if "subscriptions" in attributes: self.subscriptions = [braintree.subscription.Subscription(gateway, subscription) for subscription in self.subscriptions]
[ 1, 529, 276, 1112, 420, 29958, 261, 3845, 412, 16447, 29914, 29923, 29899, 22529, 13, 5215, 4105, 524, 929, 13, 3166, 4105, 524, 929, 29889, 10314, 1053, 18981, 13, 13, 1990, 3189, 262, 3188, 10601, 29898, 6848, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 28646, 29892, 8393, 1125, 13, 4706, 18981, 17255, 2344, 12035, 1311, 29892, 28646, 29892, 8393, 29897, 13, 4706, 565, 376, 1491, 7588, 1980, 29908, 297, 8393, 29901, 13, 9651, 1583, 29889, 1491, 7588, 1980, 353, 518, 2634, 524, 929, 29889, 1491, 22371, 29889, 4035, 22371, 29898, 17062, 1582, 29892, 25691, 29897, 363, 25691, 297, 1583, 29889, 1491, 7588, 1980, 29962, 13, 2 ]
tests/auth_test.py
moeyensj/adam_home
9
1606589
import json import unittest from adam import Auth from adam.rest_proxy import _RestProxyForTest # This test suite is testing authentication, but authentication is not really done through this # API. Authentication (i.e. adding authentication credentials to HTTP requests) is handled in # AuthenticatingRestProxy. Keeping this class here for now, but the test should be rewritten for # real use cases (e.g. just testing that the auth.Auth() class is doing the right thing). class AuthTest(unittest.TestCase): """Unit tests for auth module """ def test_successful_authentication(self): # Use REST proxy for testing rest = _RestProxyForTest() auth = Auth(rest) # Before authenticating, auth should reflect not logged in. self.assertEqual(auth.get_user(), '') self.assertEqual(auth.get_logged_in(), False) # A successful authentication should store token and set user to returned value. rest.expect_get('/me', 200, {'email': '<EMAIL>', 'loggedIn': True}) auth.authenticate() self.assertEqual(auth.get_user(), '<EMAIL>') self.assertEqual(auth.get_logged_in(), True) def test_unsuccessful_authentication(self): # Use REST proxy for testing rest = _RestProxyForTest() auth = Auth(rest) # Authenticate in order to fill in email/logged_in so that next test # can verify that these are cleared. rest.expect_get('/me', 200, {'email': '<EMAIL>', 'loggedIn': True}) auth.authenticate() # An unsuccessful authentication should clear token and other values. # An example of the few ways that the server might reject a user. Others look # like this with different messages. server_error_on_bad_token = """ { "error": { "errors": [ { "domain": "global", "reason": "backendError", "message": "org.apache.shiro.authc.IncorrectCredentialsException" } ], "code": 503, "message": "org.apache.shiro.authc.IncorrectCredentialsException" } } """ rest.expect_get('/me', 503, json.loads(server_error_on_bad_token)) auth.authenticate() self.assertEqual(auth.get_user(), '') self.assertEqual(auth.get_logged_in(), False) def test_authentication_empty_token(self): # Use REST proxy for testing rest = _RestProxyForTest() auth = Auth(rest) # Authenticate in order to fill in email/logged_in so that next test # can verify that these are cleared. rest.expect_get('/me', 200, {'email': '<EMAIL>', 'loggedIn': True}) auth.authenticate() # Authentication with an empty token should be no problem and result in an empty # auth object. rest.expect_get('/me', 200, {"loggedIn": False}) auth.authenticate() self.assertEqual(auth.get_user(), '') self.assertEqual(auth.get_logged_in(), False) def test_authentication_server_error(self): # Use REST proxy for testing rest = _RestProxyForTest() auth = Auth(rest) # Authenticate in order to fill in email/logged_in/token so that next test # can verify that these are not cleared. rest.expect_get('/me', 200, {'email': '<EMAIL>', 'loggedIn': True}) auth.authenticate() # Authentication should throw on a non-200 response and leave auth contents # unchanged. rest.expect_get('/me', 404, {}) with self.assertRaises(RuntimeError): auth.authenticate() self.assertEqual(auth.get_user(), '<EMAIL>') self.assertEqual(auth.get_logged_in(), True) if __name__ == '__main__': unittest.main()
[ 1, 1053, 4390, 13, 5215, 443, 27958, 13, 13, 3166, 594, 314, 1053, 13189, 13, 3166, 594, 314, 29889, 5060, 29918, 14701, 1053, 903, 15078, 14048, 2831, 3057, 13, 13, 13, 29937, 910, 1243, 9460, 338, 6724, 10760, 29892, 541, 10760, 338, 451, 2289, 2309, 1549, 445, 13, 29937, 3450, 29889, 27241, 313, 29875, 29889, 29872, 29889, 4417, 10760, 16140, 304, 7331, 7274, 29897, 338, 16459, 297, 13, 29937, 13189, 4173, 1218, 15078, 14048, 29889, 19152, 292, 445, 770, 1244, 363, 1286, 29892, 541, 278, 1243, 881, 367, 337, 17625, 363, 13, 29937, 1855, 671, 4251, 313, 29872, 29889, 29887, 29889, 925, 6724, 393, 278, 4817, 29889, 6444, 580, 770, 338, 2599, 278, 1492, 2655, 467, 13, 1990, 13189, 3057, 29898, 348, 27958, 29889, 3057, 8259, 1125, 13, 1678, 9995, 8325, 6987, 363, 4817, 3883, 13, 13, 1678, 9995, 13, 13, 1678, 822, 1243, 29918, 8698, 1319, 29918, 23055, 29898, 1311, 1125, 13, 4706, 396, 4803, 16759, 10166, 363, 6724, 13, 4706, 1791, 353, 903, 15078, 14048, 2831, 3057, 580, 13, 4706, 4817, 353, 13189, 29898, 5060, 29897, 13, 13, 4706, 396, 10949, 15585, 1218, 29892, 4817, 881, 9432, 451, 13817, 297, 29889, 13, 4706, 1583, 29889, 9294, 9843, 29898, 5150, 29889, 657, 29918, 1792, 3285, 27255, 13, 4706, 1583, 29889, 9294, 9843, 29898, 5150, 29889, 657, 29918, 1188, 3192, 29918, 262, 3285, 7700, 29897, 13, 13, 4706, 396, 319, 9150, 10760, 881, 3787, 5993, 322, 731, 1404, 304, 4133, 995, 29889, 13, 4706, 1791, 29889, 17854, 29918, 657, 11219, 1004, 742, 29871, 29906, 29900, 29900, 29892, 13, 462, 4706, 11117, 5269, 2396, 12801, 26862, 6227, 29958, 742, 525, 1188, 3192, 797, 2396, 5852, 1800, 13, 4706, 4817, 29889, 27218, 403, 580, 13, 4706, 1583, 29889, 9294, 9843, 29898, 5150, 29889, 657, 29918, 1792, 3285, 12801, 26862, 6227, 29958, 1495, 13, 4706, 1583, 29889, 9294, 9843, 29898, 5150, 29889, 657, 29918, 1188, 3192, 29918, 262, 3285, 5852, 29897, 13, 13, 1678, 822, 1243, 29918, 348, 8698, 1319, 29918, 23055, 29898, 1311, 1125, 13, 4706, 396, 4803, 16759, 10166, 363, 6724, 13, 4706, 1791, 353, 903, 15078, 14048, 2831, 3057, 580, 13, 4706, 4817, 353, 13189, 29898, 5060, 29897, 13, 13, 4706, 396, 13189, 4173, 403, 297, 1797, 304, 5445, 297, 4876, 29914, 1188, 3192, 29918, 262, 577, 393, 2446, 1243, 13, 4706, 396, 508, 11539, 393, 1438, 526, 24639, 29889, 13, 4706, 1791, 29889, 17854, 29918, 657, 11219, 1004, 742, 29871, 29906, 29900, 29900, 29892, 13, 462, 4706, 11117, 5269, 2396, 12801, 26862, 6227, 29958, 742, 525, 1188, 3192, 797, 2396, 5852, 1800, 13, 4706, 4817, 29889, 27218, 403, 580, 13, 13, 4706, 396, 530, 443, 8698, 1319, 10760, 881, 2821, 5993, 322, 916, 1819, 29889, 13, 4706, 396, 530, 1342, 310, 278, 2846, 5837, 393, 278, 1923, 1795, 12560, 263, 1404, 29889, 438, 3341, 1106, 13, 4706, 396, 763, 445, 411, 1422, 7191, 29889, 13, 4706, 1923, 29918, 2704, 29918, 265, 29918, 12313, 29918, 6979, 353, 9995, 13, 9651, 426, 13, 795, 376, 2704, 1115, 426, 13, 18884, 376, 12523, 1115, 518, 13, 462, 29871, 426, 13, 462, 1678, 376, 7247, 1115, 376, 10945, 613, 13, 462, 1678, 376, 23147, 1115, 376, 27852, 2392, 613, 13, 462, 1678, 376, 4906, 1115, 376, 990, 29889, 4288, 29889, 845, 3350, 29889, 5150, 29883, 29889, 797, 15728, 28037, 2451, 29908, 13, 462, 29871, 500, 13, 18884, 21251, 13, 18884, 376, 401, 1115, 29871, 29945, 29900, 29941, 29892, 13, 18884, 376, 4906, 1115, 376, 990, 29889, 4288, 29889, 845, 3350, 29889, 5150, 29883, 29889, 797, 15728, 28037, 2451, 29908, 13, 795, 500, 13, 9651, 500, 13, 9651, 9995, 13, 4706, 1791, 29889, 17854, 29918, 657, 11219, 1004, 742, 29871, 29945, 29900, 29941, 29892, 13, 462, 4706, 4390, 29889, 18132, 29898, 2974, 29918, 2704, 29918, 265, 29918, 12313, 29918, 6979, 876, 13, 4706, 4817, 29889, 27218, 403, 580, 13, 4706, 1583, 29889, 9294, 9843, 29898, 5150, 29889, 657, 29918, 1792, 3285, 27255, 13, 4706, 1583, 29889, 9294, 9843, 29898, 5150, 29889, 657, 29918, 1188, 3192, 29918, 262, 3285, 7700, 29897, 13, 13, 1678, 822, 1243, 29918, 23055, 29918, 6310, 29918, 6979, 29898, 1311, 1125, 13, 4706, 396, 4803, 16759, 10166, 363, 6724, 13, 4706, 1791, 353, 903, 15078, 14048, 2831, 3057, 580, 13, 4706, 4817, 353, 13189, 29898, 5060, 29897, 13, 13, 4706, 396, 13189, 4173, 403, 297, 1797, 304, 5445, 297, 4876, 29914, 1188, 3192, 29918, 262, 577, 393, 2446, 1243, 13, 4706, 396, 508, 11539, 393, 1438, 526, 24639, 29889, 13, 4706, 1791, 29889, 17854, 29918, 657, 11219, 1004, 742, 29871, 29906, 29900, 29900, 29892, 13, 462, 4706, 11117, 5269, 2396, 12801, 26862, 6227, 29958, 742, 525, 1188, 3192, 797, 2396, 5852, 1800, 13, 4706, 4817, 29889, 27218, 403, 580, 13, 13, 4706, 396, 27241, 411, 385, 4069, 5993, 881, 367, 694, 1108, 322, 1121, 297, 385, 4069, 13, 4706, 396, 4817, 1203, 29889, 13, 4706, 1791, 29889, 17854, 29918, 657, 11219, 1004, 742, 29871, 29906, 29900, 29900, 29892, 8853, 1188, 3192, 797, 1115, 7700, 1800, 13, 4706, 4817, 29889, 27218, 403, 580, 13, 4706, 1583, 29889, 9294, 9843, 29898, 5150, 29889, 657, 29918, 1792, 3285, 27255, 13, 4706, 1583, 29889, 9294, 9843, 29898, 5150, 29889, 657, 29918, 1188, 3192, 29918, 262, 3285, 7700, 29897, 13, 13, 1678, 822, 1243, 29918, 23055, 29918, 2974, 29918, 2704, 29898, 1311, 1125, 13, 4706, 396, 4803, 16759, 10166, 363, 6724, 13, 4706, 1791, 353, 903, 15078, 14048, 2831, 3057, 580, 13, 4706, 4817, 353, 13189, 29898, 5060, 29897, 13, 13, 4706, 396, 13189, 4173, 403, 297, 1797, 304, 5445, 297, 4876, 29914, 1188, 3192, 29918, 262, 29914, 6979, 577, 393, 2446, 1243, 13, 4706, 396, 508, 11539, 393, 1438, 526, 451, 24639, 29889, 13, 4706, 1791, 29889, 17854, 29918, 657, 11219, 1004, 742, 29871, 29906, 29900, 29900, 29892, 13, 462, 4706, 11117, 5269, 2396, 12801, 26862, 6227, 29958, 742, 525, 1188, 3192, 797, 2396, 5852, 1800, 13, 4706, 4817, 29889, 27218, 403, 580, 13, 13, 4706, 396, 27241, 881, 3183, 373, 263, 1661, 29899, 29906, 29900, 29900, 2933, 322, 5967, 4817, 8118, 13, 4706, 396, 443, 15033, 29889, 13, 4706, 1791, 29889, 17854, 29918, 657, 11219, 1004, 742, 29871, 29946, 29900, 29946, 29892, 426, 1800, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 29898, 7944, 2392, 1125, 13, 9651, 4817, 29889, 27218, 403, 580, 13, 4706, 1583, 29889, 9294, 9843, 29898, 5150, 29889, 657, 29918, 1792, 3285, 12801, 26862, 6227, 29958, 1495, 13, 4706, 1583, 29889, 9294, 9843, 29898, 5150, 29889, 657, 29918, 1188, 3192, 29918, 262, 3285, 5852, 29897, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 443, 27958, 29889, 3396, 580, 13, 2 ]
examples/simple_email_pattern.py
Mattlk13/python-cybox
40
161095
#!/usr/bin/env python # Copyright (c) 2017, The MITRE Corporation. All rights reserved. # See LICENSE.txt for complete terms. """Creates the CybOX content for CybOX_Simple_Email_Pattern.xml """ from cybox.core import Observables from cybox.objects.email_message_object import EmailMessage def main(): m = EmailMessage() m.from_ = ["<EMAIL>", "<EMAIL>", "<EMAIL>"] m.from_.condition = "Equals" m.subject = "New modifications to the specification" m.subject.condition = "Equals" print(Observables(m).to_xml(encoding=None)) if __name__ == "__main__": main()
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 13, 13, 29937, 14187, 1266, 313, 29883, 29897, 29871, 29906, 29900, 29896, 29955, 29892, 450, 341, 1806, 1525, 15025, 29889, 2178, 10462, 21676, 29889, 13, 29937, 2823, 365, 2965, 1430, 1660, 29889, 3945, 363, 4866, 4958, 29889, 13, 13, 15945, 29908, 9832, 1078, 278, 8045, 29890, 29949, 29990, 2793, 363, 8045, 29890, 29949, 29990, 29918, 15427, 29918, 9823, 29918, 17144, 29889, 3134, 13, 15945, 29908, 13, 13, 3166, 5094, 1884, 29889, 3221, 1053, 21651, 1849, 13, 3166, 5094, 1884, 29889, 12650, 29889, 5269, 29918, 4906, 29918, 3318, 1053, 22608, 3728, 13, 13, 13, 1753, 1667, 7295, 13, 1678, 286, 353, 22608, 3728, 580, 13, 1678, 286, 29889, 3166, 29918, 353, 6796, 29966, 26862, 6227, 28341, 13, 1669, 9872, 26862, 6227, 28341, 13, 1669, 9872, 26862, 6227, 29958, 3108, 13, 1678, 286, 29889, 3166, 5396, 16122, 353, 376, 14776, 29908, 13, 1678, 286, 29889, 16009, 353, 376, 4373, 26278, 304, 278, 21992, 29908, 13, 1678, 286, 29889, 16009, 29889, 16122, 353, 376, 14776, 29908, 13, 13, 1678, 1596, 29898, 6039, 2140, 1849, 29898, 29885, 467, 517, 29918, 3134, 29898, 22331, 29922, 8516, 876, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 1667, 580, 13, 2 ]
notebooks/_solutions/05-spatial-operations-overlays11.py
jorisvandenbossche/DS-python-geospatial
58
36103
# Calculate the intersection of the land use polygons with Muette land_use_muette = land_use.geometry.intersection(muette)
[ 1, 396, 20535, 403, 278, 17686, 310, 278, 2982, 671, 1248, 4790, 787, 411, 8229, 2353, 13, 1049, 29918, 1509, 29918, 2589, 2353, 353, 2982, 29918, 1509, 29889, 19156, 29889, 1639, 2042, 29898, 2589, 2353, 29897, 2 ]
scorecard/views.py
desafinadude/municipal-data
0
1612110
from django.shortcuts import redirect from django.views.generic.base import TemplateView from django.http import Http404, HttpResponse from django.urls import reverse from scorecard.profiles import get_profile from scorecard.models import Geography, LocationNotFound from infrastructure.models import Project from household.models import HouseholdServiceTotal, HouseholdBillTotal from household.chart import stack_chart, chart_data, percent_increase, yearly_percent import json from . import models import municipal_finance from . import serializers from rest_framework import viewsets import subprocess from django.conf import settings class GeographyViewSet(viewsets.ReadOnlyModelViewSet): queryset = models.Geography.objects.all() serializer_class = serializers.GeographySerializer class MunicipalityProfileViewSet(viewsets.ReadOnlyModelViewSet): queryset = municipal_finance.models.MunicipalityProfile.objects.all() serializer_class = serializers.MunicipalityProfileSerializer def infra_dict(project): return { "description": project.project_description, "expenditure_amount": project.expenditure.first().amount, "url": reverse('project-detail-view', args=[project.id]), } class LocateView(TemplateView): template_name = "webflow/locate.html" def get(self, request, *args, **kwargs): self.lat = self.request.GET.get("lat", None) self.lon = self.request.GET.get("lon", None) self.nope = False if self.lat and self.lon: place = None places = Geography.get_locations_from_coords( latitude=self.lat, longitude=self.lon ) if places: place = places[0] # if multiple, prefer the metro/local municipality if available if len(places) > 1: places = [p for p in places if p.geo_level == "municipality"] if places: place = places[0] return redirect( reverse("geography_detail", kwargs={"geography_id": place.geoid}) ) self.nope = True return super(LocateView, self).get(request, *args, **kwargs) def get_context_data(self, *args, **kwargs): return { "page_data_json": json.dumps( {"nope": self.nope}, cls=serializers.JSONEncoder, sort_keys=True, indent=4 if settings.DEBUG else None ), } class GeographyDetailView(TemplateView): template_name = "webflow/muni-profile.html" def dispatch(self, *args, **kwargs): self.geo_id = self.kwargs.get("geography_id", None) try: self.geo_level, self.geo_code = self.geo_id.split("-", 1) self.geo = Geography.find(self.geo_code, self.geo_level) except (ValueError, LocationNotFound): raise Http404 # check slug if kwargs.get("slug") or self.geo.slug: if kwargs["slug"] != self.geo.slug: kwargs["slug"] = self.geo.slug url = "/profiles/%s-%s-%s/" % ( self.geo_level, self.geo_code, self.geo.slug, ) return redirect(url, permanent=True) return super(GeographyDetailView, self).dispatch(*args, **kwargs) def pdf_url(self): return "/profiles/%s-%s-%s.pdf" % ( self.geo_level, self.geo_code, self.geo.slug, ) def get_context_data(self, *args, **kwargs): page_json = {} profile = get_profile(self.geo) page_json.update(profile) profile["geography"] = self.geo.as_dict() page_json["geography"] = self.geo page_json["pdf_url"] = self.pdf_url() profile["demarcation"]["disestablished_to_geos"] = [ Geography.objects.filter(geo_code=code).first().as_dict() for code in profile["demarcation"].get("disestablished_to", []) ] profile["demarcation"]["established_from_geos"] = [ Geography.objects.filter(geo_code=code).first().as_dict() for code in profile["demarcation"].get("established_from", []) ] for date in profile["demarcation"]["land_gained"]: for change in date["changes"]: change["geo"] = ( Geography.objects.filter(geo_code=change["demarcation_code"]) .first() .as_dict() ) for date in profile["demarcation"]["land_lost"]: for change in date["changes"]: change["geo"] = ( Geography.objects.filter(geo_code=change["demarcation_code"]) .first() .as_dict() ) infrastructure_financial_year = "2019/2020" infrastructure = ( Project.objects.prefetch_related( "geography", "expenditure__budget_phase", "expenditure__financial_year", "expenditure", ) .filter( geography__geo_code=self.geo_code, expenditure__budget_phase__name="Budget year", expenditure__financial_year__budget_year=infrastructure_financial_year, ) .order_by("-expenditure__amount") ) page_json["infrastructure_summary"] = { "projects": [infra_dict(p) for p in infrastructure[:5]], "project_count": infrastructure.count(), "financial_year": infrastructure_financial_year[5:9] } households = HouseholdBillTotal.summary.bill_totals(self.geo_code) page_json["household_percent"] = percent_increase(households) page_json["yearly_percent"] = yearly_percent(households) chart = chart_data(households) page_json["household_chart_overall"] = chart service_middle = ( HouseholdServiceTotal.summary.active(self.geo_code) .middle() .order_by("financial_year__budget_year") ) service_affordable = ( HouseholdServiceTotal.summary.active(self.geo_code) .affordable() .order_by("financial_year__budget_year") ) service_indigent = ( HouseholdServiceTotal.summary.active(self.geo_code) .indigent() .order_by("financial_year__budget_year") ) chart_middle = stack_chart(service_middle, households) chart_affordable = stack_chart(service_affordable, households) chart_indigent = stack_chart(service_indigent, households) page_json["household_chart_middle"] = chart_middle page_json["household_chart_affordable"] = chart_affordable page_json["household_chart_indigent"] = chart_indigent page_context = { "page_data_json": json.dumps( page_json, cls=serializers.JSONEncoder, sort_keys=True, indent=4 if settings.DEBUG else None ), "page_title": f"{ self.geo.name} - Municipal Money", "page_description": f"Financial Performance for { self.geo.name }, and other information.", } return page_context class GeographyPDFView(GeographyDetailView): def get(self, request, *args, **kwargs): # render as pdf path = "/profiles/%s-%s-%s?print=1" % ( self.geo_level, self.geo_code, self.geo.slug, ) url = request.build_absolute_uri(path) # !!! This relies on GeographyDetailView validating the user-provided # input to the path to avoid arbitraty command execution command = ["node", "makepdf.js", url] try: completed_process = subprocess.run( command, check=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT ) except subprocess.CalledProcessError as e: print(e.output) raise e filename = "%s-%s-%s.pdf" % (self.geo_level, self.geo_code, self.geo.slug) response = HttpResponse(completed_process.stdout, content_type='application/pdf') response['Content-Disposition'] = f'attachment; filename="{ filename }"' return response class SitemapView(TemplateView): template_name = "sitemap.txt" content_type = "text/plain" def get_context_data(self): return {"geos": Geography.objects.all()}
[ 1, 515, 9557, 29889, 12759, 7582, 29879, 1053, 6684, 13, 3166, 9557, 29889, 7406, 29889, 19206, 29889, 3188, 1053, 25663, 1043, 13, 3166, 9557, 29889, 1124, 1053, 9056, 29946, 29900, 29946, 29892, 9056, 5103, 13, 3166, 9557, 29889, 26045, 1053, 11837, 13, 13, 3166, 8158, 7543, 29889, 771, 5325, 1053, 679, 29918, 10185, 13, 3166, 8158, 7543, 29889, 9794, 1053, 27340, 29892, 17015, 17413, 13, 3166, 22035, 12425, 29889, 9794, 1053, 8010, 13, 3166, 22329, 29889, 9794, 1053, 5619, 8948, 3170, 11536, 29892, 5619, 8948, 29933, 453, 11536, 13, 3166, 22329, 29889, 15425, 1053, 5096, 29918, 15425, 29892, 8727, 29918, 1272, 29892, 10151, 29918, 262, 1037, 559, 29892, 1629, 368, 29918, 25376, 13, 13, 5215, 4390, 13, 13, 3166, 869, 1053, 4733, 13, 5215, 11677, 29918, 4951, 749, 13, 3166, 869, 1053, 7797, 19427, 13, 3166, 1791, 29918, 4468, 1053, 1776, 7224, 13, 13, 5215, 1014, 5014, 13, 3166, 9557, 29889, 5527, 1053, 6055, 13, 13, 13, 1990, 27340, 1043, 2697, 29898, 1493, 7224, 29889, 6359, 11730, 3195, 1043, 2697, 1125, 13, 1678, 2346, 842, 353, 4733, 29889, 7999, 5275, 29889, 12650, 29889, 497, 580, 13, 1678, 7797, 3950, 29918, 1990, 353, 7797, 19427, 29889, 7999, 5275, 17679, 13, 13, 13, 1990, 12813, 2877, 13909, 1043, 2697, 29898, 1493, 7224, 29889, 6359, 11730, 3195, 1043, 2697, 1125, 13, 1678, 2346, 842, 353, 11677, 29918, 4951, 749, 29889, 9794, 29889, 29924, 4376, 2877, 13909, 29889, 12650, 29889, 497, 580, 13, 1678, 7797, 3950, 29918, 1990, 353, 7797, 19427, 29889, 29924, 4376, 2877, 13909, 17679, 13, 13, 13, 1753, 3041, 336, 29918, 8977, 29898, 4836, 1125, 13, 1678, 736, 426, 13, 4706, 376, 8216, 1115, 2060, 29889, 4836, 29918, 8216, 29892, 13, 4706, 376, 4548, 355, 17252, 29918, 14506, 1115, 2060, 29889, 4548, 355, 17252, 29889, 4102, 2141, 14506, 29892, 13, 4706, 376, 2271, 1115, 11837, 877, 4836, 29899, 16432, 29899, 1493, 742, 6389, 11759, 4836, 29889, 333, 11724, 13, 1678, 500, 13, 13, 13, 1990, 5976, 403, 1043, 29898, 6733, 1043, 1125, 13, 1678, 4472, 29918, 978, 353, 376, 705, 1635, 677, 29914, 2029, 403, 29889, 1420, 29908, 13, 13, 1678, 822, 679, 29898, 1311, 29892, 2009, 29892, 334, 5085, 29892, 3579, 19290, 1125, 13, 4706, 1583, 29889, 5066, 353, 1583, 29889, 3827, 29889, 7194, 29889, 657, 703, 5066, 613, 6213, 29897, 13, 4706, 1583, 29889, 12957, 353, 1583, 29889, 3827, 29889, 7194, 29889, 657, 703, 12957, 613, 6213, 29897, 13, 4706, 1583, 29889, 1217, 412, 353, 7700, 13, 13, 4706, 565, 1583, 29889, 5066, 322, 1583, 29889, 12957, 29901, 13, 9651, 2058, 353, 6213, 13, 9651, 7600, 353, 27340, 29889, 657, 29918, 2029, 800, 29918, 3166, 29918, 1111, 4339, 29898, 13, 18884, 26271, 29922, 1311, 29889, 5066, 29892, 28745, 29922, 1311, 29889, 12957, 13, 9651, 1723, 13, 13, 9651, 565, 7600, 29901, 13, 18884, 2058, 353, 7600, 29961, 29900, 29962, 13, 13, 18884, 396, 565, 2999, 29892, 5821, 278, 1539, 307, 29914, 2997, 21511, 565, 3625, 13, 18884, 565, 7431, 29898, 29886, 6048, 29897, 1405, 29871, 29896, 29901, 13, 462, 1678, 7600, 353, 518, 29886, 363, 282, 297, 7600, 565, 282, 29889, 24756, 29918, 5563, 1275, 376, 29885, 4376, 2877, 3108, 13, 462, 1678, 565, 7600, 29901, 13, 462, 4706, 2058, 353, 7600, 29961, 29900, 29962, 13, 13, 18884, 736, 6684, 29898, 13, 462, 1678, 11837, 703, 479, 5275, 29918, 16432, 613, 9049, 5085, 3790, 29908, 479, 5275, 29918, 333, 1115, 2058, 29889, 479, 3398, 1800, 13, 18884, 1723, 13, 9651, 1583, 29889, 1217, 412, 353, 5852, 13, 13, 4706, 736, 2428, 29898, 3524, 403, 1043, 29892, 1583, 467, 657, 29898, 3827, 29892, 334, 5085, 29892, 3579, 19290, 29897, 13, 13, 1678, 822, 679, 29918, 4703, 29918, 1272, 29898, 1311, 29892, 334, 5085, 29892, 3579, 19290, 1125, 13, 4706, 736, 426, 13, 9651, 376, 3488, 29918, 1272, 29918, 3126, 1115, 4390, 29889, 29881, 17204, 29898, 13, 18884, 8853, 1217, 412, 1115, 1583, 29889, 1217, 412, 1118, 13, 18884, 1067, 29879, 29922, 15550, 19427, 29889, 7249, 8566, 6119, 29892, 13, 18884, 2656, 29918, 8149, 29922, 5574, 29892, 13, 18884, 29536, 29922, 29946, 565, 6055, 29889, 18525, 1683, 6213, 13, 9651, 10353, 13, 4706, 500, 13, 13, 1990, 27340, 16570, 1043, 29898, 6733, 1043, 1125, 13, 1678, 4472, 29918, 978, 353, 376, 705, 1635, 677, 29914, 29885, 3909, 29899, 10185, 29889, 1420, 29908, 13, 13, 1678, 822, 13916, 29898, 1311, 29892, 334, 5085, 29892, 3579, 19290, 1125, 13, 4706, 1583, 29889, 24756, 29918, 333, 353, 1583, 29889, 19290, 29889, 657, 703, 479, 5275, 29918, 333, 613, 6213, 29897, 13, 13, 4706, 1018, 29901, 13, 9651, 1583, 29889, 24756, 29918, 5563, 29892, 1583, 29889, 24756, 29918, 401, 353, 1583, 29889, 24756, 29918, 333, 29889, 5451, 703, 29899, 613, 29871, 29896, 29897, 13, 9651, 1583, 29889, 24756, 353, 27340, 29889, 2886, 29898, 1311, 29889, 24756, 29918, 401, 29892, 1583, 29889, 24756, 29918, 5563, 29897, 13, 4706, 5174, 313, 1917, 2392, 29892, 17015, 17413, 1125, 13, 9651, 12020, 9056, 29946, 29900, 29946, 13, 13, 4706, 396, 1423, 2243, 688, 13, 4706, 565, 9049, 5085, 29889, 657, 703, 29517, 1159, 470, 1583, 29889, 24756, 29889, 29517, 29901, 13, 9651, 565, 9049, 5085, 3366, 29517, 3108, 2804, 1583, 29889, 24756, 29889, 29517, 29901, 13, 18884, 9049, 5085, 3366, 29517, 3108, 353, 1583, 29889, 24756, 29889, 29517, 13, 18884, 3142, 353, 5591, 771, 5325, 22584, 29879, 19222, 29879, 19222, 29879, 12975, 1273, 313, 13, 462, 1678, 1583, 29889, 24756, 29918, 5563, 29892, 13, 462, 1678, 1583, 29889, 24756, 29918, 401, 29892, 13, 462, 1678, 1583, 29889, 24756, 29889, 29517, 29892, 13, 18884, 1723, 13, 18884, 736, 6684, 29898, 2271, 29892, 17667, 29922, 5574, 29897, 13, 13, 4706, 736, 2428, 29898, 7999, 5275, 16570, 1043, 29892, 1583, 467, 13369, 10456, 5085, 29892, 3579, 19290, 29897, 13, 13, 1678, 822, 13552, 29918, 2271, 29898, 1311, 1125, 13, 4706, 736, 5591, 771, 5325, 22584, 29879, 19222, 29879, 19222, 29879, 29889, 5140, 29908, 1273, 313, 13, 9651, 1583, 29889, 24756, 29918, 5563, 29892, 13, 9651, 1583, 29889, 24756, 29918, 401, 29892, 13, 9651, 1583, 29889, 24756, 29889, 29517, 29892, 13, 4706, 1723, 13, 13, 1678, 822, 679, 29918, 4703, 29918, 1272, 29898, 1311, 29892, 334, 5085, 29892, 3579, 19290, 1125, 13, 4706, 1813, 29918, 3126, 353, 6571, 13, 13, 4706, 8722, 353, 679, 29918, 10185, 29898, 1311, 29889, 24756, 29897, 13, 4706, 1813, 29918, 3126, 29889, 5504, 29898, 10185, 29897, 13, 13, 4706, 8722, 3366, 479, 5275, 3108, 353, 1583, 29889, 24756, 29889, 294, 29918, 8977, 580, 13, 4706, 1813, 29918, 3126, 3366, 479, 5275, 3108, 353, 1583, 29889, 24756, 13, 4706, 1813, 29918, 3126, 3366, 5140, 29918, 2271, 3108, 353, 1583, 29889, 5140, 29918, 2271, 580, 13, 13, 4706, 8722, 3366, 2310, 5666, 362, 3108, 3366, 2218, 342, 370, 3726, 29918, 517, 29918, 479, 359, 3108, 353, 518, 13, 9651, 27340, 29889, 12650, 29889, 4572, 29898, 24756, 29918, 401, 29922, 401, 467, 4102, 2141, 294, 29918, 8977, 580, 13, 9651, 363, 775, 297, 8722, 3366, 2310, 5666, 362, 16862, 657, 703, 2218, 342, 370, 3726, 29918, 517, 613, 518, 2314, 13, 4706, 4514, 13, 13, 4706, 8722, 3366, 2310, 5666, 362, 3108, 3366, 342, 370, 3726, 29918, 3166, 29918, 479, 359, 3108, 353, 518, 13, 9651, 27340, 29889, 12650, 29889, 4572, 29898, 24756, 29918, 401, 29922, 401, 467, 4102, 2141, 294, 29918, 8977, 580, 13, 9651, 363, 775, 297, 8722, 3366, 2310, 5666, 362, 16862, 657, 703, 342, 370, 3726, 29918, 3166, 613, 518, 2314, 13, 4706, 4514, 13, 13, 4706, 363, 2635, 297, 8722, 3366, 2310, 5666, 362, 3108, 3366, 1049, 29918, 29887, 7114, 3108, 29901, 13, 9651, 363, 1735, 297, 2635, 3366, 25990, 3108, 29901, 13, 18884, 1735, 3366, 24756, 3108, 353, 313, 13, 462, 1678, 27340, 29889, 12650, 29889, 4572, 29898, 24756, 29918, 401, 29922, 3167, 3366, 2310, 5666, 362, 29918, 401, 20068, 13, 462, 1678, 869, 4102, 580, 13, 462, 1678, 869, 294, 29918, 8977, 580, 13, 18884, 1723, 13, 4706, 363, 2635, 297, 8722, 3366, 2310, 5666, 362, 3108, 3366, 1049, 29918, 18767, 3108, 29901, 13, 9651, 363, 1735, 297, 2635, 3366, 25990, 3108, 29901, 13, 18884, 1735, 3366, 24756, 3108, 353, 313, 13, 462, 1678, 27340, 29889, 12650, 29889, 4572, 29898, 24756, 29918, 401, 29922, 3167, 3366, 2310, 5666, 362, 29918, 401, 20068, 13, 462, 1678, 869, 4102, 580, 13, 462, 1678, 869, 294, 29918, 8977, 580, 13, 18884, 1723, 13, 4706, 22035, 12425, 29918, 4951, 273, 1455, 29918, 6360, 353, 376, 29906, 29900, 29896, 29929, 29914, 29906, 29900, 29906, 29900, 29908, 13, 4706, 22035, 12425, 353, 313, 13, 9651, 8010, 29889, 12650, 29889, 29886, 999, 3486, 29918, 12817, 29898, 13, 18884, 376, 479, 5275, 613, 13, 18884, 376, 4548, 355, 17252, 1649, 15841, 657, 29918, 21646, 613, 13, 18884, 376, 4548, 355, 17252, 1649, 4951, 273, 1455, 29918, 6360, 613, 13, 18884, 376, 4548, 355, 17252, 613, 13, 9651, 1723, 13, 9651, 869, 4572, 29898, 13, 18884, 1737, 5275, 1649, 24756, 29918, 401, 29922, 1311, 29889, 24756, 29918, 401, 29892, 13, 18884, 1518, 355, 17252, 1649, 15841, 657, 29918, 21646, 1649, 978, 543, 29933, 566, 657, 1629, 613, 13, 18884, 1518, 355, 17252, 1649, 4951, 273, 1455, 29918, 6360, 1649, 15841, 657, 29918, 6360, 29922, 262, 14867, 12425, 29918, 4951, 273, 1455, 29918, 6360, 29892, 13, 9651, 1723, 13, 9651, 869, 2098, 29918, 1609, 703, 29899, 4548, 355, 17252, 1649, 14506, 1159, 13, 4706, 1723, 13, 4706, 1813, 29918, 3126, 3366, 262, 14867, 12425, 29918, 7727, 3108, 353, 426, 13, 9651, 376, 16418, 1115, 518, 7192, 336, 29918, 8977, 29898, 29886, 29897, 363, 282, 297, 22035, 12425, 7503, 29945, 20526, 13, 9651, 376, 4836, 29918, 2798, 1115, 22035, 12425, 29889, 2798, 3285, 13, 9651, 376, 4951, 273, 1455, 29918, 6360, 1115, 22035, 12425, 29918, 4951, 273, 1455, 29918, 6360, 29961, 29945, 29901, 29929, 29962, 13, 4706, 500, 13, 13, 4706, 26850, 353, 5619, 8948, 29933, 453, 11536, 29889, 7727, 29889, 29890, 453, 29918, 4260, 1338, 29898, 1311, 29889, 24756, 29918, 401, 29897, 13, 4706, 1813, 29918, 3126, 3366, 8697, 8948, 29918, 25376, 3108, 353, 10151, 29918, 262, 1037, 559, 29898, 8697, 23177, 29897, 13, 4706, 1813, 29918, 3126, 3366, 6360, 368, 29918, 25376, 3108, 353, 1629, 368, 29918, 25376, 29898, 8697, 23177, 29897, 13, 13, 4706, 8727, 353, 8727, 29918, 1272, 29898, 8697, 23177, 29897, 13, 13, 4706, 1813, 29918, 3126, 3366, 8697, 8948, 29918, 15425, 29918, 957, 497, 3108, 353, 8727, 13, 13, 4706, 2669, 29918, 17662, 353, 313, 13, 9651, 5619, 8948, 3170, 11536, 29889, 7727, 29889, 4925, 29898, 1311, 29889, 24756, 29918, 401, 29897, 13, 9651, 869, 17662, 580, 13, 9651, 869, 2098, 29918, 1609, 703, 4951, 273, 1455, 29918, 6360, 1649, 15841, 657, 29918, 6360, 1159, 13, 4706, 1723, 13, 4706, 2669, 29918, 3470, 536, 519, 353, 313, 13, 9651, 5619, 8948, 3170, 11536, 29889, 7727, 29889, 4925, 29898, 1311, 29889, 24756, 29918, 401, 29897, 13, 9651, 869, 3470, 536, 519, 580, 13, 9651, 869, 2098, 29918, 1609, 703, 4951, 273, 1455, 29918, 6360, 1649, 15841, 657, 29918, 6360, 1159, 13, 4706, 1723, 13, 4706, 2669, 29918, 513, 25692, 353, 313, 13, 9651, 5619, 8948, 3170, 11536, 29889, 7727, 29889, 4925, 29898, 1311, 29889, 24756, 29918, 401, 29897, 13, 9651, 869, 513, 25692, 580, 13, 9651, 869, 2098, 29918, 1609, 703, 4951, 273, 1455, 29918, 6360, 1649, 15841, 657, 29918, 6360, 1159, 13, 4706, 1723, 13, 13, 4706, 8727, 29918, 17662, 353, 5096, 29918, 15425, 29898, 5509, 29918, 17662, 29892, 26850, 29897, 13, 4706, 8727, 29918, 3470, 536, 519, 353, 5096, 29918, 15425, 29898, 5509, 29918, 3470, 536, 519, 29892, 26850, 29897, 13, 4706, 8727, 29918, 513, 25692, 353, 5096, 29918, 15425, 29898, 5509, 29918, 513, 25692, 29892, 26850, 29897, 13, 13, 4706, 1813, 29918, 3126, 3366, 8697, 8948, 29918, 15425, 29918, 17662, 3108, 353, 8727, 29918, 17662, 13, 4706, 1813, 29918, 3126, 3366, 8697, 8948, 29918, 15425, 29918, 3470, 536, 519, 3108, 353, 8727, 29918, 3470, 536, 519, 13, 4706, 1813, 29918, 3126, 3366, 8697, 8948, 29918, 15425, 29918, 513, 25692, 3108, 353, 8727, 29918, 513, 25692, 13, 13, 4706, 1813, 29918, 4703, 353, 426, 13, 9651, 376, 3488, 29918, 1272, 29918, 3126, 1115, 4390, 29889, 29881, 17204, 29898, 13, 18884, 1813, 29918, 3126, 29892, 13, 18884, 1067, 29879, 29922, 15550, 19427, 29889, 7249, 8566, 6119, 29892, 13, 18884, 2656, 29918, 8149, 29922, 5574, 29892, 13, 18884, 29536, 29922, 29946, 565, 6055, 29889, 18525, 1683, 6213, 13, 9651, 10353, 13, 9651, 376, 3488, 29918, 3257, 1115, 285, 29908, 29912, 1583, 29889, 24756, 29889, 978, 29913, 448, 21327, 341, 4992, 613, 13, 9651, 376, 3488, 29918, 8216, 1115, 285, 29908, 12881, 273, 1455, 23768, 363, 426, 1583, 29889, 24756, 29889, 978, 2981, 322, 916, 2472, 19602, 13, 4706, 500, 13, 4706, 736, 1813, 29918, 4703, 13, 13, 13, 1990, 27340, 8493, 1043, 29898, 7999, 5275, 16570, 1043, 1125, 13, 1678, 822, 679, 29898, 1311, 29892, 2009, 29892, 334, 5085, 29892, 3579, 19290, 1125, 13, 4706, 396, 4050, 408, 13552, 13, 4706, 2224, 353, 5591, 771, 5325, 22584, 29879, 19222, 29879, 19222, 29879, 29973, 2158, 29922, 29896, 29908, 1273, 313, 13, 9651, 1583, 29889, 24756, 29918, 5563, 29892, 13, 9651, 1583, 29889, 24756, 29918, 401, 29892, 13, 9651, 1583, 29889, 24756, 29889, 29517, 29892, 13, 4706, 1723, 13, 4706, 3142, 353, 2009, 29889, 4282, 29918, 23552, 29918, 5338, 29898, 2084, 29897, 13, 4706, 396, 1738, 6824, 910, 337, 3687, 373, 27340, 16570, 1043, 2854, 1218, 278, 1404, 29899, 16123, 2618, 13, 4706, 396, 1881, 304, 278, 2224, 304, 4772, 564, 2966, 3605, 29891, 1899, 8225, 13, 4706, 1899, 353, 6796, 3177, 613, 376, 5675, 5140, 29889, 1315, 613, 3142, 29962, 13, 4706, 1018, 29901, 13, 9651, 8676, 29918, 5014, 353, 1014, 5014, 29889, 3389, 29898, 13, 18884, 1899, 29892, 13, 18884, 1423, 29922, 5574, 29892, 13, 18884, 27591, 29922, 1491, 5014, 29889, 2227, 4162, 29892, 13, 18884, 380, 20405, 29922, 1491, 5014, 29889, 1254, 3970, 2692, 13, 9651, 1723, 13, 4706, 5174, 1014, 5014, 29889, 29907, 4212, 7032, 2392, 408, 321, 29901, 13, 9651, 1596, 29898, 29872, 29889, 4905, 29897, 13, 9651, 12020, 321, 13, 4706, 10422, 353, 11860, 29879, 19222, 29879, 19222, 29879, 29889, 5140, 29908, 1273, 313, 1311, 29889, 24756, 29918, 5563, 29892, 1583, 29889, 24756, 29918, 401, 29892, 1583, 29889, 24756, 29889, 29517, 29897, 13, 4706, 2933, 353, 9056, 5103, 29898, 5729, 9446, 29918, 5014, 29889, 25393, 29892, 2793, 29918, 1853, 2433, 6214, 29914, 5140, 1495, 13, 4706, 2933, 1839, 3916, 29899, 4205, 3283, 2033, 353, 285, 29915, 14930, 358, 29936, 10422, 10724, 10422, 500, 29908, 29915, 13, 4706, 736, 2933, 13, 13, 13, 1990, 317, 667, 481, 1043, 29898, 6733, 1043, 1125, 13, 1678, 4472, 29918, 978, 353, 376, 29879, 667, 481, 29889, 3945, 29908, 13, 1678, 2793, 29918, 1853, 353, 376, 726, 29914, 24595, 29908, 13, 13, 1678, 822, 679, 29918, 4703, 29918, 1272, 29898, 1311, 1125, 13, 4706, 736, 8853, 479, 359, 1115, 27340, 29889, 12650, 29889, 497, 28296, 13, 2 ]
h1theswan_utils/treefiles/treefile_utils.py
h1-the-swan/h1theswan_utils
0
84308
import pandas as pd import numpy as np class Treefile(object): """Tools for working with a treefile (.tree)""" def __init__(self, fname=None, comment_char="#", field_sep=" ", cluster_sep=":"): """ :fname: filename for the treefile """ self.fname = fname self.comment_char = comment_char self.field_sep = field_sep self.cluster_sep = cluster_sep self.d = None self.df = None self.top_cluster_counts = None def parse(self, fname=None): """Parse the treefile :fname: filename for the treefile :returns: list of dictionaries. each item in the list is a row in the treefile """ if fname is not None: self.fname = fname else: fname = self.fname d = [] with open(fname, 'r') as f: for line in f: if line[0] == self.comment_char: continue line = line.strip().split(self.field_sep) this_row = {} this_row['path'] = line[0] this_row['flow'] = float(line[1]) this_row['name'] = line[2].strip('"') if len(line) > 3: this_row['node'] = int(line[3]) d.append(this_row) self.d = d def load_df(self): """load treefile as a pandas dataframe :returns: pandas dataframe """ if not self.d: self.parse() self.df = pd.DataFrame(self.d) return self.df def add_top_cluster_column_to_df(self, df=None): if df is None: df = self.df if df is None: raise RuntimeError("df is not specified. call load_df() to load the dataframe") top_cluster = df['path'].apply(lambda x: x.split(self.cluster_sep)[0]) top_cluster.name = 'top_cluster' df['top_cluster'] = top_cluster return df def get_top_cluster_counts(self, df=None): if df is None: df = self.df if df is None: # if it's still not there, load it (parsing the treefile if necessary) df = self.load_df() df = self.add_top_cluster_column_to_df(df=df) self.top_cluster_counts = df['top_cluster'].value_counts() return self.top_cluster_counts def get_nodes_for_cluster(self, cluster_name=None, df=None): """get a list of the node names for one cluster :returns: list of node names """ if cluster_name is None: raise RuntimeError("must specify cluster_name") # TODO: could reimplement this so it doesn't use pandas. might be more efficient if df is None: df = self.df if df is None: # if it's still not there, load it (parsing the treefile if necessary) df = self.load_df() if self.cluster_sep not in str(cluster_name): # assume this is a top-level cluster if 'top_cluster' not in df.columns: self.df = add_top_cluster_column_to_df(df=df) subset = df[df['top_cluster']==cluster_name] else: # make sure the cluster separator is the last character in cluster_name if cluster_name[-1] != self.cluster_sep: cluster_name = cluster_name + self.cluster_sep subset = df[df['path'].str.startswith(cluster_name)] return subset['name'].tolist()
[ 1, 1053, 11701, 408, 10518, 13, 5215, 12655, 408, 7442, 13, 13, 1990, 15472, 1445, 29898, 3318, 1125, 13, 13, 1678, 9995, 24183, 363, 1985, 411, 263, 5447, 1445, 14544, 8336, 5513, 15945, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 13, 18884, 285, 978, 29922, 8516, 29892, 13, 18884, 3440, 29918, 3090, 9880, 613, 13, 18884, 1746, 29918, 19570, 543, 9162, 13, 18884, 9867, 29918, 19570, 543, 6160, 1125, 13, 4706, 9995, 13, 4706, 584, 29888, 978, 29901, 10422, 363, 278, 5447, 1445, 13, 4706, 9995, 13, 13, 4706, 1583, 29889, 29888, 978, 353, 285, 978, 13, 4706, 1583, 29889, 9342, 29918, 3090, 353, 3440, 29918, 3090, 13, 4706, 1583, 29889, 2671, 29918, 19570, 353, 1746, 29918, 19570, 13, 4706, 1583, 29889, 19594, 29918, 19570, 353, 9867, 29918, 19570, 13, 13, 4706, 1583, 29889, 29881, 353, 6213, 13, 4706, 1583, 29889, 2176, 353, 6213, 13, 4706, 1583, 29889, 3332, 29918, 19594, 29918, 2798, 29879, 353, 6213, 13, 13, 1678, 822, 6088, 29898, 1311, 29892, 285, 978, 29922, 8516, 1125, 13, 4706, 9995, 12914, 278, 5447, 1445, 13, 13, 4706, 584, 29888, 978, 29901, 10422, 363, 278, 5447, 1445, 13, 4706, 584, 18280, 29901, 1051, 310, 21503, 4314, 29889, 1269, 2944, 297, 278, 1051, 338, 263, 1948, 297, 278, 5447, 1445, 13, 13, 4706, 9995, 13, 13, 4706, 565, 285, 978, 338, 451, 6213, 29901, 13, 9651, 1583, 29889, 29888, 978, 353, 285, 978, 13, 4706, 1683, 29901, 13, 9651, 285, 978, 353, 1583, 29889, 29888, 978, 13, 13, 4706, 270, 353, 5159, 13, 4706, 411, 1722, 29898, 29888, 978, 29892, 525, 29878, 1495, 408, 285, 29901, 13, 9651, 363, 1196, 297, 285, 29901, 13, 18884, 565, 1196, 29961, 29900, 29962, 1275, 1583, 29889, 9342, 29918, 3090, 29901, 13, 462, 1678, 6773, 13, 18884, 1196, 353, 1196, 29889, 17010, 2141, 5451, 29898, 1311, 29889, 2671, 29918, 19570, 29897, 13, 18884, 445, 29918, 798, 353, 6571, 13, 18884, 445, 29918, 798, 1839, 2084, 2033, 353, 1196, 29961, 29900, 29962, 13, 18884, 445, 29918, 798, 1839, 1731, 2033, 353, 5785, 29898, 1220, 29961, 29896, 2314, 13, 18884, 445, 29918, 798, 1839, 978, 2033, 353, 1196, 29961, 29906, 1822, 17010, 877, 29908, 1495, 13, 18884, 565, 7431, 29898, 1220, 29897, 1405, 29871, 29941, 29901, 13, 462, 1678, 445, 29918, 798, 1839, 3177, 2033, 353, 938, 29898, 1220, 29961, 29941, 2314, 13, 18884, 270, 29889, 4397, 29898, 1366, 29918, 798, 29897, 13, 4706, 1583, 29889, 29881, 353, 270, 13, 13, 1678, 822, 2254, 29918, 2176, 29898, 1311, 1125, 13, 4706, 9995, 1359, 5447, 1445, 408, 263, 11701, 12205, 13, 4706, 584, 18280, 29901, 11701, 12205, 13, 13, 4706, 9995, 13, 4706, 565, 451, 1583, 29889, 29881, 29901, 13, 9651, 1583, 29889, 5510, 580, 13, 13, 4706, 1583, 29889, 2176, 353, 10518, 29889, 17271, 29898, 1311, 29889, 29881, 29897, 13, 4706, 736, 1583, 29889, 2176, 13, 13, 1678, 822, 788, 29918, 3332, 29918, 19594, 29918, 4914, 29918, 517, 29918, 2176, 29898, 1311, 29892, 4489, 29922, 8516, 1125, 13, 4706, 565, 4489, 338, 6213, 29901, 13, 9651, 4489, 353, 1583, 29889, 2176, 13, 4706, 565, 4489, 338, 6213, 29901, 13, 9651, 12020, 24875, 2392, 703, 2176, 338, 451, 6790, 29889, 1246, 2254, 29918, 2176, 580, 304, 2254, 278, 12205, 1159, 13, 4706, 2246, 29918, 19594, 353, 4489, 1839, 2084, 13359, 7302, 29898, 2892, 921, 29901, 921, 29889, 5451, 29898, 1311, 29889, 19594, 29918, 19570, 9601, 29900, 2314, 13, 4706, 2246, 29918, 19594, 29889, 978, 353, 525, 3332, 29918, 19594, 29915, 13, 4706, 4489, 1839, 3332, 29918, 19594, 2033, 353, 2246, 29918, 19594, 13, 4706, 736, 4489, 13, 308, 13, 1678, 822, 679, 29918, 3332, 29918, 19594, 29918, 2798, 29879, 29898, 1311, 29892, 4489, 29922, 8516, 1125, 13, 4706, 565, 4489, 338, 6213, 29901, 13, 9651, 4489, 353, 1583, 29889, 2176, 13, 4706, 565, 4489, 338, 6213, 29901, 29871, 396, 565, 372, 29915, 29879, 1603, 451, 727, 29892, 2254, 372, 313, 862, 2976, 278, 5447, 1445, 565, 5181, 29897, 13, 9651, 4489, 353, 1583, 29889, 1359, 29918, 2176, 580, 13, 308, 13, 4706, 4489, 353, 1583, 29889, 1202, 29918, 3332, 29918, 19594, 29918, 4914, 29918, 517, 29918, 2176, 29898, 2176, 29922, 2176, 29897, 13, 4706, 1583, 29889, 3332, 29918, 19594, 29918, 2798, 29879, 353, 4489, 1839, 3332, 29918, 19594, 13359, 1767, 29918, 2798, 29879, 580, 13, 4706, 736, 1583, 29889, 3332, 29918, 19594, 29918, 2798, 29879, 13, 13, 1678, 822, 679, 29918, 18010, 29918, 1454, 29918, 19594, 29898, 1311, 29892, 9867, 29918, 978, 29922, 8516, 29892, 4489, 29922, 8516, 1125, 13, 4706, 9995, 657, 263, 1051, 310, 278, 2943, 2983, 363, 697, 9867, 13, 13, 4706, 584, 18280, 29901, 1051, 310, 2943, 2983, 13, 13, 4706, 9995, 13, 4706, 565, 9867, 29918, 978, 338, 6213, 29901, 13, 9651, 12020, 24875, 2392, 703, 21969, 6084, 9867, 29918, 978, 1159, 13, 13, 4706, 396, 14402, 29901, 1033, 337, 326, 2037, 445, 577, 372, 1838, 29915, 29873, 671, 11701, 29889, 1795, 367, 901, 8543, 13, 4706, 565, 4489, 338, 6213, 29901, 13, 9651, 4489, 353, 1583, 29889, 2176, 13, 4706, 565, 4489, 338, 6213, 29901, 29871, 396, 565, 372, 29915, 29879, 1603, 451, 727, 29892, 2254, 372, 313, 862, 2976, 278, 5447, 1445, 565, 5181, 29897, 13, 9651, 4489, 353, 1583, 29889, 1359, 29918, 2176, 580, 13, 13, 4706, 565, 1583, 29889, 19594, 29918, 19570, 451, 297, 851, 29898, 19594, 29918, 978, 1125, 13, 9651, 396, 5251, 445, 338, 263, 2246, 29899, 5563, 9867, 13, 9651, 565, 525, 3332, 29918, 19594, 29915, 451, 297, 4489, 29889, 13099, 29901, 13, 18884, 1583, 29889, 2176, 353, 788, 29918, 3332, 29918, 19594, 29918, 4914, 29918, 517, 29918, 2176, 29898, 2176, 29922, 2176, 29897, 13, 9651, 11306, 353, 4489, 29961, 2176, 1839, 3332, 29918, 19594, 2033, 1360, 19594, 29918, 978, 29962, 13, 13, 4706, 1683, 29901, 13, 9651, 396, 1207, 1854, 278, 9867, 28128, 338, 278, 1833, 2931, 297, 9867, 29918, 978, 13, 9651, 565, 9867, 29918, 978, 14352, 29896, 29962, 2804, 1583, 29889, 19594, 29918, 19570, 29901, 13, 18884, 9867, 29918, 978, 353, 9867, 29918, 978, 718, 1583, 29889, 19594, 29918, 19570, 13, 9651, 11306, 353, 4489, 29961, 2176, 1839, 2084, 13359, 710, 29889, 27382, 2541, 29898, 19594, 29918, 978, 4638, 13, 13, 4706, 736, 11306, 1839, 978, 13359, 25027, 391, 580, 13, 2 ]
tests/conftest.py
marqov/procrastinate
0
44025
<filename>tests/conftest.py<gh_stars>0 import os import signal as stdlib_signal from contextlib import closing import aiopg import psycopg2 import pytest from psycopg2 import sql from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT from procrastinate import aiopg_connector from procrastinate import app as app_module from procrastinate import jobs, migration, testing # Just ensuring the tests are not polluted by environment for key in os.environ: if key.startswith("PROCRASTINATE_"): os.environ.pop(key) def _execute(cursor, query, *identifiers): cursor.execute( sql.SQL(query).format( *(sql.Identifier(identifier) for identifier in identifiers) ) ) @pytest.fixture(scope="session") def setup_db(): with closing(psycopg2.connect("", dbname="postgres")) as connection: connection.set_isolation_level(ISOLATION_LEVEL_AUTOCOMMIT) with connection.cursor() as cursor: _execute( cursor, "DROP DATABASE IF EXISTS {}", "procrastinate_test_template" ) _execute(cursor, "CREATE DATABASE {}", "procrastinate_test_template") job_store = aiopg_connector.PostgresJobStore(dbname="procrastinate_test_template") migrator = migration.Migrator(job_store=job_store) migrator.migrate() # We need to close the psycopg2 underlying connection synchronously job_store._connection._conn.close() with closing( psycopg2.connect("", dbname="procrastinate_test_template") ) as connection: connection.set_isolation_level(ISOLATION_LEVEL_AUTOCOMMIT) yield connection with closing(psycopg2.connect("", dbname="postgres")) as connection: connection.set_isolation_level(ISOLATION_LEVEL_AUTOCOMMIT) with connection.cursor() as cursor: _execute( cursor, "DROP DATABASE IF EXISTS {}", "procrastinate_test_template" ) @pytest.fixture def connection_params(setup_db): with setup_db.cursor() as cursor: _execute(cursor, "DROP DATABASE IF EXISTS {}", "procrastinate_test") _execute( cursor, "CREATE DATABASE {} TEMPLATE {}", "procrastinate_test", "procrastinate_test_template", ) yield {"dsn": "", "dbname": "procrastinate_test"} with setup_db.cursor() as cursor: _execute(cursor, "DROP DATABASE IF EXISTS {}", "procrastinate_test") @pytest.fixture async def connection(connection_params): async with aiopg.connect(**connection_params) as connection: yield connection @pytest.fixture async def pg_job_store(connection_params): job_store = aiopg_connector.PostgresJobStore(**connection_params) yield job_store connection = await job_store.get_connection() await connection.close() @pytest.fixture def kill_own_pid(): def f(signal=stdlib_signal.SIGTERM): os.kill(os.getpid(), signal) return f @pytest.fixture def job_store(): return testing.InMemoryJobStore() @pytest.fixture def get_all(connection): async def f(table, *fields): async with connection.cursor( cursor_factory=aiopg_connector.RealDictCursor ) as cursor: await cursor.execute(f"SELECT {', '.join(fields)} FROM {table}") return await cursor.fetchall() return f @pytest.fixture def app(job_store): return app_module.App(job_store=job_store) @pytest.fixture def pg_app(pg_job_store): return app_module.App(job_store=pg_job_store) @pytest.fixture def job_factory(): defaults = { "id": 42, "task_name": "bla", "task_kwargs": {}, "lock": None, "queue": "queue", } def factory(**kwargs): final_kwargs = defaults.copy() final_kwargs.update(kwargs) return jobs.Job(**final_kwargs) return factory
[ 1, 529, 9507, 29958, 21150, 29914, 535, 615, 342, 29889, 2272, 29966, 12443, 29918, 303, 1503, 29958, 29900, 13, 5215, 2897, 13, 5215, 7182, 408, 3659, 1982, 29918, 25436, 13, 3166, 3030, 1982, 1053, 14382, 13, 13, 5215, 7468, 459, 29887, 13, 5215, 6529, 29891, 9708, 29887, 29906, 13, 5215, 11451, 1688, 13, 3166, 6529, 29891, 9708, 29887, 29906, 1053, 4576, 13, 3166, 6529, 29891, 9708, 29887, 29906, 29889, 24299, 1053, 8519, 5607, 8098, 29918, 1307, 29963, 6670, 29918, 20656, 29949, 3217, 7428, 1806, 13, 13, 3166, 410, 7283, 579, 16976, 1053, 7468, 459, 29887, 29918, 11958, 2801, 13, 3166, 410, 7283, 579, 16976, 1053, 623, 408, 623, 29918, 5453, 13, 3166, 410, 7283, 579, 16976, 1053, 17643, 29892, 20332, 29892, 6724, 13, 13, 29937, 3387, 5662, 3864, 278, 6987, 526, 451, 21180, 3860, 491, 5177, 13, 1454, 1820, 297, 2897, 29889, 21813, 29901, 13, 1678, 565, 1820, 29889, 27382, 2541, 703, 8618, 29907, 4717, 1254, 1177, 3040, 27508, 1125, 13, 4706, 2897, 29889, 21813, 29889, 7323, 29898, 1989, 29897, 13, 13, 13, 1753, 903, 7978, 29898, 18127, 29892, 2346, 29892, 334, 1693, 14903, 1125, 13, 1678, 10677, 29889, 7978, 29898, 13, 4706, 4576, 29889, 4176, 29898, 1972, 467, 4830, 29898, 13, 9651, 334, 29898, 2850, 29889, 12889, 29898, 25378, 29897, 363, 15882, 297, 2893, 14903, 29897, 13, 4706, 1723, 13, 1678, 1723, 13, 13, 13, 29992, 2272, 1688, 29889, 7241, 15546, 29898, 6078, 543, 7924, 1159, 13, 1753, 6230, 29918, 2585, 7295, 13, 13, 1678, 411, 14382, 29898, 567, 29891, 9708, 29887, 29906, 29889, 6915, 703, 613, 4833, 978, 543, 2490, 7201, 5783, 408, 3957, 29901, 13, 4706, 3957, 29889, 842, 29918, 275, 22671, 29918, 5563, 29898, 3235, 5607, 8098, 29918, 1307, 29963, 6670, 29918, 20656, 29949, 3217, 7428, 1806, 29897, 13, 4706, 411, 3957, 29889, 18127, 580, 408, 10677, 29901, 13, 9651, 903, 7978, 29898, 13, 18884, 10677, 29892, 376, 29928, 29366, 27640, 27982, 10762, 28731, 6571, 613, 376, 771, 7283, 579, 16976, 29918, 1688, 29918, 6886, 29908, 13, 9651, 1723, 13, 9651, 903, 7978, 29898, 18127, 29892, 376, 27045, 27640, 27982, 6571, 613, 376, 771, 7283, 579, 16976, 29918, 1688, 29918, 6886, 1159, 13, 13, 1678, 4982, 29918, 8899, 353, 7468, 459, 29887, 29918, 11958, 2801, 29889, 6747, 7201, 11947, 9044, 29898, 2585, 978, 543, 771, 7283, 579, 16976, 29918, 1688, 29918, 6886, 1159, 13, 1678, 9725, 1061, 353, 20332, 29889, 29924, 4481, 1061, 29898, 9057, 29918, 8899, 29922, 9057, 29918, 8899, 29897, 13, 1678, 9725, 1061, 29889, 26983, 403, 580, 13, 1678, 396, 1334, 817, 304, 3802, 278, 6529, 29891, 9708, 29887, 29906, 14407, 3957, 12231, 5794, 13, 1678, 4982, 29918, 8899, 3032, 9965, 3032, 13082, 29889, 5358, 580, 13, 13, 1678, 411, 14382, 29898, 13, 4706, 6529, 29891, 9708, 29887, 29906, 29889, 6915, 703, 613, 4833, 978, 543, 771, 7283, 579, 16976, 29918, 1688, 29918, 6886, 1159, 13, 1678, 1723, 408, 3957, 29901, 13, 4706, 3957, 29889, 842, 29918, 275, 22671, 29918, 5563, 29898, 3235, 5607, 8098, 29918, 1307, 29963, 6670, 29918, 20656, 29949, 3217, 7428, 1806, 29897, 13, 4706, 7709, 3957, 13, 13, 1678, 411, 14382, 29898, 567, 29891, 9708, 29887, 29906, 29889, 6915, 703, 613, 4833, 978, 543, 2490, 7201, 5783, 408, 3957, 29901, 13, 4706, 3957, 29889, 842, 29918, 275, 22671, 29918, 5563, 29898, 3235, 5607, 8098, 29918, 1307, 29963, 6670, 29918, 20656, 29949, 3217, 7428, 1806, 29897, 13, 4706, 411, 3957, 29889, 18127, 580, 408, 10677, 29901, 13, 9651, 903, 7978, 29898, 13, 18884, 10677, 29892, 376, 29928, 29366, 27640, 27982, 10762, 28731, 6571, 613, 376, 771, 7283, 579, 16976, 29918, 1688, 29918, 6886, 29908, 13, 9651, 1723, 13, 13, 13, 29992, 2272, 1688, 29889, 7241, 15546, 13, 1753, 3957, 29918, 7529, 29898, 14669, 29918, 2585, 1125, 13, 1678, 411, 6230, 29918, 2585, 29889, 18127, 580, 408, 10677, 29901, 13, 4706, 903, 7978, 29898, 18127, 29892, 376, 29928, 29366, 27640, 27982, 10762, 28731, 6571, 613, 376, 771, 7283, 579, 16976, 29918, 1688, 1159, 13, 4706, 903, 7978, 29898, 13, 9651, 10677, 29892, 13, 9651, 376, 27045, 27640, 27982, 6571, 17067, 3580, 29931, 3040, 6571, 613, 13, 9651, 376, 771, 7283, 579, 16976, 29918, 1688, 613, 13, 9651, 376, 771, 7283, 579, 16976, 29918, 1688, 29918, 6886, 613, 13, 4706, 1723, 13, 13, 1678, 7709, 8853, 6289, 29876, 1115, 12633, 376, 2585, 978, 1115, 376, 771, 7283, 579, 16976, 29918, 1688, 9092, 13, 13, 1678, 411, 6230, 29918, 2585, 29889, 18127, 580, 408, 10677, 29901, 13, 4706, 903, 7978, 29898, 18127, 29892, 376, 29928, 29366, 27640, 27982, 10762, 28731, 6571, 613, 376, 771, 7283, 579, 16976, 29918, 1688, 1159, 13, 13, 13, 29992, 2272, 1688, 29889, 7241, 15546, 13, 12674, 822, 3957, 29898, 9965, 29918, 7529, 1125, 13, 1678, 7465, 411, 7468, 459, 29887, 29889, 6915, 29898, 1068, 9965, 29918, 7529, 29897, 408, 3957, 29901, 13, 4706, 7709, 3957, 13, 13, 13, 29992, 2272, 1688, 29889, 7241, 15546, 13, 12674, 822, 23822, 29918, 9057, 29918, 8899, 29898, 9965, 29918, 7529, 1125, 13, 1678, 4982, 29918, 8899, 353, 7468, 459, 29887, 29918, 11958, 2801, 29889, 6747, 7201, 11947, 9044, 29898, 1068, 9965, 29918, 7529, 29897, 13, 1678, 7709, 4982, 29918, 8899, 13, 1678, 3957, 353, 7272, 4982, 29918, 8899, 29889, 657, 29918, 9965, 580, 13, 1678, 7272, 3957, 29889, 5358, 580, 13, 13, 13, 29992, 2272, 1688, 29889, 7241, 15546, 13, 1753, 12088, 29918, 776, 29918, 5935, 7295, 13, 1678, 822, 285, 29898, 25436, 29922, 4172, 1982, 29918, 25436, 29889, 5425, 29954, 4945, 29924, 1125, 13, 4706, 2897, 29889, 21174, 29898, 359, 29889, 657, 5935, 3285, 7182, 29897, 13, 13, 1678, 736, 285, 13, 13, 13, 29992, 2272, 1688, 29889, 7241, 15546, 13, 1753, 4982, 29918, 8899, 7295, 13, 1678, 736, 6724, 29889, 797, 16015, 11947, 9044, 580, 13, 13, 13, 29992, 2272, 1688, 29889, 7241, 15546, 13, 1753, 679, 29918, 497, 29898, 9965, 1125, 13, 1678, 7465, 822, 285, 29898, 2371, 29892, 334, 9621, 1125, 13, 4706, 7465, 411, 3957, 29889, 18127, 29898, 13, 9651, 10677, 29918, 14399, 29922, 1794, 459, 29887, 29918, 11958, 2801, 29889, 21713, 21533, 19890, 13, 4706, 1723, 408, 10677, 29901, 13, 9651, 7272, 10677, 29889, 7978, 29898, 29888, 29908, 6404, 426, 742, 15300, 7122, 29898, 9621, 2915, 3895, 426, 2371, 27195, 13, 9651, 736, 7272, 10677, 29889, 9155, 497, 580, 13, 13, 1678, 736, 285, 13, 13, 13, 29992, 2272, 1688, 29889, 7241, 15546, 13, 1753, 623, 29898, 9057, 29918, 8899, 1125, 13, 1678, 736, 623, 29918, 5453, 29889, 2052, 29898, 9057, 29918, 8899, 29922, 9057, 29918, 8899, 29897, 13, 13, 13, 29992, 2272, 1688, 29889, 7241, 15546, 13, 1753, 23822, 29918, 932, 29898, 4061, 29918, 9057, 29918, 8899, 1125, 13, 1678, 736, 623, 29918, 5453, 29889, 2052, 29898, 9057, 29918, 8899, 29922, 4061, 29918, 9057, 29918, 8899, 29897, 13, 13, 13, 29992, 2272, 1688, 29889, 7241, 15546, 13, 1753, 4982, 29918, 14399, 7295, 13, 1678, 21274, 353, 426, 13, 4706, 376, 333, 1115, 29871, 29946, 29906, 29892, 13, 4706, 376, 7662, 29918, 978, 1115, 376, 17530, 613, 13, 4706, 376, 7662, 29918, 19290, 1115, 24335, 13, 4706, 376, 908, 1115, 6213, 29892, 13, 4706, 376, 9990, 1115, 376, 9990, 613, 13, 1678, 500, 13, 13, 1678, 822, 12529, 29898, 1068, 19290, 1125, 13, 4706, 2186, 29918, 19290, 353, 21274, 29889, 8552, 580, 13, 4706, 2186, 29918, 19290, 29889, 5504, 29898, 19290, 29897, 13, 4706, 736, 17643, 29889, 11947, 29898, 1068, 8394, 29918, 19290, 29897, 13, 13, 1678, 736, 12529, 13, 2 ]
porthole/management/commands/brocade.py
jsayles/Porthole
0
9828
<filename>porthole/management/commands/brocade.py from django.core.management.base import BaseCommand, CommandError from django.conf import settings from porthole import models, brocade class Command(BaseCommand): help = "Command the Brocade switch stacks" args = "" requires_system_checks = False def add_arguments(self, parser): parser.add_argument( '--print_stacks', action='store_true', dest='print_stacks', help='Show the VLAN data from all switch stacks', ) def handle(self, *args, **options): if options['print_stacks']: self.print_stacks() def print_stacks(self): for s in models.SwitchStack.objects.all(): stack = brocade.SwitchStack(s.name, s.ip_address, s.raw_username, s.raw_password, port=s.port) stack.print_stack() print()
[ 1, 529, 9507, 29958, 1971, 386, 1772, 29914, 21895, 29914, 26381, 29914, 6729, 6332, 29889, 2272, 13, 3166, 9557, 29889, 3221, 29889, 21895, 29889, 3188, 1053, 7399, 6255, 29892, 10516, 2392, 13, 3166, 9557, 29889, 5527, 1053, 6055, 13, 13, 3166, 1277, 386, 1772, 1053, 4733, 29892, 2545, 6332, 13, 13, 13, 1990, 10516, 29898, 5160, 6255, 1125, 13, 1678, 1371, 353, 376, 6255, 278, 4358, 6332, 4607, 5096, 29879, 29908, 13, 1678, 6389, 353, 5124, 13, 1678, 6858, 29918, 5205, 29918, 3198, 29879, 353, 7700, 13, 13, 1678, 822, 788, 29918, 25699, 29898, 1311, 29892, 13812, 1125, 13, 4706, 13812, 29889, 1202, 29918, 23516, 29898, 13, 9651, 525, 489, 2158, 29918, 1429, 29879, 742, 13, 9651, 3158, 2433, 8899, 29918, 3009, 742, 13, 9651, 2731, 2433, 2158, 29918, 1429, 29879, 742, 13, 9651, 1371, 2433, 8964, 278, 478, 29931, 2190, 848, 515, 599, 4607, 5096, 29879, 742, 13, 4706, 1723, 13, 13, 1678, 822, 4386, 29898, 1311, 29892, 334, 5085, 29892, 3579, 6768, 1125, 13, 4706, 565, 3987, 1839, 2158, 29918, 1429, 29879, 2033, 29901, 13, 9651, 1583, 29889, 2158, 29918, 1429, 29879, 580, 13, 13, 1678, 822, 1596, 29918, 1429, 29879, 29898, 1311, 1125, 13, 4706, 363, 269, 297, 4733, 29889, 24995, 7264, 29889, 12650, 29889, 497, 7295, 13, 9651, 5096, 353, 2545, 6332, 29889, 24995, 7264, 29898, 29879, 29889, 978, 29892, 269, 29889, 666, 29918, 7328, 29892, 269, 29889, 1610, 29918, 6786, 29892, 269, 29889, 1610, 29918, 5630, 29892, 2011, 29922, 29879, 29889, 637, 29897, 13, 9651, 5096, 29889, 2158, 29918, 1429, 580, 13, 9651, 1596, 580, 13, 2 ]
helpers/time.py
fswzb/autotrade
1
181598
<gh_stars>1-10 # coding:utf8 import datetime def is_weekend(now_time): return now_time.weekday() >= 5 #to get the latest trade day except_trade_day_list=['2015-05-01','2015-06-22','2015-09-03','2015-10-01','2015-10-02','2015-10-06', \ '2015-10-07','2015-10-08', '2016-04-04','2016-05-02','2016-06-09','2016-06-10', \ '2016-09-15','2016-09-16','2016-10-03','2016-10-04','2016-10-05','2016-10-06', \ '2016-10-07','2017-01-02','2017-01-30','2017-01-31','2017-02-01','2017-02-02', \ '2017-04-03','2017-05-29','2017-10-02','2017-10-03','2017-10-04','2017-10-05','2017-10-06'] def is_trade_date(given_date_str=None): """ :param given_date_str: str type, like '2017-10-01' :return: bool type """ this_day = datetime.datetime.now() date_format = '%Y-%m-%d' this_str = this_day.strftime(date_format) open_str = ' 09:15:00' if this_str in except_trade_day_list: return False return this_day.isoweekday() < 6 def get_latest_trade_date(this_date=None, date_format='%Y-%m-%d'): """ :param this_date: datetime.datetim type, like datetime.datetime.now() :return: latest_day_str, str type """ this_day = datetime.datetime.now() if this_date != None: this_day = this_date open_str = ' 09:25:00' time_format = date_format + ' %X' this_str = this_day.strftime(time_format) if (this_day.hour >= 0 and this_day.hour < 9) or (this_day.hour == 9 and this_day.minute < 15): this_day = datetime.datetime.strptime( this_str, time_format) + datetime.timedelta(days=-1) this_str = this_day.strftime(date_format) latest_day_str = '' this_str = this_str[:10] while this_str >= '1990-01-01': if is_trade_date(this_str): return this_str #break else: this_day = this_day + datetime.timedelta(days=-1) this_str = this_day.strftime(date_format) def get_next_trade_date(now_time): """ :param now_time: datetime.datetime :return: >>> import datetime >>> get_next_trade_date(datetime.date(2016, 5, 5)) datetime.date(2016, 5, 6) """ now = now_time max_days = 365 days = 0 while 1: days += 1 now += datetime.timedelta(days=1) if is_trade_date(now): if isinstance(now, datetime.date): return now else: return now.date() if days > max_days: raise ValueError('无法确定 %s 下一个交易日' % now_time) OPEN_TIME = ((datetime.time(9, 15, 0), datetime.time(11, 30, 0)), (datetime.time(13, 0, 0), datetime.time(15, 0, 0)), ) def is_tradetime(now_time): """ :param now_time: datetime.time() :return: """ now = now_time.time() for begin, end in OPEN_TIME: if begin <= now < end: return True else: return False PAUSE_TIME = ((datetime.time(11, 30, 0), datetime.time(12, 59, 30)), ) def is_pause(now_time): """ :param now_time: :return: """ now = now_time.time() for b, e in PAUSE_TIME: if b <= now < e: return True CONTINUE_TIME = ((datetime.time(12, 59, 30), datetime.time(13, 0, 0)), ) def is_continue(now_time): now = now_time.time() for b, e in CONTINUE_TIME: if b <= now < e: return True return False CLOSE_TIME = (datetime.time(15, 0, 0), ) def is_closing(now_time, start=datetime.time(14, 54, 30)): now = now_time.time() for close in CLOSE_TIME: if start <= now < close: return True return False
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 29937, 14137, 29901, 9420, 29947, 13, 13, 5215, 12865, 13, 13, 13, 1753, 338, 29918, 18448, 355, 29898, 3707, 29918, 2230, 1125, 13, 1678, 736, 1286, 29918, 2230, 29889, 18448, 3250, 580, 6736, 29871, 29945, 13, 13, 29937, 517, 679, 278, 9281, 11302, 2462, 13, 19499, 29918, 3018, 311, 29918, 3250, 29918, 1761, 29922, 1839, 29906, 29900, 29896, 29945, 29899, 29900, 29945, 29899, 29900, 29896, 3788, 29906, 29900, 29896, 29945, 29899, 29900, 29953, 29899, 29906, 29906, 3788, 29906, 29900, 29896, 29945, 29899, 29900, 29929, 29899, 29900, 29941, 3788, 29906, 29900, 29896, 29945, 29899, 29896, 29900, 29899, 29900, 29896, 3788, 29906, 29900, 29896, 29945, 29899, 29896, 29900, 29899, 29900, 29906, 3788, 29906, 29900, 29896, 29945, 29899, 29896, 29900, 29899, 29900, 29953, 742, 320, 13, 462, 539, 525, 29906, 29900, 29896, 29945, 29899, 29896, 29900, 29899, 29900, 29955, 3788, 29906, 29900, 29896, 29945, 29899, 29896, 29900, 29899, 29900, 29947, 742, 525, 29906, 29900, 29896, 29953, 29899, 29900, 29946, 29899, 29900, 29946, 3788, 29906, 29900, 29896, 29953, 29899, 29900, 29945, 29899, 29900, 29906, 3788, 29906, 29900, 29896, 29953, 29899, 29900, 29953, 29899, 29900, 29929, 3788, 29906, 29900, 29896, 29953, 29899, 29900, 29953, 29899, 29896, 29900, 742, 320, 13, 462, 539, 525, 29906, 29900, 29896, 29953, 29899, 29900, 29929, 29899, 29896, 29945, 3788, 29906, 29900, 29896, 29953, 29899, 29900, 29929, 29899, 29896, 29953, 3788, 29906, 29900, 29896, 29953, 29899, 29896, 29900, 29899, 29900, 29941, 3788, 29906, 29900, 29896, 29953, 29899, 29896, 29900, 29899, 29900, 29946, 3788, 29906, 29900, 29896, 29953, 29899, 29896, 29900, 29899, 29900, 29945, 3788, 29906, 29900, 29896, 29953, 29899, 29896, 29900, 29899, 29900, 29953, 742, 320, 13, 462, 539, 525, 29906, 29900, 29896, 29953, 29899, 29896, 29900, 29899, 29900, 29955, 3788, 29906, 29900, 29896, 29955, 29899, 29900, 29896, 29899, 29900, 29906, 3788, 29906, 29900, 29896, 29955, 29899, 29900, 29896, 29899, 29941, 29900, 3788, 29906, 29900, 29896, 29955, 29899, 29900, 29896, 29899, 29941, 29896, 3788, 29906, 29900, 29896, 29955, 29899, 29900, 29906, 29899, 29900, 29896, 3788, 29906, 29900, 29896, 29955, 29899, 29900, 29906, 29899, 29900, 29906, 742, 320, 13, 462, 539, 525, 29906, 29900, 29896, 29955, 29899, 29900, 29946, 29899, 29900, 29941, 3788, 29906, 29900, 29896, 29955, 29899, 29900, 29945, 29899, 29906, 29929, 3788, 29906, 29900, 29896, 29955, 29899, 29896, 29900, 29899, 29900, 29906, 3788, 29906, 29900, 29896, 29955, 29899, 29896, 29900, 29899, 29900, 29941, 3788, 29906, 29900, 29896, 29955, 29899, 29896, 29900, 29899, 29900, 29946, 3788, 29906, 29900, 29896, 29955, 29899, 29896, 29900, 29899, 29900, 29945, 3788, 29906, 29900, 29896, 29955, 29899, 29896, 29900, 29899, 29900, 29953, 2033, 13, 13, 13, 1753, 338, 29918, 3018, 311, 29918, 1256, 29898, 29887, 5428, 29918, 1256, 29918, 710, 29922, 8516, 1125, 13, 1678, 9995, 13, 1678, 584, 3207, 2183, 29918, 1256, 29918, 710, 29901, 851, 1134, 29892, 763, 525, 29906, 29900, 29896, 29955, 29899, 29896, 29900, 29899, 29900, 29896, 29915, 13, 1678, 584, 2457, 29901, 6120, 1134, 13, 1678, 9995, 13, 1678, 445, 29918, 3250, 353, 12865, 29889, 12673, 29889, 3707, 580, 13, 1678, 2635, 29918, 4830, 353, 14210, 29979, 19222, 29885, 19222, 29881, 29915, 13, 1678, 445, 29918, 710, 353, 445, 29918, 3250, 29889, 710, 615, 603, 29898, 1256, 29918, 4830, 29897, 13, 1678, 1722, 29918, 710, 353, 525, 29871, 29900, 29929, 29901, 29896, 29945, 29901, 29900, 29900, 29915, 13, 1678, 565, 445, 29918, 710, 297, 5174, 29918, 3018, 311, 29918, 3250, 29918, 1761, 29901, 13, 4706, 736, 7700, 13, 1678, 736, 445, 29918, 3250, 29889, 275, 4657, 1416, 3250, 580, 529, 29871, 29953, 13, 13, 13, 1753, 679, 29918, 12333, 29918, 3018, 311, 29918, 1256, 29898, 1366, 29918, 1256, 29922, 8516, 29892, 2635, 29918, 4830, 2433, 29995, 29979, 19222, 29885, 19222, 29881, 29374, 13, 1678, 9995, 13, 1678, 584, 3207, 445, 29918, 1256, 29901, 12865, 29889, 4130, 300, 326, 1134, 29892, 763, 12865, 29889, 12673, 29889, 3707, 580, 13, 1678, 584, 2457, 29901, 9281, 29918, 3250, 29918, 710, 29892, 851, 1134, 13, 1678, 9995, 13, 1678, 445, 29918, 3250, 353, 12865, 29889, 12673, 29889, 3707, 580, 13, 1678, 565, 445, 29918, 1256, 2804, 6213, 29901, 13, 4706, 445, 29918, 3250, 353, 445, 29918, 1256, 13, 1678, 1722, 29918, 710, 353, 525, 29871, 29900, 29929, 29901, 29906, 29945, 29901, 29900, 29900, 29915, 13, 1678, 931, 29918, 4830, 353, 2635, 29918, 4830, 718, 525, 1273, 29990, 29915, 13, 1678, 445, 29918, 710, 353, 445, 29918, 3250, 29889, 710, 615, 603, 29898, 2230, 29918, 4830, 29897, 13, 1678, 565, 313, 1366, 29918, 3250, 29889, 18721, 6736, 29871, 29900, 322, 445, 29918, 3250, 29889, 18721, 529, 29871, 29929, 29897, 470, 313, 1366, 29918, 3250, 29889, 18721, 1275, 29871, 29929, 322, 13, 462, 462, 462, 418, 445, 29918, 3250, 29889, 1195, 1082, 529, 29871, 29896, 29945, 1125, 13, 4706, 445, 29918, 3250, 353, 12865, 29889, 12673, 29889, 710, 415, 603, 29898, 13, 9651, 445, 29918, 710, 29892, 931, 29918, 4830, 29897, 718, 12865, 29889, 9346, 287, 2554, 29898, 16700, 10457, 29896, 29897, 13, 4706, 445, 29918, 710, 353, 445, 29918, 3250, 29889, 710, 615, 603, 29898, 1256, 29918, 4830, 29897, 13, 1678, 9281, 29918, 3250, 29918, 710, 353, 6629, 13, 1678, 445, 29918, 710, 353, 445, 29918, 710, 7503, 29896, 29900, 29962, 13, 1678, 1550, 445, 29918, 710, 6736, 525, 29896, 29929, 29929, 29900, 29899, 29900, 29896, 29899, 29900, 29896, 2396, 13, 4706, 565, 338, 29918, 3018, 311, 29918, 1256, 29898, 1366, 29918, 710, 1125, 13, 9651, 736, 445, 29918, 710, 13, 9651, 396, 8690, 13, 4706, 1683, 29901, 13, 9651, 445, 29918, 3250, 353, 445, 29918, 3250, 718, 12865, 29889, 9346, 287, 2554, 29898, 16700, 10457, 29896, 29897, 13, 9651, 445, 29918, 710, 353, 445, 29918, 3250, 29889, 710, 615, 603, 29898, 1256, 29918, 4830, 29897, 13, 13, 13, 1753, 679, 29918, 4622, 29918, 3018, 311, 29918, 1256, 29898, 3707, 29918, 2230, 1125, 13, 1678, 9995, 13, 1678, 584, 3207, 1286, 29918, 2230, 29901, 12865, 29889, 12673, 13, 1678, 584, 2457, 29901, 13, 1678, 8653, 1053, 12865, 13, 1678, 8653, 679, 29918, 4622, 29918, 3018, 311, 29918, 1256, 29898, 12673, 29889, 1256, 29898, 29906, 29900, 29896, 29953, 29892, 29871, 29945, 29892, 29871, 29945, 876, 13, 1678, 12865, 29889, 1256, 29898, 29906, 29900, 29896, 29953, 29892, 29871, 29945, 29892, 29871, 29953, 29897, 13, 1678, 9995, 13, 1678, 1286, 353, 1286, 29918, 2230, 13, 1678, 4236, 29918, 16700, 353, 29871, 29941, 29953, 29945, 13, 1678, 3841, 353, 29871, 29900, 13, 1678, 1550, 29871, 29896, 29901, 13, 4706, 3841, 4619, 29871, 29896, 13, 4706, 1286, 4619, 12865, 29889, 9346, 287, 2554, 29898, 16700, 29922, 29896, 29897, 13, 4706, 565, 338, 29918, 3018, 311, 29918, 1256, 29898, 3707, 1125, 13, 9651, 565, 338, 8758, 29898, 3707, 29892, 12865, 29889, 1256, 1125, 13, 18884, 736, 1286, 13, 9651, 1683, 29901, 13, 18884, 736, 1286, 29889, 1256, 580, 13, 4706, 565, 3841, 1405, 4236, 29918, 16700, 29901, 13, 9651, 12020, 7865, 2392, 877, 31352, 30545, 31835, 30495, 1273, 29879, 29871, 30557, 30287, 30502, 31398, 233, 155, 150, 30325, 29915, 1273, 1286, 29918, 2230, 29897, 13, 13, 13, 4590, 1430, 29918, 15307, 353, 5135, 12673, 29889, 2230, 29898, 29929, 29892, 29871, 29896, 29945, 29892, 29871, 29900, 511, 12865, 29889, 2230, 29898, 29896, 29896, 29892, 29871, 29941, 29900, 29892, 29871, 29900, 8243, 13, 632, 313, 12673, 29889, 2230, 29898, 29896, 29941, 29892, 29871, 29900, 29892, 29871, 29900, 511, 12865, 29889, 2230, 29898, 29896, 29945, 29892, 29871, 29900, 29892, 29871, 29900, 8243, 1723, 13, 13, 13, 1753, 338, 29918, 29576, 5410, 29898, 3707, 29918, 2230, 1125, 13, 1678, 9995, 13, 1678, 584, 3207, 1286, 29918, 2230, 29901, 12865, 29889, 2230, 580, 13, 1678, 584, 2457, 29901, 13, 1678, 9995, 13, 1678, 1286, 353, 1286, 29918, 2230, 29889, 2230, 580, 13, 1678, 363, 3380, 29892, 1095, 297, 6418, 1430, 29918, 15307, 29901, 13, 4706, 565, 3380, 5277, 1286, 529, 1095, 29901, 13, 9651, 736, 5852, 13, 1678, 1683, 29901, 13, 4706, 736, 7700, 13, 13, 13, 7228, 17171, 29918, 15307, 353, 5135, 12673, 29889, 2230, 29898, 29896, 29896, 29892, 29871, 29941, 29900, 29892, 29871, 29900, 511, 12865, 29889, 2230, 29898, 29896, 29906, 29892, 29871, 29945, 29929, 29892, 29871, 29941, 29900, 8243, 1723, 13, 13, 13, 1753, 338, 29918, 29886, 1071, 29898, 3707, 29918, 2230, 1125, 13, 1678, 9995, 13, 1678, 584, 3207, 1286, 29918, 2230, 29901, 13, 1678, 584, 2457, 29901, 13, 1678, 9995, 13, 1678, 1286, 353, 1286, 29918, 2230, 29889, 2230, 580, 13, 1678, 363, 289, 29892, 321, 297, 17687, 17171, 29918, 15307, 29901, 13, 4706, 565, 289, 5277, 1286, 529, 321, 29901, 13, 9651, 736, 5852, 13, 13, 13, 22412, 1177, 4462, 29918, 15307, 353, 5135, 12673, 29889, 2230, 29898, 29896, 29906, 29892, 29871, 29945, 29929, 29892, 29871, 29941, 29900, 511, 12865, 29889, 2230, 29898, 29896, 29941, 29892, 29871, 29900, 29892, 29871, 29900, 8243, 1723, 13, 13, 13, 1753, 338, 29918, 19878, 29898, 3707, 29918, 2230, 1125, 13, 1678, 1286, 353, 1286, 29918, 2230, 29889, 2230, 580, 13, 1678, 363, 289, 29892, 321, 297, 8707, 29911, 1177, 4462, 29918, 15307, 29901, 13, 4706, 565, 289, 5277, 1286, 529, 321, 29901, 13, 9651, 736, 5852, 13, 1678, 736, 7700, 13, 13, 13, 29907, 3927, 1660, 29918, 15307, 353, 313, 12673, 29889, 2230, 29898, 29896, 29945, 29892, 29871, 29900, 29892, 29871, 29900, 511, 1723, 13, 13, 13, 1753, 338, 29918, 11291, 292, 29898, 3707, 29918, 2230, 29892, 1369, 29922, 12673, 29889, 2230, 29898, 29896, 29946, 29892, 29871, 29945, 29946, 29892, 29871, 29941, 29900, 22164, 13, 1678, 1286, 353, 1286, 29918, 2230, 29889, 2230, 580, 13, 1678, 363, 3802, 297, 315, 3927, 1660, 29918, 15307, 29901, 13, 4706, 565, 1369, 5277, 1286, 529, 3802, 29901, 13, 9651, 736, 5852, 13, 1678, 736, 7700, 13, 2 ]
tet/i18n/__init__.py
koirikivi/tet
1
105074
import sys from pyramid.config import Configurator from pyramid.i18n import get_localizer, TranslationStringFactory from pyramid.threadlocal import get_current_request def add_renderer_globals(event): request = event.get('request') if request is None: request = get_current_request() event['_'] = request.translate event['gettext'] = request.translate event['ngettext'] = request.pluralize event['localizer'] = request.localizer def configure_i18n(config: Configurator, default_domain: str): config.add_subscriber(add_renderer_globals, 'pyramid.events.BeforeRender') config.add_subscriber(add_renderer_globals, 'tet.viewlet.IBeforeViewletRender') config.registry.tsf = tsf = TranslationStringFactory(default_domain) def translate(request): localizer = request.localizer def auto_translate(string, *, domain=default_domain, mapping=None, context=None): if isinstance(string, str): string = tsf(string, context=context) return localizer.translate(string, domain=domain, mapping=mapping) return auto_translate def pluralize(request): localizer = request.localizer def auto_pluralize(singular, plural, n, *, domain=default_domain, mapping=None, context=None): if isinstance(singular, str): singular = tsf(singular, context=context) return localizer.pluralize(singular, plural, n, domain=domain, mapping=mapping) return auto_pluralize config.add_request_method(translate, property=True, reify=True) config.add_request_method(pluralize, property=True, reify=True) config.add_request_method(get_localizer, name='localize', property=True, reify=True) def includeme(config: Configurator): default_domain = config.get_settings().get('default_i18n_domain', config.package.__name__) configure_i18n(config, default_domain)
[ 1, 1053, 10876, 13, 13, 3166, 11451, 2572, 333, 29889, 2917, 1053, 12782, 332, 1061, 13, 3166, 11451, 2572, 333, 29889, 29875, 29896, 29947, 29876, 1053, 679, 29918, 2997, 3950, 29892, 4103, 18411, 1231, 5126, 13, 3166, 11451, 2572, 333, 29889, 7097, 2997, 1053, 679, 29918, 3784, 29918, 3827, 13, 13, 13, 1753, 788, 29918, 9482, 261, 29918, 23705, 1338, 29898, 3696, 1125, 13, 1678, 2009, 353, 1741, 29889, 657, 877, 3827, 1495, 13, 13, 1678, 565, 2009, 338, 6213, 29901, 13, 4706, 2009, 353, 679, 29918, 3784, 29918, 3827, 580, 13, 13, 1678, 1741, 1839, 29918, 2033, 353, 2009, 29889, 21652, 13, 1678, 1741, 1839, 657, 726, 2033, 353, 2009, 29889, 21652, 13, 1678, 1741, 1839, 29876, 657, 726, 2033, 353, 2009, 29889, 572, 3631, 675, 13, 1678, 1741, 1839, 2997, 3950, 2033, 353, 2009, 29889, 2997, 3950, 13, 13, 13, 1753, 10822, 29918, 29875, 29896, 29947, 29876, 29898, 2917, 29901, 12782, 332, 1061, 29892, 2322, 29918, 7247, 29901, 851, 1125, 13, 1678, 2295, 29889, 1202, 29918, 1491, 7588, 495, 29898, 1202, 29918, 9482, 261, 29918, 23705, 1338, 29892, 13, 462, 3986, 525, 2272, 2572, 333, 29889, 13604, 29889, 18743, 10716, 1495, 13, 1678, 2295, 29889, 1202, 29918, 1491, 7588, 495, 29898, 1202, 29918, 9482, 261, 29918, 23705, 1338, 29892, 13, 462, 3986, 525, 29873, 300, 29889, 1493, 1026, 29889, 29902, 18743, 1043, 1026, 10716, 1495, 13, 13, 1678, 2295, 29889, 1727, 6020, 29889, 1372, 29888, 353, 260, 4668, 353, 4103, 18411, 1231, 5126, 29898, 4381, 29918, 7247, 29897, 13, 13, 1678, 822, 14240, 29898, 3827, 1125, 13, 4706, 1887, 3950, 353, 2009, 29889, 2997, 3950, 13, 13, 4706, 822, 4469, 29918, 21652, 29898, 1807, 29892, 334, 29892, 5354, 29922, 4381, 29918, 7247, 29892, 10417, 29922, 8516, 29892, 3030, 29922, 8516, 1125, 13, 9651, 565, 338, 8758, 29898, 1807, 29892, 851, 1125, 13, 18884, 1347, 353, 260, 4668, 29898, 1807, 29892, 3030, 29922, 4703, 29897, 13, 13, 9651, 736, 1887, 3950, 29889, 21652, 29898, 1807, 29892, 5354, 29922, 7247, 29892, 10417, 29922, 20698, 29897, 13, 13, 4706, 736, 4469, 29918, 21652, 13, 13, 1678, 822, 715, 3631, 675, 29898, 3827, 1125, 13, 4706, 1887, 3950, 353, 2009, 29889, 2997, 3950, 13, 13, 4706, 822, 4469, 29918, 572, 3631, 675, 29898, 2976, 1070, 29892, 715, 3631, 29892, 302, 29892, 334, 29892, 5354, 29922, 4381, 29918, 7247, 29892, 10417, 29922, 8516, 29892, 3030, 29922, 8516, 1125, 13, 9651, 565, 338, 8758, 29898, 2976, 1070, 29892, 851, 1125, 13, 18884, 13512, 353, 260, 4668, 29898, 2976, 1070, 29892, 3030, 29922, 4703, 29897, 13, 13, 9651, 736, 1887, 3950, 29889, 572, 3631, 675, 29898, 2976, 1070, 29892, 715, 3631, 29892, 302, 29892, 5354, 29922, 7247, 29892, 10417, 29922, 20698, 29897, 13, 13, 4706, 736, 4469, 29918, 572, 3631, 675, 13, 13, 1678, 2295, 29889, 1202, 29918, 3827, 29918, 5696, 29898, 21652, 29892, 2875, 29922, 5574, 29892, 337, 1598, 29922, 5574, 29897, 13, 1678, 2295, 29889, 1202, 29918, 3827, 29918, 5696, 29898, 572, 3631, 675, 29892, 2875, 29922, 5574, 29892, 337, 1598, 29922, 5574, 29897, 13, 1678, 2295, 29889, 1202, 29918, 3827, 29918, 5696, 29898, 657, 29918, 2997, 3950, 29892, 1024, 2433, 2997, 675, 742, 2875, 29922, 5574, 29892, 337, 1598, 29922, 5574, 29897, 13, 13, 13, 1753, 3160, 1004, 29898, 2917, 29901, 12782, 332, 1061, 1125, 13, 1678, 2322, 29918, 7247, 353, 2295, 29889, 657, 29918, 11027, 2141, 657, 877, 4381, 29918, 29875, 29896, 29947, 29876, 29918, 7247, 742, 13, 462, 462, 1669, 2295, 29889, 5113, 17255, 978, 1649, 29897, 13, 1678, 10822, 29918, 29875, 29896, 29947, 29876, 29898, 2917, 29892, 2322, 29918, 7247, 29897, 13, 2 ]
Wrappers/Python/cil/processors/Masker.py
ClaireDelplancke/CCPi-Framework
30
75693
<reponame>ClaireDelplancke/CCPi-Framework # -*- coding: utf-8 -*- # This work is part of the Core Imaging Library (CIL) developed by CCPi # (Collaborative Computational Project in Tomographic Imaging), with # substantial contributions by UKRI-STFC and University of Manchester. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from cil.framework import DataProcessor, AcquisitionData, ImageData, ImageGeometry, DataContainer import warnings import numpy from scipy import interpolate class Masker(DataProcessor): r''' Processor to fill missing values provided by mask. Please use the desiried method to configure a processor for your needs. ''' @staticmethod def value(mask=None, value=0): r'''This sets the masked values of the input data to the requested value. :param mask: A boolean array with the same dimensions as input, where 'False' represents masked values. Mask can be generated using 'MaskGenerator' processor to identify outliers. :type mask: DataContainer, ImageData, AcquisitionData, numpy.ndarray :param value: values to be assigned to missing elements :type value: float, default=0 ''' processor = Masker(mode='value', mask=mask, value=value) return processor @staticmethod def mean(mask=None, axis=None): r'''This sets the masked values of the input data to the mean of the unmasked values across the array or axis. :param mask: A boolean array with the same dimensions as input, where 'False' represents masked values. Mask can be generated using 'MaskGenerator' processor to identify outliers. :type mask: DataContainer, ImageData, AcquisitionData, numpy.ndarray :param axis: specify axis as int or from 'dimension_labels' to calculate mean. :type axis: str, int ''' processor = Masker(mode='mean', mask=mask, axis=axis) return processor @staticmethod def median(mask=None, axis=None): r'''This sets the masked values of the input data to the median of the unmasked values across the array or axis. :param mask: A boolean array with the same dimensions as input, where 'False' represents masked values. Mask can be generated using 'MaskGenerator' processor to identify outliers. :type mask: DataContainer, ImageData, AcquisitionData, numpy.ndarray :param axis: specify axis as int or from 'dimension_labels' to calculate median. :type axis: str, int ''' processor = Masker(mode='median', mask=mask, axis=axis) return processor @staticmethod def interpolate(mask=None, axis=None, method='linear'): r'''This operates over the specified axis and uses 1D interpolation over remaining flattened array to fill in missing vaues. :param mask: A boolean array with the same dimensions as input, where 'False' represents masked values. Mask can be generated using 'MaskGenerator' processor to identify outliers. :type mask: DataContainer, ImageData, AcquisitionData, numpy.ndarray :param axis: specify axis as int or from 'dimension_labels' to loop over and perform 1D interpolation. :type axis: str, int :param method: One of the following interpoaltion methods: linear, nearest, zeros, linear, quadratic, cubic, previous, next :param method: str, default='linear' ''' processor = Masker(mode='interpolate', mask=mask, axis=axis, method=method) return processor def __init__(self, mask = None, mode = 'value', value = 0, axis = None, method = 'linear'): r'''Processor to fill missing values provided by mask. :param mask: A boolean array with the same dimensions as input, where 'False' represents masked values. Mask can be generated using 'MaskGenerator' processor to identify outliers. :type mask: DataContainer, ImageData, AcquisitionData, numpy.ndarray :param mode: a method to fill in missing values (value, mean, median, interpolate) :type mode: str, default=value :param value: substitute all outliers with a specific value :type value: float, default=0 :param axis: specify axis as int or from 'dimension_labels' to calculate mean or median in respective modes :type axis: str or int :param method: One of the following interpoaltion methods: linear, nearest, zeros, linear, quadratic, cubic, previous, next :param method: str, default='linear' :return: DataContainer or it's subclass with masked outliers :rtype: DataContainer or it's subclass ''' kwargs = {'mask': mask, 'mode': mode, 'value': value, 'axis': axis, 'method': method} super(Masker, self).__init__(**kwargs) def check_input(self, data): if self.mask is None: raise ValueError('Please, provide a mask.') if not (data.shape == self.mask.shape): raise Exception("Mask and Data must have the same shape." + "{} != {}".format(self.mask.mask, data.shape)) if hasattr(self.mask, 'dimension_labels') and data.dimension_labels != self.mask.dimension_labels: raise Exception("Mask and Data must have the same dimension labels." + "{} != {}".format(self.mask.dimension_labels, data.dimension_labels)) if self.mode not in ['value', 'mean', 'median', 'interpolate']: raise Exception("Wrong mode. One of the following is expected:\n" + "value, mean, median, interpolate") return True def process(self, out=None): data = self.get_input() return_arr = False if out is None: out = data.copy() arr = out.as_array() return_arr = True else: arr = out.as_array() #assumes mask has 'as_array' method, i.e. is a DataContainer or is a numpy array try: mask_arr = self.mask.as_array() except: mask_arr = self.mask try: mask_invert = ~mask_arr except TypeError: raise TypeError("Mask expected to be a boolean array got {}".format(mask_arr.dtype)) try: axis_index = data.dimension_labels.index(self.axis) except: if type(self.axis) == int: axis_index = self.axis else: axis_index = None if self.mode == 'value': arr[mask_invert] = self.value elif self.mode == 'mean' or self.mode == 'median': if axis_index is not None: ndim = data.number_of_dimensions slice_obj = [slice(None, None, 1)] * ndim for i in range(arr.shape[axis_index]): current_slice_obj = slice_obj[:] current_slice_obj[axis_index] = i current_slice_obj = tuple(current_slice_obj) slice_data = arr[current_slice_obj] if self.mode == 'mean': slice_data[mask_invert[current_slice_obj]] = numpy.mean(slice_data[mask_arr[current_slice_obj]]) else: slice_data[mask_invert[current_slice_obj]] = numpy.median(slice_data[mask_arr[current_slice_obj]]) arr[current_slice_obj] = slice_data else: if self.mode == 'mean': arr[mask_invert] = numpy.mean(arr[mask_arr]) else: arr[mask_invert] = numpy.median(arr[mask_arr]) elif self.mode == 'interpolate': if self.method not in ['linear', 'nearest', 'zeros', 'linear', \ 'quadratic', 'cubic', 'previous', 'next']: raise TypeError("Wrong interpolation method, one of the follwoing is expected:\n" + "linear, nearest, zeros, linear, quadratic, cubic, previous, next") ndim = data.number_of_dimensions shape = arr.shape if axis_index is None: raise NotImplementedError ('Currently Only 1D interpolation is available. Please specify an axis to interpolate over.') res_dim = 1 for i in range(ndim): if i != axis_index: res_dim *= shape[i] # get axis for 1D interpolation interp_axis = numpy.arange(shape[axis_index]) # loop over slice for i in range(res_dim): rest_shape = [] for j in range(ndim): if j != axis_index: rest_shape.append(shape[j]) rest_shape = tuple(rest_shape) rest_idx = numpy.unravel_index(i, rest_shape) k = 0 idx = [] for j in range(ndim): if j == axis_index: idx.append(slice(None,None,1)) else: idx.append(rest_idx[k]) k += 1 idx = tuple(idx) if numpy.any(mask_invert[idx]): tmp = arr[idx] f = interpolate.interp1d(interp_axis[mask_arr[idx]], tmp[mask_arr[idx]], fill_value='extrapolate', assume_sorted=True, kind=self.method) tmp[mask_invert[idx]] = f(numpy.where(mask_arr[idx] == False)[0]) arr[idx] = tmp else: raise ValueError('Mode is not recognised. One of the following is expected: ' + 'value, mean, median, interpolate') out.fill(arr) if return_arr is True: return out
[ 1, 529, 276, 1112, 420, 29958, 20216, 533, 13157, 9018, 10055, 29914, 4174, 12197, 29899, 16660, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 29937, 259, 910, 664, 338, 760, 310, 278, 10239, 1954, 6751, 9538, 313, 29907, 6227, 29897, 8906, 491, 315, 6271, 29875, 29871, 13, 29937, 259, 313, 28377, 3717, 1230, 11796, 1288, 8010, 297, 4335, 12122, 1954, 6751, 511, 411, 29871, 13, 29937, 259, 23228, 20706, 491, 10261, 3960, 29899, 1254, 8610, 322, 3014, 310, 19659, 29889, 13, 13, 29937, 259, 10413, 21144, 1090, 278, 13380, 19245, 29892, 10079, 29871, 29906, 29889, 29900, 313, 1552, 376, 29931, 293, 1947, 1496, 13, 29937, 259, 366, 1122, 451, 671, 445, 934, 5174, 297, 752, 13036, 411, 278, 19245, 29889, 13, 29937, 259, 887, 1122, 4017, 263, 3509, 310, 278, 19245, 472, 13, 13, 29937, 259, 1732, 597, 1636, 29889, 4288, 29889, 990, 29914, 506, 11259, 29914, 27888, 1430, 1660, 29899, 29906, 29889, 29900, 13, 13, 29937, 259, 25870, 3734, 491, 22903, 4307, 470, 15502, 304, 297, 5007, 29892, 7047, 13, 29937, 259, 13235, 1090, 278, 19245, 338, 13235, 373, 385, 376, 3289, 8519, 29908, 350, 3289, 3235, 29892, 13, 29937, 259, 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, 259, 2823, 278, 19245, 363, 278, 2702, 4086, 14765, 1076, 11239, 322, 13, 29937, 259, 27028, 1090, 278, 19245, 29889, 13, 13, 3166, 274, 309, 29889, 4468, 1053, 3630, 18689, 29892, 7255, 23493, 1469, 29892, 7084, 1469, 29892, 7084, 7999, 7843, 29892, 3630, 7895, 13, 5215, 18116, 13, 5215, 12655, 13, 3166, 4560, 2272, 1053, 20064, 403, 13, 13, 1990, 341, 1278, 261, 29898, 1469, 18689, 1125, 13, 1678, 364, 12008, 13, 1678, 10554, 272, 304, 5445, 4567, 1819, 4944, 491, 11105, 29889, 3529, 671, 278, 553, 29875, 1255, 1158, 304, 10822, 263, 21433, 363, 596, 4225, 29889, 13, 1678, 14550, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 995, 29898, 13168, 29922, 8516, 29892, 995, 29922, 29900, 1125, 13, 4706, 364, 12008, 4013, 6166, 278, 11105, 287, 1819, 310, 278, 1881, 848, 304, 278, 13877, 995, 29889, 13, 13, 4706, 584, 3207, 11105, 29901, 319, 7223, 1409, 411, 278, 1021, 13391, 408, 1881, 29892, 988, 525, 8824, 29915, 11524, 11105, 287, 1819, 29889, 341, 1278, 508, 367, 5759, 773, 525, 19832, 21575, 29915, 21433, 304, 12439, 714, 27801, 29889, 29871, 13, 4706, 584, 1853, 11105, 29901, 3630, 7895, 29892, 7084, 1469, 29892, 7255, 23493, 1469, 29892, 12655, 29889, 299, 2378, 13, 4706, 584, 3207, 995, 29901, 1819, 304, 367, 9859, 304, 4567, 3161, 13, 4706, 584, 1853, 995, 29901, 5785, 29892, 2322, 29922, 29900, 13, 4706, 14550, 13, 13, 4706, 21433, 353, 341, 1278, 261, 29898, 8513, 2433, 1767, 742, 11105, 29922, 13168, 29892, 995, 29922, 1767, 29897, 13, 13, 4706, 736, 21433, 13, 268, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 2099, 29898, 13168, 29922, 8516, 29892, 9685, 29922, 8516, 1125, 13, 4706, 364, 12008, 4013, 6166, 278, 11105, 287, 1819, 310, 278, 1881, 848, 304, 278, 2099, 310, 278, 443, 13168, 287, 1819, 4822, 278, 1409, 470, 9685, 29889, 13, 13, 4706, 584, 3207, 11105, 29901, 319, 7223, 1409, 411, 278, 1021, 13391, 408, 1881, 29892, 988, 525, 8824, 29915, 11524, 11105, 287, 1819, 29889, 341, 1278, 508, 367, 5759, 773, 525, 19832, 21575, 29915, 21433, 304, 12439, 714, 27801, 29889, 259, 13, 4706, 584, 1853, 11105, 29901, 3630, 7895, 29892, 7084, 1469, 29892, 7255, 23493, 1469, 29892, 12655, 29889, 299, 2378, 13, 4706, 584, 3207, 9685, 29901, 6084, 9685, 408, 938, 470, 515, 525, 6229, 2673, 29918, 21134, 29915, 304, 8147, 2099, 29889, 29871, 13, 4706, 584, 1853, 9685, 29901, 851, 29892, 938, 13, 4706, 14550, 13, 13, 4706, 21433, 353, 341, 1278, 261, 29898, 8513, 2433, 12676, 742, 11105, 29922, 13168, 29892, 9685, 29922, 8990, 29897, 13, 13, 4706, 736, 21433, 13, 268, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 19194, 29898, 13168, 29922, 8516, 29892, 9685, 29922, 8516, 1125, 13, 4706, 364, 12008, 4013, 6166, 278, 11105, 287, 1819, 310, 278, 1881, 848, 304, 278, 19194, 310, 278, 443, 13168, 287, 1819, 4822, 278, 1409, 470, 9685, 29889, 13, 13, 4706, 584, 3207, 11105, 29901, 319, 7223, 1409, 411, 278, 1021, 13391, 408, 1881, 29892, 988, 525, 8824, 29915, 11524, 11105, 287, 1819, 29889, 341, 1278, 508, 367, 5759, 773, 525, 19832, 21575, 29915, 21433, 304, 12439, 714, 27801, 29889, 259, 13, 4706, 584, 1853, 11105, 29901, 3630, 7895, 29892, 7084, 1469, 29892, 7255, 23493, 1469, 29892, 12655, 29889, 299, 2378, 13, 4706, 584, 3207, 9685, 29901, 6084, 9685, 408, 938, 470, 515, 525, 6229, 2673, 29918, 21134, 29915, 304, 8147, 19194, 29889, 29871, 13, 4706, 584, 1853, 9685, 29901, 851, 29892, 938, 13, 4706, 14550, 13, 13, 4706, 21433, 353, 341, 1278, 261, 29898, 8513, 2433, 2168, 713, 742, 11105, 29922, 13168, 29892, 9685, 29922, 8990, 29897, 13, 13, 4706, 736, 21433, 13, 268, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 20064, 403, 29898, 13168, 29922, 8516, 29892, 9685, 29922, 8516, 29892, 1158, 2433, 10660, 29374, 13, 4706, 364, 12008, 4013, 1751, 1078, 975, 278, 6790, 9685, 322, 3913, 29871, 29896, 29928, 29694, 975, 9886, 1652, 8606, 287, 1409, 304, 5445, 297, 4567, 325, 585, 267, 29889, 13, 13, 4706, 584, 3207, 11105, 29901, 319, 7223, 1409, 411, 278, 1021, 13391, 408, 1881, 29892, 988, 525, 8824, 29915, 11524, 11105, 287, 1819, 29889, 341, 1278, 508, 367, 5759, 773, 525, 19832, 21575, 29915, 21433, 304, 12439, 714, 27801, 29889, 259, 13, 4706, 584, 1853, 11105, 29901, 3630, 7895, 29892, 7084, 1469, 29892, 7255, 23493, 1469, 29892, 12655, 29889, 299, 2378, 13, 4706, 584, 3207, 9685, 29901, 6084, 9685, 408, 938, 470, 515, 525, 6229, 2673, 29918, 21134, 29915, 304, 2425, 975, 322, 2189, 29871, 29896, 29928, 29694, 29889, 29871, 13, 4706, 584, 1853, 9685, 29901, 851, 29892, 938, 13, 4706, 584, 3207, 1158, 29901, 3118, 310, 278, 1494, 1006, 1129, 1997, 291, 3519, 29901, 5608, 29892, 20471, 29892, 24786, 29892, 5608, 29892, 25904, 29892, 13630, 293, 29892, 3517, 29892, 2446, 13, 4706, 584, 3207, 1158, 29901, 851, 29892, 2322, 2433, 10660, 29915, 13, 4706, 14550, 13, 13, 4706, 21433, 353, 341, 1278, 261, 29898, 8513, 2433, 1639, 3733, 403, 742, 11105, 29922, 13168, 29892, 9685, 29922, 8990, 29892, 1158, 29922, 5696, 29897, 13, 13, 4706, 736, 21433, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 13, 462, 11105, 353, 6213, 29892, 13, 462, 4464, 353, 525, 1767, 742, 13, 462, 995, 353, 29871, 29900, 29892, 13, 462, 9685, 353, 6213, 29892, 13, 462, 1158, 353, 525, 10660, 29374, 13, 308, 13, 4706, 364, 12008, 18689, 304, 5445, 4567, 1819, 4944, 491, 11105, 29889, 13, 13, 4706, 584, 3207, 11105, 29901, 319, 7223, 1409, 411, 278, 1021, 13391, 408, 1881, 29892, 988, 525, 8824, 29915, 11524, 11105, 287, 1819, 29889, 341, 1278, 508, 367, 5759, 773, 525, 19832, 21575, 29915, 21433, 304, 12439, 714, 27801, 29889, 29871, 13, 4706, 584, 1853, 11105, 29901, 3630, 7895, 29892, 7084, 1469, 29892, 7255, 23493, 1469, 29892, 12655, 29889, 299, 2378, 13, 4706, 584, 3207, 4464, 29901, 263, 1158, 304, 5445, 297, 4567, 1819, 313, 1767, 29892, 2099, 29892, 19194, 29892, 20064, 403, 29897, 13, 4706, 584, 1853, 4464, 29901, 851, 29892, 2322, 29922, 1767, 13, 4706, 584, 3207, 995, 29901, 23764, 599, 714, 27801, 411, 263, 2702, 995, 13, 4706, 584, 1853, 995, 29901, 5785, 29892, 2322, 29922, 29900, 13, 4706, 584, 3207, 9685, 29901, 6084, 9685, 408, 938, 470, 515, 525, 6229, 2673, 29918, 21134, 29915, 304, 8147, 2099, 470, 19194, 297, 18067, 18893, 29871, 13, 4706, 584, 1853, 9685, 29901, 851, 470, 938, 13, 4706, 584, 3207, 1158, 29901, 3118, 310, 278, 1494, 1006, 1129, 1997, 291, 3519, 29901, 5608, 29892, 20471, 29892, 24786, 29892, 5608, 29892, 25904, 29892, 13630, 293, 29892, 3517, 29892, 2446, 13, 4706, 584, 3207, 1158, 29901, 851, 29892, 2322, 2433, 10660, 29915, 13, 4706, 584, 2457, 29901, 3630, 7895, 470, 372, 29915, 29879, 19481, 411, 11105, 287, 714, 27801, 13, 4706, 584, 29878, 1853, 29901, 3630, 7895, 470, 372, 29915, 29879, 19481, 1678, 13, 4706, 14550, 13, 13, 4706, 9049, 5085, 353, 11117, 13168, 2396, 11105, 29892, 13, 462, 29871, 525, 8513, 2396, 4464, 29892, 13, 462, 29871, 525, 1767, 2396, 995, 29892, 13, 462, 29871, 525, 8990, 2396, 9685, 29892, 13, 462, 29871, 525, 5696, 2396, 1158, 29913, 13, 13, 4706, 2428, 29898, 19832, 261, 29892, 1583, 467, 1649, 2344, 12035, 1068, 19290, 29897, 13, 268, 13, 1678, 822, 1423, 29918, 2080, 29898, 1311, 29892, 848, 1125, 13, 13, 4706, 565, 1583, 29889, 13168, 338, 6213, 29901, 13, 9651, 12020, 7865, 2392, 877, 12148, 29892, 3867, 263, 11105, 29889, 1495, 13, 13, 4706, 565, 451, 313, 1272, 29889, 12181, 1275, 1583, 29889, 13168, 29889, 12181, 1125, 13, 9651, 12020, 8960, 703, 19832, 322, 3630, 1818, 505, 278, 1021, 8267, 1213, 718, 29871, 13, 462, 9651, 376, 8875, 2804, 6571, 1642, 4830, 29898, 1311, 29889, 13168, 29889, 13168, 29892, 848, 29889, 12181, 876, 13, 308, 13, 4706, 565, 756, 5552, 29898, 1311, 29889, 13168, 29892, 525, 6229, 2673, 29918, 21134, 1495, 322, 848, 29889, 6229, 2673, 29918, 21134, 2804, 1583, 29889, 13168, 29889, 6229, 2673, 29918, 21134, 29901, 13, 9651, 12020, 8960, 703, 19832, 322, 3630, 1818, 505, 278, 1021, 9927, 11073, 1213, 718, 29871, 13, 462, 9651, 376, 8875, 2804, 6571, 1642, 4830, 29898, 1311, 29889, 13168, 29889, 6229, 2673, 29918, 21134, 29892, 848, 29889, 6229, 2673, 29918, 21134, 876, 13, 13, 4706, 565, 1583, 29889, 8513, 451, 297, 6024, 1767, 742, 525, 12676, 742, 525, 2168, 713, 742, 525, 1639, 3733, 403, 2033, 29901, 13, 9651, 12020, 8960, 703, 29956, 29373, 4464, 29889, 3118, 310, 278, 1494, 338, 3806, 3583, 29876, 29908, 718, 29871, 13, 462, 9651, 376, 1767, 29892, 2099, 29892, 19194, 29892, 20064, 403, 1159, 13, 268, 13, 4706, 736, 5852, 29871, 13, 13, 1678, 822, 1889, 29898, 1311, 29892, 714, 29922, 8516, 1125, 13, 308, 13, 4706, 848, 353, 1583, 29889, 657, 29918, 2080, 580, 13, 308, 13, 4706, 736, 29918, 2749, 353, 7700, 13, 4706, 565, 714, 338, 6213, 29901, 13, 9651, 714, 353, 848, 29889, 8552, 580, 13, 9651, 3948, 353, 714, 29889, 294, 29918, 2378, 580, 13, 9651, 736, 29918, 2749, 353, 5852, 13, 4706, 1683, 29901, 13, 9651, 3948, 353, 714, 29889, 294, 29918, 2378, 580, 13, 308, 13, 4706, 396, 465, 9351, 11105, 756, 525, 294, 29918, 2378, 29915, 1158, 29892, 474, 29889, 29872, 29889, 338, 263, 3630, 7895, 470, 338, 263, 12655, 1409, 13, 4706, 1018, 29901, 13, 9651, 11105, 29918, 2749, 353, 1583, 29889, 13168, 29889, 294, 29918, 2378, 580, 13, 4706, 5174, 29901, 13, 9651, 11105, 29918, 2749, 353, 1583, 29889, 13168, 13, 13, 4706, 1018, 29901, 13, 9651, 11105, 29918, 262, 1765, 353, 3695, 13168, 29918, 2749, 13, 4706, 5174, 20948, 29901, 13, 9651, 12020, 20948, 703, 19832, 3806, 304, 367, 263, 7223, 1409, 2355, 6571, 1642, 4830, 29898, 13168, 29918, 2749, 29889, 29881, 1853, 876, 13, 13, 4706, 1018, 29901, 13, 9651, 9685, 29918, 2248, 353, 848, 29889, 6229, 2673, 29918, 21134, 29889, 2248, 29898, 1311, 29889, 8990, 29897, 795, 13, 4706, 5174, 29901, 13, 9651, 565, 1134, 29898, 1311, 29889, 8990, 29897, 1275, 938, 29901, 13, 18884, 9685, 29918, 2248, 353, 1583, 29889, 8990, 13, 9651, 1683, 29901, 13, 18884, 9685, 29918, 2248, 353, 6213, 13, 308, 13, 4706, 565, 1583, 29889, 8513, 1275, 525, 1767, 2396, 13, 632, 13, 9651, 3948, 29961, 13168, 29918, 262, 1765, 29962, 353, 1583, 29889, 1767, 13, 308, 13, 4706, 25342, 1583, 29889, 8513, 1275, 525, 12676, 29915, 470, 1583, 29889, 8513, 1275, 525, 2168, 713, 2396, 13, 632, 13, 9651, 565, 9685, 29918, 2248, 338, 451, 6213, 29901, 13, 462, 13, 462, 299, 326, 353, 848, 29889, 4537, 29918, 974, 29918, 6229, 5580, 13, 462, 268, 13, 18884, 22780, 29918, 5415, 353, 518, 18337, 29898, 8516, 29892, 6213, 29892, 29871, 29896, 4638, 334, 29871, 299, 326, 13, 462, 632, 13, 18884, 363, 474, 297, 3464, 29898, 2749, 29889, 12181, 29961, 8990, 29918, 2248, 29962, 1125, 13, 462, 1678, 1857, 29918, 18337, 29918, 5415, 353, 22780, 29918, 5415, 7503, 29962, 13, 462, 1678, 1857, 29918, 18337, 29918, 5415, 29961, 8990, 29918, 2248, 29962, 353, 474, 13, 462, 1678, 1857, 29918, 18337, 29918, 5415, 353, 18761, 29898, 3784, 29918, 18337, 29918, 5415, 29897, 13, 462, 1678, 22780, 29918, 1272, 353, 3948, 29961, 3784, 29918, 18337, 29918, 5415, 29962, 13, 462, 1678, 565, 1583, 29889, 8513, 1275, 525, 12676, 2396, 13, 462, 4706, 22780, 29918, 1272, 29961, 13168, 29918, 262, 1765, 29961, 3784, 29918, 18337, 29918, 5415, 5262, 353, 12655, 29889, 12676, 29898, 18337, 29918, 1272, 29961, 13168, 29918, 2749, 29961, 3784, 29918, 18337, 29918, 5415, 24960, 13, 462, 1678, 1683, 29901, 13, 462, 4706, 22780, 29918, 1272, 29961, 13168, 29918, 262, 1765, 29961, 3784, 29918, 18337, 29918, 5415, 5262, 353, 12655, 29889, 2168, 713, 29898, 18337, 29918, 1272, 29961, 13168, 29918, 2749, 29961, 3784, 29918, 18337, 29918, 5415, 24960, 13, 462, 1678, 3948, 29961, 3784, 29918, 18337, 29918, 5415, 29962, 353, 22780, 29918, 1272, 13, 462, 13, 9651, 1683, 29901, 13, 13, 18884, 565, 1583, 29889, 8513, 1275, 525, 12676, 2396, 13, 462, 1678, 3948, 29961, 13168, 29918, 262, 1765, 29962, 353, 12655, 29889, 12676, 29898, 2749, 29961, 13168, 29918, 2749, 2314, 29871, 13, 18884, 1683, 29901, 13, 462, 1678, 3948, 29961, 13168, 29918, 262, 1765, 29962, 353, 12655, 29889, 2168, 713, 29898, 2749, 29961, 13168, 29918, 2749, 2314, 29871, 13, 308, 13, 4706, 25342, 1583, 29889, 8513, 1275, 525, 1639, 3733, 403, 2396, 13, 9651, 565, 1583, 29889, 5696, 451, 297, 6024, 10660, 742, 525, 28502, 342, 742, 525, 3298, 359, 742, 525, 10660, 742, 320, 13, 462, 462, 4706, 525, 3425, 29878, 2454, 742, 525, 29883, 431, 293, 742, 525, 24957, 742, 525, 4622, 2033, 29901, 13, 18884, 12020, 20948, 703, 29956, 29373, 29694, 1158, 29892, 697, 310, 278, 900, 29880, 827, 292, 338, 3806, 3583, 29876, 29908, 718, 29871, 13, 462, 18884, 376, 10660, 29892, 20471, 29892, 24786, 29892, 5608, 29892, 25904, 29892, 13630, 293, 29892, 3517, 29892, 2446, 1159, 13, 632, 13, 632, 299, 326, 353, 848, 29889, 4537, 29918, 974, 29918, 6229, 5580, 13, 9651, 8267, 353, 3948, 29889, 12181, 13, 632, 13, 9651, 565, 9685, 29918, 2248, 338, 6213, 29901, 13, 18884, 12020, 2216, 1888, 2037, 287, 2392, 6702, 7583, 368, 9333, 29871, 29896, 29928, 29694, 338, 3625, 29889, 3529, 6084, 385, 9685, 304, 20064, 403, 975, 29889, 1495, 13, 632, 13, 9651, 620, 29918, 6229, 353, 29871, 29896, 13, 9651, 363, 474, 297, 3464, 29898, 299, 326, 1125, 13, 18884, 565, 474, 2804, 9685, 29918, 2248, 29901, 13, 462, 1678, 620, 29918, 6229, 334, 29922, 8267, 29961, 29875, 29962, 13, 632, 13, 9651, 396, 679, 9685, 363, 29871, 29896, 29928, 29694, 13, 9651, 1006, 29886, 29918, 8990, 353, 12655, 29889, 279, 927, 29898, 12181, 29961, 8990, 29918, 2248, 2314, 13, 632, 13, 9651, 396, 2425, 975, 22780, 13, 9651, 363, 474, 297, 3464, 29898, 690, 29918, 6229, 1125, 13, 462, 13, 18884, 1791, 29918, 12181, 353, 5159, 13, 18884, 363, 432, 297, 3464, 29898, 299, 326, 1125, 13, 462, 1678, 565, 432, 2804, 9685, 29918, 2248, 29901, 13, 462, 4706, 1791, 29918, 12181, 29889, 4397, 29898, 12181, 29961, 29926, 2314, 13, 18884, 1791, 29918, 12181, 353, 18761, 29898, 5060, 29918, 12181, 29897, 13, 462, 13, 18884, 1791, 29918, 13140, 353, 12655, 29889, 348, 336, 955, 29918, 2248, 29898, 29875, 29892, 1791, 29918, 12181, 29897, 13, 462, 13, 18884, 413, 353, 29871, 29900, 13, 18884, 22645, 353, 5159, 13, 18884, 363, 432, 297, 3464, 29898, 299, 326, 1125, 13, 462, 1678, 565, 432, 1275, 9685, 29918, 2248, 29901, 13, 462, 4706, 22645, 29889, 4397, 29898, 18337, 29898, 8516, 29892, 8516, 29892, 29896, 876, 13, 462, 1678, 1683, 29901, 13, 462, 4706, 22645, 29889, 4397, 29898, 5060, 29918, 13140, 29961, 29895, 2314, 13, 462, 4706, 413, 4619, 29871, 29896, 13, 18884, 22645, 353, 18761, 29898, 13140, 29897, 13, 462, 13, 18884, 565, 12655, 29889, 1384, 29898, 13168, 29918, 262, 1765, 29961, 13140, 29962, 1125, 13, 462, 1678, 13128, 353, 3948, 29961, 13140, 29962, 13, 462, 1678, 285, 353, 20064, 403, 29889, 1639, 29886, 29896, 29881, 29898, 1639, 29886, 29918, 8990, 29961, 13168, 29918, 2749, 29961, 13140, 20526, 13128, 29961, 13168, 29918, 2749, 29961, 13140, 20526, 29871, 13, 462, 462, 9651, 5445, 29918, 1767, 2433, 1062, 2390, 23167, 742, 13, 462, 462, 9651, 5251, 29918, 24582, 29922, 5574, 29892, 13, 462, 462, 9651, 2924, 29922, 1311, 29889, 5696, 29897, 13, 462, 1678, 13128, 29961, 13168, 29918, 262, 1765, 29961, 13140, 5262, 353, 285, 29898, 23749, 29889, 3062, 29898, 13168, 29918, 2749, 29961, 13140, 29962, 1275, 7700, 9601, 29900, 2314, 13, 462, 1678, 3948, 29961, 13140, 29962, 353, 13128, 13, 308, 13, 4706, 1683, 29901, 13, 9651, 12020, 7865, 2392, 877, 6818, 338, 451, 5936, 3368, 29889, 3118, 310, 278, 1494, 338, 3806, 29901, 525, 718, 29871, 13, 462, 795, 525, 1767, 29892, 2099, 29892, 19194, 29892, 20064, 403, 1495, 13, 308, 13, 4706, 714, 29889, 5589, 29898, 2749, 29897, 13, 13, 4706, 565, 736, 29918, 2749, 338, 5852, 29901, 13, 9651, 736, 714, 13, 2 ]
mpf/devices/segment_display/transitions.py
haggispinball/mpf_fathom_fast
163
64855
"""Text transitions used for segment displays.""" import abc from typing import Optional, List from mpf.core.placeholder_manager import TextTemplate from mpf.core.rgb_color import RGBColor from mpf.devices.segment_display.segment_display_text import SegmentDisplayText, UncoloredSegmentDisplayText STEP_OUT_OF_RANGE_ERROR = "Step is out of range" TRANSITION_DIRECTION_UNKNOWN_ERROR = "Transition uses an unknown direction value" class TransitionBase(metaclass=abc.ABCMeta): """Base class for text transitions in segment displays.""" __slots__ = ["output_length", "config", "collapse_dots", "collapse_commas"] def __init__(self, output_length: int, collapse_dots: bool, collapse_commas: bool, config: dict) -> None: """Initialize the transition.""" self.output_length = output_length self.config = config self.collapse_dots = collapse_dots self.collapse_commas = collapse_commas for key, value in config.items(): if hasattr(self, key): setattr(self, key, value) @abc.abstractmethod def get_step_count(self): """Return the total number of steps required for the transition.""" raise NotImplementedError # pylint: disable=too-many-arguments @abc.abstractmethod def get_transition_step(self, step: int, current_text: str, new_text: str, current_colors: Optional[List[RGBColor]] = None, new_colors: Optional[List[RGBColor]] = None) -> SegmentDisplayText: """Calculate all the steps in the transition.""" raise NotImplementedError class TransitionRunner: """Class to run/execute transitions using an iterator.""" __slots__ = ["_transition", "_step", "_current_placeholder", "_new_placeholder", "_current_colors", "_new_colors"] # pylint: disable=too-many-arguments def __init__(self, machine, transition: TransitionBase, current_text: str, new_text: str, current_colors: Optional[List[RGBColor]] = None, new_colors: Optional[List[RGBColor]] = None) -> None: """Class initializer.""" self._transition = transition self._step = 0 self._current_placeholder = TextTemplate(machine, current_text) self._new_placeholder = TextTemplate(machine, new_text) self._current_colors = current_colors self._new_colors = new_colors def __iter__(self): """Return the iterator.""" return self def __next__(self): """Evaluate and return the next transition step.""" if self._step >= self._transition.get_step_count(): raise StopIteration transition_step = self._transition.get_transition_step(self._step, self._current_placeholder.evaluate({}), self._new_placeholder.evaluate({}), self._current_colors, self._new_colors) self._step += 1 return transition_step class NoTransition(TransitionBase): """Segment display no transition effect.""" def get_step_count(self): """Return the total number of steps required for the transition.""" return 1 # pylint: disable=too-many-arguments def get_transition_step(self, step: int, current_text: str, new_text: str, current_colors: Optional[List[RGBColor]] = None, new_colors: Optional[List[RGBColor]] = None) -> SegmentDisplayText: """Calculate all the steps in the transition.""" if step < 0 or step >= self.get_step_count(): raise AssertionError(STEP_OUT_OF_RANGE_ERROR) return SegmentDisplayText.from_str(new_text, self.output_length, self.collapse_dots, self.collapse_commas, new_colors) class PushTransition(TransitionBase): """Segment display push transition effect.""" def __init__(self, output_length: int, collapse_dots: bool, collapse_commas: bool, config: dict) -> None: """Class initializer.""" self.direction = 'right' self.text = None self.text_color = None super().__init__(output_length, collapse_dots, collapse_commas, config) if self.text is None: self.text = '' def get_step_count(self): """Return the total number of steps required for the transition.""" return self.output_length + len(self.text) # pylint: disable=too-many-arguments def get_transition_step(self, step: int, current_text: str, new_text: str, current_colors: Optional[List[RGBColor]] = None, new_colors: Optional[List[RGBColor]] = None) -> SegmentDisplayText: """Calculate all the steps in the transition.""" if step < 0 or step >= self.get_step_count(): raise AssertionError(STEP_OUT_OF_RANGE_ERROR) current_display_text = SegmentDisplayText.from_str(current_text, self.output_length, self.collapse_dots, self.collapse_commas, current_colors) new_display_text = SegmentDisplayText.from_str(new_text, self.output_length, self.collapse_dots, self.collapse_commas, new_colors) if self.text: if new_colors and not self.text_color: text_color = [new_colors[0]] else: text_color = self.text_color transition_text = SegmentDisplayText.from_str(self.text, len(self.text), self.collapse_dots, self.collapse_commas, text_color) else: transition_text = UncoloredSegmentDisplayText([], self.collapse_dots, self.collapse_commas) if self.direction == 'right': temp_list = new_display_text temp_list.extend(transition_text) temp_list.extend(current_display_text) return temp_list[ self.output_length + len(self.text) - (step + 1):2 * self.output_length + len( self.text) - (step + 1)] if self.direction == 'left': temp_list = current_display_text temp_list.extend(transition_text) temp_list.extend(new_display_text) return temp_list[step + 1:step + 1 + self.output_length] raise AssertionError(TRANSITION_DIRECTION_UNKNOWN_ERROR) class CoverTransition(TransitionBase): """Segment display cover transition effect.""" def __init__(self, output_length: int, collapse_dots: bool, collapse_commas: bool, config: dict) -> None: """Class initializer.""" self.direction = 'right' self.text = None self.text_color = None super().__init__(output_length, collapse_dots, collapse_commas, config) if self.text is None: self.text = '' def get_step_count(self): """Return the total number of steps required for the transition.""" return self.output_length + len(self.text) # pylint: disable=too-many-arguments def get_transition_step(self, step: int, current_text: str, new_text: str, current_colors: Optional[List[RGBColor]] = None, new_colors: Optional[List[RGBColor]] = None) -> SegmentDisplayText: """Calculate all the steps in the transition.""" if step < 0 or step >= self.get_step_count(): raise AssertionError(STEP_OUT_OF_RANGE_ERROR) current_display_text = SegmentDisplayText.from_str(current_text, self.output_length, self.collapse_dots, self.collapse_commas, current_colors) new_display_text = SegmentDisplayText.from_str(new_text, self.output_length, self.collapse_dots, self.collapse_commas, new_colors) if self.text: if new_colors and not self.text_color: text_color = [new_colors[0]] else: text_color = self.text_color transition_text = SegmentDisplayText.from_str(self.text, len(self.text), self.collapse_dots, self.collapse_commas, text_color) else: transition_text = UncoloredSegmentDisplayText([], self.collapse_dots, self.collapse_commas) if self.direction == 'right': new_extended_display_text = new_display_text new_extended_display_text.extend(transition_text) if step < self.output_length: temp_text = new_extended_display_text[-(step + 1):] temp_text.extend(current_display_text[step + 1:]) else: temp_text = new_display_text[-(step + 1):-(step + 1) + self.output_length] return temp_text if self.direction == 'left': new_extended_display_text = transition_text new_extended_display_text.extend(new_display_text) if step < self.output_length: temp_text = current_display_text[:self.output_length - (step + 1)] temp_text.extend(new_extended_display_text[:step + 1]) else: temp_text = new_extended_display_text[step - self.output_length + 1:step + 1] return temp_text raise AssertionError(TRANSITION_DIRECTION_UNKNOWN_ERROR) class UncoverTransition(TransitionBase): """Segment display uncover transition effect.""" def __init__(self, output_length: int, collapse_dots: bool, collapse_commas: bool, config: dict) -> None: """Class initializer.""" self.direction = 'right' self.text = None self.text_color = None super().__init__(output_length, collapse_dots, collapse_commas, config) if self.text is None: self.text = '' def get_step_count(self): """Return the total number of steps required for the transition.""" return self.output_length + len(self.text) # pylint: disable=too-many-arguments def get_transition_step(self, step: int, current_text: str, new_text: str, current_colors: Optional[List[RGBColor]] = None, new_colors: Optional[List[RGBColor]] = None) -> SegmentDisplayText: """Calculate all the steps in the transition.""" if step < 0 or step >= self.get_step_count(): raise AssertionError(STEP_OUT_OF_RANGE_ERROR) current_display_text = SegmentDisplayText.from_str(current_text, self.output_length, self.collapse_dots, self.collapse_commas, current_colors) new_display_text = SegmentDisplayText.from_str(new_text, self.output_length, self.collapse_dots, self.collapse_commas, new_colors) if self.text: if new_colors and not self.text_color: text_color = [new_colors[0]] else: text_color = self.text_color transition_text = SegmentDisplayText.from_str(self.text, len(self.text), self.collapse_dots, self.collapse_commas, text_color) else: transition_text = UncoloredSegmentDisplayText([], self.collapse_dots, self.collapse_commas) if self.direction == 'right': current_extended_display_text = transition_text current_extended_display_text.extend(current_display_text) if step < len(self.text): temp_text = current_extended_display_text[ len(self.text) - step - 1:len(self.text) - step - 1 + self.output_length] else: temp_text = new_display_text[:step - len(self.text) + 1] temp_text.extend(current_extended_display_text[:self.output_length - len(temp_text)]) return temp_text if self.direction == 'left': current_extended_display_text = current_display_text current_extended_display_text.extend(transition_text) if step < len(self.text): temp_text = current_extended_display_text[step + 1:step + 1 + self.output_length] else: temp_text = current_display_text[step + 1:] temp_text.extend(new_display_text[-(self.output_length - len(temp_text)):]) return temp_text raise AssertionError(TRANSITION_DIRECTION_UNKNOWN_ERROR) class WipeTransition(TransitionBase): """Segment display wipe transition effect.""" def __init__(self, output_length: int, collapse_dots: bool, collapse_commas: bool, config: dict) -> None: """Class initializer.""" self.direction = 'right' self.text = None self.text_color = None super().__init__(output_length, collapse_dots, collapse_commas, config) if self.text is None: self.text = '' def get_step_count(self): """Return the total number of steps required for the transition.""" return self.output_length + len(self.text) # pylint: disable=too-many-arguments,too-many-branches,too-many-return-statements def get_transition_step(self, step: int, current_text: str, new_text: str, current_colors: Optional[List[RGBColor]] = None, new_colors: Optional[List[RGBColor]] = None) -> SegmentDisplayText: """Calculate all the steps in the transition.""" if step < 0 or step >= self.get_step_count(): raise AssertionError(STEP_OUT_OF_RANGE_ERROR) current_display_text = SegmentDisplayText.from_str(current_text, self.output_length, self.collapse_dots, self.collapse_commas, current_colors) new_display_text = SegmentDisplayText.from_str(new_text, self.output_length, self.collapse_dots, self.collapse_commas, new_colors) if self.text: if new_colors and not self.text_color: text_color = [new_colors[0]] else: text_color = self.text_color transition_text = SegmentDisplayText.from_str(self.text, len(self.text), self.collapse_dots, self.collapse_commas, text_color) else: transition_text = UncoloredSegmentDisplayText([], self.collapse_dots, self.collapse_commas) if self.direction == 'right': if step < len(self.text): temp_text = transition_text[-(step + 1):] temp_text.extend(current_display_text[step + 1:]) elif step < self.output_length: temp_text = new_display_text[:step - len(self.text) + 1] temp_text.extend(transition_text) temp_text.extend(current_display_text[len(temp_text):]) else: temp_text = new_display_text[:step - len(self.text) + 1] temp_text.extend(transition_text[:self.output_length - len(temp_text)]) return temp_text if self.direction == 'left': if step < len(self.text): temp_text = current_display_text[:self.output_length - (step + 1)] temp_text.extend(transition_text[:step + 1]) elif step < self.output_length: temp_text = current_display_text[:self.output_length - (step + 1)] temp_text.extend(transition_text) temp_text.extend(new_display_text[len(temp_text):]) elif step < self.output_length + len(self.text) - 1: temp_text = transition_text[step - (self.output_length + len(self.text)) + 1:] temp_text.extend(new_display_text[-(self.output_length - len(temp_text)):]) else: temp_text = new_display_text return temp_text raise AssertionError(TRANSITION_DIRECTION_UNKNOWN_ERROR) class SplitTransition(TransitionBase): """Segment display split transition effect.""" def __init__(self, output_length: int, collapse_dots: bool, collapse_commas: bool, config: dict) -> None: """Class initializer.""" self.direction = 'out' self.mode = 'push' super().__init__(output_length, collapse_dots, collapse_commas, config) def get_step_count(self): """Return the total number of steps required for the transition.""" return int((self.output_length + 1) / 2) # pylint: disable=too-many-arguments,too-many-branches,too-many-return-statements def get_transition_step(self, step: int, current_text: str, new_text: str, current_colors: Optional[List[RGBColor]] = None, new_colors: Optional[List[RGBColor]] = None) -> SegmentDisplayText: """Calculate all the steps in the transition.""" if step < 0 or step >= self.get_step_count(): raise AssertionError(STEP_OUT_OF_RANGE_ERROR) current_display_text = SegmentDisplayText.from_str(current_text, self.output_length, self.collapse_dots, self.collapse_commas, current_colors) new_display_text = SegmentDisplayText.from_str(new_text, self.output_length, self.collapse_dots, self.collapse_commas, new_colors) if self.mode == 'push': if self.direction == 'out': if step == self.get_step_count() - 1: return new_display_text characters = int(self.output_length / 2) split_point = characters if characters * 2 == self.output_length: characters -= 1 else: split_point += 1 characters -= step temp_text = current_display_text[split_point - characters:split_point] temp_text.extend(new_display_text[characters:characters + (self.output_length - 2 * characters)]) temp_text.extend(current_display_text[split_point:split_point + characters]) return temp_text if self.direction == 'in': if step == self.get_step_count() - 1: return new_display_text split_point = int(self.output_length / 2) characters = 1 if split_point * 2 < self.output_length: split_point += 1 characters += step temp_text = new_display_text[split_point - characters:split_point] temp_text.extend(current_display_text[characters:characters + (self.output_length - 2 * characters)]) temp_text.extend(new_display_text[split_point:split_point + characters]) return temp_text raise AssertionError(TRANSITION_DIRECTION_UNKNOWN_ERROR) if self.mode == 'wipe': if self.direction == 'out': if step == self.get_step_count() - 1: return new_display_text characters = int(self.output_length / 2) if characters * 2 == self.output_length: characters -= 1 characters -= step temp_text = current_display_text[:characters] temp_text.extend(new_display_text[characters:characters + (self.output_length - 2 * characters)]) temp_text.extend(current_display_text[-characters:]) return temp_text if self.direction == 'in': if step == self.get_step_count() - 1: return new_display_text temp_text = new_display_text[:step + 1] temp_text.extend(current_display_text[step + 1:step + 1 + (self.output_length - 2 * len(temp_text))]) temp_text.extend(new_display_text[-(step + 1):]) return temp_text raise AssertionError(TRANSITION_DIRECTION_UNKNOWN_ERROR) raise AssertionError("Transition uses an unknown mode value")
[ 1, 9995, 1626, 1301, 2187, 1304, 363, 10768, 14423, 1213, 15945, 13, 5215, 25638, 13, 3166, 19229, 1053, 28379, 29892, 2391, 13, 13, 3166, 286, 7810, 29889, 3221, 29889, 27074, 29918, 12847, 1053, 3992, 6733, 13, 3166, 286, 7810, 29889, 3221, 29889, 23973, 29918, 2780, 1053, 390, 7210, 3306, 13, 3166, 286, 7810, 29889, 3359, 1575, 29889, 28192, 29918, 4990, 29889, 28192, 29918, 4990, 29918, 726, 1053, 6667, 358, 9323, 1626, 29892, 853, 2780, 287, 17669, 358, 9323, 1626, 13, 13, 1254, 15488, 29918, 12015, 29918, 9800, 29918, 29934, 24336, 29918, 11432, 353, 376, 14448, 338, 714, 310, 3464, 29908, 13, 26813, 29903, 22122, 29918, 4571, 1525, 9838, 29918, 3904, 29968, 6632, 16048, 29918, 11432, 353, 376, 4300, 654, 3913, 385, 9815, 5305, 995, 29908, 13, 13, 13, 1990, 4103, 654, 5160, 29898, 2527, 562, 605, 29922, 10736, 29889, 19658, 19346, 1125, 13, 13, 1678, 9995, 5160, 770, 363, 1426, 1301, 2187, 297, 10768, 14423, 1213, 15945, 13, 13, 1678, 4770, 2536, 1862, 1649, 353, 6796, 4905, 29918, 2848, 613, 376, 2917, 613, 376, 27756, 29918, 7778, 613, 376, 27756, 29918, 2055, 294, 3108, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1962, 29918, 2848, 29901, 938, 29892, 24382, 29918, 7778, 29901, 6120, 29892, 24382, 29918, 2055, 294, 29901, 6120, 29892, 2295, 29901, 9657, 29897, 1599, 6213, 29901, 13, 4706, 9995, 6644, 6646, 278, 9558, 1213, 15945, 13, 4706, 1583, 29889, 4905, 29918, 2848, 353, 1962, 29918, 2848, 13, 4706, 1583, 29889, 2917, 353, 2295, 13, 4706, 1583, 29889, 27756, 29918, 7778, 353, 24382, 29918, 7778, 13, 4706, 1583, 29889, 27756, 29918, 2055, 294, 353, 24382, 29918, 2055, 294, 13, 13, 4706, 363, 1820, 29892, 995, 297, 2295, 29889, 7076, 7295, 13, 9651, 565, 756, 5552, 29898, 1311, 29892, 1820, 1125, 13, 18884, 731, 5552, 29898, 1311, 29892, 1820, 29892, 995, 29897, 13, 13, 1678, 732, 10736, 29889, 16595, 5696, 13, 1678, 822, 679, 29918, 10568, 29918, 2798, 29898, 1311, 1125, 13, 4706, 9995, 11609, 278, 3001, 1353, 310, 6576, 3734, 363, 278, 9558, 1213, 15945, 13, 4706, 12020, 2216, 1888, 2037, 287, 2392, 13, 13, 1678, 396, 282, 2904, 524, 29901, 11262, 29922, 517, 29877, 29899, 13011, 29899, 25699, 13, 1678, 732, 10736, 29889, 16595, 5696, 13, 1678, 822, 679, 29918, 20543, 29918, 10568, 29898, 1311, 29892, 4331, 29901, 938, 29892, 1857, 29918, 726, 29901, 851, 29892, 716, 29918, 726, 29901, 851, 29892, 13, 462, 9651, 1857, 29918, 27703, 29901, 28379, 29961, 1293, 29961, 28212, 3306, 5262, 353, 6213, 29892, 13, 462, 9651, 716, 29918, 27703, 29901, 28379, 29961, 1293, 29961, 28212, 3306, 5262, 353, 6213, 29897, 1599, 6667, 358, 9323, 1626, 29901, 13, 4706, 9995, 27065, 403, 599, 278, 6576, 297, 278, 9558, 1213, 15945, 13, 4706, 12020, 2216, 1888, 2037, 287, 2392, 13, 13, 13, 1990, 4103, 654, 16802, 29901, 13, 13, 1678, 9995, 2385, 304, 1065, 29914, 7978, 1301, 2187, 773, 385, 20380, 1213, 15945, 13, 13, 1678, 4770, 2536, 1862, 1649, 353, 6796, 29918, 20543, 613, 11119, 10568, 613, 11119, 3784, 29918, 27074, 613, 11119, 1482, 29918, 27074, 613, 11119, 3784, 29918, 27703, 613, 11119, 1482, 29918, 27703, 3108, 13, 13, 1678, 396, 282, 2904, 524, 29901, 11262, 29922, 517, 29877, 29899, 13011, 29899, 25699, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 4933, 29892, 9558, 29901, 4103, 654, 5160, 29892, 1857, 29918, 726, 29901, 851, 29892, 716, 29918, 726, 29901, 851, 29892, 13, 462, 1857, 29918, 27703, 29901, 28379, 29961, 1293, 29961, 28212, 3306, 5262, 353, 6213, 29892, 13, 462, 716, 29918, 27703, 29901, 28379, 29961, 1293, 29961, 28212, 3306, 5262, 353, 6213, 29897, 1599, 6213, 29901, 13, 4706, 9995, 2385, 2847, 3950, 1213, 15945, 13, 4706, 1583, 3032, 20543, 353, 9558, 13, 4706, 1583, 3032, 10568, 353, 29871, 29900, 13, 4706, 1583, 3032, 3784, 29918, 27074, 353, 3992, 6733, 29898, 23523, 29892, 1857, 29918, 726, 29897, 13, 4706, 1583, 3032, 1482, 29918, 27074, 353, 3992, 6733, 29898, 23523, 29892, 716, 29918, 726, 29897, 13, 4706, 1583, 3032, 3784, 29918, 27703, 353, 1857, 29918, 27703, 13, 4706, 1583, 3032, 1482, 29918, 27703, 353, 716, 29918, 27703, 13, 13, 1678, 822, 4770, 1524, 12035, 1311, 1125, 13, 4706, 9995, 11609, 278, 20380, 1213, 15945, 13, 4706, 736, 1583, 13, 13, 1678, 822, 4770, 4622, 12035, 1311, 1125, 13, 4706, 9995, 29923, 4387, 403, 322, 736, 278, 2446, 9558, 4331, 1213, 15945, 13, 4706, 565, 1583, 3032, 10568, 6736, 1583, 3032, 20543, 29889, 657, 29918, 10568, 29918, 2798, 7295, 13, 9651, 12020, 22303, 13463, 362, 13, 13, 4706, 9558, 29918, 10568, 353, 1583, 3032, 20543, 29889, 657, 29918, 20543, 29918, 10568, 29898, 1311, 3032, 10568, 29892, 13, 462, 462, 462, 1669, 1583, 3032, 3784, 29918, 27074, 29889, 24219, 403, 3319, 9594, 13, 462, 462, 462, 1669, 1583, 3032, 1482, 29918, 27074, 29889, 24219, 403, 3319, 9594, 13, 462, 462, 462, 1669, 1583, 3032, 3784, 29918, 27703, 29892, 13, 462, 462, 462, 1669, 1583, 3032, 1482, 29918, 27703, 29897, 13, 4706, 1583, 3032, 10568, 4619, 29871, 29896, 13, 4706, 736, 9558, 29918, 10568, 13, 13, 13, 1990, 1939, 4300, 654, 29898, 4300, 654, 5160, 1125, 13, 13, 1678, 9995, 17669, 358, 2479, 694, 9558, 2779, 1213, 15945, 13, 13, 1678, 822, 679, 29918, 10568, 29918, 2798, 29898, 1311, 1125, 13, 4706, 9995, 11609, 278, 3001, 1353, 310, 6576, 3734, 363, 278, 9558, 1213, 15945, 13, 4706, 736, 29871, 29896, 13, 13, 1678, 396, 282, 2904, 524, 29901, 11262, 29922, 517, 29877, 29899, 13011, 29899, 25699, 13, 1678, 822, 679, 29918, 20543, 29918, 10568, 29898, 1311, 29892, 4331, 29901, 938, 29892, 1857, 29918, 726, 29901, 851, 29892, 716, 29918, 726, 29901, 851, 29892, 13, 462, 9651, 1857, 29918, 27703, 29901, 28379, 29961, 1293, 29961, 28212, 3306, 5262, 353, 6213, 29892, 13, 462, 9651, 716, 29918, 27703, 29901, 28379, 29961, 1293, 29961, 28212, 3306, 5262, 353, 6213, 29897, 1599, 6667, 358, 9323, 1626, 29901, 13, 4706, 9995, 27065, 403, 599, 278, 6576, 297, 278, 9558, 1213, 15945, 13, 4706, 565, 4331, 529, 29871, 29900, 470, 4331, 6736, 1583, 29889, 657, 29918, 10568, 29918, 2798, 7295, 13, 9651, 12020, 16499, 291, 2392, 29898, 1254, 15488, 29918, 12015, 29918, 9800, 29918, 29934, 24336, 29918, 11432, 29897, 13, 13, 4706, 736, 6667, 358, 9323, 1626, 29889, 3166, 29918, 710, 29898, 1482, 29918, 726, 29892, 1583, 29889, 4905, 29918, 2848, 29892, 1583, 29889, 27756, 29918, 7778, 29892, 1583, 29889, 27756, 29918, 2055, 294, 29892, 13, 462, 462, 965, 716, 29918, 27703, 29897, 13, 13, 13, 1990, 349, 1878, 4300, 654, 29898, 4300, 654, 5160, 1125, 13, 13, 1678, 9995, 17669, 358, 2479, 5503, 9558, 2779, 1213, 15945, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1962, 29918, 2848, 29901, 938, 29892, 24382, 29918, 7778, 29901, 6120, 29892, 24382, 29918, 2055, 294, 29901, 6120, 29892, 2295, 29901, 9657, 29897, 1599, 6213, 29901, 13, 4706, 9995, 2385, 2847, 3950, 1213, 15945, 13, 4706, 1583, 29889, 20845, 353, 525, 1266, 29915, 13, 4706, 1583, 29889, 726, 353, 6213, 13, 4706, 1583, 29889, 726, 29918, 2780, 353, 6213, 13, 4706, 2428, 2141, 1649, 2344, 12035, 4905, 29918, 2848, 29892, 24382, 29918, 7778, 29892, 24382, 29918, 2055, 294, 29892, 2295, 29897, 13, 13, 4706, 565, 1583, 29889, 726, 338, 6213, 29901, 13, 9651, 1583, 29889, 726, 353, 6629, 13, 13, 1678, 822, 679, 29918, 10568, 29918, 2798, 29898, 1311, 1125, 13, 4706, 9995, 11609, 278, 3001, 1353, 310, 6576, 3734, 363, 278, 9558, 1213, 15945, 13, 4706, 736, 1583, 29889, 4905, 29918, 2848, 718, 7431, 29898, 1311, 29889, 726, 29897, 13, 13, 1678, 396, 282, 2904, 524, 29901, 11262, 29922, 517, 29877, 29899, 13011, 29899, 25699, 13, 1678, 822, 679, 29918, 20543, 29918, 10568, 29898, 1311, 29892, 4331, 29901, 938, 29892, 1857, 29918, 726, 29901, 851, 29892, 716, 29918, 726, 29901, 851, 29892, 13, 462, 9651, 1857, 29918, 27703, 29901, 28379, 29961, 1293, 29961, 28212, 3306, 5262, 353, 6213, 29892, 13, 462, 9651, 716, 29918, 27703, 29901, 28379, 29961, 1293, 29961, 28212, 3306, 5262, 353, 6213, 29897, 1599, 6667, 358, 9323, 1626, 29901, 13, 4706, 9995, 27065, 403, 599, 278, 6576, 297, 278, 9558, 1213, 15945, 13, 4706, 565, 4331, 529, 29871, 29900, 470, 4331, 6736, 1583, 29889, 657, 29918, 10568, 29918, 2798, 7295, 13, 9651, 12020, 16499, 291, 2392, 29898, 1254, 15488, 29918, 12015, 29918, 9800, 29918, 29934, 24336, 29918, 11432, 29897, 13, 13, 4706, 1857, 29918, 4990, 29918, 726, 353, 6667, 358, 9323, 1626, 29889, 3166, 29918, 710, 29898, 3784, 29918, 726, 29892, 1583, 29889, 4905, 29918, 2848, 29892, 1583, 29889, 27756, 29918, 7778, 29892, 13, 462, 462, 462, 965, 1583, 29889, 27756, 29918, 2055, 294, 29892, 1857, 29918, 27703, 29897, 13, 4706, 716, 29918, 4990, 29918, 726, 353, 6667, 358, 9323, 1626, 29889, 3166, 29918, 710, 29898, 1482, 29918, 726, 29892, 1583, 29889, 4905, 29918, 2848, 29892, 1583, 29889, 27756, 29918, 7778, 29892, 13, 462, 462, 462, 539, 1583, 29889, 27756, 29918, 2055, 294, 29892, 716, 29918, 27703, 29897, 13, 13, 4706, 565, 1583, 29889, 726, 29901, 13, 9651, 565, 716, 29918, 27703, 322, 451, 1583, 29889, 726, 29918, 2780, 29901, 13, 18884, 1426, 29918, 2780, 353, 518, 1482, 29918, 27703, 29961, 29900, 5262, 13, 9651, 1683, 29901, 13, 18884, 1426, 29918, 2780, 353, 1583, 29889, 726, 29918, 2780, 13, 9651, 9558, 29918, 726, 353, 6667, 358, 9323, 1626, 29889, 3166, 29918, 710, 29898, 1311, 29889, 726, 29892, 7431, 29898, 1311, 29889, 726, 511, 1583, 29889, 27756, 29918, 7778, 29892, 13, 462, 462, 462, 3986, 1583, 29889, 27756, 29918, 2055, 294, 29892, 1426, 29918, 2780, 29897, 13, 4706, 1683, 29901, 13, 9651, 9558, 29918, 726, 353, 853, 2780, 287, 17669, 358, 9323, 1626, 4197, 1402, 1583, 29889, 27756, 29918, 7778, 29892, 1583, 29889, 27756, 29918, 2055, 294, 29897, 13, 13, 4706, 565, 1583, 29889, 20845, 1275, 525, 1266, 2396, 13, 9651, 5694, 29918, 1761, 353, 716, 29918, 4990, 29918, 726, 13, 9651, 5694, 29918, 1761, 29889, 21843, 29898, 20543, 29918, 726, 29897, 13, 9651, 5694, 29918, 1761, 29889, 21843, 29898, 3784, 29918, 4990, 29918, 726, 29897, 13, 9651, 736, 5694, 29918, 1761, 29961, 13, 18884, 1583, 29889, 4905, 29918, 2848, 718, 7431, 29898, 1311, 29889, 726, 29897, 448, 313, 10568, 718, 29871, 29896, 1125, 29906, 334, 1583, 29889, 4905, 29918, 2848, 718, 7431, 29898, 13, 462, 1678, 1583, 29889, 726, 29897, 448, 313, 10568, 718, 29871, 29896, 4638, 13, 13, 4706, 565, 1583, 29889, 20845, 1275, 525, 1563, 2396, 13, 9651, 5694, 29918, 1761, 353, 1857, 29918, 4990, 29918, 726, 13, 9651, 5694, 29918, 1761, 29889, 21843, 29898, 20543, 29918, 726, 29897, 13, 9651, 5694, 29918, 1761, 29889, 21843, 29898, 1482, 29918, 4990, 29918, 726, 29897, 13, 9651, 736, 5694, 29918, 1761, 29961, 10568, 718, 29871, 29896, 29901, 10568, 718, 29871, 29896, 718, 1583, 29889, 4905, 29918, 2848, 29962, 13, 13, 4706, 12020, 16499, 291, 2392, 29898, 26813, 29903, 22122, 29918, 4571, 1525, 9838, 29918, 3904, 29968, 6632, 16048, 29918, 11432, 29897, 13, 13, 13, 1990, 26428, 4300, 654, 29898, 4300, 654, 5160, 1125, 13, 13, 1678, 9995, 17669, 358, 2479, 4612, 9558, 2779, 1213, 15945, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1962, 29918, 2848, 29901, 938, 29892, 24382, 29918, 7778, 29901, 6120, 29892, 24382, 29918, 2055, 294, 29901, 6120, 29892, 2295, 29901, 9657, 29897, 1599, 6213, 29901, 13, 4706, 9995, 2385, 2847, 3950, 1213, 15945, 13, 4706, 1583, 29889, 20845, 353, 525, 1266, 29915, 13, 4706, 1583, 29889, 726, 353, 6213, 13, 4706, 1583, 29889, 726, 29918, 2780, 353, 6213, 13, 4706, 2428, 2141, 1649, 2344, 12035, 4905, 29918, 2848, 29892, 24382, 29918, 7778, 29892, 24382, 29918, 2055, 294, 29892, 2295, 29897, 13, 13, 4706, 565, 1583, 29889, 726, 338, 6213, 29901, 13, 9651, 1583, 29889, 726, 353, 6629, 13, 13, 1678, 822, 679, 29918, 10568, 29918, 2798, 29898, 1311, 1125, 13, 4706, 9995, 11609, 278, 3001, 1353, 310, 6576, 3734, 363, 278, 9558, 1213, 15945, 13, 4706, 736, 1583, 29889, 4905, 29918, 2848, 718, 7431, 29898, 1311, 29889, 726, 29897, 13, 13, 1678, 396, 282, 2904, 524, 29901, 11262, 29922, 517, 29877, 29899, 13011, 29899, 25699, 13, 1678, 822, 679, 29918, 20543, 29918, 10568, 29898, 1311, 29892, 4331, 29901, 938, 29892, 1857, 29918, 726, 29901, 851, 29892, 716, 29918, 726, 29901, 851, 29892, 13, 462, 9651, 1857, 29918, 27703, 29901, 28379, 29961, 1293, 29961, 28212, 3306, 5262, 353, 6213, 29892, 13, 462, 9651, 716, 29918, 27703, 29901, 28379, 29961, 1293, 29961, 28212, 3306, 5262, 353, 6213, 29897, 1599, 6667, 358, 9323, 1626, 29901, 13, 4706, 9995, 27065, 403, 599, 278, 6576, 297, 278, 9558, 1213, 15945, 13, 4706, 565, 4331, 529, 29871, 29900, 470, 4331, 6736, 1583, 29889, 657, 29918, 10568, 29918, 2798, 7295, 13, 9651, 12020, 16499, 291, 2392, 29898, 1254, 15488, 29918, 12015, 29918, 9800, 29918, 29934, 24336, 29918, 11432, 29897, 13, 13, 4706, 1857, 29918, 4990, 29918, 726, 353, 6667, 358, 9323, 1626, 29889, 3166, 29918, 710, 29898, 3784, 29918, 726, 29892, 1583, 29889, 4905, 29918, 2848, 29892, 1583, 29889, 27756, 29918, 7778, 29892, 13, 462, 462, 462, 965, 1583, 29889, 27756, 29918, 2055, 294, 29892, 1857, 29918, 27703, 29897, 13, 4706, 716, 29918, 4990, 29918, 726, 353, 6667, 358, 9323, 1626, 29889, 3166, 29918, 710, 29898, 1482, 29918, 726, 29892, 1583, 29889, 4905, 29918, 2848, 29892, 1583, 29889, 27756, 29918, 7778, 29892, 13, 462, 462, 462, 539, 1583, 29889, 27756, 29918, 2055, 294, 29892, 716, 29918, 27703, 29897, 13, 13, 4706, 565, 1583, 29889, 726, 29901, 13, 9651, 565, 716, 29918, 27703, 322, 451, 1583, 29889, 726, 29918, 2780, 29901, 13, 18884, 1426, 29918, 2780, 353, 518, 1482, 29918, 27703, 29961, 29900, 5262, 13, 9651, 1683, 29901, 13, 18884, 1426, 29918, 2780, 353, 1583, 29889, 726, 29918, 2780, 13, 9651, 9558, 29918, 726, 353, 6667, 358, 9323, 1626, 29889, 3166, 29918, 710, 29898, 1311, 29889, 726, 29892, 7431, 29898, 1311, 29889, 726, 511, 1583, 29889, 27756, 29918, 7778, 29892, 13, 462, 462, 462, 3986, 1583, 29889, 27756, 29918, 2055, 294, 29892, 1426, 29918, 2780, 29897, 13, 4706, 1683, 29901, 13, 9651, 9558, 29918, 726, 353, 853, 2780, 287, 17669, 358, 9323, 1626, 4197, 1402, 1583, 29889, 27756, 29918, 7778, 29892, 1583, 29889, 27756, 29918, 2055, 294, 29897, 13, 13, 4706, 565, 1583, 29889, 20845, 1275, 525, 1266, 2396, 13, 9651, 716, 29918, 1062, 2760, 29918, 4990, 29918, 726, 353, 716, 29918, 4990, 29918, 726, 13, 9651, 716, 29918, 1062, 2760, 29918, 4990, 29918, 726, 29889, 21843, 29898, 20543, 29918, 726, 29897, 13, 13, 9651, 565, 4331, 529, 1583, 29889, 4905, 29918, 2848, 29901, 13, 18884, 5694, 29918, 726, 353, 716, 29918, 1062, 2760, 29918, 4990, 29918, 726, 14352, 29898, 10568, 718, 29871, 29896, 1125, 29962, 13, 18884, 5694, 29918, 726, 29889, 21843, 29898, 3784, 29918, 4990, 29918, 726, 29961, 10568, 718, 29871, 29896, 29901, 2314, 13, 9651, 1683, 29901, 13, 18884, 5694, 29918, 726, 353, 716, 29918, 4990, 29918, 726, 14352, 29898, 10568, 718, 29871, 29896, 1125, 17722, 10568, 718, 29871, 29896, 29897, 718, 1583, 29889, 4905, 29918, 2848, 29962, 13, 13, 9651, 736, 5694, 29918, 726, 13, 13, 4706, 565, 1583, 29889, 20845, 1275, 525, 1563, 2396, 13, 9651, 716, 29918, 1062, 2760, 29918, 4990, 29918, 726, 353, 9558, 29918, 726, 13, 9651, 716, 29918, 1062, 2760, 29918, 4990, 29918, 726, 29889, 21843, 29898, 1482, 29918, 4990, 29918, 726, 29897, 13, 13, 9651, 565, 4331, 529, 1583, 29889, 4905, 29918, 2848, 29901, 13, 18884, 5694, 29918, 726, 353, 1857, 29918, 4990, 29918, 726, 7503, 1311, 29889, 4905, 29918, 2848, 448, 313, 10568, 718, 29871, 29896, 4638, 13, 18884, 5694, 29918, 726, 29889, 21843, 29898, 1482, 29918, 1062, 2760, 29918, 4990, 29918, 726, 7503, 10568, 718, 29871, 29896, 2314, 13, 9651, 1683, 29901, 13, 18884, 5694, 29918, 726, 353, 716, 29918, 1062, 2760, 29918, 4990, 29918, 726, 29961, 10568, 448, 1583, 29889, 4905, 29918, 2848, 718, 29871, 29896, 29901, 10568, 718, 29871, 29896, 29962, 13, 13, 9651, 736, 5694, 29918, 726, 13, 13, 4706, 12020, 16499, 291, 2392, 29898, 26813, 29903, 22122, 29918, 4571, 1525, 9838, 29918, 3904, 29968, 6632, 16048, 29918, 11432, 29897, 13, 13, 13, 1990, 853, 11911, 4300, 654, 29898, 4300, 654, 5160, 1125, 13, 13, 1678, 9995, 17669, 358, 2479, 443, 11911, 9558, 2779, 1213, 15945, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1962, 29918, 2848, 29901, 938, 29892, 24382, 29918, 7778, 29901, 6120, 29892, 24382, 29918, 2055, 294, 29901, 6120, 29892, 2295, 29901, 9657, 29897, 1599, 6213, 29901, 13, 4706, 9995, 2385, 2847, 3950, 1213, 15945, 13, 4706, 1583, 29889, 20845, 353, 525, 1266, 29915, 13, 4706, 1583, 29889, 726, 353, 6213, 13, 4706, 1583, 29889, 726, 29918, 2780, 353, 6213, 13, 4706, 2428, 2141, 1649, 2344, 12035, 4905, 29918, 2848, 29892, 24382, 29918, 7778, 29892, 24382, 29918, 2055, 294, 29892, 2295, 29897, 13, 13, 4706, 565, 1583, 29889, 726, 338, 6213, 29901, 13, 9651, 1583, 29889, 726, 353, 6629, 13, 13, 1678, 822, 679, 29918, 10568, 29918, 2798, 29898, 1311, 1125, 13, 4706, 9995, 11609, 278, 3001, 1353, 310, 6576, 3734, 363, 278, 9558, 1213, 15945, 13, 4706, 736, 1583, 29889, 4905, 29918, 2848, 718, 7431, 29898, 1311, 29889, 726, 29897, 13, 13, 1678, 396, 282, 2904, 524, 29901, 11262, 29922, 517, 29877, 29899, 13011, 29899, 25699, 13, 1678, 822, 679, 29918, 20543, 29918, 10568, 29898, 1311, 29892, 4331, 29901, 938, 29892, 1857, 29918, 726, 29901, 851, 29892, 716, 29918, 726, 29901, 851, 29892, 13, 462, 9651, 1857, 29918, 27703, 29901, 28379, 29961, 1293, 29961, 28212, 3306, 5262, 353, 6213, 29892, 13, 462, 9651, 716, 29918, 27703, 29901, 28379, 29961, 1293, 29961, 28212, 3306, 5262, 353, 6213, 29897, 1599, 6667, 358, 9323, 1626, 29901, 13, 4706, 9995, 27065, 403, 599, 278, 6576, 297, 278, 9558, 1213, 15945, 13, 4706, 565, 4331, 529, 29871, 29900, 470, 4331, 6736, 1583, 29889, 657, 29918, 10568, 29918, 2798, 7295, 13, 9651, 12020, 16499, 291, 2392, 29898, 1254, 15488, 29918, 12015, 29918, 9800, 29918, 29934, 24336, 29918, 11432, 29897, 13, 13, 4706, 1857, 29918, 4990, 29918, 726, 353, 6667, 358, 9323, 1626, 29889, 3166, 29918, 710, 29898, 3784, 29918, 726, 29892, 1583, 29889, 4905, 29918, 2848, 29892, 1583, 29889, 27756, 29918, 7778, 29892, 13, 462, 462, 462, 965, 1583, 29889, 27756, 29918, 2055, 294, 29892, 1857, 29918, 27703, 29897, 13, 4706, 716, 29918, 4990, 29918, 726, 353, 6667, 358, 9323, 1626, 29889, 3166, 29918, 710, 29898, 1482, 29918, 726, 29892, 1583, 29889, 4905, 29918, 2848, 29892, 1583, 29889, 27756, 29918, 7778, 29892, 13, 462, 462, 462, 539, 1583, 29889, 27756, 29918, 2055, 294, 29892, 716, 29918, 27703, 29897, 13, 13, 4706, 565, 1583, 29889, 726, 29901, 13, 9651, 565, 716, 29918, 27703, 322, 451, 1583, 29889, 726, 29918, 2780, 29901, 13, 18884, 1426, 29918, 2780, 353, 518, 1482, 29918, 27703, 29961, 29900, 5262, 13, 9651, 1683, 29901, 13, 18884, 1426, 29918, 2780, 353, 1583, 29889, 726, 29918, 2780, 13, 9651, 9558, 29918, 726, 353, 6667, 358, 9323, 1626, 29889, 3166, 29918, 710, 29898, 1311, 29889, 726, 29892, 7431, 29898, 1311, 29889, 726, 511, 1583, 29889, 27756, 29918, 7778, 29892, 13, 462, 462, 462, 3986, 1583, 29889, 27756, 29918, 2055, 294, 29892, 1426, 29918, 2780, 29897, 13, 4706, 1683, 29901, 13, 9651, 9558, 29918, 726, 353, 853, 2780, 287, 17669, 358, 9323, 1626, 4197, 1402, 1583, 29889, 27756, 29918, 7778, 29892, 1583, 29889, 27756, 29918, 2055, 294, 29897, 13, 13, 4706, 565, 1583, 29889, 20845, 1275, 525, 1266, 2396, 13, 9651, 1857, 29918, 1062, 2760, 29918, 4990, 29918, 726, 353, 9558, 29918, 726, 13, 9651, 1857, 29918, 1062, 2760, 29918, 4990, 29918, 726, 29889, 21843, 29898, 3784, 29918, 4990, 29918, 726, 29897, 13, 13, 9651, 565, 4331, 529, 7431, 29898, 1311, 29889, 726, 1125, 13, 18884, 5694, 29918, 726, 353, 1857, 29918, 1062, 2760, 29918, 4990, 29918, 726, 29961, 13, 462, 1678, 7431, 29898, 1311, 29889, 726, 29897, 448, 4331, 448, 29871, 29896, 29901, 2435, 29898, 1311, 29889, 726, 29897, 448, 4331, 448, 29871, 29896, 718, 1583, 29889, 4905, 29918, 2848, 29962, 13, 9651, 1683, 29901, 13, 18884, 5694, 29918, 726, 353, 716, 29918, 4990, 29918, 726, 7503, 10568, 448, 7431, 29898, 1311, 29889, 726, 29897, 718, 29871, 29896, 29962, 13, 18884, 5694, 29918, 726, 29889, 21843, 29898, 3784, 29918, 1062, 2760, 29918, 4990, 29918, 726, 7503, 1311, 29889, 4905, 29918, 2848, 448, 7431, 29898, 7382, 29918, 726, 29897, 2314, 13, 13, 9651, 736, 5694, 29918, 726, 13, 13, 4706, 565, 1583, 29889, 20845, 1275, 525, 1563, 2396, 13, 9651, 1857, 29918, 1062, 2760, 29918, 4990, 29918, 726, 353, 1857, 29918, 4990, 29918, 726, 13, 9651, 1857, 29918, 1062, 2760, 29918, 4990, 29918, 726, 29889, 21843, 29898, 20543, 29918, 726, 29897, 13, 13, 9651, 565, 4331, 529, 7431, 29898, 1311, 29889, 726, 1125, 13, 18884, 5694, 29918, 726, 353, 1857, 29918, 1062, 2760, 29918, 4990, 29918, 726, 29961, 10568, 718, 29871, 29896, 29901, 10568, 718, 29871, 29896, 718, 1583, 29889, 4905, 29918, 2848, 29962, 13, 9651, 1683, 29901, 13, 18884, 5694, 29918, 726, 353, 1857, 29918, 4990, 29918, 726, 29961, 10568, 718, 29871, 29896, 17531, 13, 18884, 5694, 29918, 726, 29889, 21843, 29898, 1482, 29918, 4990, 29918, 726, 14352, 29898, 1311, 29889, 4905, 29918, 2848, 448, 7431, 29898, 7382, 29918, 726, 22164, 2314, 13, 9651, 736, 5694, 29918, 726, 13, 13, 4706, 12020, 16499, 291, 2392, 29898, 26813, 29903, 22122, 29918, 4571, 1525, 9838, 29918, 3904, 29968, 6632, 16048, 29918, 11432, 29897, 13, 13, 13, 1990, 14570, 412, 4300, 654, 29898, 4300, 654, 5160, 1125, 13, 13, 1678, 9995, 17669, 358, 2479, 281, 15705, 9558, 2779, 1213, 15945, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1962, 29918, 2848, 29901, 938, 29892, 24382, 29918, 7778, 29901, 6120, 29892, 24382, 29918, 2055, 294, 29901, 6120, 29892, 2295, 29901, 9657, 29897, 1599, 6213, 29901, 13, 4706, 9995, 2385, 2847, 3950, 1213, 15945, 13, 4706, 1583, 29889, 20845, 353, 525, 1266, 29915, 13, 4706, 1583, 29889, 726, 353, 6213, 13, 4706, 1583, 29889, 726, 29918, 2780, 353, 6213, 13, 4706, 2428, 2141, 1649, 2344, 12035, 4905, 29918, 2848, 29892, 24382, 29918, 7778, 29892, 24382, 29918, 2055, 294, 29892, 2295, 29897, 13, 13, 4706, 565, 1583, 29889, 726, 338, 6213, 29901, 13, 9651, 1583, 29889, 726, 353, 6629, 13, 13, 1678, 822, 679, 29918, 10568, 29918, 2798, 29898, 1311, 1125, 13, 4706, 9995, 11609, 278, 3001, 1353, 310, 6576, 3734, 363, 278, 9558, 1213, 15945, 13, 4706, 736, 1583, 29889, 4905, 29918, 2848, 718, 7431, 29898, 1311, 29889, 726, 29897, 13, 13, 1678, 396, 282, 2904, 524, 29901, 11262, 29922, 517, 29877, 29899, 13011, 29899, 25699, 29892, 517, 29877, 29899, 13011, 29899, 17519, 267, 29892, 517, 29877, 29899, 13011, 29899, 2457, 29899, 6112, 4110, 13, 1678, 822, 679, 29918, 20543, 29918, 10568, 29898, 1311, 29892, 4331, 29901, 938, 29892, 1857, 29918, 726, 29901, 851, 29892, 716, 29918, 726, 29901, 851, 29892, 13, 462, 9651, 1857, 29918, 27703, 29901, 28379, 29961, 1293, 29961, 28212, 3306, 5262, 353, 6213, 29892, 13, 462, 9651, 716, 29918, 27703, 29901, 28379, 29961, 1293, 29961, 28212, 3306, 5262, 353, 6213, 29897, 1599, 6667, 358, 9323, 1626, 29901, 13, 4706, 9995, 27065, 403, 599, 278, 6576, 297, 278, 9558, 1213, 15945, 13, 4706, 565, 4331, 529, 29871, 29900, 470, 4331, 6736, 1583, 29889, 657, 29918, 10568, 29918, 2798, 7295, 13, 9651, 12020, 16499, 291, 2392, 29898, 1254, 15488, 29918, 12015, 29918, 9800, 29918, 29934, 24336, 29918, 11432, 29897, 13, 13, 4706, 1857, 29918, 4990, 29918, 726, 353, 6667, 358, 9323, 1626, 29889, 3166, 29918, 710, 29898, 3784, 29918, 726, 29892, 1583, 29889, 4905, 29918, 2848, 29892, 1583, 29889, 27756, 29918, 7778, 29892, 13, 462, 462, 462, 965, 1583, 29889, 27756, 29918, 2055, 294, 29892, 1857, 29918, 27703, 29897, 13, 4706, 716, 29918, 4990, 29918, 726, 353, 6667, 358, 9323, 1626, 29889, 3166, 29918, 710, 29898, 1482, 29918, 726, 29892, 1583, 29889, 4905, 29918, 2848, 29892, 1583, 29889, 27756, 29918, 7778, 29892, 13, 462, 462, 462, 539, 1583, 29889, 27756, 29918, 2055, 294, 29892, 716, 29918, 27703, 29897, 13, 13, 4706, 565, 1583, 29889, 726, 29901, 13, 9651, 565, 716, 29918, 27703, 322, 451, 1583, 29889, 726, 29918, 2780, 29901, 13, 18884, 1426, 29918, 2780, 353, 518, 1482, 29918, 27703, 29961, 29900, 5262, 13, 9651, 1683, 29901, 13, 18884, 1426, 29918, 2780, 353, 1583, 29889, 726, 29918, 2780, 13, 9651, 9558, 29918, 726, 353, 6667, 358, 9323, 1626, 29889, 3166, 29918, 710, 29898, 1311, 29889, 726, 29892, 7431, 29898, 1311, 29889, 726, 511, 1583, 29889, 27756, 29918, 7778, 29892, 13, 462, 462, 462, 3986, 1583, 29889, 27756, 29918, 2055, 294, 29892, 1426, 29918, 2780, 29897, 13, 4706, 1683, 29901, 13, 9651, 9558, 29918, 726, 353, 853, 2780, 287, 17669, 358, 9323, 1626, 4197, 1402, 1583, 29889, 27756, 29918, 7778, 29892, 1583, 29889, 27756, 29918, 2055, 294, 29897, 13, 13, 4706, 565, 1583, 29889, 20845, 1275, 525, 1266, 2396, 13, 9651, 565, 4331, 529, 7431, 29898, 1311, 29889, 726, 1125, 13, 18884, 5694, 29918, 726, 353, 9558, 29918, 726, 14352, 29898, 10568, 718, 29871, 29896, 1125, 29962, 13, 18884, 5694, 29918, 726, 29889, 21843, 29898, 3784, 29918, 4990, 29918, 726, 29961, 10568, 718, 29871, 29896, 29901, 2314, 13, 9651, 25342, 4331, 529, 1583, 29889, 4905, 29918, 2848, 29901, 13, 18884, 5694, 29918, 726, 353, 716, 29918, 4990, 29918, 726, 7503, 10568, 448, 7431, 29898, 1311, 29889, 726, 29897, 718, 29871, 29896, 29962, 13, 18884, 5694, 29918, 726, 29889, 21843, 29898, 20543, 29918, 726, 29897, 13, 18884, 5694, 29918, 726, 29889, 21843, 29898, 3784, 29918, 4990, 29918, 726, 29961, 2435, 29898, 7382, 29918, 726, 1125, 2314, 13, 9651, 1683, 29901, 13, 18884, 5694, 29918, 726, 353, 716, 29918, 4990, 29918, 726, 7503, 10568, 448, 7431, 29898, 1311, 29889, 726, 29897, 718, 29871, 29896, 29962, 13, 18884, 5694, 29918, 726, 29889, 21843, 29898, 20543, 29918, 726, 7503, 1311, 29889, 4905, 29918, 2848, 448, 7431, 29898, 7382, 29918, 726, 29897, 2314, 13, 9651, 736, 5694, 29918, 726, 13, 13, 4706, 565, 1583, 29889, 20845, 1275, 525, 1563, 2396, 13, 9651, 565, 4331, 529, 7431, 29898, 1311, 29889, 726, 1125, 13, 18884, 5694, 29918, 726, 353, 1857, 29918, 4990, 29918, 726, 7503, 1311, 29889, 4905, 29918, 2848, 448, 313, 10568, 718, 29871, 29896, 4638, 13, 18884, 5694, 29918, 726, 29889, 21843, 29898, 20543, 29918, 726, 7503, 10568, 718, 29871, 29896, 2314, 13, 9651, 25342, 4331, 529, 1583, 29889, 4905, 29918, 2848, 29901, 13, 18884, 5694, 29918, 726, 353, 1857, 29918, 4990, 29918, 726, 7503, 1311, 29889, 4905, 29918, 2848, 448, 313, 10568, 718, 29871, 29896, 4638, 13, 18884, 5694, 29918, 726, 29889, 21843, 29898, 20543, 29918, 726, 29897, 13, 18884, 5694, 29918, 726, 29889, 21843, 29898, 1482, 29918, 4990, 29918, 726, 29961, 2435, 29898, 7382, 29918, 726, 1125, 2314, 13, 9651, 25342, 4331, 529, 1583, 29889, 4905, 29918, 2848, 718, 7431, 29898, 1311, 29889, 726, 29897, 448, 29871, 29896, 29901, 13, 18884, 5694, 29918, 726, 353, 9558, 29918, 726, 29961, 10568, 448, 313, 1311, 29889, 4905, 29918, 2848, 718, 7431, 29898, 1311, 29889, 726, 876, 718, 29871, 29896, 17531, 13, 18884, 5694, 29918, 726, 29889, 21843, 29898, 1482, 29918, 4990, 29918, 726, 14352, 29898, 1311, 29889, 4905, 29918, 2848, 448, 7431, 29898, 7382, 29918, 726, 22164, 2314, 13, 9651, 1683, 29901, 13, 18884, 5694, 29918, 726, 353, 716, 29918, 4990, 29918, 726, 13, 9651, 736, 5694, 29918, 726, 13, 13, 4706, 12020, 16499, 291, 2392, 29898, 26813, 29903, 22122, 29918, 4571, 1525, 9838, 29918, 3904, 29968, 6632, 16048, 29918, 11432, 29897, 13, 13, 13, 1990, 26178, 4300, 654, 29898, 4300, 654, 5160, 1125, 13, 13, 1678, 9995, 17669, 358, 2479, 6219, 9558, 2779, 1213, 15945, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1962, 29918, 2848, 29901, 938, 29892, 24382, 29918, 7778, 29901, 6120, 29892, 24382, 29918, 2055, 294, 29901, 6120, 29892, 2295, 29901, 9657, 29897, 1599, 6213, 29901, 13, 4706, 9995, 2385, 2847, 3950, 1213, 15945, 13, 4706, 1583, 29889, 20845, 353, 525, 449, 29915, 13, 4706, 1583, 29889, 8513, 353, 525, 5910, 29915, 13, 4706, 2428, 2141, 1649, 2344, 12035, 4905, 29918, 2848, 29892, 24382, 29918, 7778, 29892, 24382, 29918, 2055, 294, 29892, 2295, 29897, 13, 13, 1678, 822, 679, 29918, 10568, 29918, 2798, 29898, 1311, 1125, 13, 4706, 9995, 11609, 278, 3001, 1353, 310, 6576, 3734, 363, 278, 9558, 1213, 15945, 13, 4706, 736, 938, 3552, 1311, 29889, 4905, 29918, 2848, 718, 29871, 29896, 29897, 847, 29871, 29906, 29897, 13, 13, 1678, 396, 282, 2904, 524, 29901, 11262, 29922, 517, 29877, 29899, 13011, 29899, 25699, 29892, 517, 29877, 29899, 13011, 29899, 17519, 267, 29892, 517, 29877, 29899, 13011, 29899, 2457, 29899, 6112, 4110, 13, 1678, 822, 679, 29918, 20543, 29918, 10568, 29898, 1311, 29892, 4331, 29901, 938, 29892, 1857, 29918, 726, 29901, 851, 29892, 716, 29918, 726, 29901, 851, 29892, 13, 462, 9651, 1857, 29918, 27703, 29901, 28379, 29961, 1293, 29961, 28212, 3306, 5262, 353, 6213, 29892, 13, 462, 9651, 716, 29918, 27703, 29901, 28379, 29961, 1293, 29961, 28212, 3306, 5262, 353, 6213, 29897, 1599, 6667, 358, 9323, 1626, 29901, 13, 4706, 9995, 27065, 403, 599, 278, 6576, 297, 278, 9558, 1213, 15945, 13, 4706, 565, 4331, 529, 29871, 29900, 470, 4331, 6736, 1583, 29889, 657, 29918, 10568, 29918, 2798, 7295, 13, 9651, 12020, 16499, 291, 2392, 29898, 1254, 15488, 29918, 12015, 29918, 9800, 29918, 29934, 24336, 29918, 11432, 29897, 13, 13, 4706, 1857, 29918, 4990, 29918, 726, 353, 6667, 358, 9323, 1626, 29889, 3166, 29918, 710, 29898, 3784, 29918, 726, 29892, 1583, 29889, 4905, 29918, 2848, 29892, 1583, 29889, 27756, 29918, 7778, 29892, 13, 462, 462, 462, 965, 1583, 29889, 27756, 29918, 2055, 294, 29892, 1857, 29918, 27703, 29897, 13, 4706, 716, 29918, 4990, 29918, 726, 353, 6667, 358, 9323, 1626, 29889, 3166, 29918, 710, 29898, 1482, 29918, 726, 29892, 1583, 29889, 4905, 29918, 2848, 29892, 1583, 29889, 27756, 29918, 7778, 29892, 13, 462, 462, 462, 539, 1583, 29889, 27756, 29918, 2055, 294, 29892, 716, 29918, 27703, 29897, 13, 13, 4706, 565, 1583, 29889, 8513, 1275, 525, 5910, 2396, 13, 9651, 565, 1583, 29889, 20845, 1275, 525, 449, 2396, 13, 18884, 565, 4331, 1275, 1583, 29889, 657, 29918, 10568, 29918, 2798, 580, 448, 29871, 29896, 29901, 13, 462, 1678, 736, 716, 29918, 4990, 29918, 726, 13, 13, 18884, 4890, 353, 938, 29898, 1311, 29889, 4905, 29918, 2848, 847, 29871, 29906, 29897, 13, 18884, 6219, 29918, 3149, 353, 4890, 13, 18884, 565, 4890, 334, 29871, 29906, 1275, 1583, 29889, 4905, 29918, 2848, 29901, 13, 462, 1678, 4890, 22361, 29871, 29896, 13, 18884, 1683, 29901, 13, 462, 1678, 6219, 29918, 3149, 4619, 29871, 29896, 13, 13, 18884, 4890, 22361, 4331, 13, 18884, 5694, 29918, 726, 353, 1857, 29918, 4990, 29918, 726, 29961, 5451, 29918, 3149, 448, 4890, 29901, 5451, 29918, 3149, 29962, 13, 18884, 5694, 29918, 726, 29889, 21843, 29898, 1482, 29918, 4990, 29918, 726, 29961, 3090, 21706, 29901, 3090, 21706, 718, 313, 1311, 29889, 4905, 29918, 2848, 448, 29871, 29906, 334, 4890, 29897, 2314, 13, 18884, 5694, 29918, 726, 29889, 21843, 29898, 3784, 29918, 4990, 29918, 726, 29961, 5451, 29918, 3149, 29901, 5451, 29918, 3149, 718, 4890, 2314, 13, 18884, 736, 5694, 29918, 726, 13, 13, 9651, 565, 1583, 29889, 20845, 1275, 525, 262, 2396, 13, 18884, 565, 4331, 1275, 1583, 29889, 657, 29918, 10568, 29918, 2798, 580, 448, 29871, 29896, 29901, 13, 462, 1678, 736, 716, 29918, 4990, 29918, 726, 13, 13, 18884, 6219, 29918, 3149, 353, 938, 29898, 1311, 29889, 4905, 29918, 2848, 847, 29871, 29906, 29897, 13, 18884, 4890, 353, 29871, 29896, 13, 18884, 565, 6219, 29918, 3149, 334, 29871, 29906, 529, 1583, 29889, 4905, 29918, 2848, 29901, 13, 462, 1678, 6219, 29918, 3149, 4619, 29871, 29896, 13, 13, 18884, 4890, 4619, 4331, 13, 18884, 5694, 29918, 726, 353, 716, 29918, 4990, 29918, 726, 29961, 5451, 29918, 3149, 448, 4890, 29901, 5451, 29918, 3149, 29962, 13, 18884, 5694, 29918, 726, 29889, 21843, 29898, 3784, 29918, 4990, 29918, 726, 29961, 3090, 21706, 29901, 3090, 21706, 718, 313, 1311, 29889, 4905, 29918, 2848, 448, 29871, 29906, 334, 4890, 29897, 2314, 13, 18884, 5694, 29918, 726, 29889, 21843, 29898, 1482, 29918, 4990, 29918, 726, 29961, 5451, 29918, 3149, 29901, 5451, 29918, 3149, 718, 4890, 2314, 13, 18884, 736, 5694, 29918, 726, 13, 13, 9651, 12020, 16499, 291, 2392, 29898, 26813, 29903, 22122, 29918, 4571, 1525, 9838, 29918, 3904, 29968, 6632, 16048, 29918, 11432, 29897, 13, 13, 4706, 565, 1583, 29889, 8513, 1275, 525, 4353, 412, 2396, 13, 9651, 565, 1583, 29889, 20845, 1275, 525, 449, 2396, 13, 18884, 565, 4331, 1275, 1583, 29889, 657, 29918, 10568, 29918, 2798, 580, 448, 29871, 29896, 29901, 13, 462, 1678, 736, 716, 29918, 4990, 29918, 726, 13, 13, 18884, 4890, 353, 938, 29898, 1311, 29889, 4905, 29918, 2848, 847, 29871, 29906, 29897, 13, 18884, 565, 4890, 334, 29871, 29906, 1275, 1583, 29889, 4905, 29918, 2848, 29901, 13, 462, 1678, 4890, 22361, 29871, 29896, 13, 13, 18884, 4890, 22361, 4331, 13, 18884, 5694, 29918, 726, 353, 1857, 29918, 4990, 29918, 726, 7503, 3090, 21706, 29962, 13, 18884, 5694, 29918, 726, 29889, 21843, 29898, 1482, 29918, 4990, 29918, 726, 29961, 3090, 21706, 29901, 3090, 21706, 718, 313, 1311, 29889, 4905, 29918, 2848, 448, 29871, 29906, 334, 4890, 29897, 2314, 13, 18884, 5694, 29918, 726, 29889, 21843, 29898, 3784, 29918, 4990, 29918, 726, 14352, 3090, 21706, 29901, 2314, 13, 18884, 736, 5694, 29918, 726, 13, 13, 9651, 565, 1583, 29889, 20845, 1275, 525, 262, 2396, 13, 18884, 565, 4331, 1275, 1583, 29889, 657, 29918, 10568, 29918, 2798, 580, 448, 29871, 29896, 29901, 13, 462, 1678, 736, 716, 29918, 4990, 29918, 726, 13, 13, 18884, 5694, 29918, 726, 353, 716, 29918, 4990, 29918, 726, 7503, 10568, 718, 29871, 29896, 29962, 13, 18884, 5694, 29918, 726, 29889, 21843, 29898, 3784, 29918, 4990, 29918, 726, 29961, 10568, 718, 29871, 29896, 29901, 10568, 718, 29871, 29896, 718, 313, 1311, 29889, 4905, 29918, 2848, 448, 29871, 29906, 334, 7431, 29898, 7382, 29918, 726, 876, 2314, 13, 18884, 5694, 29918, 726, 29889, 21843, 29898, 1482, 29918, 4990, 29918, 726, 14352, 29898, 10568, 718, 29871, 29896, 1125, 2314, 13, 18884, 736, 5694, 29918, 726, 13, 13, 9651, 12020, 16499, 291, 2392, 29898, 26813, 29903, 22122, 29918, 4571, 1525, 9838, 29918, 3904, 29968, 6632, 16048, 29918, 11432, 29897, 13, 13, 4706, 12020, 16499, 291, 2392, 703, 4300, 654, 3913, 385, 9815, 4464, 995, 1159, 13, 2 ]
setup_cares.py
thedrow/pycares
0
37396
import errno import os import subprocess import sys from distutils import log from distutils.command.build_ext import build_ext from distutils.errors import DistutilsError def exec_process(cmdline, silent=True, catch_enoent=True, input=None, **kwargs): """Execute a subprocess and returns the returncode, stdout buffer and stderr buffer. Optionally prints stdout and stderr while running.""" try: sub = subprocess.Popen(args=cmdline, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, **kwargs) stdout, stderr = sub.communicate(input=input) if type(stdout) != type(""): # decode on Python 3 # do nothing on Python 2 (it just doesn't care about encoding anyway) stdout = stdout.decode(sys.getdefaultencoding(), "replace") stderr = stderr.decode(sys.getdefaultencoding(), "replace") returncode = sub.returncode if not silent: sys.stdout.write(stdout) sys.stderr.write(stderr) except OSError as e: if e.errno == errno.ENOENT and catch_enoent: raise DistutilsError('"%s" is not present on this system' % cmdline[0]) else: raise if returncode != 0: raise DistutilsError('Got return value %d while executing "%s", stderr output was:\n%s' % (returncode, " ".join(cmdline), stderr.rstrip("\n"))) return stdout def exec_make(cmdline, *args, **kwargs): assert isinstance(cmdline, list) makes = ["make"] if "bsd" in sys.platform: makes.insert(0, "gmake") for make in makes: if "bsd" in sys.platform and make == "make": log.warn("Running plain make on BSD-derived system. It will likely fail. Consider installing GNU make from the ports collection.") try: return exec_process([make] + cmdline, *args, catch_enoent=False, **kwargs) except OSError as e: if e.errno != errno.ENOENT: raise raise DistutilsError('"make" is not present on this system') class cares_build_ext(build_ext): cares_dir = os.path.join('deps', 'c-ares') user_options = build_ext.user_options user_options.extend([ ("cares-clean-compile", None, "Clean c-ares tree before compilation"), ]) boolean_options = build_ext.boolean_options boolean_options.extend(["cares-clean-compile"]) def initialize_options(self): build_ext.initialize_options(self) self.cares_clean_compile = 0 def build_extensions(self): if self.compiler.compiler_type == 'mingw32': # Dirty hack to avoid linking with more than one C runtime when using MinGW self.compiler.dll_libraries = [lib for lib in self.compiler.dll_libraries if not lib.startswith('msvcr')] self.force = self.cares_clean_compile if self.compiler.compiler_type == 'msvc': self.cares_lib = os.path.join(self.cares_dir, 'cares.lib') else: self.cares_lib = os.path.join(self.cares_dir, 'libcares.a') self.build_cares() # Set compiler options if self.compiler.compiler_type == 'mingw32': self.compiler.add_library_dir(self.cares_dir) self.compiler.add_library('cares') self.extensions[0].extra_objects = [self.cares_lib] self.compiler.add_include_dir(os.path.join(self.cares_dir, 'src')) if sys.platform.startswith('linux'): self.compiler.add_library('rt') elif sys.platform == 'win32': if self.compiler.compiler_type == 'msvc': self.extensions[0].extra_link_args = ['/NODEFAULTLIB:libcmt'] self.compiler.add_library('advapi32') self.compiler.add_library('iphlpapi') self.compiler.add_library('psapi') self.compiler.add_library('ws2_32') build_ext.build_extensions(self) def build_cares(self): #self.debug_mode = bool(self.debug) or hasattr(sys, 'gettotalrefcount') win32_msvc = self.compiler.compiler_type == 'msvc' def build(): cflags = '-fPIC' env = os.environ.copy() env['CFLAGS'] = ' '.join(x for x in (cflags, env.get('CFLAGS', None)) if x) log.info('Building c-ares...') if win32_msvc: exec_process('cmd.exe /C vcbuild.bat', cwd=self.cares_dir, env=env, shell=True) else: exec_make(['libcares.a'], cwd=self.cares_dir, env=env) def clean(): if win32_msvc: exec_process('cmd.exe /C vcbuild.bat clean', cwd=self.cares_dir, shell=True) else: exec_make(['clean'], cwd=self.cares_dir) if self.cares_clean_compile: clean() if not os.path.exists(self.cares_lib): log.info('c-ares needs to be compiled.') build() else: log.info('No need to build c-ares.')
[ 1, 29871, 13, 5215, 4589, 1217, 13, 5215, 2897, 13, 5215, 1014, 5014, 13, 5215, 10876, 13, 13, 3166, 1320, 13239, 1053, 1480, 13, 3166, 1320, 13239, 29889, 6519, 29889, 4282, 29918, 1062, 1053, 2048, 29918, 1062, 13, 3166, 1320, 13239, 29889, 12523, 1053, 6652, 13239, 2392, 13, 13, 13, 1753, 2279, 29918, 5014, 29898, 9006, 1220, 29892, 17436, 29922, 5574, 29892, 4380, 29918, 8154, 296, 29922, 5574, 29892, 1881, 29922, 8516, 29892, 3579, 19290, 1125, 13, 1678, 9995, 12296, 263, 1014, 5014, 322, 3639, 278, 736, 401, 29892, 27591, 6835, 322, 380, 20405, 6835, 29889, 13, 1678, 10831, 635, 14677, 27591, 322, 380, 20405, 1550, 2734, 1213, 15945, 13, 1678, 1018, 29901, 13, 4706, 1014, 353, 1014, 5014, 29889, 29925, 3150, 29898, 5085, 29922, 9006, 1220, 29892, 3659, 262, 29922, 1491, 5014, 29889, 2227, 4162, 29892, 27591, 29922, 1491, 5014, 29889, 2227, 4162, 29892, 380, 20405, 29922, 1491, 5014, 29889, 2227, 4162, 29892, 3579, 19290, 29897, 13, 4706, 27591, 29892, 380, 20405, 353, 1014, 29889, 27820, 403, 29898, 2080, 29922, 2080, 29897, 13, 13, 4706, 565, 1134, 29898, 25393, 29897, 2804, 1134, 703, 29908, 1125, 13, 9651, 396, 21822, 373, 5132, 29871, 29941, 13, 9651, 396, 437, 3078, 373, 5132, 29871, 29906, 313, 277, 925, 1838, 29915, 29873, 2562, 1048, 8025, 8763, 29897, 13, 9651, 27591, 353, 27591, 29889, 13808, 29898, 9675, 29889, 657, 4381, 22331, 3285, 376, 6506, 1159, 13, 9651, 380, 20405, 353, 380, 20405, 29889, 13808, 29898, 9675, 29889, 657, 4381, 22331, 3285, 376, 6506, 1159, 13, 13, 4706, 736, 401, 353, 1014, 29889, 2457, 401, 13, 4706, 565, 451, 17436, 29901, 13, 9651, 10876, 29889, 25393, 29889, 3539, 29898, 25393, 29897, 13, 9651, 10876, 29889, 303, 20405, 29889, 3539, 29898, 303, 20405, 29897, 13, 1678, 5174, 438, 29173, 408, 321, 29901, 13, 4706, 565, 321, 29889, 3127, 1217, 1275, 4589, 1217, 29889, 1430, 29949, 3919, 322, 4380, 29918, 8154, 296, 29901, 13, 9651, 12020, 6652, 13239, 2392, 877, 29908, 29995, 29879, 29908, 338, 451, 2198, 373, 445, 1788, 29915, 1273, 9920, 1220, 29961, 29900, 2314, 13, 4706, 1683, 29901, 13, 9651, 12020, 13, 1678, 565, 736, 401, 2804, 29871, 29900, 29901, 13, 4706, 12020, 6652, 13239, 2392, 877, 29954, 327, 736, 995, 1273, 29881, 1550, 14012, 11860, 29879, 613, 380, 20405, 1962, 471, 3583, 29876, 29995, 29879, 29915, 1273, 313, 2457, 401, 29892, 376, 11393, 7122, 29898, 9006, 1220, 511, 380, 20405, 29889, 29878, 17010, 14182, 29876, 29908, 4961, 13, 1678, 736, 27591, 13, 13, 13, 1753, 2279, 29918, 5675, 29898, 9006, 1220, 29892, 334, 5085, 29892, 3579, 19290, 1125, 13, 1678, 4974, 338, 8758, 29898, 9006, 1220, 29892, 1051, 29897, 13, 1678, 3732, 353, 6796, 5675, 3108, 13, 1678, 565, 376, 29890, 4928, 29908, 297, 10876, 29889, 12120, 29901, 13, 4706, 3732, 29889, 7851, 29898, 29900, 29892, 376, 29887, 5675, 1159, 13, 1678, 363, 1207, 297, 3732, 29901, 13, 4706, 565, 376, 29890, 4928, 29908, 297, 10876, 29889, 12120, 322, 1207, 1275, 376, 5675, 1115, 13, 9651, 1480, 29889, 25442, 703, 27795, 8656, 1207, 373, 350, 7230, 29899, 672, 2347, 1788, 29889, 739, 674, 5517, 4418, 29889, 10056, 15476, 15143, 1207, 515, 278, 16169, 4333, 23157, 13, 4706, 1018, 29901, 13, 9651, 736, 2279, 29918, 5014, 4197, 5675, 29962, 718, 9920, 1220, 29892, 334, 5085, 29892, 4380, 29918, 8154, 296, 29922, 8824, 29892, 3579, 19290, 29897, 13, 4706, 5174, 438, 29173, 408, 321, 29901, 13, 9651, 565, 321, 29889, 3127, 1217, 2804, 4589, 1217, 29889, 1430, 29949, 3919, 29901, 13, 18884, 12020, 13, 1678, 12020, 6652, 13239, 2392, 877, 29908, 5675, 29908, 338, 451, 2198, 373, 445, 1788, 1495, 13, 13, 13, 1990, 1559, 267, 29918, 4282, 29918, 1062, 29898, 4282, 29918, 1062, 1125, 13, 1678, 1559, 267, 29918, 3972, 353, 2897, 29889, 2084, 29889, 7122, 877, 311, 567, 742, 525, 29883, 29899, 5114, 1495, 13, 13, 1678, 1404, 29918, 6768, 353, 2048, 29918, 1062, 29889, 1792, 29918, 6768, 13, 1678, 1404, 29918, 6768, 29889, 21843, 4197, 13, 4706, 4852, 4287, 267, 29899, 14941, 29899, 12198, 613, 6213, 29892, 376, 29907, 14044, 274, 29899, 5114, 5447, 1434, 14835, 4968, 13, 268, 2314, 13, 1678, 7223, 29918, 6768, 353, 2048, 29918, 1062, 29889, 20054, 29918, 6768, 13, 1678, 7223, 29918, 6768, 29889, 21843, 29898, 3366, 4287, 267, 29899, 14941, 29899, 12198, 20068, 13, 13, 1678, 822, 11905, 29918, 6768, 29898, 1311, 1125, 13, 4706, 2048, 29918, 1062, 29889, 24926, 29918, 6768, 29898, 1311, 29897, 13, 4706, 1583, 29889, 4287, 267, 29918, 14941, 29918, 12198, 353, 29871, 29900, 13, 13, 1678, 822, 2048, 29918, 24299, 29898, 1311, 1125, 13, 4706, 565, 1583, 29889, 21789, 29889, 21789, 29918, 1853, 1275, 525, 4056, 29893, 29941, 29906, 2396, 13, 9651, 396, 360, 13163, 15833, 304, 4772, 25236, 411, 901, 1135, 697, 315, 10073, 746, 773, 3080, 29954, 29956, 13, 9651, 1583, 29889, 21789, 29889, 12396, 29918, 492, 8464, 353, 518, 1982, 363, 4303, 297, 1583, 29889, 21789, 29889, 12396, 29918, 492, 8464, 565, 451, 4303, 29889, 27382, 2541, 877, 1516, 7071, 29878, 1495, 29962, 13, 4706, 1583, 29889, 10118, 353, 1583, 29889, 4287, 267, 29918, 14941, 29918, 12198, 13, 4706, 565, 1583, 29889, 21789, 29889, 21789, 29918, 1853, 1275, 525, 1516, 7071, 2396, 13, 9651, 1583, 29889, 4287, 267, 29918, 1982, 353, 2897, 29889, 2084, 29889, 7122, 29898, 1311, 29889, 4287, 267, 29918, 3972, 29892, 525, 4287, 267, 29889, 1982, 1495, 13, 4706, 1683, 29901, 13, 9651, 1583, 29889, 4287, 267, 29918, 1982, 353, 2897, 29889, 2084, 29889, 7122, 29898, 1311, 29889, 4287, 267, 29918, 3972, 29892, 525, 1982, 4287, 267, 29889, 29874, 1495, 13, 4706, 1583, 29889, 4282, 29918, 4287, 267, 580, 13, 4706, 396, 3789, 6516, 3987, 13, 4706, 565, 1583, 29889, 21789, 29889, 21789, 29918, 1853, 1275, 525, 4056, 29893, 29941, 29906, 2396, 13, 9651, 1583, 29889, 21789, 29889, 1202, 29918, 5258, 29918, 3972, 29898, 1311, 29889, 4287, 267, 29918, 3972, 29897, 13, 9651, 1583, 29889, 21789, 29889, 1202, 29918, 5258, 877, 4287, 267, 1495, 13, 4706, 1583, 29889, 24299, 29961, 29900, 1822, 17833, 29918, 12650, 353, 518, 1311, 29889, 4287, 267, 29918, 1982, 29962, 13, 4706, 1583, 29889, 21789, 29889, 1202, 29918, 2856, 29918, 3972, 29898, 359, 29889, 2084, 29889, 7122, 29898, 1311, 29889, 4287, 267, 29918, 3972, 29892, 525, 4351, 8785, 13, 4706, 565, 10876, 29889, 12120, 29889, 27382, 2541, 877, 9389, 29374, 13, 9651, 1583, 29889, 21789, 29889, 1202, 29918, 5258, 877, 2273, 1495, 13, 4706, 25342, 10876, 29889, 12120, 1275, 525, 5080, 29941, 29906, 2396, 13, 9651, 565, 1583, 29889, 21789, 29889, 21789, 29918, 1853, 1275, 525, 1516, 7071, 2396, 13, 18884, 1583, 29889, 24299, 29961, 29900, 1822, 17833, 29918, 2324, 29918, 5085, 353, 6024, 29914, 6632, 23397, 5265, 29933, 29901, 1982, 29883, 4378, 2033, 13, 18884, 1583, 29889, 21789, 29889, 1202, 29918, 5258, 877, 17263, 2754, 29941, 29906, 1495, 13, 9651, 1583, 29889, 21789, 29889, 1202, 29918, 5258, 877, 29875, 561, 22833, 2754, 1495, 13, 9651, 1583, 29889, 21789, 29889, 1202, 29918, 5258, 877, 567, 2754, 1495, 13, 9651, 1583, 29889, 21789, 29889, 1202, 29918, 5258, 877, 5652, 29906, 29918, 29941, 29906, 1495, 13, 4706, 2048, 29918, 1062, 29889, 4282, 29918, 24299, 29898, 1311, 29897, 13, 13, 1678, 822, 2048, 29918, 4287, 267, 29898, 1311, 1125, 13, 4706, 396, 1311, 29889, 8382, 29918, 8513, 353, 29871, 6120, 29898, 1311, 29889, 8382, 29897, 470, 756, 5552, 29898, 9675, 29892, 525, 657, 7827, 999, 2798, 1495, 13, 4706, 5401, 29941, 29906, 29918, 1516, 7071, 353, 1583, 29889, 21789, 29889, 21789, 29918, 1853, 1275, 525, 1516, 7071, 29915, 13, 4706, 822, 2048, 7295, 13, 9651, 274, 15764, 353, 17411, 29888, 2227, 29907, 29915, 13, 9651, 8829, 353, 2897, 29889, 21813, 29889, 8552, 580, 13, 9651, 8829, 1839, 9207, 4375, 10749, 2033, 353, 525, 15300, 7122, 29898, 29916, 363, 921, 297, 313, 29883, 15764, 29892, 8829, 29889, 657, 877, 9207, 4375, 10749, 742, 6213, 876, 565, 921, 29897, 13, 9651, 1480, 29889, 3888, 877, 8893, 292, 274, 29899, 5114, 856, 1495, 13, 9651, 565, 5401, 29941, 29906, 29918, 1516, 7071, 29901, 13, 18884, 2279, 29918, 5014, 877, 9006, 29889, 8097, 847, 29907, 325, 29883, 4282, 29889, 10222, 742, 274, 9970, 29922, 1311, 29889, 4287, 267, 29918, 3972, 29892, 8829, 29922, 6272, 29892, 6473, 29922, 5574, 29897, 13, 9651, 1683, 29901, 13, 18884, 2279, 29918, 5675, 18959, 1982, 4287, 267, 29889, 29874, 7464, 274, 9970, 29922, 1311, 29889, 4287, 267, 29918, 3972, 29892, 8829, 29922, 6272, 29897, 13, 4706, 822, 5941, 7295, 13, 9651, 565, 5401, 29941, 29906, 29918, 1516, 7071, 29901, 13, 18884, 2279, 29918, 5014, 877, 9006, 29889, 8097, 847, 29907, 325, 29883, 4282, 29889, 10222, 5941, 742, 274, 9970, 29922, 1311, 29889, 4287, 267, 29918, 3972, 29892, 6473, 29922, 5574, 29897, 13, 9651, 1683, 29901, 13, 18884, 2279, 29918, 5675, 18959, 14941, 7464, 274, 9970, 29922, 1311, 29889, 4287, 267, 29918, 3972, 29897, 13, 4706, 565, 1583, 29889, 4287, 267, 29918, 14941, 29918, 12198, 29901, 13, 9651, 5941, 580, 13, 4706, 565, 451, 2897, 29889, 2084, 29889, 9933, 29898, 1311, 29889, 4287, 267, 29918, 1982, 1125, 13, 9651, 1480, 29889, 3888, 877, 29883, 29899, 5114, 4225, 304, 367, 13126, 29889, 1495, 13, 9651, 2048, 580, 13, 4706, 1683, 29901, 13, 9651, 1480, 29889, 3888, 877, 3782, 817, 304, 2048, 274, 29899, 5114, 29889, 1495, 13, 13, 2 ]
user_service/resources/auth.py
lewisemm/vistagrid-backend-k8
0
67379
<filename>user_service/resources/auth.py from flask_jwt_extended import ( create_access_token, jwt_required, get_jwt_identity ) from flask_restful import reqparse, Resource from user_service.models import User as UserModel class UserAuth(Resource): def __init__(self): self.parser = reqparse.RequestParser() self.parser.add_argument( 'username', type=str, help='username field is required.', required=True ) self.parser.add_argument( 'password', type=str, help='password field is required.', required=True ) def user_exists(self, username): user = UserModel.query.filter_by(username=username).first() return user def post(self): args = self.parser.parse_args() user = self.user_exists(args['username']) if user is None: return {'error': f'User {args["username"]} does not exist.'}, 404 if not user.verify_password(args['password']): return { 'error': f'Invalid password for user {args["username"]}.' }, 401 access_token = create_access_token(identity=user.user_id) return {'access_token': access_token}, 200 @jwt_required def get(self): try: current_user = get_jwt_identity() return {'username': current_user}, 200 except Exception as e: return {'error': f'{e}'}, 500
[ 1, 529, 9507, 29958, 1792, 29918, 5509, 29914, 13237, 29914, 5150, 29889, 2272, 13, 3166, 29784, 29918, 29926, 14554, 29918, 1062, 2760, 1053, 313, 13, 1678, 1653, 29918, 5943, 29918, 6979, 29892, 13, 1678, 432, 14554, 29918, 12403, 29892, 13, 1678, 679, 29918, 29926, 14554, 29918, 22350, 13, 29897, 13, 3166, 29784, 29918, 5060, 1319, 1053, 12428, 5510, 29892, 18981, 13, 3166, 1404, 29918, 5509, 29889, 9794, 1053, 4911, 408, 4911, 3195, 13, 13, 13, 1990, 4911, 6444, 29898, 6848, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 1583, 29889, 16680, 353, 12428, 5510, 29889, 3089, 11726, 580, 13, 4706, 1583, 29889, 16680, 29889, 1202, 29918, 23516, 29898, 13, 9651, 525, 6786, 742, 13, 9651, 1134, 29922, 710, 29892, 13, 9651, 1371, 2433, 6786, 1746, 338, 3734, 29889, 742, 13, 9651, 3734, 29922, 5574, 13, 4706, 1723, 13, 4706, 1583, 29889, 16680, 29889, 1202, 29918, 23516, 29898, 13, 9651, 525, 5630, 742, 13, 9651, 1134, 29922, 710, 29892, 13, 9651, 1371, 2433, 5630, 1746, 338, 3734, 29889, 742, 13, 9651, 3734, 29922, 5574, 13, 4706, 1723, 13, 268, 13, 1678, 822, 1404, 29918, 9933, 29898, 1311, 29892, 8952, 1125, 13, 4706, 1404, 353, 4911, 3195, 29889, 1972, 29889, 4572, 29918, 1609, 29898, 6786, 29922, 6786, 467, 4102, 580, 13, 4706, 736, 1404, 13, 13, 1678, 822, 1400, 29898, 1311, 1125, 13, 4706, 6389, 353, 1583, 29889, 16680, 29889, 5510, 29918, 5085, 580, 13, 4706, 1404, 353, 1583, 29889, 1792, 29918, 9933, 29898, 5085, 1839, 6786, 11287, 13, 4706, 565, 1404, 338, 6213, 29901, 13, 9651, 736, 11117, 2704, 2396, 285, 29915, 2659, 426, 5085, 3366, 6786, 3108, 29913, 947, 451, 1863, 6169, 1118, 29871, 29946, 29900, 29946, 13, 4706, 565, 451, 1404, 29889, 27902, 29918, 5630, 29898, 5085, 1839, 5630, 2033, 1125, 13, 9651, 736, 426, 13, 18884, 525, 2704, 2396, 285, 29915, 13919, 4800, 363, 1404, 426, 5085, 3366, 6786, 3108, 1836, 29915, 13, 9651, 2981, 29871, 29946, 29900, 29896, 13, 4706, 2130, 29918, 6979, 353, 1653, 29918, 5943, 29918, 6979, 29898, 22350, 29922, 1792, 29889, 1792, 29918, 333, 29897, 13, 4706, 736, 11117, 5943, 29918, 6979, 2396, 2130, 29918, 6979, 1118, 29871, 29906, 29900, 29900, 13, 268, 13, 1678, 732, 29926, 14554, 29918, 12403, 13, 1678, 822, 679, 29898, 1311, 1125, 13, 4706, 1018, 29901, 13, 9651, 1857, 29918, 1792, 353, 679, 29918, 29926, 14554, 29918, 22350, 580, 13, 9651, 736, 11117, 6786, 2396, 1857, 29918, 1792, 1118, 29871, 29906, 29900, 29900, 13, 4706, 5174, 8960, 408, 321, 29901, 13, 9651, 736, 11117, 2704, 2396, 285, 29915, 29912, 29872, 10162, 1118, 29871, 29945, 29900, 29900, 13, 2 ]
mumbleroni/tests/test_settings_datastructure.py
Peter-Morawski/MumbleRoni
1
141147
# -*- coding: utf-8 -*- import os import unittest from ..settings.datastructure import Settings class SettingsDataStructureTests(unittest.TestCase): def setUp(self): self._host = "example.domain.com" self._port = 1337 self._user = "MumbleRoni" self._password = "<PASSWORD>" self._default_channel_str = "In - Game" self._default_channel_int = 1 self._certificate_path = os.path.curdir def test_parse_from_none(self): with self.assertRaises(ValueError): Settings.from_dict(None) def test_parse_from_empty_dict(self): with self.assertRaises(ValueError): Settings.from_dict({}) def test_parse_from_dict_missing_host(self): settings = { "server": { "username": self._host, } } with self.assertRaises(ValueError): Settings.from_dict(settings) def test_parse_from_dict_empty_host(self): settings = { "server": { "host": "", } } with self.assertRaises(ValueError): Settings.from_dict(settings) def test_parse_from_dict_host_wrong_type(self): settings = { "server": { "host": 123, } } with self.assertRaises(ValueError): Settings.from_dict(settings) def test_parse_from_dict_missing_username(self): settings = { "server": { "host": self._host, } } with self.assertRaises(ValueError): Settings.from_dict(settings) def test_parse_from_dict_empty_username(self): settings = { "server": { "host": self._host, "username": "", } } with self.assertRaises(ValueError): Settings.from_dict(settings) def test_parse_from_dict_username_wrong_type(self): settings = { "server": { "host": self._host, "username": 123, } } with self.assertRaises(ValueError): Settings.from_dict(settings) def test_parse_from_dict_empty_password(self): settings = { "server": { "host": self._host, "username": self._user, "password": "" } } expected = Settings() expected.server.host = self._host expected.server.username = self._user expected.server.password = "" actual = Settings.from_dict(settings) assert expected.server.host == actual.server.host assert expected.server.username == actual.server.username assert expected.server.password == actual.server.password def test_parse_from_dict_password_wrong_type(self): settings = { "server": { "host": self._host, "username": self._user, "password": <PASSWORD> } } with self.assertRaises(ValueError): Settings.from_dict(settings) def test_parse_from_dict_default_channel_wrong_type(self): settings = { "server": { "host": self._host, "username": self._user, "default_channel": False, } } with self.assertRaises(ValueError): Settings.from_dict(settings) def test_parse_from_dict_default_channel_str(self): settings = { "server": { "host": self._host, "username": self._user, "default_channel": self._default_channel_str, } } expected = Settings() expected.server.host = self._host expected.server.username = self._user expected.server.default_channel = self._default_channel_str actual = Settings.from_dict(settings) assert expected.server.host == actual.server.host assert expected.server.username == actual.server.username assert expected.server.default_channel == actual.server.default_channel def test_parse_from_dict_default_channel_int(self): settings = { "server": { "host": self._host, "username": self._user, "default_channel": self._default_channel_int, } } expected = Settings() expected.server.host = self._host expected.server.username = self._user expected.server.default_channel = self._default_channel_int actual = Settings.from_dict(settings) assert expected.server.host == actual.server.host assert expected.server.username == actual.server.username assert expected.server.default_channel == actual.server.default_channel def test_parse_from_dict_port_wrong_type(self): settings = { "server": { "host": self._host, "username": self._user, "port": "some_port", } } with self.assertRaises(ValueError): Settings.from_dict(settings) def test_parse_from_dict_port_is_none(self): settings = { "server": { "host": self._host, "username": self._user, "port": None, } } with self.assertRaises(ValueError): Settings.from_dict(settings) def test_parse_from_dict_port(self): settings = { "server": { "host": self._host, "username": self._user, "port": self._port, } } expected = Settings() expected.server.host = self._host expected.server.username = self._user expected.server.port = self._port actual = Settings.from_dict(settings) assert expected.server.host == actual.server.host assert expected.server.username == actual.server.username assert expected.server.port == actual.server.port def test_parse_from_dict_certificate_path_wrong_type(self): settings = { "server": { "host": self._host, "username": self._user, "certificate_path": 123, } } with self.assertRaises(ValueError): Settings.from_dict(settings) def test_parse_from_dict_certificate_path_invalid_path(self): settings = { "server": { "host": self._host, "username": self._user, "certificate_path": "invalid", } } with self.assertRaises(ValueError): Settings.from_dict(settings) def test_parse_from_dict_certificate_path_cur_dir(self): settings = { "server": { "host": self._host, "username": self._user, "certificate_path": self._certificate_path, } } expected = Settings() expected.server.host = self._host expected.server.username = self._user expected.server.certificate_path = self._certificate_path actual = Settings.from_dict(settings) assert expected.server.host == actual.server.host assert expected.server.username == actual.server.username assert expected.server.certificate_path == actual.server.certificate_path def test_parse_from_valid_dict_1(self): settings = { "server": { "host": self._host, "username": self._user, } } expected = Settings() expected.server.host = self._host expected.server.username = self._user actual = Settings.from_dict(settings) assert actual.server.host is expected.server.host assert actual.server.username is expected.server.username if __name__ == '__main__': unittest.main()
[ 1, 396, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 13, 5215, 2897, 13, 5215, 443, 27958, 13, 3166, 6317, 11027, 29889, 4130, 7614, 12425, 1053, 19215, 13, 13, 13, 1990, 19215, 1469, 5015, 12425, 24376, 29898, 348, 27958, 29889, 3057, 8259, 1125, 13, 1678, 822, 731, 3373, 29898, 1311, 1125, 13, 4706, 1583, 3032, 3069, 353, 376, 4773, 29889, 7247, 29889, 510, 29908, 13, 4706, 1583, 3032, 637, 353, 29871, 29896, 29941, 29941, 29955, 13, 4706, 1583, 3032, 1792, 353, 376, 29924, 15563, 29934, 5271, 29908, 13, 4706, 1583, 3032, 5630, 353, 9872, 25711, 17013, 11903, 13, 4706, 1583, 3032, 4381, 29918, 12719, 29918, 710, 353, 376, 797, 448, 8448, 29908, 13, 4706, 1583, 3032, 4381, 29918, 12719, 29918, 524, 353, 29871, 29896, 13, 4706, 1583, 3032, 6327, 8021, 29918, 2084, 353, 2897, 29889, 2084, 29889, 2764, 3972, 13, 13, 1678, 822, 1243, 29918, 5510, 29918, 3166, 29918, 9290, 29898, 1311, 1125, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 29898, 1917, 2392, 1125, 13, 9651, 19215, 29889, 3166, 29918, 8977, 29898, 8516, 29897, 13, 13, 1678, 822, 1243, 29918, 5510, 29918, 3166, 29918, 6310, 29918, 8977, 29898, 1311, 1125, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 29898, 1917, 2392, 1125, 13, 9651, 19215, 29889, 3166, 29918, 8977, 3319, 1800, 13, 13, 1678, 822, 1243, 29918, 5510, 29918, 3166, 29918, 8977, 29918, 27259, 29918, 3069, 29898, 1311, 1125, 13, 4706, 6055, 353, 426, 13, 9651, 376, 2974, 1115, 426, 13, 18884, 376, 6786, 1115, 1583, 3032, 3069, 29892, 13, 9651, 500, 13, 4706, 500, 13, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 29898, 1917, 2392, 1125, 13, 9651, 19215, 29889, 3166, 29918, 8977, 29898, 11027, 29897, 13, 13, 1678, 822, 1243, 29918, 5510, 29918, 3166, 29918, 8977, 29918, 6310, 29918, 3069, 29898, 1311, 1125, 13, 4706, 6055, 353, 426, 13, 9651, 376, 2974, 1115, 426, 13, 18884, 376, 3069, 1115, 12633, 13, 9651, 500, 13, 4706, 500, 13, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 29898, 1917, 2392, 1125, 13, 9651, 19215, 29889, 3166, 29918, 8977, 29898, 11027, 29897, 13, 13, 1678, 822, 1243, 29918, 5510, 29918, 3166, 29918, 8977, 29918, 3069, 29918, 15866, 549, 29918, 1853, 29898, 1311, 1125, 13, 4706, 6055, 353, 426, 13, 9651, 376, 2974, 1115, 426, 13, 18884, 376, 3069, 1115, 29871, 29896, 29906, 29941, 29892, 13, 9651, 500, 13, 4706, 500, 13, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 29898, 1917, 2392, 1125, 13, 9651, 19215, 29889, 3166, 29918, 8977, 29898, 11027, 29897, 13, 13, 1678, 822, 1243, 29918, 5510, 29918, 3166, 29918, 8977, 29918, 27259, 29918, 6786, 29898, 1311, 1125, 13, 4706, 6055, 353, 426, 13, 9651, 376, 2974, 1115, 426, 13, 18884, 376, 3069, 1115, 1583, 3032, 3069, 29892, 13, 9651, 500, 13, 4706, 500, 13, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 29898, 1917, 2392, 1125, 13, 9651, 19215, 29889, 3166, 29918, 8977, 29898, 11027, 29897, 13, 13, 1678, 822, 1243, 29918, 5510, 29918, 3166, 29918, 8977, 29918, 6310, 29918, 6786, 29898, 1311, 1125, 13, 4706, 6055, 353, 426, 13, 9651, 376, 2974, 1115, 426, 13, 18884, 376, 3069, 1115, 1583, 3032, 3069, 29892, 13, 18884, 376, 6786, 1115, 12633, 13, 9651, 500, 13, 4706, 500, 13, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 29898, 1917, 2392, 1125, 13, 9651, 19215, 29889, 3166, 29918, 8977, 29898, 11027, 29897, 13, 13, 1678, 822, 1243, 29918, 5510, 29918, 3166, 29918, 8977, 29918, 6786, 29918, 15866, 549, 29918, 1853, 29898, 1311, 1125, 13, 4706, 6055, 353, 426, 13, 9651, 376, 2974, 1115, 426, 13, 18884, 376, 3069, 1115, 1583, 3032, 3069, 29892, 13, 18884, 376, 6786, 1115, 29871, 29896, 29906, 29941, 29892, 13, 9651, 500, 13, 4706, 500, 13, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 29898, 1917, 2392, 1125, 13, 9651, 19215, 29889, 3166, 29918, 8977, 29898, 11027, 29897, 13, 13, 1678, 822, 1243, 29918, 5510, 29918, 3166, 29918, 8977, 29918, 6310, 29918, 5630, 29898, 1311, 1125, 13, 4706, 6055, 353, 426, 13, 9651, 376, 2974, 1115, 426, 13, 18884, 376, 3069, 1115, 1583, 3032, 3069, 29892, 13, 18884, 376, 6786, 1115, 1583, 3032, 1792, 29892, 13, 18884, 376, 5630, 1115, 5124, 13, 9651, 500, 13, 4706, 500, 13, 13, 4706, 3806, 353, 19215, 580, 13, 4706, 3806, 29889, 2974, 29889, 3069, 353, 1583, 3032, 3069, 13, 4706, 3806, 29889, 2974, 29889, 6786, 353, 1583, 3032, 1792, 13, 4706, 3806, 29889, 2974, 29889, 5630, 353, 5124, 13, 13, 4706, 3935, 353, 19215, 29889, 3166, 29918, 8977, 29898, 11027, 29897, 13, 13, 4706, 4974, 3806, 29889, 2974, 29889, 3069, 1275, 3935, 29889, 2974, 29889, 3069, 13, 4706, 4974, 3806, 29889, 2974, 29889, 6786, 1275, 3935, 29889, 2974, 29889, 6786, 13, 4706, 4974, 3806, 29889, 2974, 29889, 5630, 1275, 3935, 29889, 2974, 29889, 5630, 13, 13, 1678, 822, 1243, 29918, 5510, 29918, 3166, 29918, 8977, 29918, 5630, 29918, 15866, 549, 29918, 1853, 29898, 1311, 1125, 13, 4706, 6055, 353, 426, 13, 9651, 376, 2974, 1115, 426, 13, 18884, 376, 3069, 1115, 1583, 3032, 3069, 29892, 13, 18884, 376, 6786, 1115, 1583, 3032, 1792, 29892, 13, 18884, 376, 5630, 1115, 529, 25711, 17013, 29958, 13, 9651, 500, 13, 4706, 500, 13, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 29898, 1917, 2392, 1125, 13, 9651, 19215, 29889, 3166, 29918, 8977, 29898, 11027, 29897, 13, 13, 1678, 822, 1243, 29918, 5510, 29918, 3166, 29918, 8977, 29918, 4381, 29918, 12719, 29918, 15866, 549, 29918, 1853, 29898, 1311, 1125, 13, 4706, 6055, 353, 426, 13, 9651, 376, 2974, 1115, 426, 13, 18884, 376, 3069, 1115, 1583, 3032, 3069, 29892, 13, 18884, 376, 6786, 1115, 1583, 3032, 1792, 29892, 13, 18884, 376, 4381, 29918, 12719, 1115, 7700, 29892, 13, 9651, 500, 13, 4706, 500, 13, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 29898, 1917, 2392, 1125, 13, 9651, 19215, 29889, 3166, 29918, 8977, 29898, 11027, 29897, 13, 13, 1678, 822, 1243, 29918, 5510, 29918, 3166, 29918, 8977, 29918, 4381, 29918, 12719, 29918, 710, 29898, 1311, 1125, 13, 4706, 6055, 353, 426, 13, 9651, 376, 2974, 1115, 426, 13, 18884, 376, 3069, 1115, 1583, 3032, 3069, 29892, 13, 18884, 376, 6786, 1115, 1583, 3032, 1792, 29892, 13, 18884, 376, 4381, 29918, 12719, 1115, 1583, 3032, 4381, 29918, 12719, 29918, 710, 29892, 13, 9651, 500, 13, 4706, 500, 13, 13, 4706, 3806, 353, 19215, 580, 13, 4706, 3806, 29889, 2974, 29889, 3069, 353, 1583, 3032, 3069, 13, 4706, 3806, 29889, 2974, 29889, 6786, 353, 1583, 3032, 1792, 13, 4706, 3806, 29889, 2974, 29889, 4381, 29918, 12719, 353, 1583, 3032, 4381, 29918, 12719, 29918, 710, 13, 13, 4706, 3935, 353, 19215, 29889, 3166, 29918, 8977, 29898, 11027, 29897, 13, 13, 4706, 4974, 3806, 29889, 2974, 29889, 3069, 1275, 3935, 29889, 2974, 29889, 3069, 13, 4706, 4974, 3806, 29889, 2974, 29889, 6786, 1275, 3935, 29889, 2974, 29889, 6786, 13, 4706, 4974, 3806, 29889, 2974, 29889, 4381, 29918, 12719, 1275, 3935, 29889, 2974, 29889, 4381, 29918, 12719, 13, 13, 1678, 822, 1243, 29918, 5510, 29918, 3166, 29918, 8977, 29918, 4381, 29918, 12719, 29918, 524, 29898, 1311, 1125, 13, 4706, 6055, 353, 426, 13, 9651, 376, 2974, 1115, 426, 13, 18884, 376, 3069, 1115, 1583, 3032, 3069, 29892, 13, 18884, 376, 6786, 1115, 1583, 3032, 1792, 29892, 13, 18884, 376, 4381, 29918, 12719, 1115, 1583, 3032, 4381, 29918, 12719, 29918, 524, 29892, 13, 9651, 500, 13, 4706, 500, 13, 13, 4706, 3806, 353, 19215, 580, 13, 4706, 3806, 29889, 2974, 29889, 3069, 353, 1583, 3032, 3069, 13, 4706, 3806, 29889, 2974, 29889, 6786, 353, 1583, 3032, 1792, 13, 4706, 3806, 29889, 2974, 29889, 4381, 29918, 12719, 353, 1583, 3032, 4381, 29918, 12719, 29918, 524, 13, 13, 4706, 3935, 353, 19215, 29889, 3166, 29918, 8977, 29898, 11027, 29897, 13, 13, 4706, 4974, 3806, 29889, 2974, 29889, 3069, 1275, 3935, 29889, 2974, 29889, 3069, 13, 4706, 4974, 3806, 29889, 2974, 29889, 6786, 1275, 3935, 29889, 2974, 29889, 6786, 13, 4706, 4974, 3806, 29889, 2974, 29889, 4381, 29918, 12719, 1275, 3935, 29889, 2974, 29889, 4381, 29918, 12719, 13, 13, 1678, 822, 1243, 29918, 5510, 29918, 3166, 29918, 8977, 29918, 637, 29918, 15866, 549, 29918, 1853, 29898, 1311, 1125, 13, 4706, 6055, 353, 426, 13, 9651, 376, 2974, 1115, 426, 13, 18884, 376, 3069, 1115, 1583, 3032, 3069, 29892, 13, 18884, 376, 6786, 1115, 1583, 3032, 1792, 29892, 13, 18884, 376, 637, 1115, 376, 5372, 29918, 637, 613, 13, 9651, 500, 13, 4706, 500, 13, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 29898, 1917, 2392, 1125, 13, 9651, 19215, 29889, 3166, 29918, 8977, 29898, 11027, 29897, 13, 13, 1678, 822, 1243, 29918, 5510, 29918, 3166, 29918, 8977, 29918, 637, 29918, 275, 29918, 9290, 29898, 1311, 1125, 13, 4706, 6055, 353, 426, 13, 9651, 376, 2974, 1115, 426, 13, 18884, 376, 3069, 1115, 1583, 3032, 3069, 29892, 13, 18884, 376, 6786, 1115, 1583, 3032, 1792, 29892, 13, 18884, 376, 637, 1115, 6213, 29892, 13, 9651, 500, 13, 4706, 500, 13, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 29898, 1917, 2392, 1125, 13, 9651, 19215, 29889, 3166, 29918, 8977, 29898, 11027, 29897, 13, 13, 1678, 822, 1243, 29918, 5510, 29918, 3166, 29918, 8977, 29918, 637, 29898, 1311, 1125, 13, 4706, 6055, 353, 426, 13, 9651, 376, 2974, 1115, 426, 13, 18884, 376, 3069, 1115, 1583, 3032, 3069, 29892, 13, 18884, 376, 6786, 1115, 1583, 3032, 1792, 29892, 13, 18884, 376, 637, 1115, 1583, 3032, 637, 29892, 13, 9651, 500, 13, 4706, 500, 13, 13, 4706, 3806, 353, 19215, 580, 13, 4706, 3806, 29889, 2974, 29889, 3069, 353, 1583, 3032, 3069, 13, 4706, 3806, 29889, 2974, 29889, 6786, 353, 1583, 3032, 1792, 13, 4706, 3806, 29889, 2974, 29889, 637, 353, 1583, 3032, 637, 13, 13, 4706, 3935, 353, 19215, 29889, 3166, 29918, 8977, 29898, 11027, 29897, 13, 13, 4706, 4974, 3806, 29889, 2974, 29889, 3069, 1275, 3935, 29889, 2974, 29889, 3069, 13, 4706, 4974, 3806, 29889, 2974, 29889, 6786, 1275, 3935, 29889, 2974, 29889, 6786, 13, 4706, 4974, 3806, 29889, 2974, 29889, 637, 1275, 3935, 29889, 2974, 29889, 637, 13, 13, 1678, 822, 1243, 29918, 5510, 29918, 3166, 29918, 8977, 29918, 6327, 8021, 29918, 2084, 29918, 15866, 549, 29918, 1853, 29898, 1311, 1125, 13, 4706, 6055, 353, 426, 13, 9651, 376, 2974, 1115, 426, 13, 18884, 376, 3069, 1115, 1583, 3032, 3069, 29892, 13, 18884, 376, 6786, 1115, 1583, 3032, 1792, 29892, 13, 18884, 376, 6327, 8021, 29918, 2084, 1115, 29871, 29896, 29906, 29941, 29892, 13, 9651, 500, 13, 4706, 500, 13, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 29898, 1917, 2392, 1125, 13, 9651, 19215, 29889, 3166, 29918, 8977, 29898, 11027, 29897, 13, 13, 1678, 822, 1243, 29918, 5510, 29918, 3166, 29918, 8977, 29918, 6327, 8021, 29918, 2084, 29918, 20965, 29918, 2084, 29898, 1311, 1125, 13, 4706, 6055, 353, 426, 13, 9651, 376, 2974, 1115, 426, 13, 18884, 376, 3069, 1115, 1583, 3032, 3069, 29892, 13, 18884, 376, 6786, 1115, 1583, 3032, 1792, 29892, 13, 18884, 376, 6327, 8021, 29918, 2084, 1115, 376, 20965, 613, 13, 9651, 500, 13, 4706, 500, 13, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 29898, 1917, 2392, 1125, 13, 9651, 19215, 29889, 3166, 29918, 8977, 29898, 11027, 29897, 13, 13, 1678, 822, 1243, 29918, 5510, 29918, 3166, 29918, 8977, 29918, 6327, 8021, 29918, 2084, 29918, 2764, 29918, 3972, 29898, 1311, 1125, 13, 4706, 6055, 353, 426, 13, 9651, 376, 2974, 1115, 426, 13, 18884, 376, 3069, 1115, 1583, 3032, 3069, 29892, 13, 18884, 376, 6786, 1115, 1583, 3032, 1792, 29892, 13, 18884, 376, 6327, 8021, 29918, 2084, 1115, 1583, 3032, 6327, 8021, 29918, 2084, 29892, 13, 9651, 500, 13, 4706, 500, 13, 13, 4706, 3806, 353, 19215, 580, 13, 4706, 3806, 29889, 2974, 29889, 3069, 353, 1583, 3032, 3069, 13, 4706, 3806, 29889, 2974, 29889, 6786, 353, 1583, 3032, 1792, 13, 4706, 3806, 29889, 2974, 29889, 6327, 8021, 29918, 2084, 353, 1583, 3032, 6327, 8021, 29918, 2084, 13, 13, 4706, 3935, 353, 19215, 29889, 3166, 29918, 8977, 29898, 11027, 29897, 13, 13, 4706, 4974, 3806, 29889, 2974, 29889, 3069, 1275, 3935, 29889, 2974, 29889, 3069, 13, 4706, 4974, 3806, 29889, 2974, 29889, 6786, 1275, 3935, 29889, 2974, 29889, 6786, 13, 4706, 4974, 3806, 29889, 2974, 29889, 6327, 8021, 29918, 2084, 1275, 3935, 29889, 2974, 29889, 6327, 8021, 29918, 2084, 13, 13, 1678, 822, 1243, 29918, 5510, 29918, 3166, 29918, 3084, 29918, 8977, 29918, 29896, 29898, 1311, 1125, 13, 4706, 6055, 353, 426, 13, 9651, 376, 2974, 1115, 426, 13, 18884, 376, 3069, 1115, 1583, 3032, 3069, 29892, 13, 18884, 376, 6786, 1115, 1583, 3032, 1792, 29892, 13, 9651, 500, 13, 4706, 500, 13, 4706, 3806, 353, 19215, 580, 13, 4706, 3806, 29889, 2974, 29889, 3069, 353, 1583, 3032, 3069, 13, 4706, 3806, 29889, 2974, 29889, 6786, 353, 1583, 3032, 1792, 13, 13, 4706, 3935, 353, 19215, 29889, 3166, 29918, 8977, 29898, 11027, 29897, 13, 13, 4706, 4974, 3935, 29889, 2974, 29889, 3069, 338, 3806, 29889, 2974, 29889, 3069, 13, 4706, 4974, 3935, 29889, 2974, 29889, 6786, 338, 3806, 29889, 2974, 29889, 6786, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 443, 27958, 29889, 3396, 580, 13, 2 ]
3rdParty/Berkeley-DB/db-5.3.21.NC/build.py
rtobar/askapsoft
1
73346
import os from askapdev.rbuild.builders import Autotools as Builder import askapdev.rbuild.utils as utils builder = Builder(buildsubdir="build_unix", confcommand='../dist/configure') builder.remote_archive = "db-5.3.21.NC.tar.gz" if os.uname()[4] == 'x86_64': builder.add_option('--with-pic') #builder.add_option('--disable-shared') # Need shared libraries for Java. builder.add_option('--enable-cxx') builder.add_option('--enable-java') builder.nowarnings = True # On Mac OSX jni.h is in a location where BerkleyDB can't find it. Including # $JAVA_HOME/include (and include/darwin) fixes this. The JAVA_HOME environment # can be setup on OSX like so (for bash): export JAVA_HOME=$(/usr/libexec/java_home) platform = utils.get_platform() if platform['system'] == 'Darwin' and os.environ.has_key("JAVA_HOME"): javahome = os.environ.get('JAVA_HOME') # builder.add_option('JAVACFLAGS="-source 1.7 -target 1.7" CPPFLAGS="-I%s/include -I%s/include/darwin"' %(javahome,javahome)) if '1.8' in javahome: builder.add_option('JAVACFLAGS="-source 1.7 -target 1.7"') builder.add_option('CPPFLAGS="-I%s/include -I%s/include/darwin"' %(javahome,javahome)) # The Cray cc and c++ compilers wrappers break here, so go directly to gcc and g++ if os.environ.has_key("CRAYOS_VERSION"): builder.add_env("CC","gcc") builder.add_env("CXX","g++") builder.add_env("LINK","g++") builder.add_env("SHLINK","g++") builder.build()
[ 1, 1053, 2897, 13, 13, 3166, 2244, 481, 3359, 29889, 29878, 4282, 29889, 4282, 414, 1053, 5202, 327, 8789, 408, 5373, 2700, 13, 5215, 2244, 481, 3359, 29889, 29878, 4282, 29889, 13239, 408, 3667, 29879, 13, 13, 16409, 353, 5373, 2700, 29898, 4282, 1491, 3972, 543, 4282, 29918, 24538, 613, 13, 462, 29871, 1970, 6519, 2433, 6995, 5721, 29914, 17591, 1495, 13, 16409, 29889, 16674, 29918, 10867, 353, 376, 2585, 29899, 29945, 29889, 29941, 29889, 29906, 29896, 29889, 15868, 29889, 12637, 29889, 18828, 29908, 13, 13, 361, 2897, 29889, 348, 420, 580, 29961, 29946, 29962, 1275, 525, 29916, 29947, 29953, 29918, 29953, 29946, 2396, 13, 1678, 12856, 29889, 1202, 29918, 3385, 877, 489, 2541, 29899, 16447, 1495, 13, 13, 29937, 16409, 29889, 1202, 29918, 3385, 877, 489, 20472, 29899, 12366, 1495, 396, 20768, 7258, 9562, 363, 3355, 29889, 13, 16409, 29889, 1202, 29918, 3385, 877, 489, 12007, 29899, 29883, 4419, 1495, 13, 16409, 29889, 1202, 29918, 3385, 877, 489, 12007, 29899, 1645, 1495, 13, 16409, 29889, 3707, 2753, 886, 353, 5852, 13, 13, 29937, 1551, 4326, 6570, 29990, 432, 1240, 29889, 29882, 338, 297, 263, 29871, 4423, 988, 2292, 29895, 2330, 4051, 508, 29915, 29873, 1284, 372, 29889, 512, 22368, 13, 29937, 395, 29967, 26612, 29918, 17353, 29914, 2856, 313, 392, 3160, 29914, 16702, 5080, 29897, 24626, 445, 29889, 450, 435, 26612, 29918, 17353, 5177, 13, 29937, 508, 367, 6230, 373, 6570, 29990, 763, 577, 313, 1454, 10891, 1125, 5609, 435, 26612, 29918, 17353, 6080, 18854, 4855, 29914, 1982, 4258, 29914, 1645, 29918, 5184, 29897, 13, 12120, 353, 29871, 3667, 29879, 29889, 657, 29918, 12120, 580, 13, 361, 7481, 1839, 5205, 2033, 1275, 525, 29928, 279, 5080, 29915, 322, 2897, 29889, 21813, 29889, 5349, 29918, 1989, 703, 29967, 26612, 29918, 17353, 29908, 1125, 13, 1678, 26673, 801, 608, 353, 2897, 29889, 21813, 29889, 657, 877, 29967, 26612, 29918, 17353, 1495, 13, 29937, 1678, 12856, 29889, 1202, 29918, 3385, 877, 29967, 7520, 2477, 18823, 10749, 543, 29899, 4993, 29871, 29896, 29889, 29955, 448, 5182, 29871, 29896, 29889, 29955, 29908, 28505, 13691, 4375, 10749, 543, 29899, 29902, 29995, 29879, 29914, 2856, 448, 29902, 29995, 29879, 29914, 2856, 29914, 16702, 5080, 29908, 29915, 1273, 29898, 9494, 801, 608, 29892, 9494, 801, 608, 876, 13, 1678, 565, 525, 29896, 29889, 29947, 29915, 297, 26673, 801, 608, 29901, 13, 4706, 12856, 29889, 1202, 29918, 3385, 877, 29967, 7520, 2477, 18823, 10749, 543, 29899, 4993, 29871, 29896, 29889, 29955, 448, 5182, 29871, 29896, 29889, 29955, 29908, 1495, 13, 1678, 12856, 29889, 1202, 29918, 3385, 877, 6271, 13691, 4375, 10749, 543, 29899, 29902, 29995, 29879, 29914, 2856, 448, 29902, 29995, 29879, 29914, 2856, 29914, 16702, 5080, 29908, 29915, 1273, 29898, 9494, 801, 608, 29892, 9494, 801, 608, 876, 13, 13, 29937, 450, 315, 764, 21759, 322, 274, 1817, 752, 22058, 11463, 22437, 2867, 1244, 29892, 577, 748, 4153, 304, 20243, 322, 330, 1817, 13, 361, 2897, 29889, 21813, 29889, 5349, 29918, 1989, 703, 29907, 22800, 3267, 29918, 16358, 29908, 1125, 13, 1678, 12856, 29889, 1202, 29918, 6272, 703, 4174, 3284, 19644, 1159, 13, 1678, 12856, 29889, 1202, 29918, 6272, 703, 29907, 6247, 3284, 29887, 1817, 1159, 13, 1678, 12856, 29889, 1202, 29918, 6272, 703, 23714, 29968, 3284, 29887, 1817, 1159, 13, 1678, 12856, 29889, 1202, 29918, 6272, 703, 7068, 23714, 29968, 3284, 29887, 1817, 1159, 13, 13, 16409, 29889, 4282, 580, 13, 2 ]
server/form/mongo.py
SRM-IST-KTR/ossmosis
6
3550
import os from pymongo import MongoClient from dotenv import load_dotenv def database_entry(data): try: load_dotenv() mongo_string = os.getenv('MONGODB_AUTH_URI') client = MongoClient(mongo_string) database = client[os.getenv('MONGODB_DB')] col = database['users'] col.insert_one(data) return True except Exception as e: print(e) return False if __name__ == "__main__": pass
[ 1, 1053, 2897, 13, 3166, 282, 962, 7443, 1053, 18294, 4032, 13, 3166, 8329, 6272, 1053, 2254, 29918, 6333, 6272, 13, 13, 13, 1753, 2566, 29918, 8269, 29898, 1272, 1125, 13, 1678, 1018, 29901, 13, 4706, 2254, 29918, 6333, 6272, 580, 13, 4706, 19476, 29918, 1807, 353, 2897, 29889, 657, 6272, 877, 22877, 17080, 4051, 29918, 20656, 29950, 29918, 15551, 1495, 13, 4706, 3132, 353, 18294, 4032, 29898, 29885, 7443, 29918, 1807, 29897, 13, 4706, 2566, 353, 3132, 29961, 359, 29889, 657, 6272, 877, 22877, 17080, 4051, 29918, 4051, 1495, 29962, 13, 4706, 784, 353, 2566, 1839, 7193, 2033, 13, 4706, 784, 29889, 7851, 29918, 650, 29898, 1272, 29897, 13, 4706, 736, 5852, 13, 1678, 5174, 8960, 408, 321, 29901, 13, 4706, 1596, 29898, 29872, 29897, 13, 4706, 736, 7700, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 1209, 13, 2 ]
tests/test_asyncio.py
adityaoza1901/AioContext
37
100568
<filename>tests/test_asyncio.py<gh_stars>10-100 import asyncio import pytest @asyncio.coroutine def _check_update_context(context): assert context == {'key1': 'value1'} context['key1'] = 'value2' context['key2'] = 'value2' assert context == {'key1': 'value2', 'key2': 'value2'} @pytest.mark.asyncio @asyncio.coroutine def test_ensure_future(context, context_loop): context['key1'] = 'value1' yield from asyncio.ensure_future(_check_update_context(context)) assert context == {'key1': 'value1'} @pytest.mark.asyncio @asyncio.coroutine def test_wait_for(context, context_loop): context['key1'] = 'value1' yield from asyncio.wait_for(_check_update_context(context), 1) assert context == {'key1': 'value1'} @pytest.mark.asyncio @asyncio.coroutine def test_gather(context, context_loop): context['key1'] = 'value1' yield from asyncio.gather(_check_update_context(context)) assert context == {'key1': 'value1'}
[ 1, 529, 9507, 29958, 21150, 29914, 1688, 29918, 294, 948, 3934, 29889, 2272, 29966, 12443, 29918, 303, 1503, 29958, 29896, 29900, 29899, 29896, 29900, 29900, 13, 5215, 408, 948, 3934, 13, 13, 5215, 11451, 1688, 13, 13, 13, 29992, 294, 948, 3934, 29889, 2616, 449, 457, 13, 1753, 903, 3198, 29918, 5504, 29918, 4703, 29898, 4703, 1125, 13, 1678, 4974, 3030, 1275, 11117, 1989, 29896, 2396, 525, 1767, 29896, 10827, 13, 1678, 3030, 1839, 1989, 29896, 2033, 353, 525, 1767, 29906, 29915, 13, 1678, 3030, 1839, 1989, 29906, 2033, 353, 525, 1767, 29906, 29915, 13, 1678, 4974, 3030, 1275, 11117, 1989, 29896, 2396, 525, 1767, 29906, 742, 525, 1989, 29906, 2396, 525, 1767, 29906, 10827, 13, 13, 13, 29992, 2272, 1688, 29889, 3502, 29889, 294, 948, 3934, 13, 29992, 294, 948, 3934, 29889, 2616, 449, 457, 13, 1753, 1243, 29918, 7469, 29918, 29888, 9130, 29898, 4703, 29892, 3030, 29918, 7888, 1125, 13, 1678, 3030, 1839, 1989, 29896, 2033, 353, 525, 1767, 29896, 29915, 13, 1678, 7709, 515, 408, 948, 3934, 29889, 7469, 29918, 29888, 9130, 7373, 3198, 29918, 5504, 29918, 4703, 29898, 4703, 876, 13, 1678, 4974, 3030, 1275, 11117, 1989, 29896, 2396, 525, 1767, 29896, 10827, 13, 13, 13, 29992, 2272, 1688, 29889, 3502, 29889, 294, 948, 3934, 13, 29992, 294, 948, 3934, 29889, 2616, 449, 457, 13, 1753, 1243, 29918, 10685, 29918, 1454, 29898, 4703, 29892, 3030, 29918, 7888, 1125, 13, 1678, 3030, 1839, 1989, 29896, 2033, 353, 525, 1767, 29896, 29915, 13, 1678, 7709, 515, 408, 948, 3934, 29889, 10685, 29918, 1454, 7373, 3198, 29918, 5504, 29918, 4703, 29898, 4703, 511, 29871, 29896, 29897, 13, 1678, 4974, 3030, 1275, 11117, 1989, 29896, 2396, 525, 1767, 29896, 10827, 13, 13, 13, 29992, 2272, 1688, 29889, 3502, 29889, 294, 948, 3934, 13, 29992, 294, 948, 3934, 29889, 2616, 449, 457, 13, 1753, 1243, 29918, 29887, 1624, 29898, 4703, 29892, 3030, 29918, 7888, 1125, 13, 1678, 3030, 1839, 1989, 29896, 2033, 353, 525, 1767, 29896, 29915, 13, 1678, 7709, 515, 408, 948, 3934, 29889, 29887, 1624, 7373, 3198, 29918, 5504, 29918, 4703, 29898, 4703, 876, 13, 1678, 4974, 3030, 1275, 11117, 1989, 29896, 2396, 525, 1767, 29896, 10827, 13, 2 ]
rubin_sim/maf/mafContrib/GRBTransientMetric.py
RileyWClarke/flarubin
0
1602206
from builtins import zip # Gamma-ray burst afterglow metric # <EMAIL> import rubin_sim.maf.metrics as metrics import numpy as np __all__ = ['GRBTransientMetric'] class GRBTransientMetric(metrics.BaseMetric): """Detections for on-axis GRB afterglows decaying as F(t) = F(1min)((t-t0)/1min)^-alpha. No jet break, for now. Derived from TransientMetric, but calculated with reduce functions to enable-band specific counts. Burst parameters taken from 2011PASP..123.1034J. Simplifications: no color variation or evolution encoded yet. no jet breaks. not treating off-axis events. Parameters ---------- alpha : float, temporal decay index Default = 1.0 apparent_mag_1min_mean : float, mean magnitude at 1 minute after burst Default = 15.35 apparent_mag_1min_sigma : float, std of magnitudes at 1 minute after burst Default = 1.59 transDuration : float, optional How long the transient lasts (days). Default 10. surveyDuration : float, optional Length of survey (years). Default 10. surveyStart : float, optional MJD for the survey start date. Default None (uses the time of the first observation). detectM5Plus : float, optional An observation will be used if the light curve magnitude is brighter than m5+detectM5Plus. Default 0. nPerFilter : int, optional Number of separate detections of the light curve above the detectM5Plus theshold (in a single filter) for the light curve to be counted. Default 1. nFilters : int, optional Number of filters that need to be observed nPerFilter times, with differences minDeltaMag, for an object to be counted as detected. Default 1. minDeltaMag : float, optional magnitude difference between detections in the same filter required for second+ detection to be counted. For example, if minDeltaMag = 0.1 mag and two consecutive observations differ only by 0.05 mag, those two detections will only count as one. (Better would be a SNR-based discrimination of lightcurve change.) Default 0. nPhaseCheck : int, optional Sets the number of phases that should be checked. One can imagine pathological cadences where many objects pass the detection criteria, but would not if the observations were offset by a phase-shift. Default 1. """ def __init__(self, alpha=1, apparent_mag_1min_mean=15.35, apparent_mag_1min_sigma=1.59, metricName='GRBTransientMetric', mjdCol='expMJD', m5Col='fiveSigmaDepth', filterCol='filter', transDuration=10., surveyDuration=10., surveyStart=None, detectM5Plus=0., nPerFilter=1, nFilters=1, minDeltaMag=0., nPhaseCheck=1, **kwargs): self.mjdCol = mjdCol self.m5Col = m5Col self.filterCol = filterCol super( GRBTransientMetric, self).__init__( col=[self.mjdCol, self.m5Col, self.filterCol], units='Fraction Detected', metricName=metricName,**kwargs) self.alpha = alpha self.apparent_mag_1min_mean = apparent_mag_1min_mean self.apparent_mag_1min_sigma = apparent_mag_1min_sigma self.transDuration = transDuration self.surveyDuration = surveyDuration self.surveyStart = surveyStart self.detectM5Plus = detectM5Plus self.nPerFilter = nPerFilter self.nFilters = nFilters self.minDeltaMag = minDeltaMag self.nPhaseCheck = nPhaseCheck self.peakTime = 0. self.reduceOrder = {'Bandu':0, 'Bandg':1, 'Bandr':2, 'Bandi':3, 'Bandz':4, 'Bandy':5,'Band1FiltAvg':6,'BandanyNfilters':7} def lightCurve(self, time, filters): """ given the times and filters of an observation, return the magnitudes. """ lcMags = np.zeros(time.size, dtype=float) decline = np.where(time > self.peakTime) apparent_mag_1min = np.random.randn()*self.apparent_mag_1min_sigma + self.apparent_mag_1min_mean lcMags[decline] += apparent_mag_1min + self.alpha * 2.5 * np.log10((time[decline]-self.peakTime)*24.*60.) #for key in self.peaks.keys(): # fMatch = np.where(filters == key) # lcMags[fMatch] += self.peaks[key] return lcMags def run(self, dataSlice, slicePoint=None): """" Calculate the detectability of a transient with the specified lightcurve. Parameters ---------- dataSlice : numpy.array Numpy structured array containing the data related to the visits provided by the slicer. slicePoint : dict, optional Dictionary containing information about the slicepoint currently active in the slicer. Returns ------- float The total number of transients that could be detected. """ # Total number of transients that could go off back-to-back nTransMax = np.floor(self.surveyDuration / (self.transDuration / 365.25)) tshifts = np.arange(self.nPhaseCheck) * self.transDuration / float(self.nPhaseCheck) nDetected = 0 nTransMax = 0 for tshift in tshifts: # Compute the total number of back-to-back transients are possible to detect # given the survey duration and the transient duration. nTransMax += np.floor(self.surveyDuration / (self.transDuration / 365.25)) if tshift != 0: nTransMax -= 1 if self.surveyStart is None: surveyStart = dataSlice[self.mjdCol].min() time = (dataSlice[self.mjdCol] - surveyStart + tshift) % self.transDuration # Which lightcurve does each point belong to lcNumber = np.floor((dataSlice[self.mjdCol] - surveyStart) / self.transDuration) lcMags = self.lightCurve(time, dataSlice[self.filterCol]) # How many criteria needs to be passed detectThresh = 0 # Flag points that are above the SNR limit detected = np.zeros(dataSlice.size, dtype=int) detected[np.where(lcMags < dataSlice[self.m5Col] + self.detectM5Plus)] += 1 bandcounter={'u':0, 'g':0, 'r':0, 'i':0, 'z':0, 'y':0, 'any':0} #define zeroed out counter # make sure things are sorted by time ord = np.argsort(dataSlice[self.mjdCol]) dataSlice = dataSlice[ord] detected = detected[ord] lcNumber = lcNumber[ord] lcMags = lcMags[ord] ulcNumber = np.unique(lcNumber) left = np.searchsorted(lcNumber, ulcNumber) right = np.searchsorted(lcNumber, ulcNumber, side='right') detectThresh += self.nFilters # iterate over the lightcurves for le, ri in zip(left, right): wdet = np.where(detected[le:ri] > 0) ufilters = np.unique(dataSlice[self.filterCol][le:ri][wdet]) nfilts_lci = 0 for filtName in ufilters: wdetfilt = np.where( (dataSlice[self.filterCol][le:ri] == filtName) & detected[le:ri]) lcPoints = lcMags[le:ri][wdetfilt] dlc = np.abs(np.diff(lcPoints)) # number of detections in band, requring that for # nPerFilter > 1 that points have more than minDeltaMag # change nbanddet = np.sum(dlc > self.minDeltaMag) + 1 if nbanddet >= self.nPerFilter: bandcounter[filtName] += 1 nfilts_lci += 1 if nfilts_lci >= self.nFilters: bandcounter['any'] += 1 bandfraction = {} for band in bandcounter.keys(): bandfraction[band] = float(bandcounter[band]) / nTransMax return bandfraction def reduceBand1FiltAvg(self, bandfraction): "Average fraction detected in single filter" return np.mean(list(bandfraction.values())) def reduceBandanyNfilters(self, bandfraction): "Fraction of events detected in Nfilters or more" return bandfraction['any'] def reduceBandu(self, bandfraction): return bandfraction['u'] def reduceBandg(self, bandfraction): return bandfraction['g'] def reduceBandr(self, bandfraction): return bandfraction['r'] def reduceBandi(self, bandfraction): return bandfraction['i'] def reduceBandz(self, bandfraction): return bandfraction['z'] def reduceBandy(self, bandfraction): return bandfraction['y']
[ 1, 515, 4240, 1144, 1053, 14319, 13, 29937, 402, 2735, 29899, 764, 20887, 1156, 29887, 677, 12714, 13, 29937, 529, 26862, 6227, 29958, 13, 13, 5215, 14051, 262, 29918, 3601, 29889, 655, 29888, 29889, 2527, 10817, 408, 21556, 13, 5215, 12655, 408, 7442, 13, 13, 1649, 497, 1649, 353, 6024, 14345, 29933, 4300, 993, 10095, 2200, 2033, 29871, 13, 13, 1990, 18016, 29933, 4300, 993, 10095, 2200, 29898, 2527, 10817, 29889, 5160, 10095, 2200, 1125, 13, 1678, 9995, 29928, 2650, 1953, 363, 373, 29899, 8990, 18016, 29933, 1156, 29887, 677, 29879, 20228, 292, 408, 29871, 13, 12, 29943, 29898, 29873, 29897, 353, 383, 29898, 29896, 1195, 29897, 3552, 29873, 29899, 29873, 29900, 6802, 29896, 1195, 4887, 29899, 2312, 29889, 29871, 1939, 22588, 2867, 29892, 363, 1286, 29889, 13, 13, 12, 15383, 2347, 515, 4103, 993, 10095, 2200, 29892, 541, 12833, 411, 10032, 3168, 304, 29871, 13, 1678, 9025, 29899, 4980, 2702, 18139, 29889, 29871, 13, 12, 29933, 26268, 4128, 4586, 515, 29871, 29906, 29900, 29896, 29896, 29925, 3289, 29925, 636, 29896, 29906, 29941, 29889, 29896, 29900, 29941, 29946, 29967, 29889, 13, 13, 12, 8942, 572, 8232, 29901, 29871, 13, 12, 1217, 2927, 19262, 470, 14675, 18511, 3447, 29889, 13, 12, 1217, 22588, 16706, 29889, 13, 12, 1333, 2578, 1218, 1283, 29899, 8990, 4959, 29889, 13, 268, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 1678, 15595, 584, 5785, 29892, 29871, 13, 4706, 25406, 20228, 2380, 29871, 13, 4706, 13109, 353, 29871, 29896, 29889, 29900, 13, 1678, 20295, 29918, 11082, 29918, 29896, 1195, 29918, 12676, 584, 5785, 29892, 29871, 13, 4706, 2099, 18497, 472, 29871, 29896, 11015, 1156, 20887, 29871, 13, 4706, 13109, 353, 29871, 29896, 29945, 29889, 29941, 29945, 13, 1678, 20295, 29918, 11082, 29918, 29896, 1195, 29918, 3754, 584, 5785, 29892, 29871, 13, 4706, 3659, 310, 9119, 20816, 472, 29871, 29896, 11015, 1156, 20887, 29871, 13, 4706, 13109, 353, 29871, 29896, 29889, 29945, 29929, 13, 1678, 1301, 18984, 584, 5785, 29892, 13136, 13, 4706, 1128, 1472, 278, 1301, 993, 1833, 29879, 313, 16700, 467, 13109, 29871, 29896, 29900, 29889, 13, 1678, 18994, 18984, 584, 5785, 29892, 13136, 13, 4706, 365, 1477, 310, 18994, 313, 6360, 29879, 467, 13, 4706, 13109, 29871, 29896, 29900, 29889, 13, 1678, 18994, 4763, 584, 5785, 29892, 13136, 13, 4706, 341, 29967, 29928, 363, 278, 18994, 1369, 2635, 29889, 13, 4706, 13109, 6213, 313, 6394, 278, 931, 310, 278, 937, 15500, 467, 13, 1678, 6459, 29924, 29945, 29575, 584, 5785, 29892, 13136, 13, 4706, 530, 15500, 674, 367, 1304, 565, 278, 3578, 11672, 18497, 338, 1506, 14643, 1135, 286, 29945, 29974, 4801, 522, 29924, 29945, 29575, 29889, 13, 4706, 13109, 29871, 29900, 29889, 13, 1678, 302, 5894, 5072, 584, 938, 29892, 13136, 13, 4706, 9681, 310, 5004, 1439, 29872, 1953, 310, 278, 3578, 11672, 2038, 278, 29871, 13, 4706, 6459, 29924, 29945, 29575, 266, 267, 8948, 313, 262, 263, 2323, 4175, 29897, 363, 278, 3578, 11672, 29871, 13, 4706, 304, 367, 29115, 29889, 13, 4706, 13109, 29871, 29896, 29889, 13, 1678, 302, 3434, 2153, 584, 938, 29892, 13136, 13, 4706, 9681, 310, 18094, 393, 817, 304, 367, 8900, 302, 5894, 5072, 3064, 29892, 13, 4706, 411, 12651, 1375, 5268, 19095, 29892, 13, 4706, 363, 385, 1203, 304, 367, 29115, 408, 17809, 29889, 13, 4706, 13109, 29871, 29896, 29889, 259, 13, 1678, 1375, 5268, 19095, 584, 5785, 29892, 13136, 13, 539, 18497, 4328, 1546, 1439, 29872, 1953, 297, 278, 1021, 4175, 3734, 13, 539, 363, 1473, 29974, 15326, 304, 367, 29115, 29889, 13, 539, 1152, 1342, 29892, 565, 1375, 5268, 19095, 353, 29871, 29900, 29889, 29896, 2320, 322, 1023, 18942, 13917, 13, 539, 1163, 871, 491, 29871, 29900, 29889, 29900, 29945, 2320, 29892, 1906, 1023, 1439, 29872, 1953, 674, 871, 2302, 408, 697, 29889, 13, 539, 313, 29933, 19036, 723, 367, 263, 317, 16514, 29899, 6707, 2313, 5632, 3381, 310, 3578, 2764, 345, 1735, 1846, 13, 539, 13109, 29871, 29900, 29889, 13, 1678, 302, 4819, 559, 5596, 584, 938, 29892, 13136, 13, 4706, 317, 1691, 278, 1353, 310, 29540, 393, 881, 367, 7120, 29889, 13, 4706, 3118, 508, 14034, 2224, 5996, 13840, 2063, 988, 1784, 3618, 1209, 278, 15326, 16614, 29892, 13, 4706, 541, 723, 451, 565, 278, 13917, 892, 9210, 491, 263, 8576, 29899, 10889, 29889, 13, 4706, 13109, 29871, 29896, 29889, 13, 1678, 9995, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 15595, 29922, 29896, 29892, 20295, 29918, 11082, 29918, 29896, 1195, 29918, 12676, 29922, 29896, 29945, 29889, 29941, 29945, 29892, 29871, 13, 462, 20295, 29918, 11082, 29918, 29896, 1195, 29918, 3754, 29922, 29896, 29889, 29945, 29929, 29892, 12714, 1170, 2433, 14345, 29933, 4300, 993, 10095, 2200, 742, 29871, 13, 462, 286, 26012, 1625, 2433, 4548, 29924, 29967, 29928, 742, 286, 29945, 1625, 2433, 20818, 10142, 8498, 386, 742, 4175, 1625, 2433, 4572, 742, 13, 462, 1301, 18984, 29922, 29896, 29900, 1696, 29871, 13, 462, 18994, 18984, 29922, 29896, 29900, 1696, 18994, 4763, 29922, 8516, 29892, 6459, 29924, 29945, 29575, 29922, 29900, 1696, 13, 462, 302, 5894, 5072, 29922, 29896, 29892, 302, 3434, 2153, 29922, 29896, 29892, 1375, 5268, 19095, 29922, 29900, 1696, 302, 4819, 559, 5596, 29922, 29896, 29892, 13, 462, 3579, 19290, 1125, 13, 4706, 1583, 29889, 29885, 26012, 1625, 353, 286, 26012, 1625, 13, 4706, 1583, 29889, 29885, 29945, 1625, 353, 286, 29945, 1625, 13, 4706, 1583, 29889, 4572, 1625, 353, 4175, 1625, 13, 4706, 2428, 29898, 18016, 29933, 4300, 993, 10095, 2200, 29892, 1583, 467, 1649, 2344, 12035, 13, 18884, 784, 11759, 1311, 29889, 29885, 26012, 1625, 29892, 1583, 29889, 29885, 29945, 1625, 29892, 1583, 29889, 4572, 1625, 1402, 13, 18884, 10340, 2433, 29943, 13857, 5953, 26458, 742, 13, 18884, 12714, 1170, 29922, 16414, 1170, 29892, 1068, 19290, 29897, 13, 4706, 1583, 29889, 2312, 353, 15595, 13, 4706, 1583, 29889, 932, 279, 296, 29918, 11082, 29918, 29896, 1195, 29918, 12676, 353, 20295, 29918, 11082, 29918, 29896, 1195, 29918, 12676, 13, 4706, 1583, 29889, 932, 279, 296, 29918, 11082, 29918, 29896, 1195, 29918, 3754, 353, 20295, 29918, 11082, 29918, 29896, 1195, 29918, 3754, 13, 4706, 1583, 29889, 3286, 18984, 353, 1301, 18984, 13, 4706, 1583, 29889, 7610, 6950, 18984, 353, 18994, 18984, 13, 4706, 1583, 29889, 7610, 6950, 4763, 353, 18994, 4763, 13, 4706, 1583, 29889, 4801, 522, 29924, 29945, 29575, 353, 6459, 29924, 29945, 29575, 13, 4706, 1583, 29889, 29876, 5894, 5072, 353, 302, 5894, 5072, 13, 4706, 1583, 29889, 29876, 3434, 2153, 353, 302, 3434, 2153, 13, 4706, 1583, 29889, 1195, 5268, 19095, 353, 1375, 5268, 19095, 13, 4706, 1583, 29889, 29876, 4819, 559, 5596, 353, 302, 4819, 559, 5596, 13, 4706, 1583, 29889, 412, 557, 2481, 353, 29871, 29900, 29889, 13, 4706, 1583, 29889, 17469, 7514, 353, 11117, 29933, 392, 29884, 2396, 29900, 29892, 525, 29933, 392, 29887, 2396, 29896, 29892, 525, 29933, 27177, 2396, 29906, 29892, 525, 29933, 392, 29875, 2396, 29941, 29892, 525, 29933, 392, 29920, 2396, 29946, 29892, 525, 29933, 13910, 2396, 29945, 5501, 29933, 392, 29896, 29943, 2782, 12810, 29887, 2396, 29953, 5501, 29933, 392, 1384, 29940, 26705, 2396, 29955, 29913, 13, 308, 13, 1678, 822, 3578, 23902, 345, 29898, 1311, 29892, 931, 29892, 18094, 1125, 13, 4706, 9995, 13, 4706, 2183, 278, 3064, 322, 18094, 310, 385, 15500, 29892, 736, 278, 9119, 20816, 29889, 13, 4706, 9995, 13, 13, 4706, 301, 29883, 29924, 810, 353, 7442, 29889, 3298, 359, 29898, 2230, 29889, 2311, 29892, 26688, 29922, 7411, 29897, 13, 13, 4706, 4845, 457, 353, 7442, 29889, 3062, 29898, 2230, 1405, 1583, 29889, 412, 557, 2481, 29897, 13, 4706, 20295, 29918, 11082, 29918, 29896, 1195, 353, 7442, 29889, 8172, 29889, 9502, 29876, 580, 29930, 1311, 29889, 932, 279, 296, 29918, 11082, 29918, 29896, 1195, 29918, 3754, 718, 1583, 29889, 932, 279, 296, 29918, 11082, 29918, 29896, 1195, 29918, 12676, 13, 4706, 301, 29883, 29924, 810, 29961, 27787, 457, 29962, 4619, 20295, 29918, 11082, 29918, 29896, 1195, 718, 1583, 29889, 2312, 334, 29871, 29906, 29889, 29945, 334, 7442, 29889, 1188, 29896, 29900, 3552, 2230, 29961, 27787, 457, 29962, 29899, 1311, 29889, 412, 557, 2481, 11877, 29906, 29946, 5575, 29953, 29900, 1846, 13, 13, 4706, 396, 1454, 1820, 297, 1583, 29889, 412, 10327, 29889, 8149, 7295, 13, 4706, 396, 1678, 285, 9652, 353, 7442, 29889, 3062, 29898, 26705, 1275, 1820, 29897, 13, 4706, 396, 1678, 301, 29883, 29924, 810, 29961, 29888, 9652, 29962, 4619, 1583, 29889, 412, 10327, 29961, 1989, 29962, 13, 13, 4706, 736, 301, 29883, 29924, 810, 13, 13, 1678, 822, 1065, 29898, 1311, 29892, 848, 29903, 5897, 29892, 22780, 5228, 29922, 8516, 1125, 13, 4706, 9995, 29908, 13, 4706, 20535, 403, 278, 6459, 3097, 310, 263, 1301, 993, 411, 278, 6790, 3578, 2764, 345, 29889, 13, 13, 4706, 12662, 2699, 13, 4706, 448, 1378, 29899, 13, 4706, 848, 29903, 5897, 584, 12655, 29889, 2378, 13, 9651, 11848, 2272, 2281, 2955, 1409, 6943, 278, 848, 4475, 304, 278, 1998, 1169, 4944, 491, 278, 269, 506, 261, 29889, 13, 4706, 22780, 5228, 584, 9657, 29892, 13136, 13, 9651, 13343, 6943, 2472, 1048, 278, 269, 506, 1022, 2461, 5279, 6136, 297, 278, 269, 506, 261, 29889, 13, 13, 4706, 16969, 13, 4706, 448, 22158, 13, 4706, 5785, 13, 9651, 450, 3001, 1353, 310, 1301, 10070, 393, 1033, 367, 17809, 29889, 13, 4706, 9995, 13, 4706, 396, 14990, 1353, 310, 1301, 10070, 393, 1033, 748, 1283, 1250, 29899, 517, 29899, 1627, 13, 4706, 302, 4300, 7976, 353, 7442, 29889, 14939, 29898, 1311, 29889, 7610, 6950, 18984, 847, 313, 1311, 29889, 3286, 18984, 847, 29871, 29941, 29953, 29945, 29889, 29906, 29945, 876, 13, 4706, 260, 845, 17741, 353, 7442, 29889, 279, 927, 29898, 1311, 29889, 29876, 4819, 559, 5596, 29897, 334, 1583, 29889, 3286, 18984, 847, 5785, 29898, 1311, 29889, 29876, 4819, 559, 5596, 29897, 13, 4706, 302, 6362, 26458, 353, 29871, 29900, 13, 4706, 302, 4300, 7976, 353, 29871, 29900, 13, 4706, 363, 260, 10889, 297, 260, 845, 17741, 29901, 13, 9651, 396, 11796, 29872, 278, 3001, 1353, 310, 1250, 29899, 517, 29899, 1627, 1301, 10070, 526, 1950, 304, 6459, 13, 9651, 396, 2183, 278, 18994, 14385, 322, 278, 1301, 993, 14385, 29889, 13, 9651, 302, 4300, 7976, 4619, 7442, 29889, 14939, 29898, 1311, 29889, 7610, 6950, 18984, 847, 313, 1311, 29889, 3286, 18984, 847, 29871, 29941, 29953, 29945, 29889, 29906, 29945, 876, 13, 9651, 565, 260, 10889, 2804, 29871, 29900, 29901, 13, 18884, 302, 4300, 7976, 22361, 29871, 29896, 13, 9651, 565, 1583, 29889, 7610, 6950, 4763, 338, 6213, 29901, 13, 18884, 18994, 4763, 353, 848, 29903, 5897, 29961, 1311, 29889, 29885, 26012, 1625, 1822, 1195, 580, 13, 9651, 931, 353, 313, 1272, 29903, 5897, 29961, 1311, 29889, 29885, 26012, 1625, 29962, 448, 18994, 4763, 718, 260, 10889, 29897, 1273, 1583, 29889, 3286, 18984, 13, 13, 9651, 396, 8449, 3578, 2764, 345, 947, 1269, 1298, 6852, 304, 13, 9651, 301, 29883, 4557, 353, 7442, 29889, 14939, 3552, 1272, 29903, 5897, 29961, 1311, 29889, 29885, 26012, 1625, 29962, 448, 18994, 4763, 29897, 847, 1583, 29889, 3286, 18984, 29897, 13, 13, 9651, 301, 29883, 29924, 810, 353, 1583, 29889, 4366, 23902, 345, 29898, 2230, 29892, 848, 29903, 5897, 29961, 1311, 29889, 4572, 1625, 2314, 13, 13, 9651, 396, 1128, 1784, 16614, 4225, 304, 367, 4502, 13, 9651, 6459, 1349, 3781, 353, 29871, 29900, 13, 13, 9651, 396, 28697, 3291, 393, 526, 2038, 278, 317, 16514, 4046, 13, 9651, 17809, 353, 7442, 29889, 3298, 359, 29898, 1272, 29903, 5897, 29889, 2311, 29892, 26688, 29922, 524, 29897, 13, 9651, 17809, 29961, 9302, 29889, 3062, 29898, 29880, 29883, 29924, 810, 529, 848, 29903, 5897, 29961, 1311, 29889, 29885, 29945, 1625, 29962, 718, 1583, 29889, 4801, 522, 29924, 29945, 29575, 4638, 4619, 29871, 29896, 13, 13, 9651, 3719, 11808, 3790, 29915, 29884, 2396, 29900, 29892, 525, 29887, 2396, 29900, 29892, 525, 29878, 2396, 29900, 29892, 525, 29875, 2396, 29900, 29892, 525, 29920, 2396, 29900, 29892, 525, 29891, 2396, 29900, 29892, 525, 1384, 2396, 29900, 29913, 396, 7922, 5225, 287, 714, 6795, 13, 13, 9651, 396, 1207, 1854, 2712, 526, 12705, 491, 931, 13, 9651, 4356, 353, 7442, 29889, 5085, 441, 29898, 1272, 29903, 5897, 29961, 1311, 29889, 29885, 26012, 1625, 2314, 13, 9651, 848, 29903, 5897, 353, 848, 29903, 5897, 29961, 536, 29962, 13, 9651, 17809, 353, 17809, 29961, 536, 29962, 13, 9651, 301, 29883, 4557, 353, 301, 29883, 4557, 29961, 536, 29962, 13, 9651, 301, 29883, 29924, 810, 353, 301, 29883, 29924, 810, 29961, 536, 29962, 13, 9651, 9238, 29883, 4557, 353, 7442, 29889, 13092, 29898, 29880, 29883, 4557, 29897, 13, 9651, 2175, 353, 7442, 29889, 4478, 24582, 29898, 29880, 29883, 4557, 29892, 9238, 29883, 4557, 29897, 13, 9651, 1492, 353, 7442, 29889, 4478, 24582, 29898, 29880, 29883, 4557, 29892, 9238, 29883, 4557, 29892, 2625, 2433, 1266, 1495, 13, 9651, 6459, 1349, 3781, 4619, 1583, 29889, 29876, 3434, 2153, 13, 13, 9651, 396, 13649, 975, 278, 3578, 2764, 1960, 13, 9651, 363, 454, 29892, 10107, 297, 14319, 29898, 1563, 29892, 1492, 1125, 13, 18884, 281, 4801, 353, 7442, 29889, 3062, 29898, 4801, 26458, 29961, 280, 29901, 374, 29962, 1405, 29871, 29900, 29897, 13, 18884, 318, 26705, 353, 7442, 29889, 13092, 29898, 1272, 29903, 5897, 29961, 1311, 29889, 4572, 1625, 3816, 280, 29901, 374, 3816, 29893, 4801, 2314, 13, 18884, 302, 1777, 1372, 29918, 29880, 455, 353, 29871, 29900, 13, 18884, 363, 977, 29873, 1170, 297, 318, 26705, 29901, 13, 462, 1678, 281, 4801, 1777, 29873, 353, 7442, 29889, 3062, 29898, 13, 462, 4706, 313, 1272, 29903, 5897, 29961, 1311, 29889, 4572, 1625, 3816, 280, 29901, 374, 29962, 1275, 977, 29873, 1170, 29897, 669, 13, 462, 4706, 17809, 29961, 280, 29901, 374, 2314, 13, 13, 462, 1678, 301, 29883, 20325, 353, 301, 29883, 29924, 810, 29961, 280, 29901, 374, 3816, 29893, 4801, 1777, 29873, 29962, 13, 462, 1678, 270, 29880, 29883, 353, 7442, 29889, 6897, 29898, 9302, 29889, 12765, 29898, 29880, 29883, 20325, 876, 13, 13, 462, 1678, 396, 1353, 310, 1439, 29872, 1953, 297, 3719, 29892, 12428, 3864, 393, 363, 13, 462, 1678, 396, 302, 5894, 5072, 1405, 29871, 29896, 393, 3291, 505, 901, 1135, 1375, 5268, 19095, 13, 462, 1678, 396, 1735, 13, 462, 1678, 302, 4980, 4801, 353, 7442, 29889, 2083, 29898, 11671, 29883, 1405, 1583, 29889, 1195, 5268, 19095, 29897, 718, 29871, 29896, 13, 462, 1678, 565, 302, 4980, 4801, 6736, 1583, 29889, 29876, 5894, 5072, 29901, 13, 462, 4706, 3719, 11808, 29961, 1777, 29873, 1170, 29962, 4619, 29871, 29896, 13, 462, 4706, 302, 1777, 1372, 29918, 29880, 455, 4619, 29871, 29896, 13, 18884, 565, 302, 1777, 1372, 29918, 29880, 455, 6736, 1583, 29889, 29876, 3434, 2153, 29901, 13, 462, 1678, 3719, 11808, 1839, 1384, 2033, 4619, 29871, 29896, 13, 13, 4706, 3719, 29888, 13857, 353, 6571, 13, 4706, 363, 3719, 297, 3719, 11808, 29889, 8149, 7295, 13, 9651, 3719, 29888, 13857, 29961, 4980, 29962, 353, 5785, 29898, 4980, 11808, 29961, 4980, 2314, 847, 302, 4300, 7976, 13, 13, 4706, 736, 3719, 29888, 13857, 13, 13, 13, 1678, 822, 10032, 29933, 392, 29896, 29943, 2782, 12810, 29887, 29898, 1311, 29892, 3719, 29888, 13857, 1125, 13, 4706, 376, 29909, 19698, 15958, 17809, 297, 2323, 4175, 29908, 29871, 13, 4706, 736, 7442, 29889, 12676, 29898, 1761, 29898, 4980, 29888, 13857, 29889, 5975, 22130, 13, 539, 13, 1678, 822, 10032, 29933, 392, 1384, 29940, 26705, 29898, 1311, 29892, 3719, 29888, 13857, 1125, 13, 4706, 376, 29943, 13857, 310, 4959, 17809, 297, 405, 26705, 470, 901, 29908, 29871, 13, 4706, 736, 3719, 29888, 13857, 1839, 1384, 2033, 13, 13, 1678, 822, 10032, 29933, 392, 29884, 29898, 1311, 29892, 3719, 29888, 13857, 1125, 13, 4706, 736, 3719, 29888, 13857, 1839, 29884, 2033, 13, 13, 1678, 822, 10032, 29933, 392, 29887, 29898, 1311, 29892, 3719, 29888, 13857, 1125, 13, 4706, 736, 3719, 29888, 13857, 1839, 29887, 2033, 13, 13, 1678, 822, 10032, 29933, 27177, 29898, 1311, 29892, 3719, 29888, 13857, 1125, 13, 4706, 736, 3719, 29888, 13857, 1839, 29878, 2033, 13, 13, 1678, 822, 10032, 29933, 392, 29875, 29898, 1311, 29892, 3719, 29888, 13857, 1125, 13, 4706, 736, 3719, 29888, 13857, 1839, 29875, 2033, 13, 13, 1678, 822, 10032, 29933, 392, 29920, 29898, 1311, 29892, 3719, 29888, 13857, 1125, 13, 4706, 736, 3719, 29888, 13857, 1839, 29920, 2033, 13, 13, 1678, 822, 10032, 29933, 13910, 29898, 1311, 29892, 3719, 29888, 13857, 1125, 13, 4706, 736, 3719, 29888, 13857, 1839, 29891, 2033, 13, 2 ]
graph_search/week2/assignment_dijkstra_shortest_paths.py
liaoaoyuan97/standford_algorithms_specialization
0
5595
import heapq import time from os import path from math import floor class Heap: def __init__(self): self.size = 0 self.array = [] self.v2index_map = {} def __get_parent_index(self, idx): return int(floor((idx - 1) / 2)) def __get_left_child_index(self, idx): return 2 * idx + 1 def __get_right_child_index(self, idx): return 2 * idx + 2 def __swap_value(self, i, j): t = self.array[i] self.v2index_map[t[0]] = j self.v2index_map[self.array[j][0]] = i self.array[i] = self.array[j] self.array[j] = t def __bubble_up(self, idx): parent_idx = self.__get_parent_index(idx) while parent_idx >= 0: if self.array[parent_idx][1] <= self.array[idx][1]: break self.__swap_value(parent_idx, idx) idx = parent_idx parent_idx = self.__get_parent_index(idx) def __bubble_down(self, idx): left_idx = self.__get_left_child_index(idx) right_idx = self.__get_right_child_index(idx) while left_idx < self.size or right_idx < self.size: min_idx = left_idx if left_idx >= self.size or (right_idx < self.size and self.array[right_idx][1] < self.array[left_idx][1]): min_idx = right_idx if self.array[idx][1] < self.array[min_idx][1]: break self.__swap_value(idx, min_idx) idx = min_idx left_idx = self.__get_left_child_index(idx) right_idx = self.__get_right_child_index(idx) def get_vertex_key(self, v_id): return self.array[self.v2index_map[v_id]][1] def pop(self): if self.size < 1: raise IndexError min_node = self.array[0] self.size = self.size - 1 self.__swap_value(0, self.size) self.array.pop() if self.size > 1: self.__bubble_down(0) del self.v2index_map[min_node[0]] return min_node def insert(self, node): self.array.append(node) self.v2index_map[node[0]] = self.size self.size = self.size + 1 if self.size > 1: self.__bubble_up(self.size - 1) def modify_key(self, v_id, update_val): idx = self.v2index_map[v_id] self.array[idx] = (v_id, update_val) parent_idx = self.__get_parent_index(idx) if parent_idx >= 0 and self.array[idx][1] < self.array[parent_idx][1]: self.__bubble_up(idx) else: self.__bubble_down(idx) def read_graph(filename): graph = dict() with open(path.join('.', filename), 'r') as f: for row in f.readlines(): edges = row.strip('\t\n').split('\t') s = int(edges[0]) graph[s] = [] for i in range(1, len(edges)): edge = edges[i].split(',') graph[s].append((int(edge[0]), int(edge[1]))) return graph def get_shortest_paths_heapq(graph): heap = [] heapq.heappush(heap, (0, 1)) # (dj_score, vertex_id) distances = {i: 1000000 for i in graph} distances[1] = 0 X = [] while heap: cur_distance, cur_v = heapq.heappop(heap) if cur_distance > distances[cur_v]: continue # added to X X.append(cur_v) for neighbor, weight in graph[cur_v]: dj_score = cur_distance + weight if dj_score < distances[neighbor]: distances[neighbor] = dj_score heapq.heappush(heap, (dj_score, neighbor)) return distances, X def get_shortest_paths_self_defined_heap(graph): heap = Heap() heap.insert((1, 0)) # (vertex_id, dj_score) for v in graph: if v != 1: heap.insert((v, 1000000)) shortest_paths = dict() n_v = len(graph) while len(shortest_paths) < n_v: assert len(shortest_paths) + heap.size == n_v cur_v, v_score = heap.pop() shortest_paths[cur_v] = v_score for neighbor, weight in graph[cur_v]: dj_score = v_score + weight # import pdb;pdb.set_trace() if neighbor not in shortest_paths and dj_score < heap.get_vertex_key(neighbor): heap.modify_key(neighbor, dj_score) return shortest_paths if __name__ == "__main__": # test case 1, output: {1: 0, 2: 1, 3: 2, 4: 2, 5: 3, 6: 4} # graph = { # 1: [(6, 7), (5, 3), (2, 1), (4, 2), (3, 3)], # 2: [(1, 1), (3, 1), (4, 1), (6, 6)], # 3: [(1, 3), (2, 1), (6, 2)], # 4: [(2, 1), (1, 2), (6, 5)], # 5: [(1, 3), (6, 3)], # 6: [(1, 7), (3, 2), (2, 6), (4, 5), (5, 3)] # } graph = read_graph("Dijkstra.txt") dedup_edges = set() for k, _ in graph.items(): for v in _: dedup_edges.add((k, v[0], v[1])) dedup_edges.add((v[0], k, v[1])) assert len(dedup_edges) == sum([len(e) for e in graph.values()]) # graph = {} # heap = Heap() # heap.insert((1,0)) # heap.insert((2,0)) # heap.pop() start_t = time.time() min_distances,X = get_shortest_paths_heapq(graph) print(time.time() - start_t) # print(min_distances) e = [7, 37, 59, 82, 99, 115, 133, 165, 188, 197] print(",".join([str(int(min_distances[i])) for i in e])) start_t = time.time() min_distances = get_shortest_paths_self_defined_heap(graph, X) print(time.time() - start_t) # print(min_distances) e = [7, 37, 59, 82, 99, 115, 133, 165, 188, 197] print(",".join([str(int(min_distances[i])) for i in e]))
[ 1, 1053, 16947, 29939, 13, 5215, 931, 13, 3166, 2897, 1053, 2224, 13, 3166, 5844, 1053, 11904, 13, 13, 13, 1990, 940, 481, 29901, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 1583, 29889, 2311, 353, 29871, 29900, 13, 4706, 1583, 29889, 2378, 353, 5159, 13, 4706, 1583, 29889, 29894, 29906, 2248, 29918, 1958, 353, 6571, 13, 13, 1678, 822, 4770, 657, 29918, 3560, 29918, 2248, 29898, 1311, 29892, 22645, 1125, 13, 4706, 736, 938, 29898, 14939, 3552, 13140, 448, 29871, 29896, 29897, 847, 29871, 29906, 876, 13, 13, 1678, 822, 4770, 657, 29918, 1563, 29918, 5145, 29918, 2248, 29898, 1311, 29892, 22645, 1125, 13, 4706, 736, 29871, 29906, 334, 22645, 718, 29871, 29896, 13, 13, 1678, 822, 4770, 657, 29918, 1266, 29918, 5145, 29918, 2248, 29898, 1311, 29892, 22645, 1125, 13, 4706, 736, 29871, 29906, 334, 22645, 718, 29871, 29906, 13, 13, 1678, 822, 4770, 26276, 29918, 1767, 29898, 1311, 29892, 474, 29892, 432, 1125, 13, 4706, 260, 353, 1583, 29889, 2378, 29961, 29875, 29962, 13, 13, 4706, 1583, 29889, 29894, 29906, 2248, 29918, 1958, 29961, 29873, 29961, 29900, 5262, 353, 432, 13, 4706, 1583, 29889, 29894, 29906, 2248, 29918, 1958, 29961, 1311, 29889, 2378, 29961, 29926, 3816, 29900, 5262, 353, 474, 13, 13, 4706, 1583, 29889, 2378, 29961, 29875, 29962, 353, 1583, 29889, 2378, 29961, 29926, 29962, 13, 4706, 1583, 29889, 2378, 29961, 29926, 29962, 353, 260, 13, 13, 1678, 822, 4770, 29890, 23232, 29918, 786, 29898, 1311, 29892, 22645, 1125, 13, 4706, 3847, 29918, 13140, 353, 1583, 17255, 657, 29918, 3560, 29918, 2248, 29898, 13140, 29897, 13, 4706, 1550, 3847, 29918, 13140, 6736, 29871, 29900, 29901, 13, 9651, 565, 1583, 29889, 2378, 29961, 3560, 29918, 13140, 3816, 29896, 29962, 5277, 1583, 29889, 2378, 29961, 13140, 3816, 29896, 5387, 13, 18884, 2867, 13, 13, 9651, 1583, 17255, 26276, 29918, 1767, 29898, 3560, 29918, 13140, 29892, 22645, 29897, 13, 9651, 22645, 353, 3847, 29918, 13140, 13, 9651, 3847, 29918, 13140, 353, 1583, 17255, 657, 29918, 3560, 29918, 2248, 29898, 13140, 29897, 13, 13, 1678, 822, 4770, 29890, 23232, 29918, 3204, 29898, 1311, 29892, 22645, 1125, 13, 4706, 2175, 29918, 13140, 353, 1583, 17255, 657, 29918, 1563, 29918, 5145, 29918, 2248, 29898, 13140, 29897, 13, 4706, 1492, 29918, 13140, 353, 1583, 17255, 657, 29918, 1266, 29918, 5145, 29918, 2248, 29898, 13140, 29897, 13, 13, 4706, 1550, 2175, 29918, 13140, 529, 1583, 29889, 2311, 470, 1492, 29918, 13140, 529, 1583, 29889, 2311, 29901, 13, 9651, 1375, 29918, 13140, 353, 2175, 29918, 13140, 13, 9651, 565, 2175, 29918, 13140, 6736, 1583, 29889, 2311, 470, 313, 1266, 29918, 13140, 529, 1583, 29889, 2311, 322, 1583, 29889, 2378, 29961, 1266, 29918, 13140, 3816, 29896, 29962, 529, 1583, 29889, 2378, 29961, 1563, 29918, 13140, 3816, 29896, 29962, 1125, 13, 18884, 1375, 29918, 13140, 353, 1492, 29918, 13140, 13, 13, 9651, 565, 1583, 29889, 2378, 29961, 13140, 3816, 29896, 29962, 529, 1583, 29889, 2378, 29961, 1195, 29918, 13140, 3816, 29896, 5387, 13, 18884, 2867, 13, 13, 9651, 1583, 17255, 26276, 29918, 1767, 29898, 13140, 29892, 1375, 29918, 13140, 29897, 13, 9651, 22645, 353, 1375, 29918, 13140, 13, 9651, 2175, 29918, 13140, 353, 1583, 17255, 657, 29918, 1563, 29918, 5145, 29918, 2248, 29898, 13140, 29897, 13, 9651, 1492, 29918, 13140, 353, 1583, 17255, 657, 29918, 1266, 29918, 5145, 29918, 2248, 29898, 13140, 29897, 13, 13, 1678, 822, 679, 29918, 369, 4776, 29918, 1989, 29898, 1311, 29892, 325, 29918, 333, 1125, 13, 4706, 736, 1583, 29889, 2378, 29961, 1311, 29889, 29894, 29906, 2248, 29918, 1958, 29961, 29894, 29918, 333, 29962, 3816, 29896, 29962, 13, 13, 1678, 822, 1835, 29898, 1311, 1125, 13, 4706, 565, 1583, 29889, 2311, 529, 29871, 29896, 29901, 13, 9651, 12020, 11374, 2392, 13, 13, 4706, 1375, 29918, 3177, 353, 1583, 29889, 2378, 29961, 29900, 29962, 13, 4706, 1583, 29889, 2311, 353, 1583, 29889, 2311, 448, 29871, 29896, 13, 4706, 1583, 17255, 26276, 29918, 1767, 29898, 29900, 29892, 1583, 29889, 2311, 29897, 13, 4706, 1583, 29889, 2378, 29889, 7323, 580, 13, 13, 4706, 565, 1583, 29889, 2311, 1405, 29871, 29896, 29901, 13, 9651, 1583, 17255, 29890, 23232, 29918, 3204, 29898, 29900, 29897, 13, 13, 4706, 628, 1583, 29889, 29894, 29906, 2248, 29918, 1958, 29961, 1195, 29918, 3177, 29961, 29900, 5262, 13, 13, 4706, 736, 1375, 29918, 3177, 13, 13, 1678, 822, 4635, 29898, 1311, 29892, 2943, 1125, 13, 4706, 1583, 29889, 2378, 29889, 4397, 29898, 3177, 29897, 13, 4706, 1583, 29889, 29894, 29906, 2248, 29918, 1958, 29961, 3177, 29961, 29900, 5262, 353, 1583, 29889, 2311, 13, 4706, 1583, 29889, 2311, 353, 1583, 29889, 2311, 718, 29871, 29896, 13, 13, 4706, 565, 1583, 29889, 2311, 1405, 29871, 29896, 29901, 13, 9651, 1583, 17255, 29890, 23232, 29918, 786, 29898, 1311, 29889, 2311, 448, 29871, 29896, 29897, 13, 13, 1678, 822, 6623, 29918, 1989, 29898, 1311, 29892, 325, 29918, 333, 29892, 2767, 29918, 791, 1125, 13, 4706, 22645, 353, 1583, 29889, 29894, 29906, 2248, 29918, 1958, 29961, 29894, 29918, 333, 29962, 13, 4706, 1583, 29889, 2378, 29961, 13140, 29962, 353, 313, 29894, 29918, 333, 29892, 2767, 29918, 791, 29897, 13, 13, 4706, 3847, 29918, 13140, 353, 1583, 17255, 657, 29918, 3560, 29918, 2248, 29898, 13140, 29897, 13, 4706, 565, 3847, 29918, 13140, 6736, 29871, 29900, 322, 1583, 29889, 2378, 29961, 13140, 3816, 29896, 29962, 529, 1583, 29889, 2378, 29961, 3560, 29918, 13140, 3816, 29896, 5387, 13, 9651, 1583, 17255, 29890, 23232, 29918, 786, 29898, 13140, 29897, 13, 4706, 1683, 29901, 13, 9651, 1583, 17255, 29890, 23232, 29918, 3204, 29898, 13140, 29897, 13, 13, 13, 1753, 1303, 29918, 4262, 29898, 9507, 1125, 13, 1678, 3983, 353, 9657, 580, 13, 13, 1678, 411, 1722, 29898, 2084, 29889, 7122, 12839, 742, 10422, 511, 525, 29878, 1495, 408, 285, 29901, 13, 4706, 363, 1948, 297, 285, 29889, 949, 9012, 7295, 13, 9651, 12770, 353, 1948, 29889, 17010, 28909, 29873, 29905, 29876, 2824, 5451, 28909, 29873, 1495, 13, 13, 9651, 269, 353, 938, 29898, 287, 2710, 29961, 29900, 2314, 13, 9651, 3983, 29961, 29879, 29962, 353, 5159, 13, 9651, 363, 474, 297, 3464, 29898, 29896, 29892, 7431, 29898, 287, 2710, 22164, 13, 18884, 7636, 353, 12770, 29961, 29875, 1822, 5451, 29317, 1495, 13, 18884, 3983, 29961, 29879, 1822, 4397, 3552, 524, 29898, 12864, 29961, 29900, 11724, 938, 29898, 12864, 29961, 29896, 29962, 4961, 13, 13, 1678, 736, 3983, 13, 13, 13, 1753, 679, 29918, 12759, 342, 29918, 24772, 29918, 354, 481, 29939, 29898, 4262, 1125, 13, 1678, 16947, 353, 5159, 13, 1678, 16947, 29939, 29889, 354, 932, 1878, 29898, 354, 481, 29892, 313, 29900, 29892, 29871, 29896, 876, 29871, 396, 313, 19776, 29918, 13628, 29892, 12688, 29918, 333, 29897, 13, 1678, 24610, 353, 426, 29875, 29901, 29871, 29896, 29900, 29900, 29900, 29900, 29900, 29900, 363, 474, 297, 3983, 29913, 13, 1678, 24610, 29961, 29896, 29962, 353, 29871, 29900, 13, 1678, 1060, 353, 5159, 13, 13, 1678, 1550, 16947, 29901, 13, 4706, 3151, 29918, 19244, 29892, 3151, 29918, 29894, 353, 16947, 29939, 29889, 354, 932, 459, 29898, 354, 481, 29897, 13, 13, 4706, 565, 3151, 29918, 19244, 1405, 24610, 29961, 2764, 29918, 29894, 5387, 13, 9651, 6773, 13, 13, 4706, 396, 2715, 304, 1060, 13, 4706, 1060, 29889, 4397, 29898, 2764, 29918, 29894, 29897, 13, 4706, 363, 12307, 29892, 7688, 297, 3983, 29961, 2764, 29918, 29894, 5387, 13, 9651, 270, 29926, 29918, 13628, 353, 3151, 29918, 19244, 718, 7688, 13, 9651, 565, 270, 29926, 29918, 13628, 529, 24610, 29961, 484, 1141, 4089, 5387, 13, 18884, 24610, 29961, 484, 1141, 4089, 29962, 353, 270, 29926, 29918, 13628, 13, 18884, 16947, 29939, 29889, 354, 932, 1878, 29898, 354, 481, 29892, 313, 19776, 29918, 13628, 29892, 12307, 876, 13, 13, 1678, 736, 24610, 29892, 1060, 13, 13, 13, 1753, 679, 29918, 12759, 342, 29918, 24772, 29918, 1311, 29918, 12119, 29918, 354, 481, 29898, 4262, 1125, 13, 1678, 16947, 353, 940, 481, 580, 13, 1678, 16947, 29889, 7851, 3552, 29896, 29892, 29871, 29900, 876, 29871, 396, 313, 369, 4776, 29918, 333, 29892, 270, 29926, 29918, 13628, 29897, 13, 1678, 363, 325, 297, 3983, 29901, 13, 4706, 565, 325, 2804, 29871, 29896, 29901, 13, 9651, 16947, 29889, 7851, 3552, 29894, 29892, 29871, 29896, 29900, 29900, 29900, 29900, 29900, 29900, 876, 13, 13, 1678, 3273, 342, 29918, 24772, 353, 9657, 580, 13, 1678, 302, 29918, 29894, 353, 7431, 29898, 4262, 29897, 13, 13, 1678, 1550, 7431, 29898, 12759, 342, 29918, 24772, 29897, 529, 302, 29918, 29894, 29901, 13, 4706, 4974, 7431, 29898, 12759, 342, 29918, 24772, 29897, 718, 16947, 29889, 2311, 1275, 302, 29918, 29894, 13, 13, 4706, 3151, 29918, 29894, 29892, 325, 29918, 13628, 353, 16947, 29889, 7323, 580, 13, 4706, 3273, 342, 29918, 24772, 29961, 2764, 29918, 29894, 29962, 353, 325, 29918, 13628, 13, 13, 4706, 363, 12307, 29892, 7688, 297, 3983, 29961, 2764, 29918, 29894, 5387, 13, 9651, 270, 29926, 29918, 13628, 353, 325, 29918, 13628, 718, 7688, 13, 9651, 396, 1053, 282, 2585, 29936, 29886, 2585, 29889, 842, 29918, 15003, 580, 13, 9651, 565, 12307, 451, 297, 3273, 342, 29918, 24772, 322, 270, 29926, 29918, 13628, 529, 16947, 29889, 657, 29918, 369, 4776, 29918, 1989, 29898, 484, 1141, 4089, 1125, 13, 18884, 16947, 29889, 1545, 1598, 29918, 1989, 29898, 484, 1141, 4089, 29892, 270, 29926, 29918, 13628, 29897, 13, 13, 1678, 736, 3273, 342, 29918, 24772, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 396, 1243, 1206, 29871, 29896, 29892, 1962, 29901, 426, 29896, 29901, 29871, 29900, 29892, 29871, 29906, 29901, 29871, 29896, 29892, 29871, 29941, 29901, 29871, 29906, 29892, 29871, 29946, 29901, 29871, 29906, 29892, 29871, 29945, 29901, 29871, 29941, 29892, 29871, 29953, 29901, 29871, 29946, 29913, 13, 1678, 396, 3983, 353, 426, 13, 1678, 396, 418, 29896, 29901, 17288, 29953, 29892, 29871, 29955, 511, 313, 29945, 29892, 29871, 29941, 511, 313, 29906, 29892, 29871, 29896, 511, 313, 29946, 29892, 29871, 29906, 511, 313, 29941, 29892, 29871, 29941, 29897, 1402, 13, 1678, 396, 418, 29906, 29901, 17288, 29896, 29892, 29871, 29896, 511, 313, 29941, 29892, 29871, 29896, 511, 313, 29946, 29892, 29871, 29896, 511, 313, 29953, 29892, 29871, 29953, 29897, 1402, 13, 1678, 396, 418, 29941, 29901, 17288, 29896, 29892, 29871, 29941, 511, 313, 29906, 29892, 29871, 29896, 511, 313, 29953, 29892, 29871, 29906, 29897, 1402, 13, 1678, 396, 418, 29946, 29901, 17288, 29906, 29892, 29871, 29896, 511, 313, 29896, 29892, 29871, 29906, 511, 313, 29953, 29892, 29871, 29945, 29897, 1402, 13, 1678, 396, 418, 29945, 29901, 17288, 29896, 29892, 29871, 29941, 511, 313, 29953, 29892, 29871, 29941, 29897, 1402, 13, 1678, 396, 418, 29953, 29901, 17288, 29896, 29892, 29871, 29955, 511, 313, 29941, 29892, 29871, 29906, 511, 313, 29906, 29892, 29871, 29953, 511, 313, 29946, 29892, 29871, 29945, 511, 313, 29945, 29892, 29871, 29941, 4638, 13, 1678, 396, 500, 13, 13, 1678, 3983, 353, 1303, 29918, 4262, 703, 29928, 13535, 4151, 29889, 3945, 1159, 13, 13, 1678, 28262, 786, 29918, 287, 2710, 353, 731, 580, 13, 1678, 363, 413, 29892, 903, 297, 3983, 29889, 7076, 7295, 13, 4706, 363, 325, 297, 903, 29901, 13, 9651, 28262, 786, 29918, 287, 2710, 29889, 1202, 3552, 29895, 29892, 325, 29961, 29900, 1402, 325, 29961, 29896, 12622, 13, 9651, 28262, 786, 29918, 287, 2710, 29889, 1202, 3552, 29894, 29961, 29900, 1402, 413, 29892, 325, 29961, 29896, 12622, 13, 1678, 4974, 7431, 29898, 7176, 786, 29918, 287, 2710, 29897, 1275, 2533, 4197, 2435, 29898, 29872, 29897, 363, 321, 297, 3983, 29889, 5975, 580, 2314, 13, 13, 1678, 396, 3983, 353, 6571, 13, 13, 1678, 396, 16947, 353, 940, 481, 580, 13, 1678, 396, 16947, 29889, 7851, 3552, 29896, 29892, 29900, 876, 13, 1678, 396, 16947, 29889, 7851, 3552, 29906, 29892, 29900, 876, 13, 1678, 396, 16947, 29889, 7323, 580, 13, 13, 1678, 1369, 29918, 29873, 353, 931, 29889, 2230, 580, 13, 1678, 1375, 29918, 5721, 2925, 29892, 29990, 353, 679, 29918, 12759, 342, 29918, 24772, 29918, 354, 481, 29939, 29898, 4262, 29897, 13, 1678, 1596, 29898, 2230, 29889, 2230, 580, 448, 1369, 29918, 29873, 29897, 13, 13, 1678, 396, 1596, 29898, 1195, 29918, 5721, 2925, 29897, 13, 1678, 321, 353, 518, 29955, 29892, 29871, 29941, 29955, 29892, 29871, 29945, 29929, 29892, 29871, 29947, 29906, 29892, 29871, 29929, 29929, 29892, 29871, 29896, 29896, 29945, 29892, 29871, 29896, 29941, 29941, 29892, 29871, 29896, 29953, 29945, 29892, 29871, 29896, 29947, 29947, 29892, 29871, 29896, 29929, 29955, 29962, 13, 1678, 1596, 28165, 1642, 7122, 4197, 710, 29898, 524, 29898, 1195, 29918, 5721, 2925, 29961, 29875, 12622, 363, 474, 297, 321, 12622, 13, 13, 1678, 1369, 29918, 29873, 353, 931, 29889, 2230, 580, 13, 1678, 1375, 29918, 5721, 2925, 353, 679, 29918, 12759, 342, 29918, 24772, 29918, 1311, 29918, 12119, 29918, 354, 481, 29898, 4262, 29892, 1060, 29897, 13, 1678, 1596, 29898, 2230, 29889, 2230, 580, 448, 1369, 29918, 29873, 29897, 13, 13, 1678, 396, 1596, 29898, 1195, 29918, 5721, 2925, 29897, 13, 1678, 321, 353, 518, 29955, 29892, 29871, 29941, 29955, 29892, 29871, 29945, 29929, 29892, 29871, 29947, 29906, 29892, 29871, 29929, 29929, 29892, 29871, 29896, 29896, 29945, 29892, 29871, 29896, 29941, 29941, 29892, 29871, 29896, 29953, 29945, 29892, 29871, 29896, 29947, 29947, 29892, 29871, 29896, 29929, 29955, 29962, 13, 1678, 1596, 28165, 1642, 7122, 4197, 710, 29898, 524, 29898, 1195, 29918, 5721, 2925, 29961, 29875, 12622, 363, 474, 297, 321, 12622, 13, 2 ]
examples/ex_bit_flip_code.py
jasonelhaderi/pypsqueak
0
110933
import context # Remove this import if running with pip installed version. from pypsqueak.api import qReg, qOp from pypsqueak.gates import X, Z, I, ROT_Y, CNOT from pypsqueak.noise import b_flip_map import numpy as np import sys if len(sys.argv) > 1 and int(sys.argv[1]) > 0: n_trials = int(sys.argv[1]) else: n_trials = 2000 if len(sys.argv) > 2 and float(sys.argv[2]) <= 1 and float(sys.argv[2]) >= 0: prob = float(sys.argv[2]) else: prob = 0.1 theory_success = (1 - prob)**3 + 3*prob*(1-prob)**2 theory_failure = 1 - theory_success successes = 0 failures = 0 noisy_channel = qOp(np.eye(2), kraus_ops=b_flip_map(prob)) # Check that we are getting the correct statistics out of our noisy channel. print("Initialized noisy channel with {:.1f}% chance of bit flip.".format(100*prob)) print("Probing channel with single qubit {} times...".format(n_trials)) flip_amount = 0 for i in range(n_trials): register = qReg() noisy_channel.on(register) if not np.array_equal([1, 0], register.dump_state()): flip_amount += 1 flip_percent = 100*flip_amount/n_trials print("Bit flip occured ({:.1f} +/- {:.1f})% of the time.\n".format(flip_percent, 0.5*flip_percent/np.sqrt(n_trials))) print("With bit flip probability of {:.1f}%:".format(100*prob)) print("Theoretical transmission success rate: {:.1f}%".format(100*theory_success)) print("Theoretical transmission failure rate: {:.1f}%\n".format(100*theory_failure)) # Now we send an encoded state through our noisy channel n_trials times. # Uncomment the print lines in the for loop to peek at the state of the register # after each operation. Remember, peeking is unphysical! print("Running {} trials of sending an encoded state...".format(n_trials)) for i in range(n_trials): # Initialize a state. super_position = qReg(1) ROT_Y(0.2).on(super_position) # print("Input state |psi> =", super_position.peek()) # Encode against bit flip. CNOT.on(super_position, 1, 0) CNOT.on(super_position, 2, 0) init_state = super_position.dump_state() # print("Encoded state |psi'> =", super_position.peek()) # Send state through noisy channel. for qubit in range(len(super_position)): noisy_channel.on(super_position, qubit) # print("Encoded state after noisy transmission:", super_position.peek()) # Diagnose error syndrome. Z_21 = Z.kron(Z, I) Z_10 = I.kron(Z, Z) product_21 = super_position.measure_observable(Z_21) # print("Action of Z_21:", super_position.peek()) # print("Z_21 measurement:", product_21) product_10 = super_position.measure_observable(Z_10) # print("Action of Z_10:", super_position.peek()) # print("Z_10 measurement:", product_10) if product_10 == product_21: if product_10 == 1: # No correction required (1 - p)^3 pass else: # Middle qubit flipped (1 - p)^2 * p X.on(super_position, 1) if product_10 != product_21: if product_21 == -1: # Qubit 2 flipped (1 - p)^2 * p X.on(super_position, 2) else: # Qubit 0 flipped (1 - p)^2 * p X.on(super_position, 0) # print("Recovered state:", super_position.peek()) if np.allclose(init_state, super_position.dump_state()): successes += 1 else: failures += 1 print("Successful {:.2f}% of the time".format(100*successes/n_trials)) print("Unsuccessful {:.2f}% of the time".format(100*failures/n_trials))
[ 1, 1053, 3030, 29871, 396, 15154, 445, 1053, 565, 2734, 411, 8450, 5130, 1873, 29889, 13, 13, 3166, 11451, 567, 802, 557, 29889, 2754, 1053, 3855, 4597, 29892, 3855, 11746, 13, 3166, 11451, 567, 802, 557, 29889, 29887, 1078, 1053, 1060, 29892, 796, 29892, 306, 29892, 390, 2891, 29918, 29979, 29892, 315, 12256, 13, 3166, 11451, 567, 802, 557, 29889, 1217, 895, 1053, 289, 29918, 29888, 3466, 29918, 1958, 13, 5215, 12655, 408, 7442, 13, 5215, 10876, 13, 13, 361, 7431, 29898, 9675, 29889, 19218, 29897, 1405, 29871, 29896, 322, 938, 29898, 9675, 29889, 19218, 29961, 29896, 2314, 1405, 29871, 29900, 29901, 13, 1678, 302, 29918, 3626, 1338, 353, 938, 29898, 9675, 29889, 19218, 29961, 29896, 2314, 13, 2870, 29901, 13, 1678, 302, 29918, 3626, 1338, 353, 29871, 29906, 29900, 29900, 29900, 13, 13, 361, 7431, 29898, 9675, 29889, 19218, 29897, 1405, 29871, 29906, 322, 5785, 29898, 9675, 29889, 19218, 29961, 29906, 2314, 5277, 29871, 29896, 322, 5785, 29898, 9675, 29889, 19218, 29961, 29906, 2314, 6736, 29871, 29900, 29901, 13, 1678, 2070, 353, 5785, 29898, 9675, 29889, 19218, 29961, 29906, 2314, 13, 2870, 29901, 13, 1678, 2070, 353, 29871, 29900, 29889, 29896, 13, 13, 14138, 29918, 8698, 353, 313, 29896, 448, 2070, 29897, 1068, 29941, 718, 29871, 29941, 29930, 22795, 16395, 29896, 29899, 22795, 29897, 1068, 29906, 13, 14138, 29918, 14057, 545, 353, 29871, 29896, 448, 6368, 29918, 8698, 13, 8698, 267, 353, 29871, 29900, 13, 14057, 1973, 353, 29871, 29900, 13, 1217, 13344, 29918, 12719, 353, 3855, 11746, 29898, 9302, 29889, 1032, 29872, 29898, 29906, 511, 18858, 375, 29918, 3554, 29922, 29890, 29918, 29888, 3466, 29918, 1958, 29898, 22795, 876, 13, 13, 29937, 5399, 393, 591, 526, 2805, 278, 1959, 13964, 714, 310, 1749, 694, 13344, 8242, 29889, 13, 2158, 703, 15514, 1891, 694, 13344, 8242, 411, 12365, 29889, 29896, 29888, 10560, 8825, 310, 2586, 285, 3466, 1213, 29889, 4830, 29898, 29896, 29900, 29900, 29930, 22795, 876, 13, 2158, 703, 1184, 10549, 8242, 411, 2323, 439, 2966, 6571, 3064, 856, 1642, 4830, 29898, 29876, 29918, 3626, 1338, 876, 13, 29888, 3466, 29918, 14506, 353, 29871, 29900, 13, 1454, 474, 297, 3464, 29898, 29876, 29918, 3626, 1338, 1125, 13, 1678, 6036, 353, 3855, 4597, 580, 13, 1678, 694, 13344, 29918, 12719, 29889, 265, 29898, 9573, 29897, 13, 1678, 565, 451, 7442, 29889, 2378, 29918, 11745, 4197, 29896, 29892, 29871, 29900, 1402, 6036, 29889, 15070, 29918, 3859, 580, 1125, 13, 4706, 285, 3466, 29918, 14506, 4619, 29871, 29896, 13, 13, 29888, 3466, 29918, 25376, 353, 29871, 29896, 29900, 29900, 29930, 29888, 3466, 29918, 14506, 29914, 29876, 29918, 3626, 1338, 13, 2158, 703, 21591, 285, 3466, 2179, 2955, 21313, 29901, 29889, 29896, 29888, 29913, 718, 24028, 12365, 29889, 29896, 29888, 1800, 29995, 310, 278, 931, 7790, 29876, 1642, 4830, 29898, 29888, 3466, 29918, 25376, 29892, 29871, 29900, 29889, 29945, 29930, 29888, 3466, 29918, 25376, 29914, 9302, 29889, 3676, 29898, 29876, 29918, 3626, 1338, 4961, 13, 13, 2158, 703, 3047, 2586, 285, 3466, 6976, 310, 12365, 29889, 29896, 29888, 10560, 29901, 1642, 4830, 29898, 29896, 29900, 29900, 29930, 22795, 876, 13, 2158, 703, 1576, 12116, 936, 22713, 2551, 6554, 29901, 12365, 29889, 29896, 29888, 10560, 1642, 4830, 29898, 29896, 29900, 29900, 29930, 14138, 29918, 8698, 876, 13, 2158, 703, 1576, 12116, 936, 22713, 10672, 6554, 29901, 12365, 29889, 29896, 29888, 10560, 29905, 29876, 1642, 4830, 29898, 29896, 29900, 29900, 29930, 14138, 29918, 14057, 545, 876, 13, 13, 29937, 2567, 591, 3638, 385, 18511, 2106, 1549, 1749, 694, 13344, 8242, 302, 29918, 3626, 1338, 3064, 29889, 13, 29937, 853, 9342, 278, 1596, 3454, 297, 278, 363, 2425, 304, 1236, 1416, 472, 278, 2106, 310, 278, 6036, 13, 29937, 1156, 1269, 5858, 29889, 22738, 29892, 1236, 1416, 292, 338, 443, 14017, 936, 29991, 13, 2158, 703, 27795, 6571, 3367, 1338, 310, 9348, 385, 18511, 2106, 856, 1642, 4830, 29898, 29876, 29918, 3626, 1338, 876, 13, 1454, 474, 297, 3464, 29898, 29876, 29918, 3626, 1338, 1125, 13, 1678, 396, 25455, 263, 2106, 29889, 13, 1678, 2428, 29918, 3283, 353, 3855, 4597, 29898, 29896, 29897, 13, 1678, 390, 2891, 29918, 29979, 29898, 29900, 29889, 29906, 467, 265, 29898, 9136, 29918, 3283, 29897, 13, 1678, 396, 1596, 703, 4290, 2106, 891, 6134, 29958, 353, 613, 2428, 29918, 3283, 29889, 412, 1416, 3101, 13, 1678, 396, 1174, 401, 2750, 2586, 285, 3466, 29889, 13, 1678, 315, 12256, 29889, 265, 29898, 9136, 29918, 3283, 29892, 29871, 29896, 29892, 29871, 29900, 29897, 13, 1678, 315, 12256, 29889, 265, 29898, 9136, 29918, 3283, 29892, 29871, 29906, 29892, 29871, 29900, 29897, 13, 1678, 2069, 29918, 3859, 353, 2428, 29918, 3283, 29889, 15070, 29918, 3859, 580, 13, 1678, 396, 1596, 703, 8566, 6797, 2106, 891, 6134, 11041, 353, 613, 2428, 29918, 3283, 29889, 412, 1416, 3101, 13, 1678, 396, 15076, 2106, 1549, 694, 13344, 8242, 29889, 13, 1678, 363, 439, 2966, 297, 3464, 29898, 2435, 29898, 9136, 29918, 3283, 22164, 13, 4706, 694, 13344, 29918, 12719, 29889, 265, 29898, 9136, 29918, 3283, 29892, 439, 2966, 29897, 13, 1678, 396, 1596, 703, 8566, 6797, 2106, 1156, 694, 13344, 22713, 29901, 613, 2428, 29918, 3283, 29889, 412, 1416, 3101, 13, 1678, 396, 4671, 4211, 852, 1059, 22898, 4871, 29889, 13, 1678, 796, 29918, 29906, 29896, 353, 796, 29889, 29895, 1617, 29898, 29999, 29892, 306, 29897, 13, 1678, 796, 29918, 29896, 29900, 353, 306, 29889, 29895, 1617, 29898, 29999, 29892, 796, 29897, 13, 1678, 3234, 29918, 29906, 29896, 353, 2428, 29918, 3283, 29889, 26658, 29918, 711, 12114, 29898, 29999, 29918, 29906, 29896, 29897, 13, 1678, 396, 1596, 703, 4276, 310, 796, 29918, 29906, 29896, 29901, 613, 2428, 29918, 3283, 29889, 412, 1416, 3101, 13, 1678, 396, 1596, 703, 29999, 29918, 29906, 29896, 20039, 29901, 613, 3234, 29918, 29906, 29896, 29897, 13, 1678, 3234, 29918, 29896, 29900, 353, 2428, 29918, 3283, 29889, 26658, 29918, 711, 12114, 29898, 29999, 29918, 29896, 29900, 29897, 13, 1678, 396, 1596, 703, 4276, 310, 796, 29918, 29896, 29900, 29901, 613, 2428, 29918, 3283, 29889, 412, 1416, 3101, 13, 1678, 396, 1596, 703, 29999, 29918, 29896, 29900, 20039, 29901, 613, 3234, 29918, 29896, 29900, 29897, 13, 1678, 565, 3234, 29918, 29896, 29900, 1275, 3234, 29918, 29906, 29896, 29901, 13, 4706, 565, 3234, 29918, 29896, 29900, 1275, 29871, 29896, 29901, 13, 9651, 396, 1939, 26385, 3734, 313, 29896, 448, 282, 4887, 29941, 13, 9651, 1209, 13, 4706, 1683, 29901, 13, 9651, 396, 14253, 439, 2966, 285, 492, 2986, 313, 29896, 448, 282, 4887, 29906, 334, 282, 13, 9651, 1060, 29889, 265, 29898, 9136, 29918, 3283, 29892, 29871, 29896, 29897, 13, 1678, 565, 3234, 29918, 29896, 29900, 2804, 3234, 29918, 29906, 29896, 29901, 13, 4706, 565, 3234, 29918, 29906, 29896, 1275, 448, 29896, 29901, 13, 9651, 396, 660, 431, 277, 29871, 29906, 285, 492, 2986, 313, 29896, 448, 282, 4887, 29906, 334, 282, 13, 9651, 1060, 29889, 265, 29898, 9136, 29918, 3283, 29892, 29871, 29906, 29897, 13, 4706, 1683, 29901, 13, 9651, 396, 660, 431, 277, 29871, 29900, 285, 492, 2986, 313, 29896, 448, 282, 4887, 29906, 334, 282, 13, 9651, 1060, 29889, 265, 29898, 9136, 29918, 3283, 29892, 29871, 29900, 29897, 13, 1678, 396, 1596, 703, 4789, 957, 287, 2106, 29901, 613, 2428, 29918, 3283, 29889, 412, 1416, 3101, 13, 1678, 565, 7442, 29889, 497, 5358, 29898, 2344, 29918, 3859, 29892, 2428, 29918, 3283, 29889, 15070, 29918, 3859, 580, 1125, 13, 4706, 2551, 267, 4619, 29871, 29896, 13, 1678, 1683, 29901, 13, 4706, 4418, 1973, 4619, 29871, 29896, 13, 13, 2158, 703, 14191, 1319, 12365, 29889, 29906, 29888, 10560, 310, 278, 931, 1642, 4830, 29898, 29896, 29900, 29900, 29930, 8698, 267, 29914, 29876, 29918, 3626, 1338, 876, 13, 2158, 703, 25807, 29884, 1676, 1319, 12365, 29889, 29906, 29888, 10560, 310, 278, 931, 1642, 4830, 29898, 29896, 29900, 29900, 29930, 14057, 1973, 29914, 29876, 29918, 3626, 1338, 876, 13, 2 ]
devices/parser/serializers.py
City-of-Helsinki/hel-data-pipe
1
19250
<reponame>City-of-Helsinki/hel-data-pipe from rest_framework import serializers from .models import Device, SensorType class SensorTypeSerializer(serializers.ModelSerializer): class Meta: model = SensorType fields = "__all__" class DeviceSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = Device fields = "__all__"
[ 1, 529, 276, 1112, 420, 29958, 16885, 29899, 974, 29899, 29950, 1379, 682, 29875, 29914, 3952, 29899, 1272, 29899, 17760, 13, 3166, 1791, 29918, 4468, 1053, 7797, 19427, 13, 13, 3166, 869, 9794, 1053, 21830, 29892, 317, 6073, 1542, 13, 13, 13, 1990, 317, 6073, 1542, 17679, 29898, 15550, 19427, 29889, 3195, 17679, 1125, 13, 1678, 770, 20553, 29901, 13, 4706, 1904, 353, 317, 6073, 1542, 13, 4706, 4235, 353, 376, 1649, 497, 1649, 29908, 13, 13, 13, 1990, 21830, 17679, 29898, 15550, 19427, 29889, 26322, 546, 2324, 287, 3195, 17679, 1125, 13, 1678, 770, 20553, 29901, 13, 4706, 1904, 353, 21830, 13, 4706, 4235, 353, 376, 1649, 497, 1649, 29908, 13, 2 ]
tests/unit/test_client.py
Omegaice/smartcontainers
6
165916
<gh_stars>1-10 # -*- coding: utf-8 -*- """Tests for Smart Containers Docker API Client. Testing for Smart Containers Client. This module extends the docker-py package to provide the ability to add metadata to docker containers. It is meant to be a drop-in replacement the docker-py package Client module. Existing methods that change the state of a conainer are implimented to also write the provenance associated with that state change. """ import tarfile import time import os def test_simple_tar(createClient): """Tarfile creation. Create tarfile from sample file and assert that resultant file is a tarfile. """ # Create the smartcontainer client # Create a test file to be turned into a tar with open('tempprov.txt', 'a') as provfile: provfile.write('This is the data for the tar file test.') # Call the simple tar function and test the result thisfile = createClient.simple_tar('tempprov.txt') assert tarfile.is_tarfile(thisfile.name) def test_fileCopyIn(createClient, pull_docker_image): """File Copy into container from image. Create a new test container and copy tarfile into container. """ newContainer = createClient.create_container(image=pull_docker_image, command="/bin/sh", tty=True) ContainerID = str(newContainer['Id']) createClient.start(ContainerID) with open('SCProv.jsonld', 'a') as provfile: provfile.write('This is the data for the tar file test.') createClient.fileCopyIn(ContainerID, 'SCProv.jsonld', '/') assert createClient.hasProv(ContainerID, 'SCProv.jsonld', '/SmartContainer') time.sleep(1) createClient.stop(ContainerID) createClient.remove_container(ContainerID) os.remove('SCProv.jsonld') def test_fileCopyOut(createClient, pull_docker_image): """File Copy out of container. Create a new test container and copy directory out of container as a tarfile. """ newContainer = createClient.create_container(image=pull_docker_image, command="/bin/sh", tty=True) ContainerID = str(newContainer['Id']) createClient.start(ContainerID) with open('SCProv.jsonld', 'a') as provfile: provfile.write('This is the data for the tar file test.') createClient.fileCopyIn(ContainerID, 'SCProv.jsonld', '/') createClient.fileCopyOut(ContainerID, 'SCProv.jsonld', '/SmartContainer/') assert os.path.isfile('SCProv.jsonld') time.sleep(1) createClient.stop(ContainerID) createClient.remove_container(ContainerID) os.remove('SCProv.jsonld') def test_put_label_image(createClient, pull_docker_image): """Add label to docker image. Add a label to a test image file and assert the label exists. """ myLabel = {'smartcontainer': '{"author":"<NAME>"}'} createClient.put_label_image(image=pull_docker_image, repository="phusion/baseimage", tag="tester", label=myLabel) # The new image created should be image[0]'s id image_list = createClient.images() image_id = image_list[0]['Id'] myInspect = createClient.inspect_image(image_id) assert 'Szakonyi' in str(myInspect) createClient.remove_image(image_id) def test_infect_image(createClient, pull_docker_image): """TODO: Create new Smart Container from docker image ID. First create a new smart container from fixture image. Next make sure that if the smart container already exists we don't overwrite the existing smart container. """ imageID = str(createClient.inspect_image(pull_docker_image)['Id']) imageID = imageID.replace('sha256:', '') sc_image = createClient.infect_image(image=imageID) # Test creation of existing smart container -- it's a twofur existing_sc_image = createClient.infect_image(image=sc_image) assert existing_sc_image == None # Cleanup image after ourselves createClient.remove_image(sc_image) # image_list = createClient.images() # We assume that if this operation is successful it will be on # top of the image list. # image_id = image_list[0]['Id'] def test_infect_container(createClient, pull_docker_image): """TODO: Create new Smartcontainer from container ID.""" pass def test_get_label_image(createClient, pull_docker_image): """Get JSON label from imageID.""" imageID = str(createClient.inspect_image(pull_docker_image)['Id']) imageID = imageID.replace('sha256:', '') sc_image = createClient.infect_image(image=imageID) json_str = createClient.get_label_image(imageID=sc_image) assert 'smartcontainer' in str(json_str) # print json_str createClient.remove_image(sc_image)
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 15945, 29908, 24376, 363, 4116, 442, 2866, 475, 414, 20868, 3450, 12477, 29889, 13, 13, 3057, 292, 363, 4116, 442, 2866, 475, 414, 12477, 29889, 13, 4013, 3883, 4988, 278, 10346, 29899, 2272, 3577, 304, 3867, 278, 11509, 304, 788, 13, 19635, 304, 10346, 22637, 29889, 739, 338, 6839, 304, 367, 263, 5768, 29899, 262, 16920, 29871, 278, 13, 14695, 29899, 2272, 3577, 12477, 3883, 29889, 1222, 15423, 3519, 393, 1735, 278, 2106, 310, 263, 13, 535, 4008, 526, 13374, 2073, 287, 304, 884, 2436, 278, 16413, 749, 6942, 411, 393, 13, 3859, 1735, 29889, 13, 15945, 29908, 13, 13, 5215, 9913, 1445, 13, 5215, 931, 13, 5215, 2897, 13, 13, 13, 1753, 1243, 29918, 12857, 29918, 12637, 29898, 3258, 4032, 1125, 13, 1678, 9995, 29911, 279, 1445, 11265, 29889, 13, 13, 1678, 6204, 9913, 1445, 515, 4559, 934, 322, 4974, 393, 1121, 424, 934, 13, 1678, 338, 263, 9913, 1445, 29889, 13, 1678, 9995, 13, 1678, 396, 6204, 278, 15040, 7611, 3132, 13, 1678, 396, 6204, 263, 1243, 934, 304, 367, 6077, 964, 263, 9913, 13, 1678, 411, 1722, 877, 1356, 407, 10139, 29889, 3945, 742, 525, 29874, 1495, 408, 1326, 1445, 29901, 13, 4706, 1326, 1445, 29889, 3539, 877, 4013, 338, 278, 848, 363, 278, 9913, 934, 1243, 29889, 1495, 13, 1678, 396, 8251, 278, 2560, 9913, 740, 322, 1243, 278, 1121, 13, 1678, 445, 1445, 353, 1653, 4032, 29889, 12857, 29918, 12637, 877, 1356, 407, 10139, 29889, 3945, 1495, 13, 1678, 4974, 9913, 1445, 29889, 275, 29918, 12637, 1445, 29898, 1366, 1445, 29889, 978, 29897, 13, 13, 13, 1753, 1243, 29918, 1445, 11882, 797, 29898, 3258, 4032, 29892, 8206, 29918, 14695, 29918, 3027, 1125, 13, 1678, 9995, 2283, 14187, 964, 5639, 515, 1967, 29889, 13, 13, 1678, 6204, 263, 716, 1243, 5639, 322, 3509, 9913, 1445, 964, 5639, 29889, 13, 1678, 9995, 13, 1678, 716, 7895, 353, 1653, 4032, 29889, 3258, 29918, 7611, 29898, 3027, 29922, 26746, 29918, 14695, 29918, 3027, 29892, 13, 462, 462, 462, 1899, 13802, 2109, 29914, 845, 613, 260, 1017, 29922, 5574, 29897, 13, 1678, 21679, 1367, 353, 851, 29898, 1482, 7895, 1839, 1204, 11287, 13, 1678, 1653, 4032, 29889, 2962, 29898, 7895, 1367, 29897, 13, 1678, 411, 1722, 877, 7187, 1184, 29894, 29889, 3126, 430, 742, 525, 29874, 1495, 408, 1326, 1445, 29901, 13, 4706, 1326, 1445, 29889, 3539, 877, 4013, 338, 278, 848, 363, 278, 9913, 934, 1243, 29889, 1495, 13, 1678, 1653, 4032, 29889, 1445, 11882, 797, 29898, 7895, 1367, 29892, 525, 7187, 1184, 29894, 29889, 3126, 430, 742, 8207, 1495, 13, 1678, 4974, 1653, 4032, 29889, 5349, 1184, 29894, 29898, 7895, 1367, 29892, 525, 7187, 1184, 29894, 29889, 3126, 430, 742, 8207, 12636, 442, 7895, 1495, 13, 1678, 931, 29889, 17059, 29898, 29896, 29897, 13, 1678, 1653, 4032, 29889, 9847, 29898, 7895, 1367, 29897, 13, 1678, 1653, 4032, 29889, 5992, 29918, 7611, 29898, 7895, 1367, 29897, 13, 1678, 2897, 29889, 5992, 877, 7187, 1184, 29894, 29889, 3126, 430, 1495, 13, 13, 13, 1753, 1243, 29918, 1445, 11882, 3744, 29898, 3258, 4032, 29892, 8206, 29918, 14695, 29918, 3027, 1125, 13, 1678, 9995, 2283, 14187, 714, 310, 5639, 29889, 13, 13, 1678, 6204, 263, 716, 1243, 5639, 322, 3509, 3884, 714, 310, 5639, 13, 1678, 408, 263, 9913, 1445, 29889, 13, 1678, 9995, 13, 1678, 716, 7895, 353, 1653, 4032, 29889, 3258, 29918, 7611, 29898, 3027, 29922, 26746, 29918, 14695, 29918, 3027, 29892, 13, 462, 462, 462, 1899, 13802, 2109, 29914, 845, 613, 260, 1017, 29922, 5574, 29897, 13, 1678, 21679, 1367, 353, 851, 29898, 1482, 7895, 1839, 1204, 11287, 13, 1678, 1653, 4032, 29889, 2962, 29898, 7895, 1367, 29897, 13, 1678, 411, 1722, 877, 7187, 1184, 29894, 29889, 3126, 430, 742, 525, 29874, 1495, 408, 1326, 1445, 29901, 13, 4706, 1326, 1445, 29889, 3539, 877, 4013, 338, 278, 848, 363, 278, 9913, 934, 1243, 29889, 1495, 13, 1678, 1653, 4032, 29889, 1445, 11882, 797, 29898, 7895, 1367, 29892, 525, 7187, 1184, 29894, 29889, 3126, 430, 742, 8207, 1495, 13, 1678, 1653, 4032, 29889, 1445, 11882, 3744, 29898, 7895, 1367, 29892, 525, 7187, 1184, 29894, 29889, 3126, 430, 742, 8207, 12636, 442, 7895, 29914, 1495, 13, 1678, 4974, 2897, 29889, 2084, 29889, 275, 1445, 877, 7187, 1184, 29894, 29889, 3126, 430, 1495, 13, 1678, 931, 29889, 17059, 29898, 29896, 29897, 13, 1678, 1653, 4032, 29889, 9847, 29898, 7895, 1367, 29897, 13, 1678, 1653, 4032, 29889, 5992, 29918, 7611, 29898, 7895, 1367, 29897, 13, 1678, 2897, 29889, 5992, 877, 7187, 1184, 29894, 29889, 3126, 430, 1495, 13, 13, 13, 1753, 1243, 29918, 649, 29918, 1643, 29918, 3027, 29898, 3258, 4032, 29892, 8206, 29918, 14695, 29918, 3027, 1125, 13, 1678, 9995, 2528, 3858, 304, 10346, 1967, 29889, 13, 13, 1678, 3462, 263, 3858, 304, 263, 1243, 1967, 934, 322, 4974, 278, 3858, 4864, 29889, 13, 1678, 9995, 13, 1678, 590, 4775, 353, 11117, 3844, 442, 7611, 2396, 525, 6377, 8921, 4710, 29966, 5813, 29958, 9092, 10827, 13, 1678, 1653, 4032, 29889, 649, 29918, 1643, 29918, 3027, 29898, 3027, 29922, 26746, 29918, 14695, 29918, 3027, 29892, 13, 462, 462, 9810, 543, 561, 3958, 29914, 3188, 3027, 613, 13, 462, 462, 4055, 543, 1688, 261, 613, 3858, 29922, 1357, 4775, 29897, 13, 1678, 396, 450, 716, 1967, 2825, 881, 367, 1967, 29961, 29900, 29962, 29915, 29879, 1178, 13, 1678, 1967, 29918, 1761, 353, 1653, 4032, 29889, 8346, 580, 13, 1678, 1967, 29918, 333, 353, 1967, 29918, 1761, 29961, 29900, 22322, 1204, 2033, 13, 1678, 590, 797, 21494, 353, 1653, 4032, 29889, 1144, 1103, 29918, 3027, 29898, 3027, 29918, 333, 29897, 13, 1678, 4974, 525, 29903, 29114, 2592, 29875, 29915, 297, 851, 29898, 1357, 797, 21494, 29897, 13, 1678, 1653, 4032, 29889, 5992, 29918, 3027, 29898, 3027, 29918, 333, 29897, 13, 13, 13, 1753, 1243, 29918, 262, 3647, 29918, 3027, 29898, 3258, 4032, 29892, 8206, 29918, 14695, 29918, 3027, 1125, 13, 1678, 9995, 4986, 3970, 29901, 6204, 716, 4116, 442, 21679, 515, 10346, 1967, 3553, 29889, 13, 13, 1678, 3824, 1653, 263, 716, 15040, 5639, 515, 5713, 15546, 1967, 29889, 8084, 1207, 13, 1678, 1854, 393, 565, 278, 15040, 5639, 2307, 4864, 591, 1016, 29915, 29873, 26556, 278, 13, 1678, 5923, 15040, 5639, 29889, 13, 1678, 9995, 13, 1678, 1967, 1367, 353, 851, 29898, 3258, 4032, 29889, 1144, 1103, 29918, 3027, 29898, 26746, 29918, 14695, 29918, 3027, 29897, 1839, 1204, 11287, 13, 1678, 1967, 1367, 353, 1967, 1367, 29889, 6506, 877, 17051, 29906, 29945, 29953, 29901, 742, 27255, 13, 1678, 885, 29918, 3027, 353, 1653, 4032, 29889, 262, 3647, 29918, 3027, 29898, 3027, 29922, 3027, 1367, 29897, 13, 13, 1678, 396, 4321, 11265, 310, 5923, 15040, 5639, 1192, 372, 29915, 29879, 263, 1023, 22613, 13, 1678, 5923, 29918, 1557, 29918, 3027, 353, 1653, 4032, 29889, 262, 3647, 29918, 3027, 29898, 3027, 29922, 1557, 29918, 3027, 29897, 13, 1678, 4974, 5923, 29918, 1557, 29918, 3027, 1275, 6213, 13, 1678, 396, 315, 14044, 786, 1967, 1156, 20278, 13, 1678, 1653, 4032, 29889, 5992, 29918, 3027, 29898, 1557, 29918, 3027, 29897, 13, 1678, 396, 1967, 29918, 1761, 353, 1653, 4032, 29889, 8346, 580, 13, 1678, 396, 1334, 5251, 393, 565, 445, 5858, 338, 9150, 372, 674, 367, 373, 13, 1678, 396, 2246, 310, 278, 1967, 1051, 29889, 13, 1678, 396, 1967, 29918, 333, 353, 1967, 29918, 1761, 29961, 29900, 22322, 1204, 2033, 13, 13, 13, 1753, 1243, 29918, 262, 3647, 29918, 7611, 29898, 3258, 4032, 29892, 8206, 29918, 14695, 29918, 3027, 1125, 13, 1678, 9995, 4986, 3970, 29901, 6204, 716, 4116, 442, 7611, 515, 5639, 3553, 1213, 15945, 13, 1678, 1209, 13, 13, 13, 1753, 1243, 29918, 657, 29918, 1643, 29918, 3027, 29898, 3258, 4032, 29892, 8206, 29918, 14695, 29918, 3027, 1125, 13, 1678, 9995, 2577, 4663, 3858, 515, 1967, 1367, 1213, 15945, 13, 1678, 1967, 1367, 353, 851, 29898, 3258, 4032, 29889, 1144, 1103, 29918, 3027, 29898, 26746, 29918, 14695, 29918, 3027, 29897, 1839, 1204, 11287, 13, 1678, 1967, 1367, 353, 1967, 1367, 29889, 6506, 877, 17051, 29906, 29945, 29953, 29901, 742, 27255, 13, 1678, 885, 29918, 3027, 353, 1653, 4032, 29889, 262, 3647, 29918, 3027, 29898, 3027, 29922, 3027, 1367, 29897, 13, 1678, 4390, 29918, 710, 353, 1653, 4032, 29889, 657, 29918, 1643, 29918, 3027, 29898, 3027, 1367, 29922, 1557, 29918, 3027, 29897, 13, 1678, 4974, 525, 3844, 442, 7611, 29915, 297, 851, 29898, 3126, 29918, 710, 29897, 13, 1678, 396, 1596, 4390, 29918, 710, 13, 1678, 1653, 4032, 29889, 5992, 29918, 3027, 29898, 1557, 29918, 3027, 29897, 13, 2 ]
neo/io/plexonio.py
michaelfsp/python-neo
1
52859
<filename>neo/io/plexonio.py # encoding: utf-8 """ Class for reading data from Plexion acquisition system (.plx) Compatible with versions 100 to 106. Other versions have not been tested. This IO is developed thanks to the header file downloadable from: http://www.plexon.com/downloads.html Depend on: Supported : Read Author: sgarcia """ from .baseio import BaseIO from ..core import * from .tools import create_many_to_one_relationship, iteritems import numpy as np import quantities as pq import struct import datetime import os class PlexonIO(BaseIO): """ Class for reading plx file. Usage: >>> from neo import io >>> r = io.PlexonIO(filename='File_plexon_1.plx') >>> seg = r.read_segment(lazy=False, cascade=True) >>> print seg.analogsignals [] >>> print seg.spiketrains # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE [<SpikeTrain(array([ 2.75000000e-02, 5.68250000e-02, 8.52500000e-02, ..., ... >>> print seg.eventarrays [] """ is_readable = True is_writable = False supported_objects = [Segment , AnalogSignal, SpikeTrain, EventArray, EpochArray] readable_objects = [ Segment] writeable_objects = [] has_header = False is_streameable = False # This is for GUI stuf : a definition for parameters when reading. read_params = { Segment : [ ('load_spike_waveform' , { 'value' : False } ) , ] } write_params = None name = 'Plexon' extensions = [ 'plx' ] mode = 'file' def __init__(self , filename = None) : """ This class read a plx file. Arguments: filename : the filename """ BaseIO.__init__(self) self.filename = filename def read_segment(self, lazy = False, cascade = True, load_spike_waveform = False, ): """ """ fid = open(self.filename, 'rb') globalHeader = HeaderReader(fid , GlobalHeader ).read_f(offset = 0) # metadatas seg = Segment() seg.rec_datetime = datetime.datetime( globalHeader['Year'] , globalHeader['Month'] , globalHeader['Day'] , globalHeader['Hour'] , globalHeader['Minute'] , globalHeader['Second'] ) seg.file_origin = os.path.basename(self.filename) seg.annotate(plexon_version = globalHeader['Version']) if not cascade: return seg ## Step 1 : read headers # dsp channels heade dspChannelHeaders = { } maxunit=0 maxchan = 0 for i in xrange(globalHeader['NumDSPChannels']): # channel is 1 based channelHeader = HeaderReader(fid , ChannelHeader ).read_f(offset = None) channelHeader['Template'] = np.array(channelHeader['Template']).reshape((5,64)) channelHeader['Boxes'] = np.array(channelHeader['Boxes']).reshape((5,2,4)) dspChannelHeaders[channelHeader['Channel']]=channelHeader maxunit = max(channelHeader['NUnits'],maxunit) maxchan = max(channelHeader['Channel'],maxchan) # event channel header eventHeaders = { } for i in xrange(globalHeader['NumEventChannels']): eventHeader = HeaderReader(fid , EventHeader ).read_f(offset = None) eventHeaders[eventHeader['Channel']] = eventHeader # slow channel header slowChannelHeaders = { } for i in xrange(globalHeader['NumSlowChannels']): slowChannelHeader = HeaderReader(fid , SlowChannelHeader ).read_f(offset = None) slowChannelHeaders[slowChannelHeader['Channel']] = slowChannelHeader ## Step 2 : prepare allocating # for allocating continuous signal ncontinuoussamples = np.zeros(len(slowChannelHeaders)) sampleposition = np.zeros(len(slowChannelHeaders)) anaSigs = { } # for allocating spiketimes and waveform spiketrains = { } nspikecounts = np.zeros((maxchan+1, maxunit+1) ,dtype='i') for i,channelHeader in iteritems(dspChannelHeaders): spiketrains[i] = { } # for allocating EventArray eventarrays = { } neventsperchannel = { } #maxstrsizeperchannel = { } for chan, h in iteritems(eventHeaders): neventsperchannel[chan] = 0 #maxstrsizeperchannel[chan] = 0 ## Step 3 : a first loop for counting size start = fid.tell() while fid.tell() !=-1 : # read block header dataBlockHeader = HeaderReader(fid , DataBlockHeader ).read_f(offset = None) if dataBlockHeader is None : break chan = dataBlockHeader['Channel'] unit = dataBlockHeader['Unit'] n1,n2 = dataBlockHeader['NumberOfWaveforms'] , dataBlockHeader['NumberOfWordsInWaveform'] if dataBlockHeader['Type'] == 1: #spike if unit not in spiketrains[chan]: sptr = SpikeTrain([ ], units='s', t_stop=0.0) sptr.annotate(unit_name = dspChannelHeaders[chan]['Name']) sptr.annotate(channel_index = i) spiketrains[chan][unit] = sptr spiketrains[chan][unit].sizeOfWaveform = n1,n2 nspikecounts[chan,unit] +=1 fid.seek(n1*n2*2,1) elif dataBlockHeader['Type'] ==4: #event neventsperchannel[chan] += 1 if chan not in eventarrays: ea = EventArray() ea.annotate(channel_name= eventHeaders[chan]['Name']) ea.annotate(channel_index = chan) eventarrays[chan] = ea elif dataBlockHeader['Type'] == 5: #continuous signal fid.seek(n2*2, 1) if n2> 0: ncontinuoussamples[chan] += n2 if chan not in anaSigs: anasig = AnalogSignal( [ ], units = 'V', sampling_rate = float(slowChannelHeaders[chan]['ADFreq'])*pq.Hz, t_start = 0.*pq.s, ) anasig.annotate(channel_index = slowChannelHeaders[chan]['Channel']) anasig.annotate(channel_name = slowChannelHeaders[chan]['Name']) anaSigs[chan] = anasig if lazy: for chan, anaSig in iteritems(anaSigs): anaSigs[chan].lazy_shape = ncontinuoussamples[chan] for chan, sptrs in iteritems(spiketrains): for unit, sptr in iteritems(sptrs): spiketrains[chan][unit].lazy_shape = nspikecounts[chan][unit] for chan, ea in iteritems(eventarrays): ea.lazy_shape = neventsperchannel[chan] else: ## Step 4: allocating memory if not lazy # continuous signal for chan, anaSig in iteritems(anaSigs): anaSigs[chan] = anaSig.duplicate_with_new_array(np.zeros((ncontinuoussamples[chan]) , dtype = 'f4')*pq.V, ) # allocating mem for SpikeTrain for chan, sptrs in iteritems(spiketrains): for unit, sptr in iteritems(sptrs): new = SpikeTrain(np.zeros((nspikecounts[chan][unit]), dtype='f')*pq.s, t_stop=1e99) # use an enormous value for t_stop for now, put in correct value later new.annotations.update(sptr.annotations) if load_spike_waveform: n1, n2 = spiketrains[chan][unit].sizeOfWaveform new.waveforms = np.zeros( (nspikecounts[chan][unit], n1, n2 )*pq.V , dtype = 'f' ) * pq.V spiketrains[chan][unit] = new nspikecounts[:] = 0 # event eventpositions = { } for chan, ea in iteritems(eventarrays): ea.times = np.zeros( neventsperchannel[chan] )*pq.s #ea.labels = zeros( neventsperchannel[chan] , dtype = 'S'+str(neventsperchannel[chan]) ) eventpositions[chan]=0 if not lazy: ## Step 5 : a second loop for reading if not lazy fid.seek(start) while fid.tell() !=-1 : dataBlockHeader = HeaderReader(fid , DataBlockHeader ).read_f(offset = None) if dataBlockHeader is None : break chan = dataBlockHeader['Channel'] n1,n2 = dataBlockHeader['NumberOfWaveforms'] , dataBlockHeader['NumberOfWordsInWaveform'] time = dataBlockHeader['UpperByteOf5ByteTimestamp']*2.**32 + dataBlockHeader['TimeStamp'] time/= globalHeader['ADFrequency'] if n2 <0: break if dataBlockHeader['Type'] == 1: #spike unit = dataBlockHeader['Unit'] sptr = spiketrains[chan][unit] pos = nspikecounts[chan,unit] sptr[pos] = time * pq.s if load_spike_waveform and n1*n2 != 0 : waveform = fromstring( fid.read(n1*n2*2) , dtype = 'i2').reshape(n1,n2).astype('f') #range if globalHeader['Version'] <103: waveform = waveform*3000./(2048*dspChannelHeaders[chan]['Gain']*1000.) elif globalHeader['Version'] >=103 and globalHeader['Version'] <105: waveform = waveform*globalHeader['SpikeMaxMagnitudeMV']/(.5*2.**(globalHeader['BitsPerSpikeSample'])*1000.) elif globalHeader['Version'] >105: waveform = waveform*globalHeader['SpikeMaxMagnitudeMV']/(.5*2.**(globalHeader['BitsPerSpikeSample'])*globalHeader['SpikePreAmpGain']) sptr._waveforms[pos,:,:] = waveform else: fid.seek(n1*n2*2,1) nspikecounts[chan,unit] +=1 elif dataBlockHeader['Type'] == 4: # event pos = eventpositions[chan] eventarrays[chan].times[pos] = time * pq.s eventpositions[chan]+= 1 elif dataBlockHeader['Type'] == 5: #signal data = np.fromstring( fid.read(n2*2) , dtype = 'i2').astype('f4') #range if globalHeader['Version'] ==100 or globalHeader['Version'] ==101 : data = data*5000./(2048*slowChannelHeaders[chan]['Gain']*1000.) elif globalHeader['Version'] ==102 : data = data*5000./(2048*slowChannelHeaders[chan]['Gain']*slowChannelHeaders[chan]['PreampGain']) elif globalHeader['Version'] >= 103: data = data*globalHeader['SlowMaxMagnitudeMV']/(.5*(2**globalHeader['BitsPerSpikeSample'])*\ slowChannelHeaders[chan]['Gain']*slowChannelHeaders[chan]['PreampGain']) anaSigs[chan][sampleposition[chan] : sampleposition[chan]+data.size] = data * pq.V sampleposition[chan] += data.size if sampleposition[chan] ==0: anaSigs[chan].t_start = time* pq.s #TODO if lazy # add AnalogSignal to sgement for k,anaSig in iteritems(anaSigs) : if anaSig is not None: seg.analogsignals.append(anaSig) # add SpikeTrain to sgement for chan, sptrs in iteritems(spiketrains): for unit, sptr in iteritems(sptrs): if len(sptr) > 0: sptr.t_stop = sptr.max() # can probably get a better value for this, from the associated AnalogSignal seg.spiketrains.append(sptr) # add eventarray to segment for chan,ea in iteritems(eventarrays): seg.eventarrays.append(ea) create_many_to_one_relationship(seg) return seg GlobalHeader = [ ('MagicNumber' , 'I'), ('Version','i'), ('Comment','128s'), ('ADFrequency','i'), ('NumDSPChannels','i'), ('NumEventChannels','i'), ('NumSlowChannels','i'), ('NumPointsWave','i'), ('NumPointsPreThr','i'), ('Year','i'), ('Month','i'), ('Day','i'), ('Hour','i'), ('Minute','i'), ('Second','i'), ('FastRead','i'), ('WaveformFreq','i'), ('LastTimestamp','d'), #version >103 ('Trodalness' , 'b'), ('DataTrodalness' , 'b'), ('BitsPerSpikeSample' , 'b'), ('BitsPerSlowSample' , 'b'), ('SpikeMaxMagnitudeMV' , 'H'), ('SlowMaxMagnitudeMV' , 'H'), #version 105 ('SpikePreAmpGain' , 'H'), #version 106 ('AcquiringSoftware','18s'), ('ProcessingSoftware','18s'), ('Padding','10s'), # all version ('TSCounts','650i'), ('WFCounts','650i'), ('EVCounts','512i'), ] ChannelHeader = [ ('Name' , '32s'), ('SIGName','32s'), ('Channel','i'), ('WFRate','i'), ('SIG','i'), ('Ref','i'), ('Gain','i'), ('Filter','i'), ('Threshold','i'), ('Method','i'), ('NUnits','i'), ('Template','320h'), ('Fit','5i'), ('SortWidth','i'), ('Boxes','40h'), ('SortBeg','i'), #version 105 ('Comment','128s'), #version 106 ('SrcId','b'), ('reserved','b'), ('ChanId','H'), ('Padding','10i'), ] EventHeader = [ ('Name' , '32s'), ('Channel','i'), #version 105 ('Comment' , '128s'), #version 106 ('SrcId','b'), ('reserved','b'), ('ChanId','H'), ('Padding','32i'), ] SlowChannelHeader = [ ('Name' , '32s'), ('Channel','i'), ('ADFreq','i'), ('Gain','i'), ('Enabled','i'), ('PreampGain','i'), #version 104 ('SpikeChannel','i'), #version 105 ('Comment','128s'), #version 106 ('SrcId','b'), ('reserved','b'), ('ChanId','H'), ('Padding','27i'), ] DataBlockHeader = [ ('Type','h'), ('UpperByteOf5ByteTimestamp','h'), ('TimeStamp','i'), ('Channel','h'), ('Unit','h'), ('NumberOfWaveforms','h'), ('NumberOfWordsInWaveform','h'), ]# 16 bytes class HeaderReader(): def __init__(self,fid ,description ): self.fid = fid self.description = description def read_f(self, offset =None): if offset is not None : self.fid.seek(offset) d = { } for key, format in self.description : buf = self.fid.read(struct.calcsize(format)) if len(buf) != struct.calcsize(format) : return None val = struct.unpack(format , buf) if len(val) == 1: val = val[0] else : val = list(val) if 's' in format : val = val.replace('\x00','') d[key] = val return d
[ 1, 529, 9507, 29958, 11496, 29914, 601, 29914, 10709, 14642, 29889, 2272, 13, 29937, 8025, 29901, 23616, 29899, 29947, 13, 15945, 29908, 13, 2385, 363, 5183, 848, 515, 349, 2506, 291, 1274, 23493, 1788, 14544, 572, 29916, 29897, 13, 13, 14644, 1821, 411, 6910, 29871, 29896, 29900, 29900, 304, 29871, 29896, 29900, 29953, 29889, 13, 16107, 6910, 505, 451, 1063, 9528, 29889, 13, 13, 4013, 10663, 338, 8906, 3969, 304, 278, 4839, 934, 5142, 519, 515, 29901, 13, 1124, 597, 1636, 29889, 10709, 265, 29889, 510, 29914, 10382, 29879, 29889, 1420, 13, 13, 13, 8498, 355, 373, 29901, 13, 13, 14039, 287, 584, 7523, 13, 13, 13720, 29901, 269, 5397, 1512, 13, 13, 15945, 29908, 13, 13, 3166, 869, 3188, 601, 1053, 7399, 5971, 13, 3166, 6317, 3221, 1053, 334, 13, 3166, 869, 8504, 1053, 1653, 29918, 13011, 29918, 517, 29918, 650, 29918, 2674, 800, 4034, 29892, 4256, 7076, 13, 5215, 12655, 408, 7442, 13, 5215, 26855, 408, 282, 29939, 13, 13, 5215, 2281, 13, 5215, 12865, 13, 5215, 2897, 13, 13, 13, 13, 1990, 349, 2506, 265, 5971, 29898, 5160, 5971, 1125, 13, 1678, 9995, 13, 1678, 4134, 363, 5183, 715, 29916, 934, 29889, 13, 13, 1678, 10783, 482, 29901, 13, 4706, 8653, 515, 452, 29877, 1053, 12013, 13, 4706, 8653, 364, 353, 12013, 29889, 29925, 2506, 265, 5971, 29898, 9507, 2433, 2283, 29918, 10709, 265, 29918, 29896, 29889, 572, 29916, 1495, 13, 4706, 8653, 2377, 353, 364, 29889, 949, 29918, 28192, 29898, 433, 1537, 29922, 8824, 29892, 3209, 6332, 29922, 5574, 29897, 13, 4706, 8653, 1596, 2377, 29889, 7054, 468, 4530, 1338, 13, 4706, 5159, 13, 4706, 8653, 1596, 2377, 29889, 1028, 638, 27280, 1144, 29871, 396, 437, 312, 342, 29901, 718, 29923, 2208, 5690, 29903, 3235, 29892, 718, 29940, 1955, 1529, 5265, 10721, 29918, 25039, 1806, 2890, 29925, 11538, 13, 4706, 518, 29966, 29903, 1631, 446, 5323, 262, 29898, 2378, 4197, 259, 29906, 29889, 29955, 29945, 29900, 29900, 29900, 29900, 29900, 29900, 29872, 29899, 29900, 29906, 29892, 1678, 29945, 29889, 29953, 29947, 29906, 29945, 29900, 29900, 29900, 29900, 29872, 29899, 29900, 29906, 29892, 1678, 29947, 29889, 29945, 29906, 29945, 29900, 29900, 29900, 29900, 29900, 29872, 29899, 29900, 29906, 29892, 2023, 29892, 13, 4706, 2023, 13, 4706, 8653, 1596, 2377, 29889, 3696, 2378, 29879, 13, 4706, 5159, 13, 1678, 9995, 13, 13, 1678, 338, 29918, 949, 519, 4706, 353, 5852, 13, 1678, 338, 29918, 8231, 519, 4706, 353, 7700, 13, 13, 1678, 6969, 29918, 12650, 29871, 353, 518, 17669, 358, 1919, 11597, 468, 10140, 284, 29892, 317, 1631, 446, 5323, 262, 29892, 6864, 2588, 29892, 382, 1129, 305, 2588, 29962, 13, 1678, 19909, 29918, 12650, 1678, 353, 518, 6667, 358, 29962, 13, 1678, 2436, 519, 29918, 12650, 259, 353, 5159, 13, 13, 1678, 756, 29918, 6672, 308, 353, 7700, 13, 1678, 338, 29918, 13045, 420, 519, 268, 353, 7700, 13, 13, 1678, 396, 910, 338, 363, 14839, 380, 1137, 584, 263, 5023, 363, 4128, 746, 5183, 29889, 13, 1678, 1303, 29918, 7529, 4706, 353, 426, 13, 13, 462, 4706, 6667, 358, 584, 29871, 518, 13, 462, 462, 4706, 6702, 1359, 29918, 1028, 9345, 29918, 27766, 689, 29915, 1919, 426, 525, 1767, 29915, 584, 7700, 500, 1723, 1919, 13, 462, 462, 4706, 4514, 13, 462, 4706, 500, 13, 1678, 2436, 29918, 7529, 539, 353, 6213, 13, 13, 1678, 1024, 1669, 353, 525, 29925, 2506, 265, 29915, 13, 1678, 17752, 3986, 353, 518, 525, 572, 29916, 29915, 4514, 13, 13, 1678, 4464, 353, 525, 1445, 29915, 13, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 1919, 10422, 353, 6213, 29897, 584, 13, 4706, 9995, 13, 4706, 910, 770, 1303, 263, 715, 29916, 934, 29889, 13, 13, 4706, 11842, 9331, 29901, 13, 9651, 10422, 584, 278, 10422, 13, 13, 4706, 9995, 13, 4706, 7399, 5971, 17255, 2344, 12035, 1311, 29897, 13, 4706, 1583, 29889, 9507, 353, 10422, 13, 13, 13, 1678, 822, 1303, 29918, 28192, 29898, 1311, 29892, 13, 462, 462, 4706, 17366, 353, 7700, 29892, 13, 462, 462, 4706, 3209, 6332, 353, 5852, 29892, 13, 462, 462, 4706, 2254, 29918, 1028, 9345, 29918, 27766, 689, 353, 7700, 29892, 13, 462, 462, 632, 1125, 13, 4706, 9995, 13, 13, 4706, 9995, 13, 13, 4706, 25947, 353, 1722, 29898, 1311, 29889, 9507, 29892, 525, 6050, 1495, 13, 4706, 5534, 7850, 353, 19345, 6982, 29898, 29888, 333, 1919, 12002, 7850, 13742, 949, 29918, 29888, 29898, 10289, 353, 29871, 29900, 29897, 13, 13, 4706, 396, 1539, 328, 271, 294, 13, 4706, 2377, 353, 6667, 358, 580, 13, 4706, 2377, 29889, 3757, 29918, 12673, 353, 12865, 29889, 12673, 29898, 29871, 5534, 7850, 1839, 12883, 2033, 1919, 5534, 7850, 1839, 13953, 2033, 29871, 1919, 5534, 7850, 1839, 12742, 2033, 1919, 13, 462, 1678, 5534, 7850, 1839, 29950, 473, 2033, 1919, 5534, 7850, 1839, 8140, 1082, 2033, 1919, 5534, 7850, 1839, 11863, 2033, 1723, 13, 4706, 2377, 29889, 1445, 29918, 12574, 353, 2897, 29889, 2084, 29889, 6500, 3871, 29898, 1311, 29889, 9507, 29897, 13, 4706, 2377, 29889, 6735, 403, 29898, 10709, 265, 29918, 3259, 353, 5534, 7850, 1839, 6594, 11287, 13, 13, 4706, 565, 451, 3209, 6332, 29901, 13, 9651, 736, 2377, 13, 13, 13, 4706, 444, 16696, 29871, 29896, 584, 1303, 9066, 13, 13, 4706, 396, 270, 1028, 18196, 540, 1943, 13, 4706, 270, 1028, 13599, 18163, 353, 426, 500, 13, 4706, 4236, 5441, 29922, 29900, 13, 4706, 4236, 5083, 353, 29871, 29900, 13, 4706, 363, 474, 297, 921, 3881, 29898, 10945, 7850, 1839, 8009, 29928, 5550, 1451, 12629, 2033, 1125, 13, 9651, 396, 8242, 338, 29871, 29896, 2729, 13, 9651, 8242, 7850, 353, 19345, 6982, 29898, 29888, 333, 1919, 17368, 7850, 13742, 949, 29918, 29888, 29898, 10289, 353, 6213, 29897, 13, 9651, 8242, 7850, 1839, 6733, 2033, 353, 7442, 29889, 2378, 29898, 12719, 7850, 1839, 6733, 2033, 467, 690, 14443, 3552, 29945, 29892, 29953, 29946, 876, 13, 9651, 8242, 7850, 1839, 3313, 267, 2033, 353, 7442, 29889, 2378, 29898, 12719, 7850, 1839, 3313, 267, 2033, 467, 690, 14443, 3552, 29945, 29892, 29906, 29892, 29946, 876, 13, 9651, 270, 1028, 13599, 18163, 29961, 12719, 7850, 1839, 13599, 2033, 13192, 12719, 7850, 13, 9651, 4236, 5441, 353, 4236, 29898, 12719, 7850, 1839, 29940, 2525, 1169, 7464, 3317, 5441, 29897, 13, 9651, 4236, 5083, 353, 4236, 29898, 12719, 7850, 1839, 13599, 7464, 3317, 5083, 29897, 13, 13, 539, 396, 1741, 8242, 4839, 13, 4706, 1741, 18163, 353, 426, 500, 13, 4706, 363, 474, 297, 921, 3881, 29898, 10945, 7850, 1839, 8009, 2624, 1451, 12629, 2033, 1125, 13, 9651, 1741, 7850, 353, 19345, 6982, 29898, 29888, 333, 1919, 6864, 7850, 13742, 949, 29918, 29888, 29898, 10289, 353, 6213, 29897, 13, 9651, 1741, 18163, 29961, 3696, 7850, 1839, 13599, 2033, 29962, 353, 1741, 7850, 13, 13, 4706, 396, 5232, 8242, 4839, 13, 4706, 5232, 13599, 18163, 353, 426, 500, 13, 4706, 363, 474, 297, 921, 3881, 29898, 10945, 7850, 1839, 8009, 29903, 677, 1451, 12629, 2033, 1125, 13, 9651, 5232, 13599, 7850, 353, 19345, 6982, 29898, 29888, 333, 1919, 317, 677, 13599, 7850, 13742, 949, 29918, 29888, 29898, 10289, 353, 6213, 29897, 13, 9651, 5232, 13599, 18163, 29961, 28544, 13599, 7850, 1839, 13599, 2033, 29962, 353, 5232, 13599, 7850, 13, 13, 4706, 444, 16696, 29871, 29906, 584, 19012, 6643, 1218, 13, 4706, 396, 363, 6643, 1218, 9126, 7182, 13, 4706, 302, 20621, 21167, 9422, 353, 7442, 29889, 3298, 359, 29898, 2435, 29898, 28544, 13599, 18163, 876, 13, 4706, 4559, 3283, 353, 7442, 29889, 3298, 359, 29898, 2435, 29898, 28544, 13599, 18163, 876, 13, 4706, 385, 29874, 29903, 23379, 353, 426, 500, 13, 13, 4706, 396, 363, 6643, 1218, 805, 638, 300, 1355, 322, 10742, 689, 13, 4706, 805, 638, 27280, 1144, 353, 426, 500, 13, 4706, 302, 1028, 9345, 2798, 29879, 353, 7442, 29889, 3298, 359, 3552, 3317, 5083, 29974, 29896, 29892, 4236, 5441, 29974, 29896, 29897, 1919, 29881, 1853, 2433, 29875, 1495, 13, 4706, 363, 474, 29892, 12719, 7850, 297, 4256, 7076, 29898, 29881, 1028, 13599, 18163, 1125, 13, 9651, 805, 638, 27280, 1144, 29961, 29875, 29962, 353, 426, 500, 13, 13, 4706, 396, 363, 6643, 1218, 6864, 2588, 13, 4706, 1741, 2378, 29879, 353, 426, 500, 13, 4706, 452, 794, 29879, 546, 12719, 353, 426, 500, 13, 4706, 396, 3317, 710, 2311, 546, 12719, 353, 426, 500, 13, 4706, 363, 521, 273, 29892, 298, 297, 4256, 7076, 29898, 3696, 18163, 1125, 13, 9651, 452, 794, 29879, 546, 12719, 29961, 5083, 29962, 353, 29871, 29900, 13, 9651, 396, 3317, 710, 2311, 546, 12719, 29961, 5083, 29962, 353, 29871, 29900, 13, 13, 13, 4706, 444, 16696, 29871, 29941, 584, 263, 937, 2425, 363, 21248, 2159, 13, 13, 13, 4706, 1369, 353, 25947, 29889, 29873, 514, 580, 13, 4706, 1550, 25947, 29889, 29873, 514, 580, 2804, 29899, 29896, 584, 13, 9651, 396, 1303, 2908, 4839, 13, 9651, 848, 7445, 7850, 353, 19345, 6982, 29898, 29888, 333, 1919, 3630, 7445, 7850, 13742, 949, 29918, 29888, 29898, 10289, 353, 6213, 29897, 13, 9651, 565, 848, 7445, 7850, 338, 6213, 584, 2867, 13, 13, 9651, 521, 273, 353, 848, 7445, 7850, 1839, 13599, 2033, 13, 9651, 5190, 353, 848, 7445, 7850, 1839, 8325, 2033, 13, 9651, 302, 29896, 29892, 29876, 29906, 353, 848, 7445, 7850, 1839, 4557, 2776, 29956, 1351, 9514, 2033, 1919, 848, 7445, 7850, 1839, 4557, 2776, 29956, 4339, 797, 29956, 1351, 689, 2033, 13, 13, 9651, 565, 848, 7445, 7850, 1839, 1542, 2033, 1275, 29871, 29896, 29901, 13, 18884, 396, 1028, 9345, 13, 18884, 565, 5190, 451, 297, 805, 638, 27280, 1144, 29961, 5083, 5387, 13, 462, 1678, 269, 7414, 353, 317, 1631, 446, 5323, 262, 4197, 21251, 10340, 2433, 29879, 742, 260, 29918, 9847, 29922, 29900, 29889, 29900, 29897, 13, 462, 1678, 269, 7414, 29889, 6735, 403, 29898, 5441, 29918, 978, 353, 270, 1028, 13599, 18163, 29961, 5083, 22322, 1170, 11287, 13, 462, 1678, 269, 7414, 29889, 6735, 403, 29898, 12719, 29918, 2248, 353, 474, 29897, 13, 462, 1678, 805, 638, 27280, 1144, 29961, 5083, 3816, 5441, 29962, 353, 269, 7414, 13, 13, 462, 1678, 805, 638, 27280, 1144, 29961, 5083, 3816, 5441, 1822, 2311, 2776, 29956, 1351, 689, 353, 302, 29896, 29892, 29876, 29906, 13, 13, 18884, 302, 1028, 9345, 2798, 29879, 29961, 5083, 29892, 5441, 29962, 4619, 29896, 13, 18884, 25947, 29889, 344, 1416, 29898, 29876, 29896, 29930, 29876, 29906, 29930, 29906, 29892, 29896, 29897, 13, 13, 9651, 25342, 848, 7445, 7850, 1839, 1542, 2033, 1275, 29946, 29901, 13, 18884, 396, 3696, 13, 18884, 452, 794, 29879, 546, 12719, 29961, 5083, 29962, 4619, 29871, 29896, 13, 18884, 565, 521, 273, 451, 297, 1741, 2378, 29879, 29901, 13, 462, 1678, 321, 29874, 353, 6864, 2588, 580, 13, 462, 1678, 321, 29874, 29889, 6735, 403, 29898, 12719, 29918, 978, 29922, 1741, 18163, 29961, 5083, 22322, 1170, 11287, 13, 462, 1678, 321, 29874, 29889, 6735, 403, 29898, 12719, 29918, 2248, 353, 521, 273, 29897, 13, 462, 1678, 1741, 2378, 29879, 29961, 5083, 29962, 353, 321, 29874, 13, 13, 9651, 25342, 848, 7445, 7850, 1839, 1542, 2033, 1275, 29871, 29945, 29901, 13, 18884, 396, 20621, 681, 7182, 13, 18884, 25947, 29889, 344, 1416, 29898, 29876, 29906, 29930, 29906, 29892, 29871, 29896, 29897, 13, 18884, 565, 302, 29906, 29958, 29871, 29900, 29901, 13, 462, 1678, 302, 20621, 21167, 9422, 29961, 5083, 29962, 4619, 302, 29906, 13, 462, 1678, 565, 521, 273, 451, 297, 385, 29874, 29903, 23379, 29901, 13, 462, 4706, 385, 294, 335, 353, 29871, 11597, 468, 10140, 284, 29898, 13, 462, 462, 462, 462, 4706, 518, 21251, 13, 462, 462, 462, 462, 4706, 10340, 353, 525, 29963, 742, 13, 462, 462, 462, 462, 4706, 23460, 29918, 10492, 353, 5785, 29898, 28544, 13599, 18163, 29961, 5083, 22322, 3035, 29943, 7971, 11287, 29930, 29886, 29939, 29889, 12661, 29892, 13, 462, 462, 462, 462, 4706, 260, 29918, 2962, 353, 29871, 29900, 5575, 29886, 29939, 29889, 29879, 29892, 13, 462, 462, 462, 462, 4706, 1723, 13, 462, 1678, 385, 294, 335, 29889, 6735, 403, 29898, 12719, 29918, 2248, 353, 5232, 13599, 18163, 29961, 5083, 22322, 13599, 11287, 13, 462, 1678, 385, 294, 335, 29889, 6735, 403, 29898, 12719, 29918, 978, 353, 5232, 13599, 18163, 29961, 5083, 22322, 1170, 11287, 13, 462, 1678, 385, 29874, 29903, 23379, 29961, 5083, 29962, 353, 29871, 385, 294, 335, 13, 13, 4706, 565, 17366, 29901, 13, 9651, 363, 521, 273, 29892, 385, 29874, 29903, 335, 297, 4256, 7076, 29898, 1648, 29903, 23379, 1125, 13, 18884, 385, 29874, 29903, 23379, 29961, 5083, 1822, 433, 1537, 29918, 12181, 353, 302, 20621, 21167, 9422, 29961, 5083, 29962, 13, 13, 9651, 363, 521, 273, 29892, 269, 415, 2288, 297, 4256, 7076, 29898, 1028, 638, 27280, 1144, 1125, 13, 18884, 363, 5190, 29892, 269, 7414, 297, 4256, 7076, 29898, 29879, 415, 2288, 1125, 13, 462, 1678, 805, 638, 27280, 1144, 29961, 5083, 3816, 5441, 1822, 433, 1537, 29918, 12181, 353, 302, 1028, 9345, 2798, 29879, 29961, 5083, 3816, 5441, 29962, 13, 13, 9651, 363, 521, 273, 29892, 321, 29874, 297, 4256, 7076, 29898, 3696, 2378, 29879, 1125, 13, 18884, 321, 29874, 29889, 433, 1537, 29918, 12181, 353, 452, 794, 29879, 546, 12719, 29961, 5083, 29962, 13, 4706, 1683, 29901, 13, 9651, 444, 16696, 29871, 29946, 29901, 6643, 1218, 3370, 565, 451, 17366, 13, 9651, 396, 9126, 7182, 13, 9651, 363, 521, 273, 29892, 385, 29874, 29903, 335, 297, 4256, 7076, 29898, 1648, 29903, 23379, 1125, 13, 18884, 385, 29874, 29903, 23379, 29961, 5083, 29962, 353, 385, 29874, 29903, 335, 29889, 20908, 5926, 29918, 2541, 29918, 1482, 29918, 2378, 29898, 9302, 29889, 3298, 359, 3552, 29876, 20621, 21167, 9422, 29961, 5083, 2314, 1919, 26688, 353, 525, 29888, 29946, 1495, 29930, 29886, 29939, 29889, 29963, 29892, 1723, 13, 13, 9651, 396, 6643, 1218, 2626, 363, 317, 1631, 446, 5323, 262, 13, 9651, 363, 521, 273, 29892, 269, 415, 2288, 297, 4256, 7076, 29898, 1028, 638, 27280, 1144, 1125, 13, 18884, 363, 5190, 29892, 269, 7414, 297, 4256, 7076, 29898, 29879, 415, 2288, 1125, 13, 462, 4706, 716, 353, 317, 1631, 446, 5323, 262, 29898, 9302, 29889, 3298, 359, 3552, 29876, 1028, 9345, 2798, 29879, 29961, 5083, 3816, 5441, 11724, 26688, 2433, 29888, 1495, 29930, 29886, 29939, 29889, 29879, 29892, 260, 29918, 9847, 29922, 29896, 29872, 29929, 29929, 29897, 396, 671, 385, 18886, 681, 995, 363, 260, 29918, 9847, 363, 1286, 29892, 1925, 297, 1959, 995, 2678, 13, 462, 4706, 716, 29889, 6735, 800, 29889, 5504, 29898, 29879, 7414, 29889, 6735, 800, 29897, 13, 462, 4706, 565, 2254, 29918, 1028, 9345, 29918, 27766, 689, 29901, 13, 462, 9651, 302, 29896, 29892, 302, 29906, 353, 805, 638, 27280, 1144, 29961, 5083, 3816, 5441, 1822, 2311, 2776, 29956, 1351, 689, 13, 462, 9651, 716, 29889, 27766, 9514, 353, 7442, 29889, 3298, 359, 29898, 313, 29876, 1028, 9345, 2798, 29879, 29961, 5083, 3816, 5441, 1402, 302, 29896, 29892, 302, 29906, 1723, 29930, 29886, 29939, 29889, 29963, 1919, 26688, 353, 525, 29888, 29915, 1723, 334, 282, 29939, 29889, 29963, 13, 462, 4706, 805, 638, 27280, 1144, 29961, 5083, 3816, 5441, 29962, 353, 716, 13, 9651, 302, 1028, 9345, 2798, 29879, 7503, 29962, 353, 29871, 29900, 13, 13, 9651, 396, 1741, 13, 9651, 1741, 1066, 2187, 353, 426, 500, 13, 9651, 363, 521, 273, 29892, 321, 29874, 297, 4256, 7076, 29898, 3696, 2378, 29879, 1125, 13, 18884, 321, 29874, 29889, 3706, 353, 7442, 29889, 3298, 359, 29898, 452, 794, 29879, 546, 12719, 29961, 5083, 29962, 1723, 29930, 29886, 29939, 29889, 29879, 13, 18884, 396, 11248, 29889, 21134, 353, 24786, 29898, 452, 794, 29879, 546, 12719, 29961, 5083, 29962, 1919, 26688, 353, 525, 29903, 18717, 710, 29898, 484, 794, 29879, 546, 12719, 29961, 5083, 2314, 1723, 13, 18884, 1741, 1066, 2187, 29961, 5083, 13192, 29900, 13, 13, 4706, 565, 451, 17366, 29901, 13, 13, 9651, 444, 16696, 29871, 29945, 584, 263, 1473, 2425, 363, 5183, 565, 451, 17366, 13, 9651, 25947, 29889, 344, 1416, 29898, 2962, 29897, 13, 9651, 1550, 25947, 29889, 29873, 514, 580, 2804, 29899, 29896, 584, 13, 18884, 848, 7445, 7850, 353, 19345, 6982, 29898, 29888, 333, 1919, 3630, 7445, 7850, 13742, 949, 29918, 29888, 29898, 10289, 353, 6213, 29897, 13, 18884, 565, 848, 7445, 7850, 338, 6213, 584, 2867, 13, 18884, 521, 273, 353, 848, 7445, 7850, 1839, 13599, 2033, 13, 18884, 302, 29896, 29892, 29876, 29906, 353, 848, 7445, 7850, 1839, 4557, 2776, 29956, 1351, 9514, 2033, 1919, 848, 7445, 7850, 1839, 4557, 2776, 29956, 4339, 797, 29956, 1351, 689, 2033, 13, 18884, 931, 353, 848, 7445, 7850, 1839, 26214, 12901, 2776, 29945, 12901, 27939, 2033, 29930, 29906, 29889, 1068, 29941, 29906, 718, 848, 7445, 7850, 1839, 2481, 855, 1160, 2033, 13, 18884, 931, 29914, 29922, 5534, 7850, 1839, 3035, 23923, 23860, 2033, 13, 13, 18884, 565, 302, 29906, 529, 29900, 29901, 2867, 13, 18884, 565, 848, 7445, 7850, 1839, 1542, 2033, 1275, 29871, 29896, 29901, 13, 462, 1678, 396, 1028, 9345, 13, 462, 1678, 5190, 353, 848, 7445, 7850, 1839, 8325, 2033, 13, 462, 1678, 269, 7414, 353, 805, 638, 27280, 1144, 29961, 5083, 3816, 5441, 29962, 13, 13, 462, 1678, 926, 353, 302, 1028, 9345, 2798, 29879, 29961, 5083, 29892, 5441, 29962, 13, 462, 1678, 269, 7414, 29961, 1066, 29962, 353, 931, 334, 282, 29939, 29889, 29879, 13, 13, 462, 1678, 565, 2254, 29918, 1028, 9345, 29918, 27766, 689, 322, 302, 29896, 29930, 29876, 29906, 2804, 29871, 29900, 584, 13, 462, 4706, 10742, 689, 353, 515, 1807, 29898, 25947, 29889, 949, 29898, 29876, 29896, 29930, 29876, 29906, 29930, 29906, 29897, 1919, 26688, 353, 525, 29875, 29906, 2824, 690, 14443, 29898, 29876, 29896, 29892, 29876, 29906, 467, 579, 668, 877, 29888, 1495, 13, 462, 4706, 396, 3881, 13, 462, 4706, 565, 5534, 7850, 1839, 6594, 2033, 529, 29896, 29900, 29941, 29901, 13, 462, 9651, 10742, 689, 353, 10742, 689, 29930, 29941, 29900, 29900, 29900, 6904, 29898, 29906, 29900, 29946, 29947, 29930, 29881, 1028, 13599, 18163, 29961, 5083, 22322, 29954, 475, 2033, 29930, 29896, 29900, 29900, 29900, 1846, 13, 462, 4706, 25342, 5534, 7850, 1839, 6594, 2033, 6736, 29896, 29900, 29941, 322, 5534, 7850, 1839, 6594, 2033, 529, 29896, 29900, 29945, 29901, 13, 462, 9651, 10742, 689, 353, 10742, 689, 29930, 10945, 7850, 1839, 29903, 1631, 446, 7976, 29924, 4211, 4279, 29924, 29963, 2033, 29914, 11891, 29945, 29930, 29906, 29889, 1068, 29898, 10945, 7850, 1839, 29933, 1169, 5894, 29903, 1631, 446, 17708, 11287, 29930, 29896, 29900, 29900, 29900, 1846, 13, 462, 4706, 25342, 5534, 7850, 1839, 6594, 2033, 1405, 29896, 29900, 29945, 29901, 13, 462, 9651, 10742, 689, 353, 10742, 689, 29930, 10945, 7850, 1839, 29903, 1631, 446, 7976, 29924, 4211, 4279, 29924, 29963, 2033, 29914, 11891, 29945, 29930, 29906, 29889, 1068, 29898, 10945, 7850, 1839, 29933, 1169, 5894, 29903, 1631, 446, 17708, 11287, 29930, 10945, 7850, 1839, 29903, 1631, 446, 6572, 29909, 1526, 29954, 475, 11287, 13, 13, 462, 4706, 269, 7414, 3032, 27766, 9514, 29961, 1066, 29892, 29901, 29892, 17531, 353, 10742, 689, 13, 462, 1678, 1683, 29901, 13, 462, 4706, 25947, 29889, 344, 1416, 29898, 29876, 29896, 29930, 29876, 29906, 29930, 29906, 29892, 29896, 29897, 13, 13, 462, 1678, 302, 1028, 9345, 2798, 29879, 29961, 5083, 29892, 5441, 29962, 4619, 29896, 13, 13, 13, 13, 13, 18884, 25342, 848, 7445, 7850, 1839, 1542, 2033, 1275, 29871, 29946, 29901, 13, 462, 1678, 396, 1741, 13, 462, 1678, 926, 353, 1741, 1066, 2187, 29961, 5083, 29962, 13, 462, 1678, 1741, 2378, 29879, 29961, 5083, 1822, 3706, 29961, 1066, 29962, 353, 931, 334, 282, 29939, 29889, 29879, 13, 462, 1678, 1741, 1066, 2187, 29961, 5083, 10062, 29922, 29871, 29896, 13, 13, 18884, 25342, 848, 7445, 7850, 1839, 1542, 2033, 1275, 29871, 29945, 29901, 13, 462, 1678, 396, 25436, 13, 462, 1678, 848, 353, 7442, 29889, 3166, 1807, 29898, 25947, 29889, 949, 29898, 29876, 29906, 29930, 29906, 29897, 1919, 26688, 353, 525, 29875, 29906, 2824, 579, 668, 877, 29888, 29946, 1495, 13, 462, 1678, 396, 3881, 13, 462, 1678, 565, 5534, 7850, 1839, 6594, 2033, 1275, 29896, 29900, 29900, 470, 5534, 7850, 1839, 6594, 2033, 1275, 29896, 29900, 29896, 584, 13, 462, 4706, 848, 353, 848, 29930, 29945, 29900, 29900, 29900, 6904, 29898, 29906, 29900, 29946, 29947, 29930, 28544, 13599, 18163, 29961, 5083, 22322, 29954, 475, 2033, 29930, 29896, 29900, 29900, 29900, 1846, 13, 462, 1678, 25342, 5534, 7850, 1839, 6594, 2033, 1275, 29896, 29900, 29906, 584, 13, 462, 4706, 848, 353, 848, 29930, 29945, 29900, 29900, 29900, 6904, 29898, 29906, 29900, 29946, 29947, 29930, 28544, 13599, 18163, 29961, 5083, 22322, 29954, 475, 2033, 29930, 28544, 13599, 18163, 29961, 5083, 22322, 6572, 1160, 29954, 475, 11287, 13, 462, 1678, 25342, 5534, 7850, 1839, 6594, 2033, 6736, 29871, 29896, 29900, 29941, 29901, 13, 462, 4706, 848, 353, 848, 29930, 10945, 7850, 1839, 29903, 677, 7976, 29924, 4211, 4279, 29924, 29963, 2033, 29914, 11891, 29945, 16395, 29906, 1068, 10945, 7850, 1839, 29933, 1169, 5894, 29903, 1631, 446, 17708, 11287, 17710, 13, 462, 462, 462, 9651, 5232, 13599, 18163, 29961, 5083, 22322, 29954, 475, 2033, 29930, 28544, 13599, 18163, 29961, 5083, 22322, 6572, 1160, 29954, 475, 11287, 13, 462, 1678, 385, 29874, 29903, 23379, 29961, 5083, 3816, 11249, 3283, 29961, 5083, 29962, 584, 4559, 3283, 29961, 5083, 10062, 1272, 29889, 2311, 29962, 353, 848, 334, 282, 29939, 29889, 29963, 13, 462, 1678, 4559, 3283, 29961, 5083, 29962, 4619, 848, 29889, 2311, 13, 462, 1678, 565, 4559, 3283, 29961, 5083, 29962, 1275, 29900, 29901, 13, 462, 4706, 385, 29874, 29903, 23379, 29961, 5083, 1822, 29873, 29918, 2962, 353, 931, 29930, 282, 29939, 29889, 29879, 13, 13, 13, 13, 13, 4706, 396, 4986, 3970, 565, 17366, 13, 13, 13, 4706, 396, 788, 11597, 468, 10140, 284, 304, 269, 29887, 882, 13, 4706, 363, 413, 29892, 1648, 29903, 335, 297, 4256, 7076, 29898, 1648, 29903, 23379, 29897, 584, 13, 9651, 565, 385, 29874, 29903, 335, 338, 451, 6213, 29901, 13, 18884, 2377, 29889, 7054, 468, 4530, 1338, 29889, 4397, 29898, 1648, 29903, 335, 29897, 13, 13, 4706, 396, 788, 317, 1631, 446, 5323, 262, 304, 269, 29887, 882, 13, 4706, 363, 521, 273, 29892, 269, 415, 2288, 297, 4256, 7076, 29898, 1028, 638, 27280, 1144, 1125, 13, 9651, 363, 5190, 29892, 269, 7414, 297, 4256, 7076, 29898, 29879, 415, 2288, 1125, 13, 18884, 565, 7431, 29898, 29879, 7414, 29897, 1405, 29871, 29900, 29901, 13, 462, 1678, 269, 7414, 29889, 29873, 29918, 9847, 353, 269, 7414, 29889, 3317, 580, 396, 508, 3117, 679, 263, 2253, 995, 363, 445, 29892, 515, 278, 6942, 11597, 468, 10140, 284, 13, 18884, 2377, 29889, 1028, 638, 27280, 1144, 29889, 4397, 29898, 29879, 7414, 29897, 13, 13, 4706, 396, 788, 1741, 2378, 304, 10768, 13, 4706, 363, 521, 273, 29892, 11248, 297, 29871, 4256, 7076, 29898, 3696, 2378, 29879, 1125, 13, 9651, 2377, 29889, 3696, 2378, 29879, 29889, 4397, 29898, 11248, 29897, 13, 13, 4706, 1653, 29918, 13011, 29918, 517, 29918, 650, 29918, 2674, 800, 4034, 29898, 10199, 29897, 13, 4706, 736, 2377, 13, 13, 13, 13, 12756, 7850, 353, 518, 13, 1678, 6702, 19095, 293, 4557, 29915, 1919, 525, 29902, 5477, 13, 1678, 6702, 6594, 3788, 29875, 5477, 13, 1678, 6702, 20001, 3788, 29896, 29906, 29947, 29879, 5477, 13, 1678, 6702, 3035, 23923, 23860, 3788, 29875, 5477, 13, 1678, 6702, 8009, 29928, 5550, 1451, 12629, 3788, 29875, 5477, 13, 1678, 6702, 8009, 2624, 1451, 12629, 3788, 29875, 5477, 13, 1678, 6702, 8009, 29903, 677, 1451, 12629, 3788, 29875, 5477, 13, 1678, 6702, 8009, 20325, 29956, 1351, 3788, 29875, 5477, 13, 1678, 6702, 8009, 20325, 6572, 29911, 1092, 3788, 29875, 5477, 13, 1678, 6702, 12883, 3788, 29875, 5477, 13, 1678, 6702, 13953, 3788, 29875, 5477, 13, 1678, 6702, 12742, 3788, 29875, 5477, 13, 1678, 6702, 29950, 473, 3788, 29875, 5477, 13, 1678, 6702, 8140, 1082, 3788, 29875, 5477, 13, 1678, 6702, 11863, 3788, 29875, 5477, 13, 1678, 6702, 29943, 579, 6359, 3788, 29875, 5477, 13, 1678, 6702, 29956, 1351, 689, 29943, 7971, 3788, 29875, 5477, 13, 1678, 6702, 8897, 27939, 3788, 29881, 5477, 13, 13, 1678, 396, 3259, 1405, 29896, 29900, 29941, 13, 1678, 6702, 29911, 5964, 284, 2264, 29915, 1919, 525, 29890, 5477, 13, 1678, 6702, 1469, 29911, 5964, 284, 2264, 29915, 1919, 525, 29890, 5477, 13, 1678, 6702, 29933, 1169, 5894, 29903, 1631, 446, 17708, 29915, 1919, 525, 29890, 5477, 13, 1678, 6702, 29933, 1169, 5894, 29903, 677, 17708, 29915, 1919, 525, 29890, 5477, 13, 1678, 6702, 29903, 1631, 446, 7976, 29924, 4211, 4279, 29924, 29963, 29915, 1919, 525, 29950, 5477, 13, 1678, 6702, 29903, 677, 7976, 29924, 4211, 4279, 29924, 29963, 29915, 1919, 525, 29950, 5477, 13, 13, 1678, 396, 3259, 29871, 29896, 29900, 29945, 13, 1678, 6702, 29903, 1631, 446, 6572, 29909, 1526, 29954, 475, 29915, 1919, 525, 29950, 5477, 13, 13, 1678, 396, 3259, 29871, 29896, 29900, 29953, 13, 1678, 6702, 10644, 339, 8491, 6295, 14093, 3788, 29896, 29947, 29879, 5477, 13, 1678, 6702, 7032, 292, 6295, 14093, 3788, 29896, 29947, 29879, 5477, 13, 13, 1678, 6702, 29925, 4676, 3788, 29896, 29900, 29879, 5477, 13, 13, 1678, 396, 599, 1873, 13, 1678, 6702, 9375, 3981, 29879, 3788, 29953, 29945, 29900, 29875, 5477, 13, 1678, 6702, 29686, 3981, 29879, 3788, 29953, 29945, 29900, 29875, 5477, 13, 1678, 6702, 22240, 3981, 29879, 3788, 29945, 29896, 29906, 29875, 5477, 13, 13, 1678, 4514, 13, 13, 13, 13599, 7850, 353, 518, 13, 1678, 6702, 1170, 29915, 1919, 525, 29941, 29906, 29879, 5477, 13, 1678, 6702, 5425, 29954, 1170, 3788, 29941, 29906, 29879, 5477, 13, 1678, 6702, 13599, 3788, 29875, 5477, 13, 1678, 6702, 29956, 15860, 403, 3788, 29875, 5477, 13, 1678, 6702, 5425, 29954, 3788, 29875, 5477, 13, 1678, 6702, 5620, 3788, 29875, 5477, 13, 1678, 6702, 29954, 475, 3788, 29875, 5477, 13, 1678, 6702, 5072, 3788, 29875, 5477, 13, 1678, 6702, 1349, 12268, 3788, 29875, 5477, 13, 1678, 6702, 4062, 3788, 29875, 5477, 13, 1678, 6702, 29940, 2525, 1169, 3788, 29875, 5477, 13, 1678, 6702, 6733, 3788, 29941, 29906, 29900, 29882, 5477, 13, 1678, 6702, 29943, 277, 3788, 29945, 29875, 5477, 13, 1678, 6702, 13685, 6110, 3788, 29875, 5477, 13, 1678, 6702, 3313, 267, 3788, 29946, 29900, 29882, 5477, 13, 1678, 6702, 13685, 29933, 387, 3788, 29875, 5477, 13, 1678, 396, 3259, 29871, 29896, 29900, 29945, 13, 1678, 6702, 20001, 3788, 29896, 29906, 29947, 29879, 5477, 13, 1678, 396, 3259, 29871, 29896, 29900, 29953, 13, 1678, 6702, 29903, 2214, 1204, 3788, 29890, 5477, 13, 1678, 6702, 690, 9841, 3788, 29890, 5477, 13, 1678, 6702, 1451, 273, 1204, 3788, 29950, 5477, 13, 13, 1678, 6702, 29925, 4676, 3788, 29896, 29900, 29875, 5477, 13, 1678, 4514, 13, 13, 2624, 7850, 353, 518, 13, 1678, 6702, 1170, 29915, 1919, 525, 29941, 29906, 29879, 5477, 13, 1678, 6702, 13599, 3788, 29875, 5477, 13, 1678, 396, 3259, 29871, 29896, 29900, 29945, 13, 1678, 6702, 20001, 29915, 1919, 525, 29896, 29906, 29947, 29879, 5477, 13, 1678, 396, 3259, 29871, 29896, 29900, 29953, 13, 1678, 6702, 29903, 2214, 1204, 3788, 29890, 5477, 13, 1678, 6702, 690, 9841, 3788, 29890, 5477, 13, 1678, 6702, 1451, 273, 1204, 3788, 29950, 5477, 13, 13, 1678, 6702, 29925, 4676, 3788, 29941, 29906, 29875, 5477, 13, 1678, 4514, 13, 13, 13, 29903, 677, 13599, 7850, 353, 518, 13, 1678, 6702, 1170, 29915, 1919, 525, 29941, 29906, 29879, 5477, 13, 1678, 6702, 13599, 3788, 29875, 5477, 13, 1678, 6702, 3035, 29943, 7971, 3788, 29875, 5477, 13, 1678, 6702, 29954, 475, 3788, 29875, 5477, 13, 1678, 6702, 10861, 3788, 29875, 5477, 13, 1678, 6702, 6572, 1160, 29954, 475, 3788, 29875, 5477, 13, 1678, 396, 3259, 29871, 29896, 29900, 29946, 13, 1678, 6702, 29903, 1631, 446, 13599, 3788, 29875, 5477, 13, 1678, 396, 3259, 29871, 29896, 29900, 29945, 13, 1678, 6702, 20001, 3788, 29896, 29906, 29947, 29879, 5477, 13, 1678, 396, 3259, 29871, 29896, 29900, 29953, 13, 1678, 6702, 29903, 2214, 1204, 3788, 29890, 5477, 13, 1678, 6702, 690, 9841, 3788, 29890, 5477, 13, 1678, 6702, 1451, 273, 1204, 3788, 29950, 5477, 13, 13, 1678, 6702, 29925, 4676, 3788, 29906, 29955, 29875, 5477, 13, 1678, 4514, 13, 13, 1469, 7445, 7850, 353, 518, 13, 1678, 6702, 1542, 3788, 29882, 5477, 13, 1678, 6702, 26214, 12901, 2776, 29945, 12901, 27939, 3788, 29882, 5477, 13, 1678, 6702, 2481, 855, 1160, 3788, 29875, 5477, 13, 1678, 6702, 13599, 3788, 29882, 5477, 13, 1678, 6702, 8325, 3788, 29882, 5477, 13, 1678, 6702, 4557, 2776, 29956, 1351, 9514, 3788, 29882, 5477, 13, 1678, 6702, 4557, 2776, 29956, 4339, 797, 29956, 1351, 689, 3788, 29882, 5477, 13, 1678, 4514, 29937, 29871, 29896, 29953, 6262, 13, 13, 13, 1990, 19345, 6982, 7295, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 29888, 333, 1919, 8216, 29871, 1125, 13, 4706, 1583, 29889, 29888, 333, 353, 25947, 13, 4706, 1583, 29889, 8216, 353, 6139, 13, 1678, 822, 1303, 29918, 29888, 29898, 1311, 29892, 9210, 353, 8516, 1125, 13, 4706, 565, 9210, 338, 451, 6213, 584, 13, 9651, 1583, 29889, 29888, 333, 29889, 344, 1416, 29898, 10289, 29897, 13, 4706, 270, 353, 426, 500, 13, 4706, 363, 1820, 29892, 3402, 297, 1583, 29889, 8216, 584, 13, 9651, 18392, 353, 1583, 29889, 29888, 333, 29889, 949, 29898, 4984, 29889, 28667, 2311, 29898, 4830, 876, 13, 9651, 565, 7431, 29898, 9721, 29897, 2804, 2281, 29889, 28667, 2311, 29898, 4830, 29897, 584, 736, 6213, 13, 9651, 659, 353, 2281, 29889, 348, 4058, 29898, 4830, 1919, 18392, 29897, 13, 9651, 565, 7431, 29898, 791, 29897, 1275, 29871, 29896, 29901, 13, 18884, 659, 353, 659, 29961, 29900, 29962, 13, 9651, 1683, 584, 13, 18884, 659, 353, 1051, 29898, 791, 29897, 13, 9651, 565, 525, 29879, 29915, 297, 3402, 584, 13, 18884, 659, 353, 659, 29889, 6506, 28909, 29916, 29900, 29900, 3788, 1495, 13, 9651, 270, 29961, 1989, 29962, 353, 659, 13, 4706, 736, 270, 13, 13, 13, 13, 2 ]
beta_version.py
JeanneGasser/basic_cypting
0
191086
# -*- coding: utf-8 -*- """ Created on Tue Nov 20 16:56:32 2018 @author: jeann """ from nltk import RegexpTokenizer toknizer = RegexpTokenizer(r'''\w'|\w+|[^\w\s]''') from string import punctuation import unidecode #Class construction class EncryptDecrypt: """ For each letter return the numerical position in alphabet Or for each number return the corresponding letter """ def encrypt(self, text): #Remove accent, caps and excess white space text = unidecode.unidecode(text.lower().strip()) token = toknizer.tokenize(text) #ord return ascii code of the letter. In order to have the alphabet position : -96 return " ".join( ["-".join([str(ord(l)-96) for l in word if l.isalpha()]) for word in token if word not in punctuation]) def decrypt(self, text): #chr gives the char attached to an ascii code. Since we're using letter position, need to add +96 #Encrypted word given in format xx-xx-xx, hence the split. to_decrypt = [word.split("-") for word in text.split(" ")] return " ".join( [("".join([chr(int(l)+96) for l in word])) for word in to_decrypt]) #User input and class output print("Bienvenue, avec ce programme vous allez pouvoir chiffrer ou déchiffrer du texte. \n \ Chiffrement : lettres = position numérique dans l'alphabet") textfile = input("Veuillez entrer votre texte ou un nom de fichier texte avec le chemin \n") if ".txt" in textfile: txt = open(textfile,"r").read() what_to_do = input("Voulez vous décrypter ou encrypter \n \n") if unidecode.unidecode(what_to_do.lower().strip())=="encrypter": open(textfile.split(".")[0] + "_crypted.txt","w").write(EncryptDecrypt().encrypt(txt)) print("Fichier encrypté et enregistré") elif unidecode.unidecode(what_to_do.lower().strip())=="decrypter": open(textfile.split(".")[0] + "_decrypted.txt","w").write(EncryptDecrypt().decrypt(txt)) print("Fichier décrypté et enregistré") else: print("Veuillez entrer une commande valide: Encrypter ou Decrypter") else: what_to_do = input("Voulez vous décrypter ou encrypter \n \n") if what_to_do.lower().strip()=="encrypter": print(EncryptDecrypt().encrypt(textfile)) elif unidecode.unidecode(what_to_do.lower().strip())=="decrypter": print(EncryptDecrypt().decrypt(textfile)) else: print("Veuillez entrer une commande valide: Encrypter ou Decrypter")
[ 1, 396, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 30004, 13, 15945, 19451, 13, 20399, 373, 323, 434, 2864, 29871, 29906, 29900, 29871, 29896, 29953, 29901, 29945, 29953, 29901, 29941, 29906, 29871, 29906, 29900, 29896, 29947, 30004, 13, 30004, 13, 29992, 8921, 29901, 1444, 812, 30004, 13, 15945, 19451, 13, 30004, 13, 3166, 302, 1896, 29895, 1053, 2169, 4548, 6066, 3950, 30004, 13, 517, 3959, 3950, 353, 2169, 4548, 6066, 3950, 29898, 29878, 12008, 29905, 29893, 29915, 4295, 29893, 29974, 29989, 29961, 3823, 29893, 29905, 29879, 29962, 4907, 1495, 30004, 13, 3166, 1347, 1053, 6035, 22999, 362, 30004, 13, 5215, 443, 680, 401, 30004, 13, 30004, 13, 29937, 2385, 7632, 30004, 13, 1990, 11346, 4641, 6185, 4641, 29901, 30004, 13, 1678, 9995, 30004, 13, 1678, 1152, 1269, 5497, 736, 278, 16259, 2602, 297, 22968, 30004, 13, 1678, 1394, 363, 1269, 1353, 736, 278, 6590, 5497, 30004, 13, 1678, 9995, 30004, 13, 1678, 822, 27924, 29898, 1311, 29892, 1426, 1125, 30004, 13, 4706, 6756, 13, 4706, 396, 15941, 1035, 296, 29892, 26091, 322, 19163, 4796, 2913, 6756, 13, 4706, 1426, 353, 443, 680, 401, 29889, 348, 680, 401, 29898, 726, 29889, 13609, 2141, 17010, 3101, 30004, 13, 4706, 6756, 13, 4706, 5993, 353, 304, 3959, 3950, 29889, 6979, 675, 29898, 726, 8443, 13, 4706, 396, 536, 736, 408, 18869, 775, 310, 278, 5497, 29889, 512, 1797, 304, 505, 278, 22968, 2602, 584, 448, 29929, 29953, 30004, 13, 4706, 736, 376, 11393, 7122, 29898, 30004, 13, 18884, 6796, 29899, 1642, 7122, 4197, 710, 29898, 536, 29898, 29880, 6817, 29929, 29953, 29897, 363, 301, 297, 1734, 565, 301, 29889, 275, 2312, 580, 2314, 30004, 13, 462, 4706, 363, 1734, 297, 5993, 565, 1734, 451, 297, 6035, 22999, 362, 2314, 30004, 13, 1678, 6756, 13, 1678, 822, 1602, 4641, 29898, 1311, 29892, 1426, 1125, 30004, 13, 4706, 6756, 13, 4706, 396, 22495, 4076, 278, 1373, 10959, 304, 385, 408, 18869, 775, 29889, 4001, 591, 29915, 276, 773, 5497, 2602, 29892, 817, 304, 788, 718, 29929, 29953, 30004, 13, 4706, 396, 8566, 14740, 1734, 2183, 297, 3402, 15473, 29899, 4419, 29899, 4419, 29892, 8151, 278, 6219, 29889, 6756, 13, 4706, 304, 29918, 7099, 4641, 353, 259, 518, 1742, 29889, 5451, 703, 29899, 1159, 363, 1734, 297, 1426, 29889, 5451, 703, 376, 4638, 30004, 13, 4706, 736, 376, 11393, 7122, 29898, 30004, 13, 18884, 518, 703, 1642, 7122, 4197, 22495, 29898, 524, 29898, 29880, 7240, 29929, 29953, 29897, 363, 301, 297, 1734, 12622, 30004, 13, 18884, 363, 1734, 297, 304, 29918, 7099, 4641, 2314, 30004, 13, 1678, 6756, 13, 30004, 13, 30004, 13, 29937, 2659, 1881, 322, 770, 1962, 30004, 13, 30004, 13, 30004, 13, 2158, 703, 29933, 819, 9947, 29892, 2535, 2257, 19607, 7890, 4788, 29920, 19397, 521, 361, 1341, 261, 2123, 1437, 305, 361, 1341, 261, 868, 19696, 371, 29889, 320, 29876, 320, 30004, 13, 418, 678, 2593, 276, 358, 584, 1235, 5888, 353, 2602, 954, 20600, 1465, 301, 29915, 284, 17416, 1159, 30004, 13, 726, 1445, 353, 1881, 703, 29963, 12932, 1924, 29920, 875, 2872, 26814, 19696, 371, 2123, 443, 2245, 316, 285, 436, 631, 19696, 371, 2535, 454, 26786, 320, 29876, 1159, 30004, 13, 361, 11393, 3945, 29908, 297, 1426, 1445, 29901, 30004, 13, 1678, 6756, 13, 1678, 13872, 353, 1722, 29898, 726, 1445, 1699, 29878, 2564, 949, 26471, 13, 1678, 6756, 13, 1678, 825, 29918, 517, 29918, 1867, 353, 1881, 703, 29963, 283, 11867, 7890, 4224, 719, 29886, 357, 2123, 2094, 719, 29886, 357, 320, 29876, 320, 29876, 1159, 30004, 13, 30004, 13, 1678, 565, 443, 680, 401, 29889, 348, 680, 401, 29898, 5816, 29918, 517, 29918, 1867, 29889, 13609, 2141, 17010, 3101, 26359, 3977, 719, 29886, 357, 1115, 30004, 13, 965, 6756, 13, 4706, 1722, 29898, 726, 1445, 29889, 5451, 17350, 1159, 29961, 29900, 29962, 718, 11119, 29883, 14740, 29889, 3945, 3284, 29893, 2564, 3539, 29898, 8566, 4641, 6185, 4641, 2141, 3977, 4641, 29898, 3945, 876, 30004, 13, 4706, 1596, 703, 29943, 436, 631, 27924, 29948, 634, 427, 29238, 29948, 1159, 30004, 13, 9651, 6756, 13, 1678, 6756, 13, 1678, 25342, 443, 680, 401, 29889, 348, 680, 401, 29898, 5816, 29918, 517, 29918, 1867, 29889, 13609, 2141, 17010, 3101, 26359, 7099, 719, 29886, 357, 1115, 30004, 13, 1678, 6756, 13, 4706, 1722, 29898, 726, 1445, 29889, 5451, 17350, 1159, 29961, 29900, 29962, 718, 11119, 7099, 14740, 29889, 3945, 3284, 29893, 2564, 3539, 29898, 8566, 4641, 6185, 4641, 2141, 7099, 4641, 29898, 3945, 876, 30004, 13, 4706, 1596, 703, 29943, 436, 631, 4224, 4641, 29948, 634, 427, 29238, 29948, 1159, 30004, 13, 1678, 6756, 13, 1678, 1683, 29901, 6756, 13, 4706, 1596, 703, 29963, 12932, 1924, 29920, 875, 2872, 1597, 844, 4182, 659, 680, 29901, 11346, 719, 29886, 357, 2123, 3826, 719, 29886, 357, 1159, 30004, 13, 2870, 29901, 30004, 13, 1678, 6756, 13, 1678, 825, 29918, 517, 29918, 1867, 353, 1881, 703, 29963, 283, 11867, 7890, 4224, 719, 29886, 357, 2123, 2094, 719, 29886, 357, 320, 29876, 320, 29876, 1159, 30004, 13, 1678, 6756, 13, 1678, 565, 825, 29918, 517, 29918, 1867, 29889, 13609, 2141, 17010, 580, 26359, 3977, 719, 29886, 357, 1115, 30004, 13, 4706, 6756, 13, 4706, 1596, 29898, 8566, 4641, 6185, 4641, 2141, 3977, 4641, 29898, 726, 1445, 876, 30004, 13, 4706, 6756, 13, 1678, 25342, 443, 680, 401, 29889, 348, 680, 401, 29898, 5816, 29918, 517, 29918, 1867, 29889, 13609, 2141, 17010, 3101, 26359, 7099, 719, 29886, 357, 1115, 30004, 13, 4706, 6756, 13, 4706, 1596, 29898, 8566, 4641, 6185, 4641, 2141, 7099, 4641, 29898, 726, 1445, 876, 30004, 13, 4706, 6756, 13, 1678, 1683, 29901, 6756, 13, 4706, 1596, 703, 29963, 12932, 1924, 29920, 875, 2872, 1597, 844, 4182, 659, 680, 29901, 11346, 719, 29886, 357, 2123, 3826, 719, 29886, 357, 1159, 30004, 13, 308, 2 ]
tests/unit/test_openstack_group_service.py
venumurthy/ec2-driver
0
163580
<reponame>venumurthy/ec2-driver<gh_stars>0 import unittest from mock import Mock from novaclient.v1_1.security_groups import SecurityGroupManager from nova.virt.ec2.openstack_group_service import OpenstackGroupService class TestOpenstackGroupService(unittest.TestCase): def setUp(self): self.security_group_manager = Mock(spec=SecurityGroupManager) self.openstack_group_service = OpenstackGroupService(self.security_group_manager) def test_should_get_group_from_nova_security_group_manager(self): security_group = Mock() security_group.name = 'secGroup' self.security_group_manager.list.return_value = [security_group] self.assertEqual(self.openstack_group_service.get_group(security_group.name), security_group) def test_should_get_group_from_nova_security_group_manager_when_multiple_groups_present(self): security_group1 = Mock() security_group1.name = 'secGroup' security_group2 = Mock() security_group2.name = 'otherGroup' self.security_group_manager.list.return_value = [security_group1, security_group2] self.assertEqual(self.openstack_group_service.get_group(security_group2.name), security_group2)
[ 1, 529, 276, 1112, 420, 29958, 854, 398, 332, 21155, 29914, 687, 29906, 29899, 9465, 29966, 12443, 29918, 303, 1503, 29958, 29900, 13, 5215, 443, 27958, 13, 13, 3166, 11187, 1053, 26297, 13, 3166, 2420, 562, 1593, 29889, 29894, 29896, 29918, 29896, 29889, 8926, 29918, 13155, 1053, 14223, 4782, 3260, 13, 13, 3166, 26121, 29889, 15389, 29889, 687, 29906, 29889, 3150, 1429, 29918, 2972, 29918, 5509, 1053, 4673, 1429, 4782, 3170, 13, 13, 13, 1990, 4321, 6585, 1429, 4782, 3170, 29898, 348, 27958, 29889, 3057, 8259, 1125, 13, 13, 1678, 822, 731, 3373, 29898, 1311, 1125, 13, 4706, 1583, 29889, 8926, 29918, 2972, 29918, 12847, 353, 26297, 29898, 6550, 29922, 13228, 4782, 3260, 29897, 13, 4706, 1583, 29889, 3150, 1429, 29918, 2972, 29918, 5509, 353, 4673, 1429, 4782, 3170, 29898, 1311, 29889, 8926, 29918, 2972, 29918, 12847, 29897, 13, 13, 1678, 822, 1243, 29918, 9344, 29918, 657, 29918, 2972, 29918, 3166, 29918, 29876, 4273, 29918, 8926, 29918, 2972, 29918, 12847, 29898, 1311, 1125, 13, 4706, 6993, 29918, 2972, 353, 26297, 580, 13, 4706, 6993, 29918, 2972, 29889, 978, 353, 525, 3471, 4782, 29915, 13, 4706, 1583, 29889, 8926, 29918, 2972, 29918, 12847, 29889, 1761, 29889, 2457, 29918, 1767, 353, 518, 8926, 29918, 2972, 29962, 13, 13, 4706, 1583, 29889, 9294, 9843, 29898, 1311, 29889, 3150, 1429, 29918, 2972, 29918, 5509, 29889, 657, 29918, 2972, 29898, 8926, 29918, 2972, 29889, 978, 511, 6993, 29918, 2972, 29897, 13, 13, 1678, 822, 1243, 29918, 9344, 29918, 657, 29918, 2972, 29918, 3166, 29918, 29876, 4273, 29918, 8926, 29918, 2972, 29918, 12847, 29918, 8256, 29918, 20787, 29918, 13155, 29918, 6338, 29898, 1311, 1125, 13, 4706, 6993, 29918, 2972, 29896, 353, 26297, 580, 13, 4706, 6993, 29918, 2972, 29896, 29889, 978, 353, 525, 3471, 4782, 29915, 13, 4706, 6993, 29918, 2972, 29906, 353, 26297, 580, 13, 4706, 6993, 29918, 2972, 29906, 29889, 978, 353, 525, 1228, 4782, 29915, 13, 4706, 1583, 29889, 8926, 29918, 2972, 29918, 12847, 29889, 1761, 29889, 2457, 29918, 1767, 353, 518, 8926, 29918, 2972, 29896, 29892, 6993, 29918, 2972, 29906, 29962, 13, 13, 4706, 1583, 29889, 9294, 9843, 29898, 1311, 29889, 3150, 1429, 29918, 2972, 29918, 5509, 29889, 657, 29918, 2972, 29898, 8926, 29918, 2972, 29906, 29889, 978, 511, 6993, 29918, 2972, 29906, 29897, 2 ]
yuntu/dataset/base.py
CONABIO/yuntu
0
68250
<reponame>CONABIO/yuntu<filename>yuntu/dataset/base.py from abc import abstractmethod, ABCMeta import yuntu.dataset.methods as dsetMethods class metaDataset(object): __metaclass__ = ABCMeta @abstractmethod def getType(self): pass @abstractmethod def getDefaultConfig(self): pass @abstractmethod def setConfig(self): pass class audioDataset(object): __metaclass__ = ABCMeta def __init__(self,name,collection=None,dirPath="",config=None,metadata=None,client=None,overwrite=False): self.name = name self.dirPath = dirPath self.collection = collection self.client = client self.config = self.getDefaultConfig() self.overwrite = overwrite self.info = {"name":self.name,"dirPath":dirPath,"collection":None,"creation":None,"modification":None,"type":"audioDataset","metadata":metadata} self.graph = {} doBuild = False if dsetMethods.datasetExists(self): if not self.overwrite: print("Loading soundscape...") if dsetMethods.datasetLoad(self): self.setConfig(config) else: doBuild = True else: doBuild = True if doBuild: if collection is None: raise ValueError("Collection must be explicit in dataset creation (create a collection and pass as parameter)") print("Building new soundscape...") if dsetMethods.datasetBuild(self): self.setConfig(config) self.loadGraph() def getType(self): return "audioDataset" def setConfig(self,config): return dsetMethods.datasetSetConfig(self,config) def getDefaultConfig(self): config = { "globalParams" : { "multiThread" : False, "collectionFilter" : None, "groupingFields" : None, "groupingTypes" : None, "npartitions" : 20, "annotationFabric" : "default" }, "transformationParams" : { "annotationFabric" : None, "exampleFabric" : None }, "splittingParams": { "folds" : 5, "splits" : { "train" : 70, "test" : 20, "validation" : 10 } }, } return config
[ 1, 529, 276, 1112, 420, 29958, 6007, 2882, 5971, 29914, 29891, 4159, 29966, 9507, 29958, 29891, 4159, 29914, 24713, 29914, 3188, 29889, 2272, 13, 3166, 25638, 1053, 9846, 5696, 29892, 16417, 19346, 13, 5215, 343, 4159, 29889, 24713, 29889, 23515, 408, 270, 842, 26112, 13, 13, 1990, 12700, 16390, 24541, 29898, 3318, 1125, 13, 1678, 4770, 2527, 562, 605, 1649, 353, 16417, 19346, 13, 13, 1678, 732, 16595, 5696, 13, 1678, 822, 679, 1542, 29898, 1311, 1125, 13, 4706, 1209, 13, 13, 1678, 732, 16595, 5696, 13, 1678, 822, 679, 4592, 3991, 29898, 1311, 1125, 13, 4706, 1209, 13, 13, 1678, 732, 16595, 5696, 13, 1678, 822, 731, 3991, 29898, 1311, 1125, 13, 4706, 1209, 13, 13, 1990, 10348, 16390, 24541, 29898, 3318, 1125, 13, 1678, 4770, 2527, 562, 605, 1649, 353, 16417, 19346, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 978, 29892, 10855, 29922, 8516, 29892, 3972, 2605, 543, 613, 2917, 29922, 8516, 29892, 19635, 29922, 8516, 29892, 4645, 29922, 8516, 29892, 957, 3539, 29922, 8824, 1125, 13, 4706, 1583, 29889, 978, 353, 1024, 13, 4706, 1583, 29889, 3972, 2605, 353, 4516, 2605, 13, 4706, 1583, 29889, 10855, 353, 4333, 13, 4706, 1583, 29889, 4645, 353, 3132, 13, 4706, 1583, 29889, 2917, 353, 1583, 29889, 657, 4592, 3991, 580, 13, 4706, 1583, 29889, 957, 3539, 353, 26556, 13, 4706, 1583, 29889, 3888, 353, 29871, 8853, 978, 1115, 1311, 29889, 978, 1699, 3972, 2605, 1115, 3972, 2605, 1699, 10855, 1115, 8516, 1699, 1037, 362, 1115, 8516, 1699, 1545, 2450, 1115, 8516, 1699, 1853, 4710, 18494, 16390, 24541, 3284, 19635, 1115, 19635, 29913, 13, 4706, 1583, 29889, 4262, 353, 6571, 13, 13, 4706, 437, 8893, 353, 7700, 13, 4706, 565, 270, 842, 26112, 29889, 24713, 24217, 29898, 1311, 1125, 13, 9651, 565, 451, 1583, 29889, 957, 3539, 29901, 13, 18884, 1596, 703, 23456, 10083, 5738, 856, 1159, 13, 18884, 565, 270, 842, 26112, 29889, 24713, 5896, 29898, 1311, 1125, 13, 462, 1678, 1583, 29889, 842, 3991, 29898, 2917, 29897, 13, 9651, 1683, 29901, 13, 18884, 437, 8893, 353, 5852, 13, 4706, 1683, 29901, 13, 9651, 437, 8893, 353, 5852, 13, 13, 4706, 565, 437, 8893, 29901, 13, 9651, 565, 4333, 338, 6213, 29901, 13, 18884, 12020, 7865, 2392, 703, 7196, 1818, 367, 6261, 297, 8783, 11265, 313, 3258, 263, 4333, 322, 1209, 408, 3443, 25760, 13, 9651, 1596, 703, 8893, 292, 716, 10083, 5738, 856, 1159, 13, 9651, 565, 270, 842, 26112, 29889, 24713, 8893, 29898, 1311, 1125, 13, 18884, 1583, 29889, 842, 3991, 29898, 2917, 29897, 13, 13, 4706, 1583, 29889, 1359, 9527, 580, 13, 13, 1678, 822, 679, 1542, 29898, 1311, 1125, 13, 4706, 736, 376, 18494, 16390, 24541, 29908, 13, 13, 1678, 822, 731, 3991, 29898, 1311, 29892, 2917, 1125, 13, 4706, 736, 270, 842, 26112, 29889, 24713, 2697, 3991, 29898, 1311, 29892, 2917, 29897, 13, 13, 1678, 822, 679, 4592, 3991, 29898, 1311, 1125, 13, 4706, 2295, 353, 426, 13, 9651, 376, 10945, 9629, 29908, 584, 426, 13, 18884, 376, 9910, 4899, 29908, 584, 7700, 29892, 13, 18884, 376, 10855, 5072, 29908, 584, 6213, 29892, 13, 18884, 376, 2972, 292, 14256, 29908, 584, 6213, 29892, 13, 18884, 376, 2972, 292, 10562, 29908, 584, 6213, 29892, 13, 18884, 376, 29876, 1595, 2187, 29908, 584, 29871, 29906, 29900, 29892, 13, 18884, 376, 18317, 29943, 370, 2200, 29908, 584, 376, 4381, 29908, 13, 9651, 2981, 13, 9651, 376, 3286, 5404, 9629, 29908, 584, 426, 13, 18884, 376, 18317, 29943, 370, 2200, 29908, 584, 6213, 29892, 13, 18884, 376, 4773, 29943, 370, 2200, 29908, 584, 6213, 13, 9651, 2981, 13, 9651, 376, 23579, 5367, 9629, 1115, 426, 13, 18884, 376, 29888, 3361, 29908, 584, 29871, 29945, 29892, 13, 18884, 376, 23579, 1169, 29908, 584, 426, 13, 462, 1678, 376, 14968, 29908, 584, 29871, 29955, 29900, 29892, 13, 462, 1678, 376, 1688, 29908, 584, 29871, 29906, 29900, 29892, 13, 462, 1678, 376, 18157, 29908, 584, 29871, 29896, 29900, 13, 18884, 500, 13, 9651, 2981, 13, 4706, 500, 13, 4706, 736, 2295, 13, 2 ]
src/OTLMOW/OTLModel/Classes/WVConsole.py
davidvlaminck/OTLClassPython
2
186458
<reponame>davidvlaminck/OTLClassPython # coding=utf-8 from OTLMOW.OTLModel.Classes.AIMNaamObject import AIMNaamObject from OTLMOW.GeometrieArtefact.PuntGeometrie import PuntGeometrie # Generated with OTLClassCreator. To modify: extend, do not edit class WVConsole(AIMNaamObject, PuntGeometrie): """Een draagconstructie voor het ophangen van openbare wegverlichting op plaatsen waar er geen ruimte is voor verlichtingsmasten in de grond. Typisch wordt in dergelijke gevallen de draagconstructie met het verlichtingstoestel op hoogte bevestigd aan een gebouw of een andere constructie naast de weg.""" typeURI = 'https://wegenenverkeer.data.vlaanderen.be/ns/onderdeel#WVConsole' """De URI van het object volgens https://www.w3.org/2001/XMLSchema#anyURI.""" def __init__(self): AIMNaamObject.__init__(self) PuntGeometrie.__init__(self)
[ 1, 529, 276, 1112, 420, 29958, 29881, 16093, 29894, 5288, 262, 384, 29914, 2891, 29931, 2385, 11980, 13, 29937, 14137, 29922, 9420, 29899, 29947, 13, 3166, 438, 14632, 6720, 29956, 29889, 2891, 29931, 3195, 29889, 27403, 29889, 29909, 7833, 13695, 314, 2061, 1053, 319, 7833, 13695, 314, 2061, 13, 3166, 438, 14632, 6720, 29956, 29889, 7999, 3297, 2546, 1433, 371, 17028, 29889, 29925, 1657, 7999, 3297, 2546, 1053, 349, 1657, 7999, 3297, 2546, 13, 13, 13, 29937, 3251, 630, 411, 438, 14632, 2385, 9832, 1061, 29889, 1763, 6623, 29901, 10985, 29892, 437, 451, 3863, 13, 1990, 399, 29963, 20008, 29898, 29909, 7833, 13695, 314, 2061, 29892, 349, 1657, 7999, 3297, 2546, 1125, 13, 1678, 9995, 29923, 264, 7482, 351, 11433, 347, 2979, 1681, 288, 561, 12644, 1109, 1722, 18354, 20669, 369, 10881, 292, 1015, 11365, 264, 7739, 604, 18841, 5796, 326, 371, 338, 2979, 1147, 10881, 886, 29885, 579, 264, 297, 316, 867, 898, 29889, 14213, 783, 9925, 297, 589, 29887, 6945, 22407, 5442, 316, 7482, 351, 11433, 347, 1539, 1681, 1147, 10881, 292, 7864, 342, 295, 1015, 24614, 371, 21329, 5286, 29881, 4711, 1739, 5772, 7100, 310, 1739, 9900, 3386, 347, 1055, 579, 316, 20669, 1213, 15945, 13, 13, 1678, 1134, 15551, 353, 525, 991, 597, 29893, 3442, 264, 369, 446, 261, 29889, 1272, 29889, 29894, 433, 3825, 264, 29889, 915, 29914, 1983, 29914, 8417, 311, 295, 29937, 29956, 29963, 20008, 29915, 13, 1678, 9995, 2772, 23539, 1109, 1681, 1203, 1700, 17397, 2045, 597, 1636, 29889, 29893, 29941, 29889, 990, 29914, 29906, 29900, 29900, 29896, 29914, 9165, 12763, 29937, 1384, 15551, 1213, 15945, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 319, 7833, 13695, 314, 2061, 17255, 2344, 12035, 1311, 29897, 13, 4706, 349, 1657, 7999, 3297, 2546, 17255, 2344, 12035, 1311, 29897, 13, 2 ]
python/remap.py
rmu75/rover-342-retrofit
0
82201
from stdglue import *
[ 1, 515, 3659, 3820, 434, 1053, 334, 13, 2 ]
train-cats.py
adamklein/keras-yolo3
0
55050
""" Derived from keras-yolo3 train.py (https://github.com/qqwweee/keras-yolo3), with additions from https://github.com/AntonMu/TrainYourOwnYOLO. """ import os import sys import argparse import pickle import numpy as np import keras.backend as K from keras.layers import Input, Lambda from keras.models import Model from keras.optimizers import Adam from keras.callbacks import TensorBoard, ModelCheckpoint, ReduceLROnPlateau, EarlyStopping from PIL import Image from time import time from yolo3.model import preprocess_true_boxes, yolo_body, tiny_yolo_body, yolo_loss from yolo3.utils import get_random_data def get_curr_dir(): return os.path.dirname(os.path.abspath(__file__)) def get_parent_dir(n=1): """ returns the n-th parent dicrectory of the current working directory """ current_path = get_curr_dir() for k in range(n): current_path = os.path.dirname(current_path) return current_path # --- global constants EXPORT_DIR = os.path.join(get_parent_dir(), 'for_yolo', 'vott', 'vott-export') ANNOT_FILE = os.path.join(EXPORT_DIR, 'yolo_annotations.txt') WEIGHTS_DIR = os.path.join(get_curr_dir(), 'model_data') YOLO_CLASSES = os.path.join(EXPORT_DIR, 'classes.names') LOG_DIR = 'logs/000/' ANCHORS_PATH = os.path.join(WEIGHTS_DIR, 'yolo_anchors.txt') WEIGHTS_PATH = os.path.join(WEIGHTS_DIR, 'yolo_weights.h5') VAL_SPLIT = 0.1 # 10% validation data EPOCHS = 102 # number of epochs to train; 50% transfer, 50% fine-tuning def _main(): class_names = get_classes(YOLO_CLASSES) num_classes = len(class_names) anchors = get_anchors(ANCHORS_PATH) input_shape = (416, 416) # multiple of 32, height, width epoch1, epoch2 = EPOCHS // 2, EPOCHS // 2 model = create_model(input_shape, anchors, num_classes, freeze_body=2, weights_path=WEIGHTS_PATH) # make sure you know what you freeze logging = TensorBoard(log_dir=LOG_DIR) checkpoint = ModelCheckpoint(LOG_DIR + 'ep{epoch:03d}-loss{loss:.3f}-val_loss{val_loss:.3f}.h5', monitor='val_loss', save_weights_only=True, save_best_only=True, period=3) reduce_lr = ReduceLROnPlateau(monitor='val_loss', factor=0.1, patience=3, verbose=1) early_stopping = EarlyStopping(monitor='val_loss', min_delta=0, patience=10, verbose=1) with open(ANNOT_FILE) as f: lines = f.readlines() np.random.seed(10101) np.random.shuffle(lines) num_val = int(len(lines) * VAL_SPLIT) num_train = len(lines) - num_val # Train with frozen layers first, to get a stable loss. # Adjust num epochs to your dataset. This step is enough to obtain a decent model. if True: model.compile(optimizer=Adam(lr=1e-3), loss={ # use custom yolo_loss Lambda layer. 'yolo_loss': lambda y_true, y_pred: y_pred}) batch_size = 32 print('Train on {} samples, val on {} samples, with batch size {}.'.format(num_train, num_val, batch_size)) history = model.fit_generator(data_generator_wrapper(lines[:num_train], batch_size, input_shape, anchors, num_classes), steps_per_epoch=max(1, num_train//batch_size), validation_data=data_generator_wrapper(lines[num_train:], batch_size, input_shape, anchors, num_classes), validation_steps=max(1, num_val//batch_size), epochs=epoch1, initial_epoch=0, callbacks=[logging, checkpoint]) model.save_weights(os.path.join(LOG_DIR, 'trained_weights_stage_1.h5')) step1_train_loss = history.history['loss'] with open(os.path.join(log_dir_time,'step1_loss.npy'), 'w') as f: for item in step1_train_loss: f.write("%s\n" % item) step1_val_loss = np.array(history.history['val_loss']) with open(os.path.join(log_dir_time,'step1_val_loss.npy'), 'w') as f: for item in step1_val_loss: f.write("%s\n" % item) # Unfreeze and continue training, to fine-tune. # Train longer if the result is not good. if True: for i in range(len(model.layers)): model.layers[i].trainable = True model.compile(optimizer=Adam(lr=1e-4), loss={'yolo_loss': lambda y_true, y_pred: y_pred}) # recompile to apply the change print('Unfreeze all layers.') batch_size = 4 # note that more GPU memory is required after unfreezing the body print('Train on {} samples, val on {} samples, with batch size {}.'.format(num_train, num_val, batch_size)) history=model.fit_generator(data_generator_wrapper(lines[:num_train], batch_size, input_shape, anchors, num_classes), steps_per_epoch=max(1, num_train//batch_size), validation_data=data_generator_wrapper(lines[num_train:], batch_size, input_shape, anchors, num_classes), validation_steps=max(1, num_val//batch_size), epochs=epoch1+epoch2, initial_epoch=epoch1, callbacks=[logging, checkpoint, reduce_lr, early_stopping]) model.save_weights(os.path.join(LOG_DIR, 'trained_weights_final.h5')) step2_train_loss = history.history['loss'] with open(os.path.join(log_dir_time,'step2_loss.npy'), 'w') as f: for item in step2_train_loss: f.write("%s\n" % item) step2_val_loss = np.array(history.history['val_loss']) with open(os.path.join(log_dir_time,'step2_val_loss.npy'), 'w') as f: for item in step2_val_loss: f.write("%s\n" % item) # --- HELPER FUNCS def get_classes(classes_path): """ loads the classes """ with open(classes_path) as f: class_names = f.readlines() class_names = [c.strip() for c in class_names] return class_names def get_anchors(anchors_path): '''loads the anchors from a file''' with open(anchors_path) as f: anchors = f.readline() anchors = [float(x) for x in anchors.split(',')] return np.array(anchors).reshape(-1, 2) def create_model(input_shape, anchors, num_classes, load_pretrained=True, freeze_body=2, weights_path='keras_yolo3/model_data/yolo_weights.h5'): '''create the training model''' K.clear_session() # get a new session image_input = Input(shape=(None, None, 3)) h, w = input_shape num_anchors = len(anchors) y_true = [Input(shape=(h//{0:32, 1:16, 2:8}[l], w//{0:32, 1:16, 2:8}[l], \ num_anchors//3, num_classes+5)) for l in range(3)] model_body = yolo_body(image_input, num_anchors//3, num_classes) print('Create YOLOv3 model with {} anchors and {} classes.'.format(num_anchors, num_classes)) if load_pretrained: model_body.load_weights(weights_path, by_name=True, skip_mismatch=True) print('Load weights {}.'.format(weights_path)) if freeze_body in [1, 2]: # Freeze darknet53 body or freeze all but 3 output layers. num = (185, len(model_body.layers)-3)[freeze_body-1] for i in range(num): model_body.layers[i].trainable = False print('Freeze the first {} layers of total {} layers.'.format(num, len(model_body.layers))) model_loss = Lambda(yolo_loss, output_shape=(1,), name='yolo_loss', arguments={'anchors': anchors, 'num_classes': num_classes, 'ignore_thresh': 0.5})( [*model_body.output, *y_true]) model = Model([model_body.input, *y_true], model_loss) return model def data_generator(annotation_lines, batch_size, input_shape, anchors, num_classes): '''data generator for fit_generator''' n = len(annotation_lines) i = 0 while True: image_data = [] box_data = [] for b in range(batch_size): if i==0: np.random.shuffle(annotation_lines) image, box = get_random_data(annotation_lines[i], input_shape, random=True) image_data.append(image) box_data.append(box) i = (i+1) % n image_data = np.array(image_data) box_data = np.array(box_data) y_true = preprocess_true_boxes(box_data, input_shape, anchors, num_classes) yield [image_data, *y_true], np.zeros(batch_size) def data_generator_wrapper(annotation_lines, batch_size, input_shape, anchors, num_classes): n = len(annotation_lines) if n==0 or batch_size<=0: return None return data_generator(annotation_lines, batch_size, input_shape, anchors, num_classes) # ---- if __name__ == '__main__': _main()
[ 1, 9995, 13, 15383, 2347, 515, 13023, 294, 29899, 29891, 3543, 29941, 7945, 29889, 2272, 313, 991, 597, 3292, 29889, 510, 29914, 24349, 29893, 705, 3905, 29914, 3946, 294, 29899, 29891, 3543, 29941, 511, 13, 2541, 788, 2187, 515, 2045, 597, 3292, 29889, 510, 29914, 13448, 265, 29924, 29884, 29914, 5323, 262, 10858, 29949, 1233, 29979, 29949, 3927, 29889, 13, 15945, 29908, 13, 13, 5215, 2897, 13, 5215, 10876, 13, 5215, 1852, 5510, 13, 5215, 5839, 280, 13, 13, 5215, 12655, 408, 7442, 13, 5215, 13023, 294, 29889, 27852, 408, 476, 13, 13, 3166, 13023, 294, 29889, 29277, 1053, 10567, 29892, 365, 2269, 13, 3166, 13023, 294, 29889, 9794, 1053, 8125, 13, 3166, 13023, 294, 29889, 20640, 19427, 1053, 11783, 13, 3166, 13023, 294, 29889, 14035, 29879, 1053, 323, 6073, 28397, 29892, 8125, 5596, 3149, 29892, 4367, 24551, 29931, 1672, 29876, 3247, 403, 585, 29892, 11095, 20754, 3262, 13, 13, 3166, 349, 6227, 1053, 7084, 13, 3166, 931, 1053, 931, 13, 13, 3166, 343, 3543, 29941, 29889, 4299, 1053, 758, 5014, 29918, 3009, 29918, 1884, 267, 29892, 343, 3543, 29918, 2587, 29892, 21577, 29918, 29891, 3543, 29918, 2587, 29892, 343, 3543, 29918, 6758, 13, 3166, 343, 3543, 29941, 29889, 13239, 1053, 679, 29918, 8172, 29918, 1272, 13, 13, 13, 1753, 679, 29918, 21962, 29918, 3972, 7295, 13, 1678, 736, 2897, 29889, 2084, 29889, 25721, 29898, 359, 29889, 2084, 29889, 370, 1028, 493, 22168, 1445, 1649, 876, 13, 13, 1753, 679, 29918, 3560, 29918, 3972, 29898, 29876, 29922, 29896, 1125, 13, 1678, 9995, 29871, 13, 1678, 3639, 278, 302, 29899, 386, 3847, 12124, 1621, 706, 310, 278, 1857, 13, 1678, 1985, 3884, 29871, 13, 1678, 9995, 13, 1678, 1857, 29918, 2084, 353, 679, 29918, 21962, 29918, 3972, 580, 13, 1678, 363, 413, 297, 3464, 29898, 29876, 1125, 13, 4706, 1857, 29918, 2084, 353, 2897, 29889, 2084, 29889, 25721, 29898, 3784, 29918, 2084, 29897, 13, 1678, 736, 1857, 29918, 2084, 13, 13, 29937, 11474, 5534, 17727, 13, 13, 5746, 15082, 29918, 9464, 353, 2897, 29889, 2084, 29889, 7122, 29898, 657, 29918, 3560, 29918, 3972, 3285, 525, 1454, 29918, 29891, 3543, 742, 525, 29894, 1501, 742, 525, 29894, 1501, 29899, 15843, 1495, 13, 2190, 12256, 29918, 7724, 353, 2897, 29889, 2084, 29889, 7122, 29898, 5746, 15082, 29918, 9464, 29892, 525, 29891, 3543, 29918, 6735, 800, 29889, 3945, 1495, 13, 13, 8851, 22530, 29903, 29918, 9464, 353, 2897, 29889, 2084, 29889, 7122, 29898, 657, 29918, 21962, 29918, 3972, 3285, 525, 4299, 29918, 1272, 1495, 13, 29979, 29949, 3927, 29918, 6154, 3289, 1660, 29903, 353, 2897, 29889, 2084, 29889, 7122, 29898, 5746, 15082, 29918, 9464, 29892, 525, 13203, 29889, 7039, 1495, 13, 13, 14480, 29918, 9464, 353, 525, 20756, 29914, 29900, 29900, 29900, 22208, 13, 2190, 3210, 24125, 29918, 10145, 353, 2897, 29889, 2084, 29889, 7122, 29898, 8851, 22530, 29903, 29918, 9464, 29892, 525, 29891, 3543, 29918, 14588, 943, 29889, 3945, 1495, 13, 8851, 22530, 29903, 29918, 10145, 353, 2897, 29889, 2084, 29889, 7122, 29898, 8851, 22530, 29903, 29918, 9464, 29892, 525, 29891, 3543, 29918, 705, 5861, 29889, 29882, 29945, 1495, 13, 13, 8932, 29918, 5550, 29931, 1806, 353, 29871, 29900, 29889, 29896, 259, 396, 29871, 29896, 29900, 29995, 8845, 848, 13, 29923, 13152, 3210, 29903, 353, 29871, 29896, 29900, 29906, 418, 396, 1353, 310, 21502, 12168, 304, 7945, 29936, 29871, 29945, 29900, 29995, 6782, 29892, 29871, 29945, 29900, 29995, 2691, 29899, 29873, 27964, 13, 13, 13, 1753, 903, 3396, 7295, 13, 1678, 770, 29918, 7039, 353, 679, 29918, 13203, 29898, 29979, 29949, 3927, 29918, 6154, 3289, 1660, 29903, 29897, 13, 1678, 954, 29918, 13203, 353, 7431, 29898, 1990, 29918, 7039, 29897, 13, 13, 1678, 23791, 943, 353, 679, 29918, 14588, 943, 29898, 2190, 3210, 24125, 29918, 10145, 29897, 13, 13, 1678, 1881, 29918, 12181, 353, 313, 29946, 29896, 29953, 29892, 29871, 29946, 29896, 29953, 29897, 462, 1678, 396, 2999, 310, 29871, 29941, 29906, 29892, 3171, 29892, 2920, 13, 1678, 21502, 305, 29896, 29892, 21502, 305, 29906, 353, 382, 13152, 3210, 29903, 849, 29871, 29906, 29892, 382, 13152, 3210, 29903, 849, 29871, 29906, 13, 13, 1678, 1904, 353, 1653, 29918, 4299, 29898, 2080, 29918, 12181, 29892, 23791, 943, 29892, 954, 29918, 13203, 29892, 13, 4706, 3889, 911, 29918, 2587, 29922, 29906, 29892, 18177, 29918, 2084, 29922, 8851, 22530, 29903, 29918, 10145, 29897, 396, 1207, 1854, 366, 1073, 825, 366, 3889, 911, 13, 13, 1678, 12183, 353, 323, 6073, 28397, 29898, 1188, 29918, 3972, 29922, 14480, 29918, 9464, 29897, 13, 1678, 1423, 3149, 353, 8125, 5596, 3149, 29898, 14480, 29918, 9464, 718, 525, 1022, 29912, 1022, 2878, 29901, 29900, 29941, 29881, 7402, 6758, 29912, 6758, 29901, 29889, 29941, 29888, 7402, 791, 29918, 6758, 29912, 791, 29918, 6758, 29901, 29889, 29941, 29888, 1836, 29882, 29945, 742, 13, 4706, 11819, 2433, 791, 29918, 6758, 742, 4078, 29918, 705, 5861, 29918, 6194, 29922, 5574, 29892, 4078, 29918, 13318, 29918, 6194, 29922, 5574, 29892, 3785, 29922, 29941, 29897, 13, 1678, 10032, 29918, 29212, 353, 4367, 24551, 29931, 1672, 29876, 3247, 403, 585, 29898, 3712, 2105, 2433, 791, 29918, 6758, 742, 7329, 29922, 29900, 29889, 29896, 29892, 282, 24701, 29922, 29941, 29892, 26952, 29922, 29896, 29897, 13, 1678, 4688, 29918, 7864, 3262, 353, 11095, 20754, 3262, 29898, 3712, 2105, 2433, 791, 29918, 6758, 742, 1375, 29918, 4181, 29922, 29900, 29892, 282, 24701, 29922, 29896, 29900, 29892, 26952, 29922, 29896, 29897, 13, 13, 1678, 411, 1722, 29898, 2190, 12256, 29918, 7724, 29897, 408, 285, 29901, 13, 4706, 3454, 353, 285, 29889, 949, 9012, 580, 13, 13, 1678, 7442, 29889, 8172, 29889, 26776, 29898, 29896, 29900, 29896, 29900, 29896, 29897, 13, 1678, 7442, 29889, 8172, 29889, 845, 21897, 29898, 9012, 29897, 13, 1678, 954, 29918, 791, 353, 938, 29898, 2435, 29898, 9012, 29897, 334, 12599, 29918, 5550, 29931, 1806, 29897, 13, 1678, 954, 29918, 14968, 353, 7431, 29898, 9012, 29897, 448, 954, 29918, 791, 13, 13, 1678, 396, 28186, 411, 14671, 2256, 15359, 937, 29892, 304, 679, 263, 13714, 6410, 29889, 13, 1678, 396, 2087, 5143, 954, 21502, 12168, 304, 596, 8783, 29889, 910, 4331, 338, 3307, 304, 4017, 263, 27189, 1904, 29889, 13, 1678, 565, 5852, 29901, 13, 4706, 1904, 29889, 12198, 29898, 20640, 3950, 29922, 3253, 314, 29898, 29212, 29922, 29896, 29872, 29899, 29941, 511, 6410, 3790, 13, 9651, 396, 671, 2888, 343, 3543, 29918, 6758, 365, 2269, 7546, 29889, 13, 9651, 525, 29891, 3543, 29918, 6758, 2396, 14013, 343, 29918, 3009, 29892, 343, 29918, 11965, 29901, 343, 29918, 11965, 1800, 13, 13, 4706, 9853, 29918, 2311, 353, 29871, 29941, 29906, 13, 4706, 1596, 877, 5323, 262, 373, 6571, 11916, 29892, 659, 373, 6571, 11916, 29892, 411, 9853, 2159, 426, 1836, 4286, 4830, 29898, 1949, 29918, 14968, 29892, 954, 29918, 791, 29892, 9853, 29918, 2311, 876, 13, 4706, 4955, 353, 1904, 29889, 9202, 29918, 27959, 29898, 1272, 29918, 27959, 29918, 17699, 29898, 9012, 7503, 1949, 29918, 14968, 1402, 9853, 29918, 2311, 29892, 1881, 29918, 12181, 29892, 23791, 943, 29892, 954, 29918, 13203, 511, 13, 18884, 6576, 29918, 546, 29918, 1022, 2878, 29922, 3317, 29898, 29896, 29892, 954, 29918, 14968, 458, 16175, 29918, 2311, 511, 13, 18884, 8845, 29918, 1272, 29922, 1272, 29918, 27959, 29918, 17699, 29898, 9012, 29961, 1949, 29918, 14968, 29901, 1402, 9853, 29918, 2311, 29892, 1881, 29918, 12181, 29892, 23791, 943, 29892, 954, 29918, 13203, 511, 13, 18884, 8845, 29918, 24530, 29922, 3317, 29898, 29896, 29892, 954, 29918, 791, 458, 16175, 29918, 2311, 511, 13, 18884, 21502, 12168, 29922, 1022, 2878, 29896, 29892, 13, 18884, 2847, 29918, 1022, 2878, 29922, 29900, 29892, 13, 18884, 6939, 29879, 11759, 21027, 29892, 1423, 3149, 2314, 13, 4706, 1904, 29889, 7620, 29918, 705, 5861, 29898, 359, 29889, 2084, 29889, 7122, 29898, 14480, 29918, 9464, 29892, 525, 3018, 1312, 29918, 705, 5861, 29918, 19190, 29918, 29896, 29889, 29882, 29945, 8785, 13, 13, 4706, 4331, 29896, 29918, 14968, 29918, 6758, 353, 4955, 29889, 18434, 1839, 6758, 2033, 13, 4706, 411, 1722, 29898, 359, 29889, 2084, 29889, 7122, 29898, 1188, 29918, 3972, 29918, 2230, 5501, 10568, 29896, 29918, 6758, 29889, 29876, 2272, 5477, 525, 29893, 1495, 408, 285, 29901, 13, 9651, 363, 2944, 297, 4331, 29896, 29918, 14968, 29918, 6758, 29901, 13, 18884, 285, 29889, 3539, 11702, 29879, 29905, 29876, 29908, 1273, 2944, 29897, 29871, 13, 13, 4706, 4331, 29896, 29918, 791, 29918, 6758, 353, 7442, 29889, 2378, 29898, 18434, 29889, 18434, 1839, 791, 29918, 6758, 11287, 13, 4706, 411, 1722, 29898, 359, 29889, 2084, 29889, 7122, 29898, 1188, 29918, 3972, 29918, 2230, 5501, 10568, 29896, 29918, 791, 29918, 6758, 29889, 29876, 2272, 5477, 525, 29893, 1495, 408, 285, 29901, 13, 9651, 363, 2944, 297, 4331, 29896, 29918, 791, 29918, 6758, 29901, 13, 18884, 285, 29889, 3539, 11702, 29879, 29905, 29876, 29908, 1273, 2944, 29897, 29871, 13, 13, 1678, 396, 853, 9021, 911, 322, 6773, 6694, 29892, 304, 2691, 29899, 29873, 1540, 29889, 13, 1678, 396, 28186, 5520, 565, 278, 1121, 338, 451, 1781, 29889, 13, 1678, 565, 5852, 29901, 13, 4706, 363, 474, 297, 3464, 29898, 2435, 29898, 4299, 29889, 29277, 22164, 13, 9651, 1904, 29889, 29277, 29961, 29875, 1822, 14968, 519, 353, 5852, 13, 4706, 1904, 29889, 12198, 29898, 20640, 3950, 29922, 3253, 314, 29898, 29212, 29922, 29896, 29872, 29899, 29946, 511, 6410, 3790, 29915, 29891, 3543, 29918, 6758, 2396, 14013, 343, 29918, 3009, 29892, 343, 29918, 11965, 29901, 343, 29918, 11965, 1800, 396, 337, 12198, 304, 3394, 278, 1735, 13, 4706, 1596, 877, 2525, 9021, 911, 599, 15359, 29889, 1495, 13, 13, 4706, 9853, 29918, 2311, 353, 29871, 29946, 396, 4443, 393, 901, 22796, 3370, 338, 3734, 1156, 443, 9021, 19583, 278, 3573, 13, 4706, 1596, 877, 5323, 262, 373, 6571, 11916, 29892, 659, 373, 6571, 11916, 29892, 411, 9853, 2159, 426, 1836, 4286, 4830, 29898, 1949, 29918, 14968, 29892, 954, 29918, 791, 29892, 9853, 29918, 2311, 876, 13, 4706, 4955, 29922, 4299, 29889, 9202, 29918, 27959, 29898, 1272, 29918, 27959, 29918, 17699, 29898, 9012, 7503, 1949, 29918, 14968, 1402, 9853, 29918, 2311, 29892, 1881, 29918, 12181, 29892, 23791, 943, 29892, 954, 29918, 13203, 511, 13, 9651, 6576, 29918, 546, 29918, 1022, 2878, 29922, 3317, 29898, 29896, 29892, 954, 29918, 14968, 458, 16175, 29918, 2311, 511, 13, 9651, 8845, 29918, 1272, 29922, 1272, 29918, 27959, 29918, 17699, 29898, 9012, 29961, 1949, 29918, 14968, 29901, 1402, 9853, 29918, 2311, 29892, 1881, 29918, 12181, 29892, 23791, 943, 29892, 954, 29918, 13203, 511, 13, 9651, 8845, 29918, 24530, 29922, 3317, 29898, 29896, 29892, 954, 29918, 791, 458, 16175, 29918, 2311, 511, 13, 9651, 21502, 12168, 29922, 1022, 2878, 29896, 29974, 1022, 2878, 29906, 29892, 13, 9651, 2847, 29918, 1022, 2878, 29922, 1022, 2878, 29896, 29892, 13, 9651, 6939, 29879, 11759, 21027, 29892, 1423, 3149, 29892, 10032, 29918, 29212, 29892, 4688, 29918, 7864, 3262, 2314, 13, 13, 4706, 1904, 29889, 7620, 29918, 705, 5861, 29898, 359, 29889, 2084, 29889, 7122, 29898, 14480, 29918, 9464, 29892, 525, 3018, 1312, 29918, 705, 5861, 29918, 8394, 29889, 29882, 29945, 8785, 13, 13, 4706, 4331, 29906, 29918, 14968, 29918, 6758, 353, 4955, 29889, 18434, 1839, 6758, 2033, 13, 4706, 411, 1722, 29898, 359, 29889, 2084, 29889, 7122, 29898, 1188, 29918, 3972, 29918, 2230, 5501, 10568, 29906, 29918, 6758, 29889, 29876, 2272, 5477, 525, 29893, 1495, 408, 285, 29901, 13, 9651, 363, 2944, 297, 4331, 29906, 29918, 14968, 29918, 6758, 29901, 13, 18884, 285, 29889, 3539, 11702, 29879, 29905, 29876, 29908, 1273, 2944, 29897, 29871, 13, 13, 4706, 4331, 29906, 29918, 791, 29918, 6758, 353, 7442, 29889, 2378, 29898, 18434, 29889, 18434, 1839, 791, 29918, 6758, 11287, 13, 4706, 411, 1722, 29898, 359, 29889, 2084, 29889, 7122, 29898, 1188, 29918, 3972, 29918, 2230, 5501, 10568, 29906, 29918, 791, 29918, 6758, 29889, 29876, 2272, 5477, 525, 29893, 1495, 408, 285, 29901, 13, 9651, 363, 2944, 297, 4331, 29906, 29918, 791, 29918, 6758, 29901, 13, 18884, 285, 29889, 3539, 11702, 29879, 29905, 29876, 29908, 1273, 2944, 29897, 29871, 13, 13, 29937, 11474, 379, 6670, 13171, 383, 3904, 9295, 13, 13, 1753, 679, 29918, 13203, 29898, 13203, 29918, 2084, 1125, 13, 1678, 9995, 15376, 278, 4413, 9995, 13, 1678, 411, 1722, 29898, 13203, 29918, 2084, 29897, 408, 285, 29901, 13, 4706, 770, 29918, 7039, 353, 285, 29889, 949, 9012, 580, 13, 1678, 770, 29918, 7039, 353, 518, 29883, 29889, 17010, 580, 363, 274, 297, 770, 29918, 7039, 29962, 13, 1678, 736, 770, 29918, 7039, 13, 13, 1753, 679, 29918, 14588, 943, 29898, 14588, 943, 29918, 2084, 1125, 13, 1678, 14550, 18132, 278, 23791, 943, 515, 263, 934, 12008, 13, 1678, 411, 1722, 29898, 14588, 943, 29918, 2084, 29897, 408, 285, 29901, 13, 4706, 23791, 943, 353, 285, 29889, 949, 1220, 580, 13, 1678, 23791, 943, 353, 518, 7411, 29898, 29916, 29897, 363, 921, 297, 23791, 943, 29889, 5451, 29317, 1495, 29962, 13, 1678, 736, 7442, 29889, 2378, 29898, 14588, 943, 467, 690, 14443, 6278, 29896, 29892, 29871, 29906, 29897, 13, 13, 1753, 1653, 29918, 4299, 29898, 2080, 29918, 12181, 29892, 23791, 943, 29892, 954, 29918, 13203, 29892, 2254, 29918, 1457, 3018, 1312, 29922, 5574, 29892, 3889, 911, 29918, 2587, 29922, 29906, 29892, 13, 9651, 18177, 29918, 2084, 2433, 3946, 294, 29918, 29891, 3543, 29941, 29914, 4299, 29918, 1272, 29914, 29891, 3543, 29918, 705, 5861, 29889, 29882, 29945, 29374, 13, 1678, 14550, 3258, 278, 6694, 1904, 12008, 13, 1678, 476, 29889, 8551, 29918, 7924, 580, 396, 679, 263, 716, 4867, 13, 1678, 1967, 29918, 2080, 353, 10567, 29898, 12181, 7607, 8516, 29892, 6213, 29892, 29871, 29941, 876, 13, 1678, 298, 29892, 281, 353, 1881, 29918, 12181, 13, 1678, 954, 29918, 14588, 943, 353, 7431, 29898, 14588, 943, 29897, 13, 13, 1678, 343, 29918, 3009, 353, 518, 4290, 29898, 12181, 7607, 29882, 458, 29912, 29900, 29901, 29941, 29906, 29892, 29871, 29896, 29901, 29896, 29953, 29892, 29871, 29906, 29901, 29947, 4400, 29880, 1402, 281, 458, 29912, 29900, 29901, 29941, 29906, 29892, 29871, 29896, 29901, 29896, 29953, 29892, 29871, 29906, 29901, 29947, 4400, 29880, 1402, 320, 13, 4706, 954, 29918, 14588, 943, 458, 29941, 29892, 954, 29918, 13203, 29974, 29945, 876, 363, 301, 297, 3464, 29898, 29941, 4638, 13, 13, 1678, 1904, 29918, 2587, 353, 343, 3543, 29918, 2587, 29898, 3027, 29918, 2080, 29892, 954, 29918, 14588, 943, 458, 29941, 29892, 954, 29918, 13203, 29897, 13, 1678, 1596, 877, 4391, 612, 29949, 3927, 29894, 29941, 1904, 411, 6571, 23791, 943, 322, 6571, 4413, 29889, 4286, 4830, 29898, 1949, 29918, 14588, 943, 29892, 954, 29918, 13203, 876, 13, 13, 1678, 565, 2254, 29918, 1457, 3018, 1312, 29901, 13, 4706, 1904, 29918, 2587, 29889, 1359, 29918, 705, 5861, 29898, 705, 5861, 29918, 2084, 29892, 491, 29918, 978, 29922, 5574, 29892, 14383, 29918, 29885, 1608, 905, 29922, 5574, 29897, 13, 4706, 1596, 877, 5896, 18177, 426, 1836, 4286, 4830, 29898, 705, 5861, 29918, 2084, 876, 13, 4706, 565, 3889, 911, 29918, 2587, 297, 518, 29896, 29892, 29871, 29906, 5387, 13, 9651, 396, 12362, 911, 6501, 1212, 29945, 29941, 3573, 470, 3889, 911, 599, 541, 29871, 29941, 1962, 15359, 29889, 13, 9651, 954, 353, 313, 29896, 29947, 29945, 29892, 7431, 29898, 4299, 29918, 2587, 29889, 29277, 6817, 29941, 9601, 9021, 911, 29918, 2587, 29899, 29896, 29962, 13, 9651, 363, 474, 297, 3464, 29898, 1949, 1125, 1904, 29918, 2587, 29889, 29277, 29961, 29875, 1822, 14968, 519, 353, 7700, 13, 9651, 1596, 877, 20475, 911, 278, 937, 6571, 15359, 310, 3001, 6571, 15359, 29889, 4286, 4830, 29898, 1949, 29892, 7431, 29898, 4299, 29918, 2587, 29889, 29277, 4961, 13, 13, 1678, 1904, 29918, 6758, 353, 365, 2269, 29898, 29891, 3543, 29918, 6758, 29892, 1962, 29918, 12181, 7607, 29896, 29892, 511, 1024, 2433, 29891, 3543, 29918, 6758, 742, 13, 4706, 6273, 3790, 29915, 14588, 943, 2396, 23791, 943, 29892, 525, 1949, 29918, 13203, 2396, 954, 29918, 13203, 29892, 525, 17281, 29918, 386, 3781, 2396, 29871, 29900, 29889, 29945, 1800, 29898, 13, 4706, 518, 29930, 4299, 29918, 2587, 29889, 4905, 29892, 334, 29891, 29918, 3009, 2314, 13, 1678, 1904, 353, 8125, 4197, 4299, 29918, 2587, 29889, 2080, 29892, 334, 29891, 29918, 3009, 1402, 1904, 29918, 6758, 29897, 13, 13, 1678, 736, 1904, 13, 13, 1753, 848, 29918, 27959, 29898, 18317, 29918, 9012, 29892, 9853, 29918, 2311, 29892, 1881, 29918, 12181, 29892, 23791, 943, 29892, 954, 29918, 13203, 1125, 13, 1678, 14550, 1272, 15299, 363, 6216, 29918, 27959, 12008, 13, 1678, 302, 353, 7431, 29898, 18317, 29918, 9012, 29897, 13, 1678, 474, 353, 29871, 29900, 13, 1678, 1550, 5852, 29901, 13, 4706, 1967, 29918, 1272, 353, 5159, 13, 4706, 3800, 29918, 1272, 353, 5159, 13, 4706, 363, 289, 297, 3464, 29898, 16175, 29918, 2311, 1125, 13, 9651, 565, 474, 1360, 29900, 29901, 13, 18884, 7442, 29889, 8172, 29889, 845, 21897, 29898, 18317, 29918, 9012, 29897, 13, 9651, 1967, 29892, 3800, 353, 679, 29918, 8172, 29918, 1272, 29898, 18317, 29918, 9012, 29961, 29875, 1402, 1881, 29918, 12181, 29892, 4036, 29922, 5574, 29897, 13, 9651, 1967, 29918, 1272, 29889, 4397, 29898, 3027, 29897, 13, 9651, 3800, 29918, 1272, 29889, 4397, 29898, 1884, 29897, 13, 9651, 474, 353, 313, 29875, 29974, 29896, 29897, 1273, 302, 13, 4706, 1967, 29918, 1272, 353, 7442, 29889, 2378, 29898, 3027, 29918, 1272, 29897, 13, 4706, 3800, 29918, 1272, 353, 7442, 29889, 2378, 29898, 1884, 29918, 1272, 29897, 13, 4706, 343, 29918, 3009, 353, 758, 5014, 29918, 3009, 29918, 1884, 267, 29898, 1884, 29918, 1272, 29892, 1881, 29918, 12181, 29892, 23791, 943, 29892, 954, 29918, 13203, 29897, 13, 4706, 7709, 518, 3027, 29918, 1272, 29892, 334, 29891, 29918, 3009, 1402, 7442, 29889, 3298, 359, 29898, 16175, 29918, 2311, 29897, 13, 13, 1753, 848, 29918, 27959, 29918, 17699, 29898, 18317, 29918, 9012, 29892, 9853, 29918, 2311, 29892, 1881, 29918, 12181, 29892, 23791, 943, 29892, 954, 29918, 13203, 1125, 13, 1678, 302, 353, 7431, 29898, 18317, 29918, 9012, 29897, 13, 1678, 565, 302, 1360, 29900, 470, 9853, 29918, 2311, 14065, 29900, 29901, 736, 6213, 13, 1678, 736, 848, 29918, 27959, 29898, 18317, 29918, 9012, 29892, 9853, 29918, 2311, 29892, 1881, 29918, 12181, 29892, 23791, 943, 29892, 954, 29918, 13203, 29897, 13, 13, 29937, 23250, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 903, 3396, 580, 13, 13, 2 ]
src/tokenizers.py
tomfran/caselaw-temporal-analysis
0
97271
import os import spacy import json os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' class BatchTokenizer(): def __init__(self): self.nlp = spacy.load("en_core_web_md") def tokenize(self, documents): tokens = [] for doc in self.nlp.pipe(documents, batch_size = 30): tokens.append([token.lemma_ for token in doc if token.pos_ in ['NOUN', 'PROPN', 'VERB', 'ADJ', 'ADV']]) return tokens
[ 1, 1053, 2897, 13, 5215, 805, 4135, 13, 5215, 4390, 13, 13, 359, 29889, 21813, 1839, 8969, 29918, 6271, 29925, 29918, 16173, 29918, 14480, 29918, 1307, 29963, 6670, 2033, 353, 525, 29941, 29915, 29871, 13, 308, 13, 1990, 350, 905, 6066, 3950, 7295, 13, 268, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 1583, 29889, 12938, 29886, 353, 805, 4135, 29889, 1359, 703, 264, 29918, 3221, 29918, 2676, 29918, 3487, 1159, 13, 268, 13, 1678, 822, 5993, 675, 29898, 1311, 29892, 10701, 1125, 13, 4706, 18897, 353, 5159, 13, 4706, 363, 1574, 297, 1583, 29889, 12938, 29886, 29889, 17760, 29898, 3225, 29879, 29892, 9853, 29918, 2311, 353, 29871, 29941, 29900, 1125, 13, 9651, 18897, 29889, 4397, 4197, 6979, 29889, 13846, 29918, 363, 5993, 297, 1574, 29871, 13, 462, 965, 565, 5993, 29889, 1066, 29918, 297, 6024, 6632, 3904, 742, 525, 8618, 15695, 742, 525, 5348, 29933, 742, 525, 3035, 29967, 742, 525, 3035, 29963, 2033, 2314, 13, 632, 13, 4706, 736, 18897, 2 ]
crits/exploits/urls.py
dutrow/crits
738
49629
from django.conf.urls import url from . import views urlpatterns = [ url(r'^add/$', views.add_exploit, name='crits-exploits-views-add_exploit'), url(r'^edit/cve/$', views.edit_exploit_cve, name='crits-exploits-views-edit_exploit_cve'), url(r'^edit/name/(?P<id_>\S+)/$', views.edit_exploit_name, name='crits-exploits-views-edit_exploit_name'), url(r'^details/(?P<id_>\S+)/$', views.exploit_detail, name='crits-exploits-views-exploit_detail'), url(r'^remove/(?P<id_>\S+)/$', views.remove_exploit, name='crits-exploits-views-remove_exploit'), url(r'^list/$', views.exploits_listing, name='crits-exploits-views-exploits_listing'), url(r'^list/(?P<option>\S+)/$', views.exploits_listing, name='crits-exploits-views-exploits_listing'), ]
[ 1, 515, 9557, 29889, 5527, 29889, 26045, 1053, 3142, 13, 13, 3166, 869, 1053, 8386, 13, 13, 2271, 11037, 29879, 353, 518, 13, 1678, 3142, 29898, 29878, 29915, 29985, 1202, 13346, 742, 8386, 29889, 1202, 29918, 4548, 417, 277, 29892, 1024, 2433, 9695, 29879, 29899, 4548, 417, 1169, 29899, 7406, 29899, 1202, 29918, 4548, 417, 277, 5477, 13, 1678, 3142, 29898, 29878, 29915, 29985, 5628, 29914, 29883, 345, 13346, 742, 8386, 29889, 5628, 29918, 4548, 417, 277, 29918, 29883, 345, 29892, 1024, 2433, 9695, 29879, 29899, 4548, 417, 1169, 29899, 7406, 29899, 5628, 29918, 4548, 417, 277, 29918, 29883, 345, 5477, 13, 1678, 3142, 29898, 29878, 29915, 29985, 5628, 29914, 978, 29914, 10780, 29925, 29966, 333, 29918, 14247, 29903, 29974, 6802, 29938, 742, 8386, 29889, 5628, 29918, 4548, 417, 277, 29918, 978, 29892, 1024, 2433, 9695, 29879, 29899, 4548, 417, 1169, 29899, 7406, 29899, 5628, 29918, 4548, 417, 277, 29918, 978, 5477, 13, 1678, 3142, 29898, 29878, 29915, 29985, 14144, 29914, 10780, 29925, 29966, 333, 29918, 14247, 29903, 29974, 6802, 29938, 742, 8386, 29889, 4548, 417, 277, 29918, 16432, 29892, 1024, 2433, 9695, 29879, 29899, 4548, 417, 1169, 29899, 7406, 29899, 4548, 417, 277, 29918, 16432, 5477, 13, 1678, 3142, 29898, 29878, 29915, 29985, 5992, 29914, 10780, 29925, 29966, 333, 29918, 14247, 29903, 29974, 6802, 29938, 742, 8386, 29889, 5992, 29918, 4548, 417, 277, 29892, 1024, 2433, 9695, 29879, 29899, 4548, 417, 1169, 29899, 7406, 29899, 5992, 29918, 4548, 417, 277, 5477, 13, 1678, 3142, 29898, 29878, 29915, 29985, 1761, 13346, 742, 8386, 29889, 4548, 417, 1169, 29918, 1761, 292, 29892, 1024, 2433, 9695, 29879, 29899, 4548, 417, 1169, 29899, 7406, 29899, 4548, 417, 1169, 29918, 1761, 292, 5477, 13, 1678, 3142, 29898, 29878, 29915, 29985, 1761, 29914, 10780, 29925, 29966, 3385, 14247, 29903, 29974, 6802, 29938, 742, 8386, 29889, 4548, 417, 1169, 29918, 1761, 292, 29892, 1024, 2433, 9695, 29879, 29899, 4548, 417, 1169, 29899, 7406, 29899, 4548, 417, 1169, 29918, 1761, 292, 5477, 13, 29962, 13, 2 ]
python_modules/dagster-graphql/dagster_graphql_tests/graphql/snapshots/snap_test_solids.py
zzztimbo/dagster
0
197932
# -*- coding: utf-8 -*- # snapshottest: v1 - https://goo.gl/zC4yUc from __future__ import unicode_literals from snapshottest import Snapshot snapshots = Snapshot() snapshots['test_query_all_solids 1'] = { 'usedSolids': [ { '__typename': 'UsedSolid', 'definition': { 'name': 'a_solid_with_multilayered_config' }, 'invocations': [ { 'pipeline': { 'name': 'more_complicated_nested_config' }, 'solidHandle': { 'handleID': 'a_solid_with_multilayered_config' } } ] }, { '__typename': 'UsedSolid', 'definition': { 'name': 'a_solid_with_three_field_config' }, 'invocations': [ { 'pipeline': { 'name': 'more_complicated_config' }, 'solidHandle': { 'handleID': 'a_solid_with_three_field_config' } } ] }, { '__typename': 'UsedSolid', 'definition': { 'name': 'add_four' }, 'invocations': [ { 'pipeline': { 'name': 'composites_pipeline' }, 'solidHandle': { 'handleID': 'add_four' } } ] }, { '__typename': 'UsedSolid', 'definition': { 'name': 'add_one' }, 'invocations': [ { 'pipeline': { 'name': 'composites_pipeline' }, 'solidHandle': { 'handleID': 'add_four.adder_1.adder_1' } }, { 'pipeline': { 'name': 'composites_pipeline' }, 'solidHandle': { 'handleID': 'add_four.adder_2.adder_1' } }, { 'pipeline': { 'name': 'composites_pipeline' }, 'solidHandle': { 'handleID': 'add_four.adder_1.adder_2' } }, { 'pipeline': { 'name': 'composites_pipeline' }, 'solidHandle': { 'handleID': 'add_four.adder_2.adder_2' } } ] }, { '__typename': 'UsedSolid', 'definition': { 'name': 'add_two' }, 'invocations': [ { 'pipeline': { 'name': 'composites_pipeline' }, 'solidHandle': { 'handleID': 'add_four.adder_1' } }, { 'pipeline': { 'name': 'composites_pipeline' }, 'solidHandle': { 'handleID': 'add_four.adder_2' } } ] }, { '__typename': 'UsedSolid', 'definition': { 'name': 'apply_to_three' }, 'invocations': [ { 'pipeline': { 'name': 'multi_mode_with_resources' }, 'solidHandle': { 'handleID': 'apply_to_three' } } ] }, { '__typename': 'UsedSolid', 'definition': { 'name': 'can_fail' }, 'invocations': [ { 'pipeline': { 'name': 'retry_multi_output_pipeline' }, 'solidHandle': { 'handleID': 'can_fail' } } ] }, { '__typename': 'UsedSolid', 'definition': { 'name': 'df_expectations_solid' }, 'invocations': [ { 'pipeline': { 'name': 'csv_hello_world_with_expectations' }, 'solidHandle': { 'handleID': 'df_expectations_solid' } } ] }, { '__typename': 'UsedSolid', 'definition': { 'name': 'div_four' }, 'invocations': [ { 'pipeline': { 'name': 'composites_pipeline' }, 'solidHandle': { 'handleID': 'div_four' } } ] }, { '__typename': 'UsedSolid', 'definition': { 'name': 'div_two' }, 'invocations': [ { 'pipeline': { 'name': 'composites_pipeline' }, 'solidHandle': { 'handleID': 'div_four.div_1' } }, { 'pipeline': { 'name': 'composites_pipeline' }, 'solidHandle': { 'handleID': 'div_four.div_2' } } ] }, { '__typename': 'UsedSolid', 'definition': { 'name': 'emit_failed_expectation' }, 'invocations': [ { 'pipeline': { 'name': 'pipeline_with_expectations' }, 'solidHandle': { 'handleID': 'emit_failed_expectation' } } ] }, { '__typename': 'UsedSolid', 'definition': { 'name': 'emit_successful_expectation' }, 'invocations': [ { 'pipeline': { 'name': 'pipeline_with_expectations' }, 'solidHandle': { 'handleID': 'emit_successful_expectation' } } ] }, { '__typename': 'UsedSolid', 'definition': { 'name': 'emit_successful_expectation_no_metadata' }, 'invocations': [ { 'pipeline': { 'name': 'pipeline_with_expectations' }, 'solidHandle': { 'handleID': 'emit_successful_expectation_no_metadata' } } ] }, { '__typename': 'UsedSolid', 'definition': { 'name': 'fail' }, 'invocations': [ { 'pipeline': { 'name': 'eventually_successful' }, 'solidHandle': { 'handleID': 'fail' } }, { 'pipeline': { 'name': 'eventually_successful' }, 'solidHandle': { 'handleID': 'fail_2' } }, { 'pipeline': { 'name': 'eventually_successful' }, 'solidHandle': { 'handleID': 'fail_3' } } ] }, { '__typename': 'UsedSolid', 'definition': { 'name': 'fail_subset' }, 'invocations': [ { 'pipeline': { 'name': 'pipeline_with_invalid_definition_error' }, 'solidHandle': { 'handleID': 'fail_subset' } } ] }, { '__typename': 'UsedSolid', 'definition': { 'name': 'loop' }, 'invocations': [ { 'pipeline': { 'name': 'infinite_loop_pipeline' }, 'solidHandle': { 'handleID': 'loop' } } ] }, { '__typename': 'UsedSolid', 'definition': { 'name': 'materialize' }, 'invocations': [ { 'pipeline': { 'name': 'materialization_pipeline' }, 'solidHandle': { 'handleID': 'materialize' } } ] }, { '__typename': 'UsedSolid', 'definition': { 'name': 'multi' }, 'invocations': [ { 'pipeline': { 'name': 'retry_multi_output_pipeline' }, 'solidHandle': { 'handleID': 'multi' } } ] }, { '__typename': 'UsedSolid', 'definition': { 'name': 'no_output' }, 'invocations': [ { 'pipeline': { 'name': 'retry_multi_output_pipeline' }, 'solidHandle': { 'handleID': 'child_multi_skip' } }, { 'pipeline': { 'name': 'retry_multi_output_pipeline' }, 'solidHandle': { 'handleID': 'child_skip' } }, { 'pipeline': { 'name': 'retry_multi_output_pipeline' }, 'solidHandle': { 'handleID': 'grandchild_fail' } } ] }, { '__typename': 'UsedSolid', 'definition': { 'name': 'noop_solid' }, 'invocations': [ { 'pipeline': { 'name': 'noop_pipeline' }, 'solidHandle': { 'handleID': 'noop_solid' } } ] }, { '__typename': 'UsedSolid', 'definition': { 'name': 'one' }, 'invocations': [ { 'pipeline': { 'name': 'pipeline_with_invalid_definition_error' }, 'solidHandle': { 'handleID': 'one' } } ] }, { '__typename': 'UsedSolid', 'definition': { 'name': 'passthrough' }, 'invocations': [ { 'pipeline': { 'name': 'retry_multi_output_pipeline' }, 'solidHandle': { 'handleID': 'child_fail' } } ] }, { '__typename': 'UsedSolid', 'definition': { 'name': 'reset' }, 'invocations': [ { 'pipeline': { 'name': 'eventually_successful' }, 'solidHandle': { 'handleID': 'reset' } } ] }, { '__typename': 'UsedSolid', 'definition': { 'name': 'return_any' }, 'invocations': [ { 'pipeline': { 'name': 'scalar_output_pipeline' }, 'solidHandle': { 'handleID': 'return_any' } } ] }, { '__typename': 'UsedSolid', 'definition': { 'name': 'return_bool' }, 'invocations': [ { 'pipeline': { 'name': 'scalar_output_pipeline' }, 'solidHandle': { 'handleID': 'return_bool' } } ] }, { '__typename': 'UsedSolid', 'definition': { 'name': 'return_foo' }, 'invocations': [ { 'pipeline': { 'name': 'no_config_chain_pipeline' }, 'solidHandle': { 'handleID': 'return_foo' } } ] }, { '__typename': 'UsedSolid', 'definition': { 'name': 'return_hello' }, 'invocations': [ { 'pipeline': { 'name': 'no_config_pipeline' }, 'solidHandle': { 'handleID': 'return_hello' } } ] }, { '__typename': 'UsedSolid', 'definition': { 'name': 'return_hello_world' }, 'invocations': [ { 'pipeline': { 'name': 'no_config_chain_pipeline' }, 'solidHandle': { 'handleID': 'return_hello_world' } } ] }, { '__typename': 'UsedSolid', 'definition': { 'name': 'return_int' }, 'invocations': [ { 'pipeline': { 'name': 'scalar_output_pipeline' }, 'solidHandle': { 'handleID': 'return_int' } } ] }, { '__typename': 'UsedSolid', 'definition': { 'name': 'return_six' }, 'invocations': [ { 'pipeline': { 'name': 'multi_mode_with_loggers' }, 'solidHandle': { 'handleID': 'return_six' } } ] }, { '__typename': 'UsedSolid', 'definition': { 'name': 'return_str' }, 'invocations': [ { 'pipeline': { 'name': 'scalar_output_pipeline' }, 'solidHandle': { 'handleID': 'return_str' } } ] }, { '__typename': 'UsedSolid', 'definition': { 'name': 'simple_solid' }, 'invocations': [ { 'pipeline': { 'name': 'tagged_pipeline' }, 'solidHandle': { 'handleID': 'simple_solid' } } ] }, { '__typename': 'UsedSolid', 'definition': { 'name': 'solid_with_list' }, 'invocations': [ { 'pipeline': { 'name': 'pipeline_with_list' }, 'solidHandle': { 'handleID': 'solid_with_list' } } ] }, { '__typename': 'UsedSolid', 'definition': { 'name': 'solid_with_required_resource' }, 'invocations': [ { 'pipeline': { 'name': 'required_resource_pipeline' }, 'solidHandle': { 'handleID': 'solid_with_required_resource' } } ] }, { '__typename': 'UsedSolid', 'definition': { 'name': 'spawn' }, 'invocations': [ { 'pipeline': { 'name': 'eventually_successful' }, 'solidHandle': { 'handleID': 'spawn' } } ] }, { '__typename': 'UsedSolid', 'definition': { 'name': 'spew' }, 'invocations': [ { 'pipeline': { 'name': 'spew_pipeline' }, 'solidHandle': { 'handleID': 'spew' } } ] }, { '__typename': 'UsedSolid', 'definition': { 'name': 'start' }, 'invocations': [ { 'pipeline': { 'name': 'retry_resource_pipeline' }, 'solidHandle': { 'handleID': 'start' } } ] }, { '__typename': 'UsedSolid', 'definition': { 'name': 'sum_solid' }, 'invocations': [ { 'pipeline': { 'name': 'csv_hello_world' }, 'solidHandle': { 'handleID': 'sum_solid' } }, { 'pipeline': { 'name': 'csv_hello_world_df_input' }, 'solidHandle': { 'handleID': 'sum_solid' } }, { 'pipeline': { 'name': 'csv_hello_world_two' }, 'solidHandle': { 'handleID': 'sum_solid' } }, { 'pipeline': { 'name': 'csv_hello_world_with_expectations' }, 'solidHandle': { 'handleID': 'sum_solid' } } ] }, { '__typename': 'UsedSolid', 'definition': { 'name': 'sum_sq_solid' }, 'invocations': [ { 'pipeline': { 'name': 'csv_hello_world' }, 'solidHandle': { 'handleID': 'sum_sq_solid' } }, { 'pipeline': { 'name': 'csv_hello_world_df_input' }, 'solidHandle': { 'handleID': 'sum_sq_solid' } }, { 'pipeline': { 'name': 'csv_hello_world_with_expectations' }, 'solidHandle': { 'handleID': 'sum_sq_solid' } } ] }, { '__typename': 'UsedSolid', 'definition': { 'name': 'takes_an_enum' }, 'invocations': [ { 'pipeline': { 'name': 'pipeline_with_enum_config' }, 'solidHandle': { 'handleID': 'takes_an_enum' } } ] }, { '__typename': 'UsedSolid', 'definition': { 'name': 'throw_a_thing' }, 'invocations': [ { 'pipeline': { 'name': 'naughty_programmer_pipeline' }, 'solidHandle': { 'handleID': 'throw_a_thing' } } ] }, { '__typename': 'UsedSolid', 'definition': { 'name': 'will_fail' }, 'invocations': [ { 'pipeline': { 'name': 'retry_resource_pipeline' }, 'solidHandle': { 'handleID': 'will_fail' } } ] } ] }
[ 1, 396, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 29937, 15101, 845, 1501, 342, 29901, 325, 29896, 448, 2045, 597, 1484, 29877, 29889, 3820, 29914, 29920, 29907, 29946, 29891, 29965, 29883, 13, 3166, 4770, 29888, 9130, 1649, 1053, 29104, 29918, 20889, 1338, 13, 13, 3166, 15101, 845, 1501, 342, 1053, 317, 14551, 13, 13, 29879, 8971, 845, 1862, 353, 317, 14551, 580, 13, 13, 29879, 8971, 845, 1862, 1839, 1688, 29918, 1972, 29918, 497, 29918, 2929, 4841, 29871, 29896, 2033, 353, 426, 13, 1678, 525, 3880, 13296, 4841, 2396, 518, 13, 4706, 426, 13, 9651, 525, 1649, 22646, 2396, 525, 29965, 8485, 13296, 333, 742, 13, 9651, 525, 16553, 2396, 426, 13, 18884, 525, 978, 2396, 525, 29874, 29918, 2929, 333, 29918, 2541, 29918, 4713, 309, 2747, 287, 29918, 2917, 29915, 13, 9651, 2981, 13, 9651, 525, 11569, 542, 800, 2396, 518, 13, 18884, 426, 13, 462, 1678, 525, 13096, 5570, 2396, 426, 13, 462, 4706, 525, 978, 2396, 525, 5514, 29918, 2388, 9169, 29918, 27420, 29918, 2917, 29915, 13, 462, 1678, 2981, 13, 462, 1678, 525, 2929, 333, 13554, 2396, 426, 13, 462, 4706, 525, 8411, 1367, 2396, 525, 29874, 29918, 2929, 333, 29918, 2541, 29918, 4713, 309, 2747, 287, 29918, 2917, 29915, 13, 462, 1678, 500, 13, 18884, 500, 13, 9651, 4514, 13, 4706, 2981, 13, 4706, 426, 13, 9651, 525, 1649, 22646, 2396, 525, 29965, 8485, 13296, 333, 742, 13, 9651, 525, 16553, 2396, 426, 13, 18884, 525, 978, 2396, 525, 29874, 29918, 2929, 333, 29918, 2541, 29918, 17536, 29918, 2671, 29918, 2917, 29915, 13, 9651, 2981, 13, 9651, 525, 11569, 542, 800, 2396, 518, 13, 18884, 426, 13, 462, 1678, 525, 13096, 5570, 2396, 426, 13, 462, 4706, 525, 978, 2396, 525, 5514, 29918, 2388, 9169, 29918, 2917, 29915, 13, 462, 1678, 2981, 13, 462, 1678, 525, 2929, 333, 13554, 2396, 426, 13, 462, 4706, 525, 8411, 1367, 2396, 525, 29874, 29918, 2929, 333, 29918, 2541, 29918, 17536, 29918, 2671, 29918, 2917, 29915, 13, 462, 1678, 500, 13, 18884, 500, 13, 9651, 4514, 13, 4706, 2981, 13, 4706, 426, 13, 9651, 525, 1649, 22646, 2396, 525, 29965, 8485, 13296, 333, 742, 13, 9651, 525, 16553, 2396, 426, 13, 18884, 525, 978, 2396, 525, 1202, 29918, 17823, 29915, 13, 9651, 2981, 13, 9651, 525, 11569, 542, 800, 2396, 518, 13, 18884, 426, 13, 462, 1678, 525, 13096, 5570, 2396, 426, 13, 462, 4706, 525, 978, 2396, 525, 22410, 3246, 29918, 13096, 5570, 29915, 13, 462, 1678, 2981, 13, 462, 1678, 525, 2929, 333, 13554, 2396, 426, 13, 462, 4706, 525, 8411, 1367, 2396, 525, 1202, 29918, 17823, 29915, 13, 462, 1678, 500, 13, 18884, 500, 13, 9651, 4514, 13, 4706, 2981, 13, 4706, 426, 13, 9651, 525, 1649, 22646, 2396, 525, 29965, 8485, 13296, 333, 742, 13, 9651, 525, 16553, 2396, 426, 13, 18884, 525, 978, 2396, 525, 1202, 29918, 650, 29915, 13, 9651, 2981, 13, 9651, 525, 11569, 542, 800, 2396, 518, 13, 18884, 426, 13, 462, 1678, 525, 13096, 5570, 2396, 426, 13, 462, 4706, 525, 978, 2396, 525, 22410, 3246, 29918, 13096, 5570, 29915, 13, 462, 1678, 2981, 13, 462, 1678, 525, 2929, 333, 13554, 2396, 426, 13, 462, 4706, 525, 8411, 1367, 2396, 525, 1202, 29918, 17823, 29889, 328, 672, 29918, 29896, 29889, 328, 672, 29918, 29896, 29915, 13, 462, 1678, 500, 13, 18884, 2981, 13, 18884, 426, 13, 462, 1678, 525, 13096, 5570, 2396, 426, 13, 462, 4706, 525, 978, 2396, 525, 22410, 3246, 29918, 13096, 5570, 29915, 13, 462, 1678, 2981, 13, 462, 1678, 525, 2929, 333, 13554, 2396, 426, 13, 462, 4706, 525, 8411, 1367, 2396, 525, 1202, 29918, 17823, 29889, 328, 672, 29918, 29906, 29889, 328, 672, 29918, 29896, 29915, 13, 462, 1678, 500, 13, 18884, 2981, 13, 18884, 426, 13, 462, 1678, 525, 13096, 5570, 2396, 426, 13, 462, 4706, 525, 978, 2396, 525, 22410, 3246, 29918, 13096, 5570, 29915, 13, 462, 1678, 2981, 13, 462, 1678, 525, 2929, 333, 13554, 2396, 426, 13, 462, 4706, 525, 8411, 1367, 2396, 525, 1202, 29918, 17823, 29889, 328, 672, 29918, 29896, 29889, 328, 672, 29918, 29906, 29915, 13, 462, 1678, 500, 13, 18884, 2981, 13, 18884, 426, 13, 462, 1678, 525, 13096, 5570, 2396, 426, 13, 462, 4706, 525, 978, 2396, 525, 22410, 3246, 29918, 13096, 5570, 29915, 13, 462, 1678, 2981, 13, 462, 1678, 525, 2929, 333, 13554, 2396, 426, 13, 462, 4706, 525, 8411, 1367, 2396, 525, 1202, 29918, 17823, 29889, 328, 672, 29918, 29906, 29889, 328, 672, 29918, 29906, 29915, 13, 462, 1678, 500, 13, 18884, 500, 13, 9651, 4514, 13, 4706, 2981, 13, 4706, 426, 13, 9651, 525, 1649, 22646, 2396, 525, 29965, 8485, 13296, 333, 742, 13, 9651, 525, 16553, 2396, 426, 13, 18884, 525, 978, 2396, 525, 1202, 29918, 10184, 29915, 13, 9651, 2981, 13, 9651, 525, 11569, 542, 800, 2396, 518, 13, 18884, 426, 13, 462, 1678, 525, 13096, 5570, 2396, 426, 13, 462, 4706, 525, 978, 2396, 525, 22410, 3246, 29918, 13096, 5570, 29915, 13, 462, 1678, 2981, 13, 462, 1678, 525, 2929, 333, 13554, 2396, 426, 13, 462, 4706, 525, 8411, 1367, 2396, 525, 1202, 29918, 17823, 29889, 328, 672, 29918, 29896, 29915, 13, 462, 1678, 500, 13, 18884, 2981, 13, 18884, 426, 13, 462, 1678, 525, 13096, 5570, 2396, 426, 13, 462, 4706, 525, 978, 2396, 525, 22410, 3246, 29918, 13096, 5570, 29915, 13, 462, 1678, 2981, 13, 462, 1678, 525, 2929, 333, 13554, 2396, 426, 13, 462, 4706, 525, 8411, 1367, 2396, 525, 1202, 29918, 17823, 29889, 328, 672, 29918, 29906, 29915, 13, 462, 1678, 500, 13, 18884, 500, 13, 9651, 4514, 13, 4706, 2981, 13, 4706, 426, 13, 9651, 525, 1649, 22646, 2396, 525, 29965, 8485, 13296, 333, 742, 13, 9651, 525, 16553, 2396, 426, 13, 18884, 525, 978, 2396, 525, 7302, 29918, 517, 29918, 17536, 29915, 13, 9651, 2981, 13, 9651, 525, 11569, 542, 800, 2396, 518, 13, 18884, 426, 13, 462, 1678, 525, 13096, 5570, 2396, 426, 13, 462, 4706, 525, 978, 2396, 525, 9910, 29918, 8513, 29918, 2541, 29918, 13237, 29915, 13, 462, 1678, 2981, 13, 462, 1678, 525, 2929, 333, 13554, 2396, 426, 13, 462, 4706, 525, 8411, 1367, 2396, 525, 7302, 29918, 517, 29918, 17536, 29915, 13, 462, 1678, 500, 13, 18884, 500, 13, 9651, 4514, 13, 4706, 2981, 13, 4706, 426, 13, 9651, 525, 1649, 22646, 2396, 525, 29965, 8485, 13296, 333, 742, 13, 9651, 525, 16553, 2396, 426, 13, 18884, 525, 978, 2396, 525, 3068, 29918, 14057, 29915, 13, 9651, 2981, 13, 9651, 525, 11569, 542, 800, 2396, 518, 13, 18884, 426, 13, 462, 1678, 525, 13096, 5570, 2396, 426, 13, 462, 4706, 525, 978, 2396, 525, 276, 2202, 29918, 9910, 29918, 4905, 29918, 13096, 5570, 29915, 13, 462, 1678, 2981, 13, 462, 1678, 525, 2929, 333, 13554, 2396, 426, 13, 462, 4706, 525, 8411, 1367, 2396, 525, 3068, 29918, 14057, 29915, 13, 462, 1678, 500, 13, 18884, 500, 13, 9651, 4514, 13, 4706, 2981, 13, 4706, 426, 13, 9651, 525, 1649, 22646, 2396, 525, 29965, 8485, 13296, 333, 742, 13, 9651, 525, 16553, 2396, 426, 13, 18884, 525, 978, 2396, 525, 2176, 29918, 17854, 800, 29918, 2929, 333, 29915, 13, 9651, 2981, 13, 9651, 525, 11569, 542, 800, 2396, 518, 13, 18884, 426, 13, 462, 1678, 525, 13096, 5570, 2396, 426, 13, 462, 4706, 525, 978, 2396, 525, 7638, 29918, 12199, 29918, 11526, 29918, 2541, 29918, 17854, 800, 29915, 13, 462, 1678, 2981, 13, 462, 1678, 525, 2929, 333, 13554, 2396, 426, 13, 462, 4706, 525, 8411, 1367, 2396, 525, 2176, 29918, 17854, 800, 29918, 2929, 333, 29915, 13, 462, 1678, 500, 13, 18884, 500, 13, 9651, 4514, 13, 4706, 2981, 13, 4706, 426, 13, 9651, 525, 1649, 22646, 2396, 525, 29965, 8485, 13296, 333, 742, 13, 9651, 525, 16553, 2396, 426, 13, 18884, 525, 978, 2396, 525, 4563, 29918, 17823, 29915, 13, 9651, 2981, 13, 9651, 525, 11569, 542, 800, 2396, 518, 13, 18884, 426, 13, 462, 1678, 525, 13096, 5570, 2396, 426, 13, 462, 4706, 525, 978, 2396, 525, 22410, 3246, 29918, 13096, 5570, 29915, 13, 462, 1678, 2981, 13, 462, 1678, 525, 2929, 333, 13554, 2396, 426, 13, 462, 4706, 525, 8411, 1367, 2396, 525, 4563, 29918, 17823, 29915, 13, 462, 1678, 500, 13, 18884, 500, 13, 9651, 4514, 13, 4706, 2981, 13, 4706, 426, 13, 9651, 525, 1649, 22646, 2396, 525, 29965, 8485, 13296, 333, 742, 13, 9651, 525, 16553, 2396, 426, 13, 18884, 525, 978, 2396, 525, 4563, 29918, 10184, 29915, 13, 9651, 2981, 13, 9651, 525, 11569, 542, 800, 2396, 518, 13, 18884, 426, 13, 462, 1678, 525, 13096, 5570, 2396, 426, 13, 462, 4706, 525, 978, 2396, 525, 22410, 3246, 29918, 13096, 5570, 29915, 13, 462, 1678, 2981, 13, 462, 1678, 525, 2929, 333, 13554, 2396, 426, 13, 462, 4706, 525, 8411, 1367, 2396, 525, 4563, 29918, 17823, 29889, 4563, 29918, 29896, 29915, 13, 462, 1678, 500, 13, 18884, 2981, 13, 18884, 426, 13, 462, 1678, 525, 13096, 5570, 2396, 426, 13, 462, 4706, 525, 978, 2396, 525, 22410, 3246, 29918, 13096, 5570, 29915, 13, 462, 1678, 2981, 13, 462, 1678, 525, 2929, 333, 13554, 2396, 426, 13, 462, 4706, 525, 8411, 1367, 2396, 525, 4563, 29918, 17823, 29889, 4563, 29918, 29906, 29915, 13, 462, 1678, 500, 13, 18884, 500, 13, 9651, 4514, 13, 4706, 2981, 13, 4706, 426, 13, 9651, 525, 1649, 22646, 2396, 525, 29965, 8485, 13296, 333, 742, 13, 9651, 525, 16553, 2396, 426, 13, 18884, 525, 978, 2396, 525, 21976, 29918, 26061, 29918, 17854, 362, 29915, 13, 9651, 2981, 13, 9651, 525, 11569, 542, 800, 2396, 518, 13, 18884, 426, 13, 462, 1678, 525, 13096, 5570, 2396, 426, 13, 462, 4706, 525, 978, 2396, 525, 13096, 5570, 29918, 2541, 29918, 17854, 800, 29915, 13, 462, 1678, 2981, 13, 462, 1678, 525, 2929, 333, 13554, 2396, 426, 13, 462, 4706, 525, 8411, 1367, 2396, 525, 21976, 29918, 26061, 29918, 17854, 362, 29915, 13, 462, 1678, 500, 13, 18884, 500, 13, 9651, 4514, 13, 4706, 2981, 13, 4706, 426, 13, 9651, 525, 1649, 22646, 2396, 525, 29965, 8485, 13296, 333, 742, 13, 9651, 525, 16553, 2396, 426, 13, 18884, 525, 978, 2396, 525, 21976, 29918, 8698, 1319, 29918, 17854, 362, 29915, 13, 9651, 2981, 13, 9651, 525, 11569, 542, 800, 2396, 518, 13, 18884, 426, 13, 462, 1678, 525, 13096, 5570, 2396, 426, 13, 462, 4706, 525, 978, 2396, 525, 13096, 5570, 29918, 2541, 29918, 17854, 800, 29915, 13, 462, 1678, 2981, 13, 462, 1678, 525, 2929, 333, 13554, 2396, 426, 13, 462, 4706, 525, 8411, 1367, 2396, 525, 21976, 29918, 8698, 1319, 29918, 17854, 362, 29915, 13, 462, 1678, 500, 13, 18884, 500, 13, 9651, 4514, 13, 4706, 2981, 13, 4706, 426, 13, 9651, 525, 1649, 22646, 2396, 525, 29965, 8485, 13296, 333, 742, 13, 9651, 525, 16553, 2396, 426, 13, 18884, 525, 978, 2396, 525, 21976, 29918, 8698, 1319, 29918, 17854, 362, 29918, 1217, 29918, 19635, 29915, 13, 9651, 2981, 13, 9651, 525, 11569, 542, 800, 2396, 518, 13, 18884, 426, 13, 462, 1678, 525, 13096, 5570, 2396, 426, 13, 462, 4706, 525, 978, 2396, 525, 13096, 5570, 29918, 2541, 29918, 17854, 800, 29915, 13, 462, 1678, 2981, 13, 462, 1678, 525, 2929, 333, 13554, 2396, 426, 13, 462, 4706, 525, 8411, 1367, 2396, 525, 21976, 29918, 8698, 1319, 29918, 17854, 362, 29918, 1217, 29918, 19635, 29915, 13, 462, 1678, 500, 13, 18884, 500, 13, 9651, 4514, 13, 4706, 2981, 13, 4706, 426, 13, 9651, 525, 1649, 22646, 2396, 525, 29965, 8485, 13296, 333, 742, 13, 9651, 525, 16553, 2396, 426, 13, 18884, 525, 978, 2396, 525, 14057, 29915, 13, 9651, 2981, 13, 9651, 525, 11569, 542, 800, 2396, 518, 13, 18884, 426, 13, 462, 1678, 525, 13096, 5570, 2396, 426, 13, 462, 4706, 525, 978, 2396, 525, 3696, 1474, 29918, 8698, 1319, 29915, 13, 462, 1678, 2981, 13, 462, 1678, 525, 2929, 333, 13554, 2396, 426, 13, 462, 4706, 525, 8411, 1367, 2396, 525, 14057, 29915, 13, 462, 1678, 500, 13, 18884, 2981, 13, 18884, 426, 13, 462, 1678, 525, 13096, 5570, 2396, 426, 13, 462, 4706, 525, 978, 2396, 525, 3696, 1474, 29918, 8698, 1319, 29915, 13, 462, 1678, 2981, 13, 462, 1678, 525, 2929, 333, 13554, 2396, 426, 13, 462, 4706, 525, 8411, 1367, 2396, 525, 14057, 29918, 29906, 29915, 13, 462, 1678, 500, 13, 18884, 2981, 13, 18884, 426, 13, 462, 1678, 525, 13096, 5570, 2396, 426, 13, 462, 4706, 525, 978, 2396, 525, 3696, 1474, 29918, 8698, 1319, 29915, 13, 462, 1678, 2981, 13, 462, 1678, 525, 2929, 333, 13554, 2396, 426, 13, 462, 4706, 525, 8411, 1367, 2396, 525, 14057, 29918, 29941, 29915, 13, 462, 1678, 500, 13, 18884, 500, 13, 9651, 4514, 13, 4706, 2981, 13, 4706, 426, 13, 9651, 525, 1649, 22646, 2396, 525, 29965, 8485, 13296, 333, 742, 13, 9651, 525, 16553, 2396, 426, 13, 18884, 525, 978, 2396, 525, 14057, 29918, 6484, 29915, 13, 9651, 2981, 13, 9651, 525, 11569, 542, 800, 2396, 518, 13, 18884, 426, 13, 462, 1678, 525, 13096, 5570, 2396, 426, 13, 462, 4706, 525, 978, 2396, 525, 13096, 5570, 29918, 2541, 29918, 20965, 29918, 16553, 29918, 2704, 29915, 13, 462, 1678, 2981, 13, 462, 1678, 525, 2929, 333, 13554, 2396, 426, 13, 462, 4706, 525, 8411, 1367, 2396, 525, 14057, 29918, 6484, 29915, 13, 462, 1678, 500, 13, 18884, 500, 13, 9651, 4514, 13, 4706, 2981, 13, 4706, 426, 13, 9651, 525, 1649, 22646, 2396, 525, 29965, 8485, 13296, 333, 742, 13, 9651, 525, 16553, 2396, 426, 13, 18884, 525, 978, 2396, 525, 7888, 29915, 13, 9651, 2981, 13, 9651, 525, 11569, 542, 800, 2396, 518, 13, 18884, 426, 13, 462, 1678, 525, 13096, 5570, 2396, 426, 13, 462, 4706, 525, 978, 2396, 525, 262, 18925, 29918, 7888, 29918, 13096, 5570, 29915, 13, 462, 1678, 2981, 13, 462, 1678, 525, 2929, 333, 13554, 2396, 426, 13, 462, 4706, 525, 8411, 1367, 2396, 525, 7888, 29915, 13, 462, 1678, 500, 13, 18884, 500, 13, 9651, 4514, 13, 4706, 2981, 13, 4706, 426, 13, 9651, 525, 1649, 22646, 2396, 525, 29965, 8485, 13296, 333, 742, 13, 9651, 525, 16553, 2396, 426, 13, 18884, 525, 978, 2396, 525, 15388, 675, 29915, 13, 9651, 2981, 13, 9651, 525, 11569, 542, 800, 2396, 518, 13, 18884, 426, 13, 462, 1678, 525, 13096, 5570, 2396, 426, 13, 462, 4706, 525, 978, 2396, 525, 15388, 2133, 29918, 13096, 5570, 29915, 13, 462, 1678, 2981, 13, 462, 1678, 525, 2929, 333, 13554, 2396, 426, 13, 462, 4706, 525, 8411, 1367, 2396, 525, 15388, 675, 29915, 13, 462, 1678, 500, 13, 18884, 500, 13, 9651, 4514, 13, 4706, 2981, 13, 4706, 426, 13, 9651, 525, 1649, 22646, 2396, 525, 29965, 8485, 13296, 333, 742, 13, 9651, 525, 16553, 2396, 426, 13, 18884, 525, 978, 2396, 525, 9910, 29915, 13, 9651, 2981, 13, 9651, 525, 11569, 542, 800, 2396, 518, 13, 18884, 426, 13, 462, 1678, 525, 13096, 5570, 2396, 426, 13, 462, 4706, 525, 978, 2396, 525, 276, 2202, 29918, 9910, 29918, 4905, 29918, 13096, 5570, 29915, 13, 462, 1678, 2981, 13, 462, 1678, 525, 2929, 333, 13554, 2396, 426, 13, 462, 4706, 525, 8411, 1367, 2396, 525, 9910, 29915, 13, 462, 1678, 500, 13, 18884, 500, 13, 9651, 4514, 13, 4706, 2981, 13, 4706, 426, 13, 9651, 525, 1649, 22646, 2396, 525, 29965, 8485, 13296, 333, 742, 13, 9651, 525, 16553, 2396, 426, 13, 18884, 525, 978, 2396, 525, 1217, 29918, 4905, 29915, 13, 9651, 2981, 13, 9651, 525, 11569, 542, 800, 2396, 518, 13, 18884, 426, 13, 462, 1678, 525, 13096, 5570, 2396, 426, 13, 462, 4706, 525, 978, 2396, 525, 276, 2202, 29918, 9910, 29918, 4905, 29918, 13096, 5570, 29915, 13, 462, 1678, 2981, 13, 462, 1678, 525, 2929, 333, 13554, 2396, 426, 13, 462, 4706, 525, 8411, 1367, 2396, 525, 5145, 29918, 9910, 29918, 11014, 29915, 13, 462, 1678, 500, 13, 18884, 2981, 13, 18884, 426, 13, 462, 1678, 525, 13096, 5570, 2396, 426, 13, 462, 4706, 525, 978, 2396, 525, 276, 2202, 29918, 9910, 29918, 4905, 29918, 13096, 5570, 29915, 13, 462, 1678, 2981, 13, 462, 1678, 525, 2929, 333, 13554, 2396, 426, 13, 462, 4706, 525, 8411, 1367, 2396, 525, 5145, 29918, 11014, 29915, 13, 462, 1678, 500, 13, 18884, 2981, 13, 18884, 426, 13, 462, 1678, 525, 13096, 5570, 2396, 426, 13, 462, 4706, 525, 978, 2396, 525, 276, 2202, 29918, 9910, 29918, 4905, 29918, 13096, 5570, 29915, 13, 462, 1678, 2981, 13, 462, 1678, 525, 2929, 333, 13554, 2396, 426, 13, 462, 4706, 525, 8411, 1367, 2396, 525, 27857, 5145, 29918, 14057, 29915, 13, 462, 1678, 500, 13, 18884, 500, 13, 9651, 4514, 13, 4706, 2981, 13, 4706, 426, 13, 9651, 525, 1649, 22646, 2396, 525, 29965, 8485, 13296, 333, 742, 13, 9651, 525, 16553, 2396, 426, 13, 18884, 525, 978, 2396, 525, 1217, 459, 29918, 2929, 333, 29915, 13, 9651, 2981, 13, 9651, 525, 11569, 542, 800, 2396, 518, 13, 18884, 426, 13, 462, 1678, 525, 13096, 5570, 2396, 426, 13, 462, 4706, 525, 978, 2396, 525, 1217, 459, 29918, 13096, 5570, 29915, 13, 462, 1678, 2981, 13, 462, 1678, 525, 2929, 333, 13554, 2396, 426, 13, 462, 4706, 525, 8411, 1367, 2396, 525, 1217, 459, 29918, 2929, 333, 29915, 13, 462, 1678, 500, 13, 18884, 500, 13, 9651, 4514, 13, 4706, 2981, 13, 4706, 426, 13, 9651, 525, 1649, 22646, 2396, 525, 29965, 8485, 13296, 333, 742, 13, 9651, 525, 16553, 2396, 426, 13, 18884, 525, 978, 2396, 525, 650, 29915, 13, 9651, 2981, 13, 9651, 525, 11569, 542, 800, 2396, 518, 13, 18884, 426, 13, 462, 1678, 525, 13096, 5570, 2396, 426, 13, 462, 4706, 525, 978, 2396, 525, 13096, 5570, 29918, 2541, 29918, 20965, 29918, 16553, 29918, 2704, 29915, 13, 462, 1678, 2981, 13, 462, 1678, 525, 2929, 333, 13554, 2396, 426, 13, 462, 4706, 525, 8411, 1367, 2396, 525, 650, 29915, 13, 462, 1678, 500, 13, 18884, 500, 13, 9651, 4514, 13, 4706, 2981, 13, 4706, 426, 13, 9651, 525, 1649, 22646, 2396, 525, 29965, 8485, 13296, 333, 742, 13, 9651, 525, 16553, 2396, 426, 13, 18884, 525, 978, 2396, 525, 18182, 303, 1092, 820, 29915, 13, 9651, 2981, 13, 9651, 525, 11569, 542, 800, 2396, 518, 13, 18884, 426, 13, 462, 1678, 525, 13096, 5570, 2396, 426, 13, 462, 4706, 525, 978, 2396, 525, 276, 2202, 29918, 9910, 29918, 4905, 29918, 13096, 5570, 29915, 13, 462, 1678, 2981, 13, 462, 1678, 525, 2929, 333, 13554, 2396, 426, 13, 462, 4706, 525, 8411, 1367, 2396, 525, 5145, 29918, 14057, 29915, 13, 462, 1678, 500, 13, 18884, 500, 13, 9651, 4514, 13, 4706, 2981, 13, 4706, 426, 13, 9651, 525, 1649, 22646, 2396, 525, 29965, 8485, 13296, 333, 742, 13, 9651, 525, 16553, 2396, 426, 13, 18884, 525, 978, 2396, 525, 12071, 29915, 13, 9651, 2981, 13, 9651, 525, 11569, 542, 800, 2396, 518, 13, 18884, 426, 13, 462, 1678, 525, 13096, 5570, 2396, 426, 13, 462, 4706, 525, 978, 2396, 525, 3696, 1474, 29918, 8698, 1319, 29915, 13, 462, 1678, 2981, 13, 462, 1678, 525, 2929, 333, 13554, 2396, 426, 13, 462, 4706, 525, 8411, 1367, 2396, 525, 12071, 29915, 13, 462, 1678, 500, 13, 18884, 500, 13, 9651, 4514, 13, 4706, 2981, 13, 4706, 426, 13, 9651, 525, 1649, 22646, 2396, 525, 29965, 8485, 13296, 333, 742, 13, 9651, 525, 16553, 2396, 426, 13, 18884, 525, 978, 2396, 525, 2457, 29918, 1384, 29915, 13, 9651, 2981, 13, 9651, 525, 11569, 542, 800, 2396, 518, 13, 18884, 426, 13, 462, 1678, 525, 13096, 5570, 2396, 426, 13, 462, 4706, 525, 978, 2396, 525, 19529, 279, 29918, 4905, 29918, 13096, 5570, 29915, 13, 462, 1678, 2981, 13, 462, 1678, 525, 2929, 333, 13554, 2396, 426, 13, 462, 4706, 525, 8411, 1367, 2396, 525, 2457, 29918, 1384, 29915, 13, 462, 1678, 500, 13, 18884, 500, 13, 9651, 4514, 13, 4706, 2981, 13, 4706, 426, 13, 9651, 525, 1649, 22646, 2396, 525, 29965, 8485, 13296, 333, 742, 13, 9651, 525, 16553, 2396, 426, 13, 18884, 525, 978, 2396, 525, 2457, 29918, 11227, 29915, 13, 9651, 2981, 13, 9651, 525, 11569, 542, 800, 2396, 518, 13, 18884, 426, 13, 462, 1678, 525, 13096, 5570, 2396, 426, 13, 462, 4706, 525, 978, 2396, 525, 19529, 279, 29918, 4905, 29918, 13096, 5570, 29915, 13, 462, 1678, 2981, 13, 462, 1678, 525, 2929, 333, 13554, 2396, 426, 13, 462, 4706, 525, 8411, 1367, 2396, 525, 2457, 29918, 11227, 29915, 13, 462, 1678, 500, 13, 18884, 500, 13, 9651, 4514, 13, 4706, 2981, 13, 4706, 426, 13, 9651, 525, 1649, 22646, 2396, 525, 29965, 8485, 13296, 333, 742, 13, 9651, 525, 16553, 2396, 426, 13, 18884, 525, 978, 2396, 525, 2457, 29918, 5431, 29915, 13, 9651, 2981, 13, 9651, 525, 11569, 542, 800, 2396, 518, 13, 18884, 426, 13, 462, 1678, 525, 13096, 5570, 2396, 426, 13, 462, 4706, 525, 978, 2396, 525, 1217, 29918, 2917, 29918, 14153, 29918, 13096, 5570, 29915, 13, 462, 1678, 2981, 13, 462, 1678, 525, 2929, 333, 13554, 2396, 426, 13, 462, 4706, 525, 8411, 1367, 2396, 525, 2457, 29918, 5431, 29915, 13, 462, 1678, 500, 13, 18884, 500, 13, 9651, 4514, 13, 4706, 2981, 13, 4706, 426, 13, 9651, 525, 1649, 22646, 2396, 525, 29965, 8485, 13296, 333, 742, 13, 9651, 525, 16553, 2396, 426, 13, 18884, 525, 978, 2396, 525, 2457, 29918, 12199, 29915, 13, 9651, 2981, 13, 9651, 525, 11569, 542, 800, 2396, 518, 13, 18884, 426, 13, 462, 1678, 525, 13096, 5570, 2396, 426, 13, 462, 4706, 525, 978, 2396, 525, 1217, 29918, 2917, 29918, 13096, 5570, 29915, 13, 462, 1678, 2981, 13, 462, 1678, 525, 2929, 333, 13554, 2396, 426, 13, 462, 4706, 525, 8411, 1367, 2396, 525, 2457, 29918, 12199, 29915, 13, 462, 1678, 500, 13, 18884, 500, 13, 9651, 4514, 13, 4706, 2981, 13, 4706, 426, 13, 9651, 525, 1649, 22646, 2396, 525, 29965, 8485, 13296, 333, 742, 13, 9651, 525, 16553, 2396, 426, 13, 18884, 525, 978, 2396, 525, 2457, 29918, 12199, 29918, 11526, 29915, 13, 9651, 2981, 13, 9651, 525, 11569, 542, 800, 2396, 518, 13, 18884, 426, 13, 462, 1678, 525, 13096, 5570, 2396, 426, 13, 462, 4706, 525, 978, 2396, 525, 1217, 29918, 2917, 29918, 14153, 29918, 13096, 5570, 29915, 13, 462, 1678, 2981, 13, 462, 1678, 525, 2929, 333, 13554, 2396, 426, 13, 462, 4706, 525, 8411, 1367, 2396, 525, 2457, 29918, 12199, 29918, 11526, 29915, 13, 462, 1678, 500, 13, 18884, 500, 13, 9651, 4514, 13, 4706, 2981, 13, 4706, 426, 13, 9651, 525, 1649, 22646, 2396, 525, 29965, 8485, 13296, 333, 742, 13, 9651, 525, 16553, 2396, 426, 13, 18884, 525, 978, 2396, 525, 2457, 29918, 524, 29915, 13, 9651, 2981, 13, 9651, 525, 11569, 542, 800, 2396, 518, 13, 18884, 426, 13, 462, 1678, 525, 13096, 5570, 2396, 426, 13, 462, 4706, 525, 978, 2396, 525, 19529, 279, 29918, 4905, 29918, 13096, 5570, 29915, 13, 462, 1678, 2981, 13, 462, 1678, 525, 2929, 333, 13554, 2396, 426, 13, 462, 4706, 525, 8411, 1367, 2396, 525, 2457, 29918, 524, 29915, 13, 462, 1678, 500, 13, 18884, 500, 13, 9651, 4514, 13, 4706, 2981, 13, 4706, 426, 13, 9651, 525, 1649, 22646, 2396, 525, 29965, 8485, 13296, 333, 742, 13, 9651, 525, 16553, 2396, 426, 13, 18884, 525, 978, 2396, 525, 2457, 29918, 28319, 29915, 13, 9651, 2981, 13, 9651, 525, 11569, 542, 800, 2396, 518, 13, 18884, 426, 13, 462, 1678, 525, 13096, 5570, 2396, 426, 13, 462, 4706, 525, 978, 2396, 525, 9910, 29918, 8513, 29918, 2541, 29918, 1188, 5743, 29915, 13, 462, 1678, 2981, 13, 462, 1678, 525, 2929, 333, 13554, 2396, 426, 13, 462, 4706, 525, 8411, 1367, 2396, 525, 2457, 29918, 28319, 29915, 13, 462, 1678, 500, 13, 18884, 500, 13, 9651, 4514, 13, 4706, 2981, 13, 4706, 426, 13, 9651, 525, 1649, 22646, 2396, 525, 29965, 8485, 13296, 333, 742, 13, 9651, 525, 16553, 2396, 426, 13, 18884, 525, 978, 2396, 525, 2457, 29918, 710, 29915, 13, 9651, 2981, 13, 9651, 525, 11569, 542, 800, 2396, 518, 13, 18884, 426, 13, 462, 1678, 525, 13096, 5570, 2396, 426, 13, 462, 4706, 525, 978, 2396, 525, 19529, 279, 29918, 4905, 29918, 13096, 5570, 29915, 13, 462, 1678, 2981, 13, 462, 1678, 525, 2929, 333, 13554, 2396, 426, 13, 462, 4706, 525, 8411, 1367, 2396, 525, 2457, 29918, 710, 29915, 13, 462, 1678, 500, 13, 18884, 500, 13, 9651, 4514, 13, 4706, 2981, 13, 4706, 426, 13, 9651, 525, 1649, 22646, 2396, 525, 29965, 8485, 13296, 333, 742, 13, 9651, 525, 16553, 2396, 426, 13, 18884, 525, 978, 2396, 525, 12857, 29918, 2929, 333, 29915, 13, 9651, 2981, 13, 9651, 525, 11569, 542, 800, 2396, 518, 13, 18884, 426, 13, 462, 1678, 525, 13096, 5570, 2396, 426, 13, 462, 4706, 525, 978, 2396, 525, 4039, 3192, 29918, 13096, 5570, 29915, 13, 462, 1678, 2981, 13, 462, 1678, 525, 2929, 333, 13554, 2396, 426, 13, 462, 4706, 525, 8411, 1367, 2396, 525, 12857, 29918, 2929, 333, 29915, 13, 462, 1678, 500, 13, 18884, 500, 13, 9651, 4514, 13, 4706, 2981, 13, 4706, 426, 13, 9651, 525, 1649, 22646, 2396, 525, 29965, 8485, 13296, 333, 742, 13, 9651, 525, 16553, 2396, 426, 13, 18884, 525, 978, 2396, 525, 2929, 333, 29918, 2541, 29918, 1761, 29915, 13, 9651, 2981, 13, 9651, 525, 11569, 542, 800, 2396, 518, 13, 18884, 426, 13, 462, 1678, 525, 13096, 5570, 2396, 426, 13, 462, 4706, 525, 978, 2396, 525, 13096, 5570, 29918, 2541, 29918, 1761, 29915, 13, 462, 1678, 2981, 13, 462, 1678, 525, 2929, 333, 13554, 2396, 426, 13, 462, 4706, 525, 8411, 1367, 2396, 525, 2929, 333, 29918, 2541, 29918, 1761, 29915, 13, 462, 1678, 500, 13, 18884, 500, 13, 9651, 4514, 13, 4706, 2981, 13, 4706, 426, 13, 9651, 525, 1649, 22646, 2396, 525, 29965, 8485, 13296, 333, 742, 13, 9651, 525, 16553, 2396, 426, 13, 18884, 525, 978, 2396, 525, 2929, 333, 29918, 2541, 29918, 12403, 29918, 10314, 29915, 13, 9651, 2981, 13, 9651, 525, 11569, 542, 800, 2396, 518, 13, 18884, 426, 13, 462, 1678, 525, 13096, 5570, 2396, 426, 13, 462, 4706, 525, 978, 2396, 525, 12403, 29918, 10314, 29918, 13096, 5570, 29915, 13, 462, 1678, 2981, 13, 462, 1678, 525, 2929, 333, 13554, 2396, 426, 13, 462, 4706, 525, 8411, 1367, 2396, 525, 2929, 333, 29918, 2541, 29918, 12403, 29918, 10314, 29915, 13, 462, 1678, 500, 13, 18884, 500, 13, 9651, 4514, 13, 4706, 2981, 13, 4706, 426, 13, 9651, 525, 1649, 22646, 2396, 525, 29965, 8485, 13296, 333, 742, 13, 9651, 525, 16553, 2396, 426, 13, 18884, 525, 978, 2396, 525, 1028, 18101, 29915, 13, 9651, 2981, 13, 9651, 525, 11569, 542, 800, 2396, 518, 13, 18884, 426, 13, 462, 1678, 525, 13096, 5570, 2396, 426, 13, 462, 4706, 525, 978, 2396, 525, 3696, 1474, 29918, 8698, 1319, 29915, 13, 462, 1678, 2981, 13, 462, 1678, 525, 2929, 333, 13554, 2396, 426, 13, 462, 4706, 525, 8411, 1367, 2396, 525, 1028, 18101, 29915, 13, 462, 1678, 500, 13, 18884, 500, 13, 9651, 4514, 13, 4706, 2981, 13, 4706, 426, 13, 9651, 525, 1649, 22646, 2396, 525, 29965, 8485, 13296, 333, 742, 13, 9651, 525, 16553, 2396, 426, 13, 18884, 525, 978, 2396, 525, 5965, 29893, 29915, 13, 9651, 2981, 13, 9651, 525, 11569, 542, 800, 2396, 518, 13, 18884, 426, 13, 462, 1678, 525, 13096, 5570, 2396, 426, 13, 462, 4706, 525, 978, 2396, 525, 5965, 29893, 29918, 13096, 5570, 29915, 13, 462, 1678, 2981, 13, 462, 1678, 525, 2929, 333, 13554, 2396, 426, 13, 462, 4706, 525, 8411, 1367, 2396, 525, 5965, 29893, 29915, 13, 462, 1678, 500, 13, 18884, 500, 13, 9651, 4514, 13, 4706, 2981, 13, 4706, 426, 13, 9651, 525, 1649, 22646, 2396, 525, 29965, 8485, 13296, 333, 742, 13, 9651, 525, 16553, 2396, 426, 13, 18884, 525, 978, 2396, 525, 2962, 29915, 13, 9651, 2981, 13, 9651, 525, 11569, 542, 800, 2396, 518, 13, 18884, 426, 13, 462, 1678, 525, 13096, 5570, 2396, 426, 13, 462, 4706, 525, 978, 2396, 525, 276, 2202, 29918, 10314, 29918, 13096, 5570, 29915, 13, 462, 1678, 2981, 13, 462, 1678, 525, 2929, 333, 13554, 2396, 426, 13, 462, 4706, 525, 8411, 1367, 2396, 525, 2962, 29915, 13, 462, 1678, 500, 13, 18884, 500, 13, 9651, 4514, 13, 4706, 2981, 13, 4706, 426, 13, 9651, 525, 1649, 22646, 2396, 525, 29965, 8485, 13296, 333, 742, 13, 9651, 525, 16553, 2396, 426, 13, 18884, 525, 978, 2396, 525, 2083, 29918, 2929, 333, 29915, 13, 9651, 2981, 13, 9651, 525, 11569, 542, 800, 2396, 518, 13, 18884, 426, 13, 462, 1678, 525, 13096, 5570, 2396, 426, 13, 462, 4706, 525, 978, 2396, 525, 7638, 29918, 12199, 29918, 11526, 29915, 13, 462, 1678, 2981, 13, 462, 1678, 525, 2929, 333, 13554, 2396, 426, 13, 462, 4706, 525, 8411, 1367, 2396, 525, 2083, 29918, 2929, 333, 29915, 13, 462, 1678, 500, 13, 18884, 2981, 13, 18884, 426, 13, 462, 1678, 525, 13096, 5570, 2396, 426, 13, 462, 4706, 525, 978, 2396, 525, 7638, 29918, 12199, 29918, 11526, 29918, 2176, 29918, 2080, 29915, 13, 462, 1678, 2981, 13, 462, 1678, 525, 2929, 333, 13554, 2396, 426, 13, 462, 4706, 525, 8411, 1367, 2396, 525, 2083, 29918, 2929, 333, 29915, 13, 462, 1678, 500, 13, 18884, 2981, 13, 18884, 426, 13, 462, 1678, 525, 13096, 5570, 2396, 426, 13, 462, 4706, 525, 978, 2396, 525, 7638, 29918, 12199, 29918, 11526, 29918, 10184, 29915, 13, 462, 1678, 2981, 13, 462, 1678, 525, 2929, 333, 13554, 2396, 426, 13, 462, 4706, 525, 8411, 1367, 2396, 525, 2083, 29918, 2929, 333, 29915, 13, 462, 1678, 500, 13, 18884, 2981, 13, 18884, 426, 13, 462, 1678, 525, 13096, 5570, 2396, 426, 13, 462, 4706, 525, 978, 2396, 525, 7638, 29918, 12199, 29918, 11526, 29918, 2541, 29918, 17854, 800, 29915, 13, 462, 1678, 2981, 13, 462, 1678, 525, 2929, 333, 13554, 2396, 426, 13, 462, 4706, 525, 8411, 1367, 2396, 525, 2083, 29918, 2929, 333, 29915, 13, 462, 1678, 500, 13, 18884, 500, 13, 9651, 4514, 13, 4706, 2981, 13, 4706, 426, 13, 9651, 525, 1649, 22646, 2396, 525, 29965, 8485, 13296, 333, 742, 13, 9651, 525, 16553, 2396, 426, 13, 18884, 525, 978, 2396, 525, 2083, 29918, 3044, 29918, 2929, 333, 29915, 13, 9651, 2981, 13, 9651, 525, 11569, 542, 800, 2396, 518, 13, 18884, 426, 13, 462, 1678, 525, 13096, 5570, 2396, 426, 13, 462, 4706, 525, 978, 2396, 525, 7638, 29918, 12199, 29918, 11526, 29915, 13, 462, 1678, 2981, 13, 462, 1678, 525, 2929, 333, 13554, 2396, 426, 13, 462, 4706, 525, 8411, 1367, 2396, 525, 2083, 29918, 3044, 29918, 2929, 333, 29915, 13, 462, 1678, 500, 13, 18884, 2981, 13, 18884, 426, 13, 462, 1678, 525, 13096, 5570, 2396, 426, 13, 462, 4706, 525, 978, 2396, 525, 7638, 29918, 12199, 29918, 11526, 29918, 2176, 29918, 2080, 29915, 13, 462, 1678, 2981, 13, 462, 1678, 525, 2929, 333, 13554, 2396, 426, 13, 462, 4706, 525, 8411, 1367, 2396, 525, 2083, 29918, 3044, 29918, 2929, 333, 29915, 13, 462, 1678, 500, 13, 18884, 2981, 13, 18884, 426, 13, 462, 1678, 525, 13096, 5570, 2396, 426, 13, 462, 4706, 525, 978, 2396, 525, 7638, 29918, 12199, 29918, 11526, 29918, 2541, 29918, 17854, 800, 29915, 13, 462, 1678, 2981, 13, 462, 1678, 525, 2929, 333, 13554, 2396, 426, 13, 462, 4706, 525, 8411, 1367, 2396, 525, 2083, 29918, 3044, 29918, 2929, 333, 29915, 13, 462, 1678, 500, 13, 18884, 500, 13, 9651, 4514, 13, 4706, 2981, 13, 4706, 426, 13, 9651, 525, 1649, 22646, 2396, 525, 29965, 8485, 13296, 333, 742, 13, 9651, 525, 16553, 2396, 426, 13, 18884, 525, 978, 2396, 525, 29873, 6926, 29918, 273, 29918, 18605, 29915, 13, 9651, 2981, 13, 9651, 525, 11569, 542, 800, 2396, 518, 13, 18884, 426, 13, 462, 1678, 525, 13096, 5570, 2396, 426, 13, 462, 4706, 525, 978, 2396, 525, 13096, 5570, 29918, 2541, 29918, 18605, 29918, 2917, 29915, 13, 462, 1678, 2981, 13, 462, 1678, 525, 2929, 333, 13554, 2396, 426, 13, 462, 4706, 525, 8411, 1367, 2396, 525, 29873, 6926, 29918, 273, 29918, 18605, 29915, 13, 462, 1678, 500, 13, 18884, 500, 13, 9651, 4514, 13, 4706, 2981, 13, 4706, 426, 13, 9651, 525, 1649, 22646, 2396, 525, 29965, 8485, 13296, 333, 742, 13, 9651, 525, 16553, 2396, 426, 13, 18884, 525, 978, 2396, 525, 20539, 29918, 29874, 29918, 1918, 29915, 13, 9651, 2981, 13, 9651, 525, 11569, 542, 800, 2396, 518, 13, 18884, 426, 13, 462, 1678, 525, 13096, 5570, 2396, 426, 13, 462, 4706, 525, 978, 2396, 525, 29876, 6482, 29891, 29918, 8860, 1050, 29918, 13096, 5570, 29915, 13, 462, 1678, 2981, 13, 462, 1678, 525, 2929, 333, 13554, 2396, 426, 13, 462, 4706, 525, 8411, 1367, 2396, 525, 20539, 29918, 29874, 29918, 1918, 29915, 13, 462, 1678, 500, 13, 18884, 500, 13, 9651, 4514, 13, 4706, 2981, 13, 4706, 426, 13, 9651, 525, 1649, 22646, 2396, 525, 29965, 8485, 13296, 333, 742, 13, 9651, 525, 16553, 2396, 426, 13, 18884, 525, 978, 2396, 525, 14043, 29918, 14057, 29915, 13, 9651, 2981, 13, 9651, 525, 11569, 542, 800, 2396, 518, 13, 18884, 426, 13, 462, 1678, 525, 13096, 5570, 2396, 426, 13, 462, 4706, 525, 978, 2396, 525, 276, 2202, 29918, 10314, 29918, 13096, 5570, 29915, 13, 462, 1678, 2981, 13, 462, 1678, 525, 2929, 333, 13554, 2396, 426, 13, 462, 4706, 525, 8411, 1367, 2396, 525, 14043, 29918, 14057, 29915, 13, 462, 1678, 500, 13, 18884, 500, 13, 9651, 4514, 13, 4706, 500, 13, 1678, 4514, 13, 29913, 13, 2 ]
setup.py
yuvipanda/fakeokclient
0
33917
import setuptools setuptools.setup( name="fakeokpy", version='0.1', url="https://github.com/yuvipanda/fakeokpy", author="<NAME>", author_email="<EMAIL>", license="BSD-3-Clause", packages=setuptools.find_packages(), )
[ 1, 1053, 731, 21245, 8789, 13, 13, 842, 21245, 8789, 29889, 14669, 29898, 13, 1678, 1024, 543, 29888, 1296, 554, 2272, 613, 13, 1678, 1873, 2433, 29900, 29889, 29896, 742, 13, 1678, 3142, 543, 991, 597, 3292, 29889, 510, 29914, 29891, 4090, 666, 5863, 29914, 29888, 1296, 554, 2272, 613, 13, 1678, 4148, 543, 29966, 5813, 28341, 13, 1678, 4148, 29918, 5269, 543, 29966, 26862, 6227, 28341, 13, 1678, 19405, 543, 29933, 7230, 29899, 29941, 29899, 20216, 1509, 613, 13, 1678, 9741, 29922, 842, 21245, 8789, 29889, 2886, 29918, 8318, 3285, 13, 29897, 13, 2 ]
modules/astrom_test_2.py
rsiverd/ultracool
0
181741
#!/usr/bin/env python # vim: set fileencoding=utf-8 ts=4 sts=4 sw=4 et tw=80 : # # Second cut at astrometry fitting for UCD project. # # <NAME> # Created: 2021-08-30 # Last modified: 2021-08-30 #-------------------------------------------------------------------------- #************************************************************************** #-------------------------------------------------------------------------- ## Logging setup: import logging #logging.basicConfig(level=logging.DEBUG) logging.basicConfig(level=logging.INFO) logger = logging.getLogger(__name__) #logger.setLevel(logging.DEBUG) logger.setLevel(logging.INFO) ## Current version: __version__ = "0.1.0" ## Modules: import os import sys import time import numpy as np from numpy.lib.recfunctions import append_fields #import datetime as dt #from dateutil import parser as dtp #import scipy.linalg as sla #import scipy.signal as ssig #import scipy.ndimage as ndi import scipy.optimize as opti #import scipy.interpolate as stp #import scipy.spatial.distance as ssd #from functools import partial #from collections import OrderedDict #from collections.abc import Iterable #import multiprocessing as mp #np.set_printoptions(suppress=True, linewidth=160) #import pandas as pd #import statsmodels.api as sm #import statsmodels.formula.api as smf #from statsmodels.regression.quantile_regression import QuantReg _have_np_vers = float('.'.join(np.__version__.split('.')[:2])) import theil_sen as ts ## Useful stats routines: def calc_ls_med_MAD(a, axis=None): """Return median and median absolute deviation of *a* (scaled to normal).""" med_val = np.median(a, axis=axis) sig_hat = (1.482602218 * np.median(np.abs(a - med_val), axis=axis)) return (med_val, sig_hat) ## Median absolute residual: def calc_MAR(residuals, scalefactor=1.482602218): """Return median absolute residual (MAR) of input array. By default, the result is scaled to the normal distribution.""" return scalefactor * np.median(np.abs(residuals)) ##--------------------------------------------------------------------------## ##------------------ Astrometry Fitting (5-par) ----------------## ##--------------------------------------------------------------------------## _ARCSEC_PER_RADIAN = 180. * 3600.0 / np.pi _MAS_PER_RADIAN = _ARCSEC_PER_RADIAN * 1e3 class AstFit(object): """ This module provides astrometric fitting capability. Internally, a 5-parameter model is maintained in a numpy array. Its contents are: * RA (radians) at reference epoch * DE (radians) at reference epoch * pmRA (radians / yr). [this is pmRA* / cos(dec)] * pmDE (radians / yr) * parallax (radians) """ _need_eph_keys = ['jdtdb', 'x', 'y', 'z'] _need_data_keys = ['jdtdb', 'dra', 'dde', 'obs_x', 'obs_y', 'obs_z'] _asec_per_rad = _ARCSEC_PER_RADIAN _mas_per_rad = _MAS_PER_RADIAN def __init__(self): self._jd_tdb = None self._dt_yrs = None self.obs_eph = None self.ref_tdb = None self.inliers = None self.rweight = None self._is_set = False self._chiexp = 2 self._can_iterate = False return def set_exponent(self, exponent=2): """ Choose exponent used in penalty function (N below). The solver seeks to minimize the sum over data points of: ((obs - model) / err)**N """ #Setting N=2 behaves like Chi-squared. Setting N=1 minimizes total #absolute deviation self._chiexp = exponent return #def setup(self, jd_tdb_ref, RA_deg, DE_deg, obs_eph, def setup(self, data, reject_outliers=True, jd_tdb_ref=None, RA_err=None, DE_err=None): self._is_rdy = False if not all([isinstance(data[x], np.ndarray) \ for x in self._need_data_keys]): sys.stderr.write("Incomplete data set!\n") sys.stderr.write("Required columns include:\n") sys.stderr.write("--> %s\n" % str(self._need_data_keys)) return False self._outrej = reject_outliers #if not all([isinstance(obs_eph[x], np.ndarray) \ # for x in self._need_eph_keys]): # sys.stderr.write("Incomplete ephemeris data!\n") # sys.stderr.write("Required columns include:\n") # sys.stderr.write("--> %s\n" % str(self._need_eph_keys)) # return False #self.inliers = np.ones_like(RA_deg, dtype='bool') #self.rweight = np.ones_like(RA_deg) self.inliers = np.ones(len(data), dtype='bool') self.rweight = np.ones(len(data), dtype='float') #self.obs_eph = self._augmented_eph(obs_eph) self.dataset = np.copy(data) if jd_tdb_ref: self.ref_tdb = jd_tdb_ref else: self.ref_tdb = data['jdtdb'][0] #self.ref_tdb = jd_tdb_ref self._dt_yrs = (self.dataset['jdtdb'] - self.ref_tdb) / 365.25 #self._RA_rad = np.radians(RA_deg) #self._DE_rad = np.radians(DE_deg) self._RA_rad = np.radians(self.dataset['dra']) self._DE_rad = np.radians(self.dataset['dde']) #self._RA_med, self._RA_MAD = calc_ls_med_MAD(self._RA_rad) #self._DE_med, self._DE_MAD = calc_ls_med_MAD(self._DE_rad) #self._RA_MAD *= np.cos(self._DE_med) self._RA_err = RA_err self._DE_err = DE_err self._need_resid_errors = False if not isinstance(RA_err, np.ndarray): sys.stderr.write("WARNING: RA_err not given, using estimated\n") self._need_resid_errors = True if not isinstance(DE_err, np.ndarray): sys.stderr.write("WARNING: DE_err not given, using estimated\n") self._need_resid_errors = True #if isinstance(RA_err, np.ndarray): # self._RA_err = np.radians(RA_err) #else: # self._RA_err = self._RA_MAD #if isinstance(DE_err, np.ndarray): # self._DE_err = np.radians(DE_err) #else: # self._DE_err = self._DE_MAD #self._DE_err = np.radians(DE_err) if DE_err else self._DE_MAD self._is_set = True self._can_iterate = False return True #def set_ref_time(self, t_ref): # self.ref_time = t_ref # return @staticmethod def _calc_parallax_factors(RA_rad, DE_rad, X_au, Y_au, Z_au): """Compute parallax factors in arcseconds. The RA component has been divided by cos(dec) so that it can be used directly for residual minimization.""" sinRA, cosRA = np.sin(RA_rad), np.cos(RA_rad) sinDE, cosDE = np.sin(DE_rad), np.cos(DE_rad) ra_factor = (X_au * sinRA - Y_au * cosRA) / cosDE de_factor = X_au * cosRA * sinDE \ + Y_au * sinRA * sinDE \ - Z_au * cosDE return ra_factor, de_factor #def ts_fit_coord(self, time_vals, coo_vals): @staticmethod def ts_fit_radec_pm(t_yrs, RA_rad, DE_rad, plx_as=0, weighted=False): ts_ra_model = ts.linefit(t_yrs, RA_rad, weighted=weighted) ts_de_model = ts.linefit(t_yrs, DE_rad, weighted=weighted) return np.array([ts_ra_model[0], ts_de_model[0], ts_ra_model[1], ts_de_model[1], plx_as]) def apparent_radec(self, t_ref, astrom_pars, eph_obs): """ t_ref -- chosen reference epoch astrom_pars -- five astrometric parameters specified at the reference epoch: meanRA (rad), meanDE (rad), pmRA*cos(DE), pmDE, and parallax eph_obs -- dict with x,y,z,t elements describing the times and places of observations (numpy arrays) FOR NOW, assume [t_ref] = JD (TDB) [t] = JD (TDB) [pars] = rad, rad, arcsec/yr, arcsec/yr, arcsec *no cos(d)* """ rra, rde, pmra, pmde, prlx = astrom_pars t_diff_yr = (eph_obs['t'] - t_ref) / 365.25 # units of years pfra, pfde = self._calc_parallax_factors(rra, rde, eph_obs['x'], eph_obs['y'], eph_obs['z']) delta_ra = (t_diff_yr * pmra + prlx * pfra) delta_de = (t_diff_yr * pmde + prlx * pfde) return (rra + delta_ra, rde + delta_de) def eval_model(self, params): return self._solver_eval(params) #def eval_model(self, params): # rra, rde, pmra, pmde, prlx = params # pfra, pfde = self._calc_parallax_factors(rra, rde, # self.dataset['obs_x'], self.dataset['obs_y'], # self.dataset['obs_z']) # delta_ra = self._dt_yrs * pmra + prlx * pfra # delta_de = self._dt_yrs * pmde + prlx * pfde # return (rra + delta_ra, rde + delta_de) def _solver_eval(self, params): rra, rde, pmra, pmde, prlx = params pfra, pfde = self._calc_parallax_factors(rra, rde, self.dataset['obs_x'], self.dataset['obs_y'], self.dataset['obs_z']) delta_ra = self._dt_yrs * pmra + prlx * pfra delta_de = self._dt_yrs * pmde + prlx * pfde #delta_ra = self._dt_yrs * pmra - prlx * pfra #delta_de = self._dt_yrs * pmde - prlx * pfde return (rra + delta_ra, rde + delta_de) def _calc_radec_residuals(self, params): model_RA, model_DE = self._solver_eval(params) return (self._RA_rad - model_RA, self._DE_rad - model_DE) def _calc_radec_residuals_sigma(self, params): model_RA, model_DE = self._solver_eval(params) #rsigs_RA = (self._RA_rad - model_RA) / self._RA_err #rsigs_DE = (self._DE_rad - model_DE) / self._DE_err rsigs_RA = (self._RA_rad - model_RA) / self._use_RA_err rsigs_DE = (self._DE_rad - model_DE) / self._use_DE_err return rsigs_RA, rsigs_DE def _calc_total_residuals_sigma(self, params): return np.hypot(*self._calc_radec_residuals_sigma(params)) def _calc_chi_square(self, params, negplxhit=100.): model_ra, model_de = self._solver_eval(params) #resid_ra = (model_ra - self._RA_rad) #/ np.cos(model_de) #resid_de = (model_de - self._DE_rad) resid_ra = (self._RA_rad - model_ra) #/ np.cos(model_de) resid_de = (self._DE_rad - model_de) #resid_ra = (model_ra - self._RA_rad) / self._RA_err #resid_de = (model_de - self._DE_rad) / self._DE_err #if isinstance(self._RA_err, np.ndarray): # resid_ra /= self._RA_err #if isinstance(self._DE_err, np.ndarray): # resid_de /= self._DE_err if isinstance(self._use_RA_err, np.ndarray): resid_ra /= self._use_RA_err if isinstance(self._use_DE_err, np.ndarray): resid_de /= self._use_DE_err #return np.sum(np.hypot(resid_ra, resid_de)) #return np.sum(np.hypot(resid_ra, resid_de)**2) resid_tot = np.hypot(resid_ra, resid_de)[self.inliers] if (params[4] < 0.0): resid_tot *= negplxhit return np.sum(resid_tot**self._chiexp) #return np.sum(np.hypot(resid_ra, resid_de)**self._chiexp) #return np.sum(np.abs(resid_ra * resid_de)**self._chiexp) def _calc_initial_parallax(self, params): rra_resid, rde_resid = self._calc_radec_residuals(params) mar_ra_rad = calc_MAR(rra_resid) mar_ra_mas = _MAS_PER_RADIAN * mar_ra_rad sys.stderr.write("mar_ra_rad: %f\n" % mar_ra_rad) sys.stderr.write("mar_ra_mas: %f\n" % mar_ra_mas) pfra, pfde = self._calc_parallax_factors( self._RA_rad, self._DE_rad, self.dataset['obs_x'], self.dataset['obs_y'], self.dataset['obs_z']) #sys.stderr.write("pfra_arcsec: %s\n" % str(pfra_arcsec)) #pfra_rad = pfra_arcsec / _ARCSEC_PER_RADIAN adjustment_arcsec = ts.linefit(pfra, _ARCSEC_PER_RADIAN * rra_resid) sys.stderr.write("adjustment (arcsec): %s\n" % str(adjustment_arcsec)) return adjustment_arcsec # Driver routine for 5-parameter astrometric fitting: def fit_bestpars(self, sigcut=5): if not self._is_set: sys.stderr.write("Error: data not OK for fitting!\n") sys.stderr.write("Run setup() first and retry ...\n") return False # robust initial guess with Theil-Sen: uguess = self.ts_fit_radec_pm(self._dt_yrs, self._RA_rad, self._DE_rad) wguess = self.ts_fit_radec_pm(self._dt_yrs, self._RA_rad, self._DE_rad, weighted=True) #sys.stderr.write("Initial guess: %s\n" % str(guess)) sys.stderr.write("Initial guess (unweighted):\n") sys.stderr.write("==> %s\n" % str(self.nice_units(uguess))) sys.stderr.write("\n") sys.stderr.write("Initial guess (weighted):\n") sys.stderr.write("==> %s\n" % str(self.nice_units(wguess))) sys.stderr.write("\n") guess = uguess # adopt unweighted for now #guess[4] = 1000. / _MAS_PER_RADIAN # initial crack at parallax and zero-point: woohoo = self._calc_initial_parallax(guess) sys.stderr.write("woohoo: %s\n" % str(woohoo)) self.woohoo = woohoo ra_nudge_rad, plx_rad = woohoo / _ARCSEC_PER_RADIAN guess[0] += ra_nudge_rad guess[4] = plx_rad # estimate RA,Dec uncertainty from residuals if not known a prior: if self._need_resid_errors: rra_resid, rde_resid = self._calc_radec_residuals(guess) rra_scatter = calc_MAR(rra_resid) rde_scatter = calc_MAR(rde_resid) mra_scatter = _MAS_PER_RADIAN * rra_scatter mde_scatter = _MAS_PER_RADIAN * rde_scatter #sys.stderr.write("rra_resid: %s\n" % str(rra_resid)) #sys.stderr.write("rde_resid: %s\n" % str(rde_resid)) sys.stderr.write("rra_scatter: %e (rad)\n" % rra_scatter) sys.stderr.write("rde_scatter: %e (rad)\n" % rde_scatter) sys.stderr.write("mra_scatter: %10.5f (mas)\n" % mra_scatter) sys.stderr.write("mde_scatter: %10.5f (mas)\n" % mde_scatter) self._RA_err = np.ones_like(self._RA_rad) * rra_scatter self._DE_err = np.ones_like(self._DE_rad) * rde_scatter self._use_RA_err = np.copy(self._RA_err) self._use_DE_err = np.copy(self._DE_err) # check whether anything looks really bad: self._par_guess = guess #rsig_tot = np.hypot(*self._calc_radec_residuals_sigma(guess)) rsig_tot = self._calc_total_residuals_sigma(guess) #sys.stderr.write("rsig_tot:\n") #sys.stderr.write("%s\n" % str(rsig_tot)) sys.stderr.write("typical rsig_tot: %8.3f\n" % np.median(rsig_tot)) #sys.stderr.write("rsig_tot: %s\n" % str(rsig_tot)) self.inliers = (rsig_tot < sigcut) ndropped = self.inliers.size - np.sum(self.inliers) sys.stderr.write("Dropped %d point(s) beyond %.2f-sigma.\n" % (ndropped, sigcut)) #sys.stderr.write("ra_res: %s\n" % str(ra_res)) #sys.stderr.write("de_res: %s\n" % str(de_res)) #sys.stderr.write("ra_sig: %s\n" % str(ra_sig)) #sys.stderr.write("de_sig: %s\n" % str(de_sig)) # find minimum: self.full_result = opti.fmin(self._calc_chi_square, guess, xtol=1e-7, ftol=1e-7, full_output=True) #xtol=1e-9, ftol=1e-9, full_output=True) self.result = self.full_result[0] # brute-force minimum: #ra_fudge = np.median(self._RA_err) #de_fudge = np.median(self._DE_err) #pm_fudge = 0.2 #px_fudge = 4.0 #ranges = [(guess[0] - ra_fudge, guess[0] + ra_fudge), # RA # (guess[1] - de_fudge, guess[1] + de_fudge), # DE # (guess[2] / pm_fudge, guess[2] * pm_fudge), # pmRA # (guess[3] / pm_fudge, guess[3] * pm_fudge), # pmRA # (guess[4] / px_fudge, guess[3] * px_fudge), # parallax # ] #npts = 10 #self.result = opti.brute(self._calc_chi_square, ranges, Ns=npts) sys.stderr.write("Found minimum:\n") sys.stderr.write("==> %s\n" % str(self.nice_units(self.result))) self._can_iterate = True return self.result # ----------------------------------------------------------------------- def _calc_huber_rweights(self, residuals, sigma): _k_sig = 1.34 * sigma res_devs = np.abs(residuals / _k_sig) rweights = np.ones_like(res_devs) distants = (res_devs > 1.0) rweights[distants] = 1.0 / res_devs[distants] return rweights def iter_update_bestpars(self, params): """Perform an IRLS iteration.""" # calculate residuals: rra_resid, rde_resid = self._calc_radec_residuals(params) #sys.stderr.write("rra_resid: %s\n" % str(rra_resid)) #sys.stderr.write("rde_resid: %s\n" % str(rde_resid)) rra_scatter = calc_MAR(rra_resid) rde_scatter = calc_MAR(rde_resid) #sys.stderr.write("rra_scatter: %e (rad)\n" % rra_scatter) #sys.stderr.write("rde_scatter: %e (rad)\n" % rde_scatter) ra_rweights = self._calc_huber_rweights(rra_resid, rra_scatter) self._use_RA_err = ra_rweights * self._RA_err de_rweights = self._calc_huber_rweights(rde_resid, rde_scatter) self._use_DE_err = de_rweights * self._DE_err # find minimum: self.iresult = opti.fmin(self._calc_chi_square, params , xtol=1e-7, ftol=1e-7, full_output=True) sys.stderr.write("Found IRLS minimum:\n") sys.stderr.write("==> %s\n" % str(self.nice_units(self.iresult[0]))) self._can_iterate = True return self.iresult[0] # ----------------------------------------------------------------------- def nice_units(self, params): result = np.degrees(params) result[2:5] *= 3.6e6 # into milliarcsec result[2] *= np.cos(params[1]) # cos(dec) for pmRA return result def list_resid_sigmas(self, params): rsig_RA, rsig_DE = self._calc_radec_residuals_sigma(params) rsig_tot = np.hypot(rsig_RA, rsig_DE) #sys.stderr.write("%15s %15s\n") for ii,point in enumerate(zip(rsig_RA, rsig_DE, rsig_tot), 0): sys.stderr.write("> %10.5f %10.5f (%10.5f)\n" % point) return ###################################################################### # CHANGELOG (astrom_test_2.py): #--------------------------------------------------------------------- # # 2020-02-07: # -- Increased __version__ to 0.1.0. # -- First created astrom_test_2.py. #
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 13, 29937, 325, 326, 29901, 731, 934, 22331, 29922, 9420, 29899, 29947, 18696, 29922, 29946, 380, 29879, 29922, 29946, 2381, 29922, 29946, 634, 3252, 29922, 29947, 29900, 584, 13, 29937, 13, 29937, 6440, 5700, 472, 8717, 456, 27184, 28221, 363, 501, 6530, 2060, 29889, 13, 29937, 13, 29937, 529, 5813, 29958, 13, 29937, 6760, 630, 29901, 4706, 29906, 29900, 29906, 29896, 29899, 29900, 29947, 29899, 29941, 29900, 13, 29937, 9208, 9120, 29901, 29871, 29906, 29900, 29906, 29896, 29899, 29900, 29947, 29899, 29941, 29900, 13, 29937, 2683, 2683, 2683, 2683, 28400, 13, 29937, 7775, 7775, 7775, 7775, 4189, 1068, 13, 29937, 2683, 2683, 2683, 2683, 28400, 13, 13, 2277, 4522, 3460, 6230, 29901, 13, 5215, 12183, 13, 29937, 21027, 29889, 16121, 3991, 29898, 5563, 29922, 21027, 29889, 18525, 29897, 13, 21027, 29889, 16121, 3991, 29898, 5563, 29922, 21027, 29889, 11690, 29897, 13, 21707, 353, 12183, 29889, 657, 16363, 22168, 978, 1649, 29897, 13, 29937, 21707, 29889, 842, 10108, 29898, 21027, 29889, 18525, 29897, 13, 21707, 29889, 842, 10108, 29898, 21027, 29889, 11690, 29897, 13, 13, 2277, 9626, 1873, 29901, 13, 1649, 3259, 1649, 353, 376, 29900, 29889, 29896, 29889, 29900, 29908, 13, 13, 2277, 3382, 2540, 29901, 13, 5215, 2897, 13, 5215, 10876, 13, 5215, 931, 13, 5215, 12655, 408, 7442, 13, 3166, 12655, 29889, 1982, 29889, 3757, 12171, 1053, 9773, 29918, 9621, 13, 29937, 5215, 12865, 408, 11636, 13, 29937, 3166, 2635, 4422, 1053, 13812, 408, 270, 9392, 13, 29937, 5215, 4560, 2272, 29889, 29880, 979, 29887, 408, 8370, 13, 29937, 5215, 4560, 2272, 29889, 25436, 408, 17971, 335, 13, 29937, 5215, 4560, 2272, 29889, 299, 3027, 408, 29871, 299, 29875, 13, 5215, 4560, 2272, 29889, 20640, 675, 408, 3523, 29875, 13, 29937, 5215, 4560, 2272, 29889, 1639, 3733, 403, 408, 380, 29886, 13, 29937, 5215, 4560, 2272, 29889, 1028, 15238, 29889, 19244, 408, 269, 4928, 13, 29937, 3166, 2090, 312, 8789, 1053, 7687, 13, 29937, 3166, 16250, 1053, 8170, 287, 21533, 13, 29937, 3166, 16250, 29889, 10736, 1053, 20504, 519, 13, 29937, 5215, 6674, 307, 985, 292, 408, 22326, 13, 29937, 9302, 29889, 842, 29918, 558, 8941, 1980, 29898, 19303, 1253, 29922, 5574, 29892, 1196, 2103, 29922, 29896, 29953, 29900, 29897, 13, 29937, 5215, 11701, 408, 10518, 13, 29937, 5215, 22663, 9794, 29889, 2754, 408, 1560, 13, 29937, 5215, 22663, 9794, 29889, 689, 2497, 29889, 2754, 408, 1560, 29888, 13, 29937, 3166, 22663, 9794, 29889, 276, 11476, 29889, 12150, 488, 29918, 276, 11476, 1053, 22746, 4597, 13, 29918, 17532, 29918, 9302, 29918, 874, 353, 5785, 12839, 4286, 7122, 29898, 9302, 17255, 3259, 26914, 5451, 12839, 1495, 7503, 29906, 12622, 13, 13, 5215, 278, 309, 29918, 4881, 408, 18696, 13, 13, 2277, 4803, 1319, 22663, 6745, 1475, 29901, 13, 1753, 22235, 29918, 3137, 29918, 2168, 29918, 1529, 29928, 29898, 29874, 29892, 9685, 29922, 8516, 1125, 13, 1678, 9995, 11609, 19194, 322, 19194, 8380, 29522, 310, 334, 29874, 29930, 313, 7052, 29881, 304, 4226, 467, 15945, 29908, 13, 1678, 1612, 29918, 791, 353, 7442, 29889, 2168, 713, 29898, 29874, 29892, 9685, 29922, 8990, 29897, 13, 1678, 4365, 29918, 2455, 353, 313, 29896, 29889, 29946, 29947, 29906, 29953, 29900, 29906, 29906, 29896, 29947, 334, 7442, 29889, 2168, 713, 29898, 9302, 29889, 6897, 29898, 29874, 448, 1612, 29918, 791, 511, 9685, 29922, 8990, 876, 13, 1678, 736, 313, 2168, 29918, 791, 29892, 4365, 29918, 2455, 29897, 13, 13, 2277, 3436, 713, 8380, 10995, 950, 29901, 13, 1753, 22235, 29918, 1529, 29934, 29898, 690, 333, 27101, 29892, 6287, 19790, 29922, 29896, 29889, 29946, 29947, 29906, 29953, 29900, 29906, 29906, 29896, 29947, 1125, 13, 1678, 9995, 11609, 19194, 8380, 10995, 950, 313, 1529, 29934, 29897, 310, 1881, 1409, 29889, 2648, 2322, 29892, 13, 1678, 278, 1121, 338, 6287, 29881, 304, 278, 4226, 4978, 1213, 15945, 13, 1678, 736, 6287, 19790, 334, 7442, 29889, 2168, 713, 29898, 9302, 29889, 6897, 29898, 690, 333, 27101, 876, 13, 13, 2277, 2683, 2683, 2683, 2683, 28400, 2277, 13, 2277, 2683, 489, 539, 10186, 456, 27184, 383, 5367, 313, 29945, 29899, 862, 29897, 539, 448, 9072, 5634, 2277, 13, 2277, 2683, 2683, 2683, 2683, 28400, 2277, 13, 13, 29918, 1718, 29907, 1660, 29907, 29918, 13171, 29918, 29934, 3035, 29902, 2190, 353, 29871, 29896, 29947, 29900, 29889, 334, 29871, 29941, 29953, 29900, 29900, 29889, 29900, 847, 7442, 29889, 1631, 13, 29918, 1529, 29903, 29918, 13171, 29918, 29934, 3035, 29902, 2190, 353, 903, 1718, 29907, 1660, 29907, 29918, 13171, 29918, 29934, 3035, 29902, 2190, 334, 29871, 29896, 29872, 29941, 13, 1990, 10186, 29943, 277, 29898, 3318, 1125, 13, 13, 1678, 9995, 13, 1678, 910, 3883, 8128, 8717, 456, 300, 2200, 28221, 2117, 3097, 29889, 2422, 635, 29892, 263, 13, 268, 29945, 29899, 15501, 1904, 338, 19949, 297, 263, 12655, 1409, 29889, 8011, 8118, 526, 29901, 13, 4706, 334, 18865, 313, 3665, 5834, 29897, 472, 3407, 21502, 305, 13, 4706, 334, 5012, 313, 3665, 5834, 29897, 472, 3407, 21502, 305, 13, 4706, 334, 26354, 4717, 313, 3665, 5834, 847, 343, 29878, 467, 518, 1366, 338, 26354, 4717, 29930, 847, 6776, 29898, 7099, 4638, 13, 4706, 334, 26354, 2287, 313, 3665, 5834, 847, 343, 29878, 29897, 13, 4706, 334, 610, 9864, 29916, 313, 3665, 5834, 29897, 13, 1678, 9995, 13, 13, 1678, 903, 26180, 29918, 29872, 561, 29918, 8149, 353, 6024, 26012, 1594, 29890, 742, 525, 29916, 742, 525, 29891, 742, 525, 29920, 2033, 13, 1678, 903, 26180, 29918, 1272, 29918, 8149, 353, 6024, 26012, 1594, 29890, 742, 525, 19811, 742, 525, 29881, 311, 742, 525, 26290, 29918, 29916, 742, 525, 26290, 29918, 29891, 742, 525, 26290, 29918, 29920, 2033, 13, 1678, 903, 559, 29883, 29918, 546, 29918, 3665, 29871, 353, 903, 1718, 29907, 1660, 29907, 29918, 13171, 29918, 29934, 3035, 29902, 2190, 13, 1678, 903, 8247, 29918, 546, 29918, 3665, 259, 353, 903, 1529, 29903, 29918, 13171, 29918, 29934, 3035, 29902, 2190, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 1583, 3032, 26012, 29918, 1594, 29890, 353, 6213, 13, 4706, 1583, 3032, 6008, 29918, 29891, 2288, 353, 6213, 13, 4706, 1583, 29889, 26290, 29918, 29872, 561, 353, 6213, 13, 4706, 1583, 29889, 999, 29918, 1594, 29890, 353, 6213, 13, 4706, 1583, 29889, 262, 27801, 353, 6213, 13, 4706, 1583, 29889, 29878, 7915, 353, 6213, 13, 4706, 1583, 3032, 275, 29918, 842, 353, 7700, 13, 4706, 1583, 3032, 305, 347, 26330, 353, 29871, 29906, 13, 4706, 1583, 3032, 3068, 29918, 1524, 403, 353, 7700, 13, 4706, 736, 13, 13, 1678, 822, 731, 29918, 735, 3296, 29898, 1311, 29892, 28869, 29922, 29906, 1125, 13, 4706, 9995, 13, 4706, 14542, 852, 28869, 1304, 297, 27368, 740, 313, 29940, 2400, 467, 450, 899, 369, 1074, 2039, 13, 4706, 304, 6260, 675, 278, 2533, 975, 848, 3291, 310, 29901, 13, 4706, 5135, 26290, 448, 1904, 29897, 847, 4589, 29897, 1068, 29940, 13, 4706, 9995, 13, 4706, 396, 29020, 405, 29922, 29906, 4010, 267, 763, 18168, 29899, 26613, 1965, 29889, 21605, 405, 29922, 29896, 6260, 7093, 3001, 13, 4706, 396, 23552, 29522, 13, 4706, 1583, 3032, 305, 347, 26330, 353, 28869, 13, 4706, 736, 13, 13, 1678, 396, 1753, 6230, 29898, 1311, 29892, 432, 29881, 29918, 1594, 29890, 29918, 999, 29892, 18865, 29918, 12163, 29892, 5012, 29918, 12163, 29892, 20881, 29918, 29872, 561, 29892, 29871, 13, 1678, 822, 6230, 29898, 1311, 29892, 848, 29892, 12560, 29918, 449, 27801, 29922, 5574, 29892, 13, 9651, 432, 29881, 29918, 1594, 29890, 29918, 999, 29922, 8516, 29892, 18865, 29918, 3127, 29922, 8516, 29892, 5012, 29918, 3127, 29922, 8516, 1125, 13, 4706, 1583, 3032, 275, 29918, 29878, 4518, 353, 7700, 13, 4706, 565, 451, 599, 4197, 275, 8758, 29898, 1272, 29961, 29916, 1402, 7442, 29889, 299, 2378, 29897, 320, 13, 18884, 363, 921, 297, 1583, 3032, 26180, 29918, 1272, 29918, 8149, 29962, 1125, 13, 9651, 10876, 29889, 303, 20405, 29889, 3539, 703, 797, 8835, 848, 731, 9903, 29876, 1159, 29871, 13, 9651, 10876, 29889, 303, 20405, 29889, 3539, 703, 19347, 4341, 3160, 3583, 29876, 1159, 13, 9651, 10876, 29889, 303, 20405, 29889, 3539, 703, 15110, 1273, 29879, 29905, 29876, 29908, 1273, 851, 29898, 1311, 3032, 26180, 29918, 1272, 29918, 8149, 876, 13, 9651, 736, 7700, 13, 4706, 1583, 3032, 449, 276, 29926, 353, 12560, 29918, 449, 27801, 13, 4706, 396, 361, 451, 599, 4197, 275, 8758, 29898, 26290, 29918, 29872, 561, 29961, 29916, 1402, 7442, 29889, 299, 2378, 29897, 320, 13, 4706, 396, 4706, 363, 921, 297, 1583, 3032, 26180, 29918, 29872, 561, 29918, 8149, 29962, 1125, 13, 4706, 396, 1678, 10876, 29889, 303, 20405, 29889, 3539, 703, 797, 8835, 321, 561, 25154, 275, 848, 9903, 29876, 1159, 29871, 13, 4706, 396, 1678, 10876, 29889, 303, 20405, 29889, 3539, 703, 19347, 4341, 3160, 3583, 29876, 1159, 13, 4706, 396, 1678, 10876, 29889, 303, 20405, 29889, 3539, 703, 15110, 1273, 29879, 29905, 29876, 29908, 1273, 851, 29898, 1311, 3032, 26180, 29918, 29872, 561, 29918, 8149, 876, 13, 4706, 396, 1678, 736, 7700, 13, 308, 13, 4706, 396, 1311, 29889, 262, 27801, 353, 7442, 29889, 2873, 29918, 4561, 29898, 4717, 29918, 12163, 29892, 26688, 2433, 11227, 1495, 13, 4706, 396, 1311, 29889, 29878, 7915, 353, 7442, 29889, 2873, 29918, 4561, 29898, 4717, 29918, 12163, 29897, 13, 4706, 1583, 29889, 262, 27801, 353, 7442, 29889, 2873, 29898, 2435, 29898, 1272, 511, 26688, 2433, 11227, 1495, 13, 4706, 1583, 29889, 29878, 7915, 353, 7442, 29889, 2873, 29898, 2435, 29898, 1272, 511, 26688, 2433, 7411, 1495, 13, 4706, 396, 1311, 29889, 26290, 29918, 29872, 561, 353, 1583, 3032, 2987, 358, 287, 29918, 29872, 561, 29898, 26290, 29918, 29872, 561, 29897, 13, 4706, 1583, 29889, 24713, 353, 7442, 29889, 8552, 29898, 1272, 29897, 13, 4706, 565, 432, 29881, 29918, 1594, 29890, 29918, 999, 29901, 13, 9651, 1583, 29889, 999, 29918, 1594, 29890, 353, 432, 29881, 29918, 1594, 29890, 29918, 999, 13, 4706, 1683, 29901, 13, 9651, 1583, 29889, 999, 29918, 1594, 29890, 353, 848, 1839, 26012, 1594, 29890, 2033, 29961, 29900, 29962, 13, 4706, 396, 1311, 29889, 999, 29918, 1594, 29890, 353, 432, 29881, 29918, 1594, 29890, 29918, 999, 13, 308, 13, 4706, 1583, 3032, 6008, 29918, 29891, 2288, 353, 313, 1311, 29889, 24713, 1839, 26012, 1594, 29890, 2033, 448, 1583, 29889, 999, 29918, 1594, 29890, 29897, 847, 29871, 29941, 29953, 29945, 29889, 29906, 29945, 13, 4706, 396, 1311, 3032, 4717, 29918, 3665, 353, 7442, 29889, 3665, 5834, 29898, 4717, 29918, 12163, 29897, 13, 4706, 396, 1311, 3032, 2287, 29918, 3665, 353, 7442, 29889, 3665, 5834, 29898, 2287, 29918, 12163, 29897, 13, 4706, 1583, 3032, 4717, 29918, 3665, 353, 7442, 29889, 3665, 5834, 29898, 1311, 29889, 24713, 1839, 19811, 11287, 13, 4706, 1583, 3032, 2287, 29918, 3665, 353, 7442, 29889, 3665, 5834, 29898, 1311, 29889, 24713, 1839, 29881, 311, 11287, 13, 4706, 396, 1311, 3032, 4717, 29918, 2168, 29892, 1583, 3032, 4717, 29918, 1529, 29928, 353, 22235, 29918, 3137, 29918, 2168, 29918, 1529, 29928, 29898, 1311, 3032, 4717, 29918, 3665, 29897, 13, 4706, 396, 1311, 3032, 2287, 29918, 2168, 29892, 1583, 3032, 2287, 29918, 1529, 29928, 353, 22235, 29918, 3137, 29918, 2168, 29918, 1529, 29928, 29898, 1311, 3032, 2287, 29918, 3665, 29897, 13, 4706, 396, 1311, 3032, 4717, 29918, 1529, 29928, 334, 29922, 7442, 29889, 3944, 29898, 1311, 3032, 2287, 29918, 2168, 29897, 13, 13, 4706, 1583, 3032, 4717, 29918, 3127, 353, 18865, 29918, 3127, 13, 4706, 1583, 3032, 2287, 29918, 3127, 353, 5012, 29918, 3127, 13, 4706, 1583, 3032, 26180, 29918, 690, 333, 29918, 12523, 353, 7700, 13, 4706, 565, 451, 338, 8758, 29898, 4717, 29918, 3127, 29892, 7442, 29889, 299, 2378, 1125, 13, 9651, 10876, 29889, 303, 20405, 29889, 3539, 703, 29956, 25614, 29901, 18865, 29918, 3127, 451, 2183, 29892, 773, 15899, 29905, 29876, 1159, 13, 9651, 1583, 3032, 26180, 29918, 690, 333, 29918, 12523, 353, 5852, 13, 4706, 565, 451, 338, 8758, 29898, 2287, 29918, 3127, 29892, 7442, 29889, 299, 2378, 1125, 13, 9651, 10876, 29889, 303, 20405, 29889, 3539, 703, 29956, 25614, 29901, 5012, 29918, 3127, 451, 2183, 29892, 773, 15899, 29905, 29876, 1159, 13, 9651, 1583, 3032, 26180, 29918, 690, 333, 29918, 12523, 353, 5852, 13, 308, 13, 4706, 396, 361, 338, 8758, 29898, 4717, 29918, 3127, 29892, 7442, 29889, 299, 2378, 1125, 13, 4706, 396, 1678, 1583, 3032, 4717, 29918, 3127, 353, 7442, 29889, 3665, 5834, 29898, 4717, 29918, 3127, 29897, 13, 4706, 396, 2870, 29901, 13, 4706, 396, 1678, 1583, 3032, 4717, 29918, 3127, 353, 1583, 3032, 4717, 29918, 1529, 29928, 13, 4706, 396, 361, 338, 8758, 29898, 2287, 29918, 3127, 29892, 7442, 29889, 299, 2378, 1125, 13, 4706, 396, 1678, 1583, 3032, 2287, 29918, 3127, 353, 7442, 29889, 3665, 5834, 29898, 2287, 29918, 3127, 29897, 13, 4706, 396, 2870, 29901, 13, 4706, 396, 1678, 1583, 3032, 2287, 29918, 3127, 353, 1583, 3032, 2287, 29918, 1529, 29928, 13, 4706, 396, 1311, 3032, 2287, 29918, 3127, 353, 7442, 29889, 3665, 5834, 29898, 2287, 29918, 3127, 29897, 565, 5012, 29918, 3127, 1683, 1583, 3032, 2287, 29918, 1529, 29928, 13, 4706, 1583, 3032, 275, 29918, 842, 353, 5852, 13, 4706, 1583, 3032, 3068, 29918, 1524, 403, 353, 7700, 13, 4706, 736, 5852, 13, 13, 1678, 396, 1753, 731, 29918, 999, 29918, 2230, 29898, 1311, 29892, 260, 29918, 999, 1125, 13, 1678, 396, 1678, 1583, 29889, 999, 29918, 2230, 353, 260, 29918, 999, 13, 1678, 396, 1678, 736, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 903, 28667, 29918, 862, 9864, 29916, 29918, 17028, 943, 29898, 4717, 29918, 3665, 29892, 5012, 29918, 3665, 29892, 1060, 29918, 585, 29892, 612, 29918, 585, 29892, 796, 29918, 585, 1125, 13, 4706, 9995, 20606, 29872, 610, 9864, 29916, 13879, 297, 15232, 23128, 29889, 450, 18865, 4163, 756, 29871, 13, 4706, 1063, 13931, 491, 6776, 29898, 7099, 29897, 577, 393, 372, 508, 367, 1304, 4153, 363, 13, 4706, 10995, 950, 6260, 2133, 1213, 15945, 13, 4706, 4457, 4717, 29892, 6776, 4717, 353, 7442, 29889, 5223, 29898, 4717, 29918, 3665, 511, 7442, 29889, 3944, 29898, 4717, 29918, 3665, 29897, 13, 4706, 4457, 2287, 29892, 6776, 2287, 353, 7442, 29889, 5223, 29898, 2287, 29918, 3665, 511, 7442, 29889, 3944, 29898, 2287, 29918, 3665, 29897, 13, 4706, 1153, 29918, 19790, 353, 313, 29990, 29918, 585, 334, 4457, 4717, 448, 612, 29918, 585, 334, 6776, 4717, 29897, 847, 6776, 2287, 13, 4706, 316, 29918, 19790, 353, 29871, 1060, 29918, 585, 334, 6776, 4717, 334, 4457, 2287, 320, 13, 462, 29871, 718, 29871, 612, 29918, 585, 334, 4457, 4717, 334, 4457, 2287, 320, 13, 462, 29871, 448, 29871, 796, 29918, 585, 334, 6776, 2287, 13, 4706, 736, 1153, 29918, 19790, 29892, 316, 29918, 19790, 13, 13, 1678, 396, 1753, 18696, 29918, 9202, 29918, 1111, 536, 29898, 1311, 29892, 931, 29918, 791, 29879, 29892, 1302, 29877, 29918, 791, 29879, 1125, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 18696, 29918, 9202, 29918, 336, 7099, 29918, 3358, 29898, 29873, 29918, 29891, 2288, 29892, 18865, 29918, 3665, 29892, 5012, 29918, 3665, 29892, 715, 29916, 29918, 294, 29922, 29900, 29892, 7688, 287, 29922, 8824, 1125, 13, 4706, 18696, 29918, 336, 29918, 4299, 353, 18696, 29889, 1220, 9202, 29898, 29873, 29918, 29891, 2288, 29892, 18865, 29918, 3665, 29892, 7688, 287, 29922, 7915, 287, 29897, 13, 4706, 18696, 29918, 311, 29918, 4299, 353, 18696, 29889, 1220, 9202, 29898, 29873, 29918, 29891, 2288, 29892, 5012, 29918, 3665, 29892, 7688, 287, 29922, 7915, 287, 29897, 13, 4706, 736, 7442, 29889, 2378, 4197, 1372, 29918, 336, 29918, 4299, 29961, 29900, 1402, 18696, 29918, 311, 29918, 4299, 29961, 29900, 1402, 13, 18884, 18696, 29918, 336, 29918, 4299, 29961, 29896, 1402, 18696, 29918, 311, 29918, 4299, 29961, 29896, 1402, 715, 29916, 29918, 294, 2314, 13, 13, 1678, 822, 20295, 29918, 336, 7099, 29898, 1311, 29892, 260, 29918, 999, 29892, 8717, 456, 29918, 862, 29879, 29892, 321, 561, 29918, 26290, 1125, 13, 4706, 9995, 13, 4706, 260, 29918, 999, 539, 1192, 29871, 10434, 3407, 21502, 305, 13, 4706, 8717, 456, 29918, 862, 29879, 1192, 29871, 5320, 8717, 456, 300, 2200, 4128, 6790, 472, 278, 13, 462, 4706, 3407, 21502, 305, 29901, 2099, 4717, 313, 3665, 511, 2099, 2287, 313, 3665, 511, 13, 462, 4706, 26354, 4717, 29930, 3944, 29898, 2287, 511, 26354, 2287, 29892, 322, 610, 9864, 29916, 13, 4706, 321, 561, 29918, 26290, 268, 1192, 29871, 9657, 411, 921, 29892, 29891, 29892, 29920, 29892, 29873, 3161, 20766, 278, 3064, 13, 462, 4706, 322, 7600, 310, 13917, 313, 23749, 7049, 29897, 13, 4706, 15842, 405, 9806, 29892, 5251, 13, 462, 1678, 518, 29873, 29918, 999, 29962, 353, 435, 29928, 313, 29911, 4051, 29897, 13, 462, 1678, 518, 29873, 29962, 268, 353, 435, 29928, 313, 29911, 4051, 29897, 13, 462, 1678, 518, 862, 29879, 29962, 29871, 353, 2971, 29892, 2971, 29892, 15232, 3471, 29914, 4316, 29892, 15232, 3471, 29914, 4316, 29892, 15232, 3471, 13, 462, 462, 539, 334, 1217, 6776, 29898, 29881, 11877, 13, 4706, 9995, 13, 268, 13, 4706, 364, 336, 29892, 364, 311, 29892, 26354, 336, 29892, 26354, 311, 29892, 544, 29880, 29916, 353, 8717, 456, 29918, 862, 29879, 13, 268, 13, 4706, 260, 29918, 12765, 29918, 4316, 353, 313, 29872, 561, 29918, 26290, 1839, 29873, 2033, 448, 260, 29918, 999, 29897, 847, 29871, 29941, 29953, 29945, 29889, 29906, 29945, 268, 396, 10340, 310, 2440, 13, 268, 13, 4706, 282, 20910, 29892, 282, 29888, 311, 353, 1583, 3032, 28667, 29918, 862, 9864, 29916, 29918, 17028, 943, 29898, 29878, 336, 29892, 364, 311, 29892, 13, 18884, 321, 561, 29918, 26290, 1839, 29916, 7464, 321, 561, 29918, 26290, 1839, 29891, 7464, 321, 561, 29918, 26290, 1839, 29920, 11287, 13, 268, 13, 4706, 19471, 29918, 336, 353, 313, 29873, 29918, 12765, 29918, 4316, 334, 26354, 336, 718, 544, 29880, 29916, 334, 282, 20910, 29897, 13, 4706, 19471, 29918, 311, 353, 313, 29873, 29918, 12765, 29918, 4316, 334, 26354, 311, 718, 544, 29880, 29916, 334, 282, 29888, 311, 29897, 13, 268, 13, 4706, 736, 313, 29878, 336, 718, 19471, 29918, 336, 29892, 364, 311, 718, 19471, 29918, 311, 29897, 13, 13, 1678, 822, 19745, 29918, 4299, 29898, 1311, 29892, 8636, 1125, 13, 4706, 736, 1583, 3032, 2929, 369, 29918, 14513, 29898, 7529, 29897, 13, 1678, 396, 1753, 19745, 29918, 4299, 29898, 1311, 29892, 8636, 1125, 13, 1678, 396, 1678, 364, 336, 29892, 364, 311, 29892, 26354, 336, 29892, 26354, 311, 29892, 544, 29880, 29916, 353, 8636, 13, 1678, 396, 1678, 282, 20910, 29892, 282, 29888, 311, 353, 1583, 3032, 28667, 29918, 862, 9864, 29916, 29918, 17028, 943, 29898, 29878, 336, 29892, 364, 311, 29892, 13, 1678, 396, 9651, 1583, 29889, 24713, 1839, 26290, 29918, 29916, 7464, 1583, 29889, 24713, 1839, 26290, 29918, 29891, 7464, 13, 1678, 396, 9651, 1583, 29889, 24713, 1839, 26290, 29918, 29920, 11287, 13, 1678, 396, 1678, 19471, 29918, 336, 353, 1583, 3032, 6008, 29918, 29891, 2288, 334, 26354, 336, 718, 544, 29880, 29916, 334, 282, 20910, 13, 1678, 396, 1678, 19471, 29918, 311, 353, 1583, 3032, 6008, 29918, 29891, 2288, 334, 26354, 311, 718, 544, 29880, 29916, 334, 282, 29888, 311, 13, 1678, 396, 1678, 736, 313, 29878, 336, 718, 19471, 29918, 336, 29892, 364, 311, 718, 19471, 29918, 311, 29897, 13, 13, 1678, 822, 903, 2929, 369, 29918, 14513, 29898, 1311, 29892, 8636, 1125, 13, 4706, 364, 336, 29892, 364, 311, 29892, 26354, 336, 29892, 26354, 311, 29892, 544, 29880, 29916, 353, 8636, 13, 4706, 282, 20910, 29892, 282, 29888, 311, 353, 1583, 3032, 28667, 29918, 862, 9864, 29916, 29918, 17028, 943, 29898, 29878, 336, 29892, 364, 311, 29892, 13, 18884, 1583, 29889, 24713, 1839, 26290, 29918, 29916, 7464, 1583, 29889, 24713, 1839, 26290, 29918, 29891, 7464, 13, 18884, 1583, 29889, 24713, 1839, 26290, 29918, 29920, 11287, 13, 4706, 19471, 29918, 336, 353, 1583, 3032, 6008, 29918, 29891, 2288, 334, 26354, 336, 718, 544, 29880, 29916, 334, 282, 20910, 13, 4706, 19471, 29918, 311, 353, 1583, 3032, 6008, 29918, 29891, 2288, 334, 26354, 311, 718, 544, 29880, 29916, 334, 282, 29888, 311, 13, 4706, 396, 4181, 29918, 336, 353, 1583, 3032, 6008, 29918, 29891, 2288, 334, 26354, 336, 448, 544, 29880, 29916, 334, 282, 20910, 13, 4706, 396, 4181, 29918, 311, 353, 1583, 3032, 6008, 29918, 29891, 2288, 334, 26354, 311, 448, 544, 29880, 29916, 334, 282, 29888, 311, 13, 4706, 736, 313, 29878, 336, 718, 19471, 29918, 336, 29892, 364, 311, 718, 19471, 29918, 311, 29897, 13, 13, 1678, 822, 903, 28667, 29918, 336, 7099, 29918, 690, 333, 27101, 29898, 1311, 29892, 8636, 1125, 13, 4706, 1904, 29918, 4717, 29892, 1904, 29918, 2287, 353, 1583, 3032, 2929, 369, 29918, 14513, 29898, 7529, 29897, 13, 4706, 736, 313, 1311, 3032, 4717, 29918, 3665, 448, 1904, 29918, 4717, 29892, 1583, 3032, 2287, 29918, 3665, 448, 1904, 29918, 2287, 29897, 13, 13, 1678, 822, 903, 28667, 29918, 336, 7099, 29918, 690, 333, 27101, 29918, 3754, 29898, 1311, 29892, 8636, 1125, 13, 4706, 1904, 29918, 4717, 29892, 1904, 29918, 2287, 353, 1583, 3032, 2929, 369, 29918, 14513, 29898, 7529, 29897, 13, 4706, 396, 2288, 23379, 29918, 4717, 353, 313, 1311, 3032, 4717, 29918, 3665, 448, 1904, 29918, 4717, 29897, 847, 1583, 3032, 4717, 29918, 3127, 13, 4706, 396, 2288, 23379, 29918, 2287, 353, 313, 1311, 3032, 2287, 29918, 3665, 448, 1904, 29918, 2287, 29897, 847, 1583, 3032, 2287, 29918, 3127, 13, 4706, 364, 18816, 29879, 29918, 4717, 353, 313, 1311, 3032, 4717, 29918, 3665, 448, 1904, 29918, 4717, 29897, 847, 1583, 3032, 1509, 29918, 4717, 29918, 3127, 13, 4706, 364, 18816, 29879, 29918, 2287, 353, 313, 1311, 3032, 2287, 29918, 3665, 448, 1904, 29918, 2287, 29897, 847, 1583, 3032, 1509, 29918, 2287, 29918, 3127, 13, 4706, 736, 364, 18816, 29879, 29918, 4717, 29892, 364, 18816, 29879, 29918, 2287, 13, 13, 1678, 822, 903, 28667, 29918, 7827, 29918, 690, 333, 27101, 29918, 3754, 29898, 1311, 29892, 8636, 1125, 13, 4706, 736, 7442, 29889, 29882, 1478, 327, 10456, 1311, 3032, 28667, 29918, 336, 7099, 29918, 690, 333, 27101, 29918, 3754, 29898, 7529, 876, 13, 13, 1678, 822, 903, 28667, 29918, 4161, 29918, 17619, 29898, 1311, 29892, 8636, 29892, 3480, 572, 29916, 27342, 29922, 29896, 29900, 29900, 9575, 13, 4706, 1904, 29918, 336, 29892, 1904, 29918, 311, 353, 1583, 3032, 2929, 369, 29918, 14513, 29898, 7529, 29897, 13, 4706, 396, 690, 333, 29918, 336, 353, 313, 4299, 29918, 336, 448, 1583, 3032, 4717, 29918, 3665, 29897, 396, 29914, 7442, 29889, 3944, 29898, 4299, 29918, 311, 29897, 13, 4706, 396, 690, 333, 29918, 311, 353, 313, 4299, 29918, 311, 448, 1583, 3032, 2287, 29918, 3665, 29897, 13, 4706, 10995, 29918, 336, 353, 313, 1311, 3032, 4717, 29918, 3665, 448, 1904, 29918, 336, 29897, 396, 29914, 7442, 29889, 3944, 29898, 4299, 29918, 311, 29897, 13, 4706, 10995, 29918, 311, 353, 313, 1311, 3032, 2287, 29918, 3665, 448, 1904, 29918, 311, 29897, 13, 4706, 396, 690, 333, 29918, 336, 353, 313, 4299, 29918, 336, 448, 1583, 3032, 4717, 29918, 3665, 29897, 847, 1583, 3032, 4717, 29918, 3127, 13, 4706, 396, 690, 333, 29918, 311, 353, 313, 4299, 29918, 311, 448, 1583, 3032, 2287, 29918, 3665, 29897, 847, 1583, 3032, 2287, 29918, 3127, 13, 4706, 396, 361, 338, 8758, 29898, 1311, 3032, 4717, 29918, 3127, 29892, 7442, 29889, 299, 2378, 1125, 13, 4706, 396, 1678, 10995, 29918, 336, 847, 29922, 1583, 3032, 4717, 29918, 3127, 13, 4706, 396, 361, 338, 8758, 29898, 1311, 3032, 2287, 29918, 3127, 29892, 7442, 29889, 299, 2378, 1125, 13, 4706, 396, 1678, 10995, 29918, 311, 847, 29922, 1583, 3032, 2287, 29918, 3127, 13, 4706, 565, 338, 8758, 29898, 1311, 3032, 1509, 29918, 4717, 29918, 3127, 29892, 7442, 29889, 299, 2378, 1125, 13, 9651, 10995, 29918, 336, 847, 29922, 1583, 3032, 1509, 29918, 4717, 29918, 3127, 13, 4706, 565, 338, 8758, 29898, 1311, 3032, 1509, 29918, 2287, 29918, 3127, 29892, 7442, 29889, 299, 2378, 1125, 13, 9651, 10995, 29918, 311, 847, 29922, 1583, 3032, 1509, 29918, 2287, 29918, 3127, 13, 4706, 396, 2457, 7442, 29889, 2083, 29898, 9302, 29889, 29882, 1478, 327, 29898, 690, 333, 29918, 336, 29892, 10995, 29918, 311, 876, 13, 4706, 396, 2457, 7442, 29889, 2083, 29898, 9302, 29889, 29882, 1478, 327, 29898, 690, 333, 29918, 336, 29892, 10995, 29918, 311, 29897, 1068, 29906, 29897, 13, 4706, 10995, 29918, 4260, 353, 7442, 29889, 29882, 1478, 327, 29898, 690, 333, 29918, 336, 29892, 10995, 29918, 311, 9601, 1311, 29889, 262, 27801, 29962, 13, 4706, 565, 313, 7529, 29961, 29946, 29962, 529, 29871, 29900, 29889, 29900, 1125, 13, 9651, 10995, 29918, 4260, 334, 29922, 3480, 572, 29916, 27342, 13, 4706, 736, 7442, 29889, 2083, 29898, 690, 333, 29918, 4260, 1068, 1311, 3032, 305, 347, 26330, 29897, 13, 4706, 396, 2457, 7442, 29889, 2083, 29898, 9302, 29889, 29882, 1478, 327, 29898, 690, 333, 29918, 336, 29892, 10995, 29918, 311, 29897, 1068, 1311, 3032, 305, 347, 26330, 29897, 13, 4706, 396, 2457, 7442, 29889, 2083, 29898, 9302, 29889, 6897, 29898, 690, 333, 29918, 336, 334, 10995, 29918, 311, 29897, 1068, 1311, 3032, 305, 347, 26330, 29897, 13, 13, 1678, 822, 903, 28667, 29918, 11228, 29918, 862, 9864, 29916, 29898, 1311, 29892, 8636, 1125, 13, 4706, 364, 336, 29918, 690, 333, 29892, 364, 311, 29918, 690, 333, 353, 1583, 3032, 28667, 29918, 336, 7099, 29918, 690, 333, 27101, 29898, 7529, 29897, 13, 4706, 1766, 29918, 336, 29918, 3665, 353, 22235, 29918, 1529, 29934, 29898, 29878, 336, 29918, 690, 333, 29897, 13, 4706, 1766, 29918, 336, 29918, 8247, 353, 903, 1529, 29903, 29918, 13171, 29918, 29934, 3035, 29902, 2190, 334, 1766, 29918, 336, 29918, 3665, 13, 4706, 10876, 29889, 303, 20405, 29889, 3539, 703, 3034, 29918, 336, 29918, 3665, 29901, 1273, 29888, 29905, 29876, 29908, 1273, 1766, 29918, 336, 29918, 3665, 29897, 13, 4706, 10876, 29889, 303, 20405, 29889, 3539, 703, 3034, 29918, 336, 29918, 8247, 29901, 1273, 29888, 29905, 29876, 29908, 1273, 1766, 29918, 336, 29918, 8247, 29897, 13, 4706, 282, 20910, 29892, 282, 29888, 311, 353, 1583, 3032, 28667, 29918, 862, 9864, 29916, 29918, 17028, 943, 29898, 13, 18884, 1583, 3032, 4717, 29918, 3665, 29892, 1583, 3032, 2287, 29918, 3665, 29892, 1583, 29889, 24713, 1839, 26290, 29918, 29916, 7464, 13, 18884, 1583, 29889, 24713, 1839, 26290, 29918, 29891, 7464, 1583, 29889, 24713, 1839, 26290, 29918, 29920, 11287, 13, 4706, 396, 9675, 29889, 303, 20405, 29889, 3539, 703, 7810, 336, 29918, 5666, 3471, 29901, 1273, 29879, 29905, 29876, 29908, 1273, 851, 29898, 7810, 336, 29918, 5666, 3471, 876, 13, 4706, 396, 7810, 336, 29918, 3665, 259, 353, 282, 20910, 29918, 5666, 3471, 847, 903, 1718, 29907, 1660, 29907, 29918, 13171, 29918, 29934, 3035, 29902, 2190, 13, 4706, 10365, 358, 29918, 5666, 3471, 353, 18696, 29889, 1220, 9202, 29898, 7810, 336, 29892, 903, 1718, 29907, 1660, 29907, 29918, 13171, 29918, 29934, 3035, 29902, 2190, 334, 364, 336, 29918, 690, 333, 29897, 13, 4706, 10876, 29889, 303, 20405, 29889, 3539, 703, 328, 5143, 358, 313, 5666, 3471, 1125, 1273, 29879, 29905, 29876, 29908, 1273, 851, 29898, 328, 5143, 358, 29918, 5666, 3471, 876, 13, 4706, 736, 10365, 358, 29918, 5666, 3471, 13, 13, 1678, 396, 26391, 26529, 363, 29871, 29945, 29899, 15501, 8717, 456, 300, 2200, 28221, 29901, 13, 1678, 822, 6216, 29918, 13318, 862, 29879, 29898, 1311, 29892, 4365, 7582, 29922, 29945, 1125, 13, 4706, 565, 451, 1583, 3032, 275, 29918, 842, 29901, 13, 9651, 10876, 29889, 303, 20405, 29889, 3539, 703, 2392, 29901, 848, 451, 9280, 363, 28221, 9903, 29876, 1159, 13, 9651, 10876, 29889, 303, 20405, 29889, 3539, 703, 6558, 6230, 580, 937, 322, 337, 2202, 2023, 29905, 29876, 1159, 13, 9651, 736, 7700, 13, 13, 4706, 396, 16424, 2847, 4140, 411, 450, 309, 29899, 29903, 264, 29901, 13, 4706, 318, 2543, 404, 353, 1583, 29889, 1372, 29918, 9202, 29918, 336, 7099, 29918, 3358, 29898, 1311, 3032, 6008, 29918, 29891, 2288, 29892, 1583, 3032, 4717, 29918, 3665, 29892, 1583, 3032, 2287, 29918, 3665, 29897, 13, 4706, 281, 2543, 404, 353, 1583, 29889, 1372, 29918, 9202, 29918, 336, 7099, 29918, 3358, 29898, 1311, 3032, 6008, 29918, 29891, 2288, 29892, 1583, 3032, 4717, 29918, 3665, 29892, 1583, 3032, 2287, 29918, 3665, 29892, 13, 18884, 7688, 287, 29922, 5574, 29897, 13, 4706, 396, 9675, 29889, 303, 20405, 29889, 3539, 703, 15514, 4140, 29901, 1273, 29879, 29905, 29876, 29908, 1273, 851, 29898, 2543, 404, 876, 13, 4706, 10876, 29889, 303, 20405, 29889, 3539, 703, 15514, 4140, 313, 348, 7915, 287, 1125, 29905, 29876, 1159, 13, 4706, 10876, 29889, 303, 20405, 29889, 3539, 703, 1360, 29958, 1273, 29879, 29905, 29876, 29908, 1273, 851, 29898, 1311, 29889, 16533, 29918, 348, 1169, 29898, 688, 29884, 404, 4961, 13, 4706, 10876, 29889, 303, 20405, 29889, 3539, 14182, 29876, 1159, 13, 4706, 10876, 29889, 303, 20405, 29889, 3539, 703, 15514, 4140, 313, 7915, 287, 1125, 29905, 29876, 1159, 13, 4706, 10876, 29889, 303, 20405, 29889, 3539, 703, 1360, 29958, 1273, 29879, 29905, 29876, 29908, 1273, 851, 29898, 1311, 29889, 16533, 29918, 348, 1169, 29898, 29893, 2543, 404, 4961, 13, 4706, 10876, 29889, 303, 20405, 29889, 3539, 14182, 29876, 1159, 13, 4706, 4140, 353, 318, 2543, 404, 29871, 396, 9332, 443, 7915, 287, 363, 1286, 13, 4706, 396, 2543, 404, 29961, 29946, 29962, 353, 29871, 29896, 29900, 29900, 29900, 29889, 847, 903, 1529, 29903, 29918, 13171, 29918, 29934, 3035, 29902, 2190, 13, 13, 4706, 396, 2847, 26755, 472, 610, 9864, 29916, 322, 5225, 29899, 3149, 29901, 13, 4706, 8879, 1148, 3634, 353, 1583, 3032, 28667, 29918, 11228, 29918, 862, 9864, 29916, 29898, 2543, 404, 29897, 13, 4706, 10876, 29889, 303, 20405, 29889, 3539, 703, 827, 1148, 3634, 29901, 1273, 29879, 29905, 29876, 29908, 1273, 851, 29898, 827, 1148, 3634, 876, 13, 4706, 1583, 29889, 827, 1148, 3634, 353, 8879, 1148, 3634, 13, 4706, 1153, 29918, 29876, 566, 479, 29918, 3665, 29892, 715, 29916, 29918, 3665, 353, 8879, 1148, 3634, 847, 903, 1718, 29907, 1660, 29907, 29918, 13171, 29918, 29934, 3035, 29902, 2190, 13, 4706, 4140, 29961, 29900, 29962, 4619, 1153, 29918, 29876, 566, 479, 29918, 3665, 13, 4706, 4140, 29961, 29946, 29962, 353, 715, 29916, 29918, 3665, 13, 13, 4706, 396, 12678, 18865, 29892, 6185, 25812, 515, 10995, 27101, 565, 451, 2998, 263, 7536, 29901, 13, 4706, 565, 1583, 3032, 26180, 29918, 690, 333, 29918, 12523, 29901, 13, 9651, 364, 336, 29918, 690, 333, 29892, 364, 311, 29918, 690, 333, 353, 1583, 3032, 28667, 29918, 336, 7099, 29918, 690, 333, 27101, 29898, 2543, 404, 29897, 13, 9651, 364, 336, 29918, 1557, 2620, 353, 22235, 29918, 1529, 29934, 29898, 29878, 336, 29918, 690, 333, 29897, 13, 9651, 364, 311, 29918, 1557, 2620, 353, 22235, 29918, 1529, 29934, 29898, 29878, 311, 29918, 690, 333, 29897, 13, 9651, 286, 336, 29918, 1557, 2620, 353, 903, 1529, 29903, 29918, 13171, 29918, 29934, 3035, 29902, 2190, 334, 364, 336, 29918, 1557, 2620, 13, 9651, 286, 311, 29918, 1557, 2620, 353, 903, 1529, 29903, 29918, 13171, 29918, 29934, 3035, 29902, 2190, 334, 364, 311, 29918, 1557, 2620, 13, 9651, 396, 9675, 29889, 303, 20405, 29889, 3539, 703, 29878, 336, 29918, 690, 333, 29901, 1273, 29879, 29905, 29876, 29908, 1273, 851, 29898, 29878, 336, 29918, 690, 333, 876, 13, 9651, 396, 9675, 29889, 303, 20405, 29889, 3539, 703, 29878, 311, 29918, 690, 333, 29901, 1273, 29879, 29905, 29876, 29908, 1273, 851, 29898, 29878, 311, 29918, 690, 333, 876, 13, 9651, 10876, 29889, 303, 20405, 29889, 3539, 703, 29878, 336, 29918, 1557, 2620, 29901, 1273, 29872, 313, 3665, 2144, 29876, 29908, 1273, 364, 336, 29918, 1557, 2620, 29897, 13, 9651, 10876, 29889, 303, 20405, 29889, 3539, 703, 29878, 311, 29918, 1557, 2620, 29901, 1273, 29872, 313, 3665, 2144, 29876, 29908, 1273, 364, 311, 29918, 1557, 2620, 29897, 13, 9651, 10876, 29889, 303, 20405, 29889, 3539, 703, 29885, 336, 29918, 1557, 2620, 29901, 1273, 29896, 29900, 29889, 29945, 29888, 313, 8247, 2144, 29876, 29908, 1273, 286, 336, 29918, 1557, 2620, 29897, 13, 9651, 10876, 29889, 303, 20405, 29889, 3539, 703, 29885, 311, 29918, 1557, 2620, 29901, 1273, 29896, 29900, 29889, 29945, 29888, 313, 8247, 2144, 29876, 29908, 1273, 286, 311, 29918, 1557, 2620, 29897, 13, 9651, 1583, 3032, 4717, 29918, 3127, 353, 7442, 29889, 2873, 29918, 4561, 29898, 1311, 3032, 4717, 29918, 3665, 29897, 334, 364, 336, 29918, 1557, 2620, 13, 9651, 1583, 3032, 2287, 29918, 3127, 353, 7442, 29889, 2873, 29918, 4561, 29898, 1311, 3032, 2287, 29918, 3665, 29897, 334, 364, 311, 29918, 1557, 2620, 13, 4706, 1583, 3032, 1509, 29918, 4717, 29918, 3127, 353, 7442, 29889, 8552, 29898, 1311, 3032, 4717, 29918, 3127, 29897, 13, 4706, 1583, 3032, 1509, 29918, 2287, 29918, 3127, 353, 7442, 29889, 8552, 29898, 1311, 3032, 2287, 29918, 3127, 29897, 13, 13, 4706, 396, 1423, 3692, 3099, 3430, 2289, 4319, 29901, 13, 4706, 1583, 3032, 862, 29918, 2543, 404, 353, 4140, 13, 4706, 396, 2288, 335, 29918, 4260, 353, 7442, 29889, 29882, 1478, 327, 10456, 1311, 3032, 28667, 29918, 336, 7099, 29918, 690, 333, 27101, 29918, 3754, 29898, 2543, 404, 876, 13, 4706, 364, 18816, 29918, 4260, 353, 1583, 3032, 28667, 29918, 7827, 29918, 690, 333, 27101, 29918, 3754, 29898, 2543, 404, 29897, 13, 4706, 396, 9675, 29889, 303, 20405, 29889, 3539, 703, 2288, 335, 29918, 4260, 3583, 29876, 1159, 13, 4706, 396, 9675, 29889, 303, 20405, 29889, 3539, 11702, 29879, 29905, 29876, 29908, 1273, 851, 29898, 2288, 335, 29918, 4260, 876, 13, 4706, 10876, 29889, 303, 20405, 29889, 3539, 703, 22449, 936, 364, 18816, 29918, 4260, 29901, 1273, 29947, 29889, 29941, 29888, 29905, 29876, 29908, 1273, 7442, 29889, 2168, 713, 29898, 2288, 335, 29918, 4260, 876, 13, 4706, 396, 9675, 29889, 303, 20405, 29889, 3539, 703, 2288, 335, 29918, 4260, 29901, 1273, 29879, 29905, 29876, 29908, 1273, 851, 29898, 2288, 335, 29918, 4260, 876, 13, 4706, 1583, 29889, 262, 27801, 353, 313, 2288, 335, 29918, 4260, 529, 4365, 7582, 29897, 13, 308, 299, 307, 2986, 353, 1583, 29889, 262, 27801, 29889, 2311, 448, 7442, 29889, 2083, 29898, 1311, 29889, 262, 27801, 29897, 13, 4706, 10876, 29889, 303, 20405, 29889, 3539, 703, 29928, 307, 2986, 1273, 29881, 1298, 29898, 29879, 29897, 8724, 18695, 29906, 29888, 29899, 3754, 7790, 29876, 29908, 13, 18884, 1273, 313, 299, 307, 2986, 29892, 4365, 7582, 876, 13, 4706, 396, 9675, 29889, 303, 20405, 29889, 3539, 703, 336, 29918, 690, 29901, 1273, 29879, 29905, 29876, 29908, 1273, 851, 29898, 336, 29918, 690, 876, 13, 4706, 396, 9675, 29889, 303, 20405, 29889, 3539, 703, 311, 29918, 690, 29901, 1273, 29879, 29905, 29876, 29908, 1273, 851, 29898, 311, 29918, 690, 876, 13, 4706, 396, 9675, 29889, 303, 20405, 29889, 3539, 703, 336, 29918, 18816, 29901, 1273, 29879, 29905, 29876, 29908, 1273, 851, 29898, 336, 29918, 18816, 876, 13, 4706, 396, 9675, 29889, 303, 20405, 29889, 3539, 703, 311, 29918, 18816, 29901, 1273, 29879, 29905, 29876, 29908, 1273, 851, 29898, 311, 29918, 18816, 876, 13, 29871, 13, 13, 4706, 396, 1284, 9212, 29901, 13, 4706, 1583, 29889, 8159, 29918, 2914, 353, 3523, 29875, 29889, 29888, 1195, 29898, 1311, 3032, 28667, 29918, 4161, 29918, 17619, 29892, 4140, 29892, 29871, 13, 462, 486, 324, 29922, 29896, 29872, 29899, 29955, 29892, 11791, 324, 29922, 29896, 29872, 29899, 29955, 29892, 2989, 29918, 4905, 29922, 5574, 29897, 13, 18884, 396, 486, 324, 29922, 29896, 29872, 29899, 29929, 29892, 11791, 324, 29922, 29896, 29872, 29899, 29929, 29892, 2989, 29918, 4905, 29922, 5574, 29897, 13, 4706, 1583, 29889, 2914, 353, 1583, 29889, 8159, 29918, 2914, 29961, 29900, 29962, 13, 13, 4706, 396, 1506, 1082, 29899, 10118, 9212, 29901, 13, 4706, 396, 336, 29918, 29888, 566, 479, 353, 7442, 29889, 2168, 713, 29898, 1311, 3032, 4717, 29918, 3127, 29897, 13, 4706, 396, 311, 29918, 29888, 566, 479, 353, 7442, 29889, 2168, 713, 29898, 1311, 3032, 2287, 29918, 3127, 29897, 13, 4706, 396, 3358, 29918, 29888, 566, 479, 353, 29871, 29900, 29889, 29906, 13, 4706, 396, 1756, 29918, 29888, 566, 479, 353, 29871, 29946, 29889, 29900, 13, 4706, 396, 29878, 6916, 353, 17288, 2543, 404, 29961, 29900, 29962, 448, 1153, 29918, 29888, 566, 479, 29892, 4140, 29961, 29900, 29962, 718, 1153, 29918, 29888, 566, 479, 511, 259, 396, 18865, 13, 4706, 396, 3986, 313, 2543, 404, 29961, 29896, 29962, 448, 316, 29918, 29888, 566, 479, 29892, 4140, 29961, 29896, 29962, 718, 316, 29918, 29888, 566, 479, 511, 259, 396, 5012, 13, 4706, 396, 3986, 313, 2543, 404, 29961, 29906, 29962, 847, 26354, 29918, 29888, 566, 479, 29892, 4140, 29961, 29906, 29962, 334, 26354, 29918, 29888, 566, 479, 511, 259, 396, 26354, 4717, 13, 4706, 396, 3986, 313, 2543, 404, 29961, 29941, 29962, 847, 26354, 29918, 29888, 566, 479, 29892, 4140, 29961, 29941, 29962, 334, 26354, 29918, 29888, 566, 479, 511, 259, 396, 26354, 4717, 13, 4706, 396, 3986, 313, 2543, 404, 29961, 29946, 29962, 847, 282, 29916, 29918, 29888, 566, 479, 29892, 4140, 29961, 29941, 29962, 334, 282, 29916, 29918, 29888, 566, 479, 511, 259, 396, 610, 9864, 29916, 13, 4706, 396, 3986, 4514, 13, 4706, 396, 29876, 16485, 353, 29871, 29896, 29900, 13, 4706, 396, 1311, 29889, 2914, 353, 3523, 29875, 29889, 1182, 1082, 29898, 1311, 3032, 28667, 29918, 4161, 29918, 17619, 29892, 20238, 29892, 405, 29879, 29922, 29876, 16485, 29897, 13, 13, 4706, 10876, 29889, 303, 20405, 29889, 3539, 703, 9692, 9212, 3583, 29876, 1159, 13, 4706, 10876, 29889, 303, 20405, 29889, 3539, 703, 1360, 29958, 1273, 29879, 29905, 29876, 29908, 1273, 851, 29898, 1311, 29889, 16533, 29918, 348, 1169, 29898, 1311, 29889, 2914, 4961, 13, 4706, 1583, 3032, 3068, 29918, 1524, 403, 353, 5852, 13, 4706, 736, 1583, 29889, 2914, 13, 29871, 13, 1678, 396, 448, 2683, 2683, 2683, 2683, 22158, 29871, 13, 1678, 822, 903, 28667, 29918, 29882, 11234, 29918, 29878, 705, 5861, 29898, 1311, 29892, 10995, 27101, 29892, 269, 2934, 1125, 13, 4706, 903, 29895, 29918, 18816, 353, 29871, 29896, 29889, 29941, 29946, 334, 269, 2934, 13, 4706, 620, 29918, 3359, 29879, 353, 7442, 29889, 6897, 29898, 690, 333, 27101, 847, 903, 29895, 29918, 18816, 29897, 13, 4706, 364, 705, 5861, 353, 7442, 29889, 2873, 29918, 4561, 29898, 690, 29918, 3359, 29879, 29897, 13, 4706, 1320, 1934, 353, 313, 690, 29918, 3359, 29879, 1405, 29871, 29896, 29889, 29900, 29897, 13, 4706, 364, 705, 5861, 29961, 5721, 1934, 29962, 353, 29871, 29896, 29889, 29900, 847, 620, 29918, 3359, 29879, 29961, 5721, 1934, 29962, 13, 4706, 736, 364, 705, 5861, 13, 13, 1678, 822, 4256, 29918, 5504, 29918, 13318, 862, 29879, 29898, 1311, 29892, 8636, 1125, 13, 4706, 9995, 5894, 689, 385, 306, 2241, 29903, 12541, 1213, 15945, 13, 13, 4706, 396, 8147, 10995, 27101, 29901, 13, 4706, 364, 336, 29918, 690, 333, 29892, 364, 311, 29918, 690, 333, 353, 1583, 3032, 28667, 29918, 336, 7099, 29918, 690, 333, 27101, 29898, 7529, 29897, 13, 4706, 396, 9675, 29889, 303, 20405, 29889, 3539, 703, 29878, 336, 29918, 690, 333, 29901, 1273, 29879, 29905, 29876, 29908, 1273, 851, 29898, 29878, 336, 29918, 690, 333, 876, 13, 4706, 396, 9675, 29889, 303, 20405, 29889, 3539, 703, 29878, 311, 29918, 690, 333, 29901, 1273, 29879, 29905, 29876, 29908, 1273, 851, 29898, 29878, 311, 29918, 690, 333, 876, 13, 4706, 364, 336, 29918, 1557, 2620, 353, 22235, 29918, 1529, 29934, 29898, 29878, 336, 29918, 690, 333, 29897, 13, 4706, 364, 311, 29918, 1557, 2620, 353, 22235, 29918, 1529, 29934, 29898, 29878, 311, 29918, 690, 333, 29897, 13, 4706, 396, 9675, 29889, 303, 20405, 29889, 3539, 703, 29878, 336, 29918, 1557, 2620, 29901, 1273, 29872, 313, 3665, 2144, 29876, 29908, 1273, 364, 336, 29918, 1557, 2620, 29897, 13, 4706, 396, 9675, 29889, 303, 20405, 29889, 3539, 703, 29878, 311, 29918, 1557, 2620, 29901, 1273, 29872, 313, 3665, 2144, 29876, 29908, 1273, 364, 311, 29918, 1557, 2620, 29897, 13, 13, 4706, 1153, 29918, 29878, 705, 5861, 353, 1583, 3032, 28667, 29918, 29882, 11234, 29918, 29878, 705, 5861, 29898, 29878, 336, 29918, 690, 333, 29892, 364, 336, 29918, 1557, 2620, 29897, 13, 4706, 1583, 3032, 1509, 29918, 4717, 29918, 3127, 353, 1153, 29918, 29878, 705, 5861, 334, 1583, 3032, 4717, 29918, 3127, 13, 4706, 316, 29918, 29878, 705, 5861, 353, 1583, 3032, 28667, 29918, 29882, 11234, 29918, 29878, 705, 5861, 29898, 29878, 311, 29918, 690, 333, 29892, 364, 311, 29918, 1557, 2620, 29897, 13, 4706, 1583, 3032, 1509, 29918, 2287, 29918, 3127, 353, 316, 29918, 29878, 705, 5861, 334, 1583, 3032, 2287, 29918, 3127, 13, 13, 4706, 396, 1284, 9212, 29901, 13, 4706, 1583, 29889, 2658, 499, 353, 3523, 29875, 29889, 29888, 1195, 29898, 1311, 3032, 28667, 29918, 4161, 29918, 17619, 29892, 8636, 1919, 13, 462, 486, 324, 29922, 29896, 29872, 29899, 29955, 29892, 11791, 324, 29922, 29896, 29872, 29899, 29955, 29892, 2989, 29918, 4905, 29922, 5574, 29897, 13, 13, 4706, 10876, 29889, 303, 20405, 29889, 3539, 703, 9692, 306, 2241, 29903, 9212, 3583, 29876, 1159, 13, 4706, 10876, 29889, 303, 20405, 29889, 3539, 703, 1360, 29958, 1273, 29879, 29905, 29876, 29908, 1273, 851, 29898, 1311, 29889, 16533, 29918, 348, 1169, 29898, 1311, 29889, 2658, 499, 29961, 29900, 29962, 4961, 13, 4706, 1583, 3032, 3068, 29918, 1524, 403, 353, 5852, 13, 4706, 736, 1583, 29889, 2658, 499, 29961, 29900, 29962, 13, 13, 13, 1678, 396, 448, 2683, 2683, 2683, 2683, 22158, 29871, 13, 1678, 822, 7575, 29918, 348, 1169, 29898, 1311, 29892, 8636, 1125, 13, 4706, 1121, 353, 7442, 29889, 311, 7979, 267, 29898, 7529, 29897, 13, 4706, 1121, 29961, 29906, 29901, 29945, 29962, 334, 29922, 29871, 29941, 29889, 29953, 29872, 29953, 18884, 396, 964, 3533, 4447, 29883, 3471, 13, 4706, 1121, 29961, 29906, 29962, 334, 29922, 7442, 29889, 3944, 29898, 7529, 29961, 29896, 2314, 418, 396, 6776, 29898, 7099, 29897, 363, 26354, 4717, 13, 4706, 736, 1121, 13, 13, 1678, 822, 1051, 29918, 690, 333, 29918, 18816, 8247, 29898, 1311, 29892, 8636, 1125, 13, 4706, 364, 18816, 29918, 4717, 29892, 364, 18816, 29918, 2287, 353, 1583, 3032, 28667, 29918, 336, 7099, 29918, 690, 333, 27101, 29918, 3754, 29898, 7529, 29897, 13, 4706, 364, 18816, 29918, 4260, 353, 7442, 29889, 29882, 1478, 327, 29898, 2288, 335, 29918, 4717, 29892, 364, 18816, 29918, 2287, 29897, 13, 4706, 396, 9675, 29889, 303, 20405, 29889, 3539, 11702, 29896, 29945, 29879, 1273, 29896, 29945, 29879, 29905, 29876, 1159, 13, 4706, 363, 13607, 29892, 3149, 297, 26985, 29898, 7554, 29898, 2288, 335, 29918, 4717, 29892, 364, 18816, 29918, 2287, 29892, 364, 18816, 29918, 4260, 511, 29871, 29900, 1125, 13, 9651, 10876, 29889, 303, 20405, 29889, 3539, 703, 29958, 1273, 29896, 29900, 29889, 29945, 29888, 1273, 29896, 29900, 29889, 29945, 29888, 313, 29995, 29896, 29900, 29889, 29945, 29888, 2144, 29876, 29908, 1273, 1298, 29897, 13, 4706, 736, 13, 13, 13, 13383, 13383, 13383, 13383, 4136, 2277, 13, 29937, 5868, 24336, 14480, 313, 579, 456, 29918, 1688, 29918, 29906, 29889, 2272, 1125, 13, 29937, 2683, 2683, 2683, 2683, 23648, 13, 29937, 13, 29937, 259, 29906, 29900, 29906, 29900, 29899, 29900, 29906, 29899, 29900, 29955, 29901, 13, 29937, 268, 1192, 512, 1037, 1463, 4770, 3259, 1649, 304, 29871, 29900, 29889, 29896, 29889, 29900, 29889, 13, 29937, 268, 1192, 3824, 2825, 8717, 456, 29918, 1688, 29918, 29906, 29889, 2272, 29889, 13, 29937, 13, 2 ]
main.py
SaintBuddha/UCU_LinuxClub_GitHW
0
140358
<reponame>SaintBuddha/UCU_LinuxClub_GitHW<gh_stars>0 from os import system, name import cowsay import json import random CHARACTERS = ["beavis", "cheese", "daemon", "cow", "dragon", "ghostbusters", "kitty", "meow", "milk", "stegosaurus", "stimpy", "turkey", "turtle", "tux"] def get_character(): """This function chooses the character for cowsay Returns: str - cowsay character """ character = random.choice(CHARACTERS) return character def get_quote(): """ Responsible for getting a quote. Args: Returns: str - a quote """ return "This is quote from latest master branch! Random quotes coming soon!" if __name__ == "__main__": character = get_character() print(f"{character.capitalize()} says:\n\n\n") getattr(cowsay,character)(get_quote())
[ 1, 529, 276, 1112, 420, 29958, 22211, 29933, 566, 29881, 2350, 29914, 23129, 29965, 29918, 24085, 6821, 431, 29918, 28712, 29950, 29956, 29966, 12443, 29918, 303, 1503, 29958, 29900, 13, 3166, 2897, 1053, 1788, 29892, 1024, 13, 5215, 274, 1242, 388, 13, 5215, 4390, 13, 5215, 4036, 13, 13, 13, 11282, 17923, 23598, 353, 6796, 915, 485, 275, 613, 376, 1173, 968, 613, 376, 1388, 9857, 613, 376, 20587, 613, 376, 20515, 265, 613, 376, 29887, 3069, 29890, 504, 414, 613, 376, 29895, 986, 29891, 613, 376, 1004, 340, 613, 376, 23853, 29895, 613, 376, 303, 387, 3628, 17142, 613, 13, 795, 376, 303, 326, 2272, 613, 376, 29873, 332, 1989, 613, 376, 29873, 4227, 280, 613, 376, 29873, 1314, 3108, 13, 13, 13, 1753, 679, 29918, 18609, 7295, 13, 1678, 9995, 4013, 740, 3060, 15806, 278, 2931, 363, 274, 1242, 388, 13, 1678, 16969, 29901, 13, 4706, 851, 448, 274, 1242, 388, 2931, 13, 1678, 9995, 13, 1678, 2931, 353, 4036, 29889, 16957, 29898, 11282, 17923, 23598, 29897, 13, 1678, 736, 2931, 13, 13, 1753, 679, 29918, 1396, 7295, 13, 1678, 9995, 13, 1678, 2538, 29886, 787, 1821, 363, 2805, 263, 14978, 29889, 13, 1678, 826, 3174, 29901, 13, 1678, 16969, 29901, 13, 4706, 851, 448, 263, 14978, 13, 1678, 9995, 13, 1678, 736, 376, 4013, 338, 14978, 515, 9281, 5835, 5443, 29991, 16968, 11839, 6421, 4720, 3850, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 2931, 353, 679, 29918, 18609, 580, 13, 1678, 1596, 29898, 29888, 29908, 29912, 18609, 29889, 5030, 2410, 675, 28296, 4083, 3583, 29876, 29905, 29876, 29905, 29876, 1159, 13, 13, 1678, 679, 5552, 29898, 29883, 1242, 388, 29892, 18609, 5033, 657, 29918, 1396, 3101, 13, 13, 13, 2 ]
metalgrafica/metalgrafica/doctype/plantilla_de_grupo_de_productos/plantilla_de_grupo_de_productos.py
Nirchains/metal
0
132129
# -*- coding: utf-8 -*- # Copyright (c) 2017, <NAME> and contributors # For license information, please see license.txt from __future__ import unicode_literals import frappe from frappe.model.document import Document class Plantilladegrupodeproductos(Document): def validate(self): from erpnext.utilities.transaction_base import validate_uom_is_integer validate_uom_is_integer(self, "stock_uom", "qty", "BOM Item")
[ 1, 396, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 29937, 14187, 1266, 313, 29883, 29897, 29871, 29906, 29900, 29896, 29955, 29892, 529, 5813, 29958, 322, 17737, 29560, 13, 29937, 1152, 19405, 2472, 29892, 3113, 1074, 19405, 29889, 3945, 13, 13, 3166, 4770, 29888, 9130, 1649, 1053, 29104, 29918, 20889, 1338, 13, 5215, 5227, 4798, 13, 3166, 5227, 4798, 29889, 4299, 29889, 3225, 1053, 10854, 13, 13, 1990, 18058, 2911, 311, 7108, 29886, 356, 4704, 359, 29898, 6268, 1125, 13, 12, 1753, 12725, 29898, 1311, 1125, 13, 12, 12, 13, 12, 12, 3166, 604, 29886, 4622, 29889, 4422, 1907, 29889, 20736, 29918, 3188, 1053, 12725, 29918, 29884, 290, 29918, 275, 29918, 16031, 13, 12, 12, 15480, 29918, 29884, 290, 29918, 275, 29918, 16031, 29898, 1311, 29892, 376, 17712, 29918, 29884, 290, 613, 376, 29939, 1017, 613, 376, 29933, 6488, 10976, 1159, 13, 13, 2 ]
src/pyft4222/wrapper/i2c/slave.py
lavovaLampa/pyft4222
0
51407
<filename>src/pyft4222/wrapper/i2c/slave.py<gh_stars>0 from ctypes import POINTER, byref, c_char_p from ctypes import c_void_p, c_uint8, c_uint16, c_bool from typing import NewType from ..dll_loader import ftlib from .. import FtHandle, Result, Ok, Err, Ft4222Exception, Ft4222Status I2cSlaveHandle = NewType("I2cSlaveHandle", FtHandle) # Function prototypes _init = ftlib.FT4222_I2CSlave_Init _init.argtypes = [c_void_p] _init.restype = Ft4222Status _reset = ftlib.FT4222_I2CSlave_Reset _reset.argtypes = [c_void_p] _reset.restype = Ft4222Status _get_address = ftlib.FT4222_I2CSlave_GetAddress _get_address.argtypes = [c_void_p, POINTER(c_uint8)] _get_address.restype = Ft4222Status _set_address = ftlib.FT4222_I2CSlave_SetAddress _set_address.argtypes = [c_void_p, c_uint8] _set_address.restype = Ft4222Status _get_rx_status = ftlib.FT4222_I2CSlave_GetRxStatus _get_rx_status.argtypes = [c_void_p, POINTER(c_uint16)] _get_rx_status.restype = Ft4222Status _read = ftlib.FT4222_I2CSlave_Read _read.argtypes = [c_void_p, POINTER(c_uint8), c_uint16, POINTER(c_uint16)] _read.restype = Ft4222Status _write = ftlib.FT4222_I2CSlave_Write _write.argtypes = [c_void_p, c_char_p, c_uint16, POINTER(c_uint16)] _write.restype = Ft4222Status _set_clock_stretch = ftlib.FT4222_I2CSlave_SetClockStretch _set_clock_stretch.argtypes = [c_void_p, c_bool] _set_clock_stretch.restype = Ft4222Status _set_resp_word = ftlib.FT4222_I2CSlave_SetRespWord _set_resp_word.argtypes = [c_void_p, c_uint8] _set_resp_word.restype = Ft4222Status def init(ft_handle: FtHandle) -> Result[I2cSlaveHandle, Ft4222Status]: """Initialized FT4222H as an I2C slave. Note: The I2C slave address is set to 0x40 after initialization. Args: ft_handle: Handle to an opened FT4222 device Returns: Result: Handle to initialized FT4222 device in I2C Slave mode """ result: Ft4222Status = _init(ft_handle) if result == Ft4222Status.OK: return Ok(I2cSlaveHandle(ft_handle)) else: return Err(result) def reset(ft_handle: I2cSlaveHandle) -> None: """Reset the I2C slave device. This function will maintain the original I2C slave settings and clear all caches in the device. Args: ft_handle: Handle to an initialized FT4222 device in I2C Slave mode Raises: Ft4222Exception: In case of unexpected error """ result: Ft4222Status = _reset(ft_handle) if result != Ft4222Status.OK: raise Ft4222Exception(result) def get_address(ft_handle: I2cSlaveHandle) -> int: """Get the address of the I2C slave device. Default address is 0x40. Args: ft_handle: Handle to an initialized FT4222 device in I2C Slave mode Raises: Ft4222Exception: In case of unexpected error Returns: int: Current I2C slave address """ addr = c_uint8() result: Ft4222Status = _get_address(ft_handle, byref(addr)) if result != Ft4222Status.OK: raise Ft4222Exception(result) return addr.value def set_address(ft_handle: I2cSlaveHandle, addr: int) -> None: """Set the address of the I2C slave device. Args: ft_handle: Handle to an initialized FT4222 device in I2C Slave mode addr: Address to be set Raises: Ft4222Exception: In case of unexpected error """ assert ( 0 <= addr < (2 ** 7) ), "Device address must be an unsigned 16b integer (range 0 - 65 535)" result: Ft4222Status = _set_address(ft_handle, addr) if result != Ft4222Status.OK: raise Ft4222Exception(result) def get_rx_status(ft_handle: I2cSlaveHandle) -> int: """Get number of bytes in the receive queue. Args: ft_handle: Handle to an initialized FT4222 device in I2C Slave mode Raises: Ft4222Exception: In case of unexpected error Returns: int: Number of bytes in Rx queue """ rx_size = c_uint16() result: Ft4222Status = _get_rx_status(ft_handle, byref(rx_size)) if result != Ft4222Status.OK: raise Ft4222Exception(result) return rx_size.value def read(ft_handle: I2cSlaveHandle, read_byte_count: int) -> bytes: """Read data from the buffer of the I2C slave device. Args: ft_handle: Handle to an initialized FT4222 device in I2C Slave mode read_byte_count: Positive number of bytes to read Raises: Ft4222Exception: In case of unexpected error Returns: bytes: Read data """ assert ( 0 < read_byte_count < (2 ** 16) ), "Number of bytes to read must be positive and less than 2^16" read_buffer = (c_uint8 * read_byte_count)() bytes_read = c_uint16() result: Ft4222Status = _read( ft_handle, read_buffer, len(read_buffer), byref(bytes_read) ) if result != Ft4222Status.OK: raise Ft4222Exception(result) return bytes(read_buffer[: bytes_read.value]) def write(ft_handle: I2cSlaveHandle, write_data: bytes) -> int: """Write data to the buffer of I2C slave device. Args: ft_handle: Handle to an initialized FT4222 device in I2C Slave mode write_data: Non-empty list of bytes to write into Tx queue Raises: Ft4222Exception: In case of unexpected error Returns: int: Number of bytes written """ assert ( 0 < len(write_data) < (2 ** 16) ), "Data to be written must be non-empty and contain less than 2^16 bytes" bytes_written = c_uint16() result: Ft4222Status = _write( ft_handle, write_data, len(write_data), byref(bytes_written) ) if result != Ft4222Status.OK: raise Ft4222Exception(result) return bytes_written.value def set_clock_stretch(ft_handle: I2cSlaveHandle, enable: bool) -> None: """Enable or disable Clock Stretch. The default setting of clock stretching is disabled. Clock stretch is as a flow-control mechanism for slaves. An addressed slave device may hold the clock line (SCL) low after receiving (or sending) a byte, indicating that it is not yet ready to process more data. The master that is communicating with the slave may not finish the transmission of the current bit, but must wait until the clock line actually goes high. Args: ft_handle: Handle to an initialized FT4222 device in I2C Slave mode enable: Enable clock stretching? Raises: Ft4222Exception: In case of unexpected error """ result: Ft4222Status = _set_clock_stretch(ft_handle, enable) if result != Ft4222Status.OK: raise Ft4222Exception(result) def set_resp_word(ft_handle: I2cSlaveHandle, response_word: int) -> None: """Set the response word in case of empty Tx queue. Default value is 0xFF. This function only takes effect when Clock Stretch is disabled. When data is requested by an I2C master and the device is not ready to respond, the device will respond with a default value. Args: ft_handle: Handle to an initialized FT4222 device in I2C Slave mode response_word: Unsigned 8-bit response word to be set Raises: Ft4222Exception: In case of unexpected error """ assert ( 0 <= response_word < (2 ** 8) ), "The response word must be an 8b unsigned integer (range 0 - 255)" result: Ft4222Status = _set_resp_word(ft_handle, response_word) if result != Ft4222Status.OK: raise Ft4222Exception(result)
[ 1, 529, 9507, 29958, 4351, 29914, 2272, 615, 29946, 29906, 29906, 29906, 29914, 17699, 29914, 29875, 29906, 29883, 29914, 29879, 18398, 29889, 2272, 29966, 12443, 29918, 303, 1503, 29958, 29900, 13, 3166, 274, 8768, 1053, 349, 6992, 4945, 29892, 491, 999, 29892, 274, 29918, 3090, 29918, 29886, 13, 3166, 274, 8768, 1053, 274, 29918, 5405, 29918, 29886, 29892, 274, 29918, 13470, 29947, 29892, 274, 29918, 13470, 29896, 29953, 29892, 274, 29918, 11227, 13, 13, 3166, 19229, 1053, 1570, 1542, 13, 13, 3166, 6317, 12396, 29918, 12657, 1053, 11791, 1982, 13, 3166, 6317, 1053, 383, 29873, 13554, 29892, 7867, 29892, 3674, 29892, 25361, 29892, 383, 29873, 29946, 29906, 29906, 29906, 2451, 29892, 383, 29873, 29946, 29906, 29906, 29906, 5709, 13, 13, 13, 29902, 29906, 29883, 29903, 18398, 13554, 353, 1570, 1542, 703, 29902, 29906, 29883, 29903, 18398, 13554, 613, 383, 29873, 13554, 29897, 13, 13, 29937, 6680, 410, 4260, 7384, 13, 13, 29918, 2344, 353, 11791, 1982, 29889, 7818, 29946, 29906, 29906, 29906, 29918, 29902, 29906, 9295, 18398, 29918, 6644, 13, 29918, 2344, 29889, 1191, 8768, 353, 518, 29883, 29918, 5405, 29918, 29886, 29962, 13, 29918, 2344, 29889, 5060, 668, 353, 383, 29873, 29946, 29906, 29906, 29906, 5709, 13, 13, 29918, 12071, 353, 11791, 1982, 29889, 7818, 29946, 29906, 29906, 29906, 29918, 29902, 29906, 9295, 18398, 29918, 27175, 13, 29918, 12071, 29889, 1191, 8768, 353, 518, 29883, 29918, 5405, 29918, 29886, 29962, 13, 29918, 12071, 29889, 5060, 668, 353, 383, 29873, 29946, 29906, 29906, 29906, 5709, 13, 13, 29918, 657, 29918, 7328, 353, 11791, 1982, 29889, 7818, 29946, 29906, 29906, 29906, 29918, 29902, 29906, 9295, 18398, 29918, 2577, 7061, 13, 29918, 657, 29918, 7328, 29889, 1191, 8768, 353, 518, 29883, 29918, 5405, 29918, 29886, 29892, 349, 6992, 4945, 29898, 29883, 29918, 13470, 29947, 4638, 13, 29918, 657, 29918, 7328, 29889, 5060, 668, 353, 383, 29873, 29946, 29906, 29906, 29906, 5709, 13, 13, 29918, 842, 29918, 7328, 353, 11791, 1982, 29889, 7818, 29946, 29906, 29906, 29906, 29918, 29902, 29906, 9295, 18398, 29918, 2697, 7061, 13, 29918, 842, 29918, 7328, 29889, 1191, 8768, 353, 518, 29883, 29918, 5405, 29918, 29886, 29892, 274, 29918, 13470, 29947, 29962, 13, 29918, 842, 29918, 7328, 29889, 5060, 668, 353, 383, 29873, 29946, 29906, 29906, 29906, 5709, 13, 13, 29918, 657, 29918, 17697, 29918, 4882, 353, 11791, 1982, 29889, 7818, 29946, 29906, 29906, 29906, 29918, 29902, 29906, 9295, 18398, 29918, 2577, 29934, 29916, 5709, 13, 29918, 657, 29918, 17697, 29918, 4882, 29889, 1191, 8768, 353, 518, 29883, 29918, 5405, 29918, 29886, 29892, 349, 6992, 4945, 29898, 29883, 29918, 13470, 29896, 29953, 4638, 13, 29918, 657, 29918, 17697, 29918, 4882, 29889, 5060, 668, 353, 383, 29873, 29946, 29906, 29906, 29906, 5709, 13, 13, 29918, 949, 353, 11791, 1982, 29889, 7818, 29946, 29906, 29906, 29906, 29918, 29902, 29906, 9295, 18398, 29918, 6359, 13, 29918, 949, 29889, 1191, 8768, 353, 518, 29883, 29918, 5405, 29918, 29886, 29892, 349, 6992, 4945, 29898, 29883, 29918, 13470, 29947, 511, 274, 29918, 13470, 29896, 29953, 29892, 349, 6992, 4945, 29898, 29883, 29918, 13470, 29896, 29953, 4638, 13, 29918, 949, 29889, 5060, 668, 353, 383, 29873, 29946, 29906, 29906, 29906, 5709, 13, 13, 29918, 3539, 353, 11791, 1982, 29889, 7818, 29946, 29906, 29906, 29906, 29918, 29902, 29906, 9295, 18398, 29918, 6113, 13, 29918, 3539, 29889, 1191, 8768, 353, 518, 29883, 29918, 5405, 29918, 29886, 29892, 274, 29918, 3090, 29918, 29886, 29892, 274, 29918, 13470, 29896, 29953, 29892, 349, 6992, 4945, 29898, 29883, 29918, 13470, 29896, 29953, 4638, 13, 29918, 3539, 29889, 5060, 668, 353, 383, 29873, 29946, 29906, 29906, 29906, 5709, 13, 13, 29918, 842, 29918, 13058, 29918, 303, 10301, 353, 11791, 1982, 29889, 7818, 29946, 29906, 29906, 29906, 29918, 29902, 29906, 9295, 18398, 29918, 2697, 29907, 908, 855, 10301, 13, 29918, 842, 29918, 13058, 29918, 303, 10301, 29889, 1191, 8768, 353, 518, 29883, 29918, 5405, 29918, 29886, 29892, 274, 29918, 11227, 29962, 13, 29918, 842, 29918, 13058, 29918, 303, 10301, 29889, 5060, 668, 353, 383, 29873, 29946, 29906, 29906, 29906, 5709, 13, 13, 29918, 842, 29918, 13713, 29918, 1742, 353, 11791, 1982, 29889, 7818, 29946, 29906, 29906, 29906, 29918, 29902, 29906, 9295, 18398, 29918, 2697, 1666, 29886, 14463, 13, 29918, 842, 29918, 13713, 29918, 1742, 29889, 1191, 8768, 353, 518, 29883, 29918, 5405, 29918, 29886, 29892, 274, 29918, 13470, 29947, 29962, 13, 29918, 842, 29918, 13713, 29918, 1742, 29889, 5060, 668, 353, 383, 29873, 29946, 29906, 29906, 29906, 5709, 13, 13, 13, 1753, 2069, 29898, 615, 29918, 8411, 29901, 383, 29873, 13554, 29897, 1599, 7867, 29961, 29902, 29906, 29883, 29903, 18398, 13554, 29892, 383, 29873, 29946, 29906, 29906, 29906, 5709, 5387, 13, 1678, 9995, 15514, 1891, 383, 29911, 29946, 29906, 29906, 29906, 29950, 408, 385, 306, 29906, 29907, 19532, 29889, 13, 13, 1678, 3940, 29901, 13, 4706, 450, 306, 29906, 29907, 19532, 3211, 338, 731, 304, 29871, 29900, 29916, 29946, 29900, 1156, 17865, 29889, 13, 13, 1678, 826, 3174, 29901, 13, 4706, 11791, 29918, 8411, 29901, 418, 29273, 304, 385, 6496, 383, 29911, 29946, 29906, 29906, 29906, 4742, 13, 13, 1678, 16969, 29901, 13, 4706, 7867, 29901, 308, 29273, 304, 16601, 383, 29911, 29946, 29906, 29906, 29906, 4742, 297, 306, 29906, 29907, 317, 18398, 4464, 13, 1678, 9995, 13, 1678, 1121, 29901, 383, 29873, 29946, 29906, 29906, 29906, 5709, 353, 903, 2344, 29898, 615, 29918, 8411, 29897, 13, 13, 1678, 565, 1121, 1275, 383, 29873, 29946, 29906, 29906, 29906, 5709, 29889, 8949, 29901, 13, 4706, 736, 3674, 29898, 29902, 29906, 29883, 29903, 18398, 13554, 29898, 615, 29918, 8411, 876, 13, 1678, 1683, 29901, 13, 4706, 736, 25361, 29898, 2914, 29897, 13, 13, 13, 1753, 10092, 29898, 615, 29918, 8411, 29901, 306, 29906, 29883, 29903, 18398, 13554, 29897, 1599, 6213, 29901, 13, 1678, 9995, 27175, 278, 306, 29906, 29907, 19532, 4742, 29889, 13, 13, 1678, 910, 740, 674, 7344, 278, 2441, 306, 29906, 29907, 19532, 6055, 13, 1678, 322, 2821, 599, 274, 14520, 297, 278, 4742, 29889, 13, 13, 1678, 826, 3174, 29901, 13, 4706, 11791, 29918, 8411, 29901, 418, 29273, 304, 385, 16601, 383, 29911, 29946, 29906, 29906, 29906, 4742, 297, 306, 29906, 29907, 317, 18398, 4464, 13, 13, 1678, 390, 1759, 267, 29901, 13, 4706, 383, 29873, 29946, 29906, 29906, 29906, 2451, 29901, 1678, 512, 1206, 310, 15668, 1059, 13, 1678, 9995, 13, 1678, 1121, 29901, 383, 29873, 29946, 29906, 29906, 29906, 5709, 353, 903, 12071, 29898, 615, 29918, 8411, 29897, 13, 13, 1678, 565, 1121, 2804, 383, 29873, 29946, 29906, 29906, 29906, 5709, 29889, 8949, 29901, 13, 4706, 12020, 383, 29873, 29946, 29906, 29906, 29906, 2451, 29898, 2914, 29897, 13, 13, 13, 1753, 679, 29918, 7328, 29898, 615, 29918, 8411, 29901, 306, 29906, 29883, 29903, 18398, 13554, 29897, 1599, 938, 29901, 13, 1678, 9995, 2577, 278, 3211, 310, 278, 306, 29906, 29907, 19532, 4742, 29889, 13, 13, 1678, 13109, 3211, 338, 29871, 29900, 29916, 29946, 29900, 29889, 13, 13, 1678, 826, 3174, 29901, 13, 4706, 11791, 29918, 8411, 29901, 418, 29273, 304, 385, 16601, 383, 29911, 29946, 29906, 29906, 29906, 4742, 297, 306, 29906, 29907, 317, 18398, 4464, 13, 13, 1678, 390, 1759, 267, 29901, 13, 4706, 383, 29873, 29946, 29906, 29906, 29906, 2451, 29901, 1678, 512, 1206, 310, 15668, 1059, 13, 13, 1678, 16969, 29901, 13, 4706, 938, 29901, 9651, 9626, 306, 29906, 29907, 19532, 3211, 13, 1678, 9995, 13, 1678, 28915, 353, 274, 29918, 13470, 29947, 580, 13, 13, 1678, 1121, 29901, 383, 29873, 29946, 29906, 29906, 29906, 5709, 353, 903, 657, 29918, 7328, 29898, 615, 29918, 8411, 29892, 491, 999, 29898, 10030, 876, 13, 13, 1678, 565, 1121, 2804, 383, 29873, 29946, 29906, 29906, 29906, 5709, 29889, 8949, 29901, 13, 4706, 12020, 383, 29873, 29946, 29906, 29906, 29906, 2451, 29898, 2914, 29897, 13, 13, 1678, 736, 28915, 29889, 1767, 13, 13, 13, 1753, 731, 29918, 7328, 29898, 615, 29918, 8411, 29901, 306, 29906, 29883, 29903, 18398, 13554, 29892, 28915, 29901, 938, 29897, 1599, 6213, 29901, 13, 1678, 9995, 2697, 278, 3211, 310, 278, 306, 29906, 29907, 19532, 4742, 29889, 13, 13, 1678, 826, 3174, 29901, 13, 4706, 11791, 29918, 8411, 29901, 418, 29273, 304, 385, 16601, 383, 29911, 29946, 29906, 29906, 29906, 4742, 297, 306, 29906, 29907, 317, 18398, 4464, 13, 4706, 28915, 29901, 965, 16428, 304, 367, 731, 13, 13, 1678, 390, 1759, 267, 29901, 13, 4706, 383, 29873, 29946, 29906, 29906, 29906, 2451, 29901, 1678, 512, 1206, 310, 15668, 1059, 13, 1678, 9995, 13, 1678, 4974, 313, 13, 308, 29900, 5277, 28915, 529, 313, 29906, 3579, 29871, 29955, 29897, 13, 1678, 10353, 376, 11501, 3211, 1818, 367, 385, 12780, 29871, 29896, 29953, 29890, 6043, 313, 3881, 29871, 29900, 448, 29871, 29953, 29945, 29871, 29945, 29941, 29945, 5513, 13, 13, 1678, 1121, 29901, 383, 29873, 29946, 29906, 29906, 29906, 5709, 353, 903, 842, 29918, 7328, 29898, 615, 29918, 8411, 29892, 28915, 29897, 13, 13, 1678, 565, 1121, 2804, 383, 29873, 29946, 29906, 29906, 29906, 5709, 29889, 8949, 29901, 13, 4706, 12020, 383, 29873, 29946, 29906, 29906, 29906, 2451, 29898, 2914, 29897, 13, 13, 13, 1753, 679, 29918, 17697, 29918, 4882, 29898, 615, 29918, 8411, 29901, 306, 29906, 29883, 29903, 18398, 13554, 29897, 1599, 938, 29901, 13, 1678, 9995, 2577, 1353, 310, 6262, 297, 278, 7150, 9521, 29889, 13, 13, 1678, 826, 3174, 29901, 13, 4706, 11791, 29918, 8411, 29901, 29871, 29273, 304, 385, 16601, 383, 29911, 29946, 29906, 29906, 29906, 4742, 297, 306, 29906, 29907, 317, 18398, 4464, 13, 13, 1678, 390, 1759, 267, 29901, 13, 4706, 383, 29873, 29946, 29906, 29906, 29906, 2451, 29901, 1678, 512, 1206, 310, 15668, 1059, 13, 13, 1678, 16969, 29901, 13, 4706, 938, 29901, 18884, 9681, 310, 6262, 297, 390, 29916, 9521, 13, 1678, 9995, 13, 1678, 364, 29916, 29918, 2311, 353, 274, 29918, 13470, 29896, 29953, 580, 13, 13, 1678, 1121, 29901, 383, 29873, 29946, 29906, 29906, 29906, 5709, 353, 903, 657, 29918, 17697, 29918, 4882, 29898, 615, 29918, 8411, 29892, 491, 999, 29898, 17697, 29918, 2311, 876, 13, 13, 1678, 565, 1121, 2804, 383, 29873, 29946, 29906, 29906, 29906, 5709, 29889, 8949, 29901, 13, 4706, 12020, 383, 29873, 29946, 29906, 29906, 29906, 2451, 29898, 2914, 29897, 13, 13, 1678, 736, 364, 29916, 29918, 2311, 29889, 1767, 13, 13, 13, 1753, 1303, 29898, 615, 29918, 8411, 29901, 306, 29906, 29883, 29903, 18398, 13554, 29892, 1303, 29918, 10389, 29918, 2798, 29901, 938, 29897, 1599, 6262, 29901, 13, 1678, 9995, 6359, 848, 515, 278, 6835, 310, 278, 306, 29906, 29907, 19532, 4742, 29889, 13, 13, 1678, 826, 3174, 29901, 13, 4706, 11791, 29918, 8411, 29901, 3986, 29273, 304, 385, 16601, 383, 29911, 29946, 29906, 29906, 29906, 4742, 297, 306, 29906, 29907, 317, 18398, 4464, 13, 4706, 1303, 29918, 10389, 29918, 2798, 29901, 1678, 10321, 3321, 1353, 310, 6262, 304, 1303, 13, 13, 1678, 390, 1759, 267, 29901, 13, 4706, 383, 29873, 29946, 29906, 29906, 29906, 2451, 29901, 1678, 512, 1206, 310, 15668, 1059, 13, 13, 1678, 16969, 29901, 13, 4706, 6262, 29901, 795, 7523, 848, 13, 1678, 9995, 13, 1678, 4974, 313, 13, 308, 29900, 529, 1303, 29918, 10389, 29918, 2798, 529, 313, 29906, 3579, 29871, 29896, 29953, 29897, 13, 1678, 10353, 376, 4557, 310, 6262, 304, 1303, 1818, 367, 6374, 322, 3109, 1135, 29871, 29906, 29985, 29896, 29953, 29908, 13, 13, 1678, 1303, 29918, 9040, 353, 313, 29883, 29918, 13470, 29947, 334, 1303, 29918, 10389, 29918, 2798, 29897, 580, 13, 1678, 6262, 29918, 949, 353, 274, 29918, 13470, 29896, 29953, 580, 13, 13, 1678, 1121, 29901, 383, 29873, 29946, 29906, 29906, 29906, 5709, 353, 903, 949, 29898, 13, 4706, 11791, 29918, 8411, 29892, 1303, 29918, 9040, 29892, 7431, 29898, 949, 29918, 9040, 511, 491, 999, 29898, 13193, 29918, 949, 29897, 13, 1678, 1723, 13, 13, 1678, 565, 1121, 2804, 383, 29873, 29946, 29906, 29906, 29906, 5709, 29889, 8949, 29901, 13, 4706, 12020, 383, 29873, 29946, 29906, 29906, 29906, 2451, 29898, 2914, 29897, 13, 13, 1678, 736, 6262, 29898, 949, 29918, 9040, 7503, 6262, 29918, 949, 29889, 1767, 2314, 13, 13, 13, 1753, 2436, 29898, 615, 29918, 8411, 29901, 306, 29906, 29883, 29903, 18398, 13554, 29892, 2436, 29918, 1272, 29901, 6262, 29897, 1599, 938, 29901, 13, 1678, 9995, 6113, 848, 304, 278, 6835, 310, 306, 29906, 29907, 19532, 4742, 29889, 13, 13, 1678, 826, 3174, 29901, 13, 4706, 11791, 29918, 8411, 29901, 418, 29273, 304, 385, 16601, 383, 29911, 29946, 29906, 29906, 29906, 4742, 297, 306, 29906, 29907, 317, 18398, 4464, 13, 4706, 2436, 29918, 1272, 29901, 268, 10050, 29899, 6310, 1051, 310, 6262, 304, 2436, 964, 323, 29916, 9521, 13, 13, 1678, 390, 1759, 267, 29901, 13, 4706, 383, 29873, 29946, 29906, 29906, 29906, 2451, 29901, 1678, 512, 1206, 310, 15668, 1059, 13, 13, 1678, 16969, 29901, 13, 4706, 938, 29901, 9651, 9681, 310, 6262, 3971, 13, 1678, 9995, 13, 1678, 4974, 313, 13, 308, 29900, 529, 7431, 29898, 3539, 29918, 1272, 29897, 529, 313, 29906, 3579, 29871, 29896, 29953, 29897, 13, 1678, 10353, 376, 1469, 304, 367, 3971, 1818, 367, 1661, 29899, 6310, 322, 1712, 3109, 1135, 29871, 29906, 29985, 29896, 29953, 6262, 29908, 13, 13, 1678, 6262, 29918, 17625, 353, 274, 29918, 13470, 29896, 29953, 580, 13, 13, 1678, 1121, 29901, 383, 29873, 29946, 29906, 29906, 29906, 5709, 353, 903, 3539, 29898, 13, 4706, 11791, 29918, 8411, 29892, 2436, 29918, 1272, 29892, 7431, 29898, 3539, 29918, 1272, 511, 491, 999, 29898, 13193, 29918, 17625, 29897, 13, 1678, 1723, 13, 13, 1678, 565, 1121, 2804, 383, 29873, 29946, 29906, 29906, 29906, 5709, 29889, 8949, 29901, 13, 4706, 12020, 383, 29873, 29946, 29906, 29906, 29906, 2451, 29898, 2914, 29897, 13, 13, 1678, 736, 6262, 29918, 17625, 29889, 1767, 13, 13, 13, 1753, 731, 29918, 13058, 29918, 303, 10301, 29898, 615, 29918, 8411, 29901, 306, 29906, 29883, 29903, 18398, 13554, 29892, 9025, 29901, 6120, 29897, 1599, 6213, 29901, 13, 1678, 9995, 20701, 470, 11262, 315, 908, 624, 10301, 29889, 13, 13, 1678, 450, 2322, 4444, 310, 12006, 16116, 292, 338, 12708, 29889, 13, 13, 1678, 315, 908, 16116, 338, 408, 263, 4972, 29899, 6451, 13336, 363, 25569, 29889, 13, 1678, 530, 20976, 19532, 4742, 1122, 4808, 278, 12006, 1196, 313, 29903, 6154, 29897, 4482, 1156, 13442, 313, 272, 9348, 29897, 263, 7023, 29892, 13, 1678, 23941, 393, 372, 338, 451, 3447, 7960, 304, 1889, 901, 848, 29889, 13, 1678, 450, 5835, 393, 338, 7212, 1218, 411, 278, 19532, 1122, 451, 8341, 278, 22713, 310, 278, 1857, 2586, 29892, 13, 1678, 541, 1818, 4480, 2745, 278, 12006, 1196, 2869, 5771, 1880, 29889, 13, 13, 1678, 826, 3174, 29901, 13, 4706, 11791, 29918, 8411, 29901, 418, 29273, 304, 385, 16601, 383, 29911, 29946, 29906, 29906, 29906, 4742, 297, 306, 29906, 29907, 317, 18398, 4464, 13, 4706, 9025, 29901, 308, 1174, 519, 12006, 16116, 292, 29973, 13, 13, 1678, 390, 1759, 267, 29901, 13, 4706, 383, 29873, 29946, 29906, 29906, 29906, 2451, 29901, 1678, 512, 1206, 310, 15668, 1059, 13, 1678, 9995, 13, 1678, 1121, 29901, 383, 29873, 29946, 29906, 29906, 29906, 5709, 353, 903, 842, 29918, 13058, 29918, 303, 10301, 29898, 615, 29918, 8411, 29892, 9025, 29897, 13, 13, 1678, 565, 1121, 2804, 383, 29873, 29946, 29906, 29906, 29906, 5709, 29889, 8949, 29901, 13, 4706, 12020, 383, 29873, 29946, 29906, 29906, 29906, 2451, 29898, 2914, 29897, 13, 13, 13, 1753, 731, 29918, 13713, 29918, 1742, 29898, 615, 29918, 8411, 29901, 306, 29906, 29883, 29903, 18398, 13554, 29892, 2933, 29918, 1742, 29901, 938, 29897, 1599, 6213, 29901, 13, 1678, 9995, 2697, 278, 2933, 1734, 297, 1206, 310, 4069, 323, 29916, 9521, 29889, 13, 13, 1678, 13109, 995, 338, 29871, 29900, 29916, 4198, 29889, 13, 13, 1678, 910, 740, 871, 4893, 2779, 746, 315, 908, 624, 10301, 338, 12708, 29889, 13, 1678, 1932, 848, 338, 13877, 491, 385, 306, 29906, 29907, 5835, 322, 278, 4742, 338, 451, 7960, 304, 10049, 29892, 13, 1678, 278, 4742, 674, 10049, 411, 263, 2322, 995, 29889, 13, 13, 1678, 826, 3174, 29901, 13, 4706, 11791, 29918, 8411, 29901, 418, 29273, 304, 385, 16601, 383, 29911, 29946, 29906, 29906, 29906, 4742, 297, 306, 29906, 29907, 317, 18398, 4464, 13, 4706, 2933, 29918, 1742, 29901, 29871, 853, 7433, 29871, 29947, 29899, 2966, 2933, 1734, 304, 367, 731, 13, 13, 1678, 390, 1759, 267, 29901, 13, 4706, 383, 29873, 29946, 29906, 29906, 29906, 2451, 29901, 1678, 512, 1206, 310, 15668, 1059, 13, 1678, 9995, 13, 1678, 4974, 313, 13, 308, 29900, 5277, 2933, 29918, 1742, 529, 313, 29906, 3579, 29871, 29947, 29897, 13, 1678, 10353, 376, 1576, 2933, 1734, 1818, 367, 385, 29871, 29947, 29890, 12780, 6043, 313, 3881, 29871, 29900, 448, 29871, 29906, 29945, 29945, 5513, 13, 13, 1678, 1121, 29901, 383, 29873, 29946, 29906, 29906, 29906, 5709, 353, 903, 842, 29918, 13713, 29918, 1742, 29898, 615, 29918, 8411, 29892, 2933, 29918, 1742, 29897, 13, 13, 1678, 565, 1121, 2804, 383, 29873, 29946, 29906, 29906, 29906, 5709, 29889, 8949, 29901, 13, 4706, 12020, 383, 29873, 29946, 29906, 29906, 29906, 2451, 29898, 2914, 29897, 13, 2 ]
test/psyke/classification/real/test_real.py
psykei/psyke-python
2
179137
<reponame>psykei/psyke-python import unittest from parameterized import parameterized_class from tuprolog.solve.prolog import prolog_solver from psyke import logger from test import get_in_rule from test.psyke import initialize, data_to_struct @parameterized_class(initialize('real')) class TestReal(unittest.TestCase): def test_extract(self): logger.info(self.expected_theory) logger.info(self.extracted_theory) self.assertTrue(self.expected_theory.equals(self.extracted_theory, False)) def test_predict(self): predictions = self.extractor.predict(self.test_set.iloc[:, :-1]) solver = prolog_solver(static_kb=self.extracted_theory.assertZ(get_in_rule())) substitutions = [solver.solveOnce(data_to_struct(data)) for _, data in self.test_set.iterrows()] index = self.test_set.shape[1] - 1 expected = [str(query.solved_query.get_arg_at(index)) if query.is_yes else -1 for query in substitutions] logger.info(predictions) logger.info(expected) self.assertTrue(predictions == expected) if __name__ == '__main__': unittest.main()
[ 1, 529, 276, 1112, 420, 29958, 567, 29891, 446, 29875, 29914, 567, 29891, 446, 29899, 4691, 13, 5215, 443, 27958, 13, 3166, 3443, 1891, 1053, 3443, 1891, 29918, 1990, 13, 3166, 5291, 771, 1188, 29889, 2929, 345, 29889, 771, 1188, 1053, 410, 1188, 29918, 2929, 369, 13, 3166, 6529, 29891, 446, 1053, 17927, 13, 3166, 1243, 1053, 679, 29918, 262, 29918, 7491, 13, 3166, 1243, 29889, 567, 29891, 446, 1053, 11905, 29892, 848, 29918, 517, 29918, 4984, 13, 13, 13, 29992, 15501, 1891, 29918, 1990, 29898, 24926, 877, 6370, 8785, 13, 1990, 4321, 21713, 29898, 348, 27958, 29889, 3057, 8259, 1125, 13, 13, 1678, 822, 1243, 29918, 21111, 29898, 1311, 1125, 13, 4706, 17927, 29889, 3888, 29898, 1311, 29889, 9684, 29918, 14138, 29897, 13, 4706, 17927, 29889, 3888, 29898, 1311, 29889, 21111, 287, 29918, 14138, 29897, 13, 4706, 1583, 29889, 9294, 5574, 29898, 1311, 29889, 9684, 29918, 14138, 29889, 10954, 29898, 1311, 29889, 21111, 287, 29918, 14138, 29892, 7700, 876, 13, 13, 1678, 822, 1243, 29918, 27711, 29898, 1311, 1125, 13, 13, 4706, 27303, 353, 1583, 29889, 21111, 272, 29889, 27711, 29898, 1311, 29889, 1688, 29918, 842, 29889, 309, 542, 7503, 29892, 8956, 29896, 2314, 13, 4706, 899, 369, 353, 410, 1188, 29918, 2929, 369, 29898, 7959, 29918, 21066, 29922, 1311, 29889, 21111, 287, 29918, 14138, 29889, 9294, 29999, 29898, 657, 29918, 262, 29918, 7491, 22130, 13, 13, 4706, 23697, 29879, 353, 518, 2929, 369, 29889, 2929, 345, 26222, 29898, 1272, 29918, 517, 29918, 4984, 29898, 1272, 876, 363, 17117, 848, 297, 1583, 29889, 1688, 29918, 842, 29889, 1524, 5727, 580, 29962, 13, 4706, 2380, 353, 1583, 29889, 1688, 29918, 842, 29889, 12181, 29961, 29896, 29962, 448, 29871, 29896, 13, 4706, 3806, 353, 518, 710, 29898, 1972, 29889, 2929, 1490, 29918, 1972, 29889, 657, 29918, 1191, 29918, 271, 29898, 2248, 876, 565, 2346, 29889, 275, 29918, 3582, 1683, 448, 29896, 363, 2346, 297, 23697, 29879, 29962, 13, 13, 4706, 17927, 29889, 3888, 29898, 27711, 1080, 29897, 13, 4706, 17927, 29889, 3888, 29898, 9684, 29897, 13, 13, 4706, 1583, 29889, 9294, 5574, 29898, 27711, 1080, 1275, 3806, 29897, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 443, 27958, 29889, 3396, 580, 13, 2 ]
Python-Intermetiate/04_regular_expressions.py
carlosmertens/Django-Full-Stack
0
139408
# REGULAR EXPRESSIONS # Start by importing "re" for Reglar Expressions import re patterns = ["term1", "term2"] text = "This is a string with term1, but not the other!" # Search with re print("\n** Regular Expression - Search") for pattern in patterns: print("*Serching for: " + pattern) if re.search(pattern, text): print("Found match!") else: print("No match found!") match = re.search("term1", text) print("** Locations start at:", match.start()) # Print location # Split with re print("\nRegular Expression - Split") email = "<EMAIL>" split_at = "@" print(re.split(split_at, email)) # Find with re finding = re.findall("t", text) print(finding) # Create a function to find patterns with re def multi_re_find(patterns, phrase): """Function to find patterns using Regular Expressions.""" for idx in patterns: print("*Searching for pattern {}".format(idx)) print(re.findall(idx, phrase)) print("\n") test_phrase = "sdsd..sssddd...sdddsddd...dsds...dsssss...sdddd" test_patterns = ["sd*", # s followed by zero or more d's "sd+", # s followed by one or more d's "sd?", # s followed by zero or one d's "sd{3}", # s followed by three d's "sd{2,3}", # s followed by two to three d's "s[sd]+" ] multi_re_find(test_patterns, test_phrase) # Strip punctuations print("** Strip Punctuation") test_comment = "This is a string! But it has punctuation. How can we remove it?" new_patterns = ["[^!.?]+"] multi_re_find(new_patterns, test_comment) other_patterns = ["[a-z]+"] # To find capital letters change to A-Z multi_re_find(other_patterns, test_comment)
[ 1, 396, 5195, 29954, 13309, 1718, 8528, 15094, 13507, 29903, 13, 13, 29937, 7370, 491, 28348, 376, 276, 29908, 363, 2169, 4675, 14657, 1080, 13, 13, 5215, 337, 13, 13, 11037, 29879, 353, 6796, 8489, 29896, 613, 376, 8489, 29906, 3108, 13, 726, 353, 376, 4013, 338, 263, 1347, 411, 1840, 29896, 29892, 541, 451, 278, 916, 3850, 13, 13, 29937, 11856, 411, 337, 13, 2158, 14182, 29876, 1068, 2169, 1070, 21444, 448, 11856, 1159, 13, 13, 1454, 4766, 297, 15038, 29901, 13, 1678, 1596, 703, 29930, 1748, 305, 292, 363, 29901, 376, 718, 4766, 29897, 13, 13, 1678, 565, 337, 29889, 4478, 29898, 11037, 29892, 1426, 1125, 13, 4706, 1596, 703, 9692, 1993, 29991, 1159, 13, 1678, 1683, 29901, 13, 4706, 1596, 703, 3782, 1993, 1476, 29991, 1159, 13, 13, 4352, 353, 337, 29889, 4478, 703, 8489, 29896, 613, 1426, 29897, 13, 2158, 703, 1068, 5976, 800, 1369, 472, 29901, 613, 1993, 29889, 2962, 3101, 29871, 396, 13905, 4423, 13, 13, 29937, 26178, 411, 337, 13, 2158, 14182, 29876, 4597, 1070, 21444, 448, 26178, 1159, 13, 13, 5269, 353, 9872, 26862, 6227, 11903, 13, 5451, 29918, 271, 353, 376, 5507, 13, 13, 2158, 29898, 276, 29889, 5451, 29898, 5451, 29918, 271, 29892, 4876, 876, 13, 13, 29937, 10987, 411, 337, 13, 2886, 292, 353, 337, 29889, 2886, 497, 703, 29873, 613, 1426, 29897, 13, 13, 2158, 29898, 2886, 292, 29897, 13, 13, 29937, 6204, 263, 740, 304, 1284, 15038, 411, 337, 13, 13, 13, 1753, 2473, 29918, 276, 29918, 2886, 29898, 11037, 29879, 29892, 16549, 1125, 13, 1678, 9995, 6678, 304, 1284, 15038, 773, 2169, 1070, 14657, 1080, 1213, 15945, 13, 13, 1678, 363, 22645, 297, 15038, 29901, 13, 4706, 1596, 703, 29930, 7974, 292, 363, 4766, 6571, 1642, 4830, 29898, 13140, 876, 13, 4706, 1596, 29898, 276, 29889, 2886, 497, 29898, 13140, 29892, 16549, 876, 13, 4706, 1596, 14182, 29876, 1159, 13, 13, 13, 1688, 29918, 24588, 559, 353, 376, 4928, 4928, 636, 893, 29879, 1289, 29881, 856, 29879, 1289, 6289, 1289, 29881, 856, 29881, 4928, 29879, 856, 29881, 893, 893, 29879, 856, 29879, 1289, 1289, 29908, 13, 1688, 29918, 11037, 29879, 353, 6796, 4928, 29930, 613, 268, 396, 269, 5643, 491, 5225, 470, 901, 270, 29915, 29879, 13, 462, 376, 4928, 29974, 613, 3986, 396, 269, 5643, 491, 697, 470, 901, 270, 29915, 29879, 13, 462, 376, 4928, 29973, 613, 3986, 396, 269, 5643, 491, 5225, 470, 697, 270, 29915, 29879, 13, 462, 376, 4928, 29912, 29941, 17671, 4706, 396, 269, 5643, 491, 2211, 270, 29915, 29879, 13, 462, 376, 4928, 29912, 29906, 29892, 29941, 17671, 418, 396, 269, 5643, 491, 1023, 304, 2211, 270, 29915, 29879, 13, 462, 376, 29879, 29961, 4928, 10062, 29908, 13, 462, 4514, 13, 13, 9910, 29918, 276, 29918, 2886, 29898, 1688, 29918, 11037, 29879, 29892, 1243, 29918, 24588, 559, 29897, 13, 13, 29937, 624, 6472, 6035, 22999, 800, 13, 2158, 703, 1068, 624, 6472, 349, 18049, 29884, 362, 1159, 13, 13, 1688, 29918, 9342, 353, 376, 4013, 338, 263, 1347, 29991, 1205, 372, 756, 6035, 22999, 362, 29889, 1128, 508, 591, 3349, 372, 3026, 13, 1482, 29918, 11037, 29879, 353, 6796, 22896, 21520, 29973, 10062, 3108, 13, 13, 9910, 29918, 276, 29918, 2886, 29898, 1482, 29918, 11037, 29879, 29892, 1243, 29918, 9342, 29897, 13, 13, 1228, 29918, 11037, 29879, 353, 6796, 29961, 29874, 29899, 29920, 10062, 3108, 29871, 396, 1763, 1284, 7483, 8721, 1735, 304, 319, 29899, 29999, 13, 13, 9910, 29918, 276, 29918, 2886, 29898, 1228, 29918, 11037, 29879, 29892, 1243, 29918, 9342, 29897, 13, 2 ]
setup.py
mariocesar/boot.py
2
30074
<reponame>mariocesar/boot.py<filename>setup.py #!/usr/bin/env python3 import sys from setuptools import find_packages, setup if sys.version_info < (3, 6): sys.exit('Python 3.6 is the minimum required version') description, long_description = ( open('README.rst', 'rt').read().split('\n\n', 1)) setup( name='boot.py', author='<NAME>', author_email='<EMAIL>', version='0.16', url='https://github.com/mariocesar/boot.py', description=description, long_description=f'\n{long_description}', package_dir={'': 'src'}, packages=find_packages('src'), python_requires='>=3.6', setup_requires=['pytest-runner'], tests_require=['pytest', 'pytest-cov'], classifiers=[ 'Development Status :: 3 - Alpha', 'Intended Audience :: Developers', 'Programming Language :: Python', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.6', 'License :: OSI Approved :: MIT License', 'Topic :: Software Development :: Libraries :: Python Modules', ], )
[ 1, 529, 276, 1112, 420, 29958, 29885, 1306, 542, 26892, 29914, 4777, 29889, 2272, 29966, 9507, 29958, 14669, 29889, 2272, 13, 29937, 14708, 4855, 29914, 2109, 29914, 6272, 3017, 29941, 13, 5215, 10876, 13, 13, 3166, 731, 21245, 8789, 1053, 1284, 29918, 8318, 29892, 6230, 13, 13, 361, 10876, 29889, 3259, 29918, 3888, 529, 313, 29941, 29892, 29871, 29953, 1125, 13, 1678, 10876, 29889, 13322, 877, 11980, 29871, 29941, 29889, 29953, 338, 278, 9212, 3734, 1873, 1495, 13, 13, 8216, 29892, 1472, 29918, 8216, 353, 313, 13, 1678, 1722, 877, 16310, 2303, 29889, 29878, 303, 742, 525, 2273, 2824, 949, 2141, 5451, 28909, 29876, 29905, 29876, 742, 29871, 29896, 876, 13, 13, 14669, 29898, 13, 1678, 1024, 2433, 4777, 29889, 2272, 742, 13, 1678, 4148, 2433, 29966, 5813, 29958, 742, 13, 1678, 4148, 29918, 5269, 2433, 29966, 26862, 6227, 29958, 742, 13, 1678, 1873, 2433, 29900, 29889, 29896, 29953, 742, 13, 1678, 3142, 2433, 991, 597, 3292, 29889, 510, 29914, 29885, 1306, 542, 26892, 29914, 4777, 29889, 2272, 742, 13, 1678, 6139, 29922, 8216, 29892, 13, 1678, 1472, 29918, 8216, 29922, 29888, 12764, 29876, 29912, 5426, 29918, 8216, 29913, 742, 13, 1678, 3577, 29918, 3972, 3790, 29915, 2396, 525, 4351, 16675, 13, 1678, 9741, 29922, 2886, 29918, 8318, 877, 4351, 5477, 13, 1678, 3017, 29918, 276, 339, 2658, 2433, 18572, 29941, 29889, 29953, 742, 13, 1678, 6230, 29918, 276, 339, 2658, 29922, 1839, 2272, 1688, 29899, 27492, 7464, 13, 1678, 6987, 29918, 12277, 29922, 1839, 2272, 1688, 742, 525, 2272, 1688, 29899, 24542, 7464, 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, 9283, 4056, 17088, 4761, 5132, 742, 13, 4706, 525, 9283, 4056, 17088, 4761, 5132, 4761, 29871, 29941, 742, 13, 4706, 525, 9283, 4056, 17088, 4761, 5132, 4761, 29871, 29941, 29889, 29953, 742, 13, 4706, 525, 29931, 293, 1947, 4761, 438, 5425, 28268, 1490, 4761, 341, 1806, 19245, 742, 13, 4706, 525, 7031, 293, 4761, 18540, 14650, 4761, 365, 4626, 4314, 4761, 5132, 3382, 2540, 742, 13, 1678, 21251, 13, 29897, 13, 2 ]