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 ]
README.md exists but content is empty.
Downloads last month
53