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
__init__.py
MycroftAI/skill-date
1
1602411
<reponame>MycroftAI/skill-date # Copyright 2021, Mycroft AI 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. """Mycroft skill to respond to user requests for dates.""" import time from datetime import date, datetime from pathlib import Path from mycroft.messagebus.message import Message from mycroft.skills import MycroftSkill, intent_handler from mycroft.skills.intent_service import AdaptIntent from mycroft.util.format import date_time_format from mycroft.util.time import now_local from .skill import get_speakable_weekend_date, is_leap_year, Response MARK_I = "mycroft_mark_1" MARK_II = "mycroft_mark_2" class DateSkill(MycroftSkill): """Mycroft skill to respond to user requests for dates.""" def __init__(self): super().__init__("DateSkill") self.displayed_time = None # TODO: Move to reusable location @property def platform(self): """Get the platform identifier string Returns: str: Platform identifier, such as "mycroft_mark_1", "mycroft_picroft", "mycroft_mark_2". None for non-standard. """ if self.config_core and self.config_core.get("enclosure"): return self.config_core["enclosure"].get("platform") else: return None def initialize(self): """Tasks to perform after constructor but before skill is ready for use.""" date_time_format.cache(self.lang) @intent_handler(AdaptIntent().require("query").require("date").optionally("today")) def handle_current_date_request(self, _): """Respond to a request from the user for the current date. Example: "What is the date today?" """ self._handle_current_date() @intent_handler( AdaptIntent().optionally("query").require("relative-day").optionally("date") ) def handle_relative_date_request(self, request: Message): """Respond to a request from the user for a date in the past or future. Example: "What is the date in five days?" Args: request: The request from the user that triggered this intent. """ self._handle_relative_date(request) @intent_handler(AdaptIntent().require("query").require("month")) def handle_day_for_date(self, request): """Respond to a request from the user for a specific past or future date. Example: "When is July 10th?" Args: request: The request from the user that triggered this intent. """ self._handle_relative_date(request) @intent_handler(AdaptIntent().require("query").require("leap-year")) def handle_next_leap_year_request(self, _): """Respond to a request from the user for the next leap year. Example: "When is the next leap year?" """ today = now_local().date() leap_date = date(today.year, 2, 28) year = today.year if today <= leap_date else today.year + 1 while not is_leap_year(year): year += 1 self.speak_dialog("next-leap-year", data=dict(year=year)) @intent_handler("date-future-weekend.intent") def handle_future_weekend_request(self, _): saturday_date = get_speakable_weekend_date("this saturday") sunday_date = get_speakable_weekend_date("this sunday") dialog_data = dict(saturday_date=saturday_date, sunday_date=sunday_date) self.speak_dialog("date-future-weekend", data=dialog_data) @intent_handler("date-last-weekend.intent") def handle_last_weekend_request(self, _): """Respond to a request from the user for dates for the upcoming weekend. Example: "What were the dates last weekend?" """ saturday_date = get_speakable_weekend_date("last saturday") sunday_date = get_speakable_weekend_date("last sunday") dialog_data = dict(saturday_date=saturday_date, sunday_date=sunday_date) self.speak_dialog("date-last-weekend", data=dialog_data) def _handle_current_date(self): """Build, speak and display the response to a current date request.""" response = Response() response.build_current_date_response() self._respond(response) def _handle_relative_date(self, request: Message): """Build, speak and display the response to a current date request. Args: request: The request from the user that triggered this intent. """ utterance = request.data["utterance"].lower() response = Response() response.build_relative_date_response(utterance) if response.date_time is not None: self._respond(response) def _respond(self, response: Response): """Speak and display the response to a date request. Args: response: Data used by the speak/display logic to communicate the Response """ self._display(response) self.speak_dialog(response.dialog_name, response.dialog_data, wait=True) time.sleep(10) self._clear_display() def _display(self, response: Response): """Display the response to a date request if the platform supports it. Args: response: Data used by the display logic to communicate the Response """ if self.platform == MARK_I: self._display_mark_i(response) elif self.gui.connected: self._display_gui(response) def _display_mark_i(self, response: Response): """Display the response to a date request on the Mark I. This logic could be re-used for other platforms that have an Arduino faceplate with the same dimensions as the Mark I's. Args: response: Data used by the display logic to communicate the Response """ display_date = self._get_display_date(response.date_time) self.enclosure.deactivate_mouth_events() self.enclosure.mouth_text(display_date) def _get_display_date(self, date_time: datetime) -> str: """Format the datetime object returned from the parser for display purposes. Args: date_time: Contains the date that will be displayed. """ if self.config_core.get("date_format") == "MDY": display_date = date_time.strftime("%-m/%-d/%Y") else: display_date = date_time.strftime("%Y/%-d/%-m") return display_date def _display_gui(self, response: Response): """Display the response to a date request on a device using the GUI Framework. Args: response: Data used by the display logic to communicate the Response """ self.gui.clear() self.gui["weekdayString"] = response.date_time.strftime("%A").upper() self.gui["monthString"] = response.date_time.strftime("%B") self.gui["dayString"] = response.date_time.strftime("%-d") if self.platform == MARK_II: self.gui.show_page("date-mark-ii.qml") else: self.gui.show_page("date-scalable.qml") def _clear_display(self): """Clear the display medium of the date.""" if self.platform == "mycroft_mark_1": self.enclosure.mouth_reset() self.enclosure.activate_mouth_events() self.enclosure.display_manager.remove_active() elif self.gui.connected: self.gui.release() def create_skill(): """Boilerplate code used to load this skill into core.""" return DateSkill()
[ 1, 529, 276, 1112, 420, 29958, 3421, 24077, 615, 23869, 29914, 808, 453, 29899, 1256, 13, 29937, 14187, 1266, 29871, 29906, 29900, 29906, 29896, 29892, 1619, 24077, 615, 319, 29902, 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, 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, 15945, 29908, 3421, 24077, 615, 19911, 304, 10049, 304, 1404, 7274, 363, 10116, 1213, 15945, 13, 5215, 931, 13, 3166, 12865, 1053, 2635, 29892, 12865, 13, 3166, 2224, 1982, 1053, 10802, 13, 13, 3166, 590, 24077, 615, 29889, 4906, 8262, 29889, 4906, 1053, 7777, 13, 3166, 590, 24077, 615, 29889, 808, 6090, 1053, 1619, 24077, 615, 15797, 453, 29892, 7609, 29918, 13789, 13, 3166, 590, 24077, 615, 29889, 808, 6090, 29889, 14029, 29918, 5509, 1053, 23255, 415, 10286, 13, 3166, 590, 24077, 615, 29889, 4422, 29889, 4830, 1053, 2635, 29918, 2230, 29918, 4830, 13, 3166, 590, 24077, 615, 29889, 4422, 29889, 2230, 1053, 1286, 29918, 2997, 13, 3166, 869, 808, 453, 1053, 679, 29918, 5965, 557, 519, 29918, 18448, 355, 29918, 1256, 29892, 338, 29918, 280, 481, 29918, 6360, 29892, 13291, 13, 13, 1529, 29934, 29968, 29918, 29902, 353, 376, 1357, 24077, 615, 29918, 3502, 29918, 29896, 29908, 13, 1529, 29934, 29968, 29918, 2687, 353, 376, 1357, 24077, 615, 29918, 3502, 29918, 29906, 29908, 13, 13, 13, 1990, 4712, 15797, 453, 29898, 3421, 24077, 615, 15797, 453, 1125, 13, 1678, 9995, 3421, 24077, 615, 19911, 304, 10049, 304, 1404, 7274, 363, 10116, 1213, 15945, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 2428, 2141, 1649, 2344, 1649, 703, 2539, 15797, 453, 1159, 13, 4706, 1583, 29889, 4990, 287, 29918, 2230, 353, 6213, 13, 13, 1678, 396, 14402, 29901, 25249, 304, 337, 27979, 4423, 13, 1678, 732, 6799, 13, 1678, 822, 7481, 29898, 1311, 1125, 13, 4706, 9995, 2577, 278, 7481, 15882, 1347, 13, 13, 4706, 16969, 29901, 13, 9651, 851, 29901, 28096, 15882, 29892, 1316, 408, 376, 1357, 24077, 615, 29918, 3502, 29918, 29896, 613, 13, 462, 376, 1357, 24077, 615, 29918, 29886, 2357, 615, 613, 376, 1357, 24077, 615, 29918, 3502, 29918, 29906, 1642, 29871, 6213, 363, 1661, 29899, 15770, 29889, 13, 4706, 9995, 13, 4706, 565, 1583, 29889, 2917, 29918, 3221, 322, 1583, 29889, 2917, 29918, 3221, 29889, 657, 703, 264, 25071, 29908, 1125, 13, 9651, 736, 1583, 29889, 2917, 29918, 3221, 3366, 264, 25071, 16862, 657, 703, 12120, 1159, 13, 4706, 1683, 29901, 13, 9651, 736, 6213, 13, 13, 1678, 822, 11905, 29898, 1311, 1125, 13, 4706, 9995, 26249, 304, 2189, 1156, 5823, 541, 1434, 19911, 338, 7960, 363, 671, 1213, 15945, 13, 4706, 2635, 29918, 2230, 29918, 4830, 29889, 8173, 29898, 1311, 29889, 3893, 29897, 13, 13, 1678, 732, 14029, 29918, 13789, 29898, 29909, 1388, 415, 10286, 2141, 12277, 703, 1972, 2564, 12277, 703, 1256, 2564, 3385, 635, 703, 27765, 5783, 13, 1678, 822, 4386, 29918, 3784, 29918, 1256, 29918, 3827, 29898, 1311, 29892, 903, 1125, 13, 4706, 9995, 1666, 2818, 304, 263, 2009, 515, 278, 1404, 363, 278, 1857, 2635, 29889, 13, 13, 4706, 8741, 29901, 376, 5618, 338, 278, 2635, 9826, 3026, 13, 4706, 9995, 13, 4706, 1583, 3032, 8411, 29918, 3784, 29918, 1256, 580, 13, 13, 1678, 732, 14029, 29918, 13789, 29898, 13, 4706, 23255, 415, 10286, 2141, 3385, 635, 703, 1972, 2564, 12277, 703, 22925, 29899, 3250, 2564, 3385, 635, 703, 1256, 1159, 13, 1678, 1723, 13, 1678, 822, 4386, 29918, 22925, 29918, 1256, 29918, 3827, 29898, 1311, 29892, 2009, 29901, 7777, 1125, 13, 4706, 9995, 1666, 2818, 304, 263, 2009, 515, 278, 1404, 363, 263, 2635, 297, 278, 4940, 470, 5434, 29889, 13, 13, 4706, 8741, 29901, 376, 5618, 338, 278, 2635, 297, 5320, 3841, 3026, 13, 13, 4706, 826, 3174, 29901, 13, 9651, 2009, 29901, 450, 2009, 515, 278, 1404, 393, 19799, 445, 7609, 29889, 13, 4706, 9995, 13, 4706, 1583, 3032, 8411, 29918, 22925, 29918, 1256, 29898, 3827, 29897, 13, 13, 1678, 732, 14029, 29918, 13789, 29898, 29909, 1388, 415, 10286, 2141, 12277, 703, 1972, 2564, 12277, 703, 10874, 5783, 13, 1678, 822, 4386, 29918, 3250, 29918, 1454, 29918, 1256, 29898, 1311, 29892, 2009, 1125, 13, 4706, 9995, 1666, 2818, 304, 263, 2009, 515, 278, 1404, 363, 263, 2702, 4940, 470, 5434, 2635, 29889, 13, 13, 4706, 8741, 29901, 376, 10401, 338, 5468, 29871, 29896, 29900, 386, 3026, 13, 13, 4706, 826, 3174, 29901, 13, 9651, 2009, 29901, 450, 2009, 515, 278, 1404, 393, 19799, 445, 7609, 29889, 13, 4706, 9995, 13, 4706, 1583, 3032, 8411, 29918, 22925, 29918, 1256, 29898, 3827, 29897, 13, 13, 1678, 732, 14029, 29918, 13789, 29898, 29909, 1388, 415, 10286, 2141, 12277, 703, 1972, 2564, 12277, 703, 280, 481, 29899, 6360, 5783, 13, 1678, 822, 4386, 29918, 4622, 29918, 280, 481, 29918, 6360, 29918, 3827, 29898, 1311, 29892, 903, 1125, 13, 4706, 9995, 1666, 2818, 304, 263, 2009, 515, 278, 1404, 363, 278, 2446, 454, 481, 1629, 29889, 13, 13, 4706, 8741, 29901, 376, 10401, 338, 278, 2446, 454, 481, 1629, 3026, 13, 4706, 9995, 13, 4706, 9826, 353, 1286, 29918, 2997, 2141, 1256, 580, 13, 4706, 454, 481, 29918, 1256, 353, 2635, 29898, 27765, 29889, 6360, 29892, 29871, 29906, 29892, 29871, 29906, 29947, 29897, 13, 4706, 1629, 353, 9826, 29889, 6360, 565, 9826, 5277, 454, 481, 29918, 1256, 1683, 9826, 29889, 6360, 718, 29871, 29896, 13, 4706, 1550, 451, 338, 29918, 280, 481, 29918, 6360, 29898, 6360, 1125, 13, 9651, 1629, 4619, 29871, 29896, 13, 4706, 1583, 29889, 5965, 557, 29918, 15901, 703, 4622, 29899, 280, 481, 29899, 6360, 613, 848, 29922, 8977, 29898, 6360, 29922, 6360, 876, 13, 13, 1678, 732, 14029, 29918, 13789, 703, 1256, 29899, 29888, 9130, 29899, 18448, 355, 29889, 14029, 1159, 13, 1678, 822, 4386, 29918, 29888, 9130, 29918, 18448, 355, 29918, 3827, 29898, 1311, 29892, 903, 1125, 13, 4706, 269, 20510, 29918, 1256, 353, 679, 29918, 5965, 557, 519, 29918, 18448, 355, 29918, 1256, 703, 1366, 269, 20510, 1159, 13, 4706, 480, 299, 388, 29918, 1256, 353, 679, 29918, 5965, 557, 519, 29918, 18448, 355, 29918, 1256, 703, 1366, 480, 299, 388, 1159, 13, 4706, 7928, 29918, 1272, 353, 9657, 29898, 29879, 20510, 29918, 1256, 29922, 29879, 20510, 29918, 1256, 29892, 480, 299, 388, 29918, 1256, 29922, 29879, 870, 388, 29918, 1256, 29897, 13, 4706, 1583, 29889, 5965, 557, 29918, 15901, 703, 1256, 29899, 29888, 9130, 29899, 18448, 355, 613, 848, 29922, 15901, 29918, 1272, 29897, 13, 13, 1678, 732, 14029, 29918, 13789, 703, 1256, 29899, 4230, 29899, 18448, 355, 29889, 14029, 1159, 13, 1678, 822, 4386, 29918, 4230, 29918, 18448, 355, 29918, 3827, 29898, 1311, 29892, 903, 1125, 13, 4706, 9995, 1666, 2818, 304, 263, 2009, 515, 278, 1404, 363, 10116, 363, 278, 701, 11506, 4723, 355, 29889, 13, 13, 4706, 8741, 29901, 376, 5618, 892, 278, 10116, 1833, 4723, 355, 3026, 13, 4706, 9995, 13, 4706, 269, 20510, 29918, 1256, 353, 679, 29918, 5965, 557, 519, 29918, 18448, 355, 29918, 1256, 703, 4230, 269, 20510, 1159, 13, 4706, 480, 299, 388, 29918, 1256, 353, 679, 29918, 5965, 557, 519, 29918, 18448, 355, 29918, 1256, 703, 4230, 480, 299, 388, 1159, 13, 4706, 7928, 29918, 1272, 353, 9657, 29898, 29879, 20510, 29918, 1256, 29922, 29879, 20510, 29918, 1256, 29892, 480, 299, 388, 29918, 1256, 29922, 29879, 870, 388, 29918, 1256, 29897, 13, 4706, 1583, 29889, 5965, 557, 29918, 15901, 703, 1256, 29899, 4230, 29899, 18448, 355, 613, 848, 29922, 15901, 29918, 1272, 29897, 13, 13, 1678, 822, 903, 8411, 29918, 3784, 29918, 1256, 29898, 1311, 1125, 13, 4706, 9995, 8893, 29892, 7726, 322, 2479, 278, 2933, 304, 263, 1857, 2635, 2009, 1213, 15945, 13, 4706, 2933, 353, 13291, 580, 13, 4706, 2933, 29889, 4282, 29918, 3784, 29918, 1256, 29918, 5327, 580, 13, 4706, 1583, 3032, 3636, 29898, 5327, 29897, 13, 13, 1678, 822, 903, 8411, 29918, 22925, 29918, 1256, 29898, 1311, 29892, 2009, 29901, 7777, 1125, 13, 4706, 9995, 8893, 29892, 7726, 322, 2479, 278, 2933, 304, 263, 1857, 2635, 2009, 29889, 13, 13, 4706, 826, 3174, 29901, 13, 9651, 2009, 29901, 450, 2009, 515, 278, 1404, 393, 19799, 445, 7609, 29889, 13, 4706, 9995, 13, 4706, 14401, 749, 353, 2009, 29889, 1272, 3366, 6463, 749, 16862, 13609, 580, 13, 4706, 2933, 353, 13291, 580, 13, 4706, 2933, 29889, 4282, 29918, 22925, 29918, 1256, 29918, 5327, 29898, 6463, 749, 29897, 13, 4706, 565, 2933, 29889, 1256, 29918, 2230, 338, 451, 6213, 29901, 13, 9651, 1583, 3032, 3636, 29898, 5327, 29897, 13, 13, 1678, 822, 903, 3636, 29898, 1311, 29892, 2933, 29901, 13291, 1125, 13, 4706, 9995, 10649, 557, 322, 2479, 278, 2933, 304, 263, 2635, 2009, 29889, 13, 13, 4706, 826, 3174, 29901, 13, 9651, 2933, 29901, 3630, 1304, 491, 278, 7726, 29914, 4990, 5900, 304, 23120, 278, 13291, 13, 4706, 9995, 13, 4706, 1583, 3032, 4990, 29898, 5327, 29897, 13, 4706, 1583, 29889, 5965, 557, 29918, 15901, 29898, 5327, 29889, 15901, 29918, 978, 29892, 2933, 29889, 15901, 29918, 1272, 29892, 4480, 29922, 5574, 29897, 13, 4706, 931, 29889, 17059, 29898, 29896, 29900, 29897, 13, 4706, 1583, 3032, 8551, 29918, 4990, 580, 13, 13, 1678, 822, 903, 4990, 29898, 1311, 29892, 2933, 29901, 13291, 1125, 13, 4706, 9995, 9323, 278, 2933, 304, 263, 2635, 2009, 565, 278, 7481, 11286, 372, 29889, 13, 13, 4706, 826, 3174, 29901, 13, 9651, 2933, 29901, 3630, 1304, 491, 278, 2479, 5900, 304, 23120, 278, 13291, 13, 4706, 9995, 13, 4706, 565, 1583, 29889, 12120, 1275, 23851, 29968, 29918, 29902, 29901, 13, 9651, 1583, 3032, 4990, 29918, 3502, 29918, 29875, 29898, 5327, 29897, 13, 4706, 25342, 1583, 29889, 23569, 29889, 18045, 29901, 13, 9651, 1583, 3032, 4990, 29918, 23569, 29898, 5327, 29897, 13, 13, 1678, 822, 903, 4990, 29918, 3502, 29918, 29875, 29898, 1311, 29892, 2933, 29901, 13291, 1125, 13, 4706, 9995, 9323, 278, 2933, 304, 263, 2635, 2009, 373, 278, 4485, 306, 29889, 13, 13, 4706, 910, 5900, 1033, 367, 337, 29899, 3880, 363, 916, 21796, 393, 505, 385, 826, 28955, 3700, 2341, 13, 4706, 411, 278, 1021, 13391, 408, 278, 4485, 306, 29915, 29879, 29889, 13, 13, 4706, 826, 3174, 29901, 13, 9651, 2933, 29901, 3630, 1304, 491, 278, 2479, 5900, 304, 23120, 278, 13291, 13, 4706, 9995, 13, 4706, 2479, 29918, 1256, 353, 1583, 3032, 657, 29918, 4990, 29918, 1256, 29898, 5327, 29889, 1256, 29918, 2230, 29897, 13, 4706, 1583, 29889, 264, 25071, 29889, 311, 11236, 403, 29918, 21026, 29918, 13604, 580, 13, 4706, 1583, 29889, 264, 25071, 29889, 21026, 29918, 726, 29898, 4990, 29918, 1256, 29897, 13, 13, 1678, 822, 903, 657, 29918, 4990, 29918, 1256, 29898, 1311, 29892, 2635, 29918, 2230, 29901, 12865, 29897, 1599, 851, 29901, 13, 4706, 9995, 5809, 278, 12865, 1203, 4133, 515, 278, 13812, 363, 2479, 11976, 29889, 13, 13, 4706, 826, 3174, 29901, 13, 9651, 2635, 29918, 2230, 29901, 2866, 2708, 278, 2635, 393, 674, 367, 8833, 29889, 13, 4706, 9995, 13, 4706, 565, 1583, 29889, 2917, 29918, 3221, 29889, 657, 703, 1256, 29918, 4830, 1159, 1275, 376, 5773, 29979, 1115, 13, 9651, 2479, 29918, 1256, 353, 2635, 29918, 2230, 29889, 710, 615, 603, 11702, 29899, 29885, 22584, 29899, 29881, 22584, 29979, 1159, 13, 4706, 1683, 29901, 13, 9651, 2479, 29918, 1256, 353, 2635, 29918, 2230, 29889, 710, 615, 603, 11702, 29979, 22584, 29899, 29881, 22584, 29899, 29885, 1159, 13, 13, 4706, 736, 2479, 29918, 1256, 13, 13, 1678, 822, 903, 4990, 29918, 23569, 29898, 1311, 29892, 2933, 29901, 13291, 1125, 13, 4706, 9995, 9323, 278, 2933, 304, 263, 2635, 2009, 373, 263, 4742, 773, 278, 14839, 16657, 29889, 13, 13, 4706, 826, 3174, 29901, 13, 9651, 2933, 29901, 3630, 1304, 491, 278, 2479, 5900, 304, 23120, 278, 13291, 13, 4706, 9995, 13, 4706, 1583, 29889, 23569, 29889, 8551, 580, 13, 4706, 1583, 29889, 23569, 3366, 18448, 3250, 1231, 3108, 353, 2933, 29889, 1256, 29918, 2230, 29889, 710, 615, 603, 11702, 29909, 2564, 21064, 580, 13, 4706, 1583, 29889, 23569, 3366, 10874, 1231, 3108, 353, 2933, 29889, 1256, 29918, 2230, 29889, 710, 615, 603, 11702, 29933, 1159, 13, 4706, 1583, 29889, 23569, 3366, 3250, 1231, 3108, 353, 2933, 29889, 1256, 29918, 2230, 29889, 710, 615, 603, 11702, 29899, 29881, 1159, 13, 4706, 565, 1583, 29889, 12120, 1275, 23851, 29968, 29918, 2687, 29901, 13, 9651, 1583, 29889, 23569, 29889, 4294, 29918, 3488, 703, 1256, 29899, 3502, 29899, 2236, 29889, 29939, 828, 1159, 13, 4706, 1683, 29901, 13, 9651, 1583, 29889, 23569, 29889, 4294, 29918, 3488, 703, 1256, 29899, 19529, 519, 29889, 29939, 828, 1159, 13, 13, 1678, 822, 903, 8551, 29918, 4990, 29898, 1311, 1125, 13, 4706, 9995, 18759, 278, 2479, 18350, 310, 278, 2635, 1213, 15945, 13, 4706, 565, 1583, 29889, 12120, 1275, 376, 1357, 24077, 615, 29918, 3502, 29918, 29896, 1115, 13, 9651, 1583, 29889, 264, 25071, 29889, 21026, 29918, 12071, 580, 13, 9651, 1583, 29889, 264, 25071, 29889, 11236, 403, 29918, 21026, 29918, 13604, 580, 13, 9651, 1583, 29889, 264, 25071, 29889, 4990, 29918, 12847, 29889, 5992, 29918, 4925, 580, 13, 4706, 25342, 1583, 29889, 23569, 29889, 18045, 29901, 13, 9651, 1583, 29889, 23569, 29889, 14096, 580, 13, 13, 13, 1753, 1653, 29918, 808, 453, 7295, 13, 1678, 9995, 8431, 3955, 2341, 775, 1304, 304, 2254, 445, 19911, 964, 7136, 1213, 15945, 13, 1678, 736, 4712, 15797, 453, 580, 13, 2 ]
venv/Lib/site-packages/moderngl_window/meta/data.py
net-oil-man/Oilman-Manim-Tools
1
85218
from moderngl_window.meta.base import ResourceDescription class DataDescription(ResourceDescription): """Describes data file to load. This is a generic resource description type for loading resources that are not textures, programs and scenes. That loaded class is used depends on the ``kind`` or the file extension. Currently used to load: - text files - json files - binary files .. code:: python # Describe a text file. Text loader is used based on file extension DataDescription(path='data/text.txt') # Describe a json file. Json loader is used based on file extension DataDescription(path='data/data.json') # Describe a binary file. Specify a binary loader should be used. DataDescription(path='data/data.bin', kind='binary') """ default_kind = None resource_type = "data" def __init__(self, path=None, kind=None, **kwargs): """Initialize the resource description. Keyword Args: path (str): Relative path to the resource kind (str): The resource kind deciding loader class **kwargs: Additional custom attributes """ kwargs.update( {"path": path, "kind": kind} ) super().__init__(**kwargs)
[ 1, 515, 5400, 3820, 29918, 7165, 29889, 7299, 29889, 3188, 1053, 18981, 9868, 13, 13, 13, 1990, 3630, 9868, 29898, 6848, 9868, 1125, 13, 1678, 9995, 4002, 699, 5707, 848, 934, 304, 2254, 29889, 13, 13, 1678, 910, 338, 263, 10035, 6503, 6139, 1134, 13, 1678, 363, 8363, 7788, 393, 526, 451, 1426, 1973, 29892, 11104, 322, 20407, 29889, 13, 1678, 2193, 7500, 770, 338, 1304, 7111, 373, 278, 4954, 14380, 16159, 470, 278, 934, 6081, 29889, 13, 13, 1678, 15447, 1304, 304, 2254, 29901, 13, 13, 1678, 448, 1426, 2066, 13, 1678, 448, 4390, 2066, 13, 1678, 448, 7581, 2066, 13, 13, 1678, 6317, 775, 1057, 3017, 13, 13, 4706, 396, 20355, 915, 263, 1426, 934, 29889, 3992, 23466, 338, 1304, 2729, 373, 934, 6081, 13, 4706, 3630, 9868, 29898, 2084, 2433, 1272, 29914, 726, 29889, 3945, 1495, 13, 13, 4706, 396, 20355, 915, 263, 4390, 934, 29889, 14355, 23466, 338, 1304, 2729, 373, 934, 6081, 13, 4706, 3630, 9868, 29898, 2084, 2433, 1272, 29914, 1272, 29889, 3126, 1495, 13, 13, 4706, 396, 20355, 915, 263, 7581, 934, 29889, 12048, 1598, 263, 7581, 23466, 881, 367, 1304, 29889, 13, 4706, 3630, 9868, 29898, 2084, 2433, 1272, 29914, 1272, 29889, 2109, 742, 2924, 2433, 19541, 1495, 13, 1678, 9995, 13, 13, 1678, 2322, 29918, 14380, 353, 6213, 13, 1678, 6503, 29918, 1853, 353, 376, 1272, 29908, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 2224, 29922, 8516, 29892, 2924, 29922, 8516, 29892, 3579, 19290, 1125, 13, 4706, 9995, 6644, 6646, 278, 6503, 6139, 29889, 13, 13, 4706, 7670, 1742, 826, 3174, 29901, 13, 9651, 2224, 313, 710, 1125, 6376, 1230, 2224, 304, 278, 6503, 13, 9651, 2924, 313, 710, 1125, 450, 6503, 2924, 1602, 4821, 23466, 770, 13, 9651, 3579, 19290, 29901, 3462, 3245, 2888, 8393, 13, 4706, 9995, 13, 4706, 9049, 5085, 29889, 5504, 29898, 13, 9651, 8853, 2084, 1115, 2224, 29892, 376, 14380, 1115, 2924, 29913, 13, 4706, 1723, 13, 4706, 2428, 2141, 1649, 2344, 12035, 1068, 19290, 29897, 13, 2 ]
othelloai/gui/__init__.py
jcarrete5/othello
0
186801
"""GUI for the othello application.""" import logging import tkinter as tk import tkinter.messagebox from random import choice as choose_from from typing import Optional from .player import GUIPlayer from .. import bitboard as bb from ..ai import ai_default, ai_options, AIOption from ..board import Board from ..color import Color, opposite_color from ..exception import OutOfTurnError from ..game import Game, GameType _logger = logging.getLogger(__name__) _game: Optional[Game] = None _my_player: Optional[GUIPlayer] = None class BoardView(tk.Canvas): """Represents the state of the board graphically.""" def __init__(self, master): self._cell_size = 80 self._border_width = 0 self._grid_line_width = 1 super().__init__( master, width=self._cell_size * 8 + self._grid_line_width * 7, height=self._cell_size * 8 + self._grid_line_width * 7, borderwidth=f"{self._border_width}", highlightthickness=0, bg="#000", ) self.pack() self.bind("<Button-1>", self.onclick) _logger.debug( "Canvas dim (%d, %d)", self.winfo_reqwidth(), self.winfo_reqheight() ) self.redraw(Board(0, 0)) def onclick(self, event): _logger.debug("BoardView clicked %s", event) if _my_player is None: _logger.debug("My player is None. Ignoring...") return col = (event.x - self._border_width) / self.winfo_reqwidth() * 8 row = (event.y - self._border_width) / self.winfo_reqheight() * 8 _logger.debug("(row=%f, col=%f)", row, col) _logger.debug("(row=%d, col=%d)", row, col) if 0 <= col < 8 and 0 <= row < 8: pos = bb.Position(int(row), int(col)) try: _my_player.make_move(pos) except OutOfTurnError: tk.messagebox.showwarning("Illegal Move", "It is not your turn!") def redraw(self, board: Board): _logger.debug("Redrawing\n%s", board) self.delete(tk.ALL) for r in range(8): for c in range(8): x_off = ( c * self._cell_size + c * self._grid_line_width + self._border_width ) y_off = ( r * self._cell_size + r * self._grid_line_width + self._border_width ) # Draw green empty cell self.create_rectangle( x_off, y_off, self._cell_size + x_off, self._cell_size + y_off, fill="#060", ) # Draw piece in cell mask = bb.pos_mask(r, c) inset = 5 fill_color = None if board.white & mask != 0: fill_color = "#fff" elif board.black & mask != 0: fill_color = "#000" if fill_color: self.create_oval( x_off + inset, y_off + inset, x_off + self._cell_size - inset, y_off + self._cell_size - inset, fill=fill_color, ) class NewGameDialog(tk.Toplevel): """Modal dialog window for creating new games.""" def __init__(self, parent, board_view: BoardView): super().__init__(parent) self.board_view = board_view self.ai_settings = dict(depth=3) # Frames self.frame = tk.Frame(self) self.frame_color = tk.LabelFrame(self.frame, text="Color") self.frame_ai = tk.LabelFrame(self.frame, text="AI") self.frame_gametype = tk.LabelFrame(self.frame, text="Opponent") self.frame_ai_settings = tk.LabelFrame(self.frame_ai, text="Settings", border=0) # Variables self.color_var = tk.StringVar(self.frame, Color.black.name) self.game_type_var = tk.StringVar(self.frame, GameType.computer.name) self.ai_var = tk.StringVar(self.frame, ai_default.name) self.depth_var = tk.IntVar(self.frame, self.ai_settings["depth"]) # Radio buttons self.radiobutton_color_black = tk.Radiobutton( self.frame_color, text="Black", variable=self.color_var, value=Color.black.name, ) self.radiobutton_color_white = tk.Radiobutton( self.frame_color, text="White", variable=self.color_var, value=Color.white.name, ) self.radiobutton_color_random = tk.Radiobutton( self.frame_color, text="Random", variable=self.color_var, value=None ) self.radiobutton_gametype_computer = tk.Radiobutton( self.frame_gametype, text="Computer", variable=self.game_type_var, value=GameType.computer.name, ) self.radiobutton_gametype_online = tk.Radiobutton( self.frame_gametype, text="Online", variable=self.game_type_var, value=GameType.online.name, state=tk.DISABLED, ) # Buttons self.button_cancel = tk.Button(self.frame, text="Cancel", command=self.cancel) self.button_start = tk.Button(self.frame, text="Start", command=self.submit) # Option menus self.optionmenu_ai = tk.OptionMenu( self.frame_ai, self.ai_var, *(ai.name for ai in ai_options) ) # Spinbox self.spinbox_minmax_depth = tk.Spinbox( self.frame_ai_settings, textvariable=self.depth_var, width=5, from_=1, to=10, increment=1, ) # Labels self.label_depth = tk.Label(self.frame_ai_settings, text="Depth:") # Configure self.transient(parent) self.focus_set() self.grab_set() self.title("New Game") self.frame.pack_configure(expand=True) # Bindings self.bind("<Escape>", lambda e: self.cancel()) self.bind("<Return>", lambda e: self.submit()) self.ai_var.trace_add( "write", callback=lambda *args: self._layout_ai_settings() ) self.depth_var.trace_add( "write", callback=lambda *args: self.ai_settings.update(depth=self.depth_var.get()), ) self._layout() self.wait_window(self) _logger.debug("NewGameDialog closed") def _layout(self): self.frame_color.grid(row=0, column=0, sticky="n") self.radiobutton_color_black.grid(row=1, column=1, sticky="w") self.radiobutton_color_white.grid(row=2, column=1, sticky="w") self.radiobutton_color_random.grid(row=3, column=1, sticky="w") self.frame_gametype.grid(row=0, column=1, sticky="n") self.radiobutton_gametype_computer.grid(row=1, column=0, sticky="w") self.radiobutton_gametype_online.grid(row=2, column=0, sticky="w") self.frame_ai.grid(row=0, column=2, sticky="n") self.optionmenu_ai.grid(row=0, column=0, sticky="w") self._layout_ai_settings() self.button_cancel.grid(row=1, column=0) self.button_start.grid(row=1, column=1) def _layout_ai_settings(self): ai = AIOption[self.ai_var.get()] if ai is AIOption.Randy: self.frame_ai_settings.grid_remove() elif ai is AIOption.Marty: self.frame_ai_settings.grid(row=1, column=0) self.label_depth.grid(row=0, column=0) self.spinbox_minmax_depth.grid(row=0, column=1) else: assert False def cancel(self): _logger.debug("Cancel") self.destroy() def submit(self): global _game _logger.debug("Submit") if _game is not None: proceed = tk.messagebox.askokcancel( title="Start New Game", message="Another game is already in progress. Proceed?", ) if not proceed: self.destroy() self._reset_game() self.destroy() def _reset_game(self): global _game self._make_my_player() opponent = self._make_opponent_player(opposite_color(_my_player.color)) if _game is not None: _game.shutdown() _game = Game(_my_player, opponent) _game.start() def _make_my_player(self): global _my_player my_color = ( self.color_var.get() and Color[self.color_var.get()] or choose_from(list(Color)) ) _my_player = GUIPlayer( my_color, self.board_view.redraw, _show_winner, ) def _make_opponent_player(self, color: Color): game_type = GameType[self.game_type_var.get()] if game_type == GameType.computer: OpponentPlayerClass = ai_options[AIOption[self.ai_var.get()]] _logger.debug( "%s chosen with settings %s", OpponentPlayerClass.__name__, self.ai_settings, ) opponent = OpponentPlayerClass(color, **self.ai_settings) else: assert False, f"{game_type} not implemented" return opponent def _show_winner(color: Optional[Color], _: Board): if color is None: msg = "The game is drawn!" else: msg = f"{color.name.capitalize()} has won!" tk.messagebox.showinfo("Game Over", msg) def _init_widgets(root: tk.Tk): root.title("Othello") main = tk.Frame(root) main.pack_configure(expand=True) board_view = BoardView(main) menu_bar = tk.Menu(root) game_menu = tk.Menu(menu_bar, tearoff=0) game_menu.add_command( label="New Game...", command=lambda: NewGameDialog(root, board_view) ) menu_bar.add_cascade(label="Game", menu=game_menu) root.config(menu=menu_bar) # Immediately display a new game dialog NewGameDialog(root, board_view) def loop(): global _game _logger.debug("Init ui loop") try: root = tk.Tk() _init_widgets(root) root.mainloop() finally: if _game is not None: _game.shutdown()
[ 1, 9995, 29954, 3120, 363, 278, 288, 386, 3156, 2280, 1213, 15945, 13, 13, 5215, 12183, 13, 5215, 18883, 1639, 408, 18883, 13, 5215, 18883, 1639, 29889, 4906, 1884, 13, 3166, 4036, 1053, 7348, 408, 6755, 29918, 3166, 13, 3166, 19229, 1053, 28379, 13, 13, 3166, 869, 9106, 1053, 14839, 9075, 13, 3166, 6317, 1053, 2586, 3377, 408, 289, 29890, 13, 3166, 6317, 1794, 1053, 7468, 29918, 4381, 29892, 7468, 29918, 6768, 29892, 319, 5971, 683, 13, 3166, 6317, 3377, 1053, 12590, 13, 3166, 6317, 2780, 1053, 9159, 29892, 11564, 29918, 2780, 13, 3166, 6317, 11739, 1053, 4451, 2776, 27407, 2392, 13, 3166, 6317, 11802, 1053, 8448, 29892, 8448, 1542, 13, 13, 29918, 21707, 353, 12183, 29889, 657, 16363, 22168, 978, 1649, 29897, 13, 29918, 11802, 29901, 28379, 29961, 14199, 29962, 353, 6213, 13, 29918, 1357, 29918, 9106, 29901, 28379, 29961, 29954, 3120, 9075, 29962, 353, 6213, 13, 13, 13, 1990, 12590, 1043, 29898, 11178, 29889, 21960, 1125, 13, 1678, 9995, 1123, 4569, 1237, 278, 2106, 310, 278, 7613, 3983, 1711, 1213, 15945, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 5835, 1125, 13, 4706, 1583, 3032, 3729, 29918, 2311, 353, 29871, 29947, 29900, 13, 4706, 1583, 3032, 11466, 29918, 2103, 353, 29871, 29900, 13, 4706, 1583, 3032, 7720, 29918, 1220, 29918, 2103, 353, 29871, 29896, 13, 4706, 2428, 2141, 1649, 2344, 12035, 13, 9651, 5835, 29892, 13, 9651, 2920, 29922, 1311, 3032, 3729, 29918, 2311, 334, 29871, 29947, 718, 1583, 3032, 7720, 29918, 1220, 29918, 2103, 334, 29871, 29955, 29892, 13, 9651, 3171, 29922, 1311, 3032, 3729, 29918, 2311, 334, 29871, 29947, 718, 1583, 3032, 7720, 29918, 1220, 29918, 2103, 334, 29871, 29955, 29892, 13, 9651, 5139, 2103, 29922, 29888, 29908, 29912, 1311, 3032, 11466, 29918, 2103, 17671, 13, 9651, 12141, 27996, 2264, 29922, 29900, 29892, 13, 9651, 25989, 9880, 29900, 29900, 29900, 613, 13, 4706, 1723, 13, 4706, 1583, 29889, 4058, 580, 13, 4706, 1583, 29889, 5355, 28945, 3125, 29899, 29896, 28341, 1583, 29889, 265, 3808, 29897, 13, 13, 4706, 903, 21707, 29889, 8382, 29898, 13, 9651, 376, 21960, 3964, 313, 29995, 29881, 29892, 1273, 29881, 19123, 1583, 29889, 29893, 3888, 29918, 7971, 2103, 3285, 1583, 29889, 29893, 3888, 29918, 7971, 3545, 580, 13, 4706, 1723, 13, 13, 4706, 1583, 29889, 1127, 1610, 29898, 28397, 29898, 29900, 29892, 29871, 29900, 876, 13, 13, 1678, 822, 15630, 29898, 1311, 29892, 1741, 1125, 13, 4706, 903, 21707, 29889, 8382, 703, 28397, 1043, 11484, 1273, 29879, 613, 1741, 29897, 13, 4706, 565, 903, 1357, 29918, 9106, 338, 6213, 29901, 13, 9651, 903, 21707, 29889, 8382, 703, 3421, 4847, 338, 6213, 29889, 18076, 8253, 856, 1159, 13, 9651, 736, 13, 13, 4706, 784, 353, 313, 3696, 29889, 29916, 448, 1583, 3032, 11466, 29918, 2103, 29897, 847, 1583, 29889, 29893, 3888, 29918, 7971, 2103, 580, 334, 29871, 29947, 13, 4706, 1948, 353, 313, 3696, 29889, 29891, 448, 1583, 3032, 11466, 29918, 2103, 29897, 847, 1583, 29889, 29893, 3888, 29918, 7971, 3545, 580, 334, 29871, 29947, 13, 4706, 903, 21707, 29889, 8382, 703, 29898, 798, 16328, 29888, 29892, 784, 16328, 29888, 19123, 1948, 29892, 784, 29897, 13, 4706, 903, 21707, 29889, 8382, 703, 29898, 798, 16328, 29881, 29892, 784, 16328, 29881, 19123, 1948, 29892, 784, 29897, 13, 4706, 565, 29871, 29900, 5277, 784, 529, 29871, 29947, 322, 29871, 29900, 5277, 1948, 529, 29871, 29947, 29901, 13, 9651, 926, 353, 289, 29890, 29889, 8003, 29898, 524, 29898, 798, 511, 938, 29898, 1054, 876, 13, 9651, 1018, 29901, 13, 18884, 903, 1357, 29918, 9106, 29889, 5675, 29918, 11631, 29898, 1066, 29897, 13, 9651, 5174, 4451, 2776, 27407, 2392, 29901, 13, 18884, 18883, 29889, 4906, 1884, 29889, 4294, 27392, 703, 14126, 12018, 25249, 613, 376, 3112, 338, 451, 596, 2507, 29991, 1159, 13, 13, 1678, 822, 2654, 1610, 29898, 1311, 29892, 7613, 29901, 12590, 1125, 13, 4706, 903, 21707, 29889, 8382, 703, 9039, 1610, 292, 29905, 29876, 29995, 29879, 613, 7613, 29897, 13, 4706, 1583, 29889, 8143, 29898, 11178, 29889, 9818, 29897, 13, 4706, 363, 364, 297, 3464, 29898, 29947, 1125, 13, 9651, 363, 274, 297, 3464, 29898, 29947, 1125, 13, 18884, 921, 29918, 2696, 353, 313, 13, 462, 1678, 274, 334, 1583, 3032, 3729, 29918, 2311, 718, 274, 334, 1583, 3032, 7720, 29918, 1220, 29918, 2103, 718, 1583, 3032, 11466, 29918, 2103, 13, 18884, 1723, 13, 18884, 343, 29918, 2696, 353, 313, 13, 462, 1678, 364, 334, 1583, 3032, 3729, 29918, 2311, 718, 364, 334, 1583, 3032, 7720, 29918, 1220, 29918, 2103, 718, 1583, 3032, 11466, 29918, 2103, 13, 18884, 1723, 13, 18884, 396, 18492, 7933, 4069, 3038, 13, 18884, 1583, 29889, 3258, 29918, 1621, 2521, 29898, 13, 462, 1678, 921, 29918, 2696, 29892, 13, 462, 1678, 343, 29918, 2696, 29892, 13, 462, 1678, 1583, 3032, 3729, 29918, 2311, 718, 921, 29918, 2696, 29892, 13, 462, 1678, 1583, 3032, 3729, 29918, 2311, 718, 343, 29918, 2696, 29892, 13, 462, 1678, 5445, 9880, 29900, 29953, 29900, 613, 13, 18884, 1723, 13, 13, 18884, 396, 18492, 8424, 297, 3038, 13, 18884, 11105, 353, 289, 29890, 29889, 1066, 29918, 13168, 29898, 29878, 29892, 274, 29897, 13, 18884, 297, 842, 353, 29871, 29945, 13, 18884, 5445, 29918, 2780, 353, 6213, 13, 18884, 565, 7613, 29889, 10921, 669, 11105, 2804, 29871, 29900, 29901, 13, 462, 1678, 5445, 29918, 2780, 353, 12305, 18725, 29908, 13, 18884, 25342, 7613, 29889, 8517, 669, 11105, 2804, 29871, 29900, 29901, 13, 462, 1678, 5445, 29918, 2780, 353, 12305, 29900, 29900, 29900, 29908, 13, 18884, 565, 5445, 29918, 2780, 29901, 13, 462, 1678, 1583, 29889, 3258, 29918, 10611, 29898, 13, 462, 4706, 921, 29918, 2696, 718, 297, 842, 29892, 13, 462, 4706, 343, 29918, 2696, 718, 297, 842, 29892, 13, 462, 4706, 921, 29918, 2696, 718, 1583, 3032, 3729, 29918, 2311, 448, 297, 842, 29892, 13, 462, 4706, 343, 29918, 2696, 718, 1583, 3032, 3729, 29918, 2311, 448, 297, 842, 29892, 13, 462, 4706, 5445, 29922, 5589, 29918, 2780, 29892, 13, 462, 1678, 1723, 13, 13, 13, 1990, 1570, 14199, 7647, 29898, 11178, 29889, 29911, 1991, 955, 1125, 13, 1678, 9995, 19751, 7928, 3474, 363, 4969, 716, 8090, 1213, 15945, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 3847, 29892, 7613, 29918, 1493, 29901, 12590, 1043, 1125, 13, 4706, 2428, 2141, 1649, 2344, 12035, 3560, 29897, 13, 4706, 1583, 29889, 3377, 29918, 1493, 353, 7613, 29918, 1493, 13, 4706, 1583, 29889, 1794, 29918, 11027, 353, 9657, 29898, 19488, 29922, 29941, 29897, 13, 13, 4706, 396, 4693, 1280, 13, 4706, 1583, 29889, 2557, 353, 18883, 29889, 4308, 29898, 1311, 29897, 13, 4706, 1583, 29889, 2557, 29918, 2780, 353, 18883, 29889, 4775, 4308, 29898, 1311, 29889, 2557, 29892, 1426, 543, 3306, 1159, 13, 4706, 1583, 29889, 2557, 29918, 1794, 353, 18883, 29889, 4775, 4308, 29898, 1311, 29889, 2557, 29892, 1426, 543, 23869, 1159, 13, 4706, 1583, 29889, 2557, 29918, 29887, 314, 300, 668, 353, 18883, 29889, 4775, 4308, 29898, 1311, 29889, 2557, 29892, 1426, 543, 29949, 407, 265, 296, 1159, 13, 4706, 1583, 29889, 2557, 29918, 1794, 29918, 11027, 353, 18883, 29889, 4775, 4308, 29898, 1311, 29889, 2557, 29918, 1794, 29892, 1426, 543, 9585, 613, 5139, 29922, 29900, 29897, 13, 13, 4706, 396, 9586, 1849, 13, 4706, 1583, 29889, 2780, 29918, 1707, 353, 18883, 29889, 1231, 9037, 29898, 1311, 29889, 2557, 29892, 9159, 29889, 8517, 29889, 978, 29897, 13, 4706, 1583, 29889, 11802, 29918, 1853, 29918, 1707, 353, 18883, 29889, 1231, 9037, 29898, 1311, 29889, 2557, 29892, 8448, 1542, 29889, 12097, 261, 29889, 978, 29897, 13, 4706, 1583, 29889, 1794, 29918, 1707, 353, 18883, 29889, 1231, 9037, 29898, 1311, 29889, 2557, 29892, 7468, 29918, 4381, 29889, 978, 29897, 13, 4706, 1583, 29889, 19488, 29918, 1707, 353, 18883, 29889, 2928, 9037, 29898, 1311, 29889, 2557, 29892, 1583, 29889, 1794, 29918, 11027, 3366, 19488, 20068, 13, 13, 4706, 396, 9204, 9828, 13, 4706, 1583, 29889, 13399, 3092, 29918, 2780, 29918, 8517, 353, 18883, 29889, 21818, 3092, 29898, 13, 9651, 1583, 29889, 2557, 29918, 2780, 29892, 13, 9651, 1426, 543, 18700, 613, 13, 9651, 2286, 29922, 1311, 29889, 2780, 29918, 1707, 29892, 13, 9651, 995, 29922, 3306, 29889, 8517, 29889, 978, 29892, 13, 4706, 1723, 13, 4706, 1583, 29889, 13399, 3092, 29918, 2780, 29918, 10921, 353, 18883, 29889, 21818, 3092, 29898, 13, 9651, 1583, 29889, 2557, 29918, 2780, 29892, 13, 9651, 1426, 543, 21823, 613, 13, 9651, 2286, 29922, 1311, 29889, 2780, 29918, 1707, 29892, 13, 9651, 995, 29922, 3306, 29889, 10921, 29889, 978, 29892, 13, 4706, 1723, 13, 4706, 1583, 29889, 13399, 3092, 29918, 2780, 29918, 8172, 353, 18883, 29889, 21818, 3092, 29898, 13, 9651, 1583, 29889, 2557, 29918, 2780, 29892, 1426, 543, 17875, 613, 2286, 29922, 1311, 29889, 2780, 29918, 1707, 29892, 995, 29922, 8516, 13, 4706, 1723, 13, 4706, 1583, 29889, 13399, 3092, 29918, 29887, 314, 300, 668, 29918, 12097, 261, 353, 18883, 29889, 21818, 3092, 29898, 13, 9651, 1583, 29889, 2557, 29918, 29887, 314, 300, 668, 29892, 13, 9651, 1426, 543, 20606, 261, 613, 13, 9651, 2286, 29922, 1311, 29889, 11802, 29918, 1853, 29918, 1707, 29892, 13, 9651, 995, 29922, 14199, 1542, 29889, 12097, 261, 29889, 978, 29892, 13, 4706, 1723, 13, 4706, 1583, 29889, 13399, 3092, 29918, 29887, 314, 300, 668, 29918, 14627, 353, 18883, 29889, 21818, 3092, 29898, 13, 9651, 1583, 29889, 2557, 29918, 29887, 314, 300, 668, 29892, 13, 9651, 1426, 543, 2951, 1220, 613, 13, 9651, 2286, 29922, 1311, 29889, 11802, 29918, 1853, 29918, 1707, 29892, 13, 9651, 995, 29922, 14199, 1542, 29889, 14627, 29889, 978, 29892, 13, 9651, 2106, 29922, 11178, 29889, 23711, 6181, 29928, 29892, 13, 4706, 1723, 13, 13, 4706, 396, 1205, 7453, 13, 4706, 1583, 29889, 3092, 29918, 20713, 353, 18883, 29889, 3125, 29898, 1311, 29889, 2557, 29892, 1426, 543, 19420, 613, 1899, 29922, 1311, 29889, 20713, 29897, 13, 4706, 1583, 29889, 3092, 29918, 2962, 353, 18883, 29889, 3125, 29898, 1311, 29889, 2557, 29892, 1426, 543, 4763, 613, 1899, 29922, 1311, 29889, 7892, 29897, 13, 13, 4706, 396, 10831, 1757, 375, 13, 4706, 1583, 29889, 3385, 6510, 29918, 1794, 353, 18883, 29889, 8375, 6823, 29898, 13, 9651, 1583, 29889, 2557, 29918, 1794, 29892, 1583, 29889, 1794, 29918, 1707, 29892, 334, 29898, 1794, 29889, 978, 363, 7468, 297, 7468, 29918, 6768, 29897, 13, 4706, 1723, 13, 13, 4706, 396, 1706, 262, 1884, 13, 4706, 1583, 29889, 1028, 262, 1884, 29918, 1195, 3317, 29918, 19488, 353, 18883, 29889, 5592, 262, 1884, 29898, 13, 9651, 1583, 29889, 2557, 29918, 1794, 29918, 11027, 29892, 13, 9651, 1426, 11918, 29922, 1311, 29889, 19488, 29918, 1707, 29892, 13, 9651, 2920, 29922, 29945, 29892, 13, 9651, 515, 29918, 29922, 29896, 29892, 13, 9651, 304, 29922, 29896, 29900, 29892, 13, 9651, 11924, 29922, 29896, 29892, 13, 4706, 1723, 13, 13, 4706, 396, 15796, 29879, 13, 4706, 1583, 29889, 1643, 29918, 19488, 353, 18883, 29889, 4775, 29898, 1311, 29889, 2557, 29918, 1794, 29918, 11027, 29892, 1426, 543, 8498, 386, 29901, 1159, 13, 13, 4706, 396, 1281, 4532, 13, 4706, 1583, 29889, 3286, 993, 29898, 3560, 29897, 13, 4706, 1583, 29889, 18037, 29918, 842, 580, 13, 4706, 1583, 29889, 3874, 29890, 29918, 842, 580, 13, 4706, 1583, 29889, 3257, 703, 4373, 8448, 1159, 13, 4706, 1583, 29889, 2557, 29889, 4058, 29918, 17591, 29898, 18837, 29922, 5574, 29897, 13, 13, 4706, 396, 29672, 886, 13, 4706, 1583, 29889, 5355, 28945, 14190, 5738, 28341, 14013, 321, 29901, 1583, 29889, 20713, 3101, 13, 4706, 1583, 29889, 5355, 28945, 11609, 28341, 14013, 321, 29901, 1583, 29889, 7892, 3101, 13, 4706, 1583, 29889, 1794, 29918, 1707, 29889, 15003, 29918, 1202, 29898, 13, 9651, 376, 3539, 613, 6939, 29922, 2892, 334, 5085, 29901, 1583, 3032, 2680, 29918, 1794, 29918, 11027, 580, 13, 4706, 1723, 13, 4706, 1583, 29889, 19488, 29918, 1707, 29889, 15003, 29918, 1202, 29898, 13, 9651, 376, 3539, 613, 13, 9651, 6939, 29922, 2892, 334, 5085, 29901, 1583, 29889, 1794, 29918, 11027, 29889, 5504, 29898, 19488, 29922, 1311, 29889, 19488, 29918, 1707, 29889, 657, 25739, 13, 4706, 1723, 13, 13, 4706, 1583, 3032, 2680, 580, 13, 13, 4706, 1583, 29889, 10685, 29918, 7165, 29898, 1311, 29897, 13, 4706, 903, 21707, 29889, 8382, 703, 4373, 14199, 7647, 5764, 1159, 13, 13, 1678, 822, 903, 2680, 29898, 1311, 1125, 13, 4706, 1583, 29889, 2557, 29918, 2780, 29889, 7720, 29898, 798, 29922, 29900, 29892, 1897, 29922, 29900, 29892, 12070, 29891, 543, 29876, 1159, 13, 4706, 1583, 29889, 13399, 3092, 29918, 2780, 29918, 8517, 29889, 7720, 29898, 798, 29922, 29896, 29892, 1897, 29922, 29896, 29892, 12070, 29891, 543, 29893, 1159, 13, 4706, 1583, 29889, 13399, 3092, 29918, 2780, 29918, 10921, 29889, 7720, 29898, 798, 29922, 29906, 29892, 1897, 29922, 29896, 29892, 12070, 29891, 543, 29893, 1159, 13, 4706, 1583, 29889, 13399, 3092, 29918, 2780, 29918, 8172, 29889, 7720, 29898, 798, 29922, 29941, 29892, 1897, 29922, 29896, 29892, 12070, 29891, 543, 29893, 1159, 13, 13, 4706, 1583, 29889, 2557, 29918, 29887, 314, 300, 668, 29889, 7720, 29898, 798, 29922, 29900, 29892, 1897, 29922, 29896, 29892, 12070, 29891, 543, 29876, 1159, 13, 4706, 1583, 29889, 13399, 3092, 29918, 29887, 314, 300, 668, 29918, 12097, 261, 29889, 7720, 29898, 798, 29922, 29896, 29892, 1897, 29922, 29900, 29892, 12070, 29891, 543, 29893, 1159, 13, 4706, 1583, 29889, 13399, 3092, 29918, 29887, 314, 300, 668, 29918, 14627, 29889, 7720, 29898, 798, 29922, 29906, 29892, 1897, 29922, 29900, 29892, 12070, 29891, 543, 29893, 1159, 13, 13, 4706, 1583, 29889, 2557, 29918, 1794, 29889, 7720, 29898, 798, 29922, 29900, 29892, 1897, 29922, 29906, 29892, 12070, 29891, 543, 29876, 1159, 13, 4706, 1583, 29889, 3385, 6510, 29918, 1794, 29889, 7720, 29898, 798, 29922, 29900, 29892, 1897, 29922, 29900, 29892, 12070, 29891, 543, 29893, 1159, 13, 4706, 1583, 3032, 2680, 29918, 1794, 29918, 11027, 580, 13, 13, 4706, 1583, 29889, 3092, 29918, 20713, 29889, 7720, 29898, 798, 29922, 29896, 29892, 1897, 29922, 29900, 29897, 13, 4706, 1583, 29889, 3092, 29918, 2962, 29889, 7720, 29898, 798, 29922, 29896, 29892, 1897, 29922, 29896, 29897, 13, 13, 1678, 822, 903, 2680, 29918, 1794, 29918, 11027, 29898, 1311, 1125, 13, 4706, 7468, 353, 319, 5971, 683, 29961, 1311, 29889, 1794, 29918, 1707, 29889, 657, 580, 29962, 13, 4706, 565, 7468, 338, 319, 5971, 683, 29889, 29934, 13910, 29901, 13, 9651, 1583, 29889, 2557, 29918, 1794, 29918, 11027, 29889, 7720, 29918, 5992, 580, 13, 4706, 25342, 7468, 338, 319, 5971, 683, 29889, 15838, 29891, 29901, 13, 9651, 1583, 29889, 2557, 29918, 1794, 29918, 11027, 29889, 7720, 29898, 798, 29922, 29896, 29892, 1897, 29922, 29900, 29897, 13, 9651, 1583, 29889, 1643, 29918, 19488, 29889, 7720, 29898, 798, 29922, 29900, 29892, 1897, 29922, 29900, 29897, 13, 9651, 1583, 29889, 1028, 262, 1884, 29918, 1195, 3317, 29918, 19488, 29889, 7720, 29898, 798, 29922, 29900, 29892, 1897, 29922, 29896, 29897, 13, 4706, 1683, 29901, 13, 9651, 4974, 7700, 13, 13, 1678, 822, 12611, 29898, 1311, 1125, 13, 4706, 903, 21707, 29889, 8382, 703, 19420, 1159, 13, 4706, 1583, 29889, 20524, 580, 13, 13, 1678, 822, 9752, 29898, 1311, 1125, 13, 4706, 5534, 903, 11802, 13, 13, 4706, 903, 21707, 29889, 8382, 703, 16228, 1159, 13, 13, 4706, 565, 903, 11802, 338, 451, 6213, 29901, 13, 9651, 8469, 353, 18883, 29889, 4906, 1884, 29889, 1278, 554, 20713, 29898, 13, 18884, 3611, 543, 4763, 1570, 8448, 613, 13, 18884, 2643, 543, 2744, 1228, 3748, 338, 2307, 297, 6728, 29889, 1019, 3947, 29973, 613, 13, 9651, 1723, 13, 9651, 565, 451, 8469, 29901, 13, 18884, 1583, 29889, 20524, 580, 13, 13, 4706, 1583, 3032, 12071, 29918, 11802, 580, 13, 13, 4706, 1583, 29889, 20524, 580, 13, 13, 1678, 822, 903, 12071, 29918, 11802, 29898, 1311, 1125, 13, 4706, 5534, 903, 11802, 13, 13, 4706, 1583, 3032, 5675, 29918, 1357, 29918, 9106, 580, 13, 4706, 23995, 296, 353, 1583, 3032, 5675, 29918, 9354, 265, 296, 29918, 9106, 29898, 9354, 359, 568, 29918, 2780, 7373, 1357, 29918, 9106, 29889, 2780, 876, 13, 13, 4706, 565, 903, 11802, 338, 451, 6213, 29901, 13, 9651, 903, 11802, 29889, 845, 329, 3204, 580, 13, 13, 4706, 903, 11802, 353, 8448, 7373, 1357, 29918, 9106, 29892, 23995, 296, 29897, 13, 4706, 903, 11802, 29889, 2962, 580, 13, 13, 1678, 822, 903, 5675, 29918, 1357, 29918, 9106, 29898, 1311, 1125, 13, 4706, 5534, 903, 1357, 29918, 9106, 13, 13, 4706, 590, 29918, 2780, 353, 313, 13, 9651, 1583, 29889, 2780, 29918, 1707, 29889, 657, 580, 13, 9651, 322, 9159, 29961, 1311, 29889, 2780, 29918, 1707, 29889, 657, 580, 29962, 13, 9651, 470, 6755, 29918, 3166, 29898, 1761, 29898, 3306, 876, 13, 4706, 1723, 13, 4706, 903, 1357, 29918, 9106, 353, 14839, 9075, 29898, 13, 9651, 590, 29918, 2780, 29892, 13, 9651, 1583, 29889, 3377, 29918, 1493, 29889, 1127, 1610, 29892, 13, 9651, 903, 4294, 29918, 29893, 3993, 29892, 13, 4706, 1723, 13, 13, 1678, 822, 903, 5675, 29918, 9354, 265, 296, 29918, 9106, 29898, 1311, 29892, 2927, 29901, 9159, 1125, 13, 4706, 3748, 29918, 1853, 353, 8448, 1542, 29961, 1311, 29889, 11802, 29918, 1853, 29918, 1707, 29889, 657, 580, 29962, 13, 4706, 565, 3748, 29918, 1853, 1275, 8448, 1542, 29889, 12097, 261, 29901, 13, 9651, 438, 407, 265, 296, 9075, 2385, 353, 7468, 29918, 6768, 29961, 29909, 5971, 683, 29961, 1311, 29889, 1794, 29918, 1707, 29889, 657, 580, 5262, 13, 9651, 903, 21707, 29889, 8382, 29898, 13, 18884, 11860, 29879, 10434, 411, 6055, 1273, 29879, 613, 13, 18884, 438, 407, 265, 296, 9075, 2385, 17255, 978, 1649, 29892, 13, 18884, 1583, 29889, 1794, 29918, 11027, 29892, 13, 9651, 1723, 13, 9651, 23995, 296, 353, 438, 407, 265, 296, 9075, 2385, 29898, 2780, 29892, 3579, 1311, 29889, 1794, 29918, 11027, 29897, 13, 4706, 1683, 29901, 13, 9651, 4974, 7700, 29892, 285, 29908, 29912, 11802, 29918, 1853, 29913, 451, 8762, 29908, 13, 4706, 736, 23995, 296, 13, 13, 13, 1753, 903, 4294, 29918, 29893, 3993, 29898, 2780, 29901, 28379, 29961, 3306, 1402, 903, 29901, 12590, 1125, 13, 1678, 565, 2927, 338, 6213, 29901, 13, 4706, 10191, 353, 376, 1576, 3748, 338, 12061, 3850, 13, 1678, 1683, 29901, 13, 4706, 10191, 353, 285, 29908, 29912, 2780, 29889, 978, 29889, 5030, 2410, 675, 28296, 756, 2113, 3850, 13, 1678, 18883, 29889, 4906, 1884, 29889, 4294, 3888, 703, 14199, 6811, 613, 10191, 29897, 13, 13, 13, 1753, 903, 2344, 29918, 8030, 29879, 29898, 4632, 29901, 18883, 29889, 29911, 29895, 1125, 13, 1678, 3876, 29889, 3257, 703, 29949, 386, 3156, 1159, 13, 13, 1678, 1667, 353, 18883, 29889, 4308, 29898, 4632, 29897, 13, 1678, 1667, 29889, 4058, 29918, 17591, 29898, 18837, 29922, 5574, 29897, 13, 1678, 7613, 29918, 1493, 353, 12590, 1043, 29898, 3396, 29897, 13, 13, 1678, 6143, 29918, 1646, 353, 18883, 29889, 6823, 29898, 4632, 29897, 13, 1678, 3748, 29918, 6510, 353, 18883, 29889, 6823, 29898, 6510, 29918, 1646, 29892, 734, 279, 2696, 29922, 29900, 29897, 13, 1678, 3748, 29918, 6510, 29889, 1202, 29918, 6519, 29898, 13, 4706, 3858, 543, 4373, 8448, 856, 613, 1899, 29922, 2892, 29901, 1570, 14199, 7647, 29898, 4632, 29892, 7613, 29918, 1493, 29897, 13, 1678, 1723, 13, 1678, 6143, 29918, 1646, 29889, 1202, 29918, 9398, 6332, 29898, 1643, 543, 14199, 613, 6143, 29922, 11802, 29918, 6510, 29897, 13, 1678, 3876, 29889, 2917, 29898, 6510, 29922, 6510, 29918, 1646, 29897, 13, 13, 1678, 396, 1954, 4210, 2486, 2479, 263, 716, 3748, 7928, 13, 1678, 1570, 14199, 7647, 29898, 4632, 29892, 7613, 29918, 1493, 29897, 13, 13, 13, 1753, 2425, 7295, 13, 1678, 5534, 903, 11802, 13, 13, 1678, 903, 21707, 29889, 8382, 703, 6644, 14313, 2425, 1159, 13, 13, 1678, 1018, 29901, 13, 4706, 3876, 353, 18883, 29889, 29911, 29895, 580, 13, 4706, 903, 2344, 29918, 8030, 29879, 29898, 4632, 29897, 13, 4706, 3876, 29889, 3396, 7888, 580, 13, 1678, 7146, 29901, 13, 4706, 565, 903, 11802, 338, 451, 6213, 29901, 13, 9651, 903, 11802, 29889, 845, 329, 3204, 580, 13, 2 ]
mod_stats/tools/dlcount.py
openSUSE/mirrorbrain
24
81412
#!/usr/bin/python # Copyright 2008,2009 <NAME> # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License version 2 # as published by the Free Software Foundation; # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA # # # # Analyze Apache logfiles in order to count downloads # # # This script parses a MirrorBrain-enhanced access_log and does the following: # - select lines on that the log analysis is supposed to run # (StatsLogMask directive, which defaults to a regexp suitable for a MirrorBrain logfile) # The expression also selects data from the log line, for example the # country where a client request originated from. # - a little ring buffer filters requests recurring within a sliding time # window (keyed by ip+url+referer+user-agent # length of the sliding window: StatsDupWindow # - arbitrary log lines can be ignored by regexp (StatsIgnoreMask) # - IP addresses can be ignored by string prefix match (StatsIgnoreIP) # - apply prefiltering to the request (regular expressions with substitution) # with one or more StatsPrefilter directives # - parse the remaining request url into the values to be logged # (StatsCount directive) # - apply optional post-filtering to the parsed data (StatsPostfilter) # # # The script should serve as model implementation for the Apache module which # does the same in realtime. # # # Usage: # ./dlcount.py /var/log/apache2/download.services.openoffice.org/2009/11/download.services.openoffice.org-20091123-access_log.bz2 | sort -u # # Uncompressed, gzip or bzip2 compressed files are transparently opened. # # # This script uses Python generators, which means that it doesn't allocate # memory according to the log size. It rather works like a Unix pipe. # (The implementation of the generator pipeline is based on David Beazley's # PyCon UK 08 great talk about generator tricks for systems programmers.) # __version__ = '0.91' __author__ = '<NAME> <<EMAIL>>' __copyright__ = 'Peter poeml <<EMAIL>>' __license__ = 'GPLv2' __url__ = 'http://mirrorbrain.org/' try: import sys import os import os.path import re import hashlib import time from datetime import datetime from optparse import OptionParser set except NameError: from sets import Set as set # Python 2.3 fallback try: sorted except NameError: def sorted(in_value): # Python 2.3 fallback "A naive implementation of sorted" out_value = list(in_value) out_value.sort() return out_value def gen_open(filenames): """Open a sequence of filenames""" import gzip import bz2 for name in filenames: if name.endswith(".gz"): yield gzip.open(name) elif name.endswith(".bz2"): yield bz2.BZ2File(name) else: yield open(name) def gen_cat(sources): """Concatenate items from one or more source into a single sequence of items""" for s in sources: for item in s: yield item def gen_grep(pat, lines): import re patc = re.compile(pat) for line in lines: if patc.search(line): yield line def gen_fragments(lines, pat): """Generate a sequence of line fragments, according to a given regular expression""" for line in lines: m = pat.match(line) if m: yield m.groups() # else: # print 'no match for:' # print line class RingBuffer: """Here is a simple circular buffer, or ring buffer, implementation in Python. It is a first-in, first-out (FIFO) buffer with a fixed size. Here is an example where the buffer size is 4. Ten integers, 0-9, are inserted, one at a time, at the end of the buffer. Each iteration, the first element is removed from the front of the buffer. buf = RingBuffer(4) for i in xrange(10): buf.append(i) print buf.get() Here are the results: [None, None, None, 0] [None, None, 0, 1] [None, 0, 1, 2] [0, 1, 2, 3] [1, 2, 3, 4] [2, 3, 4, 5] [3, 4, 5, 6] [4, 5, 6, 7] [5, 6, 7, 8] [6, 7, 8, 9] from http://www.saltycrane.com/blog/2007/11/python-circular-buffer/ """ def __init__(self, size): self.data = [None for i in xrange(size)] def append(self, x): self.data.pop(0) self.data.append(x) def get(self): return self.data def readconf(filename): """we'd need Apache's config parser here...""" known_directives = ['StatsLogMask', 'StatsIgnoreMask', 'StatsIgnoreIP', 'StatsDupWindow', 'StatsPreFilter', 'StatsCount', 'StatsPostFilter'] known_directives_lower = [i.lower() for i in known_directives] # regular expressions to parse arguments parse_1_in_quotes = re.compile(r'"(.*)"') parse_2_in_quotes = re.compile(r'"(.*)"\s+"(.*)"') # create a dictionary to hold the config # each item is a list (because the directives could occur more than once) # each list item will correspond to one directive occurrence conf = {} for i in known_directives_lower: conf[i] = list() conf['statsdupwindow'] = 200 for line in open(filename): # remove trailing and leading whitespace and newlines line = line.strip() # ignore comment lines if line.startswith('#'): continue # and empty lines if not line: continue # split line into 1st word plus rest # will fail if it's not a valid config line try: word, val = line.split(None, 1) except: sys.exit('error: can\'t parse the line %r' % line) if word.lower() not in known_directives_lower: sys.exit('unknown config directive: %r' % word) directive = word.lower() val = val # this is just a single integer if directive in ['statsdupwindow']: conf[directive] = int(val) # directives with one argument: a regexp elif directive in ['statslogmask', 'statsignoremask']: m = parse_1_in_quotes.match(val) regex = m.group(1).replace('\\"', '"') regex_compiled = re.compile(regex) conf[directive].append((regex_compiled, regex)) # these come with two args: a regexp and a substitution rule elif directive in ['statsprefilter', 'statscount', 'statspostfilter']: m = parse_2_in_quotes.match(val) # print 'substitute %s by %s' % (m.group(1), m.group(2)) regex = m.group(1).replace('\\"', '"') subst = m.group(2).replace('\\"', '"') regex_compiled = re.compile(regex) conf[directive].append((regex_compiled, subst, regex)) elif directive in ['statsignoreip']: conf[directive].append(val) else: sys.exit('unparsed directive (implementation needed)', directive) # set defaults for directives that didn't occur in the config if not len(conf['statslogmask']): regex = '^(\S+).+\[(.*?)\] "GET (\S*) HTTP.*" (200|302) [^"]+ "([^"]*)" "([^"]*)".* \w\w:(\w\w) ASN:' regex_compiled = re.compile(regex) conf['statslogmask'] = [(regex_compiled, regex)] #import pprint # pprint.pprint(conf) # sys.exit(0) return conf # class Countable(): # """This holds a result from a parsed log line # which consists of a date and 5 attributes""" # #def __init__(self, date, a0, a1, a2, a3, a4): # def __init__(self, (date, a0, a1, a2, a3, a4, a5)): # self.date = date # self.a0 = a0 # self.a1 = a1 # self.a2 = a2 # self.a3 = a3 # self.a4 = a4 # self.a5 = a5 class Req(): """This helps us in housekeeping while parsing a log line""" def __init__(self): # url_raw contains the original url, if needed self.url_raw = None self.tstamp = None self.tstamp_raw = None self.date = None self.status = None self.referer = None self.ua = None self.country = None # this is the processed URL, after running through all the regexps self.url = None self.countable = False def __str__(self): return '%-80s' % self.url def as_tuple(self): return self.tuple # def as_obj(self): # return Countable(self.tuple) def gen_processreqs(reqs, conf, options): """process a tuple of request data, and return the parsed in the form of a generator""" known = RingBuffer(conf['statsdupwindow']) for req in reqs: rq = Req() if len(req) == 7: (ip, tstamp_raw, url, status, referer, ua, country) = req elif len(req) == 6: (ip, tstamp_raw, url, status, referer, ua) = req country = '' skip = False for r, mreg in conf['statsignoremask']: if r.match(url): # print 'ignoring req %s because it matches %s' %(url, mreg) skip = True break if skip: continue for i in conf['statsignoreip']: if ip.startswith(i): # print 'ignoring ip %s because it matches %s' %(ip, i) skip = True break if skip: continue # over a window of StatsDupWindow last requests, the same request must # not have occured already. If it did, ignore it. If it didn't, put # it into the ring buffer. if conf['statsdupwindow'] > 0: m = hashlib.md5() m.update(ip) m.update(url) m.update(referer) m.update(ua) md = m.digest() if md in known.data: continue known.append(md) rq.url_raw = url rq.status = status rq.referer = referer rq.ua = ua rq.country = country.lower() tstamp_raw = tstamp_raw.split()[0] # split off timezone offset - we ignore it rq.tstamp = time.strptime(tstamp_raw, '%d/%b/%Y:%H:%M:%S') rq.tstamp_raw = tstamp_raw # apply the prefiltering rules for r, s, mreg in conf['statsprefilter']: url = r.sub(s, url) matched = False for r, s, mreg in conf['statscount']: if r.match(url): if matched: # FIXME: eventually, we want to allow multiple matches. But now we are debugging. sys.exit('warning: %r matches\n %r\nbut already matched a pevious regexp:\n %r' % (url, mreg, matched)) url = r.sub(s, url) matched = mreg if not matched: if options.verbose: print 'not matched', url yield rq continue # apply postfiltering for r, s, mreg in conf['statspostfilter']: url = r.sub(s, url) rq.url = url # would time.strftime("%Y-%m-%d", ...) be faster? rq.date = datetime(rq.tstamp[0], rq.tstamp[1], rq.tstamp[2]) rq.tuple = [rq.date] rq.tuple.extend(rq.url.split()) # the country is our fifth attribute rq.tuple.append(rq.country) rq.tuple = tuple(rq.tuple) rq.countable = True # print rq yield rq def main(): """ Create a generator pipeline for the matching log file lines and process them. """ usage = 'usage: %prog [options] CONFIGFILE LOGFILE [LOGFILE ...]' version = '%prog ' + __version__ parser = OptionParser(usage=usage, version=version) # parser.disable_interspersed_args() parser.add_option('--db', action="store_true", dest="db", default=False, help="save counts to the database") parser.add_option('--db-home', help="specify directory where the database lives", metavar='DIR') parser.add_option("-q", "--quiet", action="store_true", dest="quiet", default=False, help="print only errors") parser.add_option("-v", "--verbose", action="store_true", dest="verbose", default=False, help="print debug messages to stderr") (options, args) = parser.parse_args() usage = usage.replace('%prog', os.path.basename(sys.argv[0])) if len(args) < 2: sys.exit(usage) conffile = args[0] filenames = args[1:] conf = readconf(conffile) logfiles = gen_open(filenames) loglines = gen_cat(logfiles) reqs = gen_fragments(loglines, conf['statslogmask'][0][0]) items = gen_processreqs(reqs, conf, options) if options.db and not options.db_home: sys.exit('--db-home is mandatory with --db.') if options.db: dirpath = options.db_home #dirpath = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) dirpath = os.path.realpath(dirpath) os.chdir(dirpath) sys.path.insert(0, os.path.dirname(dirpath)) os.environ['DJANGO_SETTINGS_MODULE'] = 'downloadstats.settings' from downloadstats.stats.models import Counter import downloadstats.settings if downloadstats.settings.DEBUG: from django import db # print 'you are runninng in DEBUG mode. This is not recommended, because\n' \ # 'Django then saves a copy of every SQL statement it has executed.\n' \ # 'I'm installing a cleanup handler that\'ll help.' # see below, in the loop # http://docs.djangoproject.com/en/dev/faq/models/#why-is-django-leaking-memory start = time.time() counterdict = {} n = 0 get = counterdict.get for item in items: if not item.countable: continue t = item.as_tuple() n += 1 counterdict[t] = get(t, 0) + 1 delta = time.time() - start print 'processed log in %.1f seconds, found %s valid and unique requests' % (delta, n) print '%s distinct countables' % len(counterdict) start = time.time() if options.db: for key, val in counterdict.iteritems(): (date, a0, a1, a2, a3, a4) = key if downloadstats.settings.DEBUG: db.reset_queries() counter, created = Counter.objects.get_or_create(date=date, product=a0, osname=a1, version=a2, lang=a3, country=a4) if created: # count is 1 for a new item counter.count = val else: # item existed already - increase its counter counter.count += val counter.save() delta = time.time() - start print 'saved counts to db in %.1f seconds' % delta sys.exit(0) if __name__ == '__main__': main()
[ 1, 18787, 4855, 29914, 2109, 29914, 4691, 13, 13, 29937, 14187, 1266, 29871, 29906, 29900, 29900, 29947, 29892, 29906, 29900, 29900, 29929, 529, 5813, 29958, 13, 29937, 13, 29937, 268, 910, 1824, 338, 3889, 7047, 29936, 366, 508, 2654, 391, 2666, 372, 322, 29914, 272, 13, 29937, 268, 6623, 372, 1090, 278, 4958, 310, 278, 15143, 4593, 5236, 19245, 1873, 29871, 29906, 13, 29937, 268, 408, 6369, 491, 278, 12362, 18540, 10606, 29936, 13, 29937, 13, 29937, 268, 910, 1824, 338, 13235, 297, 278, 4966, 393, 372, 674, 367, 5407, 29892, 13, 29937, 268, 541, 399, 1806, 8187, 2692, 13764, 29979, 399, 1718, 29934, 13566, 29979, 29936, 1728, 1584, 278, 2411, 2957, 1370, 21867, 29891, 310, 13, 29937, 268, 341, 1001, 3210, 13566, 2882, 6227, 11937, 470, 383, 1806, 8186, 1799, 15842, 319, 349, 8322, 2965, 13309, 1718, 349, 4574, 13152, 1660, 29889, 29871, 2823, 278, 13, 29937, 268, 15143, 4593, 5236, 19245, 363, 901, 4902, 29889, 13, 29937, 13, 29937, 268, 887, 881, 505, 4520, 263, 3509, 310, 278, 15143, 4593, 5236, 19245, 13, 29937, 268, 3412, 411, 445, 1824, 29936, 565, 451, 29892, 2436, 304, 278, 12362, 18540, 13, 29937, 268, 10606, 29892, 9266, 1696, 29871, 29945, 29896, 21504, 7103, 29892, 29008, 386, 383, 10102, 29892, 12115, 29892, 14861, 259, 29900, 29906, 29896, 29896, 29900, 29899, 29896, 29941, 29900, 29896, 29892, 8278, 13, 29937, 13, 29937, 13, 29937, 13, 29937, 11597, 29891, 911, 13380, 1480, 5325, 297, 1797, 304, 2302, 5142, 29879, 13, 29937, 13, 29937, 13, 29937, 910, 2471, 610, 29879, 267, 263, 11612, 729, 22097, 29899, 264, 29308, 2130, 29918, 1188, 322, 947, 278, 1494, 29901, 13, 29937, 259, 448, 1831, 3454, 373, 393, 278, 1480, 7418, 338, 7424, 304, 1065, 13, 29937, 268, 313, 25060, 3403, 19832, 17041, 29892, 607, 21274, 304, 263, 6528, 29886, 13907, 363, 263, 11612, 729, 22097, 1480, 1445, 29897, 13, 29937, 268, 450, 4603, 884, 27778, 848, 515, 278, 1480, 1196, 29892, 363, 1342, 278, 13, 29937, 268, 4234, 988, 263, 3132, 2009, 3978, 630, 515, 29889, 13, 29937, 259, 448, 263, 2217, 9228, 6835, 18094, 7274, 1162, 1038, 292, 2629, 263, 2243, 4821, 931, 13, 29937, 268, 3474, 313, 1989, 287, 491, 10377, 29974, 2271, 29974, 20275, 261, 29974, 1792, 29899, 14748, 13, 29937, 268, 3309, 310, 278, 2243, 4821, 3474, 29901, 624, 1446, 29928, 786, 5907, 13, 29937, 259, 448, 11472, 1480, 3454, 508, 367, 17262, 491, 6528, 29886, 313, 25060, 23805, 19832, 29897, 13, 29937, 259, 448, 5641, 14157, 508, 367, 17262, 491, 1347, 10944, 1993, 313, 25060, 23805, 5690, 29897, 13, 29937, 259, 448, 3394, 758, 4572, 292, 304, 278, 2009, 313, 15227, 12241, 411, 23697, 29897, 13, 29937, 268, 411, 697, 470, 901, 624, 1446, 29925, 999, 309, 357, 1513, 3145, 13, 29937, 259, 448, 6088, 278, 9886, 2009, 3142, 964, 278, 1819, 304, 367, 13817, 13, 29937, 268, 313, 25060, 3981, 17041, 29897, 13, 29937, 259, 448, 3394, 13136, 1400, 29899, 4572, 292, 304, 278, 21213, 848, 313, 25060, 6747, 4572, 29897, 13, 29937, 13, 29937, 13, 29937, 450, 2471, 881, 9080, 408, 1904, 5314, 363, 278, 13380, 3883, 607, 13, 29937, 947, 278, 1021, 297, 1855, 2230, 29889, 13, 29937, 13, 29937, 13, 29937, 10783, 482, 29901, 13, 29937, 11431, 11671, 2798, 29889, 2272, 847, 1707, 29914, 1188, 29914, 4288, 29906, 29914, 10382, 29889, 9916, 29889, 3150, 20205, 29889, 990, 29914, 29906, 29900, 29900, 29929, 29914, 29896, 29896, 29914, 10382, 29889, 9916, 29889, 3150, 20205, 29889, 990, 29899, 29906, 29900, 29900, 29929, 29896, 29896, 29906, 29941, 29899, 5943, 29918, 1188, 29889, 29890, 29920, 29906, 891, 2656, 448, 29884, 13, 29937, 13, 29937, 853, 510, 13120, 29892, 330, 7554, 470, 289, 7554, 29906, 419, 13120, 2066, 526, 1301, 862, 2705, 6496, 29889, 13, 29937, 13, 29937, 13, 29937, 910, 2471, 3913, 5132, 1176, 4097, 29892, 607, 2794, 393, 372, 1838, 29915, 29873, 23632, 13, 29937, 3370, 5034, 304, 278, 1480, 2159, 29889, 739, 3265, 1736, 763, 263, 26663, 14282, 29889, 13, 29937, 313, 1576, 5314, 310, 278, 15299, 16439, 338, 2729, 373, 4699, 1522, 834, 2330, 29915, 29879, 13, 29937, 10772, 1168, 10261, 29871, 29900, 29947, 2107, 5193, 1048, 15299, 534, 7358, 363, 6757, 1824, 13269, 1846, 13, 29937, 13, 13, 13, 1649, 3259, 1649, 353, 525, 29900, 29889, 29929, 29896, 29915, 13, 1649, 8921, 1649, 353, 12801, 5813, 29958, 3532, 26862, 6227, 6778, 29915, 13, 1649, 8552, 1266, 1649, 353, 525, 23686, 26576, 29880, 3532, 26862, 6227, 6778, 29915, 13, 1649, 506, 1947, 1649, 353, 525, 29954, 7390, 29894, 29906, 29915, 13, 1649, 2271, 1649, 353, 525, 1124, 597, 11038, 729, 2634, 262, 29889, 990, 22208, 13, 13, 13, 2202, 29901, 13, 5215, 10876, 13, 5215, 2897, 13, 5215, 2897, 29889, 2084, 13, 5215, 337, 13, 5215, 6608, 1982, 13, 5215, 931, 13, 3166, 12865, 1053, 12865, 13, 3166, 3523, 5510, 1053, 10831, 11726, 13, 842, 13, 19499, 4408, 2392, 29901, 13, 1678, 515, 6166, 1053, 3789, 408, 731, 268, 396, 5132, 29871, 29906, 29889, 29941, 6416, 1627, 13, 13, 2202, 29901, 13, 1678, 12705, 13, 19499, 4408, 2392, 29901, 13, 1678, 822, 12705, 29898, 262, 29918, 1767, 1125, 965, 396, 5132, 29871, 29906, 29889, 29941, 6416, 1627, 13, 4706, 376, 29909, 1055, 573, 5314, 310, 12705, 29908, 13, 4706, 714, 29918, 1767, 353, 1051, 29898, 262, 29918, 1767, 29897, 13, 4706, 714, 29918, 1767, 29889, 6605, 580, 13, 4706, 736, 714, 29918, 1767, 13, 13, 13, 1753, 2531, 29918, 3150, 29898, 1777, 264, 1280, 1125, 13, 1678, 9995, 6585, 263, 5665, 310, 977, 264, 1280, 15945, 29908, 13, 1678, 1053, 330, 7554, 13, 1678, 1053, 289, 29920, 29906, 13, 1678, 363, 1024, 297, 977, 264, 1280, 29901, 13, 4706, 565, 1024, 29889, 1975, 2541, 17350, 18828, 29908, 1125, 13, 9651, 7709, 330, 7554, 29889, 3150, 29898, 978, 29897, 13, 4706, 25342, 1024, 29889, 1975, 2541, 17350, 29890, 29920, 29906, 29908, 1125, 13, 9651, 7709, 289, 29920, 29906, 29889, 29933, 29999, 29906, 2283, 29898, 978, 29897, 13, 4706, 1683, 29901, 13, 9651, 7709, 1722, 29898, 978, 29897, 13, 13, 13, 1753, 2531, 29918, 4117, 29898, 29879, 2863, 1125, 13, 1678, 9995, 1168, 29883, 2579, 403, 4452, 515, 697, 470, 901, 13, 1678, 2752, 964, 263, 2323, 5665, 310, 4452, 15945, 29908, 13, 1678, 363, 269, 297, 8974, 29901, 13, 4706, 363, 2944, 297, 269, 29901, 13, 9651, 7709, 2944, 13, 13, 13, 1753, 2531, 29918, 22385, 29898, 5031, 29892, 3454, 1125, 13, 1678, 1053, 337, 13, 1678, 2373, 29883, 353, 337, 29889, 12198, 29898, 5031, 29897, 13, 1678, 363, 1196, 297, 3454, 29901, 13, 4706, 565, 2373, 29883, 29889, 4478, 29898, 1220, 1125, 13, 9651, 7709, 1196, 13, 13, 13, 1753, 2531, 29918, 29888, 1431, 1860, 29898, 9012, 29892, 2373, 1125, 13, 1678, 9995, 5631, 403, 263, 5665, 310, 1196, 22370, 29892, 5034, 304, 13, 1678, 263, 2183, 4943, 4603, 15945, 29908, 13, 1678, 363, 1196, 297, 3454, 29901, 13, 4706, 286, 353, 2373, 29889, 4352, 29898, 1220, 29897, 13, 4706, 565, 286, 29901, 13, 9651, 7709, 286, 29889, 13155, 580, 13, 4706, 396, 1683, 29901, 13, 4706, 396, 1678, 1596, 525, 1217, 1993, 363, 11283, 13, 4706, 396, 1678, 1596, 1196, 13, 13, 13, 1990, 17716, 7701, 29901, 13, 1678, 9995, 10605, 338, 263, 2560, 19308, 6835, 29892, 470, 9228, 6835, 29892, 5314, 297, 13, 1678, 5132, 29889, 739, 338, 263, 937, 29899, 262, 29892, 937, 29899, 449, 313, 3738, 5800, 29897, 6835, 411, 263, 4343, 2159, 29889, 13, 13, 1678, 2266, 338, 385, 1342, 988, 278, 6835, 2159, 338, 29871, 29946, 29889, 12444, 11920, 29892, 29871, 29900, 29899, 29929, 29892, 526, 13, 1678, 15478, 29892, 697, 472, 263, 931, 29892, 472, 278, 1095, 310, 278, 6835, 29889, 7806, 12541, 29892, 278, 937, 13, 1678, 1543, 338, 6206, 515, 278, 4565, 310, 278, 6835, 29889, 13, 13, 1678, 18392, 353, 17716, 7701, 29898, 29946, 29897, 13, 1678, 363, 474, 297, 921, 3881, 29898, 29896, 29900, 1125, 13, 4706, 18392, 29889, 4397, 29898, 29875, 29897, 13, 4706, 1596, 18392, 29889, 657, 580, 13, 13, 13, 1678, 2266, 526, 278, 2582, 29901, 13, 13, 1678, 518, 8516, 29892, 6213, 29892, 6213, 29892, 29871, 29900, 29962, 13, 1678, 518, 8516, 29892, 6213, 29892, 29871, 29900, 29892, 29871, 29896, 29962, 13, 1678, 518, 8516, 29892, 29871, 29900, 29892, 29871, 29896, 29892, 29871, 29906, 29962, 13, 1678, 518, 29900, 29892, 29871, 29896, 29892, 29871, 29906, 29892, 29871, 29941, 29962, 13, 1678, 518, 29896, 29892, 29871, 29906, 29892, 29871, 29941, 29892, 29871, 29946, 29962, 13, 1678, 518, 29906, 29892, 29871, 29941, 29892, 29871, 29946, 29892, 29871, 29945, 29962, 13, 1678, 518, 29941, 29892, 29871, 29946, 29892, 29871, 29945, 29892, 29871, 29953, 29962, 13, 1678, 518, 29946, 29892, 29871, 29945, 29892, 29871, 29953, 29892, 29871, 29955, 29962, 13, 1678, 518, 29945, 29892, 29871, 29953, 29892, 29871, 29955, 29892, 29871, 29947, 29962, 13, 1678, 518, 29953, 29892, 29871, 29955, 29892, 29871, 29947, 29892, 29871, 29929, 29962, 13, 13, 1678, 515, 1732, 597, 1636, 29889, 29879, 18745, 29883, 10800, 29889, 510, 29914, 7312, 29914, 29906, 29900, 29900, 29955, 29914, 29896, 29896, 29914, 4691, 29899, 6034, 1070, 29899, 9040, 29914, 13, 1678, 9995, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 2159, 1125, 13, 4706, 1583, 29889, 1272, 353, 518, 8516, 363, 474, 297, 921, 3881, 29898, 2311, 4638, 13, 13, 1678, 822, 9773, 29898, 1311, 29892, 921, 1125, 13, 4706, 1583, 29889, 1272, 29889, 7323, 29898, 29900, 29897, 13, 4706, 1583, 29889, 1272, 29889, 4397, 29898, 29916, 29897, 13, 13, 1678, 822, 679, 29898, 1311, 1125, 13, 4706, 736, 1583, 29889, 1272, 13, 13, 13, 1753, 1303, 5527, 29898, 9507, 1125, 13, 1678, 9995, 705, 29915, 29881, 817, 13380, 29915, 29879, 2295, 13812, 1244, 856, 15945, 29908, 13, 1678, 2998, 29918, 11851, 3145, 353, 6024, 25060, 3403, 19832, 742, 13, 462, 4706, 525, 25060, 23805, 19832, 742, 13, 462, 4706, 525, 25060, 23805, 5690, 742, 13, 462, 4706, 525, 25060, 29928, 786, 5907, 742, 13, 462, 4706, 525, 25060, 6572, 5072, 742, 13, 462, 4706, 525, 25060, 3981, 742, 13, 462, 4706, 525, 25060, 6747, 5072, 2033, 13, 1678, 2998, 29918, 11851, 3145, 29918, 13609, 353, 518, 29875, 29889, 13609, 580, 363, 474, 297, 2998, 29918, 11851, 3145, 29962, 13, 1678, 396, 4943, 12241, 304, 6088, 6273, 13, 1678, 6088, 29918, 29896, 29918, 262, 29918, 339, 4769, 353, 337, 29889, 12198, 29898, 29878, 11838, 28104, 5513, 1495, 13, 1678, 6088, 29918, 29906, 29918, 262, 29918, 339, 4769, 353, 337, 29889, 12198, 29898, 29878, 11838, 28104, 5513, 29905, 29879, 13578, 28104, 5513, 1495, 13, 13, 1678, 396, 1653, 263, 8600, 304, 4808, 278, 2295, 13, 1678, 396, 1269, 2944, 338, 263, 1051, 313, 18103, 278, 1513, 3145, 1033, 6403, 901, 1135, 2748, 29897, 13, 1678, 396, 1269, 1051, 2944, 674, 3928, 304, 697, 17041, 27170, 13, 1678, 1970, 353, 6571, 13, 1678, 363, 474, 297, 2998, 29918, 11851, 3145, 29918, 13609, 29901, 13, 4706, 1970, 29961, 29875, 29962, 353, 1051, 580, 13, 1678, 1970, 1839, 16202, 20908, 7165, 2033, 353, 29871, 29906, 29900, 29900, 13, 13, 1678, 363, 1196, 297, 1722, 29898, 9507, 1125, 13, 4706, 396, 3349, 25053, 322, 8236, 24358, 322, 716, 9012, 13, 4706, 1196, 353, 1196, 29889, 17010, 580, 13, 4706, 396, 11455, 3440, 3454, 13, 4706, 565, 1196, 29889, 27382, 2541, 14237, 29374, 13, 9651, 6773, 13, 4706, 396, 322, 4069, 3454, 13, 4706, 565, 451, 1196, 29901, 13, 9651, 6773, 13, 13, 4706, 396, 6219, 1196, 964, 29871, 29896, 303, 1734, 2298, 1791, 13, 4706, 396, 674, 4418, 565, 372, 29915, 29879, 451, 263, 2854, 2295, 1196, 13, 4706, 1018, 29901, 13, 9651, 1734, 29892, 659, 353, 1196, 29889, 5451, 29898, 8516, 29892, 29871, 29896, 29897, 13, 4706, 5174, 29901, 13, 9651, 10876, 29889, 13322, 877, 2704, 29901, 508, 20333, 29873, 6088, 278, 1196, 1273, 29878, 29915, 1273, 1196, 29897, 13, 4706, 565, 1734, 29889, 13609, 580, 451, 297, 2998, 29918, 11851, 3145, 29918, 13609, 29901, 13, 9651, 10876, 29889, 13322, 877, 26690, 2295, 17041, 29901, 1273, 29878, 29915, 1273, 1734, 29897, 13, 4706, 17041, 353, 1734, 29889, 13609, 580, 13, 4706, 659, 353, 659, 13, 13, 4706, 396, 445, 338, 925, 263, 2323, 6043, 13, 4706, 565, 17041, 297, 6024, 16202, 20908, 7165, 2033, 29901, 13, 9651, 1970, 29961, 11851, 573, 29962, 353, 938, 29898, 791, 29897, 13, 13, 4706, 396, 1513, 3145, 411, 697, 2980, 29901, 263, 6528, 29886, 13, 4706, 25342, 17041, 297, 6024, 16202, 1188, 13168, 742, 525, 16202, 647, 3668, 1278, 2033, 29901, 13, 9651, 286, 353, 6088, 29918, 29896, 29918, 262, 29918, 339, 4769, 29889, 4352, 29898, 791, 29897, 13, 9651, 6528, 353, 286, 29889, 2972, 29898, 29896, 467, 6506, 877, 1966, 29908, 742, 18793, 1495, 13, 9651, 6528, 29918, 2388, 2356, 353, 337, 29889, 12198, 29898, 13087, 29897, 13, 9651, 1970, 29961, 11851, 573, 1822, 4397, 3552, 13087, 29918, 2388, 2356, 29892, 6528, 876, 13, 13, 4706, 396, 1438, 2041, 411, 1023, 6389, 29901, 263, 6528, 29886, 322, 263, 23697, 5751, 13, 4706, 25342, 17041, 297, 6024, 6112, 1028, 999, 309, 357, 742, 525, 16202, 2798, 742, 525, 6112, 1028, 520, 4572, 2033, 29901, 13, 9651, 286, 353, 6088, 29918, 29906, 29918, 262, 29918, 339, 4769, 29889, 4352, 29898, 791, 29897, 13, 9651, 396, 1596, 525, 22492, 12356, 1273, 29879, 491, 1273, 29879, 29915, 1273, 313, 29885, 29889, 2972, 29898, 29896, 511, 286, 29889, 2972, 29898, 29906, 876, 13, 9651, 6528, 353, 286, 29889, 2972, 29898, 29896, 467, 6506, 877, 1966, 29908, 742, 18793, 1495, 13, 9651, 5960, 353, 286, 29889, 2972, 29898, 29906, 467, 6506, 877, 1966, 29908, 742, 18793, 1495, 13, 9651, 6528, 29918, 2388, 2356, 353, 337, 29889, 12198, 29898, 13087, 29897, 13, 9651, 1970, 29961, 11851, 573, 1822, 4397, 3552, 13087, 29918, 2388, 2356, 29892, 5960, 29892, 6528, 876, 13, 13, 4706, 25342, 17041, 297, 6024, 16202, 17281, 666, 2033, 29901, 13, 9651, 1970, 29961, 11851, 573, 1822, 4397, 29898, 791, 29897, 13, 13, 4706, 1683, 29901, 13, 9651, 10876, 29889, 13322, 877, 348, 862, 8485, 17041, 313, 21382, 4312, 29897, 742, 17041, 29897, 13, 13, 1678, 396, 731, 21274, 363, 1513, 3145, 393, 3282, 29915, 29873, 6403, 297, 278, 2295, 13, 1678, 565, 451, 7431, 29898, 5527, 1839, 16202, 1188, 13168, 2033, 1125, 13, 4706, 6528, 353, 525, 29985, 1194, 29903, 29974, 467, 3124, 15625, 5575, 29973, 2144, 29962, 376, 7194, 3441, 29903, 7528, 7331, 5575, 29908, 313, 29906, 29900, 29900, 29989, 29941, 29900, 29906, 29897, 518, 29985, 3108, 29974, 376, 4197, 29985, 3108, 29930, 5513, 376, 4197, 29985, 3108, 7528, 1642, 29930, 320, 29893, 29905, 29893, 29901, 1194, 29893, 29905, 29893, 29897, 3339, 29940, 11283, 13, 4706, 6528, 29918, 2388, 2356, 353, 337, 29889, 12198, 29898, 13087, 29897, 13, 4706, 1970, 1839, 16202, 1188, 13168, 2033, 353, 17288, 13087, 29918, 2388, 2356, 29892, 6528, 4638, 13, 13, 1678, 396, 5215, 282, 2158, 13, 1678, 396, 282, 2158, 29889, 407, 29878, 524, 29898, 5527, 29897, 13, 1678, 396, 10876, 29889, 13322, 29898, 29900, 29897, 13, 13, 1678, 736, 1970, 13, 13, 29937, 770, 3917, 519, 7295, 13, 29937, 1678, 9995, 4013, 8640, 263, 1121, 515, 263, 21213, 1480, 1196, 13, 29937, 1678, 607, 11624, 310, 263, 2635, 322, 29871, 29945, 8393, 15945, 29908, 13, 29937, 1678, 396, 1753, 4770, 2344, 12035, 1311, 29892, 2635, 29892, 263, 29900, 29892, 263, 29896, 29892, 263, 29906, 29892, 263, 29941, 29892, 263, 29946, 1125, 13, 29937, 1678, 822, 4770, 2344, 12035, 1311, 29892, 313, 1256, 29892, 263, 29900, 29892, 263, 29896, 29892, 263, 29906, 29892, 263, 29941, 29892, 263, 29946, 29892, 263, 29945, 22164, 13, 29937, 4706, 1583, 29889, 1256, 29871, 353, 2635, 13, 29937, 4706, 1583, 29889, 29874, 29900, 353, 263, 29900, 13, 29937, 4706, 1583, 29889, 29874, 29896, 353, 263, 29896, 13, 29937, 4706, 1583, 29889, 29874, 29906, 353, 263, 29906, 13, 29937, 4706, 1583, 29889, 29874, 29941, 353, 263, 29941, 13, 29937, 4706, 1583, 29889, 29874, 29946, 353, 263, 29946, 13, 29937, 4706, 1583, 29889, 29874, 29945, 353, 263, 29945, 13, 13, 13, 1990, 830, 29939, 7295, 13, 1678, 9995, 4013, 6911, 502, 297, 3699, 17462, 292, 1550, 13755, 263, 1480, 1196, 15945, 29908, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 396, 3142, 29918, 1610, 3743, 278, 2441, 3142, 29892, 565, 4312, 13, 4706, 1583, 29889, 2271, 29918, 1610, 353, 6213, 13, 4706, 1583, 29889, 29873, 303, 1160, 353, 6213, 13, 4706, 1583, 29889, 29873, 303, 1160, 29918, 1610, 353, 6213, 13, 4706, 1583, 29889, 1256, 353, 6213, 13, 4706, 1583, 29889, 4882, 353, 6213, 13, 4706, 1583, 29889, 20275, 261, 353, 6213, 13, 4706, 1583, 29889, 3357, 353, 6213, 13, 4706, 1583, 29889, 13509, 353, 6213, 13, 13, 4706, 396, 445, 338, 278, 19356, 3988, 29892, 1156, 2734, 1549, 599, 278, 6528, 567, 13, 4706, 1583, 29889, 2271, 353, 6213, 13, 13, 4706, 1583, 29889, 2798, 519, 353, 7700, 13, 13, 1678, 822, 4770, 710, 12035, 1311, 1125, 13, 4706, 736, 14210, 29899, 29947, 29900, 29879, 29915, 1273, 1583, 29889, 2271, 13, 13, 1678, 822, 408, 29918, 23583, 29898, 1311, 1125, 13, 4706, 736, 1583, 29889, 23583, 13, 29937, 1678, 822, 408, 29918, 5415, 29898, 1311, 1125, 13, 29937, 4706, 736, 3917, 519, 29898, 1311, 29889, 23583, 29897, 13, 13, 13, 1753, 2531, 29918, 5014, 7971, 29879, 29898, 7971, 29879, 29892, 1970, 29892, 3987, 1125, 13, 1678, 9995, 5014, 263, 18761, 310, 2009, 848, 29892, 322, 736, 278, 21213, 297, 278, 883, 310, 263, 15299, 15945, 29908, 13, 13, 1678, 2998, 353, 17716, 7701, 29898, 5527, 1839, 16202, 20908, 7165, 11287, 13, 13, 1678, 363, 12428, 297, 12428, 29879, 29901, 13, 4706, 364, 29939, 353, 830, 29939, 580, 13, 4706, 565, 7431, 29898, 7971, 29897, 1275, 29871, 29955, 29901, 13, 9651, 313, 666, 29892, 260, 303, 1160, 29918, 1610, 29892, 3142, 29892, 4660, 29892, 2737, 261, 29892, 318, 29874, 29892, 4234, 29897, 353, 12428, 13, 4706, 25342, 7431, 29898, 7971, 29897, 1275, 29871, 29953, 29901, 13, 9651, 313, 666, 29892, 260, 303, 1160, 29918, 1610, 29892, 3142, 29892, 4660, 29892, 2737, 261, 29892, 318, 29874, 29897, 353, 12428, 13, 9651, 4234, 353, 6629, 13, 13, 4706, 14383, 353, 7700, 13, 4706, 363, 364, 29892, 286, 1727, 297, 1970, 1839, 16202, 647, 3668, 1278, 2033, 29901, 13, 9651, 565, 364, 29889, 4352, 29898, 2271, 1125, 13, 18884, 396, 1596, 525, 647, 8253, 12428, 1273, 29879, 1363, 372, 7087, 1273, 29879, 29915, 1273, 29898, 2271, 29892, 286, 1727, 29897, 13, 18884, 14383, 353, 5852, 13, 18884, 2867, 13, 4706, 565, 14383, 29901, 13, 9651, 6773, 13, 13, 4706, 363, 474, 297, 1970, 1839, 16202, 17281, 666, 2033, 29901, 13, 9651, 565, 10377, 29889, 27382, 2541, 29898, 29875, 1125, 13, 18884, 396, 1596, 525, 647, 8253, 10377, 1273, 29879, 1363, 372, 7087, 1273, 29879, 29915, 1273, 29898, 666, 29892, 474, 29897, 13, 18884, 14383, 353, 5852, 13, 18884, 2867, 13, 4706, 565, 14383, 29901, 13, 9651, 6773, 13, 13, 4706, 396, 975, 263, 3474, 310, 624, 1446, 29928, 786, 5907, 1833, 7274, 29892, 278, 1021, 2009, 1818, 13, 4706, 396, 451, 505, 2179, 2955, 2307, 29889, 960, 372, 1258, 29892, 11455, 372, 29889, 960, 372, 3282, 29915, 29873, 29892, 1925, 13, 4706, 396, 372, 964, 278, 9228, 6835, 29889, 13, 4706, 565, 1970, 1839, 16202, 20908, 7165, 2033, 1405, 29871, 29900, 29901, 13, 9651, 286, 353, 6608, 1982, 29889, 3487, 29945, 580, 13, 9651, 286, 29889, 5504, 29898, 666, 29897, 13, 9651, 286, 29889, 5504, 29898, 2271, 29897, 13, 9651, 286, 29889, 5504, 29898, 20275, 261, 29897, 13, 9651, 286, 29889, 5504, 29898, 3357, 29897, 13, 9651, 22821, 353, 286, 29889, 7501, 342, 580, 13, 9651, 565, 22821, 297, 2998, 29889, 1272, 29901, 13, 18884, 6773, 13, 9651, 2998, 29889, 4397, 29898, 3487, 29897, 13, 13, 4706, 364, 29939, 29889, 2271, 29918, 1610, 353, 3142, 13, 4706, 364, 29939, 29889, 4882, 353, 4660, 13, 4706, 364, 29939, 29889, 20275, 261, 353, 2737, 261, 13, 4706, 364, 29939, 29889, 3357, 353, 318, 29874, 13, 4706, 364, 29939, 29889, 13509, 353, 4234, 29889, 13609, 580, 13, 13, 4706, 260, 303, 1160, 29918, 1610, 353, 260, 303, 1160, 29918, 1610, 29889, 5451, 580, 29961, 29900, 29962, 29871, 396, 6219, 1283, 29431, 9210, 448, 591, 11455, 372, 13, 4706, 364, 29939, 29889, 29873, 303, 1160, 353, 931, 29889, 710, 415, 603, 29898, 29873, 303, 1160, 29918, 1610, 29892, 14210, 29881, 22584, 29890, 22584, 29979, 16664, 29950, 16664, 29924, 16664, 29903, 1495, 13, 4706, 364, 29939, 29889, 29873, 303, 1160, 29918, 1610, 353, 260, 303, 1160, 29918, 1610, 13, 13, 4706, 396, 3394, 278, 758, 4572, 292, 6865, 13, 4706, 363, 364, 29892, 269, 29892, 286, 1727, 297, 1970, 1839, 6112, 1028, 999, 309, 357, 2033, 29901, 13, 9651, 3142, 353, 364, 29889, 1491, 29898, 29879, 29892, 3142, 29897, 13, 13, 4706, 19228, 353, 7700, 13, 4706, 363, 364, 29892, 269, 29892, 286, 1727, 297, 1970, 1839, 16202, 2798, 2033, 29901, 13, 9651, 565, 364, 29889, 4352, 29898, 2271, 1125, 13, 18884, 565, 19228, 29901, 13, 462, 1678, 396, 383, 6415, 2303, 29901, 10201, 29892, 591, 864, 304, 2758, 2999, 7087, 29889, 1205, 1286, 591, 526, 13490, 29889, 13, 462, 1678, 10876, 29889, 13322, 877, 27392, 29901, 1273, 29878, 7087, 29905, 29876, 259, 1273, 29878, 29905, 29876, 4187, 2307, 19228, 263, 1236, 2366, 6528, 29886, 3583, 29876, 259, 1273, 29878, 29915, 1273, 313, 2271, 29892, 286, 1727, 29892, 19228, 876, 13, 18884, 3142, 353, 364, 29889, 1491, 29898, 29879, 29892, 3142, 29897, 13, 18884, 19228, 353, 286, 1727, 13, 4706, 565, 451, 19228, 29901, 13, 9651, 565, 3987, 29889, 369, 15828, 29901, 13, 18884, 1596, 525, 1333, 19228, 742, 3142, 13, 9651, 7709, 364, 29939, 13, 9651, 6773, 13, 13, 4706, 396, 3394, 1400, 4572, 292, 13, 4706, 363, 364, 29892, 269, 29892, 286, 1727, 297, 1970, 1839, 6112, 1028, 520, 4572, 2033, 29901, 13, 9651, 3142, 353, 364, 29889, 1491, 29898, 29879, 29892, 3142, 29897, 13, 13, 4706, 364, 29939, 29889, 2271, 353, 3142, 13, 13, 4706, 396, 723, 931, 29889, 710, 615, 603, 11702, 29979, 19222, 29885, 19222, 29881, 613, 29757, 367, 8473, 29973, 13, 4706, 364, 29939, 29889, 1256, 353, 12865, 29898, 29878, 29939, 29889, 29873, 303, 1160, 29961, 29900, 1402, 364, 29939, 29889, 29873, 303, 1160, 29961, 29896, 1402, 364, 29939, 29889, 29873, 303, 1160, 29961, 29906, 2314, 13, 13, 4706, 364, 29939, 29889, 23583, 353, 518, 29878, 29939, 29889, 1256, 29962, 13, 4706, 364, 29939, 29889, 23583, 29889, 21843, 29898, 29878, 29939, 29889, 2271, 29889, 5451, 3101, 13, 4706, 396, 278, 4234, 338, 1749, 18615, 5352, 13, 4706, 364, 29939, 29889, 23583, 29889, 4397, 29898, 29878, 29939, 29889, 13509, 29897, 13, 4706, 364, 29939, 29889, 23583, 353, 18761, 29898, 29878, 29939, 29889, 23583, 29897, 13, 13, 4706, 364, 29939, 29889, 2798, 519, 353, 5852, 13, 4706, 396, 1596, 364, 29939, 13, 4706, 7709, 364, 29939, 13, 13, 13, 1753, 1667, 7295, 13, 1678, 9995, 13, 1678, 6204, 263, 15299, 16439, 363, 278, 9686, 1480, 934, 3454, 13, 1678, 322, 1889, 963, 29889, 13, 1678, 9995, 13, 13, 1678, 8744, 353, 525, 21125, 29901, 1273, 29097, 518, 6768, 29962, 8707, 18667, 7724, 25401, 7724, 518, 14480, 7724, 2023, 29962, 29915, 13, 1678, 1873, 353, 14210, 29097, 525, 718, 4770, 3259, 1649, 13, 13, 1678, 13812, 353, 10831, 11726, 29898, 21125, 29922, 21125, 29892, 1873, 29922, 3259, 29897, 13, 1678, 396, 13812, 29889, 20472, 29918, 1639, 1028, 414, 287, 29918, 5085, 580, 13, 13, 1678, 13812, 29889, 1202, 29918, 3385, 877, 489, 2585, 742, 13, 462, 418, 3158, 543, 8899, 29918, 3009, 613, 2731, 543, 2585, 613, 2322, 29922, 8824, 29892, 13, 462, 418, 1371, 543, 7620, 18139, 304, 278, 2566, 1159, 13, 13, 1678, 13812, 29889, 1202, 29918, 3385, 877, 489, 2585, 29899, 5184, 742, 13, 462, 418, 1371, 543, 6550, 1598, 3884, 988, 278, 2566, 12080, 613, 1539, 485, 279, 2433, 9464, 1495, 13, 13, 1678, 13812, 29889, 1202, 29918, 3385, 703, 29899, 29939, 613, 376, 489, 339, 2035, 613, 13, 462, 418, 3158, 543, 8899, 29918, 3009, 613, 2731, 543, 339, 2035, 613, 2322, 29922, 8824, 29892, 13, 462, 418, 1371, 543, 2158, 871, 4436, 1159, 13, 13, 1678, 13812, 29889, 1202, 29918, 3385, 703, 29899, 29894, 613, 376, 489, 369, 15828, 613, 13, 462, 418, 3158, 543, 8899, 29918, 3009, 613, 2731, 543, 369, 15828, 613, 2322, 29922, 8824, 29892, 13, 462, 418, 1371, 543, 2158, 4744, 7191, 304, 380, 20405, 1159, 13, 13, 1678, 313, 6768, 29892, 6389, 29897, 353, 13812, 29889, 5510, 29918, 5085, 580, 13, 13, 1678, 8744, 353, 8744, 29889, 6506, 877, 29995, 29097, 742, 2897, 29889, 2084, 29889, 6500, 3871, 29898, 9675, 29889, 19218, 29961, 29900, 12622, 13, 13, 1678, 565, 7431, 29898, 5085, 29897, 529, 29871, 29906, 29901, 13, 4706, 10876, 29889, 13322, 29898, 21125, 29897, 13, 13, 1678, 378, 600, 488, 353, 6389, 29961, 29900, 29962, 13, 1678, 977, 264, 1280, 353, 6389, 29961, 29896, 17531, 13, 13, 1678, 1970, 353, 1303, 5527, 29898, 535, 600, 488, 29897, 13, 13, 1678, 1480, 5325, 353, 2531, 29918, 3150, 29898, 1777, 264, 1280, 29897, 13, 1678, 1480, 9012, 353, 2531, 29918, 4117, 29898, 1188, 5325, 29897, 13, 1678, 12428, 29879, 353, 2531, 29918, 29888, 1431, 1860, 29898, 1188, 9012, 29892, 1970, 1839, 16202, 1188, 13168, 2033, 29961, 29900, 3816, 29900, 2314, 13, 1678, 4452, 353, 2531, 29918, 5014, 7971, 29879, 29898, 7971, 29879, 29892, 1970, 29892, 3987, 29897, 13, 13, 1678, 565, 3987, 29889, 2585, 322, 451, 3987, 29889, 2585, 29918, 5184, 29901, 13, 4706, 10876, 29889, 13322, 877, 489, 2585, 29899, 5184, 338, 9619, 7606, 411, 1192, 2585, 29889, 1495, 13, 13, 1678, 565, 3987, 29889, 2585, 29901, 13, 4706, 4516, 2084, 353, 3987, 29889, 2585, 29918, 5184, 13, 4706, 396, 3972, 2084, 353, 2897, 29889, 2084, 29889, 25721, 29898, 359, 29889, 2084, 29889, 25721, 29898, 359, 29889, 2084, 29889, 6370, 2084, 22168, 1445, 1649, 4961, 13, 4706, 4516, 2084, 353, 2897, 29889, 2084, 29889, 6370, 2084, 29898, 3972, 2084, 29897, 13, 4706, 2897, 29889, 305, 3972, 29898, 3972, 2084, 29897, 13, 4706, 10876, 29889, 2084, 29889, 7851, 29898, 29900, 29892, 2897, 29889, 2084, 29889, 25721, 29898, 3972, 2084, 876, 13, 4706, 2897, 29889, 21813, 1839, 29928, 29967, 2190, 17080, 29918, 10490, 29911, 4214, 29903, 29918, 6720, 14849, 1307, 2033, 353, 525, 10382, 16202, 29889, 11027, 29915, 13, 4706, 515, 5142, 16202, 29889, 16202, 29889, 9794, 1053, 315, 5336, 13, 13, 4706, 1053, 5142, 16202, 29889, 11027, 13, 4706, 565, 5142, 16202, 29889, 11027, 29889, 18525, 29901, 13, 9651, 515, 9557, 1053, 4833, 13, 9651, 396, 1596, 525, 6293, 526, 1065, 29876, 262, 865, 297, 21681, 4464, 29889, 910, 338, 451, 13622, 29892, 1363, 29905, 29876, 29915, 320, 13, 9651, 396, 418, 525, 29928, 5364, 769, 27401, 263, 3509, 310, 1432, 3758, 3229, 372, 756, 8283, 7790, 29876, 29915, 320, 13, 9651, 396, 418, 525, 29902, 29915, 29885, 15476, 263, 5941, 786, 7834, 393, 20333, 645, 1371, 6169, 13, 9651, 396, 1074, 2400, 29892, 297, 278, 2425, 13, 9651, 396, 1732, 597, 2640, 29889, 19776, 574, 26555, 622, 29889, 510, 29914, 264, 29914, 3359, 29914, 5444, 29939, 29914, 9794, 8484, 14606, 29899, 275, 29899, 14095, 29899, 280, 5086, 29899, 14834, 13, 13, 1678, 1369, 353, 931, 29889, 2230, 580, 13, 13, 1678, 6795, 8977, 353, 6571, 13, 1678, 302, 353, 29871, 29900, 13, 1678, 679, 353, 6795, 8977, 29889, 657, 13, 1678, 363, 2944, 297, 4452, 29901, 13, 4706, 565, 451, 2944, 29889, 2798, 519, 29901, 13, 9651, 6773, 13, 13, 4706, 260, 353, 2944, 29889, 294, 29918, 23583, 580, 13, 4706, 302, 4619, 29871, 29896, 13, 4706, 6795, 8977, 29961, 29873, 29962, 353, 679, 29898, 29873, 29892, 29871, 29900, 29897, 718, 29871, 29896, 13, 13, 1678, 19471, 353, 931, 29889, 2230, 580, 448, 1369, 13, 1678, 1596, 525, 5014, 287, 1480, 297, 18695, 29896, 29888, 6923, 29892, 1476, 1273, 29879, 2854, 322, 5412, 7274, 29915, 1273, 313, 4181, 29892, 302, 29897, 13, 1678, 1596, 14210, 29879, 8359, 2302, 1849, 29915, 1273, 7431, 29898, 11808, 8977, 29897, 13, 1678, 1369, 353, 931, 29889, 2230, 580, 13, 13, 1678, 565, 3987, 29889, 2585, 29901, 13, 4706, 363, 1820, 29892, 659, 297, 6795, 8977, 29889, 1524, 7076, 7295, 13, 13, 9651, 313, 1256, 29892, 263, 29900, 29892, 263, 29896, 29892, 263, 29906, 29892, 263, 29941, 29892, 263, 29946, 29897, 353, 1820, 13, 13, 9651, 565, 5142, 16202, 29889, 11027, 29889, 18525, 29901, 13, 18884, 4833, 29889, 12071, 29918, 339, 6358, 580, 13, 13, 9651, 6795, 29892, 2825, 353, 315, 5336, 29889, 12650, 29889, 657, 29918, 272, 29918, 3258, 29898, 1256, 29922, 1256, 29892, 13, 462, 462, 462, 632, 3234, 29922, 29874, 29900, 29892, 2897, 978, 29922, 29874, 29896, 29892, 1873, 29922, 29874, 29906, 29892, 6361, 29922, 29874, 29941, 29892, 13, 462, 462, 462, 632, 4234, 29922, 29874, 29946, 29897, 13, 9651, 565, 2825, 29901, 13, 18884, 396, 2302, 338, 29871, 29896, 363, 263, 716, 2944, 13, 18884, 6795, 29889, 2798, 353, 659, 13, 9651, 1683, 29901, 13, 18884, 396, 2944, 22856, 2307, 448, 7910, 967, 6795, 13, 18884, 6795, 29889, 2798, 4619, 659, 13, 9651, 6795, 29889, 7620, 580, 13, 13, 4706, 19471, 353, 931, 29889, 2230, 580, 448, 1369, 13, 4706, 1596, 525, 17314, 18139, 304, 4833, 297, 18695, 29896, 29888, 6923, 29915, 1273, 19471, 13, 13, 1678, 10876, 29889, 13322, 29898, 29900, 29897, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 1667, 580, 13, 2 ]
tests/libs/datasets/zeros_filter_test.py
ConsultingMD/covid-data-model
0
111732
import more_itertools import structlog from covidactnow.datapublic.common_fields import CommonFields from libs.datasets.sources import zeros_filter from libs.pipeline import Region from tests import test_helpers from tests.test_helpers import TimeseriesLiteral import pandas as pd def test_basic(): region_tx = Region.from_state("TX") region_sf = Region.from_fips("06075") region_hi = Region.from_state("HI") # Add a timeseries with a tag to make sure they are preserved. ts_with_tag = TimeseriesLiteral( [0, 0, 0], annotation=[test_helpers.make_tag(date="2020-04-01")] ) ds_in = test_helpers.build_dataset( { region_tx: {CommonFields.VACCINES_DISTRIBUTED: [0, 0, 0]}, region_sf: {CommonFields.VACCINES_DISTRIBUTED: [0, 0, 1]}, region_hi: { CommonFields.VACCINES_DISTRIBUTED: [0, 0, None], CommonFields.CASES: ts_with_tag, }, } ) with structlog.testing.capture_logs() as logs: ds_out = zeros_filter.drop_all_zero_timeseries(ds_in, [CommonFields.VACCINES_DISTRIBUTED]) ds_expected = test_helpers.build_dataset( { region_sf: {CommonFields.VACCINES_DISTRIBUTED: [0, 0, 1]}, region_hi: {CommonFields.CASES: ts_with_tag}, } ) log = more_itertools.one(logs) assert log["event"] == zeros_filter.DROPPING_TIMESERIES_WITH_ONLY_ZEROS assert pd.MultiIndex.from_tuples( [ (region_hi.location_id, CommonFields.VACCINES_DISTRIBUTED), (region_tx.location_id, CommonFields.VACCINES_DISTRIBUTED), ] ).equals(log["dropped"]) test_helpers.assert_dataset_like(ds_expected, ds_out)
[ 1, 1053, 901, 29918, 1524, 8504, 13, 5215, 2281, 1188, 13, 3166, 18838, 333, 627, 3707, 29889, 4130, 481, 803, 29889, 9435, 29918, 9621, 1053, 13103, 14256, 13, 13, 3166, 4303, 29879, 29889, 14538, 1691, 29889, 29879, 2863, 1053, 24786, 29918, 4572, 13, 3166, 4303, 29879, 29889, 13096, 5570, 1053, 11069, 13, 3166, 6987, 1053, 1243, 29918, 3952, 6774, 13, 3166, 6987, 29889, 1688, 29918, 3952, 6774, 1053, 10277, 6358, 24938, 284, 13, 5215, 11701, 408, 10518, 13, 13, 13, 1753, 1243, 29918, 16121, 7295, 13, 1678, 5120, 29918, 7508, 353, 11069, 29889, 3166, 29918, 3859, 703, 28627, 1159, 13, 1678, 5120, 29918, 4668, 353, 11069, 29889, 3166, 29918, 29888, 4512, 703, 29900, 29953, 29900, 29955, 29945, 1159, 13, 1678, 5120, 29918, 2918, 353, 11069, 29889, 3166, 29918, 3859, 703, 17628, 1159, 13, 1678, 396, 3462, 263, 3064, 6358, 411, 263, 4055, 304, 1207, 1854, 896, 526, 21634, 29889, 13, 1678, 18696, 29918, 2541, 29918, 4039, 353, 10277, 6358, 24938, 284, 29898, 13, 4706, 518, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 1402, 17195, 11759, 1688, 29918, 3952, 6774, 29889, 5675, 29918, 4039, 29898, 1256, 543, 29906, 29900, 29906, 29900, 29899, 29900, 29946, 29899, 29900, 29896, 13531, 13, 1678, 1723, 13, 1678, 18031, 29918, 262, 353, 1243, 29918, 3952, 6774, 29889, 4282, 29918, 24713, 29898, 13, 4706, 426, 13, 9651, 5120, 29918, 7508, 29901, 426, 18877, 14256, 29889, 29963, 2477, 29907, 1177, 2890, 29918, 4571, 1254, 3960, 29933, 2692, 3352, 29901, 518, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29962, 1118, 13, 9651, 5120, 29918, 4668, 29901, 426, 18877, 14256, 29889, 29963, 2477, 29907, 1177, 2890, 29918, 4571, 1254, 3960, 29933, 2692, 3352, 29901, 518, 29900, 29892, 29871, 29900, 29892, 29871, 29896, 29962, 1118, 13, 9651, 5120, 29918, 2918, 29901, 426, 13, 18884, 13103, 14256, 29889, 29963, 2477, 29907, 1177, 2890, 29918, 4571, 1254, 3960, 29933, 2692, 3352, 29901, 518, 29900, 29892, 29871, 29900, 29892, 6213, 1402, 13, 18884, 13103, 14256, 29889, 23487, 29903, 29901, 18696, 29918, 2541, 29918, 4039, 29892, 13, 9651, 2981, 13, 4706, 500, 13, 1678, 1723, 13, 13, 1678, 411, 2281, 1188, 29889, 13424, 29889, 17885, 545, 29918, 20756, 580, 408, 10748, 29901, 13, 4706, 18031, 29918, 449, 353, 24786, 29918, 4572, 29889, 8865, 29918, 497, 29918, 9171, 29918, 3706, 6358, 29898, 6289, 29918, 262, 29892, 518, 18877, 14256, 29889, 29963, 2477, 29907, 1177, 2890, 29918, 4571, 1254, 3960, 29933, 2692, 3352, 2314, 13, 1678, 18031, 29918, 9684, 353, 1243, 29918, 3952, 6774, 29889, 4282, 29918, 24713, 29898, 13, 4706, 426, 13, 9651, 5120, 29918, 4668, 29901, 426, 18877, 14256, 29889, 29963, 2477, 29907, 1177, 2890, 29918, 4571, 1254, 3960, 29933, 2692, 3352, 29901, 518, 29900, 29892, 29871, 29900, 29892, 29871, 29896, 29962, 1118, 13, 9651, 5120, 29918, 2918, 29901, 426, 18877, 14256, 29889, 23487, 29903, 29901, 18696, 29918, 2541, 29918, 4039, 1118, 13, 4706, 500, 13, 1678, 1723, 13, 1678, 1480, 353, 901, 29918, 1524, 8504, 29889, 650, 29898, 20756, 29897, 13, 1678, 4974, 1480, 3366, 3696, 3108, 1275, 24786, 29918, 4572, 29889, 29928, 1672, 18009, 4214, 29918, 15307, 6304, 29059, 29918, 29956, 13054, 29918, 1164, 16786, 29918, 29999, 1001, 3267, 13, 1678, 4974, 10518, 29889, 15329, 3220, 29889, 3166, 29918, 9161, 2701, 29898, 13, 4706, 518, 13, 9651, 313, 12803, 29918, 2918, 29889, 5479, 29918, 333, 29892, 13103, 14256, 29889, 29963, 2477, 29907, 1177, 2890, 29918, 4571, 1254, 3960, 29933, 2692, 3352, 511, 13, 9651, 313, 12803, 29918, 7508, 29889, 5479, 29918, 333, 29892, 13103, 14256, 29889, 29963, 2477, 29907, 1177, 2890, 29918, 4571, 1254, 3960, 29933, 2692, 3352, 511, 13, 4706, 4514, 13, 1678, 13742, 10954, 29898, 1188, 3366, 26419, 2986, 20068, 13, 1678, 1243, 29918, 3952, 6774, 29889, 9294, 29918, 24713, 29918, 4561, 29898, 6289, 29918, 9684, 29892, 18031, 29918, 449, 29897, 13, 2 ]
fypy/model/levy/__init__.py
jkirkby3/fypy
16
1611163
<filename>fypy/model/levy/__init__.py from fypy.model.levy.VarianceGamma import VarianceGamma from fypy.model.levy.BlackScholes import BlackScholes from fypy.model.levy.CGMY import CMGY from fypy.model.levy.KouJD import KouJD from fypy.model.levy.MertonJD import MertonJD from fypy.model.levy.NIG import NIG
[ 1, 529, 9507, 29958, 29888, 1478, 29891, 29914, 4299, 29914, 2608, 29891, 29914, 1649, 2344, 26914, 2272, 13, 3166, 285, 1478, 29891, 29889, 4299, 29889, 2608, 29891, 29889, 9037, 8837, 6642, 1053, 11681, 8837, 6642, 13, 3166, 285, 1478, 29891, 29889, 4299, 29889, 2608, 29891, 29889, 18700, 4504, 6544, 1053, 6054, 4504, 6544, 13, 3166, 285, 1478, 29891, 29889, 4299, 29889, 2608, 29891, 29889, 11135, 17870, 1053, 315, 29924, 29954, 29979, 13, 3166, 285, 1478, 29891, 29889, 4299, 29889, 2608, 29891, 29889, 29968, 283, 29967, 29928, 1053, 476, 283, 29967, 29928, 13, 3166, 285, 1478, 29891, 29889, 4299, 29889, 2608, 29891, 29889, 29924, 28634, 29967, 29928, 1053, 341, 28634, 29967, 29928, 13, 3166, 285, 1478, 29891, 29889, 4299, 29889, 2608, 29891, 29889, 29940, 6259, 1053, 405, 6259, 2 ]
challenges/2021-10-26-the-24-game/solutions/mob/mob.py
JenniferToops/CodingDojo
34
137990
<gh_stars>10-100 import unittest """ # The 24 Game The `24` game is played as follows. You are given a list of four integers, each in a fixed order. By placing the operators +, -, *, and / between the numbers, and grouping them with parentheses, determine whether it is possible to reach the value `24`. For example, given the input [5, 2, 7, 8], you should return True, since (5 * 2 - 7) * 8 = 24. Write a function that plays the `24` game. ## Business Rules/Errata - Your input will always consist of an array of four integers. These integers do not all need to be positive. - Your function should return a boolean value indicating whether the input can be combined to produce `24`. You do not need to produce the formula that yields `24`. - The results of any division operation should be rounded to the nearest integer. So, `3 / 2 = 2`, not `3 / 2 = 1`. - The result of division by zero should be zero, not undefined. ## Examples ``` play([5, 2, 7, 8]); // True -> (5 * 2 - 7) * 8 = 24 play([2, 4, 8, 10]); // True -> 2 + 4 + 8 + 10 = 24 play([5, 0, 4, 4]); // True -> (5 + 0) * 4 + 4 = 24 play([47, 2, 0, 0]); // True -> (47 / 2) + 0 + 0 = 24 play([1, 5, 7, 19]); // False, no combinations yield 24 ``` """ # depth first search through a tree # use a STACK - last in/first out # Keep track of: # The stack of lists to operate on def play(int_list): # Create a STACK (aka list) stack = [int_list] # While the stack is not empty while stack: # Pop an item (sublist) off the stack sublist = stack.pop() # If your sublist is length 1: if len(sublist) == 1: # if the only number in sublist is 24, return True. if sublist[0] == 24: return True # Otherwise, throw out sublist and go back to the start of the while loop continue # For each pair of items in sublist for i in range(len(sublist) - 1): # Do all four operations on the pair of items, collect in a list called RESULTS first, second = sublist[i], sublist[i + 1] results = [first + second, first - second, first * second] results.append(0 if second == 0 else round(first / second)) # For each result in RESULTS for result in results: # Create a list (from sublist) replacing the two input numbers with result current = sublist[:i] + [result] + sublist[i + 2:] # add the new, smaller list to the stack stack.append(current) # Return False return False class TestPlay(unittest.TestCase): def setUp(self): self.prod_sub_prod = [5, 2, 7, 8] self.addition = [2, 4, 8, 10] self.subtraction = [27, 1, 1, 1] self.add_prod_add = [5, 0, 4, 4] self.div_roundup = [47, 2, 0, 0] self.div_rounddown = [1, 1, 73, 3] self.fail = [1, 5, 7, 19] def test_prod_sub_prod(self): self.assertTrue(play(self.prod_sub_prod), "(5 * 2 - 7) * 8 = 24 -> True") def test_addition(self): self.assertTrue(play(self.addition), "2 + 4 + 8 + 10 = 24 -> True") def test_subtraction(self): self.assertTrue(play(self.subtraction), "27 - 1 - 1 - 1 = 24 -> True") def test_add_prod_add(self): self.assertTrue(play(self.add_prod_add), "(5 + 0) * 4 + 4 = 24 -> True") def test_div_roundup(self): self.assertTrue(play(self.div_roundup), "47 / 2 + 0 + 0 = 23.5 -> 24 -> True") def test_div_rounddown(self): self.assertTrue(play(self.div_rounddown), "1 - 1 + (73 / 3) = 24.33 -> 24 -> True") def test_fail(self): self.assertFalse(play(self.fail), "1 ? 5 ? 7 ? 19 != 24 -> False") def tearDown(self): pass if __name__ == "__main__": unittest.main()
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29900, 29899, 29896, 29900, 29900, 13, 5215, 443, 27958, 13, 13, 15945, 29908, 13, 29937, 450, 29871, 29906, 29946, 8448, 13, 13, 1576, 421, 29906, 29946, 29952, 3748, 338, 5318, 408, 4477, 29889, 887, 526, 2183, 263, 1051, 310, 3023, 11920, 29892, 1269, 297, 263, 4343, 1797, 29889, 2648, 13, 24421, 278, 12768, 718, 29892, 448, 29892, 334, 29892, 322, 847, 1546, 278, 3694, 29892, 322, 27270, 963, 411, 29494, 29892, 8161, 3692, 372, 338, 1950, 304, 6159, 278, 995, 421, 29906, 29946, 1412, 13, 13, 2831, 1342, 29892, 2183, 278, 1881, 518, 29945, 29892, 29871, 29906, 29892, 29871, 29955, 29892, 29871, 29947, 1402, 366, 881, 736, 5852, 29892, 1951, 313, 29945, 334, 29871, 29906, 448, 29871, 29955, 29897, 334, 29871, 29947, 353, 29871, 29906, 29946, 29889, 13, 13, 6113, 263, 740, 393, 13582, 278, 421, 29906, 29946, 29952, 3748, 29889, 13, 13, 2277, 15197, 390, 2540, 29914, 19212, 532, 13, 13, 29899, 3575, 1881, 674, 2337, 5718, 310, 385, 1409, 310, 3023, 11920, 29889, 4525, 11920, 437, 451, 599, 817, 304, 367, 6374, 29889, 13, 29899, 3575, 740, 881, 736, 263, 7223, 995, 23941, 3692, 278, 1881, 508, 367, 12420, 304, 7738, 421, 29906, 29946, 1412, 887, 437, 451, 817, 304, 7738, 278, 7063, 393, 17498, 421, 29906, 29946, 1412, 13, 29899, 450, 2582, 310, 738, 8542, 5858, 881, 367, 28240, 304, 278, 20471, 6043, 29889, 1105, 29892, 421, 29941, 847, 29871, 29906, 353, 29871, 29906, 1673, 451, 421, 29941, 847, 29871, 29906, 353, 29871, 29896, 1412, 13, 29899, 450, 1121, 310, 8542, 491, 5225, 881, 367, 5225, 29892, 451, 7580, 29889, 13, 13, 2277, 1222, 9422, 13, 13, 28956, 13, 1456, 4197, 29945, 29892, 29871, 29906, 29892, 29871, 29955, 29892, 29871, 29947, 5691, 259, 849, 5852, 1599, 313, 29945, 334, 29871, 29906, 448, 29871, 29955, 29897, 334, 29871, 29947, 353, 29871, 29906, 29946, 13, 1456, 4197, 29906, 29892, 29871, 29946, 29892, 29871, 29947, 29892, 29871, 29896, 29900, 5691, 29871, 849, 5852, 1599, 29871, 29906, 718, 29871, 29946, 718, 29871, 29947, 718, 29871, 29896, 29900, 353, 29871, 29906, 29946, 13, 1456, 4197, 29945, 29892, 29871, 29900, 29892, 29871, 29946, 29892, 29871, 29946, 5691, 259, 849, 5852, 1599, 313, 29945, 718, 29871, 29900, 29897, 334, 29871, 29946, 718, 29871, 29946, 353, 29871, 29906, 29946, 13, 1456, 4197, 29946, 29955, 29892, 29871, 29906, 29892, 29871, 29900, 29892, 29871, 29900, 5691, 29871, 849, 5852, 1599, 313, 29946, 29955, 847, 29871, 29906, 29897, 718, 29871, 29900, 718, 29871, 29900, 353, 29871, 29906, 29946, 13, 1456, 4197, 29896, 29892, 29871, 29945, 29892, 29871, 29955, 29892, 29871, 29896, 29929, 5691, 29871, 849, 7700, 29892, 694, 18240, 7709, 29871, 29906, 29946, 13, 28956, 13, 15945, 29908, 13, 13, 29937, 10809, 937, 2740, 1549, 263, 5447, 13, 29871, 396, 671, 263, 6850, 11375, 448, 1833, 297, 29914, 4102, 714, 13, 13, 29937, 19152, 5702, 310, 29901, 13, 29871, 396, 450, 5096, 310, 8857, 304, 21994, 373, 13, 13, 1753, 1708, 29898, 524, 29918, 1761, 1125, 13, 29871, 396, 6204, 263, 6850, 11375, 313, 8245, 1051, 29897, 13, 1678, 5096, 353, 518, 524, 29918, 1761, 29962, 13, 29871, 396, 5806, 278, 5096, 338, 451, 4069, 13, 1678, 1550, 5096, 29901, 13, 4706, 396, 6977, 385, 2944, 313, 1491, 1761, 29897, 1283, 278, 5096, 13, 4706, 1014, 1761, 353, 5096, 29889, 7323, 580, 13, 4706, 396, 960, 596, 1014, 1761, 338, 3309, 29871, 29896, 29901, 29871, 13, 4706, 565, 7431, 29898, 1491, 1761, 29897, 1275, 29871, 29896, 29901, 13, 9651, 396, 565, 278, 871, 1353, 297, 1014, 1761, 338, 29871, 29906, 29946, 29892, 736, 5852, 29889, 29871, 13, 9651, 565, 1014, 1761, 29961, 29900, 29962, 1275, 29871, 29906, 29946, 29901, 13, 18884, 736, 5852, 13, 9651, 396, 13466, 29892, 3183, 714, 1014, 1761, 322, 748, 1250, 304, 278, 1369, 310, 278, 1550, 2425, 13, 9651, 6773, 13, 4706, 396, 1152, 1269, 5101, 310, 4452, 297, 1014, 1761, 13, 4706, 363, 474, 297, 3464, 29898, 2435, 29898, 1491, 1761, 29897, 448, 29871, 29896, 1125, 13, 9651, 396, 1938, 599, 3023, 6931, 373, 278, 5101, 310, 4452, 29892, 6314, 297, 263, 1051, 2000, 390, 2890, 8647, 29903, 13, 9651, 937, 29892, 1473, 353, 1014, 1761, 29961, 29875, 1402, 1014, 1761, 29961, 29875, 718, 29871, 29896, 29962, 13, 9651, 2582, 353, 518, 4102, 718, 1473, 29892, 937, 448, 1473, 29892, 937, 334, 1473, 29962, 13, 9651, 2582, 29889, 4397, 29898, 29900, 565, 1473, 1275, 29871, 29900, 1683, 4513, 29898, 4102, 847, 1473, 876, 13, 9651, 396, 1152, 1269, 1121, 297, 390, 2890, 8647, 29903, 13, 9651, 363, 1121, 297, 2582, 29901, 13, 18884, 396, 6204, 263, 1051, 313, 3166, 1014, 1761, 29897, 15270, 278, 1023, 1881, 3694, 411, 1121, 13, 18884, 1857, 353, 1014, 1761, 7503, 29875, 29962, 718, 518, 2914, 29962, 718, 1014, 1761, 29961, 29875, 718, 29871, 29906, 17531, 13, 18884, 396, 788, 278, 716, 29892, 7968, 1051, 304, 278, 5096, 13, 18884, 5096, 29889, 4397, 29898, 3784, 29897, 13, 1678, 396, 7106, 7700, 13, 1678, 736, 7700, 13, 13, 13, 1990, 4321, 13454, 29898, 348, 27958, 29889, 3057, 8259, 1125, 13, 1678, 822, 731, 3373, 29898, 1311, 1125, 13, 4706, 1583, 29889, 10633, 29918, 1491, 29918, 10633, 353, 518, 29945, 29892, 29871, 29906, 29892, 29871, 29955, 29892, 29871, 29947, 29962, 13, 4706, 1583, 29889, 1202, 654, 353, 518, 29906, 29892, 29871, 29946, 29892, 29871, 29947, 29892, 29871, 29896, 29900, 29962, 13, 4706, 1583, 29889, 1491, 3018, 428, 353, 518, 29906, 29955, 29892, 29871, 29896, 29892, 29871, 29896, 29892, 29871, 29896, 29962, 13, 4706, 1583, 29889, 1202, 29918, 10633, 29918, 1202, 353, 518, 29945, 29892, 29871, 29900, 29892, 29871, 29946, 29892, 29871, 29946, 29962, 13, 4706, 1583, 29889, 4563, 29918, 14486, 786, 353, 518, 29946, 29955, 29892, 29871, 29906, 29892, 29871, 29900, 29892, 29871, 29900, 29962, 13, 4706, 1583, 29889, 4563, 29918, 14486, 3204, 353, 518, 29896, 29892, 29871, 29896, 29892, 29871, 29955, 29941, 29892, 29871, 29941, 29962, 13, 4706, 1583, 29889, 14057, 353, 518, 29896, 29892, 29871, 29945, 29892, 29871, 29955, 29892, 29871, 29896, 29929, 29962, 13, 13, 1678, 822, 1243, 29918, 10633, 29918, 1491, 29918, 10633, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 5574, 29898, 1456, 29898, 1311, 29889, 10633, 29918, 1491, 29918, 10633, 511, 13, 462, 4706, 18227, 29945, 334, 29871, 29906, 448, 29871, 29955, 29897, 334, 29871, 29947, 353, 29871, 29906, 29946, 1599, 5852, 1159, 13, 13, 1678, 822, 1243, 29918, 1202, 654, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 5574, 29898, 1456, 29898, 1311, 29889, 1202, 654, 511, 376, 29906, 718, 29871, 29946, 718, 29871, 29947, 718, 29871, 29896, 29900, 353, 29871, 29906, 29946, 1599, 5852, 1159, 13, 13, 1678, 822, 1243, 29918, 1491, 3018, 428, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 5574, 29898, 1456, 29898, 1311, 29889, 1491, 3018, 428, 511, 376, 29906, 29955, 448, 29871, 29896, 448, 29871, 29896, 448, 29871, 29896, 353, 29871, 29906, 29946, 1599, 5852, 1159, 13, 13, 1678, 822, 1243, 29918, 1202, 29918, 10633, 29918, 1202, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 5574, 29898, 1456, 29898, 1311, 29889, 1202, 29918, 10633, 29918, 1202, 511, 13, 462, 4706, 18227, 29945, 718, 29871, 29900, 29897, 334, 29871, 29946, 718, 29871, 29946, 353, 29871, 29906, 29946, 1599, 5852, 1159, 13, 13, 1678, 822, 1243, 29918, 4563, 29918, 14486, 786, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 5574, 29898, 1456, 29898, 1311, 29889, 4563, 29918, 14486, 786, 511, 13, 462, 4706, 376, 29946, 29955, 847, 29871, 29906, 718, 29871, 29900, 718, 29871, 29900, 353, 29871, 29906, 29941, 29889, 29945, 1599, 29871, 29906, 29946, 1599, 5852, 1159, 13, 13, 1678, 822, 1243, 29918, 4563, 29918, 14486, 3204, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 5574, 29898, 1456, 29898, 1311, 29889, 4563, 29918, 14486, 3204, 511, 13, 462, 4706, 376, 29896, 448, 29871, 29896, 718, 313, 29955, 29941, 847, 29871, 29941, 29897, 353, 29871, 29906, 29946, 29889, 29941, 29941, 1599, 29871, 29906, 29946, 1599, 5852, 1159, 13, 13, 1678, 822, 1243, 29918, 14057, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 8824, 29898, 1456, 29898, 1311, 29889, 14057, 511, 376, 29896, 1577, 29871, 29945, 1577, 29871, 29955, 1577, 29871, 29896, 29929, 2804, 29871, 29906, 29946, 1599, 7700, 1159, 13, 13, 1678, 822, 734, 279, 6767, 29898, 1311, 1125, 13, 4706, 1209, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 443, 27958, 29889, 3396, 580, 13, 2 ]
create_dataset.py
KiLJ4EdeN/COVID_WEB
5
1615527
# Import dependencies. import os import numpy as np import cv2 from scipy.io import savemat # Create labels. C = np.ones((349,)) N = np.zeros((397,)) labels = np.concatenate((C, N), axis=0) # Load the datased and resize to imagenet size. covid = os.listdir('CT_COVID') n_covid = os.listdir('CT_NonCOVID') data=[] for img_path in covid: img = cv2.imread('CT_COVID/'+img_path, cv2.IMREAD_COLOR) data.append(cv2.resize(img, (224, 224))) for img_path in n_covid: img = cv2.imread('CT_NonCOVID/'+img_path, cv2.IMREAD_COLOR) data.append(cv2.resize(img, (224, 224))) # Normalization. data = np.array(data)/255. print(data.shape) print(labels.shape) # Save the data. savemat('images.mat', {'data': data, 'labels': labels})
[ 1, 396, 16032, 9962, 29889, 13, 5215, 2897, 13, 5215, 12655, 408, 7442, 13, 5215, 13850, 29906, 13, 3166, 4560, 2272, 29889, 601, 1053, 4048, 4579, 13, 13, 29937, 6204, 11073, 29889, 13, 29907, 353, 7442, 29889, 2873, 3552, 29941, 29946, 29929, 29892, 876, 13, 29940, 353, 7442, 29889, 3298, 359, 3552, 29941, 29929, 29955, 29892, 876, 13, 21134, 353, 7442, 29889, 535, 29883, 2579, 403, 3552, 29907, 29892, 405, 511, 9685, 29922, 29900, 29897, 13, 13, 29937, 16012, 278, 1418, 1463, 322, 19490, 304, 527, 5370, 300, 2159, 29889, 13, 24542, 333, 353, 2897, 29889, 1761, 3972, 877, 1783, 29918, 3217, 13044, 1495, 13, 29876, 29918, 24542, 333, 353, 2897, 29889, 1761, 3972, 877, 1783, 29918, 12283, 3217, 13044, 1495, 13, 1272, 29922, 2636, 13, 13, 13, 1454, 10153, 29918, 2084, 297, 18838, 333, 29901, 13, 29871, 10153, 353, 13850, 29906, 29889, 326, 949, 877, 1783, 29918, 3217, 13044, 29914, 18717, 2492, 29918, 2084, 29892, 13850, 29906, 29889, 7833, 16310, 29918, 15032, 1955, 29897, 13, 29871, 848, 29889, 4397, 29898, 11023, 29906, 29889, 21476, 29898, 2492, 29892, 313, 29906, 29906, 29946, 29892, 29871, 29906, 29906, 29946, 4961, 13, 259, 13, 13, 1454, 10153, 29918, 2084, 297, 302, 29918, 24542, 333, 29901, 13, 29871, 10153, 353, 13850, 29906, 29889, 326, 949, 877, 1783, 29918, 12283, 3217, 13044, 29914, 18717, 2492, 29918, 2084, 29892, 13850, 29906, 29889, 7833, 16310, 29918, 15032, 1955, 29897, 13, 29871, 848, 29889, 4397, 29898, 11023, 29906, 29889, 21476, 29898, 2492, 29892, 313, 29906, 29906, 29946, 29892, 29871, 29906, 29906, 29946, 4961, 13, 259, 13, 29937, 21981, 2133, 29889, 13, 1272, 353, 7442, 29889, 2378, 29898, 1272, 6802, 29906, 29945, 29945, 29889, 13, 2158, 29898, 1272, 29889, 12181, 29897, 13, 2158, 29898, 21134, 29889, 12181, 29897, 13, 13, 29937, 16913, 278, 848, 29889, 13, 29879, 485, 4579, 877, 8346, 29889, 2922, 742, 11117, 1272, 2396, 848, 29892, 13, 462, 308, 525, 21134, 2396, 11073, 1800, 13, 2 ]
test.py
Aaron-Jin-Xu/DataIO
1
142915
from utils.io import inspect_data_dirs from configs import DATA_DIRS inspect_data_dirs(DATA_DIRS)
[ 1, 515, 3667, 29879, 29889, 601, 1053, 16096, 29918, 1272, 29918, 3972, 29879, 13, 3166, 2295, 29879, 1053, 360, 8254, 29918, 9464, 29903, 13, 13, 1144, 1103, 29918, 1272, 29918, 3972, 29879, 29898, 14573, 29918, 9464, 29903, 29897, 13, 2 ]
river/optim/base.py
online-ml/creme
1,105
47902
import abc import numbers from typing import Union import numpy as np from river import base, optim, utils VectorLike = Union[utils.VectorDict, np.ndarray] __all__ = ["Initializer", "Scheduler", "Optimizer", "Loss"] class Initializer(base.Base, abc.ABC): """An initializer is used to set initial weights in a model.""" @abc.abstractmethod def __call__(self, shape=1): """Returns a fresh set of weights. Parameters ---------- shape Indicates how many weights to return. If `1`, then a single scalar value will be returned. """ class Scheduler(base.Base, abc.ABC): """Can be used to program the learning rate schedule of an `optim.base.Optimizer`.""" @abc.abstractmethod def get(self, t: int) -> float: """Returns the learning rate at a given iteration. Parameters ---------- t The iteration number. """ def __repr__(self): return f"{self.__class__.__name__}({vars(self)})" class Optimizer(base.Base): """Optimizer interface. Every optimizer inherits from this base interface. Parameters ---------- lr Attributes ---------- learning_rate : float Returns the current learning rate value. """ def __init__(self, lr: Union[Scheduler, float]): if isinstance(lr, numbers.Number): lr = optim.schedulers.Constant(lr) self.lr = lr self.n_iterations = 0 @property def learning_rate(self) -> float: return self.lr.get(self.n_iterations) def look_ahead(self, w: dict) -> dict: """Updates a weight vector before a prediction is made. Parameters: w (dict): A dictionary of weight parameters. The weights are modified in-place. Returns: The updated weights. """ return w def _step_with_dict(self, w: dict, g: dict) -> dict: raise NotImplementedError def _step_with_vector(self, w: VectorLike, g: VectorLike) -> VectorLike: raise NotImplementedError def step( self, w: Union[dict, VectorLike], g: Union[dict, VectorLike] ) -> Union[dict, VectorLike]: """Updates a weight vector given a gradient. Parameters ---------- w A vector-like object containing weights. The weights are modified in-place. g A vector-like object of gradients. Returns ------- The updated weights. """ if isinstance(w, VectorLike.__args__) and isinstance(g, VectorLike.__args__): try: w = self._step_with_vector(w, g) self.n_iterations += 1 return w except NotImplementedError: pass w = self._step_with_dict(w, g) self.n_iterations += 1 return w def __repr__(self): return f"{self.__class__.__name__}({vars(self)})" class Loss(base.Base, abc.ABC): """Base class for all loss functions.""" def __repr__(self): return f"{self.__class__.__name__}({vars(self)})" @abc.abstractmethod def __call__(self, y_true, y_pred): """Returns the loss. Parameters ---------- y_true Ground truth(s). y_pred Prediction(s). Returns ------- The loss(es). """ @abc.abstractmethod def gradient(self, y_true, y_pred): """Return the gradient with respect to y_pred. Parameters ---------- y_true Ground truth(s). y_pred Prediction(s). Returns ------- The gradient(s). """ @abc.abstractmethod def mean_func(self, y_pred): """Mean function. This is the inverse of the link function. Typically, a loss function takes as input the raw output of a model. In the case of classification, the raw output would be logits. The mean function can be used to convert the raw output into a value that makes sense to the user, such as a probability. Parameters ---------- y_pred Raw prediction(s). Returns ------- The adjusted prediction(s). References ---------- [^1]: [Wikipedia section on link and mean function](https://www.wikiwand.com/en/Generalized_linear_model#/Link_function) """
[ 1, 1053, 25638, 13, 5215, 3694, 13, 3166, 19229, 1053, 7761, 13, 13, 5215, 12655, 408, 7442, 13, 13, 3166, 8580, 1053, 2967, 29892, 5994, 29892, 3667, 29879, 13, 13, 12877, 27552, 353, 7761, 29961, 13239, 29889, 12877, 21533, 29892, 7442, 29889, 299, 2378, 29962, 13, 13, 13, 1649, 497, 1649, 353, 6796, 15514, 3950, 613, 376, 4504, 14952, 613, 376, 20624, 326, 3950, 613, 376, 29931, 2209, 3108, 13, 13, 13, 1990, 17250, 3950, 29898, 3188, 29889, 5160, 29892, 25638, 29889, 19658, 1125, 13, 1678, 9995, 2744, 2847, 3950, 338, 1304, 304, 731, 2847, 18177, 297, 263, 1904, 1213, 15945, 13, 13, 1678, 732, 10736, 29889, 16595, 5696, 13, 1678, 822, 4770, 4804, 12035, 1311, 29892, 8267, 29922, 29896, 1125, 13, 4706, 9995, 11609, 29879, 263, 10849, 731, 310, 18177, 29889, 13, 13, 4706, 12662, 2699, 13, 4706, 448, 1378, 29899, 13, 4706, 8267, 13, 9651, 1894, 293, 1078, 920, 1784, 18177, 304, 736, 29889, 960, 421, 29896, 1673, 769, 263, 2323, 17336, 995, 674, 367, 13, 9651, 4133, 29889, 13, 13, 4706, 9995, 13, 13, 13, 1990, 1102, 14952, 29898, 3188, 29889, 5160, 29892, 25638, 29889, 19658, 1125, 13, 1678, 9995, 6028, 367, 1304, 304, 1824, 278, 6509, 6554, 20410, 310, 385, 421, 20640, 29889, 3188, 29889, 20624, 326, 3950, 29952, 1213, 15945, 13, 13, 1678, 732, 10736, 29889, 16595, 5696, 13, 1678, 822, 679, 29898, 1311, 29892, 260, 29901, 938, 29897, 1599, 5785, 29901, 13, 4706, 9995, 11609, 29879, 278, 6509, 6554, 472, 263, 2183, 12541, 29889, 13, 13, 4706, 12662, 2699, 13, 4706, 448, 1378, 29899, 13, 4706, 260, 13, 9651, 450, 12541, 1353, 29889, 13, 13, 4706, 9995, 13, 13, 1678, 822, 4770, 276, 558, 12035, 1311, 1125, 13, 4706, 736, 285, 29908, 29912, 1311, 17255, 1990, 1649, 17255, 978, 1649, 2119, 29912, 16908, 29898, 1311, 26972, 29908, 13, 13, 13, 1990, 20693, 326, 3950, 29898, 3188, 29889, 5160, 1125, 13, 1678, 9995, 20624, 326, 3950, 5067, 29889, 13, 13, 1678, 7569, 5994, 3950, 7846, 1169, 515, 445, 2967, 5067, 29889, 13, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 1678, 301, 29878, 13, 13, 1678, 6212, 5026, 13, 1678, 448, 1378, 29899, 13, 1678, 6509, 29918, 10492, 584, 5785, 13, 4706, 16969, 278, 1857, 6509, 6554, 995, 29889, 13, 13, 1678, 9995, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 301, 29878, 29901, 7761, 29961, 4504, 14952, 29892, 5785, 29962, 1125, 13, 4706, 565, 338, 8758, 29898, 29212, 29892, 3694, 29889, 4557, 1125, 13, 9651, 301, 29878, 353, 5994, 29889, 816, 287, 352, 414, 29889, 12075, 424, 29898, 29212, 29897, 13, 4706, 1583, 29889, 29212, 353, 301, 29878, 13, 4706, 1583, 29889, 29876, 29918, 1524, 800, 353, 29871, 29900, 13, 13, 1678, 732, 6799, 13, 1678, 822, 6509, 29918, 10492, 29898, 1311, 29897, 1599, 5785, 29901, 13, 4706, 736, 1583, 29889, 29212, 29889, 657, 29898, 1311, 29889, 29876, 29918, 1524, 800, 29897, 13, 13, 1678, 822, 1106, 29918, 29874, 2813, 29898, 1311, 29892, 281, 29901, 9657, 29897, 1599, 9657, 29901, 13, 4706, 9995, 3373, 15190, 263, 7688, 4608, 1434, 263, 18988, 338, 1754, 29889, 13, 13, 4706, 12662, 2699, 29901, 13, 9651, 281, 313, 8977, 1125, 319, 8600, 310, 7688, 4128, 29889, 450, 18177, 526, 9120, 297, 29899, 6689, 29889, 13, 13, 4706, 16969, 29901, 13, 9651, 450, 4784, 18177, 29889, 13, 13, 4706, 9995, 13, 4706, 736, 281, 13, 13, 1678, 822, 903, 10568, 29918, 2541, 29918, 8977, 29898, 1311, 29892, 281, 29901, 9657, 29892, 330, 29901, 9657, 29897, 1599, 9657, 29901, 13, 4706, 12020, 2216, 1888, 2037, 287, 2392, 13, 13, 1678, 822, 903, 10568, 29918, 2541, 29918, 8111, 29898, 1311, 29892, 281, 29901, 16510, 27552, 29892, 330, 29901, 16510, 27552, 29897, 1599, 16510, 27552, 29901, 13, 4706, 12020, 2216, 1888, 2037, 287, 2392, 13, 13, 1678, 822, 4331, 29898, 13, 4706, 1583, 29892, 281, 29901, 7761, 29961, 8977, 29892, 16510, 27552, 1402, 330, 29901, 7761, 29961, 8977, 29892, 16510, 27552, 29962, 13, 1678, 1723, 1599, 7761, 29961, 8977, 29892, 16510, 27552, 5387, 13, 4706, 9995, 3373, 15190, 263, 7688, 4608, 2183, 263, 16030, 29889, 13, 13, 4706, 12662, 2699, 13, 4706, 448, 1378, 29899, 13, 4706, 281, 13, 9651, 319, 4608, 29899, 4561, 1203, 6943, 18177, 29889, 450, 18177, 526, 9120, 297, 29899, 6689, 29889, 13, 4706, 330, 13, 9651, 319, 4608, 29899, 4561, 1203, 310, 4656, 10070, 29889, 13, 13, 4706, 16969, 13, 4706, 448, 22158, 13, 4706, 450, 4784, 18177, 29889, 13, 13, 4706, 9995, 13, 13, 4706, 565, 338, 8758, 29898, 29893, 29892, 16510, 27552, 17255, 5085, 1649, 29897, 322, 338, 8758, 29898, 29887, 29892, 16510, 27552, 17255, 5085, 1649, 1125, 13, 9651, 1018, 29901, 13, 18884, 281, 353, 1583, 3032, 10568, 29918, 2541, 29918, 8111, 29898, 29893, 29892, 330, 29897, 13, 18884, 1583, 29889, 29876, 29918, 1524, 800, 4619, 29871, 29896, 13, 18884, 736, 281, 13, 9651, 5174, 2216, 1888, 2037, 287, 2392, 29901, 13, 18884, 1209, 13, 13, 4706, 281, 353, 1583, 3032, 10568, 29918, 2541, 29918, 8977, 29898, 29893, 29892, 330, 29897, 13, 4706, 1583, 29889, 29876, 29918, 1524, 800, 4619, 29871, 29896, 13, 4706, 736, 281, 13, 13, 1678, 822, 4770, 276, 558, 12035, 1311, 1125, 13, 4706, 736, 285, 29908, 29912, 1311, 17255, 1990, 1649, 17255, 978, 1649, 2119, 29912, 16908, 29898, 1311, 26972, 29908, 13, 13, 13, 1990, 365, 2209, 29898, 3188, 29889, 5160, 29892, 25638, 29889, 19658, 1125, 13, 1678, 9995, 5160, 770, 363, 599, 6410, 3168, 1213, 15945, 13, 13, 1678, 822, 4770, 276, 558, 12035, 1311, 1125, 13, 4706, 736, 285, 29908, 29912, 1311, 17255, 1990, 1649, 17255, 978, 1649, 2119, 29912, 16908, 29898, 1311, 26972, 29908, 13, 13, 1678, 732, 10736, 29889, 16595, 5696, 13, 1678, 822, 4770, 4804, 12035, 1311, 29892, 343, 29918, 3009, 29892, 343, 29918, 11965, 1125, 13, 4706, 9995, 11609, 29879, 278, 6410, 29889, 13, 13, 4706, 12662, 2699, 13, 4706, 448, 1378, 29899, 13, 4706, 343, 29918, 3009, 13, 9651, 1632, 618, 8760, 29898, 29879, 467, 13, 4706, 343, 29918, 11965, 13, 9651, 21099, 2463, 29898, 29879, 467, 13, 13, 4706, 16969, 13, 4706, 448, 22158, 13, 4706, 450, 6410, 29898, 267, 467, 13, 13, 4706, 9995, 13, 13, 1678, 732, 10736, 29889, 16595, 5696, 13, 1678, 822, 16030, 29898, 1311, 29892, 343, 29918, 3009, 29892, 343, 29918, 11965, 1125, 13, 4706, 9995, 11609, 278, 16030, 411, 3390, 304, 343, 29918, 11965, 29889, 13, 13, 4706, 12662, 2699, 13, 4706, 448, 1378, 29899, 13, 4706, 343, 29918, 3009, 13, 9651, 1632, 618, 8760, 29898, 29879, 467, 13, 4706, 343, 29918, 11965, 13, 9651, 21099, 2463, 29898, 29879, 467, 13, 13, 4706, 16969, 13, 4706, 448, 22158, 13, 4706, 450, 16030, 29898, 29879, 467, 13, 13, 4706, 9995, 13, 13, 1678, 732, 10736, 29889, 16595, 5696, 13, 1678, 822, 2099, 29918, 9891, 29898, 1311, 29892, 343, 29918, 11965, 1125, 13, 4706, 9995, 6816, 273, 740, 29889, 13, 13, 4706, 910, 338, 278, 16402, 310, 278, 1544, 740, 29889, 14213, 1711, 29892, 263, 6410, 740, 4893, 408, 1881, 278, 10650, 13, 4706, 1962, 310, 263, 1904, 29889, 512, 278, 1206, 310, 12965, 29892, 278, 10650, 1962, 723, 367, 1480, 1169, 29889, 450, 2099, 13, 4706, 740, 508, 367, 1304, 304, 3588, 278, 10650, 1962, 964, 263, 995, 393, 3732, 4060, 304, 278, 1404, 29892, 13, 4706, 1316, 408, 263, 6976, 29889, 13, 13, 4706, 12662, 2699, 13, 4706, 448, 1378, 29899, 13, 4706, 343, 29918, 11965, 13, 9651, 22038, 18988, 29898, 29879, 467, 13, 13, 4706, 16969, 13, 4706, 448, 22158, 13, 4706, 450, 10365, 287, 18988, 29898, 29879, 467, 13, 13, 4706, 28318, 13, 4706, 448, 1378, 29899, 13, 4706, 518, 29985, 29896, 5387, 518, 5653, 4652, 4004, 373, 1544, 322, 2099, 740, 850, 991, 597, 1636, 29889, 4594, 18622, 29889, 510, 29914, 264, 29914, 15263, 1891, 29918, 10660, 29918, 4299, 29937, 29914, 6595, 29918, 2220, 29897, 13, 13, 4706, 9995, 13, 2 ]
blog/templatetags/markdownify.py
darkLord19/blog
12
26658
from django import template import mistune register = template.Library() @register.filter def markdown(value): markdown = mistune.Markdown() return markdown(value)
[ 1, 515, 9557, 1053, 4472, 13, 5215, 5862, 1540, 13, 13, 9573, 353, 4472, 29889, 12284, 580, 13, 13, 13, 29992, 9573, 29889, 4572, 13, 1753, 2791, 3204, 29898, 1767, 1125, 13, 1678, 2791, 3204, 353, 5862, 1540, 29889, 9802, 3204, 580, 13, 1678, 736, 2791, 3204, 29898, 1767, 29897, 13, 2 ]
problem0231.py
kmarcini/Project-Euler-Python
0
50155
########################### # # #231 The prime factorisation of binomial coefficients - Project Euler # https://projecteuler.net/problem=231 # # Code by <NAME> # ###########################
[ 1, 835, 13383, 7346, 13, 29937, 13, 29937, 396, 29906, 29941, 29896, 450, 6019, 7329, 4371, 310, 9016, 7615, 16127, 448, 8010, 382, 8584, 13, 29937, 2045, 597, 4836, 29872, 8584, 29889, 1212, 29914, 17199, 29922, 29906, 29941, 29896, 13, 29937, 13, 29937, 5920, 491, 529, 5813, 29958, 13, 29937, 13, 13383, 7346, 2277, 29937, 13, 2 ]
measurements/update_measurements.py
gvvynplaine/AutoEq
1
82125
<filename>measurements/update_measurements.py<gh_stars>1-10 # -*- coding: utf-8 -*- import os import sys import argparse from glob import glob from selenium import webdriver from selenium.webdriver.chrome.options import Options sys.path.insert(1, os.path.realpath(os.path.join(sys.path[0], os.pardir))) from measurements.rtings.rtings_crawler import RtingsCrawler from measurements.oratory1990.oratory1990_crawler import Oratory1990Crawler from measurements.crinacle.crinacle_crawler import CrinacleCrawler from measurements.referenceaudioanalyzer.reference_audio_analyzer_crawler import ReferenceAudioAnalyzerCrawler from measurements.average import average_measurements DIR_PATH = os.path.abspath(os.path.join(__file__, os.pardir)) def main(crinacle=False, oratory1990=False, rtings=False, referenceaudioanalyzer=False, prompt=False): classes = [] if not (crinacle | oratory1990 | rtings | referenceaudioanalyzer): # None means all crinacle = True oratory1990 = True rtings = True referenceaudioanalyzer = True if crinacle: classes.append(CrinacleCrawler) if oratory1990: classes.append(Oratory1990Crawler) if rtings: classes.append(RtingsCrawler) if referenceaudioanalyzer: classes.append(ReferenceAudioAnalyzerCrawler) if Oratory1990Crawler in classes or ReferenceAudioAnalyzerCrawler in classes or RtingsCrawler in classes: # oratory1990 and Reference Audio Analyzer crawlers require Selenium Web Driver opts = Options() opts.add_argument('--headless') driver = webdriver.Chrome(os.path.join(DIR_PATH, 'chromedriver'), options=opts) else: driver = None for cls in classes: print(f'Running {cls.__name__}') crawler = cls(driver=driver) crawler.process_new(prompt=prompt) crawler.write_name_index() for dir_path in glob(os.path.join(DIR_PATH, '*', 'data', '*')): average_measurements(input_dir=dir_path, output_dir=dir_path) if driver is not None: driver.close() def create_cli(): parser = argparse.ArgumentParser() parser.add_argument('--crinacle', action='store_true', help='Update Crinacle measurements?') parser.add_argument('--oratory1990', action='store_true', help='Update oratory1990 measurements?') parser.add_argument('--rtings', action='store_true', help='Update Rtings measurements?') parser.add_argument('--referenceaudioanalyzer', action='store_true', help='Update Reference Audio Analyzer measurements?') parser.add_argument('--prompt', action='store_true', help='Prompt for true names and forms?') return vars(parser.parse_args()) if __name__ == '__main__': main(**create_cli())
[ 1, 529, 9507, 29958, 26658, 1860, 29914, 5504, 29918, 26658, 1860, 29889, 2272, 29966, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 13, 5215, 2897, 13, 5215, 10876, 13, 5215, 1852, 5510, 13, 3166, 13149, 1053, 13149, 13, 3166, 18866, 1053, 1856, 9465, 13, 3166, 18866, 29889, 29813, 29889, 18114, 29889, 6768, 1053, 25186, 13, 9675, 29889, 2084, 29889, 7851, 29898, 29896, 29892, 2897, 29889, 2084, 29889, 6370, 2084, 29898, 359, 29889, 2084, 29889, 7122, 29898, 9675, 29889, 2084, 29961, 29900, 1402, 2897, 29889, 29886, 538, 381, 4961, 13, 3166, 20398, 29889, 2273, 886, 29889, 2273, 886, 29918, 29883, 1610, 1358, 1053, 390, 29873, 886, 29907, 1610, 1358, 13, 3166, 20398, 29889, 272, 7606, 29896, 29929, 29929, 29900, 29889, 272, 7606, 29896, 29929, 29929, 29900, 29918, 29883, 1610, 1358, 1053, 1394, 7606, 29896, 29929, 29929, 29900, 29907, 1610, 1358, 13, 3166, 20398, 29889, 7283, 262, 6436, 29889, 7283, 262, 6436, 29918, 29883, 1610, 1358, 1053, 6781, 262, 6436, 29907, 1610, 1358, 13, 3166, 20398, 29889, 5679, 18494, 24209, 3298, 29889, 5679, 29918, 18494, 29918, 24209, 3298, 29918, 29883, 1610, 1358, 1053, 12105, 17111, 2744, 14997, 3298, 29907, 1610, 1358, 13, 3166, 20398, 29889, 12483, 482, 1053, 6588, 29918, 26658, 1860, 13, 13, 9464, 29918, 10145, 353, 2897, 29889, 2084, 29889, 370, 1028, 493, 29898, 359, 29889, 2084, 29889, 7122, 22168, 1445, 1649, 29892, 2897, 29889, 29886, 538, 381, 876, 13, 13, 13, 1753, 1667, 29898, 7283, 262, 6436, 29922, 8824, 29892, 470, 7606, 29896, 29929, 29929, 29900, 29922, 8824, 29892, 364, 29873, 886, 29922, 8824, 29892, 3407, 18494, 24209, 3298, 29922, 8824, 29892, 9508, 29922, 8824, 1125, 13, 1678, 4413, 353, 5159, 13, 1678, 565, 451, 313, 7283, 262, 6436, 891, 470, 7606, 29896, 29929, 29929, 29900, 891, 364, 29873, 886, 891, 3407, 18494, 24209, 3298, 1125, 13, 4706, 396, 6213, 2794, 599, 13, 4706, 2181, 262, 6436, 353, 5852, 13, 4706, 470, 7606, 29896, 29929, 29929, 29900, 353, 5852, 13, 4706, 364, 29873, 886, 353, 5852, 13, 4706, 3407, 18494, 24209, 3298, 353, 5852, 13, 13, 1678, 565, 2181, 262, 6436, 29901, 13, 4706, 4413, 29889, 4397, 29898, 29907, 17056, 6436, 29907, 1610, 1358, 29897, 13, 1678, 565, 470, 7606, 29896, 29929, 29929, 29900, 29901, 13, 4706, 4413, 29889, 4397, 29898, 2816, 7606, 29896, 29929, 29929, 29900, 29907, 1610, 1358, 29897, 13, 1678, 565, 364, 29873, 886, 29901, 13, 4706, 4413, 29889, 4397, 29898, 29934, 29873, 886, 29907, 1610, 1358, 29897, 13, 1678, 565, 3407, 18494, 24209, 3298, 29901, 13, 4706, 4413, 29889, 4397, 29898, 7422, 17111, 2744, 14997, 3298, 29907, 1610, 1358, 29897, 13, 13, 1678, 565, 1394, 7606, 29896, 29929, 29929, 29900, 29907, 1610, 1358, 297, 4413, 470, 12105, 17111, 2744, 14997, 3298, 29907, 1610, 1358, 297, 4413, 470, 390, 29873, 886, 29907, 1610, 1358, 297, 4413, 29901, 13, 4706, 396, 470, 7606, 29896, 29929, 29929, 29900, 322, 12105, 21764, 11597, 29891, 3298, 29349, 9306, 1996, 317, 13462, 2563, 26391, 13, 4706, 29111, 353, 25186, 580, 13, 4706, 29111, 29889, 1202, 29918, 23516, 877, 489, 2813, 2222, 1495, 13, 4706, 7156, 353, 1856, 9465, 29889, 1451, 4871, 29898, 359, 29889, 2084, 29889, 7122, 29898, 9464, 29918, 10145, 29892, 525, 27433, 287, 3511, 5477, 3987, 29922, 25707, 29897, 13, 1678, 1683, 29901, 13, 4706, 7156, 353, 6213, 13, 13, 1678, 363, 1067, 29879, 297, 4413, 29901, 13, 4706, 1596, 29898, 29888, 29915, 27795, 426, 25932, 17255, 978, 1649, 29913, 1495, 13, 4706, 29349, 1358, 353, 1067, 29879, 29898, 9465, 29922, 9465, 29897, 13, 4706, 29349, 1358, 29889, 5014, 29918, 1482, 29898, 14032, 415, 29922, 14032, 415, 29897, 13, 4706, 29349, 1358, 29889, 3539, 29918, 978, 29918, 2248, 580, 13, 13, 1678, 363, 4516, 29918, 2084, 297, 13149, 29898, 359, 29889, 2084, 29889, 7122, 29898, 9464, 29918, 10145, 29892, 525, 29930, 742, 525, 1272, 742, 525, 29930, 8785, 29901, 13, 4706, 6588, 29918, 26658, 1860, 29898, 2080, 29918, 3972, 29922, 3972, 29918, 2084, 29892, 1962, 29918, 3972, 29922, 3972, 29918, 2084, 29897, 13, 13, 1678, 565, 7156, 338, 451, 6213, 29901, 13, 4706, 7156, 29889, 5358, 580, 13, 13, 13, 1753, 1653, 29918, 11303, 7295, 13, 1678, 13812, 353, 1852, 5510, 29889, 15730, 11726, 580, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 7283, 262, 6436, 742, 3158, 2433, 8899, 29918, 3009, 742, 1371, 2433, 6422, 6781, 262, 6436, 20398, 29973, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 272, 7606, 29896, 29929, 29929, 29900, 742, 3158, 2433, 8899, 29918, 3009, 742, 1371, 2433, 6422, 470, 7606, 29896, 29929, 29929, 29900, 20398, 29973, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 2273, 886, 742, 3158, 2433, 8899, 29918, 3009, 742, 1371, 2433, 6422, 390, 29873, 886, 20398, 29973, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 5679, 18494, 24209, 3298, 742, 3158, 2433, 8899, 29918, 3009, 742, 13, 462, 4706, 1371, 2433, 6422, 12105, 21764, 11597, 29891, 3298, 20398, 29973, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 14032, 415, 742, 3158, 2433, 8899, 29918, 3009, 742, 1371, 2433, 18571, 415, 363, 1565, 2983, 322, 7190, 29973, 1495, 13, 1678, 736, 24987, 29898, 16680, 29889, 5510, 29918, 5085, 3101, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 1667, 29898, 1068, 3258, 29918, 11303, 3101, 13, 2 ]
01-Exercicios/Aula001/Ex2.py
AmandaRH07/Python_Entra21
0
23501
#--- Exercício 2 - Variáveis #--- Crie um menu para um sistema de cadastro de funcionários #--- O menu deve ser impresso com a função format() #--- As opções devem ser variáveis do tipo inteiro #--- As descrições das opções serão: #--- Cadastrar funcionário #--- Listar funcionários #--- Editar funcionário #--- Deletar funcionário #--- Sair #--- Além das opções o menu deve conter um cabeçalho e um rodapé #--- Entre o cabeçalho e o menu e entre o menu e o rodapé deverá ter espaçamento de 3 linhas #--- Deve ser utilizado os caracteres especiais de quebra de linha e de tabulação opcao = int(input(""" SISTEMA DE CADASTRO DE FUNCIONARIO\n\n\n {} - Cadastrar Funcionário {} - Listar Funcinários {} - Editar Funcionário {} - Deletar Funcionário {} - Sair\n\n\n Escolha uma opção: """.format(1,2,3,4,5))) if opcao == 1: print("A opção escolhida foi 'Cadastrar funcionário'") elif opcao == 2: print("A opção escolhida foi 'Listar funcionários'") elif opcao == 3: print("A opção escolhida foi 'Editar funcionário'") elif opcao == 4: print("A opção escolhida foi 'Deletar funcionário'") elif opcao == 5: print("A opção escolhida foi 'Sair'") else: pass
[ 1, 396, 5634, 1222, 6269, 24394, 29871, 29906, 29871, 448, 9586, 29976, 27072, 13, 29937, 5634, 315, 2546, 1922, 6143, 1702, 1922, 10502, 316, 13840, 23364, 316, 21802, 26047, 13, 29937, 5634, 438, 6143, 28542, 724, 21210, 29877, 419, 263, 2090, 2340, 3402, 580, 13, 29937, 5634, 1094, 1015, 5616, 2906, 331, 724, 1197, 29976, 27072, 437, 13306, 2293, 3350, 13, 29937, 5634, 1094, 2342, 5616, 1697, 1015, 5616, 724, 1368, 29901, 13, 29937, 5634, 1678, 315, 3922, 509, 279, 21802, 12288, 13, 29937, 5634, 1678, 2391, 279, 21802, 26047, 13, 29937, 5634, 1678, 2155, 3673, 21802, 12288, 13, 29937, 5634, 1678, 897, 1026, 279, 21802, 12288, 13, 29937, 5634, 1678, 317, 1466, 13, 29937, 5634, 838, 2249, 1697, 1015, 5616, 288, 6143, 28542, 378, 357, 1922, 27444, 30019, 284, 1251, 321, 1922, 15382, 481, 29948, 13, 29937, 5634, 14447, 288, 27444, 30019, 284, 1251, 321, 288, 6143, 321, 2637, 288, 6143, 321, 288, 15382, 481, 29948, 316, 369, 29976, 1935, 9015, 30019, 4487, 316, 29871, 29941, 6276, 5349, 13, 29937, 5634, 897, 345, 724, 11824, 912, 2897, 15215, 267, 4740, 1512, 275, 316, 712, 2634, 316, 6276, 2350, 321, 316, 4434, 2497, 2340, 13, 13, 459, 1113, 29877, 353, 938, 29898, 2080, 703, 15945, 13, 5425, 1254, 26862, 5012, 315, 3035, 28938, 1672, 5012, 383, 3904, 29907, 2725, 1718, 5971, 29905, 29876, 29905, 29876, 29905, 29876, 13, 1678, 6571, 448, 315, 3922, 509, 279, 383, 4661, 291, 12288, 13, 1678, 6571, 448, 2391, 279, 383, 4661, 262, 26047, 13, 1678, 6571, 448, 2155, 3673, 383, 4661, 291, 12288, 13, 1678, 6571, 448, 897, 1026, 279, 383, 4661, 291, 12288, 13, 1678, 6571, 448, 317, 1466, 29905, 29876, 29905, 29876, 29905, 29876, 13, 1678, 3423, 1054, 2350, 3672, 1015, 2340, 29901, 29871, 5124, 1642, 4830, 29898, 29896, 29892, 29906, 29892, 29941, 29892, 29946, 29892, 29945, 4961, 13, 13, 361, 1015, 1113, 29877, 1275, 29871, 29896, 29901, 13, 1678, 1596, 703, 29909, 1015, 2340, 25224, 29882, 1458, 4732, 525, 29907, 3922, 509, 279, 21802, 12288, 29915, 1159, 13, 23681, 1015, 1113, 29877, 1275, 29871, 29906, 29901, 13, 1678, 1596, 703, 29909, 1015, 2340, 25224, 29882, 1458, 4732, 525, 1293, 279, 21802, 26047, 29915, 1159, 13, 23681, 1015, 1113, 29877, 1275, 29871, 29941, 29901, 13, 1678, 1596, 703, 29909, 1015, 2340, 25224, 29882, 1458, 4732, 525, 3853, 3673, 21802, 12288, 29915, 1159, 13, 23681, 1015, 1113, 29877, 1275, 29871, 29946, 29901, 13, 1678, 1596, 703, 29909, 1015, 2340, 25224, 29882, 1458, 4732, 525, 2772, 1026, 279, 21802, 12288, 29915, 1159, 13, 23681, 1015, 1113, 29877, 1275, 29871, 29945, 29901, 13, 1678, 1596, 703, 29909, 1015, 2340, 25224, 29882, 1458, 4732, 525, 29903, 1466, 29915, 1159, 13, 2870, 29901, 13, 1678, 1209, 13, 13, 2 ]
stage/factory/base.py
daveshed/linearstage
0
74621
#pylint: disable=missing-docstring #pyling: enable=missing-docstring import abc class StageFactoryBase(abc.ABC): """ The factory base class that provides necessary objects required to instantiate a Stage object. """ @abc.abstractproperty def minimum_position(self): """The stage minimum position""" return @abc.abstractproperty def maximum_position(self): """The stage maximum position""" return @abc.abstractproperty def motor(self): """The motor to be used by the stage""" return @abc.abstractproperty def end_stop(self): """ End stop object that is triggered when the stage reaches the end of its travel """ return
[ 1, 396, 2272, 27854, 29901, 11262, 29922, 27259, 29899, 1514, 1807, 13, 29937, 2272, 1847, 29901, 9025, 29922, 27259, 29899, 1514, 1807, 13, 5215, 25638, 13, 13, 13, 1990, 24906, 5126, 5160, 29898, 10736, 29889, 19658, 1125, 13, 1678, 9995, 13, 1678, 450, 12529, 2967, 770, 393, 8128, 5181, 3618, 3734, 304, 13, 1678, 25112, 263, 24906, 1203, 29889, 13, 1678, 9995, 13, 1678, 732, 10736, 29889, 16595, 6799, 13, 1678, 822, 9212, 29918, 3283, 29898, 1311, 1125, 13, 4706, 9995, 1576, 7408, 9212, 2602, 15945, 29908, 13, 4706, 736, 13, 13, 1678, 732, 10736, 29889, 16595, 6799, 13, 1678, 822, 7472, 29918, 3283, 29898, 1311, 1125, 13, 4706, 9995, 1576, 7408, 7472, 2602, 15945, 29908, 13, 4706, 736, 13, 13, 1678, 732, 10736, 29889, 16595, 6799, 13, 1678, 822, 10992, 29898, 1311, 1125, 13, 4706, 9995, 1576, 10992, 304, 367, 1304, 491, 278, 7408, 15945, 29908, 13, 4706, 736, 13, 13, 1678, 732, 10736, 29889, 16595, 6799, 13, 1678, 822, 1095, 29918, 9847, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 2796, 5040, 1203, 393, 338, 19799, 746, 278, 7408, 22170, 278, 1095, 310, 13, 4706, 967, 9850, 13, 4706, 9995, 13, 4706, 736, 13, 2 ]
sps/sps/doctype/attendance_sheet/attendance_sheet.py
tushar7724/SPS
0
135641
<reponame>tushar7724/SPS # -*- coding: utf-8 -*- # Copyright (c) 2019, <NAME> and contributors # For license information, please see license.txt from __future__ import unicode_literals import frappe from frappe.utils import cint, flt, add_months, today, date_diff, getdate, add_days, cstr, nowdate from frappe.model.document import Document class AttendanceSheet(Document): def get_period_date_days(self): from datetime import date, timedelta d1 = getdate(self.start_date) d2 = getdate(self.end_date) delta = d2 - d1 # timedelta dates_days = [] for i in range(delta.days + 1): x = (d1 + timedelta(i)) x = str(x).split("-") dates_days.append(x[2]) return dates_days def get_contracts(self): period_doc = frappe.get_doc('Payroll Period', self.period) conditions = " and tc.start_date <= '%s' and tc.end_date >= '%s'" %(str(period_doc.end_date), str(period_doc.start_date)) if self.customer: conditions +=" and tc.party_name = '%s'" % (self.customer) if self.site: conditions +=" and tc.bu_site = '%s'" % (self.site) if self.contract: conditions +=" and tc.name = '%s'" % (self.contract) if self.branch_manager: conditions += " and tbu.branch_manager= '%s'" %(self.branch_manager) if self.area_officer: conditions += " and tbu.area_officer= '%s'" %(self.area_officer) #contract = frappe.db.sql("""select distinct name,contract_name,party_name,bu_site_name from`tabContract` where docstatus=1 %s ORDER BY contract_name""" %(conditions),as_dict=1) contract= frappe.db.sql(""" select distinct tc.name, tc.contract_name, tc.party_name, tc.bu_site_name from`tabContract` tc Inner join `tabBusiness Unit` tbu on tbu.name= tc.bu_site where tc.docstatus=1 and tc.status= 'Active' %s ORDER BY tc.contract_name; """%(conditions),as_dict=1) data={} if contract: for c in contract: pd = frappe.db.sql( """select parent,employee,employee_name,work_type,from_date,to_date from`tabPeople Posting` where employee !="" and parent='%s' and docstatus=1 """ % (c.name), as_dict=1) if pd: for idx,pdd in enumerate(pd): pdd['contract_id']=c.name pdd['contract_name']=c.contract_name pdd['party_name']=c.party_name pdd['bu_site_name']=c.bu_site_name if c.name in data: data[c.name]+= pd else:data[c.name]= pd print"######### Total No.of Attendance Sheet( Contracts ): %s ############" % len(data) return data or {}
[ 1, 529, 276, 1112, 420, 29958, 29873, 1878, 279, 29955, 29955, 29906, 29946, 29914, 5550, 29903, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 29937, 14187, 1266, 313, 29883, 29897, 29871, 29906, 29900, 29896, 29929, 29892, 529, 5813, 29958, 322, 17737, 29560, 13, 29937, 1152, 19405, 2472, 29892, 3113, 1074, 19405, 29889, 3945, 13, 13, 3166, 4770, 29888, 9130, 1649, 1053, 29104, 29918, 20889, 1338, 13, 5215, 5227, 4798, 13, 3166, 5227, 4798, 29889, 13239, 1053, 274, 524, 29892, 1652, 29873, 29892, 788, 29918, 10874, 29879, 29892, 9826, 29892, 2635, 29918, 12765, 29892, 679, 1256, 29892, 788, 29918, 16700, 29892, 274, 710, 29892, 1286, 1256, 13, 3166, 5227, 4798, 29889, 4299, 29889, 3225, 1053, 10854, 13, 13, 1990, 6212, 21642, 10654, 29898, 6268, 1125, 13, 12, 1753, 679, 29918, 19145, 29918, 1256, 29918, 16700, 29898, 1311, 1125, 13, 12, 12, 3166, 12865, 1053, 2635, 29892, 5335, 287, 2554, 13, 12, 12, 29881, 29896, 353, 679, 1256, 29898, 1311, 29889, 2962, 29918, 1256, 29897, 13, 12, 12, 29881, 29906, 353, 679, 1256, 29898, 1311, 29889, 355, 29918, 1256, 29897, 13, 12, 12, 4181, 353, 270, 29906, 448, 270, 29896, 29871, 396, 5335, 287, 2554, 13, 12, 12, 15190, 29918, 16700, 353, 5159, 13, 12, 12, 1454, 474, 297, 3464, 29898, 4181, 29889, 16700, 718, 29871, 29896, 1125, 13, 12, 12, 12, 29916, 353, 313, 29881, 29896, 718, 5335, 287, 2554, 29898, 29875, 876, 13, 12, 12, 12, 29916, 353, 851, 29898, 29916, 467, 5451, 703, 29899, 1159, 13, 12, 12, 12, 15190, 29918, 16700, 29889, 4397, 29898, 29916, 29961, 29906, 2314, 13, 12, 12, 2457, 10116, 29918, 16700, 13, 13, 12, 1753, 679, 29918, 1285, 1461, 29879, 29898, 1311, 1125, 13, 12, 12, 19145, 29918, 1514, 353, 5227, 4798, 29889, 657, 29918, 1514, 877, 15467, 1245, 29498, 742, 1583, 29889, 19145, 29897, 13, 12, 12, 1116, 2187, 353, 376, 322, 260, 29883, 29889, 2962, 29918, 1256, 5277, 14210, 29879, 29915, 322, 260, 29883, 29889, 355, 29918, 1256, 6736, 14210, 29879, 11838, 1273, 29898, 710, 29898, 19145, 29918, 1514, 29889, 355, 29918, 1256, 511, 851, 29898, 19145, 29918, 1514, 29889, 2962, 29918, 1256, 876, 13, 12, 12, 361, 1583, 29889, 15539, 29901, 5855, 718, 543, 322, 260, 29883, 29889, 22633, 29918, 978, 353, 14210, 29879, 11838, 1273, 313, 1311, 29889, 15539, 29897, 13, 12, 12, 361, 1583, 29889, 2746, 29901, 5855, 718, 543, 322, 260, 29883, 29889, 2423, 29918, 2746, 353, 14210, 29879, 11838, 1273, 313, 1311, 29889, 2746, 29897, 13, 12, 12, 361, 1583, 29889, 1285, 1461, 29901, 5855, 718, 543, 322, 260, 29883, 29889, 978, 353, 14210, 29879, 11838, 1273, 313, 1311, 29889, 1285, 1461, 29897, 13, 12, 12, 361, 1583, 29889, 17519, 29918, 12847, 29901, 5855, 4619, 376, 322, 260, 2423, 29889, 17519, 29918, 12847, 29922, 14210, 29879, 11838, 1273, 29898, 1311, 29889, 17519, 29918, 12847, 29897, 13, 12, 12, 361, 1583, 29889, 6203, 29918, 29877, 2416, 261, 29901, 5855, 4619, 376, 322, 260, 2423, 29889, 6203, 29918, 29877, 2416, 261, 29922, 14210, 29879, 11838, 1273, 29898, 1311, 29889, 6203, 29918, 29877, 2416, 261, 29897, 13, 12, 12, 29937, 1285, 1461, 353, 5227, 4798, 29889, 2585, 29889, 2850, 703, 15945, 2622, 8359, 1024, 29892, 1285, 1461, 29918, 978, 29892, 22633, 29918, 978, 29892, 2423, 29918, 2746, 29918, 978, 515, 29952, 3891, 21263, 29952, 988, 1574, 4882, 29922, 29896, 1273, 29879, 15606, 6770, 8078, 29918, 978, 15945, 29908, 1273, 29898, 1116, 2187, 511, 294, 29918, 8977, 29922, 29896, 29897, 13, 12, 12, 1285, 1461, 29922, 5227, 4798, 29889, 2585, 29889, 2850, 703, 15945, 13, 12, 12, 12, 12, 12, 12, 12, 12, 12, 2622, 8359, 260, 29883, 29889, 978, 29892, 260, 29883, 29889, 1285, 1461, 29918, 978, 29892, 260, 29883, 29889, 22633, 29918, 978, 29892, 260, 29883, 29889, 2423, 29918, 2746, 29918, 978, 13, 12, 12, 12, 12, 12, 12, 12, 12, 12, 3166, 29952, 3891, 21263, 29952, 260, 29883, 13, 12, 12, 12, 12, 12, 12, 12, 12, 12, 27748, 5988, 421, 3891, 16890, 3335, 13223, 29952, 260, 2423, 373, 260, 2423, 29889, 978, 29922, 260, 29883, 29889, 2423, 29918, 2746, 13, 12, 12, 12, 12, 12, 12, 12, 12, 12, 3062, 260, 29883, 29889, 1514, 4882, 29922, 29896, 322, 260, 29883, 29889, 4882, 29922, 525, 9966, 29915, 1273, 29879, 15606, 6770, 260, 29883, 29889, 1285, 1461, 29918, 978, 29936, 13, 12, 12, 12, 12, 12, 12, 12, 12, 15945, 29908, 29995, 29898, 1116, 2187, 511, 294, 29918, 8977, 29922, 29896, 29897, 13, 12, 12, 1272, 3790, 29913, 13, 12, 12, 361, 8078, 29901, 13, 12, 12, 12, 1454, 274, 297, 8078, 29901, 13, 12, 12, 12, 12, 15926, 353, 5227, 4798, 29889, 2585, 29889, 2850, 29898, 13, 12, 12, 12, 12, 12, 15945, 29908, 2622, 3847, 29892, 26143, 29892, 26143, 29918, 978, 29892, 1287, 29918, 1853, 29892, 3166, 29918, 1256, 29892, 517, 29918, 1256, 515, 29952, 3891, 15666, 1991, 4918, 292, 29952, 988, 19001, 1738, 13776, 322, 3847, 2433, 29995, 29879, 29915, 322, 1574, 4882, 29922, 29896, 9995, 1273, 313, 29883, 29889, 978, 511, 408, 29918, 8977, 29922, 29896, 29897, 13, 12, 12, 12, 12, 361, 10518, 29901, 13, 12, 12, 12, 12, 12, 1454, 22645, 29892, 29886, 1289, 297, 26985, 29898, 15926, 1125, 13, 12, 12, 12, 12, 12, 12, 29886, 1289, 1839, 1285, 1461, 29918, 333, 2033, 29922, 29883, 29889, 978, 13, 12, 12, 12, 12, 12, 12, 29886, 1289, 1839, 1285, 1461, 29918, 978, 2033, 29922, 29883, 29889, 1285, 1461, 29918, 978, 13, 12, 12, 12, 12, 12, 12, 29886, 1289, 1839, 22633, 29918, 978, 2033, 29922, 29883, 29889, 22633, 29918, 978, 13, 12, 12, 12, 12, 12, 12, 29886, 1289, 1839, 2423, 29918, 2746, 29918, 978, 2033, 29922, 29883, 29889, 2423, 29918, 2746, 29918, 978, 13, 12, 12, 12, 12, 12, 361, 274, 29889, 978, 297, 848, 29901, 848, 29961, 29883, 29889, 978, 10062, 29922, 10518, 13, 12, 12, 12, 12, 12, 2870, 29901, 1272, 29961, 29883, 29889, 978, 13192, 10518, 13, 12, 12, 2158, 29908, 7346, 29937, 14990, 1939, 29889, 974, 6212, 21642, 2296, 300, 29898, 2866, 1461, 29879, 29871, 1125, 1273, 29879, 835, 7346, 29937, 29908, 1273, 7431, 29898, 1272, 29897, 13, 12, 12, 2457, 848, 470, 6571, 13, 2 ]
power4.py
valentinp72/PuissanceQuatre_bot
0
160924
<gh_stars>0 ''' power4.py <NAME> - 14/10/2016 MIT License Version 0.1 ==== This is the main file for the twitter bot power4 ''' # ------- # Imports import tweepy import sys import os # Import config file from config import * from msgLogger import * from gridFunctions import * # --------- # Init game game = [[0 for x in range(N_COLUMN)] for x in range(N_LINE)] # Clear terminal and print log os.system('clear') logMsg(HEADER, "power4", "Loading power4 bot ...\n") # --------------- # Auth to twitter auth = tweepy.OAuthHandler(Consumer_Key, Consumer_Secret) auth.set_access_token(Access_Key, Access_Secret) try: redirect_url = auth.get_authorization_url() logMsg(SUCCESS, "Twitter", "Successfully logged in Twitter.") except tweepy.TweepError: logMsg(FAIL, "Twitter", "Error! Wrong tokens. Check your config.py (or configSAMPLE.py if not present).") sys.exit() api = tweepy.API(auth) column = 2 line = addPiece(game, PLAYER_1, column) if line == -1: print "error" else: print "Piece added in : ["+ str(line) + "]["+str(column)+"]" printGame(game) logMsg(WARNING, "power4", "End of power4.py, quitting.") #api.update_status('Yeah, that rocks!')
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 12008, 13, 1678, 3081, 29946, 29889, 2272, 13, 1678, 529, 5813, 29958, 448, 29871, 29896, 29946, 29914, 29896, 29900, 29914, 29906, 29900, 29896, 29953, 13, 1678, 341, 1806, 19245, 13, 1678, 10079, 29871, 29900, 29889, 29896, 13, 13, 1678, 1275, 1360, 13, 13, 1678, 910, 338, 278, 1667, 934, 363, 278, 23394, 9225, 3081, 29946, 13, 13, 12008, 13, 13, 29937, 448, 22158, 13, 29937, 1954, 4011, 13, 5215, 7780, 1022, 29891, 13, 5215, 10876, 13, 5215, 2897, 13, 13, 29937, 16032, 2295, 934, 13, 3166, 2295, 1053, 334, 13, 3166, 10191, 16363, 1053, 334, 13, 3166, 6856, 6678, 29879, 1053, 334, 13, 13, 13, 29937, 448, 1378, 13, 29937, 10886, 3748, 13, 13, 11802, 353, 5519, 29900, 363, 921, 297, 3464, 29898, 29940, 29918, 15032, 29127, 4638, 363, 921, 297, 3464, 29898, 29940, 29918, 18521, 4638, 13, 13, 13, 29937, 17732, 8638, 322, 1596, 1480, 13, 359, 29889, 5205, 877, 8551, 1495, 13, 1188, 16190, 29898, 23252, 1001, 29892, 376, 13519, 29946, 613, 376, 23456, 3081, 29946, 9225, 2023, 29905, 29876, 1159, 13, 13, 13, 13, 29937, 448, 9072, 489, 13, 29937, 13189, 304, 23394, 13, 5150, 353, 7780, 1022, 29891, 29889, 29949, 6444, 4598, 29898, 13696, 4680, 29918, 2558, 29892, 2138, 4680, 29918, 28459, 29897, 13, 5150, 29889, 842, 29918, 5943, 29918, 6979, 29898, 6638, 29918, 2558, 29892, 11028, 29918, 28459, 29897, 13, 13, 2202, 29901, 13, 1678, 6684, 29918, 2271, 353, 4817, 29889, 657, 29918, 8921, 2133, 29918, 2271, 580, 13, 1678, 1480, 16190, 29898, 14605, 26925, 29892, 376, 27418, 5171, 613, 376, 14191, 3730, 13817, 297, 20147, 23157, 13, 19499, 7780, 1022, 29891, 29889, 29911, 705, 1022, 2392, 29901, 13, 1678, 1480, 16190, 29898, 4519, 6227, 29892, 376, 27418, 5171, 613, 376, 2392, 29991, 399, 29373, 18897, 29889, 5399, 596, 2295, 29889, 2272, 313, 272, 2295, 8132, 3580, 1307, 29889, 2272, 565, 451, 2198, 467, 1159, 13, 1678, 10876, 29889, 13322, 580, 13, 13, 2754, 353, 7780, 1022, 29891, 29889, 8787, 29898, 5150, 29897, 13, 13, 4914, 353, 29871, 29906, 13, 1220, 353, 788, 29925, 347, 346, 29898, 11802, 29892, 349, 18799, 1001, 29918, 29896, 29892, 1897, 29897, 13, 361, 1196, 1275, 448, 29896, 29901, 13, 1678, 1596, 376, 2704, 29908, 13, 2870, 29901, 13, 1678, 1596, 376, 29925, 347, 346, 2715, 297, 584, 6796, 29974, 851, 29898, 1220, 29897, 718, 376, 29962, 3366, 29974, 710, 29898, 4914, 7240, 3108, 29908, 13, 1678, 1596, 14199, 29898, 11802, 29897, 13, 13, 13, 13, 1188, 16190, 29898, 29956, 25614, 29892, 376, 13519, 29946, 613, 376, 5044, 310, 3081, 29946, 29889, 2272, 29892, 439, 5367, 23157, 13, 29937, 2754, 29889, 5504, 29918, 4882, 877, 29979, 29872, 801, 29892, 393, 23150, 29991, 1495, 13, 2 ]
gpu_speed_test.py
baumgach/gpu_speed_test
1
189566
<filename>gpu_speed_test.py # Calculate the computation times for several matrix sizes on GPU # Author: <NAME> (<EMAIL>) from __future__ import print_function import os os.environ["CUDA_VISIBLE_DEVICES"] = os.environ['SGE_GPU'] import numpy as np import tensorflow as tf import time import socket def get_times(matrix_sizes): elapsed_times = [] for size in matrix_sizes: #print("####### Calculating size %d" % size) shape = (size,size) data_type = tf.float32 with tf.device('/gpu:0'): r1 = tf.random_uniform(shape=shape, minval=0, maxval=1, dtype=data_type) r2 = tf.random_uniform(shape=shape, minval=0, maxval=1, dtype=data_type) dot_operation = tf.matmul(r2, r1) with tf.Session() as session: #config=tf.ConfigProto(log_device_placement=True) start_time = time.time() result = session.run(dot_operation) elapsed_time = time.time() - start_time elapsed_times.append(elapsed_time) return elapsed_times if __name__ == "__main__": matrix_sizes = range(500,10000,50) times = get_times(matrix_sizes) print ('---------- Versions: -------------') print('Using GPU%s' % os.environ['SGE_GPU']) print('Tensorflow version:') print(tf.__version__) hostname = socket.gethostname() print('Hostname: %s' % hostname ) code_path = os.path.dirname(os.path.realpath(__file__)) print('Code path: %s' % code_path) print('----------- Summary: -------------') for ii, size in enumerate(matrix_sizes): print("Size: %dx%d, Time: %f secs" % (size,size,times[ii])) print('----------------------------------') print("Average time: %f" % np.mean(times)) print('----------------------------------') np.savez('%s/%s.npz' % (code_path, hostname), matrix_sizes, times)
[ 1, 529, 9507, 29958, 29887, 3746, 29918, 19322, 29918, 1688, 29889, 2272, 13, 29937, 20535, 403, 278, 16287, 3064, 363, 3196, 4636, 15786, 373, 22796, 13, 29937, 13361, 29901, 529, 5813, 29958, 313, 29966, 26862, 6227, 12948, 13, 13, 3166, 4770, 29888, 9130, 1649, 1053, 1596, 29918, 2220, 13, 5215, 2897, 13, 359, 29889, 21813, 3366, 29907, 29965, 7698, 29918, 28607, 8979, 1307, 29918, 2287, 29963, 2965, 2890, 3108, 353, 2897, 29889, 21813, 1839, 29903, 1692, 29918, 29954, 7056, 2033, 13, 13, 5215, 12655, 408, 7442, 13, 5215, 26110, 408, 15886, 13, 5215, 931, 13, 5215, 9909, 13, 13, 1753, 679, 29918, 3706, 29898, 5344, 29918, 29879, 7093, 1125, 13, 13, 1678, 560, 28170, 29918, 3706, 353, 5159, 13, 13, 1678, 363, 2159, 297, 4636, 29918, 29879, 7093, 29901, 13, 13, 4706, 396, 2158, 703, 4136, 2277, 29937, 20535, 1218, 2159, 1273, 29881, 29908, 1273, 2159, 29897, 13, 13, 4706, 8267, 353, 313, 2311, 29892, 2311, 29897, 13, 4706, 848, 29918, 1853, 353, 15886, 29889, 7411, 29941, 29906, 13, 13, 4706, 411, 15886, 29889, 10141, 11219, 29887, 3746, 29901, 29900, 29374, 13, 9651, 364, 29896, 353, 15886, 29889, 8172, 29918, 29590, 29898, 12181, 29922, 12181, 29892, 1375, 791, 29922, 29900, 29892, 4236, 791, 29922, 29896, 29892, 26688, 29922, 1272, 29918, 1853, 29897, 13, 9651, 364, 29906, 353, 15886, 29889, 8172, 29918, 29590, 29898, 12181, 29922, 12181, 29892, 1375, 791, 29922, 29900, 29892, 4236, 791, 29922, 29896, 29892, 26688, 29922, 1272, 29918, 1853, 29897, 13, 9651, 8329, 29918, 16453, 353, 15886, 29889, 2922, 16109, 29898, 29878, 29906, 29892, 364, 29896, 29897, 13, 13, 13, 4706, 411, 15886, 29889, 7317, 580, 408, 4867, 29901, 396, 2917, 29922, 13264, 29889, 3991, 1184, 517, 29898, 1188, 29918, 10141, 29918, 29886, 9552, 29922, 5574, 29897, 13, 9651, 1369, 29918, 2230, 353, 931, 29889, 2230, 580, 13, 9651, 1121, 353, 4867, 29889, 3389, 29898, 6333, 29918, 16453, 29897, 13, 9651, 560, 28170, 29918, 2230, 353, 931, 29889, 2230, 580, 448, 1369, 29918, 2230, 13, 9651, 560, 28170, 29918, 3706, 29889, 4397, 29898, 295, 28170, 29918, 2230, 29897, 13, 13, 1678, 736, 560, 28170, 29918, 3706, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 13, 1678, 4636, 29918, 29879, 7093, 353, 3464, 29898, 29945, 29900, 29900, 29892, 29896, 29900, 29900, 29900, 29900, 29892, 29945, 29900, 29897, 13, 1678, 3064, 353, 679, 29918, 3706, 29898, 5344, 29918, 29879, 7093, 29897, 13, 13, 1678, 1596, 6702, 28400, 10138, 1080, 29901, 448, 9072, 1495, 13, 1678, 1596, 877, 15156, 22796, 29995, 29879, 29915, 1273, 2897, 29889, 21813, 1839, 29903, 1692, 29918, 29954, 7056, 11287, 13, 1678, 1596, 877, 29911, 6073, 1731, 1873, 29901, 1495, 13, 1678, 1596, 29898, 13264, 17255, 3259, 1649, 29897, 13, 1678, 3495, 978, 353, 9909, 29889, 29887, 621, 520, 978, 580, 13, 1678, 1596, 877, 8514, 978, 29901, 1273, 29879, 29915, 1273, 3495, 978, 1723, 13, 1678, 775, 29918, 2084, 353, 2897, 29889, 2084, 29889, 25721, 29898, 359, 29889, 2084, 29889, 6370, 2084, 22168, 1445, 1649, 876, 13, 1678, 1596, 877, 3399, 2224, 29901, 1273, 29879, 29915, 1273, 775, 29918, 2084, 29897, 13, 13, 1678, 1596, 877, 1378, 5634, 6991, 5219, 29901, 448, 9072, 1495, 13, 13, 1678, 363, 13607, 29892, 2159, 297, 26985, 29898, 5344, 29918, 29879, 7093, 1125, 13, 4706, 1596, 703, 3505, 29901, 1273, 8235, 29995, 29881, 29892, 5974, 29901, 1273, 29888, 409, 2395, 29908, 1273, 313, 2311, 29892, 2311, 29892, 3706, 29961, 2236, 12622, 13, 13, 1678, 1596, 877, 2683, 2683, 489, 1495, 13, 1678, 1596, 703, 29909, 19698, 931, 29901, 1273, 29888, 29908, 1273, 7442, 29889, 12676, 29898, 3706, 876, 13, 1678, 1596, 877, 2683, 2683, 489, 1495, 13, 13, 1678, 7442, 29889, 7620, 29920, 877, 29995, 29879, 22584, 29879, 29889, 9302, 29920, 29915, 1273, 313, 401, 29918, 2084, 29892, 3495, 978, 511, 4636, 29918, 29879, 7093, 29892, 3064, 29897, 13, 2 ]
setup.py
Goggin/djeasyroute
0
152426
<filename>setup.py #!/usr/bin/env python try: from setuptools.core import setup except ImportError: from distutils.core import setup setup(name='djeasyroute', version='0.0.3', description='A simple class based route system for django similar to flask', author='<NAME>', author_email='<EMAIL>', url='https://github.com/Goggin/djeasyroute', download_url='', classifiers=[ "Development Status :: 3 - Alpha", "Framework :: Django", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Intended Audience :: Developers", "Topic :: Software Development", ], install_requires=[ 'django', ], packages=[ 'djeasyroute', ], )
[ 1, 529, 9507, 29958, 14669, 29889, 2272, 13, 29937, 14708, 4855, 29914, 2109, 29914, 6272, 3017, 13, 13, 2202, 29901, 13, 1678, 515, 731, 21245, 8789, 29889, 3221, 1053, 6230, 13, 19499, 16032, 2392, 29901, 13, 1678, 515, 1320, 13239, 29889, 3221, 1053, 6230, 13, 13, 14669, 29898, 978, 2433, 29881, 1324, 294, 4316, 2663, 742, 13, 418, 1873, 2433, 29900, 29889, 29900, 29889, 29941, 742, 13, 418, 6139, 2433, 29909, 2560, 770, 2729, 5782, 1788, 363, 9557, 2788, 304, 29784, 742, 13, 418, 4148, 2433, 29966, 5813, 29958, 742, 13, 418, 4148, 29918, 5269, 2433, 29966, 26862, 6227, 29958, 742, 13, 418, 3142, 2433, 991, 597, 3292, 29889, 510, 29914, 29954, 468, 5359, 29914, 29881, 1324, 294, 4316, 2663, 742, 13, 418, 5142, 29918, 2271, 2433, 742, 13, 418, 770, 14903, 11759, 13, 9651, 376, 21956, 358, 16034, 4761, 29871, 29941, 448, 838, 2026, 613, 13, 9651, 376, 16660, 4761, 15337, 613, 13, 9651, 376, 29931, 293, 1947, 4761, 438, 5425, 28268, 1490, 4761, 341, 1806, 19245, 613, 13, 9651, 376, 7094, 1218, 2184, 4761, 6570, 25266, 613, 13, 9651, 376, 2928, 2760, 319, 4749, 663, 4761, 10682, 414, 613, 13, 9651, 376, 7031, 293, 4761, 18540, 14650, 613, 13, 418, 21251, 13, 418, 2601, 29918, 276, 339, 2658, 11759, 13, 9651, 525, 14095, 742, 13, 418, 21251, 13, 418, 9741, 11759, 13, 9651, 525, 29881, 1324, 294, 4316, 2663, 742, 13, 418, 21251, 13, 29897, 13, 2 ]
lib/python2.7/site-packages/appionlib/apTaskLog.py
leschzinerlab/myami-3.2-freeHand
0
138351
import sys import time import subprocess import math import os from appionlib import basicScript from appionlib import apParam from appionlib import apDisplay class TaskLog(basicScript.BasicScript): ''' TaskLog is used by TaskStatusLogger.py on remote cluster host to parse the logfile or result of a task for useful messages and added to the logfile of the job so that appion can monitor it from the local webserver ''' def __init__(self,optlist=[]): super(TaskLog,self).__init__(optlist,True) self.setAttributes() self.__checkTaskLogExistance() #===================== def setupParserOptions(self): # Agent class uses this to choose the RefineJob subclass self.parser.add_option("--jobtype", dest="jobtype", help="Job Type of processing run, e.g., emanrecon", metavar="X") self.parser.add_option("--tasktype", dest="tasktype", help="Type of task the logfile come from specific to the jobtype, e.g., 'refine' for emanrecon", metavar="X") self.parser.add_option("--iter", dest="iter", type="int", default=1, help="current iteration if applicable", metavar="INT") self.parser.add_option("--tasklogfile", dest="tasklogfile", help="Path for the task logfile. if relative path is given, current directory is assumed e.g. --tasklogfile=/home/you/sessionname/recon/runname/recon/refine1.log", metavar="PATH") #===================== def checkConflicts(self): if self.params['jobtype'] is None: apDisplay.printError("enter the refine jobtype, e.g. --jobtype=emanrecon") def setAttributes(self): self.jobtype = self.params['jobtype'] self.tasktype = self.params['tasktype'] self.tasklogfile = os.path.abspath(self.params['tasklogfile']) self.iter = self.params['iter'] self.failed = False def __checkTaskLogExistance(self): tasktype_display = self.tasktype.upper() tasklog_basename = os.path.basename(self.tasklogfile) if not os.path.isfile(self.tasklogfile): self.failed = True apDisplay.printError('task %s did not produce %s' % (tasktype_display,tasklog_basename),raised=False) else: apDisplay.printMsg('task %s produced successfully file %s' % (tasktype_display,tasklog_basename)) if os.stat(self.tasklogfile)[6] == 0: self.failed = True apDisplay.printError('task %s file %s is empty' % (tasktype_display,tasklog_basename),raised=False) def examineTaskLog(self): ''' add other log testing here ''' pass def start(self): # no need to examine tasklog content if already failed if not self.failed: self.examineTaskLog() if __name__ == '__main__': test = TaskLog() test.start() test.close()
[ 1, 1053, 10876, 13, 5215, 931, 13, 5215, 1014, 5014, 13, 5215, 5844, 13, 5215, 2897, 13, 13, 3166, 623, 291, 1982, 1053, 6996, 4081, 13, 3166, 623, 291, 1982, 1053, 3095, 4736, 13, 3166, 623, 291, 1982, 1053, 3095, 9323, 13, 13, 1990, 9330, 3403, 29898, 16121, 4081, 29889, 16616, 4081, 1125, 13, 12, 12008, 13, 12, 5398, 3403, 338, 1304, 491, 9330, 5709, 16363, 29889, 2272, 13, 12, 265, 7592, 9867, 3495, 304, 6088, 278, 1480, 1445, 470, 1121, 310, 263, 3414, 29871, 13, 12, 1454, 5407, 7191, 12, 392, 2715, 304, 278, 1480, 1445, 310, 278, 4982, 13, 12, 578, 393, 623, 291, 508, 11819, 372, 515, 278, 1887, 1856, 2974, 13, 12, 12008, 13, 12, 1753, 4770, 2344, 12035, 1311, 29892, 3670, 1761, 29922, 2636, 1125, 13, 12, 12, 9136, 29898, 5398, 3403, 29892, 1311, 467, 1649, 2344, 12035, 3670, 1761, 29892, 5574, 29897, 13, 12, 12, 1311, 29889, 842, 15801, 580, 13, 12, 12, 1311, 17255, 3198, 5398, 3403, 1252, 21558, 580, 13, 13, 12, 29937, 9166, 2751, 29922, 13, 12, 1753, 6230, 11726, 5856, 29898, 1311, 1125, 13, 12, 12, 29937, 28330, 770, 3913, 445, 304, 6755, 278, 9897, 457, 11947, 19481, 13, 12, 12, 1311, 29889, 16680, 29889, 1202, 29918, 3385, 703, 489, 9057, 1853, 613, 2731, 543, 9057, 1853, 613, 13, 12, 12, 12, 8477, 543, 11947, 5167, 310, 9068, 1065, 29892, 321, 29889, 29887, 1696, 953, 273, 276, 535, 613, 1539, 485, 279, 543, 29990, 1159, 13, 12, 12, 1311, 29889, 16680, 29889, 1202, 29918, 3385, 703, 489, 29873, 294, 1193, 668, 613, 2731, 543, 29873, 294, 1193, 668, 613, 13, 12, 12, 12, 8477, 543, 1542, 310, 3414, 278, 1480, 1445, 2041, 515, 2702, 304, 278, 4982, 1853, 29892, 321, 29889, 29887, 1696, 525, 999, 457, 29915, 363, 953, 273, 276, 535, 613, 1539, 485, 279, 543, 29990, 1159, 13, 12, 12, 1311, 29889, 16680, 29889, 1202, 29918, 3385, 703, 489, 1524, 613, 2731, 543, 1524, 613, 1134, 543, 524, 613, 2322, 29922, 29896, 29892, 13, 12, 12, 12, 8477, 543, 3784, 12541, 565, 22903, 613, 1539, 485, 279, 543, 10192, 1159, 13, 12, 12, 1311, 29889, 16680, 29889, 1202, 29918, 3385, 703, 489, 7662, 1188, 1445, 613, 2731, 543, 7662, 1188, 1445, 613, 13, 12, 12, 12, 8477, 543, 2605, 363, 278, 3414, 1480, 1445, 29889, 565, 6198, 2224, 338, 2183, 29892, 1857, 3884, 338, 12023, 321, 29889, 29887, 29889, 1192, 7662, 1188, 1445, 14327, 5184, 29914, 6293, 29914, 7924, 978, 29914, 276, 535, 29914, 3389, 978, 29914, 276, 535, 29914, 999, 457, 29896, 29889, 1188, 613, 1539, 485, 279, 543, 10145, 1159, 13, 12, 12, 13, 12, 29937, 9166, 2751, 29922, 13, 12, 1753, 1423, 16376, 506, 1372, 29898, 1311, 1125, 13, 12, 12, 361, 1583, 29889, 7529, 1839, 9057, 1853, 2033, 338, 6213, 29901, 13, 12, 12, 12, 481, 9323, 29889, 2158, 2392, 703, 5893, 278, 2143, 457, 4982, 1853, 29892, 321, 29889, 29887, 29889, 1192, 9057, 1853, 29922, 11422, 276, 535, 1159, 13, 12, 12, 13, 12, 1753, 731, 15801, 29898, 1311, 1125, 13, 12, 12, 1311, 29889, 9057, 1853, 353, 1583, 29889, 7529, 1839, 9057, 1853, 2033, 13, 12, 12, 1311, 29889, 29873, 294, 1193, 668, 353, 1583, 29889, 7529, 1839, 29873, 294, 1193, 668, 2033, 13, 12, 12, 1311, 29889, 7662, 1188, 1445, 353, 2897, 29889, 2084, 29889, 370, 1028, 493, 29898, 1311, 29889, 7529, 1839, 7662, 1188, 1445, 11287, 13, 12, 12, 1311, 29889, 1524, 353, 1583, 29889, 7529, 1839, 1524, 2033, 13, 12, 12, 1311, 29889, 26061, 353, 7700, 13, 13, 12, 1753, 4770, 3198, 5398, 3403, 1252, 21558, 29898, 1311, 1125, 13, 12, 12, 29873, 294, 1193, 668, 29918, 4990, 353, 1583, 29889, 29873, 294, 1193, 668, 29889, 21064, 580, 13, 12, 12, 7662, 1188, 29918, 6500, 3871, 353, 2897, 29889, 2084, 29889, 6500, 3871, 29898, 1311, 29889, 7662, 1188, 1445, 29897, 13, 12, 12, 361, 451, 2897, 29889, 2084, 29889, 275, 1445, 29898, 1311, 29889, 7662, 1188, 1445, 1125, 13, 12, 12, 12, 1311, 29889, 26061, 353, 5852, 13, 12, 12, 12, 481, 9323, 29889, 2158, 2392, 877, 7662, 1273, 29879, 1258, 451, 7738, 1273, 29879, 29915, 1273, 313, 29873, 294, 1193, 668, 29918, 4990, 29892, 7662, 1188, 29918, 6500, 3871, 511, 336, 3368, 29922, 8824, 29897, 13, 12, 12, 2870, 29901, 13, 12, 12, 12, 481, 9323, 29889, 2158, 16190, 877, 7662, 1273, 29879, 7371, 8472, 934, 1273, 29879, 29915, 1273, 313, 29873, 294, 1193, 668, 29918, 4990, 29892, 7662, 1188, 29918, 6500, 3871, 876, 13, 12, 12, 12, 361, 2897, 29889, 6112, 29898, 1311, 29889, 7662, 1188, 1445, 9601, 29953, 29962, 1275, 29871, 29900, 29901, 13, 12, 12, 12, 12, 1311, 29889, 26061, 353, 5852, 13, 12, 12, 12, 12, 481, 9323, 29889, 2158, 2392, 877, 7662, 1273, 29879, 934, 1273, 29879, 338, 4069, 29915, 1273, 313, 29873, 294, 1193, 668, 29918, 4990, 29892, 7662, 1188, 29918, 6500, 3871, 511, 336, 3368, 29922, 8824, 29897, 13, 13, 12, 1753, 25917, 5398, 3403, 29898, 1311, 1125, 13, 12, 12, 12008, 13, 12, 12, 1202, 916, 1480, 6724, 1244, 13, 12, 12, 12008, 13, 12, 12, 3364, 13, 13, 12, 1753, 1369, 29898, 1311, 1125, 13, 12, 12, 29937, 694, 817, 304, 25917, 3414, 1188, 2793, 565, 2307, 5229, 13, 12, 12, 361, 451, 12, 1311, 29889, 26061, 29901, 13, 12, 12, 12, 1311, 29889, 735, 314, 457, 5398, 3403, 580, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 12, 1688, 353, 9330, 3403, 580, 13, 12, 1688, 29889, 2962, 580, 13, 12, 1688, 29889, 5358, 580, 13, 2 ]
commands/slotsjackpot.py
Dabomstew/goldenrod
2
94878
import config import random import datetime, time import math def execute(parser, bot, user, args): slotsPool = bot.execQuerySelectOne("SELECT * FROM slotspool") bot.addressUser(user, "The current slots jackpot is %d %s." % (slotsPool["slotspool"], config.currencyPlural)) def requiredPerm(): return "anyone" def canUseByWhisper(): return True
[ 1, 1053, 2295, 30004, 13, 5215, 4036, 30004, 13, 5215, 12865, 29892, 931, 30004, 13, 5215, 5844, 30004, 13, 30004, 13, 1753, 6222, 29898, 16680, 29892, 9225, 29892, 1404, 29892, 6389, 1125, 30004, 13, 1678, 2243, 1862, 11426, 353, 9225, 29889, 4258, 3010, 3549, 6716, 703, 6404, 334, 3895, 21497, 1028, 1507, 1159, 30004, 13, 1678, 9225, 29889, 7328, 2659, 29898, 1792, 29892, 376, 1576, 1857, 2243, 1862, 28015, 17765, 338, 1273, 29881, 1273, 29879, 1213, 1273, 313, 2536, 1862, 11426, 3366, 2536, 327, 1028, 1507, 12436, 2295, 29889, 26095, 3247, 3631, 876, 30004, 13, 1678, 6756, 13, 1753, 3734, 15737, 7295, 30004, 13, 1678, 736, 376, 1384, 650, 19451, 13, 1678, 6756, 13, 1753, 508, 11403, 2059, 8809, 275, 546, 7295, 30004, 13, 1678, 736, 5852, 30004, 13, 30004, 13, 2 ]
epde/Tokens.py
vnleonenko/EPDE
15
162611
<reponame>vnleonenko/EPDE """ Contains baseline prototypes of 'Token' instance as a gen in Individual chromosome. Classes ---------- Token TerminalToken ComplexToken """ import random import numpy as np from copy import deepcopy, copy from functools import reduce from abc import ABC, abstractmethod, abstractproperty class Token(ABC): """ A token is an entity that has some meaning in the context of a given task, and encapsulates information that is sufficient to work with it. """ @abstractmethod def value(self, grid): """ Return value of the token in the context of the task. Parameters ---------- grid: The grid on which the value is calculated. """ pass def name(self, with_params=False): try: return str(self.params[0]) + self.name_ except: try: if with_params: return type(self).__name__ + '(params=' + str(list(self.params)) + ')' return type(self).__name__ except: return type(self).__name__ def copy(self): return deepcopy(self) class TerminalToken(Token): """ TerminalToken is the token that returns a value as a vector whose evaluating requaires only numeric parameters. """ def __init__(self, number_params: int = 0, params_description: dict = None, params: np.ndarray = None, cache_val: bool = True, fix_val: bool = False, fix: bool = False, val: np.ndarray = None, type_: str = 'TerminalToken', optimizer: str = None, name_: str = None, mandatory: float = 0, optimize_id: int = None): """ Parameters ---------- number_params: int Number of numeric parameters describing the behavior of the token. params_description: dict The dictionary of dictionaries for describing numeric parameters of the token. Must have the form like: { parameter_index: dict(name='name', bounds=(min_value, max_value)[, ...]), ... } params: numpy.ndarray Numeric parameters of the token for calculating its value. cache_val: bool If true, token value will be calculated only when its params are changed. Calculated value is written to the token property 'self.val'. fix_val: bool Defined by parameter 'cache_val'. If true, token value returns 'self.val'. fix: bool If true, numeric parameters will not be changed by optimization procedures. val: np.ndarray Value of the token. type_: str Type of the token. optimizer: str Optimizer name_: str The name of the token that will be used for visualisation results and some comparison operations. mandatory: float Unique id for the token. If not zero, the token must be present in the result construct. optimize_id: int Used for identifications by optimizers which token to optimize. """ self._number_params = number_params if params_description is None: params_description = {} self.params_description = params_description self.check_params_description() if params is None: self.params = np.zeros(self._number_params) else: self.params = np.array(params, dtype=float) self.check_params() self.val = val self.fix = fix self.cache_val = cache_val self._fix_val = fix_val self.type = type_ self.optimizer = optimizer self.name_ = name_ self.mandatory = mandatory self.optimize_id = optimize_id def copy(self): new_copy = copy(self) new_copy.params = deepcopy(new_copy.params) return new_copy # Methods for work with params and its descriptions @property def params_description(self): return self._params_description @params_description.setter def params_description(self, params_description: dict): """ Params_description is dictionary of dictionaries for describing numeric parameters of the token. Must have the form like: { parameter_index=0: dict(name='name', bounds=(min_value, max_value)[, ...]), ... } Params_description must contain all fields for work in current tokens that will be checked by method 'self.check_params_description()'. Parameters ---------- params_description: dict Dictionary with description for each parameter """ assert type(params_description) == dict self._params_description = params_description def check_params_description(self): """ Check params_description for requirements for current token. """ recomendations = "\nUse methods 'params_description.setter' or 'set_descriptor' to change params_descriptions" assert type( self._params_description) == dict, "Invalid params_description structure," \ " must be a dictionary of dictionaries" + recomendations assert len(self._params_description) == self._number_params, "The number of parameters does not" \ " match the number of descriptors" + recomendations for key, value in self._params_description.items(): assert type(value) == dict, "Invalid params_description structure, must be a dictionary of dictionaries" assert 'name' in value.keys(), "Key 'name' must be in the nested" \ " dictionary for each parameter" + recomendations assert 'bounds' in value.keys(), "Key 'bounds' must be in the nested " \ "dictionary for each parameter" + recomendations assert key < self._number_params, "The parameter index must not exceed" \ " the number of parameters" + recomendations assert (len(value['bounds']) == 2 and value['bounds'][0] <= value['bounds'][1]), "Bounds of each parameter must have" \ " length = 2 and contain value" \ " boundaries MIN <= MAX." + recomendations def set_descriptor(self, key: int, descriptor_name: str, descriptor_value): try: self._params_description[key][descriptor_name] = descriptor_value except KeyError: print('There is no parameter with such index/descriptor') def get_key_use_params_description(self, descriptor_name: str, descriptor_value): for key, value in self._params_description.items(): if value[descriptor_name] == descriptor_value: return key raise KeyError() def get_descriptor_foreach_param(self, descriptor_name: str) -> list: ret = [None for _ in range(self._number_params)] for key, value in self._params_description.items(): ret[key] = value[descriptor_name] return ret @property def params(self): return self._params @params.setter def params(self, params): assert len(params) == self._number_params, "Input array has incorrect size" self._params = np.array(params, dtype=float) self._fix_val = False def check_params(self): recomendations = "\nUse methods 'params.setter' or 'set_param' to change params" assert len( self._params) == self._number_params, "The number of parameters does not match the length of params array" + recomendations for key, value in self._params_description.items(): if self._params[key] > value['bounds'][1]: self._params[key] = value['bounds'][1] if self._params[key] < value['bounds'][0]: self._params[key] = value['bounds'][0] def param(self, name=None, idx=None): try: idx = idx if name == None else self.get_key_use_params_description('name', name) except KeyError: print('There is no parameter with this name') try: return self._params[idx] except IndexError: print('There is no parameter with this index') def set_param(self, param, name=None, idx=None): try: idx = idx if name is None else self.get_key_use_params_description('name', name) except KeyError: raise KeyError('"{}" have no parameter with name "{}"'.format(self, name)) try: self._params[idx] = param self._fix_val = False except IndexError: raise IndexError('"{}" have no parameter with index "{}"'.format(self, idx)) def init_params(self): try: for key, value in self._params_description.items(): self.set_param(np.random.uniform(value['bounds'][0], value['bounds'][1]), idx=key) except OverflowError: # tb = sys.exc_info()[2] raise OverflowError('Bounds have incorrect/infinite values') # .with_traceback(tb) def set_val(self, val): self.val = val def value(self, grid): """ Returns value of the token on the grid. Returns either cache result in self.val or calculated value in self.val by method self.evaluate(). Parameters ---------- grid: np.ndarray Grid for evaluation. Returns ------- Value of the token. """ if not self._fix_val or self.val is None: # self.check_params() self._fix_val = self.cache_val self.val = self.evaluate(self.params, grid) # centralization # self.val -= np.mean(self.val) assert self.val.shape == grid.shape, "Value must be the same shape as grid" return self.val @staticmethod def evaluate(params, grid): """ Calculating token value on the grid depending on parameters. Must be override/implement in each TerminalToken. May be not staticmethod if it is necessary. Parameters ---------- params: numpy.ndarray Numeric token parameters. grid: numpy.ndarray Grid for evaluation. Returns ------- numpy.ndarray """ return np.zeros(grid.shape) class ComplexToken(TerminalToken): """ ComplexToken is the Token which consists other tokens (as subtokens in property self.subtokens) in addition to the numeric parameters. Example: Product of TerminalTokens. """ def __init__(self, number_params: int = 0, params_description: dict = None, params: np.ndarray = None, cache_val: bool = True, fix_val: bool = False, fix: bool = False, val: np.ndarray = None, type_: str = 'TerminalToken', optimizer: str = None, name_: str = None, mandatory: float = 0, optimize_id: int = None, subtokens: list = None): """ Parameters ---------- See documentation TerminalToken.__init__.__doc__ subtokens: list List of other tokens which current token uses for calculating its value. """ super().__init__(number_params=number_params, params_description=params_description, params=params, cache_val=cache_val, fix_val=fix_val, fix=fix, val=val, type_=type_, optimizer=optimizer, name_=name_, mandatory=mandatory) if subtokens is None: subtokens = [] self.subtokens = subtokens self._check_mandatory() @property def subtokens(self): return self._subtokens @subtokens.setter def subtokens(self, subtokens: list): for token in subtokens: token.set_param(1, name='Amplitude') self._fix_val = False self._subtokens = subtokens self._check_mandatory() def add_subtoken(self, token): token.set_param(1, name='Amplitude') self._fix_val = False self.subtokens.append(token) self._check_mandatory() def set_subtoken(self, token, idx): token.set_param(1, name='Amplitude') self._fix_val = False self.subtokens[idx] = token self._check_mandatory() def del_subtoken(self, token): self.subtokens.remove(token) def _check_mandatory(self): """ If some subtoken in ComplexToken is mandatory then ComplexToken is mandatory too. Returns ------- """ for subtoken in self.subtokens: if subtoken.mandatory != 0: self.mandatory = np.random.uniform() return self.mandatory = 0
[ 1, 529, 276, 1112, 420, 29958, 18564, 280, 19131, 2901, 29914, 15488, 2287, 13, 15945, 29908, 13, 21409, 2362, 5570, 410, 4260, 7384, 310, 525, 6066, 29915, 2777, 408, 263, 2531, 297, 1894, 23352, 25173, 359, 608, 29889, 13, 13, 27403, 13, 28400, 13, 6066, 13, 14343, 979, 6066, 13, 8909, 29916, 6066, 13, 15945, 29908, 13, 5215, 4036, 13, 5215, 12655, 408, 7442, 13, 3166, 3509, 1053, 6483, 8552, 29892, 3509, 13, 3166, 2090, 312, 8789, 1053, 10032, 13, 3166, 25638, 1053, 16417, 29892, 9846, 5696, 29892, 9846, 6799, 13, 13, 13, 1990, 25159, 29898, 19658, 1125, 13, 1678, 9995, 13, 1678, 319, 5993, 338, 385, 7855, 393, 756, 777, 6593, 297, 278, 3030, 13, 1678, 310, 263, 2183, 3414, 29892, 322, 2094, 2547, 352, 1078, 2472, 393, 338, 8002, 304, 664, 411, 372, 29889, 13, 1678, 9995, 13, 13, 1678, 732, 16595, 5696, 13, 1678, 822, 995, 29898, 1311, 29892, 6856, 1125, 13, 4706, 9995, 13, 4706, 7106, 995, 310, 278, 5993, 297, 278, 3030, 310, 278, 3414, 29889, 13, 13, 4706, 12662, 2699, 13, 4706, 448, 1378, 29899, 13, 4706, 6856, 29901, 13, 9651, 450, 6856, 373, 607, 278, 995, 338, 12833, 29889, 13, 4706, 9995, 13, 4706, 1209, 13, 13, 1678, 822, 1024, 29898, 1311, 29892, 411, 29918, 7529, 29922, 8824, 1125, 13, 4706, 1018, 29901, 13, 9651, 736, 851, 29898, 1311, 29889, 7529, 29961, 29900, 2314, 718, 1583, 29889, 978, 29918, 13, 4706, 5174, 29901, 13, 9651, 1018, 29901, 13, 18884, 565, 411, 29918, 7529, 29901, 13, 462, 1678, 736, 1134, 29898, 1311, 467, 1649, 978, 1649, 718, 525, 29898, 7529, 2433, 718, 851, 29898, 1761, 29898, 1311, 29889, 7529, 876, 718, 525, 16029, 13, 18884, 736, 1134, 29898, 1311, 467, 1649, 978, 1649, 13, 9651, 5174, 29901, 13, 18884, 736, 1134, 29898, 1311, 467, 1649, 978, 1649, 13, 13, 1678, 822, 3509, 29898, 1311, 1125, 13, 4706, 736, 6483, 8552, 29898, 1311, 29897, 13, 13, 13, 1990, 29175, 6066, 29898, 6066, 1125, 13, 1678, 9995, 13, 1678, 29175, 6066, 338, 278, 5993, 393, 3639, 263, 995, 408, 263, 4608, 5069, 6161, 1218, 13, 1678, 5054, 7147, 871, 16985, 4128, 29889, 13, 13, 1678, 9995, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1353, 29918, 7529, 29901, 938, 353, 29871, 29900, 29892, 8636, 29918, 8216, 29901, 9657, 353, 6213, 29892, 8636, 29901, 7442, 29889, 299, 2378, 353, 6213, 29892, 13, 462, 7090, 29918, 791, 29901, 6120, 353, 5852, 29892, 2329, 29918, 791, 29901, 6120, 353, 7700, 29892, 2329, 29901, 6120, 353, 7700, 29892, 13, 462, 659, 29901, 7442, 29889, 299, 2378, 353, 6213, 29892, 1134, 29918, 29901, 851, 353, 525, 14343, 979, 6066, 742, 5994, 3950, 29901, 851, 353, 6213, 29892, 1024, 29918, 29901, 851, 353, 6213, 29892, 13, 462, 9619, 7606, 29901, 5785, 353, 29871, 29900, 29892, 24656, 29918, 333, 29901, 938, 353, 6213, 1125, 13, 4706, 9995, 13, 13, 4706, 12662, 2699, 13, 4706, 448, 1378, 29899, 13, 4706, 1353, 29918, 7529, 29901, 938, 13, 9651, 9681, 310, 16985, 4128, 20766, 278, 6030, 310, 278, 5993, 29889, 13, 4706, 8636, 29918, 8216, 29901, 9657, 13, 9651, 450, 8600, 310, 21503, 4314, 363, 20766, 16985, 4128, 310, 278, 5993, 29889, 13, 9651, 19928, 505, 278, 883, 763, 29901, 13, 9651, 426, 13, 18884, 3443, 29918, 2248, 29901, 9657, 29898, 978, 2433, 978, 742, 13451, 7607, 1195, 29918, 1767, 29892, 4236, 29918, 1767, 9601, 29892, 2023, 11724, 13, 18884, 2023, 13, 9651, 500, 13, 4706, 8636, 29901, 12655, 29889, 299, 2378, 13, 9651, 405, 25099, 4128, 310, 278, 5993, 363, 25202, 967, 995, 29889, 13, 4706, 7090, 29918, 791, 29901, 6120, 13, 9651, 960, 1565, 29892, 5993, 995, 674, 367, 12833, 871, 746, 967, 8636, 526, 3939, 29889, 20535, 630, 995, 13, 9651, 338, 3971, 304, 278, 5993, 2875, 525, 1311, 29889, 791, 4286, 13, 4706, 2329, 29918, 791, 29901, 6120, 13, 9651, 5282, 1312, 491, 3443, 525, 8173, 29918, 791, 4286, 960, 1565, 29892, 5993, 995, 3639, 525, 1311, 29889, 791, 4286, 13, 4706, 2329, 29901, 6120, 13, 9651, 960, 1565, 29892, 16985, 4128, 674, 451, 367, 3939, 491, 13883, 28648, 29889, 13, 4706, 659, 29901, 7442, 29889, 299, 2378, 13, 9651, 7865, 310, 278, 5993, 29889, 13, 4706, 1134, 29918, 29901, 851, 13, 9651, 5167, 310, 278, 5993, 29889, 13, 4706, 5994, 3950, 29901, 851, 13, 9651, 20693, 326, 3950, 29871, 13, 4706, 1024, 29918, 29901, 851, 13, 9651, 450, 1024, 310, 278, 5993, 393, 674, 367, 1304, 363, 7604, 4371, 2582, 322, 29871, 777, 10230, 6931, 29889, 13, 4706, 9619, 7606, 29901, 5785, 13, 9651, 853, 1387, 1178, 363, 278, 5993, 29889, 960, 451, 5225, 29892, 278, 5993, 1818, 367, 2198, 297, 278, 1121, 3386, 29889, 13, 4706, 24656, 29918, 333, 29901, 938, 13, 9651, 501, 8485, 363, 2893, 8232, 491, 5994, 19427, 607, 5993, 304, 24656, 29889, 13, 4706, 9995, 13, 4706, 1583, 3032, 4537, 29918, 7529, 353, 1353, 29918, 7529, 13, 4706, 565, 8636, 29918, 8216, 338, 6213, 29901, 13, 9651, 8636, 29918, 8216, 353, 6571, 13, 4706, 1583, 29889, 7529, 29918, 8216, 353, 8636, 29918, 8216, 13, 4706, 1583, 29889, 3198, 29918, 7529, 29918, 8216, 580, 13, 13, 4706, 565, 8636, 338, 6213, 29901, 13, 9651, 1583, 29889, 7529, 353, 7442, 29889, 3298, 359, 29898, 1311, 3032, 4537, 29918, 7529, 29897, 13, 4706, 1683, 29901, 13, 9651, 1583, 29889, 7529, 353, 7442, 29889, 2378, 29898, 7529, 29892, 26688, 29922, 7411, 29897, 13, 4706, 1583, 29889, 3198, 29918, 7529, 580, 13, 13, 4706, 1583, 29889, 791, 353, 659, 13, 4706, 1583, 29889, 5878, 353, 2329, 13, 4706, 1583, 29889, 8173, 29918, 791, 353, 7090, 29918, 791, 13, 4706, 1583, 3032, 5878, 29918, 791, 353, 2329, 29918, 791, 13, 4706, 1583, 29889, 1853, 353, 1134, 29918, 13, 4706, 1583, 29889, 20640, 3950, 353, 5994, 3950, 13, 4706, 1583, 29889, 978, 29918, 353, 1024, 29918, 13, 4706, 1583, 29889, 29885, 392, 7606, 353, 9619, 7606, 13, 4706, 1583, 29889, 20640, 675, 29918, 333, 353, 24656, 29918, 333, 13, 13, 1678, 822, 3509, 29898, 1311, 1125, 13, 4706, 716, 29918, 8552, 353, 3509, 29898, 1311, 29897, 13, 4706, 716, 29918, 8552, 29889, 7529, 353, 6483, 8552, 29898, 1482, 29918, 8552, 29889, 7529, 29897, 13, 4706, 736, 716, 29918, 8552, 13, 13, 1678, 396, 8108, 29879, 363, 664, 411, 8636, 322, 967, 2342, 1980, 13, 1678, 732, 6799, 13, 1678, 822, 8636, 29918, 8216, 29898, 1311, 1125, 13, 4706, 736, 1583, 3032, 7529, 29918, 8216, 13, 13, 1678, 732, 7529, 29918, 8216, 29889, 842, 357, 13, 1678, 822, 8636, 29918, 8216, 29898, 1311, 29892, 8636, 29918, 8216, 29901, 9657, 1125, 13, 4706, 9995, 13, 4706, 1459, 2232, 29918, 8216, 338, 8600, 310, 21503, 4314, 363, 20766, 16985, 4128, 310, 278, 5993, 29889, 13, 9651, 19928, 505, 278, 883, 763, 29901, 13, 9651, 426, 13, 18884, 3443, 29918, 2248, 29922, 29900, 29901, 9657, 29898, 978, 2433, 978, 742, 13451, 7607, 1195, 29918, 1767, 29892, 4236, 29918, 1767, 9601, 29892, 2023, 11724, 13, 18884, 2023, 13, 9651, 500, 13, 4706, 1459, 2232, 29918, 8216, 1818, 1712, 599, 4235, 363, 664, 297, 1857, 18897, 393, 674, 367, 7120, 491, 13, 4706, 1158, 525, 1311, 29889, 3198, 29918, 7529, 29918, 8216, 580, 4286, 13, 13, 4706, 12662, 2699, 13, 4706, 448, 1378, 29899, 13, 4706, 8636, 29918, 8216, 29901, 9657, 13, 9651, 13343, 411, 6139, 363, 1269, 3443, 13, 4706, 9995, 13, 4706, 4974, 1134, 29898, 7529, 29918, 8216, 29897, 1275, 9657, 13, 4706, 1583, 3032, 7529, 29918, 8216, 353, 8636, 29918, 8216, 13, 13, 1678, 822, 1423, 29918, 7529, 29918, 8216, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 5399, 8636, 29918, 8216, 363, 11780, 363, 1857, 5993, 29889, 13, 4706, 9995, 13, 4706, 27878, 355, 800, 353, 6634, 29876, 11403, 3519, 525, 7529, 29918, 8216, 29889, 842, 357, 29915, 470, 525, 842, 29918, 2783, 11709, 29915, 304, 1735, 8636, 29918, 2783, 699, 1980, 29908, 13, 4706, 4974, 1134, 29898, 1583, 3032, 7529, 29918, 8216, 29897, 1275, 9657, 29892, 376, 13919, 8636, 29918, 8216, 3829, 1699, 320, 13, 462, 462, 462, 4706, 376, 1818, 367, 263, 8600, 310, 21503, 4314, 29908, 718, 27878, 355, 800, 13, 4706, 4974, 7431, 29898, 1311, 3032, 7529, 29918, 8216, 29897, 1275, 1583, 3032, 4537, 29918, 7529, 29892, 376, 1576, 1353, 310, 4128, 947, 451, 29908, 320, 13, 462, 462, 462, 462, 268, 376, 1993, 278, 1353, 310, 29037, 943, 29908, 718, 27878, 355, 800, 13, 4706, 363, 1820, 29892, 995, 297, 1583, 3032, 7529, 29918, 8216, 29889, 7076, 7295, 13, 9651, 4974, 1134, 29898, 1767, 29897, 1275, 9657, 29892, 376, 13919, 8636, 29918, 8216, 3829, 29892, 1818, 367, 263, 8600, 310, 21503, 4314, 29908, 13, 9651, 4974, 525, 978, 29915, 297, 995, 29889, 8149, 3285, 376, 2558, 525, 978, 29915, 1818, 367, 297, 278, 9322, 29908, 320, 13, 462, 462, 965, 376, 8600, 363, 1269, 3443, 29908, 718, 27878, 355, 800, 13, 9651, 4974, 525, 23687, 29915, 297, 995, 29889, 8149, 3285, 376, 2558, 525, 23687, 29915, 1818, 367, 297, 278, 9322, 376, 320, 13, 462, 462, 632, 376, 27126, 363, 1269, 3443, 29908, 718, 27878, 355, 800, 13, 9651, 4974, 1820, 529, 1583, 3032, 4537, 29918, 7529, 29892, 376, 1576, 3443, 2380, 1818, 451, 13461, 29908, 320, 13, 462, 462, 795, 376, 278, 1353, 310, 4128, 29908, 718, 27878, 355, 800, 13, 9651, 4974, 313, 2435, 29898, 1767, 1839, 23687, 11287, 1275, 29871, 29906, 322, 13, 462, 259, 995, 1839, 23687, 2033, 29961, 29900, 29962, 5277, 995, 1839, 23687, 2033, 29961, 29896, 11724, 376, 18526, 310, 1269, 3443, 1818, 505, 29908, 320, 13, 462, 462, 462, 9651, 376, 3309, 353, 29871, 29906, 322, 1712, 995, 29908, 320, 13, 462, 462, 462, 9651, 376, 24371, 341, 1177, 5277, 18134, 1213, 718, 27878, 355, 800, 13, 13, 1678, 822, 731, 29918, 2783, 11709, 29898, 1311, 29892, 1820, 29901, 938, 29892, 553, 11709, 29918, 978, 29901, 851, 29892, 553, 11709, 29918, 1767, 1125, 13, 4706, 1018, 29901, 13, 9651, 1583, 3032, 7529, 29918, 8216, 29961, 1989, 3816, 2783, 11709, 29918, 978, 29962, 353, 553, 11709, 29918, 1767, 13, 4706, 5174, 7670, 2392, 29901, 13, 9651, 1596, 877, 8439, 338, 694, 3443, 411, 1316, 2380, 29914, 2783, 11709, 1495, 13, 13, 1678, 822, 679, 29918, 1989, 29918, 1509, 29918, 7529, 29918, 8216, 29898, 1311, 29892, 553, 11709, 29918, 978, 29901, 851, 29892, 553, 11709, 29918, 1767, 1125, 13, 4706, 363, 1820, 29892, 995, 297, 1583, 3032, 7529, 29918, 8216, 29889, 7076, 7295, 13, 9651, 565, 995, 29961, 2783, 11709, 29918, 978, 29962, 1275, 553, 11709, 29918, 1767, 29901, 13, 18884, 736, 1820, 13, 4706, 12020, 7670, 2392, 580, 13, 13, 1678, 822, 679, 29918, 2783, 11709, 29918, 13150, 29918, 3207, 29898, 1311, 29892, 553, 11709, 29918, 978, 29901, 851, 29897, 1599, 1051, 29901, 13, 4706, 3240, 353, 518, 8516, 363, 903, 297, 3464, 29898, 1311, 3032, 4537, 29918, 7529, 4638, 13, 4706, 363, 1820, 29892, 995, 297, 1583, 3032, 7529, 29918, 8216, 29889, 7076, 7295, 13, 9651, 3240, 29961, 1989, 29962, 353, 995, 29961, 2783, 11709, 29918, 978, 29962, 13, 4706, 736, 3240, 13, 13, 1678, 732, 6799, 13, 1678, 822, 8636, 29898, 1311, 1125, 13, 4706, 736, 1583, 3032, 7529, 13, 13, 1678, 732, 7529, 29889, 842, 357, 13, 1678, 822, 8636, 29898, 1311, 29892, 8636, 1125, 13, 4706, 4974, 7431, 29898, 7529, 29897, 1275, 1583, 3032, 4537, 29918, 7529, 29892, 376, 4290, 1409, 756, 10240, 2159, 29908, 13, 4706, 1583, 3032, 7529, 353, 7442, 29889, 2378, 29898, 7529, 29892, 26688, 29922, 7411, 29897, 13, 4706, 1583, 3032, 5878, 29918, 791, 353, 7700, 13, 13, 1678, 822, 1423, 29918, 7529, 29898, 1311, 1125, 13, 4706, 27878, 355, 800, 353, 6634, 29876, 11403, 3519, 525, 7529, 29889, 842, 357, 29915, 470, 525, 842, 29918, 3207, 29915, 304, 1735, 8636, 29908, 13, 4706, 4974, 7431, 29898, 13, 9651, 1583, 3032, 7529, 29897, 1275, 1583, 3032, 4537, 29918, 7529, 29892, 376, 1576, 1353, 310, 4128, 947, 451, 1993, 278, 3309, 310, 8636, 1409, 29908, 718, 27878, 355, 800, 13, 4706, 363, 1820, 29892, 995, 297, 1583, 3032, 7529, 29918, 8216, 29889, 7076, 7295, 13, 9651, 565, 1583, 3032, 7529, 29961, 1989, 29962, 1405, 995, 1839, 23687, 2033, 29961, 29896, 5387, 13, 18884, 1583, 3032, 7529, 29961, 1989, 29962, 353, 995, 1839, 23687, 2033, 29961, 29896, 29962, 13, 9651, 565, 1583, 3032, 7529, 29961, 1989, 29962, 529, 995, 1839, 23687, 2033, 29961, 29900, 5387, 13, 18884, 1583, 3032, 7529, 29961, 1989, 29962, 353, 995, 1839, 23687, 2033, 29961, 29900, 29962, 13, 13, 1678, 822, 1828, 29898, 1311, 29892, 1024, 29922, 8516, 29892, 22645, 29922, 8516, 1125, 13, 4706, 1018, 29901, 13, 9651, 22645, 353, 22645, 565, 1024, 1275, 6213, 1683, 1583, 29889, 657, 29918, 1989, 29918, 1509, 29918, 7529, 29918, 8216, 877, 978, 742, 1024, 29897, 13, 4706, 5174, 7670, 2392, 29901, 13, 9651, 1596, 877, 8439, 338, 694, 3443, 411, 445, 1024, 1495, 13, 4706, 1018, 29901, 13, 9651, 736, 1583, 3032, 7529, 29961, 13140, 29962, 13, 4706, 5174, 11374, 2392, 29901, 13, 9651, 1596, 877, 8439, 338, 694, 3443, 411, 445, 2380, 1495, 13, 13, 1678, 822, 731, 29918, 3207, 29898, 1311, 29892, 1828, 29892, 1024, 29922, 8516, 29892, 22645, 29922, 8516, 1125, 13, 4706, 1018, 29901, 13, 9651, 22645, 353, 22645, 565, 1024, 338, 6213, 1683, 1583, 29889, 657, 29918, 1989, 29918, 1509, 29918, 7529, 29918, 8216, 877, 978, 742, 1024, 29897, 13, 4706, 5174, 7670, 2392, 29901, 13, 9651, 12020, 7670, 2392, 877, 29908, 29912, 5038, 505, 694, 3443, 411, 1024, 29850, 5038, 4286, 4830, 29898, 1311, 29892, 1024, 876, 13, 4706, 1018, 29901, 13, 9651, 1583, 3032, 7529, 29961, 13140, 29962, 353, 1828, 13, 9651, 1583, 3032, 5878, 29918, 791, 353, 7700, 13, 4706, 5174, 11374, 2392, 29901, 13, 9651, 12020, 11374, 2392, 877, 29908, 29912, 5038, 505, 694, 3443, 411, 2380, 29850, 5038, 4286, 4830, 29898, 1311, 29892, 22645, 876, 13, 13, 1678, 822, 2069, 29918, 7529, 29898, 1311, 1125, 13, 4706, 1018, 29901, 13, 9651, 363, 1820, 29892, 995, 297, 1583, 3032, 7529, 29918, 8216, 29889, 7076, 7295, 13, 18884, 1583, 29889, 842, 29918, 3207, 29898, 9302, 29889, 8172, 29889, 29590, 29898, 1767, 1839, 23687, 2033, 29961, 29900, 1402, 995, 1839, 23687, 2033, 29961, 29896, 11724, 22645, 29922, 1989, 29897, 13, 4706, 5174, 28845, 2392, 29901, 13, 9651, 396, 260, 29890, 353, 10876, 29889, 735, 29883, 29918, 3888, 580, 29961, 29906, 29962, 13, 9651, 12020, 28845, 2392, 877, 18526, 505, 10240, 29914, 262, 18925, 1819, 1495, 29871, 396, 869, 2541, 29918, 15003, 1627, 29898, 22625, 29897, 13, 13, 1678, 822, 731, 29918, 791, 29898, 1311, 29892, 659, 1125, 13, 4706, 1583, 29889, 791, 353, 659, 13, 13, 1678, 822, 995, 29898, 1311, 29892, 6856, 1125, 13, 4706, 9995, 13, 4706, 16969, 995, 310, 278, 5993, 373, 278, 6856, 29889, 13, 4706, 16969, 2845, 7090, 1121, 297, 1583, 29889, 791, 470, 12833, 995, 297, 1583, 29889, 791, 491, 1158, 1583, 29889, 24219, 403, 2141, 13, 13, 4706, 12662, 2699, 13, 4706, 448, 1378, 29899, 13, 4706, 6856, 29901, 7442, 29889, 299, 2378, 13, 9651, 11657, 363, 17983, 29889, 13, 13, 4706, 16969, 13, 4706, 448, 22158, 13, 4706, 7865, 310, 278, 5993, 29889, 13, 4706, 9995, 13, 4706, 565, 451, 1583, 3032, 5878, 29918, 791, 470, 1583, 29889, 791, 338, 6213, 29901, 13, 9651, 396, 1583, 29889, 3198, 29918, 7529, 580, 13, 9651, 1583, 3032, 5878, 29918, 791, 353, 1583, 29889, 8173, 29918, 791, 13, 9651, 1583, 29889, 791, 353, 1583, 29889, 24219, 403, 29898, 1311, 29889, 7529, 29892, 6856, 29897, 13, 9651, 396, 6555, 2133, 13, 9651, 396, 1583, 29889, 791, 22361, 7442, 29889, 12676, 29898, 1311, 29889, 791, 29897, 13, 4706, 4974, 1583, 29889, 791, 29889, 12181, 1275, 6856, 29889, 12181, 29892, 376, 1917, 1818, 367, 278, 1021, 8267, 408, 6856, 29908, 13, 4706, 736, 1583, 29889, 791, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 14707, 29898, 7529, 29892, 6856, 1125, 13, 4706, 9995, 13, 4706, 20535, 1218, 5993, 995, 373, 278, 6856, 8679, 373, 4128, 29889, 13, 4706, 19928, 367, 5712, 29914, 326, 2037, 297, 1269, 29175, 6066, 29889, 13, 4706, 2610, 367, 451, 2294, 5696, 565, 372, 338, 5181, 29889, 13, 13, 4706, 12662, 2699, 13, 4706, 448, 1378, 29899, 13, 4706, 8636, 29901, 12655, 29889, 299, 2378, 13, 9651, 405, 25099, 5993, 4128, 29889, 13, 4706, 6856, 29901, 12655, 29889, 299, 2378, 13, 9651, 11657, 363, 17983, 29889, 13, 13, 4706, 16969, 13, 4706, 448, 22158, 13, 4706, 12655, 29889, 299, 2378, 13, 4706, 9995, 13, 4706, 736, 7442, 29889, 3298, 359, 29898, 7720, 29889, 12181, 29897, 13, 13, 13, 1990, 26596, 6066, 29898, 14343, 979, 6066, 1125, 13, 1678, 9995, 13, 1678, 26596, 6066, 338, 278, 25159, 607, 11624, 916, 18897, 313, 294, 1014, 517, 12360, 297, 2875, 1583, 29889, 1491, 517, 12360, 29897, 13, 1678, 297, 6124, 304, 278, 16985, 4128, 29889, 13, 1678, 8741, 29901, 10969, 310, 29175, 29911, 554, 575, 29889, 13, 1678, 9995, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1353, 29918, 7529, 29901, 938, 353, 29871, 29900, 29892, 8636, 29918, 8216, 29901, 9657, 353, 6213, 29892, 8636, 29901, 7442, 29889, 299, 2378, 353, 6213, 29892, 13, 462, 7090, 29918, 791, 29901, 6120, 353, 5852, 29892, 2329, 29918, 791, 29901, 6120, 353, 7700, 29892, 2329, 29901, 6120, 353, 7700, 29892, 13, 462, 659, 29901, 7442, 29889, 299, 2378, 353, 6213, 29892, 1134, 29918, 29901, 851, 353, 525, 14343, 979, 6066, 742, 5994, 3950, 29901, 851, 353, 6213, 29892, 1024, 29918, 29901, 851, 353, 6213, 29892, 13, 462, 9619, 7606, 29901, 5785, 353, 29871, 29900, 29892, 24656, 29918, 333, 29901, 938, 353, 6213, 29892, 13, 462, 1014, 517, 12360, 29901, 1051, 353, 6213, 1125, 13, 4706, 9995, 13, 13, 4706, 12662, 2699, 13, 4706, 448, 1378, 29899, 13, 4706, 2823, 5106, 29175, 6066, 17255, 2344, 1649, 17255, 1514, 1649, 13, 13, 4706, 1014, 517, 12360, 29901, 1051, 13, 9651, 2391, 310, 916, 18897, 607, 1857, 5993, 3913, 363, 25202, 967, 995, 29889, 13, 4706, 9995, 13, 4706, 2428, 2141, 1649, 2344, 12035, 4537, 29918, 7529, 29922, 4537, 29918, 7529, 29892, 8636, 29918, 8216, 29922, 7529, 29918, 8216, 29892, 13, 462, 308, 8636, 29922, 7529, 29892, 7090, 29918, 791, 29922, 8173, 29918, 791, 29892, 2329, 29918, 791, 29922, 5878, 29918, 791, 29892, 2329, 29922, 5878, 29892, 13, 462, 308, 659, 29922, 791, 29892, 1134, 29918, 29922, 1853, 3383, 5994, 3950, 29922, 20640, 3950, 29892, 1024, 29918, 29922, 978, 3383, 9619, 7606, 29922, 29885, 392, 7606, 29897, 13, 4706, 565, 1014, 517, 12360, 338, 6213, 29901, 13, 9651, 1014, 517, 12360, 353, 5159, 13, 4706, 1583, 29889, 1491, 517, 12360, 353, 1014, 517, 12360, 13, 4706, 1583, 3032, 3198, 29918, 29885, 392, 7606, 580, 13, 13, 1678, 732, 6799, 13, 1678, 822, 1014, 517, 12360, 29898, 1311, 1125, 13, 4706, 736, 1583, 3032, 1491, 517, 12360, 13, 13, 1678, 732, 1491, 517, 12360, 29889, 842, 357, 13, 1678, 822, 1014, 517, 12360, 29898, 1311, 29892, 1014, 517, 12360, 29901, 1051, 1125, 13, 4706, 363, 5993, 297, 1014, 517, 12360, 29901, 13, 9651, 5993, 29889, 842, 29918, 3207, 29898, 29896, 29892, 1024, 2433, 6833, 2830, 1151, 1495, 13, 4706, 1583, 3032, 5878, 29918, 791, 353, 7700, 13, 4706, 1583, 3032, 1491, 517, 12360, 353, 1014, 517, 12360, 13, 4706, 1583, 3032, 3198, 29918, 29885, 392, 7606, 580, 13, 13, 1678, 822, 788, 29918, 1491, 6979, 29898, 1311, 29892, 5993, 1125, 13, 4706, 5993, 29889, 842, 29918, 3207, 29898, 29896, 29892, 1024, 2433, 6833, 2830, 1151, 1495, 13, 4706, 1583, 3032, 5878, 29918, 791, 353, 7700, 13, 4706, 1583, 29889, 1491, 517, 12360, 29889, 4397, 29898, 6979, 29897, 13, 4706, 1583, 3032, 3198, 29918, 29885, 392, 7606, 580, 13, 13, 1678, 822, 731, 29918, 1491, 6979, 29898, 1311, 29892, 5993, 29892, 22645, 1125, 13, 4706, 5993, 29889, 842, 29918, 3207, 29898, 29896, 29892, 1024, 2433, 6833, 2830, 1151, 1495, 13, 4706, 1583, 3032, 5878, 29918, 791, 353, 7700, 13, 4706, 1583, 29889, 1491, 517, 12360, 29961, 13140, 29962, 353, 5993, 13, 4706, 1583, 3032, 3198, 29918, 29885, 392, 7606, 580, 13, 13, 1678, 822, 628, 29918, 1491, 6979, 29898, 1311, 29892, 5993, 1125, 13, 4706, 1583, 29889, 1491, 517, 12360, 29889, 5992, 29898, 6979, 29897, 13, 13, 1678, 822, 903, 3198, 29918, 29885, 392, 7606, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 960, 777, 1014, 6979, 297, 26596, 6066, 338, 9619, 7606, 769, 26596, 6066, 338, 9619, 7606, 2086, 29889, 13, 13, 4706, 16969, 13, 4706, 448, 22158, 13, 13, 4706, 9995, 13, 4706, 363, 1014, 6979, 297, 1583, 29889, 1491, 517, 12360, 29901, 13, 9651, 565, 1014, 6979, 29889, 29885, 392, 7606, 2804, 29871, 29900, 29901, 13, 18884, 1583, 29889, 29885, 392, 7606, 353, 7442, 29889, 8172, 29889, 29590, 580, 13, 18884, 736, 13, 4706, 1583, 29889, 29885, 392, 7606, 353, 29871, 29900, 13, 13, 2 ]
spacy/lang/pt/lex_attrs.py
keshan/spaCy
1
14125
<filename>spacy/lang/pt/lex_attrs.py # coding: utf8 from __future__ import unicode_literals from ...attrs import LIKE_NUM _num_words = ['zero', 'um', 'dois', 'três', 'tres', 'quatro', 'cinco', 'seis', 'sete', 'oito', 'nove', 'dez', 'onze', 'doze', 'dúzia', 'dúzias', 'duzia', 'duzias', 'treze', 'catorze', 'quinze', 'dezasseis', 'dezassete', 'dezoito', 'dezanove', 'vinte', 'trinta', 'quarenta', 'cinquenta', 'sessenta', 'setenta', 'oitenta', 'noventa', 'cem', 'cento', 'duzentos', 'trezentos', 'quatrocentos', 'quinhentos', 'seicentos', 'setecentos', 'oitocentos', 'novecentos', 'mil', 'milhão', 'milhao', 'milhões', 'milhoes', 'bilhão', 'bilhao', 'bilhões', 'bilhoes', 'trilhão', 'trilhao', 'trilhões', 'trilhoes', 'quadrilhão', 'quadrilhao', 'quadrilhões', 'quadrilhoes'] _ordinal_words = ['primeiro', 'segundo', 'terceiro', 'quarto', 'quinto', 'sexto', 'sétimo', 'oitavo', 'nono', 'décimo', 'vigésimo', 'trigésimo', 'quadragésimo', 'quinquagésimo', 'sexagésimo', 'septuagésimo', 'octogésimo', 'nonagésimo', 'centésimo', 'ducentésimo', 'trecentésimo', 'quadringentésimo', 'quingentésimo', 'sexcentésimo', 'septingentésimo', 'octingentésimo', 'nongentésimo', 'milésimo', 'milionésimo', 'bilionésimo'] def like_num(text): text = text.replace(',', '').replace('.', '') if text.isdigit(): return True if text.count('/') == 1: num, denom = text.split('/') if num.isdigit() and denom.isdigit(): return True if text.lower() in _num_words: return True if text.lower() in _ordinal_words: return True return False LEX_ATTRS = { LIKE_NUM: like_num }
[ 1, 529, 9507, 29958, 1028, 4135, 29914, 3893, 29914, 415, 29914, 2506, 29918, 5552, 29879, 29889, 2272, 13, 29937, 14137, 29901, 23616, 29947, 13, 3166, 4770, 29888, 9130, 1649, 1053, 29104, 29918, 20889, 1338, 13, 13, 3166, 2023, 5552, 29879, 1053, 22962, 29918, 13967, 13, 13, 13, 29918, 1949, 29918, 9303, 353, 6024, 9171, 742, 525, 398, 742, 525, 1867, 275, 742, 525, 509, 8769, 742, 525, 5888, 742, 525, 339, 7816, 742, 525, 16381, 1111, 742, 525, 344, 275, 742, 525, 842, 29872, 742, 525, 29877, 2049, 742, 525, 29876, 994, 742, 525, 311, 29920, 742, 13, 795, 525, 265, 911, 742, 525, 1867, 911, 742, 525, 29881, 30030, 19822, 742, 525, 29881, 30030, 2526, 294, 742, 525, 700, 19822, 742, 525, 700, 2526, 294, 742, 525, 2484, 911, 742, 525, 29883, 1061, 911, 742, 525, 24150, 911, 742, 525, 311, 29920, 5793, 275, 742, 29871, 13, 795, 525, 311, 29920, 465, 2650, 742, 525, 311, 2502, 2049, 742, 525, 311, 24912, 994, 742, 525, 3845, 371, 742, 525, 509, 15073, 742, 525, 339, 279, 6381, 742, 525, 16381, 339, 6381, 742, 525, 29879, 404, 6381, 742, 13, 795, 525, 842, 6381, 742, 525, 20252, 6381, 742, 525, 13715, 6381, 742, 525, 19335, 742, 525, 1760, 29877, 742, 525, 700, 6741, 359, 742, 525, 2484, 6741, 359, 742, 525, 339, 7816, 1760, 359, 742, 13, 795, 525, 24150, 29882, 296, 359, 742, 525, 344, 293, 296, 359, 742, 525, 842, 687, 296, 359, 742, 525, 20252, 542, 296, 359, 742, 525, 29876, 994, 1760, 359, 742, 525, 23853, 742, 525, 23853, 29882, 1368, 742, 525, 23853, 2350, 29877, 742, 13, 795, 525, 23853, 29882, 4420, 742, 525, 23853, 1251, 267, 742, 525, 18152, 29882, 1368, 742, 525, 18152, 2350, 29877, 742, 525, 18152, 29882, 4420, 742, 525, 18152, 1251, 267, 742, 525, 509, 309, 29882, 1368, 742, 525, 509, 309, 2350, 29877, 742, 525, 509, 309, 29882, 4420, 742, 13, 795, 525, 509, 309, 1251, 267, 742, 525, 3425, 4115, 29882, 1368, 742, 525, 3425, 4115, 2350, 29877, 742, 525, 3425, 4115, 29882, 4420, 742, 525, 3425, 4115, 1251, 267, 2033, 13, 13, 13, 29918, 536, 979, 29918, 9303, 353, 6024, 10080, 3350, 742, 525, 10199, 6201, 742, 525, 357, 346, 3350, 742, 525, 339, 22171, 742, 525, 339, 8941, 742, 525, 344, 486, 29877, 742, 13, 462, 29871, 525, 29879, 1893, 4200, 742, 525, 20252, 27082, 742, 525, 29876, 3231, 742, 525, 29881, 4582, 4200, 742, 525, 29894, 335, 743, 4200, 742, 525, 509, 335, 743, 4200, 742, 13, 462, 29871, 525, 3425, 1431, 743, 4200, 742, 525, 24150, 339, 351, 743, 4200, 742, 525, 14167, 351, 743, 4200, 742, 525, 344, 415, 29884, 351, 743, 4200, 742, 13, 462, 29871, 525, 20082, 468, 743, 4200, 742, 525, 5464, 351, 743, 4200, 742, 525, 1760, 743, 4200, 742, 525, 700, 1760, 743, 4200, 742, 13, 462, 29871, 525, 2484, 1760, 743, 4200, 742, 525, 3425, 5393, 296, 743, 4200, 742, 525, 339, 292, 296, 743, 4200, 742, 525, 14167, 1760, 743, 4200, 742, 13, 462, 29871, 525, 344, 415, 292, 296, 743, 4200, 742, 525, 20082, 292, 296, 743, 4200, 742, 525, 29876, 549, 296, 743, 4200, 742, 525, 23853, 743, 4200, 742, 13, 462, 29871, 525, 23853, 291, 743, 4200, 742, 525, 18152, 291, 743, 4200, 2033, 13, 13, 13, 1753, 763, 29918, 1949, 29898, 726, 1125, 13, 1678, 1426, 353, 1426, 29889, 6506, 29317, 742, 525, 2824, 6506, 12839, 742, 27255, 13, 1678, 565, 1426, 29889, 275, 26204, 7295, 13, 4706, 736, 5852, 13, 1678, 565, 1426, 29889, 2798, 11219, 1495, 1275, 29871, 29896, 29901, 13, 4706, 954, 29892, 972, 290, 353, 1426, 29889, 5451, 11219, 1495, 13, 4706, 565, 954, 29889, 275, 26204, 580, 322, 972, 290, 29889, 275, 26204, 7295, 13, 9651, 736, 5852, 13, 1678, 565, 1426, 29889, 13609, 580, 297, 903, 1949, 29918, 9303, 29901, 13, 4706, 736, 5852, 13, 1678, 565, 1426, 29889, 13609, 580, 297, 903, 536, 979, 29918, 9303, 29901, 13, 4706, 736, 5852, 13, 1678, 736, 7700, 13, 13, 13, 1307, 29990, 29918, 1299, 5659, 29903, 353, 426, 13, 1678, 22962, 29918, 13967, 29901, 763, 29918, 1949, 13, 29913, 13, 2 ]
spider_service/app/spider/selenium/webdriver.py
seniortesting/python-spider
0
20166
# -*- coding:utf-8 -*- import random import time from selenium import webdriver from selenium.webdriver.chrome.options import Options from selenium.webdriver.common.keys import Keys from app.api.util.web_request import WebRequest, USER_AGENT_PC, USER_AGENT_MOBILE class SpiderWebDriver(object): def __init__(self, url: str, userAgent: str = None,referer: str=None, proxy: str = None): # 进入浏览器设置 chrome_options = Options() # 配置参数: http://chromedriver.chromium.org/capabilities # 详细参数: https://peter.sh/experiments/chromium-command-line-switches/ chrome_options.add_argument('lang=zh_CN.UTF-8') # chrome_options.add_argument('headless') # chrome_options.add_argument('window-size=1024,768') chrome_options.add_argument('no-sandbox') chrome_options.add_argument("disable-gpu") chrome_options.add_argument("ignore-certificate-errors"); chrome_options.add_argument("disable-popup-blocking"); chrome_options.add_argument("disable-default-apps"); # Chrome is being controlled by automated test software if userAgent is None: # 默认safari pc端浏览器 userAgent = 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534.57.2 (KHTML, like Gecko) Version/5.1.7 Safari/534.57.2' chrome_options.add_argument('user-agent="' + userAgent + '"') chrome_options.add_argument('referer="https://www.google.com/"') if proxy is not None: proxy_str = "http://{proxy}".format(proxy=proxy) chrome_options.add_argument('proxy-server=' + proxy_str) # http://chromedriver.storage.googleapis.com/index.html self.driver = webdriver.Chrome(options=chrome_options) self.driver.maximize_window() if url: self.driver.get(url=url) def close(self): driver = self.driver if driver is None: return try: driver.close() driver.quit() finally: self.driver = None def __enter__(self): return self def __exit__(self, *exc_info): del exc_info self.close() def open(self, url): self.driver.get(url) def get_cookies(self): cookies_dict = {} cookies = self.driver.get_cookies() for cookie in cookies: cookies_dict[cookie['name']] = cookie['value'] return cookies_dict def execute_js(self, js, *args): return self.driver.execute_script(js, args) def adsenseClick(): # 获取wordpress的随机文章 url = 'https://pingbook.top/wp-json/wp/v2/posts' r=WebRequest() post_list=r.pc().get(url=url).json() # links=[ item.get('link') for item in post_list] # print(links) # post_list =[{'link': 'https://pingbook.top/vue-videojs-m3u8-player-a-html5-video-player/'}] # 模拟操作打开文章 proxyset = set() for num in range(10000): post=random.choice(post_list) post_url=post.get('link') print('发送请求的文章地址是: {}'.format(post_url)) agents = USER_AGENT_PC + USER_AGENT_MOBILE time_count = num + 1 driver = None try: content = r.pc().get('https://open.pingbook.top/proxy/get?type=valid').json() proxy = content.get('data').get('proxy') print('发送请求的代理是: {}'.format(proxy)) if proxy not in proxyset: # 时候重复的使用了相同的ip地址 proxyset.add(proxy) agent = random.choice(agents) driver = SpiderWebDriver(post_url, agent, proxy) driver.open(post_url) print('已经打开博客地址: {}'.format(post_url)) driver.driver.refresh() submitBtn =driver.driver.find_element_by_id('submit') if submitBtn: # 滚动到对应的广告部分 driver.driver.execute_script('arguments[0].scrollIntoView(true);',submitBtn) submitBtn.click() time.sleep(3) # driver.driver.refresh() # wait = WebDriverWait(driver.driver, 6) # element = wait.until(expected_conditions.element_to_be_clickable((By.ID, 'ads'))) # driver.close() print('第{}次轮训成功,代理: {}。。。。'.format(time_count, proxy)) # actionBtn = driver.driver.find_element_by_class_name('copy-btn') # if actionBtn: # driver.driver.refresh() # wait = WebDriverWait(driver.driver, 6) # element = wait.until(expected_conditions.element_to_be_clickable((By.ID, 'ads'))) # actionBtn.click() # driver.close() # print('第{}次轮训成功,代理: {}。。。。'.format(time, proxy)) else: print('当前代理地址: {}已经存在,不再使用该地址进行测试,代理池大小: {}!'.format(proxy,len(proxyset))) except Exception as e: print('第{}次轮训失败,失败信息: {}。。。。'.format(time_count, e)) # raise finally: if driver is not None: driver.close() def searchGoogle(): keyword= 'nuxt create nuxt app error :pingbook.top' # 模拟操作打开文章 proxyset = set() r=WebRequest() agents=USER_AGENT_PC for num in range(10000): driver = None try: content = r.pc().get('https://open.pingbook.top/proxy/get?type=valid').json() proxy = content.get('data').get('proxy') print('发送请求的代理是: {}'.format(proxy)) if proxy not in proxyset: # 时候重复的使用了相同的ip地址 proxyset.add(proxy) agent = random.choice(agents) spider = SpiderWebDriver(None, agent, proxy) spider.open('https://google.com') driver =spider.driver # 输入关键字 inputbox=driver.find_element_by_name('q') if inputbox: inputbox.send_keys(keyword) inputbox.send_keys(Keys.ENTER) time.sleep(3) # 点击第一条记录 first_record=driver.find_element_by_css_selector('#rso > div:nth-child(1) > div > div:nth-child(1) > div > div > div.r > a') first_record.click() time.sleep(5) driver.refresh() time.sleep(6) except Exception as e: print('第{}次轮训失败,失败信息: {}。。。。'.format(num, e)) finally: if driver is not None: driver.quit() if __name__ == '__main__': adsenseClick()
[ 1, 396, 448, 29930, 29899, 14137, 29901, 9420, 29899, 29947, 448, 29930, 29899, 13, 5215, 4036, 13, 5215, 931, 13, 13, 3166, 18866, 1053, 1856, 9465, 13, 3166, 18866, 29889, 29813, 29889, 18114, 29889, 6768, 1053, 25186, 13, 3166, 18866, 29889, 29813, 29889, 9435, 29889, 8149, 1053, 4813, 952, 13, 13, 3166, 623, 29889, 2754, 29889, 4422, 29889, 2676, 29918, 3827, 1053, 2563, 3089, 29892, 3148, 1001, 29918, 10051, 3919, 29918, 9026, 29892, 3148, 1001, 29918, 10051, 3919, 29918, 6720, 12809, 1307, 13, 13, 13, 1990, 26778, 3609, 12376, 29898, 3318, 1125, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 3142, 29901, 851, 29892, 13, 462, 1404, 19661, 29901, 851, 353, 6213, 29892, 20275, 261, 29901, 851, 29922, 8516, 29892, 10166, 29901, 851, 353, 6213, 1125, 13, 4706, 396, 29871, 31174, 30752, 233, 184, 146, 235, 170, 139, 30943, 30872, 30669, 13, 4706, 16735, 29918, 6768, 353, 25186, 580, 13, 4706, 396, 29871, 31361, 30669, 31125, 30354, 29901, 1732, 597, 27433, 287, 3511, 29889, 27433, 1974, 29889, 990, 29914, 5030, 11614, 13, 4706, 396, 29871, 235, 178, 169, 234, 190, 137, 31125, 30354, 30383, 2045, 597, 29886, 1308, 29889, 845, 29914, 735, 546, 7862, 29914, 27433, 1974, 29899, 6519, 29899, 1220, 29899, 15123, 267, 29914, 13, 4706, 16735, 29918, 6768, 29889, 1202, 29918, 23516, 877, 3893, 29922, 17599, 29918, 13778, 29889, 10496, 29899, 29947, 1495, 13, 4706, 396, 16735, 29918, 6768, 29889, 1202, 29918, 23516, 877, 2813, 2222, 1495, 13, 4706, 396, 16735, 29918, 6768, 29889, 1202, 29918, 23516, 877, 7165, 29899, 2311, 29922, 29896, 29900, 29906, 29946, 29892, 29955, 29953, 29947, 1495, 13, 4706, 16735, 29918, 6768, 29889, 1202, 29918, 23516, 877, 1217, 29899, 29879, 26738, 1495, 13, 4706, 16735, 29918, 6768, 29889, 1202, 29918, 23516, 703, 20472, 29899, 29887, 3746, 1159, 13, 4706, 16735, 29918, 6768, 29889, 1202, 29918, 23516, 703, 17281, 29899, 6327, 8021, 29899, 12523, 1496, 13, 4706, 16735, 29918, 6768, 29889, 1202, 29918, 23516, 703, 20472, 29899, 7323, 786, 29899, 1271, 292, 1496, 13, 4706, 16735, 29918, 6768, 29889, 1202, 29918, 23516, 703, 20472, 29899, 4381, 29899, 13371, 1496, 13, 4706, 396, 10228, 338, 1641, 20704, 491, 3345, 630, 1243, 7047, 13, 13, 4706, 565, 1404, 19661, 338, 6213, 29901, 13, 9651, 396, 29871, 31735, 31439, 29879, 2142, 1306, 22844, 234, 174, 178, 233, 184, 146, 235, 170, 139, 30943, 13, 9651, 1404, 19661, 353, 525, 29924, 2112, 2911, 29914, 29945, 29889, 29900, 313, 7685, 405, 29911, 29871, 29953, 29889, 29896, 29936, 399, 9806, 29953, 29946, 29897, 12113, 3609, 13117, 29914, 29945, 29941, 29946, 29889, 29945, 29955, 29889, 29906, 313, 29968, 7020, 29892, 763, 1879, 27604, 29897, 10079, 29914, 29945, 29889, 29896, 29889, 29955, 24544, 29914, 29945, 29941, 29946, 29889, 29945, 29955, 29889, 29906, 29915, 13, 4706, 16735, 29918, 6768, 29889, 1202, 29918, 23516, 877, 1792, 29899, 14748, 543, 29915, 718, 1404, 19661, 718, 18793, 1495, 13, 4706, 16735, 29918, 6768, 29889, 1202, 29918, 23516, 877, 20275, 261, 543, 991, 597, 1636, 29889, 3608, 29889, 510, 12975, 1495, 13, 4706, 565, 10166, 338, 451, 6213, 29901, 13, 9651, 10166, 29918, 710, 353, 376, 1124, 597, 29912, 14701, 29913, 1642, 4830, 29898, 14701, 29922, 14701, 29897, 13, 9651, 16735, 29918, 6768, 29889, 1202, 29918, 23516, 877, 14701, 29899, 2974, 2433, 718, 10166, 29918, 710, 29897, 13, 4706, 396, 1732, 597, 27433, 287, 3511, 29889, 12925, 29889, 15947, 29889, 510, 29914, 2248, 29889, 1420, 13, 4706, 1583, 29889, 9465, 353, 1856, 9465, 29889, 1451, 4871, 29898, 6768, 29922, 18114, 29918, 6768, 29897, 13, 4706, 1583, 29889, 9465, 29889, 27525, 675, 29918, 7165, 580, 13, 4706, 565, 3142, 29901, 13, 9651, 1583, 29889, 9465, 29889, 657, 29898, 2271, 29922, 2271, 29897, 13, 13, 1678, 822, 3802, 29898, 1311, 1125, 13, 4706, 7156, 353, 1583, 29889, 9465, 13, 4706, 565, 7156, 338, 6213, 29901, 13, 9651, 736, 13, 4706, 1018, 29901, 13, 9651, 7156, 29889, 5358, 580, 13, 9651, 7156, 29889, 28358, 580, 13, 4706, 7146, 29901, 13, 9651, 1583, 29889, 9465, 353, 6213, 13, 13, 1678, 822, 4770, 5893, 12035, 1311, 1125, 13, 4706, 736, 1583, 13, 13, 1678, 822, 4770, 13322, 12035, 1311, 29892, 334, 735, 29883, 29918, 3888, 1125, 13, 4706, 628, 5566, 29918, 3888, 13, 4706, 1583, 29889, 5358, 580, 13, 13, 1678, 822, 1722, 29898, 1311, 29892, 3142, 1125, 13, 4706, 1583, 29889, 9465, 29889, 657, 29898, 2271, 29897, 13, 13, 1678, 822, 679, 29918, 15108, 583, 29898, 1311, 1125, 13, 4706, 21046, 29918, 8977, 353, 6571, 13, 4706, 21046, 353, 1583, 29889, 9465, 29889, 657, 29918, 15108, 583, 580, 13, 4706, 363, 15327, 297, 21046, 29901, 13, 9651, 21046, 29918, 8977, 29961, 21509, 1839, 978, 2033, 29962, 353, 15327, 1839, 1767, 2033, 13, 4706, 736, 21046, 29918, 8977, 13, 13, 1678, 822, 6222, 29918, 1315, 29898, 1311, 29892, 6965, 29892, 334, 5085, 1125, 13, 4706, 736, 1583, 29889, 9465, 29889, 7978, 29918, 2154, 29898, 1315, 29892, 6389, 29897, 13, 13, 13, 1753, 594, 29879, 1947, 4164, 7295, 13, 1678, 396, 29871, 31024, 30683, 23424, 30210, 236, 157, 146, 31429, 30333, 31374, 13, 1678, 3142, 353, 525, 991, 597, 15702, 2909, 29889, 3332, 29914, 11912, 29899, 3126, 29914, 11912, 29914, 29894, 29906, 29914, 14080, 29915, 13, 1678, 364, 29922, 3609, 3089, 580, 13, 1678, 1400, 29918, 1761, 29922, 29878, 29889, 6739, 2141, 657, 29898, 2271, 29922, 2271, 467, 3126, 580, 13, 1678, 396, 2988, 11759, 2944, 29889, 657, 877, 2324, 1495, 363, 2944, 297, 1400, 29918, 1761, 29962, 13, 1678, 396, 1596, 29898, 4965, 29897, 13, 1678, 396, 1400, 29918, 1761, 353, 29961, 10998, 2324, 2396, 525, 991, 597, 15702, 2909, 29889, 3332, 29914, 19682, 29899, 9641, 1315, 29899, 29885, 29941, 29884, 29947, 29899, 9106, 29899, 29874, 29899, 1420, 29945, 29899, 9641, 29899, 9106, 22208, 6525, 13, 1678, 396, 29871, 31382, 233, 142, 162, 31904, 30732, 31656, 31026, 30333, 31374, 13, 1678, 10166, 842, 353, 731, 580, 13, 1678, 363, 954, 297, 3464, 29898, 29896, 29900, 29900, 29900, 29900, 1125, 13, 4706, 1400, 29922, 8172, 29889, 16957, 29898, 2490, 29918, 1761, 29897, 13, 4706, 1400, 29918, 2271, 29922, 2490, 29889, 657, 877, 2324, 1495, 13, 4706, 1596, 877, 30910, 31545, 31088, 31376, 30210, 30333, 31374, 30533, 31702, 30392, 29901, 6571, 4286, 4830, 29898, 2490, 29918, 2271, 876, 13, 4706, 19518, 353, 3148, 1001, 29918, 10051, 3919, 29918, 9026, 718, 3148, 1001, 29918, 10051, 3919, 29918, 6720, 12809, 1307, 13, 4706, 931, 29918, 2798, 353, 954, 718, 29871, 29896, 13, 4706, 7156, 353, 6213, 13, 4706, 1018, 29901, 13, 9651, 2793, 353, 364, 29889, 6739, 2141, 657, 877, 991, 597, 3150, 29889, 15702, 2909, 29889, 3332, 29914, 14701, 29914, 657, 29973, 1853, 29922, 3084, 2824, 3126, 580, 13, 9651, 10166, 353, 2793, 29889, 657, 877, 1272, 2824, 657, 877, 14701, 1495, 13, 9651, 1596, 877, 30910, 31545, 31088, 31376, 30210, 30690, 30687, 30392, 29901, 6571, 4286, 4830, 29898, 14701, 876, 13, 9651, 565, 10166, 451, 297, 10166, 842, 29901, 13, 18884, 396, 29871, 30594, 31974, 30908, 31810, 30210, 30785, 30406, 30743, 30990, 30980, 30210, 666, 30533, 31702, 13, 18884, 10166, 842, 29889, 1202, 29898, 14701, 29897, 13, 18884, 10823, 353, 4036, 29889, 16957, 29898, 351, 1237, 29897, 13, 18884, 7156, 353, 26778, 3609, 12376, 29898, 2490, 29918, 2271, 29892, 10823, 29892, 10166, 29897, 13, 18884, 7156, 29889, 3150, 29898, 2490, 29918, 2271, 29897, 13, 18884, 1596, 877, 31290, 31412, 31656, 31026, 31196, 31915, 30533, 31702, 29901, 6571, 4286, 4830, 29898, 2490, 29918, 2271, 876, 13, 18884, 7156, 29889, 9465, 29889, 22379, 580, 13, 18884, 9752, 20808, 353, 9465, 29889, 9465, 29889, 2886, 29918, 5029, 29918, 1609, 29918, 333, 877, 7892, 1495, 13, 18884, 565, 9752, 20808, 29901, 13, 462, 1678, 396, 29871, 233, 190, 157, 30846, 30780, 30783, 31370, 30210, 31566, 31785, 30636, 30748, 13, 462, 1678, 7156, 29889, 9465, 29889, 7978, 29918, 2154, 877, 25699, 29961, 29900, 1822, 10510, 797, 517, 1043, 29898, 3009, 416, 742, 7892, 20808, 29897, 13, 462, 1678, 9752, 20808, 29889, 3808, 580, 13, 462, 1678, 931, 29889, 17059, 29898, 29941, 29897, 13, 462, 1678, 396, 7156, 29889, 9465, 29889, 22379, 580, 13, 462, 1678, 396, 4480, 353, 2563, 12376, 15716, 29898, 9465, 29889, 9465, 29892, 29871, 29953, 29897, 13, 462, 1678, 396, 1543, 353, 4480, 29889, 29305, 29898, 9684, 29918, 1116, 2187, 29889, 5029, 29918, 517, 29918, 915, 29918, 3808, 519, 3552, 2059, 29889, 1367, 29892, 525, 7925, 29915, 4961, 13, 13, 462, 1678, 396, 7156, 29889, 5358, 580, 13, 462, 1678, 1596, 877, 30622, 8875, 30936, 235, 192, 177, 235, 177, 176, 30494, 31134, 29892, 30690, 30687, 29901, 6571, 30267, 30267, 30267, 30267, 4286, 4830, 29898, 2230, 29918, 2798, 29892, 10166, 876, 13, 13, 18884, 396, 3158, 20808, 353, 7156, 29889, 9465, 29889, 2886, 29918, 5029, 29918, 1609, 29918, 1990, 29918, 978, 877, 8552, 29899, 7290, 1495, 13, 18884, 396, 565, 3158, 20808, 29901, 13, 18884, 396, 268, 7156, 29889, 9465, 29889, 22379, 580, 13, 18884, 396, 268, 4480, 353, 2563, 12376, 15716, 29898, 9465, 29889, 9465, 29892, 29871, 29953, 29897, 13, 18884, 396, 268, 1543, 353, 4480, 29889, 29305, 29898, 9684, 29918, 1116, 2187, 29889, 5029, 29918, 517, 29918, 915, 29918, 3808, 519, 3552, 2059, 29889, 1367, 29892, 525, 7925, 29915, 4961, 13, 18884, 396, 268, 3158, 20808, 29889, 3808, 580, 13, 18884, 396, 268, 7156, 29889, 5358, 580, 13, 18884, 396, 268, 1596, 877, 30622, 8875, 30936, 235, 192, 177, 235, 177, 176, 30494, 31134, 29892, 30690, 30687, 29901, 6571, 30267, 30267, 30267, 30267, 4286, 4830, 29898, 2230, 29892, 10166, 876, 13, 9651, 1683, 29901, 13, 18884, 1596, 877, 30948, 30658, 30690, 30687, 30533, 31702, 29901, 6571, 31290, 31412, 30946, 30505, 29892, 30413, 31733, 30785, 30406, 31751, 30533, 31702, 31174, 30448, 31851, 31787, 29892, 30690, 30687, 31853, 30257, 30446, 29901, 6571, 29991, 4286, 4830, 29898, 14701, 29892, 2435, 29898, 14701, 842, 4961, 13, 4706, 5174, 8960, 408, 321, 29901, 13, 9651, 1596, 877, 30622, 8875, 30936, 235, 192, 177, 235, 177, 176, 31369, 31955, 29892, 31369, 31955, 30689, 31021, 29901, 6571, 30267, 30267, 30267, 30267, 4286, 4830, 29898, 2230, 29918, 2798, 29892, 321, 876, 13, 9651, 396, 12020, 13, 4706, 7146, 29901, 13, 9651, 565, 7156, 338, 451, 6213, 29901, 13, 18884, 7156, 29889, 5358, 580, 13, 13, 13, 1753, 2740, 14207, 7295, 13, 1678, 13553, 29922, 525, 3433, 486, 1653, 4948, 486, 623, 1059, 584, 15702, 2909, 29889, 3332, 29915, 13, 1678, 396, 29871, 31382, 233, 142, 162, 31904, 30732, 31656, 31026, 30333, 31374, 13, 1678, 10166, 842, 353, 731, 580, 13, 1678, 364, 29922, 3609, 3089, 580, 13, 1678, 19518, 29922, 11889, 29918, 10051, 3919, 29918, 9026, 13, 1678, 363, 954, 297, 3464, 29898, 29896, 29900, 29900, 29900, 29900, 1125, 13, 4706, 7156, 353, 6213, 13, 4706, 1018, 29901, 13, 9651, 2793, 353, 364, 29889, 6739, 2141, 657, 877, 991, 597, 3150, 29889, 15702, 2909, 29889, 3332, 29914, 14701, 29914, 657, 29973, 1853, 29922, 3084, 2824, 3126, 580, 13, 9651, 10166, 353, 2793, 29889, 657, 877, 1272, 2824, 657, 877, 14701, 1495, 13, 9651, 1596, 877, 30910, 31545, 31088, 31376, 30210, 30690, 30687, 30392, 29901, 6571, 4286, 4830, 29898, 14701, 876, 13, 9651, 565, 10166, 451, 297, 10166, 842, 29901, 13, 18884, 396, 29871, 30594, 31974, 30908, 31810, 30210, 30785, 30406, 30743, 30990, 30980, 30210, 666, 30533, 31702, 13, 18884, 10166, 842, 29889, 1202, 29898, 14701, 29897, 13, 18884, 10823, 353, 4036, 29889, 16957, 29898, 351, 1237, 29897, 13, 18884, 805, 1241, 353, 26778, 3609, 12376, 29898, 8516, 29892, 10823, 29892, 10166, 29897, 13, 18884, 805, 1241, 29889, 3150, 877, 991, 597, 3608, 29889, 510, 1495, 13, 18884, 7156, 353, 1028, 1241, 29889, 9465, 13, 18884, 396, 29871, 31573, 30752, 31057, 236, 151, 177, 30578, 13, 18884, 1881, 1884, 29922, 9465, 29889, 2886, 29918, 5029, 29918, 1609, 29918, 978, 877, 29939, 1495, 13, 18884, 565, 1881, 1884, 29901, 13, 462, 1678, 1881, 1884, 29889, 6717, 29918, 8149, 29898, 26766, 29897, 13, 462, 1678, 1881, 1884, 29889, 6717, 29918, 8149, 29898, 15506, 29889, 3919, 1001, 29897, 13, 462, 1678, 931, 29889, 17059, 29898, 29941, 29897, 13, 462, 1678, 396, 29871, 30940, 31768, 30622, 30287, 31217, 31410, 31283, 13, 462, 1678, 937, 29918, 11651, 29922, 9465, 29889, 2886, 29918, 5029, 29918, 1609, 29918, 4268, 29918, 14357, 14237, 29878, 578, 1405, 1933, 29901, 20800, 29899, 5145, 29898, 29896, 29897, 1405, 1933, 1405, 1933, 29901, 20800, 29899, 5145, 29898, 29896, 29897, 1405, 1933, 1405, 1933, 1405, 1933, 29889, 29878, 1405, 263, 1495, 13, 462, 1678, 937, 29918, 11651, 29889, 3808, 580, 13, 462, 1678, 931, 29889, 17059, 29898, 29945, 29897, 13, 462, 1678, 7156, 29889, 22379, 580, 13, 462, 1678, 931, 29889, 17059, 29898, 29953, 29897, 13, 4706, 5174, 8960, 408, 321, 29901, 13, 9651, 1596, 877, 30622, 8875, 30936, 235, 192, 177, 235, 177, 176, 31369, 31955, 29892, 31369, 31955, 30689, 31021, 29901, 6571, 30267, 30267, 30267, 30267, 4286, 4830, 29898, 1949, 29892, 321, 876, 13, 4706, 7146, 29901, 13, 9651, 565, 7156, 338, 451, 6213, 29901, 13, 18884, 7156, 29889, 28358, 580, 13, 13, 13, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 259, 594, 29879, 1947, 4164, 580, 13, 2 ]
conanfile.py
torshind/conan-pcg-cpp
0
125483
from conans import ConanFile, CMake class PcgCppConan(ConanFile): name = "pcg-cpp" version = "latest" license = "MIT" homepage = "http://www.pcg-random.org/" url = "https://github.com/torshind/conan-pcg-cpp/" description = "PCG — C++ Implementation" settings = "os", "compiler", "build_type", "arch" options = {"shared": [True, False]} default_options = {"shared": False} exports_sources = "*" def source(self): self.run("git clone https://github.com/imneme/pcg-cpp.git") def build(self): self.run("cd pcg-cpp && make test") def package(self): self.copy("*.hpp", dst="include", src="pcg-cpp/include") def package_info(self): self.info.header_only()
[ 1, 515, 378, 550, 1053, 1281, 273, 2283, 29892, 315, 9984, 13, 13, 13, 1990, 349, 29883, 29887, 29907, 407, 1168, 273, 29898, 1168, 273, 2283, 1125, 13, 1678, 1024, 353, 376, 6739, 29887, 29899, 8223, 29908, 13, 1678, 1873, 353, 376, 12333, 29908, 13, 1678, 19405, 353, 376, 26349, 29908, 13, 1678, 3271, 3488, 353, 376, 1124, 597, 1636, 29889, 6739, 29887, 29899, 8172, 29889, 990, 12975, 13, 1678, 3142, 353, 376, 991, 597, 3292, 29889, 510, 29914, 7345, 845, 513, 29914, 535, 273, 29899, 6739, 29887, 29899, 8223, 12975, 13, 1678, 6139, 353, 376, 9026, 29954, 813, 315, 1817, 1954, 14607, 29908, 13, 1678, 6055, 353, 376, 359, 613, 376, 21789, 613, 376, 4282, 29918, 1853, 613, 376, 1279, 29908, 13, 1678, 3987, 353, 8853, 12366, 1115, 518, 5574, 29892, 7700, 12258, 13, 1678, 2322, 29918, 6768, 353, 8853, 12366, 1115, 7700, 29913, 13, 1678, 29586, 29918, 29879, 2863, 353, 376, 20605, 13, 13, 1678, 822, 2752, 29898, 1311, 1125, 13, 4706, 1583, 29889, 3389, 703, 5559, 17432, 2045, 597, 3292, 29889, 510, 29914, 326, 29876, 2004, 29914, 6739, 29887, 29899, 8223, 29889, 5559, 1159, 13, 13, 1678, 822, 2048, 29898, 1311, 1125, 13, 4706, 1583, 29889, 3389, 703, 2252, 22844, 29887, 29899, 8223, 2607, 1207, 1243, 1159, 13, 13, 1678, 822, 3577, 29898, 1311, 1125, 13, 4706, 1583, 29889, 8552, 703, 10521, 29623, 613, 29743, 543, 2856, 613, 4765, 543, 6739, 29887, 29899, 8223, 29914, 2856, 1159, 13, 13, 1678, 822, 3577, 29918, 3888, 29898, 1311, 1125, 13, 4706, 1583, 29889, 3888, 29889, 6672, 29918, 6194, 580, 13, 2 ]
scripts/cosmoWindToNC.py
r-beer/RESKit
0
104035
<filename>scripts/cosmoWindToNC.py #### Setup command line arguments import argparse parser = argparse.ArgumentParser(description='Process single-timestep 3D wind grib files and construct an output NC file') parser.add_argument(dest="uFile", type=str, help='path to the file containing 3D U wind speeds') parser.add_argument(dest="vFile", type=str, help='path to the file containing 3D V wind speeds') parser.add_argument('-o', dest='oFile', type=str, default="CHANGEME", help='path to the desired output file') parser.add_argument(dest='cFile', type=str, help='path to the file containing domain constants') args = parser.parse_args() #### Imports import netCDF4 as nc import pygrib from collections import OrderedDict, defaultdict import pandas as pd from datetime import datetime as dt import numpy as np #### Arrange constants constDS = nc.Dataset(args.cFile) levels = constDS["level"][:] if levels[1] < levels[0]: raise RuntimeError("levels need to be in increasing order") midHeights = OrderedDict() for l,mh in zip(levels,constDS["cell_mean"][:]): midHeights[l] = mh ####### # find levels around desired heights heights = [10, 100, 140] heightLevels = [] levelsToSaveU = {} levelsToSaveV = {} for h in heights: for i,l in enumerate(levels): if midHeights[l] <= h: heightLevels.append((levels[i-1],levels[i])) # add levels to the search list levelsToSaveU[levels[i-1]] = False levelsToSaveU[levels[i]] = False levelsToSaveV[levels[i-1]] = False levelsToSaveV[levels[i]] = False break #### Read WS data grbs = pygrib.open(args.uFile) # find data for each height rawWSU = OrderedDict() timeVal = None grbs.seek(0) for grb in grbs: # Check if we have a wind speed if not grb.indicatorOfParameter == 33: continue gLvl = grb.bottomLevel # Check if we want this level if not gLvl in levelsToSaveU: continue # Make sure we have the right time tmp = dt(year=grb.year, month=grb.month, day=grb.day, hour=grb.hour, minute=grb.minute) timeValTmp = (tmp - dt(year=1900, month=1, day=1, hour=0, minute=0)).total_seconds()//60 if timeVal is None: timeVal = timeValTmp else: if timeVal != timeValTmp: raise RuntimeError("Time mismatch") # Store data rawWSU[gLvl] = grb.values Ny,Nx = rawWSU[gLvl].shape levelsToSaveU[gLvl]=True #### Read WS data grbs = pygrib.open(args.vFile) # find data for each height rawWSV = OrderedDict() grbs.seek(0) for grb in grbs: # Check if we have a wind speed if not grb.indicatorOfParameter == 34: continue gLvl = grb.bottomLevel # Check if we want this level if not gLvl in levelsToSaveV: continue # Make sure we have the right time tmp = dt(year=grb.year, month=grb.month, day=grb.day, hour=grb.hour, minute=grb.minute) timeValTmp = (tmp - dt(year=1900, month=1, day=1, hour=0, minute=0)).total_seconds()//60 if timeVal != timeValTmp: raise RuntimeError("Time mismatch") # Store data rawWSV[gLvl] = grb.values Ny,Nx = rawWSV[gLvl].shape levelsToSaveV[gLvl]=True # make sure we found all required levels for level,found in levelsToSaveU.items(): if not found: raise RuntimeError("level %d not found"%level) for level,found in levelsToSaveV.items(): if not found: raise RuntimeError("level %d not found"%level) # Do interpolations ws = np.zeros((1,len(heights), Ny, Nx) ) for i,h in enumerate(heights): lvl0 = heightLevels[i][0] lvl1 = heightLevels[i][1] ws0 = np.sqrt(rawWSU[lvl0]*rawWSU[lvl0] + rawWSV[lvl0]*rawWSV[lvl0]) ws1 = np.sqrt(rawWSU[lvl1]*rawWSU[lvl1] + rawWSV[lvl1]*rawWSV[lvl1]) a = np.log(ws0/ws1)/np.log(midHeights[lvl0]/midHeights[lvl1]) ws[0,i,:,:] = ws0 * np.power(h/midHeights[lvl0], a) #### Make output NC file if args.oFile == "CHANGEME": oFile = args.uFile.replace(".grb",".nc") else: oFile = args.oFile ods = nc.Dataset(oFile,"w") # set dimensions ods.createDimension("time", ws.shape[0] ) ods.createDimension("height", ws.shape[1] ) ods.createDimension("latI", ws.shape[2]) ods.createDimension("lonI", ws.shape[3]) # set time var = ods.createVariable("time", int, ("time", )) var.setncatts(dict( name="time", units="Minutes since 1900-01-01 00:00:00" )) var[:] = [ int(timeVal), ] # set heights var = ods.createVariable("height", int, ("height", )) var.setncatts(dict( name="Height above surface", units="m" )) var[:] = heights # set windspeed var = ods.createVariable("wspd", "f", ("time", "height", "latI", "lonI"), zlib=True) var.setncatts(dict( name="Wind speed", units="m/s", )) var[:] = ws # DONE! ods.close()
[ 1, 529, 9507, 29958, 16713, 29914, 3944, 4346, 29956, 513, 1762, 15868, 29889, 2272, 13, 4136, 3789, 786, 1899, 1196, 6273, 13, 5215, 1852, 5510, 13, 13, 16680, 353, 1852, 5510, 29889, 15730, 11726, 29898, 8216, 2433, 7032, 2323, 29899, 9346, 342, 1022, 29871, 29941, 29928, 8805, 330, 1091, 2066, 322, 3386, 385, 1962, 25166, 934, 1495, 13, 16680, 29889, 1202, 29918, 23516, 29898, 7854, 543, 29884, 2283, 613, 1134, 29922, 710, 29892, 1371, 2433, 2084, 304, 278, 934, 6943, 29871, 29941, 29928, 501, 8805, 961, 5779, 1495, 13, 16680, 29889, 1202, 29918, 23516, 29898, 7854, 543, 29894, 2283, 613, 1134, 29922, 710, 29892, 1371, 2433, 2084, 304, 278, 934, 6943, 29871, 29941, 29928, 478, 8805, 961, 5779, 1495, 13, 16680, 29889, 1202, 29918, 23516, 877, 29899, 29877, 742, 2731, 2433, 29877, 2283, 742, 1134, 29922, 710, 29892, 2322, 543, 3210, 24336, 2303, 613, 29871, 13, 462, 1678, 1371, 2433, 2084, 304, 278, 7429, 1962, 934, 1495, 13, 13, 16680, 29889, 1202, 29918, 23516, 29898, 7854, 2433, 29883, 2283, 742, 1134, 29922, 710, 29892, 1371, 2433, 2084, 304, 278, 934, 6943, 5354, 17727, 1495, 13, 13, 5085, 353, 13812, 29889, 5510, 29918, 5085, 580, 13, 13, 4136, 1954, 4011, 13, 5215, 7787, 29907, 4037, 29946, 408, 302, 29883, 13, 5215, 19484, 1091, 13, 3166, 16250, 1053, 8170, 287, 21533, 29892, 2322, 8977, 13, 5215, 11701, 408, 10518, 13, 3166, 12865, 1053, 12865, 408, 11636, 13, 5215, 12655, 408, 7442, 13, 13, 4136, 826, 3881, 17727, 13, 3075, 8452, 353, 302, 29883, 29889, 16390, 24541, 29898, 5085, 29889, 29883, 2283, 29897, 13, 5563, 29879, 353, 1040, 8452, 3366, 5563, 3108, 7503, 29962, 13, 361, 11174, 29961, 29896, 29962, 529, 11174, 29961, 29900, 5387, 12020, 24875, 2392, 703, 5563, 29879, 817, 304, 367, 297, 10231, 1797, 1159, 13, 13, 6563, 3868, 5861, 353, 8170, 287, 21533, 580, 13, 1454, 301, 29892, 29885, 29882, 297, 14319, 29898, 5563, 29879, 29892, 3075, 8452, 3366, 3729, 29918, 12676, 3108, 7503, 29962, 1125, 13, 1678, 7145, 3868, 5861, 29961, 29880, 29962, 353, 286, 29882, 13, 13, 4136, 2277, 29937, 13, 13, 29937, 1284, 11174, 2820, 7429, 3171, 29879, 13, 3545, 29879, 353, 518, 29896, 29900, 29892, 29871, 29896, 29900, 29900, 29892, 29871, 29896, 29946, 29900, 29962, 13, 3545, 10108, 29879, 353, 5159, 13, 5563, 29879, 1762, 11371, 29965, 353, 6571, 13, 5563, 29879, 1762, 11371, 29963, 353, 6571, 13, 1454, 298, 297, 3171, 29879, 29901, 13, 1678, 363, 474, 29892, 29880, 297, 26985, 29898, 5563, 29879, 1125, 13, 4706, 565, 7145, 3868, 5861, 29961, 29880, 29962, 5277, 298, 29901, 13, 9651, 3171, 10108, 29879, 29889, 4397, 3552, 5563, 29879, 29961, 29875, 29899, 29896, 1402, 5563, 29879, 29961, 29875, 12622, 13, 13, 9651, 396, 788, 11174, 304, 278, 2740, 1051, 13, 9651, 11174, 1762, 11371, 29965, 29961, 5563, 29879, 29961, 29875, 29899, 29896, 5262, 353, 7700, 13, 9651, 11174, 1762, 11371, 29965, 29961, 5563, 29879, 29961, 29875, 5262, 353, 7700, 13, 632, 13, 9651, 11174, 1762, 11371, 29963, 29961, 5563, 29879, 29961, 29875, 29899, 29896, 5262, 353, 7700, 13, 9651, 11174, 1762, 11371, 29963, 29961, 5563, 29879, 29961, 29875, 5262, 353, 7700, 13, 13, 9651, 2867, 13, 13, 4136, 7523, 399, 29903, 848, 13, 629, 5824, 353, 19484, 1091, 29889, 3150, 29898, 5085, 29889, 29884, 2283, 29897, 13, 13, 29937, 1284, 848, 363, 1269, 3171, 13, 1610, 7811, 29965, 353, 8170, 287, 21533, 580, 13, 2230, 1440, 353, 6213, 13, 13, 629, 5824, 29889, 344, 1416, 29898, 29900, 29897, 13, 1454, 867, 29890, 297, 867, 5824, 29901, 13, 1678, 396, 5399, 565, 591, 505, 263, 8805, 6210, 13, 1678, 565, 451, 867, 29890, 29889, 513, 20485, 2776, 9329, 1275, 29871, 29941, 29941, 29901, 13, 4706, 6773, 13, 13, 1678, 330, 29931, 20901, 353, 867, 29890, 29889, 8968, 10108, 13, 13, 1678, 396, 5399, 565, 591, 864, 445, 3233, 13, 1678, 565, 451, 330, 29931, 20901, 297, 11174, 1762, 11371, 29965, 29901, 6773, 13, 13, 1678, 396, 8561, 1854, 591, 505, 278, 1492, 931, 13, 1678, 13128, 353, 11636, 29898, 6360, 29922, 629, 29890, 29889, 6360, 29892, 4098, 29922, 629, 29890, 29889, 10874, 29892, 2462, 29922, 629, 29890, 29889, 3250, 29892, 7234, 29922, 629, 29890, 29889, 18721, 29892, 11015, 29922, 629, 29890, 29889, 1195, 1082, 29897, 13, 1678, 931, 1440, 29911, 1526, 353, 313, 7050, 448, 11636, 29898, 6360, 29922, 29896, 29929, 29900, 29900, 29892, 4098, 29922, 29896, 29892, 2462, 29922, 29896, 29892, 7234, 29922, 29900, 29892, 11015, 29922, 29900, 8106, 7827, 29918, 23128, 580, 458, 29953, 29900, 13, 1678, 565, 931, 1440, 338, 6213, 29901, 13, 4706, 931, 1440, 353, 931, 1440, 29911, 1526, 13, 1678, 1683, 29901, 29871, 13, 4706, 565, 931, 1440, 2804, 931, 1440, 29911, 1526, 29901, 12020, 24875, 2392, 703, 2481, 29635, 1159, 13, 13, 1678, 396, 14491, 848, 13, 1678, 10650, 7811, 29965, 29961, 29887, 29931, 20901, 29962, 353, 867, 29890, 29889, 5975, 13, 1678, 16693, 29892, 29940, 29916, 353, 10650, 7811, 29965, 29961, 29887, 29931, 20901, 1822, 12181, 13, 1678, 11174, 1762, 11371, 29965, 29961, 29887, 29931, 20901, 13192, 5574, 13, 13, 4136, 7523, 399, 29903, 848, 13, 629, 5824, 353, 19484, 1091, 29889, 3150, 29898, 5085, 29889, 29894, 2283, 29897, 13, 13, 29937, 1284, 848, 363, 1269, 3171, 13, 1610, 29956, 7597, 353, 8170, 287, 21533, 580, 13, 13, 629, 5824, 29889, 344, 1416, 29898, 29900, 29897, 13, 1454, 867, 29890, 297, 867, 5824, 29901, 13, 1678, 396, 5399, 565, 591, 505, 263, 8805, 6210, 13, 1678, 565, 451, 867, 29890, 29889, 513, 20485, 2776, 9329, 1275, 29871, 29941, 29946, 29901, 13, 4706, 6773, 13, 13, 1678, 330, 29931, 20901, 353, 867, 29890, 29889, 8968, 10108, 13, 13, 1678, 396, 5399, 565, 591, 864, 445, 3233, 13, 1678, 565, 451, 330, 29931, 20901, 297, 11174, 1762, 11371, 29963, 29901, 6773, 13, 13, 1678, 396, 8561, 1854, 591, 505, 278, 1492, 931, 13, 1678, 13128, 353, 11636, 29898, 6360, 29922, 629, 29890, 29889, 6360, 29892, 4098, 29922, 629, 29890, 29889, 10874, 29892, 2462, 29922, 629, 29890, 29889, 3250, 29892, 7234, 29922, 629, 29890, 29889, 18721, 29892, 11015, 29922, 629, 29890, 29889, 1195, 1082, 29897, 13, 1678, 931, 1440, 29911, 1526, 353, 313, 7050, 448, 11636, 29898, 6360, 29922, 29896, 29929, 29900, 29900, 29892, 4098, 29922, 29896, 29892, 2462, 29922, 29896, 29892, 7234, 29922, 29900, 29892, 11015, 29922, 29900, 8106, 7827, 29918, 23128, 580, 458, 29953, 29900, 13, 1678, 565, 931, 1440, 2804, 931, 1440, 29911, 1526, 29901, 12020, 24875, 2392, 703, 2481, 29635, 1159, 13, 13, 1678, 396, 14491, 848, 13, 1678, 10650, 29956, 7597, 29961, 29887, 29931, 20901, 29962, 353, 867, 29890, 29889, 5975, 13, 1678, 16693, 29892, 29940, 29916, 353, 10650, 29956, 7597, 29961, 29887, 29931, 20901, 1822, 12181, 13, 1678, 11174, 1762, 11371, 29963, 29961, 29887, 29931, 20901, 13192, 5574, 13, 13, 29937, 1207, 1854, 591, 1476, 599, 3734, 11174, 13, 1454, 3233, 29892, 11940, 297, 11174, 1762, 11371, 29965, 29889, 7076, 7295, 13, 1678, 565, 451, 1476, 29901, 13, 4706, 12020, 24875, 2392, 703, 5563, 1273, 29881, 451, 1476, 29908, 29995, 5563, 29897, 13, 1454, 3233, 29892, 11940, 297, 11174, 1762, 11371, 29963, 29889, 7076, 7295, 13, 1678, 565, 451, 1476, 29901, 13, 4706, 12020, 24875, 2392, 703, 5563, 1273, 29881, 451, 1476, 29908, 29995, 5563, 29897, 13, 13, 29937, 1938, 20064, 800, 13, 5652, 353, 7442, 29889, 3298, 359, 3552, 29896, 29892, 2435, 29898, 3545, 29879, 511, 16693, 29892, 405, 29916, 29897, 1723, 13, 1454, 474, 29892, 29882, 297, 26985, 29898, 3545, 29879, 1125, 13, 1678, 301, 20901, 29900, 353, 3171, 10108, 29879, 29961, 29875, 3816, 29900, 29962, 13, 1678, 301, 20901, 29896, 353, 3171, 10108, 29879, 29961, 29875, 3816, 29896, 29962, 13, 13, 1678, 16904, 29900, 353, 7442, 29889, 3676, 29898, 1610, 7811, 29965, 29961, 29880, 20901, 29900, 14178, 1610, 7811, 29965, 29961, 29880, 20901, 29900, 29962, 718, 10650, 29956, 7597, 29961, 29880, 20901, 29900, 14178, 1610, 29956, 7597, 29961, 29880, 20901, 29900, 2314, 13, 1678, 16904, 29896, 353, 7442, 29889, 3676, 29898, 1610, 7811, 29965, 29961, 29880, 20901, 29896, 14178, 1610, 7811, 29965, 29961, 29880, 20901, 29896, 29962, 718, 10650, 29956, 7597, 29961, 29880, 20901, 29896, 14178, 1610, 29956, 7597, 29961, 29880, 20901, 29896, 2314, 13, 13, 1678, 263, 353, 7442, 29889, 1188, 29898, 5652, 29900, 29914, 5652, 29896, 6802, 9302, 29889, 1188, 29898, 6563, 3868, 5861, 29961, 29880, 20901, 29900, 16261, 6563, 3868, 5861, 29961, 29880, 20901, 29896, 2314, 13, 13, 1678, 16904, 29961, 29900, 29892, 29875, 29892, 29901, 29892, 17531, 353, 16904, 29900, 334, 7442, 29889, 13519, 29898, 29882, 29914, 6563, 3868, 5861, 29961, 29880, 20901, 29900, 1402, 263, 29897, 13, 13, 4136, 8561, 1962, 25166, 934, 13, 13, 361, 6389, 29889, 29877, 2283, 1275, 376, 3210, 24336, 2303, 1115, 13, 1678, 288, 2283, 353, 6389, 29889, 29884, 2283, 29889, 6506, 17350, 629, 29890, 613, 1642, 17608, 1159, 13, 2870, 29901, 13, 1678, 288, 2283, 353, 6389, 29889, 29877, 2283, 13, 13, 19653, 353, 302, 29883, 29889, 16390, 24541, 29898, 29877, 2283, 1699, 29893, 1159, 13, 13, 29937, 731, 13391, 13, 19653, 29889, 3258, 16142, 2673, 703, 2230, 613, 16904, 29889, 12181, 29961, 29900, 29962, 1723, 13, 19653, 29889, 3258, 16142, 2673, 703, 3545, 613, 16904, 29889, 12181, 29961, 29896, 29962, 1723, 13, 19653, 29889, 3258, 16142, 2673, 703, 5066, 29902, 613, 16904, 29889, 12181, 29961, 29906, 2314, 13, 19653, 29889, 3258, 16142, 2673, 703, 12957, 29902, 613, 16904, 29889, 12181, 29961, 29941, 2314, 13, 13, 29937, 731, 931, 13, 1707, 353, 2413, 29879, 29889, 3258, 16174, 703, 2230, 613, 938, 29892, 4852, 2230, 613, 29871, 876, 13, 1707, 29889, 842, 17608, 1131, 29879, 29898, 8977, 29898, 13, 1678, 1024, 543, 2230, 613, 13, 1678, 10340, 543, 8140, 2667, 1951, 29871, 29896, 29929, 29900, 29900, 29899, 29900, 29896, 29899, 29900, 29896, 29871, 29900, 29900, 29901, 29900, 29900, 29901, 29900, 29900, 29908, 13, 268, 876, 13, 1707, 7503, 29962, 353, 518, 938, 29898, 2230, 1440, 511, 4514, 13, 13, 29937, 731, 3171, 29879, 13, 1707, 353, 2413, 29879, 29889, 3258, 16174, 703, 3545, 613, 938, 29892, 4852, 3545, 613, 29871, 876, 13, 1707, 29889, 842, 17608, 1131, 29879, 29898, 8977, 29898, 13, 1678, 1024, 543, 7011, 2038, 7101, 613, 13, 1678, 10340, 543, 29885, 29908, 13, 268, 876, 13, 1707, 7503, 29962, 353, 3171, 29879, 13, 13, 29937, 731, 8805, 19322, 13, 1707, 353, 2413, 29879, 29889, 3258, 16174, 703, 29893, 1028, 29881, 613, 376, 29888, 613, 4852, 2230, 613, 376, 3545, 613, 376, 5066, 29902, 613, 376, 12957, 29902, 4968, 503, 1982, 29922, 5574, 29897, 13, 1707, 29889, 842, 17608, 1131, 29879, 29898, 8977, 29898, 13, 1678, 1024, 543, 29956, 513, 6210, 613, 13, 1678, 10340, 543, 29885, 29914, 29879, 613, 13, 268, 876, 13, 1707, 7503, 29962, 353, 16904, 13, 13, 29937, 360, 12413, 29991, 13, 19653, 29889, 5358, 580, 13, 2 ]
meeko/preparation.py
forlilab/Meeko
19
138852
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Meeko preparation # import os import sys from collections import OrderedDict import warnings from rdkit import Chem from .molsetup import OBMoleculeSetup from .molsetup import RDKitMoleculeSetup from .atomtyper import AtomTyper from .bondtyper import BondTyperLegacy from .hydrate import HydrateMoleculeLegacy from .macrocycle import FlexMacrocycle from .flexibility import FlexibilityBuilder from .writer import PDBQTWriterLegacy try: from openbabel import openbabel as ob except ImportError: _has_openbabel = False else: _has_openbabel = True class MoleculePreparation: def __init__(self, keep_nonpolar_hydrogens=False, hydrate=False, flexible_amides=False, rigid_macrocycles=False, min_ring_size=7, max_ring_size=33, keep_chorded_rings=False, keep_equivalent_rings=False, rigidify_bonds_smarts=[], rigidify_bonds_indices=[], double_bond_penalty=50, atom_type_smarts={}, add_index_map=False, stop_at_defaults=False, remove_smiles=False): self.keep_nonpolar_hydrogens = keep_nonpolar_hydrogens self.hydrate = hydrate self.flexible_amides = flexible_amides self.rigid_macrocycles = rigid_macrocycles self.min_ring_size = min_ring_size self.max_ring_size = max_ring_size self.keep_chorded_rings = keep_chorded_rings self.keep_equivalent_rings = keep_equivalent_rings self.rigidify_bonds_smarts = rigidify_bonds_smarts self.rigidify_bonds_indices = rigidify_bonds_indices self.double_bond_penalty = double_bond_penalty self.atom_type_smarts = atom_type_smarts self.add_index_map = add_index_map self.remove_smiles = remove_smiles if stop_at_defaults: return # create an object to show just the defaults (e.g. to argparse) self.setup = None self._atom_typer = AtomTyper(self.atom_type_smarts) self._bond_typer = BondTyperLegacy() self._macrocycle_typer = FlexMacrocycle( self.min_ring_size, self.max_ring_size, self.double_bond_penalty) self._flex_builder = FlexibilityBuilder() self._water_builder = HydrateMoleculeLegacy() self._writer = PDBQTWriterLegacy() self.is_ok = None self.log = None self._classes_setup = {Chem.rdchem.Mol: RDKitMoleculeSetup} if _has_openbabel: self._classes_setup[ob.OBMol] = OBMoleculeSetup if keep_chorded_rings and keep_equivalent_rings==False: warnings.warn("keep_equivalent_rings=False ignored because keep_chorded_rings=True", RuntimeWarning) @classmethod def init_just_defaults(cls): return cls(stop_at_defaults=True) @ classmethod def from_config(cls, config): expected_keys = cls.init_just_defaults().__dict__.keys() bad_keys = [k for k in config if k not in expected_keys] for key in bad_keys: print("ERROR: unexpected key \"%s\" in MoleculePreparation.from_config()" % key, file=sys.stderr) if len(bad_keys) > 0: raise ValueError p = cls(**config) return p def prepare(self, mol, root_atom_index=None, not_terminal_atoms=[]): """ if protein_sidechain, C H N O will be removed, root will be CA, and BEGIN/END_RES will be added. """ mol_type = type(mol) if not mol_type in self._classes_setup: raise TypeError("Molecule is not an instance of supported types: %s" % type(mol)) setup_class = self._classes_setup[mol_type] setup = setup_class(mol, keep_chorded_rings=self.keep_chorded_rings, keep_equivalent_rings=self.keep_equivalent_rings) self.setup = setup # 1. assign atom types (including HB types, vectors and stuff) # DISABLED TODO self.atom_typer.set_parm(mol) self._atom_typer(setup) # 2a. add pi-model + merge_h_pi (THIS CHANGE SOME ATOM TYPES) # disabled # 2b. merge_h_classic if not self.keep_nonpolar_hydrogens: setup.merge_hydrogen() # 3. assign bond types by using SMARTS... # - bonds should be typed even in rings (but set as non-rotatable) # - if macrocycle is selected, they will be enabled (so they must be typed already!) self._bond_typer(setup, self.flexible_amides, self.rigidify_bonds_smarts, self.rigidify_bonds_indices, not_terminal_atoms) # 4 . hydrate molecule if self.hydrate: self._water_builder.hydrate(setup) # 5. break macrocycles into open/linear form if self.rigid_macrocycles: break_combo_data = None bonds_in_rigid_rings = None # not true, but this is only needed when breaking macrocycles else: break_combo_data, bonds_in_rigid_rings = self._macrocycle_typer.search_macrocycle(setup) # 6. build flexibility... # 6.1 if macrocycles typed: # - walk the setup graph by skipping proposed closures # and score resulting flex_trees basing on the lenght # of the branches generated # - actually break the best closure bond (THIS CHANGES SOME ATOM TYPES) # 6.2 - walk the graph and build the flextree # 7. but disable all bonds that are in rings and not # in flexible macrocycles # TODO restore legacy AD types for PDBQT #self._atom_typer.set_param_legacy(mol) new_setup = self._flex_builder(setup, root_atom_index=root_atom_index, break_combo_data=break_combo_data, bonds_in_rigid_rings=bonds_in_rigid_rings) self.setup = new_setup # TODO re-run typing after breaking bonds # self.bond_typer.set_types_legacy(mol, exclude=[macrocycle_bonds]) self.is_ok = self._check() def _check(self): # verify that all atoms have been typed is_ok = True msg = "" for idx in self.setup.atom_type: atom_type = self.setup.atom_type[idx] if atom_type is None: msg += 'atom number %d has None type, mol name: %s' % (idx, self.setup.get_mol_name()) is_ok = False self.log = msg return is_ok def show_setup(self): if self.setup is not None: tot_charge = 0 print("Molecule setup\n") print("==============[ ATOMS ]===================================================") print("idx | coords | charge |ign| atype | connections") print("-----+----------------------------+--------+---+----------+--------------- . . . ") for k, v in list(self.setup.coord.items()): print("% 4d | % 8.3f % 8.3f % 8.3f | % 1.3f | %d" % (k, v[0], v[1], v[2], self.setup.charge[k], self.setup.atom_ignore[k]), "| % -8s |" % self.setup.atom_type[k], self.setup.graph[k]) tot_charge += self.setup.charge[k] print("-----+----------------------------+--------+---+----------+--------------- . . . ") print(" TOT CHARGE: %3.3f" % tot_charge) print("\n======[ DIRECTIONAL VECTORS ]==========") for k, v in list(self.setup.coord.items()): if k in self.setup.interaction_vector: print("% 4d " % k, self.setup.atom_type[k], end=' ') print("\n==============[ BONDS ]================") # For sanity users, we won't show those keys for now keys_to_not_show = ['bond_order', 'type'] for k, v in list(self.setup.bond.items()): t = ', '.join('%s: %s' % (i, j) for i, j in v.items() if not i in keys_to_not_show) print("% 8s - " % str(k), t) self._macrocycle_typer.show_macrocycle_scores(self.setup) print('') def write_pdbqt_string(self, add_index_map=None, remove_smiles=None): if self.is_ok == False: raise RuntimeError("Molecule not OK, refusing to write PDBQT\n\nLOG:\n%s" % self.log) if add_index_map is None: add_index_map = self.add_index_map if remove_smiles is None: remove_smiles = self.remove_smiles if self.setup is not None: return self._writer.write_string(self.setup, add_index_map, remove_smiles) else: raise RuntimeError('Cannot generate PDBQT file, the molecule is not prepared.') def write_pdbqt_file(self, pdbqt_filename, add_index_map=None, remove_smiles=None): with open(pdbqt_filename,'w') as w: w.write(self.write_pdbqt_string(add_index_map, remove_smiles)) def adapt_pdbqt_for_autodock4_flexres(self, pdbqt_string, res, chain, num): """ adapt pdbqt_string to be compatible with AutoDock4 requirements: - first and second atoms named CA and CB - write BEGIN_RES / END_RES - remove TORSDOF this is for covalent docking (tethered) """ new_string = "BEGIN_RES %s %s %s\n" % (res, chain, num) atom_number = 0 for line in pdbqt_string.split("\n"): if line == "": continue if line.startswith("TORSDOF"): continue if line.startswith("ATOM"): atom_number+=1 if atom_number == 1: line = line[:13] + 'CA' + line[15:] elif atom_number == 2: line = line[:13] + 'CB' + line[15:] new_string += line + '\n' continue new_string += line + '\n' new_string += "END_RES %s %s %s\n" % (res, chain, num) return new_string
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 29937, 13, 29937, 2191, 1416, 29877, 10223, 362, 13, 29937, 13, 13, 5215, 2897, 13, 5215, 10876, 13, 3166, 16250, 1053, 8170, 287, 21533, 13, 5215, 18116, 13, 13, 3166, 364, 29881, 7354, 1053, 12677, 13, 13, 3166, 869, 29885, 324, 14669, 1053, 438, 29933, 29924, 1772, 29883, 1297, 26947, 13, 3166, 869, 29885, 324, 14669, 1053, 390, 29928, 13117, 29924, 1772, 29883, 1297, 26947, 13, 3166, 869, 8678, 1017, 546, 1053, 2180, 290, 21314, 546, 13, 3166, 869, 29890, 898, 1017, 546, 1053, 26370, 21314, 546, 22988, 4135, 13, 3166, 869, 29882, 2941, 10492, 1053, 379, 2941, 10492, 29924, 1772, 29883, 1297, 22988, 4135, 13, 3166, 869, 25254, 23090, 1053, 383, 2506, 15735, 307, 23090, 13, 3166, 869, 16041, 4127, 1053, 383, 2506, 4127, 5627, 13, 3166, 869, 13236, 1053, 349, 4051, 29984, 29911, 10507, 22988, 4135, 13, 13, 2202, 29901, 13, 1678, 515, 1722, 28727, 1053, 1722, 28727, 408, 704, 13, 19499, 16032, 2392, 29901, 13, 1678, 903, 5349, 29918, 3150, 28727, 353, 7700, 13, 2870, 29901, 13, 1678, 903, 5349, 29918, 3150, 28727, 353, 5852, 13, 13, 13, 1990, 341, 1772, 29883, 1297, 6572, 862, 362, 29901, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 3013, 29918, 5464, 3733, 279, 29918, 29882, 2941, 9102, 575, 29922, 8824, 29892, 13, 9651, 27246, 10492, 29922, 8824, 29892, 25706, 29918, 314, 2247, 29922, 8824, 29892, 13, 9651, 12912, 333, 29918, 25254, 1270, 7799, 29922, 8824, 29892, 1375, 29918, 5393, 29918, 2311, 29922, 29955, 29892, 4236, 29918, 5393, 29918, 2311, 29922, 29941, 29941, 29892, 13, 9651, 3013, 29918, 305, 536, 287, 29918, 29878, 886, 29922, 8824, 29892, 3013, 29918, 1686, 27445, 29918, 29878, 886, 29922, 8824, 29892, 13, 9651, 12912, 333, 1598, 29918, 29890, 13788, 29918, 3844, 5708, 11759, 1402, 12912, 333, 1598, 29918, 29890, 13788, 29918, 513, 1575, 11759, 1402, 13, 9651, 3765, 29918, 29890, 898, 29918, 2238, 18745, 29922, 29945, 29900, 29892, 12301, 29918, 1853, 29918, 3844, 5708, 3790, 1118, 13, 9651, 788, 29918, 2248, 29918, 1958, 29922, 8824, 29892, 13, 9651, 5040, 29918, 271, 29918, 4381, 29879, 29922, 8824, 29892, 3349, 29918, 3844, 5475, 29922, 8824, 1125, 13, 13, 4706, 1583, 29889, 17462, 29918, 5464, 3733, 279, 29918, 29882, 2941, 9102, 575, 353, 3013, 29918, 5464, 3733, 279, 29918, 29882, 2941, 9102, 575, 13, 4706, 1583, 29889, 29882, 2941, 10492, 353, 27246, 10492, 13, 4706, 1583, 29889, 16041, 1821, 29918, 314, 2247, 353, 25706, 29918, 314, 2247, 13, 4706, 1583, 29889, 8966, 333, 29918, 25254, 1270, 7799, 353, 12912, 333, 29918, 25254, 1270, 7799, 13, 4706, 1583, 29889, 1195, 29918, 5393, 29918, 2311, 353, 1375, 29918, 5393, 29918, 2311, 13, 4706, 1583, 29889, 3317, 29918, 5393, 29918, 2311, 353, 4236, 29918, 5393, 29918, 2311, 13, 4706, 1583, 29889, 17462, 29918, 305, 536, 287, 29918, 29878, 886, 353, 3013, 29918, 305, 536, 287, 29918, 29878, 886, 13, 4706, 1583, 29889, 17462, 29918, 1686, 27445, 29918, 29878, 886, 353, 3013, 29918, 1686, 27445, 29918, 29878, 886, 13, 4706, 1583, 29889, 8966, 333, 1598, 29918, 29890, 13788, 29918, 3844, 5708, 353, 12912, 333, 1598, 29918, 29890, 13788, 29918, 3844, 5708, 13, 4706, 1583, 29889, 8966, 333, 1598, 29918, 29890, 13788, 29918, 513, 1575, 353, 12912, 333, 1598, 29918, 29890, 13788, 29918, 513, 1575, 13, 4706, 1583, 29889, 8896, 29918, 29890, 898, 29918, 2238, 18745, 353, 3765, 29918, 29890, 898, 29918, 2238, 18745, 13, 4706, 1583, 29889, 8678, 29918, 1853, 29918, 3844, 5708, 353, 12301, 29918, 1853, 29918, 3844, 5708, 13, 4706, 1583, 29889, 1202, 29918, 2248, 29918, 1958, 353, 788, 29918, 2248, 29918, 1958, 13, 4706, 1583, 29889, 5992, 29918, 3844, 5475, 353, 3349, 29918, 3844, 5475, 13, 13, 4706, 565, 5040, 29918, 271, 29918, 4381, 29879, 29901, 736, 396, 1653, 385, 1203, 304, 1510, 925, 278, 21274, 313, 29872, 29889, 29887, 29889, 304, 1852, 5510, 29897, 13, 13, 4706, 1583, 29889, 14669, 353, 6213, 13, 4706, 1583, 3032, 8678, 29918, 1017, 546, 353, 2180, 290, 21314, 546, 29898, 1311, 29889, 8678, 29918, 1853, 29918, 3844, 5708, 29897, 13, 4706, 1583, 3032, 29890, 898, 29918, 1017, 546, 353, 26370, 21314, 546, 22988, 4135, 580, 13, 4706, 1583, 3032, 25254, 23090, 29918, 1017, 546, 353, 383, 2506, 15735, 307, 23090, 29898, 13, 18884, 1583, 29889, 1195, 29918, 5393, 29918, 2311, 29892, 1583, 29889, 3317, 29918, 5393, 29918, 2311, 29892, 1583, 29889, 8896, 29918, 29890, 898, 29918, 2238, 18745, 29897, 13, 4706, 1583, 3032, 16041, 29918, 16409, 353, 383, 2506, 4127, 5627, 580, 13, 4706, 1583, 3032, 13405, 29918, 16409, 353, 379, 2941, 10492, 29924, 1772, 29883, 1297, 22988, 4135, 580, 13, 4706, 1583, 3032, 13236, 353, 349, 4051, 29984, 29911, 10507, 22988, 4135, 580, 13, 4706, 1583, 29889, 275, 29918, 554, 353, 6213, 13, 4706, 1583, 29889, 1188, 353, 6213, 13, 4706, 1583, 3032, 13203, 29918, 14669, 353, 426, 1451, 331, 29889, 5499, 14969, 29889, 29924, 324, 29901, 390, 29928, 13117, 29924, 1772, 29883, 1297, 26947, 29913, 13, 4706, 565, 903, 5349, 29918, 3150, 28727, 29901, 13, 9651, 1583, 3032, 13203, 29918, 14669, 29961, 711, 29889, 14824, 29924, 324, 29962, 353, 438, 29933, 29924, 1772, 29883, 1297, 26947, 13, 4706, 565, 3013, 29918, 305, 536, 287, 29918, 29878, 886, 322, 3013, 29918, 1686, 27445, 29918, 29878, 886, 1360, 8824, 29901, 13, 9651, 18116, 29889, 25442, 703, 17462, 29918, 1686, 27445, 29918, 29878, 886, 29922, 8824, 17262, 1363, 3013, 29918, 305, 536, 287, 29918, 29878, 886, 29922, 5574, 613, 24875, 22709, 29897, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 2069, 29918, 5143, 29918, 4381, 29879, 29898, 25932, 1125, 13, 4706, 736, 1067, 29879, 29898, 9847, 29918, 271, 29918, 4381, 29879, 29922, 5574, 29897, 13, 13, 1678, 732, 770, 5696, 13, 1678, 822, 515, 29918, 2917, 29898, 25932, 29892, 2295, 1125, 13, 4706, 3806, 29918, 8149, 353, 1067, 29879, 29889, 2344, 29918, 5143, 29918, 4381, 29879, 2141, 1649, 8977, 26914, 8149, 580, 13, 4706, 4319, 29918, 8149, 353, 518, 29895, 363, 413, 297, 2295, 565, 413, 451, 297, 3806, 29918, 8149, 29962, 13, 4706, 363, 1820, 297, 4319, 29918, 8149, 29901, 13, 9651, 1596, 703, 11432, 29901, 15668, 1820, 13218, 29995, 29879, 5931, 297, 341, 1772, 29883, 1297, 6572, 862, 362, 29889, 3166, 29918, 2917, 25318, 1273, 1820, 29892, 934, 29922, 9675, 29889, 303, 20405, 29897, 13, 4706, 565, 7431, 29898, 12313, 29918, 8149, 29897, 1405, 29871, 29900, 29901, 13, 9651, 12020, 7865, 2392, 13, 4706, 282, 353, 1067, 29879, 29898, 1068, 2917, 29897, 13, 4706, 736, 282, 13, 13, 1678, 822, 19012, 29898, 1311, 29892, 6062, 29892, 3876, 29918, 8678, 29918, 2248, 29922, 8516, 29892, 451, 29918, 8489, 979, 29918, 271, 4835, 29922, 2636, 1125, 13, 4706, 9995, 565, 26823, 29918, 2975, 14153, 29892, 315, 379, 405, 438, 674, 367, 6206, 29892, 13, 9651, 3876, 674, 367, 12766, 29892, 322, 22815, 29914, 11794, 29918, 15989, 674, 367, 2715, 29889, 13, 4706, 9995, 13, 4706, 6062, 29918, 1853, 353, 1134, 29898, 29885, 324, 29897, 13, 4706, 565, 451, 6062, 29918, 1853, 297, 1583, 3032, 13203, 29918, 14669, 29901, 13, 9651, 12020, 20948, 703, 29924, 1772, 29883, 1297, 338, 451, 385, 2777, 310, 6969, 4072, 29901, 1273, 29879, 29908, 1273, 1134, 29898, 29885, 324, 876, 13, 4706, 6230, 29918, 1990, 353, 1583, 3032, 13203, 29918, 14669, 29961, 29885, 324, 29918, 1853, 29962, 13, 4706, 6230, 353, 6230, 29918, 1990, 29898, 29885, 324, 29892, 13, 9651, 3013, 29918, 305, 536, 287, 29918, 29878, 886, 29922, 1311, 29889, 17462, 29918, 305, 536, 287, 29918, 29878, 886, 29892, 13, 9651, 3013, 29918, 1686, 27445, 29918, 29878, 886, 29922, 1311, 29889, 17462, 29918, 1686, 27445, 29918, 29878, 886, 29897, 13, 4706, 1583, 29889, 14669, 353, 6230, 13, 4706, 396, 29871, 29896, 29889, 29871, 3566, 12301, 4072, 313, 18271, 379, 29933, 4072, 29892, 12047, 322, 6433, 29897, 13, 4706, 396, 28657, 6181, 29928, 14402, 1583, 29889, 8678, 29918, 1017, 546, 29889, 842, 29918, 862, 29885, 29898, 29885, 324, 29897, 13, 4706, 1583, 3032, 8678, 29918, 1017, 546, 29898, 14669, 29897, 13, 4706, 396, 29871, 29906, 29874, 29889, 788, 2930, 29899, 4299, 718, 10366, 29918, 29882, 29918, 1631, 313, 4690, 3235, 5868, 24336, 7791, 2303, 319, 4986, 29924, 323, 29979, 29925, 2890, 29897, 13, 4706, 396, 12708, 13, 4706, 396, 29871, 29906, 29890, 29889, 10366, 29918, 29882, 29918, 1990, 293, 13, 4706, 565, 451, 1583, 29889, 17462, 29918, 5464, 3733, 279, 29918, 29882, 2941, 9102, 575, 29901, 13, 9651, 6230, 29889, 14634, 29918, 29882, 11279, 1885, 580, 13, 4706, 396, 29871, 29941, 29889, 29871, 3566, 21224, 4072, 491, 773, 317, 1529, 29934, 9375, 856, 13, 4706, 396, 268, 448, 289, 13788, 881, 367, 13033, 1584, 297, 28774, 313, 4187, 731, 408, 1661, 29899, 5450, 17219, 29897, 13, 4706, 396, 268, 448, 565, 11758, 23090, 338, 4629, 29892, 896, 674, 367, 9615, 313, 578, 896, 1818, 367, 13033, 2307, 14366, 13, 4706, 1583, 3032, 29890, 898, 29918, 1017, 546, 29898, 14669, 29892, 1583, 29889, 16041, 1821, 29918, 314, 2247, 29892, 1583, 29889, 8966, 333, 1598, 29918, 29890, 13788, 29918, 3844, 5708, 29892, 1583, 29889, 8966, 333, 1598, 29918, 29890, 13788, 29918, 513, 1575, 29892, 451, 29918, 8489, 979, 29918, 271, 4835, 29897, 13, 4706, 396, 29871, 29946, 869, 27246, 10492, 13206, 29883, 1297, 13, 4706, 565, 1583, 29889, 29882, 2941, 10492, 29901, 13, 9651, 1583, 3032, 13405, 29918, 16409, 29889, 29882, 2941, 10492, 29898, 14669, 29897, 13, 4706, 396, 29871, 29945, 29889, 29871, 2867, 11758, 1270, 7799, 964, 1722, 29914, 10660, 883, 13, 4706, 565, 1583, 29889, 8966, 333, 29918, 25254, 1270, 7799, 29901, 13, 9651, 2867, 29918, 510, 833, 29918, 1272, 353, 6213, 13, 9651, 289, 13788, 29918, 262, 29918, 8966, 333, 29918, 29878, 886, 353, 6213, 396, 451, 1565, 29892, 541, 445, 338, 871, 4312, 746, 16679, 11758, 1270, 7799, 13, 4706, 1683, 29901, 13, 9651, 2867, 29918, 510, 833, 29918, 1272, 29892, 289, 13788, 29918, 262, 29918, 8966, 333, 29918, 29878, 886, 353, 1583, 3032, 25254, 23090, 29918, 1017, 546, 29889, 4478, 29918, 25254, 23090, 29898, 14669, 29897, 13, 13, 4706, 396, 29871, 29953, 29889, 29871, 2048, 8525, 4127, 856, 13, 4706, 396, 29871, 29953, 29889, 29896, 565, 11758, 1270, 7799, 13033, 29901, 13, 4706, 396, 268, 448, 6686, 278, 6230, 3983, 491, 14993, 3262, 7972, 4694, 1973, 13, 4706, 396, 539, 322, 8158, 9819, 8525, 29918, 28737, 2362, 292, 373, 278, 28537, 400, 13, 4706, 396, 539, 310, 278, 14202, 5759, 13, 4706, 396, 268, 448, 2869, 2867, 278, 1900, 18424, 21224, 313, 4690, 3235, 5868, 24336, 29903, 7791, 2303, 319, 4986, 29924, 323, 29979, 29925, 2890, 29897, 13, 4706, 396, 29871, 29953, 29889, 29906, 29871, 448, 6686, 278, 3983, 322, 2048, 278, 9115, 486, 929, 13, 4706, 396, 29871, 29955, 29889, 29871, 541, 11262, 599, 289, 13788, 393, 526, 297, 28774, 322, 451, 13, 4706, 396, 268, 297, 25706, 11758, 1270, 7799, 13, 4706, 396, 14402, 17749, 25000, 11033, 4072, 363, 349, 4051, 29984, 29911, 13, 4706, 396, 1311, 3032, 8678, 29918, 1017, 546, 29889, 842, 29918, 3207, 29918, 1397, 4135, 29898, 29885, 324, 29897, 13, 13, 4706, 716, 29918, 14669, 353, 1583, 3032, 16041, 29918, 16409, 29898, 14669, 29892, 13, 462, 462, 539, 3876, 29918, 8678, 29918, 2248, 29922, 4632, 29918, 8678, 29918, 2248, 29892, 13, 462, 462, 539, 2867, 29918, 510, 833, 29918, 1272, 29922, 8690, 29918, 510, 833, 29918, 1272, 29892, 13, 462, 462, 539, 289, 13788, 29918, 262, 29918, 8966, 333, 29918, 29878, 886, 29922, 29890, 13788, 29918, 262, 29918, 8966, 333, 29918, 29878, 886, 29897, 13, 13, 4706, 1583, 29889, 14669, 353, 716, 29918, 14669, 13, 4706, 396, 14402, 337, 29899, 3389, 19229, 1156, 16679, 289, 13788, 13, 4706, 396, 1583, 29889, 29890, 898, 29918, 1017, 546, 29889, 842, 29918, 8768, 29918, 1397, 4135, 29898, 29885, 324, 29892, 19060, 11759, 25254, 23090, 29918, 29890, 13788, 2314, 13, 4706, 1583, 29889, 275, 29918, 554, 353, 1583, 3032, 3198, 580, 13, 13, 13, 1678, 822, 903, 3198, 29898, 1311, 1125, 13, 4706, 396, 11539, 393, 599, 28422, 505, 1063, 13033, 13, 4706, 338, 29918, 554, 353, 5852, 13, 4706, 10191, 353, 5124, 13, 4706, 363, 22645, 297, 1583, 29889, 14669, 29889, 8678, 29918, 1853, 29901, 13, 9651, 12301, 29918, 1853, 353, 1583, 29889, 14669, 29889, 8678, 29918, 1853, 29961, 13140, 29962, 13, 9651, 565, 12301, 29918, 1853, 338, 6213, 29901, 13, 18884, 10191, 4619, 525, 8678, 1353, 1273, 29881, 756, 6213, 1134, 29892, 6062, 1024, 29901, 1273, 29879, 29915, 1273, 313, 13140, 29892, 1583, 29889, 14669, 29889, 657, 29918, 29885, 324, 29918, 978, 3101, 13, 18884, 338, 29918, 554, 353, 7700, 13, 4706, 1583, 29889, 1188, 353, 10191, 13, 4706, 736, 338, 29918, 554, 29871, 13, 13, 13, 1678, 822, 1510, 29918, 14669, 29898, 1311, 1125, 13, 4706, 565, 1583, 29889, 14669, 338, 451, 6213, 29901, 13, 9651, 2025, 29918, 23367, 353, 29871, 29900, 13, 13, 9651, 1596, 703, 29924, 1772, 29883, 1297, 6230, 29905, 29876, 1159, 13, 9651, 1596, 703, 4936, 2751, 1360, 29961, 319, 4986, 4345, 4514, 9166, 9166, 9166, 1360, 543, 29897, 13, 9651, 1596, 703, 13140, 29871, 891, 3986, 1302, 4339, 9651, 891, 8323, 891, 647, 29989, 472, 668, 1678, 891, 12368, 1159, 13, 9651, 1596, 703, 807, 11793, 2683, 9072, 29974, 1378, 29974, 12918, 1378, 13097, 9072, 5634, 869, 869, 869, 16521, 13, 9651, 363, 413, 29892, 325, 297, 1051, 29898, 1311, 29889, 14669, 29889, 1111, 536, 29889, 7076, 580, 1125, 13, 18884, 1596, 11702, 29871, 29946, 29881, 891, 1273, 29871, 29947, 29889, 29941, 29888, 1273, 29871, 29947, 29889, 29941, 29888, 1273, 29871, 29947, 29889, 29941, 29888, 891, 1273, 29871, 29896, 29889, 29941, 29888, 891, 1273, 29881, 29908, 1273, 313, 29895, 29892, 325, 29961, 29900, 1402, 325, 29961, 29896, 1402, 325, 29961, 29906, 1402, 13, 462, 418, 1583, 29889, 14669, 29889, 23367, 29961, 29895, 1402, 1583, 29889, 14669, 29889, 8678, 29918, 17281, 29961, 29895, 11724, 13, 462, 418, 376, 29989, 1273, 448, 29947, 29879, 891, 29908, 1273, 1583, 29889, 14669, 29889, 8678, 29918, 1853, 29961, 29895, 1402, 13, 462, 418, 1583, 29889, 14669, 29889, 4262, 29961, 29895, 2314, 13, 18884, 2025, 29918, 23367, 4619, 1583, 29889, 14669, 29889, 23367, 29961, 29895, 29962, 13, 9651, 1596, 703, 807, 11793, 2683, 9072, 29974, 1378, 29974, 12918, 1378, 13097, 9072, 5634, 869, 869, 869, 16521, 13, 9651, 1596, 703, 29871, 323, 2891, 26871, 1692, 29901, 1273, 29941, 29889, 29941, 29888, 29908, 1273, 2025, 29918, 23367, 29897, 13, 13, 9651, 1596, 14182, 29876, 2751, 1360, 29961, 22471, 1525, 9838, 1964, 478, 13845, 24125, 4514, 4936, 26359, 29897, 13, 9651, 363, 413, 29892, 325, 297, 1051, 29898, 1311, 29889, 14669, 29889, 1111, 536, 29889, 7076, 580, 1125, 13, 18884, 565, 413, 297, 1583, 29889, 14669, 29889, 1639, 2467, 29918, 8111, 29901, 13, 462, 1678, 1596, 11702, 29871, 29946, 29881, 376, 1273, 413, 29892, 1583, 29889, 14669, 29889, 8678, 29918, 1853, 29961, 29895, 1402, 1095, 2433, 25710, 13, 13, 9651, 1596, 14182, 29876, 4936, 2751, 1360, 29961, 350, 1164, 8452, 4514, 4936, 2751, 25512, 543, 29897, 13, 9651, 396, 1152, 9753, 537, 4160, 29892, 591, 2113, 29915, 29873, 1510, 1906, 6611, 363, 1286, 13, 9651, 6611, 29918, 517, 29918, 1333, 29918, 4294, 353, 6024, 29890, 898, 29918, 2098, 742, 525, 1853, 2033, 13, 9651, 363, 413, 29892, 325, 297, 1051, 29898, 1311, 29889, 14669, 29889, 29890, 898, 29889, 7076, 580, 1125, 13, 18884, 260, 353, 13420, 15300, 7122, 877, 29995, 29879, 29901, 1273, 29879, 29915, 1273, 313, 29875, 29892, 432, 29897, 363, 474, 29892, 432, 297, 325, 29889, 7076, 580, 565, 451, 474, 297, 6611, 29918, 517, 29918, 1333, 29918, 4294, 29897, 13, 18884, 1596, 11702, 29871, 29947, 29879, 448, 376, 1273, 851, 29898, 29895, 511, 260, 29897, 13, 13, 9651, 1583, 3032, 25254, 23090, 29918, 1017, 546, 29889, 4294, 29918, 25254, 23090, 29918, 1557, 2361, 29898, 1311, 29889, 14669, 29897, 13, 13, 9651, 1596, 877, 1495, 13, 13, 1678, 822, 2436, 29918, 29886, 2585, 17915, 29918, 1807, 29898, 1311, 29892, 788, 29918, 2248, 29918, 1958, 29922, 8516, 29892, 3349, 29918, 3844, 5475, 29922, 8516, 1125, 13, 4706, 565, 1583, 29889, 275, 29918, 554, 1275, 7700, 29901, 13, 9651, 12020, 24875, 2392, 703, 29924, 1772, 29883, 1297, 451, 9280, 29892, 2143, 4746, 304, 2436, 349, 4051, 29984, 29911, 29905, 29876, 29905, 29876, 14480, 3583, 29876, 29995, 29879, 29908, 1273, 1583, 29889, 1188, 29897, 13, 4706, 565, 788, 29918, 2248, 29918, 1958, 338, 6213, 29901, 788, 29918, 2248, 29918, 1958, 353, 1583, 29889, 1202, 29918, 2248, 29918, 1958, 13, 4706, 565, 3349, 29918, 3844, 5475, 338, 6213, 29901, 3349, 29918, 3844, 5475, 353, 1583, 29889, 5992, 29918, 3844, 5475, 13, 4706, 565, 1583, 29889, 14669, 338, 451, 6213, 29901, 13, 9651, 736, 1583, 3032, 13236, 29889, 3539, 29918, 1807, 29898, 1311, 29889, 14669, 29892, 788, 29918, 2248, 29918, 1958, 29892, 3349, 29918, 3844, 5475, 29897, 13, 4706, 1683, 29901, 13, 9651, 12020, 24875, 2392, 877, 29089, 5706, 349, 4051, 29984, 29911, 934, 29892, 278, 13206, 29883, 1297, 338, 451, 13240, 29889, 1495, 13, 13, 1678, 822, 2436, 29918, 29886, 2585, 17915, 29918, 1445, 29898, 1311, 29892, 282, 2585, 17915, 29918, 9507, 29892, 788, 29918, 2248, 29918, 1958, 29922, 8516, 29892, 3349, 29918, 3844, 5475, 29922, 8516, 1125, 13, 4706, 411, 1722, 29898, 29886, 2585, 17915, 29918, 9507, 5501, 29893, 1495, 408, 281, 29901, 13, 9651, 281, 29889, 3539, 29898, 1311, 29889, 3539, 29918, 29886, 2585, 17915, 29918, 1807, 29898, 1202, 29918, 2248, 29918, 1958, 29892, 3349, 29918, 3844, 5475, 876, 13, 13, 1678, 822, 7744, 29918, 29886, 2585, 17915, 29918, 1454, 29918, 1300, 397, 1698, 29946, 29918, 16041, 690, 29898, 1311, 29892, 282, 2585, 17915, 29918, 1807, 29892, 620, 29892, 9704, 29892, 954, 1125, 13, 4706, 9995, 7744, 282, 2585, 17915, 29918, 1807, 304, 367, 15878, 411, 11133, 29928, 1698, 29946, 11780, 29901, 13, 632, 448, 937, 322, 1473, 28422, 4257, 12766, 322, 315, 29933, 13, 632, 448, 2436, 22815, 29918, 15989, 847, 11056, 29918, 15989, 13, 632, 448, 3349, 323, 24125, 3970, 29943, 13, 9651, 445, 338, 363, 274, 10611, 296, 23630, 292, 313, 29873, 1979, 287, 29897, 13, 4706, 9995, 13, 4706, 716, 29918, 1807, 353, 376, 29933, 17958, 29918, 15989, 1273, 29879, 1273, 29879, 1273, 29879, 29905, 29876, 29908, 1273, 313, 690, 29892, 9704, 29892, 954, 29897, 13, 4706, 12301, 29918, 4537, 353, 29871, 29900, 13, 4706, 363, 1196, 297, 282, 2585, 17915, 29918, 1807, 29889, 5451, 14182, 29876, 29908, 1125, 13, 9651, 565, 1196, 1275, 376, 1115, 13, 18884, 6773, 13, 9651, 565, 1196, 29889, 27382, 2541, 703, 29911, 24125, 3970, 29943, 29908, 1125, 13, 18884, 6773, 13, 9651, 565, 1196, 29889, 27382, 2541, 703, 1299, 6488, 29908, 1125, 13, 18884, 12301, 29918, 4537, 23661, 29896, 13, 18884, 565, 12301, 29918, 4537, 1275, 29871, 29896, 29901, 13, 462, 1678, 1196, 353, 1196, 7503, 29896, 29941, 29962, 718, 525, 5454, 29915, 718, 1196, 29961, 29896, 29945, 17531, 13, 18884, 25342, 12301, 29918, 4537, 1275, 29871, 29906, 29901, 13, 462, 1678, 1196, 353, 1196, 7503, 29896, 29941, 29962, 718, 525, 21685, 29915, 718, 1196, 29961, 29896, 29945, 17531, 13, 18884, 716, 29918, 1807, 4619, 1196, 718, 11297, 29876, 29915, 13, 18884, 6773, 13, 9651, 716, 29918, 1807, 4619, 1196, 718, 11297, 29876, 29915, 13, 4706, 716, 29918, 1807, 4619, 376, 11794, 29918, 15989, 1273, 29879, 1273, 29879, 1273, 29879, 29905, 29876, 29908, 1273, 313, 690, 29892, 9704, 29892, 954, 29897, 13, 4706, 736, 716, 29918, 1807, 13, 13, 2 ]
DL/live_camera_ocr/LC_layer.py
jay-z007/Deep-Learning
0
167181
<filename>DL/live_camera_ocr/LC_layer.py import numpy as np # data # weights # strides # padding(opt) # def get_patches(): # pass """ data : 3d [in_height 4, in_width 4, in_depth 64] //weights : 5d [in_height (4), in_width (4), in_depth (64), kernel*kernel (3x3), depth (64)] weights : [kernel, kernel, in_depth, in_height-diff, in_width-diff, depth] biases : ? """ def LC_layer(data, weights, strides, kernel_size=3):#, padding="SAME"): shape = list(weights.shape) filters = shape[5] Y = shape[3] X = shape[4] #shape = list(data.shape) #print shape diff = kernel_size - 1 sumb = np.ndarray(shape=(Y, X, filters), dtype=np.float32) for d in range(filters): for h in range(Y, strides[1]): for w in range(X, strides[0]): sumb[h, w, d] = np.sum(data[h:h+kernel_size, w:w+kernel_size, :] * weights[:, :, :, h:h+kernel_size, w:w+kernel_size, d]) print sumb.shape data = np.ndarray(shape=(4, 4, 64), dtype=np.float32) weights = np.ndarray(shape=(3, 3, 64, 2, 2, 5), dtype=np.float32) LC_layer(data, weights, [2,2])
[ 1, 529, 9507, 29958, 19558, 29914, 9258, 29918, 26065, 29918, 8415, 29914, 12182, 29918, 13148, 29889, 2272, 13, 5215, 12655, 408, 7442, 13, 13, 29937, 848, 13, 29937, 18177, 13, 29937, 851, 2247, 13, 29937, 7164, 29898, 3670, 29897, 13, 13, 29937, 822, 679, 29918, 5041, 267, 7295, 13, 29937, 29871, 12, 3364, 13, 13, 15945, 29908, 13, 1272, 584, 29871, 29941, 29881, 518, 262, 29918, 3545, 29871, 29946, 29892, 297, 29918, 2103, 29871, 29946, 29892, 297, 29918, 19488, 29871, 29953, 29946, 29962, 13, 458, 705, 5861, 584, 29871, 29945, 29881, 518, 262, 29918, 3545, 313, 29946, 511, 297, 29918, 2103, 313, 29946, 511, 297, 29918, 19488, 313, 29953, 29946, 511, 8466, 29930, 17460, 313, 29941, 29916, 29941, 511, 10809, 313, 29953, 29946, 4638, 13, 705, 5861, 584, 518, 17460, 29892, 8466, 29892, 297, 29918, 19488, 29892, 297, 29918, 3545, 29899, 12765, 29892, 297, 29918, 2103, 29899, 12765, 29892, 10809, 29962, 13, 5365, 2129, 584, 1577, 13, 15945, 29908, 13, 1753, 365, 29907, 29918, 13148, 29898, 1272, 29892, 18177, 29892, 851, 2247, 29892, 8466, 29918, 2311, 29922, 29941, 1125, 6552, 7164, 543, 8132, 2303, 29908, 1125, 12, 12, 13, 12, 12181, 353, 1051, 29898, 705, 5861, 29889, 12181, 29897, 13, 12, 26705, 353, 8267, 29961, 29945, 29962, 13, 12, 29979, 353, 8267, 29961, 29941, 29962, 13, 12, 29990, 353, 8267, 29961, 29946, 29962, 13, 12, 29937, 12181, 353, 1051, 29898, 1272, 29889, 12181, 29897, 13, 12, 29937, 2158, 8267, 13, 12, 12765, 353, 8466, 29918, 2311, 448, 29871, 29896, 13, 12, 2083, 29890, 353, 7442, 29889, 299, 2378, 29898, 12181, 7607, 29979, 29892, 1060, 29892, 18094, 511, 26688, 29922, 9302, 29889, 7411, 29941, 29906, 29897, 13, 12, 1454, 270, 297, 3464, 29898, 26705, 1125, 13, 12, 12, 1454, 298, 297, 3464, 29898, 29979, 29892, 851, 2247, 29961, 29896, 29962, 1125, 13, 12, 12, 12, 1454, 281, 297, 3464, 29898, 29990, 29892, 851, 2247, 29961, 29900, 29962, 1125, 13, 12, 12, 12, 12, 2083, 29890, 29961, 29882, 29892, 281, 29892, 270, 29962, 353, 7442, 29889, 2083, 29898, 1272, 29961, 29882, 29901, 29882, 29974, 17460, 29918, 2311, 29892, 281, 29901, 29893, 29974, 17460, 29918, 2311, 29892, 584, 29962, 334, 18177, 7503, 29892, 584, 29892, 584, 29892, 298, 29901, 29882, 29974, 17460, 29918, 2311, 29892, 281, 29901, 29893, 29974, 17460, 29918, 2311, 29892, 270, 2314, 13, 13, 12, 2158, 2533, 29890, 29889, 12181, 13, 13, 1272, 353, 7442, 29889, 299, 2378, 29898, 12181, 7607, 29946, 29892, 29871, 29946, 29892, 29871, 29953, 29946, 511, 26688, 29922, 9302, 29889, 7411, 29941, 29906, 29897, 13, 705, 5861, 353, 7442, 29889, 299, 2378, 29898, 12181, 7607, 29941, 29892, 29871, 29941, 29892, 29871, 29953, 29946, 29892, 29871, 29906, 29892, 29871, 29906, 29892, 29871, 29945, 511, 26688, 29922, 9302, 29889, 7411, 29941, 29906, 29897, 13, 12182, 29918, 13148, 29898, 1272, 29892, 18177, 29892, 518, 29906, 29892, 29906, 2314, 2 ]
pre_commit_hooks/loaderon_hooks/util/file_helpers.py
alvaroscelza/pre-commit-hooks
0
74856
<gh_stars>0 # -*- coding: utf-8 -*- import os import re def read_file(file_path, only_first_line=False): opened_file = open(file_path) if only_first_line: lines = opened_file.readline() else: lines = opened_file.readlines() opened_file.close() return lines def read_file_line(file_path): return read_file(file_path, True) def read_file_lines(file_path): return read_file(file_path) def find_file_starting_from_reference_file_directory(reference_file, file_to_find): """Attempts to find file_to_find by navigating through directories from reference_file's parent directory.""" file_path = os.path.realpath(reference_file) folder_path = os.path.dirname(file_path) for root, unused_dirs, files in os.walk(folder_path): if file_to_find in files: return os.path.join(root, file_to_find) return None def get_indexes_of_lines_per_regex(file_lines, regex): regex_pattern = re.compile(regex) indexes_of_lines_defining_regex = [] for index, line in enumerate(file_lines): if regex_pattern.match(line): indexes_of_lines_defining_regex.append(index) return indexes_of_lines_defining_regex def get_bunches_of_lines_dividing_by_regex(file_lines, regex): lines = [] indexes_of_lines_per_regex = get_indexes_of_lines_per_regex(file_lines, regex) for index, index_of_lines in enumerate(indexes_of_lines_per_regex): try: next_regex_index = indexes_of_lines_per_regex[index + 1] current_regex_lines = file_lines[index_of_lines:next_regex_index] except IndexError: current_regex_lines = file_lines[index_of_lines:] lines.append(current_regex_lines) return lines def split_by_regexp(filename, regex): file_lines = read_file_lines(filename) return get_bunches_of_lines_dividing_by_regex(file_lines, regex)
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 5215, 2897, 13, 5215, 337, 13, 13, 13, 1753, 1303, 29918, 1445, 29898, 1445, 29918, 2084, 29892, 871, 29918, 4102, 29918, 1220, 29922, 8824, 1125, 13, 1678, 6496, 29918, 1445, 353, 1722, 29898, 1445, 29918, 2084, 29897, 13, 1678, 565, 871, 29918, 4102, 29918, 1220, 29901, 13, 4706, 3454, 353, 6496, 29918, 1445, 29889, 949, 1220, 580, 13, 1678, 1683, 29901, 13, 4706, 3454, 353, 6496, 29918, 1445, 29889, 949, 9012, 580, 13, 1678, 6496, 29918, 1445, 29889, 5358, 580, 13, 1678, 736, 3454, 13, 13, 13, 1753, 1303, 29918, 1445, 29918, 1220, 29898, 1445, 29918, 2084, 1125, 13, 1678, 736, 1303, 29918, 1445, 29898, 1445, 29918, 2084, 29892, 5852, 29897, 13, 13, 13, 1753, 1303, 29918, 1445, 29918, 9012, 29898, 1445, 29918, 2084, 1125, 13, 1678, 736, 1303, 29918, 1445, 29898, 1445, 29918, 2084, 29897, 13, 13, 13, 1753, 1284, 29918, 1445, 29918, 2962, 292, 29918, 3166, 29918, 5679, 29918, 1445, 29918, 12322, 29898, 5679, 29918, 1445, 29892, 934, 29918, 517, 29918, 2886, 1125, 13, 1678, 9995, 4165, 3456, 29879, 304, 1284, 934, 29918, 517, 29918, 2886, 491, 12402, 1218, 1549, 17525, 515, 3407, 29918, 1445, 29915, 29879, 3847, 3884, 1213, 15945, 13, 1678, 934, 29918, 2084, 353, 2897, 29889, 2084, 29889, 6370, 2084, 29898, 5679, 29918, 1445, 29897, 13, 1678, 4138, 29918, 2084, 353, 2897, 29889, 2084, 29889, 25721, 29898, 1445, 29918, 2084, 29897, 13, 1678, 363, 3876, 29892, 443, 3880, 29918, 3972, 29879, 29892, 2066, 297, 2897, 29889, 20919, 29898, 12083, 29918, 2084, 1125, 13, 4706, 565, 934, 29918, 517, 29918, 2886, 297, 2066, 29901, 13, 9651, 736, 2897, 29889, 2084, 29889, 7122, 29898, 4632, 29892, 934, 29918, 517, 29918, 2886, 29897, 13, 1678, 736, 6213, 13, 13, 13, 1753, 679, 29918, 2248, 267, 29918, 974, 29918, 9012, 29918, 546, 29918, 13087, 29898, 1445, 29918, 9012, 29892, 6528, 1125, 13, 1678, 6528, 29918, 11037, 353, 337, 29889, 12198, 29898, 13087, 29897, 13, 1678, 18111, 29918, 974, 29918, 9012, 29918, 1753, 2827, 29918, 13087, 353, 5159, 13, 1678, 363, 2380, 29892, 1196, 297, 26985, 29898, 1445, 29918, 9012, 1125, 13, 4706, 565, 6528, 29918, 11037, 29889, 4352, 29898, 1220, 1125, 13, 9651, 18111, 29918, 974, 29918, 9012, 29918, 1753, 2827, 29918, 13087, 29889, 4397, 29898, 2248, 29897, 13, 1678, 736, 18111, 29918, 974, 29918, 9012, 29918, 1753, 2827, 29918, 13087, 13, 13, 13, 1753, 679, 29918, 29890, 3322, 267, 29918, 974, 29918, 9012, 29918, 29881, 3640, 292, 29918, 1609, 29918, 13087, 29898, 1445, 29918, 9012, 29892, 6528, 1125, 13, 1678, 3454, 353, 5159, 13, 1678, 18111, 29918, 974, 29918, 9012, 29918, 546, 29918, 13087, 353, 679, 29918, 2248, 267, 29918, 974, 29918, 9012, 29918, 546, 29918, 13087, 29898, 1445, 29918, 9012, 29892, 6528, 29897, 13, 1678, 363, 2380, 29892, 2380, 29918, 974, 29918, 9012, 297, 26985, 29898, 2248, 267, 29918, 974, 29918, 9012, 29918, 546, 29918, 13087, 1125, 13, 4706, 1018, 29901, 13, 9651, 2446, 29918, 13087, 29918, 2248, 353, 18111, 29918, 974, 29918, 9012, 29918, 546, 29918, 13087, 29961, 2248, 718, 29871, 29896, 29962, 13, 9651, 1857, 29918, 13087, 29918, 9012, 353, 934, 29918, 9012, 29961, 2248, 29918, 974, 29918, 9012, 29901, 4622, 29918, 13087, 29918, 2248, 29962, 13, 4706, 5174, 11374, 2392, 29901, 13, 9651, 1857, 29918, 13087, 29918, 9012, 353, 934, 29918, 9012, 29961, 2248, 29918, 974, 29918, 9012, 17531, 13, 4706, 3454, 29889, 4397, 29898, 3784, 29918, 13087, 29918, 9012, 29897, 13, 1678, 736, 3454, 13, 13, 13, 1753, 6219, 29918, 1609, 29918, 13087, 29886, 29898, 9507, 29892, 6528, 1125, 13, 1678, 934, 29918, 9012, 353, 1303, 29918, 1445, 29918, 9012, 29898, 9507, 29897, 13, 1678, 736, 679, 29918, 29890, 3322, 267, 29918, 974, 29918, 9012, 29918, 29881, 3640, 292, 29918, 1609, 29918, 13087, 29898, 1445, 29918, 9012, 29892, 6528, 29897, 13, 2 ]
agent/tests/test_input/test_1/test_kafka_http.py
anodot/daria
16
153927
<filename>agent/tests/test_input/test_1/test_kafka_http.py<gh_stars>10-100 import json import subprocess import traceback from agent import cli, source, pipeline from ..test_zpipeline_base import TestInputBase from ...conftest import get_input_file_path class TestKafka(TestInputBase): __test__ = True params = { 'test_source_create': [{'name': 'test_kfk'}, {'name': 'test_running_counters'}, {'name': 'test_json_arrays'}], 'test_create': [ { 'source_name': 'test_kfk', 'name': 'test_kfk_value_const', 'options': ['-a'], 'value': 'y\nclicks\ny\n\n \n ', 'timestamp': 'timestamp_unix\nunix', 'advanced_options': 'key1:val1\n\n\n\n' }, { 'source_name': 'test_kfk', 'name': 'test_kfk_timestamp_ms', 'options': [], 'value': 'n\nClicks:gauge\nClicks:clicks', 'timestamp': 'timestamp_unix_ms\nunix_ms', 'advanced_options': '' }, { 'source_name': 'test_kfk', 'name': 'test_kfk_timestamp_string', 'options': ['-a'], 'value': 'y\nclicks\ny\n\n \n ', 'timestamp': 'timestamp_string\nstring\nM/d/yyyy H:mm:ss\n', 'advanced_options': 'key1:val1\ntag1:tagval tag2:tagval\n"Country" == "USA"\n/home/kafka_transform.csv' }, { 'source_name': 'test_running_counters', 'name': 'test_kfk_running_counter', 'options': ['-a'], 'value': 'n\ny\n\nClicks:running_counter\nClicks:clicks', 'timestamp': 'timestamp_unix\nunix', 'advanced_options': 'key1:val1\n \n \n \n\nn' }, { 'source_name': 'test_running_counters', 'name': 'test_kfk_running_counter_static_tt', 'options': ['-a'], 'value': 'n\nn\n \nClicks:running_counter\nClicks:metric', 'timestamp': 'timestamp_unix\nunix', 'advanced_options': 'key1:val1\n \n \n \nn' }, { 'source_name': 'test_running_counters', 'name': 'test_kfk_running_counter_dynamic_what', 'options': ['-a'], 'value': 'n\nn\n\nClicks:agg_type\nClicks:metric', 'timestamp': 'timestamp_unix\nunix', 'advanced_options': 'key1:val1\n \n \n \nn' }, { 'source_name': 'test_json_arrays', 'name': 'test_json_arrays', 'options': ['-a'], 'value': 'n\ny\nkpis\n\nClicks:gauge\nClicks:clicks', 'timestamp': 'timestamp_unix\nunix', 'advanced_options': ' \n \n \n \n\nn' }, { 'source_name': 'test_kfk', 'name': 'test_kafka_timezone', 'options': ['-a'], 'value': 'n\ny\n \nClicks:gauge\n ', 'timestamp': 'timestamp_string\nstring\nM/d/yyyy H:mm:ss\nEurope/Berlin', 'advanced_options': '\n\n\n\n\nn' }, ], 'test_edit': [ {'options': ['test_kfk_value_const', '-a'], 'value': 'y\nclicks\n\n\n\n'}, {'options': ['test_kfk_timestamp_string', '-a'], 'value': 'n\nn\n\nClicks:agg_type\nClicks:metric'} ], 'test_create_transform_value': [ { 'pipeline_id': 'test_transform_value', 'transform_file': '/home/kafka_transform_value.csv' }, { 'pipeline_id': 'test_transform_value_2', 'transform_file': '/home/kafka_transform_value_2.csv' }, ], 'test_create_source_with_file': [{'file_name': 'kafka_sources'}], 'test_create_with_file': [{'file_name': 'kafka_pipelines'}], } def test_source_create(self, cli_runner, name): result = cli_runner.invoke(cli.source.create, catch_exceptions=False, input=f"kafka\n{name}\nkafka:29092\n{name}\n\n\n") assert result.exit_code == 0 assert source.repository.exists(name) def test_create(self, cli_runner, source_name, name, options, value, timestamp, advanced_options): result = cli_runner.invoke( cli.pipeline.create, options, catch_exceptions=False, input=f"{source_name}\n{name}\n\n{value}\n{timestamp}\nver Country\nExchange optional_dim ad_type ADTYPE GEN\n\n{advanced_options}\n" ) traceback.print_exception(*result.exc_info) assert result.exit_code == 0 pipeline_ = pipeline.repository.get_by_id(name) assert bool(pipeline_.override_source) def test_edit(self, cli_runner, options, value): result = cli_runner.invoke(cli.pipeline.edit, options, catch_exceptions=False, input=f"\n{value}\n\n\n\n\n\n\n\n\n\n\n\n") assert result.exit_code == 0 def test_create_transform_value(self, cli_runner, pipeline_id: str, transform_file: dict): input_ = { 'source name': 'test_kfk', 'pipeline id': pipeline_id, 'preview': 'n', 'count': 'n', 'static': 'y', 'value array': ' ', 'value properties': 'Clicks:gauge', 'measurement names': 'Clicks:clicks', 'timestamp': 'timestamp_unix', 'timestamp type': 'unix', 'required dimensions': ' ', 'optional dimensions': 'title subtitle', 'consumer group': '', 'additional props': ' ', 'tags': ' ', 'filter condition': ' ', 'transformation file': transform_file, } result = cli_runner.invoke(cli.pipeline.create, ["-a"], catch_exceptions=False, input='\n'.join(input_.values())) traceback.print_exception(*result.exc_info) assert result.exit_code == 0 # I guess it's testing di.init() for cli, cli_runner doesn't run click app, and subprocess runs it def test_create_subprocess(self): input_file_path = get_input_file_path('kafka_sources_2.json') try: subprocess.check_output(['agent', 'source', 'create', '-f', input_file_path], stderr=subprocess.STDOUT) except subprocess.CalledProcessError as exc: raise Exception(f'Status: FAIL\nexit code {exc.returncode}\n{exc.output}') with open(input_file_path) as f: sources = json.load(f) for source_ in sources: assert source.repository.exists(f"{source_['name']}")
[ 1, 529, 9507, 29958, 14748, 29914, 21150, 29914, 1688, 29918, 2080, 29914, 1688, 29918, 29896, 29914, 1688, 29918, 28510, 29918, 1124, 29889, 2272, 29966, 12443, 29918, 303, 1503, 29958, 29896, 29900, 29899, 29896, 29900, 29900, 13, 5215, 4390, 13, 5215, 1014, 5014, 13, 5215, 9637, 1627, 13, 13, 3166, 10823, 1053, 9335, 29892, 2752, 29892, 16439, 13, 3166, 6317, 1688, 29918, 29920, 13096, 5570, 29918, 3188, 1053, 4321, 4290, 5160, 13, 3166, 2023, 535, 615, 342, 1053, 679, 29918, 2080, 29918, 1445, 29918, 2084, 13, 13, 13, 1990, 4321, 29968, 20817, 29898, 3057, 4290, 5160, 1125, 13, 1678, 4770, 1688, 1649, 353, 5852, 13, 1678, 8636, 353, 426, 13, 4706, 525, 1688, 29918, 4993, 29918, 3258, 2396, 518, 10998, 978, 2396, 525, 1688, 29918, 29895, 29888, 29895, 16675, 11117, 978, 2396, 525, 1688, 29918, 21094, 29918, 29883, 1309, 2153, 16675, 11117, 978, 2396, 525, 1688, 29918, 3126, 29918, 2378, 29879, 10827, 1402, 13, 4706, 525, 1688, 29918, 3258, 2396, 518, 13, 9651, 426, 13, 18884, 525, 4993, 29918, 978, 2396, 525, 1688, 29918, 29895, 29888, 29895, 742, 13, 18884, 525, 978, 2396, 525, 1688, 29918, 29895, 29888, 29895, 29918, 1767, 29918, 3075, 742, 13, 18884, 525, 6768, 2396, 6024, 29899, 29874, 7464, 13, 18884, 525, 1767, 2396, 525, 29891, 29905, 29876, 3808, 29879, 29905, 1460, 29905, 29876, 29905, 29876, 320, 29876, 13420, 13, 18884, 525, 16394, 2396, 525, 16394, 29918, 24538, 29905, 29876, 24538, 742, 13, 18884, 525, 328, 16858, 29918, 6768, 2396, 525, 1989, 29896, 29901, 791, 29896, 29905, 29876, 29905, 29876, 29905, 29876, 29905, 29876, 29915, 13, 9651, 2981, 13, 9651, 426, 13, 18884, 525, 4993, 29918, 978, 2396, 525, 1688, 29918, 29895, 29888, 29895, 742, 13, 18884, 525, 978, 2396, 525, 1688, 29918, 29895, 29888, 29895, 29918, 16394, 29918, 1516, 742, 13, 18884, 525, 6768, 2396, 19997, 13, 18884, 525, 1767, 2396, 525, 29876, 29905, 29876, 4164, 29879, 29901, 29887, 585, 479, 29905, 29876, 4164, 29879, 29901, 3808, 29879, 742, 13, 18884, 525, 16394, 2396, 525, 16394, 29918, 24538, 29918, 1516, 29905, 29876, 24538, 29918, 1516, 742, 13, 18884, 525, 328, 16858, 29918, 6768, 2396, 6629, 13, 9651, 2981, 13, 9651, 426, 13, 18884, 525, 4993, 29918, 978, 2396, 525, 1688, 29918, 29895, 29888, 29895, 742, 13, 18884, 525, 978, 2396, 525, 1688, 29918, 29895, 29888, 29895, 29918, 16394, 29918, 1807, 742, 13, 18884, 525, 6768, 2396, 6024, 29899, 29874, 7464, 13, 18884, 525, 1767, 2396, 525, 29891, 29905, 29876, 3808, 29879, 29905, 1460, 29905, 29876, 29905, 29876, 320, 29876, 13420, 13, 18884, 525, 16394, 2396, 525, 16394, 29918, 1807, 29905, 29876, 1807, 29905, 29876, 29924, 29914, 29881, 29914, 18855, 379, 29901, 4317, 29901, 893, 29905, 29876, 742, 13, 18884, 525, 328, 16858, 29918, 6768, 2396, 525, 1989, 29896, 29901, 791, 29896, 29905, 593, 351, 29896, 29901, 4039, 791, 4055, 29906, 29901, 4039, 791, 29905, 29876, 29908, 20779, 29908, 1275, 376, 27019, 26732, 29876, 29914, 5184, 29914, 28510, 29918, 9067, 29889, 7638, 29915, 13, 9651, 2981, 13, 9651, 426, 13, 18884, 525, 4993, 29918, 978, 2396, 525, 1688, 29918, 21094, 29918, 29883, 1309, 2153, 742, 13, 18884, 525, 978, 2396, 525, 1688, 29918, 29895, 29888, 29895, 29918, 21094, 29918, 11808, 742, 13, 18884, 525, 6768, 2396, 6024, 29899, 29874, 7464, 13, 18884, 525, 1767, 2396, 525, 29876, 29905, 1460, 29905, 29876, 29905, 29876, 4164, 29879, 29901, 21094, 29918, 11808, 29905, 29876, 4164, 29879, 29901, 3808, 29879, 742, 13, 18884, 525, 16394, 2396, 525, 16394, 29918, 24538, 29905, 29876, 24538, 742, 13, 18884, 525, 328, 16858, 29918, 6768, 2396, 525, 1989, 29896, 29901, 791, 29896, 29905, 29876, 320, 29876, 320, 29876, 320, 29876, 29905, 15755, 29915, 13, 9651, 2981, 13, 9651, 426, 13, 18884, 525, 4993, 29918, 978, 2396, 525, 1688, 29918, 21094, 29918, 29883, 1309, 2153, 742, 13, 18884, 525, 978, 2396, 525, 1688, 29918, 29895, 29888, 29895, 29918, 21094, 29918, 11808, 29918, 7959, 29918, 698, 742, 13, 18884, 525, 6768, 2396, 6024, 29899, 29874, 7464, 13, 18884, 525, 1767, 2396, 525, 29876, 29905, 15755, 29905, 29876, 320, 29876, 4164, 29879, 29901, 21094, 29918, 11808, 29905, 29876, 4164, 29879, 29901, 16414, 742, 13, 18884, 525, 16394, 2396, 525, 16394, 29918, 24538, 29905, 29876, 24538, 742, 13, 18884, 525, 328, 16858, 29918, 6768, 2396, 525, 1989, 29896, 29901, 791, 29896, 29905, 29876, 320, 29876, 320, 29876, 320, 15755, 29915, 13, 9651, 2981, 13, 9651, 426, 13, 18884, 525, 4993, 29918, 978, 2396, 525, 1688, 29918, 21094, 29918, 29883, 1309, 2153, 742, 13, 18884, 525, 978, 2396, 525, 1688, 29918, 29895, 29888, 29895, 29918, 21094, 29918, 11808, 29918, 16626, 29918, 5816, 742, 13, 18884, 525, 6768, 2396, 6024, 29899, 29874, 7464, 13, 18884, 525, 1767, 2396, 525, 29876, 29905, 15755, 29905, 29876, 29905, 29876, 4164, 29879, 29901, 16170, 29918, 1853, 29905, 29876, 4164, 29879, 29901, 16414, 742, 13, 18884, 525, 16394, 2396, 525, 16394, 29918, 24538, 29905, 29876, 24538, 742, 13, 18884, 525, 328, 16858, 29918, 6768, 2396, 525, 1989, 29896, 29901, 791, 29896, 29905, 29876, 320, 29876, 320, 29876, 320, 15755, 29915, 13, 9651, 2981, 13, 9651, 426, 13, 18884, 525, 4993, 29918, 978, 2396, 525, 1688, 29918, 3126, 29918, 2378, 29879, 742, 13, 18884, 525, 978, 2396, 525, 1688, 29918, 3126, 29918, 2378, 29879, 742, 13, 18884, 525, 6768, 2396, 6024, 29899, 29874, 7464, 13, 18884, 525, 1767, 2396, 525, 29876, 29905, 1460, 29905, 29876, 29895, 3334, 29905, 29876, 29905, 29876, 4164, 29879, 29901, 29887, 585, 479, 29905, 29876, 4164, 29879, 29901, 3808, 29879, 742, 13, 18884, 525, 16394, 2396, 525, 16394, 29918, 24538, 29905, 29876, 24538, 742, 13, 18884, 525, 328, 16858, 29918, 6768, 2396, 525, 320, 29876, 320, 29876, 320, 29876, 320, 29876, 29905, 15755, 29915, 13, 9651, 2981, 13, 9651, 426, 13, 18884, 525, 4993, 29918, 978, 2396, 525, 1688, 29918, 29895, 29888, 29895, 742, 13, 18884, 525, 978, 2396, 525, 1688, 29918, 28510, 29918, 2230, 8028, 742, 13, 18884, 525, 6768, 2396, 6024, 29899, 29874, 7464, 13, 18884, 525, 1767, 2396, 525, 29876, 29905, 1460, 29905, 29876, 320, 29876, 4164, 29879, 29901, 29887, 585, 479, 29905, 29876, 13420, 13, 18884, 525, 16394, 2396, 525, 16394, 29918, 1807, 29905, 29876, 1807, 29905, 29876, 29924, 29914, 29881, 29914, 18855, 379, 29901, 4317, 29901, 893, 29905, 29876, 15654, 29914, 17104, 1915, 742, 13, 18884, 525, 328, 16858, 29918, 6768, 2396, 11297, 29876, 29905, 29876, 29905, 29876, 29905, 29876, 29905, 15755, 29915, 13, 9651, 2981, 13, 4706, 21251, 13, 4706, 525, 1688, 29918, 5628, 2396, 518, 13, 9651, 11117, 6768, 2396, 6024, 1688, 29918, 29895, 29888, 29895, 29918, 1767, 29918, 3075, 742, 17411, 29874, 7464, 525, 1767, 2396, 525, 29891, 29905, 29876, 3808, 29879, 29905, 29876, 29905, 29876, 29905, 29876, 29905, 29876, 16675, 13, 9651, 11117, 6768, 2396, 6024, 1688, 29918, 29895, 29888, 29895, 29918, 16394, 29918, 1807, 742, 17411, 29874, 7464, 525, 1767, 2396, 525, 29876, 29905, 15755, 29905, 29876, 29905, 29876, 4164, 29879, 29901, 16170, 29918, 1853, 29905, 29876, 4164, 29879, 29901, 16414, 10827, 13, 4706, 21251, 13, 4706, 525, 1688, 29918, 3258, 29918, 9067, 29918, 1767, 2396, 518, 13, 9651, 426, 13, 18884, 525, 13096, 5570, 29918, 333, 2396, 525, 1688, 29918, 9067, 29918, 1767, 742, 13, 18884, 525, 9067, 29918, 1445, 2396, 8207, 5184, 29914, 28510, 29918, 9067, 29918, 1767, 29889, 7638, 29915, 13, 9651, 2981, 13, 9651, 426, 13, 18884, 525, 13096, 5570, 29918, 333, 2396, 525, 1688, 29918, 9067, 29918, 1767, 29918, 29906, 742, 13, 18884, 525, 9067, 29918, 1445, 2396, 8207, 5184, 29914, 28510, 29918, 9067, 29918, 1767, 29918, 29906, 29889, 7638, 29915, 13, 9651, 2981, 13, 4706, 21251, 13, 4706, 525, 1688, 29918, 3258, 29918, 4993, 29918, 2541, 29918, 1445, 2396, 518, 10998, 1445, 29918, 978, 2396, 525, 28510, 29918, 29879, 2863, 10827, 1402, 13, 4706, 525, 1688, 29918, 3258, 29918, 2541, 29918, 1445, 2396, 518, 10998, 1445, 29918, 978, 2396, 525, 28510, 29918, 13096, 24210, 10827, 1402, 13, 1678, 500, 13, 13, 1678, 822, 1243, 29918, 4993, 29918, 3258, 29898, 1311, 29892, 9335, 29918, 27492, 29892, 1024, 1125, 13, 4706, 1121, 353, 9335, 29918, 27492, 29889, 9772, 29898, 11303, 29889, 4993, 29889, 3258, 29892, 4380, 29918, 11739, 29879, 29922, 8824, 29892, 13, 462, 462, 259, 1881, 29922, 29888, 29908, 28510, 29905, 29876, 29912, 978, 1012, 29876, 28510, 29901, 29906, 29929, 29900, 29929, 29906, 29905, 29876, 29912, 978, 1012, 29876, 29905, 29876, 29905, 29876, 1159, 13, 4706, 4974, 1121, 29889, 13322, 29918, 401, 1275, 29871, 29900, 13, 4706, 4974, 2752, 29889, 19033, 29889, 9933, 29898, 978, 29897, 13, 13, 1678, 822, 1243, 29918, 3258, 29898, 1311, 29892, 9335, 29918, 27492, 29892, 2752, 29918, 978, 29892, 1024, 29892, 3987, 29892, 995, 29892, 14334, 29892, 12862, 29918, 6768, 1125, 13, 4706, 1121, 353, 9335, 29918, 27492, 29889, 9772, 29898, 13, 9651, 9335, 29889, 13096, 5570, 29889, 3258, 29892, 3987, 29892, 4380, 29918, 11739, 29879, 29922, 8824, 29892, 13, 9651, 1881, 29922, 29888, 29908, 29912, 4993, 29918, 978, 1012, 29876, 29912, 978, 1012, 29876, 29905, 29876, 29912, 1767, 1012, 29876, 29912, 16394, 1012, 29876, 369, 15456, 29905, 29876, 1252, 3167, 13136, 29918, 6229, 594, 29918, 1853, 11033, 11116, 402, 1430, 29905, 29876, 29905, 29876, 29912, 328, 16858, 29918, 6768, 1012, 29876, 29908, 13, 4706, 1723, 13, 4706, 9637, 1627, 29889, 2158, 29918, 11739, 10456, 2914, 29889, 735, 29883, 29918, 3888, 29897, 13, 4706, 4974, 1121, 29889, 13322, 29918, 401, 1275, 29871, 29900, 13, 4706, 16439, 29918, 353, 16439, 29889, 19033, 29889, 657, 29918, 1609, 29918, 333, 29898, 978, 29897, 13, 4706, 4974, 6120, 29898, 13096, 5570, 5396, 15752, 29918, 4993, 29897, 13, 13, 1678, 822, 1243, 29918, 5628, 29898, 1311, 29892, 9335, 29918, 27492, 29892, 3987, 29892, 995, 1125, 13, 4706, 1121, 353, 9335, 29918, 27492, 29889, 9772, 29898, 11303, 29889, 13096, 5570, 29889, 5628, 29892, 3987, 29892, 4380, 29918, 11739, 29879, 29922, 8824, 29892, 13, 462, 462, 259, 1881, 29922, 29888, 26732, 29876, 29912, 1767, 1012, 29876, 29905, 29876, 29905, 29876, 29905, 29876, 29905, 29876, 29905, 29876, 29905, 29876, 29905, 29876, 29905, 29876, 29905, 29876, 29905, 29876, 29905, 29876, 1159, 13, 4706, 4974, 1121, 29889, 13322, 29918, 401, 1275, 29871, 29900, 13, 13, 1678, 822, 1243, 29918, 3258, 29918, 9067, 29918, 1767, 29898, 1311, 29892, 9335, 29918, 27492, 29892, 16439, 29918, 333, 29901, 851, 29892, 4327, 29918, 1445, 29901, 9657, 1125, 13, 4706, 1881, 29918, 353, 426, 13, 9651, 525, 4993, 1024, 2396, 525, 1688, 29918, 29895, 29888, 29895, 742, 13, 9651, 525, 13096, 5570, 1178, 2396, 16439, 29918, 333, 29892, 13, 9651, 525, 25347, 2396, 525, 29876, 742, 13, 9651, 525, 2798, 2396, 525, 29876, 742, 13, 9651, 525, 7959, 2396, 525, 29891, 742, 13, 9651, 525, 1767, 1409, 2396, 525, 13420, 13, 9651, 525, 1767, 4426, 2396, 525, 4164, 29879, 29901, 29887, 585, 479, 742, 13, 9651, 525, 26658, 358, 2983, 2396, 525, 4164, 29879, 29901, 3808, 29879, 742, 13, 9651, 525, 16394, 2396, 525, 16394, 29918, 24538, 742, 13, 9651, 525, 16394, 1134, 2396, 525, 24538, 742, 13, 9651, 525, 12403, 13391, 2396, 525, 13420, 13, 9651, 525, 25253, 13391, 2396, 525, 3257, 1014, 3257, 742, 13, 9651, 525, 25978, 261, 2318, 2396, 15516, 13, 9651, 525, 1202, 3245, 17761, 2396, 525, 13420, 13, 9651, 525, 11338, 2396, 525, 13420, 13, 9651, 525, 4572, 4195, 2396, 525, 13420, 13, 9651, 525, 3286, 5404, 934, 2396, 4327, 29918, 1445, 29892, 13, 4706, 500, 13, 4706, 1121, 353, 9335, 29918, 27492, 29889, 9772, 29898, 11303, 29889, 13096, 5570, 29889, 3258, 29892, 6796, 29899, 29874, 12436, 4380, 29918, 11739, 29879, 29922, 8824, 29892, 1881, 2433, 29905, 29876, 4286, 7122, 29898, 2080, 5396, 5975, 22130, 13, 4706, 9637, 1627, 29889, 2158, 29918, 11739, 10456, 2914, 29889, 735, 29883, 29918, 3888, 29897, 13, 4706, 4974, 1121, 29889, 13322, 29918, 401, 1275, 29871, 29900, 13, 13, 1678, 396, 306, 4140, 372, 29915, 29879, 6724, 652, 29889, 2344, 580, 363, 9335, 29892, 9335, 29918, 27492, 1838, 29915, 29873, 1065, 2828, 623, 29892, 322, 1014, 5014, 6057, 372, 13, 1678, 822, 1243, 29918, 3258, 29918, 1491, 5014, 29898, 1311, 1125, 13, 4706, 1881, 29918, 1445, 29918, 2084, 353, 679, 29918, 2080, 29918, 1445, 29918, 2084, 877, 28510, 29918, 29879, 2863, 29918, 29906, 29889, 3126, 1495, 13, 4706, 1018, 29901, 13, 9651, 1014, 5014, 29889, 3198, 29918, 4905, 18959, 14748, 742, 525, 4993, 742, 525, 3258, 742, 17411, 29888, 742, 1881, 29918, 1445, 29918, 2084, 1402, 380, 20405, 29922, 1491, 5014, 29889, 1254, 3970, 2692, 29897, 13, 4706, 5174, 1014, 5014, 29889, 29907, 4212, 7032, 2392, 408, 5566, 29901, 13, 9651, 12020, 8960, 29898, 29888, 29915, 5709, 29901, 13515, 6227, 29905, 13996, 277, 775, 426, 735, 29883, 29889, 2457, 401, 1012, 29876, 29912, 735, 29883, 29889, 4905, 29913, 1495, 13, 4706, 411, 1722, 29898, 2080, 29918, 1445, 29918, 2084, 29897, 408, 285, 29901, 13, 9651, 8974, 353, 4390, 29889, 1359, 29898, 29888, 29897, 13, 9651, 363, 2752, 29918, 297, 8974, 29901, 13, 18884, 4974, 2752, 29889, 19033, 29889, 9933, 29898, 29888, 29908, 29912, 4993, 29918, 1839, 978, 2033, 27195, 13, 2 ]
chap02/calc/calc_parser.py
lutzhamel/plipy-code
1
145195
<gh_stars>1-10 ''' Parser for our calc language explist : ({ NUM, PLUS, MINUS, LPAREN } exp)* exp : { NUM } NUM | { PLUS, MINUS } op exp exp | { LPAREN } LPAREN op exp exp ({ NUM, PLUS, MINUS, LPAREN } exp)* RPAREN op : { PLUS } PLUS | { MINUS } MINUS ''' def explist(stream): while stream.pointer().type in ['NUM', 'PLUS', 'MINUS', 'LPAREN']: exp(stream) return def exp(stream): token = stream.pointer() if token.type in ['NUM']: stream.match('NUM') return elif token.type in ['PLUS','MINUS']: op(stream) exp(stream) exp(stream) return elif token.type in ['LPAREN']: stream.match('LPAREN') op(stream) exp(stream) exp(stream) while stream.pointer().type in ['NUM', 'PLUS', 'MINUS', 'LPAREN']: exp(stream) stream.match('RPAREN') else: raise SyntaxError("syntax error at {}".format(token.type)) def op(stream): token = stream.pointer() if token.type in ['PLUS']: stream.match('PLUS') return elif token.type in ['MINUS']: stream.match('MINUS') return else: raise SyntaxError("syntax error at {}".format(token.type)) def parse(): from calc_lexer import Lexer from sys import stdin try: char_stream = stdin.read() # read from stdin token_stream = Lexer(char_stream) explist(token_stream) # call the parser function for start symbol if token_stream.end_of_file(): print("parse successful") else: raise SyntaxError("bad syntax at {}" .format(token_stream.pointer())) except Exception as e: print("error: " + str(e)) if __name__ == "__main__": parse()
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 12008, 13, 11726, 363, 1749, 22235, 4086, 13, 13, 24516, 391, 584, 21313, 28019, 29892, 16507, 3308, 29892, 341, 1177, 3308, 29892, 365, 16320, 1430, 500, 1518, 11877, 13, 13, 4548, 29871, 584, 426, 28019, 500, 28019, 13, 268, 891, 426, 16507, 3308, 29892, 341, 1177, 3308, 500, 1015, 1518, 1518, 13, 268, 891, 426, 365, 16320, 1430, 500, 365, 16320, 1430, 1015, 1518, 1518, 21313, 28019, 29892, 16507, 3308, 29892, 341, 1177, 3308, 29892, 365, 16320, 1430, 500, 1518, 11877, 390, 16320, 1430, 13, 13, 459, 584, 426, 16507, 3308, 500, 16507, 3308, 13, 259, 891, 426, 341, 1177, 3308, 500, 341, 1177, 3308, 13, 12008, 13, 13, 1753, 3902, 391, 29898, 5461, 1125, 13, 1678, 1550, 4840, 29889, 17226, 2141, 1853, 297, 6024, 13967, 742, 525, 7390, 3308, 742, 525, 16173, 3308, 742, 525, 13208, 1718, 1430, 2033, 29901, 13, 4706, 1518, 29898, 5461, 29897, 13, 1678, 736, 13, 13, 1753, 1518, 29898, 5461, 1125, 13, 1678, 5993, 353, 4840, 29889, 17226, 580, 13, 1678, 565, 5993, 29889, 1853, 297, 6024, 13967, 2033, 29901, 13, 4706, 4840, 29889, 4352, 877, 13967, 1495, 13, 4706, 736, 13, 1678, 25342, 5993, 29889, 1853, 297, 6024, 7390, 3308, 3788, 16173, 3308, 2033, 29901, 13, 4706, 1015, 29898, 5461, 29897, 13, 4706, 1518, 29898, 5461, 29897, 13, 4706, 1518, 29898, 5461, 29897, 13, 4706, 736, 13, 1678, 25342, 5993, 29889, 1853, 297, 6024, 13208, 1718, 1430, 2033, 29901, 13, 4706, 4840, 29889, 4352, 877, 13208, 1718, 1430, 1495, 13, 4706, 1015, 29898, 5461, 29897, 13, 4706, 1518, 29898, 5461, 29897, 13, 4706, 1518, 29898, 5461, 29897, 13, 4706, 1550, 4840, 29889, 17226, 2141, 1853, 297, 6024, 13967, 742, 525, 7390, 3308, 742, 525, 16173, 3308, 742, 525, 13208, 1718, 1430, 2033, 29901, 13, 9651, 1518, 29898, 5461, 29897, 13, 4706, 4840, 29889, 4352, 877, 29934, 16320, 1430, 1495, 13, 1678, 1683, 29901, 13, 4706, 12020, 21306, 2392, 703, 29562, 1059, 472, 6571, 1642, 4830, 29898, 6979, 29889, 1853, 876, 13, 13, 1753, 1015, 29898, 5461, 1125, 13, 1678, 5993, 353, 4840, 29889, 17226, 580, 13, 1678, 565, 5993, 29889, 1853, 297, 6024, 7390, 3308, 2033, 29901, 13, 4706, 4840, 29889, 4352, 877, 7390, 3308, 1495, 13, 4706, 736, 13, 1678, 25342, 5993, 29889, 1853, 297, 6024, 16173, 3308, 2033, 29901, 13, 4706, 4840, 29889, 4352, 877, 16173, 3308, 1495, 13, 4706, 736, 13, 1678, 1683, 29901, 13, 4706, 12020, 21306, 2392, 703, 29562, 1059, 472, 6571, 1642, 4830, 29898, 6979, 29889, 1853, 876, 13, 13, 1753, 6088, 7295, 13, 1678, 515, 22235, 29918, 2506, 261, 1053, 15045, 261, 13, 1678, 515, 10876, 1053, 3659, 262, 13, 1678, 1018, 29901, 13, 4706, 1373, 29918, 5461, 353, 3659, 262, 29889, 949, 580, 396, 1303, 515, 3659, 262, 13, 4706, 5993, 29918, 5461, 353, 15045, 261, 29898, 3090, 29918, 5461, 29897, 13, 4706, 3902, 391, 29898, 6979, 29918, 5461, 29897, 396, 1246, 278, 13812, 740, 363, 1369, 5829, 13, 4706, 565, 5993, 29918, 5461, 29889, 355, 29918, 974, 29918, 1445, 7295, 13, 9651, 1596, 703, 5510, 9150, 1159, 13, 4706, 1683, 29901, 13, 9651, 12020, 21306, 2392, 703, 12313, 5877, 472, 426, 5038, 13, 462, 795, 869, 4830, 29898, 6979, 29918, 5461, 29889, 17226, 22130, 13, 1678, 5174, 8960, 408, 321, 29901, 13, 4706, 1596, 703, 2704, 29901, 376, 718, 851, 29898, 29872, 876, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 6088, 580, 13, 2 ]
accounts/admin.py
Muson117/SharedAccountLibrary
0
188642
<reponame>Muson117/SharedAccountLibrary ''' models registered to Django admin interface ''' from django.contrib import admin # Register your models here. from .models import Employee, Account #admin.site.register(Employee) #admin.site.register(Account) @admin.register(Employee) class EmployeeAdmin(admin.ModelAdmin): ''' what to display in admin ''' list_display = ('employee_FirstName', 'employee_LastName') @admin.register(Account) class AccountAdmin(admin.ModelAdmin): ''' what to display in admin ''' list_display = ('account_name', 'status', 'account_taken_by', 'account_taken_at') list_filter = ['status', 'account_taken_at'] exclude = ('account_pass') ''' fieldsets = ( (None, { 'fields': ('account_name','account_pass') }), ('Availability', { 'fields': ('status', 'id') }), ) '''
[ 1, 529, 276, 1112, 420, 29958, 14958, 265, 29896, 29896, 29955, 29914, 21741, 10601, 12284, 13, 12008, 4733, 15443, 304, 15337, 4113, 5067, 14550, 13, 3166, 9557, 29889, 21570, 1053, 4113, 13, 13, 29937, 12577, 596, 4733, 1244, 29889, 13, 3166, 869, 9794, 1053, 24654, 29892, 16535, 13, 13, 29937, 6406, 29889, 2746, 29889, 9573, 29898, 19461, 29897, 13, 29937, 6406, 29889, 2746, 29889, 9573, 29898, 10601, 29897, 13, 13, 29992, 6406, 29889, 9573, 29898, 19461, 29897, 13, 1990, 24654, 12754, 29898, 6406, 29889, 3195, 12754, 1125, 13, 1678, 14550, 825, 304, 2479, 297, 4113, 14550, 13, 1678, 1051, 29918, 4990, 353, 6702, 26143, 29918, 29541, 742, 525, 26143, 29918, 8897, 1170, 1495, 13, 13, 29992, 6406, 29889, 9573, 29898, 10601, 29897, 13, 1990, 16535, 12754, 29898, 6406, 29889, 3195, 12754, 1125, 13, 1678, 14550, 825, 304, 2479, 297, 4113, 14550, 13, 1678, 1051, 29918, 4990, 353, 6702, 10149, 29918, 978, 742, 525, 4882, 742, 525, 10149, 29918, 29873, 9424, 29918, 1609, 742, 525, 10149, 29918, 29873, 9424, 29918, 271, 1495, 13, 1678, 1051, 29918, 4572, 353, 6024, 4882, 742, 525, 10149, 29918, 29873, 9424, 29918, 271, 2033, 13, 1678, 19060, 353, 6702, 10149, 29918, 3364, 1495, 13, 13, 1678, 14550, 13, 1678, 1746, 7224, 353, 313, 13, 4706, 313, 8516, 29892, 426, 13, 9651, 525, 9621, 2396, 6702, 10149, 29918, 978, 3788, 10149, 29918, 3364, 1495, 13, 4706, 500, 511, 13, 4706, 6702, 12810, 737, 3097, 742, 426, 13, 9651, 525, 9621, 2396, 6702, 4882, 742, 525, 333, 1495, 13, 4706, 500, 511, 13, 1678, 1723, 13, 1678, 14550, 13, 2 ]
src/encoded/audit/dataset.py
Lattice-Data/encoded
0
34565
from snovault import ( AuditFailure, audit_checker, ) from .formatter import ( audit_link, path_to_text, ) def audit_contributor_institute(value, system): if value['status'] in ['deleted']: return need_inst = [] if 'corresponding_contributors' in value: for user in value['corresponding_contributors']: if not user.get('institute_name'): need_inst.append(user.get('uuid')) if need_inst: detail = ('Dataset {} contains corresponding_contributors {} that do not have an institute_name.'.format( audit_link(path_to_text(value['@id']), value['@id']), ', '.join(need_inst) ) ) yield AuditFailure('no contributor institute', detail, level='ERROR') need_inst = [] if 'contributors' in value: for user in value['contributors']: if not user.get('institute_name'): need_inst.append(user.get('uuid')) if need_inst: detail = ('Dataset {} contains contributors {} that do not have an institute_name.'.format( audit_link(path_to_text(value['@id']), value['@id']), ', '.join(need_inst) ) ) yield AuditFailure('no contributor institute', detail, level='ERROR') return def audit_contributor_email(value, system): if value['status'] in ['deleted']: return need_email = [] if 'corresponding_contributors' in value: for user in value['corresponding_contributors']: if not user.get('email'): need_email.append(user.get('uuid')) if need_email: detail = ('Dataset {} contains corresponding_contributors {} that do not have an email.'.format( audit_link(path_to_text(value['@id']), value['@id']), ', '.join(need_email) ) ) yield AuditFailure('no corresponding email', detail, level='ERROR') return def audit_contributor_lists(value, system): if value['status'] in ['deleted']: return duplicates = [] if 'contributors' in value and 'corresponding_contributors' in value: for user in value['corresponding_contributors']: if user in value.get('contributors'): duplicates.append(user.get('uuid')) if duplicates: detail = ('Dataset {} contains duplicated contributors {}.'.format( audit_link(path_to_text(value['@id']), value['@id']), ', '.join(duplicates) ) ) yield AuditFailure('duplicated contributors', detail, level='ERROR') return def audit_dataset_no_raw_files(value, system): if value['status'] in ['deleted']: return raw_data = False if 'original_files' in value: for f in value['original_files']: if f['@type'][0] == 'RawSequenceFile' and f['no_file_available'] != True: raw_data = True if raw_data == False: detail = ('Dataset {} does not contain any raw sequence files.'.format( audit_link(path_to_text(value['@id']), value['@id']) ) ) yield AuditFailure('no raw data', detail, level='ERROR') return def audit_dataset_dcp_required_properties(value, system): if value['status'] in ['deleted']: return dcp_reqs = ['dataset_title', 'description', 'funding_organizations'] for req in dcp_reqs: if req not in value: detail = ('Dataset {} does not have {}, required by the DCP.'.format( audit_link(path_to_text(value['@id']), value['@id']), req ) ) yield AuditFailure('missing DCP-required field', detail, level='ERROR') dcp_optional = ['corresponding_contributors', 'contributors'] for opt in dcp_optional: if opt not in value: detail = ('Dataset {} does not have {}, strongly encouraged by the DCP.'.format( audit_link(path_to_text(value['@id']), value['@id']), opt ) ) yield AuditFailure('missing DCP-encouraged field', detail, level='ERROR') return def audit_experiment_released_with_unreleased_files(value, system): ''' A released experiment should not have unreleased files ''' if value['status'] != 'released': return if 'original_files' not in value: return for f in value['original_files']: if f['status'] not in ['released', 'deleted', 'revoked', 'replaced', 'archived']: detail = ('Released dataset {} contains file {} that has not been released.'.format( audit_link(path_to_text(value['@id']), value['@id']), audit_link(path_to_text(f['@id']), f['@id']) ) ) yield AuditFailure('mismatched file status', detail, level='INTERNAL_ACTION') return function_dispatcher_with_files = { 'audit_contributor_institute': audit_contributor_institute, 'audit_contributor_email': audit_contributor_email, 'audit_contributor_lists': audit_contributor_lists, 'audit_dataset_no_raw_files': audit_dataset_no_raw_files, 'audit_dataset_dcp_required_properties': audit_dataset_dcp_required_properties, 'audit_released_with_unreleased_files': audit_experiment_released_with_unreleased_files } @audit_checker('Dataset', frame=['original_files', 'corresponding_contributors', 'contributors']) def audit_experiment(value, system): for function_name in function_dispatcher_with_files.keys(): yield from function_dispatcher_with_files[function_name](value, system) return
[ 1, 515, 5807, 586, 1292, 1053, 313, 13, 1678, 8612, 277, 24155, 29892, 13, 1678, 12990, 277, 29918, 3198, 261, 29892, 13, 29897, 13, 3166, 869, 689, 2620, 1053, 313, 13, 1678, 12990, 277, 29918, 2324, 29892, 13, 1678, 2224, 29918, 517, 29918, 726, 29892, 13, 29897, 13, 13, 13, 1753, 12990, 277, 29918, 21570, 3406, 29918, 2611, 12356, 29898, 1767, 29892, 1788, 1125, 13, 1678, 565, 995, 1839, 4882, 2033, 297, 6024, 311, 22742, 2033, 29901, 13, 4706, 736, 13, 13, 1678, 817, 29918, 2611, 353, 5159, 13, 1678, 565, 525, 2616, 3636, 292, 29918, 21570, 29560, 29915, 297, 995, 29901, 13, 4706, 363, 1404, 297, 995, 1839, 2616, 3636, 292, 29918, 21570, 29560, 2033, 29901, 13, 9651, 565, 451, 1404, 29889, 657, 877, 2611, 12356, 29918, 978, 29374, 13, 18884, 817, 29918, 2611, 29889, 4397, 29898, 1792, 29889, 657, 877, 25118, 8785, 13, 1678, 565, 817, 29918, 2611, 29901, 13, 4706, 9493, 353, 6702, 16390, 24541, 6571, 3743, 6590, 29918, 21570, 29560, 6571, 393, 437, 451, 505, 385, 832, 12356, 29918, 978, 29889, 4286, 4830, 29898, 13, 18884, 12990, 277, 29918, 2324, 29898, 2084, 29918, 517, 29918, 726, 29898, 1767, 1839, 29992, 333, 2033, 511, 995, 1839, 29992, 333, 2033, 511, 13, 18884, 13420, 15300, 7122, 29898, 26180, 29918, 2611, 29897, 13, 9651, 1723, 13, 4706, 1723, 13, 4706, 7709, 8612, 277, 24155, 877, 1217, 17737, 3406, 832, 12356, 742, 9493, 29892, 3233, 2433, 11432, 1495, 13, 13, 1678, 817, 29918, 2611, 353, 5159, 13, 1678, 565, 525, 21570, 29560, 29915, 297, 995, 29901, 13, 4706, 363, 1404, 297, 995, 1839, 21570, 29560, 2033, 29901, 13, 9651, 565, 451, 1404, 29889, 657, 877, 2611, 12356, 29918, 978, 29374, 13, 18884, 817, 29918, 2611, 29889, 4397, 29898, 1792, 29889, 657, 877, 25118, 8785, 13, 1678, 565, 817, 29918, 2611, 29901, 13, 4706, 9493, 353, 6702, 16390, 24541, 6571, 3743, 17737, 29560, 6571, 393, 437, 451, 505, 385, 832, 12356, 29918, 978, 29889, 4286, 4830, 29898, 13, 18884, 12990, 277, 29918, 2324, 29898, 2084, 29918, 517, 29918, 726, 29898, 1767, 1839, 29992, 333, 2033, 511, 995, 1839, 29992, 333, 2033, 511, 13, 18884, 13420, 15300, 7122, 29898, 26180, 29918, 2611, 29897, 13, 9651, 1723, 13, 4706, 1723, 13, 4706, 7709, 8612, 277, 24155, 877, 1217, 17737, 3406, 832, 12356, 742, 9493, 29892, 3233, 2433, 11432, 1495, 13, 1678, 736, 13, 13, 13, 1753, 12990, 277, 29918, 21570, 3406, 29918, 5269, 29898, 1767, 29892, 1788, 1125, 13, 1678, 565, 995, 1839, 4882, 2033, 297, 6024, 311, 22742, 2033, 29901, 13, 4706, 736, 13, 13, 1678, 817, 29918, 5269, 353, 5159, 13, 1678, 565, 525, 2616, 3636, 292, 29918, 21570, 29560, 29915, 297, 995, 29901, 13, 4706, 363, 1404, 297, 995, 1839, 2616, 3636, 292, 29918, 21570, 29560, 2033, 29901, 13, 9651, 565, 451, 1404, 29889, 657, 877, 5269, 29374, 13, 18884, 817, 29918, 5269, 29889, 4397, 29898, 1792, 29889, 657, 877, 25118, 8785, 13, 1678, 565, 817, 29918, 5269, 29901, 13, 4706, 9493, 353, 6702, 16390, 24541, 6571, 3743, 6590, 29918, 21570, 29560, 6571, 393, 437, 451, 505, 385, 4876, 29889, 4286, 4830, 29898, 13, 18884, 12990, 277, 29918, 2324, 29898, 2084, 29918, 517, 29918, 726, 29898, 1767, 1839, 29992, 333, 2033, 511, 995, 1839, 29992, 333, 2033, 511, 13, 18884, 13420, 15300, 7122, 29898, 26180, 29918, 5269, 29897, 13, 9651, 1723, 13, 4706, 1723, 13, 4706, 7709, 8612, 277, 24155, 877, 1217, 6590, 4876, 742, 9493, 29892, 3233, 2433, 11432, 1495, 13, 1678, 736, 13, 13, 13, 1753, 12990, 277, 29918, 21570, 3406, 29918, 21513, 29898, 1767, 29892, 1788, 1125, 13, 1678, 565, 995, 1839, 4882, 2033, 297, 6024, 311, 22742, 2033, 29901, 13, 4706, 736, 13, 13, 1678, 20955, 353, 5159, 13, 1678, 565, 525, 21570, 29560, 29915, 297, 995, 322, 525, 2616, 3636, 292, 29918, 21570, 29560, 29915, 297, 995, 29901, 13, 4706, 363, 1404, 297, 995, 1839, 2616, 3636, 292, 29918, 21570, 29560, 2033, 29901, 13, 9651, 565, 1404, 297, 995, 29889, 657, 877, 21570, 29560, 29374, 13, 18884, 20955, 29889, 4397, 29898, 1792, 29889, 657, 877, 25118, 8785, 13, 1678, 565, 20955, 29901, 13, 4706, 9493, 353, 6702, 16390, 24541, 6571, 3743, 5141, 9169, 17737, 29560, 426, 1836, 4286, 4830, 29898, 13, 18884, 12990, 277, 29918, 2324, 29898, 2084, 29918, 517, 29918, 726, 29898, 1767, 1839, 29992, 333, 2033, 511, 995, 1839, 29992, 333, 2033, 511, 13, 18884, 13420, 15300, 7122, 29898, 20908, 15815, 29897, 13, 9651, 1723, 13, 4706, 1723, 13, 4706, 7709, 8612, 277, 24155, 877, 20908, 9169, 17737, 29560, 742, 9493, 29892, 3233, 2433, 11432, 1495, 13, 1678, 736, 13, 13, 13, 1753, 12990, 277, 29918, 24713, 29918, 1217, 29918, 1610, 29918, 5325, 29898, 1767, 29892, 1788, 1125, 13, 1678, 565, 995, 1839, 4882, 2033, 297, 6024, 311, 22742, 2033, 29901, 13, 4706, 736, 13, 13, 1678, 10650, 29918, 1272, 353, 7700, 13, 1678, 565, 525, 13492, 29918, 5325, 29915, 297, 995, 29901, 13, 4706, 363, 285, 297, 995, 1839, 13492, 29918, 5325, 2033, 29901, 13, 9651, 565, 285, 1839, 29992, 1853, 2033, 29961, 29900, 29962, 1275, 525, 22131, 20529, 2283, 29915, 322, 285, 1839, 1217, 29918, 1445, 29918, 16515, 2033, 2804, 5852, 29901, 13, 18884, 10650, 29918, 1272, 353, 5852, 13, 1678, 565, 10650, 29918, 1272, 1275, 7700, 29901, 13, 4706, 9493, 353, 6702, 16390, 24541, 6571, 947, 451, 1712, 738, 10650, 5665, 2066, 29889, 4286, 4830, 29898, 13, 18884, 12990, 277, 29918, 2324, 29898, 2084, 29918, 517, 29918, 726, 29898, 1767, 1839, 29992, 333, 2033, 511, 995, 1839, 29992, 333, 11287, 13, 9651, 1723, 13, 4706, 1723, 13, 4706, 7709, 8612, 277, 24155, 877, 1217, 10650, 848, 742, 9493, 29892, 3233, 2433, 11432, 1495, 13, 1678, 736, 13, 13, 13, 1753, 12990, 277, 29918, 24713, 29918, 29881, 6814, 29918, 12403, 29918, 11330, 29898, 1767, 29892, 1788, 1125, 13, 1678, 565, 995, 1839, 4882, 2033, 297, 6024, 311, 22742, 2033, 29901, 13, 4706, 736, 13, 13, 1678, 270, 6814, 29918, 7971, 29879, 353, 6024, 24713, 29918, 3257, 742, 525, 8216, 742, 525, 27159, 292, 29918, 6388, 17063, 2033, 13, 1678, 363, 12428, 297, 270, 6814, 29918, 7971, 29879, 29901, 13, 4706, 565, 12428, 451, 297, 995, 29901, 13, 9651, 9493, 353, 6702, 16390, 24541, 6571, 947, 451, 505, 24335, 3734, 491, 278, 360, 6271, 29889, 4286, 4830, 29898, 13, 462, 1678, 12990, 277, 29918, 2324, 29898, 2084, 29918, 517, 29918, 726, 29898, 1767, 1839, 29992, 333, 2033, 511, 995, 1839, 29992, 333, 2033, 511, 13, 462, 1678, 12428, 13, 18884, 1723, 13, 9651, 1723, 13, 9651, 7709, 8612, 277, 24155, 877, 27259, 360, 6271, 29899, 12403, 1746, 742, 9493, 29892, 3233, 2433, 11432, 1495, 13, 1678, 270, 6814, 29918, 25253, 353, 6024, 2616, 3636, 292, 29918, 21570, 29560, 742, 525, 21570, 29560, 2033, 13, 1678, 363, 3523, 297, 270, 6814, 29918, 25253, 29901, 13, 4706, 565, 3523, 451, 297, 995, 29901, 13, 9651, 9493, 353, 6702, 16390, 24541, 6571, 947, 451, 505, 24335, 13818, 18443, 287, 491, 278, 360, 6271, 29889, 4286, 4830, 29898, 13, 462, 1678, 12990, 277, 29918, 2324, 29898, 2084, 29918, 517, 29918, 726, 29898, 1767, 1839, 29992, 333, 2033, 511, 995, 1839, 29992, 333, 2033, 511, 13, 462, 1678, 3523, 13, 18884, 1723, 13, 9651, 1723, 13, 9651, 7709, 8612, 277, 24155, 877, 27259, 360, 6271, 29899, 3977, 283, 1431, 287, 1746, 742, 9493, 29892, 3233, 2433, 11432, 1495, 13, 1678, 736, 13, 13, 13, 1753, 12990, 277, 29918, 735, 15362, 29918, 276, 4611, 29918, 2541, 29918, 348, 276, 4611, 29918, 5325, 29898, 1767, 29892, 1788, 1125, 13, 1678, 14550, 13, 1678, 319, 5492, 7639, 881, 451, 505, 443, 276, 4611, 2066, 13, 1678, 14550, 13, 1678, 565, 995, 1839, 4882, 2033, 2804, 525, 276, 4611, 2396, 13, 4706, 736, 13, 1678, 565, 525, 13492, 29918, 5325, 29915, 451, 297, 995, 29901, 13, 4706, 736, 13, 1678, 363, 285, 297, 995, 1839, 13492, 29918, 5325, 2033, 29901, 13, 4706, 565, 285, 1839, 4882, 2033, 451, 297, 6024, 276, 4611, 742, 525, 311, 22742, 742, 13, 462, 1669, 525, 13478, 12504, 742, 525, 3445, 433, 1133, 742, 13, 462, 1669, 525, 1279, 2347, 2033, 29901, 13, 9651, 9493, 353, 6702, 1123, 4611, 8783, 6571, 3743, 934, 6571, 393, 756, 451, 1063, 5492, 29889, 4286, 4830, 29898, 13, 462, 1678, 12990, 277, 29918, 2324, 29898, 2084, 29918, 517, 29918, 726, 29898, 1767, 1839, 29992, 333, 2033, 511, 995, 1839, 29992, 333, 2033, 511, 13, 462, 1678, 12990, 277, 29918, 2324, 29898, 2084, 29918, 517, 29918, 726, 29898, 29888, 1839, 29992, 333, 2033, 511, 285, 1839, 29992, 333, 11287, 13, 18884, 1723, 13, 9651, 1723, 13, 9651, 7709, 8612, 277, 24155, 877, 29885, 1608, 905, 287, 934, 4660, 742, 9493, 29892, 3233, 2433, 23845, 29940, 1964, 29918, 24705, 1495, 13, 1678, 736, 13, 13, 13, 2220, 29918, 13369, 261, 29918, 2541, 29918, 5325, 353, 426, 13, 1678, 525, 15052, 277, 29918, 21570, 3406, 29918, 2611, 12356, 2396, 12990, 277, 29918, 21570, 3406, 29918, 2611, 12356, 29892, 13, 1678, 525, 15052, 277, 29918, 21570, 3406, 29918, 5269, 2396, 12990, 277, 29918, 21570, 3406, 29918, 5269, 29892, 13, 1678, 525, 15052, 277, 29918, 21570, 3406, 29918, 21513, 2396, 12990, 277, 29918, 21570, 3406, 29918, 21513, 29892, 13, 1678, 525, 15052, 277, 29918, 24713, 29918, 1217, 29918, 1610, 29918, 5325, 2396, 12990, 277, 29918, 24713, 29918, 1217, 29918, 1610, 29918, 5325, 29892, 13, 1678, 525, 15052, 277, 29918, 24713, 29918, 29881, 6814, 29918, 12403, 29918, 11330, 2396, 12990, 277, 29918, 24713, 29918, 29881, 6814, 29918, 12403, 29918, 11330, 29892, 13, 1678, 525, 15052, 277, 29918, 276, 4611, 29918, 2541, 29918, 348, 276, 4611, 29918, 5325, 2396, 12990, 277, 29918, 735, 15362, 29918, 276, 4611, 29918, 2541, 29918, 348, 276, 4611, 29918, 5325, 13, 29913, 13, 13, 29992, 15052, 277, 29918, 3198, 261, 877, 16390, 24541, 742, 13, 1669, 3515, 29922, 1839, 13492, 29918, 5325, 742, 13, 462, 1678, 525, 2616, 3636, 292, 29918, 21570, 29560, 742, 13, 462, 1678, 525, 21570, 29560, 11287, 13, 1753, 12990, 277, 29918, 735, 15362, 29898, 1767, 29892, 1788, 1125, 13, 1678, 363, 740, 29918, 978, 297, 740, 29918, 13369, 261, 29918, 2541, 29918, 5325, 29889, 8149, 7295, 13, 4706, 7709, 515, 740, 29918, 13369, 261, 29918, 2541, 29918, 5325, 29961, 2220, 29918, 978, 850, 1767, 29892, 1788, 29897, 13, 1678, 736, 13, 2 ]
src/simmate/website/core_components/filters/symmetry.py
laurenmm/simmate-1
9
73930
<filename>src/simmate/website/core_components/filters/symmetry.py # -*- coding: utf-8 -*- from django_filters import rest_framework as filters from simmate.database.base_data_types import Spacegroup as SpacegroupTable class Spacegroup(filters.FilterSet): class Meta: model = SpacegroupTable fields = dict( number=["exact", "range"], symbol=["exact"], crystal_system=["exact"], point_group=["exact"], )
[ 1, 529, 9507, 29958, 4351, 29914, 3601, 25046, 29914, 22942, 29914, 3221, 29918, 14036, 29914, 26705, 29914, 11967, 2527, 719, 29889, 2272, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 13, 3166, 9557, 29918, 26705, 1053, 1791, 29918, 4468, 408, 18094, 13, 13, 3166, 1027, 25046, 29889, 9803, 29889, 3188, 29918, 1272, 29918, 8768, 1053, 14121, 2972, 408, 14121, 2972, 3562, 13, 13, 13, 1990, 14121, 2972, 29898, 26705, 29889, 5072, 2697, 1125, 13, 1678, 770, 20553, 29901, 13, 4706, 1904, 353, 14121, 2972, 3562, 13, 4706, 4235, 353, 9657, 29898, 13, 9651, 1353, 29922, 3366, 735, 627, 613, 376, 3881, 12436, 13, 9651, 5829, 29922, 3366, 735, 627, 12436, 13, 9651, 10901, 11195, 29918, 5205, 29922, 3366, 735, 627, 12436, 13, 9651, 1298, 29918, 2972, 29922, 3366, 735, 627, 12436, 13, 4706, 1723, 13, 2 ]
happy_holding_server/db.py
gracewgao/happy-holding
1
122870
import os import sqlite3 from flask import current_app, g BASE_DIR = os.path.dirname(os.path.abspath(__file__)) DATABASE = os.path.join(BASE_DIR, "data/database.db") def get_db(): db = getattr(g, '_database', None) if db is None: db = g._database = sqlite3.connect(DATABASE) return db def close_connection(exception): db = getattr(g, '_database', None) if db is not None: db.close() def init_app(app): app.teardown_appcontext(close_connection)
[ 1, 1053, 2897, 13, 5215, 21120, 29941, 13, 13, 3166, 29784, 1053, 1857, 29918, 932, 29892, 330, 13, 13, 25416, 29918, 9464, 353, 2897, 29889, 2084, 29889, 25721, 29898, 359, 29889, 2084, 29889, 370, 1028, 493, 22168, 1445, 1649, 876, 13, 25832, 27982, 353, 2897, 29889, 2084, 29889, 7122, 29898, 25416, 29918, 9464, 29892, 376, 1272, 29914, 9803, 29889, 2585, 1159, 13, 13, 1753, 679, 29918, 2585, 7295, 13, 1678, 4833, 353, 679, 5552, 29898, 29887, 29892, 22868, 9803, 742, 6213, 29897, 13, 1678, 565, 4833, 338, 6213, 29901, 13, 4706, 4833, 353, 330, 3032, 9803, 353, 21120, 29941, 29889, 6915, 29898, 25832, 27982, 29897, 13, 1678, 736, 4833, 13, 13, 1753, 3802, 29918, 9965, 29898, 11739, 1125, 13, 1678, 4833, 353, 679, 5552, 29898, 29887, 29892, 22868, 9803, 742, 6213, 29897, 13, 1678, 565, 4833, 338, 451, 6213, 29901, 13, 4706, 4833, 29889, 5358, 580, 13, 13, 1753, 2069, 29918, 932, 29898, 932, 1125, 13, 1678, 623, 29889, 371, 538, 776, 29918, 932, 4703, 29898, 5358, 29918, 9965, 29897, 13, 2 ]
datasets/YelpDataset.py
aatifjiwani/yelp-rating-predictor
0
156098
import numpy as np from torch.utils.data import Dataset import jsonlines import json import random from tqdm import tqdm import pandas as pd try: from vocab_gen import * except ImportError: from datasets.vocab_gen import * class YelpDataset(Dataset): def __init__(self, jsonl_file:str, tokenizer=None, max_len:int = 50, is_from_partition=False, add_cls=False, should_stem=True, using_pandas=False, using_bpe=False): self.jsonl_file = jsonl_file self.eval_df = None self.reviews = [] self.tokenizer = tokenizer self.max_len = max_len self.should_stem = should_stem self.add_cls = add_cls if using_pandas: self.train_df = pd.read_json(jsonl_file, lines=True) self.train_df['label'] = self.train_df.iloc[:, 2] self.train_df['text'] = self.train_df['text'].apply(clean_sentence) self.train_df['label'] = self.train_df['label'].apply(lambda x: x-1) self.train_df = self.train_df.drop(self.train_df.columns[[0, 2]], axis=1) print(self.train_df) else: with jsonlines.open(self.jsonl_file) as reader: for obj in reader.iter(type=dict, skip_invalid=True): if is_from_partition: self.reviews.append({"input": obj["input"], "label": obj["label"]}) else: rating = obj["stars"] review = obj["text"] self.reviews.append({"input": review, "label": rating}) print("dataset loaded...") def __len__(self): return len(self.reviews) def __getitem__(self, idx): assert self.tokenizer is not None, "tokenizer must be passed in during instantiation" sample = self.reviews[idx] review, stars = sample["input"], int(sample["label"]) review = self.tokenizer.tokenize2Index(review, self.should_stem)[:self.max_len] if (len(review) < self.max_len): review += [PAD_TOKEN]*(self.max_len-len(review)) if self.add_cls: review = [len(self.tokenizer.word2Index)] + [x + 1 for x in review] #SET CLS TOKEN TO 0 AND PUSH EVERYTHING DOWN BY 1 return {"input": np.array(review), "label": np.array(stars - 1)} def getFromText(review, tokenizer, max_len=1000, should_stem=True): review = tokenizer.tokenize2Index(review, should_stem)[:max_len] if (len(review) < max_len): review += [PAD_TOKEN]*(max_len-len(review)) return np.array(review) def split_dataset(self, training_partition: float, training_file: str, validation_file: str): assert training_partition > 0 and training_partition < 1, "Training partition must be a float between 0 and 1 non-exclusive" num_train_examples = int(training_partition * len(self.reviews)) random.shuffle(self.reviews) training_partition = self.reviews[:num_train_examples] val_partition = self.reviews[num_train_examples:] with open(training_file, "w+") as train_f: for rev in tqdm(training_partition): json.dump(rev, train_f) train_f.write("\n") with open(validation_file, "w+") as val_f: for rev in tqdm(val_partition): json.dump(rev, val_f) val_f.write("\n") def make_datasets(self, tokenizer, max_length, x_path, y_path): x_train, y_train, x_val, y_val = [],[],[],[] num_reviews = len(self.reviews) for i in range(num_reviews): rating_vector = [0,0,0,0,0] rating_vector[int(self.reviews[i]["label"])-1] = 1 sequenced_review = tokenizer.tokenize2Index(self.reviews[i]["input"]) if len(sequenced_review) > max_length: sequenced_review = sequenced_review[:max_length] elif len(sequenced_review) < max_length: sequenced_review += [PAD_TOKEN]*(max_length-len(sequenced_review)) sequenced_review = [int(x) for x in sequenced_review] x_train.append(sequenced_review) y_train.append(rating_vector) np.savetxt(x_path, x_train, fmt ='%4d') np.savetxt(y_path, y_train, fmt='%4d') return np.asarray(x_train), np.asarray(y_train) def make_eval_pandas(self, num): file = "../datasets/yelp_challenge_" + str(num) + "_with_answers.jsonl" self.eval_df = pd.read_json(file, lines=True) self.eval_df['label'] = self.eval_df.iloc[:, 2] self.eval_df['text'] = self.eval_df['text'].apply(clean_sentence) self.eval_df['label'] = self.eval_df['label'].apply(lambda x: x - 1) self.eval_df = self.eval_df.drop(self.eval_df.columns[[0, 2]], axis=1) print(self.eval_df) if __name__ == "__main__": training_yelp = YelpDataset("yelp_review_training_dataset.jsonl", tokenizer=None, max_len=1000, is_from_partition=False, add_cls=False) # with open("cleaned_reviews.txt", "w+") as f: len_words = 0 count = 0 for rev in tqdm(training_yelp.reviews): cleaned_review = clean_sentence(rev["input"].lower()).split() len_words += len(cleaned_review) count += 1 print(len_words / count)
[ 1, 1053, 12655, 408, 7442, 13, 3166, 4842, 305, 29889, 13239, 29889, 1272, 1053, 13373, 24541, 13, 5215, 4390, 9012, 13, 5215, 4390, 13, 5215, 4036, 13, 3166, 260, 29939, 18933, 1053, 260, 29939, 18933, 13, 5215, 11701, 408, 10518, 13, 13, 2202, 29901, 13, 1678, 515, 7931, 370, 29918, 1885, 1053, 334, 13, 19499, 16032, 2392, 29901, 13, 1678, 515, 20035, 29889, 29894, 542, 370, 29918, 1885, 1053, 334, 13, 13, 1990, 612, 295, 29886, 16390, 24541, 29898, 16390, 24541, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 4390, 29880, 29918, 1445, 29901, 710, 29892, 5993, 3950, 29922, 8516, 29892, 4236, 29918, 2435, 29901, 524, 353, 29871, 29945, 29900, 29892, 338, 29918, 3166, 29918, 16707, 29922, 8824, 29892, 788, 29918, 25932, 29922, 8824, 29892, 29871, 13, 18884, 881, 29918, 303, 331, 29922, 5574, 29892, 773, 29918, 15112, 29922, 8824, 29892, 773, 29918, 29890, 412, 29922, 8824, 1125, 13, 4706, 1583, 29889, 3126, 29880, 29918, 1445, 353, 4390, 29880, 29918, 1445, 13, 4706, 1583, 29889, 14513, 29918, 2176, 353, 6213, 13, 4706, 1583, 29889, 276, 7406, 353, 5159, 13, 4706, 1583, 29889, 6979, 3950, 353, 5993, 3950, 13, 4706, 1583, 29889, 3317, 29918, 2435, 353, 4236, 29918, 2435, 13, 4706, 1583, 29889, 9344, 29918, 303, 331, 353, 881, 29918, 303, 331, 13, 4706, 1583, 29889, 1202, 29918, 25932, 353, 788, 29918, 25932, 13, 13, 4706, 565, 773, 29918, 15112, 29901, 13, 9651, 1583, 29889, 14968, 29918, 2176, 353, 10518, 29889, 949, 29918, 3126, 29898, 3126, 29880, 29918, 1445, 29892, 3454, 29922, 5574, 29897, 13, 9651, 1583, 29889, 14968, 29918, 2176, 1839, 1643, 2033, 353, 1583, 29889, 14968, 29918, 2176, 29889, 309, 542, 7503, 29892, 29871, 29906, 29962, 13, 9651, 1583, 29889, 14968, 29918, 2176, 1839, 726, 2033, 353, 1583, 29889, 14968, 29918, 2176, 1839, 726, 13359, 7302, 29898, 14941, 29918, 18616, 663, 29897, 13, 9651, 1583, 29889, 14968, 29918, 2176, 1839, 1643, 2033, 353, 1583, 29889, 14968, 29918, 2176, 1839, 1643, 13359, 7302, 29898, 2892, 921, 29901, 921, 29899, 29896, 29897, 13, 9651, 1583, 29889, 14968, 29918, 2176, 353, 1583, 29889, 14968, 29918, 2176, 29889, 8865, 29898, 1311, 29889, 14968, 29918, 2176, 29889, 13099, 8999, 29900, 29892, 29871, 29906, 20526, 9685, 29922, 29896, 29897, 13, 9651, 1596, 29898, 1311, 29889, 14968, 29918, 2176, 29897, 13, 4706, 1683, 29901, 13, 9651, 411, 4390, 9012, 29889, 3150, 29898, 1311, 29889, 3126, 29880, 29918, 1445, 29897, 408, 9591, 29901, 13, 18884, 363, 5446, 297, 9591, 29889, 1524, 29898, 1853, 29922, 8977, 29892, 14383, 29918, 20965, 29922, 5574, 1125, 13, 462, 1678, 565, 338, 29918, 3166, 29918, 16707, 29901, 13, 462, 4706, 1583, 29889, 276, 7406, 29889, 4397, 3319, 29908, 2080, 1115, 5446, 3366, 2080, 12436, 376, 1643, 1115, 5446, 3366, 1643, 3108, 1800, 13, 462, 1678, 1683, 29901, 13, 462, 4706, 21700, 353, 5446, 3366, 303, 1503, 3108, 13, 462, 4706, 9076, 353, 5446, 3366, 726, 3108, 13, 13, 462, 4706, 1583, 29889, 276, 7406, 29889, 4397, 3319, 29908, 2080, 1115, 9076, 29892, 376, 1643, 1115, 21700, 1800, 13, 13, 13, 4706, 1596, 703, 24713, 7500, 856, 1159, 13, 13, 1678, 822, 4770, 2435, 12035, 1311, 1125, 13, 4706, 736, 7431, 29898, 1311, 29889, 276, 7406, 29897, 13, 13, 1678, 822, 4770, 657, 667, 12035, 1311, 29892, 22645, 1125, 13, 4706, 4974, 1583, 29889, 6979, 3950, 338, 451, 6213, 29892, 376, 6979, 3950, 1818, 367, 4502, 297, 2645, 13213, 362, 29908, 13, 13, 4706, 4559, 353, 29871, 1583, 29889, 276, 7406, 29961, 13140, 29962, 13, 4706, 9076, 29892, 10819, 353, 4559, 3366, 2080, 12436, 938, 29898, 11249, 3366, 1643, 20068, 13, 13, 4706, 9076, 353, 1583, 29889, 6979, 3950, 29889, 6979, 675, 29906, 3220, 29898, 27828, 29892, 1583, 29889, 9344, 29918, 303, 331, 29897, 7503, 1311, 29889, 3317, 29918, 2435, 29962, 13, 4706, 565, 313, 2435, 29898, 27828, 29897, 529, 1583, 29889, 3317, 29918, 2435, 1125, 13, 9651, 9076, 4619, 518, 29925, 3035, 29918, 4986, 29968, 1430, 14178, 29898, 1311, 29889, 3317, 29918, 2435, 29899, 2435, 29898, 27828, 876, 13, 13, 4706, 565, 1583, 29889, 1202, 29918, 25932, 29901, 13, 9651, 9076, 353, 518, 2435, 29898, 1311, 29889, 6979, 3950, 29889, 1742, 29906, 3220, 4638, 718, 518, 29916, 718, 29871, 29896, 363, 921, 297, 9076, 29962, 396, 10490, 315, 8547, 7495, 29968, 1430, 7495, 29871, 29900, 5300, 349, 3308, 29950, 382, 5348, 29979, 4690, 4214, 360, 9806, 29940, 6770, 29871, 29896, 13, 13, 4706, 736, 8853, 2080, 1115, 7442, 29889, 2378, 29898, 27828, 511, 376, 1643, 1115, 7442, 29889, 2378, 29898, 303, 1503, 448, 29871, 29896, 2915, 13, 13, 1678, 822, 679, 4591, 1626, 29898, 27828, 29892, 5993, 3950, 29892, 4236, 29918, 2435, 29922, 29896, 29900, 29900, 29900, 29892, 881, 29918, 303, 331, 29922, 5574, 1125, 12, 13, 4706, 9076, 353, 5993, 3950, 29889, 6979, 675, 29906, 3220, 29898, 27828, 29892, 881, 29918, 303, 331, 29897, 7503, 3317, 29918, 2435, 29962, 12, 13, 4706, 565, 313, 2435, 29898, 27828, 29897, 529, 4236, 29918, 2435, 1125, 12, 13, 9651, 9076, 4619, 518, 29925, 3035, 29918, 4986, 29968, 1430, 14178, 29898, 3317, 29918, 2435, 29899, 2435, 29898, 27828, 876, 12, 13, 13, 4706, 736, 7442, 29889, 2378, 29898, 27828, 29897, 13, 13, 1678, 822, 6219, 29918, 24713, 29898, 1311, 29892, 6694, 29918, 16707, 29901, 5785, 29892, 6694, 29918, 1445, 29901, 851, 29892, 8845, 29918, 1445, 29901, 851, 1125, 13, 4706, 4974, 6694, 29918, 16707, 1405, 29871, 29900, 322, 6694, 29918, 16707, 529, 29871, 29896, 29892, 376, 5323, 2827, 8877, 1818, 367, 263, 5785, 1546, 29871, 29900, 322, 29871, 29896, 1661, 29899, 735, 7009, 573, 29908, 13, 13, 4706, 954, 29918, 14968, 29918, 19057, 353, 938, 29898, 26495, 29918, 16707, 334, 7431, 29898, 1311, 29889, 276, 7406, 876, 13, 13, 4706, 4036, 29889, 845, 21897, 29898, 1311, 29889, 276, 7406, 29897, 13, 13, 4706, 6694, 29918, 16707, 353, 1583, 29889, 276, 7406, 7503, 1949, 29918, 14968, 29918, 19057, 29962, 13, 4706, 659, 29918, 16707, 353, 1583, 29889, 276, 7406, 29961, 1949, 29918, 14968, 29918, 19057, 17531, 13, 13, 4706, 411, 1722, 29898, 26495, 29918, 1445, 29892, 376, 29893, 29974, 1159, 408, 7945, 29918, 29888, 29901, 13, 9651, 363, 6664, 297, 260, 29939, 18933, 29898, 26495, 29918, 16707, 1125, 13, 18884, 4390, 29889, 15070, 29898, 13478, 29892, 7945, 29918, 29888, 29897, 13, 18884, 7945, 29918, 29888, 29889, 3539, 14182, 29876, 1159, 13, 13, 4706, 411, 1722, 29898, 18157, 29918, 1445, 29892, 376, 29893, 29974, 1159, 408, 659, 29918, 29888, 29901, 13, 9651, 363, 6664, 297, 260, 29939, 18933, 29898, 791, 29918, 16707, 1125, 13, 18884, 4390, 29889, 15070, 29898, 13478, 29892, 659, 29918, 29888, 29897, 13, 18884, 659, 29918, 29888, 29889, 3539, 14182, 29876, 1159, 13, 13, 1678, 822, 1207, 29918, 14538, 1691, 29898, 1311, 29892, 5993, 3950, 29892, 4236, 29918, 2848, 29892, 921, 29918, 2084, 29892, 343, 29918, 2084, 1125, 13, 4706, 921, 29918, 14968, 29892, 343, 29918, 14968, 29892, 921, 29918, 791, 29892, 343, 29918, 791, 353, 518, 16272, 16272, 1402, 2636, 13, 4706, 954, 29918, 276, 7406, 353, 7431, 29898, 1311, 29889, 276, 7406, 29897, 13, 4706, 363, 474, 297, 3464, 29898, 1949, 29918, 276, 7406, 1125, 13, 9651, 21700, 29918, 8111, 353, 518, 29900, 29892, 29900, 29892, 29900, 29892, 29900, 29892, 29900, 29962, 13, 9651, 21700, 29918, 8111, 29961, 524, 29898, 1311, 29889, 276, 7406, 29961, 29875, 29962, 3366, 1643, 20068, 29899, 29896, 29962, 353, 29871, 29896, 13, 9651, 8617, 9223, 29918, 27828, 353, 5993, 3950, 29889, 6979, 675, 29906, 3220, 29898, 1311, 29889, 276, 7406, 29961, 29875, 29962, 3366, 2080, 20068, 13, 9651, 565, 7431, 29898, 6831, 9223, 29918, 27828, 29897, 1405, 4236, 29918, 2848, 29901, 13, 18884, 8617, 9223, 29918, 27828, 353, 8617, 9223, 29918, 27828, 7503, 3317, 29918, 2848, 29962, 13, 9651, 25342, 7431, 29898, 6831, 9223, 29918, 27828, 29897, 529, 4236, 29918, 2848, 29901, 13, 18884, 8617, 9223, 29918, 27828, 4619, 518, 29925, 3035, 29918, 4986, 29968, 1430, 14178, 29898, 3317, 29918, 2848, 29899, 2435, 29898, 6831, 9223, 29918, 27828, 876, 13, 9651, 8617, 9223, 29918, 27828, 353, 518, 524, 29898, 29916, 29897, 363, 921, 297, 8617, 9223, 29918, 27828, 29962, 13, 9651, 921, 29918, 14968, 29889, 4397, 29898, 6831, 9223, 29918, 27828, 29897, 13, 9651, 343, 29918, 14968, 29889, 4397, 29898, 29741, 29918, 8111, 29897, 13, 13, 4706, 7442, 29889, 29879, 485, 300, 486, 29898, 29916, 29918, 2084, 29892, 921, 29918, 14968, 29892, 19200, 353, 29915, 29995, 29946, 29881, 1495, 13, 4706, 7442, 29889, 29879, 485, 300, 486, 29898, 29891, 29918, 2084, 29892, 343, 29918, 14968, 29892, 19200, 2433, 29995, 29946, 29881, 1495, 13, 4706, 736, 7442, 29889, 294, 2378, 29898, 29916, 29918, 14968, 511, 7442, 29889, 294, 2378, 29898, 29891, 29918, 14968, 29897, 13, 13, 1678, 822, 1207, 29918, 14513, 29918, 15112, 29898, 1311, 29892, 954, 1125, 13, 4706, 934, 353, 376, 6995, 14538, 1691, 29914, 29891, 295, 29886, 29918, 305, 11768, 27508, 718, 851, 29898, 1949, 29897, 718, 11119, 2541, 29918, 550, 17538, 29889, 3126, 29880, 29908, 13, 4706, 1583, 29889, 14513, 29918, 2176, 353, 10518, 29889, 949, 29918, 3126, 29898, 1445, 29892, 3454, 29922, 5574, 29897, 13, 4706, 1583, 29889, 14513, 29918, 2176, 1839, 1643, 2033, 353, 1583, 29889, 14513, 29918, 2176, 29889, 309, 542, 7503, 29892, 29871, 29906, 29962, 13, 4706, 1583, 29889, 14513, 29918, 2176, 1839, 726, 2033, 353, 1583, 29889, 14513, 29918, 2176, 1839, 726, 13359, 7302, 29898, 14941, 29918, 18616, 663, 29897, 13, 4706, 1583, 29889, 14513, 29918, 2176, 1839, 1643, 2033, 353, 1583, 29889, 14513, 29918, 2176, 1839, 1643, 13359, 7302, 29898, 2892, 921, 29901, 921, 448, 29871, 29896, 29897, 13, 4706, 1583, 29889, 14513, 29918, 2176, 353, 1583, 29889, 14513, 29918, 2176, 29889, 8865, 29898, 1311, 29889, 14513, 29918, 2176, 29889, 13099, 8999, 29900, 29892, 29871, 29906, 20526, 9685, 29922, 29896, 29897, 13, 4706, 1596, 29898, 1311, 29889, 14513, 29918, 2176, 29897, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 6694, 29918, 29891, 295, 29886, 353, 612, 295, 29886, 16390, 24541, 703, 29891, 295, 29886, 29918, 27828, 29918, 26495, 29918, 24713, 29889, 3126, 29880, 613, 5993, 3950, 29922, 8516, 29892, 4236, 29918, 2435, 29922, 29896, 29900, 29900, 29900, 29892, 338, 29918, 3166, 29918, 16707, 29922, 8824, 29892, 788, 29918, 25932, 29922, 8824, 29897, 13, 1678, 396, 411, 1722, 703, 14941, 287, 29918, 276, 7406, 29889, 3945, 613, 376, 29893, 29974, 1159, 408, 285, 29901, 13, 1678, 7431, 29918, 9303, 353, 29871, 29900, 13, 1678, 2302, 353, 29871, 29900, 13, 1678, 363, 6664, 297, 260, 29939, 18933, 29898, 26495, 29918, 29891, 295, 29886, 29889, 276, 7406, 1125, 13, 4706, 5941, 287, 29918, 27828, 353, 5941, 29918, 18616, 663, 29898, 13478, 3366, 2080, 16862, 13609, 16655, 5451, 580, 13, 4706, 7431, 29918, 9303, 4619, 7431, 29898, 14941, 287, 29918, 27828, 29897, 13, 4706, 2302, 4619, 29871, 29896, 13, 13, 1678, 1596, 29898, 2435, 29918, 9303, 847, 2302, 29897, 632, 13, 13, 13, 13, 2 ]
Facraft.py
lyk91471872/Facraft
1
130667
import pygame, random, math, sys, sqlite3 # Classes class Bullet(): def __init__(self, type='a', dmg=1, dx=0): self.image = pygame.image.load(type+'.png').convert_alpha() self.dmg = dmg self.dx = dx self.existence = True self.rect = self.image.get_rect() self.rect.x = 0 self.rect.y = 1000 self.mask = pygame.mask.from_surface(self.image) def move(self): if self.rect.x==0 and self.rect.y==1000: x, y = pygame.mouse.get_pos() self.rect.x = x-self.image.get_width()/2 self.rect.y = y+40-self.image.get_height()/2 else: self.rect.x -= self.dx self.rect.y -= 20 class Enemy: def __init__(self, type='byg', hp=2, dx='rd', dy=3, x=-1, y=-100, score=1): self.image = pygame.image.load(type+'.png').convert_alpha() self.hp = hp self.score = score if dx=='rd': self.dx = (random.random() - 0.5) * 7 else: self.dx = dx self.dy = dy self.rect = self.image.get_rect() if x==-1: self.rect.x = random.random() * 1350 else: self.rect.x = x self.rect.y = y self.existence = True self.mask = pygame.mask.from_surface(self.image) def move(self): self.rect.x += self.dx self.rect.y += self.dy class Player_targeting_enemy(Enemy): def move(self): x, y = pygame.mouse.get_pos() dx = x - self.rect.x if dx>4: dx = 4 if dx<-4: dx = -4 self.dx = dx dy = y - self.rect.y if dy>8: dy = 8 if dy<-8: dy = -8 self.dy = dy self.rect.x += self.dx self.rect.y += self.dy class Player_targeting_bullet(Enemy): def move(self): x, y = pygame.mouse.get_pos() dx = x - self.rect.x if dx>10: dx = 10 if dx<-10: dx = -10 self.dx = dx self.rect.x += self.dx self.rect.y += self.dy class Boss(Enemy): def move(self): if self.timer<0: if self.timer<-3: self.rect.y += 20 elif self.timer==-3: self.rect.y += 15 elif self.timer==-2: self.rect.y += 10 elif self.timer==-1: self.rect.y += 5 self.timer += 1 else: self.rect.x = math.sin(self.timer) * 500 + 600 self.rect.y = math.sin(2 * self.timer) * 100 + 170 self.timer += 0.05 # Preparation player = input('Enter player name: ') if player=='': player = 'Anonym' fps = input('Enter fps: ') if fps=='': fps = 30 else: fps = int(fps) # create a new pygame window pygame.init() screen = pygame.display.set_mode((1280, 800), 0, 0) pygame.display.set_caption('Facraft') # load images background = pygame.image.load('bg.png').convert() dlg_drinking_image = pygame.image.load('dlg_drinking.png').convert_alpha() dlg_image = pygame.image.load('dlg.png').convert_alpha() # initialize variables to manage states bullet_timer = 0 enemy_timer = 0 bullets = [] enemies = [] boss = False game_over = False victory = False paused = False ccps_counter = 0 special_attack = False bullet_type = 'a' bullet_dmg = 1 bullet_pattern = 1 score = 0 # determine fps clock = pygame.time.Clock() # set player fa = pygame.sprite.Sprite() fa.image = pygame.image.load('fa.png').convert_alpha() fa.shoot_image = pygame.image.load('fa_shoot.png').convert_alpha() fa.rect = fa.image.get_rect() # main loop while True: clock.tick(fps) # determine whether to restart/quit for event in pygame.event.get(): if event.type==pygame.QUIT: pygame.quit() sys.exit() elif (game_over or victory) and event.type==pygame.MOUSEBUTTONUP: game_over = False victory = False enemies = [] bullets = [] ccps_counter = 0 special_attack = False if boss: del dlg boss = False score = 0 bullet_type = 'a' bullet_dmg = 1 bullet_pattern = 1 elif not(game_over or victory) and event.type==pygame.KEYDOWN: if event.key==pygame.K_ESCAPE: paused = not(paused) elif event.key==pygame.K_EQUALS: bullet_type = 'b' bullet_pattern = 2 bullet_dmg = 2 score = 90 # level up if score>=20 and score<25: bullet_pattern = 2 if score>=85 and score<90: bullet_type = 'b' bullet_dmg = 2 if paused: continue screen.blit(background, (0,0)) # show score score_font = pygame.font.Font('Arial.ttf', 32) score_label = score_font.render('score: '+str(score), True, (255, 255, 255)) screen.blit(score_label, (20, 20)) if game_over: game_over_label = pygame.image.load('game_over.png').convert_alpha() screen.blit(game_over_label, (260, 307)) pygame.display.update() continue if boss==True and dlg.hp<=0: if not(victory): conn = sqlite3.connect('records.db') cursor = conn.cursor() cursor.execute('create table if not exists records(player text, fps int, score int)') cursor.execute('insert into records(player, fps, score) values(\'' + player + '\', ' + str(fps) + ', ' + str(score) +')') conn.commit() conn.close() victory = True bullets = [] enemies = [] victory_font = pygame.font.Font('Arial.ttf', 200) victory_label = victory_font.render('Victory!', True, (0, 0, 0)) screen.blit(victory_label, (260, 307)) pygame.display.update() continue # update player position x, y = pygame.mouse.get_pos() fa.rect.x = x - 50 fa.rect.y = y - 66 if bullet_timer>=6 or bullet_timer==0: screen.blit(fa.shoot_image, (fa.rect.x, fa.rect.y)) else: screen.blit(fa.image, (fa.rect.x, fa.rect.y)) # shoot bullets bullet_timer += 1 if bullet_timer==8: bullet_timer = 0 if bullet_pattern==1: bullets.append(Bullet(type=bullet_type, dmg=bullet_dmg)) if bullet_pattern==2: bullets.append(Bullet(type=bullet_type, dmg=bullet_dmg, dx=10)) bullets.append(Bullet(type=bullet_type, dmg=bullet_dmg, dx=0)) bullets.append(Bullet(type=bullet_type, dmg=bullet_dmg, dx=-10)) # summon boss if score>=100 and score<200: if boss==False and enemies==[]: boss = True dlg = Boss(type='dlg', hp=1000, dx=0, dy=0, x=600, score=100) dlg.timer = -15 enemies.append(dlg) enemy_timer = 0 # summon enemies enemy_timer += 1 if enemy_timer==20: enemy_timer = 0 if score<35: enemies.append(Enemy()) enemies.append(Enemy()) if score>=35 and score<100: enemies.append(Enemy()) enemies.append(Enemy(dy=10)) enemies.append(Player_targeting_enemy(score=2)) enemies.append(Player_targeting_enemy(score=2)) if score>=100 and score<200 and type(enemies[0])==Boss: if special_attack==False: enemies.append(Player_targeting_bullet(type='knife', hp=1, dx=0, dy=15, x=dlg.rect.x, y=dlg.rect.y, score=0)) else: special_attack = False dlg.image = dlg_image enemies.append(Player_targeting_bullet(type='knife', hp=1, dx=0, dy=5, x=dlg.rect.x, y=dlg.rect.y, score=0)) enemies.append(Player_targeting_bullet(type='knife', hp=1, dx=0, dy=10, x=dlg.rect.x, y=dlg.rect.y, score=0)) enemies.append(Player_targeting_bullet(type='knife', hp=1, dx=0, dy=15, x=dlg.rect.x, y=dlg.rect.y, score=0)) # update bullets' positions i = len(bullets) - 1 while i>=0: bullets[i].move() if bullets[i].rect.y<-100 or bullets[i].rect.x<-100 or bullets[i].rect.x>1540: del bullets[i] else: screen.blit(bullets[i].image, (bullets[i].rect.x, bullets[i].rect.y)) i -= 1 # update enemies' positions i = len(enemies) - 1 while i>=0: if type(enemies[i])==Boss: if ccps_counter==20: ccps_counter = 0 dlg.image = dlg_drinking_image special_attack = True score += 10 dlg.hp -= 100 enemies[i].move() if enemies[i].rect.y>900 or enemies[i].rect.x<-100 or enemies[i].rect.x>1540: del enemies[i] else: screen.blit(enemies[i].image, (enemies[i].rect.x, enemies[i].rect.y)) i -= 1 # detect collisions i = len(enemies) - 1 while i>=0: if pygame.sprite.collide_mask(enemies[i], fa)!=None: game_over = True bullets = [] enemies = [] conn = sqlite3.connect('records.db') cursor = conn.cursor() cursor.execute('create table if not exists records(player text, fps int, score int)') cursor.execute('insert into records(player, fps, score) values(\'' + player + '\', ' + str(fps) + ', ' + str(score) +')') conn.commit() conn.close() break if type(enemies[i])==Player_targeting_bullet: i -= 1 continue j = len(bullets) - 1 while j>=0: if pygame.sprite.collide_mask(enemies[i], bullets[j])!=None: enemies[i].hp -= bullets[j].dmg if type(enemies[i])==Boss: ccps_counter += bullets[j].dmg del bullets[j] if enemies[i].hp<=0: score += enemies[i].score del enemies[i] break j -= 1 i -= 1 pygame.display.update()
[ 1, 1053, 22028, 29892, 4036, 29892, 5844, 29892, 10876, 29892, 21120, 29941, 13, 13, 13, 29937, 4134, 267, 13, 1990, 8313, 1026, 7295, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1134, 2433, 29874, 742, 270, 29885, 29887, 29922, 29896, 29892, 15414, 29922, 29900, 1125, 13, 4706, 1583, 29889, 3027, 353, 22028, 29889, 3027, 29889, 1359, 29898, 1853, 29974, 4286, 2732, 2824, 13441, 29918, 2312, 580, 13, 4706, 1583, 29889, 18933, 29887, 353, 270, 29885, 29887, 13, 4706, 1583, 29889, 8235, 353, 15414, 13, 4706, 1583, 29889, 735, 11416, 353, 5852, 13, 4706, 1583, 29889, 1621, 353, 1583, 29889, 3027, 29889, 657, 29918, 1621, 580, 13, 4706, 1583, 29889, 1621, 29889, 29916, 353, 29871, 29900, 13, 4706, 1583, 29889, 1621, 29889, 29891, 353, 29871, 29896, 29900, 29900, 29900, 13, 4706, 1583, 29889, 13168, 353, 22028, 29889, 13168, 29889, 3166, 29918, 7610, 2161, 29898, 1311, 29889, 3027, 29897, 13, 13, 1678, 822, 4337, 29898, 1311, 1125, 13, 4706, 565, 1583, 29889, 1621, 29889, 29916, 1360, 29900, 322, 1583, 29889, 1621, 29889, 29891, 1360, 29896, 29900, 29900, 29900, 29901, 13, 9651, 921, 29892, 343, 29871, 353, 22028, 29889, 15769, 29889, 657, 29918, 1066, 580, 13, 9651, 1583, 29889, 1621, 29889, 29916, 353, 921, 29899, 1311, 29889, 3027, 29889, 657, 29918, 2103, 580, 29914, 29906, 13, 9651, 1583, 29889, 1621, 29889, 29891, 353, 343, 29974, 29946, 29900, 29899, 1311, 29889, 3027, 29889, 657, 29918, 3545, 580, 29914, 29906, 13, 4706, 1683, 29901, 13, 9651, 1583, 29889, 1621, 29889, 29916, 22361, 1583, 29889, 8235, 13, 9651, 1583, 29889, 1621, 29889, 29891, 22361, 29871, 29906, 29900, 13, 13, 1990, 1174, 6764, 29901, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1134, 2433, 1609, 29887, 742, 298, 29886, 29922, 29906, 29892, 15414, 2433, 5499, 742, 13475, 29922, 29941, 29892, 921, 10457, 29896, 29892, 343, 10457, 29896, 29900, 29900, 29892, 8158, 29922, 29896, 1125, 13, 4706, 1583, 29889, 3027, 353, 22028, 29889, 3027, 29889, 1359, 29898, 1853, 29974, 4286, 2732, 2824, 13441, 29918, 2312, 580, 13, 4706, 1583, 29889, 28887, 353, 298, 29886, 13, 4706, 1583, 29889, 13628, 353, 8158, 13, 4706, 565, 15414, 1360, 29915, 5499, 2396, 13, 9651, 1583, 29889, 8235, 353, 313, 8172, 29889, 8172, 580, 448, 29871, 29900, 29889, 29945, 29897, 334, 29871, 29955, 13, 4706, 1683, 29901, 13, 9651, 1583, 29889, 8235, 353, 15414, 13, 4706, 1583, 29889, 4518, 353, 13475, 13, 4706, 1583, 29889, 1621, 353, 1583, 29889, 3027, 29889, 657, 29918, 1621, 580, 13, 4706, 565, 921, 1360, 29899, 29896, 29901, 13, 9651, 1583, 29889, 1621, 29889, 29916, 353, 4036, 29889, 8172, 580, 334, 29871, 29896, 29941, 29945, 29900, 13, 4706, 1683, 29901, 13, 9651, 1583, 29889, 1621, 29889, 29916, 353, 921, 13, 4706, 1583, 29889, 1621, 29889, 29891, 353, 343, 13, 4706, 1583, 29889, 735, 11416, 353, 5852, 13, 4706, 1583, 29889, 13168, 353, 22028, 29889, 13168, 29889, 3166, 29918, 7610, 2161, 29898, 1311, 29889, 3027, 29897, 13, 13, 1678, 822, 4337, 29898, 1311, 1125, 13, 4706, 1583, 29889, 1621, 29889, 29916, 4619, 1583, 29889, 8235, 13, 4706, 1583, 29889, 1621, 29889, 29891, 4619, 1583, 29889, 4518, 13, 13, 1990, 14574, 29918, 5182, 292, 29918, 264, 6764, 29898, 2369, 6764, 1125, 13, 1678, 822, 4337, 29898, 1311, 1125, 13, 4706, 921, 29892, 343, 353, 22028, 29889, 15769, 29889, 657, 29918, 1066, 580, 13, 4706, 15414, 353, 921, 448, 1583, 29889, 1621, 29889, 29916, 13, 4706, 565, 15414, 29958, 29946, 29901, 15414, 353, 29871, 29946, 13, 4706, 565, 15414, 16406, 29946, 29901, 15414, 353, 448, 29946, 13, 4706, 1583, 29889, 8235, 353, 15414, 13, 4706, 13475, 353, 343, 448, 1583, 29889, 1621, 29889, 29891, 13, 4706, 565, 13475, 29958, 29947, 29901, 13475, 353, 29871, 29947, 13, 4706, 565, 13475, 16406, 29947, 29901, 13475, 353, 448, 29947, 13, 4706, 1583, 29889, 4518, 353, 13475, 13, 4706, 1583, 29889, 1621, 29889, 29916, 4619, 1583, 29889, 8235, 13, 4706, 1583, 29889, 1621, 29889, 29891, 4619, 1583, 29889, 4518, 13, 13, 1990, 14574, 29918, 5182, 292, 29918, 18850, 29898, 2369, 6764, 1125, 13, 1678, 822, 4337, 29898, 1311, 1125, 13, 4706, 921, 29892, 343, 353, 22028, 29889, 15769, 29889, 657, 29918, 1066, 580, 13, 4706, 15414, 353, 921, 448, 1583, 29889, 1621, 29889, 29916, 13, 4706, 565, 15414, 29958, 29896, 29900, 29901, 15414, 353, 29871, 29896, 29900, 13, 4706, 565, 15414, 16406, 29896, 29900, 29901, 15414, 353, 448, 29896, 29900, 13, 4706, 1583, 29889, 8235, 353, 15414, 13, 4706, 1583, 29889, 1621, 29889, 29916, 4619, 1583, 29889, 8235, 13, 4706, 1583, 29889, 1621, 29889, 29891, 4619, 1583, 29889, 4518, 13, 13, 1990, 350, 2209, 29898, 2369, 6764, 1125, 13, 1678, 822, 4337, 29898, 1311, 1125, 13, 4706, 565, 1583, 29889, 20404, 29966, 29900, 29901, 13, 9651, 565, 1583, 29889, 20404, 16406, 29941, 29901, 13, 18884, 1583, 29889, 1621, 29889, 29891, 4619, 29871, 29906, 29900, 13, 9651, 25342, 1583, 29889, 20404, 1360, 29899, 29941, 29901, 13, 18884, 1583, 29889, 1621, 29889, 29891, 4619, 29871, 29896, 29945, 13, 9651, 25342, 1583, 29889, 20404, 1360, 29899, 29906, 29901, 13, 18884, 1583, 29889, 1621, 29889, 29891, 4619, 29871, 29896, 29900, 13, 9651, 25342, 1583, 29889, 20404, 1360, 29899, 29896, 29901, 13, 18884, 1583, 29889, 1621, 29889, 29891, 4619, 29871, 29945, 13, 9651, 1583, 29889, 20404, 4619, 29871, 29896, 13, 4706, 1683, 29901, 13, 9651, 1583, 29889, 1621, 29889, 29916, 353, 5844, 29889, 5223, 29898, 1311, 29889, 20404, 29897, 334, 29871, 29945, 29900, 29900, 718, 29871, 29953, 29900, 29900, 13, 9651, 1583, 29889, 1621, 29889, 29891, 353, 5844, 29889, 5223, 29898, 29906, 334, 1583, 29889, 20404, 29897, 334, 29871, 29896, 29900, 29900, 718, 29871, 29896, 29955, 29900, 13, 9651, 1583, 29889, 20404, 4619, 29871, 29900, 29889, 29900, 29945, 13, 13, 13, 29937, 4721, 862, 362, 13, 9106, 353, 1881, 877, 10399, 4847, 1024, 29901, 25710, 13, 361, 4847, 1360, 29915, 2396, 13, 1678, 4847, 353, 525, 2744, 4735, 29915, 13, 29888, 567, 353, 1881, 877, 10399, 285, 567, 29901, 25710, 13, 361, 285, 567, 1360, 29915, 2396, 13, 1678, 285, 567, 353, 29871, 29941, 29900, 13, 2870, 29901, 13, 1678, 285, 567, 353, 938, 29898, 29888, 567, 29897, 13, 13, 29937, 1653, 263, 716, 22028, 3474, 13, 2272, 11802, 29889, 2344, 580, 13, 10525, 353, 22028, 29889, 4990, 29889, 842, 29918, 8513, 3552, 29896, 29906, 29947, 29900, 29892, 29871, 29947, 29900, 29900, 511, 29871, 29900, 29892, 29871, 29900, 29897, 13, 2272, 11802, 29889, 4990, 29889, 842, 29918, 6671, 877, 29943, 562, 4154, 1495, 13, 13, 29937, 2254, 4558, 13, 7042, 353, 22028, 29889, 3027, 29889, 1359, 877, 16264, 29889, 2732, 2824, 13441, 580, 13, 11671, 29887, 29918, 7707, 18159, 29918, 3027, 353, 22028, 29889, 3027, 29889, 1359, 877, 11671, 29887, 29918, 7707, 18159, 29889, 2732, 2824, 13441, 29918, 2312, 580, 13, 11671, 29887, 29918, 3027, 353, 22028, 29889, 3027, 29889, 1359, 877, 11671, 29887, 29889, 2732, 2824, 13441, 29918, 2312, 580, 13, 13, 29937, 11905, 3651, 304, 10933, 5922, 13, 18850, 29918, 20404, 353, 29871, 29900, 13, 264, 6764, 29918, 20404, 353, 29871, 29900, 13, 8645, 10376, 353, 5159, 13, 264, 331, 583, 353, 5159, 13, 29890, 2209, 353, 7700, 13, 11802, 29918, 957, 353, 7700, 13, 29894, 919, 706, 353, 7700, 13, 29886, 15244, 353, 7700, 13, 617, 567, 29918, 11808, 353, 29871, 29900, 13, 18732, 29918, 1131, 547, 353, 7700, 13, 18850, 29918, 1853, 353, 525, 29874, 29915, 13, 18850, 29918, 18933, 29887, 353, 29871, 29896, 13, 18850, 29918, 11037, 353, 29871, 29896, 13, 13628, 353, 29871, 29900, 13, 13, 29937, 8161, 285, 567, 13, 13058, 353, 22028, 29889, 2230, 29889, 29907, 908, 580, 13, 13, 29937, 731, 4847, 13, 5444, 353, 22028, 29889, 15099, 568, 29889, 29903, 558, 568, 580, 13, 5444, 29889, 3027, 353, 22028, 29889, 3027, 29889, 1359, 877, 5444, 29889, 2732, 2824, 13441, 29918, 2312, 580, 13, 5444, 29889, 845, 3155, 29918, 3027, 353, 22028, 29889, 3027, 29889, 1359, 877, 5444, 29918, 845, 3155, 29889, 2732, 2824, 13441, 29918, 2312, 580, 13, 5444, 29889, 1621, 353, 2258, 29889, 3027, 29889, 657, 29918, 1621, 580, 13, 13, 13, 29937, 1667, 2425, 13, 8000, 5852, 29901, 13, 1678, 12006, 29889, 24667, 29898, 29888, 567, 29897, 13, 13, 1678, 396, 8161, 3692, 304, 10715, 29914, 28358, 13, 1678, 363, 1741, 297, 22028, 29889, 3696, 29889, 657, 7295, 13, 4706, 565, 1741, 29889, 1853, 1360, 2272, 11802, 29889, 13356, 1806, 29901, 13, 9651, 22028, 29889, 28358, 580, 13, 9651, 10876, 29889, 13322, 580, 13, 4706, 25342, 313, 11802, 29918, 957, 470, 15354, 29897, 322, 1741, 29889, 1853, 1360, 2272, 11802, 29889, 6720, 17171, 29933, 2692, 29911, 1164, 4897, 29901, 13, 9651, 3748, 29918, 957, 353, 7700, 13, 9651, 15354, 353, 7700, 13, 9651, 22595, 353, 5159, 13, 9651, 8227, 10376, 353, 5159, 13, 9651, 21759, 567, 29918, 11808, 353, 29871, 29900, 13, 9651, 4266, 29918, 1131, 547, 353, 7700, 13, 9651, 565, 289, 2209, 29901, 13, 18884, 628, 270, 19920, 13, 18884, 289, 2209, 353, 7700, 13, 9651, 8158, 353, 29871, 29900, 13, 9651, 24334, 29918, 1853, 353, 525, 29874, 29915, 13, 9651, 24334, 29918, 18933, 29887, 353, 29871, 29896, 13, 9651, 24334, 29918, 11037, 353, 29871, 29896, 13, 4706, 25342, 451, 29898, 11802, 29918, 957, 470, 15354, 29897, 322, 1741, 29889, 1853, 1360, 2272, 11802, 29889, 10818, 3970, 16048, 29901, 13, 9651, 565, 1741, 29889, 1989, 1360, 2272, 11802, 29889, 29968, 29918, 2890, 29907, 3301, 29923, 29901, 13, 18884, 28454, 353, 451, 29898, 29886, 15244, 29897, 13, 9651, 25342, 1741, 29889, 1989, 1360, 2272, 11802, 29889, 29968, 29918, 29923, 13356, 1964, 29903, 29901, 13, 18884, 24334, 29918, 1853, 353, 525, 29890, 29915, 13, 18884, 24334, 29918, 11037, 353, 29871, 29906, 13, 18884, 24334, 29918, 18933, 29887, 353, 29871, 29906, 13, 18884, 8158, 353, 29871, 29929, 29900, 13, 13, 1678, 396, 3233, 701, 13, 1678, 565, 8158, 18572, 29906, 29900, 322, 8158, 29966, 29906, 29945, 29901, 13, 4706, 24334, 29918, 11037, 353, 29871, 29906, 13, 1678, 565, 8158, 18572, 29947, 29945, 322, 8158, 29966, 29929, 29900, 29901, 13, 4706, 24334, 29918, 1853, 353, 525, 29890, 29915, 13, 4706, 24334, 29918, 18933, 29887, 353, 29871, 29906, 13, 13, 1678, 565, 28454, 29901, 6773, 13, 13, 1678, 4315, 29889, 2204, 277, 29898, 7042, 29892, 313, 29900, 29892, 29900, 876, 13, 13, 1678, 396, 1510, 8158, 13, 1678, 8158, 29918, 5657, 353, 22028, 29889, 5657, 29889, 9824, 877, 29909, 9315, 29889, 698, 29888, 742, 29871, 29941, 29906, 29897, 13, 1678, 8158, 29918, 1643, 353, 8158, 29918, 5657, 29889, 9482, 877, 13628, 29901, 525, 29974, 710, 29898, 13628, 511, 5852, 29892, 313, 29906, 29945, 29945, 29892, 29871, 29906, 29945, 29945, 29892, 29871, 29906, 29945, 29945, 876, 13, 1678, 4315, 29889, 2204, 277, 29898, 13628, 29918, 1643, 29892, 313, 29906, 29900, 29892, 29871, 29906, 29900, 876, 13, 13, 1678, 565, 3748, 29918, 957, 29901, 13, 4706, 3748, 29918, 957, 29918, 1643, 353, 22028, 29889, 3027, 29889, 1359, 877, 11802, 29918, 957, 29889, 2732, 2824, 13441, 29918, 2312, 580, 13, 4706, 4315, 29889, 2204, 277, 29898, 11802, 29918, 957, 29918, 1643, 29892, 313, 29906, 29953, 29900, 29892, 29871, 29941, 29900, 29955, 876, 13, 4706, 22028, 29889, 4990, 29889, 5504, 580, 13, 4706, 6773, 13, 13, 1678, 565, 289, 2209, 1360, 5574, 322, 270, 19920, 29889, 28887, 14065, 29900, 29901, 13, 4706, 565, 451, 29898, 29894, 919, 706, 1125, 13, 9651, 11009, 353, 21120, 29941, 29889, 6915, 877, 3757, 4339, 29889, 2585, 1495, 13, 9651, 10677, 353, 11009, 29889, 18127, 580, 13, 9651, 10677, 29889, 7978, 877, 3258, 1591, 565, 451, 4864, 6475, 29898, 9106, 1426, 29892, 285, 567, 938, 29892, 8158, 938, 29897, 1495, 13, 9651, 10677, 29889, 7978, 877, 7851, 964, 6475, 29898, 9106, 29892, 285, 567, 29892, 8158, 29897, 1819, 1194, 4907, 718, 4847, 718, 11297, 742, 525, 718, 851, 29898, 29888, 567, 29897, 718, 13420, 525, 718, 851, 29898, 13628, 29897, 718, 1495, 1495, 13, 9651, 11009, 29889, 15060, 580, 13, 9651, 11009, 29889, 5358, 580, 13, 9651, 15354, 353, 5852, 13, 9651, 8227, 10376, 353, 5159, 13, 9651, 22595, 353, 5159, 13, 4706, 15354, 29918, 5657, 353, 22028, 29889, 5657, 29889, 9824, 877, 29909, 9315, 29889, 698, 29888, 742, 29871, 29906, 29900, 29900, 29897, 13, 4706, 15354, 29918, 1643, 353, 15354, 29918, 5657, 29889, 9482, 877, 29963, 919, 706, 29991, 742, 5852, 29892, 313, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 876, 13, 4706, 4315, 29889, 2204, 277, 29898, 29894, 919, 706, 29918, 1643, 29892, 313, 29906, 29953, 29900, 29892, 29871, 29941, 29900, 29955, 876, 13, 4706, 22028, 29889, 4990, 29889, 5504, 580, 13, 4706, 6773, 13, 13, 1678, 396, 2767, 4847, 2602, 13, 1678, 921, 29892, 343, 353, 22028, 29889, 15769, 29889, 657, 29918, 1066, 580, 13, 1678, 2258, 29889, 1621, 29889, 29916, 353, 921, 448, 29871, 29945, 29900, 13, 1678, 2258, 29889, 1621, 29889, 29891, 353, 343, 448, 29871, 29953, 29953, 13, 1678, 565, 24334, 29918, 20404, 18572, 29953, 470, 24334, 29918, 20404, 1360, 29900, 29901, 13, 4706, 4315, 29889, 2204, 277, 29898, 5444, 29889, 845, 3155, 29918, 3027, 29892, 313, 5444, 29889, 1621, 29889, 29916, 29892, 2258, 29889, 1621, 29889, 29891, 876, 13, 1678, 1683, 29901, 13, 4706, 4315, 29889, 2204, 277, 29898, 5444, 29889, 3027, 29892, 313, 5444, 29889, 1621, 29889, 29916, 29892, 2258, 29889, 1621, 29889, 29891, 876, 13, 13, 1678, 396, 15049, 8227, 10376, 13, 1678, 24334, 29918, 20404, 4619, 29871, 29896, 13, 1678, 565, 24334, 29918, 20404, 1360, 29947, 29901, 13, 4706, 24334, 29918, 20404, 353, 29871, 29900, 13, 4706, 565, 24334, 29918, 11037, 1360, 29896, 29901, 13, 9651, 8227, 10376, 29889, 4397, 29898, 29933, 352, 1026, 29898, 1853, 29922, 18850, 29918, 1853, 29892, 270, 29885, 29887, 29922, 18850, 29918, 18933, 29887, 876, 13, 4706, 565, 24334, 29918, 11037, 1360, 29906, 29901, 13, 9651, 8227, 10376, 29889, 4397, 29898, 29933, 352, 1026, 29898, 1853, 29922, 18850, 29918, 1853, 29892, 270, 29885, 29887, 29922, 18850, 29918, 18933, 29887, 29892, 15414, 29922, 29896, 29900, 876, 13, 9651, 8227, 10376, 29889, 4397, 29898, 29933, 352, 1026, 29898, 1853, 29922, 18850, 29918, 1853, 29892, 270, 29885, 29887, 29922, 18850, 29918, 18933, 29887, 29892, 15414, 29922, 29900, 876, 13, 9651, 8227, 10376, 29889, 4397, 29898, 29933, 352, 1026, 29898, 1853, 29922, 18850, 29918, 1853, 29892, 270, 29885, 29887, 29922, 18850, 29918, 18933, 29887, 29892, 15414, 10457, 29896, 29900, 876, 13, 13, 1678, 396, 2533, 3712, 289, 2209, 13, 1678, 565, 8158, 18572, 29896, 29900, 29900, 322, 8158, 29966, 29906, 29900, 29900, 29901, 13, 4706, 565, 289, 2209, 1360, 8824, 322, 22595, 1360, 2636, 29901, 13, 9651, 289, 2209, 353, 5852, 13, 9651, 270, 19920, 353, 350, 2209, 29898, 1853, 2433, 11671, 29887, 742, 298, 29886, 29922, 29896, 29900, 29900, 29900, 29892, 15414, 29922, 29900, 29892, 13475, 29922, 29900, 29892, 921, 29922, 29953, 29900, 29900, 29892, 8158, 29922, 29896, 29900, 29900, 29897, 13, 9651, 270, 19920, 29889, 20404, 353, 448, 29896, 29945, 13, 9651, 22595, 29889, 4397, 29898, 11671, 29887, 29897, 13, 9651, 11103, 29918, 20404, 353, 29871, 29900, 13, 13, 1678, 396, 2533, 3712, 22595, 13, 1678, 11103, 29918, 20404, 4619, 29871, 29896, 13, 1678, 565, 11103, 29918, 20404, 1360, 29906, 29900, 29901, 13, 4706, 11103, 29918, 20404, 353, 29871, 29900, 13, 4706, 565, 8158, 29966, 29941, 29945, 29901, 13, 9651, 22595, 29889, 4397, 29898, 2369, 6764, 3101, 13, 9651, 22595, 29889, 4397, 29898, 2369, 6764, 3101, 13, 4706, 565, 8158, 18572, 29941, 29945, 322, 8158, 29966, 29896, 29900, 29900, 29901, 13, 9651, 22595, 29889, 4397, 29898, 2369, 6764, 3101, 13, 9651, 22595, 29889, 4397, 29898, 2369, 6764, 29898, 4518, 29922, 29896, 29900, 876, 13, 9651, 22595, 29889, 4397, 29898, 9075, 29918, 5182, 292, 29918, 264, 6764, 29898, 13628, 29922, 29906, 876, 13, 9651, 22595, 29889, 4397, 29898, 9075, 29918, 5182, 292, 29918, 264, 6764, 29898, 13628, 29922, 29906, 876, 13, 4706, 565, 8158, 18572, 29896, 29900, 29900, 322, 8158, 29966, 29906, 29900, 29900, 322, 1134, 29898, 264, 331, 583, 29961, 29900, 2314, 1360, 29933, 2209, 29901, 13, 9651, 565, 4266, 29918, 1131, 547, 1360, 8824, 29901, 13, 18884, 22595, 29889, 4397, 29898, 9075, 29918, 5182, 292, 29918, 18850, 29898, 1853, 2433, 3959, 1607, 742, 298, 29886, 29922, 29896, 29892, 15414, 29922, 29900, 29892, 13475, 29922, 29896, 29945, 29892, 921, 29922, 11671, 29887, 29889, 1621, 29889, 29916, 29892, 343, 29922, 11671, 29887, 29889, 1621, 29889, 29891, 29892, 8158, 29922, 29900, 876, 13, 9651, 1683, 29901, 13, 18884, 4266, 29918, 1131, 547, 353, 7700, 13, 18884, 270, 19920, 29889, 3027, 353, 270, 19920, 29918, 3027, 13, 18884, 22595, 29889, 4397, 29898, 9075, 29918, 5182, 292, 29918, 18850, 29898, 1853, 2433, 3959, 1607, 742, 298, 29886, 29922, 29896, 29892, 15414, 29922, 29900, 29892, 13475, 29922, 29945, 29892, 921, 29922, 11671, 29887, 29889, 1621, 29889, 29916, 29892, 343, 29922, 11671, 29887, 29889, 1621, 29889, 29891, 29892, 8158, 29922, 29900, 876, 13, 18884, 22595, 29889, 4397, 29898, 9075, 29918, 5182, 292, 29918, 18850, 29898, 1853, 2433, 3959, 1607, 742, 298, 29886, 29922, 29896, 29892, 15414, 29922, 29900, 29892, 13475, 29922, 29896, 29900, 29892, 921, 29922, 11671, 29887, 29889, 1621, 29889, 29916, 29892, 343, 29922, 11671, 29887, 29889, 1621, 29889, 29891, 29892, 8158, 29922, 29900, 876, 13, 18884, 22595, 29889, 4397, 29898, 9075, 29918, 5182, 292, 29918, 18850, 29898, 1853, 2433, 3959, 1607, 742, 298, 29886, 29922, 29896, 29892, 15414, 29922, 29900, 29892, 13475, 29922, 29896, 29945, 29892, 921, 29922, 11671, 29887, 29889, 1621, 29889, 29916, 29892, 343, 29922, 11671, 29887, 29889, 1621, 29889, 29891, 29892, 8158, 29922, 29900, 876, 13, 13, 1678, 396, 2767, 8227, 10376, 29915, 11909, 13, 1678, 474, 353, 7431, 29898, 8645, 10376, 29897, 448, 29871, 29896, 13, 1678, 1550, 474, 18572, 29900, 29901, 13, 4706, 8227, 10376, 29961, 29875, 1822, 11631, 580, 13, 4706, 565, 8227, 10376, 29961, 29875, 1822, 1621, 29889, 29891, 16406, 29896, 29900, 29900, 470, 8227, 10376, 29961, 29875, 1822, 1621, 29889, 29916, 16406, 29896, 29900, 29900, 470, 8227, 10376, 29961, 29875, 1822, 1621, 29889, 29916, 29958, 29896, 29945, 29946, 29900, 29901, 13, 9651, 628, 8227, 10376, 29961, 29875, 29962, 13, 4706, 1683, 29901, 13, 9651, 4315, 29889, 2204, 277, 29898, 8645, 10376, 29961, 29875, 1822, 3027, 29892, 313, 8645, 10376, 29961, 29875, 1822, 1621, 29889, 29916, 29892, 8227, 10376, 29961, 29875, 1822, 1621, 29889, 29891, 876, 13, 4706, 474, 22361, 29871, 29896, 13, 13, 1678, 396, 2767, 22595, 29915, 11909, 13, 1678, 474, 353, 7431, 29898, 264, 331, 583, 29897, 448, 29871, 29896, 13, 1678, 1550, 474, 18572, 29900, 29901, 13, 4706, 565, 1134, 29898, 264, 331, 583, 29961, 29875, 2314, 1360, 29933, 2209, 29901, 13, 9651, 565, 21759, 567, 29918, 11808, 1360, 29906, 29900, 29901, 13, 18884, 21759, 567, 29918, 11808, 353, 29871, 29900, 13, 18884, 270, 19920, 29889, 3027, 353, 270, 19920, 29918, 7707, 18159, 29918, 3027, 13, 18884, 4266, 29918, 1131, 547, 353, 5852, 13, 18884, 8158, 4619, 29871, 29896, 29900, 13, 18884, 270, 19920, 29889, 28887, 22361, 29871, 29896, 29900, 29900, 13, 4706, 22595, 29961, 29875, 1822, 11631, 580, 13, 4706, 565, 22595, 29961, 29875, 1822, 1621, 29889, 29891, 29958, 29929, 29900, 29900, 470, 22595, 29961, 29875, 1822, 1621, 29889, 29916, 16406, 29896, 29900, 29900, 470, 22595, 29961, 29875, 1822, 1621, 29889, 29916, 29958, 29896, 29945, 29946, 29900, 29901, 13, 9651, 628, 22595, 29961, 29875, 29962, 13, 4706, 1683, 29901, 13, 9651, 4315, 29889, 2204, 277, 29898, 264, 331, 583, 29961, 29875, 1822, 3027, 29892, 313, 264, 331, 583, 29961, 29875, 1822, 1621, 29889, 29916, 29892, 22595, 29961, 29875, 1822, 1621, 29889, 29891, 876, 13, 4706, 474, 22361, 29871, 29896, 13, 13, 1678, 396, 6459, 5321, 12112, 13, 1678, 474, 353, 7431, 29898, 264, 331, 583, 29897, 448, 29871, 29896, 13, 1678, 1550, 474, 18572, 29900, 29901, 13, 4706, 565, 22028, 29889, 15099, 568, 29889, 1054, 7459, 29918, 13168, 29898, 264, 331, 583, 29961, 29875, 1402, 2258, 29897, 19216, 8516, 29901, 13, 9651, 3748, 29918, 957, 353, 5852, 13, 9651, 8227, 10376, 353, 5159, 13, 9651, 22595, 353, 5159, 13, 9651, 11009, 353, 21120, 29941, 29889, 6915, 877, 3757, 4339, 29889, 2585, 1495, 13, 9651, 10677, 353, 11009, 29889, 18127, 580, 13, 9651, 10677, 29889, 7978, 877, 3258, 1591, 565, 451, 4864, 6475, 29898, 9106, 1426, 29892, 285, 567, 938, 29892, 8158, 938, 29897, 1495, 13, 9651, 10677, 29889, 7978, 877, 7851, 964, 6475, 29898, 9106, 29892, 285, 567, 29892, 8158, 29897, 1819, 1194, 4907, 718, 4847, 718, 11297, 742, 525, 718, 851, 29898, 29888, 567, 29897, 718, 13420, 525, 718, 851, 29898, 13628, 29897, 718, 1495, 1495, 13, 9651, 11009, 29889, 15060, 580, 13, 9651, 11009, 29889, 5358, 580, 13, 9651, 2867, 13, 4706, 565, 1134, 29898, 264, 331, 583, 29961, 29875, 2314, 1360, 9075, 29918, 5182, 292, 29918, 18850, 29901, 13, 9651, 474, 22361, 29871, 29896, 13, 9651, 6773, 13, 4706, 432, 353, 7431, 29898, 8645, 10376, 29897, 448, 29871, 29896, 13, 4706, 1550, 432, 18572, 29900, 29901, 13, 9651, 565, 22028, 29889, 15099, 568, 29889, 1054, 7459, 29918, 13168, 29898, 264, 331, 583, 29961, 29875, 1402, 8227, 10376, 29961, 29926, 2314, 19216, 8516, 29901, 13, 18884, 22595, 29961, 29875, 1822, 28887, 22361, 8227, 10376, 29961, 29926, 1822, 18933, 29887, 13, 18884, 565, 1134, 29898, 264, 331, 583, 29961, 29875, 2314, 1360, 29933, 2209, 29901, 13, 462, 1678, 21759, 567, 29918, 11808, 4619, 8227, 10376, 29961, 29926, 1822, 18933, 29887, 13, 18884, 628, 8227, 10376, 29961, 29926, 29962, 13, 18884, 565, 22595, 29961, 29875, 1822, 28887, 14065, 29900, 29901, 13, 462, 1678, 8158, 4619, 22595, 29961, 29875, 1822, 13628, 13, 462, 1678, 628, 22595, 29961, 29875, 29962, 13, 462, 1678, 2867, 13, 9651, 432, 22361, 29871, 29896, 13, 4706, 474, 22361, 29871, 29896, 13, 13, 1678, 22028, 29889, 4990, 29889, 5504, 580, 13, 13, 2 ]
sshsysmon/drivers/ssh.py
zix99/sshsysmon
46
51918
from lib.plugins import Driver import os from paramiko import SSHClient, RSAKey, AutoAddPolicy from io import StringIO class Ssh(Driver): DEFAULT_KEY_PATH = "~/.ssh/id_rsa" def __init__(self, host, username='root', password = None, key = None, port = 22, path = "/proc"): Driver.__init__(self) self._host = host self._username = username self._password = password self._port = port self._path = path self._client = None self._ftp = None if not password or key: self._key = RSAKey.from_private_key_file(os.path.expanduser(key or Ssh.DEFAULT_KEY_PATH)) else: self._key = None def readProc(self, path): sftp = self._connectFtp() o = StringIO() for line in sftp.open(os.path.join(self._path, path)): o.write(line) return o.getvalue() def sh(self, cmd): client = self._connect() stdin, stdout, stderr = client.exec_command(cmd) return { "stdout": stdout.read().decode('utf-8'), "stderr": stderr.read().decode('utf-8'), "status": stdout.channel.recv_exit_status() } def _connect(self): if not self._client: client = SSHClient() client.set_missing_host_key_policy(AutoAddPolicy()) client.connect(hostname = self._host, username=self._username, password=self._password, pkey=self._key, port=self._port, look_for_keys=False) self._client = client return self._client def _connectFtp(self): if not self._ftp: client = self._connect() self._ftp = client.open_sftp() return self._ftp def getHost(self): return self._host def create(args): return Ssh(**args)
[ 1, 515, 4303, 29889, 12800, 1053, 26391, 13, 5215, 2897, 13, 3166, 1828, 10349, 1053, 22343, 4032, 29892, 390, 8132, 2558, 29892, 11133, 2528, 15644, 13, 3166, 12013, 1053, 1714, 5971, 13, 13, 1990, 317, 845, 29898, 12376, 1125, 13, 12, 23397, 29918, 10818, 29918, 10145, 353, 376, 30022, 6294, 15269, 29914, 333, 29918, 2288, 29874, 29908, 13, 13, 12, 1753, 4770, 2344, 12035, 1311, 29892, 3495, 29892, 8952, 2433, 4632, 742, 4800, 353, 6213, 29892, 1820, 353, 6213, 29892, 2011, 353, 29871, 29906, 29906, 29892, 2224, 353, 5591, 15439, 29908, 1125, 13, 12, 12, 12376, 17255, 2344, 12035, 1311, 29897, 13, 12, 12, 1311, 3032, 3069, 353, 3495, 13, 12, 12, 1311, 3032, 6786, 353, 8952, 13, 12, 12, 1311, 3032, 5630, 353, 4800, 13, 12, 12, 1311, 3032, 637, 353, 2011, 13, 12, 12, 1311, 3032, 2084, 353, 2224, 13, 13, 12, 12, 1311, 3032, 4645, 353, 6213, 13, 12, 12, 1311, 3032, 23102, 353, 6213, 13, 13, 12, 12, 361, 451, 4800, 470, 1820, 29901, 13, 12, 12, 12, 1311, 3032, 1989, 353, 390, 8132, 2558, 29889, 3166, 29918, 9053, 29918, 1989, 29918, 1445, 29898, 359, 29889, 2084, 29889, 18837, 1792, 29898, 1989, 470, 317, 845, 29889, 23397, 29918, 10818, 29918, 10145, 876, 13, 12, 12, 2870, 29901, 13, 12, 12, 12, 1311, 3032, 1989, 353, 6213, 13, 13, 12, 1753, 1303, 27893, 29898, 1311, 29892, 2224, 1125, 13, 12, 12, 29879, 23102, 353, 1583, 3032, 6915, 29943, 9392, 580, 13, 13, 12, 12, 29877, 353, 1714, 5971, 580, 13, 12, 12, 1454, 1196, 297, 269, 23102, 29889, 3150, 29898, 359, 29889, 2084, 29889, 7122, 29898, 1311, 3032, 2084, 29892, 2224, 22164, 13, 12, 12, 12, 29877, 29889, 3539, 29898, 1220, 29897, 13, 13, 12, 12, 2457, 288, 29889, 657, 1767, 580, 13, 13, 12, 1753, 528, 29898, 1311, 29892, 9920, 1125, 13, 12, 12, 4645, 353, 1583, 3032, 6915, 580, 13, 12, 12, 4172, 262, 29892, 27591, 29892, 380, 20405, 353, 3132, 29889, 4258, 29918, 6519, 29898, 9006, 29897, 13, 12, 12, 2457, 426, 13, 12, 12, 12, 29908, 25393, 1115, 27591, 29889, 949, 2141, 13808, 877, 9420, 29899, 29947, 5477, 13, 12, 12, 12, 29908, 303, 20405, 1115, 380, 20405, 29889, 949, 2141, 13808, 877, 9420, 29899, 29947, 5477, 13, 12, 12, 12, 29908, 4882, 1115, 27591, 29889, 12719, 29889, 3757, 29894, 29918, 13322, 29918, 4882, 580, 13, 12, 12, 29913, 13, 13, 12, 1753, 903, 6915, 29898, 1311, 1125, 13, 12, 12, 361, 451, 1583, 3032, 4645, 29901, 13, 12, 12, 12, 4645, 353, 22343, 4032, 580, 13, 12, 12, 12, 4645, 29889, 842, 29918, 27259, 29918, 3069, 29918, 1989, 29918, 22197, 29898, 12300, 2528, 15644, 3101, 13, 12, 12, 12, 4645, 29889, 6915, 29898, 28988, 353, 1583, 3032, 3069, 29892, 8952, 29922, 1311, 3032, 6786, 29892, 4800, 29922, 1311, 3032, 5630, 29892, 282, 1989, 29922, 1311, 3032, 1989, 29892, 2011, 29922, 1311, 3032, 637, 29892, 1106, 29918, 1454, 29918, 8149, 29922, 8824, 29897, 13, 12, 12, 12, 1311, 3032, 4645, 353, 3132, 13, 12, 12, 2457, 1583, 3032, 4645, 13, 13, 12, 1753, 903, 6915, 29943, 9392, 29898, 1311, 1125, 13, 12, 12, 361, 451, 1583, 3032, 23102, 29901, 13, 12, 12, 12, 4645, 353, 1583, 3032, 6915, 580, 13, 12, 12, 12, 1311, 3032, 23102, 353, 3132, 29889, 3150, 29918, 29879, 23102, 580, 13, 12, 12, 2457, 1583, 3032, 23102, 13, 13, 12, 1753, 679, 8514, 29898, 1311, 1125, 13, 12, 12, 2457, 1583, 3032, 3069, 13, 13, 1753, 1653, 29898, 5085, 1125, 13, 12, 2457, 317, 845, 29898, 1068, 5085, 29897, 2 ]
utils/The_Alchemist_Code/conceptcard.py
heboric/ouro
3
25260
<reponame>heboric/ouro from ._main import DIRS,LinkDB,ConvertFields,StrBuff,StrCondition,Embed, Rarity,GitLabLink import copy def Conceptcard(iname, page): #get card dir card=DIRS['Conceptcard'][iname] #create basic embed embed= Embed( title='', #page name url=LinkDB('card',iname,'',True,'jp') #page link ) embed.set_author(name=card['name'],url=embed.url)#, url=LinkDB('card',iname)) embed.set_thumbnail(url=GitLabLink('/ConceptCardIcon/%s.png'%iname))#'http://cdn.alchemistcodedb.com/images/cards/icons/{}.png'.format(iname)) embed.set_image(url=GitLabLink('/ConceptCard/%s.png'%iname))#'http://cdn.alchemistcodedb.com/images/cards/artworks/{}.png'.format(iname)) while page: if page=='main': embed.ConvertFields(main(card)) embed.title='main' break break return embed def main(card): try: unit=DIRS['Unit']['UN_V2_'+card['iname'].rsplit('_',2)[1]]['name'] except: unit='None' fields = [ {'name': 'Unit', 'value': unit, 'inline':True}, {'name': 'Rarity', 'value': Rarity(card['rare'],4), 'inline':True}, {'name': 'Enhance Cost', 'value': str(card['en_cost']), 'inline':True}, {'name': 'Enhance EXP', 'value': str(card['en_exp']), 'inline':True}, ] #Weapon Type ~ Tag if 'trust_reward' in card: fields.append({'name': 'Trust Reward(s)', 'value': '```\t%s```'%'\n\t'.join( [ '%s%s (%s)'%('%sx'%reward['reward_num'] if reward['reward_num']>1 else '', DIRS[reward['reward_type']][reward['iname']]['name'],reward['reward_type'].replace('Artifact','Gear')) for reward in DIRS['Conceptcardtrustreward'][card['trust_reward']]['rewards'] ] ), 'inline': False}) #effects for i,effect in enumerate(card['effects']): value=[] #cnds_iname if 'cnds_iname' in effect: value.append( '__**Condition(s):**__\n'+CardConditions(effect['cnds_iname']) ) #abil_iname if 'abil_iname' in effect: value.append('__**Vision Ability:**__\n'+ DIRS['Ability'][effect['abil_iname']]['name'] ) #skin if 'skin' in effect: value.append('__**Skin:**__\n'+DIRS['Artifact'][effect['skin']]['name']) #statusup_skill ~ from equipping if 'statusup_skill' in effect: value.append('__**Stats:**__\n'+ StrBuff(DIRS['Skill'][effect['statusup_skill']]['target_buff_iname'],2,2) ) ##### # LV 30: stats (x per level) # Limit Break: x per level # Max Limit Break: total stats (lv 40, all limit breaks, + mlb bonus) #card_skill buffs=[] if 'card_skill' in effect: buffs.append(DIRS['Skill'][effect['card_skill']]['target_buff_iname']) value.append( '__**LV 30 Stats:**__ %s'%( StrBuff(DIRS['Skill'][effect['card_skill']]['target_buff_iname'],30,40) ) ) #add_card_skill_buff_awake if 'add_card_skill_buff_awake' in effect: buffs.append(effect['add_card_skill_buff_awake']) value.append('__**Limit Break Stats:**__\n1:%s\n5:%s'%(StrBuff(effect['add_card_skill_buff_awake'],1,5),StrBuff(effect['add_card_skill_buff_awake'],5,5)) ) #add_card_skill_buff_lvmax if 'add_card_skill_buff_lvmax' in effect: buffs.append(effect['add_card_skill_buff_lvmax']) value.append('__**MLB Bonus Stats:**__\n'+ StrBuff(effect['add_card_skill_buff_lvmax'],2,2) ) #total stats if buffs: value.append('__**Max Stats:**__\n'+ StrBuff(add_buffs(buffs),2,2) ) for buff in buffs: buff=DIRS['Buff'][buff] if 'un_group' in buff: value.append('__**Boosted Units:**__\n%s'%(', '.join([ DIRS['Unit'][unit]['name'] for unit in DIRS['Unitgroup'][buff['un_group']]['units'] ]))) break #elif costum target fields.append({'name': 'Effect '+str(i+1), 'value': '\n'.join(value), 'inline':False}) #lore fields.append({'name': 'Description', 'value': card['expr'], 'inline': False}) return fields def CardConditions(iname): conds=DIRS['Conceptcardconditions'][iname] ret=[] #unit group if 'unit_group' in conds: ret.append('Units: '+', '.join([ DIRS['Unit'][uiname]['name'] for uiname in DIRS['Unitgroup'][conds['unit_group']]['units'] ])) #job group if 'job_group' in conds: ret.append('Jobs: '+', '.join([ DIRS['Job'][jiname]['name'] for jiname in DIRS['Jobgroup'][conds['job_group']]['jobs'] ])) #element if 'conditions_elements' in conds: ret.append('Element: '+', '.join(conds['conditions_elements'])) #birth if 'birth' in conds: ret.append('Birth: '+', '.join(conds['birth'])) return '\n'.join(ret) def add_buffs(buffs): #check type buffs=[ copy.deepcopy(DIRS['Buff'][buff]) if type(buff)==str else copy.deepcopy(buff) for buff in buffs ] #add effects up types={'Scale':{},'Add':{},'Fixed':{}} for buff in buffs: for stat in buff['buffs']: typ=types[stat['calc']] if stat['type'] not in typ: typ[stat['type']]=stat else: typ[stat['type']]['value_ini']+=stat['value_ini'] typ[stat['type']]['value_max']+=stat['value_max'] typ[stat['type']]['value_one']+=stat['value_one'] #revert back return ({'buffs':[ buff for typ,items in types.items() for key,buff in items.items() ]})
[ 1, 529, 276, 1112, 420, 29958, 354, 4089, 293, 29914, 283, 307, 13, 3166, 869, 29918, 3396, 1053, 360, 8193, 29903, 29892, 6595, 4051, 29892, 18455, 14256, 29892, 5015, 29933, 3096, 29892, 5015, 25255, 29892, 6026, 2580, 29892, 390, 279, 537, 29892, 28712, 28632, 6595, 13, 5215, 3509, 13, 1753, 1281, 1547, 7543, 29898, 262, 420, 29892, 1813, 1125, 13, 12, 29937, 657, 5881, 4516, 13, 12, 7543, 29922, 9464, 29903, 1839, 1168, 1547, 7543, 2033, 29961, 262, 420, 29962, 13, 13, 12, 29937, 3258, 6996, 8297, 13, 12, 17987, 29922, 2812, 2580, 29898, 13, 12, 12, 3257, 2433, 742, 396, 3488, 1024, 13, 12, 12, 2271, 29922, 6595, 4051, 877, 7543, 742, 262, 420, 5501, 742, 5574, 5501, 16865, 1495, 29871, 396, 3488, 1544, 13, 12, 12, 29897, 13, 12, 17987, 29889, 842, 29918, 8921, 29898, 978, 29922, 7543, 1839, 978, 7464, 2271, 29922, 17987, 29889, 2271, 29897, 6552, 3142, 29922, 6595, 4051, 877, 7543, 742, 262, 420, 876, 13, 12, 17987, 29889, 842, 29918, 386, 21145, 29898, 2271, 29922, 28712, 28632, 6595, 11219, 1168, 1547, 13200, 12492, 22584, 29879, 29889, 2732, 29915, 29995, 262, 420, 876, 29937, 29915, 1124, 597, 13687, 29889, 284, 14969, 391, 29659, 29890, 29889, 510, 29914, 8346, 29914, 28160, 29914, 27078, 19248, 1836, 2732, 4286, 4830, 29898, 262, 420, 876, 13, 12, 17987, 29889, 842, 29918, 3027, 29898, 2271, 29922, 28712, 28632, 6595, 11219, 1168, 1547, 13200, 22584, 29879, 29889, 2732, 29915, 29995, 262, 420, 876, 29937, 29915, 1124, 597, 13687, 29889, 284, 14969, 391, 29659, 29890, 29889, 510, 29914, 8346, 29914, 28160, 29914, 442, 13129, 19248, 1836, 2732, 4286, 4830, 29898, 262, 420, 876, 13, 13, 12, 8000, 1813, 29901, 13, 12, 12, 361, 1813, 1360, 29915, 3396, 2396, 13, 12, 12, 12, 17987, 29889, 18455, 14256, 29898, 3396, 29898, 7543, 876, 13, 12, 12, 12, 17987, 29889, 3257, 2433, 3396, 29915, 13, 12, 12, 12, 8690, 13, 12, 12, 8690, 13, 12, 13, 12, 2457, 8297, 13, 13, 1753, 1667, 29898, 7543, 1125, 13, 12, 2202, 29901, 13, 12, 12, 5441, 29922, 9464, 29903, 1839, 8325, 16215, 3904, 29918, 29963, 29906, 29918, 18717, 7543, 1839, 262, 420, 13359, 2288, 2830, 877, 29918, 742, 29906, 9601, 29896, 5262, 1839, 978, 2033, 13, 12, 19499, 29901, 13, 12, 12, 5441, 2433, 8516, 29915, 13, 13, 12, 9621, 353, 518, 13, 12, 12, 10998, 978, 2396, 525, 8325, 742, 12, 12, 12, 29915, 1767, 2396, 5190, 29892, 525, 14764, 2396, 5574, 1118, 13, 12, 12, 10998, 978, 2396, 525, 29934, 279, 537, 742, 12, 12, 29871, 525, 1767, 2396, 390, 279, 537, 29898, 7543, 1839, 25983, 7464, 29946, 511, 525, 14764, 2396, 5574, 1118, 13, 12, 12, 10998, 978, 2396, 525, 2369, 29882, 749, 9839, 742, 12, 29915, 1767, 2396, 851, 29898, 7543, 1839, 264, 29918, 18253, 2033, 511, 525, 14764, 2396, 5574, 1118, 13, 12, 12, 10998, 978, 2396, 525, 2369, 29882, 749, 8528, 29925, 742, 12, 525, 1767, 2396, 851, 29898, 7543, 1839, 264, 29918, 4548, 2033, 511, 525, 14764, 2396, 5574, 1118, 13, 12, 12, 29962, 13, 12, 29937, 4806, 481, 265, 5167, 3695, 10522, 13, 12, 361, 525, 509, 504, 29918, 276, 1328, 29915, 297, 5881, 29901, 13, 12, 12, 9621, 29889, 4397, 3319, 29915, 978, 2396, 525, 2308, 504, 390, 809, 538, 29898, 29879, 29897, 742, 525, 1767, 2396, 525, 28956, 29905, 29873, 29995, 29879, 16159, 20497, 29995, 12764, 29876, 29905, 29873, 4286, 7122, 29898, 13, 12, 12, 12, 29961, 13, 12, 12, 12, 12, 29915, 29995, 29879, 29995, 29879, 313, 29995, 29879, 16029, 29995, 877, 29995, 29879, 29916, 29915, 29995, 276, 1328, 1839, 276, 1328, 29918, 1949, 2033, 565, 20751, 1839, 276, 1328, 29918, 1949, 2033, 29958, 29896, 1683, 15516, 360, 8193, 29903, 29961, 276, 1328, 1839, 276, 1328, 29918, 1853, 2033, 3816, 276, 1328, 1839, 262, 420, 2033, 22322, 978, 7464, 276, 1328, 1839, 276, 1328, 29918, 1853, 13359, 6506, 877, 9986, 7060, 3788, 29954, 799, 8785, 29871, 13, 12, 12, 12, 12, 1454, 20751, 297, 360, 8193, 29903, 1839, 1168, 1547, 7543, 509, 504, 276, 1328, 2033, 29961, 7543, 1839, 509, 504, 29918, 276, 1328, 2033, 22322, 276, 2935, 2033, 13, 12, 12, 12, 29962, 13, 12, 12, 12, 511, 525, 14764, 2396, 7700, 1800, 13, 13, 12, 29937, 15987, 29879, 13, 12, 1454, 474, 29892, 15987, 297, 26985, 29898, 7543, 1839, 15987, 29879, 2033, 1125, 13, 12, 12, 1767, 29922, 2636, 13, 12, 12, 29937, 29883, 299, 29879, 29918, 262, 420, 13, 12, 12, 361, 525, 29883, 299, 29879, 29918, 262, 420, 29915, 297, 2779, 29901, 13, 12, 12, 12, 1767, 29889, 4397, 29898, 13, 12, 12, 12, 12, 29915, 1649, 1068, 25255, 29898, 29879, 1125, 1068, 1649, 29905, 29876, 18717, 13200, 10983, 2187, 29898, 15987, 1839, 29883, 299, 29879, 29918, 262, 420, 11287, 13, 12, 12, 12, 29897, 13, 12, 12, 29937, 4427, 29918, 262, 420, 13, 12, 12, 361, 525, 4427, 29918, 262, 420, 29915, 297, 2779, 29901, 13, 12, 12, 12, 1767, 29889, 4397, 877, 1649, 1068, 29963, 2459, 1976, 1793, 29901, 1068, 1649, 29905, 29876, 18717, 13, 12, 12, 12, 9464, 29903, 1839, 4920, 1793, 2033, 29961, 15987, 1839, 4427, 29918, 262, 420, 2033, 22322, 978, 2033, 13, 12, 12, 12, 29897, 13, 12, 12, 29937, 808, 262, 13, 12, 12, 361, 525, 808, 262, 29915, 297, 2779, 29901, 13, 12, 12, 12, 1767, 29889, 4397, 877, 1649, 1068, 29903, 9089, 29901, 1068, 1649, 29905, 29876, 18717, 9464, 29903, 1839, 9986, 7060, 2033, 29961, 15987, 1839, 808, 262, 2033, 22322, 978, 11287, 13, 12, 12, 29937, 4882, 786, 29918, 808, 453, 3695, 515, 1592, 17347, 13, 12, 12, 361, 525, 4882, 786, 29918, 808, 453, 29915, 297, 2779, 29901, 13, 12, 12, 12, 1767, 29889, 4397, 877, 1649, 1068, 25060, 29901, 1068, 1649, 29905, 29876, 18717, 13, 12, 12, 12, 5015, 29933, 3096, 29898, 9464, 29903, 1839, 15797, 453, 2033, 29961, 15987, 1839, 4882, 786, 29918, 808, 453, 2033, 22322, 5182, 29918, 28040, 29918, 262, 420, 7464, 29906, 29892, 29906, 29897, 13, 12, 12, 12, 29897, 13, 12, 12, 4136, 29937, 13, 12, 12, 29937, 365, 29963, 29871, 29941, 29900, 29901, 12, 16202, 313, 29916, 639, 3233, 29897, 13, 12, 12, 29937, 9628, 277, 28301, 29901, 921, 639, 3233, 13, 12, 12, 29937, 5918, 9628, 277, 28301, 29901, 3001, 22663, 313, 28463, 29871, 29946, 29900, 29892, 599, 4046, 16706, 29892, 718, 286, 27728, 28920, 29897, 13, 12, 12, 29937, 7543, 29918, 808, 453, 13, 12, 12, 28040, 29879, 29922, 2636, 13, 13, 12, 12, 361, 525, 7543, 29918, 808, 453, 29915, 297, 2779, 29901, 13, 12, 12, 12, 28040, 29879, 29889, 4397, 29898, 9464, 29903, 1839, 15797, 453, 2033, 29961, 15987, 1839, 7543, 29918, 808, 453, 2033, 22322, 5182, 29918, 28040, 29918, 262, 420, 11287, 13, 12, 12, 12, 1767, 29889, 4397, 29898, 13, 12, 12, 12, 29915, 1649, 1068, 29931, 29963, 29871, 29941, 29900, 624, 1446, 29901, 1068, 1649, 12, 29995, 29879, 29915, 29995, 29898, 13, 12, 12, 12, 12, 5015, 29933, 3096, 29898, 9464, 29903, 1839, 15797, 453, 2033, 29961, 15987, 1839, 7543, 29918, 808, 453, 2033, 22322, 5182, 29918, 28040, 29918, 262, 420, 7464, 29941, 29900, 29892, 29946, 29900, 29897, 13, 12, 12, 12, 12, 29897, 13, 12, 12, 12, 29897, 13, 12, 12, 29937, 1202, 29918, 7543, 29918, 808, 453, 29918, 28040, 29918, 1450, 1296, 13, 12, 12, 361, 525, 1202, 29918, 7543, 29918, 808, 453, 29918, 28040, 29918, 1450, 1296, 29915, 297, 2779, 29901, 13, 12, 12, 12, 28040, 29879, 29889, 4397, 29898, 15987, 1839, 1202, 29918, 7543, 29918, 808, 453, 29918, 28040, 29918, 1450, 1296, 11287, 13, 12, 12, 12, 1767, 29889, 4397, 877, 1649, 1068, 24445, 28301, 624, 1446, 29901, 1068, 1649, 29905, 29876, 29896, 16664, 29879, 29905, 29876, 29945, 16664, 29879, 29915, 29995, 29898, 5015, 29933, 3096, 29898, 15987, 1839, 1202, 29918, 7543, 29918, 808, 453, 29918, 28040, 29918, 1450, 1296, 7464, 29896, 29892, 29945, 511, 5015, 29933, 3096, 29898, 15987, 1839, 1202, 29918, 7543, 29918, 808, 453, 29918, 28040, 29918, 1450, 1296, 7464, 29945, 29892, 29945, 876, 13, 12, 12, 12, 29897, 13, 12, 12, 29937, 1202, 29918, 7543, 29918, 808, 453, 29918, 28040, 29918, 28463, 3317, 13, 12, 12, 361, 525, 1202, 29918, 7543, 29918, 808, 453, 29918, 28040, 29918, 28463, 3317, 29915, 297, 2779, 29901, 13, 12, 12, 12, 28040, 29879, 29889, 4397, 29898, 15987, 1839, 1202, 29918, 7543, 29918, 808, 453, 29918, 28040, 29918, 28463, 3317, 11287, 13, 12, 12, 12, 1767, 29889, 4397, 877, 1649, 1068, 1988, 29933, 8396, 375, 624, 1446, 29901, 1068, 1649, 29905, 29876, 18717, 13, 12, 12, 12, 5015, 29933, 3096, 29898, 15987, 1839, 1202, 29918, 7543, 29918, 808, 453, 29918, 28040, 29918, 28463, 3317, 7464, 29906, 29892, 29906, 29897, 13, 12, 12, 12, 29897, 13, 12, 12, 29937, 7827, 22663, 13, 12, 12, 361, 20487, 29879, 29901, 13, 12, 12, 12, 1767, 29889, 4397, 877, 1649, 1068, 7976, 624, 1446, 29901, 1068, 1649, 29905, 29876, 18717, 13, 12, 12, 12, 5015, 29933, 3096, 29898, 1202, 29918, 28040, 29879, 29898, 28040, 29879, 511, 29906, 29892, 29906, 29897, 13, 12, 12, 12, 29897, 13, 12, 12, 12, 1454, 20487, 297, 20487, 29879, 29901, 13, 12, 12, 12, 12, 28040, 29922, 9464, 29903, 1839, 29933, 3096, 2033, 29961, 28040, 29962, 13, 12, 12, 12, 12, 361, 525, 348, 29918, 2972, 29915, 297, 20487, 29901, 13, 12, 12, 12, 12, 12, 1767, 29889, 4397, 877, 1649, 1068, 8431, 520, 287, 28386, 29901, 1068, 1649, 29905, 29876, 29995, 29879, 29915, 29995, 29317, 15300, 7122, 4197, 13, 12, 12, 12, 12, 12, 12, 9464, 29903, 1839, 8325, 2033, 29961, 5441, 22322, 978, 2033, 13, 12, 12, 12, 12, 12, 12, 1454, 5190, 297, 360, 8193, 29903, 1839, 8325, 2972, 2033, 29961, 28040, 1839, 348, 29918, 2972, 2033, 22322, 348, 1169, 2033, 13, 12, 12, 12, 12, 12, 29962, 4961, 13, 12, 12, 12, 12, 8690, 13, 12, 12, 12, 12, 29937, 23681, 3438, 398, 3646, 29871, 13, 13, 12, 12, 9621, 29889, 4397, 3319, 29915, 978, 2396, 29871, 525, 13971, 525, 29974, 710, 29898, 29875, 29974, 29896, 511, 12, 29871, 525, 1767, 2396, 11297, 29876, 4286, 7122, 29898, 1767, 511, 525, 14764, 2396, 8824, 1800, 13, 12, 29937, 29880, 487, 13, 12, 9621, 29889, 4397, 3319, 29915, 978, 2396, 525, 9868, 742, 259, 525, 1767, 2396, 5881, 1839, 13338, 7464, 525, 14764, 2396, 7700, 1800, 13, 12, 2457, 4235, 13, 13, 1753, 9160, 10983, 2187, 29898, 262, 420, 1125, 13, 12, 1116, 29879, 29922, 9464, 29903, 1839, 1168, 1547, 7543, 1116, 2187, 2033, 29961, 262, 420, 29962, 13, 12, 2267, 29922, 2636, 13, 12, 29937, 5441, 2318, 13, 12, 361, 525, 5441, 29918, 2972, 29915, 297, 2148, 29879, 29901, 13, 12, 12, 2267, 29889, 4397, 877, 2525, 1169, 29901, 525, 29974, 742, 15300, 7122, 4197, 13, 12, 12, 12, 9464, 29903, 1839, 8325, 2033, 29961, 29884, 262, 420, 22322, 978, 2033, 13, 12, 12, 12, 1454, 318, 262, 420, 297, 360, 8193, 29903, 1839, 8325, 2972, 2033, 29961, 1116, 29879, 1839, 5441, 29918, 2972, 2033, 22322, 348, 1169, 2033, 13, 12, 12, 12622, 13, 12, 29937, 9057, 2318, 13, 12, 361, 525, 9057, 29918, 2972, 29915, 297, 2148, 29879, 29901, 13, 12, 12, 2267, 29889, 4397, 877, 11947, 29879, 29901, 525, 29974, 742, 15300, 7122, 4197, 13, 12, 12, 12, 9464, 29903, 1839, 11947, 2033, 29961, 28789, 420, 22322, 978, 2033, 13, 12, 12, 12, 1454, 432, 262, 420, 297, 360, 8193, 29903, 1839, 11947, 2972, 2033, 29961, 1116, 29879, 1839, 9057, 29918, 2972, 2033, 22322, 9057, 29879, 2033, 13, 12, 12, 12622, 13, 12, 29937, 5029, 13, 12, 361, 525, 1116, 2187, 29918, 17664, 29915, 297, 2148, 29879, 29901, 13, 12, 12, 2267, 29889, 4397, 877, 2642, 29901, 525, 29974, 742, 15300, 7122, 29898, 1116, 29879, 1839, 1116, 2187, 29918, 17664, 25901, 13, 12, 29937, 29890, 7515, 13, 12, 361, 525, 29890, 7515, 29915, 297, 2148, 29879, 29901, 13, 12, 12, 2267, 29889, 4397, 877, 29933, 7515, 29901, 525, 29974, 742, 15300, 7122, 29898, 1116, 29879, 1839, 29890, 7515, 25901, 13, 13, 12, 2457, 11297, 29876, 4286, 7122, 29898, 2267, 29897, 13, 13, 1753, 788, 29918, 28040, 29879, 29898, 28040, 29879, 1125, 13, 12, 29937, 3198, 1134, 13, 12, 28040, 29879, 11759, 13, 12, 12, 8552, 29889, 24535, 8552, 29898, 9464, 29903, 1839, 29933, 3096, 2033, 29961, 28040, 2314, 565, 1134, 29898, 28040, 29897, 1360, 710, 1683, 3509, 29889, 24535, 8552, 29898, 28040, 29897, 13, 12, 12, 1454, 20487, 297, 20487, 29879, 13, 12, 29962, 13, 12, 29937, 1202, 9545, 701, 13, 12, 8768, 3790, 29915, 17185, 2396, 29912, 1118, 29915, 2528, 2396, 29912, 1118, 29915, 26262, 2396, 29912, 930, 13, 12, 1454, 20487, 297, 20487, 29879, 29901, 13, 12, 12, 1454, 1002, 297, 20487, 1839, 28040, 29879, 2033, 29901, 13, 12, 12, 12, 22449, 29922, 8768, 29961, 6112, 1839, 28667, 2033, 29962, 13, 12, 12, 12, 361, 1002, 1839, 1853, 2033, 451, 297, 2393, 29901, 13, 12, 12, 12, 12, 22449, 29961, 6112, 1839, 1853, 2033, 13192, 6112, 13, 12, 12, 12, 2870, 29901, 13, 12, 12, 12, 12, 22449, 29961, 6112, 1839, 1853, 2033, 22322, 1767, 29918, 2172, 2033, 23661, 6112, 1839, 1767, 29918, 2172, 2033, 13, 12, 12, 12, 12, 22449, 29961, 6112, 1839, 1853, 2033, 22322, 1767, 29918, 3317, 2033, 23661, 6112, 1839, 1767, 29918, 3317, 2033, 13, 12, 12, 12, 12, 22449, 29961, 6112, 1839, 1853, 2033, 22322, 1767, 29918, 650, 2033, 23661, 6112, 1839, 1767, 29918, 650, 2033, 13, 12, 29937, 276, 1765, 1250, 13, 12, 2457, 313, 10998, 28040, 29879, 2396, 29961, 13, 12, 12, 28040, 13, 12, 12, 1454, 2393, 29892, 7076, 297, 4072, 29889, 7076, 580, 13, 12, 12, 1454, 1820, 29892, 28040, 297, 4452, 29889, 7076, 580, 29871, 13, 12, 12, 29962, 1800, 2 ]
botenv/lib/python3.9/site-packages/apscheduler/schedulers/twisted.py
0xtuytuy/unit-crypto-ski-week-poap-bot
3
130636
<gh_stars>1-10 from __future__ import absolute_import from functools import wraps from apscheduler.schedulers.base import BaseScheduler from apscheduler.util import maybe_ref try: from twisted.internet import reactor as default_reactor except ImportError: # pragma: nocover raise ImportError('TwistedScheduler requires Twisted installed') def run_in_reactor(func): @wraps(func) def wrapper(self, *args, **kwargs): self._reactor.callFromThread(func, self, *args, **kwargs) return wrapper class TwistedScheduler(BaseScheduler): """ A scheduler that runs on a Twisted reactor. Extra options: =========== ======================================================== ``reactor`` Reactor instance to use (defaults to the global reactor) =========== ======================================================== """ _reactor = None _delayedcall = None def _configure(self, config): self._reactor = maybe_ref(config.pop('reactor', default_reactor)) super(TwistedScheduler, self)._configure(config) @run_in_reactor def shutdown(self, wait=True): super(TwistedScheduler, self).shutdown(wait) self._stop_timer() def _start_timer(self, wait_seconds): self._stop_timer() if wait_seconds is not None: self._delayedcall = self._reactor.callLater(wait_seconds, self.wakeup) def _stop_timer(self): if self._delayedcall and self._delayedcall.active(): self._delayedcall.cancel() del self._delayedcall @run_in_reactor def wakeup(self): self._stop_timer() wait_seconds = self._process_jobs() self._start_timer(wait_seconds) def _create_default_executor(self): from apscheduler.executors.twisted import TwistedExecutor return TwistedExecutor()
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 3166, 4770, 29888, 9130, 1649, 1053, 8380, 29918, 5215, 13, 13, 3166, 2090, 312, 8789, 1053, 11463, 567, 13, 13, 3166, 263, 567, 305, 14952, 29889, 816, 287, 352, 414, 29889, 3188, 1053, 7399, 4504, 14952, 13, 3166, 263, 567, 305, 14952, 29889, 4422, 1053, 5505, 29918, 999, 13, 13, 2202, 29901, 13, 1678, 515, 3252, 12652, 29889, 14168, 300, 1053, 337, 7168, 408, 2322, 29918, 276, 7168, 13, 19499, 16032, 2392, 29901, 29871, 396, 282, 23929, 29901, 302, 542, 957, 13, 1678, 12020, 16032, 2392, 877, 27418, 12652, 4504, 14952, 6858, 8168, 12652, 5130, 1495, 13, 13, 13, 1753, 1065, 29918, 262, 29918, 276, 7168, 29898, 9891, 1125, 13, 1678, 732, 29893, 336, 567, 29898, 9891, 29897, 13, 1678, 822, 14476, 29898, 1311, 29892, 334, 5085, 29892, 3579, 19290, 1125, 13, 4706, 1583, 3032, 276, 7168, 29889, 4804, 4591, 4899, 29898, 9891, 29892, 1583, 29892, 334, 5085, 29892, 3579, 19290, 29897, 13, 1678, 736, 14476, 13, 13, 13, 1990, 8168, 12652, 4504, 14952, 29898, 5160, 4504, 14952, 1125, 13, 1678, 9995, 13, 1678, 319, 1364, 14952, 393, 6057, 373, 263, 8168, 12652, 337, 7168, 29889, 13, 13, 1678, 7338, 336, 3987, 29901, 13, 13, 1678, 1275, 4936, 29922, 1275, 9166, 9166, 9166, 2751, 1360, 13, 1678, 4954, 276, 7168, 16159, 830, 7168, 2777, 304, 671, 313, 4381, 29879, 304, 278, 5534, 337, 7168, 29897, 13, 1678, 1275, 4936, 29922, 1275, 9166, 9166, 9166, 2751, 1360, 13, 1678, 9995, 13, 13, 1678, 903, 276, 7168, 353, 6213, 13, 1678, 903, 18829, 287, 4804, 353, 6213, 13, 13, 1678, 822, 903, 17591, 29898, 1311, 29892, 2295, 1125, 13, 4706, 1583, 3032, 276, 7168, 353, 5505, 29918, 999, 29898, 2917, 29889, 7323, 877, 276, 7168, 742, 2322, 29918, 276, 7168, 876, 13, 4706, 2428, 29898, 27418, 12652, 4504, 14952, 29892, 1583, 467, 29918, 17591, 29898, 2917, 29897, 13, 13, 1678, 732, 3389, 29918, 262, 29918, 276, 7168, 13, 1678, 822, 12522, 3204, 29898, 1311, 29892, 4480, 29922, 5574, 1125, 13, 4706, 2428, 29898, 27418, 12652, 4504, 14952, 29892, 1583, 467, 845, 329, 3204, 29898, 10685, 29897, 13, 4706, 1583, 3032, 9847, 29918, 20404, 580, 13, 13, 1678, 822, 903, 2962, 29918, 20404, 29898, 1311, 29892, 4480, 29918, 23128, 1125, 13, 4706, 1583, 3032, 9847, 29918, 20404, 580, 13, 4706, 565, 4480, 29918, 23128, 338, 451, 6213, 29901, 13, 9651, 1583, 3032, 18829, 287, 4804, 353, 1583, 3032, 276, 7168, 29889, 4804, 29931, 1008, 29898, 10685, 29918, 23128, 29892, 1583, 29889, 29893, 1296, 786, 29897, 13, 13, 1678, 822, 903, 9847, 29918, 20404, 29898, 1311, 1125, 13, 4706, 565, 1583, 3032, 18829, 287, 4804, 322, 1583, 3032, 18829, 287, 4804, 29889, 4925, 7295, 13, 9651, 1583, 3032, 18829, 287, 4804, 29889, 20713, 580, 13, 9651, 628, 1583, 3032, 18829, 287, 4804, 13, 13, 1678, 732, 3389, 29918, 262, 29918, 276, 7168, 13, 1678, 822, 281, 1296, 786, 29898, 1311, 1125, 13, 4706, 1583, 3032, 9847, 29918, 20404, 580, 13, 4706, 4480, 29918, 23128, 353, 1583, 3032, 5014, 29918, 9057, 29879, 580, 13, 4706, 1583, 3032, 2962, 29918, 20404, 29898, 10685, 29918, 23128, 29897, 13, 13, 1678, 822, 903, 3258, 29918, 4381, 29918, 4258, 3406, 29898, 1311, 1125, 13, 4706, 515, 263, 567, 305, 14952, 29889, 4258, 29560, 29889, 7516, 12652, 1053, 8168, 12652, 13366, 13, 4706, 736, 8168, 12652, 13366, 580, 13, 2 ]
artifacts/migrations/0010_auto_20201201_1208.py
Joe-Bentley/team_totem
0
146946
<reponame>Joe-Bentley/team_totem # Generated by Django 3.1.3 on 2020-12-01 12:08 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('artifacts', '0009_auto_20201201_1205'), ] operations = [ migrations.AlterField( model_name='artifact', name='image', field=models.ImageField(default='uploads/qmark.png', upload_to=''), ), ]
[ 1, 529, 276, 1112, 420, 29958, 29967, 7297, 29899, 29933, 296, 2330, 29914, 14318, 29918, 4260, 331, 13, 29937, 3251, 630, 491, 15337, 29871, 29941, 29889, 29896, 29889, 29941, 373, 29871, 29906, 29900, 29906, 29900, 29899, 29896, 29906, 29899, 29900, 29896, 29871, 29896, 29906, 29901, 29900, 29947, 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, 8813, 29879, 742, 525, 29900, 29900, 29900, 29929, 29918, 6921, 29918, 29906, 29900, 29906, 29900, 29896, 29906, 29900, 29896, 29918, 29896, 29906, 29900, 29945, 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, 8813, 742, 13, 9651, 1024, 2433, 3027, 742, 13, 9651, 1746, 29922, 9794, 29889, 2940, 3073, 29898, 4381, 2433, 9009, 29879, 29914, 29939, 3502, 29889, 2732, 742, 6441, 29918, 517, 2433, 5477, 13, 4706, 10353, 13, 1678, 4514, 13, 2 ]
pytype/__version__.py
souravbadami/pytype
1
63513
<filename>pytype/__version__.py # pylint: skip-file __version__ = '2020.04.01'
[ 1, 529, 9507, 29958, 2272, 1853, 29914, 1649, 3259, 26914, 2272, 13, 29937, 282, 2904, 524, 29901, 14383, 29899, 1445, 13, 1649, 3259, 1649, 353, 525, 29906, 29900, 29906, 29900, 29889, 29900, 29946, 29889, 29900, 29896, 29915, 13, 2 ]
ci/render_pipelines.py
vpnachev/gardenlinux
0
160323
<reponame>vpnachev/gardenlinux #!/usr/bin/env python3 import dacite import dataclasses import itertools import typing import yaml import glci.model import tkn.model GardenlinuxFlavour = glci.model.GardenlinuxFlavour Pipeline = tkn.model.Pipeline PipelineSpec = tkn.model.PipelineSpec PipelineMetadata = tkn.model.PipelineMetadata TaskRef = tkn.model.TaskRef PipelineTask = tkn.model.PipelineTask NamedParam = tkn.model.NamedParam def mk_pipeline_task( gardenlinux_flavour: GardenlinuxFlavour, pipeline_flavour: glci.model.PipelineFlavour, ): if not pipeline_flavour is glci.model.PipelineFlavour.SNAPSHOT: raise NotImplementedError(pipeline_flavour) feature_names = ','.join( e.value for e in ( gardenlinux_flavour.platform, *gardenlinux_flavour.extensions, *gardenlinux_flavour.modifiers, ) ) upload_prefix = f'snapshot/{gardenlinux_flavour.architecture.value}/' return PipelineTask( name=gardenlinux_flavour.canonical_name_prefix().replace('/', '-').replace('_', '-'), taskRef=TaskRef(name='build-gardenlinux-task'), # hardcode name for now params=[ NamedParam(name='features', value=feature_names), NamedParam(name='uploadprefix', value=upload_prefix), ], ) def mk_pipeline( gardenlinux_flavours: typing.Sequence[GardenlinuxFlavour] pipeline_flavour: glci.model.PipelineFlavour=glci.model.PipelineFlavour.SNAPSHOT, ): gardenlinux_flavours = set(gardenlinux_flavours) # mk unique pipeline = Pipeline( metadata=PipelineMetadata( name='build-gardenlinux-snapshot-pipeline', namespace='gardenlinux-tkn', ), spec=PipelineSpec( tasks=[ mk_pipeline_task( gardenlinux_flavour=glf, pipeline_flavour=pipeline_flavour, ), for glf in gardenlinux_flavours ], ), ) return pipeline def render_pipeline_dict( gardenlinux_flavours: typing.Sequence[GardenlinuxFlavour], ): gardenlinux_flavours = set(gardenlinux_flavours) # mk unique pipeline:dict = mk_pipeline(gardenlinux_flavours=gardenlinux_flavours) return pipeline def enumerate_build_flavours(build_yaml: str='../build.yaml'): with open(build_yaml) as f: parsed = yaml.safe_load(f) GardenlinuxFlavour = glci.model.GardenlinuxFlavour GardenlinuxFlavourCombination = glci.model.GardenlinuxFlavourCombination Architecture = glci.model.Architecture Platform = glci.model.Platform Extension = glci.model.Extension Modifier = glci.model.Modifier flavour_combinations = [ dacite.from_dict( data_class=GardenlinuxFlavourCombination, data=flavour_def, config=dacite.Config( cast=[Architecture, Platform, Extension, Modifier, typing.Tuple], ) ) for flavour_def in parsed['flavours'] ] for comb in flavour_combinations: for arch, platf, exts, mods in itertools.product( comb.architectures, comb.platforms, comb.extensions, comb.modifiers, ): yield GardenlinuxFlavour( architecture=arch, platform=platf, extensions=exts, modifiers=mods, # fails=comb.fails, # not part of variant ) def main(): gardenlinux_flavours = list(enumerate_build_flavours()) outfile = 'pipeline.yaml' pipeline:dict = render_pipeline_dict( gardenlinux_flavours=gardenlinux_flavours, ) with open(outfile, 'w') as f: yaml.safe_dump(dataclasses.asdict(pipeline), f) print(f'dumped pipeline with {len(gardenlinux_flavours)} task(s) to {outfile}') if __name__ == '__main__': main()
[ 1, 529, 276, 1112, 420, 29958, 29894, 21257, 1829, 29894, 29914, 29887, 7879, 9389, 13, 29937, 14708, 4855, 29914, 2109, 29914, 6272, 3017, 29941, 13, 13, 5215, 270, 562, 568, 13, 5215, 848, 13203, 13, 5215, 4256, 8504, 13, 5215, 19229, 13, 13, 5215, 343, 8807, 13, 13, 5215, 3144, 455, 29889, 4299, 13, 5215, 260, 3959, 29889, 4299, 13, 13, 29954, 7879, 9389, 29943, 4112, 473, 353, 3144, 455, 29889, 4299, 29889, 29954, 7879, 9389, 29943, 4112, 473, 13, 13, 29925, 23828, 353, 260, 3959, 29889, 4299, 29889, 29925, 23828, 13, 29925, 23828, 10299, 353, 260, 3959, 29889, 4299, 29889, 29925, 23828, 10299, 13, 29925, 23828, 18417, 353, 260, 3959, 29889, 4299, 29889, 29925, 23828, 18417, 13, 5398, 5620, 353, 260, 3959, 29889, 4299, 29889, 5398, 5620, 13, 29925, 23828, 5398, 353, 260, 3959, 29889, 4299, 29889, 29925, 23828, 5398, 13, 22175, 4736, 353, 260, 3959, 29889, 4299, 29889, 22175, 4736, 13, 13, 13, 1753, 14690, 29918, 13096, 5570, 29918, 7662, 29898, 13, 1678, 16423, 9389, 29918, 29888, 4112, 473, 29901, 19906, 9389, 29943, 4112, 473, 29892, 13, 1678, 16439, 29918, 29888, 4112, 473, 29901, 3144, 455, 29889, 4299, 29889, 29925, 23828, 29943, 4112, 473, 29892, 13, 1125, 13, 1678, 565, 451, 16439, 29918, 29888, 4112, 473, 338, 3144, 455, 29889, 4299, 29889, 29925, 23828, 29943, 4112, 473, 29889, 19296, 3301, 7068, 2891, 29901, 13, 4706, 12020, 2216, 1888, 2037, 287, 2392, 29898, 13096, 5570, 29918, 29888, 4112, 473, 29897, 13, 13, 1678, 4682, 29918, 7039, 353, 13420, 4286, 7122, 29898, 13, 4706, 321, 29889, 1767, 363, 321, 297, 313, 13, 9651, 16423, 9389, 29918, 29888, 4112, 473, 29889, 12120, 29892, 13, 9651, 334, 29887, 7879, 9389, 29918, 29888, 4112, 473, 29889, 24299, 29892, 13, 9651, 334, 29887, 7879, 9389, 29918, 29888, 4112, 473, 29889, 1545, 14903, 29892, 13, 4706, 1723, 13, 1678, 1723, 13, 13, 1678, 6441, 29918, 13506, 353, 285, 29915, 29879, 14551, 19248, 29887, 7879, 9389, 29918, 29888, 4112, 473, 29889, 25428, 29889, 1767, 6822, 29915, 13, 13, 1678, 736, 349, 23828, 5398, 29898, 13, 4706, 1024, 29922, 29887, 7879, 9389, 29918, 29888, 4112, 473, 29889, 3068, 265, 936, 29918, 978, 29918, 13506, 2141, 6506, 11219, 742, 17411, 2824, 6506, 877, 29918, 742, 17411, 5477, 13, 4706, 3414, 5620, 29922, 5398, 5620, 29898, 978, 2433, 4282, 29899, 29887, 7879, 9389, 29899, 7662, 5477, 396, 2898, 401, 1024, 363, 1286, 13, 4706, 8636, 11759, 13, 9651, 405, 2795, 4736, 29898, 978, 2433, 22100, 742, 995, 29922, 14394, 29918, 7039, 511, 13, 9651, 405, 2795, 4736, 29898, 978, 2433, 9009, 13506, 742, 995, 29922, 9009, 29918, 13506, 511, 13, 4706, 21251, 13, 1678, 1723, 13, 13, 13, 1753, 14690, 29918, 13096, 5570, 29898, 13, 1678, 16423, 9389, 29918, 29888, 4112, 2470, 29901, 19229, 29889, 20529, 29961, 29954, 7879, 9389, 29943, 4112, 473, 29962, 13, 1678, 16439, 29918, 29888, 4112, 473, 29901, 3144, 455, 29889, 4299, 29889, 29925, 23828, 29943, 4112, 473, 29922, 3820, 455, 29889, 4299, 29889, 29925, 23828, 29943, 4112, 473, 29889, 19296, 3301, 7068, 2891, 29892, 13, 1125, 13, 1678, 16423, 9389, 29918, 29888, 4112, 2470, 353, 731, 29898, 29887, 7879, 9389, 29918, 29888, 4112, 2470, 29897, 396, 14690, 5412, 13, 1678, 16439, 353, 349, 23828, 29898, 13, 4706, 15562, 29922, 29925, 23828, 18417, 29898, 13, 9651, 1024, 2433, 4282, 29899, 29887, 7879, 9389, 29899, 29879, 14551, 29899, 13096, 5570, 742, 13, 9651, 7397, 2433, 29887, 7879, 9389, 29899, 29873, 3959, 742, 13, 4706, 10353, 13, 4706, 1580, 29922, 29925, 23828, 10299, 29898, 13, 9651, 9595, 11759, 13, 9651, 14690, 29918, 13096, 5570, 29918, 7662, 29898, 13, 18884, 16423, 9389, 29918, 29888, 4112, 473, 29922, 3820, 29888, 29892, 13, 18884, 16439, 29918, 29888, 4112, 473, 29922, 13096, 5570, 29918, 29888, 4112, 473, 29892, 13, 9651, 10353, 13, 9651, 363, 3144, 29888, 297, 16423, 9389, 29918, 29888, 4112, 2470, 13, 9651, 21251, 13, 4706, 10353, 13, 1678, 1723, 13, 13, 1678, 736, 16439, 13, 13, 13, 1753, 4050, 29918, 13096, 5570, 29918, 8977, 29898, 13, 1678, 16423, 9389, 29918, 29888, 4112, 2470, 29901, 19229, 29889, 20529, 29961, 29954, 7879, 9389, 29943, 4112, 473, 1402, 13, 1125, 13, 1678, 16423, 9389, 29918, 29888, 4112, 2470, 353, 731, 29898, 29887, 7879, 9389, 29918, 29888, 4112, 2470, 29897, 396, 14690, 5412, 13, 1678, 16439, 29901, 8977, 353, 14690, 29918, 13096, 5570, 29898, 29887, 7879, 9389, 29918, 29888, 4112, 2470, 29922, 29887, 7879, 9389, 29918, 29888, 4112, 2470, 29897, 13, 13, 1678, 736, 16439, 13, 13, 13, 1753, 26985, 29918, 4282, 29918, 29888, 4112, 2470, 29898, 4282, 29918, 25162, 29901, 851, 2433, 6995, 4282, 29889, 25162, 29374, 13, 1678, 411, 1722, 29898, 4282, 29918, 25162, 29897, 408, 285, 29901, 13, 4706, 21213, 353, 343, 8807, 29889, 11177, 29918, 1359, 29898, 29888, 29897, 13, 13, 1678, 19906, 9389, 29943, 4112, 473, 353, 3144, 455, 29889, 4299, 29889, 29954, 7879, 9389, 29943, 4112, 473, 13, 1678, 19906, 9389, 29943, 4112, 473, 1523, 2109, 362, 353, 3144, 455, 29889, 4299, 29889, 29954, 7879, 9389, 29943, 4112, 473, 1523, 2109, 362, 13, 1678, 28333, 353, 3144, 455, 29889, 4299, 29889, 13197, 14819, 13, 1678, 28096, 353, 3144, 455, 29889, 4299, 29889, 21889, 13, 1678, 7338, 2673, 353, 3144, 455, 29889, 4299, 29889, 17657, 13, 1678, 3382, 3709, 353, 3144, 455, 29889, 4299, 29889, 2111, 3709, 13, 13, 1678, 21054, 473, 29918, 510, 2109, 800, 353, 518, 13, 4706, 270, 562, 568, 29889, 3166, 29918, 8977, 29898, 13, 9651, 848, 29918, 1990, 29922, 29954, 7879, 9389, 29943, 4112, 473, 1523, 2109, 362, 29892, 13, 9651, 848, 29922, 29888, 4112, 473, 29918, 1753, 29892, 13, 9651, 2295, 29922, 29881, 562, 568, 29889, 3991, 29898, 13, 18884, 4320, 11759, 13197, 14819, 29892, 28096, 29892, 7338, 2673, 29892, 3382, 3709, 29892, 19229, 29889, 23215, 552, 1402, 13, 9651, 1723, 13, 4706, 1723, 363, 21054, 473, 29918, 1753, 297, 21213, 1839, 29888, 4112, 2470, 2033, 13, 1678, 4514, 13, 1678, 363, 4145, 297, 21054, 473, 29918, 510, 2109, 800, 29901, 13, 4706, 363, 3190, 29892, 18870, 29888, 29892, 1294, 29879, 29892, 878, 29879, 297, 4256, 8504, 29889, 4704, 29898, 13, 9651, 4145, 29889, 1279, 4496, 1973, 29892, 13, 9651, 4145, 29889, 12120, 29879, 29892, 13, 9651, 4145, 29889, 24299, 29892, 13, 9651, 4145, 29889, 1545, 14903, 29892, 13, 308, 1125, 13, 9651, 7709, 19906, 9389, 29943, 4112, 473, 29898, 13, 18884, 11258, 29922, 1279, 29892, 13, 18884, 7481, 29922, 572, 271, 29888, 29892, 13, 18884, 17752, 29922, 1062, 29879, 29892, 13, 18884, 878, 14903, 29922, 1545, 29879, 29892, 13, 18884, 396, 8465, 29922, 17743, 29889, 29888, 2234, 29892, 396, 451, 760, 310, 17305, 13, 9651, 1723, 13, 13, 13, 1753, 1667, 7295, 13, 1678, 16423, 9389, 29918, 29888, 4112, 2470, 353, 1051, 29898, 15172, 29918, 4282, 29918, 29888, 4112, 2470, 3101, 13, 1678, 714, 1445, 353, 525, 13096, 5570, 29889, 25162, 29915, 13, 13, 1678, 16439, 29901, 8977, 353, 4050, 29918, 13096, 5570, 29918, 8977, 29898, 13, 4706, 16423, 9389, 29918, 29888, 4112, 2470, 29922, 29887, 7879, 9389, 29918, 29888, 4112, 2470, 29892, 13, 1678, 1723, 13, 13, 1678, 411, 1722, 29898, 449, 1445, 29892, 525, 29893, 1495, 408, 285, 29901, 13, 4706, 343, 8807, 29889, 11177, 29918, 15070, 29898, 1272, 13203, 29889, 294, 8977, 29898, 13096, 5570, 511, 285, 29897, 13, 13, 1678, 1596, 29898, 29888, 29915, 15070, 287, 16439, 411, 426, 2435, 29898, 29887, 7879, 9389, 29918, 29888, 4112, 2470, 2915, 3414, 29898, 29879, 29897, 304, 426, 449, 1445, 29913, 1495, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 1667, 580, 13, 2 ]
Latest/venv/Lib/site-packages/apptools/io/h5/utils.py
adamcvj/SatelliteTracker
1
20740
from contextlib import contextmanager from .file import H5File @contextmanager def open_h5file(filename, mode='r+', **kwargs): """Context manager for reading an HDF5 file as an H5File object. Parameters ---------- filename : str HDF5 file name. mode : str Mode to open the file: 'r' : Read-only 'w' : Write; create new file (an existing file would be deleted). 'a' : Read and write to file; create if not existing 'r+': Read and write to file; must already exist See `H5File` for additional keyword arguments. """ h5 = H5File(filename, mode=mode, **kwargs) try: yield h5 finally: h5.close()
[ 1, 515, 3030, 1982, 1053, 3030, 12847, 13, 13, 3166, 869, 1445, 1053, 379, 29945, 2283, 13, 13, 13, 29992, 4703, 12847, 13, 1753, 1722, 29918, 29882, 29945, 1445, 29898, 9507, 29892, 4464, 2433, 29878, 29974, 742, 3579, 19290, 1125, 13, 1678, 9995, 2677, 8455, 363, 5183, 385, 379, 4037, 29945, 934, 408, 385, 379, 29945, 2283, 1203, 29889, 13, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 1678, 10422, 584, 851, 13, 4706, 379, 4037, 29945, 934, 1024, 29889, 13, 1678, 4464, 584, 851, 13, 4706, 21864, 304, 1722, 278, 934, 29901, 13, 13, 4706, 525, 29878, 29915, 584, 7523, 29899, 6194, 13, 4706, 525, 29893, 29915, 584, 14350, 29936, 1653, 716, 934, 313, 273, 5923, 934, 723, 367, 11132, 467, 13, 4706, 525, 29874, 29915, 584, 7523, 322, 2436, 304, 934, 29936, 1653, 565, 451, 5923, 13, 4706, 525, 29878, 29974, 2396, 7523, 322, 2436, 304, 934, 29936, 1818, 2307, 1863, 13, 13, 1678, 2823, 421, 29950, 29945, 2283, 29952, 363, 5684, 13553, 6273, 29889, 13, 1678, 9995, 13, 1678, 298, 29945, 353, 379, 29945, 2283, 29898, 9507, 29892, 4464, 29922, 8513, 29892, 3579, 19290, 29897, 13, 1678, 1018, 29901, 13, 4706, 7709, 298, 29945, 13, 1678, 7146, 29901, 13, 4706, 298, 29945, 29889, 5358, 580, 13, 2 ]
interpreter/interpreter.py
JASchilz/RoverMUD
4
61585
<reponame>JASchilz/RoverMUD #------------------------------------------------------------------------------ # interpreter/interpreter.py # Copyright 2011 <NAME> # Licensed under Apache v2 #------------------------------------------------------------------------------ articles = [" a ", " the "] def verb(command): # A function to isolate the verb in a command. this_verb = "" the_rest = "" first_space = command.find(" ") # If this_input contains a space, the verb is everything before the # first space. if first_space > 0: this_verb = command[0:first_space] the_rest = command[first_space + 1:len(command)] # If it doesn't contain a space, the whole thing is the verb. else: this_verb = command # We handle simple verb aliases at this level... if command[0] == "'": this_verb = "say" the_rest = command[1:len(command)] if command == "north" or command == "n": this_verb = "go" the_rest = "north" elif command == "south" or command == "s": this_verb = "go" the_rest = "south" elif command == "east" or command == "e": this_verb = "go" the_rest = "east" elif command == "west" or command == "w": this_verb = "go" the_rest = "west" elif command == "up" or command == "u": this_verb = "go" the_rest = "up" elif command == "down" or command == "d": this_verb = "go" the_rest = "down" if this_verb == "l": this_verb = "look" elif this_verb == "i": this_verb = "inv" elif this_verb == "h": this_verb = "health" return this_verb, the_rest def interpret(the_verb, the_rest, transitivity=1): the_rest = " " + the_rest.lower() + " " for article in articles: the_rest = the_rest.replace(article, '') if transitivity == 1: the_rest = the_rest.strip().split() if len(the_rest) > 0: # This might not be stable. return [the_rest.pop(), the_rest] else: return False
[ 1, 529, 276, 1112, 420, 29958, 29967, 3289, 305, 309, 29920, 29914, 29934, 957, 29924, 15789, 13, 29937, 2683, 2683, 2683, 2683, 9072, 489, 13, 29937, 259, 26997, 29914, 1639, 1457, 357, 29889, 2272, 13, 29937, 259, 14187, 1266, 29871, 29906, 29900, 29896, 29896, 529, 5813, 29958, 13, 29937, 259, 10413, 21144, 1090, 13380, 325, 29906, 13, 29937, 2683, 2683, 2683, 2683, 9072, 489, 13, 13, 18569, 353, 6796, 263, 9162, 376, 278, 376, 29962, 13, 13, 13, 1753, 9750, 29898, 6519, 1125, 13, 1678, 396, 319, 740, 304, 11695, 403, 278, 9750, 297, 263, 1899, 29889, 13, 13, 1678, 445, 29918, 18248, 353, 5124, 13, 1678, 278, 29918, 5060, 353, 5124, 13, 13, 1678, 937, 29918, 3493, 353, 1899, 29889, 2886, 703, 16521, 13, 13, 1678, 396, 960, 445, 29918, 2080, 3743, 263, 2913, 29892, 278, 9750, 338, 4129, 1434, 278, 13, 1678, 396, 937, 2913, 29889, 13, 1678, 565, 937, 29918, 3493, 1405, 29871, 29900, 29901, 13, 4706, 445, 29918, 18248, 353, 1899, 29961, 29900, 29901, 4102, 29918, 3493, 29962, 13, 4706, 278, 29918, 5060, 353, 1899, 29961, 4102, 29918, 3493, 718, 29871, 29896, 29901, 2435, 29898, 6519, 4638, 13, 1678, 396, 960, 372, 1838, 29915, 29873, 1712, 263, 2913, 29892, 278, 3353, 2655, 338, 278, 9750, 29889, 13, 1678, 1683, 29901, 13, 4706, 445, 29918, 18248, 353, 1899, 13, 13, 1678, 396, 1334, 4386, 2560, 9750, 14430, 2129, 472, 445, 3233, 856, 13, 1678, 565, 1899, 29961, 29900, 29962, 1275, 13577, 1115, 13, 4706, 445, 29918, 18248, 353, 376, 20834, 29908, 13, 4706, 278, 29918, 5060, 353, 1899, 29961, 29896, 29901, 2435, 29898, 6519, 4638, 13, 13, 1678, 565, 1899, 1275, 376, 29876, 2072, 29908, 470, 1899, 1275, 376, 29876, 1115, 13, 4706, 445, 29918, 18248, 353, 376, 1484, 29908, 13, 4706, 278, 29918, 5060, 353, 376, 29876, 2072, 29908, 13, 1678, 25342, 1899, 1275, 376, 29879, 2438, 29908, 470, 1899, 1275, 376, 29879, 1115, 13, 4706, 445, 29918, 18248, 353, 376, 1484, 29908, 13, 4706, 278, 29918, 5060, 353, 376, 29879, 2438, 29908, 13, 1678, 25342, 1899, 1275, 376, 23027, 29908, 470, 1899, 1275, 376, 29872, 1115, 13, 4706, 445, 29918, 18248, 353, 376, 1484, 29908, 13, 4706, 278, 29918, 5060, 353, 376, 23027, 29908, 13, 1678, 25342, 1899, 1275, 376, 5933, 29908, 470, 1899, 1275, 376, 29893, 1115, 13, 4706, 445, 29918, 18248, 353, 376, 1484, 29908, 13, 4706, 278, 29918, 5060, 353, 376, 5933, 29908, 13, 1678, 25342, 1899, 1275, 376, 786, 29908, 470, 1899, 1275, 376, 29884, 1115, 13, 4706, 445, 29918, 18248, 353, 376, 1484, 29908, 13, 4706, 278, 29918, 5060, 353, 376, 786, 29908, 13, 1678, 25342, 1899, 1275, 376, 3204, 29908, 470, 1899, 1275, 376, 29881, 1115, 13, 4706, 445, 29918, 18248, 353, 376, 1484, 29908, 13, 4706, 278, 29918, 5060, 353, 376, 3204, 29908, 13, 13, 1678, 565, 445, 29918, 18248, 1275, 376, 29880, 1115, 13, 4706, 445, 29918, 18248, 353, 376, 6914, 29908, 13, 1678, 25342, 445, 29918, 18248, 1275, 376, 29875, 1115, 13, 4706, 445, 29918, 18248, 353, 376, 11569, 29908, 13, 1678, 25342, 445, 29918, 18248, 1275, 376, 29882, 1115, 13, 4706, 445, 29918, 18248, 353, 376, 354, 4298, 29908, 13, 13, 1678, 736, 445, 29918, 18248, 29892, 278, 29918, 5060, 13, 13, 13, 1753, 6613, 29898, 1552, 29918, 18248, 29892, 278, 29918, 5060, 29892, 1301, 24858, 29922, 29896, 1125, 13, 13, 1678, 278, 29918, 5060, 353, 376, 376, 718, 278, 29918, 5060, 29889, 13609, 580, 718, 376, 376, 13, 13, 1678, 363, 4274, 297, 7456, 29901, 13, 4706, 278, 29918, 5060, 353, 278, 29918, 5060, 29889, 6506, 29898, 7914, 29892, 27255, 13, 13, 1678, 565, 1301, 24858, 1275, 29871, 29896, 29901, 13, 4706, 278, 29918, 5060, 353, 278, 29918, 5060, 29889, 17010, 2141, 5451, 580, 13, 13, 4706, 565, 7431, 29898, 1552, 29918, 5060, 29897, 1405, 29871, 29900, 29901, 13, 9651, 396, 910, 1795, 451, 367, 13714, 29889, 13, 9651, 736, 518, 1552, 29918, 5060, 29889, 7323, 3285, 278, 29918, 5060, 29962, 13, 13, 4706, 1683, 29901, 13, 9651, 736, 7700, 13, 2 ]
imperative/python/test/unit/core/test_interpreter.py
chenls/MegEngine
3
66879
<filename>imperative/python/test/unit/core/test_interpreter.py import subprocess import sys import numpy as np import pytest import megengine as mge import megengine.functional as F from megengine.core._imperative_rt.core2 import ( _set_drop_flag, _set_swap_flag, config_async_level, get_async_level, ) def test_basic(): config_async_level(2) assert get_async_level() == 2 with pytest.raises(RuntimeError): config_async_level(3) def test_level1_infer_value(): config_async_level(1) a = mge.tensor([[1, 2], [2, 3], [3, 4]], dtype="float32") b = mge.tensor([1, 1], dtype="float32") identity = mge.tensor(np.array([[1, 0], [0, 1]]), dtype="float32") # make DepType::VALUE unknown c = F.matmul(b, identity) with pytest.raises(RuntimeError): d = F.reshape(a, c) config_async_level(2) def test_level1_infer_shape_with_unknown(): config_async_level(2) a = mge.tensor([[1, 2, 2, 3]], dtype="float32") b = mge.tensor([1, 1], dtype="float32") multi2 = mge.tensor(np.array([[2, 0], [0, 2]]), dtype="float32") c = F.matmul(b, multi2) # make DepType::SHAPE unknown d = F.reshape(a, c) e = mge.tensor([[1, 2]], dtype="float32") config_async_level(1) # test src no shape, throw in level1 with pytest.raises(RuntimeError): f = F.reshape(d, b) with pytest.raises(RuntimeError): g = F.matmul(d, e) config_async_level(2) def test_host_compute_elemwise(): a = mge.tensor([[1, 2], [2, 3], [3, 4]], dtype="float32") b = mge.tensor([1, 1], dtype="int32") # check DepType::VALUE is still known c = b * 2 with pytest.raises(RuntimeError): d = F.reshape(a, c) def test_swap_drop_basic(): _set_swap_flag(True) _set_drop_flag(True) # test xpu compute x = mge.tensor(np.ones((3, 3)), dtype=np.float32) y = mge.tensor(np.ones((3, 3)), dtype=np.float32) z = x + y x._swap_out() z._drop() z.numpy() # test host value compute x = mge.tensor(np.ones((2, 2)), dtype=np.float32) y = mge.tensor(np.ones((2, 2)), dtype=np.float32) z = x + y x._swap_out() z._drop() z.numpy() _set_swap_flag(False) _set_drop_flag(False) def test_finalize(): prog = """ import megengine with megengine.core.option("enable_host_compute", 0): x = megengine.tensor(0) y = x + 1 y.numpy() """ subprocess.check_call([sys.executable, "-c", prog])
[ 1, 529, 9507, 29958, 26039, 1230, 29914, 4691, 29914, 1688, 29914, 5441, 29914, 3221, 29914, 1688, 29918, 1639, 1457, 357, 29889, 2272, 13, 5215, 1014, 5014, 13, 5215, 10876, 13, 13, 5215, 12655, 408, 7442, 13, 5215, 11451, 1688, 13, 13, 5215, 4508, 10599, 408, 286, 479, 13, 5215, 4508, 10599, 29889, 2220, 284, 408, 383, 13, 3166, 4508, 10599, 29889, 3221, 3032, 26039, 1230, 29918, 2273, 29889, 3221, 29906, 1053, 313, 13, 1678, 903, 842, 29918, 8865, 29918, 15581, 29892, 13, 1678, 903, 842, 29918, 26276, 29918, 15581, 29892, 13, 1678, 2295, 29918, 12674, 29918, 5563, 29892, 13, 1678, 679, 29918, 12674, 29918, 5563, 29892, 13, 29897, 13, 13, 13, 1753, 1243, 29918, 16121, 7295, 13, 1678, 2295, 29918, 12674, 29918, 5563, 29898, 29906, 29897, 13, 1678, 4974, 679, 29918, 12674, 29918, 5563, 580, 1275, 29871, 29906, 13, 1678, 411, 11451, 1688, 29889, 336, 4637, 29898, 7944, 2392, 1125, 13, 4706, 2295, 29918, 12674, 29918, 5563, 29898, 29941, 29897, 13, 13, 13, 1753, 1243, 29918, 5563, 29896, 29918, 262, 571, 29918, 1767, 7295, 13, 1678, 2295, 29918, 12674, 29918, 5563, 29898, 29896, 29897, 13, 1678, 263, 353, 286, 479, 29889, 20158, 4197, 29961, 29896, 29892, 29871, 29906, 1402, 518, 29906, 29892, 29871, 29941, 1402, 518, 29941, 29892, 29871, 29946, 20526, 26688, 543, 7411, 29941, 29906, 1159, 13, 1678, 289, 353, 286, 479, 29889, 20158, 4197, 29896, 29892, 29871, 29896, 1402, 26688, 543, 7411, 29941, 29906, 1159, 13, 1678, 10110, 353, 286, 479, 29889, 20158, 29898, 9302, 29889, 2378, 4197, 29961, 29896, 29892, 29871, 29900, 1402, 518, 29900, 29892, 29871, 29896, 5262, 511, 26688, 543, 7411, 29941, 29906, 1159, 13, 1678, 396, 1207, 10034, 1542, 1057, 19143, 9815, 13, 1678, 274, 353, 383, 29889, 2922, 16109, 29898, 29890, 29892, 10110, 29897, 13, 1678, 411, 11451, 1688, 29889, 336, 4637, 29898, 7944, 2392, 1125, 13, 4706, 270, 353, 383, 29889, 690, 14443, 29898, 29874, 29892, 274, 29897, 13, 1678, 2295, 29918, 12674, 29918, 5563, 29898, 29906, 29897, 13, 13, 13, 1753, 1243, 29918, 5563, 29896, 29918, 262, 571, 29918, 12181, 29918, 2541, 29918, 26690, 7295, 13, 1678, 2295, 29918, 12674, 29918, 5563, 29898, 29906, 29897, 13, 1678, 263, 353, 286, 479, 29889, 20158, 4197, 29961, 29896, 29892, 29871, 29906, 29892, 29871, 29906, 29892, 29871, 29941, 20526, 26688, 543, 7411, 29941, 29906, 1159, 13, 1678, 289, 353, 286, 479, 29889, 20158, 4197, 29896, 29892, 29871, 29896, 1402, 26688, 543, 7411, 29941, 29906, 1159, 13, 1678, 2473, 29906, 353, 286, 479, 29889, 20158, 29898, 9302, 29889, 2378, 4197, 29961, 29906, 29892, 29871, 29900, 1402, 518, 29900, 29892, 29871, 29906, 5262, 511, 26688, 543, 7411, 29941, 29906, 1159, 13, 1678, 274, 353, 383, 29889, 2922, 16109, 29898, 29890, 29892, 2473, 29906, 29897, 13, 1678, 396, 1207, 10034, 1542, 1057, 7068, 3301, 29923, 9815, 13, 1678, 270, 353, 383, 29889, 690, 14443, 29898, 29874, 29892, 274, 29897, 13, 1678, 321, 353, 286, 479, 29889, 20158, 4197, 29961, 29896, 29892, 29871, 29906, 20526, 26688, 543, 7411, 29941, 29906, 1159, 13, 1678, 2295, 29918, 12674, 29918, 5563, 29898, 29896, 29897, 13, 1678, 396, 1243, 4765, 694, 8267, 29892, 3183, 297, 3233, 29896, 13, 1678, 411, 11451, 1688, 29889, 336, 4637, 29898, 7944, 2392, 1125, 13, 4706, 285, 353, 383, 29889, 690, 14443, 29898, 29881, 29892, 289, 29897, 13, 1678, 411, 11451, 1688, 29889, 336, 4637, 29898, 7944, 2392, 1125, 13, 4706, 330, 353, 383, 29889, 2922, 16109, 29898, 29881, 29892, 321, 29897, 13, 1678, 2295, 29918, 12674, 29918, 5563, 29898, 29906, 29897, 13, 13, 13, 1753, 1243, 29918, 3069, 29918, 26017, 29918, 20461, 3538, 7295, 13, 1678, 263, 353, 286, 479, 29889, 20158, 4197, 29961, 29896, 29892, 29871, 29906, 1402, 518, 29906, 29892, 29871, 29941, 1402, 518, 29941, 29892, 29871, 29946, 20526, 26688, 543, 7411, 29941, 29906, 1159, 13, 1678, 289, 353, 286, 479, 29889, 20158, 4197, 29896, 29892, 29871, 29896, 1402, 26688, 543, 524, 29941, 29906, 1159, 13, 1678, 396, 1423, 10034, 1542, 1057, 19143, 338, 1603, 2998, 13, 1678, 274, 353, 289, 334, 29871, 29906, 13, 1678, 411, 11451, 1688, 29889, 336, 4637, 29898, 7944, 2392, 1125, 13, 4706, 270, 353, 383, 29889, 690, 14443, 29898, 29874, 29892, 274, 29897, 13, 13, 13, 1753, 1243, 29918, 26276, 29918, 8865, 29918, 16121, 7295, 13, 1678, 903, 842, 29918, 26276, 29918, 15581, 29898, 5574, 29897, 13, 1678, 903, 842, 29918, 8865, 29918, 15581, 29898, 5574, 29897, 13, 1678, 396, 1243, 921, 3746, 10272, 13, 1678, 921, 353, 286, 479, 29889, 20158, 29898, 9302, 29889, 2873, 3552, 29941, 29892, 29871, 29941, 8243, 26688, 29922, 9302, 29889, 7411, 29941, 29906, 29897, 13, 1678, 343, 353, 286, 479, 29889, 20158, 29898, 9302, 29889, 2873, 3552, 29941, 29892, 29871, 29941, 8243, 26688, 29922, 9302, 29889, 7411, 29941, 29906, 29897, 13, 1678, 503, 353, 921, 718, 343, 13, 1678, 921, 3032, 26276, 29918, 449, 580, 13, 1678, 503, 3032, 8865, 580, 13, 1678, 503, 29889, 23749, 580, 13, 1678, 396, 1243, 3495, 995, 10272, 13, 1678, 921, 353, 286, 479, 29889, 20158, 29898, 9302, 29889, 2873, 3552, 29906, 29892, 29871, 29906, 8243, 26688, 29922, 9302, 29889, 7411, 29941, 29906, 29897, 13, 1678, 343, 353, 286, 479, 29889, 20158, 29898, 9302, 29889, 2873, 3552, 29906, 29892, 29871, 29906, 8243, 26688, 29922, 9302, 29889, 7411, 29941, 29906, 29897, 13, 1678, 503, 353, 921, 718, 343, 13, 1678, 921, 3032, 26276, 29918, 449, 580, 13, 1678, 503, 3032, 8865, 580, 13, 1678, 503, 29889, 23749, 580, 13, 1678, 903, 842, 29918, 26276, 29918, 15581, 29898, 8824, 29897, 13, 1678, 903, 842, 29918, 8865, 29918, 15581, 29898, 8824, 29897, 13, 13, 13, 1753, 1243, 29918, 8394, 675, 7295, 13, 1678, 410, 29887, 353, 9995, 13, 5215, 4508, 10599, 13, 2541, 4508, 10599, 29889, 3221, 29889, 3385, 703, 12007, 29918, 3069, 29918, 26017, 613, 29871, 29900, 1125, 13, 1678, 921, 353, 4508, 10599, 29889, 20158, 29898, 29900, 29897, 13, 1678, 343, 353, 921, 718, 29871, 29896, 13, 1678, 343, 29889, 23749, 580, 13, 15945, 29908, 13, 1678, 1014, 5014, 29889, 3198, 29918, 4804, 4197, 9675, 29889, 4258, 9246, 29892, 11663, 29883, 613, 410, 29887, 2314, 13, 2 ]
pcbdl/netlistsvg.py
maxschommer/pcbdl
117
1612064
# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from .base import Part, PartInstancePin, Net from .context import * import pcbdl.small_parts as small_parts import collections import json import os import re import subprocess import tempfile """Renders our circuit into svg with the help of netlistsvg.""" __all__ = ["generate_svg", "SVGPage"] NETLISTSVG_LOCATION = os.path.expanduser( os.environ.get("NETLISTSVG_LOCATION", "~/netlistsvg")) NET_REGEX_ALL = ".*" class SVGNet(object): def __init__(self, instance, schematic_page): self.instance = instance self.schematic_page = schematic_page current_node_number = -1 @classmethod def get_next_node_number(cls): cls.current_node_number += 1 return cls.current_node_number def categorize_groups(self): self.grouped_connections = [] for original_group in self.instance.grouped_connections: group = list(original_group) # make a copy so we can fragment it group_pin_count = sum(len(pin.part.pins) for pin in group) self.grouped_connections.append(group) if self.schematic_page.airwires < 2: continue #if group_pin_count < 40: #continue first_big_part = None for pin in original_group: if len(pin.part.pins) <= 3: # part is too small, probably should stay here continue if first_big_part is None: first_big_part = pin.part continue if pin.part is not first_big_part: # too many big parts here, move this one out #print("Too many big parts in %s group %r, moving %r out" % (self.instance.name, group, pin)) group.remove(pin) self.grouped_connections.append((pin,)) self.node_numbers = [self.get_next_node_number() for group in self.grouped_connections] def _find_group(self, pin): if not hasattr(self, "node_numbers"): self.categorize_groups() for i, group in enumerate(self.grouped_connections): if pin in group: return i, group raise ValueError("Can't find pin %s on %s" % (pin, self.instance)) def get_other_pins_in_group(self, pin): _, group = self._find_group(pin) return group def get_node_number(self, pin): group_idx, _ = self._find_group(pin) if self.schematic_page.airwires == 0: return self.node_numbers[0] return self.node_numbers[group_idx] class SVGPart(object): SKIN_MAPPING = { # pcbdl_class: (skin_alias_name, pin_names, is_symmetric, is_rotatable) # more specific comes first small_parts.R: ("r_", "AB", True, True), small_parts.C: ("c_", "AB", True, True), small_parts.L: ("l_", "AB", True, True), small_parts.LED: ("d_led_", "+-", False, True), small_parts.D: ("d_", "+-", False, True), } SKIN_MAPPING_INSTANCES = tuple(SKIN_MAPPING.keys()) def __init__(self, part, schematic_page): self.part = part self.schematic_page = schematic_page self.svg_type = part.refdes self.is_skinned = False self.skin_pin_names = () self.is_symmetric = False self.is_rotatable = False for possible_class, skin_properties in self.SKIN_MAPPING.items(): if isinstance(part, possible_class): self.is_skinned = True self.svg_type, self.skin_pin_names, self.is_symmetric, self.is_rotatable = skin_properties break def attach_net_name_port(self, net, net_node_number, direction): self.schematic_page.ports_dict["%s_node%s" % (net.name, str(net_node_number))] = { "bits": [net_node_number], "direction": direction } def attach_net_name(self, net, net_node_number, display=True): netname_entry = self.schematic_page.netnames_dict[net.name] if net_node_number not in netname_entry["bits"]: # avoid duplicates netname_entry["bits"].append(net_node_number) if display: netname_entry["hide_name"] = 0 def attach_power_symbol(self, net, net_node_number): name = net.name if len(name) > 10: name = name.replace("PP","") name = name.replace("_VREF","") power_symbol = { "connections": {"A": [net_node_number]}, "attributes": {"name": name}, "type": "gnd" if net.is_gnd else "vcc", } if name == "GND": # redundant del power_symbol["attributes"]["name"] cell_name = "power_symbol_%d" % (net_node_number) self.schematic_page.cells_dict[cell_name] = power_symbol def should_draw_pin(self, pin): if not pin._net: # if we don't have a pin name, do it conditionally based on if a regex is set return self.schematic_page.net_regex.pattern == NET_REGEX_ALL else: return self.schematic_page.net_regex.match(str(pin.net.name)) def add_parts(self, indent_depth=""): # Every real part might yield multiple smaller parts (eg: airwires, gnd/vcc connections) part = self.part self.schematic_page.parts_to_draw.remove(part) connections = {} port_directions = {} parts_to_bring_on_page = [] pin_count = len(part.pins) for i, pin in enumerate(part.pins): name = "%s (%s)" % (pin.name, ", ".join(pin.numbers)) if self.skin_pin_names: # if possible we need to match pin names with the skin file in netlistsvg name = self.skin_pin_names[i] DIRECTIONS = ["output", "input"] # aka right, left port_directions[name] = DIRECTIONS[i < pin_count/2] # TODO: Make this depend on pin type, instead of such a rough heuristic if "OUT" in pin.name: port_directions[name] = "output" if "IN" in pin.name: port_directions[name] = "input" if "EN" in pin.name: port_directions[name] = "input" is_connector = part.refdes.startswith("J") or part.refdes.startswith("CN") if is_connector: try: pin_number = int(pin.number) except ValueError: pass else: port_directions[name] = DIRECTIONS[pin_number % 2] pin_net = pin._net if pin_net: if hasattr(pin_net, "parent"): pin_net = pin_net.parent pin_net_helper = self.schematic_page.net_helpers[pin_net] net_node_number = pin_net_helper.get_node_number(pin) connections[name] = [net_node_number] for other_pin in pin_net_helper.get_other_pins_in_group(pin): other_part = other_pin.part parts_to_bring_on_page.append(other_part) else: # Make up a new disposable connection connections[name] = [SVGNet.get_next_node_number()] skip_drawing_pin = not self.should_draw_pin(pin) if self.is_skinned or part.refdes.startswith("Q"): # if any other pins good on a small part, we should draw the whole part (all pins) for other_pin in set(part.pins) - set((pin,)): if self.should_draw_pin(other_pin): skip_drawing_pin = False if pin in self.schematic_page.pins_to_skip: skip_drawing_pin = True if skip_drawing_pin: del connections[name] continue self.schematic_page.pins_drawn.append(pin) self.schematic_page.pin_count += 1 if pin_net: display_net_name = pin.net.has_name if pin.net.is_gnd or pin.net.is_power: self.attach_power_symbol(pin.net, net_node_number) display_net_name = False self.attach_net_name(pin.net, net_node_number, display=display_net_name) if not connections: return if self.is_rotatable: suffix = "h" swap_pins = False for i, pin in enumerate(part.pins): if pin.net.is_power: suffix = "v" if i != 0: swap_pins = True if pin.net.is_gnd: suffix = "v" if i != 1: swap_pins = True #TODO maybe keep it horizontal if both sides .is_power if swap_pins and self.is_symmetric: mapping = {"A": "B", "B": "A"} connections = {mapping[name]:v for name, v in connections.items()} if self.is_rotatable: self.svg_type += suffix self.schematic_page.cells_dict[self.part.refdes] = { "connections": connections, "port_directions": port_directions, "attributes": {"value": part.value}, "type": self.svg_type } print(indent_depth + str(part)) # Make sure the other related parts are squeezed on this page for other_part in parts_to_bring_on_page: if other_part not in self.schematic_page.parts_to_draw: # we already drew it earlier continue self.schematic_page.part_helpers[other_part].add_parts(indent_depth + " ") class SVGPage(object): """Represents single .svg page""" def __init__(self, net_regex=NET_REGEX_ALL, airwires=2, pins_to_skip=[], max_pin_count=None, context=global_context): self.net_regex = re.compile(net_regex) self.airwires = airwires self.context = context self.max_pin_count = max_pin_count self.pin_count = 0 self.pins_to_skip = pins_to_skip self.pins_drawn = [] self.cells_dict = {} self.netnames_dict = collections.defaultdict(lambda: {"bits": [], "hide_name": 1}) self.ports_dict = {} # start helper classes self.net_helpers = {} for net in self.context.net_list: self.net_helpers[net] = SVGNet(net, self) self.part_helpers = {} for part in self.context.parts_list: self.part_helpers[part] = SVGPart(part, self) class PageEmpty(Exception): pass def write_json(self, fp): """Generate the json input required for netlistsvg and dumps it to a file.""" self.parts_to_draw = collections.deque(self.context.parts_list) while self.parts_to_draw: if self.max_pin_count and self.pin_count > self.max_pin_count: # stop drawing, this page is too cluttered break part = self.parts_to_draw[0] self.part_helpers[part].add_parts() if not self.pins_drawn: raise self.PageEmpty big_dict = {"modules": {"SVG Output": { "cells": self.cells_dict, "netnames": self.netnames_dict, "ports": self.ports_dict, }}} json.dump(big_dict, fp, indent=4) fp.flush() def generate(self): """Calls netlistsvg to generate the page and returns the svg contents as a string.""" with tempfile.NamedTemporaryFile("w", prefix="netlistsvg_input_", suffix=".json", delete=False) as json_file, \ tempfile.NamedTemporaryFile("r", prefix="netlistsvg_output_", suffix=".svg", delete=False) as netlistsvg_output: self.write_json(json_file) netlistsvg_command = [ "/usr/bin/env", "node", os.path.join(NETLISTSVG_LOCATION, "bin", "netlistsvg.js"), "--skin", os.path.join(NETLISTSVG_LOCATION, "lib", "analog.svg"), json_file.name, "-o", netlistsvg_output.name ] print(netlistsvg_command) subprocess.call(netlistsvg_command) svg_contents = netlistsvg_output.read() # When a net appears in a few places (when we have airwires), we need to disambiguage the parts of the net # so netlistsvg doesn't think they're actually the same net and should connect them together. # Remove the extra decoration: svg_contents = re.sub("_node\d+", "", svg_contents) return svg_contents def generate_svg(*args, **kwargs): pins_to_skip = [] while True: n = SVGPage(*args, **kwargs, pins_to_skip=pins_to_skip) try: svg_contents = n.generate() except SVGPage.PageEmpty: break pins_to_skip += n.pins_drawn yield svg_contents
[ 1, 396, 14187, 1266, 29871, 29906, 29900, 29896, 29929, 5087, 365, 12182, 13, 29937, 13, 29937, 10413, 21144, 1090, 278, 13380, 19245, 29892, 10079, 29871, 29906, 29889, 29900, 313, 1552, 376, 29931, 293, 1947, 1496, 13, 29937, 366, 1122, 451, 671, 445, 934, 5174, 297, 752, 13036, 411, 278, 19245, 29889, 13, 29937, 887, 1122, 4017, 263, 3509, 310, 278, 19245, 472, 13, 29937, 13, 29937, 268, 2045, 597, 1636, 29889, 4288, 29889, 990, 29914, 506, 11259, 29914, 27888, 1430, 1660, 29899, 29906, 29889, 29900, 13, 29937, 13, 29937, 25870, 3734, 491, 22903, 4307, 470, 15502, 304, 297, 5007, 29892, 7047, 13, 29937, 13235, 1090, 278, 19245, 338, 13235, 373, 385, 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, 869, 3188, 1053, 3455, 29892, 3455, 4998, 29925, 262, 29892, 12670, 13, 3166, 869, 4703, 1053, 334, 13, 5215, 22844, 6448, 29880, 29889, 9278, 29918, 20895, 408, 2319, 29918, 20895, 13, 13, 5215, 16250, 13, 5215, 4390, 13, 5215, 2897, 13, 5215, 337, 13, 5215, 1014, 5014, 13, 5215, 5694, 1445, 13, 13, 15945, 29908, 29934, 21043, 1749, 11369, 964, 25773, 411, 278, 1371, 310, 7787, 1761, 15120, 1213, 15945, 13, 1649, 497, 1649, 353, 6796, 17158, 29918, 15120, 613, 376, 7597, 29954, 5074, 3108, 13, 13, 6006, 24360, 7597, 29954, 29918, 16652, 8098, 353, 2897, 29889, 2084, 29889, 18837, 1792, 29898, 13, 1678, 2897, 29889, 21813, 29889, 657, 703, 6006, 24360, 7597, 29954, 29918, 16652, 8098, 613, 376, 20038, 1212, 1761, 15120, 5783, 13, 13, 6006, 29918, 1525, 1692, 29990, 29918, 9818, 353, 376, 5575, 29908, 13, 13, 1990, 13955, 29954, 6779, 29898, 3318, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 2777, 29892, 1364, 19217, 29918, 3488, 1125, 13, 4706, 1583, 29889, 8758, 353, 2777, 13, 4706, 1583, 29889, 816, 19217, 29918, 3488, 353, 1364, 19217, 29918, 3488, 13, 13, 1678, 1857, 29918, 3177, 29918, 4537, 353, 448, 29896, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 679, 29918, 4622, 29918, 3177, 29918, 4537, 29898, 25932, 1125, 13, 4706, 1067, 29879, 29889, 3784, 29918, 3177, 29918, 4537, 4619, 29871, 29896, 13, 4706, 736, 1067, 29879, 29889, 3784, 29918, 3177, 29918, 4537, 13, 13, 1678, 822, 11608, 675, 29918, 13155, 29898, 1311, 1125, 13, 4706, 1583, 29889, 2972, 287, 29918, 11958, 1953, 353, 5159, 13, 13, 4706, 363, 2441, 29918, 2972, 297, 1583, 29889, 8758, 29889, 2972, 287, 29918, 11958, 1953, 29901, 13, 9651, 2318, 353, 1051, 29898, 13492, 29918, 2972, 29897, 396, 1207, 263, 3509, 577, 591, 508, 9376, 372, 13, 9651, 2318, 29918, 12687, 29918, 2798, 353, 2533, 29898, 2435, 29898, 12687, 29889, 1595, 29889, 29886, 1144, 29897, 363, 12534, 297, 2318, 29897, 13, 9651, 1583, 29889, 2972, 287, 29918, 11958, 1953, 29889, 4397, 29898, 2972, 29897, 13, 13, 9651, 565, 1583, 29889, 816, 19217, 29918, 3488, 29889, 1466, 29893, 2658, 529, 29871, 29906, 29901, 13, 18884, 6773, 13, 13, 9651, 396, 361, 2318, 29918, 12687, 29918, 2798, 529, 29871, 29946, 29900, 29901, 13, 18884, 396, 19878, 13, 13, 9651, 937, 29918, 3752, 29918, 1595, 353, 6213, 13, 9651, 363, 12534, 297, 2441, 29918, 2972, 29901, 13, 18884, 565, 7431, 29898, 12687, 29889, 1595, 29889, 29886, 1144, 29897, 5277, 29871, 29941, 29901, 13, 462, 1678, 396, 760, 338, 2086, 2319, 29892, 3117, 881, 7952, 1244, 13, 462, 1678, 6773, 13, 13, 18884, 565, 937, 29918, 3752, 29918, 1595, 338, 6213, 29901, 13, 462, 1678, 937, 29918, 3752, 29918, 1595, 353, 12534, 29889, 1595, 13, 462, 1678, 6773, 13, 13, 18884, 565, 12534, 29889, 1595, 338, 451, 937, 29918, 3752, 29918, 1595, 29901, 13, 462, 1678, 396, 2086, 1784, 4802, 5633, 1244, 29892, 4337, 445, 697, 714, 13, 462, 1678, 396, 2158, 703, 1762, 29877, 1784, 4802, 5633, 297, 1273, 29879, 2318, 1273, 29878, 29892, 8401, 1273, 29878, 714, 29908, 1273, 313, 1311, 29889, 8758, 29889, 978, 29892, 2318, 29892, 12534, 876, 13, 462, 1678, 2318, 29889, 5992, 29898, 12687, 29897, 13, 462, 1678, 1583, 29889, 2972, 287, 29918, 11958, 1953, 29889, 4397, 3552, 12687, 29892, 876, 13, 13, 13, 4706, 1583, 29889, 3177, 29918, 20326, 353, 518, 1311, 29889, 657, 29918, 4622, 29918, 3177, 29918, 4537, 580, 13, 9651, 363, 2318, 297, 1583, 29889, 2972, 287, 29918, 11958, 1953, 29962, 13, 13, 1678, 822, 903, 2886, 29918, 2972, 29898, 1311, 29892, 12534, 1125, 13, 4706, 565, 451, 756, 5552, 29898, 1311, 29892, 376, 3177, 29918, 20326, 29908, 1125, 13, 9651, 1583, 29889, 29883, 20440, 675, 29918, 13155, 580, 13, 13, 4706, 363, 474, 29892, 2318, 297, 26985, 29898, 1311, 29889, 2972, 287, 29918, 11958, 1953, 1125, 13, 9651, 565, 12534, 297, 2318, 29901, 13, 18884, 736, 474, 29892, 2318, 13, 13, 4706, 12020, 7865, 2392, 703, 6028, 29915, 29873, 1284, 12534, 1273, 29879, 373, 1273, 29879, 29908, 1273, 313, 12687, 29892, 1583, 29889, 8758, 876, 13, 13, 1678, 822, 679, 29918, 1228, 29918, 29886, 1144, 29918, 262, 29918, 2972, 29898, 1311, 29892, 12534, 1125, 13, 4706, 17117, 2318, 353, 1583, 3032, 2886, 29918, 2972, 29898, 12687, 29897, 13, 4706, 736, 2318, 13, 13, 1678, 822, 679, 29918, 3177, 29918, 4537, 29898, 1311, 29892, 12534, 1125, 13, 4706, 2318, 29918, 13140, 29892, 903, 353, 1583, 3032, 2886, 29918, 2972, 29898, 12687, 29897, 13, 13, 4706, 565, 1583, 29889, 816, 19217, 29918, 3488, 29889, 1466, 29893, 2658, 1275, 29871, 29900, 29901, 13, 9651, 736, 1583, 29889, 3177, 29918, 20326, 29961, 29900, 29962, 13, 4706, 736, 1583, 29889, 3177, 29918, 20326, 29961, 2972, 29918, 13140, 29962, 13, 13, 1990, 13955, 29954, 7439, 29898, 3318, 1125, 13, 1678, 18581, 1177, 29918, 1529, 18009, 4214, 353, 426, 396, 22844, 6448, 29880, 29918, 1990, 29901, 313, 808, 262, 29918, 19973, 29918, 978, 29892, 12534, 29918, 7039, 29892, 338, 29918, 11967, 16414, 29892, 338, 29918, 5450, 17219, 29897, 13, 4706, 396, 901, 2702, 5304, 937, 13, 4706, 2319, 29918, 20895, 29889, 29934, 29901, 259, 4852, 29878, 29918, 613, 376, 2882, 613, 5852, 29892, 5852, 511, 13, 4706, 2319, 29918, 20895, 29889, 29907, 29901, 259, 4852, 29883, 29918, 613, 376, 2882, 613, 5852, 29892, 5852, 511, 13, 4706, 2319, 29918, 20895, 29889, 29931, 29901, 259, 4852, 29880, 29918, 613, 376, 2882, 613, 5852, 29892, 5852, 511, 13, 4706, 2319, 29918, 20895, 29889, 20566, 29901, 4852, 29881, 29918, 839, 29918, 613, 15691, 29899, 613, 7700, 29892, 5852, 511, 13, 4706, 2319, 29918, 20895, 29889, 29928, 29901, 259, 4852, 29881, 29918, 613, 15691, 29899, 613, 7700, 29892, 5852, 511, 13, 1678, 500, 13, 1678, 18581, 1177, 29918, 1529, 18009, 4214, 29918, 25580, 2190, 27266, 353, 18761, 29898, 16033, 1177, 29918, 1529, 18009, 4214, 29889, 8149, 3101, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 760, 29892, 1364, 19217, 29918, 3488, 1125, 13, 4706, 1583, 29889, 1595, 353, 760, 13, 4706, 1583, 29889, 816, 19217, 29918, 3488, 353, 1364, 19217, 29918, 3488, 13, 13, 4706, 1583, 29889, 15120, 29918, 1853, 353, 760, 29889, 999, 2783, 13, 4706, 1583, 29889, 275, 29918, 808, 27464, 353, 7700, 13, 4706, 1583, 29889, 808, 262, 29918, 12687, 29918, 7039, 353, 3861, 13, 4706, 1583, 29889, 275, 29918, 11967, 16414, 353, 7700, 13, 4706, 1583, 29889, 275, 29918, 5450, 17219, 353, 7700, 13, 13, 4706, 363, 1950, 29918, 1990, 29892, 19309, 29918, 11330, 297, 1583, 29889, 16033, 1177, 29918, 1529, 18009, 4214, 29889, 7076, 7295, 13, 9651, 565, 338, 8758, 29898, 1595, 29892, 1950, 29918, 1990, 1125, 13, 18884, 1583, 29889, 275, 29918, 808, 27464, 353, 5852, 13, 18884, 1583, 29889, 15120, 29918, 1853, 29892, 1583, 29889, 808, 262, 29918, 12687, 29918, 7039, 29892, 1583, 29889, 275, 29918, 11967, 16414, 29892, 1583, 29889, 275, 29918, 5450, 17219, 353, 19309, 29918, 11330, 13, 18884, 2867, 13, 13, 1678, 822, 10641, 29918, 1212, 29918, 978, 29918, 637, 29898, 1311, 29892, 7787, 29892, 7787, 29918, 3177, 29918, 4537, 29892, 5305, 1125, 13, 4706, 1583, 29889, 816, 19217, 29918, 3488, 29889, 4011, 29918, 8977, 3366, 29995, 29879, 29918, 3177, 29995, 29879, 29908, 1273, 313, 1212, 29889, 978, 29892, 851, 29898, 1212, 29918, 3177, 29918, 4537, 28166, 353, 426, 13, 9651, 376, 14836, 1115, 518, 1212, 29918, 3177, 29918, 4537, 1402, 13, 9651, 376, 20845, 1115, 5305, 13, 4706, 500, 13, 13, 1678, 822, 10641, 29918, 1212, 29918, 978, 29898, 1311, 29892, 7787, 29892, 7787, 29918, 3177, 29918, 4537, 29892, 2479, 29922, 5574, 1125, 13, 4706, 7787, 978, 29918, 8269, 353, 1583, 29889, 816, 19217, 29918, 3488, 29889, 1212, 7039, 29918, 8977, 29961, 1212, 29889, 978, 29962, 13, 4706, 565, 7787, 29918, 3177, 29918, 4537, 451, 297, 7787, 978, 29918, 8269, 3366, 14836, 3108, 29901, 396, 4772, 20955, 13, 9651, 7787, 978, 29918, 8269, 3366, 14836, 16862, 4397, 29898, 1212, 29918, 3177, 29918, 4537, 29897, 13, 4706, 565, 2479, 29901, 13, 9651, 7787, 978, 29918, 8269, 3366, 11458, 29918, 978, 3108, 353, 29871, 29900, 13, 13, 1678, 822, 10641, 29918, 13519, 29918, 18098, 29898, 1311, 29892, 7787, 29892, 7787, 29918, 3177, 29918, 4537, 1125, 13, 4706, 1024, 353, 7787, 29889, 978, 13, 4706, 565, 7431, 29898, 978, 29897, 1405, 29871, 29896, 29900, 29901, 13, 9651, 1024, 353, 1024, 29889, 6506, 703, 18009, 3284, 1159, 13, 9651, 1024, 353, 1024, 29889, 6506, 703, 29918, 29963, 25866, 3284, 1159, 13, 13, 4706, 3081, 29918, 18098, 353, 426, 13, 9651, 376, 11958, 1953, 1115, 8853, 29909, 1115, 518, 1212, 29918, 3177, 29918, 4537, 29962, 1118, 13, 9651, 376, 15697, 1115, 8853, 978, 1115, 1024, 1118, 13, 9651, 376, 1853, 1115, 376, 29887, 299, 29908, 565, 7787, 29889, 275, 29918, 29887, 299, 1683, 376, 29894, 617, 613, 13, 4706, 500, 13, 13, 4706, 565, 1024, 1275, 376, 29954, 2797, 1115, 13, 9651, 396, 28005, 13, 9651, 628, 3081, 29918, 18098, 3366, 15697, 3108, 3366, 978, 3108, 13, 13, 4706, 3038, 29918, 978, 353, 376, 13519, 29918, 18098, 29918, 29995, 29881, 29908, 1273, 313, 1212, 29918, 3177, 29918, 4537, 29897, 13, 4706, 1583, 29889, 816, 19217, 29918, 3488, 29889, 3729, 29879, 29918, 8977, 29961, 3729, 29918, 978, 29962, 353, 3081, 29918, 18098, 13, 13, 1678, 822, 881, 29918, 4012, 29918, 12687, 29898, 1311, 29892, 12534, 1125, 13, 4706, 565, 451, 12534, 3032, 1212, 29901, 13, 9651, 396, 565, 591, 1016, 29915, 29873, 505, 263, 12534, 1024, 29892, 437, 372, 4195, 635, 2729, 373, 565, 263, 6528, 338, 731, 13, 9651, 736, 1583, 29889, 816, 19217, 29918, 3488, 29889, 1212, 29918, 13087, 29889, 11037, 1275, 405, 2544, 29918, 1525, 1692, 29990, 29918, 9818, 13, 4706, 1683, 29901, 13, 9651, 736, 1583, 29889, 816, 19217, 29918, 3488, 29889, 1212, 29918, 13087, 29889, 4352, 29898, 710, 29898, 12687, 29889, 1212, 29889, 978, 876, 13, 13, 1678, 822, 788, 29918, 20895, 29898, 1311, 29892, 29536, 29918, 19488, 13776, 1125, 13, 4706, 396, 7569, 1855, 760, 1795, 7709, 2999, 7968, 5633, 313, 387, 29901, 4799, 29893, 2658, 29892, 330, 299, 29914, 29894, 617, 12368, 29897, 13, 4706, 760, 353, 1583, 29889, 1595, 13, 4706, 1583, 29889, 816, 19217, 29918, 3488, 29889, 20895, 29918, 517, 29918, 4012, 29889, 5992, 29898, 1595, 29897, 13, 13, 4706, 12368, 353, 6571, 13, 4706, 2011, 29918, 20146, 1953, 353, 6571, 13, 13, 4706, 5633, 29918, 517, 29918, 1182, 292, 29918, 265, 29918, 3488, 353, 5159, 13, 13, 4706, 12534, 29918, 2798, 353, 7431, 29898, 1595, 29889, 29886, 1144, 29897, 13, 4706, 363, 474, 29892, 12534, 297, 26985, 29898, 1595, 29889, 29886, 1144, 1125, 13, 9651, 1024, 353, 11860, 29879, 313, 29995, 29879, 5513, 1273, 313, 12687, 29889, 978, 29892, 9162, 11393, 7122, 29898, 12687, 29889, 20326, 876, 13, 9651, 565, 1583, 29889, 808, 262, 29918, 12687, 29918, 7039, 29901, 13, 18884, 396, 565, 1950, 591, 817, 304, 1993, 12534, 2983, 411, 278, 19309, 934, 297, 7787, 1761, 15120, 13, 18884, 1024, 353, 1583, 29889, 808, 262, 29918, 12687, 29918, 7039, 29961, 29875, 29962, 13, 13, 9651, 22471, 1525, 9838, 29903, 353, 6796, 4905, 613, 376, 2080, 3108, 396, 263, 1335, 1492, 29892, 2175, 13, 9651, 2011, 29918, 20146, 1953, 29961, 978, 29962, 353, 22471, 1525, 9838, 29903, 29961, 29875, 529, 12534, 29918, 2798, 29914, 29906, 29962, 13, 13, 9651, 396, 14402, 29901, 8561, 445, 8839, 373, 12534, 1134, 29892, 2012, 310, 1316, 263, 12164, 540, 332, 4695, 13, 9651, 565, 376, 12015, 29908, 297, 12534, 29889, 978, 29901, 13, 18884, 2011, 29918, 20146, 1953, 29961, 978, 29962, 353, 376, 4905, 29908, 13, 9651, 565, 376, 1177, 29908, 297, 12534, 29889, 978, 29901, 13, 18884, 2011, 29918, 20146, 1953, 29961, 978, 29962, 353, 376, 2080, 29908, 13, 9651, 565, 376, 1430, 29908, 297, 12534, 29889, 978, 29901, 13, 18884, 2011, 29918, 20146, 1953, 29961, 978, 29962, 353, 376, 2080, 29908, 13, 13, 9651, 338, 29918, 11958, 2801, 353, 760, 29889, 999, 2783, 29889, 27382, 2541, 703, 29967, 1159, 470, 760, 29889, 999, 2783, 29889, 27382, 2541, 703, 13778, 1159, 13, 9651, 565, 338, 29918, 11958, 2801, 29901, 13, 18884, 1018, 29901, 13, 462, 1678, 12534, 29918, 4537, 353, 938, 29898, 12687, 29889, 4537, 29897, 13, 18884, 5174, 7865, 2392, 29901, 13, 462, 1678, 1209, 13, 18884, 1683, 29901, 13, 462, 1678, 2011, 29918, 20146, 1953, 29961, 978, 29962, 353, 22471, 1525, 9838, 29903, 29961, 12687, 29918, 4537, 1273, 29871, 29906, 29962, 13, 13, 9651, 12534, 29918, 1212, 353, 12534, 3032, 1212, 13, 9651, 565, 12534, 29918, 1212, 29901, 13, 18884, 565, 756, 5552, 29898, 12687, 29918, 1212, 29892, 376, 3560, 29908, 1125, 13, 462, 1678, 12534, 29918, 1212, 353, 12534, 29918, 1212, 29889, 3560, 13, 13, 18884, 12534, 29918, 1212, 29918, 20907, 353, 1583, 29889, 816, 19217, 29918, 3488, 29889, 1212, 29918, 3952, 6774, 29961, 12687, 29918, 1212, 29962, 13, 13, 18884, 7787, 29918, 3177, 29918, 4537, 353, 12534, 29918, 1212, 29918, 20907, 29889, 657, 29918, 3177, 29918, 4537, 29898, 12687, 29897, 13, 18884, 12368, 29961, 978, 29962, 353, 518, 1212, 29918, 3177, 29918, 4537, 29962, 13, 13, 18884, 363, 916, 29918, 12687, 297, 12534, 29918, 1212, 29918, 20907, 29889, 657, 29918, 1228, 29918, 29886, 1144, 29918, 262, 29918, 2972, 29898, 12687, 1125, 13, 462, 1678, 916, 29918, 1595, 353, 916, 29918, 12687, 29889, 1595, 13, 462, 1678, 5633, 29918, 517, 29918, 1182, 292, 29918, 265, 29918, 3488, 29889, 4397, 29898, 1228, 29918, 1595, 29897, 13, 9651, 1683, 29901, 13, 18884, 396, 8561, 701, 263, 716, 11549, 519, 3957, 13, 18884, 12368, 29961, 978, 29962, 353, 518, 7597, 29954, 6779, 29889, 657, 29918, 4622, 29918, 3177, 29918, 4537, 580, 29962, 13, 13, 9651, 14383, 29918, 4012, 292, 29918, 12687, 353, 451, 1583, 29889, 9344, 29918, 4012, 29918, 12687, 29898, 12687, 29897, 13, 13, 9651, 565, 1583, 29889, 275, 29918, 808, 27464, 470, 760, 29889, 999, 2783, 29889, 27382, 2541, 703, 29984, 29908, 1125, 13, 18884, 396, 565, 738, 916, 282, 1144, 1781, 373, 263, 2319, 760, 29892, 591, 881, 4216, 278, 3353, 760, 313, 497, 282, 1144, 29897, 13, 18884, 363, 916, 29918, 12687, 297, 731, 29898, 1595, 29889, 29886, 1144, 29897, 448, 731, 3552, 12687, 29892, 22164, 13, 462, 1678, 565, 1583, 29889, 9344, 29918, 4012, 29918, 12687, 29898, 1228, 29918, 12687, 1125, 13, 462, 4706, 14383, 29918, 4012, 292, 29918, 12687, 353, 7700, 13, 13, 9651, 565, 12534, 297, 1583, 29889, 816, 19217, 29918, 3488, 29889, 29886, 1144, 29918, 517, 29918, 11014, 29901, 13, 18884, 14383, 29918, 4012, 292, 29918, 12687, 353, 5852, 13, 13, 9651, 565, 14383, 29918, 4012, 292, 29918, 12687, 29901, 13, 18884, 628, 12368, 29961, 978, 29962, 13, 18884, 6773, 13, 13, 9651, 1583, 29889, 816, 19217, 29918, 3488, 29889, 29886, 1144, 29918, 19811, 1233, 29889, 4397, 29898, 12687, 29897, 13, 9651, 1583, 29889, 816, 19217, 29918, 3488, 29889, 12687, 29918, 2798, 4619, 29871, 29896, 13, 13, 9651, 565, 12534, 29918, 1212, 29901, 13, 18884, 2479, 29918, 1212, 29918, 978, 353, 12534, 29889, 1212, 29889, 5349, 29918, 978, 13, 18884, 565, 12534, 29889, 1212, 29889, 275, 29918, 29887, 299, 470, 12534, 29889, 1212, 29889, 275, 29918, 13519, 29901, 13, 462, 1678, 1583, 29889, 14930, 29918, 13519, 29918, 18098, 29898, 12687, 29889, 1212, 29892, 7787, 29918, 3177, 29918, 4537, 29897, 13, 462, 1678, 2479, 29918, 1212, 29918, 978, 353, 7700, 13, 18884, 1583, 29889, 14930, 29918, 1212, 29918, 978, 29898, 12687, 29889, 1212, 29892, 7787, 29918, 3177, 29918, 4537, 29892, 2479, 29922, 4990, 29918, 1212, 29918, 978, 29897, 13, 13, 4706, 565, 451, 12368, 29901, 13, 9651, 736, 13, 13, 4706, 565, 1583, 29889, 275, 29918, 5450, 17219, 29901, 13, 9651, 25557, 353, 376, 29882, 29908, 13, 9651, 17945, 29918, 29886, 1144, 353, 7700, 13, 9651, 363, 474, 29892, 12534, 297, 26985, 29898, 1595, 29889, 29886, 1144, 1125, 13, 18884, 565, 12534, 29889, 1212, 29889, 275, 29918, 13519, 29901, 13, 462, 1678, 25557, 353, 376, 29894, 29908, 13, 462, 1678, 565, 474, 2804, 29871, 29900, 29901, 13, 462, 4706, 17945, 29918, 29886, 1144, 353, 5852, 13, 18884, 565, 12534, 29889, 1212, 29889, 275, 29918, 29887, 299, 29901, 13, 462, 1678, 25557, 353, 376, 29894, 29908, 13, 462, 1678, 565, 474, 2804, 29871, 29896, 29901, 13, 462, 4706, 17945, 29918, 29886, 1144, 353, 5852, 13, 18884, 396, 4986, 3970, 5505, 3013, 372, 14698, 565, 1716, 11192, 869, 275, 29918, 13519, 13, 13, 9651, 565, 17945, 29918, 29886, 1144, 322, 1583, 29889, 275, 29918, 11967, 16414, 29901, 13, 18884, 10417, 353, 8853, 29909, 1115, 376, 29933, 613, 376, 29933, 1115, 376, 29909, 9092, 13, 18884, 12368, 353, 426, 20698, 29961, 978, 5387, 29894, 13, 462, 1678, 363, 1024, 29892, 325, 297, 12368, 29889, 7076, 28296, 13, 13, 9651, 565, 1583, 29889, 275, 29918, 5450, 17219, 29901, 13, 18884, 1583, 29889, 15120, 29918, 1853, 4619, 25557, 13, 13, 4706, 1583, 29889, 816, 19217, 29918, 3488, 29889, 3729, 29879, 29918, 8977, 29961, 1311, 29889, 1595, 29889, 999, 2783, 29962, 353, 426, 13, 9651, 376, 11958, 1953, 1115, 12368, 29892, 13, 9651, 376, 637, 29918, 20146, 1953, 1115, 2011, 29918, 20146, 1953, 29892, 13, 9651, 376, 15697, 1115, 8853, 1767, 1115, 760, 29889, 1767, 1118, 13, 9651, 376, 1853, 1115, 1583, 29889, 15120, 29918, 1853, 13, 4706, 500, 13, 13, 4706, 1596, 29898, 12860, 29918, 19488, 718, 851, 29898, 1595, 876, 13, 13, 4706, 396, 8561, 1854, 278, 916, 4475, 5633, 526, 269, 802, 6096, 287, 373, 445, 1813, 13, 4706, 363, 916, 29918, 1595, 297, 5633, 29918, 517, 29918, 1182, 292, 29918, 265, 29918, 3488, 29901, 13, 9651, 565, 916, 29918, 1595, 451, 297, 1583, 29889, 816, 19217, 29918, 3488, 29889, 20895, 29918, 517, 29918, 4012, 29901, 13, 18884, 396, 591, 2307, 15010, 372, 8859, 13, 18884, 6773, 13, 13, 9651, 1583, 29889, 816, 19217, 29918, 3488, 29889, 1595, 29918, 3952, 6774, 29961, 1228, 29918, 1595, 1822, 1202, 29918, 20895, 29898, 12860, 29918, 19488, 718, 376, 16521, 13, 13, 1990, 13955, 29954, 5074, 29898, 3318, 1125, 13, 1678, 9995, 1123, 4569, 1237, 2323, 869, 15120, 1813, 15945, 29908, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 7787, 29918, 13087, 29922, 6006, 29918, 1525, 1692, 29990, 29918, 9818, 29892, 4799, 29893, 2658, 29922, 29906, 29892, 282, 1144, 29918, 517, 29918, 11014, 11759, 1402, 4236, 29918, 12687, 29918, 2798, 29922, 8516, 29892, 3030, 29922, 10945, 29918, 4703, 1125, 13, 4706, 1583, 29889, 1212, 29918, 13087, 353, 337, 29889, 12198, 29898, 1212, 29918, 13087, 29897, 13, 4706, 1583, 29889, 1466, 29893, 2658, 353, 4799, 29893, 2658, 13, 4706, 1583, 29889, 4703, 353, 3030, 13, 13, 4706, 1583, 29889, 3317, 29918, 12687, 29918, 2798, 353, 4236, 29918, 12687, 29918, 2798, 13, 4706, 1583, 29889, 12687, 29918, 2798, 353, 29871, 29900, 13, 13, 4706, 1583, 29889, 29886, 1144, 29918, 517, 29918, 11014, 353, 282, 1144, 29918, 517, 29918, 11014, 13, 4706, 1583, 29889, 29886, 1144, 29918, 19811, 1233, 353, 5159, 13, 13, 4706, 1583, 29889, 3729, 29879, 29918, 8977, 353, 6571, 13, 4706, 1583, 29889, 1212, 7039, 29918, 8977, 353, 16250, 29889, 4381, 8977, 29898, 2892, 29901, 8853, 14836, 1115, 19997, 376, 11458, 29918, 978, 1115, 29871, 29896, 1800, 13, 4706, 1583, 29889, 4011, 29918, 8977, 353, 6571, 13, 13, 4706, 396, 1369, 16876, 4413, 13, 4706, 1583, 29889, 1212, 29918, 3952, 6774, 353, 6571, 13, 4706, 363, 7787, 297, 1583, 29889, 4703, 29889, 1212, 29918, 1761, 29901, 13, 9651, 1583, 29889, 1212, 29918, 3952, 6774, 29961, 1212, 29962, 353, 13955, 29954, 6779, 29898, 1212, 29892, 1583, 29897, 13, 13, 4706, 1583, 29889, 1595, 29918, 3952, 6774, 353, 6571, 13, 4706, 363, 760, 297, 1583, 29889, 4703, 29889, 20895, 29918, 1761, 29901, 13, 9651, 1583, 29889, 1595, 29918, 3952, 6774, 29961, 1595, 29962, 353, 13955, 29954, 7439, 29898, 1595, 29892, 1583, 29897, 13, 13, 1678, 770, 9305, 8915, 29898, 2451, 1125, 13, 4706, 1209, 13, 13, 1678, 822, 2436, 29918, 3126, 29898, 1311, 29892, 285, 29886, 1125, 13, 4706, 9995, 5631, 403, 278, 4390, 1881, 3734, 363, 7787, 1761, 15120, 322, 270, 17204, 372, 304, 263, 934, 1213, 15945, 13, 4706, 1583, 29889, 20895, 29918, 517, 29918, 4012, 353, 16250, 29889, 311, 802, 29898, 1311, 29889, 4703, 29889, 20895, 29918, 1761, 29897, 13, 4706, 1550, 1583, 29889, 20895, 29918, 517, 29918, 4012, 29901, 13, 13, 9651, 565, 1583, 29889, 3317, 29918, 12687, 29918, 2798, 322, 1583, 29889, 12687, 29918, 2798, 1405, 1583, 29889, 3317, 29918, 12687, 29918, 2798, 29901, 13, 18884, 396, 5040, 11580, 29892, 445, 1813, 338, 2086, 1067, 6463, 287, 13, 18884, 2867, 13, 13, 9651, 760, 353, 1583, 29889, 20895, 29918, 517, 29918, 4012, 29961, 29900, 29962, 13, 9651, 1583, 29889, 1595, 29918, 3952, 6774, 29961, 1595, 1822, 1202, 29918, 20895, 580, 13, 13, 4706, 565, 451, 1583, 29889, 29886, 1144, 29918, 19811, 1233, 29901, 13, 9651, 12020, 1583, 29889, 5074, 8915, 13, 13, 4706, 4802, 29918, 8977, 353, 8853, 7576, 1115, 8853, 7597, 29954, 10604, 1115, 426, 13, 9651, 376, 3729, 29879, 1115, 1583, 29889, 3729, 29879, 29918, 8977, 29892, 13, 9651, 376, 1212, 7039, 1115, 1583, 29889, 1212, 7039, 29918, 8977, 29892, 13, 9651, 376, 4011, 1115, 1583, 29889, 4011, 29918, 8977, 29892, 13, 4706, 500, 930, 13, 13, 4706, 4390, 29889, 15070, 29898, 3752, 29918, 8977, 29892, 285, 29886, 29892, 29536, 29922, 29946, 29897, 13, 4706, 285, 29886, 29889, 23126, 580, 13, 13, 1678, 822, 5706, 29898, 1311, 1125, 13, 4706, 9995, 29907, 4293, 7787, 1761, 15120, 304, 5706, 278, 1813, 322, 3639, 278, 25773, 8118, 408, 263, 1347, 1213, 15945, 13, 4706, 411, 5694, 1445, 29889, 22175, 5776, 1971, 653, 2283, 703, 29893, 613, 10944, 543, 1212, 1761, 15120, 29918, 2080, 29918, 613, 25557, 29569, 3126, 613, 5217, 29922, 8824, 29897, 408, 4390, 29918, 1445, 29892, 320, 13, 632, 5694, 1445, 29889, 22175, 5776, 1971, 653, 2283, 703, 29878, 613, 10944, 543, 1212, 1761, 15120, 29918, 4905, 29918, 613, 25557, 29569, 15120, 613, 5217, 29922, 8824, 29897, 408, 7787, 1761, 15120, 29918, 4905, 29901, 13, 9651, 1583, 29889, 3539, 29918, 3126, 29898, 3126, 29918, 1445, 29897, 13, 9651, 7787, 1761, 15120, 29918, 6519, 353, 518, 13, 18884, 5591, 4855, 29914, 2109, 29914, 6272, 613, 376, 3177, 613, 13, 18884, 2897, 29889, 2084, 29889, 7122, 29898, 6006, 24360, 7597, 29954, 29918, 16652, 8098, 29892, 376, 2109, 613, 376, 1212, 1761, 15120, 29889, 1315, 4968, 13, 13, 18884, 376, 489, 808, 262, 613, 13, 18884, 2897, 29889, 2084, 29889, 7122, 29898, 6006, 24360, 7597, 29954, 29918, 16652, 8098, 29892, 376, 1982, 613, 376, 7054, 468, 29889, 15120, 4968, 13, 13, 18884, 4390, 29918, 1445, 29889, 978, 29892, 13, 13, 18884, 11663, 29877, 613, 13, 18884, 7787, 1761, 15120, 29918, 4905, 29889, 978, 13, 9651, 4514, 13, 9651, 1596, 29898, 1212, 1761, 15120, 29918, 6519, 29897, 13, 9651, 1014, 5014, 29889, 4804, 29898, 1212, 1761, 15120, 29918, 6519, 29897, 13, 13, 9651, 25773, 29918, 10853, 353, 7787, 1761, 15120, 29918, 4905, 29889, 949, 580, 13, 13, 4706, 396, 1932, 263, 7787, 5692, 297, 263, 2846, 7600, 313, 8256, 591, 505, 4799, 29893, 2658, 511, 591, 817, 304, 766, 14727, 482, 278, 5633, 310, 278, 7787, 13, 4706, 396, 577, 7787, 1761, 15120, 1838, 29915, 29873, 1348, 896, 29915, 276, 2869, 278, 1021, 7787, 322, 881, 4511, 963, 4208, 29889, 13, 4706, 396, 15154, 278, 4805, 10200, 362, 29901, 13, 4706, 25773, 29918, 10853, 353, 337, 29889, 1491, 703, 29918, 3177, 29905, 29881, 29974, 613, 12633, 25773, 29918, 10853, 29897, 13, 13, 4706, 736, 25773, 29918, 10853, 13, 13, 13, 1753, 5706, 29918, 15120, 10456, 5085, 29892, 3579, 19290, 1125, 13, 1678, 282, 1144, 29918, 517, 29918, 11014, 353, 5159, 13, 1678, 1550, 5852, 29901, 13, 4706, 302, 353, 13955, 29954, 5074, 10456, 5085, 29892, 3579, 19290, 29892, 282, 1144, 29918, 517, 29918, 11014, 29922, 29886, 1144, 29918, 517, 29918, 11014, 29897, 13, 4706, 1018, 29901, 13, 9651, 25773, 29918, 10853, 353, 302, 29889, 17158, 580, 13, 4706, 5174, 13955, 29954, 5074, 29889, 5074, 8915, 29901, 13, 9651, 2867, 13, 4706, 282, 1144, 29918, 517, 29918, 11014, 4619, 302, 29889, 29886, 1144, 29918, 19811, 1233, 13, 13, 4706, 7709, 25773, 29918, 10853, 13, 2 ]
urls.py
markbate/whiskerboard
20
29760
from django.conf.urls.defaults import patterns, include, url from django.contrib import admin from board.feeds import EventFeed from board.views import IndexView, ServiceView admin.autodiscover() urlpatterns = patterns('', url(r'^$', IndexView.as_view(), name='index'), url(r'^services/(?P<slug>[-\w]+)$', ServiceView.as_view(), name='service'), url(r'^feed$', EventFeed(), name='feed'), url(r'^admin/', include(admin.site.urls)), )
[ 1, 515, 9557, 29889, 5527, 29889, 26045, 29889, 4381, 29879, 1053, 15038, 29892, 3160, 29892, 3142, 13, 3166, 9557, 29889, 21570, 1053, 4113, 13, 3166, 7613, 29889, 1725, 5779, 1053, 6864, 29737, 13, 3166, 7613, 29889, 7406, 1053, 11374, 1043, 29892, 6692, 1043, 13, 13, 6406, 29889, 1300, 397, 10669, 957, 580, 13, 13, 2271, 11037, 29879, 353, 15038, 877, 742, 13, 1678, 3142, 29898, 29878, 29915, 29985, 29938, 742, 11374, 1043, 29889, 294, 29918, 1493, 3285, 1024, 2433, 2248, 5477, 13, 1678, 3142, 29898, 29878, 29915, 29985, 9916, 29914, 10780, 29925, 29966, 29517, 24566, 2612, 29893, 10062, 1262, 742, 6692, 1043, 29889, 294, 29918, 1493, 3285, 1024, 2433, 5509, 5477, 13, 1678, 3142, 29898, 29878, 29915, 29985, 18798, 29938, 742, 6864, 29737, 3285, 1024, 2433, 18798, 5477, 13, 13, 1678, 3142, 29898, 29878, 29915, 29985, 6406, 29914, 742, 3160, 29898, 6406, 29889, 2746, 29889, 26045, 8243, 13, 29897, 13, 2 ]
sdk/attestation/azure-security-attestation/azure/security/attestation/_administration_client.py
lynshi/azure-sdk-for-python
0
171400
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------- from typing import List, Any, Optional, TYPE_CHECKING from azure.core import PipelineClient from msrest import Deserializer, Serializer from six import python_2_unicode_compatible if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any from azure.core.credentials import TokenCredential from azure.core.pipeline.transport import HttpRequest, HttpResponse from ._generated import AzureAttestationRestClient from ._generated.models import AttestationType, PolicyResult, PolicyCertificatesResult, JSONWebKey, AttestationCertificateManagementBody, PolicyCertificatesModificationResult as GeneratedPolicyCertificatesModificationResult from ._configuration import AttestationClientConfiguration from ._models import AttestationSigner, AttestationToken, AttestationResponse, StoredAttestationPolicy, AttestationSigningKey, PolicyCertificatesModificationResult from ._common import Base64Url import cryptography import cryptography.x509 import base64 from azure.core.tracing.decorator import distributed_trace from threading import Lock, Thread class AttestationAdministrationClient(object): """Provides administrative APIs for managing an instance of the Attestation Service. :param str instance_url: base url of the service :param credential: Credentials for the caller used to interact with the service. :type credential: azure.core.credentials.TokenCredential :keyword Pipeline pipeline: If omitted, the standard pipeline is used. :keyword HttpTransport transport: If omitted, the standard pipeline is used. :keyword list[HTTPPolicy] policies: If omitted, the standard pipeline is used. """ def __init__( self, credential, # type: "TokenCredential" instance_url, # type: str **kwargs # type: Any ): # type: (...) -> None if not credential: raise ValueError("Missing credential.") self._config = AttestationClientConfiguration(credential, instance_url, **kwargs) self._client = AzureAttestationRestClient(credential, instance_url, **kwargs) self._statelock = Lock() self._signing_certificates = None @distributed_trace def get_policy(self, attestation_type, **kwargs): #type(AttestationType, **Any) -> AttestationResult[str]: """ Retrieves the attestation policy for a specified attestation type. :param azure.security.attestation.AttestationType attestation_type: :class:`azure.security.attestation.AttestationType` for which to retrieve the policy. :return AttestationResponse[str]: Attestation service response encapsulating a string attestation policy. """ policyResult = self._client.policy.get(attestation_type, **kwargs) token = AttestationToken[PolicyResult](token=policyResult.token, body_type=PolicyResult) token_body = token.get_body() stored_policy = AttestationToken[StoredAttestationPolicy](token=token_body.policy, body_type=StoredAttestationPolicy) actual_policy = stored_policy.get_body().attestation_policy #type: bytes if self._config.token_validation_options.validate_token: token.validate_token(self._config.token_validation_options, self._get_signers(**kwargs)) return AttestationResponse[str](token, actual_policy.decode('utf-8')) @distributed_trace def set_policy(self, attestation_type, attestation_policy, signing_key=None, **kwargs): #type:(AttestationType, str, Optional[AttestationSigningKey], **Any) -> AttestationResponse[PolicyResult] """ Sets the attestation policy for the specified attestation type. :param azure.security.attestation.AttestationType attestation_type: :class:`azure.security.attestation.AttestationType` for which to set the policy. :param str attestation_policy: Attestation policy to be set. :param Optional[AttestationSigningKey] signing_key: Optional signing key to be used to sign the policy before sending it to the service. :return AttestationResponse[PolicyResult]: Attestation service response encapsulating a :class:`PolicyResult`. .. note:: If the attestation instance is in *Isolated* mode, then the `signing_key` parameter MUST be a signing key containing one of the certificates returned by :meth:`get_policy_management_certificates`. If the attestation instance is in *AAD* mode, then the `signing_key` parameter does not need to be provided. """ policy_token = AttestationToken[StoredAttestationPolicy]( body=StoredAttestationPolicy(attestation_policy = attestation_policy.encode('ascii')), signer=signing_key, body_type=StoredAttestationPolicy) policyResult = self._client.policy.set(attestation_type=attestation_type, new_attestation_policy=policy_token.serialize(), **kwargs) token = AttestationToken[PolicyResult](token=policyResult.token, body_type=PolicyResult) if self._config.token_validation_options.validate_token: if not token.validate_token(self._config.token_validation_options, self._get_signers(**kwargs)): raise Exception("Token Validation of PolicySet API failed.") return AttestationResponse[PolicyResult](token, token.get_body()) @distributed_trace def get_policy_management_certificates(self, **kwargs): #type:(**Any) -> AttestationResponse[list[list[bytes]]] """ Retrieves the set of policy management certificates for the instance. The list of policy management certificates will only be non-empty if the attestation service instance is in Isolated mode. :return AttestationResponse[list[list[bytes]]: Attestation service response encapsulating a list of DER encoded X.509 certificate chains. """ cert_response = self._client.policy_certificates.get(**kwargs) token = AttestationToken[PolicyCertificatesResult]( token=cert_response.token, body_type=PolicyCertificatesResult) if self._config.token_validation_options.validate_token: if not token.validate_token(self._config.token_validation_options, self._get_signers(**kwargs)): raise Exception("Token Validation of PolicyCertificates API failed.") certificates = [] cert_list = token.get_body() for key in cert_list.policy_certificates.keys: key_certs = [base64.b64decode(cert) for cert in key.x5_c] certificates.append(key_certs) return AttestationResponse(token, certificates) @distributed_trace def add_policy_management_certificate(self, certificate_to_add, signing_key, **kwargs): #type:(bytes, AttestationSigningKey, **Any)-> AttestationResponse[PolicyCertificatesModificationResult] """ Adds a new policy management certificate to the set of policy management certificates for the instance. :param bytes certificate_to_add: DER encoded X.509 certificate to add to the list of attestation policy management certificates. :param AttestationSigningKey signing_key: Signing Key representing one of the *existing* attestation signing certificates. :return AttestationResponse[PolicyCertificatesModificationResult]: Attestation service response encapsulating the status of the add request. The :class:`PolicyCertificatesModificationResult` response to the :meth:`add_policy_management_certificate` API contains two attributes of interest. The first is `certificate_resolution`, which indicates whether the certificate in question is present in the set of policy management certificates after the operation has completed, or if it is absent. The second is the `thumbprint` of the certificate added. The `thumbprint` for the certificate is the SHA1 hash of the DER encoding of the certificate. """ key=JSONWebKey(kty='RSA', x5_c = [ base64.b64encode(certificate_to_add).decode('ascii')]) add_body = AttestationCertificateManagementBody(policy_certificate=key) cert_add_token = AttestationToken[AttestationCertificateManagementBody]( body=add_body, signer=signing_key, body_type=AttestationCertificateManagementBody) cert_response = self._client.policy_certificates.add(cert_add_token.serialize(), **kwargs) token = AttestationToken[GeneratedPolicyCertificatesModificationResult](token=cert_response.token, body_type=GeneratedPolicyCertificatesModificationResult) if self._config.token_validation_options.validate_token: if not token.validate_token(self._config.token_validation_options, self._get_signers(**kwargs)): raise Exception("Token Validation of PolicyCertificate Add API failed.") return AttestationResponse[PolicyCertificatesModificationResult](token, PolicyCertificatesModificationResult._from_generated(token.get_body())) @distributed_trace def remove_policy_management_certificate(self, certificate_to_add, signing_key, **kwargs): #type:(bytes, AttestationSigningKey, **Any)-> AttestationResponse[PolicyCertificatesModificationResult] """ Removes a new policy management certificate to the set of policy management certificates for the instance. :param bytes certificate_to_add: DER encoded X.509 certificate to add to the list of attestation policy management certificates. :param AttestationSigningKey signing_key: Signing Key representing one of the *existing* attestation signing certificates. :return AttestationResponse[PolicyCertificatesModificationResult]: Attestation service response encapsulating a list of DER encoded X.509 certificate chains. The :class:`PolicyCertificatesModificationResult` response to the :meth:`remove_policy_management_certificate` API contains two attributes of interest. The first is `certificate_resolution`, which indicates whether the certificate in question is present in the set of policy management certificates after the operation has completed, or if it is absent. The second is the `thumbprint` of the certificate added. The `thumbprint` for the certificate is the SHA1 hash of the DER encoding of the certificate. """ key=JSONWebKey(kty='RSA', x5_c = [ base64.b64encode(certificate_to_add).decode('ascii')]) add_body = AttestationCertificateManagementBody(policy_certificate=key) cert_add_token = AttestationToken[AttestationCertificateManagementBody]( body=add_body, signer=signing_key, body_type=AttestationCertificateManagementBody) cert_response = self._client.policy_certificates.remove(cert_add_token.serialize(), **kwargs) token = AttestationToken[GeneratedPolicyCertificatesModificationResult](token=cert_response.token, body_type=GeneratedPolicyCertificatesModificationResult) if self._config.token_validation_options.validate_token: if not token.validate_token(self._config.token_validation_options, self._get_signers(**kwargs)): raise Exception("Token Validation of PolicyCertificate Remove API failed.") return AttestationResponse[PolicyCertificatesModificationResult](token, PolicyCertificatesModificationResult._from_generated(token.get_body())) def _get_signers(self, **kwargs): #type(**Any) -> List[AttestationSigner] """ Returns the set of signing certificates used to sign attestation tokens. """ with self._statelock: if (self._signing_certificates == None): signing_certificates = self._client.signing_certificates.get(**kwargs) self._signing_certificates = [] for key in signing_certificates.keys: # Convert the returned certificate chain into an array of X.509 Certificates. certificates = [] for x5c in key.x5_c: der_cert = base64.b64decode(x5c) certificates.append(der_cert) self._signing_certificates.append(AttestationSigner(certificates, key.kid)) signers = self._signing_certificates return signers def close(self): # type: () -> None self._client.close() def __enter__(self): # type: () -> AttestationAdministrationClient self._client.__enter__() return self def __exit__(self, *exc_details): # type: (Any) -> None self._client.__exit__(*exc_details)
[ 1, 396, 14137, 29922, 9420, 29899, 29947, 13, 29937, 448, 2683, 2683, 2683, 2683, 1378, 29899, 13, 29937, 14187, 1266, 313, 29883, 29897, 7783, 15025, 29889, 2178, 10462, 21676, 29889, 13, 29937, 10413, 21144, 1090, 278, 341, 1806, 19245, 29889, 2823, 19245, 29889, 3945, 297, 278, 2060, 3876, 363, 19405, 2472, 29889, 13, 29937, 448, 2683, 2683, 2683, 2683, 1378, 29899, 13, 13, 3166, 19229, 1053, 2391, 29892, 3139, 29892, 28379, 29892, 323, 6959, 29918, 3210, 16658, 4214, 13, 13, 3166, 15699, 29889, 3221, 1053, 349, 23828, 4032, 13, 3166, 10887, 5060, 1053, 2726, 261, 616, 3950, 29892, 18896, 3950, 13, 3166, 4832, 1053, 3017, 29918, 29906, 29918, 2523, 356, 29918, 23712, 13, 13, 361, 323, 6959, 29918, 3210, 16658, 4214, 29901, 13, 1678, 396, 282, 2904, 524, 29901, 11262, 29922, 348, 3880, 29899, 5215, 29892, 348, 2972, 287, 29899, 326, 4011, 13, 1678, 515, 19229, 1053, 3139, 13, 13, 1678, 515, 15699, 29889, 3221, 29889, 11944, 9409, 1053, 25159, 15507, 2556, 13, 1678, 515, 15699, 29889, 3221, 29889, 13096, 5570, 29889, 27882, 1053, 9056, 3089, 29892, 9056, 5103, 13, 13, 3166, 869, 29918, 13525, 1053, 12634, 4165, 342, 362, 15078, 4032, 13, 3166, 869, 29918, 13525, 29889, 9794, 1053, 6212, 342, 362, 1542, 29892, 25219, 3591, 29892, 25219, 20455, 928, 1078, 3591, 29892, 4663, 3609, 2558, 29892, 6212, 342, 362, 20455, 8021, 27107, 8434, 29892, 25219, 20455, 928, 1078, 2111, 2450, 3591, 408, 3251, 630, 15644, 20455, 928, 1078, 2111, 2450, 3591, 13, 3166, 869, 29918, 13305, 1053, 6212, 342, 362, 4032, 8614, 13, 3166, 869, 29918, 9794, 1053, 6212, 342, 362, 10140, 261, 29892, 6212, 342, 362, 6066, 29892, 6212, 342, 362, 5103, 29892, 624, 4395, 4165, 342, 362, 15644, 29892, 6212, 342, 362, 10140, 292, 2558, 29892, 25219, 20455, 928, 1078, 2111, 2450, 3591, 13, 3166, 869, 29918, 9435, 1053, 7399, 29953, 29946, 5983, 13, 5215, 24941, 5275, 13, 5215, 24941, 5275, 29889, 29916, 29945, 29900, 29929, 13, 5215, 2967, 29953, 29946, 13, 3166, 15699, 29889, 3221, 29889, 29873, 945, 292, 29889, 19557, 1061, 1053, 13235, 29918, 15003, 13, 3166, 3244, 292, 1053, 18199, 29892, 10480, 13, 13, 13, 1990, 6212, 342, 362, 12754, 8306, 4032, 29898, 3318, 1125, 13, 1678, 9995, 1184, 29894, 2247, 19185, 23649, 363, 767, 6751, 385, 2777, 310, 278, 6212, 342, 362, 6692, 29889, 13, 13, 1678, 584, 3207, 851, 2777, 29918, 2271, 29901, 2967, 3142, 310, 278, 2669, 13, 1678, 584, 3207, 6625, 2556, 29901, 24596, 9409, 363, 278, 24959, 1304, 304, 16254, 411, 278, 2669, 29889, 13, 1678, 584, 1853, 6625, 2556, 29901, 15699, 29889, 3221, 29889, 11944, 9409, 29889, 6066, 15507, 2556, 13, 1678, 584, 26766, 349, 23828, 16439, 29901, 960, 25811, 29892, 278, 3918, 16439, 338, 1304, 29889, 13, 1678, 584, 26766, 9056, 27395, 8608, 29901, 960, 25811, 29892, 278, 3918, 16439, 338, 1304, 29889, 13, 1678, 584, 26766, 1051, 29961, 10493, 15644, 29962, 24833, 29901, 960, 25811, 29892, 278, 3918, 16439, 338, 1304, 29889, 13, 1678, 9995, 13, 13, 1678, 822, 4770, 2344, 12035, 13, 4706, 1583, 29892, 13, 4706, 6625, 2556, 29892, 29871, 396, 1134, 29901, 376, 6066, 15507, 2556, 29908, 13, 4706, 2777, 29918, 2271, 29892, 29871, 396, 1134, 29901, 851, 13, 4706, 3579, 19290, 29871, 396, 1134, 29901, 3139, 13, 268, 1125, 13, 4706, 396, 1134, 29901, 313, 11410, 1599, 6213, 13, 4706, 565, 451, 6625, 2556, 29901, 13, 9651, 12020, 7865, 2392, 703, 18552, 292, 6625, 2556, 23157, 13, 4706, 1583, 3032, 2917, 353, 6212, 342, 362, 4032, 8614, 29898, 11944, 2556, 29892, 2777, 29918, 2271, 29892, 3579, 19290, 29897, 13, 4706, 1583, 3032, 4645, 353, 12634, 4165, 342, 362, 15078, 4032, 29898, 11944, 2556, 29892, 2777, 29918, 2271, 29892, 3579, 19290, 29897, 13, 4706, 1583, 3032, 6112, 295, 1698, 353, 18199, 580, 13, 4706, 1583, 3032, 4530, 292, 29918, 6327, 928, 1078, 353, 6213, 13, 13, 1678, 732, 5721, 7541, 29918, 15003, 13, 1678, 822, 679, 29918, 22197, 29898, 1311, 29892, 1098, 342, 362, 29918, 1853, 29892, 3579, 19290, 1125, 29871, 13, 4706, 396, 1853, 29898, 4165, 342, 362, 1542, 29892, 3579, 10773, 29897, 1599, 6212, 342, 362, 3591, 29961, 710, 5387, 13, 4706, 9995, 19338, 1960, 278, 1098, 342, 362, 8898, 363, 263, 6790, 1098, 342, 362, 1134, 29889, 13, 13, 4706, 584, 3207, 15699, 29889, 8926, 29889, 1131, 342, 362, 29889, 4165, 342, 362, 1542, 1098, 342, 362, 29918, 1853, 29901, 584, 1990, 18078, 17688, 29889, 8926, 29889, 1131, 342, 362, 29889, 4165, 342, 362, 1542, 29952, 363, 29871, 13, 9651, 607, 304, 10563, 278, 8898, 29889, 13, 4706, 584, 2457, 6212, 342, 362, 5103, 29961, 710, 5387, 6212, 342, 362, 2669, 2933, 2094, 2547, 18099, 263, 1347, 1098, 342, 362, 8898, 29889, 13, 13, 4706, 9995, 13, 308, 13, 4706, 8898, 3591, 353, 1583, 3032, 4645, 29889, 22197, 29889, 657, 29898, 1131, 342, 362, 29918, 1853, 29892, 3579, 19290, 29897, 13, 4706, 5993, 353, 6212, 342, 362, 6066, 29961, 15644, 3591, 850, 6979, 29922, 22197, 3591, 29889, 6979, 29892, 3573, 29918, 1853, 29922, 15644, 3591, 29897, 13, 4706, 5993, 29918, 2587, 353, 5993, 29889, 657, 29918, 2587, 580, 13, 4706, 6087, 29918, 22197, 353, 6212, 342, 362, 6066, 29961, 855, 4395, 4165, 342, 362, 15644, 850, 6979, 29922, 6979, 29918, 2587, 29889, 22197, 29892, 3573, 29918, 1853, 29922, 855, 4395, 4165, 342, 362, 15644, 29897, 13, 13, 4706, 3935, 29918, 22197, 353, 6087, 29918, 22197, 29889, 657, 29918, 2587, 2141, 1131, 342, 362, 29918, 22197, 396, 1853, 29901, 6262, 13, 13, 4706, 565, 1583, 3032, 2917, 29889, 6979, 29918, 18157, 29918, 6768, 29889, 15480, 29918, 6979, 29901, 13, 9651, 5993, 29889, 15480, 29918, 6979, 29898, 1311, 3032, 2917, 29889, 6979, 29918, 18157, 29918, 6768, 29892, 1583, 3032, 657, 29918, 4530, 414, 29898, 1068, 19290, 876, 13, 13, 4706, 736, 6212, 342, 362, 5103, 29961, 710, 850, 6979, 29892, 3935, 29918, 22197, 29889, 13808, 877, 9420, 29899, 29947, 8785, 13, 13, 1678, 732, 5721, 7541, 29918, 15003, 13, 1678, 822, 731, 29918, 22197, 29898, 1311, 29892, 1098, 342, 362, 29918, 1853, 29892, 1098, 342, 362, 29918, 22197, 29892, 26188, 29918, 1989, 29922, 8516, 29892, 3579, 19290, 1125, 29871, 13, 4706, 396, 1853, 5919, 4165, 342, 362, 1542, 29892, 851, 29892, 28379, 29961, 4165, 342, 362, 10140, 292, 2558, 1402, 3579, 10773, 29897, 1599, 6212, 342, 362, 5103, 29961, 15644, 3591, 29962, 13, 4706, 9995, 317, 1691, 278, 1098, 342, 362, 8898, 363, 278, 6790, 1098, 342, 362, 1134, 29889, 13, 13, 4706, 584, 3207, 15699, 29889, 8926, 29889, 1131, 342, 362, 29889, 4165, 342, 362, 1542, 1098, 342, 362, 29918, 1853, 29901, 584, 1990, 18078, 17688, 29889, 8926, 29889, 1131, 342, 362, 29889, 4165, 342, 362, 1542, 29952, 363, 29871, 13, 9651, 607, 304, 731, 278, 8898, 29889, 13, 4706, 584, 3207, 851, 1098, 342, 362, 29918, 22197, 29901, 6212, 342, 362, 8898, 304, 367, 731, 29889, 13, 4706, 584, 3207, 28379, 29961, 4165, 342, 362, 10140, 292, 2558, 29962, 26188, 29918, 1989, 29901, 28379, 26188, 1820, 304, 367, 13, 9651, 1304, 304, 1804, 278, 8898, 1434, 9348, 372, 304, 278, 2669, 29889, 13, 4706, 584, 2457, 6212, 342, 362, 5103, 29961, 15644, 3591, 5387, 6212, 342, 362, 2669, 2933, 2094, 2547, 18099, 263, 584, 1990, 18078, 15644, 3591, 1412, 13, 13, 4706, 6317, 4443, 1057, 13, 9651, 960, 278, 1098, 342, 362, 2777, 338, 297, 334, 29902, 2929, 630, 29930, 4464, 29892, 769, 278, 29871, 13, 9651, 421, 4530, 292, 29918, 1989, 29952, 3443, 341, 17321, 367, 263, 26188, 1820, 6943, 697, 310, 278, 13, 9651, 23199, 1078, 4133, 491, 584, 29885, 621, 18078, 657, 29918, 22197, 29918, 21895, 29918, 6327, 928, 1078, 1412, 13, 13, 9651, 960, 278, 1098, 342, 362, 2777, 338, 297, 334, 29909, 3035, 29930, 4464, 29892, 769, 278, 421, 4530, 292, 29918, 1989, 29952, 29871, 13, 9651, 3443, 947, 451, 817, 304, 367, 4944, 29889, 13, 4706, 9995, 13, 4706, 8898, 29918, 6979, 353, 6212, 342, 362, 6066, 29961, 855, 4395, 4165, 342, 362, 15644, 850, 13, 9651, 3573, 29922, 855, 4395, 4165, 342, 362, 15644, 29898, 1131, 342, 362, 29918, 22197, 353, 1098, 342, 362, 29918, 22197, 29889, 12508, 877, 294, 18869, 1495, 511, 13, 9651, 1804, 261, 29922, 4530, 292, 29918, 1989, 29892, 13, 9651, 3573, 29918, 1853, 29922, 855, 4395, 4165, 342, 362, 15644, 29897, 13, 4706, 8898, 3591, 353, 1583, 3032, 4645, 29889, 22197, 29889, 842, 29898, 1131, 342, 362, 29918, 1853, 29922, 1131, 342, 362, 29918, 1853, 29892, 716, 29918, 1131, 342, 362, 29918, 22197, 29922, 22197, 29918, 6979, 29889, 643, 6646, 3285, 3579, 19290, 29897, 13, 4706, 5993, 353, 6212, 342, 362, 6066, 29961, 15644, 3591, 850, 6979, 29922, 22197, 3591, 29889, 6979, 29892, 13, 9651, 3573, 29918, 1853, 29922, 15644, 3591, 29897, 13, 4706, 565, 1583, 3032, 2917, 29889, 6979, 29918, 18157, 29918, 6768, 29889, 15480, 29918, 6979, 29901, 13, 9651, 565, 451, 5993, 29889, 15480, 29918, 6979, 29898, 1311, 3032, 2917, 29889, 6979, 29918, 18157, 29918, 6768, 29892, 1583, 3032, 657, 29918, 4530, 414, 29898, 1068, 19290, 22164, 13, 18884, 12020, 8960, 703, 6066, 15758, 362, 310, 25219, 2697, 3450, 5229, 23157, 13, 13, 13, 4706, 736, 6212, 342, 362, 5103, 29961, 15644, 3591, 850, 6979, 29892, 5993, 29889, 657, 29918, 2587, 3101, 13, 13, 1678, 732, 5721, 7541, 29918, 15003, 13, 1678, 822, 679, 29918, 22197, 29918, 21895, 29918, 6327, 928, 1078, 29898, 1311, 29892, 3579, 19290, 1125, 13, 4706, 396, 1853, 5919, 1068, 10773, 29897, 1599, 6212, 342, 362, 5103, 29961, 1761, 29961, 1761, 29961, 13193, 5262, 29962, 13, 4706, 9995, 19338, 1960, 278, 731, 310, 8898, 10643, 23199, 1078, 363, 278, 2777, 29889, 13, 13, 4706, 450, 1051, 310, 8898, 10643, 23199, 1078, 674, 871, 367, 1661, 29899, 6310, 565, 278, 13, 4706, 1098, 342, 362, 2669, 2777, 338, 297, 1317, 324, 630, 4464, 29889, 13, 13, 4706, 584, 2457, 6212, 342, 362, 5103, 29961, 1761, 29961, 1761, 29961, 13193, 5262, 29901, 6212, 342, 362, 2669, 2933, 29871, 13, 9651, 2094, 2547, 18099, 263, 1051, 310, 360, 1001, 18511, 1060, 29889, 29945, 29900, 29929, 12289, 521, 2708, 29889, 13, 4706, 9995, 13, 13, 4706, 2284, 29918, 5327, 353, 1583, 3032, 4645, 29889, 22197, 29918, 6327, 928, 1078, 29889, 657, 29898, 1068, 19290, 29897, 13, 4706, 5993, 353, 6212, 342, 362, 6066, 29961, 15644, 20455, 928, 1078, 3591, 850, 13, 9651, 5993, 29922, 6327, 29918, 5327, 29889, 6979, 29892, 13, 9651, 3573, 29918, 1853, 29922, 15644, 20455, 928, 1078, 3591, 29897, 13, 4706, 565, 1583, 3032, 2917, 29889, 6979, 29918, 18157, 29918, 6768, 29889, 15480, 29918, 6979, 29901, 13, 9651, 565, 451, 5993, 29889, 15480, 29918, 6979, 29898, 1311, 3032, 2917, 29889, 6979, 29918, 18157, 29918, 6768, 29892, 1583, 3032, 657, 29918, 4530, 414, 29898, 1068, 19290, 22164, 13, 18884, 12020, 8960, 703, 6066, 15758, 362, 310, 25219, 20455, 928, 1078, 3450, 5229, 23157, 13, 4706, 23199, 1078, 353, 5159, 13, 13, 4706, 2284, 29918, 1761, 353, 5993, 29889, 657, 29918, 2587, 580, 13, 13, 4706, 363, 1820, 297, 2284, 29918, 1761, 29889, 22197, 29918, 6327, 928, 1078, 29889, 8149, 29901, 13, 9651, 1820, 29918, 6327, 29879, 353, 518, 3188, 29953, 29946, 29889, 29890, 29953, 29946, 13808, 29898, 6327, 29897, 363, 2284, 297, 1820, 29889, 29916, 29945, 29918, 29883, 29962, 13, 9651, 23199, 1078, 29889, 4397, 29898, 1989, 29918, 6327, 29879, 29897, 13, 4706, 736, 6212, 342, 362, 5103, 29898, 6979, 29892, 23199, 1078, 29897, 13, 13, 1678, 732, 5721, 7541, 29918, 15003, 13, 1678, 822, 788, 29918, 22197, 29918, 21895, 29918, 6327, 8021, 29898, 1311, 29892, 12289, 29918, 517, 29918, 1202, 29892, 26188, 29918, 1989, 29892, 3579, 19290, 1125, 13, 4706, 396, 1853, 5919, 13193, 29892, 6212, 342, 362, 10140, 292, 2558, 29892, 3579, 10773, 19969, 6212, 342, 362, 5103, 29961, 15644, 20455, 928, 1078, 2111, 2450, 3591, 29962, 13, 4706, 9995, 3462, 29879, 263, 716, 8898, 10643, 12289, 304, 278, 731, 310, 8898, 10643, 23199, 1078, 363, 278, 2777, 29889, 13, 13, 4706, 584, 3207, 6262, 12289, 29918, 517, 29918, 1202, 29901, 360, 1001, 18511, 1060, 29889, 29945, 29900, 29929, 12289, 304, 788, 304, 29871, 13, 9651, 278, 1051, 310, 1098, 342, 362, 8898, 10643, 23199, 1078, 29889, 13, 4706, 584, 3207, 6212, 342, 362, 10140, 292, 2558, 26188, 29918, 1989, 29901, 9954, 292, 7670, 15783, 697, 310, 29871, 13, 9651, 278, 334, 735, 15423, 29930, 1098, 342, 362, 26188, 23199, 1078, 29889, 13, 4706, 584, 2457, 6212, 342, 362, 5103, 29961, 15644, 20455, 928, 1078, 2111, 2450, 3591, 5387, 6212, 342, 362, 2669, 2933, 29871, 13, 9651, 2094, 2547, 18099, 278, 4660, 310, 278, 788, 2009, 29889, 13, 13, 4706, 450, 584, 1990, 18078, 15644, 20455, 928, 1078, 2111, 2450, 3591, 29952, 2933, 304, 278, 29871, 13, 4706, 584, 29885, 621, 18078, 1202, 29918, 22197, 29918, 21895, 29918, 6327, 8021, 29952, 3450, 3743, 1023, 8393, 13, 4706, 310, 4066, 29889, 29871, 13, 308, 13, 4706, 450, 937, 338, 421, 6327, 8021, 29918, 9778, 918, 1673, 607, 14088, 29871, 13, 4706, 3692, 278, 12289, 297, 1139, 338, 2198, 297, 278, 731, 310, 8898, 29871, 13, 4706, 10643, 23199, 1078, 1156, 278, 5858, 756, 8676, 29892, 470, 565, 372, 338, 29871, 13, 4706, 29207, 29889, 13, 13, 4706, 450, 1473, 338, 278, 421, 386, 3774, 2158, 29952, 310, 278, 12289, 2715, 29889, 450, 421, 386, 3774, 2158, 29952, 13, 4706, 363, 278, 12289, 338, 278, 317, 15715, 29896, 6608, 310, 278, 360, 1001, 8025, 310, 278, 13, 4706, 12289, 29889, 13, 13, 4706, 9995, 13, 4706, 1820, 29922, 7249, 3609, 2558, 29898, 29895, 1017, 2433, 29934, 8132, 742, 921, 29945, 29918, 29883, 353, 518, 2967, 29953, 29946, 29889, 29890, 29953, 29946, 12508, 29898, 6327, 8021, 29918, 517, 29918, 1202, 467, 13808, 877, 294, 18869, 1495, 2314, 13, 4706, 788, 29918, 2587, 353, 6212, 342, 362, 20455, 8021, 27107, 8434, 29898, 22197, 29918, 6327, 8021, 29922, 1989, 29897, 13, 4706, 2284, 29918, 1202, 29918, 6979, 353, 6212, 342, 362, 6066, 29961, 4165, 342, 362, 20455, 8021, 27107, 8434, 850, 13, 9651, 3573, 29922, 1202, 29918, 2587, 29892, 13, 9651, 1804, 261, 29922, 4530, 292, 29918, 1989, 29892, 13, 9651, 3573, 29918, 1853, 29922, 4165, 342, 362, 20455, 8021, 27107, 8434, 29897, 13, 13, 4706, 2284, 29918, 5327, 353, 1583, 3032, 4645, 29889, 22197, 29918, 6327, 928, 1078, 29889, 1202, 29898, 6327, 29918, 1202, 29918, 6979, 29889, 643, 6646, 3285, 3579, 19290, 29897, 13, 4706, 5993, 353, 6212, 342, 362, 6066, 29961, 24565, 15644, 20455, 928, 1078, 2111, 2450, 3591, 850, 6979, 29922, 6327, 29918, 5327, 29889, 6979, 29892, 13, 9651, 3573, 29918, 1853, 29922, 24565, 15644, 20455, 928, 1078, 2111, 2450, 3591, 29897, 13, 4706, 565, 1583, 3032, 2917, 29889, 6979, 29918, 18157, 29918, 6768, 29889, 15480, 29918, 6979, 29901, 13, 9651, 565, 451, 5993, 29889, 15480, 29918, 6979, 29898, 1311, 3032, 2917, 29889, 6979, 29918, 18157, 29918, 6768, 29892, 1583, 3032, 657, 29918, 4530, 414, 29898, 1068, 19290, 22164, 13, 18884, 12020, 8960, 703, 6066, 15758, 362, 310, 25219, 20455, 8021, 3462, 3450, 5229, 23157, 13, 4706, 736, 6212, 342, 362, 5103, 29961, 15644, 20455, 928, 1078, 2111, 2450, 3591, 850, 6979, 29892, 25219, 20455, 928, 1078, 2111, 2450, 3591, 3032, 3166, 29918, 13525, 29898, 6979, 29889, 657, 29918, 2587, 22130, 13, 13, 1678, 732, 5721, 7541, 29918, 15003, 13, 1678, 822, 3349, 29918, 22197, 29918, 21895, 29918, 6327, 8021, 29898, 1311, 29892, 12289, 29918, 517, 29918, 1202, 29892, 26188, 29918, 1989, 29892, 3579, 19290, 1125, 13, 4706, 396, 1853, 5919, 13193, 29892, 6212, 342, 362, 10140, 292, 2558, 29892, 3579, 10773, 19969, 6212, 342, 362, 5103, 29961, 15644, 20455, 928, 1078, 2111, 2450, 3591, 29962, 13, 4706, 9995, 5240, 586, 267, 263, 716, 8898, 10643, 12289, 304, 278, 731, 310, 8898, 10643, 23199, 1078, 363, 278, 2777, 29889, 13, 13, 4706, 584, 3207, 6262, 12289, 29918, 517, 29918, 1202, 29901, 360, 1001, 18511, 1060, 29889, 29945, 29900, 29929, 12289, 304, 788, 304, 29871, 13, 9651, 278, 1051, 310, 1098, 342, 362, 8898, 10643, 23199, 1078, 29889, 13, 4706, 584, 3207, 6212, 342, 362, 10140, 292, 2558, 26188, 29918, 1989, 29901, 9954, 292, 7670, 15783, 697, 310, 29871, 13, 9651, 278, 334, 735, 15423, 29930, 1098, 342, 362, 26188, 23199, 1078, 29889, 13, 4706, 584, 2457, 6212, 342, 362, 5103, 29961, 15644, 20455, 928, 1078, 2111, 2450, 3591, 5387, 6212, 342, 362, 2669, 2933, 29871, 13, 9651, 2094, 2547, 18099, 263, 1051, 310, 360, 1001, 18511, 1060, 29889, 29945, 29900, 29929, 12289, 521, 2708, 29889, 13, 13, 4706, 450, 584, 1990, 18078, 15644, 20455, 928, 1078, 2111, 2450, 3591, 29952, 2933, 304, 278, 29871, 13, 4706, 584, 29885, 621, 18078, 5992, 29918, 22197, 29918, 21895, 29918, 6327, 8021, 29952, 3450, 3743, 1023, 8393, 13, 4706, 310, 4066, 29889, 29871, 13, 308, 13, 4706, 450, 937, 338, 421, 6327, 8021, 29918, 9778, 918, 1673, 607, 14088, 29871, 13, 4706, 3692, 278, 12289, 297, 1139, 338, 2198, 297, 278, 731, 310, 8898, 29871, 13, 4706, 10643, 23199, 1078, 1156, 278, 5858, 756, 8676, 29892, 470, 565, 372, 338, 29871, 13, 4706, 29207, 29889, 13, 13, 4706, 450, 1473, 338, 278, 421, 386, 3774, 2158, 29952, 310, 278, 12289, 2715, 29889, 450, 421, 386, 3774, 2158, 29952, 13, 4706, 363, 278, 12289, 338, 278, 317, 15715, 29896, 6608, 310, 278, 360, 1001, 8025, 310, 278, 13, 4706, 12289, 29889, 13, 308, 13, 4706, 9995, 13, 4706, 1820, 29922, 7249, 3609, 2558, 29898, 29895, 1017, 2433, 29934, 8132, 742, 921, 29945, 29918, 29883, 353, 518, 2967, 29953, 29946, 29889, 29890, 29953, 29946, 12508, 29898, 6327, 8021, 29918, 517, 29918, 1202, 467, 13808, 877, 294, 18869, 1495, 2314, 13, 4706, 788, 29918, 2587, 353, 6212, 342, 362, 20455, 8021, 27107, 8434, 29898, 22197, 29918, 6327, 8021, 29922, 1989, 29897, 13, 4706, 2284, 29918, 1202, 29918, 6979, 353, 6212, 342, 362, 6066, 29961, 4165, 342, 362, 20455, 8021, 27107, 8434, 850, 13, 9651, 3573, 29922, 1202, 29918, 2587, 29892, 13, 9651, 1804, 261, 29922, 4530, 292, 29918, 1989, 29892, 13, 9651, 3573, 29918, 1853, 29922, 4165, 342, 362, 20455, 8021, 27107, 8434, 29897, 13, 13, 4706, 2284, 29918, 5327, 353, 1583, 3032, 4645, 29889, 22197, 29918, 6327, 928, 1078, 29889, 5992, 29898, 6327, 29918, 1202, 29918, 6979, 29889, 643, 6646, 3285, 3579, 19290, 29897, 13, 4706, 5993, 353, 6212, 342, 362, 6066, 29961, 24565, 15644, 20455, 928, 1078, 2111, 2450, 3591, 850, 6979, 29922, 6327, 29918, 5327, 29889, 6979, 29892, 13, 9651, 3573, 29918, 1853, 29922, 24565, 15644, 20455, 928, 1078, 2111, 2450, 3591, 29897, 13, 4706, 565, 1583, 3032, 2917, 29889, 6979, 29918, 18157, 29918, 6768, 29889, 15480, 29918, 6979, 29901, 13, 9651, 565, 451, 5993, 29889, 15480, 29918, 6979, 29898, 1311, 3032, 2917, 29889, 6979, 29918, 18157, 29918, 6768, 29892, 1583, 3032, 657, 29918, 4530, 414, 29898, 1068, 19290, 22164, 13, 18884, 12020, 8960, 703, 6066, 15758, 362, 310, 25219, 20455, 8021, 15154, 3450, 5229, 23157, 13, 4706, 736, 6212, 342, 362, 5103, 29961, 15644, 20455, 928, 1078, 2111, 2450, 3591, 850, 6979, 29892, 25219, 20455, 928, 1078, 2111, 2450, 3591, 3032, 3166, 29918, 13525, 29898, 6979, 29889, 657, 29918, 2587, 22130, 13, 13, 1678, 822, 903, 657, 29918, 4530, 414, 29898, 1311, 29892, 3579, 19290, 1125, 13, 4706, 396, 1853, 29898, 1068, 10773, 29897, 1599, 2391, 29961, 4165, 342, 362, 10140, 261, 29962, 13, 4706, 9995, 16969, 278, 731, 310, 26188, 23199, 1078, 1304, 304, 1804, 1098, 342, 362, 18897, 29889, 13, 4706, 9995, 13, 13, 4706, 411, 1583, 3032, 6112, 295, 1698, 29901, 13, 9651, 565, 313, 1311, 3032, 4530, 292, 29918, 6327, 928, 1078, 1275, 6213, 1125, 13, 18884, 26188, 29918, 6327, 928, 1078, 353, 1583, 3032, 4645, 29889, 4530, 292, 29918, 6327, 928, 1078, 29889, 657, 29898, 1068, 19290, 29897, 13, 18884, 1583, 3032, 4530, 292, 29918, 6327, 928, 1078, 353, 5159, 13, 18884, 363, 1820, 297, 26188, 29918, 6327, 928, 1078, 29889, 8149, 29901, 13, 462, 1678, 396, 14806, 278, 4133, 12289, 9704, 964, 385, 1409, 310, 1060, 29889, 29945, 29900, 29929, 18410, 928, 1078, 29889, 13, 462, 1678, 23199, 1078, 353, 5159, 13, 462, 1678, 363, 921, 29945, 29883, 297, 1820, 29889, 29916, 29945, 29918, 29883, 29901, 13, 462, 4706, 589, 29918, 6327, 353, 2967, 29953, 29946, 29889, 29890, 29953, 29946, 13808, 29898, 29916, 29945, 29883, 29897, 13, 462, 4706, 23199, 1078, 29889, 4397, 29898, 672, 29918, 6327, 29897, 13, 462, 1678, 1583, 3032, 4530, 292, 29918, 6327, 928, 1078, 29889, 4397, 29898, 4165, 342, 362, 10140, 261, 29898, 6327, 928, 1078, 29892, 1820, 29889, 29895, 333, 876, 13, 9651, 1804, 414, 353, 1583, 3032, 4530, 292, 29918, 6327, 928, 1078, 13, 4706, 736, 1804, 414, 13, 13, 1678, 822, 3802, 29898, 1311, 1125, 13, 4706, 396, 1134, 29901, 3861, 1599, 6213, 13, 4706, 1583, 3032, 4645, 29889, 5358, 580, 13, 13, 1678, 822, 4770, 5893, 12035, 1311, 1125, 13, 4706, 396, 1134, 29901, 3861, 1599, 6212, 342, 362, 12754, 8306, 4032, 13, 4706, 1583, 3032, 4645, 17255, 5893, 1649, 580, 13, 4706, 736, 1583, 13, 13, 1678, 822, 4770, 13322, 12035, 1311, 29892, 334, 735, 29883, 29918, 14144, 1125, 13, 4706, 396, 1134, 29901, 313, 10773, 29897, 1599, 6213, 13, 4706, 1583, 3032, 4645, 17255, 13322, 1649, 10456, 735, 29883, 29918, 14144, 29897, 13, 2 ]
newsCrawl/fakeNews/index/views.py
ARIF-KHAN-420/Fake_News
1
150079
<reponame>ARIF-KHAN-420/Fake_News from django.shortcuts import render # Create your views here. def index(request): data = {'d' : "Copy a NEWS and paste it."} return render(request,'index.html',data)
[ 1, 529, 276, 1112, 420, 29958, 1718, 6545, 29899, 29968, 29950, 2190, 29899, 29946, 29906, 29900, 29914, 29943, 1296, 29918, 29328, 13, 3166, 9557, 29889, 12759, 7582, 29879, 1053, 4050, 13, 13, 29937, 6204, 596, 8386, 1244, 29889, 13, 1753, 2380, 29898, 3827, 1125, 13, 1678, 848, 353, 11117, 29881, 29915, 584, 376, 11882, 263, 14693, 7811, 322, 11417, 372, 1213, 29913, 13, 1678, 736, 4050, 29898, 3827, 5501, 2248, 29889, 1420, 742, 1272, 29897, 2 ]
get_phish_code.py
xschur/scripts
0
152386
<reponame>xschur/scripts #!/usr/bin/env python # -*- coding: utf-8 -*- # Author:schur ''' Get phish_url in phishtank,and brute to get source code ''' import aiohttp import asyncio import urllib.parse success_dir = [] success_file = [] headers = { 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 Safari/537.36', } def split_and_combine(url): dir_list = [] file_list = [] remote_file = [] ext_list = [".zip",".tar.gz",".rar",".txt",".7z",".bak",".gz",".tgz",".bz2"] url = url.split("/") main_url = url[0]+"//"+url[2]+'/' dir = url[3:] for i in dir: main_url = main_url+i+'/' dir_list.append(main_url) if len(dir_list)>=1: del dir_list[-1] for i in dir: for j in ext_list: file = i+j file_list.append(file) for i in dir_list: for j in file_list: remote_file.append(i+j) return dir_list,remote_file async def judge(url): global success_dir global success_file print('[+]handing :'+url.strip()) dir_list,remote_file = split_and_combine(url.strip()) async with aiohttp.ClientSession() as sess: for i in remote_file: try: #print("file:"+i) async with sess.get(i,headers=headers,timeout=3) as res: if res.status == 200: success_file.append(i+'\n') except Exception as e: print(str(e)) for i in dir_list: try: #print('dir'+i) async with sess.get(i,headers=headers,timeout=3) as res: html = await res.text() if "Index" in html: success_dir.append(i+'\n') except Exception as e: print(str(e)) def main(): with open('2.csv','r') as f: data = f.readlines() loop = asyncio.get_event_loop() tasks = [judge(url) for url in data] results = loop.run_until_complete(asyncio.wait(tasks)) with open("result.txt",'a') as f: f.writelines(success_dir) f.writelines(success_file) if __name__ == "__main__": main()
[ 1, 529, 276, 1112, 420, 29958, 29916, 816, 332, 29914, 16713, 13, 29937, 14708, 4855, 29914, 2109, 29914, 6272, 3017, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 29937, 13361, 29901, 816, 332, 13, 12008, 13, 2577, 1374, 728, 29918, 2271, 297, 1374, 275, 400, 804, 29892, 392, 1506, 1082, 304, 679, 2752, 775, 13, 12008, 13, 5215, 263, 601, 1124, 13, 5215, 408, 948, 3934, 13, 5215, 3142, 1982, 29889, 5510, 13, 13, 8698, 29918, 3972, 353, 5159, 13, 8698, 29918, 1445, 353, 5159, 13, 13, 13662, 353, 426, 13, 1678, 525, 2659, 29899, 19661, 2396, 525, 29924, 2112, 2911, 29914, 29945, 29889, 29900, 313, 29990, 29896, 29896, 29936, 8074, 921, 29947, 29953, 29918, 29953, 29946, 29897, 12113, 3609, 13117, 29914, 29945, 29941, 29955, 29889, 29941, 29953, 313, 29968, 7020, 29892, 763, 1879, 27604, 29897, 10228, 29914, 29946, 29947, 29889, 29900, 29889, 29906, 29945, 29953, 29946, 29889, 29896, 29896, 29953, 24544, 29914, 29945, 29941, 29955, 29889, 29941, 29953, 742, 13, 29913, 13, 13, 1753, 6219, 29918, 392, 29918, 17743, 457, 29898, 2271, 1125, 13, 1678, 4516, 29918, 1761, 29871, 353, 5159, 13, 1678, 934, 29918, 1761, 353, 5159, 13, 1678, 7592, 29918, 1445, 353, 5159, 13, 1678, 1294, 29918, 1761, 353, 518, 1642, 7554, 613, 1642, 12637, 29889, 18828, 613, 1642, 13678, 613, 1642, 3945, 613, 1642, 29955, 29920, 613, 1642, 29890, 557, 613, 1642, 18828, 613, 1642, 29873, 18828, 613, 1642, 29890, 29920, 29906, 3108, 13, 1678, 3142, 353, 3142, 29889, 5451, 11974, 1159, 13, 1678, 1667, 29918, 2271, 353, 3142, 29961, 29900, 10062, 29908, 458, 17969, 2271, 29961, 29906, 10062, 29915, 22208, 13, 1678, 4516, 353, 3142, 29961, 29941, 17531, 13, 1678, 363, 474, 297, 4516, 29901, 13, 4706, 1667, 29918, 2271, 353, 1667, 29918, 2271, 29974, 29875, 23097, 22208, 13, 4706, 4516, 29918, 1761, 29889, 4397, 29898, 3396, 29918, 2271, 29897, 13, 1678, 565, 7431, 29898, 3972, 29918, 1761, 15410, 29922, 29896, 29901, 13, 4706, 628, 4516, 29918, 1761, 14352, 29896, 29962, 13, 1678, 363, 474, 297, 4516, 29901, 13, 4706, 363, 432, 297, 1294, 29918, 1761, 29901, 13, 9651, 934, 353, 474, 29974, 29926, 13, 9651, 934, 29918, 1761, 29889, 4397, 29898, 1445, 29897, 13, 1678, 363, 474, 297, 4516, 29918, 1761, 29901, 13, 4706, 363, 432, 297, 934, 29918, 1761, 29901, 13, 9651, 7592, 29918, 1445, 29889, 4397, 29898, 29875, 29974, 29926, 29897, 13, 1678, 736, 4516, 29918, 1761, 29892, 16674, 29918, 1445, 13, 13, 12674, 822, 16833, 29898, 2271, 1125, 13, 1678, 5534, 2551, 29918, 3972, 13, 1678, 5534, 2551, 29918, 1445, 13, 1678, 1596, 877, 29961, 29974, 29962, 3179, 292, 584, 18717, 2271, 29889, 17010, 3101, 13, 1678, 4516, 29918, 1761, 29892, 16674, 29918, 1445, 353, 6219, 29918, 392, 29918, 17743, 457, 29898, 2271, 29889, 17010, 3101, 13, 1678, 7465, 411, 263, 601, 1124, 29889, 4032, 7317, 580, 408, 27937, 29901, 13, 4706, 363, 474, 297, 7592, 29918, 1445, 29901, 13, 9651, 1018, 29901, 13, 18884, 396, 2158, 703, 1445, 6160, 29974, 29875, 29897, 13, 18884, 7465, 411, 27937, 29889, 657, 29898, 29875, 29892, 13662, 29922, 13662, 29892, 15619, 29922, 29941, 29897, 408, 620, 29901, 13, 462, 1678, 565, 620, 29889, 4882, 1275, 29871, 29906, 29900, 29900, 29901, 13, 462, 4706, 2551, 29918, 1445, 29889, 4397, 29898, 29875, 29974, 12764, 29876, 1495, 13, 9651, 5174, 8960, 408, 321, 29901, 13, 18884, 1596, 29898, 710, 29898, 29872, 876, 13, 4706, 363, 474, 297, 4516, 29918, 1761, 29901, 13, 9651, 1018, 29901, 13, 18884, 396, 2158, 877, 3972, 18717, 29875, 29897, 13, 18884, 7465, 411, 27937, 29889, 657, 29898, 29875, 29892, 13662, 29922, 13662, 29892, 15619, 29922, 29941, 29897, 408, 620, 29901, 13, 462, 1678, 3472, 353, 7272, 620, 29889, 726, 580, 13, 462, 1678, 565, 376, 3220, 29908, 297, 3472, 29901, 13, 462, 4706, 2551, 29918, 3972, 29889, 4397, 29898, 29875, 29974, 12764, 29876, 1495, 13, 9651, 5174, 8960, 408, 321, 29901, 13, 18884, 1596, 29898, 710, 29898, 29872, 876, 9651, 13, 13, 1753, 1667, 7295, 13, 1678, 411, 1722, 877, 29906, 29889, 7638, 3788, 29878, 1495, 408, 285, 29901, 13, 4706, 848, 353, 285, 29889, 949, 9012, 580, 13, 1678, 2425, 353, 408, 948, 3934, 29889, 657, 29918, 3696, 29918, 7888, 580, 13, 1678, 9595, 353, 29871, 518, 17675, 479, 29898, 2271, 29897, 363, 3142, 297, 848, 29962, 13, 1678, 2582, 353, 2425, 29889, 3389, 29918, 29305, 29918, 8835, 29898, 294, 948, 3934, 29889, 10685, 29898, 20673, 876, 13, 1678, 411, 1722, 703, 2914, 29889, 3945, 613, 29915, 29874, 1495, 408, 285, 29901, 13, 4706, 285, 29889, 8231, 24210, 29898, 8698, 29918, 3972, 29897, 13, 4706, 285, 29889, 8231, 24210, 29898, 8698, 29918, 1445, 29897, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 1667, 580, 2 ]
src/utils/helpers.py
cengc13/2040FinalProject
1
1617786
<filename>src/utils/helpers.py """Helper functions for code sanity""" import numpy as np from tensorflow.keras.callbacks import Callback from sklearn.metrics import accuracy_score, roc_auc_score import re from tqdm.notebook import tqdm from sklearn import metrics def regular_encode(texts, tokenizer, maxlen=512): """ This function is from the kernel: https://www.kaggle.com/xhlulu/jigsaw-tpu-xlm-roberta """ enc_di = tokenizer.batch_encode_plus( texts, return_attention_masks=False, return_token_type_ids=False, pad_to_max_length=True, max_length=maxlen ) return np.array(enc_di['input_ids']) def fast_encode(texts, tokenizer, chunk_size=256, maxlen=512): """ https://www.kaggle.com/xhlulu/jigsaw-tpu-distilbert-with-huggingface-and-keras """ tokenizer.enable_truncation(max_length=maxlen) tokenizer.enable_padding(max_length=maxlen) all_ids = [] for i in tqdm(range(0, len(texts), chunk_size)): text_chunk = texts[i:i+chunk_size].tolist() encs = tokenizer.encode_batch(text_chunk) all_ids.extend([enc.ids for enc in encs]) return np.array(all_ids) # def build_model(transformer, max_len=512): # """ # https://www.kaggle.com/xhlulu/jigsaw-tpu-distilbert-with-huggingface-and-keras # """ # input_word_ids = Input(shape=(max_len,), dtype=tf.int32, name="input_word_ids") # sequence_output = transformer(input_word_ids)[0] # cls_token = sequence_output[:, 0, :] # out = Dense(1, activation='sigmoid')(cls_token) # model = Model(inputs=input_word_ids, outputs=out) # model.compile(Adam(lr=1e-5), loss='binary_crossentropy', metrics=['accuracy']) # return model def roc_auc(predictions,target): """ ROC-AUC value for binary classification. From: https://www.kaggle.com/tanulsingh077/ """ fpr, tpr, thresholds = metrics.roc_curve(target, predictions) roc_auc = metrics.auc(fpr, tpr) return roc_auc class RocAucEvaluation(Callback): ''' https://www.kaggle.com/tarunpaparaju/jigsaw-multilingual-toxicity-eda-models/output#Modeling- ''' def __init__(self, validation_data=(), interval=1): super(Callback, self).__init__() self.interval = interval self.X_val, self.y_val = validation_data def on_epoch_end(self, epoch, logs={}): if epoch % self.interval == 0: y_pred = self.model.predict(self.X_val, verbose=0) score = roc_auc_score(self.y_val, y_pred) print("\n ROC-AUC - epoch: {:d} - score: {:.6f}".format(epoch+1, score)) def build_lrfn(lr_start=0.000001, lr_max=0.000016, lr_min=0.0000001, lr_rampup_epochs=7, lr_sustain_epochs=0, lr_exp_decay=.87): def lrfn(epoch): if epoch < lr_rampup_epochs: lr = (lr_max - lr_start) / lr_rampup_epochs * epoch + lr_start elif epoch < lr_rampup_epochs + lr_sustain_epochs: lr = lr_max else: lr = (lr_max - lr_min) * lr_exp_decay**(epoch - lr_rampup_epochs - lr_sustain_epochs) + lr_min return lr return lrfn ##### Text cleaning from nltk import sent_tokenize LANGS = { 'en': 'english', 'it': 'italian', 'fr': 'french', 'es': 'spanish', 'tr': 'turkish', 'ru': 'russian', 'pt': 'portuguese' } def get_sentences(text, lang='en'): return sent_tokenize(text, LANGS.get(lang, 'english')) def exclude_duplicate_sentences(text, lang='en'): sentences = [] for sentence in get_sentences(text, lang): sentence = sentence.strip() if sentence not in sentences: sentences.append(sentence) return ' '.join(sentences) def clean(text): text = text.lower() # text = exclude_duplicate_sentences(text, lang='en') text = re.sub('\\n',' ', text) text = re.sub("\[\[User.*",'',text) text = re.sub("\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}",'',text) text = re.sub("\(http://.*?\s\(http://.*\)",'',text) return text # https://www.kaggle.com/chenshengabc/from-quest-encoding-ensemble-a-little-bit-differen puncts = [')', '(', '-', '|', '$', '&', '/', '[', ']', '>', '%', '=', '#', '*', '+', '\\', '•', '~', '@', '£', '·', '_', '{', '}', '©', '^', '®', '`', '<', '→', '°', '€', '™', '›', '♥', '←', '×', '§', '″', '′', 'Â', '█', '½', 'à', '…', '\xa0', '\t', '“', '★', '”', '–', '●', 'â', '►', '−', '¢', '²', '¬', '░', '¶', '↑', '±', '¿', '▾', '═', '¦', '║', '―', '¥', '▓', '—', '‹', '─', '\u3000', '\u202f', '▒', ':', '¼', '⊕', '▼', '▪', '†', '■', '’', '▀', '¨', '▄', '♫', '☆', 'é', '¯', '♦', '¤', '▲', 'è', '¸', '¾', 'Ã', '⋅', '‘', '∞', '«', '∙', ')', '↓', '、', '│', '(', '»', ',', '♪', '╩', '╚', '³', '・', '╦', '╣', '╔', '╗', '▬', '❤', 'ï', 'Ø', '¹', '≤', '‡', '√', ] special_puncts = [',', '.', '"', ':', '!', '?', ';', "'",] mispell_dict = {"aren't" : "are not", "can't" : "cannot", "couldn't" : "could not", "couldnt" : "could not", "didn't" : "did not", "doesn't" : "does not", "doesnt" : "does not", "don't" : "do not", "hadn't" : "had not", "hasn't" : "has not", "haven't" : "have not", "havent" : "have not", "he'd" : "he would", "he'll" : "he will", "he's" : "he is", "i'd" : "I would", "i'd" : "I had", "i'll" : "I will", "i'm" : "I am", "isn't" : "is not", "it's" : "it is", "it'll":"it will", "i've" : "I have", "let's" : "let us", "mightn't" : "might not", "mustn't" : "must not", "shan't" : "shall not", "she'd" : "she would", "she'll" : "she will", "she's" : "she is", "shouldn't" : "should not", "shouldnt" : "should not", "that's" : "that is", "thats" : "that is", "there's" : "there is", "theres" : "there is", "they'd" : "they would", "they'll" : "they will", "they're" : "they are", "theyre": "they are", "they've" : "they have", "we'd" : "we would", "we're" : "we are", "weren't" : "were not", "we've" : "we have", "what'll" : "what will", "what're" : "what are", "what's" : "what is", "what've" : "what have", "where's" : "where is", "who'd" : "who would", "who'll" : "who will", "who're" : "who are", "who's" : "who is", "who've" : "who have", "won't" : "will not", "wouldn't" : "would not", "you'd" : "you would", "you'll" : "you will", "you're" : "you are", "you've" : "you have", "'re": " are", "wasn't": "was not", "we'll":" will", "didn't": "did not", "tryin'":"trying"} def clean_text(x): x = str(x).replace("\n"," ") for punct in puncts: x = x.replace(punct, ' ') return x ### clean text from the kernel: ### https://www.kaggle.com/mobassir/understanding-cross-lingual-models#Part-2-:-Implementation-using-TPU-Multiprocessing from nltk.tokenize.treebank import TreebankWordTokenizer def _get_mispell(mispell_dict): mispell_re = re.compile('(%s)' % '|'.join(mispell_dict.keys())) return mispell_dict, mispell_re def replace_typical_misspell(text): mispellings, mispellings_re = _get_mispell(mispell_dict) def replace(match): return mispellings[match.group(0)] return mispellings_re.sub(replace, text) def clean_data(df, columns: list): for col in columns: df[col] = df[col].apply(lambda x: clean(x)) df[col] = df[col].apply(lambda x: clean_text(x)) df[col] = df[col].apply(lambda x: replace_typical_misspell(x)) return df def plot_loss(his, epoch, title): plt.style.use('ggplot') plt.figure() plt.plot(np.arange(0, epoch), his.history['loss'], label='train_loss') plt.plot(np.arange(0, epoch), his.history['val_loss'], label='val_loss') plt.title(title) plt.xlabel('Epoch #') plt.ylabel('Loss') plt.legend(loc='upper right') plt.show() def plot_auc(his, epoch, title): plt.style.use('ggplot') plt.figure() plt.plot(np.arange(0, epoch), his.history['auc'], label='train_auc') plt.plot(np.arange(0, epoch), his.history['val_auc'], label='val_auc') plt.title(title) plt.xlabel('Epoch #') plt.ylabel('Loss') plt.legend(loc='upper right') plt.show() ### From https://www.kaggle.com/cengc13/jigsaw-tpu-bert-two-stage-training/edit class TextTransformation: def __call__(self, text: str, lang: str = None) -> tuple: raise NotImplementedError('Abstarct') class LowerCaseTransformation(TextTransformation): def __call__(self, text: str, lang: str = None) -> tuple: return text.lower(), lang class URLTransformation(TextTransformation): def __call__(self, text: str, lang: str = None) -> tuple: for url in self.find_urls(text): if url in text: text.replace(url, ' external link ') return text.lower(), lang @staticmethod def find_urls(string): # https://www.geeksforgeeks.org/python-check-url-string/ urls = re.findall('http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\), ]|(?:%[0-9a-fA-F][0-9a-fA-F]))+', string) return urls class PunctuationTransformation(TextTransformation): def __call__(self, text: str, lang: str = None) -> tuple: for p in '?!.,"#$%\'()*+-/:;<=>@[\\]^_`{|}~' + '“”’' +"/-'" + "&" + "¡¿": if '’' in text: text = text.replace('’', f' \' ') if '’' in text: text = text.replace('’', f' \' ') if '—' in text: text = text.replace('—', f' - ') if '−' in text: text = text.replace('−', f' - ') if '–' in text: text = text.replace('–', f' - ') if '“' in text: text = text.replace('“', f' " ') if '«' in text: text = text.replace('«', f' " ') if '»' in text: text = text.replace('»', f' " ') if '”' in text: text = text.replace('”', f' " ') if '`' in text: text = text.replace('`', f' \' ') text = text.replace(p, f' {p} ') return text.strip(), lang class NumericTransformation(TextTransformation): def __call__(self, text: str, lang: str = None) -> tuple: for i in range(10): text = text.replace(str(i), f' {str(i)} ') return text, lang class WikiTransformation(TextTransformation): def __call__(self, text: str, lang: str = None) -> tuple: text = text.replace('wikiproject', ' wiki project ') for i in [' vikipedi ', ' wiki ', ' википедии ', " вики ", ' википедия ', ' viki ', ' wikipedien ', ' википедию ']: text = text.replace(i, ' wikipedia ') return text, lang class MessageTransformation(TextTransformation): def __call__(self, text: str, lang: str = None) -> tuple: text = text.replace('wikiproject', ' wiki project ') for i in [' msg ', ' msj ', ' mesaj ']: text = text.replace(i, ' message ') return text, lang class PixelTransformation(TextTransformation): def __call__(self, text: str, lang: str = None) -> tuple: for i in [' px ']: text = text.replace(i, ' pixel ') return text, lang class SaleBotTransformation(TextTransformation): def __call__(self, text: str, lang: str = None) -> tuple: text = text.replace('salebot', ' sale bot ') return text, lang class RuTransformation(TextTransformation): def __call__(self, text: str, lang: str = None) -> tuple: if lang is not None and lang == 'ru' and 'http' not in text and 'jpg' not in text and 'wikipedia' not in text: text = text.replace('t', 'т') text = text.replace('h', 'н') text = text.replace('b', 'в') text = text.replace('c', 'c') text = text.replace('k', 'к') text = text.replace('e', 'е') text = text.replace('a', 'а') return text, lang class CombineTransformation(TextTransformation): def __init__(self, transformations: list, return_lang: bool = False): self._transformations = transformations self._return_lang = return_lang def __call__(self, text: str, lang: str = None) -> tuple: for transformation in self._transformations: text, lang = transformation(text, lang) if self._return_lang: return text, lang return text def append(self, transformation: TextTransformation): self._transformations.append(transformation) transformer = CombineTransformation( [ LowerCaseTransformation(), PunctuationTransformation(), NumericTransformation(), PixelTransformation(), MessageTransformation(), WikiTransformation(), SaleBotTransformation() ] )
[ 1, 529, 9507, 29958, 4351, 29914, 13239, 29914, 3952, 6774, 29889, 2272, 13, 15945, 29908, 10739, 3168, 363, 775, 9753, 537, 15945, 29908, 13, 5215, 12655, 408, 7442, 13, 3166, 26110, 29889, 3946, 294, 29889, 14035, 29879, 1053, 8251, 1627, 13, 3166, 2071, 19668, 29889, 2527, 10817, 1053, 13600, 29918, 13628, 29892, 696, 29883, 29918, 14766, 29918, 13628, 13, 5215, 337, 13, 3166, 260, 29939, 18933, 29889, 1333, 19273, 1053, 260, 29939, 18933, 13, 3166, 2071, 19668, 1053, 21556, 13, 13, 1753, 4943, 29918, 12508, 29898, 726, 29879, 29892, 5993, 3950, 29892, 4236, 2435, 29922, 29945, 29896, 29906, 1125, 13, 1678, 9995, 13, 1678, 910, 740, 338, 515, 278, 8466, 29901, 29871, 13, 1678, 2045, 597, 1636, 29889, 29895, 351, 6234, 29889, 510, 29914, 29916, 4415, 21528, 29914, 29926, 23379, 1450, 29899, 29873, 3746, 29899, 15524, 29885, 29899, 307, 19954, 13, 1678, 9995, 13, 1678, 2094, 29918, 6051, 353, 5993, 3950, 29889, 16175, 29918, 12508, 29918, 11242, 29898, 13, 4706, 26442, 29892, 29871, 13, 4706, 736, 29918, 1131, 2509, 29918, 13168, 29879, 29922, 8824, 29892, 29871, 13, 4706, 736, 29918, 6979, 29918, 1853, 29918, 4841, 29922, 8824, 29892, 13, 4706, 17132, 29918, 517, 29918, 3317, 29918, 2848, 29922, 5574, 29892, 13, 4706, 4236, 29918, 2848, 29922, 3317, 2435, 13, 1678, 1723, 13, 268, 13, 1678, 736, 7442, 29889, 2378, 29898, 3977, 29918, 6051, 1839, 2080, 29918, 4841, 11287, 13, 13, 1753, 5172, 29918, 12508, 29898, 726, 29879, 29892, 5993, 3950, 29892, 19875, 29918, 2311, 29922, 29906, 29945, 29953, 29892, 4236, 2435, 29922, 29945, 29896, 29906, 1125, 13, 1678, 9995, 13, 1678, 2045, 597, 1636, 29889, 29895, 351, 6234, 29889, 510, 29914, 29916, 4415, 21528, 29914, 29926, 23379, 1450, 29899, 29873, 3746, 29899, 5721, 309, 2151, 29899, 2541, 29899, 29882, 688, 3460, 2161, 29899, 392, 29899, 3946, 294, 13, 1678, 9995, 13, 1678, 5993, 3950, 29889, 12007, 29918, 509, 4661, 362, 29898, 3317, 29918, 2848, 29922, 3317, 2435, 29897, 13, 1678, 5993, 3950, 29889, 12007, 29918, 12791, 29898, 3317, 29918, 2848, 29922, 3317, 2435, 29897, 13, 1678, 599, 29918, 4841, 353, 5159, 13, 268, 13, 1678, 363, 474, 297, 260, 29939, 18933, 29898, 3881, 29898, 29900, 29892, 7431, 29898, 726, 29879, 511, 19875, 29918, 2311, 22164, 13, 4706, 1426, 29918, 29812, 353, 26442, 29961, 29875, 29901, 29875, 29974, 29812, 29918, 2311, 1822, 25027, 391, 580, 13, 4706, 2094, 29879, 353, 5993, 3950, 29889, 12508, 29918, 16175, 29898, 726, 29918, 29812, 29897, 13, 4706, 599, 29918, 4841, 29889, 21843, 4197, 3977, 29889, 4841, 363, 2094, 297, 2094, 29879, 2314, 13, 268, 13, 1678, 736, 7442, 29889, 2378, 29898, 497, 29918, 4841, 29897, 13, 13, 29937, 822, 2048, 29918, 4299, 29898, 9067, 261, 29892, 4236, 29918, 2435, 29922, 29945, 29896, 29906, 1125, 13, 29937, 268, 9995, 13, 29937, 268, 2045, 597, 1636, 29889, 29895, 351, 6234, 29889, 510, 29914, 29916, 4415, 21528, 29914, 29926, 23379, 1450, 29899, 29873, 3746, 29899, 5721, 309, 2151, 29899, 2541, 29899, 29882, 688, 3460, 2161, 29899, 392, 29899, 3946, 294, 13, 29937, 268, 9995, 13, 29937, 268, 1881, 29918, 1742, 29918, 4841, 353, 10567, 29898, 12181, 7607, 3317, 29918, 2435, 29892, 511, 26688, 29922, 13264, 29889, 524, 29941, 29906, 29892, 1024, 543, 2080, 29918, 1742, 29918, 4841, 1159, 13, 29937, 268, 5665, 29918, 4905, 353, 4327, 261, 29898, 2080, 29918, 1742, 29918, 4841, 9601, 29900, 29962, 13, 29937, 268, 1067, 29879, 29918, 6979, 353, 5665, 29918, 4905, 7503, 29892, 29871, 29900, 29892, 584, 29962, 13, 29937, 268, 714, 353, 360, 1947, 29898, 29896, 29892, 26229, 2433, 18816, 29885, 3398, 1495, 29898, 25932, 29918, 6979, 29897, 13, 268, 13, 29937, 268, 1904, 353, 8125, 29898, 2080, 29879, 29922, 2080, 29918, 1742, 29918, 4841, 29892, 14391, 29922, 449, 29897, 13, 29937, 268, 1904, 29889, 12198, 29898, 3253, 314, 29898, 29212, 29922, 29896, 29872, 29899, 29945, 511, 6410, 2433, 19541, 29918, 19128, 296, 14441, 742, 21556, 29922, 1839, 562, 2764, 4135, 11287, 13, 268, 13, 29937, 268, 736, 1904, 13, 13, 1753, 696, 29883, 29918, 14766, 29898, 27711, 1080, 29892, 5182, 1125, 13, 1678, 9995, 13, 1678, 16641, 29907, 29899, 29909, 23129, 995, 363, 7581, 12965, 29889, 13, 1678, 3645, 29901, 13, 1678, 2045, 597, 1636, 29889, 29895, 351, 6234, 29889, 510, 29914, 13161, 352, 2976, 29882, 29900, 29955, 29955, 29914, 13, 1678, 9995, 1678, 13, 1678, 285, 558, 29892, 260, 558, 29892, 266, 3781, 3361, 353, 21556, 29889, 10198, 29918, 2764, 345, 29898, 5182, 29892, 27303, 29897, 13, 1678, 696, 29883, 29918, 14766, 353, 21556, 29889, 14766, 29898, 29888, 558, 29892, 260, 558, 29897, 13, 1678, 736, 696, 29883, 29918, 14766, 13, 13, 1990, 25111, 29909, 1682, 29923, 4387, 362, 29898, 10717, 1125, 13, 1678, 14550, 13, 1678, 2045, 597, 1636, 29889, 29895, 351, 6234, 29889, 510, 29914, 12637, 348, 29886, 481, 279, 19337, 29914, 29926, 23379, 1450, 29899, 4713, 6504, 950, 29899, 517, 29916, 24798, 29899, 8710, 29899, 9794, 29914, 4905, 29937, 3195, 292, 29899, 13, 1678, 14550, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 8845, 29918, 1272, 29922, 3285, 7292, 29922, 29896, 1125, 13, 4706, 2428, 29898, 10717, 29892, 1583, 467, 1649, 2344, 1649, 580, 13, 13, 4706, 1583, 29889, 19207, 353, 7292, 13, 4706, 1583, 29889, 29990, 29918, 791, 29892, 1583, 29889, 29891, 29918, 791, 353, 8845, 29918, 1272, 13, 13, 1678, 822, 373, 29918, 1022, 2878, 29918, 355, 29898, 1311, 29892, 21502, 305, 29892, 10748, 3790, 29913, 1125, 13, 4706, 565, 21502, 305, 1273, 1583, 29889, 19207, 1275, 29871, 29900, 29901, 13, 9651, 343, 29918, 11965, 353, 1583, 29889, 4299, 29889, 27711, 29898, 1311, 29889, 29990, 29918, 791, 29892, 26952, 29922, 29900, 29897, 13, 9651, 8158, 353, 696, 29883, 29918, 14766, 29918, 13628, 29898, 1311, 29889, 29891, 29918, 791, 29892, 343, 29918, 11965, 29897, 13, 9651, 1596, 14182, 29876, 16641, 29907, 29899, 29909, 23129, 448, 21502, 305, 29901, 12365, 29881, 29913, 448, 8158, 29901, 12365, 29889, 29953, 29888, 29913, 1642, 4830, 29898, 1022, 2878, 29974, 29896, 29892, 8158, 876, 13, 632, 13, 13, 1753, 2048, 29918, 29212, 9144, 29898, 29212, 29918, 2962, 29922, 29900, 29889, 29900, 29900, 29900, 29900, 29900, 29896, 29892, 301, 29878, 29918, 3317, 29922, 29900, 29889, 29900, 29900, 29900, 29900, 29896, 29953, 29892, 29871, 13, 1669, 301, 29878, 29918, 1195, 29922, 29900, 29889, 29900, 29900, 29900, 29900, 29900, 29900, 29896, 29892, 301, 29878, 29918, 29878, 1160, 786, 29918, 1022, 2878, 29879, 29922, 29955, 29892, 29871, 13, 1669, 301, 29878, 29918, 29879, 504, 475, 29918, 1022, 2878, 29879, 29922, 29900, 29892, 301, 29878, 29918, 4548, 29918, 7099, 388, 21098, 29947, 29955, 1125, 13, 13, 1678, 822, 301, 29878, 9144, 29898, 1022, 2878, 1125, 13, 4706, 565, 21502, 305, 529, 301, 29878, 29918, 29878, 1160, 786, 29918, 1022, 2878, 29879, 29901, 13, 9651, 301, 29878, 353, 313, 29212, 29918, 3317, 448, 301, 29878, 29918, 2962, 29897, 847, 301, 29878, 29918, 29878, 1160, 786, 29918, 1022, 2878, 29879, 334, 21502, 305, 718, 301, 29878, 29918, 2962, 13, 4706, 25342, 21502, 305, 529, 301, 29878, 29918, 29878, 1160, 786, 29918, 1022, 2878, 29879, 718, 301, 29878, 29918, 29879, 504, 475, 29918, 1022, 2878, 29879, 29901, 13, 9651, 301, 29878, 353, 301, 29878, 29918, 3317, 13, 4706, 1683, 29901, 13, 9651, 301, 29878, 353, 313, 29212, 29918, 3317, 448, 301, 29878, 29918, 1195, 29897, 334, 301, 29878, 29918, 4548, 29918, 7099, 388, 1068, 29898, 1022, 2878, 448, 301, 29878, 29918, 29878, 1160, 786, 29918, 1022, 2878, 29879, 448, 301, 29878, 29918, 29879, 504, 475, 29918, 1022, 2878, 29879, 29897, 718, 301, 29878, 29918, 1195, 13, 4706, 736, 301, 29878, 13, 268, 13, 1678, 736, 301, 29878, 9144, 13, 13, 268, 13, 4136, 29937, 3992, 5941, 292, 13, 3166, 302, 1896, 29895, 1053, 2665, 29918, 6979, 675, 13, 29931, 2190, 10749, 353, 426, 13, 1678, 525, 264, 2396, 525, 996, 1674, 742, 13, 1678, 525, 277, 2396, 525, 2410, 713, 742, 29871, 13, 1678, 525, 1341, 2396, 525, 29888, 4615, 742, 29871, 13, 1678, 525, 267, 2396, 525, 9653, 728, 742, 13, 1678, 525, 509, 2396, 525, 29873, 29641, 728, 742, 29871, 13, 1678, 525, 582, 2396, 525, 29878, 1558, 713, 742, 13, 1678, 525, 415, 2396, 525, 637, 688, 23053, 29915, 13, 29913, 13, 13, 1753, 679, 29918, 18616, 2063, 29898, 726, 29892, 6361, 2433, 264, 29374, 13, 1678, 736, 2665, 29918, 6979, 675, 29898, 726, 29892, 365, 2190, 10749, 29889, 657, 29898, 3893, 29892, 525, 996, 1674, 8785, 13, 13, 1753, 19060, 29918, 20908, 5926, 29918, 18616, 2063, 29898, 726, 29892, 6361, 2433, 264, 29374, 13, 1678, 25260, 353, 5159, 13, 1678, 363, 10541, 297, 679, 29918, 18616, 2063, 29898, 726, 29892, 6361, 1125, 13, 4706, 10541, 353, 10541, 29889, 17010, 580, 13, 4706, 565, 10541, 451, 297, 25260, 29901, 13, 9651, 25260, 29889, 4397, 29898, 18616, 663, 29897, 13, 1678, 736, 525, 15300, 7122, 29898, 18616, 2063, 29897, 13, 13, 1753, 5941, 29898, 726, 1125, 13, 1678, 1426, 353, 1426, 29889, 13609, 580, 13, 1678, 396, 1426, 353, 19060, 29918, 20908, 5926, 29918, 18616, 2063, 29898, 726, 29892, 6361, 2433, 264, 1495, 13, 1678, 1426, 353, 337, 29889, 1491, 877, 1966, 29876, 3788, 13420, 1426, 29897, 13, 1678, 1426, 353, 337, 29889, 1491, 14182, 7110, 29961, 2659, 5575, 613, 29915, 742, 726, 29897, 13, 1678, 1426, 353, 337, 29889, 1491, 14182, 29881, 29912, 29896, 29892, 29941, 1012, 7790, 29881, 29912, 29896, 29892, 29941, 1012, 7790, 29881, 29912, 29896, 29892, 29941, 1012, 7790, 29881, 29912, 29896, 29892, 29941, 17671, 29915, 742, 726, 29897, 13, 1678, 1426, 353, 337, 29889, 1491, 14182, 29898, 1124, 597, 5575, 29973, 29905, 29879, 29905, 29898, 1124, 597, 5575, 7244, 613, 29915, 742, 726, 29897, 13, 1678, 736, 1426, 13, 13, 13, 13, 29937, 2045, 597, 1636, 29889, 29895, 351, 6234, 29889, 510, 29914, 305, 575, 29882, 996, 10736, 29914, 3166, 29899, 1119, 29899, 22331, 29899, 24031, 29899, 29874, 29899, 29880, 1992, 29899, 2966, 29899, 29881, 8349, 264, 13, 13, 29886, 18049, 29879, 353, 518, 1495, 742, 525, 29317, 17411, 742, 29871, 525, 29989, 742, 29871, 14180, 742, 525, 29987, 742, 8207, 742, 525, 29961, 742, 525, 29962, 742, 525, 29958, 742, 14210, 742, 525, 29922, 742, 16321, 742, 525, 29930, 742, 525, 29974, 742, 525, 1966, 742, 525, 30119, 742, 29871, 525, 30022, 742, 18803, 742, 525, 30155, 742, 13, 525, 30064, 742, 22868, 742, 22372, 742, 525, 29913, 742, 525, 30211, 742, 525, 29985, 742, 525, 30342, 742, 525, 29952, 742, 29871, 12801, 742, 525, 30121, 742, 525, 30073, 742, 525, 30181, 742, 525, 30536, 742, 525, 30405, 742, 29871, 525, 30922, 742, 525, 30245, 742, 525, 30122, 742, 525, 30152, 742, 525, 30160, 742, 525, 30139, 742, 525, 30212, 742, 525, 30208, 742, 525, 30226, 742, 525, 30001, 742, 525, 30098, 742, 11297, 17367, 29900, 742, 11297, 29873, 742, 13, 525, 30015, 742, 525, 30950, 742, 525, 30024, 742, 525, 29994, 742, 525, 30764, 742, 525, 30057, 742, 525, 30318, 742, 525, 30120, 742, 525, 30650, 742, 525, 30088, 742, 525, 30320, 742, 525, 30833, 742, 525, 30497, 742, 525, 30213, 742, 525, 30221, 742, 525, 30158, 742, 525, 229, 153, 193, 742, 525, 30114, 742, 525, 30629, 742, 525, 30246, 742, 525, 30217, 742, 525, 30563, 742, 525, 31879, 742, 525, 30003, 742, 525, 30474, 742, 525, 30091, 742, 11297, 29884, 29941, 29900, 29900, 29900, 742, 11297, 29884, 29906, 29900, 29906, 29888, 742, 13, 525, 30686, 742, 525, 30383, 742, 525, 30515, 742, 525, 31200, 742, 525, 30736, 742, 525, 229, 153, 173, 742, 525, 30087, 742, 525, 30725, 742, 525, 30010, 742, 525, 30676, 742, 525, 30399, 742, 525, 30625, 742, 525, 229, 156, 174, 742, 525, 31048, 742, 525, 29948, 742, 525, 30586, 742, 525, 30649, 742, 525, 30435, 742, 525, 31282, 742, 525, 30000, 742, 525, 30836, 742, 525, 30642, 742, 525, 30179, 742, 525, 30394, 742, 525, 30086, 742, 525, 30306, 742, 525, 30009, 742, 13, 525, 31492, 742, 525, 30409, 742, 525, 30552, 742, 525, 30330, 742, 525, 30111, 742, 525, 30419, 742, 525, 30007, 742, 525, 30214, 742, 525, 229, 156, 173, 742, 525, 31216, 742, 525, 31372, 742, 525, 30168, 742, 525, 30290, 742, 525, 31128, 742, 525, 31626, 742, 525, 31351, 742, 525, 31215, 742, 525, 229, 153, 175, 742, 525, 229, 160, 167, 742, 525, 30085, 742, 525, 30222, 742, 525, 30193, 742, 525, 30248, 742, 525, 30892, 742, 525, 30562, 742, 4514, 13, 18732, 29918, 29886, 18049, 29879, 353, 518, 742, 742, 15300, 742, 18793, 742, 525, 29901, 742, 525, 29991, 742, 525, 29973, 742, 21921, 742, 13577, 613, 29962, 13, 13, 29885, 11936, 514, 29918, 8977, 353, 8853, 8326, 29915, 29873, 29908, 584, 376, 598, 451, 613, 13, 29908, 3068, 29915, 29873, 29908, 584, 376, 29883, 6735, 613, 13, 29908, 26680, 29876, 29915, 29873, 29908, 584, 376, 26680, 451, 613, 13, 29908, 26680, 593, 29908, 584, 376, 26680, 451, 613, 13, 29908, 18361, 29876, 29915, 29873, 29908, 584, 376, 18361, 451, 613, 13, 29908, 13221, 29876, 29915, 29873, 29908, 584, 376, 13221, 451, 613, 13, 29908, 13221, 593, 29908, 584, 376, 13221, 451, 613, 13, 29908, 9176, 29915, 29873, 29908, 584, 376, 1867, 451, 613, 13, 29908, 21312, 29876, 29915, 29873, 29908, 584, 376, 21312, 451, 613, 13, 29908, 5349, 29876, 29915, 29873, 29908, 584, 376, 5349, 451, 613, 13, 29908, 29882, 3496, 29915, 29873, 29908, 584, 376, 17532, 451, 613, 13, 29908, 8708, 296, 29908, 584, 376, 17532, 451, 613, 13, 29908, 354, 29915, 29881, 29908, 584, 376, 354, 723, 613, 13, 29908, 354, 29915, 645, 29908, 584, 376, 354, 674, 613, 13, 29908, 354, 29915, 29879, 29908, 584, 376, 354, 338, 613, 13, 29908, 29875, 29915, 29881, 29908, 584, 376, 29902, 723, 613, 13, 29908, 29875, 29915, 29881, 29908, 584, 376, 29902, 750, 613, 13, 29908, 29875, 29915, 645, 29908, 584, 376, 29902, 674, 613, 13, 29908, 29875, 29915, 29885, 29908, 584, 376, 29902, 626, 613, 13, 29908, 275, 29876, 29915, 29873, 29908, 584, 376, 275, 451, 613, 13, 29908, 277, 29915, 29879, 29908, 584, 376, 277, 338, 613, 13, 29908, 277, 29915, 645, 4710, 277, 674, 613, 13, 29908, 29875, 29915, 345, 29908, 584, 376, 29902, 505, 613, 13, 29908, 1026, 29915, 29879, 29908, 584, 376, 1026, 502, 613, 13, 29908, 29885, 523, 29876, 29915, 29873, 29908, 584, 376, 29885, 523, 451, 613, 13, 29908, 21969, 29876, 29915, 29873, 29908, 584, 376, 21969, 451, 613, 13, 29908, 845, 273, 29915, 29873, 29908, 584, 376, 845, 497, 451, 613, 13, 29908, 11360, 29915, 29881, 29908, 584, 376, 11360, 723, 613, 13, 29908, 11360, 29915, 645, 29908, 584, 376, 11360, 674, 613, 13, 29908, 11360, 29915, 29879, 29908, 584, 376, 11360, 338, 613, 13, 29908, 9344, 29876, 29915, 29873, 29908, 584, 376, 9344, 451, 613, 13, 29908, 9344, 593, 29908, 584, 376, 9344, 451, 613, 13, 29908, 5747, 29915, 29879, 29908, 584, 376, 5747, 338, 613, 13, 29908, 386, 1446, 29908, 584, 376, 5747, 338, 613, 13, 29908, 12711, 29915, 29879, 29908, 584, 376, 12711, 338, 613, 13, 29908, 721, 267, 29908, 584, 376, 12711, 338, 613, 13, 29908, 19562, 29915, 29881, 29908, 584, 376, 19562, 723, 613, 13, 29908, 19562, 29915, 645, 29908, 584, 376, 19562, 674, 613, 13, 29908, 19562, 29915, 276, 29908, 584, 376, 19562, 526, 613, 13, 29908, 19562, 276, 1115, 29871, 376, 19562, 526, 613, 13, 29908, 19562, 29915, 345, 29908, 584, 376, 19562, 505, 613, 13, 29908, 705, 29915, 29881, 29908, 584, 376, 705, 723, 613, 13, 29908, 705, 29915, 276, 29908, 584, 376, 705, 526, 613, 13, 29908, 556, 264, 29915, 29873, 29908, 584, 376, 29893, 406, 451, 613, 13, 29908, 705, 29915, 345, 29908, 584, 376, 705, 505, 613, 13, 29908, 5816, 29915, 645, 29908, 584, 376, 5816, 674, 613, 13, 29908, 5816, 29915, 276, 29908, 584, 376, 5816, 526, 613, 13, 29908, 5816, 29915, 29879, 29908, 584, 376, 5816, 338, 613, 13, 29908, 5816, 29915, 345, 29908, 584, 376, 5816, 505, 613, 13, 29908, 3062, 29915, 29879, 29908, 584, 376, 3062, 338, 613, 13, 29908, 15970, 29915, 29881, 29908, 584, 376, 15970, 723, 613, 13, 29908, 15970, 29915, 645, 29908, 584, 376, 15970, 674, 613, 13, 29908, 15970, 29915, 276, 29908, 584, 376, 15970, 526, 613, 13, 29908, 15970, 29915, 29879, 29908, 584, 376, 15970, 338, 613, 13, 29908, 15970, 29915, 345, 29908, 584, 376, 15970, 505, 613, 13, 29908, 12620, 29915, 29873, 29908, 584, 376, 14043, 451, 613, 13, 29908, 29893, 483, 29876, 29915, 29873, 29908, 584, 376, 29893, 483, 451, 613, 13, 29908, 6293, 29915, 29881, 29908, 584, 376, 6293, 723, 613, 13, 29908, 6293, 29915, 645, 29908, 584, 376, 6293, 674, 613, 13, 29908, 6293, 29915, 276, 29908, 584, 376, 6293, 526, 613, 13, 29908, 6293, 29915, 345, 29908, 584, 376, 6293, 505, 613, 13, 29908, 29915, 276, 1115, 376, 526, 613, 13, 29908, 11102, 29876, 29915, 29873, 1115, 376, 11102, 451, 613, 13, 29908, 705, 29915, 645, 4710, 674, 613, 13, 29908, 18361, 29876, 29915, 29873, 1115, 376, 18361, 451, 613, 13, 29908, 2202, 262, 29915, 4710, 2202, 292, 9092, 13, 13, 1753, 5941, 29918, 726, 29898, 29916, 1125, 13, 1678, 921, 353, 851, 29898, 29916, 467, 6506, 14182, 29876, 3284, 16521, 13, 1678, 363, 6035, 312, 297, 6035, 312, 29879, 29901, 13, 4706, 921, 353, 921, 29889, 6506, 29898, 29886, 18049, 29892, 525, 25710, 13, 1678, 736, 921, 13, 13, 2277, 29937, 5941, 1426, 515, 278, 8466, 29901, 13, 2277, 29937, 2045, 597, 1636, 29889, 29895, 351, 6234, 29889, 510, 29914, 29885, 711, 465, 381, 29914, 5062, 11235, 29899, 19128, 29899, 1847, 950, 29899, 9794, 29937, 7439, 29899, 29906, 29899, 13018, 1888, 14607, 29899, 4746, 29899, 3557, 29965, 29899, 6857, 666, 307, 985, 292, 13, 3166, 302, 1896, 29895, 29889, 6979, 675, 29889, 2484, 774, 804, 1053, 6479, 774, 804, 14463, 6066, 3950, 13, 13, 1753, 903, 657, 29918, 29885, 11936, 514, 29898, 29885, 11936, 514, 29918, 8977, 1125, 13, 1678, 3984, 29886, 514, 29918, 276, 353, 337, 29889, 12198, 877, 29414, 29879, 16029, 1273, 525, 29989, 4286, 7122, 29898, 29885, 11936, 514, 29918, 8977, 29889, 8149, 22130, 13, 1678, 736, 3984, 29886, 514, 29918, 8977, 29892, 3984, 29886, 514, 29918, 276, 13, 13, 13, 1753, 5191, 29918, 22449, 936, 29918, 9894, 29886, 514, 29898, 726, 1125, 13, 1678, 3984, 29886, 514, 886, 29892, 3984, 29886, 514, 886, 29918, 276, 353, 903, 657, 29918, 29885, 11936, 514, 29898, 29885, 11936, 514, 29918, 8977, 29897, 13, 13, 1678, 822, 5191, 29898, 4352, 1125, 13, 4706, 736, 3984, 29886, 514, 886, 29961, 4352, 29889, 2972, 29898, 29900, 4638, 13, 13, 1678, 736, 3984, 29886, 514, 886, 29918, 276, 29889, 1491, 29898, 6506, 29892, 1426, 29897, 13, 13, 13, 1753, 5941, 29918, 1272, 29898, 2176, 29892, 4341, 29901, 1051, 1125, 13, 1678, 363, 784, 297, 4341, 29901, 13, 4706, 4489, 29961, 1054, 29962, 353, 4489, 29961, 1054, 1822, 7302, 29898, 2892, 921, 29901, 5941, 29898, 29916, 876, 13, 4706, 4489, 29961, 1054, 29962, 353, 4489, 29961, 1054, 1822, 7302, 29898, 2892, 921, 29901, 5941, 29918, 726, 29898, 29916, 876, 29871, 13, 4706, 4489, 29961, 1054, 29962, 353, 4489, 29961, 1054, 1822, 7302, 29898, 2892, 921, 29901, 5191, 29918, 22449, 936, 29918, 9894, 29886, 514, 29898, 29916, 876, 259, 13, 1678, 736, 4489, 13, 13, 1753, 6492, 29918, 6758, 29898, 22880, 29892, 21502, 305, 29892, 3611, 1125, 13, 1678, 14770, 29889, 3293, 29889, 1509, 877, 1505, 5317, 1495, 13, 1678, 14770, 29889, 4532, 580, 13, 1678, 14770, 29889, 5317, 29898, 9302, 29889, 279, 927, 29898, 29900, 29892, 21502, 305, 511, 670, 29889, 18434, 1839, 6758, 7464, 3858, 2433, 14968, 29918, 6758, 1495, 13, 13, 1678, 14770, 29889, 5317, 29898, 9302, 29889, 279, 927, 29898, 29900, 29892, 21502, 305, 511, 670, 29889, 18434, 1839, 791, 29918, 6758, 7464, 3858, 2433, 791, 29918, 6758, 1495, 13, 13, 1678, 14770, 29889, 3257, 29898, 3257, 29897, 13, 1678, 14770, 29889, 29916, 1643, 877, 29923, 1129, 305, 396, 1495, 13, 1678, 14770, 29889, 29891, 1643, 877, 29931, 2209, 1495, 13, 1678, 14770, 29889, 26172, 29898, 2029, 2433, 21064, 1492, 1495, 13, 1678, 14770, 29889, 4294, 580, 13, 13, 13, 1753, 6492, 29918, 14766, 29898, 22880, 29892, 21502, 305, 29892, 3611, 1125, 13, 1678, 14770, 29889, 3293, 29889, 1509, 877, 1505, 5317, 1495, 13, 1678, 14770, 29889, 4532, 580, 13, 1678, 14770, 29889, 5317, 29898, 9302, 29889, 279, 927, 29898, 29900, 29892, 21502, 305, 511, 670, 29889, 18434, 1839, 14766, 7464, 3858, 2433, 14968, 29918, 14766, 1495, 13, 1678, 14770, 29889, 5317, 29898, 9302, 29889, 279, 927, 29898, 29900, 29892, 21502, 305, 511, 670, 29889, 18434, 1839, 791, 29918, 14766, 7464, 3858, 2433, 791, 29918, 14766, 1495, 13, 13, 1678, 14770, 29889, 3257, 29898, 3257, 29897, 13, 1678, 14770, 29889, 29916, 1643, 877, 29923, 1129, 305, 396, 1495, 13, 1678, 14770, 29889, 29891, 1643, 877, 29931, 2209, 1495, 13, 1678, 14770, 29889, 26172, 29898, 2029, 2433, 21064, 1492, 1495, 13, 1678, 14770, 29889, 4294, 580, 13, 13, 2277, 29937, 3645, 2045, 597, 1636, 29889, 29895, 351, 6234, 29889, 510, 29914, 29883, 996, 29883, 29896, 29941, 29914, 29926, 23379, 1450, 29899, 29873, 3746, 29899, 2151, 29899, 10184, 29899, 19190, 29899, 26495, 29914, 5628, 13, 1990, 3992, 4300, 5404, 29901, 13, 1678, 822, 4770, 4804, 12035, 1311, 29892, 1426, 29901, 851, 29892, 6361, 29901, 851, 353, 6213, 29897, 1599, 18761, 29901, 13, 4706, 12020, 2216, 1888, 2037, 287, 2392, 877, 4920, 8508, 312, 1495, 1678, 13, 308, 13, 1990, 27723, 8259, 4300, 5404, 29898, 1626, 4300, 5404, 1125, 13, 1678, 822, 4770, 4804, 12035, 1311, 29892, 1426, 29901, 851, 29892, 6361, 29901, 851, 353, 6213, 29897, 1599, 18761, 29901, 13, 4706, 736, 1426, 29889, 13609, 3285, 6361, 13, 268, 13, 268, 13, 1990, 3988, 4300, 5404, 29898, 1626, 4300, 5404, 1125, 13, 1678, 822, 4770, 4804, 12035, 1311, 29892, 1426, 29901, 851, 29892, 6361, 29901, 851, 353, 6213, 29897, 1599, 18761, 29901, 13, 4706, 363, 3142, 297, 1583, 29889, 2886, 29918, 26045, 29898, 726, 1125, 13, 9651, 565, 3142, 297, 1426, 29901, 13, 18884, 1426, 29889, 6506, 29898, 2271, 29892, 525, 7029, 1544, 25710, 13, 4706, 736, 1426, 29889, 13609, 3285, 6361, 13, 268, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 1284, 29918, 26045, 29898, 1807, 1125, 29871, 13, 4706, 396, 2045, 597, 1636, 29889, 479, 14541, 20324, 14541, 29889, 990, 29914, 4691, 29899, 3198, 29899, 2271, 29899, 1807, 29914, 13, 4706, 23942, 353, 337, 29889, 2886, 497, 877, 1124, 29961, 29879, 29962, 29973, 597, 10780, 10834, 29874, 29899, 25265, 29899, 29999, 29962, 29989, 29961, 29900, 29899, 29929, 29962, 29989, 29961, 4388, 29918, 29992, 29889, 29987, 29974, 29962, 29989, 29961, 29991, 17710, 1194, 511, 4514, 29989, 10780, 16664, 29961, 29900, 29899, 29929, 29874, 29899, 29888, 29909, 29899, 29943, 3816, 29900, 29899, 29929, 29874, 29899, 29888, 29909, 29899, 29943, 12622, 29974, 742, 1347, 29897, 29871, 13, 4706, 736, 23942, 29871, 13, 268, 13, 1990, 349, 18049, 29884, 362, 4300, 5404, 29898, 1626, 4300, 5404, 1125, 13, 1678, 822, 4770, 4804, 12035, 1311, 29892, 1426, 29901, 851, 29892, 6361, 29901, 851, 353, 6213, 29897, 1599, 18761, 29901, 13, 4706, 363, 282, 297, 525, 29973, 29991, 1696, 29908, 29937, 29938, 29995, 20333, 580, 29930, 29974, 29899, 24676, 29936, 29966, 4261, 29992, 29961, 1966, 29962, 29985, 29918, 29952, 28437, 29913, 30022, 29915, 718, 525, 30015, 30024, 30010, 29915, 718, 23901, 29899, 11838, 718, 376, 29987, 29908, 718, 376, 30180, 30158, 1115, 13, 9651, 565, 525, 30010, 29915, 297, 1426, 29901, 13, 18884, 1426, 353, 1426, 29889, 6506, 877, 30010, 742, 285, 29915, 320, 29915, 25710, 13, 462, 13, 9651, 565, 525, 30010, 29915, 297, 1426, 29901, 13, 18884, 1426, 353, 1426, 29889, 6506, 877, 30010, 742, 285, 29915, 320, 29915, 25710, 13, 1669, 13, 9651, 565, 525, 30003, 29915, 297, 1426, 29901, 13, 18884, 1426, 353, 1426, 29889, 6506, 877, 30003, 742, 285, 29915, 448, 25710, 13, 462, 13, 9651, 565, 525, 30120, 29915, 297, 1426, 29901, 13, 18884, 1426, 353, 1426, 29889, 6506, 877, 30120, 742, 285, 29915, 448, 25710, 1678, 13, 462, 13, 9651, 565, 525, 29994, 29915, 297, 1426, 29901, 13, 18884, 1426, 353, 1426, 29889, 6506, 877, 29994, 742, 285, 29915, 448, 25710, 1678, 13, 1669, 13, 9651, 565, 525, 30015, 29915, 297, 1426, 29901, 13, 18884, 1426, 353, 1426, 29889, 6506, 877, 30015, 742, 285, 29915, 376, 25710, 1678, 13, 462, 13, 9651, 565, 525, 30009, 29915, 297, 1426, 29901, 13, 18884, 1426, 353, 1426, 29889, 6506, 877, 30009, 742, 285, 29915, 376, 25710, 1678, 13, 462, 13, 9651, 565, 525, 30007, 29915, 297, 1426, 29901, 13, 18884, 1426, 353, 1426, 29889, 6506, 877, 30007, 742, 285, 29915, 376, 25710, 1678, 13, 632, 13, 9651, 565, 525, 30024, 29915, 297, 1426, 29901, 13, 18884, 1426, 353, 1426, 29889, 6506, 877, 30024, 742, 285, 29915, 376, 25710, 29871, 13, 462, 13, 9651, 565, 525, 20497, 297, 1426, 29901, 13, 18884, 1426, 353, 1426, 29889, 6506, 877, 29952, 742, 285, 29915, 320, 29915, 25710, 1669, 13, 13, 9651, 1426, 353, 1426, 29889, 6506, 29898, 29886, 29892, 285, 29915, 426, 29886, 29913, 25710, 13, 462, 13, 4706, 736, 1426, 29889, 17010, 3285, 6361, 13, 268, 13, 268, 13, 1990, 405, 25099, 4300, 5404, 29898, 1626, 4300, 5404, 1125, 13, 1678, 822, 4770, 4804, 12035, 1311, 29892, 1426, 29901, 851, 29892, 6361, 29901, 851, 353, 6213, 29897, 1599, 18761, 29901, 13, 4706, 363, 474, 297, 3464, 29898, 29896, 29900, 1125, 13, 9651, 1426, 353, 1426, 29889, 6506, 29898, 710, 29898, 29875, 511, 285, 29915, 426, 710, 29898, 29875, 2915, 25710, 13, 4706, 736, 1426, 29892, 6361, 13, 268, 13, 1990, 3772, 29875, 4300, 5404, 29898, 1626, 4300, 5404, 1125, 13, 1678, 822, 4770, 4804, 12035, 1311, 29892, 1426, 29901, 851, 29892, 6361, 29901, 851, 353, 6213, 29897, 1599, 18761, 29901, 13, 4706, 1426, 353, 1426, 29889, 6506, 877, 2851, 666, 307, 622, 742, 525, 281, 10058, 2060, 25710, 13, 4706, 363, 474, 297, 6024, 325, 638, 666, 15844, 13420, 525, 281, 10058, 13420, 525, 2196, 14949, 29917, 13420, 376, 2196, 717, 9162, 525, 2196, 14949, 29970, 13420, 525, 325, 10058, 13420, 525, 281, 638, 666, 287, 819, 13420, 525, 2196, 14949, 30005, 525, 5387, 13, 9651, 1426, 353, 1426, 29889, 6506, 29898, 29875, 29892, 525, 281, 638, 4652, 25710, 13, 4706, 736, 1426, 29892, 6361, 13, 268, 13, 268, 13, 1990, 7777, 4300, 5404, 29898, 1626, 4300, 5404, 1125, 13, 1678, 822, 4770, 4804, 12035, 1311, 29892, 1426, 29901, 851, 29892, 6361, 29901, 851, 353, 6213, 29897, 1599, 18761, 29901, 13, 4706, 1426, 353, 1426, 29889, 6506, 877, 2851, 666, 307, 622, 742, 525, 281, 10058, 2060, 25710, 13, 4706, 363, 474, 297, 6024, 10191, 13420, 525, 10887, 29926, 13420, 525, 4883, 1175, 525, 5387, 13, 9651, 1426, 353, 1426, 29889, 6506, 29898, 29875, 29892, 525, 2643, 25710, 13, 4706, 736, 1426, 29892, 6361, 13, 268, 13, 268, 13, 1990, 349, 15711, 4300, 5404, 29898, 1626, 4300, 5404, 1125, 13, 1678, 822, 4770, 4804, 12035, 1311, 29892, 1426, 29901, 851, 29892, 6361, 29901, 851, 353, 6213, 29897, 1599, 18761, 29901, 13, 4706, 363, 474, 297, 6024, 282, 29916, 525, 5387, 13, 9651, 1426, 353, 1426, 29889, 6506, 29898, 29875, 29892, 525, 15526, 25710, 13, 4706, 736, 1426, 29892, 6361, 13, 268, 13, 268, 13, 1990, 317, 744, 29933, 327, 4300, 5404, 29898, 1626, 4300, 5404, 1125, 13, 1678, 822, 4770, 4804, 12035, 1311, 29892, 1426, 29901, 851, 29892, 6361, 29901, 851, 353, 6213, 29897, 1599, 18761, 29901, 13, 4706, 1426, 353, 1426, 29889, 6506, 877, 29879, 744, 7451, 742, 525, 14686, 9225, 25710, 13, 4706, 736, 1426, 29892, 6361, 13, 268, 13, 268, 13, 1990, 9723, 4300, 5404, 29898, 1626, 4300, 5404, 1125, 13, 1678, 822, 4770, 4804, 12035, 1311, 29892, 1426, 29901, 851, 29892, 6361, 29901, 851, 353, 6213, 29897, 1599, 18761, 29901, 13, 4706, 565, 6361, 338, 451, 6213, 322, 6361, 1275, 525, 582, 29915, 322, 525, 1124, 29915, 451, 297, 1426, 322, 525, 6173, 29915, 451, 297, 1426, 322, 525, 6011, 29915, 451, 297, 1426, 29901, 13, 9651, 1426, 353, 1426, 29889, 6506, 877, 29873, 742, 525, 29932, 1495, 13, 9651, 1426, 353, 1426, 29889, 6506, 877, 29882, 742, 525, 29921, 1495, 13, 9651, 1426, 353, 1426, 29889, 6506, 877, 29890, 742, 525, 29942, 1495, 13, 9651, 1426, 353, 1426, 29889, 6506, 877, 29883, 742, 525, 29883, 1495, 13, 9651, 1426, 353, 1426, 29889, 6506, 877, 29895, 742, 525, 29951, 1495, 13, 9651, 1426, 353, 1426, 29889, 6506, 877, 29872, 742, 525, 29919, 1495, 13, 9651, 1426, 353, 1426, 29889, 6506, 877, 29874, 742, 525, 29910, 1495, 13, 4706, 736, 1426, 29892, 6361, 13, 268, 13, 1990, 422, 26062, 4300, 5404, 29898, 1626, 4300, 5404, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 29304, 29901, 1051, 29892, 736, 29918, 3893, 29901, 6120, 353, 7700, 1125, 13, 4706, 1583, 3032, 9067, 800, 353, 29304, 13, 4706, 1583, 3032, 2457, 29918, 3893, 353, 736, 29918, 3893, 13, 308, 13, 1678, 822, 4770, 4804, 12035, 1311, 29892, 1426, 29901, 851, 29892, 6361, 29901, 851, 353, 6213, 29897, 1599, 18761, 29901, 13, 4706, 363, 13852, 297, 1583, 3032, 9067, 800, 29901, 13, 9651, 1426, 29892, 6361, 353, 13852, 29898, 726, 29892, 6361, 29897, 13, 4706, 565, 1583, 3032, 2457, 29918, 3893, 29901, 13, 9651, 736, 1426, 29892, 6361, 13, 4706, 736, 1426, 13, 268, 13, 1678, 822, 9773, 29898, 1311, 29892, 13852, 29901, 3992, 4300, 5404, 1125, 13, 4706, 1583, 3032, 9067, 800, 29889, 4397, 29898, 3286, 5404, 29897, 13, 308, 13, 9067, 261, 353, 422, 26062, 4300, 5404, 29898, 13, 1678, 518, 13, 4706, 27723, 8259, 4300, 5404, 3285, 13, 4706, 349, 18049, 29884, 362, 4300, 5404, 3285, 13, 4706, 405, 25099, 4300, 5404, 3285, 13, 4706, 349, 15711, 4300, 5404, 3285, 13, 4706, 7777, 4300, 5404, 3285, 13, 4706, 3772, 29875, 4300, 5404, 3285, 13, 4706, 317, 744, 29933, 327, 4300, 5404, 580, 13, 1678, 4514, 13, 29897, 13, 2 ]
mailadmin.py
FabianWe/pymailadmin
0
160455
<gh_stars>0 # Copyright (c) 2016, 2017 <NAME> # MIT License # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in all # copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. import crypt import MySQLdb import string import random import configparser import sys import re pw_chars = string.ascii_letters + string.digits def parse_settings(path='.config'): config = configparser.ConfigParser() config.read(path) mysql = config['mysql'] user = mysql.get('user') if user is None: print('"user" not set in config file. Error.') sys.exit(1) password = mysql.get('password') if password is None: print('"password" not set in config file. Error') sys.exit(1) host = mysql.get('host', '127.0.1.1') port = mysql.getint('port', 3306) db = mysql.get('db', 'mailserver') return {'host': host, 'port': port, 'db': db, 'user': user, 'password': password} def gen_pw(pw_len=12): return "".join(random.choice(pw_chars) for _ in range(pw_len)) def open_db(host, user, passwd, port=3306, db='mailserver'): return MySQLdb.connect(host=host, user=user, passwd=passwd, db=db, port=port) def open_from_settings(path='.config'): settings = parse_settings(path) return open_db(host=settings['host'], user=settings['user'], passwd=settings['password'], port=settings['port'], db=settings['db']) def gen_hash(pw): return '{SHA512-CRYPT}' + crypt.crypt(pw, crypt.mksalt(crypt.METHOD_SHA512)) def init_db(db): cur = db.cursor() cur.execute( ''' CREATE TABLE IF NOT EXISTS virtual_domains ( id INT NOT NULL AUTO_INCREMENT, name VARCHAR(50) NOT NULL, PRIMARY KEY(id), UNIQUE KEY name (name) ) ''' ) cur.execute( ''' CREATE TABLE IF NOT EXISTS virtual_users ( id INT NOT NULL AUTO_INCREMENT, domain_id INT NOT NULL, email VARCHAR(100), password varchar(150) NOT NULL, PRIMARY KEY(id), UNIQUE KEY email (email), FOREIGN KEY (domain_id) REFERENCES virtual_domains(id) ON DELETE CASCADE ) ''' ) cur.execute( ''' CREATE TABLE IF NOT EXISTS virtual_aliases ( id INT NOT NULL AUTO_INCREMENT, domain_id INT NOT NULL, source VARCHAR(100) NOT NULL, destination VARCHAR(100) NOT NULL, PRIMARY KEY (id), FOREIGN KEY (domain_id) REFERENCES virtual_domains(id) ON DELETE CASCADE ) ''' ) cur.close() db.commit() def add_domain(db, name): cur = db.cursor() cmd = ''' INSERT INTO virtual_domains (name) VALUES (%s) ''' cur.execute(cmd, (name,)) cur.close() db.commit() def add_user(db, mail, pw_hash): cur = db.cursor() split = mail.split('@') if len(split) != 2: print('Email does not contain exactly one @. Error.') sys.exit(1) domain = split[1] get_domain = ''' SELECT id FROM virtual_domains WHERE name = %s ''' cur.execute(get_domain, (domain,)) entries = list(cur) if not entries: print('Domain "%s" was not found. Error.' % domain) sys.exit(1) # everything ok, we got the id, so now add domain_id = entries[0][0] cmd = ''' INSERT INTO virtual_users (domain_id, email, password) VALUES (%s, %s, %s) ''' cur.execute(cmd, (domain_id, mail, pw_hash)) cur.close() db.commit() def add_alias(db, source, dest): cur = db.cursor() split = source.split('@') if len(split) != 2: print('Email does not contain exactly one @. Error') sys.exit(1) domain = split[1] get_domain = ''' SELECT id FROM virtual_domains WHERE name = %s ''' cur.execute(get_domain, (domain,)) entries = list(cur) if not entries: print('Domain "%s" was not found. Error.' % domain) sys.exit(1) domain_id = entries[0][0] cmd = ''' INSERT INTO virtual_aliases (domain_id, source, destination) VALUES (%s, %s, %s) ''' cur.execute(cmd, (domain_id, source, dest)) cur.close() db.commit() mail_regex = re.compile(r"(^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$)") def valid_email(mail): return mail_regex.match(mail) is not None
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 29937, 14187, 1266, 313, 29883, 29897, 29871, 29906, 29900, 29896, 29953, 29892, 29871, 29906, 29900, 29896, 29955, 529, 5813, 29958, 13, 13, 29937, 341, 1806, 19245, 13, 29937, 20894, 2333, 338, 1244, 1609, 16896, 29892, 3889, 310, 8323, 29892, 304, 738, 2022, 4017, 292, 263, 3509, 13, 29937, 310, 445, 7047, 322, 6942, 5106, 2066, 313, 1552, 376, 6295, 14093, 4968, 304, 5376, 13, 29937, 297, 278, 18540, 1728, 24345, 29892, 3704, 1728, 29485, 278, 10462, 13, 29937, 304, 671, 29892, 3509, 29892, 6623, 29892, 10366, 29892, 9805, 29892, 1320, 2666, 29892, 269, 803, 1947, 29892, 322, 29914, 272, 19417, 13, 29937, 14591, 310, 278, 18540, 29892, 322, 304, 14257, 12407, 304, 6029, 278, 18540, 338, 13, 29937, 15252, 3276, 304, 437, 577, 29892, 4967, 304, 278, 1494, 5855, 29901, 13, 29937, 13, 29937, 450, 2038, 3509, 1266, 8369, 322, 445, 10751, 8369, 4091, 367, 5134, 297, 599, 13, 29937, 14591, 470, 23228, 2011, 1080, 310, 278, 18540, 29889, 13, 29937, 13, 29937, 6093, 7791, 7818, 12982, 1525, 8519, 13756, 13044, 3352, 376, 3289, 8519, 613, 399, 1806, 8187, 2692, 399, 1718, 29934, 13566, 29979, 8079, 13764, 29979, 476, 22255, 29892, 8528, 15094, 1799, 6323, 13, 29937, 306, 3580, 5265, 3352, 29892, 2672, 6154, 15789, 4214, 350, 2692, 6058, 27848, 3352, 7495, 6093, 399, 1718, 29934, 13566, 29059, 8079, 341, 1001, 3210, 13566, 2882, 6227, 11937, 29892, 13, 29937, 383, 1806, 8186, 1799, 15842, 319, 349, 8322, 2965, 13309, 1718, 349, 4574, 13152, 1660, 5300, 405, 1164, 1177, 15860, 1177, 1692, 13780, 29889, 2672, 11698, 382, 29963, 3919, 24972, 9818, 6093, 13, 29937, 26524, 29950, 24125, 6323, 315, 4590, 29979, 22789, 3912, 379, 5607, 8032, 29903, 20700, 17705, 6181, 15842, 13764, 29979, 315, 4375, 7833, 29892, 21330, 1529, 1692, 29903, 6323, 438, 29911, 4448, 13, 29937, 17705, 2882, 6227, 11937, 29892, 12317, 2544, 4448, 2672, 13764, 319, 9838, 8079, 8707, 29911, 4717, 1783, 29892, 323, 8476, 6323, 438, 29911, 4448, 22119, 1660, 29892, 9033, 3235, 4214, 3895, 29892, 13, 29937, 19474, 8079, 6323, 2672, 8707, 8186, 9838, 22659, 6093, 7791, 7818, 12982, 1525, 6323, 6093, 501, 1660, 6323, 438, 29911, 4448, 5012, 1964, 4214, 29903, 2672, 6093, 13, 29937, 7791, 7818, 12982, 1525, 29889, 13, 13, 5215, 24941, 13, 5215, 9254, 2585, 13, 5215, 1347, 13, 5215, 4036, 13, 5215, 2295, 16680, 13, 5215, 10876, 13, 5215, 337, 13, 13, 29886, 29893, 29918, 305, 1503, 353, 1347, 29889, 294, 18869, 29918, 1026, 2153, 718, 1347, 29889, 7501, 1169, 13, 13, 1753, 6088, 29918, 11027, 29898, 2084, 2433, 29889, 2917, 29374, 13, 1678, 2295, 353, 2295, 16680, 29889, 3991, 11726, 580, 13, 1678, 2295, 29889, 949, 29898, 2084, 29897, 13, 1678, 5749, 353, 2295, 1839, 7938, 2033, 13, 1678, 1404, 353, 5749, 29889, 657, 877, 1792, 1495, 13, 1678, 565, 1404, 338, 6213, 29901, 13, 4706, 1596, 877, 29908, 1792, 29908, 451, 731, 297, 2295, 934, 29889, 4829, 29889, 1495, 13, 4706, 10876, 29889, 13322, 29898, 29896, 29897, 13, 1678, 4800, 353, 5749, 29889, 657, 877, 5630, 1495, 13, 1678, 565, 4800, 338, 6213, 29901, 13, 4706, 1596, 877, 29908, 5630, 29908, 451, 731, 297, 2295, 934, 29889, 4829, 1495, 13, 4706, 10876, 29889, 13322, 29898, 29896, 29897, 13, 1678, 3495, 353, 5749, 29889, 657, 877, 3069, 742, 525, 29896, 29906, 29955, 29889, 29900, 29889, 29896, 29889, 29896, 1495, 13, 1678, 2011, 353, 5749, 29889, 657, 524, 877, 637, 742, 29871, 29941, 29941, 29900, 29953, 29897, 13, 1678, 4833, 353, 5749, 29889, 657, 877, 2585, 742, 525, 2549, 2974, 1495, 13, 1678, 736, 11117, 3069, 2396, 3495, 29892, 525, 637, 2396, 2011, 29892, 525, 2585, 2396, 4833, 29892, 525, 1792, 2396, 1404, 29892, 525, 5630, 2396, 4800, 29913, 13, 13, 1753, 2531, 29918, 29886, 29893, 29898, 29886, 29893, 29918, 2435, 29922, 29896, 29906, 1125, 13, 1678, 736, 376, 1642, 7122, 29898, 8172, 29889, 16957, 29898, 29886, 29893, 29918, 305, 1503, 29897, 363, 903, 297, 3464, 29898, 29886, 29893, 29918, 2435, 876, 13, 13, 1753, 1722, 29918, 2585, 29898, 3069, 29892, 1404, 29892, 1209, 9970, 29892, 2011, 29922, 29941, 29941, 29900, 29953, 29892, 4833, 2433, 2549, 2974, 29374, 13, 1678, 736, 9254, 2585, 29889, 6915, 29898, 3069, 29922, 3069, 29892, 1404, 29922, 1792, 29892, 1209, 9970, 29922, 3364, 9970, 29892, 4833, 29922, 2585, 29892, 2011, 29922, 637, 29897, 13, 13, 1753, 1722, 29918, 3166, 29918, 11027, 29898, 2084, 2433, 29889, 2917, 29374, 13, 1678, 6055, 353, 6088, 29918, 11027, 29898, 2084, 29897, 13, 1678, 736, 1722, 29918, 2585, 29898, 3069, 29922, 11027, 1839, 3069, 7464, 1404, 29922, 11027, 1839, 1792, 7464, 1209, 9970, 29922, 11027, 1839, 5630, 7464, 2011, 29922, 11027, 1839, 637, 7464, 4833, 29922, 11027, 1839, 2585, 11287, 13, 13, 1753, 2531, 29918, 8568, 29898, 29886, 29893, 1125, 13, 1678, 736, 22372, 23498, 29945, 29896, 29906, 29899, 11341, 29979, 7982, 10162, 718, 24941, 29889, 29883, 4641, 29898, 29886, 29893, 29892, 24941, 29889, 29885, 2039, 1997, 29898, 29883, 4641, 29889, 2303, 4690, 13668, 29918, 23498, 29945, 29896, 29906, 876, 13, 13, 1753, 2069, 29918, 2585, 29898, 2585, 1125, 13, 1678, 3151, 353, 4833, 29889, 18127, 580, 13, 1678, 3151, 29889, 7978, 29898, 13, 4706, 14550, 13, 4706, 14602, 10911, 10762, 6058, 28731, 6901, 29918, 3129, 2708, 313, 13, 308, 12, 333, 19578, 6058, 4265, 26524, 29949, 29918, 1177, 22245, 13780, 29892, 13, 308, 12, 978, 21748, 29898, 29945, 29900, 29897, 6058, 4265, 29892, 13, 308, 12, 10593, 24480, 14636, 29898, 333, 511, 13, 308, 12, 3904, 29902, 11144, 14636, 1024, 313, 978, 29897, 13, 4706, 1723, 13, 4706, 14550, 13, 1678, 1723, 13, 1678, 3151, 29889, 7978, 29898, 13, 1678, 14550, 13, 1678, 14602, 10911, 10762, 6058, 28731, 6901, 29918, 7193, 313, 13, 268, 12, 333, 19578, 6058, 4265, 26524, 29949, 29918, 1177, 22245, 13780, 29892, 13, 268, 12, 7247, 29918, 333, 19578, 6058, 4265, 29892, 13, 268, 12, 5269, 21748, 29898, 29896, 29900, 29900, 511, 13, 268, 12, 5630, 15236, 29898, 29896, 29945, 29900, 29897, 6058, 4265, 29892, 13, 268, 12, 10593, 24480, 14636, 29898, 333, 511, 13, 268, 12, 3904, 29902, 11144, 14636, 4876, 313, 5269, 511, 13, 268, 12, 5800, 1525, 17298, 14636, 313, 7247, 29918, 333, 29897, 5195, 29943, 1001, 1430, 27266, 6901, 29918, 3129, 2708, 29898, 333, 29897, 6732, 5012, 18476, 315, 3289, 5454, 2287, 13, 1678, 1723, 13, 1678, 14550, 13, 1678, 1723, 13, 1678, 3151, 29889, 7978, 29898, 13, 1678, 14550, 13, 1678, 14602, 10911, 10762, 6058, 28731, 6901, 29918, 2606, 2129, 313, 13, 268, 12, 333, 19578, 6058, 4265, 26524, 29949, 29918, 1177, 22245, 13780, 29892, 13, 268, 12, 7247, 29918, 333, 19578, 6058, 4265, 29892, 13, 268, 12, 4993, 21748, 29898, 29896, 29900, 29900, 29897, 6058, 4265, 29892, 13, 268, 12, 23848, 21748, 29898, 29896, 29900, 29900, 29897, 6058, 4265, 29892, 13, 268, 12, 10593, 24480, 14636, 313, 333, 511, 13, 268, 12, 5800, 1525, 17298, 14636, 313, 7247, 29918, 333, 29897, 5195, 29943, 1001, 1430, 27266, 6901, 29918, 3129, 2708, 29898, 333, 29897, 6732, 5012, 18476, 315, 3289, 5454, 2287, 13, 1678, 1723, 13, 1678, 14550, 13, 1678, 1723, 13, 1678, 3151, 29889, 5358, 580, 13, 1678, 4833, 29889, 15060, 580, 13, 13, 1753, 788, 29918, 7247, 29898, 2585, 29892, 1024, 1125, 13, 1678, 3151, 353, 4833, 29889, 18127, 580, 13, 1678, 9920, 353, 14550, 13, 1678, 14482, 11646, 6901, 29918, 3129, 2708, 13, 1678, 313, 978, 29897, 13, 1678, 15673, 313, 29995, 29879, 29897, 13, 1678, 14550, 13, 1678, 3151, 29889, 7978, 29898, 9006, 29892, 313, 978, 29892, 876, 13, 1678, 3151, 29889, 5358, 580, 13, 1678, 4833, 29889, 15060, 580, 13, 13, 1753, 788, 29918, 1792, 29898, 2585, 29892, 10524, 29892, 282, 29893, 29918, 8568, 1125, 13, 1678, 3151, 353, 4833, 29889, 18127, 580, 13, 1678, 6219, 353, 10524, 29889, 5451, 877, 29992, 1495, 13, 1678, 565, 7431, 29898, 5451, 29897, 2804, 29871, 29906, 29901, 13, 4706, 1596, 877, 9823, 947, 451, 1712, 3721, 697, 732, 29889, 4829, 29889, 1495, 13, 4706, 10876, 29889, 13322, 29898, 29896, 29897, 13, 1678, 5354, 353, 6219, 29961, 29896, 29962, 13, 1678, 679, 29918, 7247, 353, 14550, 13, 1678, 5097, 1178, 3895, 6901, 29918, 3129, 2708, 5754, 1024, 353, 1273, 29879, 13, 1678, 14550, 13, 1678, 3151, 29889, 7978, 29898, 657, 29918, 7247, 29892, 313, 7247, 29892, 876, 13, 1678, 9976, 353, 1051, 29898, 2764, 29897, 13, 1678, 565, 451, 9976, 29901, 13, 4706, 1596, 877, 15951, 11860, 29879, 29908, 471, 451, 1476, 29889, 4829, 6169, 1273, 5354, 29897, 13, 4706, 10876, 29889, 13322, 29898, 29896, 29897, 13, 1678, 396, 4129, 3431, 29892, 591, 2355, 278, 1178, 29892, 577, 1286, 788, 13, 1678, 5354, 29918, 333, 353, 9976, 29961, 29900, 3816, 29900, 29962, 13, 1678, 9920, 353, 14550, 13, 1678, 14482, 11646, 6901, 29918, 7193, 13, 1678, 313, 7247, 29918, 333, 29892, 4876, 29892, 4800, 29897, 13, 1678, 15673, 313, 29995, 29879, 29892, 1273, 29879, 29892, 1273, 29879, 29897, 13, 1678, 14550, 13, 1678, 3151, 29889, 7978, 29898, 9006, 29892, 313, 7247, 29918, 333, 29892, 10524, 29892, 282, 29893, 29918, 8568, 876, 13, 1678, 3151, 29889, 5358, 580, 13, 1678, 4833, 29889, 15060, 580, 13, 13, 1753, 788, 29918, 19973, 29898, 2585, 29892, 2752, 29892, 2731, 1125, 13, 1678, 3151, 353, 4833, 29889, 18127, 580, 13, 1678, 6219, 353, 2752, 29889, 5451, 877, 29992, 1495, 13, 1678, 565, 7431, 29898, 5451, 29897, 2804, 29871, 29906, 29901, 13, 4706, 1596, 877, 9823, 947, 451, 1712, 3721, 697, 732, 29889, 4829, 1495, 13, 4706, 10876, 29889, 13322, 29898, 29896, 29897, 13, 1678, 5354, 353, 6219, 29961, 29896, 29962, 13, 1678, 679, 29918, 7247, 353, 14550, 13, 1678, 5097, 1178, 3895, 6901, 29918, 3129, 2708, 5754, 1024, 353, 1273, 29879, 13, 1678, 14550, 13, 1678, 3151, 29889, 7978, 29898, 657, 29918, 7247, 29892, 313, 7247, 29892, 876, 13, 1678, 9976, 353, 1051, 29898, 2764, 29897, 13, 1678, 565, 451, 9976, 29901, 13, 4706, 1596, 877, 15951, 11860, 29879, 29908, 471, 451, 1476, 29889, 4829, 6169, 1273, 5354, 29897, 13, 4706, 10876, 29889, 13322, 29898, 29896, 29897, 13, 1678, 5354, 29918, 333, 353, 9976, 29961, 29900, 3816, 29900, 29962, 13, 1678, 9920, 353, 14550, 13, 1678, 14482, 11646, 6901, 29918, 2606, 2129, 13, 1678, 313, 7247, 29918, 333, 29892, 2752, 29892, 12551, 29897, 13, 1678, 15673, 313, 29995, 29879, 29892, 1273, 29879, 29892, 1273, 29879, 29897, 13, 1678, 14550, 13, 1678, 3151, 29889, 7978, 29898, 9006, 29892, 313, 7247, 29918, 333, 29892, 2752, 29892, 2731, 876, 13, 1678, 3151, 29889, 5358, 580, 13, 1678, 4833, 29889, 15060, 580, 13, 13, 13, 2549, 29918, 13087, 353, 337, 29889, 12198, 29898, 29878, 29908, 29898, 29985, 29961, 29874, 29899, 25265, 29899, 29999, 29900, 29899, 29929, 5396, 29974, 29899, 10062, 29992, 29961, 29874, 29899, 25265, 29899, 29999, 29900, 29899, 29929, 29899, 29962, 3124, 7226, 29874, 29899, 25265, 29899, 29999, 29900, 29899, 29929, 29899, 5586, 29974, 10931, 1159, 13, 13, 1753, 2854, 29918, 5269, 29898, 2549, 1125, 13, 1678, 736, 10524, 29918, 13087, 29889, 4352, 29898, 2549, 29897, 338, 451, 6213, 13, 2 ]
blisk/run_blisk_py.py
suleymanmuti/CalculiX-Examples
0
113574
#!/usr/bin/python import os os.system("cgx -bg blisk_pre.fbd") os.system("ccx blisk") os.system("cgx -bg blisk_post.fbd")
[ 1, 18787, 4855, 29914, 2109, 29914, 4691, 13, 5215, 2897, 13, 13, 359, 29889, 5205, 703, 29883, 29887, 29916, 448, 16264, 1999, 3873, 29918, 1457, 29889, 29888, 6448, 1159, 13, 359, 29889, 5205, 703, 617, 29916, 1999, 3873, 1159, 13, 359, 29889, 5205, 703, 29883, 29887, 29916, 448, 16264, 1999, 3873, 29918, 2490, 29889, 29888, 6448, 1159, 13, 13, 2 ]
parsl/tests/test_error_handling/test_resource_spec.py
MatthewBM/parsl
0
1417
<gh_stars>0 import parsl from parsl.app.app import python_app from parsl.tests.configs.local_threads import config from parsl.executors.errors import UnsupportedFeatureError from parsl.executors import WorkQueueExecutor @python_app def double(x, parsl_resource_specification={}): return x * 2 def test_resource(n=2): spec = {'cores': 2, 'memory': '1GiB'} fut = double(n, parsl_resource_specification=spec) try: fut.result() except Exception as e: assert isinstance(e, UnsupportedFeatureError) else: executors = parsl.dfk().executors executor = None for label in executors: if label != 'data_manager': executor = executors[label] break assert isinstance(executor, WorkQueueExecutor) if __name__ == '__main__': local_config = config parsl.load(local_config) x = test_resource(2)
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 5215, 610, 2536, 13, 3166, 610, 2536, 29889, 932, 29889, 932, 1053, 3017, 29918, 932, 13, 3166, 610, 2536, 29889, 21150, 29889, 2917, 29879, 29889, 2997, 29918, 28993, 1053, 2295, 13, 3166, 610, 2536, 29889, 4258, 29560, 29889, 12523, 1053, 853, 23765, 19132, 2392, 13, 3166, 610, 2536, 29889, 4258, 29560, 1053, 5244, 10620, 13366, 13, 13, 13, 29992, 4691, 29918, 932, 13, 1753, 3765, 29898, 29916, 29892, 610, 2536, 29918, 10314, 29918, 6550, 2450, 3790, 29913, 1125, 13, 1678, 736, 921, 334, 29871, 29906, 13, 13, 13, 1753, 1243, 29918, 10314, 29898, 29876, 29922, 29906, 1125, 13, 1678, 1580, 353, 11117, 29883, 2361, 2396, 29871, 29906, 29892, 525, 14834, 2396, 525, 29896, 26074, 29933, 10827, 13, 1678, 3105, 353, 3765, 29898, 29876, 29892, 610, 2536, 29918, 10314, 29918, 6550, 2450, 29922, 6550, 29897, 13, 1678, 1018, 29901, 13, 4706, 3105, 29889, 2914, 580, 13, 1678, 5174, 8960, 408, 321, 29901, 13, 4706, 4974, 338, 8758, 29898, 29872, 29892, 853, 23765, 19132, 2392, 29897, 13, 1678, 1683, 29901, 13, 4706, 6704, 943, 353, 610, 2536, 29889, 2176, 29895, 2141, 4258, 29560, 13, 4706, 2279, 3406, 353, 6213, 13, 4706, 363, 3858, 297, 6704, 943, 29901, 13, 9651, 565, 3858, 2804, 525, 1272, 29918, 12847, 2396, 13, 18884, 2279, 3406, 353, 6704, 943, 29961, 1643, 29962, 13, 18884, 2867, 13, 4706, 4974, 338, 8758, 29898, 4258, 3406, 29892, 5244, 10620, 13366, 29897, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 1887, 29918, 2917, 353, 2295, 13, 1678, 610, 2536, 29889, 1359, 29898, 2997, 29918, 2917, 29897, 13, 1678, 921, 353, 1243, 29918, 10314, 29898, 29906, 29897, 13, 2 ]
peripheral/supc_u2407/config/supc.py
Unitek-KL/csp
0
168043
# coding: utf-8 """***************************************************************************** * Copyright (C) 2018 Microchip Technology Inc. and its subsidiaries. * * Subject to your compliance with these terms, you may use Microchip software * and any derivatives exclusively with Microchip products. It is your * responsibility to comply with third party license terms applicable to your * use of third party software (including open source software) that may * accompany Microchip software. * * THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER * EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED * WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A * PARTICULAR PURPOSE. * * IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, * INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND * WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS * BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE * FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN * ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY, * THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE. *****************************************************************************""" ################################################################################################### ########################################## Callbacks ############################################# ################################################################################################### def updateSupcConfigVisibleProperty(symbol, event): symbol.setVisible(event["value"]) def updateBOD33PrescalerVisibleProperty(symbol, event): if supcSym_BOD33_STDBYCFG.getValue() == 1 or supcSym_BOD33_RUNHIB.getValue() == True or supcSym_BOD33_RUNBKUP.getValue() == True: symbol.setVisible(True) else: symbol.setVisible(False) def updateVrefVisibleProperty(symbol, event): if supcSym_VREF_VREFOE.getValue() == True and supcSym_VREF_ONDEMAND.getValue() == False: symbol.setVisible(False) else: symbol.setVisible(True) def interruptControl(symbol, event): Database.setSymbolValue("core", InterruptVector, event["value"], 2) Database.setSymbolValue("core", InterruptHandlerLock, event["value"], 2) if event["value"] == True: Database.setSymbolValue("core", InterruptHandler, supcInstanceName.getValue() + "_BODDET_InterruptHandler", 2) else: Database.setSymbolValue("core", InterruptHandler, supcInstanceName.getValue() + "_BODDET_Handler", 2) ################################################################################################### ########################################## Component ############################################# ################################################################################################### def instantiateComponent(supcComponent): global supcSym_BOD33_STDBYCFG global supcSym_BOD33_RUNHIB global supcSym_BOD33_RUNBKUP global supcSym_VREF_VREFOE global supcSym_VREF_ONDEMAND global supcInstanceName global InterruptVector global InterruptHandler global InterruptHandlerLock global supcSym_INTENSET supcInstanceName = supcComponent.createStringSymbol("SUPC_INSTANCE_NAME", None) supcInstanceName.setVisible(False) supcInstanceName.setDefaultValue(supcComponent.getID().upper()) #BOD33 Menu supcSym_BOD33_Menu= supcComponent.createMenuSymbol("BOD33_MENU", None) supcSym_BOD33_Menu.setLabel("VDD Brown-Out Detector (BOD33) Configuration") #BOD33 interrupt mode supcSym_INTENSET = supcComponent.createBooleanSymbol("SUPC_INTERRUPT_ENABLE", supcSym_BOD33_Menu) supcSym_INTENSET.setLabel("Enable BOD Interrupt") supcSym_INTENSET.setDefaultValue(False) # Interrupt Warning status supcSym_IntEnComment = supcComponent.createCommentSymbol("SUPC_INTERRUPT_ENABLE_COMMENT", supcSym_BOD33_Menu) supcSym_IntEnComment.setVisible(False) supcSym_IntEnComment.setLabel("Warning!!! SUPC Interrupt is Disabled in Interrupt Manager") supcSym_IntEnComment.setDependencies(interruptControl, ["SUPC_INTERRUPT_ENABLE"]) #BOD33 RUNHIB supcSym_BOD33_RUNHIB = supcComponent.createBooleanSymbol("SUPC_BOD33_RUNHIB", supcSym_BOD33_Menu) supcSym_BOD33_RUNHIB.setLabel("Run in Hibernate Mode") supcSym_BOD33_RUNHIB.setDescription("Configures BOD33 operation in Hibernate Sleep Mode") supcSym_BOD33_RUNHIB.setDefaultValue(False) #BOD33 RUNBKUP supcSym_BOD33_RUNBKUP = supcComponent.createBooleanSymbol("SUPC_BOD33_RUNBKUP", supcSym_BOD33_Menu) supcSym_BOD33_RUNBKUP.setLabel("Run in Backup Mode") supcSym_BOD33_RUNBKUP.setDescription("Configures BOD33 operation in Backup Sleep Mode") supcSym_BOD33_RUNBKUP.setDefaultValue(False) #BOD33 RUNSTDBY supcSym_BOD33_RUNSTDBY = supcComponent.createBooleanSymbol("SUPC_BOD33_RUNSTDBY", supcSym_BOD33_Menu) supcSym_BOD33_RUNSTDBY.setLabel("Run in Standby Mode") supcSym_BOD33_RUNSTDBY.setDescription("Configures BOD33 operation in Standby Sleep Mode") supcSym_BOD33_RUNSTDBY.setDefaultValue(False) #BOD33 STDBYCFG mode supcSym_BOD33_STDBYCFG = supcComponent.createKeyValueSetSymbol("SUPC_BOD33_STDBYCFG", supcSym_BOD33_Menu) supcSym_BOD33_STDBYCFG.setLabel("Select Standby Mode Operation") supcSym_BOD33_STDBYCFG.setDescription("Configures whether BOD33 should operate in continuous or sampling mode in Standby Sleep Mode") supcSym_BOD33_STDBYCFG.addKey("CONT_MODE", "0", "Continuous Mode") supcSym_BOD33_STDBYCFG.addKey("SAMP_MODE", "1", "Sampling Mode") supcSym_BOD33_STDBYCFG.setDefaultValue(0) supcSym_BOD33_STDBYCFG.setOutputMode("Value") supcSym_BOD33_STDBYCFG.setDisplayMode("Description") supcSym_BOD33_STDBYCFG.setVisible(False) supcSym_BOD33_STDBYCFG.setDependencies(updateSupcConfigVisibleProperty, ["SUPC_BOD33_RUNSTDBY"]) #BOD33 PSEL supcSym_BOD33_PSEL = supcComponent.createKeyValueSetSymbol("SUPC_BOD33_PSEL", supcSym_BOD33_Menu) supcSym_BOD33_PSEL.setLabel("Select Prescaler for Sampling Clock") supcSym_BOD33_PSEL.setDescription("Configures the sampling clock prescaler when BOD33 is operating in sampling Mode") supcSym_BOD33_PSEL.setVisible(False) supcSym_BOD33_PSEL.setDependencies(updateBOD33PrescalerVisibleProperty, ["SUPC_BOD33_STDBYCFG", "SUPC_BOD33_RUNHIB", "SUPC_BOD33_RUNBKUP"]) supcBOD33PselNode = ATDF.getNode("/avr-tools-device-file/modules/module@[name=\"SUPC\"]/value-group@[name=\"SUPC_BOD33__PSEL\"]") supcBOD33PselValues = [] supcBOD33PselValues = supcBOD33PselNode.getChildren() #PSEL value 0 is not usable in sampling mode. Thus the loop starts from 1. for index in range (1, len(supcBOD33PselValues)): supcBOD33PselKeyName = supcBOD33PselValues[index].getAttribute("name") supcBOD33PselKeyDescription = supcBOD33PselValues[index].getAttribute("caption") supcBOD33PselKeyValue = supcBOD33PselValues[index].getAttribute("value") supcSym_BOD33_PSEL.addKey(supcBOD33PselKeyName, supcBOD33PselKeyValue, supcBOD33PselKeyDescription) supcSym_BOD33_PSEL.setDefaultValue(0) supcSym_BOD33_PSEL.setOutputMode("Value") supcSym_BOD33_PSEL.setDisplayMode("Description") #BOD Configuration comment supcSym_BOD33_FuseComment = supcComponent.createCommentSymbol("SUPC_CONFIG_COMMENT", supcSym_BOD33_Menu) supcSym_BOD33_FuseComment.setLabel("Note: Configure BOD33 Fuses using 'System' component") #VREG Menu supcSym_VREG_Menu= supcComponent.createMenuSymbol("VREG_MENU", None) supcSym_VREG_Menu.setLabel("Voltage Regulator (VREG) Configuration") #VREG RUNBKUP mode supcSym_VREG_RUNBKUP = supcComponent.createKeyValueSetSymbol("SUPC_VREG_RUNBKUP", supcSym_VREG_Menu) supcSym_VREG_RUNBKUP.setLabel("Main Voltage Regulator operation in backup sleep") supcSym_VREG_RUNBKUP.setDescription("Selects Main Voltage Regulator operation in backup sleep") supcSym_VREG_RUNBKUP.addKey("REG_OFF", "0", "Regulator stopped") supcSym_VREG_RUNBKUP.addKey("REG_ON", "1", "Regulator not stopped") supcSym_VREG_RUNBKUP.setDefaultValue(0) supcSym_VREG_RUNBKUP.setOutputMode("Value") supcSym_VREG_RUNBKUP.setDisplayMode("Description") #VREG VESN supcSym_VREG_VSEN = supcComponent.createBooleanSymbol("SUPC_VREG_VSEN", supcSym_VREG_Menu) supcSym_VREG_VSEN.setLabel("Enable Voltage Scaling") supcSym_VREG_VSEN.setDescription("Enable smooth transition of VDDCORE") supcSym_VREG_VSEN.setDefaultValue(False) #VREG VSPER supcSym_VREG_VSPER = supcComponent.createIntegerSymbol("SUPC_VREG_VSPER", supcSym_VREG_Menu) supcSym_VREG_VSPER.setLabel("Voltage Scaling Period") supcSym_VREG_VSEN.setDescription("The time is ((2^VSPER) * T), where T is an internal period (typ 250 ns).") supcSym_VREG_VSPER.setDefaultValue(0) supcSym_VREG_VSPER.setMin(0) supcSym_VREG_VSPER.setMax(7) supcSym_VREG_VSPER.setVisible(False) supcSym_VREG_VSPER.setDependencies(updateSupcConfigVisibleProperty, ["SUPC_VREG_VSEN"]) #VREF Menu supcSym_VREF_Menu= supcComponent.createMenuSymbol("VREF_MENU", None) supcSym_VREF_Menu.setLabel("Voltage Reference (VREF) Configuration") supcSym_VREF_SEL = supcComponent.createKeyValueSetSymbol("SUPC_VREF_SEL", supcSym_VREF_Menu) supcSym_VREF_SEL.setLabel("Voltage Reference value") supcSym_VREF_SEL.setDescription("Select the Voltage Reference typical value") supcVREFSelNode = ATDF.getNode("/avr-tools-device-file/modules/module@[name=\"SUPC\"]/value-group@[name=\"SUPC_VREF__SEL\"]") supcVREFSelValues = [] supcVREFSelValues = supcVREFSelNode.getChildren() for index in range (0, len(supcVREFSelValues)): supcVREFSelKeyName = supcVREFSelValues[index].getAttribute("name") supcVREFSelKeyDescription = supcVREFSelValues[index].getAttribute("caption") supcVREFSelKeyValue = supcVREFSelValues[index].getAttribute("value") supcSym_VREF_SEL.addKey(supcVREFSelKeyName, supcVREFSelKeyValue, supcVREFSelKeyDescription) supcSym_VREF_SEL.setDefaultValue(0) supcSym_VREF_SEL.setOutputMode("Value") supcSym_VREF_SEL.setDisplayMode("Description") #VREF ONDEMAND mode supcSym_VREF_ONDEMAND = supcComponent.createBooleanSymbol("SUPC_VREF_ONDEMAND", supcSym_VREF_Menu) supcSym_VREF_ONDEMAND.setLabel("Enable On demand") supcSym_VREF_ONDEMAND.setDescription("If this option is enabled, the voltage reference is disabled when no peripheral is requesting it.") supcSym_VREF_ONDEMAND.setDefaultValue(False) #VREF RUNSTDBY mode supcSym_VREF_RUNSTDBY = supcComponent.createBooleanSymbol("SUPC_VREF_RUNSTDBY", supcSym_VREF_Menu) supcSym_VREF_RUNSTDBY.setLabel("Enable Run in Standby") supcSym_VREF_RUNSTDBY.setDescription("Enable VREF operation in Standby Sleep Mode") #VREF VREFOE supcSym_VREF_VREFOE = supcComponent.createBooleanSymbol("SUPC_VREF_VREFOE", supcSym_VREF_Menu) supcSym_VREF_VREFOE.setLabel("Enable VREF output") supcSym_VREF_VREFOE.setDescription("Enable VREF connection to ADC. If ONDEMAND is 0 and VREF is enabled, Temperature Sensor cannot be used") supcSym_VREF_VREFOE.setDefaultValue(False) #VREF TSEN supcSym_VREF_TSEN = supcComponent.createBooleanSymbol("SUPC_VREF_TSEN", supcSym_VREF_Menu) supcSym_VREF_TSEN.setLabel("Enable Temperature Sensor") supcSym_VREF_TSEN.setDescription("Enable Temperature Sensor connection to ADC") supcSym_VREF_TSEN.setDefaultValue(False) supcSym_VREF_TSEN.setDependencies(updateVrefVisibleProperty, ["SUPC_VREF_ONDEMAND", "SUPC_VREF_VREFOE"]) #BBPS Menu supcSym_BBPS_Menu= supcComponent.createMenuSymbol("SUPC_BBPS", None) supcSym_BBPS_Menu.setLabel("Battery Backup Power Switch Configuraiton") #BBPS supply switching supcSym_BBPS = supcComponent.createBooleanSymbol("SUPC_BBPS_WAKEEN", supcSym_BBPS_Menu) supcSym_BBPS.setLabel("Wake Device on BBPS Switching") supcSym_BBPS.setDescription("The device can be woken up when switched from battery backup power to Main Power.") #SUPC Output pin configuration #For pin names, refer 'Supply Controller Pinout' in Datasheet supcSym_BKOUT_Menu= supcComponent.createMenuSymbol("SUPC_BKOUT", None) supcSym_BKOUT_Menu.setLabel("SUPC Output pin configuraiton") #SUPC Output pin 0 supcSym_BKOUT0 = supcComponent.createBooleanSymbol("SUPC_BKOUT_0", supcSym_BKOUT_Menu) supcSym_BKOUT0.setLabel("Enable OUT0") supcSym_BKOUT0.setDescription("OUT0 pin can be driven by SUPC. It can be toggled by SUPC, based on RTC Events") supcSym_BKOUT0.setDefaultValue(False) #RTCTGCL 0 supcSym_BKOUT_RTCTGL0 = supcComponent.createBooleanSymbol("SUPC_BKOUT_RTCTGCL0", supcSym_BKOUT0) supcSym_BKOUT_RTCTGL0.setLabel("Toggle OUT0 on RTC Event") supcSym_BKOUT_RTCTGL0.setDescription("OUT0 pin can be toggled by SUPC, based on RTC Events") supcSym_BKOUT_RTCTGL0.setDependencies(updateSupcConfigVisibleProperty, ["SUPC_BKOUT_0"]) supcSym_BKOUT_RTCTGL0.setVisible(False) #SUPC Output pin 1 supcSym_BKOUT1 = supcComponent.createBooleanSymbol("SUPC_BKOUT_1", supcSym_BKOUT_Menu) supcSym_BKOUT1.setLabel("Enable OUT1") supcSym_BKOUT1.setDescription("OUT1 pin can be driven by SUPC. It can be toggled by SUPC, based on RTC Events") supcSym_BKOUT1.setDefaultValue(False) #RTCTGCL 1 supcSym_BKOUT_RTCTGL1 = supcComponent.createBooleanSymbol("SUPC_BKOUT_RTCTGCL1", supcSym_BKOUT1) supcSym_BKOUT_RTCTGL1.setLabel("Toggle OUT1 on RTC Event") supcSym_BKOUT_RTCTGL1.setDescription("OUT1 pin can be toggled by SUPC, based on RTC Events") supcSym_BKOUT_RTCTGL1.setDependencies(updateSupcConfigVisibleProperty, ["SUPC_BKOUT_1"]) supcSym_BKOUT_RTCTGL1.setVisible(False) ############################################################################ #### Dependency #### ############################################################################ InterruptVector = supcInstanceName.getValue() + "_BODDET_INTERRUPT_ENABLE" InterruptHandler = supcInstanceName.getValue() + "_BODDET_INTERRUPT_HANDLER" InterruptHandlerLock = supcInstanceName.getValue()+ "_BODDET_INTERRUPT_HANDLER_LOCK" ################################################################################################### ####################################### Code Generation ########################################## ################################################################################################### configName = Variables.get("__CONFIGURATION_NAME") supcSym_HeaderFile = supcComponent.createFileSymbol("SUPC_HEADER", None) supcSym_HeaderFile.setSourcePath("../peripheral/supc_u2407/templates/plib_supc.h.ftl") supcSym_HeaderFile.setOutputName("plib_"+supcInstanceName.getValue().lower()+".h") supcSym_HeaderFile.setDestPath("/peripheral/supc/") supcSym_HeaderFile.setProjectPath("config/" + configName + "/peripheral/supc/") supcSym_HeaderFile.setType("HEADER") supcSym_HeaderFile.setMarkup(True) supcSym_SourceFile = supcComponent.createFileSymbol("SUPC_SOURCE", None) supcSym_SourceFile.setSourcePath("../peripheral/supc_u2407/templates/plib_supc.c.ftl") supcSym_SourceFile.setOutputName("plib_"+supcInstanceName.getValue().lower()+".c") supcSym_SourceFile.setDestPath("/peripheral/supc/") supcSym_SourceFile.setProjectPath("config/" + configName + "/peripheral/supc/") supcSym_SourceFile.setType("SOURCE") supcSym_SourceFile.setMarkup(True) supcSym_SystemInitFile = supcComponent.createFileSymbol("SUPC_SYS_INT", None) supcSym_SystemInitFile.setType("STRING") supcSym_SystemInitFile.setOutputName("core.LIST_SYSTEM_INIT_C_SYS_INITIALIZE_PERIPHERALS") supcSym_SystemInitFile.setSourcePath("../peripheral/supc_u2407/templates/system/initialization.c.ftl") supcSym_SystemInitFile.setMarkup(True) supcSym_SystemDefFile = supcComponent.createFileSymbol("SUPC_SYS_DEF", None) supcSym_SystemDefFile.setType("STRING") supcSym_SystemDefFile.setOutputName("core.LIST_SYSTEM_DEFINITIONS_H_INCLUDES") supcSym_SystemDefFile.setSourcePath("../peripheral/supc_u2407/templates/system/definitions.h.ftl") supcSym_SystemDefFile.setMarkup(True)
[ 1, 396, 14137, 29901, 23616, 29899, 29947, 13, 15945, 29908, 7775, 7775, 7775, 7775, 4189, 2328, 29930, 13, 29930, 14187, 1266, 313, 29907, 29897, 29871, 29906, 29900, 29896, 29947, 20140, 305, 666, 17968, 9266, 29889, 322, 967, 11684, 8819, 4314, 29889, 13, 29930, 13, 29930, 3323, 622, 304, 596, 752, 13036, 411, 1438, 4958, 29892, 366, 1122, 671, 20140, 305, 666, 7047, 13, 29930, 322, 738, 25748, 13489, 3598, 411, 20140, 305, 666, 9316, 29889, 739, 338, 596, 13, 29930, 23134, 304, 752, 368, 411, 4654, 6263, 19405, 4958, 22903, 304, 596, 13, 29930, 671, 310, 4654, 6263, 7047, 313, 18271, 1722, 2752, 7047, 29897, 393, 1122, 13, 29930, 10259, 1384, 20140, 305, 666, 7047, 29889, 13, 29930, 13, 29930, 3446, 3235, 7791, 7818, 12982, 1525, 8519, 317, 4897, 29925, 5265, 3352, 6770, 341, 2965, 1672, 3210, 5690, 376, 3289, 8519, 1642, 11698, 399, 1718, 29934, 13566, 29059, 29892, 12317, 2544, 4448, 13, 29930, 8528, 15094, 1799, 29892, 306, 3580, 5265, 3352, 6323, 6850, 1299, 2692, 18929, 29892, 12279, 7390, 29979, 7495, 3446, 3235, 7791, 7818, 12982, 1525, 29892, 2672, 6154, 15789, 4214, 13764, 29979, 306, 3580, 5265, 3352, 13, 29930, 399, 1718, 29934, 13566, 29059, 8079, 405, 1164, 29899, 1177, 15860, 1177, 1692, 13780, 29892, 341, 1001, 3210, 13566, 2882, 6227, 11937, 29892, 5300, 383, 1806, 8186, 1799, 15842, 319, 13, 29930, 349, 8322, 2965, 13309, 1718, 349, 4574, 13152, 1660, 29889, 13, 29930, 13, 29930, 2672, 11698, 382, 29963, 3919, 399, 24071, 341, 2965, 1672, 3210, 5690, 20700, 17705, 6181, 15842, 13764, 29979, 2672, 4571, 26282, 29892, 317, 4162, 8426, 1964, 29892, 349, 3904, 1806, 18474, 29892, 13, 29930, 2672, 29907, 1367, 3919, 1964, 6323, 8707, 1660, 13356, 3919, 25758, 11247, 1799, 29892, 21330, 1529, 1692, 29892, 315, 3718, 6323, 8528, 29925, 1430, 1660, 8079, 13764, 29979, 476, 22255, 13, 29930, 12317, 1299, 6156, 29923, 5348, 5195, 29931, 3040, 29928, 7495, 6093, 7791, 7818, 12982, 1525, 29892, 29832, 8851, 5348, 12766, 17171, 29928, 29892, 382, 29963, 1430, 10762, 341, 2965, 1672, 3210, 5690, 379, 3289, 13, 29930, 20700, 1430, 11033, 18118, 1660, 29928, 8079, 6093, 21521, 1799, 8979, 6227, 11937, 6323, 6093, 21330, 1529, 1692, 29903, 319, 1525, 18322, 1525, 22048, 6181, 29889, 7495, 6093, 13, 29930, 383, 13309, 1307, 1254, 8528, 29911, 3919, 15149, 9806, 3352, 6770, 17900, 29956, 29892, 341, 2965, 1672, 3210, 5690, 29915, 29903, 323, 2891, 1964, 17705, 2882, 6227, 11937, 6732, 15149, 315, 4375, 29902, 4345, 2672, 13, 29930, 13764, 29979, 399, 29909, 29979, 5195, 29931, 3040, 29928, 7495, 3446, 3235, 7791, 7818, 12982, 1525, 399, 24071, 6058, 8528, 4741, 3352, 6093, 319, 6720, 10356, 8079, 383, 29923, 2890, 29892, 10762, 13764, 29979, 29892, 13, 29930, 3446, 1299, 612, 27269, 379, 7520, 29923, 17687, 1367, 22471, 26282, 16786, 7495, 341, 2965, 1672, 3210, 5690, 15842, 3446, 3235, 7791, 7818, 12982, 1525, 29889, 13, 7775, 7775, 7775, 7775, 4189, 2328, 29930, 15945, 29908, 13, 13, 13383, 13383, 13383, 13383, 13383, 13383, 2277, 29937, 13, 13383, 13383, 7346, 2277, 8251, 1627, 29879, 29871, 835, 13383, 13383, 7346, 2277, 13, 13383, 13383, 13383, 13383, 13383, 13383, 2277, 29937, 13, 13, 1753, 2767, 29903, 786, 29883, 3991, 12911, 4854, 29898, 18098, 29892, 1741, 1125, 13, 1678, 5829, 29889, 842, 12911, 29898, 3696, 3366, 1767, 20068, 13, 13, 1753, 2767, 8456, 29928, 29941, 29941, 13504, 1052, 261, 12911, 4854, 29898, 18098, 29892, 1741, 1125, 13, 1678, 565, 480, 6739, 25548, 29918, 8456, 29928, 29941, 29941, 29918, 1254, 4051, 29979, 9207, 29954, 29889, 23433, 580, 1275, 29871, 29896, 470, 480, 6739, 25548, 29918, 8456, 29928, 29941, 29941, 29918, 29934, 3904, 29950, 8979, 29889, 23433, 580, 1275, 5852, 470, 480, 6739, 25548, 29918, 8456, 29928, 29941, 29941, 29918, 29934, 3904, 29933, 29968, 4897, 29889, 23433, 580, 1275, 5852, 29901, 13, 4706, 5829, 29889, 842, 12911, 29898, 5574, 29897, 13, 1678, 1683, 29901, 13, 4706, 5829, 29889, 842, 12911, 29898, 8824, 29897, 13, 13, 1753, 2767, 29963, 999, 12911, 4854, 29898, 18098, 29892, 1741, 1125, 13, 1678, 565, 480, 6739, 25548, 29918, 29963, 25866, 29918, 29963, 1525, 5800, 29923, 29889, 23433, 580, 1275, 5852, 322, 480, 6739, 25548, 29918, 29963, 25866, 29918, 1164, 2287, 1529, 2797, 29889, 23433, 580, 1275, 7700, 29901, 13, 4706, 5829, 29889, 842, 12911, 29898, 8824, 29897, 13, 1678, 1683, 29901, 13, 4706, 5829, 29889, 842, 12911, 29898, 5574, 29897, 13, 13, 1753, 23754, 4809, 29898, 18098, 29892, 1741, 1125, 13, 13, 1678, 5470, 29889, 842, 14730, 1917, 703, 3221, 613, 4124, 6685, 12877, 29892, 1741, 3366, 1767, 12436, 29871, 29906, 29897, 13, 1678, 5470, 29889, 842, 14730, 1917, 703, 3221, 613, 4124, 6685, 4598, 16542, 29892, 1741, 3366, 1767, 12436, 29871, 29906, 29897, 13, 13, 1678, 565, 1741, 3366, 1767, 3108, 1275, 5852, 29901, 13, 4706, 5470, 29889, 842, 14730, 1917, 703, 3221, 613, 4124, 6685, 4598, 29892, 480, 6739, 4998, 1170, 29889, 23433, 580, 718, 11119, 8456, 29928, 2287, 29911, 29918, 4074, 6685, 4598, 613, 29871, 29906, 29897, 13, 1678, 1683, 29901, 13, 4706, 5470, 29889, 842, 14730, 1917, 703, 3221, 613, 4124, 6685, 4598, 29892, 480, 6739, 4998, 1170, 29889, 23433, 580, 718, 11119, 8456, 29928, 2287, 29911, 29918, 4598, 613, 29871, 29906, 29897, 13, 13, 13383, 13383, 13383, 13383, 13383, 13383, 2277, 29937, 13, 13383, 13383, 7346, 2277, 15924, 29871, 835, 13383, 13383, 7346, 2277, 13, 13383, 13383, 13383, 13383, 13383, 13383, 2277, 29937, 13, 13, 1753, 25112, 5308, 29898, 12587, 29883, 5308, 1125, 13, 1678, 5534, 480, 6739, 25548, 29918, 8456, 29928, 29941, 29941, 29918, 1254, 4051, 29979, 9207, 29954, 13, 1678, 5534, 480, 6739, 25548, 29918, 8456, 29928, 29941, 29941, 29918, 29934, 3904, 29950, 8979, 13, 1678, 5534, 480, 6739, 25548, 29918, 8456, 29928, 29941, 29941, 29918, 29934, 3904, 29933, 29968, 4897, 13, 1678, 5534, 480, 6739, 25548, 29918, 29963, 25866, 29918, 29963, 1525, 5800, 29923, 13, 1678, 5534, 480, 6739, 25548, 29918, 29963, 25866, 29918, 1164, 2287, 1529, 2797, 13, 1678, 5534, 480, 6739, 4998, 1170, 13, 1678, 5534, 4124, 6685, 12877, 13, 1678, 5534, 4124, 6685, 4598, 13, 1678, 5534, 4124, 6685, 4598, 16542, 13, 1678, 5534, 480, 6739, 25548, 29918, 10192, 1430, 10490, 13, 13, 1678, 480, 6739, 4998, 1170, 353, 480, 6739, 5308, 29889, 3258, 1231, 14730, 703, 29903, 4897, 29907, 29918, 25580, 23219, 29918, 5813, 613, 6213, 29897, 13, 1678, 480, 6739, 4998, 1170, 29889, 842, 12911, 29898, 8824, 29897, 13, 1678, 480, 6739, 4998, 1170, 29889, 842, 4592, 1917, 29898, 12587, 29883, 5308, 29889, 657, 1367, 2141, 21064, 3101, 13, 13, 1678, 396, 8456, 29928, 29941, 29941, 20019, 13, 1678, 480, 6739, 25548, 29918, 8456, 29928, 29941, 29941, 29918, 6823, 29922, 480, 6739, 5308, 29889, 3258, 6823, 14730, 703, 8456, 29928, 29941, 29941, 29918, 29924, 1430, 29965, 613, 6213, 29897, 13, 1678, 480, 6739, 25548, 29918, 8456, 29928, 29941, 29941, 29918, 6823, 29889, 842, 4775, 703, 29963, 7858, 9817, 29899, 3744, 5953, 3019, 313, 8456, 29928, 29941, 29941, 29897, 20999, 1159, 13, 13, 1678, 396, 8456, 29928, 29941, 29941, 23754, 4464, 13, 1678, 480, 6739, 25548, 29918, 10192, 1430, 10490, 353, 480, 6739, 5308, 29889, 3258, 18146, 14730, 703, 29903, 4897, 29907, 29918, 23845, 29934, 4897, 29911, 29918, 1430, 6181, 613, 480, 6739, 25548, 29918, 8456, 29928, 29941, 29941, 29918, 6823, 29897, 13, 1678, 480, 6739, 25548, 29918, 10192, 1430, 10490, 29889, 842, 4775, 703, 20701, 350, 13668, 4124, 6685, 1159, 13, 1678, 480, 6739, 25548, 29918, 10192, 1430, 10490, 29889, 842, 4592, 1917, 29898, 8824, 29897, 13, 13, 1678, 396, 4124, 6685, 24412, 4660, 13, 1678, 480, 6739, 25548, 29918, 2928, 2369, 20001, 353, 480, 6739, 5308, 29889, 3258, 20001, 14730, 703, 29903, 4897, 29907, 29918, 23845, 29934, 4897, 29911, 29918, 1430, 6181, 29918, 3217, 7428, 3919, 613, 480, 6739, 25548, 29918, 8456, 29928, 29941, 29941, 29918, 6823, 29897, 13, 1678, 480, 6739, 25548, 29918, 2928, 2369, 20001, 29889, 842, 12911, 29898, 8824, 29897, 13, 1678, 480, 6739, 25548, 29918, 2928, 2369, 20001, 29889, 842, 4775, 703, 22709, 21004, 317, 4897, 29907, 4124, 6685, 338, 3295, 3606, 297, 4124, 6685, 15629, 1159, 13, 1678, 480, 6739, 25548, 29918, 2928, 2369, 20001, 29889, 842, 8498, 7158, 29898, 1639, 6685, 4809, 29892, 6796, 29903, 4897, 29907, 29918, 23845, 29934, 4897, 29911, 29918, 1430, 6181, 20068, 13, 13, 1678, 396, 8456, 29928, 29941, 29941, 27694, 29950, 8979, 13, 1678, 480, 6739, 25548, 29918, 8456, 29928, 29941, 29941, 29918, 29934, 3904, 29950, 8979, 353, 480, 6739, 5308, 29889, 3258, 18146, 14730, 703, 29903, 4897, 29907, 29918, 8456, 29928, 29941, 29941, 29918, 29934, 3904, 29950, 8979, 613, 480, 6739, 25548, 29918, 8456, 29928, 29941, 29941, 29918, 6823, 29897, 13, 1678, 480, 6739, 25548, 29918, 8456, 29928, 29941, 29941, 29918, 29934, 3904, 29950, 8979, 29889, 842, 4775, 703, 6558, 297, 27772, 21864, 1159, 13, 1678, 480, 6739, 25548, 29918, 8456, 29928, 29941, 29941, 29918, 29934, 3904, 29950, 8979, 29889, 842, 9868, 703, 3991, 1973, 350, 13668, 29941, 29941, 5858, 297, 27772, 317, 5436, 21864, 1159, 13, 1678, 480, 6739, 25548, 29918, 8456, 29928, 29941, 29941, 29918, 29934, 3904, 29950, 8979, 29889, 842, 4592, 1917, 29898, 8824, 29897, 13, 268, 13, 1678, 396, 8456, 29928, 29941, 29941, 27694, 29933, 29968, 4897, 13, 1678, 480, 6739, 25548, 29918, 8456, 29928, 29941, 29941, 29918, 29934, 3904, 29933, 29968, 4897, 353, 480, 6739, 5308, 29889, 3258, 18146, 14730, 703, 29903, 4897, 29907, 29918, 8456, 29928, 29941, 29941, 29918, 29934, 3904, 29933, 29968, 4897, 613, 480, 6739, 25548, 29918, 8456, 29928, 29941, 29941, 29918, 6823, 29897, 13, 1678, 480, 6739, 25548, 29918, 8456, 29928, 29941, 29941, 29918, 29934, 3904, 29933, 29968, 4897, 29889, 842, 4775, 703, 6558, 297, 7437, 786, 21864, 1159, 13, 1678, 480, 6739, 25548, 29918, 8456, 29928, 29941, 29941, 29918, 29934, 3904, 29933, 29968, 4897, 29889, 842, 9868, 703, 3991, 1973, 350, 13668, 29941, 29941, 5858, 297, 7437, 786, 317, 5436, 21864, 1159, 13, 1678, 480, 6739, 25548, 29918, 8456, 29928, 29941, 29941, 29918, 29934, 3904, 29933, 29968, 4897, 29889, 842, 4592, 1917, 29898, 8824, 29897, 13, 13, 1678, 396, 8456, 29928, 29941, 29941, 27694, 1254, 4051, 29979, 13, 1678, 480, 6739, 25548, 29918, 8456, 29928, 29941, 29941, 29918, 29934, 3904, 1254, 4051, 29979, 353, 480, 6739, 5308, 29889, 3258, 18146, 14730, 703, 29903, 4897, 29907, 29918, 8456, 29928, 29941, 29941, 29918, 29934, 3904, 1254, 4051, 29979, 613, 480, 6739, 25548, 29918, 8456, 29928, 29941, 29941, 29918, 6823, 29897, 13, 1678, 480, 6739, 25548, 29918, 8456, 29928, 29941, 29941, 29918, 29934, 3904, 1254, 4051, 29979, 29889, 842, 4775, 703, 6558, 297, 6679, 1609, 21864, 1159, 13, 1678, 480, 6739, 25548, 29918, 8456, 29928, 29941, 29941, 29918, 29934, 3904, 1254, 4051, 29979, 29889, 842, 9868, 703, 3991, 1973, 350, 13668, 29941, 29941, 5858, 297, 6679, 1609, 317, 5436, 21864, 1159, 13, 1678, 480, 6739, 25548, 29918, 8456, 29928, 29941, 29941, 29918, 29934, 3904, 1254, 4051, 29979, 29889, 842, 4592, 1917, 29898, 8824, 29897, 13, 13, 1678, 396, 8456, 29928, 29941, 29941, 6850, 4051, 29979, 9207, 29954, 4464, 13, 1678, 480, 6739, 25548, 29918, 8456, 29928, 29941, 29941, 29918, 1254, 4051, 29979, 9207, 29954, 353, 480, 6739, 5308, 29889, 3258, 2558, 1917, 2697, 14730, 703, 29903, 4897, 29907, 29918, 8456, 29928, 29941, 29941, 29918, 1254, 4051, 29979, 9207, 29954, 613, 480, 6739, 25548, 29918, 8456, 29928, 29941, 29941, 29918, 6823, 29897, 13, 1678, 480, 6739, 25548, 29918, 8456, 29928, 29941, 29941, 29918, 1254, 4051, 29979, 9207, 29954, 29889, 842, 4775, 703, 3549, 6679, 1609, 21864, 20462, 1159, 13, 1678, 480, 6739, 25548, 29918, 8456, 29928, 29941, 29941, 29918, 1254, 4051, 29979, 9207, 29954, 29889, 842, 9868, 703, 3991, 1973, 3692, 350, 13668, 29941, 29941, 881, 21994, 297, 9126, 470, 23460, 4464, 297, 6679, 1609, 317, 5436, 21864, 1159, 13, 1678, 480, 6739, 25548, 29918, 8456, 29928, 29941, 29941, 29918, 1254, 4051, 29979, 9207, 29954, 29889, 1202, 2558, 703, 22412, 29918, 20387, 613, 376, 29900, 613, 376, 1323, 8675, 681, 21864, 1159, 13, 1678, 480, 6739, 25548, 29918, 8456, 29928, 29941, 29941, 29918, 1254, 4051, 29979, 9207, 29954, 29889, 1202, 2558, 703, 8132, 3580, 29918, 20387, 613, 376, 29896, 613, 376, 22966, 10335, 21864, 1159, 13, 1678, 480, 6739, 25548, 29918, 8456, 29928, 29941, 29941, 29918, 1254, 4051, 29979, 9207, 29954, 29889, 842, 4592, 1917, 29898, 29900, 29897, 13, 1678, 480, 6739, 25548, 29918, 8456, 29928, 29941, 29941, 29918, 1254, 4051, 29979, 9207, 29954, 29889, 842, 6466, 6818, 703, 1917, 1159, 13, 1678, 480, 6739, 25548, 29918, 8456, 29928, 29941, 29941, 29918, 1254, 4051, 29979, 9207, 29954, 29889, 842, 9323, 6818, 703, 9868, 1159, 13, 1678, 480, 6739, 25548, 29918, 8456, 29928, 29941, 29941, 29918, 1254, 4051, 29979, 9207, 29954, 29889, 842, 12911, 29898, 8824, 29897, 13, 1678, 480, 6739, 25548, 29918, 8456, 29928, 29941, 29941, 29918, 1254, 4051, 29979, 9207, 29954, 29889, 842, 8498, 7158, 29898, 5504, 29903, 786, 29883, 3991, 12911, 4854, 29892, 6796, 29903, 4897, 29907, 29918, 8456, 29928, 29941, 29941, 29918, 29934, 3904, 1254, 4051, 29979, 20068, 13, 13, 1678, 396, 8456, 29928, 29941, 29941, 349, 1660, 29931, 13, 1678, 480, 6739, 25548, 29918, 8456, 29928, 29941, 29941, 29918, 29925, 1660, 29931, 353, 480, 6739, 5308, 29889, 3258, 2558, 1917, 2697, 14730, 703, 29903, 4897, 29907, 29918, 8456, 29928, 29941, 29941, 29918, 29925, 1660, 29931, 613, 480, 6739, 25548, 29918, 8456, 29928, 29941, 29941, 29918, 6823, 29897, 13, 1678, 480, 6739, 25548, 29918, 8456, 29928, 29941, 29941, 29918, 29925, 1660, 29931, 29889, 842, 4775, 703, 3549, 4360, 1052, 261, 363, 3685, 10335, 315, 908, 1159, 13, 1678, 480, 6739, 25548, 29918, 8456, 29928, 29941, 29941, 29918, 29925, 1660, 29931, 29889, 842, 9868, 703, 3991, 1973, 278, 23460, 12006, 2225, 1052, 261, 746, 350, 13668, 29941, 29941, 338, 13598, 297, 23460, 21864, 1159, 13, 1678, 480, 6739, 25548, 29918, 8456, 29928, 29941, 29941, 29918, 29925, 1660, 29931, 29889, 842, 12911, 29898, 8824, 29897, 13, 1678, 480, 6739, 25548, 29918, 8456, 29928, 29941, 29941, 29918, 29925, 1660, 29931, 29889, 842, 8498, 7158, 29898, 5504, 8456, 29928, 29941, 29941, 13504, 1052, 261, 12911, 4854, 29892, 6796, 29903, 4897, 29907, 29918, 8456, 29928, 29941, 29941, 29918, 1254, 4051, 29979, 9207, 29954, 613, 376, 29903, 4897, 29907, 29918, 8456, 29928, 29941, 29941, 29918, 29934, 3904, 29950, 8979, 613, 376, 29903, 4897, 29907, 29918, 8456, 29928, 29941, 29941, 29918, 29934, 3904, 29933, 29968, 4897, 20068, 13, 13, 1678, 480, 6739, 8456, 29928, 29941, 29941, 29925, 2838, 4247, 353, 15531, 4037, 29889, 657, 4247, 11974, 485, 29878, 29899, 8504, 29899, 10141, 29899, 1445, 29914, 7576, 29914, 5453, 29992, 29961, 978, 14672, 29903, 4897, 29907, 29905, 3108, 29914, 1767, 29899, 2972, 29992, 29961, 978, 14672, 29903, 4897, 29907, 29918, 8456, 29928, 29941, 29941, 1649, 29925, 1660, 29931, 29905, 3108, 1159, 13, 1678, 480, 6739, 8456, 29928, 29941, 29941, 29925, 2838, 9065, 353, 5159, 13, 1678, 480, 6739, 8456, 29928, 29941, 29941, 29925, 2838, 9065, 353, 480, 6739, 8456, 29928, 29941, 29941, 29925, 2838, 4247, 29889, 657, 19334, 580, 13, 13, 1678, 396, 29925, 1660, 29931, 995, 29871, 29900, 338, 451, 502, 519, 297, 23460, 4464, 29889, 6549, 278, 2425, 8665, 515, 29871, 29896, 29889, 13, 1678, 363, 2380, 297, 3464, 313, 29896, 29892, 7431, 29898, 12587, 29883, 8456, 29928, 29941, 29941, 29925, 2838, 9065, 22164, 13, 4706, 480, 6739, 8456, 29928, 29941, 29941, 29925, 2838, 2558, 1170, 353, 480, 6739, 8456, 29928, 29941, 29941, 29925, 2838, 9065, 29961, 2248, 1822, 657, 6708, 703, 978, 1159, 13, 4706, 480, 6739, 8456, 29928, 29941, 29941, 29925, 2838, 2558, 9868, 353, 480, 6739, 8456, 29928, 29941, 29941, 29925, 2838, 9065, 29961, 2248, 1822, 657, 6708, 703, 6671, 1159, 13, 4706, 480, 6739, 8456, 29928, 29941, 29941, 29925, 2838, 2558, 1917, 353, 29871, 480, 6739, 8456, 29928, 29941, 29941, 29925, 2838, 9065, 29961, 2248, 1822, 657, 6708, 703, 1767, 1159, 13, 4706, 480, 6739, 25548, 29918, 8456, 29928, 29941, 29941, 29918, 29925, 1660, 29931, 29889, 1202, 2558, 29898, 12587, 29883, 8456, 29928, 29941, 29941, 29925, 2838, 2558, 1170, 29892, 480, 6739, 8456, 29928, 29941, 29941, 29925, 2838, 2558, 1917, 29892, 480, 6739, 8456, 29928, 29941, 29941, 29925, 2838, 2558, 9868, 29897, 13, 13, 1678, 480, 6739, 25548, 29918, 8456, 29928, 29941, 29941, 29918, 29925, 1660, 29931, 29889, 842, 4592, 1917, 29898, 29900, 29897, 13, 1678, 480, 6739, 25548, 29918, 8456, 29928, 29941, 29941, 29918, 29925, 1660, 29931, 29889, 842, 6466, 6818, 703, 1917, 1159, 13, 1678, 480, 6739, 25548, 29918, 8456, 29928, 29941, 29941, 29918, 29925, 1660, 29931, 29889, 842, 9323, 6818, 703, 9868, 1159, 13, 268, 13, 1678, 396, 8456, 29928, 20999, 3440, 13, 1678, 480, 6739, 25548, 29918, 8456, 29928, 29941, 29941, 29918, 29943, 1509, 20001, 353, 480, 6739, 5308, 29889, 3258, 20001, 14730, 703, 29903, 4897, 29907, 29918, 25903, 29918, 3217, 7428, 3919, 613, 480, 6739, 25548, 29918, 8456, 29928, 29941, 29941, 29918, 6823, 29897, 13, 1678, 480, 6739, 25548, 29918, 8456, 29928, 29941, 29941, 29918, 29943, 1509, 20001, 29889, 842, 4775, 703, 9842, 29901, 1281, 4532, 350, 13668, 29941, 29941, 383, 6394, 773, 525, 3924, 29915, 4163, 1159, 13, 13, 1678, 396, 29963, 18166, 20019, 13, 1678, 480, 6739, 25548, 29918, 29963, 18166, 29918, 6823, 29922, 480, 6739, 5308, 29889, 3258, 6823, 14730, 703, 29963, 18166, 29918, 29924, 1430, 29965, 613, 6213, 29897, 13, 1678, 480, 6739, 25548, 29918, 29963, 18166, 29918, 6823, 29889, 842, 4775, 703, 13072, 29873, 482, 2169, 9183, 313, 29963, 18166, 29897, 20999, 1159, 13, 13, 1678, 396, 29963, 18166, 27694, 29933, 29968, 4897, 4464, 13, 1678, 480, 6739, 25548, 29918, 29963, 18166, 29918, 29934, 3904, 29933, 29968, 4897, 353, 480, 6739, 5308, 29889, 3258, 2558, 1917, 2697, 14730, 703, 29903, 4897, 29907, 29918, 29963, 18166, 29918, 29934, 3904, 29933, 29968, 4897, 613, 480, 6739, 25548, 29918, 29963, 18166, 29918, 6823, 29897, 13, 1678, 480, 6739, 25548, 29918, 29963, 18166, 29918, 29934, 3904, 29933, 29968, 4897, 29889, 842, 4775, 703, 6330, 3684, 29873, 482, 2169, 9183, 5858, 297, 16199, 8709, 1159, 13, 1678, 480, 6739, 25548, 29918, 29963, 18166, 29918, 29934, 3904, 29933, 29968, 4897, 29889, 842, 9868, 703, 3549, 29879, 4241, 3684, 29873, 482, 2169, 9183, 5858, 297, 16199, 8709, 1159, 13, 1678, 480, 6739, 25548, 29918, 29963, 18166, 29918, 29934, 3904, 29933, 29968, 4897, 29889, 1202, 2558, 703, 18166, 29918, 27681, 613, 376, 29900, 613, 376, 4597, 9183, 11084, 1159, 13, 1678, 480, 6739, 25548, 29918, 29963, 18166, 29918, 29934, 3904, 29933, 29968, 4897, 29889, 1202, 2558, 703, 18166, 29918, 1164, 613, 376, 29896, 613, 376, 4597, 9183, 451, 11084, 1159, 13, 1678, 480, 6739, 25548, 29918, 29963, 18166, 29918, 29934, 3904, 29933, 29968, 4897, 29889, 842, 4592, 1917, 29898, 29900, 29897, 13, 1678, 480, 6739, 25548, 29918, 29963, 18166, 29918, 29934, 3904, 29933, 29968, 4897, 29889, 842, 6466, 6818, 703, 1917, 1159, 13, 1678, 480, 6739, 25548, 29918, 29963, 18166, 29918, 29934, 3904, 29933, 29968, 4897, 29889, 842, 9323, 6818, 703, 9868, 1159, 13, 13, 1678, 396, 29963, 18166, 478, 2890, 29940, 13, 1678, 480, 6739, 25548, 29918, 29963, 18166, 29918, 21819, 1430, 353, 480, 6739, 5308, 29889, 3258, 18146, 14730, 703, 29903, 4897, 29907, 29918, 29963, 18166, 29918, 21819, 1430, 613, 480, 6739, 25548, 29918, 29963, 18166, 29918, 6823, 29897, 13, 1678, 480, 6739, 25548, 29918, 29963, 18166, 29918, 21819, 1430, 29889, 842, 4775, 703, 20701, 3684, 29873, 482, 317, 1052, 292, 1159, 13, 1678, 480, 6739, 25548, 29918, 29963, 18166, 29918, 21819, 1430, 29889, 842, 9868, 703, 20701, 10597, 9558, 310, 478, 7858, 3217, 1525, 1159, 13, 1678, 480, 6739, 25548, 29918, 29963, 18166, 29918, 21819, 1430, 29889, 842, 4592, 1917, 29898, 8824, 29897, 13, 13, 1678, 396, 29963, 18166, 478, 5550, 1001, 13, 1678, 480, 6739, 25548, 29918, 29963, 18166, 29918, 29963, 5550, 1001, 353, 480, 6739, 5308, 29889, 3258, 7798, 14730, 703, 29903, 4897, 29907, 29918, 29963, 18166, 29918, 29963, 5550, 1001, 613, 480, 6739, 25548, 29918, 29963, 18166, 29918, 6823, 29897, 13, 1678, 480, 6739, 25548, 29918, 29963, 18166, 29918, 29963, 5550, 1001, 29889, 842, 4775, 703, 13072, 29873, 482, 317, 1052, 292, 29498, 1159, 13, 1678, 480, 6739, 25548, 29918, 29963, 18166, 29918, 21819, 1430, 29889, 842, 9868, 703, 1576, 931, 338, 5135, 29906, 29985, 29963, 5550, 1001, 29897, 334, 323, 511, 988, 323, 338, 385, 7463, 3785, 313, 22449, 29871, 29906, 29945, 29900, 17534, 467, 1159, 13, 1678, 480, 6739, 25548, 29918, 29963, 18166, 29918, 29963, 5550, 1001, 29889, 842, 4592, 1917, 29898, 29900, 29897, 13, 1678, 480, 6739, 25548, 29918, 29963, 18166, 29918, 29963, 5550, 1001, 29889, 842, 8140, 29898, 29900, 29897, 13, 1678, 480, 6739, 25548, 29918, 29963, 18166, 29918, 29963, 5550, 1001, 29889, 842, 7976, 29898, 29955, 29897, 13, 1678, 480, 6739, 25548, 29918, 29963, 18166, 29918, 29963, 5550, 1001, 29889, 842, 12911, 29898, 8824, 29897, 13, 1678, 480, 6739, 25548, 29918, 29963, 18166, 29918, 29963, 5550, 1001, 29889, 842, 8498, 7158, 29898, 5504, 29903, 786, 29883, 3991, 12911, 4854, 29892, 6796, 29903, 4897, 29907, 29918, 29963, 18166, 29918, 21819, 1430, 20068, 13, 13, 1678, 396, 29963, 25866, 20019, 13, 1678, 480, 6739, 25548, 29918, 29963, 25866, 29918, 6823, 29922, 480, 6739, 5308, 29889, 3258, 6823, 14730, 703, 29963, 25866, 29918, 29924, 1430, 29965, 613, 6213, 29897, 13, 1678, 480, 6739, 25548, 29918, 29963, 25866, 29918, 6823, 29889, 842, 4775, 703, 13072, 29873, 482, 12105, 313, 29963, 25866, 29897, 20999, 1159, 13, 13, 1678, 480, 6739, 25548, 29918, 29963, 25866, 29918, 1660, 29931, 353, 480, 6739, 5308, 29889, 3258, 2558, 1917, 2697, 14730, 703, 29903, 4897, 29907, 29918, 29963, 25866, 29918, 1660, 29931, 613, 480, 6739, 25548, 29918, 29963, 25866, 29918, 6823, 29897, 13, 1678, 480, 6739, 25548, 29918, 29963, 25866, 29918, 1660, 29931, 29889, 842, 4775, 703, 13072, 29873, 482, 12105, 995, 1159, 13, 1678, 480, 6739, 25548, 29918, 29963, 25866, 29918, 1660, 29931, 29889, 842, 9868, 703, 3549, 278, 3684, 29873, 482, 12105, 15662, 995, 1159, 13, 13, 1678, 480, 6739, 29963, 1525, 9998, 295, 4247, 353, 15531, 4037, 29889, 657, 4247, 11974, 485, 29878, 29899, 8504, 29899, 10141, 29899, 1445, 29914, 7576, 29914, 5453, 29992, 29961, 978, 14672, 29903, 4897, 29907, 29905, 3108, 29914, 1767, 29899, 2972, 29992, 29961, 978, 14672, 29903, 4897, 29907, 29918, 29963, 25866, 1649, 1660, 29931, 29905, 3108, 1159, 13, 1678, 480, 6739, 29963, 1525, 9998, 295, 9065, 353, 5159, 13, 1678, 480, 6739, 29963, 1525, 9998, 295, 9065, 353, 480, 6739, 29963, 1525, 9998, 295, 4247, 29889, 657, 19334, 580, 13, 13, 1678, 363, 2380, 297, 3464, 313, 29900, 29892, 7431, 29898, 12587, 29883, 29963, 1525, 9998, 295, 9065, 22164, 13, 4706, 480, 6739, 29963, 1525, 9998, 295, 2558, 1170, 353, 480, 6739, 29963, 1525, 9998, 295, 9065, 29961, 2248, 1822, 657, 6708, 703, 978, 1159, 13, 4706, 480, 6739, 29963, 1525, 9998, 295, 2558, 9868, 353, 480, 6739, 29963, 1525, 9998, 295, 9065, 29961, 2248, 1822, 657, 6708, 703, 6671, 1159, 13, 4706, 480, 6739, 29963, 1525, 9998, 295, 2558, 1917, 353, 29871, 480, 6739, 29963, 1525, 9998, 295, 9065, 29961, 2248, 1822, 657, 6708, 703, 1767, 1159, 13, 4706, 480, 6739, 25548, 29918, 29963, 25866, 29918, 1660, 29931, 29889, 1202, 2558, 29898, 12587, 29883, 29963, 1525, 9998, 295, 2558, 1170, 29892, 480, 6739, 29963, 1525, 9998, 295, 2558, 1917, 29892, 480, 6739, 29963, 1525, 9998, 295, 2558, 9868, 29897, 13, 13, 1678, 480, 6739, 25548, 29918, 29963, 25866, 29918, 1660, 29931, 29889, 842, 4592, 1917, 29898, 29900, 29897, 13, 1678, 480, 6739, 25548, 29918, 29963, 25866, 29918, 1660, 29931, 29889, 842, 6466, 6818, 703, 1917, 1159, 13, 1678, 480, 6739, 25548, 29918, 29963, 25866, 29918, 1660, 29931, 29889, 842, 9323, 6818, 703, 9868, 1159, 13, 13, 1678, 396, 29963, 25866, 6732, 2287, 1529, 2797, 4464, 13, 1678, 480, 6739, 25548, 29918, 29963, 25866, 29918, 1164, 2287, 1529, 2797, 353, 480, 6739, 5308, 29889, 3258, 18146, 14730, 703, 29903, 4897, 29907, 29918, 29963, 25866, 29918, 1164, 2287, 1529, 2797, 613, 480, 6739, 25548, 29918, 29963, 25866, 29918, 6823, 29897, 13, 1678, 480, 6739, 25548, 29918, 29963, 25866, 29918, 1164, 2287, 1529, 2797, 29889, 842, 4775, 703, 20701, 1551, 9667, 1159, 13, 1678, 480, 6739, 25548, 29918, 29963, 25866, 29918, 1164, 2287, 1529, 2797, 29889, 842, 9868, 703, 3644, 445, 2984, 338, 9615, 29892, 278, 11749, 3407, 338, 12708, 746, 694, 23603, 8096, 284, 338, 2009, 292, 372, 23157, 13, 1678, 480, 6739, 25548, 29918, 29963, 25866, 29918, 1164, 2287, 1529, 2797, 29889, 842, 4592, 1917, 29898, 8824, 29897, 13, 13, 1678, 396, 29963, 25866, 27694, 1254, 4051, 29979, 4464, 13, 1678, 480, 6739, 25548, 29918, 29963, 25866, 29918, 29934, 3904, 1254, 4051, 29979, 353, 480, 6739, 5308, 29889, 3258, 18146, 14730, 703, 29903, 4897, 29907, 29918, 29963, 25866, 29918, 29934, 3904, 1254, 4051, 29979, 613, 480, 6739, 25548, 29918, 29963, 25866, 29918, 6823, 29897, 13, 1678, 480, 6739, 25548, 29918, 29963, 25866, 29918, 29934, 3904, 1254, 4051, 29979, 29889, 842, 4775, 703, 20701, 7525, 297, 6679, 1609, 1159, 13, 1678, 480, 6739, 25548, 29918, 29963, 25866, 29918, 29934, 3904, 1254, 4051, 29979, 29889, 842, 9868, 703, 20701, 478, 25866, 5858, 297, 6679, 1609, 317, 5436, 21864, 1159, 13, 13, 1678, 396, 29963, 25866, 478, 1525, 5800, 29923, 13, 1678, 480, 6739, 25548, 29918, 29963, 25866, 29918, 29963, 1525, 5800, 29923, 353, 480, 6739, 5308, 29889, 3258, 18146, 14730, 703, 29903, 4897, 29907, 29918, 29963, 25866, 29918, 29963, 1525, 5800, 29923, 613, 480, 6739, 25548, 29918, 29963, 25866, 29918, 6823, 29897, 13, 1678, 480, 6739, 25548, 29918, 29963, 25866, 29918, 29963, 1525, 5800, 29923, 29889, 842, 4775, 703, 20701, 478, 25866, 1962, 1159, 13, 1678, 480, 6739, 25548, 29918, 29963, 25866, 29918, 29963, 1525, 5800, 29923, 29889, 842, 9868, 703, 20701, 478, 25866, 3957, 304, 11033, 29907, 29889, 960, 6732, 2287, 1529, 2797, 338, 29871, 29900, 322, 478, 25866, 338, 9615, 29892, 6789, 546, 1535, 317, 6073, 2609, 367, 1304, 1159, 13, 1678, 480, 6739, 25548, 29918, 29963, 25866, 29918, 29963, 1525, 5800, 29923, 29889, 842, 4592, 1917, 29898, 8824, 29897, 13, 13, 1678, 396, 29963, 25866, 323, 29903, 1430, 13, 1678, 480, 6739, 25548, 29918, 29963, 25866, 29918, 9375, 1430, 353, 480, 6739, 5308, 29889, 3258, 18146, 14730, 703, 29903, 4897, 29907, 29918, 29963, 25866, 29918, 9375, 1430, 613, 480, 6739, 25548, 29918, 29963, 25866, 29918, 6823, 29897, 13, 1678, 480, 6739, 25548, 29918, 29963, 25866, 29918, 9375, 1430, 29889, 842, 4775, 703, 20701, 6789, 546, 1535, 317, 6073, 1159, 13, 1678, 480, 6739, 25548, 29918, 29963, 25866, 29918, 9375, 1430, 29889, 842, 9868, 703, 20701, 6789, 546, 1535, 317, 6073, 3957, 304, 11033, 29907, 1159, 13, 1678, 480, 6739, 25548, 29918, 29963, 25866, 29918, 9375, 1430, 29889, 842, 4592, 1917, 29898, 8824, 29897, 13, 1678, 480, 6739, 25548, 29918, 29963, 25866, 29918, 9375, 1430, 29889, 842, 8498, 7158, 29898, 5504, 29963, 999, 12911, 4854, 29892, 6796, 29903, 4897, 29907, 29918, 29963, 25866, 29918, 1164, 2287, 1529, 2797, 613, 376, 29903, 4897, 29907, 29918, 29963, 25866, 29918, 29963, 1525, 5800, 29923, 20068, 13, 13, 1678, 396, 14388, 7024, 20019, 13, 1678, 480, 6739, 25548, 29918, 14388, 7024, 29918, 6823, 29922, 480, 6739, 5308, 29889, 3258, 6823, 14730, 703, 29903, 4897, 29907, 29918, 14388, 7024, 613, 6213, 29897, 13, 1678, 480, 6739, 25548, 29918, 14388, 7024, 29918, 6823, 29889, 842, 4775, 703, 29933, 2620, 29891, 7437, 786, 9206, 28176, 12782, 332, 1249, 265, 1159, 13, 13, 1678, 396, 14388, 7024, 11421, 21293, 13, 1678, 480, 6739, 25548, 29918, 14388, 7024, 353, 480, 6739, 5308, 29889, 3258, 18146, 14730, 703, 29903, 4897, 29907, 29918, 14388, 7024, 29918, 12982, 6059, 1430, 613, 480, 6739, 25548, 29918, 14388, 7024, 29918, 6823, 29897, 13, 1678, 480, 6739, 25548, 29918, 14388, 7024, 29889, 842, 4775, 703, 29956, 1296, 21830, 373, 29449, 7024, 28176, 292, 1159, 13, 1678, 480, 6739, 25548, 29918, 14388, 7024, 29889, 842, 9868, 703, 1576, 4742, 508, 367, 281, 4476, 701, 746, 26263, 515, 16988, 16199, 3081, 304, 4241, 9206, 23157, 13, 13, 1678, 396, 29903, 4897, 29907, 10604, 12534, 5285, 13, 1678, 396, 2831, 12534, 2983, 29892, 2737, 525, 20182, 368, 15830, 17434, 449, 29915, 297, 13373, 294, 4155, 13, 1678, 480, 6739, 25548, 29918, 29933, 29968, 12015, 29918, 6823, 29922, 480, 6739, 5308, 29889, 3258, 6823, 14730, 703, 29903, 4897, 29907, 29918, 29933, 29968, 12015, 613, 6213, 29897, 13, 1678, 480, 6739, 25548, 29918, 29933, 29968, 12015, 29918, 6823, 29889, 842, 4775, 703, 29903, 4897, 29907, 10604, 12534, 17127, 1249, 265, 1159, 13, 13, 1678, 396, 29903, 4897, 29907, 10604, 12534, 29871, 29900, 13, 1678, 480, 6739, 25548, 29918, 29933, 29968, 12015, 29900, 353, 480, 6739, 5308, 29889, 3258, 18146, 14730, 703, 29903, 4897, 29907, 29918, 29933, 29968, 12015, 29918, 29900, 613, 480, 6739, 25548, 29918, 29933, 29968, 12015, 29918, 6823, 29897, 13, 1678, 480, 6739, 25548, 29918, 29933, 29968, 12015, 29900, 29889, 842, 4775, 703, 20701, 19474, 29900, 1159, 13, 1678, 480, 6739, 25548, 29918, 29933, 29968, 12015, 29900, 29889, 842, 9868, 703, 12015, 29900, 12534, 508, 367, 18225, 491, 317, 4897, 29907, 29889, 739, 508, 367, 17304, 839, 491, 317, 4897, 29907, 29892, 2729, 373, 390, 9472, 28488, 1159, 13, 1678, 480, 6739, 25548, 29918, 29933, 29968, 12015, 29900, 29889, 842, 4592, 1917, 29898, 8824, 29897, 13, 13, 1678, 396, 13079, 1783, 29954, 6154, 29871, 29900, 13, 1678, 480, 6739, 25548, 29918, 29933, 29968, 12015, 29918, 13079, 1783, 7239, 29900, 353, 480, 6739, 5308, 29889, 3258, 18146, 14730, 703, 29903, 4897, 29907, 29918, 29933, 29968, 12015, 29918, 13079, 1783, 29954, 6154, 29900, 613, 480, 6739, 25548, 29918, 29933, 29968, 12015, 29900, 29897, 13, 1678, 480, 6739, 25548, 29918, 29933, 29968, 12015, 29918, 13079, 1783, 7239, 29900, 29889, 842, 4775, 703, 27199, 19474, 29900, 373, 390, 9472, 6864, 1159, 13, 1678, 480, 6739, 25548, 29918, 29933, 29968, 12015, 29918, 13079, 1783, 7239, 29900, 29889, 842, 9868, 703, 12015, 29900, 12534, 508, 367, 17304, 839, 491, 317, 4897, 29907, 29892, 2729, 373, 390, 9472, 28488, 1159, 13, 1678, 480, 6739, 25548, 29918, 29933, 29968, 12015, 29918, 13079, 1783, 7239, 29900, 29889, 842, 8498, 7158, 29898, 5504, 29903, 786, 29883, 3991, 12911, 4854, 29892, 6796, 29903, 4897, 29907, 29918, 29933, 29968, 12015, 29918, 29900, 20068, 13, 1678, 480, 6739, 25548, 29918, 29933, 29968, 12015, 29918, 13079, 1783, 7239, 29900, 29889, 842, 12911, 29898, 8824, 29897, 13, 13, 1678, 396, 29903, 4897, 29907, 10604, 12534, 29871, 29896, 13, 1678, 480, 6739, 25548, 29918, 29933, 29968, 12015, 29896, 353, 480, 6739, 5308, 29889, 3258, 18146, 14730, 703, 29903, 4897, 29907, 29918, 29933, 29968, 12015, 29918, 29896, 613, 480, 6739, 25548, 29918, 29933, 29968, 12015, 29918, 6823, 29897, 13, 1678, 480, 6739, 25548, 29918, 29933, 29968, 12015, 29896, 29889, 842, 4775, 703, 20701, 19474, 29896, 1159, 13, 1678, 480, 6739, 25548, 29918, 29933, 29968, 12015, 29896, 29889, 842, 9868, 703, 12015, 29896, 12534, 508, 367, 18225, 491, 317, 4897, 29907, 29889, 739, 508, 367, 17304, 839, 491, 317, 4897, 29907, 29892, 2729, 373, 390, 9472, 28488, 1159, 13, 1678, 480, 6739, 25548, 29918, 29933, 29968, 12015, 29896, 29889, 842, 4592, 1917, 29898, 8824, 29897, 13, 13, 1678, 396, 13079, 1783, 29954, 6154, 29871, 29896, 13, 1678, 480, 6739, 25548, 29918, 29933, 29968, 12015, 29918, 13079, 1783, 7239, 29896, 353, 480, 6739, 5308, 29889, 3258, 18146, 14730, 703, 29903, 4897, 29907, 29918, 29933, 29968, 12015, 29918, 13079, 1783, 29954, 6154, 29896, 613, 480, 6739, 25548, 29918, 29933, 29968, 12015, 29896, 29897, 13, 1678, 480, 6739, 25548, 29918, 29933, 29968, 12015, 29918, 13079, 1783, 7239, 29896, 29889, 842, 4775, 703, 27199, 19474, 29896, 373, 390, 9472, 6864, 1159, 13, 1678, 480, 6739, 25548, 29918, 29933, 29968, 12015, 29918, 13079, 1783, 7239, 29896, 29889, 842, 9868, 703, 12015, 29896, 12534, 508, 367, 17304, 839, 491, 317, 4897, 29907, 29892, 2729, 373, 390, 9472, 28488, 1159, 13, 1678, 480, 6739, 25548, 29918, 29933, 29968, 12015, 29918, 13079, 1783, 7239, 29896, 29889, 842, 8498, 7158, 29898, 5504, 29903, 786, 29883, 3991, 12911, 4854, 29892, 6796, 29903, 4897, 29907, 29918, 29933, 29968, 12015, 29918, 29896, 20068, 13, 1678, 480, 6739, 25548, 29918, 29933, 29968, 12015, 29918, 13079, 1783, 7239, 29896, 29889, 842, 12911, 29898, 8824, 29897, 13, 13, 1678, 835, 13383, 13383, 13383, 13383, 7346, 29937, 13, 1678, 3191, 10034, 5197, 3191, 13, 1678, 835, 13383, 13383, 13383, 13383, 7346, 29937, 13, 13, 1678, 4124, 6685, 12877, 353, 480, 6739, 4998, 1170, 29889, 23433, 580, 718, 11119, 8456, 29928, 2287, 29911, 29918, 23845, 29934, 4897, 29911, 29918, 1430, 6181, 29908, 13, 1678, 4124, 6685, 4598, 353, 480, 6739, 4998, 1170, 29889, 23433, 580, 718, 11119, 8456, 29928, 2287, 29911, 29918, 23845, 29934, 4897, 29911, 29918, 29950, 9468, 29931, 1001, 29908, 13, 1678, 4124, 6685, 4598, 16542, 353, 480, 6739, 4998, 1170, 29889, 23433, 580, 29974, 11119, 8456, 29928, 2287, 29911, 29918, 23845, 29934, 4897, 29911, 29918, 29950, 9468, 29931, 1001, 29918, 21339, 29908, 13, 13, 1678, 835, 13383, 13383, 13383, 13383, 13383, 13383, 13, 1678, 835, 13383, 13383, 4136, 5920, 28203, 29871, 835, 13383, 13383, 4136, 2277, 29937, 13, 1678, 835, 13383, 13383, 13383, 13383, 13383, 13383, 13, 13, 1678, 2295, 1170, 353, 9586, 1849, 29889, 657, 703, 1649, 25903, 4574, 8098, 29918, 5813, 1159, 13, 13, 1678, 480, 6739, 25548, 29918, 7850, 2283, 353, 480, 6739, 5308, 29889, 3258, 2283, 14730, 703, 29903, 4897, 29907, 29918, 23252, 1001, 613, 6213, 29897, 13, 1678, 480, 6739, 25548, 29918, 7850, 2283, 29889, 842, 4435, 2605, 703, 6995, 546, 29875, 8096, 284, 29914, 12587, 29883, 29918, 29884, 29906, 29946, 29900, 29955, 29914, 20943, 29914, 29886, 1982, 29918, 12587, 29883, 29889, 29882, 29889, 615, 29880, 1159, 13, 1678, 480, 6739, 25548, 29918, 7850, 2283, 29889, 842, 6466, 1170, 703, 29886, 1982, 29918, 17969, 12587, 29883, 4998, 1170, 29889, 23433, 2141, 13609, 580, 29974, 1642, 29882, 1159, 13, 1678, 480, 6739, 25548, 29918, 7850, 2283, 29889, 842, 14994, 2605, 11974, 546, 29875, 8096, 284, 29914, 12587, 29883, 29914, 1159, 13, 1678, 480, 6739, 25548, 29918, 7850, 2283, 29889, 842, 7653, 2605, 703, 2917, 12975, 718, 2295, 1170, 718, 5591, 546, 29875, 8096, 284, 29914, 12587, 29883, 29914, 1159, 13, 1678, 480, 6739, 25548, 29918, 7850, 2283, 29889, 842, 1542, 703, 23252, 1001, 1159, 13, 1678, 480, 6739, 25548, 29918, 7850, 2283, 29889, 842, 9802, 786, 29898, 5574, 29897, 13, 13, 1678, 480, 6739, 25548, 29918, 4435, 2283, 353, 480, 6739, 5308, 29889, 3258, 2283, 14730, 703, 29903, 4897, 29907, 29918, 27839, 4741, 613, 6213, 29897, 13, 1678, 480, 6739, 25548, 29918, 4435, 2283, 29889, 842, 4435, 2605, 703, 6995, 546, 29875, 8096, 284, 29914, 12587, 29883, 29918, 29884, 29906, 29946, 29900, 29955, 29914, 20943, 29914, 29886, 1982, 29918, 12587, 29883, 29889, 29883, 29889, 615, 29880, 1159, 13, 1678, 480, 6739, 25548, 29918, 4435, 2283, 29889, 842, 6466, 1170, 703, 29886, 1982, 29918, 17969, 12587, 29883, 4998, 1170, 29889, 23433, 2141, 13609, 580, 29974, 1642, 29883, 1159, 13, 1678, 480, 6739, 25548, 29918, 4435, 2283, 29889, 842, 14994, 2605, 11974, 546, 29875, 8096, 284, 29914, 12587, 29883, 29914, 1159, 13, 1678, 480, 6739, 25548, 29918, 4435, 2283, 29889, 842, 7653, 2605, 703, 2917, 12975, 718, 2295, 1170, 718, 5591, 546, 29875, 8096, 284, 29914, 12587, 29883, 29914, 1159, 13, 1678, 480, 6739, 25548, 29918, 4435, 2283, 29889, 842, 1542, 703, 27839, 4741, 1159, 13, 1678, 480, 6739, 25548, 29918, 4435, 2283, 29889, 842, 9802, 786, 29898, 5574, 29897, 13, 13, 1678, 480, 6739, 25548, 29918, 3924, 6644, 2283, 353, 480, 6739, 5308, 29889, 3258, 2283, 14730, 703, 29903, 4897, 29907, 29918, 14816, 29903, 29918, 10192, 613, 6213, 29897, 13, 1678, 480, 6739, 25548, 29918, 3924, 6644, 2283, 29889, 842, 1542, 703, 20785, 1159, 13, 1678, 480, 6739, 25548, 29918, 3924, 6644, 2283, 29889, 842, 6466, 1170, 703, 3221, 29889, 24360, 29918, 14816, 1254, 12665, 29918, 26019, 29918, 29907, 29918, 14816, 29903, 29918, 26019, 25758, 29902, 10721, 29918, 13171, 5690, 4448, 1964, 29903, 1159, 13, 1678, 480, 6739, 25548, 29918, 3924, 6644, 2283, 29889, 842, 4435, 2605, 703, 6995, 546, 29875, 8096, 284, 29914, 12587, 29883, 29918, 29884, 29906, 29946, 29900, 29955, 29914, 20943, 29914, 5205, 29914, 11228, 2133, 29889, 29883, 29889, 615, 29880, 1159, 13, 1678, 480, 6739, 25548, 29918, 3924, 6644, 2283, 29889, 842, 9802, 786, 29898, 5574, 29897, 13, 13, 1678, 480, 6739, 25548, 29918, 3924, 3206, 2283, 353, 480, 6739, 5308, 29889, 3258, 2283, 14730, 703, 29903, 4897, 29907, 29918, 14816, 29903, 29918, 24405, 613, 6213, 29897, 13, 1678, 480, 6739, 25548, 29918, 3924, 3206, 2283, 29889, 842, 1542, 703, 20785, 1159, 13, 1678, 480, 6739, 25548, 29918, 3924, 3206, 2283, 29889, 842, 6466, 1170, 703, 3221, 29889, 24360, 29918, 14816, 1254, 12665, 29918, 24405, 1177, 22122, 29903, 29918, 29950, 29918, 1177, 6154, 29965, 2287, 29903, 1159, 13, 1678, 480, 6739, 25548, 29918, 3924, 3206, 2283, 29889, 842, 4435, 2605, 703, 6995, 546, 29875, 8096, 284, 29914, 12587, 29883, 29918, 29884, 29906, 29946, 29900, 29955, 29914, 20943, 29914, 5205, 29914, 25476, 2187, 29889, 29882, 29889, 615, 29880, 1159, 13, 1678, 480, 6739, 25548, 29918, 3924, 3206, 2283, 29889, 842, 9802, 786, 29898, 5574, 29897, 13, 2 ]
backend/backend/users/models.py
Redaloukil/PackageWay
0
88766
import uuid from django.contrib.auth.models import AbstractUser , PermissionsMixin from django.db import models from django.urls import reverse from django.utils.translation import ugettext_lazy as _ from backend.users.managers import UserManager USER_TYPE = ( ("0" , "client"), ("1" , "delivery") ) class User(AbstractUser): username = models.CharField(_("Name of User"), blank=False, max_length=255 , unique=True) first_name = models.CharField(max_length=255 , blank=False) last_name = models.CharField(max_length=255 , blank=False) user_type = models.CharField( choices=USER_TYPE ,max_length=10 ,default="0") is_active = models.BooleanField(default=True) is_staff = models.BooleanField(default=False) objects = UserManager() def get_absolute_url(self): return reverse("users:detail", kwargs={"username": self.username}) USERNAME_FIELD = 'username' REQUIRED_FIELDS = ['first_name' ,'last_name' ,''] class Meta: app_label = 'users' def __str__(self): return self.username def get_short_name(self): return self.username def get_full_name(self): return self.username + " " + self.first_name + " " + self.last_name def save(self, *args, **kwargs): if not self.password: self.password = str(uuid.uuid4()).replace('-', '') super(User, self).save(*args, **kwargs) class Profile(models.Model): # image = models.ImageField(blank=True) user = models.ForeignKey(User , on_delete=models.CASCADE) def __str__(self): return self.user.username class ResetPasswordCode(models.Model): user = models.ForeignKey(User , on_delete=models.CASCADE) code = models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True) class Meta: default_related_name = 'reset_password_codes' def __str__(self): return self.user.username + " " + self.code
[ 1, 1053, 318, 5416, 13, 3166, 9557, 29889, 21570, 29889, 5150, 29889, 9794, 1053, 25513, 2659, 1919, 20894, 6847, 29924, 861, 262, 13, 3166, 9557, 29889, 2585, 1053, 4733, 13, 3166, 9557, 29889, 26045, 1053, 11837, 13, 3166, 9557, 29889, 13239, 29889, 3286, 18411, 1053, 318, 657, 726, 29918, 433, 1537, 408, 903, 13, 3166, 14998, 29889, 7193, 29889, 1171, 18150, 1053, 4911, 3260, 13, 13, 11889, 29918, 11116, 353, 313, 13, 1678, 4852, 29900, 29908, 1919, 376, 4645, 4968, 13, 1678, 4852, 29896, 29908, 1919, 376, 29881, 27657, 1159, 13, 29897, 13, 13, 1990, 4911, 29898, 9118, 2659, 1125, 13, 1678, 8952, 353, 4733, 29889, 27890, 7373, 703, 1170, 310, 4911, 4968, 9654, 29922, 8824, 29892, 4236, 29918, 2848, 29922, 29906, 29945, 29945, 1919, 5412, 29922, 5574, 29897, 13, 1678, 937, 29918, 978, 353, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 29922, 29906, 29945, 29945, 1919, 9654, 29922, 8824, 29897, 13, 1678, 1833, 29918, 978, 353, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 29922, 29906, 29945, 29945, 1919, 9654, 29922, 8824, 29897, 13, 1678, 1404, 29918, 1853, 353, 4733, 29889, 27890, 29898, 19995, 29922, 11889, 29918, 11116, 1919, 3317, 29918, 2848, 29922, 29896, 29900, 1919, 4381, 543, 29900, 1159, 13, 1678, 338, 29918, 4925, 353, 4733, 29889, 18146, 3073, 29898, 4381, 29922, 5574, 29897, 13, 1678, 338, 29918, 303, 3470, 353, 4733, 29889, 18146, 3073, 29898, 4381, 29922, 8824, 29897, 13, 268, 13, 268, 13, 1678, 3618, 353, 4911, 3260, 580, 13, 268, 13, 1678, 822, 679, 29918, 23552, 29918, 2271, 29898, 1311, 1125, 13, 4706, 736, 11837, 703, 7193, 29901, 16432, 613, 9049, 5085, 3790, 29908, 6786, 1115, 1583, 29889, 6786, 1800, 13, 13, 1678, 3148, 1001, 5813, 29918, 3738, 27286, 353, 525, 6786, 29915, 13, 13, 1678, 5195, 29984, 3120, 19386, 29918, 3738, 6670, 8452, 353, 6024, 4102, 29918, 978, 29915, 1919, 29915, 4230, 29918, 978, 29915, 1919, 29915, 2033, 13, 13, 1678, 770, 20553, 29901, 13, 4706, 623, 29918, 1643, 353, 525, 7193, 29915, 13, 13, 1678, 822, 4770, 710, 12035, 1311, 1125, 13, 4706, 736, 1583, 29889, 6786, 13, 13, 1678, 822, 679, 29918, 12759, 29918, 978, 29898, 1311, 1125, 13, 4706, 736, 1583, 29889, 6786, 13, 13, 1678, 822, 679, 29918, 8159, 29918, 978, 29898, 1311, 1125, 13, 4706, 736, 1583, 29889, 6786, 718, 376, 376, 718, 1583, 29889, 4102, 29918, 978, 718, 376, 376, 718, 1583, 29889, 4230, 29918, 978, 13, 13, 1678, 822, 4078, 29898, 1311, 29892, 334, 5085, 29892, 3579, 19290, 1125, 13, 4706, 565, 451, 1583, 29889, 5630, 29901, 13, 9651, 1583, 29889, 5630, 353, 851, 29898, 25118, 29889, 25118, 29946, 16655, 6506, 877, 29899, 742, 27255, 13, 4706, 2428, 29898, 2659, 29892, 1583, 467, 7620, 10456, 5085, 29892, 3579, 19290, 29897, 13, 13, 13, 1990, 20802, 29898, 9794, 29889, 3195, 1125, 13, 1678, 396, 1967, 353, 4733, 29889, 2940, 3073, 29898, 19465, 29922, 5574, 29897, 13, 1678, 1404, 353, 4733, 29889, 27755, 2558, 29898, 2659, 1919, 373, 29918, 8143, 29922, 9794, 29889, 29907, 3289, 5454, 2287, 29897, 13, 13, 1678, 822, 4770, 710, 12035, 1311, 1125, 13, 4706, 736, 1583, 29889, 1792, 29889, 6786, 13, 13, 13, 1990, 2538, 300, 10048, 3399, 29898, 9794, 29889, 3195, 1125, 13, 1678, 1404, 353, 4733, 29889, 27755, 2558, 29898, 2659, 1919, 373, 29918, 8143, 29922, 9794, 29889, 29907, 3289, 5454, 2287, 29897, 13, 1678, 775, 353, 4733, 29889, 29965, 11150, 3073, 29898, 4381, 29922, 25118, 29889, 25118, 29946, 29892, 3863, 519, 29922, 8824, 29892, 7601, 29918, 1989, 29922, 5574, 29897, 13, 13, 1678, 770, 20553, 29901, 13, 4706, 2322, 29918, 12817, 29918, 978, 353, 525, 12071, 29918, 5630, 29918, 18137, 29915, 13, 13, 1678, 822, 4770, 710, 12035, 1311, 1125, 13, 4706, 736, 1583, 29889, 1792, 29889, 6786, 718, 376, 376, 718, 1583, 29889, 401, 13, 2 ]
scripts/chi-to-json.py
paperquest/paperquest.github.io
14
125132
################################################################################ # # Parses a tab-separated dataset file of papers from CHI and UIST and # turns it into JSON. Each row in the file has the columns: # # 1. conference # 2. year # 3. title # 4. abstract # 5. authors # 6. doi # 7. references # # where authors is of the form author1~author2~...~authorN and the # references are doi's of other publications, using up as many extra # columns as there are references for the paper. # # The script also tries to complete the citation information for each # paper, scanning through the references to add relevant citations to # the papers contained in this dataset. import json import sys def partialDOIMatch(d1, d2): """ Assumes d1 is a "full DOI", like '10.1145/1166253.1166292', and d2 is a partial DOI, like '1166292' or '1166253.1166292'. Returns true if they match and false otherwise. Note that in the previous case, a partial like '292' would be a negative match. The partial must contain full subsections. """ if (d2.find('.') >= 0): return d2 == d1.split('/')[-1] return d2 == d1.split('.')[-1] if __name__ == "__main__": if len(sys.argv) != 3: print "Usage: python chi-to-json.py <papers.tsv> <citation_counts.json>" exit (1); input_file = open(sys.argv[1]) papers = {} for line in input_file.readlines(): # Drop whitespace at the end, and split on tabs. vals = line.rstrip().split('\t') # Build a new dictionary with the values for the paper. paper = {} paper['conference'] = vals[0] paper['year'] = vals[1] paper['title'] = vals[2] paper['abstract'] = vals[3] paper['authors'] = vals[4].split('~') # paper['doi'] = vals[5] paper['references'] = vals[6:] paper['citations'] = [] paper['citation_count'] = 0 # All papers have a 0 CC by default # Index papers by doi to set up for building citations. papers[vals[5]] = paper input_file.close() # Once we have a dictionary with all papers, go through them again # building the citations for doi, paper in papers.iteritems(): for ref in paper['references']: try: papers[ref]['citations'].append(doi) except KeyError: # Skip this one, there's no paper with that doi in our dataset. #print "Not found " + ref pass # For debugging: number of references and citations in the whole # dataset. If the dataset is self-contained, these numbers should # be the same. #print len(papers) #print reduce(lambda x,y: x+y, [len(p['references']) for p in papers.values()]) #print reduce(lambda x,y: x+y, [len(p['citations']) for p in papers.values()]) ccs = None with open(sys.argv[2]) as citation_counts_json: ccs = json.loads(citation_counts_json.read()) # The following process adds citation count information to every # paper that can be found on the specified file. This is a slow # process because we don't use the hash function in dict, but it # shouldn't have to run frequently. for d2 in ccs.keys(): matches = [d1 for d1 in papers.keys() if partialDOIMatch(d1, d2)] if matches: papers[matches[0]]['citation_count'] = ccs[d2]['citation_count'] # Write out a JSON object with everything in it. print json.dumps({'papers': papers})
[ 1, 835, 13383, 13383, 13383, 13383, 7346, 4136, 29937, 13, 29937, 29871, 13, 29937, 1459, 29879, 267, 263, 4434, 29899, 25048, 630, 8783, 934, 310, 15055, 515, 5868, 29902, 322, 3740, 1254, 322, 13, 29937, 12169, 372, 964, 4663, 29889, 29871, 7806, 1948, 297, 278, 934, 756, 278, 4341, 29901, 13, 29937, 13, 29937, 29871, 29896, 29889, 21362, 13, 29937, 29871, 29906, 29889, 1629, 13, 29937, 29871, 29941, 29889, 3611, 13, 29937, 29871, 29946, 29889, 9846, 13, 29937, 29871, 29945, 29889, 15717, 13, 29937, 29871, 29953, 29889, 13102, 13, 29937, 29871, 29955, 29889, 9282, 13, 29937, 13, 29937, 988, 15717, 338, 310, 278, 883, 4148, 29896, 30022, 8921, 29906, 30022, 856, 30022, 8921, 29940, 322, 278, 13, 29937, 9282, 526, 13102, 29915, 29879, 310, 916, 25964, 29892, 773, 701, 408, 1784, 4805, 13, 29937, 4341, 408, 727, 526, 9282, 363, 278, 5650, 29889, 13, 29937, 13, 29937, 450, 2471, 884, 14335, 304, 4866, 278, 274, 7018, 2472, 363, 1269, 13, 29937, 5650, 29892, 885, 9450, 1549, 278, 9282, 304, 788, 8018, 7537, 800, 304, 13, 29937, 278, 15055, 11122, 297, 445, 8783, 29889, 13, 13, 5215, 4390, 13, 5215, 10876, 13, 13, 13, 1753, 7687, 3970, 7833, 905, 29898, 29881, 29896, 29892, 270, 29906, 1125, 13, 1678, 9995, 13, 1678, 4007, 9351, 270, 29896, 338, 263, 376, 8159, 11662, 29902, 613, 763, 525, 29896, 29900, 29889, 29896, 29896, 29946, 29945, 29914, 29896, 29896, 29953, 29953, 29906, 29945, 29941, 29889, 29896, 29896, 29953, 29953, 29906, 29929, 29906, 742, 322, 270, 29906, 13, 1678, 338, 263, 7687, 11662, 29902, 29892, 763, 525, 29896, 29896, 29953, 29953, 29906, 29929, 29906, 29915, 470, 525, 29896, 29896, 29953, 29953, 29906, 29945, 29941, 29889, 29896, 29896, 29953, 29953, 29906, 29929, 29906, 4286, 29871, 16969, 1565, 13, 1678, 565, 896, 1993, 322, 2089, 6467, 29889, 13, 13, 1678, 3940, 393, 297, 278, 3517, 1206, 29892, 263, 7687, 763, 525, 29906, 29929, 29906, 29915, 723, 367, 263, 13, 1678, 8178, 1993, 29889, 29871, 450, 7687, 1818, 1712, 2989, 1014, 27117, 29889, 13, 1678, 9995, 13, 1678, 565, 313, 29881, 29906, 29889, 2886, 12839, 1495, 6736, 29871, 29900, 1125, 13, 4706, 736, 270, 29906, 1275, 270, 29896, 29889, 5451, 11219, 1495, 14352, 29896, 29962, 13, 1678, 736, 270, 29906, 1275, 270, 29896, 29889, 5451, 12839, 1495, 14352, 29896, 29962, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 565, 7431, 29898, 9675, 29889, 19218, 29897, 2804, 29871, 29941, 29901, 13, 4706, 1596, 376, 27573, 29901, 3017, 18558, 29899, 517, 29899, 3126, 29889, 2272, 529, 29886, 21321, 29889, 1372, 29894, 29958, 529, 29883, 7018, 29918, 2798, 29879, 29889, 3126, 11903, 13, 4706, 6876, 313, 29896, 416, 13, 13, 1678, 1881, 29918, 1445, 353, 1722, 29898, 9675, 29889, 19218, 29961, 29896, 2314, 13, 1678, 15055, 353, 6571, 13, 13, 1678, 363, 1196, 297, 1881, 29918, 1445, 29889, 949, 9012, 7295, 13, 4706, 396, 20724, 24358, 472, 278, 1095, 29892, 322, 6219, 373, 18859, 29889, 13, 4706, 659, 29879, 353, 1196, 29889, 29878, 17010, 2141, 5451, 28909, 29873, 1495, 13, 13, 4706, 396, 8878, 263, 716, 8600, 411, 278, 1819, 363, 278, 5650, 29889, 13, 4706, 5650, 353, 6571, 13, 4706, 5650, 1839, 535, 1659, 2033, 268, 353, 659, 29879, 29961, 29900, 29962, 13, 4706, 5650, 1839, 6360, 2033, 965, 353, 659, 29879, 29961, 29896, 29962, 13, 4706, 5650, 1839, 3257, 2033, 3986, 353, 659, 29879, 29961, 29906, 29962, 13, 4706, 5650, 1839, 16595, 2033, 539, 353, 659, 29879, 29961, 29941, 29962, 13, 4706, 5650, 1839, 5150, 943, 2033, 4706, 353, 659, 29879, 29961, 29946, 1822, 5451, 877, 30022, 1495, 13, 4706, 396, 5650, 1839, 1867, 29875, 2033, 3986, 353, 659, 29879, 29961, 29945, 29962, 13, 4706, 5650, 1839, 276, 10662, 2033, 268, 353, 659, 29879, 29961, 29953, 17531, 13, 4706, 5650, 1839, 20752, 800, 2033, 418, 353, 5159, 13, 4706, 5650, 1839, 29883, 7018, 29918, 2798, 2033, 353, 29871, 29900, 29871, 396, 2178, 15055, 505, 263, 29871, 29900, 19178, 491, 2322, 13, 13, 4706, 396, 11374, 15055, 491, 13102, 304, 731, 701, 363, 5214, 7537, 800, 29889, 13, 4706, 15055, 29961, 791, 29879, 29961, 29945, 5262, 353, 5650, 13, 13, 1678, 1881, 29918, 1445, 29889, 5358, 580, 13, 13, 1678, 396, 9038, 591, 505, 263, 8600, 411, 599, 15055, 29892, 748, 1549, 963, 1449, 13, 1678, 396, 5214, 278, 7537, 800, 13, 1678, 363, 13102, 29892, 5650, 297, 15055, 29889, 1524, 7076, 7295, 13, 4706, 363, 2143, 297, 5650, 1839, 276, 10662, 2033, 29901, 13, 9651, 1018, 29901, 13, 18884, 15055, 29961, 999, 22322, 20752, 800, 13359, 4397, 29898, 1867, 29875, 29897, 13, 9651, 5174, 7670, 2392, 29901, 13, 18884, 396, 4971, 666, 445, 697, 29892, 727, 29915, 29879, 694, 5650, 411, 393, 13102, 297, 1749, 8783, 29889, 13, 18884, 396, 2158, 376, 3664, 1476, 376, 718, 2143, 13, 18884, 1209, 13, 13, 1678, 396, 1152, 13490, 29901, 1353, 310, 9282, 322, 7537, 800, 297, 278, 3353, 13, 1678, 396, 8783, 29889, 29871, 960, 278, 8783, 338, 1583, 29899, 1285, 7114, 29892, 1438, 3694, 881, 13, 1678, 396, 367, 278, 1021, 29889, 13, 1678, 396, 2158, 7431, 29898, 29886, 21321, 29897, 13, 1678, 396, 2158, 10032, 29898, 2892, 921, 29892, 29891, 29901, 921, 29974, 29891, 29892, 518, 2435, 29898, 29886, 1839, 276, 10662, 11287, 363, 282, 297, 15055, 29889, 5975, 580, 2314, 13, 1678, 396, 2158, 10032, 29898, 2892, 921, 29892, 29891, 29901, 921, 29974, 29891, 29892, 518, 2435, 29898, 29886, 1839, 20752, 800, 11287, 363, 282, 297, 15055, 29889, 5975, 580, 2314, 13, 13, 1678, 274, 2395, 353, 6213, 13, 1678, 411, 1722, 29898, 9675, 29889, 19218, 29961, 29906, 2314, 408, 274, 7018, 29918, 2798, 29879, 29918, 3126, 29901, 13, 539, 274, 2395, 353, 4390, 29889, 18132, 29898, 29883, 7018, 29918, 2798, 29879, 29918, 3126, 29889, 949, 3101, 13, 13, 1678, 396, 450, 1494, 1889, 12778, 274, 7018, 2302, 2472, 304, 1432, 13, 1678, 396, 5650, 393, 508, 367, 1476, 373, 278, 6790, 934, 29889, 29871, 910, 338, 263, 5232, 13, 1678, 396, 1889, 1363, 591, 1016, 29915, 29873, 671, 278, 6608, 740, 297, 9657, 29892, 541, 372, 13, 1678, 396, 9273, 29915, 29873, 505, 304, 1065, 13672, 29889, 13, 1678, 363, 270, 29906, 297, 274, 2395, 29889, 8149, 7295, 13, 4706, 7087, 353, 518, 29881, 29896, 363, 270, 29896, 297, 15055, 29889, 8149, 580, 565, 7687, 3970, 7833, 905, 29898, 29881, 29896, 29892, 270, 29906, 4638, 13, 4706, 565, 7087, 29901, 13, 9651, 15055, 29961, 20317, 29961, 29900, 5262, 1839, 29883, 7018, 29918, 2798, 2033, 353, 274, 2395, 29961, 29881, 29906, 22322, 29883, 7018, 29918, 2798, 2033, 13, 13, 1678, 396, 14350, 714, 263, 4663, 1203, 411, 4129, 297, 372, 29889, 13, 1678, 1596, 4390, 29889, 29881, 17204, 3319, 29915, 29886, 21321, 2396, 15055, 1800, 13, 2 ]
python/q904/q904.py
MatthewTsan/Leetcode
0
169773
from typing import List """ keyPoint: sliding window. facing problems with multiple same numbers: consider sum it up. """ class Solution: def totalFruit(self, tree: List[int]) -> int: if len(tree) == 0: return 0 treeList = [] totalNumber = 1 for i in range(len(tree) - 1): if tree[i] == tree[i + 1]: totalNumber += 1 else: treeList.append((tree[i], totalNumber)) totalNumber = 1 treeList.append((tree[-1], totalNumber)) print(treeList) if(len(treeList) == 1): return treeList[0][1] i = 2 inBusket = [treeList[0][0], treeList[1][0]] temWeight = treeList[0][1] + treeList[1][1] maxWeight = temWeight while (i < len(treeList)): print(i) print("inBusket:", inBusket) print("temWeight:", temWeight) print("max:", maxWeight) if treeList[i][0] in inBusket: temWeight += treeList[i][1] else: maxWeight = max(temWeight, maxWeight) inBusket = [treeList[i - 1][0], treeList[i][0]] temWeight = treeList[i - 1][1] + treeList[i][1] i += 1 maxWeight = max(temWeight, maxWeight) return maxWeight if __name__ == '__main__': sol = Solution() list = [1, 1,1,1,1,1] res = sol.totalFruit(list) print(res)
[ 1, 515, 19229, 1053, 2391, 13, 13, 15945, 29908, 13, 1989, 5228, 29901, 13, 1678, 2243, 4821, 3474, 29889, 14870, 4828, 411, 2999, 1021, 3694, 29901, 2050, 2533, 372, 701, 29889, 13, 15945, 29908, 13, 13, 13, 13, 1990, 24380, 29901, 13, 1678, 822, 3001, 29943, 9216, 29898, 1311, 29892, 5447, 29901, 2391, 29961, 524, 2314, 1599, 938, 29901, 13, 4706, 565, 7431, 29898, 8336, 29897, 1275, 29871, 29900, 29901, 13, 9651, 736, 29871, 29900, 13, 13, 4706, 5447, 1293, 353, 5159, 13, 4706, 3001, 4557, 353, 29871, 29896, 13, 4706, 363, 474, 297, 3464, 29898, 2435, 29898, 8336, 29897, 448, 29871, 29896, 1125, 13, 9651, 565, 5447, 29961, 29875, 29962, 1275, 5447, 29961, 29875, 718, 29871, 29896, 5387, 13, 18884, 3001, 4557, 4619, 29871, 29896, 13, 9651, 1683, 29901, 13, 18884, 5447, 1293, 29889, 4397, 3552, 8336, 29961, 29875, 1402, 3001, 4557, 876, 13, 18884, 3001, 4557, 353, 29871, 29896, 13, 4706, 5447, 1293, 29889, 4397, 3552, 8336, 14352, 29896, 1402, 3001, 4557, 876, 13, 4706, 1596, 29898, 8336, 1293, 29897, 13, 13, 4706, 565, 29898, 2435, 29898, 8336, 1293, 29897, 1275, 29871, 29896, 1125, 13, 9651, 736, 5447, 1293, 29961, 29900, 3816, 29896, 29962, 13, 13, 4706, 474, 353, 29871, 29906, 13, 4706, 297, 16890, 7873, 353, 518, 8336, 1293, 29961, 29900, 3816, 29900, 1402, 5447, 1293, 29961, 29896, 3816, 29900, 5262, 13, 4706, 1350, 22676, 353, 5447, 1293, 29961, 29900, 3816, 29896, 29962, 718, 5447, 1293, 29961, 29896, 3816, 29896, 29962, 13, 4706, 4236, 22676, 353, 1350, 22676, 13, 4706, 1550, 313, 29875, 529, 7431, 29898, 8336, 1293, 22164, 13, 9651, 1596, 29898, 29875, 29897, 13, 9651, 1596, 703, 262, 16890, 7873, 29901, 613, 297, 16890, 7873, 29897, 13, 9651, 1596, 703, 1356, 22676, 29901, 613, 1350, 22676, 29897, 13, 9651, 1596, 703, 3317, 29901, 613, 4236, 22676, 29897, 13, 9651, 565, 5447, 1293, 29961, 29875, 3816, 29900, 29962, 297, 297, 16890, 7873, 29901, 13, 18884, 1350, 22676, 4619, 5447, 1293, 29961, 29875, 3816, 29896, 29962, 13, 9651, 1683, 29901, 13, 18884, 4236, 22676, 353, 4236, 29898, 1356, 22676, 29892, 4236, 22676, 29897, 13, 18884, 297, 16890, 7873, 353, 518, 8336, 1293, 29961, 29875, 448, 29871, 29896, 3816, 29900, 1402, 5447, 1293, 29961, 29875, 3816, 29900, 5262, 13, 18884, 1350, 22676, 353, 5447, 1293, 29961, 29875, 448, 29871, 29896, 3816, 29896, 29962, 718, 5447, 1293, 29961, 29875, 3816, 29896, 29962, 13, 9651, 474, 4619, 29871, 29896, 13, 4706, 4236, 22676, 353, 4236, 29898, 1356, 22676, 29892, 4236, 22676, 29897, 13, 13, 4706, 736, 4236, 22676, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 899, 353, 24380, 580, 13, 1678, 1051, 353, 518, 29896, 29892, 29871, 29896, 29892, 29896, 29892, 29896, 29892, 29896, 29892, 29896, 29962, 13, 1678, 620, 353, 899, 29889, 7827, 29943, 9216, 29898, 1761, 29897, 13, 1678, 1596, 29898, 690, 29897, 13, 2 ]
LaylaCoin/main.py
Bhaney44/AlgorandDevelopment
0
118244
<gh_stars>0 #Imports from config import * from algosdk.v2client import algod from algosdk import account, mnemonic from algosdk.future.transaction import write_to_file from algosdk.future.transaction import AssetConfigTxn, AssetTransferTxn from util import sign_and_send, balance_formatter from algosdk.future.transaction import AssetTransferTxn # Client # client = algod.AlgodClient(algod_token, algod_address) client = algod.AlgodClient("", algod_address, headers={'User-Agent': 'DoYouLoveMe?'}) # Create function. # Returns an unsigned txn object and writes the unsigned transaction object to a file for offline signing. # Uses current network params. def create(passphrase=None): params = client.suggested_params() txn = AssetConfigTxn(creator_address, params, **asset_details) if passphrase: txinfo = sign_and_send(txn, passphrase, client) asset_id = txinfo.get('asset-index') print("Asset ID: {}".format(asset_id)) else: write_to_file([txn], "create_coin.txn") # Creates an unsigned opt-in transaction for the specified asset id and address. # Uses current network params. def optin(passphrase=None): params = client.suggested_params() txn = AssetTransferTxn(sender=receiver_address, sp=params, receiver=receiver_address, amt=0, index=asset_id) if passphrase: txinfo = sign_and_send(txn, passphrase, client) print("Opted in to asset ID: {}".format(asset_id)) else: write_to_file([txns], "optin.txn") # Creates an unsigned transfer transaction for the specified asset id, to the specified address, for the specified amount. #def transfer(passphrase=None): #amount = 6000 #params = client.suggested_params() #txn = AssetTransferTxn(sender=creator_address, sp=params, receiver=receiver_address, amt=amount, index=asset_id) #if passphrase: #txinfo = sign_and_send(txn, passphrase, client) #formatted_amount = balance_formatter(amount, asset_id, client) #print("Transferred {} from {} to {}".format(formatted_amount, #creator_address, receiver_address)) #print("Transaction ID Confirmation: {}".format(txinfo.get("tx"))) #else: #write_to_file([txns], "transfer.txn") def transfer(passphrase=None): amount = 6000 params = client.suggested_params() txn = AssetTransferTxn(sender=creator_address, sp=params, receiver=receiver_address, amt=amount, index=asset_id) if passphrase: txinfo = sign_and_send(txn, passphrase, client) formatted_amount = balance_formatter(amount, asset_id, client) print("Transferred {} from {} to {}".format(formatted_amount, creator_address, receiver_address)) print("Transaction ID Confirmation: {}".format(txinfo.get("tx"))) else: write_to_file([txns], "transfer.txn") # Checks the asset balance for the specific address and asset id. def check_holdings(asset_id, address): account_info = client.account_info(address) assets = account_info.get("assets") for asset in assets: if asset['asset-id'] == asset_id: amount = asset.get("amount") print("Account {} has {}.".format(address, balance_formatter(amount, asset_id, client))) return print("Account {} must opt-in to Asset ID {}.".format(address, asset_id)) # Creates an unsigned opt-in transaction for the specified asset id and address. # Uses current network params. def optin(passphrase=None): params = client.suggested_params() txn = AssetTransferTxn(sender=receiver_address, sp=params, receiver=receiver_address, amt=0, index=asset_id) if passphrase: txinfo = sign_and_send(txn, passphrase, client) print("Opted in to asset ID: {}".format(asset_id)) else: write_to_file([txns], "optin.txn") from util import balance_formatter # Checks the asset balance for the specific address and asset id. def check_holdings(asset_id, address): account_info = client.account_info(address) assets = account_info.get("assets") for asset in assets: if asset['asset-id'] == asset_id: amount = asset.get("amount") print("Account {} has {}.".format(address, balance_formatter(amount, asset_id, client))) return print("Account {} must opt-in to Asset ID {}.".format(address, asset_id)) # Creates an unsigned transfer transaction for the specified asset id, to the specified address, for the specified amount. def transfer(passphrase=None): amount = 6000 params = client.suggested_params() txn = AssetTransferTxn(sender=creator_address, sp=params, receiver=receiver_address, amt=amount, index=asset_id) if passphrase: txinfo = sign_and_send(txn, passphrase, client) formatted_amount = balance_formatter(amount, asset_id, client) print("Transferred {} from {} to {}".format(formatted_amount, creator_address, receiver_address)) print("Transaction ID Confirmation: {}".format(txinfo.get("tx"))) else: write_to_file([txns], "transfer.txn")
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 29937, 1888, 4011, 13, 3166, 2295, 1053, 334, 13, 3166, 3093, 359, 8181, 29889, 29894, 29906, 4645, 1053, 3093, 397, 13, 3166, 3093, 359, 8181, 1053, 3633, 29892, 286, 15344, 8927, 13, 3166, 3093, 359, 8181, 29889, 29888, 9130, 29889, 20736, 1053, 2436, 29918, 517, 29918, 1445, 13, 3166, 3093, 359, 8181, 29889, 29888, 9130, 29889, 20736, 1053, 1094, 842, 3991, 29911, 29916, 29876, 29892, 1094, 842, 4300, 571, 29911, 29916, 29876, 13, 3166, 3667, 1053, 1804, 29918, 392, 29918, 6717, 29892, 17346, 29918, 689, 2620, 13, 3166, 3093, 359, 8181, 29889, 29888, 9130, 29889, 20736, 1053, 1094, 842, 4300, 571, 29911, 29916, 29876, 13, 13, 13, 29937, 12477, 13, 29937, 3132, 353, 3093, 397, 29889, 2499, 17083, 4032, 29898, 9564, 397, 29918, 6979, 29892, 3093, 397, 29918, 7328, 29897, 13, 4645, 353, 3093, 397, 29889, 2499, 17083, 4032, 703, 613, 3093, 397, 29918, 7328, 29892, 9066, 3790, 29915, 2659, 29899, 19661, 2396, 525, 6132, 3492, 29931, 994, 6816, 17901, 1800, 13, 13, 29937, 6204, 740, 29889, 13, 29937, 16969, 385, 12780, 25568, 29876, 1203, 322, 15873, 278, 12780, 10804, 1203, 304, 263, 934, 363, 1283, 1220, 26188, 29889, 29871, 13, 29937, 10783, 267, 1857, 3564, 8636, 29889, 13, 1753, 1653, 29898, 3364, 24588, 559, 29922, 8516, 1125, 13, 12, 7529, 353, 3132, 29889, 29879, 12981, 2868, 29918, 7529, 580, 13, 12, 7508, 29876, 353, 1094, 842, 3991, 29911, 29916, 29876, 29898, 1037, 1061, 29918, 7328, 29892, 8636, 29892, 3579, 24129, 29918, 14144, 29897, 13, 12, 361, 1209, 24588, 559, 29901, 13, 12, 12, 7508, 3888, 353, 1804, 29918, 392, 29918, 6717, 29898, 7508, 29876, 29892, 1209, 24588, 559, 29892, 3132, 29897, 13, 12, 12, 24129, 29918, 333, 353, 25568, 3888, 29889, 657, 877, 24129, 29899, 2248, 1495, 13, 12, 12, 2158, 703, 26405, 3553, 29901, 6571, 1642, 4830, 29898, 24129, 29918, 333, 876, 13, 12, 2870, 29901, 13, 12, 12, 3539, 29918, 517, 29918, 1445, 4197, 7508, 29876, 1402, 376, 3258, 29918, 1111, 262, 29889, 7508, 29876, 1159, 13, 13, 29937, 6760, 1078, 385, 12780, 3523, 29899, 262, 10804, 363, 278, 6790, 24342, 1178, 322, 3211, 29889, 29871, 13, 29937, 10783, 267, 1857, 3564, 8636, 29889, 13, 1753, 3523, 262, 29898, 3364, 24588, 559, 29922, 8516, 1125, 13, 12, 7529, 353, 3132, 29889, 29879, 12981, 2868, 29918, 7529, 580, 13, 12, 7508, 29876, 353, 1094, 842, 4300, 571, 29911, 29916, 29876, 29898, 15452, 29922, 13556, 2147, 29918, 7328, 29892, 805, 29922, 7529, 29892, 19870, 29922, 13556, 2147, 29918, 7328, 29892, 626, 29873, 29922, 29900, 29892, 2380, 29922, 24129, 29918, 333, 29897, 13, 12, 361, 1209, 24588, 559, 29901, 13, 12, 12, 7508, 3888, 353, 1804, 29918, 392, 29918, 6717, 29898, 7508, 29876, 29892, 1209, 24588, 559, 29892, 3132, 29897, 13, 12, 12, 2158, 703, 20624, 287, 297, 304, 24342, 3553, 29901, 6571, 1642, 4830, 29898, 24129, 29918, 333, 876, 13, 12, 2870, 29901, 13, 12, 12, 3539, 29918, 517, 29918, 1445, 4197, 7508, 1983, 1402, 376, 3670, 262, 29889, 7508, 29876, 1159, 13, 13, 29937, 6760, 1078, 385, 12780, 6782, 10804, 363, 278, 6790, 24342, 1178, 29892, 304, 278, 6790, 3211, 29892, 363, 278, 6790, 5253, 29889, 13, 29937, 1753, 6782, 29898, 3364, 24588, 559, 29922, 8516, 1125, 13, 12, 29937, 14506, 353, 29871, 29953, 29900, 29900, 29900, 13, 12, 29937, 7529, 353, 3132, 29889, 29879, 12981, 2868, 29918, 7529, 580, 13, 12, 29937, 7508, 29876, 353, 1094, 842, 4300, 571, 29911, 29916, 29876, 29898, 15452, 29922, 1037, 1061, 29918, 7328, 29892, 805, 29922, 7529, 29892, 19870, 29922, 13556, 2147, 29918, 7328, 29892, 626, 29873, 29922, 14506, 29892, 2380, 29922, 24129, 29918, 333, 29897, 13, 12, 29937, 361, 1209, 24588, 559, 29901, 13, 12, 12, 29937, 7508, 3888, 353, 1804, 29918, 392, 29918, 6717, 29898, 7508, 29876, 29892, 1209, 24588, 559, 29892, 3132, 29897, 13, 12, 12, 29937, 689, 19667, 29918, 14506, 353, 17346, 29918, 689, 2620, 29898, 14506, 29892, 24342, 29918, 333, 29892, 3132, 29897, 13, 12, 12, 29937, 2158, 703, 4300, 14373, 6571, 515, 6571, 304, 6571, 1642, 4830, 29898, 689, 19667, 29918, 14506, 29892, 29871, 13, 12, 12, 12, 29937, 1037, 1061, 29918, 7328, 29892, 19870, 29918, 7328, 876, 13, 12, 12, 29937, 2158, 703, 12460, 3553, 10811, 3568, 362, 29901, 6571, 1642, 4830, 29898, 7508, 3888, 29889, 657, 703, 7508, 29908, 4961, 13, 12, 29937, 2870, 29901, 13, 12, 12, 29937, 3539, 29918, 517, 29918, 1445, 4197, 7508, 1983, 1402, 376, 3286, 571, 29889, 7508, 29876, 1159, 13, 13, 1753, 6782, 29898, 3364, 24588, 559, 29922, 8516, 1125, 13, 13, 1678, 5253, 353, 29871, 29953, 29900, 29900, 29900, 13, 1678, 8636, 353, 3132, 29889, 29879, 12981, 2868, 29918, 7529, 580, 13, 1678, 25568, 29876, 353, 1094, 842, 4300, 571, 29911, 29916, 29876, 29898, 15452, 29922, 1037, 1061, 29918, 7328, 29892, 805, 29922, 7529, 29892, 19870, 29922, 13556, 2147, 29918, 7328, 29892, 626, 29873, 29922, 14506, 29892, 2380, 29922, 24129, 29918, 333, 29897, 13, 1678, 565, 1209, 24588, 559, 29901, 13, 4706, 25568, 3888, 353, 1804, 29918, 392, 29918, 6717, 29898, 7508, 29876, 29892, 1209, 24588, 559, 29892, 3132, 29897, 13, 4706, 20917, 29918, 14506, 353, 17346, 29918, 689, 2620, 29898, 14506, 29892, 24342, 29918, 333, 29892, 3132, 29897, 13, 4706, 1596, 703, 4300, 14373, 6571, 515, 6571, 304, 6571, 1642, 4830, 29898, 689, 19667, 29918, 14506, 29892, 29871, 13, 9651, 907, 1061, 29918, 7328, 29892, 19870, 29918, 7328, 876, 13, 4706, 1596, 703, 12460, 3553, 10811, 3568, 362, 29901, 6571, 1642, 4830, 29898, 7508, 3888, 29889, 657, 703, 7508, 29908, 4961, 13, 1678, 1683, 29901, 13, 4706, 2436, 29918, 517, 29918, 1445, 4197, 7508, 1983, 1402, 376, 3286, 571, 29889, 7508, 29876, 1159, 13, 13, 29937, 5399, 29879, 278, 24342, 17346, 363, 278, 2702, 3211, 322, 24342, 1178, 29889, 13, 1753, 1423, 29918, 8948, 886, 29898, 24129, 29918, 333, 29892, 3211, 1125, 13, 12, 10149, 29918, 3888, 353, 3132, 29889, 10149, 29918, 3888, 29898, 7328, 29897, 13, 12, 16596, 353, 3633, 29918, 3888, 29889, 657, 703, 16596, 1159, 13, 12, 1454, 24342, 297, 21608, 29901, 13, 12, 12, 361, 24342, 1839, 24129, 29899, 333, 2033, 1275, 24342, 29918, 333, 29901, 13, 12, 12, 12, 14506, 353, 24342, 29889, 657, 703, 14506, 1159, 13, 12, 12, 12, 2158, 703, 10601, 6571, 756, 6571, 1213, 29889, 4830, 29898, 7328, 29892, 17346, 29918, 689, 2620, 29898, 14506, 29892, 24342, 29918, 333, 29892, 3132, 4961, 13, 12, 12, 12, 2457, 13, 12, 2158, 703, 10601, 6571, 1818, 3523, 29899, 262, 304, 1094, 842, 3553, 6571, 1213, 29889, 4830, 29898, 7328, 29892, 24342, 29918, 333, 876, 13, 13, 13, 29937, 6760, 1078, 385, 12780, 3523, 29899, 262, 10804, 363, 278, 6790, 24342, 1178, 322, 3211, 29889, 29871, 13, 29937, 10783, 267, 1857, 3564, 8636, 29889, 13, 1753, 3523, 262, 29898, 3364, 24588, 559, 29922, 8516, 1125, 13, 1678, 8636, 353, 3132, 29889, 29879, 12981, 2868, 29918, 7529, 580, 13, 1678, 25568, 29876, 353, 1094, 842, 4300, 571, 29911, 29916, 29876, 29898, 15452, 29922, 13556, 2147, 29918, 7328, 29892, 805, 29922, 7529, 29892, 19870, 29922, 13556, 2147, 29918, 7328, 29892, 626, 29873, 29922, 29900, 29892, 2380, 29922, 24129, 29918, 333, 29897, 13, 1678, 565, 1209, 24588, 559, 29901, 13, 4706, 25568, 3888, 353, 1804, 29918, 392, 29918, 6717, 29898, 7508, 29876, 29892, 1209, 24588, 559, 29892, 3132, 29897, 13, 4706, 1596, 703, 20624, 287, 297, 304, 24342, 3553, 29901, 6571, 1642, 4830, 29898, 24129, 29918, 333, 876, 13, 1678, 1683, 29901, 13, 4706, 2436, 29918, 517, 29918, 1445, 4197, 7508, 1983, 1402, 376, 3670, 262, 29889, 7508, 29876, 1159, 13, 12, 13, 3166, 3667, 1053, 17346, 29918, 689, 2620, 13, 13, 29937, 5399, 29879, 278, 24342, 17346, 363, 278, 2702, 3211, 322, 24342, 1178, 29889, 13, 1753, 1423, 29918, 8948, 886, 29898, 24129, 29918, 333, 29892, 3211, 1125, 13, 1678, 3633, 29918, 3888, 353, 3132, 29889, 10149, 29918, 3888, 29898, 7328, 29897, 13, 1678, 21608, 353, 3633, 29918, 3888, 29889, 657, 703, 16596, 1159, 13, 1678, 363, 24342, 297, 21608, 29901, 13, 4706, 565, 24342, 1839, 24129, 29899, 333, 2033, 1275, 24342, 29918, 333, 29901, 13, 9651, 5253, 353, 24342, 29889, 657, 703, 14506, 1159, 13, 9651, 1596, 703, 10601, 6571, 756, 6571, 1213, 29889, 4830, 29898, 7328, 29892, 17346, 29918, 689, 2620, 29898, 14506, 29892, 24342, 29918, 333, 29892, 3132, 4961, 13, 9651, 736, 13, 1678, 1596, 703, 10601, 6571, 1818, 3523, 29899, 262, 304, 1094, 842, 3553, 6571, 1213, 29889, 4830, 29898, 7328, 29892, 24342, 29918, 333, 876, 13, 13, 13, 29937, 6760, 1078, 385, 12780, 6782, 10804, 363, 278, 6790, 24342, 1178, 29892, 304, 278, 6790, 3211, 29892, 363, 278, 6790, 5253, 29889, 13, 1753, 6782, 29898, 3364, 24588, 559, 29922, 8516, 1125, 13, 13, 1678, 5253, 353, 29871, 29953, 29900, 29900, 29900, 13, 1678, 8636, 353, 3132, 29889, 29879, 12981, 2868, 29918, 7529, 580, 13, 1678, 25568, 29876, 353, 1094, 842, 4300, 571, 29911, 29916, 29876, 29898, 15452, 29922, 1037, 1061, 29918, 7328, 29892, 805, 29922, 7529, 29892, 19870, 29922, 13556, 2147, 29918, 7328, 29892, 626, 29873, 29922, 14506, 29892, 2380, 29922, 24129, 29918, 333, 29897, 13, 1678, 565, 1209, 24588, 559, 29901, 13, 4706, 25568, 3888, 353, 1804, 29918, 392, 29918, 6717, 29898, 7508, 29876, 29892, 1209, 24588, 559, 29892, 3132, 29897, 13, 4706, 20917, 29918, 14506, 353, 17346, 29918, 689, 2620, 29898, 14506, 29892, 24342, 29918, 333, 29892, 3132, 29897, 13, 4706, 1596, 703, 4300, 14373, 6571, 515, 6571, 304, 6571, 1642, 4830, 29898, 689, 19667, 29918, 14506, 29892, 29871, 13, 9651, 907, 1061, 29918, 7328, 29892, 19870, 29918, 7328, 876, 13, 4706, 1596, 703, 12460, 3553, 10811, 3568, 362, 29901, 6571, 1642, 4830, 29898, 7508, 3888, 29889, 657, 703, 7508, 29908, 4961, 13, 1678, 1683, 29901, 13, 4706, 2436, 29918, 517, 29918, 1445, 4197, 7508, 1983, 1402, 376, 3286, 571, 29889, 7508, 29876, 1159, 2 ]
ptstat/dist/uniform.py
timmyzhao/ptstat
116
86080
import torch from torch.autograd import Variable from ptstat.core import RandomVariable, _to_v # TODO: Implement Uniform(a, b) constructor. class Uniform(RandomVariable): """ Uniform(0, 1) iid rv. """ def __init__(self, size, cuda=False): super(Uniform, self).__init__() assert len(size) == 2, str(size) self._cuda = cuda self._p_size = size def _size(self): return self._p_size def _log_pdf(self, x): return self._entropy() def _sample(self): # TODO: Use CUDA random_ when implemented. y = Variable(torch.FloatTensor(*self._p_size).uniform_()) if self._cuda: y = y.cuda() return y def _entropy(self): return _to_v(0, self._p_size[0], self._cuda)
[ 1, 1053, 4842, 305, 13, 3166, 4842, 305, 29889, 1300, 468, 3665, 1053, 28736, 13, 3166, 19592, 6112, 29889, 3221, 1053, 16968, 16174, 29892, 903, 517, 29918, 29894, 13, 13, 13, 29937, 14402, 29901, 1954, 2037, 853, 5560, 29898, 29874, 29892, 289, 29897, 5823, 29889, 13, 1990, 853, 5560, 29898, 17875, 16174, 1125, 13, 1678, 9995, 13, 1678, 853, 5560, 29898, 29900, 29892, 29871, 29896, 29897, 474, 333, 364, 29894, 29889, 13, 1678, 9995, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 2159, 29892, 274, 6191, 29922, 8824, 1125, 13, 4706, 2428, 29898, 2525, 5560, 29892, 1583, 467, 1649, 2344, 1649, 580, 13, 4706, 4974, 7431, 29898, 2311, 29897, 1275, 29871, 29906, 29892, 851, 29898, 2311, 29897, 13, 4706, 1583, 3032, 29883, 6191, 353, 274, 6191, 13, 4706, 1583, 3032, 29886, 29918, 2311, 353, 2159, 13, 13, 1678, 822, 903, 2311, 29898, 1311, 1125, 13, 4706, 736, 1583, 3032, 29886, 29918, 2311, 13, 13, 1678, 822, 903, 1188, 29918, 5140, 29898, 1311, 29892, 921, 1125, 13, 4706, 736, 1583, 3032, 296, 14441, 580, 13, 13, 1678, 822, 903, 11249, 29898, 1311, 1125, 13, 4706, 396, 14402, 29901, 4803, 315, 29965, 7698, 4036, 29918, 746, 8762, 29889, 13, 4706, 343, 353, 28736, 29898, 7345, 305, 29889, 11031, 29911, 6073, 10456, 1311, 3032, 29886, 29918, 2311, 467, 29590, 29918, 3101, 13, 4706, 565, 1583, 3032, 29883, 6191, 29901, 13, 9651, 343, 353, 343, 29889, 29883, 6191, 580, 13, 4706, 736, 343, 13, 13, 1678, 822, 903, 296, 14441, 29898, 1311, 1125, 13, 4706, 736, 903, 517, 29918, 29894, 29898, 29900, 29892, 1583, 3032, 29886, 29918, 2311, 29961, 29900, 1402, 1583, 3032, 29883, 6191, 29897, 13, 2 ]
migrations/versions/f7570724d06d_increase_length_of_artist_name_column.py
mukul-mehta/C-3PO
34
55320
"""Increase length of artist name column Revision ID: <KEY> Revises: <KEY>8 Create Date: 2020-12-27 00:44:46.286228 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = 'f<PASSWORD>' down_revision = '<KEY>' branch_labels = None depends_on = None def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.alter_column('artist', 'name', existing_type=sa.VARCHAR(length=32), type_=sa.String(length=160), existing_nullable=True) # ### end Alembic commands ### def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.alter_column('artist', 'name', existing_type=sa.String(length=160), type_=sa.VARCHAR(length=32), existing_nullable=True) # ### end Alembic commands ###
[ 1, 9995, 797, 1037, 559, 3309, 310, 7664, 1024, 1897, 13, 13, 1123, 4924, 3553, 29901, 529, 10818, 29958, 13, 1123, 1730, 267, 29901, 529, 10818, 29958, 29947, 13, 4391, 4712, 29901, 29871, 29906, 29900, 29906, 29900, 29899, 29896, 29906, 29899, 29906, 29955, 29871, 29900, 29900, 29901, 29946, 29946, 29901, 29946, 29953, 29889, 29906, 29947, 29953, 29906, 29906, 29947, 13, 13, 15945, 29908, 13, 3166, 20712, 29890, 293, 1053, 1015, 13, 5215, 4576, 284, 305, 6764, 408, 872, 13, 13, 13, 29937, 26554, 2893, 14903, 29892, 1304, 491, 319, 2409, 29890, 293, 29889, 13, 276, 4924, 353, 525, 29888, 29966, 25711, 17013, 16299, 13, 3204, 29918, 276, 4924, 353, 12801, 10818, 16299, 13, 17519, 29918, 21134, 353, 6213, 13, 2716, 1975, 29918, 265, 353, 6213, 13, 13, 13, 1753, 14955, 7295, 13, 1678, 396, 835, 8260, 4469, 5759, 491, 319, 2409, 29890, 293, 448, 3113, 10365, 29991, 835, 13, 1678, 1015, 29889, 13794, 29918, 4914, 877, 442, 391, 742, 525, 978, 742, 13, 1669, 5923, 29918, 1853, 29922, 4977, 29889, 29963, 15364, 29898, 2848, 29922, 29941, 29906, 511, 13, 1669, 1134, 29918, 29922, 4977, 29889, 1231, 29898, 2848, 29922, 29896, 29953, 29900, 511, 13, 1669, 5923, 29918, 4304, 519, 29922, 5574, 29897, 13, 1678, 396, 835, 1095, 319, 2409, 29890, 293, 8260, 835, 13, 13, 13, 1753, 1623, 8228, 7295, 13, 1678, 396, 835, 8260, 4469, 5759, 491, 319, 2409, 29890, 293, 448, 3113, 10365, 29991, 835, 13, 1678, 1015, 29889, 13794, 29918, 4914, 877, 442, 391, 742, 525, 978, 742, 13, 1669, 5923, 29918, 1853, 29922, 4977, 29889, 1231, 29898, 2848, 29922, 29896, 29953, 29900, 511, 13, 1669, 1134, 29918, 29922, 4977, 29889, 29963, 15364, 29898, 2848, 29922, 29941, 29906, 511, 13, 1669, 5923, 29918, 4304, 519, 29922, 5574, 29897, 13, 1678, 396, 835, 1095, 319, 2409, 29890, 293, 8260, 835, 13, 2 ]
slam.py
yycho0108/GraphSlam3D
8
119314
<filename>slam.py<gh_stars>1-10 """ GraphSlam 3D Implementation. TODO : support global initialization (initial pose + landmark estimates) """ import numpy as np from utils import qmath_np def block(ar): """ Convert Block Matrix to Dense Matrix """ ni,nj,nk,nl = ar.shape return np.swapaxes(ar, 1, 2).reshape(ni*nk, nj*nl) def unblock(ar, nknl): """ Convert Dense Matrix to Block Matrix """ nk,nl = nknl nink, njnl = ar.shape ni = nink/nk nj = njnl/nl return ar.reshape(ni,nk,nj,nl).swapaxes(1,2) class GraphSlam3(object): def __init__(self, n_l, l=0.0): self._nodes = {} self._n_l = n_l self._lambda = l def add_edge(self, x, i0, i1): n = self._nodes p0, q0 = qmath_np.x2pq(n[i0]) p1, q1 = qmath_np.x2pq(n[i1]) dp, dq = qmath_np.x2pq(x) Aij, Bij, eij = qmath_np.Aij_Bij_eij(p0,p1,dp,q0,q1,dq) return Aij, Bij, eij def initialize(self, x0): n = 2 + self._n_l # [x0,x1,l0...ln] self._H = np.zeros((n,n,6,6), dtype=np.float64) self._b = np.zeros((n,1,6,1), dtype=np.float64) self._H[0,0] = np.eye(6) self._nodes[0] = x0 # TODO : Are the below initializations necessary? #p, q = qmath_np.x2pq(x0) #x = np.concatenate([p,qmath_np.T(q)], axis=-1) #self._b[0,0,:,0] = x def initialize_n(self, x0s): """ Initialize all nodes with estimates """ for (xi, x) in x0s: self._nodes[xi] = x # TODO : implement # TODO : separate out online / offline classes # with shared base that implements add_edge() / add-node() / initialize() # TODO : consider folding initialize_n into initialize by checking if x0 is iterable in [n,7] def step(self, x=None, ox=None, zs=None): """ Online Version """ # " expand " self._H[1,:] = 0.0 self._H[:,1] = 0.0 self._b[1] = 0.0 zis = [] # updates list # apply motion updates first if x is not None: self._nodes[1] = qmath_np.xadd_rel(self._nodes[0], x, T=False) zis.append(1) #zs.append([0, 1, x, ox]) # TODO : incorporate omega_x somehow # simply adding x0->x1 to zs did not work # H and b are organized as (X0, X1, L0, L1, ...) # where X0 is the previous position, and X1 is the current position. # Such that H[0,..] pertains to X0, and so on. # now with observations ... for (z0, z1, z, o) in zs: zis.append(z1) if z1 not in self._nodes: # initial guess self._nodes[z1] = qmath_np.xadd_rel( self._nodes[z0], z, T=False) # no need to compute deltas for initial guesses # (will be zero) continue Aij, Bij, eij = self.add_edge(z, z0, z1) self._H[z0,z0] += Aij.T.dot(o).dot(Aij) self._H[z0,z1] += Aij.T.dot(o).dot(Bij) self._H[z1,z0] += Bij.T.dot(o).dot(Aij) self._H[z1,z1] += Bij.T.dot(o).dot(Bij) self._b[z0] += Aij.T.dot(o).dot(eij) self._b[z1] += Bij.T.dot(o).dot(eij) H00 = block(self._H[:1,:1]) H01 = block(self._H[:1,1:]) H10 = block(self._H[1:,:1]) H11 = block(self._H[1:,1:]) B00 = block(self._b[:1,:1]) B10 = block(self._b[1:,:1]) AtBi = np.matmul(H10, np.linalg.pinv(H00)) XiP = B10 # fold previous information into new matrix H = H11 - np.matmul(AtBi, H01) B = B10 - np.matmul(AtBi, B00) mI = self._lambda * np.eye(*H.shape) # marquardt damping #dx = np.matmul(np.linalg.pinv(H), -B) dx = np.linalg.lstsq(H+mI,-B, rcond=None)[0] dx = np.reshape(dx, [-1,6]) # [x1, l0, ... ln] for i in zis: self._nodes[i] = qmath_np.xadd_abs(self._nodes[i], dx[i-1]) #for i in range(1, 2+self._n_l): # if i in self._nodes: # self._nodes[i] = qmath_np.xadd(self._nodes[i], dx[i-1]) ##dx2 = np.matmul(np.linalg.pinv(block(self._H)), -block(self._b)) #dx2 = np.linalg.lstsq(block(self._H), -block(self._b), rcond=None)[0] #dx2 = np.reshape(dx2, [-1,6]) ##print 'dx2', dx2[1:] #for i in range(0, 2+self._n_l): # self._nodes[i] = qmath_np.xadd(self._nodes[i], dx2[i]) # replace previous node with current position self._nodes[0] = self._nodes[1].copy() H = unblock(H, (6,6)) B = unblock(B, (6,1)) # assign at appropriate places, with x_0 being updated with x_1 self._H[:1,:1] = H[:1,:1] self._H[:1,2:] = H[:1,1:] self._H[2:,:1] = H[1:,:1] self._H[2:,2:] = H[1:,1:] self._b[:1] = B[:1] self._b[2:] = B[1:] x = [self._nodes[k] for k in sorted(self._nodes.keys())] return x def run(self, zs, max_nodes, n_iter=10, tol=1e-4, debug=False): """ Offline version """ n = max_nodes for it in range(n_iter): # iterate 10 times for convergence H = np.zeros((n,n,6,6), dtype=np.float64) b = np.zeros((n,1,6,1), dtype=np.float64) for (z0, z1, z, o) in zs: if z1 not in self._nodes: # add initial guess to node self._nodes[z1] = qmath_np.xadd_rel(self._nodes[z0], z, T=False) Aij, Bij, eij = self.add_edge(z, z0, z1) H[z0,z0] += Aij.T.dot(o).dot(Aij) H[z0,z1] += Aij.T.dot(o).dot(Bij) H[z1,z0] += Bij.T.dot(o).dot(Aij) H[z1,z1] += Bij.T.dot(o).dot(Bij) b[z0] += Aij.T.dot(o).dot(eij) b[z1] += Bij.T.dot(o).dot(eij) H[0,0] += np.eye(6) H = block(H) b = block(b) # solve ... # marquardt - somehow makes it worse or something #mI = self._lambda * np.eye(*H.shape) #dx = np.linalg.lstsq(H+mI,-b, rcond=None)[0] dx = np.linalg.lstsq(H,-b, rcond=None)[0] dx = np.reshape(dx, [-1,6]) # update for i in range(max_nodes): if i in self._nodes: self._nodes[i] = qmath_np.xadd_abs(self._nodes[i], dx[i]) # check convergence delta = np.mean(np.square(dx)) if debug: print('delta', delta) if delta < tol: break x = [self._nodes[k] for k in sorted(self._nodes.keys())] return x
[ 1, 529, 9507, 29958, 2536, 314, 29889, 2272, 29966, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 15945, 29908, 13, 9527, 29903, 5288, 29871, 29941, 29928, 1954, 14607, 29889, 13, 13, 4986, 3970, 584, 2304, 5534, 17865, 313, 11228, 18593, 718, 2982, 3502, 21875, 29897, 13, 15945, 29908, 13, 5215, 12655, 408, 7442, 13, 3166, 3667, 29879, 1053, 3855, 755, 29918, 9302, 13, 13, 1753, 2908, 29898, 279, 1125, 13, 1678, 9995, 14806, 15658, 22513, 304, 360, 1947, 22513, 9995, 13, 1678, 6836, 29892, 29876, 29926, 29892, 29876, 29895, 29892, 12938, 353, 564, 29889, 12181, 13, 1678, 736, 7442, 29889, 26276, 1165, 267, 29898, 279, 29892, 29871, 29896, 29892, 29871, 29906, 467, 690, 14443, 29898, 1240, 29930, 29876, 29895, 29892, 20199, 29930, 12938, 29897, 13, 13, 1753, 443, 1271, 29898, 279, 29892, 302, 3959, 29880, 1125, 13, 1678, 9995, 14806, 360, 1947, 22513, 304, 15658, 22513, 9995, 13, 1678, 302, 29895, 29892, 12938, 353, 302, 3959, 29880, 13, 1678, 302, 682, 29892, 20199, 12938, 353, 564, 29889, 12181, 13, 1678, 6836, 353, 302, 682, 29914, 29876, 29895, 13, 1678, 20199, 353, 20199, 12938, 29914, 12938, 13, 1678, 736, 564, 29889, 690, 14443, 29898, 1240, 29892, 29876, 29895, 29892, 29876, 29926, 29892, 12938, 467, 26276, 1165, 267, 29898, 29896, 29892, 29906, 29897, 13, 13, 1990, 12367, 29903, 5288, 29941, 29898, 3318, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 302, 29918, 29880, 29892, 301, 29922, 29900, 29889, 29900, 1125, 13, 4706, 1583, 3032, 18010, 353, 6571, 13, 4706, 1583, 3032, 29876, 29918, 29880, 353, 302, 29918, 29880, 13, 4706, 1583, 3032, 2892, 353, 301, 13, 13, 1678, 822, 788, 29918, 12864, 29898, 1311, 29892, 921, 29892, 474, 29900, 29892, 474, 29896, 1125, 13, 4706, 302, 353, 1583, 3032, 18010, 13, 4706, 282, 29900, 29892, 3855, 29900, 353, 3855, 755, 29918, 9302, 29889, 29916, 29906, 29886, 29939, 29898, 29876, 29961, 29875, 29900, 2314, 13, 4706, 282, 29896, 29892, 3855, 29896, 353, 3855, 755, 29918, 9302, 29889, 29916, 29906, 29886, 29939, 29898, 29876, 29961, 29875, 29896, 2314, 13, 4706, 270, 29886, 29892, 270, 29939, 353, 3855, 755, 29918, 9302, 29889, 29916, 29906, 29886, 29939, 29898, 29916, 29897, 13, 4706, 319, 823, 29892, 20942, 29892, 321, 823, 353, 3855, 755, 29918, 9302, 29889, 29909, 823, 29918, 29933, 823, 29918, 29872, 823, 29898, 29886, 29900, 29892, 29886, 29896, 29892, 6099, 29892, 29939, 29900, 29892, 29939, 29896, 29892, 29881, 29939, 29897, 13, 4706, 736, 319, 823, 29892, 20942, 29892, 321, 823, 13, 13, 1678, 822, 11905, 29898, 1311, 29892, 921, 29900, 1125, 13, 4706, 302, 353, 29871, 29906, 718, 1583, 3032, 29876, 29918, 29880, 396, 518, 29916, 29900, 29892, 29916, 29896, 29892, 29880, 29900, 856, 3083, 29962, 13, 4706, 1583, 3032, 29950, 353, 7442, 29889, 3298, 359, 3552, 29876, 29892, 29876, 29892, 29953, 29892, 29953, 511, 26688, 29922, 9302, 29889, 7411, 29953, 29946, 29897, 13, 4706, 1583, 3032, 29890, 353, 7442, 29889, 3298, 359, 3552, 29876, 29892, 29896, 29892, 29953, 29892, 29896, 511, 26688, 29922, 9302, 29889, 7411, 29953, 29946, 29897, 13, 4706, 1583, 3032, 29950, 29961, 29900, 29892, 29900, 29962, 353, 7442, 29889, 1032, 29872, 29898, 29953, 29897, 13, 4706, 1583, 3032, 18010, 29961, 29900, 29962, 353, 921, 29900, 13, 4706, 396, 14402, 584, 4683, 278, 2400, 2847, 17063, 5181, 29973, 13, 4706, 396, 29886, 29892, 3855, 353, 3855, 755, 29918, 9302, 29889, 29916, 29906, 29886, 29939, 29898, 29916, 29900, 29897, 13, 4706, 396, 29916, 353, 7442, 29889, 535, 29883, 2579, 403, 4197, 29886, 29892, 29939, 755, 29918, 9302, 29889, 29911, 29898, 29939, 29897, 1402, 9685, 10457, 29896, 29897, 13, 4706, 396, 1311, 3032, 29890, 29961, 29900, 29892, 29900, 29892, 29901, 29892, 29900, 29962, 353, 921, 13, 13, 1678, 822, 11905, 29918, 29876, 29898, 1311, 29892, 921, 29900, 29879, 1125, 13, 4706, 9995, 25455, 599, 7573, 411, 21875, 9995, 13, 4706, 363, 313, 5389, 29892, 921, 29897, 297, 921, 29900, 29879, 29901, 13, 9651, 1583, 3032, 18010, 29961, 5389, 29962, 353, 921, 13, 4706, 396, 14402, 584, 2334, 13, 4706, 396, 14402, 584, 5004, 714, 7395, 847, 1283, 1220, 4413, 13, 4706, 396, 411, 7258, 2967, 393, 10703, 788, 29918, 12864, 580, 847, 788, 29899, 3177, 580, 847, 11905, 580, 13, 4706, 396, 14402, 584, 2050, 900, 8497, 11905, 29918, 29876, 964, 11905, 491, 8454, 565, 921, 29900, 338, 4256, 519, 297, 518, 29876, 29892, 29955, 29962, 13, 13, 1678, 822, 4331, 29898, 1311, 29892, 921, 29922, 8516, 29892, 19100, 29922, 8516, 29892, 503, 29879, 29922, 8516, 1125, 13, 4706, 9995, 13542, 10079, 9995, 13, 13, 4706, 396, 376, 7985, 376, 13, 4706, 1583, 3032, 29950, 29961, 29896, 29892, 17531, 353, 29871, 29900, 29889, 29900, 13, 4706, 1583, 3032, 29950, 7503, 29892, 29896, 29962, 353, 29871, 29900, 29889, 29900, 13, 4706, 1583, 3032, 29890, 29961, 29896, 29962, 259, 353, 29871, 29900, 29889, 29900, 13, 13, 4706, 503, 275, 353, 5159, 396, 11217, 1051, 13, 13, 4706, 396, 3394, 10884, 11217, 937, 13, 4706, 565, 921, 338, 451, 6213, 29901, 13, 9651, 1583, 3032, 18010, 29961, 29896, 29962, 353, 3855, 755, 29918, 9302, 29889, 29916, 1202, 29918, 2674, 29898, 1311, 3032, 18010, 29961, 29900, 1402, 921, 29892, 323, 29922, 8824, 29897, 13, 9651, 503, 275, 29889, 4397, 29898, 29896, 29897, 13, 9651, 396, 22381, 29889, 4397, 4197, 29900, 29892, 29871, 29896, 29892, 921, 29892, 19100, 2314, 13, 9651, 396, 14402, 584, 11039, 403, 2703, 2442, 29918, 29916, 10431, 13, 9651, 396, 3763, 4417, 921, 29900, 976, 29916, 29896, 304, 503, 29879, 1258, 451, 664, 13, 13, 4706, 396, 379, 322, 289, 526, 19098, 408, 313, 29990, 29900, 29892, 1060, 29896, 29892, 365, 29900, 29892, 365, 29896, 29892, 29757, 13, 4706, 396, 988, 1060, 29900, 338, 278, 3517, 2602, 29892, 322, 1060, 29896, 338, 278, 1857, 2602, 29889, 13, 4706, 396, 10506, 393, 379, 29961, 29900, 29892, 636, 29962, 639, 2408, 29879, 304, 1060, 29900, 29892, 322, 577, 373, 29889, 13, 13, 4706, 396, 1286, 411, 13917, 2023, 13, 4706, 363, 313, 29920, 29900, 29892, 503, 29896, 29892, 503, 29892, 288, 29897, 297, 503, 29879, 29901, 13, 9651, 503, 275, 29889, 4397, 29898, 29920, 29896, 29897, 13, 9651, 565, 503, 29896, 451, 297, 1583, 3032, 18010, 29901, 13, 18884, 396, 2847, 4140, 13, 18884, 1583, 3032, 18010, 29961, 29920, 29896, 29962, 353, 3855, 755, 29918, 9302, 29889, 29916, 1202, 29918, 2674, 29898, 13, 462, 4706, 1583, 3032, 18010, 29961, 29920, 29900, 1402, 503, 29892, 323, 29922, 8824, 29897, 13, 18884, 396, 694, 817, 304, 10272, 628, 29873, 294, 363, 2847, 4140, 267, 13, 18884, 396, 313, 14043, 367, 5225, 29897, 29871, 13, 18884, 6773, 13, 9651, 319, 823, 29892, 20942, 29892, 321, 823, 353, 1583, 29889, 1202, 29918, 12864, 29898, 29920, 29892, 503, 29900, 29892, 503, 29896, 29897, 13, 9651, 1583, 3032, 29950, 29961, 29920, 29900, 29892, 29920, 29900, 29962, 4619, 319, 823, 29889, 29911, 29889, 6333, 29898, 29877, 467, 6333, 29898, 29909, 823, 29897, 13, 9651, 1583, 3032, 29950, 29961, 29920, 29900, 29892, 29920, 29896, 29962, 4619, 319, 823, 29889, 29911, 29889, 6333, 29898, 29877, 467, 6333, 29898, 29933, 823, 29897, 13, 9651, 1583, 3032, 29950, 29961, 29920, 29896, 29892, 29920, 29900, 29962, 4619, 20942, 29889, 29911, 29889, 6333, 29898, 29877, 467, 6333, 29898, 29909, 823, 29897, 13, 9651, 1583, 3032, 29950, 29961, 29920, 29896, 29892, 29920, 29896, 29962, 4619, 20942, 29889, 29911, 29889, 6333, 29898, 29877, 467, 6333, 29898, 29933, 823, 29897, 13, 9651, 1583, 3032, 29890, 29961, 29920, 29900, 29962, 259, 4619, 319, 823, 29889, 29911, 29889, 6333, 29898, 29877, 467, 6333, 29898, 29872, 823, 29897, 13, 9651, 1583, 3032, 29890, 29961, 29920, 29896, 29962, 259, 4619, 20942, 29889, 29911, 29889, 6333, 29898, 29877, 467, 6333, 29898, 29872, 823, 29897, 13, 13, 4706, 379, 29900, 29900, 353, 2908, 29898, 1311, 3032, 29950, 7503, 29896, 29892, 29901, 29896, 2314, 13, 4706, 379, 29900, 29896, 353, 2908, 29898, 1311, 3032, 29950, 7503, 29896, 29892, 29896, 29901, 2314, 13, 4706, 379, 29896, 29900, 353, 2908, 29898, 1311, 3032, 29950, 29961, 29896, 29901, 29892, 29901, 29896, 2314, 13, 4706, 379, 29896, 29896, 353, 2908, 29898, 1311, 3032, 29950, 29961, 29896, 29901, 29892, 29896, 29901, 2314, 13, 13, 4706, 350, 29900, 29900, 353, 2908, 29898, 1311, 3032, 29890, 7503, 29896, 29892, 29901, 29896, 2314, 13, 4706, 350, 29896, 29900, 353, 2908, 29898, 1311, 3032, 29890, 29961, 29896, 29901, 29892, 29901, 29896, 2314, 13, 13, 4706, 2180, 20517, 353, 7442, 29889, 2922, 16109, 29898, 29950, 29896, 29900, 29892, 7442, 29889, 29880, 979, 29887, 29889, 29886, 11569, 29898, 29950, 29900, 29900, 876, 13, 4706, 1060, 29875, 29925, 29871, 353, 350, 29896, 29900, 13, 13, 4706, 396, 900, 29881, 3517, 2472, 964, 716, 4636, 13, 13, 4706, 379, 353, 379, 29896, 29896, 448, 7442, 29889, 2922, 16109, 29898, 4178, 20517, 29892, 379, 29900, 29896, 29897, 13, 4706, 350, 353, 350, 29896, 29900, 448, 7442, 29889, 2922, 16109, 29898, 4178, 20517, 29892, 350, 29900, 29900, 29897, 13, 13, 4706, 286, 29902, 353, 1583, 3032, 2892, 334, 7442, 29889, 1032, 29872, 10456, 29950, 29889, 12181, 29897, 396, 26125, 538, 29873, 270, 1160, 292, 13, 4706, 396, 8235, 353, 7442, 29889, 2922, 16109, 29898, 9302, 29889, 29880, 979, 29887, 29889, 29886, 11569, 29898, 29950, 511, 448, 29933, 29897, 13, 4706, 15414, 353, 7442, 29889, 29880, 979, 29887, 29889, 20155, 3044, 29898, 29950, 29974, 29885, 29902, 6653, 29933, 29892, 364, 1116, 29922, 8516, 9601, 29900, 29962, 13, 4706, 15414, 353, 7442, 29889, 690, 14443, 29898, 8235, 29892, 21069, 29896, 29892, 29953, 2314, 396, 518, 29916, 29896, 29892, 301, 29900, 29892, 2023, 301, 29876, 29962, 13, 13, 4706, 363, 474, 297, 503, 275, 29901, 13, 9651, 1583, 3032, 18010, 29961, 29875, 29962, 353, 3855, 755, 29918, 9302, 29889, 29916, 1202, 29918, 6897, 29898, 1311, 3032, 18010, 29961, 29875, 1402, 15414, 29961, 29875, 29899, 29896, 2314, 13, 13, 4706, 396, 1454, 474, 297, 3464, 29898, 29896, 29892, 29871, 29906, 29974, 1311, 3032, 29876, 29918, 29880, 1125, 13, 4706, 396, 1678, 565, 474, 297, 1583, 3032, 18010, 29901, 13, 4706, 396, 4706, 1583, 3032, 18010, 29961, 29875, 29962, 353, 3855, 755, 29918, 9302, 29889, 29916, 1202, 29898, 1311, 3032, 18010, 29961, 29875, 1402, 15414, 29961, 29875, 29899, 29896, 2314, 13, 13, 4706, 444, 8235, 29906, 353, 7442, 29889, 2922, 16109, 29898, 9302, 29889, 29880, 979, 29887, 29889, 29886, 11569, 29898, 1271, 29898, 1311, 3032, 29950, 8243, 448, 1271, 29898, 1311, 3032, 29890, 876, 13, 4706, 396, 8235, 29906, 353, 7442, 29889, 29880, 979, 29887, 29889, 20155, 3044, 29898, 1271, 29898, 1311, 3032, 29950, 511, 448, 1271, 29898, 1311, 3032, 29890, 511, 364, 1116, 29922, 8516, 9601, 29900, 29962, 13, 4706, 396, 8235, 29906, 353, 7442, 29889, 690, 14443, 29898, 8235, 29906, 29892, 21069, 29896, 29892, 29953, 2314, 13, 13, 4706, 444, 2158, 525, 8235, 29906, 742, 15414, 29906, 29961, 29896, 17531, 13, 4706, 396, 1454, 474, 297, 3464, 29898, 29900, 29892, 29871, 29906, 29974, 1311, 3032, 29876, 29918, 29880, 1125, 13, 4706, 396, 1678, 1583, 3032, 18010, 29961, 29875, 29962, 353, 3855, 755, 29918, 9302, 29889, 29916, 1202, 29898, 1311, 3032, 18010, 29961, 29875, 1402, 15414, 29906, 29961, 29875, 2314, 13, 13, 4706, 396, 5191, 3517, 2943, 411, 1857, 2602, 13, 4706, 1583, 3032, 18010, 29961, 29900, 29962, 353, 1583, 3032, 18010, 29961, 29896, 1822, 8552, 580, 13, 13, 4706, 379, 353, 443, 1271, 29898, 29950, 29892, 313, 29953, 29892, 29953, 876, 13, 4706, 350, 353, 443, 1271, 29898, 29933, 29892, 313, 29953, 29892, 29896, 876, 13, 13, 4706, 396, 3566, 472, 8210, 7600, 29892, 411, 921, 29918, 29900, 1641, 4784, 411, 921, 29918, 29896, 13, 4706, 1583, 3032, 29950, 7503, 29896, 29892, 29901, 29896, 29962, 353, 379, 7503, 29896, 29892, 29901, 29896, 29962, 13, 4706, 1583, 3032, 29950, 7503, 29896, 29892, 29906, 17531, 353, 379, 7503, 29896, 29892, 29896, 17531, 13, 4706, 1583, 3032, 29950, 29961, 29906, 29901, 29892, 29901, 29896, 29962, 353, 379, 29961, 29896, 29901, 29892, 29901, 29896, 29962, 13, 4706, 1583, 3032, 29950, 29961, 29906, 29901, 29892, 29906, 17531, 353, 379, 29961, 29896, 29901, 29892, 29896, 17531, 13, 4706, 1583, 3032, 29890, 7503, 29896, 29962, 353, 350, 7503, 29896, 29962, 13, 4706, 1583, 3032, 29890, 29961, 29906, 17531, 353, 350, 29961, 29896, 17531, 13, 13, 4706, 921, 353, 518, 1311, 3032, 18010, 29961, 29895, 29962, 363, 413, 297, 12705, 29898, 1311, 3032, 18010, 29889, 8149, 3101, 29962, 13, 4706, 736, 921, 13, 13, 1678, 822, 1065, 29898, 1311, 29892, 503, 29879, 29892, 4236, 29918, 18010, 29892, 302, 29918, 1524, 29922, 29896, 29900, 29892, 304, 29880, 29922, 29896, 29872, 29899, 29946, 29892, 4744, 29922, 8824, 1125, 13, 4706, 9995, 5947, 1220, 1873, 9995, 13, 13, 4706, 302, 353, 4236, 29918, 18010, 13, 13, 4706, 363, 372, 297, 3464, 29898, 29876, 29918, 1524, 1125, 396, 13649, 29871, 29896, 29900, 3064, 363, 17221, 13, 9651, 379, 353, 7442, 29889, 3298, 359, 3552, 29876, 29892, 29876, 29892, 29953, 29892, 29953, 511, 26688, 29922, 9302, 29889, 7411, 29953, 29946, 29897, 13, 9651, 289, 353, 7442, 29889, 3298, 359, 3552, 29876, 29892, 29896, 29892, 29953, 29892, 29896, 511, 26688, 29922, 9302, 29889, 7411, 29953, 29946, 29897, 13, 13, 9651, 363, 313, 29920, 29900, 29892, 503, 29896, 29892, 503, 29892, 288, 29897, 297, 503, 29879, 29901, 13, 18884, 565, 503, 29896, 451, 297, 1583, 3032, 18010, 29901, 13, 462, 1678, 396, 788, 2847, 4140, 304, 2943, 13, 462, 1678, 1583, 3032, 18010, 29961, 29920, 29896, 29962, 353, 3855, 755, 29918, 9302, 29889, 29916, 1202, 29918, 2674, 29898, 1311, 3032, 18010, 29961, 29920, 29900, 1402, 503, 29892, 323, 29922, 8824, 29897, 13, 13, 18884, 319, 823, 29892, 20942, 29892, 321, 823, 353, 1583, 29889, 1202, 29918, 12864, 29898, 29920, 29892, 503, 29900, 29892, 503, 29896, 29897, 13, 18884, 379, 29961, 29920, 29900, 29892, 29920, 29900, 29962, 4619, 319, 823, 29889, 29911, 29889, 6333, 29898, 29877, 467, 6333, 29898, 29909, 823, 29897, 13, 18884, 379, 29961, 29920, 29900, 29892, 29920, 29896, 29962, 4619, 319, 823, 29889, 29911, 29889, 6333, 29898, 29877, 467, 6333, 29898, 29933, 823, 29897, 13, 18884, 379, 29961, 29920, 29896, 29892, 29920, 29900, 29962, 4619, 20942, 29889, 29911, 29889, 6333, 29898, 29877, 467, 6333, 29898, 29909, 823, 29897, 13, 18884, 379, 29961, 29920, 29896, 29892, 29920, 29896, 29962, 4619, 20942, 29889, 29911, 29889, 6333, 29898, 29877, 467, 6333, 29898, 29933, 823, 29897, 13, 18884, 289, 29961, 29920, 29900, 29962, 1678, 4619, 319, 823, 29889, 29911, 29889, 6333, 29898, 29877, 467, 6333, 29898, 29872, 823, 29897, 13, 18884, 289, 29961, 29920, 29896, 29962, 1678, 4619, 20942, 29889, 29911, 29889, 6333, 29898, 29877, 467, 6333, 29898, 29872, 823, 29897, 13, 13, 13, 9651, 379, 29961, 29900, 29892, 29900, 29962, 4619, 7442, 29889, 1032, 29872, 29898, 29953, 29897, 13, 9651, 379, 353, 2908, 29898, 29950, 29897, 13, 9651, 289, 353, 2908, 29898, 29890, 29897, 13, 13, 9651, 396, 4505, 2023, 13, 13, 9651, 396, 26125, 538, 29873, 448, 10431, 3732, 372, 15029, 470, 1554, 13, 9651, 396, 29885, 29902, 353, 1583, 3032, 2892, 334, 7442, 29889, 1032, 29872, 10456, 29950, 29889, 12181, 29897, 13, 9651, 396, 8235, 353, 7442, 29889, 29880, 979, 29887, 29889, 20155, 3044, 29898, 29950, 29974, 29885, 29902, 6653, 29890, 29892, 364, 1116, 29922, 8516, 9601, 29900, 29962, 13, 13, 9651, 15414, 353, 7442, 29889, 29880, 979, 29887, 29889, 20155, 3044, 29898, 29950, 6653, 29890, 29892, 364, 1116, 29922, 8516, 9601, 29900, 29962, 13, 9651, 15414, 353, 7442, 29889, 690, 14443, 29898, 8235, 29892, 21069, 29896, 29892, 29953, 2314, 13, 13, 9651, 396, 2767, 13, 9651, 363, 474, 297, 3464, 29898, 3317, 29918, 18010, 1125, 13, 18884, 565, 474, 297, 1583, 3032, 18010, 29901, 13, 462, 1678, 1583, 3032, 18010, 29961, 29875, 29962, 353, 3855, 755, 29918, 9302, 29889, 29916, 1202, 29918, 6897, 29898, 1311, 3032, 18010, 29961, 29875, 1402, 15414, 29961, 29875, 2314, 13, 13, 9651, 396, 1423, 17221, 13, 9651, 19471, 353, 7442, 29889, 12676, 29898, 9302, 29889, 17619, 29898, 8235, 876, 13, 9651, 565, 4744, 29901, 13, 18884, 1596, 877, 4181, 742, 19471, 29897, 13, 9651, 565, 19471, 529, 304, 29880, 29901, 13, 18884, 2867, 13, 13, 4706, 921, 353, 518, 1311, 3032, 18010, 29961, 29895, 29962, 363, 413, 297, 12705, 29898, 1311, 3032, 18010, 29889, 8149, 3101, 29962, 13, 4706, 736, 921, 13, 2 ]
optimizers.py
ivallesp/awesome-optimizers
37
169050
import numpy as np def run_optimizer(opt, cost_f, iterations, *args, **kwargs): errors = [cost_f.eval(cost_f.x_start, cost_f.y_start)] xs,ys= [cost_f.x_start],[cost_f.y_start] for epochs in range(iterations): x, y= opt.step(*args, **kwargs) xs.append(x) ys.append(y) errors.append(cost_f.eval(x,y)) distance = np.sqrt((np.array(xs)-cost_f.x_optimum)**2 + (np.array(ys)-cost_f.y_optimum)**2) return errors, distance, xs, ys class Optimizer: def __init__(self, cost_f, lr, x, y, **kwargs): self.lr = lr self.cost_f = cost_f if x==None or y==None: self.x = self.cost_f.x_start self.y = self.cost_f.y_start else: self.x = x self.y = y self.__dict__.update(kwargs) def step(self, lr): raise NotImplementedError()
[ 1, 1053, 12655, 408, 7442, 13, 13, 13, 1753, 1065, 29918, 20640, 3950, 29898, 3670, 29892, 3438, 29918, 29888, 29892, 24372, 29892, 334, 5085, 29892, 3579, 19290, 1125, 13, 1678, 4436, 353, 518, 18253, 29918, 29888, 29889, 14513, 29898, 18253, 29918, 29888, 29889, 29916, 29918, 2962, 29892, 3438, 29918, 29888, 29889, 29891, 29918, 2962, 4638, 13, 1678, 14492, 29892, 952, 29922, 518, 18253, 29918, 29888, 29889, 29916, 29918, 2962, 16272, 18253, 29918, 29888, 29889, 29891, 29918, 2962, 29962, 13, 1678, 363, 21502, 12168, 297, 3464, 29898, 1524, 800, 1125, 13, 4706, 921, 29892, 343, 29922, 3523, 29889, 10568, 10456, 5085, 29892, 3579, 19290, 29897, 13, 4706, 14492, 29889, 4397, 29898, 29916, 29897, 13, 4706, 343, 29879, 29889, 4397, 29898, 29891, 29897, 13, 4706, 4436, 29889, 4397, 29898, 18253, 29918, 29888, 29889, 14513, 29898, 29916, 29892, 29891, 876, 13, 1678, 5418, 353, 7442, 29889, 3676, 3552, 9302, 29889, 2378, 29898, 10351, 6817, 18253, 29918, 29888, 29889, 29916, 29918, 3670, 12539, 29897, 1068, 29906, 718, 313, 9302, 29889, 2378, 29898, 952, 6817, 18253, 29918, 29888, 29889, 29891, 29918, 3670, 12539, 29897, 1068, 29906, 29897, 13, 1678, 736, 4436, 29892, 5418, 29892, 14492, 29892, 343, 29879, 13, 13, 1990, 20693, 326, 3950, 29901, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 3438, 29918, 29888, 29892, 301, 29878, 29892, 921, 29892, 343, 29892, 3579, 19290, 1125, 13, 4706, 1583, 29889, 29212, 353, 301, 29878, 13, 4706, 1583, 29889, 18253, 29918, 29888, 353, 3438, 29918, 29888, 13, 4706, 565, 921, 1360, 8516, 470, 343, 1360, 8516, 29901, 13, 9651, 1583, 29889, 29916, 353, 1583, 29889, 18253, 29918, 29888, 29889, 29916, 29918, 2962, 13, 9651, 1583, 29889, 29891, 353, 1583, 29889, 18253, 29918, 29888, 29889, 29891, 29918, 2962, 13, 4706, 1683, 29901, 13, 9651, 1583, 29889, 29916, 353, 921, 13, 9651, 1583, 29889, 29891, 353, 343, 13, 632, 13, 4706, 1583, 17255, 8977, 26914, 5504, 29898, 19290, 29897, 13, 632, 13, 1678, 822, 4331, 29898, 1311, 29892, 301, 29878, 1125, 13, 4706, 12020, 2216, 1888, 2037, 287, 2392, 580, 2 ]
src/core/lib/errors.py
lilliputten/cam-rpi-server-2202
0
108547
<gh_stars>0 # -*- coding:utf-8 -*- # @module logger # @since 2020.02.23, 02:18 # @changed 2022.02.24, 00:53 import traceback # from . import utils from . import yamlSupport def toString(error, show_stacktrace=False): errorName = type(error).__name__ errorExtra = str(error) # TODO: Add all args? errorArg = str(error.args[0]) if error.args and error.args[0] else '' if errorArg and errorArg != errorExtra: errorExtra += ' (' + errorArg + ')' errorStr = errorName + ': ' + errorExtra stack = traceback.format_exc() if stack and show_stacktrace: errorStr += '\n' + stack return errorStr def toBlockString(error): errorStr = toString(error) return yamlSupport.BlockString(errorStr) __all__ = [ # Exporting objects... 'toString', 'toBlockString', ]
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 29937, 448, 29930, 29899, 14137, 29901, 9420, 29899, 29947, 448, 29930, 29899, 13, 29937, 732, 5453, 17927, 13, 29937, 732, 16076, 29871, 29906, 29900, 29906, 29900, 29889, 29900, 29906, 29889, 29906, 29941, 29892, 29871, 29900, 29906, 29901, 29896, 29947, 13, 29937, 732, 15033, 29871, 29906, 29900, 29906, 29906, 29889, 29900, 29906, 29889, 29906, 29946, 29892, 29871, 29900, 29900, 29901, 29945, 29941, 13, 13, 13, 5215, 9637, 1627, 13, 13, 29937, 29871, 515, 869, 1053, 3667, 29879, 13, 3166, 869, 1053, 343, 8807, 14039, 13, 13, 13, 1753, 304, 1231, 29898, 2704, 29892, 1510, 29918, 1429, 15003, 29922, 8824, 1125, 13, 1678, 1059, 1170, 353, 1134, 29898, 2704, 467, 1649, 978, 1649, 13, 1678, 1059, 18126, 353, 851, 29898, 2704, 29897, 13, 1678, 396, 29871, 14402, 29901, 3462, 599, 6389, 29973, 13, 1678, 1059, 8559, 353, 851, 29898, 2704, 29889, 5085, 29961, 29900, 2314, 565, 1059, 29889, 5085, 322, 1059, 29889, 5085, 29961, 29900, 29962, 1683, 6629, 13, 1678, 565, 1059, 8559, 322, 1059, 8559, 2804, 1059, 18126, 29901, 13, 4706, 1059, 18126, 4619, 525, 6702, 718, 1059, 8559, 718, 525, 16029, 13, 1678, 1059, 5015, 353, 1059, 1170, 718, 525, 29901, 525, 718, 1059, 18126, 13, 1678, 5096, 353, 9637, 1627, 29889, 4830, 29918, 735, 29883, 580, 13, 1678, 565, 5096, 322, 1510, 29918, 1429, 15003, 29901, 13, 4706, 1059, 5015, 4619, 11297, 29876, 29915, 718, 5096, 13, 1678, 736, 1059, 5015, 13, 13, 13, 1753, 304, 7445, 1231, 29898, 2704, 1125, 13, 1678, 1059, 5015, 353, 304, 1231, 29898, 2704, 29897, 13, 1678, 736, 343, 8807, 14039, 29889, 7445, 1231, 29898, 2704, 5015, 29897, 13, 13, 13, 1649, 497, 1649, 353, 518, 29871, 396, 1222, 637, 292, 3618, 856, 13, 1678, 525, 7711, 742, 13, 1678, 525, 517, 7445, 1231, 742, 13, 29962, 13, 2 ]
cgmodsel/base_solver.py
chrlen/cgmodsel
0
109921
# Copyright (c) 2019 <NAME> (<EMAIL>) """ @author: <NAME> base class for CG models and solvers """ import abc from typing import Iterable import numpy as np #from cgmodsel.models.model_base import get_modeltype from cgmodsel.models.model_pwsl import ModelPWSL from cgmodsel.models.model_pw import ModelPW from cgmodsel.utils import grp_soft_shrink, l21norm # pylint: disable=W0511 # todos # pylint: disable=R0914 # too many locals DUMMY = 'dummy' DUMMY_RED = 'dummy_red' INDEX = 'index' FLAT = 'flat' def set_sparsity_weights(meta, cat_data, cont_data): """ use adjusted weights for all groups as suggested by LST2015 (may be essential for "good", "consistent" results)""" n_data = meta['n_data'] n_cg = meta['n_cg'] n_cat = meta['n_cat'] dim = n_cg + n_cat # CG variables mus = cont_data.sum(axis=0) / n_data sigmas_cg = np.sqrt((cont_data**2).sum(axis=0) / n_data - mus**2) # categoricals sigmas_cat = np.empty(n_cat) freqs = cat_data.sum(axis=0) / n_data for r in range(n_cat): sigma_r = 0 for k in range(meta['sizes'][r]): p_xr_k = freqs[meta['cat_glims'][r] + k] # relative probability that x_r has value k sigma_r += p_xr_k * (1 - p_xr_k) sigmas_cat[r] = np.sqrt(sigma_r) weights = np.zeros((dim, dim)) for r in range(n_cat): for j in range(r): weights[r, j] = sigmas_cat[r] * sigmas_cat[j] for s in range(n_cg): weights[n_cat + s, r] = sigmas_cat[r] * sigmas_cg[s] for j in range(n_cg): for i in range(j): weights[n_cat + j, n_cat + i] = sigmas_cg[j] * sigmas_cg[i] weights += weights.T # TODO(franknu): weights on diagonal return weights ############################################################################### # base class for all CG model solvers ############################################################################### class BaseCGSolver(abc.ABC): """ base class for all CG model solver provides external interface to drop data along with meta information about this data """ def __init__(self): """must call method drop_data after initialization""" super().__init__() self.cat_data = None # discrete data, dropped later self.cat_format_required = None # must override self.cont_data = None # continuous data, dropped later # self.problem_vars = None #TODO(franknu) self.meta = {'n_data': 0} if not hasattr(self, 'opts'): # since this may already be defined from other base classes self.opts = {} self.name = 'base' def _postsetup_data(self): """called after drop_data""" # may be overridden in derived classes # no pass because function has doc string def drop_data(self, data, meta: dict) -> None: """drop data, derived classes may perform additional computations uses and augments information contained in meta about the data categorical data must be provided in dummy-encoded form (leaving out 0-th levels if required by the solver)""" # process argument data if isinstance(data, tuple): assert len(data) == 2 cat_data, cont_data = data else: counter = 0 if 'n_cat' in meta and meta['n_cat'] > 0: counter += 1 cat_data = data cont_data = np.empty((data.shape[0], 0)) if 'n_cg' in meta and meta['n_cg'] > 0: counter += 1 cont_data = data cat_data = np.empty((data.shape[0], 0)) assert counter == 1, 'dictionary meta incompatible with provided data' self.cont_data = cont_data self.cat_data = cat_data self.meta = {} for key in ('n_cg', 'n_cat'): if key in meta: self.meta[key] = meta[key] else: meta[key] = 0 if self.meta['n_cat'] > 0: assert 'sizes' in meta assert len(meta['sizes']) == meta['n_cat'] self.meta['sizes'] = meta['sizes'] # continue checking validity of meta if self.meta['n_cg'] > 0: assert not np.any(np.isnan(cont_data)) assert meta['n_cg'] == cont_data.shape[1] self.meta['n_data'] = cont_data.shape[0] if self.meta['n_cat'] == 0: self.meta['sizes'] = [] # no discrete variables self.meta['ltot'] = 0 self.meta['red_levels'] = False # value irrelevant, no cat vars self.meta['cat_glims'] = [0] else: if 'n_data' in self.meta: assert self.meta['n_data'] == cat_data.shape[0] else: self.meta['n_data'] = cat_data.shape[0] ltot = np.sum(meta['sizes']) if self.cat_format_required == DUMMY: assert ltot == cat_data.shape[1] # 0-th levels of the discrete data are contained # for identifiability, assume that corresponding # parameters are constrained to zero self.meta['red_levels'] = False elif self.cat_format_required == DUMMY_RED: assert ltot - meta['n_cat'] == cat_data.shape[1] # assume that 0-th levels are left out in discrete data # assures identifiability of the model self.meta['red_levels'] = True self.meta['sizes'] = [size - 1 for size in meta['sizes']] elif self.cat_format_required == INDEX: assert meta['n_cat'] == cat_data.shape[1] elif self.cat_format_required == FLAT: # MAP solver assert len(cat_data.shape) == 1 else: raise Exception('invalid self.cat_format_required') if self.cat_format_required in (DUMMY, DUMMY_RED): self.meta['ltot'] = cat_data.shape[1] self.meta['dim'] = self.meta['ltot'] + self.meta['n_cg'] # calculate cumulative # of levels/ group delimiters self.meta['cat_glims'] = np.cumsum([0] + self.meta['sizes']) self.meta['glims'] = list(self.meta['cat_glims']) + \ [1 + self.meta['ltot'] + s for s in range(self.meta['n_cg'])] # TODO(franknu): self.meta['glims'] for sparse reg only self.meta['nonbinary'] = (self.meta['ltot'] > self.meta['n_cat'] * (2 - self.meta['red_levels'])) self.meta['n_catcg'] = self.meta['n_cat'] + self.meta['n_cg'] # self.meta['type'] = get_modeltype(self.n_cat, self.n_cg, self.sizes) # fac = np.log(self.meta['n_cg'] + self.meta['n_cat']) fac = np.sqrt(np.log(self.meta['n_catcg']) / self.meta['n_data']) self.meta['reg_fac'] = fac # potentially used as prescaling factor # for regularization parameters self._postsetup_data() def get_name(self): """return model name""" return self.name class BaseSparseSolver(BaseCGSolver): """ base class that contains proximal operators """ def __init__(self, useweights=False): super().__init__() self.opts.setdefault('off', 0) # if 1 regularize only off-diagonal # model options # TODO(franknu): find better place self.opts.setdefault('use_alpha', 1) self.opts.setdefault('use_u', 1) self.useweights = useweights self.weights = None self.name = 'base-sparse' def _postsetup_data(self): """called after drop_data""" if self.useweights: self.weights = set_sparsity_weights(self.meta, self.cat_data, self.cont_data) else: self.weights = None def shrink(self, mat_s, tau): """return (group)- soft shrink of matrix mat_s with tau """ if self.meta['nonbinary']: return grp_soft_shrink(mat_s, tau, self.meta['n_cat'] + self.meta['n_cg'], self.meta['glims'], self.opts['off'], weights=self.weights) return grp_soft_shrink(mat_s, tau, off=self.opts['off'], weights=self.weights) def sparse_norm(self, mat_s): """return l21/ l1-norm of mat_s""" if self.meta['nonbinary']: return l21norm(mat_s, self.meta['n_cat'] + self.meta['n_cg'], self.meta['glims'], self.opts['off'], weights=self.weights) return l21norm(mat_s, off=self.opts['off'], weights=self.weights) class BaseGradSolver(abc.ABC): """ Base solver for iterative (scipy L-BFGS-B) solvers provides with methods to pack/unpack parameters into vector """ def __init__(self): # print('Init BaseCGSolver') super().__init__() self.shapes = None self.n_params = None # self.problem_vars = None if not hasattr(self, 'opts'): # should already be defined by other class self.opts = {} self._set_defaults() def _set_defaults(self): """default solver options""" self.opts.setdefault('verb', 1) # write output ## objective variants self.opts.setdefault('use_alpha', 1) # use univariate cts parameters? self.opts.setdefault('use_u', 1) # use univariate discrete parameters? self.opts.setdefault('off', 0) # if 1 regularize only off-diagonal ## stopping criteria and tolerancies # self.opts.setdefault('abstol', 1e-5) # self.opts.setdefault('reltol', 1e-5) self.opts.setdefault('tol', 1e-12) self.opts.setdefault('maxiter', 500) # self.opts.setdefault('useweights', False) # self.opts.setdefault('maxrank', -1) # @abc.abstractmethod # def get_bounds(self): # """get bounds""" # raise NotImplementedError # deferred to BaseHuber class @abc.abstractmethod def get_fval_and_grad(self, optvars, verb=0, **kwargs): """calculate function value and gradient for solver""" raise NotImplementedError def get_params(self, optvars): """a function to display the problem parameters""" params = self.unpack(optvars) for i, param in enumerate(params): print('%s:\n' % self.shapes[i][0], param) return params def pack(self, components): """pack (typically) gradients into vector x""" grad = np.empty(self.n_params) offset = 0 for i, component in enumerate(components): size = np.prod(self.shapes[i][1]) # print(self.shapes[i][0], size, np.prod(component.shape)) assert size == np.prod(component.shape) grad[offset:offset + size] = component.flatten() # row-wise offset += size return grad def unpack(self, x) -> Iterable[np.ndarray]: """unpack model parameters from vector x, save: returns copy""" offset = 0 params = [] xcopy = x.copy() # allows modifying the copy without modifying x for _, shapedim in self.shapes: tmp = np.prod(shapedim) params.append(xcopy[offset:offset + tmp].reshape(shapedim)) offset += tmp return params class BaseSolverSL(BaseSparseSolver): """ base class for S+L model solvers """ def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.alpha, self.beta = None, None self.lbda, self.rho = None, None self.problem_vars = None def __str__(self): string = '<ADMMsolver> la=%s' % (self.lbda) + ', rho=%s' % (self.rho) string += ', alpha=%s' % (self.alpha) + ', beta=%s' % (self.beta) string += ', use_alpha=%d' % (self.opts.setdefault('use_alpha', 1)) string += ', use_u=%d' % (self.opts.setdefault('use_u', 1)) string += ', off=%d' % (self.opts.setdefault('off', 1)) return string def get_canonicalparams(self): """Retrieves the PW S+L CG model parameters from flat parameter vector. output: Model_PWSL instance""" mat_s, mat_l, alpha = self.problem_vars ltot = self.meta['ltot'] mat_lambda = -mat_s[ltot:, ltot:] # cts-cts parameters # have negative sign in CG pairwise interaction parameter matrix if self.meta['n_cat'] > 0: glims = self.meta['cat_glims'] sizes = self.meta['sizes'] mat_q = mat_s[:ltot, :ltot] mat_r = mat_s[ltot:, :ltot] vec_u = 0.5 * np.diag(mat_q).copy().reshape(ltot) for r in range(self.meta['n_cat']): # set block-diagonal to zero mat_q[glims[r]:glims[r+1], glims[r]:glims[r+1]] = \ np.zeros((sizes[r], sizes[r])) if self.meta['red_levels']: fullsizes = [size + 1 for size in sizes] else: fullsizes = sizes else: mat_q = np.empty(0) mat_r = np.empty(0) vec_u = np.empty(0) fullsizes = [] can_pwsl = vec_u, mat_q, mat_r, alpha, mat_lambda, mat_l annotations = { 'n': self.meta['n_data'], 'lambda': self.lbda, 'rho': self.rho } meta = { 'n_cat': self.meta['n_cat'], 'n_cg': self.meta['n_cg'], 'sizes': fullsizes } return ModelPWSL(can_pwsl, meta, annotations=annotations, in_padded=False) def get_regularization_params(self): """get regularization parameters""" return self.lbda, self.rho def set_regularization_params(self, hyperparams, scales=None, set_direct=False, ptype: str = 'std') -> None: """set regularization parameters hyperparams ... pair of regularization parameters ptype ... if 'std', set lambda, rho = hyperparams * scaling(n, nvars), where the parameters are for the problem min l(S-L) + lambda * ||S||_1 + rho * tr(L) s.t. S-L>0, L>=0 Here, scaling(n, nvars) is a scaling suggested by consistency results Argument <scales> is not used in this case! if 'direct', directly set lambda, rho = hyperparams if 'convex' assume that alpha, beta = hyperparams and alpha, beta are weights in [0,1] and the problem is min (1-alpha-beta) * l(S-L) + alpha * ||S||_1 + beta * tr(L) s.t. S-L>0, L>=0 In addition to the specified regularization parameters, the regularization parameters can be scaled by a fixed value (depending on the number of data points and variables): scales ... if None, use standard scaling np.sqrt(log(dg)/n) else scales must be a two-tuple, and lambda and rho are scaled according to the elements of this two-tuple """ assert len(hyperparams) == 2 assert hyperparams[0] >= 0 and hyperparams[1] >= 0 if ptype == 'std': # standard regularization parameters # first for l21, second for nuclear norm self.lbda, self.rho = hyperparams elif ptype == 'convex': alpha, beta = hyperparams # assert alpha + beta <= 1 assert alpha + beta < 1, "must contain likelihood part" self.alpha = alpha self.beta = beta denom = 1 - alpha - beta if denom != 0: self.lbda = alpha / denom self.rho = beta / denom # else: # # no likelihood part # self.lbda, self.rho = 0, 0 else: raise Exception('unknown ptype') if not set_direct: if not scales is None: scale_lbda, scale_rho = scales else: assert self.meta['n_data'] > 0, \ "data-dependent scaling, drop data first" # calculate prescaling factor for the regularization parameters # based on consistency analysis by Chandrasekaran et. al (2010) # assert 'reg_fac' in self.meta scale_lbda = self.meta['reg_fac'] scale_rho = self.meta['reg_fac'] self.lbda *= scale_lbda self.rho *= scale_rho class BaseSolverPW(BaseSparseSolver): """ base class for sparse graphical model solvers """ def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.alpha = None self.lbda = None self.problem_vars = None def __str__(self): string = '<ADMMsolver> la=%s' % (self.lbda) string += ', use_alpha=%d' % (self.opts.setdefault('use_alpha', 1)) string += ', use_u=%d' % (self.opts.setdefault('use_u', 1)) string += ', off=%d' % (self.opts.setdefault('off', 1)) return string def get_canonicalparams(self): """Retrieves the PW CG model parameters from flat parameter vector. output: Model_PW instance""" mat_s, alpha = self.problem_vars ltot = self.meta['ltot'] mat_lambda = -mat_s[ltot:, ltot:] # cts-cts parameters # have negative sign in CG pairwise interaction parameter matrix if self.meta['n_cat'] > 0: glims = self.meta['cat_glims'] sizes = self.meta['sizes'] mat_q = mat_s[:ltot, :ltot] mat_r = mat_s[ltot:, :ltot] vec_u = 0.5 * np.diag(mat_q).copy().reshape(ltot) for r in range(self.meta['n_cat']): # set block-diagonal to zero mat_q[glims[r]:glims[r+1], glims[r]:glims[r+1]] = \ np.zeros((sizes[r], sizes[r])) if self.meta['red_levels']: fullsizes = [size + 1 for size in sizes] else: fullsizes = sizes else: mat_q = np.empty(0) mat_r = np.empty(0) vec_u = np.empty(0) fullsizes = [] can_params = vec_u, mat_q, mat_r, alpha, mat_lambda annotations = { 'n': self.meta['n_data'], 'lambda': self.lbda, } meta = { 'n_cat': self.meta['n_cat'], 'n_cg': self.meta['n_cg'], 'sizes': fullsizes } return ModelPW(can_params, meta, annotations=annotations, in_padded=False) def get_regularization_params(self): """get regularization parameters""" return self.lbda def set_regularization_params(self, regparam, set_direct=False, scale=None, ptype='std'): """set regularization parameters for min l(S) + la*||S||_{2/1} hyperparams ... pair of regularization parameters ptype ... if 'std', set lambda = regparam * scaling(n, nvars), where Here, scaling(n, nvars) is a scaling suggested by consistency results Argument <scales> is not used in this case! if 'direct', directly set lambda = regparam if 'convex' assume that alpha = regparam and min_S (1-alpha) * l(S) + alpha * ||S||_ {2,1} In addition to the specified regularization parameter, the regularization parameters can be scaled by a fixed value (depending on the number of data points and variables): scales ... if None, use standard scaling np.sqrt(log(dg)/n) else scales must be a nonnegative number with which lambda is scaled """ if ptype == 'std': # standard regularization parameter for l21-norm self.lbda = regparam elif ptype == 'convex': # convex hyperparams are assumed self.alpha = regparam assert self.alpha < 1, "must contain likelihood part" denom = 1 - self.alpha if denom != 0: self.lbda = self.alpha/denom else: self.lbda = 0 else: raise Exception('unknown ptype') if not set_direct: if scale is None: assert self.meta['n_data'] > 0, \ "data-dependent scaling, drop data first" scale = self.meta['reg_fac'] self.lbda *= scale
[ 1, 396, 14187, 1266, 313, 29883, 29897, 29871, 29906, 29900, 29896, 29929, 529, 5813, 29958, 313, 29966, 26862, 6227, 12948, 13, 15945, 29908, 13, 29992, 8921, 29901, 529, 5813, 29958, 13, 13, 3188, 770, 363, 8446, 4733, 322, 899, 874, 13, 15945, 29908, 13, 5215, 25638, 13, 3166, 19229, 1053, 20504, 519, 13, 5215, 12655, 408, 7442, 13, 13, 29937, 3166, 274, 29887, 1545, 2838, 29889, 9794, 29889, 4299, 29918, 3188, 1053, 679, 29918, 4299, 1853, 13, 3166, 274, 29887, 1545, 2838, 29889, 9794, 29889, 4299, 29918, 29886, 29893, 2536, 1053, 8125, 29925, 7811, 29931, 13, 3166, 274, 29887, 1545, 2838, 29889, 9794, 29889, 4299, 29918, 29886, 29893, 1053, 8125, 29925, 29956, 13, 3166, 274, 29887, 1545, 2838, 29889, 13239, 1053, 867, 29886, 29918, 2695, 29918, 845, 29878, 682, 29892, 301, 29906, 29896, 12324, 13, 29937, 282, 2904, 524, 29901, 11262, 29922, 29956, 29900, 29945, 29896, 29896, 396, 10843, 13, 29937, 282, 2904, 524, 29901, 11262, 29922, 29934, 29900, 29929, 29896, 29946, 396, 2086, 1784, 1180, 1338, 13, 13, 29928, 5005, 17870, 353, 525, 29881, 11770, 29915, 13, 29928, 5005, 17870, 29918, 19386, 353, 525, 29881, 11770, 29918, 1127, 29915, 13, 27992, 353, 525, 2248, 29915, 13, 10536, 1299, 353, 525, 20620, 29915, 13, 13, 13, 1753, 731, 29918, 29879, 862, 29879, 537, 29918, 705, 5861, 29898, 7299, 29892, 6635, 29918, 1272, 29892, 640, 29918, 1272, 1125, 13, 1678, 9995, 29871, 671, 10365, 287, 18177, 363, 599, 6471, 408, 7829, 491, 365, 1254, 29906, 29900, 29896, 29945, 13, 1678, 313, 13029, 367, 18853, 363, 376, 16773, 613, 376, 3200, 9696, 29908, 2582, 5513, 15945, 13, 1678, 302, 29918, 1272, 353, 12700, 1839, 29876, 29918, 1272, 2033, 13, 1678, 302, 29918, 29883, 29887, 353, 12700, 1839, 29876, 29918, 29883, 29887, 2033, 13, 1678, 302, 29918, 4117, 353, 12700, 1839, 29876, 29918, 4117, 2033, 13, 1678, 3964, 353, 302, 29918, 29883, 29887, 718, 302, 29918, 4117, 13, 13, 1678, 396, 8446, 3651, 13, 1678, 2301, 353, 640, 29918, 1272, 29889, 2083, 29898, 8990, 29922, 29900, 29897, 847, 302, 29918, 1272, 13, 1678, 4365, 8247, 29918, 29883, 29887, 353, 7442, 29889, 3676, 3552, 1285, 29918, 1272, 1068, 29906, 467, 2083, 29898, 8990, 29922, 29900, 29897, 847, 302, 29918, 1272, 448, 2301, 1068, 29906, 29897, 13, 1678, 396, 11608, 936, 29879, 13, 1678, 4365, 8247, 29918, 4117, 353, 7442, 29889, 6310, 29898, 29876, 29918, 4117, 29897, 13, 1678, 3005, 29939, 29879, 353, 6635, 29918, 1272, 29889, 2083, 29898, 8990, 29922, 29900, 29897, 847, 302, 29918, 1272, 13, 1678, 363, 364, 297, 3464, 29898, 29876, 29918, 4117, 1125, 13, 4706, 269, 2934, 29918, 29878, 353, 29871, 29900, 13, 4706, 363, 413, 297, 3464, 29898, 7299, 1839, 29879, 7093, 2033, 29961, 29878, 29962, 1125, 13, 9651, 282, 29918, 29916, 29878, 29918, 29895, 353, 3005, 29939, 29879, 29961, 7299, 1839, 4117, 29918, 29887, 2576, 29879, 2033, 29961, 29878, 29962, 718, 13, 462, 965, 413, 29962, 29871, 396, 6198, 6976, 393, 921, 29918, 29878, 756, 995, 413, 13, 9651, 269, 2934, 29918, 29878, 4619, 282, 29918, 29916, 29878, 29918, 29895, 334, 313, 29896, 448, 282, 29918, 29916, 29878, 29918, 29895, 29897, 13, 4706, 4365, 8247, 29918, 4117, 29961, 29878, 29962, 353, 7442, 29889, 3676, 29898, 3754, 29918, 29878, 29897, 13, 13, 1678, 18177, 353, 7442, 29889, 3298, 359, 3552, 6229, 29892, 3964, 876, 13, 1678, 363, 364, 297, 3464, 29898, 29876, 29918, 4117, 1125, 13, 4706, 363, 432, 297, 3464, 29898, 29878, 1125, 13, 9651, 18177, 29961, 29878, 29892, 432, 29962, 353, 4365, 8247, 29918, 4117, 29961, 29878, 29962, 334, 4365, 8247, 29918, 4117, 29961, 29926, 29962, 13, 4706, 363, 269, 297, 3464, 29898, 29876, 29918, 29883, 29887, 1125, 13, 9651, 18177, 29961, 29876, 29918, 4117, 718, 269, 29892, 364, 29962, 353, 4365, 8247, 29918, 4117, 29961, 29878, 29962, 334, 4365, 8247, 29918, 29883, 29887, 29961, 29879, 29962, 13, 1678, 363, 432, 297, 3464, 29898, 29876, 29918, 29883, 29887, 1125, 13, 4706, 363, 474, 297, 3464, 29898, 29926, 1125, 13, 9651, 18177, 29961, 29876, 29918, 4117, 718, 432, 29892, 302, 29918, 4117, 718, 474, 29962, 353, 4365, 8247, 29918, 29883, 29887, 29961, 29926, 29962, 334, 4365, 8247, 29918, 29883, 29887, 29961, 29875, 29962, 13, 1678, 18177, 4619, 18177, 29889, 29911, 13, 1678, 396, 14402, 29898, 29888, 10003, 3433, 1125, 18177, 373, 19640, 13, 13, 1678, 736, 18177, 13, 13, 13, 13383, 13383, 13383, 13383, 7346, 4136, 2277, 29937, 13, 29937, 2967, 770, 363, 599, 8446, 1904, 899, 874, 13, 13383, 13383, 13383, 13383, 7346, 4136, 2277, 29937, 13, 13, 1990, 7399, 29907, 10749, 324, 369, 29898, 10736, 29889, 19658, 1125, 13, 1678, 9995, 13, 1678, 2967, 770, 363, 599, 8446, 1904, 899, 369, 13, 1678, 8128, 7029, 5067, 304, 5768, 848, 3412, 411, 12700, 2472, 13, 1678, 1048, 445, 848, 13, 1678, 9995, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 9995, 21969, 1246, 1158, 5768, 29918, 1272, 1156, 17865, 15945, 29908, 13, 4706, 2428, 2141, 1649, 2344, 1649, 580, 13, 13, 4706, 1583, 29889, 4117, 29918, 1272, 353, 6213, 29871, 396, 19554, 848, 29892, 13700, 2678, 13, 4706, 1583, 29889, 4117, 29918, 4830, 29918, 12403, 353, 6213, 29871, 396, 1818, 5712, 13, 4706, 1583, 29889, 1285, 29918, 1272, 353, 6213, 29871, 396, 9126, 848, 29892, 13700, 2678, 13, 13, 4706, 396, 4706, 1583, 29889, 17199, 29918, 16908, 353, 6213, 396, 4986, 3970, 29898, 29888, 10003, 3433, 29897, 13, 4706, 1583, 29889, 7299, 353, 11117, 29876, 29918, 1272, 2396, 29871, 29900, 29913, 13, 13, 4706, 565, 451, 756, 5552, 29898, 1311, 29892, 525, 25707, 29374, 13, 9651, 396, 1951, 445, 1122, 2307, 367, 3342, 515, 916, 2967, 4413, 13, 9651, 1583, 29889, 25707, 353, 6571, 13, 13, 4706, 1583, 29889, 978, 353, 525, 3188, 29915, 13, 13, 1678, 822, 903, 2490, 14669, 29918, 1272, 29898, 1311, 1125, 13, 4706, 9995, 13998, 1156, 5768, 29918, 1272, 15945, 29908, 13, 4706, 396, 1122, 367, 20831, 1145, 297, 10723, 4413, 13, 4706, 396, 694, 1209, 1363, 740, 756, 1574, 1347, 13, 13, 1678, 822, 5768, 29918, 1272, 29898, 1311, 29892, 848, 29892, 12700, 29901, 9657, 29897, 1599, 6213, 29901, 13, 4706, 9995, 8865, 848, 29892, 10723, 4413, 1122, 2189, 5684, 2912, 800, 13, 13, 4706, 3913, 322, 11307, 1860, 2472, 11122, 297, 12700, 1048, 278, 848, 13, 13, 4706, 11608, 936, 848, 1818, 367, 4944, 297, 20254, 29899, 26716, 883, 13, 4706, 313, 280, 5555, 714, 29871, 29900, 29899, 386, 11174, 565, 3734, 491, 278, 899, 369, 5513, 15945, 13, 13, 4706, 396, 1889, 2980, 848, 13, 4706, 565, 338, 8758, 29898, 1272, 29892, 18761, 1125, 13, 9651, 4974, 7431, 29898, 1272, 29897, 1275, 29871, 29906, 13, 9651, 6635, 29918, 1272, 29892, 640, 29918, 1272, 353, 848, 13, 4706, 1683, 29901, 13, 9651, 6795, 353, 29871, 29900, 13, 9651, 565, 525, 29876, 29918, 4117, 29915, 297, 12700, 322, 12700, 1839, 29876, 29918, 4117, 2033, 1405, 29871, 29900, 29901, 13, 18884, 6795, 4619, 29871, 29896, 13, 18884, 6635, 29918, 1272, 353, 848, 13, 18884, 640, 29918, 1272, 353, 7442, 29889, 6310, 3552, 1272, 29889, 12181, 29961, 29900, 1402, 29871, 29900, 876, 13, 9651, 565, 525, 29876, 29918, 29883, 29887, 29915, 297, 12700, 322, 12700, 1839, 29876, 29918, 29883, 29887, 2033, 1405, 29871, 29900, 29901, 13, 18884, 6795, 4619, 29871, 29896, 13, 18884, 640, 29918, 1272, 353, 848, 13, 18884, 6635, 29918, 1272, 353, 7442, 29889, 6310, 3552, 1272, 29889, 12181, 29961, 29900, 1402, 29871, 29900, 876, 13, 9651, 4974, 6795, 1275, 29871, 29896, 29892, 525, 27126, 12700, 297, 23712, 411, 4944, 848, 29915, 13, 13, 4706, 1583, 29889, 1285, 29918, 1272, 353, 640, 29918, 1272, 13, 4706, 1583, 29889, 4117, 29918, 1272, 353, 6635, 29918, 1272, 13, 13, 4706, 1583, 29889, 7299, 353, 6571, 13, 4706, 363, 1820, 297, 6702, 29876, 29918, 29883, 29887, 742, 525, 29876, 29918, 4117, 29374, 13, 9651, 565, 1820, 297, 12700, 29901, 13, 18884, 1583, 29889, 7299, 29961, 1989, 29962, 353, 12700, 29961, 1989, 29962, 13, 9651, 1683, 29901, 13, 18884, 12700, 29961, 1989, 29962, 353, 29871, 29900, 13, 13, 4706, 565, 1583, 29889, 7299, 1839, 29876, 29918, 4117, 2033, 1405, 29871, 29900, 29901, 13, 9651, 4974, 525, 29879, 7093, 29915, 297, 12700, 13, 9651, 4974, 7431, 29898, 7299, 1839, 29879, 7093, 11287, 1275, 12700, 1839, 29876, 29918, 4117, 2033, 13, 9651, 1583, 29889, 7299, 1839, 29879, 7093, 2033, 353, 12700, 1839, 29879, 7093, 2033, 13, 13, 4706, 396, 6773, 8454, 2854, 537, 310, 12700, 13, 4706, 565, 1583, 29889, 7299, 1839, 29876, 29918, 29883, 29887, 2033, 1405, 29871, 29900, 29901, 13, 9651, 4974, 451, 7442, 29889, 1384, 29898, 9302, 29889, 275, 13707, 29898, 1285, 29918, 1272, 876, 13, 9651, 4974, 12700, 1839, 29876, 29918, 29883, 29887, 2033, 1275, 640, 29918, 1272, 29889, 12181, 29961, 29896, 29962, 13, 13, 9651, 1583, 29889, 7299, 1839, 29876, 29918, 1272, 2033, 353, 640, 29918, 1272, 29889, 12181, 29961, 29900, 29962, 13, 13, 4706, 565, 1583, 29889, 7299, 1839, 29876, 29918, 4117, 2033, 1275, 29871, 29900, 29901, 13, 9651, 1583, 29889, 7299, 1839, 29879, 7093, 2033, 353, 5159, 29871, 396, 694, 19554, 3651, 13, 9651, 1583, 29889, 7299, 1839, 1896, 327, 2033, 353, 29871, 29900, 13, 9651, 1583, 29889, 7299, 1839, 1127, 29918, 5563, 29879, 2033, 353, 7700, 29871, 396, 995, 28190, 29892, 694, 6635, 24987, 13, 9651, 1583, 29889, 7299, 1839, 4117, 29918, 29887, 2576, 29879, 2033, 353, 518, 29900, 29962, 13, 4706, 1683, 29901, 13, 9651, 565, 525, 29876, 29918, 1272, 29915, 297, 1583, 29889, 7299, 29901, 13, 18884, 4974, 1583, 29889, 7299, 1839, 29876, 29918, 1272, 2033, 1275, 6635, 29918, 1272, 29889, 12181, 29961, 29900, 29962, 13, 9651, 1683, 29901, 13, 18884, 1583, 29889, 7299, 1839, 29876, 29918, 1272, 2033, 353, 6635, 29918, 1272, 29889, 12181, 29961, 29900, 29962, 13, 13, 9651, 301, 4260, 353, 7442, 29889, 2083, 29898, 7299, 1839, 29879, 7093, 11287, 13, 9651, 565, 1583, 29889, 4117, 29918, 4830, 29918, 12403, 1275, 360, 5005, 17870, 29901, 13, 18884, 4974, 301, 4260, 1275, 6635, 29918, 1272, 29889, 12181, 29961, 29896, 29962, 13, 18884, 396, 29871, 29900, 29899, 386, 11174, 310, 278, 19554, 848, 526, 11122, 13, 18884, 396, 363, 2893, 6832, 3097, 29892, 5251, 393, 6590, 13, 18884, 396, 4128, 526, 1040, 22042, 304, 5225, 13, 18884, 1583, 29889, 7299, 1839, 1127, 29918, 5563, 29879, 2033, 353, 7700, 13, 9651, 25342, 1583, 29889, 4117, 29918, 4830, 29918, 12403, 1275, 360, 5005, 17870, 29918, 19386, 29901, 13, 18884, 4974, 301, 4260, 448, 12700, 1839, 29876, 29918, 4117, 2033, 1275, 6635, 29918, 1272, 29889, 12181, 29961, 29896, 29962, 13, 18884, 396, 5251, 393, 29871, 29900, 29899, 386, 11174, 526, 2175, 714, 297, 19554, 848, 13, 18884, 396, 1223, 1973, 2893, 6832, 3097, 310, 278, 1904, 13, 18884, 1583, 29889, 7299, 1839, 1127, 29918, 5563, 29879, 2033, 353, 5852, 13, 18884, 1583, 29889, 7299, 1839, 29879, 7093, 2033, 353, 518, 2311, 448, 29871, 29896, 363, 2159, 297, 12700, 1839, 29879, 7093, 2033, 29962, 13, 9651, 25342, 1583, 29889, 4117, 29918, 4830, 29918, 12403, 1275, 2672, 19577, 29901, 13, 18884, 4974, 12700, 1839, 29876, 29918, 4117, 2033, 1275, 6635, 29918, 1272, 29889, 12181, 29961, 29896, 29962, 13, 9651, 25342, 1583, 29889, 4117, 29918, 4830, 29918, 12403, 1275, 383, 29931, 1299, 29901, 29871, 396, 341, 3301, 899, 369, 13, 18884, 4974, 7431, 29898, 4117, 29918, 1272, 29889, 12181, 29897, 1275, 29871, 29896, 13, 9651, 1683, 29901, 13, 18884, 12020, 8960, 877, 20965, 1583, 29889, 4117, 29918, 4830, 29918, 12403, 1495, 13, 13, 4706, 565, 1583, 29889, 4117, 29918, 4830, 29918, 12403, 297, 313, 29928, 5005, 17870, 29892, 360, 5005, 17870, 29918, 19386, 1125, 13, 9651, 1583, 29889, 7299, 1839, 1896, 327, 2033, 353, 6635, 29918, 1272, 29889, 12181, 29961, 29896, 29962, 13, 9651, 1583, 29889, 7299, 1839, 6229, 2033, 353, 1583, 29889, 7299, 1839, 1896, 327, 2033, 718, 1583, 29889, 7299, 1839, 29876, 29918, 29883, 29887, 2033, 13, 13, 9651, 396, 8147, 13299, 28524, 396, 310, 11174, 29914, 2318, 628, 13083, 414, 13, 9651, 1583, 29889, 7299, 1839, 4117, 29918, 29887, 2576, 29879, 2033, 353, 7442, 29889, 29883, 398, 2083, 4197, 29900, 29962, 718, 1583, 29889, 7299, 1839, 29879, 7093, 11287, 13, 13, 9651, 1583, 29889, 7299, 1839, 29887, 2576, 29879, 2033, 353, 1051, 29898, 1311, 29889, 7299, 1839, 4117, 29918, 29887, 2576, 29879, 11287, 718, 320, 13, 18884, 518, 29896, 718, 1583, 29889, 7299, 1839, 1896, 327, 2033, 718, 269, 363, 269, 297, 3464, 29898, 1311, 29889, 7299, 1839, 29876, 29918, 29883, 29887, 2033, 4638, 13, 9651, 396, 14402, 29898, 29888, 10003, 3433, 1125, 1583, 29889, 7299, 1839, 29887, 2576, 29879, 2033, 363, 29234, 1072, 871, 13, 13, 9651, 1583, 29889, 7299, 1839, 5464, 19541, 2033, 353, 313, 1311, 29889, 7299, 1839, 1896, 327, 2033, 1405, 1583, 29889, 7299, 1839, 29876, 29918, 4117, 2033, 334, 13, 462, 462, 418, 313, 29906, 448, 1583, 29889, 7299, 1839, 1127, 29918, 5563, 29879, 25901, 13, 13, 4706, 1583, 29889, 7299, 1839, 29876, 29918, 4117, 29883, 29887, 2033, 353, 1583, 29889, 7299, 1839, 29876, 29918, 4117, 2033, 718, 1583, 29889, 7299, 1839, 29876, 29918, 29883, 29887, 2033, 13, 13, 4706, 396, 1583, 29889, 7299, 1839, 1853, 2033, 353, 679, 29918, 4299, 1853, 29898, 1311, 29889, 29876, 29918, 4117, 29892, 1583, 29889, 29876, 29918, 29883, 29887, 29892, 1583, 29889, 29879, 7093, 29897, 13, 4706, 396, 4706, 4024, 353, 7442, 29889, 1188, 29898, 1311, 29889, 7299, 1839, 29876, 29918, 29883, 29887, 2033, 718, 1583, 29889, 7299, 1839, 29876, 29918, 4117, 11287, 13, 4706, 4024, 353, 7442, 29889, 3676, 29898, 9302, 29889, 1188, 29898, 1311, 29889, 7299, 1839, 29876, 29918, 4117, 29883, 29887, 11287, 847, 1583, 29889, 7299, 1839, 29876, 29918, 1272, 11287, 13, 13, 4706, 1583, 29889, 7299, 1839, 1727, 29918, 17470, 2033, 353, 4024, 29871, 396, 19998, 1304, 408, 2225, 1052, 292, 7329, 13, 4706, 396, 363, 4943, 2133, 4128, 13, 13, 4706, 1583, 3032, 2490, 14669, 29918, 1272, 580, 13, 13, 1678, 822, 679, 29918, 978, 29898, 1311, 1125, 13, 4706, 9995, 2457, 1904, 1024, 15945, 29908, 13, 4706, 736, 1583, 29889, 978, 13, 13, 13, 1990, 7399, 29903, 5510, 13296, 369, 29898, 5160, 29907, 10749, 324, 369, 1125, 13, 1678, 9995, 13, 1678, 2967, 770, 393, 3743, 23203, 284, 12768, 13, 1678, 9995, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 671, 705, 5861, 29922, 8824, 1125, 13, 4706, 2428, 2141, 1649, 2344, 1649, 580, 13, 4706, 1583, 29889, 25707, 29889, 842, 4381, 877, 2696, 742, 29871, 29900, 29897, 29871, 396, 565, 29871, 29896, 4943, 675, 871, 1283, 29899, 6051, 351, 7177, 13, 4706, 396, 1904, 3987, 396, 14402, 29898, 29888, 10003, 3433, 1125, 1284, 2253, 2058, 13, 4706, 1583, 29889, 25707, 29889, 842, 4381, 877, 1509, 29918, 2312, 742, 29871, 29896, 29897, 13, 4706, 1583, 29889, 25707, 29889, 842, 4381, 877, 1509, 29918, 29884, 742, 29871, 29896, 29897, 13, 308, 13, 4706, 1583, 29889, 1509, 705, 5861, 353, 671, 705, 5861, 13, 4706, 1583, 29889, 705, 5861, 353, 6213, 13, 13, 4706, 1583, 29889, 978, 353, 525, 3188, 29899, 29879, 5510, 29915, 13, 13, 1678, 822, 903, 2490, 14669, 29918, 1272, 29898, 1311, 1125, 13, 4706, 9995, 13998, 1156, 5768, 29918, 1272, 15945, 29908, 13, 4706, 13, 4706, 565, 1583, 29889, 1509, 705, 5861, 29901, 13, 9651, 1583, 29889, 705, 5861, 353, 731, 29918, 29879, 862, 29879, 537, 29918, 705, 5861, 29898, 1311, 29889, 7299, 29892, 13, 462, 462, 18884, 1583, 29889, 4117, 29918, 1272, 29892, 13, 462, 462, 18884, 1583, 29889, 1285, 29918, 1272, 29897, 13, 4706, 1683, 29901, 13, 9651, 1583, 29889, 705, 5861, 353, 6213, 13, 13, 1678, 822, 14653, 682, 29898, 1311, 29892, 1775, 29918, 29879, 29892, 260, 585, 1125, 13, 4706, 9995, 2457, 313, 2972, 6817, 4964, 14653, 682, 310, 4636, 1775, 29918, 29879, 411, 260, 585, 9995, 13, 4706, 565, 1583, 29889, 7299, 1839, 5464, 19541, 2033, 29901, 13, 9651, 736, 867, 29886, 29918, 2695, 29918, 845, 29878, 682, 29898, 2922, 29918, 29879, 29892, 260, 585, 29892, 13, 462, 462, 259, 1583, 29889, 7299, 1839, 29876, 29918, 4117, 2033, 718, 1583, 29889, 7299, 1839, 29876, 29918, 29883, 29887, 7464, 13, 462, 462, 259, 1583, 29889, 7299, 1839, 29887, 2576, 29879, 7464, 13, 462, 462, 259, 1583, 29889, 25707, 1839, 2696, 7464, 13, 462, 462, 259, 18177, 29922, 1311, 29889, 705, 5861, 29897, 13, 4706, 736, 867, 29886, 29918, 2695, 29918, 845, 29878, 682, 29898, 2922, 29918, 29879, 29892, 13, 462, 1669, 260, 585, 29892, 13, 462, 1669, 1283, 29922, 1311, 29889, 25707, 1839, 2696, 7464, 13, 462, 1669, 18177, 29922, 1311, 29889, 705, 5861, 29897, 13, 13, 1678, 822, 29234, 29918, 12324, 29898, 1311, 29892, 1775, 29918, 29879, 1125, 13, 4706, 9995, 2457, 301, 29906, 29896, 29914, 301, 29896, 29899, 12324, 310, 1775, 29918, 29879, 15945, 29908, 13, 4706, 565, 1583, 29889, 7299, 1839, 5464, 19541, 2033, 29901, 13, 9651, 736, 301, 29906, 29896, 12324, 29898, 2922, 29918, 29879, 29892, 13, 462, 965, 1583, 29889, 7299, 1839, 29876, 29918, 4117, 2033, 718, 1583, 29889, 7299, 1839, 29876, 29918, 29883, 29887, 7464, 13, 462, 965, 1583, 29889, 7299, 1839, 29887, 2576, 29879, 7464, 13, 462, 965, 1583, 29889, 25707, 1839, 2696, 7464, 13, 462, 965, 18177, 29922, 1311, 29889, 705, 5861, 29897, 13, 4706, 736, 301, 29906, 29896, 12324, 29898, 2922, 29918, 29879, 29892, 1283, 29922, 1311, 29889, 25707, 1839, 2696, 7464, 18177, 29922, 1311, 29889, 705, 5861, 29897, 13, 13, 13, 1990, 7399, 25584, 13296, 369, 29898, 10736, 29889, 19658, 1125, 13, 1678, 9995, 13, 1678, 7399, 899, 369, 363, 4256, 1230, 313, 26167, 2272, 365, 29899, 28062, 10749, 29899, 29933, 29897, 899, 874, 13, 1678, 8128, 411, 3519, 304, 4870, 29914, 348, 4058, 4128, 964, 4608, 13, 1678, 9995, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 396, 4706, 1596, 877, 6644, 7399, 29907, 10749, 324, 369, 1495, 13, 4706, 2428, 2141, 1649, 2344, 1649, 580, 13, 13, 4706, 1583, 29889, 845, 11603, 353, 6213, 13, 4706, 1583, 29889, 29876, 29918, 7529, 353, 6213, 13, 13, 4706, 396, 4706, 1583, 29889, 17199, 29918, 16908, 353, 6213, 13, 13, 4706, 565, 451, 756, 5552, 29898, 1311, 29892, 525, 25707, 29374, 13, 9651, 396, 881, 2307, 367, 3342, 491, 916, 770, 13, 9651, 1583, 29889, 25707, 353, 6571, 13, 4706, 1583, 3032, 842, 29918, 4381, 29879, 580, 13, 13, 1678, 822, 903, 842, 29918, 4381, 29879, 29898, 1311, 1125, 13, 4706, 9995, 4381, 899, 369, 3987, 15945, 29908, 13, 4706, 1583, 29889, 25707, 29889, 842, 4381, 877, 18248, 742, 29871, 29896, 29897, 29871, 396, 2436, 1962, 13, 13, 4706, 444, 12091, 29161, 13, 4706, 1583, 29889, 25707, 29889, 842, 4381, 877, 1509, 29918, 2312, 742, 29871, 29896, 29897, 29871, 396, 671, 443, 27432, 403, 274, 1372, 4128, 29973, 13, 4706, 1583, 29889, 25707, 29889, 842, 4381, 877, 1509, 29918, 29884, 742, 29871, 29896, 29897, 29871, 396, 671, 443, 27432, 403, 19554, 4128, 29973, 13, 4706, 1583, 29889, 25707, 29889, 842, 4381, 877, 2696, 742, 29871, 29900, 29897, 29871, 396, 565, 29871, 29896, 4943, 675, 871, 1283, 29899, 6051, 351, 7177, 13, 13, 4706, 444, 25480, 16614, 322, 20341, 273, 2478, 13, 4706, 396, 4706, 1583, 29889, 25707, 29889, 842, 4381, 877, 370, 303, 324, 742, 29871, 29896, 29872, 29899, 29945, 29897, 13, 4706, 396, 4706, 1583, 29889, 25707, 29889, 842, 4381, 877, 276, 1896, 324, 742, 29871, 29896, 29872, 29899, 29945, 29897, 13, 4706, 1583, 29889, 25707, 29889, 842, 4381, 877, 25027, 742, 29871, 29896, 29872, 29899, 29896, 29906, 29897, 13, 4706, 1583, 29889, 25707, 29889, 842, 4381, 877, 3317, 1524, 742, 29871, 29945, 29900, 29900, 29897, 13, 13, 29937, 4706, 1583, 29889, 25707, 29889, 842, 4381, 877, 1509, 705, 5861, 742, 7700, 29897, 13, 29937, 4706, 1583, 29889, 25707, 29889, 842, 4381, 877, 3317, 10003, 742, 448, 29896, 29897, 13, 13, 29937, 1678, 732, 10736, 29889, 16595, 5696, 13, 29937, 1678, 822, 679, 29918, 23687, 29898, 1311, 1125, 13, 29937, 4706, 9995, 657, 13451, 15945, 29908, 13, 29937, 4706, 12020, 2216, 1888, 2037, 287, 2392, 396, 316, 14373, 304, 7399, 29950, 11234, 770, 13, 13, 1678, 732, 10736, 29889, 16595, 5696, 13, 1678, 822, 679, 29918, 29888, 791, 29918, 392, 29918, 5105, 29898, 1311, 29892, 3523, 16908, 29892, 9750, 29922, 29900, 29892, 3579, 19290, 1125, 13, 4706, 9995, 15807, 403, 740, 995, 322, 16030, 363, 899, 369, 15945, 29908, 13, 4706, 12020, 2216, 1888, 2037, 287, 2392, 13, 13, 1678, 822, 679, 29918, 7529, 29898, 1311, 29892, 3523, 16908, 1125, 13, 4706, 9995, 29874, 740, 304, 2479, 278, 1108, 4128, 15945, 29908, 13, 4706, 8636, 353, 1583, 29889, 348, 4058, 29898, 3670, 16908, 29897, 13, 4706, 363, 474, 29892, 1828, 297, 26985, 29898, 7529, 1125, 13, 9651, 1596, 877, 29995, 29879, 3583, 29876, 29915, 1273, 1583, 29889, 845, 11603, 29961, 29875, 3816, 29900, 1402, 1828, 29897, 13, 4706, 736, 8636, 13, 13, 1678, 822, 4870, 29898, 1311, 29892, 7117, 1125, 13, 4706, 9995, 4058, 313, 22449, 1711, 29897, 4656, 10070, 964, 4608, 921, 15945, 29908, 13, 4706, 4656, 353, 7442, 29889, 6310, 29898, 1311, 29889, 29876, 29918, 7529, 29897, 13, 4706, 9210, 353, 29871, 29900, 13, 4706, 363, 474, 29892, 4163, 297, 26985, 29898, 14036, 1125, 13, 9651, 2159, 353, 7442, 29889, 10633, 29898, 1311, 29889, 845, 11603, 29961, 29875, 3816, 29896, 2314, 13, 9651, 396, 9651, 1596, 29898, 1311, 29889, 845, 11603, 29961, 29875, 3816, 29900, 1402, 2159, 29892, 7442, 29889, 10633, 29898, 9700, 29889, 12181, 876, 13, 9651, 4974, 2159, 1275, 7442, 29889, 10633, 29898, 9700, 29889, 12181, 29897, 13, 9651, 4656, 29961, 10289, 29901, 10289, 718, 2159, 29962, 353, 4163, 29889, 1579, 8606, 580, 29871, 396, 1948, 29899, 3538, 13, 9651, 9210, 4619, 2159, 13, 4706, 736, 4656, 13, 13, 1678, 822, 443, 4058, 29898, 1311, 29892, 921, 29897, 1599, 20504, 519, 29961, 9302, 29889, 299, 2378, 5387, 13, 4706, 9995, 348, 4058, 1904, 4128, 515, 4608, 921, 29892, 4078, 29901, 3639, 3509, 15945, 29908, 13, 4706, 9210, 353, 29871, 29900, 13, 4706, 8636, 353, 5159, 13, 4706, 921, 8552, 353, 921, 29889, 8552, 580, 29871, 396, 6511, 23815, 278, 3509, 1728, 23815, 921, 13, 4706, 363, 17117, 528, 10501, 326, 297, 1583, 29889, 845, 11603, 29901, 13, 9651, 13128, 353, 7442, 29889, 10633, 29898, 845, 10501, 326, 29897, 13, 9651, 8636, 29889, 4397, 29898, 29916, 8552, 29961, 10289, 29901, 10289, 718, 13128, 1822, 690, 14443, 29898, 845, 10501, 326, 876, 13, 9651, 9210, 4619, 13128, 13, 13, 4706, 736, 8636, 13, 13, 13, 1990, 7399, 13296, 369, 12750, 29898, 5160, 29903, 5510, 13296, 369, 1125, 13, 1678, 9995, 13, 1678, 2967, 770, 363, 317, 29974, 29931, 1904, 899, 874, 13, 1678, 9995, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 334, 5085, 29892, 3579, 19290, 1125, 13, 4706, 2428, 2141, 1649, 2344, 1649, 10456, 5085, 29892, 3579, 19290, 29897, 13, 13, 4706, 1583, 29889, 2312, 29892, 1583, 29889, 3571, 353, 6213, 29892, 6213, 13, 4706, 1583, 29889, 27728, 1388, 29892, 1583, 29889, 4650, 353, 6213, 29892, 6213, 13, 13, 4706, 1583, 29889, 17199, 29918, 16908, 353, 6213, 13, 13, 1678, 822, 4770, 710, 12035, 1311, 1125, 13, 4706, 1347, 353, 12801, 3035, 7428, 2929, 369, 29958, 425, 16328, 29879, 29915, 1273, 313, 1311, 29889, 27728, 1388, 29897, 718, 13420, 364, 1251, 16328, 29879, 29915, 1273, 313, 1311, 29889, 4650, 29897, 13, 4706, 1347, 4619, 13420, 15595, 16328, 29879, 29915, 1273, 313, 1311, 29889, 2312, 29897, 718, 13420, 21762, 16328, 29879, 29915, 1273, 313, 1311, 29889, 3571, 29897, 13, 4706, 1347, 4619, 13420, 671, 29918, 2312, 16328, 29881, 29915, 1273, 313, 1311, 29889, 25707, 29889, 842, 4381, 877, 1509, 29918, 2312, 742, 29871, 29896, 876, 13, 4706, 1347, 4619, 13420, 671, 29918, 29884, 16328, 29881, 29915, 1273, 313, 1311, 29889, 25707, 29889, 842, 4381, 877, 1509, 29918, 29884, 742, 29871, 29896, 876, 13, 4706, 1347, 4619, 13420, 1283, 16328, 29881, 29915, 1273, 313, 1311, 29889, 25707, 29889, 842, 4381, 877, 2696, 742, 29871, 29896, 876, 13, 4706, 736, 1347, 13, 13, 1678, 822, 679, 29918, 3068, 265, 936, 7529, 29898, 1311, 1125, 13, 4706, 9995, 8015, 2546, 1960, 278, 349, 29956, 317, 29974, 29931, 8446, 1904, 4128, 515, 12151, 3443, 4608, 29889, 13, 13, 4706, 1962, 29901, 8125, 29918, 29925, 7811, 29931, 2777, 15945, 29908, 13, 13, 4706, 1775, 29918, 29879, 29892, 1775, 29918, 29880, 29892, 15595, 353, 1583, 29889, 17199, 29918, 16908, 13, 13, 4706, 301, 4260, 353, 1583, 29889, 7299, 1839, 1896, 327, 2033, 13, 13, 4706, 1775, 29918, 2892, 353, 448, 2922, 29918, 29879, 29961, 1896, 327, 29901, 29892, 301, 4260, 17531, 29871, 396, 274, 1372, 29899, 312, 29879, 4128, 13, 4706, 396, 505, 8178, 1804, 297, 8446, 5101, 3538, 14881, 3443, 4636, 13, 13, 4706, 565, 1583, 29889, 7299, 1839, 29876, 29918, 4117, 2033, 1405, 29871, 29900, 29901, 13, 13, 9651, 330, 2576, 29879, 353, 1583, 29889, 7299, 1839, 4117, 29918, 29887, 2576, 29879, 2033, 13, 9651, 15786, 353, 1583, 29889, 7299, 1839, 29879, 7093, 2033, 13, 13, 9651, 1775, 29918, 29939, 353, 1775, 29918, 29879, 7503, 1896, 327, 29892, 584, 1896, 327, 29962, 13, 9651, 1775, 29918, 29878, 353, 1775, 29918, 29879, 29961, 1896, 327, 29901, 29892, 584, 1896, 327, 29962, 13, 9651, 9649, 29918, 29884, 353, 29871, 29900, 29889, 29945, 334, 7442, 29889, 6051, 351, 29898, 2922, 29918, 29939, 467, 8552, 2141, 690, 14443, 29898, 1896, 327, 29897, 13, 9651, 363, 364, 297, 3464, 29898, 1311, 29889, 7299, 1839, 29876, 29918, 4117, 2033, 1125, 29871, 396, 731, 2908, 29899, 6051, 351, 7177, 304, 5225, 13, 18884, 1775, 29918, 29939, 29961, 29887, 2576, 29879, 29961, 29878, 5387, 29887, 2576, 29879, 29961, 29878, 29974, 29896, 1402, 13, 462, 418, 330, 2576, 29879, 29961, 29878, 5387, 29887, 2576, 29879, 29961, 29878, 29974, 29896, 5262, 353, 320, 13, 462, 418, 7442, 29889, 3298, 359, 3552, 29879, 7093, 29961, 29878, 1402, 15786, 29961, 29878, 12622, 13, 13, 9651, 565, 1583, 29889, 7299, 1839, 1127, 29918, 5563, 29879, 2033, 29901, 13, 18884, 2989, 29879, 7093, 353, 518, 2311, 718, 29871, 29896, 363, 2159, 297, 15786, 29962, 13, 9651, 1683, 29901, 13, 18884, 2989, 29879, 7093, 353, 15786, 13, 4706, 1683, 29901, 13, 9651, 1775, 29918, 29939, 353, 7442, 29889, 6310, 29898, 29900, 29897, 13, 9651, 1775, 29918, 29878, 353, 7442, 29889, 6310, 29898, 29900, 29897, 13, 9651, 9649, 29918, 29884, 353, 7442, 29889, 6310, 29898, 29900, 29897, 13, 9651, 2989, 29879, 7093, 353, 5159, 13, 13, 4706, 508, 29918, 29886, 29893, 2536, 353, 9649, 29918, 29884, 29892, 1775, 29918, 29939, 29892, 1775, 29918, 29878, 29892, 15595, 29892, 1775, 29918, 2892, 29892, 1775, 29918, 29880, 13, 13, 4706, 25495, 353, 426, 13, 9651, 525, 29876, 2396, 1583, 29889, 7299, 1839, 29876, 29918, 1272, 7464, 13, 9651, 525, 2892, 2396, 1583, 29889, 27728, 1388, 29892, 13, 9651, 525, 4650, 2396, 1583, 29889, 4650, 13, 4706, 500, 13, 13, 4706, 12700, 353, 426, 13, 9651, 525, 29876, 29918, 4117, 2396, 1583, 29889, 7299, 1839, 29876, 29918, 4117, 7464, 13, 9651, 525, 29876, 29918, 29883, 29887, 2396, 1583, 29889, 7299, 1839, 29876, 29918, 29883, 29887, 7464, 13, 9651, 525, 29879, 7093, 2396, 2989, 29879, 7093, 13, 4706, 500, 13, 13, 4706, 736, 8125, 29925, 7811, 29931, 29898, 3068, 29918, 29886, 29893, 2536, 29892, 13, 462, 308, 12700, 29892, 13, 462, 308, 25495, 29922, 6735, 800, 29892, 13, 462, 308, 297, 29918, 29886, 23959, 29922, 8824, 29897, 13, 13, 1678, 822, 679, 29918, 15227, 2133, 29918, 7529, 29898, 1311, 1125, 13, 4706, 9995, 657, 4943, 2133, 4128, 15945, 29908, 13, 4706, 736, 1583, 29889, 27728, 1388, 29892, 1583, 29889, 4650, 13, 13, 1678, 822, 731, 29918, 15227, 2133, 29918, 7529, 29898, 1311, 29892, 13, 462, 462, 29871, 11266, 7529, 29892, 13, 462, 462, 29871, 23431, 29922, 8516, 29892, 13, 462, 462, 29871, 731, 29918, 11851, 29922, 8824, 29892, 13, 462, 462, 29871, 282, 1853, 29901, 851, 353, 525, 4172, 1495, 1599, 6213, 29901, 13, 4706, 9995, 842, 4943, 2133, 4128, 13, 13, 4706, 11266, 7529, 2023, 5101, 310, 4943, 2133, 4128, 13, 13, 4706, 282, 1853, 2023, 565, 525, 4172, 742, 13, 18884, 731, 14013, 29892, 364, 1251, 353, 11266, 7529, 334, 21640, 29898, 29876, 29892, 302, 16908, 511, 988, 13, 18884, 278, 4128, 526, 363, 278, 1108, 13, 462, 1678, 1375, 301, 29898, 29903, 29899, 29931, 29897, 718, 14013, 334, 3830, 29903, 8876, 29918, 29896, 718, 364, 1251, 334, 534, 29898, 29931, 29897, 13, 462, 1678, 269, 29889, 29873, 29889, 317, 29899, 29931, 29958, 29900, 29892, 365, 18572, 29900, 13, 18884, 2266, 29892, 21640, 29898, 29876, 29892, 302, 16908, 29897, 338, 263, 21640, 7829, 491, 13, 18884, 5718, 3819, 2582, 13, 18884, 23125, 529, 19529, 267, 29958, 338, 451, 1304, 297, 445, 1206, 29991, 13, 795, 565, 525, 11851, 742, 4153, 731, 14013, 29892, 364, 1251, 353, 11266, 7529, 13, 795, 565, 525, 535, 13809, 29915, 5251, 393, 15595, 29892, 21762, 353, 11266, 7529, 322, 13, 795, 15595, 29892, 21762, 526, 18177, 297, 518, 29900, 29892, 29896, 29962, 322, 278, 1108, 338, 13, 1669, 1375, 313, 29896, 29899, 2312, 29899, 3571, 29897, 334, 301, 29898, 29903, 29899, 29931, 29897, 718, 15595, 334, 3830, 29903, 8876, 29918, 29896, 718, 21762, 334, 534, 29898, 29931, 29897, 13, 1669, 269, 29889, 29873, 29889, 317, 29899, 29931, 29958, 29900, 29892, 365, 18572, 29900, 13, 13, 4706, 512, 6124, 304, 278, 6790, 4943, 2133, 4128, 29892, 13, 4706, 278, 4943, 2133, 4128, 508, 367, 6287, 29881, 491, 263, 4343, 995, 313, 2716, 2548, 13, 4706, 373, 278, 1353, 310, 848, 3291, 322, 3651, 1125, 13, 13, 4706, 23431, 2023, 565, 6213, 29892, 671, 3918, 21640, 7442, 29889, 3676, 29898, 1188, 29898, 20726, 6802, 29876, 29897, 13, 462, 259, 1683, 29871, 23431, 1818, 367, 263, 1023, 29899, 23583, 29892, 322, 14013, 322, 364, 1251, 526, 13, 462, 259, 6287, 29881, 5034, 304, 278, 3161, 310, 445, 1023, 29899, 23583, 13, 4706, 9995, 13, 4706, 4974, 7431, 29898, 24947, 7529, 29897, 1275, 29871, 29906, 13, 4706, 4974, 11266, 7529, 29961, 29900, 29962, 6736, 29871, 29900, 322, 11266, 7529, 29961, 29896, 29962, 6736, 29871, 29900, 13, 13, 4706, 565, 282, 1853, 1275, 525, 4172, 2396, 13, 9651, 396, 3918, 4943, 2133, 4128, 13, 9651, 396, 937, 363, 301, 29906, 29896, 29892, 1473, 363, 20346, 6056, 13, 9651, 1583, 29889, 27728, 1388, 29892, 1583, 29889, 4650, 353, 11266, 7529, 13, 4706, 25342, 282, 1853, 1275, 525, 535, 13809, 2396, 13, 9651, 15595, 29892, 21762, 353, 11266, 7529, 13, 9651, 396, 9651, 4974, 15595, 718, 21762, 5277, 29871, 29896, 13, 9651, 4974, 15595, 718, 21762, 529, 29871, 29896, 29892, 376, 21969, 1712, 4188, 22342, 760, 29908, 13, 13, 9651, 1583, 29889, 2312, 353, 15595, 13, 9651, 1583, 29889, 3571, 353, 21762, 13, 13, 9651, 972, 290, 353, 29871, 29896, 448, 15595, 448, 21762, 13, 13, 9651, 565, 972, 290, 2804, 29871, 29900, 29901, 13, 18884, 1583, 29889, 27728, 1388, 353, 15595, 847, 972, 290, 13, 18884, 1583, 29889, 4650, 353, 21762, 847, 972, 290, 13, 29937, 9651, 1683, 29901, 13, 29937, 18884, 396, 694, 4188, 22342, 760, 13, 29937, 18884, 1583, 29889, 27728, 1388, 29892, 1583, 29889, 4650, 353, 29871, 29900, 29892, 29871, 29900, 13, 4706, 1683, 29901, 13, 9651, 12020, 8960, 877, 26690, 282, 1853, 1495, 13, 13, 4706, 565, 451, 731, 29918, 11851, 29901, 13, 9651, 565, 451, 23431, 338, 6213, 29901, 13, 18884, 6287, 29918, 27728, 1388, 29892, 6287, 29918, 4650, 353, 23431, 13, 9651, 1683, 29901, 13, 18884, 4974, 1583, 29889, 7299, 1839, 29876, 29918, 1272, 2033, 1405, 29871, 29900, 29892, 320, 13, 462, 1678, 376, 1272, 29899, 18980, 21640, 29892, 5768, 848, 937, 29908, 13, 18884, 396, 8147, 2225, 1052, 292, 7329, 363, 278, 4943, 2133, 4128, 13, 18884, 396, 2729, 373, 5718, 3819, 7418, 491, 678, 27177, 559, 5689, 273, 634, 29889, 394, 313, 29906, 29900, 29896, 29900, 29897, 13, 13, 18884, 396, 4974, 525, 1727, 29918, 17470, 29915, 297, 1583, 29889, 7299, 13, 18884, 6287, 29918, 27728, 1388, 353, 1583, 29889, 7299, 1839, 1727, 29918, 17470, 2033, 13, 18884, 6287, 29918, 4650, 353, 1583, 29889, 7299, 1839, 1727, 29918, 17470, 2033, 13, 9651, 1583, 29889, 27728, 1388, 334, 29922, 6287, 29918, 27728, 1388, 13, 9651, 1583, 29889, 4650, 334, 29922, 6287, 29918, 4650, 13, 13, 13, 1990, 7399, 13296, 369, 29925, 29956, 29898, 5160, 29903, 5510, 13296, 369, 1125, 13, 1678, 9995, 13, 1678, 2967, 770, 363, 29234, 3983, 936, 1904, 899, 874, 13, 1678, 9995, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 334, 5085, 29892, 3579, 19290, 1125, 13, 4706, 2428, 2141, 1649, 2344, 1649, 10456, 5085, 29892, 3579, 19290, 29897, 13, 13, 4706, 1583, 29889, 2312, 353, 6213, 13, 4706, 1583, 29889, 27728, 1388, 353, 6213, 13, 13, 4706, 1583, 29889, 17199, 29918, 16908, 353, 6213, 13, 13, 1678, 822, 4770, 710, 12035, 1311, 1125, 13, 4706, 1347, 353, 12801, 3035, 7428, 2929, 369, 29958, 425, 16328, 29879, 29915, 1273, 313, 1311, 29889, 27728, 1388, 29897, 13, 4706, 1347, 4619, 13420, 671, 29918, 2312, 16328, 29881, 29915, 1273, 313, 1311, 29889, 25707, 29889, 842, 4381, 877, 1509, 29918, 2312, 742, 29871, 29896, 876, 13, 4706, 1347, 4619, 13420, 671, 29918, 29884, 16328, 29881, 29915, 1273, 313, 1311, 29889, 25707, 29889, 842, 4381, 877, 1509, 29918, 29884, 742, 29871, 29896, 876, 13, 4706, 1347, 4619, 13420, 1283, 16328, 29881, 29915, 1273, 313, 1311, 29889, 25707, 29889, 842, 4381, 877, 2696, 742, 29871, 29896, 876, 13, 4706, 736, 1347, 13, 13, 1678, 822, 679, 29918, 3068, 265, 936, 7529, 29898, 1311, 1125, 13, 4706, 9995, 8015, 2546, 1960, 278, 349, 29956, 8446, 1904, 4128, 515, 12151, 3443, 4608, 29889, 13, 13, 4706, 1962, 29901, 8125, 29918, 29925, 29956, 2777, 15945, 29908, 13, 13, 4706, 1775, 29918, 29879, 29892, 15595, 353, 1583, 29889, 17199, 29918, 16908, 13, 13, 4706, 301, 4260, 353, 1583, 29889, 7299, 1839, 1896, 327, 2033, 13, 13, 4706, 1775, 29918, 2892, 353, 448, 2922, 29918, 29879, 29961, 1896, 327, 29901, 29892, 301, 4260, 17531, 29871, 396, 274, 1372, 29899, 312, 29879, 4128, 13, 4706, 396, 505, 8178, 1804, 297, 8446, 5101, 3538, 14881, 3443, 4636, 13, 13, 4706, 565, 1583, 29889, 7299, 1839, 29876, 29918, 4117, 2033, 1405, 29871, 29900, 29901, 13, 13, 9651, 330, 2576, 29879, 353, 1583, 29889, 7299, 1839, 4117, 29918, 29887, 2576, 29879, 2033, 13, 9651, 15786, 353, 1583, 29889, 7299, 1839, 29879, 7093, 2033, 13, 13, 9651, 1775, 29918, 29939, 353, 1775, 29918, 29879, 7503, 1896, 327, 29892, 584, 1896, 327, 29962, 13, 9651, 1775, 29918, 29878, 353, 1775, 29918, 29879, 29961, 1896, 327, 29901, 29892, 584, 1896, 327, 29962, 13, 9651, 9649, 29918, 29884, 353, 29871, 29900, 29889, 29945, 334, 7442, 29889, 6051, 351, 29898, 2922, 29918, 29939, 467, 8552, 2141, 690, 14443, 29898, 1896, 327, 29897, 13, 9651, 363, 364, 297, 3464, 29898, 1311, 29889, 7299, 1839, 29876, 29918, 4117, 2033, 1125, 29871, 396, 731, 2908, 29899, 6051, 351, 7177, 304, 5225, 13, 18884, 1775, 29918, 29939, 29961, 29887, 2576, 29879, 29961, 29878, 5387, 29887, 2576, 29879, 29961, 29878, 29974, 29896, 1402, 13, 462, 418, 330, 2576, 29879, 29961, 29878, 5387, 29887, 2576, 29879, 29961, 29878, 29974, 29896, 5262, 353, 320, 13, 462, 418, 7442, 29889, 3298, 359, 3552, 29879, 7093, 29961, 29878, 1402, 15786, 29961, 29878, 12622, 13, 13, 9651, 565, 1583, 29889, 7299, 1839, 1127, 29918, 5563, 29879, 2033, 29901, 13, 18884, 2989, 29879, 7093, 353, 518, 2311, 718, 29871, 29896, 363, 2159, 297, 15786, 29962, 13, 9651, 1683, 29901, 13, 18884, 2989, 29879, 7093, 353, 15786, 13, 4706, 1683, 29901, 13, 9651, 1775, 29918, 29939, 353, 7442, 29889, 6310, 29898, 29900, 29897, 13, 9651, 1775, 29918, 29878, 353, 7442, 29889, 6310, 29898, 29900, 29897, 13, 9651, 9649, 29918, 29884, 353, 7442, 29889, 6310, 29898, 29900, 29897, 13, 9651, 2989, 29879, 7093, 353, 5159, 13, 13, 4706, 508, 29918, 7529, 353, 9649, 29918, 29884, 29892, 1775, 29918, 29939, 29892, 1775, 29918, 29878, 29892, 15595, 29892, 1775, 29918, 2892, 13, 13, 4706, 25495, 353, 426, 13, 9651, 525, 29876, 2396, 1583, 29889, 7299, 1839, 29876, 29918, 1272, 7464, 13, 9651, 525, 2892, 2396, 1583, 29889, 27728, 1388, 29892, 13, 4706, 500, 13, 13, 4706, 12700, 353, 426, 13, 9651, 525, 29876, 29918, 4117, 2396, 1583, 29889, 7299, 1839, 29876, 29918, 4117, 7464, 13, 9651, 525, 29876, 29918, 29883, 29887, 2396, 1583, 29889, 7299, 1839, 29876, 29918, 29883, 29887, 7464, 13, 9651, 525, 29879, 7093, 2396, 2989, 29879, 7093, 13, 4706, 500, 13, 13, 4706, 736, 8125, 29925, 29956, 29898, 3068, 29918, 7529, 29892, 13, 462, 539, 12700, 29892, 13, 462, 539, 25495, 29922, 6735, 800, 29892, 13, 462, 539, 297, 29918, 29886, 23959, 29922, 8824, 29897, 13, 13, 1678, 822, 679, 29918, 15227, 2133, 29918, 7529, 29898, 1311, 1125, 13, 4706, 9995, 657, 4943, 2133, 4128, 15945, 29908, 13, 4706, 736, 1583, 29889, 27728, 1388, 13, 13, 1678, 822, 731, 29918, 15227, 2133, 29918, 7529, 29898, 1311, 29892, 1072, 3207, 29892, 731, 29918, 11851, 29922, 8824, 29892, 13, 462, 462, 29871, 6287, 29922, 8516, 29892, 282, 1853, 2433, 4172, 29374, 13, 4706, 9995, 842, 4943, 2133, 4128, 363, 13, 4706, 1375, 301, 29898, 29903, 29897, 718, 425, 29930, 8876, 29903, 8876, 648, 29906, 29914, 29896, 29913, 13, 13, 4706, 11266, 7529, 2023, 5101, 310, 4943, 2133, 4128, 13, 13, 4706, 282, 1853, 2023, 565, 525, 4172, 742, 13, 18884, 731, 14013, 353, 1072, 3207, 334, 21640, 29898, 29876, 29892, 302, 16908, 511, 988, 13, 18884, 2266, 29892, 21640, 29898, 29876, 29892, 302, 16908, 29897, 338, 263, 21640, 7829, 491, 13, 18884, 5718, 3819, 2582, 13, 18884, 23125, 529, 19529, 267, 29958, 338, 451, 1304, 297, 445, 1206, 29991, 13, 795, 565, 525, 11851, 742, 4153, 731, 14013, 353, 1072, 3207, 13, 795, 565, 525, 535, 13809, 29915, 5251, 393, 15595, 353, 1072, 3207, 322, 13, 18884, 1375, 29918, 29903, 313, 29896, 29899, 2312, 29897, 334, 301, 29898, 29903, 29897, 718, 15595, 334, 3830, 29903, 8876, 29918, 426, 29906, 29892, 29896, 29913, 13, 13, 4706, 512, 6124, 304, 278, 6790, 4943, 2133, 3443, 29892, 13, 4706, 278, 4943, 2133, 4128, 508, 367, 6287, 29881, 491, 263, 4343, 995, 313, 2716, 2548, 13, 4706, 373, 278, 1353, 310, 848, 3291, 322, 3651, 1125, 13, 13, 4706, 23431, 2023, 565, 6213, 29892, 671, 3918, 21640, 7442, 29889, 3676, 29898, 1188, 29898, 20726, 6802, 29876, 29897, 13, 462, 259, 1683, 29871, 23431, 1818, 367, 263, 1661, 22198, 1353, 411, 607, 14013, 13, 462, 259, 338, 6287, 29881, 13, 4706, 9995, 13, 13, 4706, 565, 282, 1853, 1275, 525, 4172, 2396, 396, 3918, 4943, 2133, 3443, 363, 301, 29906, 29896, 29899, 12324, 13, 9651, 1583, 29889, 27728, 1388, 353, 1072, 3207, 13, 13, 4706, 25342, 282, 1853, 1275, 525, 535, 13809, 2396, 396, 18635, 11266, 7529, 526, 12023, 13, 9651, 1583, 29889, 2312, 353, 1072, 3207, 13, 9651, 4974, 1583, 29889, 2312, 529, 29871, 29896, 29892, 376, 21969, 1712, 4188, 22342, 760, 29908, 13, 9651, 972, 290, 353, 29871, 29896, 448, 1583, 29889, 2312, 13, 9651, 565, 972, 290, 2804, 29871, 29900, 29901, 13, 18884, 1583, 29889, 27728, 1388, 353, 1583, 29889, 2312, 29914, 1145, 290, 13, 9651, 1683, 29901, 13, 18884, 1583, 29889, 27728, 1388, 353, 29871, 29900, 13, 4706, 1683, 29901, 13, 9651, 12020, 8960, 877, 26690, 282, 1853, 1495, 13, 13, 13, 4706, 565, 451, 731, 29918, 11851, 29901, 13, 9651, 565, 6287, 338, 6213, 29901, 13, 18884, 4974, 1583, 29889, 7299, 1839, 29876, 29918, 1272, 2033, 1405, 29871, 29900, 29892, 320, 13, 462, 1678, 376, 1272, 29899, 18980, 21640, 29892, 5768, 848, 937, 29908, 13, 18884, 6287, 353, 1583, 29889, 7299, 1839, 1727, 29918, 17470, 2033, 13, 13, 9651, 1583, 29889, 27728, 1388, 334, 29922, 6287, 13, 2 ]
temporalio/bridge/proto/external_data/external_data_pb2.py
cretz/temporal-sdk-python
55
1618002
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: temporal/sdk/core/external_data/external_data.proto """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool from google.protobuf import message as _message from google.protobuf import reflection as _reflection from google.protobuf import symbol_database as _symbol_database # @@protoc_insertion_point(imports) _sym_db = _symbol_database.Default() from google.protobuf import duration_pb2 as google_dot_protobuf_dot_duration__pb2 from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2 DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( b'\n3temporal/sdk/core/external_data/external_data.proto\x12\x15\x63oresdk.external_data\x1a\x1egoogle/protobuf/duration.proto\x1a\x1fgoogle/protobuf/timestamp.proto"\xfe\x01\n\x17LocalActivityMarkerData\x12\x0b\n\x03seq\x18\x01 \x01(\r\x12\x0f\n\x07\x61ttempt\x18\x02 \x01(\r\x12\x13\n\x0b\x61\x63tivity_id\x18\x03 \x01(\t\x12\x15\n\ractivity_type\x18\x04 \x01(\t\x12\x31\n\rcomplete_time\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12*\n\x07\x62\x61\x63koff\x18\x06 \x01(\x0b\x32\x19.google.protobuf.Duration\x12:\n\x16original_schedule_time\x18\x07 \x01(\x0b\x32\x1a.google.protobuf.Timestampb\x06proto3' ) _LOCALACTIVITYMARKERDATA = DESCRIPTOR.message_types_by_name["LocalActivityMarkerData"] LocalActivityMarkerData = _reflection.GeneratedProtocolMessageType( "LocalActivityMarkerData", (_message.Message,), { "DESCRIPTOR": _LOCALACTIVITYMARKERDATA, "__module__": "temporal.sdk.core.external_data.external_data_pb2" # @@protoc_insertion_point(class_scope:coresdk.external_data.LocalActivityMarkerData) }, ) _sym_db.RegisterMessage(LocalActivityMarkerData) if _descriptor._USE_C_DESCRIPTORS == False: DESCRIPTOR._options = None _LOCALACTIVITYMARKERDATA._serialized_start = 144 _LOCALACTIVITYMARKERDATA._serialized_end = 398 # @@protoc_insertion_point(module_scope)
[ 1, 396, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 29937, 3251, 630, 491, 278, 9608, 6835, 6516, 29889, 29871, 11662, 6058, 11488, 29991, 13, 29937, 2752, 29901, 25406, 29914, 15348, 29914, 3221, 29914, 23176, 29918, 1272, 29914, 23176, 29918, 1272, 29889, 17529, 13, 15945, 29908, 24565, 9608, 6835, 775, 1213, 15945, 13, 3166, 5386, 29889, 17529, 9721, 1053, 553, 11709, 408, 903, 2783, 11709, 13, 3166, 5386, 29889, 17529, 9721, 1053, 553, 11709, 29918, 10109, 408, 903, 2783, 11709, 29918, 10109, 13, 3166, 5386, 29889, 17529, 9721, 1053, 2643, 408, 903, 4906, 13, 3166, 5386, 29889, 17529, 9721, 1053, 17842, 408, 903, 999, 1464, 13, 3166, 5386, 29889, 17529, 9721, 1053, 5829, 29918, 9803, 408, 903, 18098, 29918, 9803, 13, 13, 29937, 732, 29992, 17529, 29883, 29918, 7851, 291, 29918, 3149, 29898, 326, 4011, 29897, 13, 13, 29918, 11967, 29918, 2585, 353, 903, 18098, 29918, 9803, 29889, 4592, 580, 13, 13, 13, 3166, 5386, 29889, 17529, 9721, 1053, 14385, 29918, 24381, 29906, 408, 5386, 29918, 6333, 29918, 17529, 9721, 29918, 6333, 29918, 19708, 1649, 24381, 29906, 13, 3166, 5386, 29889, 17529, 9721, 1053, 14334, 29918, 24381, 29906, 408, 5386, 29918, 6333, 29918, 17529, 9721, 29918, 6333, 29918, 16394, 1649, 24381, 29906, 13, 13, 2287, 7187, 24290, 1955, 353, 903, 2783, 11709, 29918, 10109, 29889, 4592, 2141, 2528, 9125, 1891, 2283, 29898, 13, 1678, 289, 12764, 29876, 29941, 1356, 1971, 284, 29914, 15348, 29914, 3221, 29914, 23176, 29918, 1272, 29914, 23176, 29918, 1272, 29889, 17529, 29905, 29916, 29896, 29906, 29905, 29916, 29896, 29945, 29905, 29916, 29953, 29941, 2361, 8181, 29889, 23176, 29918, 1272, 29905, 29916, 29896, 29874, 29905, 29916, 29896, 2412, 1882, 29914, 17529, 9721, 29914, 19708, 29889, 17529, 29905, 29916, 29896, 29874, 29905, 29916, 29896, 29888, 3608, 29914, 17529, 9721, 29914, 16394, 29889, 17529, 26732, 29916, 1725, 29905, 29916, 29900, 29896, 29905, 29876, 29905, 29916, 29896, 29955, 7717, 3886, 24619, 1469, 29905, 29916, 29896, 29906, 29905, 29916, 29900, 29890, 29905, 29876, 29905, 29916, 29900, 29941, 11762, 29905, 29916, 29896, 29947, 29905, 29916, 29900, 29896, 320, 29916, 29900, 29896, 1194, 29878, 29905, 29916, 29896, 29906, 29905, 29916, 29900, 29888, 29905, 29876, 29905, 29916, 29900, 29955, 29905, 29916, 29953, 29896, 698, 3456, 29905, 29916, 29896, 29947, 29905, 29916, 29900, 29906, 320, 29916, 29900, 29896, 1194, 29878, 29905, 29916, 29896, 29906, 29905, 29916, 29896, 29941, 29905, 29876, 29905, 29916, 29900, 29890, 29905, 29916, 29953, 29896, 29905, 29916, 29953, 29941, 29873, 2068, 29918, 333, 29905, 29916, 29896, 29947, 29905, 29916, 29900, 29941, 320, 29916, 29900, 29896, 1194, 29873, 29905, 29916, 29896, 29906, 29905, 29916, 29896, 29945, 29905, 29876, 29905, 1461, 2068, 29918, 1853, 29905, 29916, 29896, 29947, 29905, 29916, 29900, 29946, 320, 29916, 29900, 29896, 1194, 29873, 29905, 29916, 29896, 29906, 29905, 29916, 29941, 29896, 29905, 29876, 29905, 29878, 8835, 29918, 2230, 29905, 29916, 29896, 29947, 29905, 29916, 29900, 29945, 320, 29916, 29900, 29896, 1194, 29916, 29900, 29890, 29905, 29916, 29941, 29906, 29905, 29916, 29896, 29874, 29889, 3608, 29889, 17529, 9721, 29889, 27939, 29905, 29916, 29896, 29906, 17710, 29876, 29905, 29916, 29900, 29955, 29905, 29916, 29953, 29906, 29905, 29916, 29953, 29896, 29905, 29916, 29953, 29941, 29895, 2696, 29905, 29916, 29896, 29947, 29905, 29916, 29900, 29953, 320, 29916, 29900, 29896, 1194, 29916, 29900, 29890, 29905, 29916, 29941, 29906, 29905, 29916, 29896, 29929, 29889, 3608, 29889, 17529, 9721, 29889, 18984, 29905, 29916, 29896, 29906, 3583, 29876, 29905, 29916, 29896, 29953, 13492, 29918, 816, 11272, 29918, 2230, 29905, 29916, 29896, 29947, 29905, 29916, 29900, 29955, 320, 29916, 29900, 29896, 1194, 29916, 29900, 29890, 29905, 29916, 29941, 29906, 29905, 29916, 29896, 29874, 29889, 3608, 29889, 17529, 9721, 29889, 27939, 29890, 29905, 29916, 29900, 29953, 17529, 29941, 29915, 13, 29897, 13, 13, 13, 29918, 16652, 1964, 17923, 5667, 11937, 1529, 29934, 29968, 1001, 14573, 353, 23050, 24290, 1955, 29889, 4906, 29918, 8768, 29918, 1609, 29918, 978, 3366, 7717, 3886, 24619, 1469, 3108, 13, 7717, 3886, 24619, 1469, 353, 903, 999, 1464, 29889, 24565, 17830, 3728, 1542, 29898, 13, 1678, 376, 7717, 3886, 24619, 1469, 613, 13, 1678, 9423, 4906, 29889, 3728, 29892, 511, 13, 1678, 426, 13, 4706, 376, 2287, 7187, 24290, 1955, 1115, 903, 16652, 1964, 17923, 5667, 11937, 1529, 29934, 29968, 1001, 14573, 29892, 13, 4706, 376, 1649, 5453, 1649, 1115, 376, 1356, 1971, 284, 29889, 15348, 29889, 3221, 29889, 23176, 29918, 1272, 29889, 23176, 29918, 1272, 29918, 24381, 29906, 29908, 13, 4706, 396, 732, 29992, 17529, 29883, 29918, 7851, 291, 29918, 3149, 29898, 1990, 29918, 6078, 29901, 29883, 2361, 8181, 29889, 23176, 29918, 1272, 29889, 7717, 3886, 24619, 1469, 29897, 13, 1678, 2981, 13, 29897, 13, 29918, 11967, 29918, 2585, 29889, 15213, 3728, 29898, 7717, 3886, 24619, 1469, 29897, 13, 13, 361, 903, 2783, 11709, 3032, 17171, 29918, 29907, 29918, 2287, 7187, 24290, 24125, 1275, 7700, 29901, 13, 13, 1678, 23050, 24290, 1955, 3032, 6768, 353, 6213, 13, 1678, 903, 16652, 1964, 17923, 5667, 11937, 1529, 29934, 29968, 1001, 14573, 3032, 15550, 1891, 29918, 2962, 353, 29871, 29896, 29946, 29946, 13, 1678, 903, 16652, 1964, 17923, 5667, 11937, 1529, 29934, 29968, 1001, 14573, 3032, 15550, 1891, 29918, 355, 353, 29871, 29941, 29929, 29947, 13, 29937, 732, 29992, 17529, 29883, 29918, 7851, 291, 29918, 3149, 29898, 5453, 29918, 6078, 29897, 13, 2 ]
lantz/drivers/newport/__init__.py
noelniles/lantz
88
146796
# -*- coding: utf-8 -*- """ lantz.drivers.newport ~~~~~~~~~~~~~~~~~~~~~ :company: Newport. :description: Test and Measurement Equipment. :website: http://www.newport.com/ --- :copyright: 2015 by Lantz Authors, see AUTHORS for more details. :license: BSD, """ from .powermeter1830c import PowerMeter1830c __all__ = ['PowerMeter1830c']
[ 1, 396, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 15945, 29908, 13, 1678, 301, 424, 29920, 29889, 24477, 874, 29889, 1482, 637, 13, 1678, 3695, 26594, 26594, 14087, 13, 13, 1678, 584, 14518, 29901, 1570, 637, 29889, 13, 1678, 584, 8216, 29901, 4321, 322, 2191, 3745, 358, 11243, 666, 358, 29889, 13, 1678, 584, 22942, 29901, 1732, 597, 1636, 29889, 1482, 637, 29889, 510, 29914, 13, 13, 1678, 11474, 13, 13, 1678, 584, 8552, 1266, 29901, 29871, 29906, 29900, 29896, 29945, 491, 365, 424, 29920, 13189, 943, 29892, 1074, 26524, 29950, 24125, 363, 901, 4902, 29889, 13, 1678, 584, 506, 1947, 29901, 350, 7230, 29892, 13, 13, 15945, 29908, 13, 13, 3166, 869, 12248, 837, 1308, 29896, 29947, 29941, 29900, 29883, 1053, 9206, 29924, 1308, 29896, 29947, 29941, 29900, 29883, 13, 13, 1649, 497, 1649, 353, 6024, 21472, 29924, 1308, 29896, 29947, 29941, 29900, 29883, 2033, 13, 2 ]
covid_xrays/tests/test_client.py
hosamshahin/covid_xrays
1
119212
<gh_stars>1-10 import json from base64 import b64encode from app.models.users import User from app.models.logs import Log import pytest def get_api_headers(username, password): return { 'Authorization': 'Basic ' + b64encode( (username + ':' + password).encode('utf-8')).decode('utf-8'), 'Accept': 'application/json', 'Content-Type': 'application/json' } def test_404(flask_test_client): response = flask_test_client.get('/wrong/url') assert response.status_code == 404 assert r'Not Found' in response.get_data(as_text=True) def test_home(flask_test_client): response = flask_test_client.get('/') assert response.status_code == 200 def test_ml_datasets_app(flask_test_client): response = flask_test_client.get('/ml_datasets', follow_redirects=True) assert response.status_code == 200 def test_reaction_dataset_app(flask_test_client): response = flask_test_client.get('/covid_form', follow_redirects=True) assert response.status_code == 200
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 5215, 4390, 13, 3166, 2967, 29953, 29946, 1053, 289, 29953, 29946, 12508, 13, 3166, 623, 29889, 9794, 29889, 7193, 1053, 4911, 13, 3166, 623, 29889, 9794, 29889, 20756, 1053, 4522, 13, 5215, 11451, 1688, 13, 13, 13, 1753, 679, 29918, 2754, 29918, 13662, 29898, 6786, 29892, 4800, 1125, 13, 1678, 736, 426, 13, 4706, 525, 25471, 2396, 525, 16616, 525, 718, 289, 29953, 29946, 12508, 29898, 13, 9651, 313, 6786, 718, 525, 11283, 718, 4800, 467, 12508, 877, 9420, 29899, 29947, 1495, 467, 13808, 877, 9420, 29899, 29947, 5477, 13, 4706, 525, 23965, 2396, 525, 6214, 29914, 3126, 742, 13, 4706, 525, 3916, 29899, 1542, 2396, 525, 6214, 29914, 3126, 29915, 13, 1678, 500, 13, 13, 1753, 1243, 29918, 29946, 29900, 29946, 29898, 1579, 1278, 29918, 1688, 29918, 4645, 1125, 13, 1678, 2933, 353, 29784, 29918, 1688, 29918, 4645, 29889, 657, 11219, 15866, 549, 29914, 2271, 1495, 13, 1678, 4974, 2933, 29889, 4882, 29918, 401, 1275, 29871, 29946, 29900, 29946, 13, 1678, 4974, 364, 29915, 3664, 7460, 29915, 297, 2933, 29889, 657, 29918, 1272, 29898, 294, 29918, 726, 29922, 5574, 29897, 13, 13, 1753, 1243, 29918, 5184, 29898, 1579, 1278, 29918, 1688, 29918, 4645, 1125, 13, 13, 1678, 2933, 353, 29784, 29918, 1688, 29918, 4645, 29889, 657, 11219, 1495, 13, 1678, 4974, 2933, 29889, 4882, 29918, 401, 1275, 29871, 29906, 29900, 29900, 13, 13, 1753, 1243, 29918, 828, 29918, 14538, 1691, 29918, 932, 29898, 1579, 1278, 29918, 1688, 29918, 4645, 1125, 13, 13, 1678, 2933, 353, 29784, 29918, 1688, 29918, 4645, 29889, 657, 11219, 828, 29918, 14538, 1691, 742, 1101, 29918, 17886, 29879, 29922, 5574, 29897, 13, 1678, 4974, 2933, 29889, 4882, 29918, 401, 1275, 29871, 29906, 29900, 29900, 13, 13, 1753, 1243, 29918, 276, 2467, 29918, 24713, 29918, 932, 29898, 1579, 1278, 29918, 1688, 29918, 4645, 1125, 13, 13, 1678, 2933, 353, 29784, 29918, 1688, 29918, 4645, 29889, 657, 11219, 24542, 333, 29918, 689, 742, 1101, 29918, 17886, 29879, 29922, 5574, 29897, 13, 1678, 4974, 2933, 29889, 4882, 29918, 401, 1275, 29871, 29906, 29900, 29900, 13, 13, 13, 13, 2 ]
scripts/imdb_precompute_test.py
jovialio/visualDet3D
250
173932
from copy import deepcopy import torch import cv2 import time import pickle import os import numpy as np import ctypes from _path_init import * from visualDet3D.utils.timer import Timer from visualDet3D.utils.utils import cfg_from_file from visualDet3D.data.kitti.kittidata import KittiData def read_one_split(cfg, index_names, data_root_dir, output_dict, data_split='training', time_display_inter=100): N = len(index_names) frames = [None] * N print("start reading {} data".format(data_split)) timer = Timer() for i, index_name in enumerate(index_names): # read data with dataloader api data_frame = KittiData(data_root_dir, index_name, output_dict) calib, _, _, _ = data_frame.read_data() # store the list of kittiObjet and kittiCalib data_frame.calib = calib frames[i] = data_frame if (i+1) % time_display_inter == 0: avg_time = timer.compute_avg_time(i+1) eta = timer.compute_eta(i+1, N) print("{} iter:{}/{}, avg-time:{}, eta:{}".format( data_split, i+1, N, avg_time, eta), end='\r') save_dir = os.path.join(cfg.path.preprocessed_path, data_split) if not os.path.isdir(save_dir): os.makedirs(save_dir) pkl_file = os.path.join(save_dir, 'imdb.pkl') pickle.dump(frames, open(pkl_file, 'wb')) print("{} split finished precomputing".format(data_split)) def main(config="config/config.py"): cfg = cfg_from_file(config) torch.cuda.set_device(cfg.trainer.gpu) time_display_inter = 100 # define the inverval displaying time consumed in loop data_root_dir = cfg.path.test_path # the base directory of training dataset calib_path = os.path.join(data_root_dir, 'calib') list_calib = os.listdir(calib_path) N = len(list_calib) # no need for image, could be modified for extended use output_dict = { "calib": True, "image": False, "label": False, "velodyne": False, } num_test_file = N test_names = ["%06d" % i for i in range(num_test_file)] read_one_split(cfg, test_names, data_root_dir, output_dict, 'test', time_display_inter) print("Preprocessing finished") if __name__ == '__main__': from fire import Fire Fire(main)
[ 1, 515, 3509, 1053, 6483, 8552, 13, 5215, 4842, 305, 13, 5215, 13850, 29906, 13, 5215, 931, 13, 5215, 5839, 280, 13, 5215, 2897, 13, 5215, 12655, 408, 7442, 13, 5215, 274, 8768, 13, 13, 3166, 903, 2084, 29918, 2344, 1053, 334, 13, 3166, 7604, 6362, 29941, 29928, 29889, 13239, 29889, 20404, 1053, 29168, 13, 3166, 7604, 6362, 29941, 29928, 29889, 13239, 29889, 13239, 1053, 274, 16434, 29918, 3166, 29918, 1445, 13, 3166, 7604, 6362, 29941, 29928, 29889, 1272, 29889, 29895, 986, 29875, 29889, 29895, 986, 333, 532, 1053, 476, 986, 29875, 1469, 13, 13, 13, 13, 1753, 1303, 29918, 650, 29918, 5451, 29898, 16859, 29892, 2380, 29918, 7039, 29892, 848, 29918, 4632, 29918, 3972, 29892, 1962, 29918, 8977, 29892, 848, 29918, 5451, 2433, 26495, 742, 931, 29918, 4990, 29918, 1639, 29922, 29896, 29900, 29900, 1125, 13, 1678, 405, 353, 7431, 29898, 2248, 29918, 7039, 29897, 13, 1678, 16608, 353, 518, 8516, 29962, 334, 405, 13, 1678, 1596, 703, 2962, 5183, 6571, 848, 1642, 4830, 29898, 1272, 29918, 5451, 876, 13, 1678, 12237, 353, 29168, 580, 13, 13, 1678, 363, 474, 29892, 2380, 29918, 978, 297, 26985, 29898, 2248, 29918, 7039, 1125, 13, 13, 4706, 396, 1303, 848, 411, 1418, 7003, 1664, 7882, 13, 4706, 848, 29918, 2557, 353, 476, 986, 29875, 1469, 29898, 1272, 29918, 4632, 29918, 3972, 29892, 2380, 29918, 978, 29892, 1962, 29918, 8977, 29897, 13, 4706, 1208, 747, 29892, 17117, 17117, 903, 353, 848, 29918, 2557, 29889, 949, 29918, 1272, 580, 13, 13, 4706, 396, 3787, 278, 1051, 310, 413, 986, 29875, 6039, 4026, 322, 413, 986, 29875, 7856, 747, 13, 4706, 848, 29918, 2557, 29889, 1052, 747, 353, 1208, 747, 13, 13, 4706, 16608, 29961, 29875, 29962, 353, 848, 29918, 2557, 13, 13, 4706, 565, 313, 29875, 29974, 29896, 29897, 1273, 931, 29918, 4990, 29918, 1639, 1275, 29871, 29900, 29901, 13, 9651, 1029, 29887, 29918, 2230, 353, 12237, 29889, 26017, 29918, 485, 29887, 29918, 2230, 29898, 29875, 29974, 29896, 29897, 13, 9651, 634, 29874, 353, 12237, 29889, 26017, 29918, 1187, 29898, 29875, 29974, 29896, 29892, 405, 29897, 13, 9651, 1596, 703, 8875, 4256, 26254, 6822, 29912, 1118, 1029, 29887, 29899, 2230, 26254, 1118, 634, 29874, 29901, 8875, 1642, 4830, 29898, 13, 18884, 848, 29918, 5451, 29892, 474, 29974, 29896, 29892, 405, 29892, 1029, 29887, 29918, 2230, 29892, 634, 29874, 511, 1095, 2433, 29905, 29878, 1495, 13, 13, 1678, 4078, 29918, 3972, 353, 2897, 29889, 2084, 29889, 7122, 29898, 16859, 29889, 2084, 29889, 1457, 5014, 287, 29918, 2084, 29892, 848, 29918, 5451, 29897, 13, 1678, 565, 451, 2897, 29889, 2084, 29889, 275, 3972, 29898, 7620, 29918, 3972, 1125, 13, 4706, 2897, 29889, 29885, 12535, 12935, 29898, 7620, 29918, 3972, 29897, 13, 268, 13, 1678, 282, 6321, 29918, 1445, 353, 2897, 29889, 2084, 29889, 7122, 29898, 7620, 29918, 3972, 29892, 525, 326, 2585, 29889, 29886, 6321, 1495, 13, 1678, 5839, 280, 29889, 15070, 29898, 19935, 29892, 1722, 29898, 29886, 6321, 29918, 1445, 29892, 525, 29893, 29890, 8785, 13, 1678, 1596, 703, 8875, 6219, 7743, 758, 12097, 292, 1642, 4830, 29898, 1272, 29918, 5451, 876, 13, 13, 13, 1753, 1667, 29898, 2917, 543, 2917, 29914, 2917, 29889, 2272, 29908, 1125, 13, 1678, 274, 16434, 353, 274, 16434, 29918, 3166, 29918, 1445, 29898, 2917, 29897, 13, 1678, 4842, 305, 29889, 29883, 6191, 29889, 842, 29918, 10141, 29898, 16859, 29889, 3018, 4983, 29889, 29887, 3746, 29897, 13, 1678, 931, 29918, 4990, 29918, 1639, 353, 29871, 29896, 29900, 29900, 29871, 396, 4529, 278, 297, 369, 791, 16384, 931, 11233, 287, 297, 2425, 13, 1678, 848, 29918, 4632, 29918, 3972, 353, 274, 16434, 29889, 2084, 29889, 1688, 29918, 2084, 29871, 396, 278, 2967, 3884, 310, 6694, 8783, 13, 1678, 1208, 747, 29918, 2084, 353, 2897, 29889, 2084, 29889, 7122, 29898, 1272, 29918, 4632, 29918, 3972, 29892, 525, 1052, 747, 1495, 13, 1678, 1051, 29918, 1052, 747, 353, 2897, 29889, 1761, 3972, 29898, 1052, 747, 29918, 2084, 29897, 13, 1678, 405, 353, 7431, 29898, 1761, 29918, 1052, 747, 29897, 13, 1678, 396, 694, 817, 363, 1967, 29892, 1033, 367, 9120, 363, 10410, 671, 13, 1678, 1962, 29918, 8977, 353, 426, 13, 4706, 376, 1052, 747, 1115, 5852, 29892, 13, 4706, 376, 3027, 1115, 7700, 29892, 13, 4706, 376, 1643, 1115, 7700, 29892, 13, 4706, 376, 955, 1486, 484, 1115, 7700, 29892, 13, 1678, 500, 13, 13, 1678, 954, 29918, 1688, 29918, 1445, 353, 405, 13, 1678, 1243, 29918, 7039, 353, 6796, 29995, 29900, 29953, 29881, 29908, 1273, 474, 363, 474, 297, 3464, 29898, 1949, 29918, 1688, 29918, 1445, 4638, 13, 1678, 1303, 29918, 650, 29918, 5451, 29898, 16859, 29892, 1243, 29918, 7039, 29892, 848, 29918, 4632, 29918, 3972, 29892, 1962, 29918, 8977, 29892, 13, 462, 259, 525, 1688, 742, 931, 29918, 4990, 29918, 1639, 29897, 13, 13, 1678, 1596, 703, 6572, 19170, 7743, 1159, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 515, 3974, 1053, 6438, 13, 1678, 6438, 29898, 3396, 29897, 13, 2 ]
network_crawler/__main__.py
luigi-riefolo/network_crawler
0
151773
"""Main stub."""
[ 1, 9995, 6330, 19281, 1213, 15945, 13, 2 ]
tests/ssim/ssim_test.py
XanderStaal/ganslate
0
56541
""" Copyright (c) Facebook, Inc. and its affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. Changes made: window is now 3D with size (1, 1, win_size, win_size, win_si`ze) All convolutions for mean and variance comp. are 3D Conv """ import torch from torch import nn import torch.nn.functional as F class SSIMLoss(nn.Module): """ SSIM loss module. """ def __init__(self, win_size: int = 7, k1: float = 0.01, k2: float = 0.03): """ Args: win_size: Window size for SSIM calculation. k1: k1 parameter for SSIM calculation. k2: k2 parameter for SSIM calculation. """ super().__init__() self.win_size = win_size self.k1, self.k2 = k1, k2 NP = win_size**2 self.cov_norm = NP / (NP - 1) def forward(self, X: torch.Tensor, Y: torch.Tensor, data_range: torch.Tensor): input_dimension = X.ndim - 2 if input_dimension == 2: conv = F.conv2d window_size = (self.win_size, self.win_size) elif input_dimension == 3: conv = F.conv3d window_size = (self.win_size, self.win_size, self.win_size) else: raise f"Unsupported dim {input_dimension} for provided input" if not hasattr(self, "w"): self.register_buffer("w", torch.ones(1, 1, *window_size) / self.win_size**2) data_range = data_range[:, None, None, None] C1 = (self.k1 * data_range)**2 C2 = (self.k2 * data_range)**2 ux = conv(X, self.w) # typing: ignore uy = conv(Y, self.w) # uxx = conv(X * X, self.w) uyy = conv(Y * Y, self.w) uxy = conv(X * Y, self.w) vx = self.cov_norm * (uxx - ux * ux) vy = self.cov_norm * (uyy - uy * uy) vxy = self.cov_norm * (uxy - ux * uy) A1, A2, B1, B2 = ( 2 * ux * uy + C1, 2 * vxy + C2, ux**2 + uy**2 + C1, vx + vy + C2, ) D = B1 * B2 S = (A1 * A2) / D return 1 - S.mean() if __name__ == "__main__": import SimpleITK as sitk import numpy as np from torchvision.utils import save_image from scipy.ndimage.filters import gaussian_filter as blur MIN_B = -1000 MAX_B = 2000 img_a = sitk.ReadImage('/repos/Maastro/nki_cervix/train/21403922/CT/0/CT.nrrd') img_b = sitk.ReadImage('/repos/Maastro/nki_cervix/train/21403922/CT/0/CT.nrrd') array_a = np.clip(sitk.GetArrayFromImage(img_a), MIN_B, MAX_B) - MIN_B array_b = np.clip(sitk.GetArrayFromImage(img_b), MIN_B, MAX_B) - MIN_B # array_a = (array_a - MIN_B) / (MAX_B - MIN_B) # array_b = (array_b - MIN_B) / (MAX_B - MIN_B) tensor_a = torch.Tensor(array_a).unsqueeze(dim=0).unsqueeze(dim=0) tensor_b = torch.Tensor(array_b).unsqueeze(dim=0).unsqueeze(dim=0) print(f"Tensor A max: {tensor_a.max()} min: {tensor_a.min()}") print(f"Tensor B max: {tensor_b.max()} min: {tensor_b.min()}") ssim = SSIMLoss() ssim_val = ssim(tensor_a, tensor_b, data_range=torch.full((1, 1, 1, 1), tensor_a.max())) print(f"Calculated SSIM Value is : {ssim_val}")
[ 1, 9995, 13, 11882, 1266, 313, 29883, 29897, 13327, 29892, 9266, 29889, 322, 967, 23736, 1078, 29889, 13, 4013, 2752, 775, 338, 7794, 21144, 1090, 278, 341, 1806, 19405, 1476, 297, 278, 13, 27888, 1430, 1660, 934, 297, 278, 3876, 3884, 310, 445, 2752, 5447, 29889, 13, 13, 21459, 1754, 29901, 13, 7165, 338, 1286, 29871, 29941, 29928, 411, 2159, 313, 29896, 29892, 29871, 29896, 29892, 5401, 29918, 2311, 29892, 5401, 29918, 2311, 29892, 5401, 29918, 1039, 29952, 911, 29897, 13, 3596, 26851, 29879, 363, 2099, 322, 20162, 752, 29889, 526, 29871, 29941, 29928, 1281, 29894, 13, 13, 15945, 29908, 13, 13, 5215, 4842, 305, 13, 3166, 4842, 305, 1053, 302, 29876, 13, 5215, 4842, 305, 29889, 15755, 29889, 2220, 284, 408, 383, 13, 13, 13, 1990, 317, 5425, 1988, 2209, 29898, 15755, 29889, 7355, 1125, 13, 1678, 9995, 13, 1678, 317, 5425, 29924, 6410, 3883, 29889, 13, 1678, 9995, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 5401, 29918, 2311, 29901, 938, 353, 29871, 29955, 29892, 413, 29896, 29901, 5785, 353, 29871, 29900, 29889, 29900, 29896, 29892, 413, 29906, 29901, 5785, 353, 29871, 29900, 29889, 29900, 29941, 1125, 13, 4706, 9995, 13, 4706, 826, 3174, 29901, 13, 9651, 5401, 29918, 2311, 29901, 18379, 2159, 363, 317, 5425, 29924, 13944, 29889, 13, 9651, 413, 29896, 29901, 413, 29896, 3443, 363, 317, 5425, 29924, 13944, 29889, 13, 9651, 413, 29906, 29901, 413, 29906, 3443, 363, 317, 5425, 29924, 13944, 29889, 13, 4706, 9995, 13, 4706, 2428, 2141, 1649, 2344, 1649, 580, 13, 4706, 1583, 29889, 5080, 29918, 2311, 353, 5401, 29918, 2311, 13, 4706, 1583, 29889, 29895, 29896, 29892, 1583, 29889, 29895, 29906, 353, 413, 29896, 29892, 413, 29906, 13, 4706, 405, 29925, 353, 5401, 29918, 2311, 1068, 29906, 13, 4706, 1583, 29889, 24542, 29918, 12324, 353, 405, 29925, 847, 313, 25500, 448, 29871, 29896, 29897, 13, 13, 1678, 822, 6375, 29898, 1311, 29892, 1060, 29901, 4842, 305, 29889, 29911, 6073, 29892, 612, 29901, 4842, 305, 29889, 29911, 6073, 29892, 848, 29918, 3881, 29901, 4842, 305, 29889, 29911, 6073, 1125, 13, 4706, 1881, 29918, 6229, 2673, 353, 1060, 29889, 299, 326, 448, 29871, 29906, 13, 4706, 565, 1881, 29918, 6229, 2673, 1275, 29871, 29906, 29901, 13, 9651, 7602, 353, 383, 29889, 20580, 29906, 29881, 13, 9651, 3474, 29918, 2311, 353, 313, 1311, 29889, 5080, 29918, 2311, 29892, 1583, 29889, 5080, 29918, 2311, 29897, 13, 4706, 25342, 1881, 29918, 6229, 2673, 1275, 29871, 29941, 29901, 13, 9651, 7602, 353, 383, 29889, 20580, 29941, 29881, 13, 9651, 3474, 29918, 2311, 353, 313, 1311, 29889, 5080, 29918, 2311, 29892, 1583, 29889, 5080, 29918, 2311, 29892, 1583, 29889, 5080, 29918, 2311, 29897, 13, 4706, 1683, 29901, 13, 9651, 12020, 285, 29908, 25807, 29884, 3016, 287, 3964, 426, 2080, 29918, 6229, 2673, 29913, 363, 4944, 1881, 29908, 13, 13, 4706, 565, 451, 756, 5552, 29898, 1311, 29892, 376, 29893, 29908, 1125, 13, 9651, 1583, 29889, 9573, 29918, 9040, 703, 29893, 613, 4842, 305, 29889, 2873, 29898, 29896, 29892, 29871, 29896, 29892, 334, 7165, 29918, 2311, 29897, 847, 1583, 29889, 5080, 29918, 2311, 1068, 29906, 29897, 13, 13, 4706, 848, 29918, 3881, 353, 848, 29918, 3881, 7503, 29892, 6213, 29892, 6213, 29892, 6213, 29962, 13, 4706, 315, 29896, 353, 313, 1311, 29889, 29895, 29896, 334, 848, 29918, 3881, 29897, 1068, 29906, 13, 4706, 315, 29906, 353, 313, 1311, 29889, 29895, 29906, 334, 848, 29918, 3881, 29897, 1068, 29906, 13, 4706, 318, 29916, 353, 7602, 29898, 29990, 29892, 1583, 29889, 29893, 29897, 29871, 396, 19229, 29901, 11455, 13, 4706, 318, 29891, 353, 7602, 29898, 29979, 29892, 1583, 29889, 29893, 29897, 29871, 396, 13, 13, 4706, 318, 4419, 353, 7602, 29898, 29990, 334, 1060, 29892, 1583, 29889, 29893, 29897, 13, 4706, 318, 8071, 353, 7602, 29898, 29979, 334, 612, 29892, 1583, 29889, 29893, 29897, 13, 4706, 318, 3594, 353, 7602, 29898, 29990, 334, 612, 29892, 1583, 29889, 29893, 29897, 13, 13, 4706, 325, 29916, 353, 1583, 29889, 24542, 29918, 12324, 334, 313, 1314, 29916, 448, 318, 29916, 334, 318, 29916, 29897, 13, 4706, 10195, 353, 1583, 29889, 24542, 29918, 12324, 334, 313, 29884, 8071, 448, 318, 29891, 334, 318, 29891, 29897, 13, 4706, 325, 3594, 353, 1583, 29889, 24542, 29918, 12324, 334, 313, 1314, 29891, 448, 318, 29916, 334, 318, 29891, 29897, 13, 4706, 319, 29896, 29892, 319, 29906, 29892, 350, 29896, 29892, 350, 29906, 353, 313, 13, 632, 29906, 334, 318, 29916, 334, 318, 29891, 718, 315, 29896, 29892, 13, 632, 29906, 334, 325, 3594, 718, 315, 29906, 29892, 13, 9651, 318, 29916, 1068, 29906, 718, 318, 29891, 1068, 29906, 718, 315, 29896, 29892, 13, 9651, 325, 29916, 718, 10195, 718, 315, 29906, 29892, 13, 4706, 1723, 13, 4706, 360, 353, 350, 29896, 334, 350, 29906, 13, 4706, 317, 353, 313, 29909, 29896, 334, 319, 29906, 29897, 847, 360, 13, 13, 4706, 736, 29871, 29896, 448, 317, 29889, 12676, 580, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 1053, 12545, 1806, 29968, 408, 7845, 29895, 13, 1678, 1053, 12655, 408, 7442, 13, 1678, 515, 4842, 305, 4924, 29889, 13239, 1053, 4078, 29918, 3027, 13, 1678, 515, 4560, 2272, 29889, 299, 3027, 29889, 26705, 1053, 330, 17019, 29918, 4572, 408, 1999, 332, 13, 1678, 341, 1177, 29918, 29933, 353, 448, 29896, 29900, 29900, 29900, 13, 1678, 18134, 29918, 29933, 353, 29871, 29906, 29900, 29900, 29900, 13, 13, 1678, 10153, 29918, 29874, 353, 7845, 29895, 29889, 6359, 2940, 11219, 276, 1066, 29914, 21870, 23364, 29914, 29876, 1984, 29918, 2265, 29894, 861, 29914, 14968, 29914, 29906, 29896, 29946, 29900, 29941, 29929, 29906, 29906, 29914, 1783, 29914, 29900, 29914, 1783, 29889, 22230, 5499, 1495, 13, 1678, 10153, 29918, 29890, 353, 7845, 29895, 29889, 6359, 2940, 11219, 276, 1066, 29914, 21870, 23364, 29914, 29876, 1984, 29918, 2265, 29894, 861, 29914, 14968, 29914, 29906, 29896, 29946, 29900, 29941, 29929, 29906, 29906, 29914, 1783, 29914, 29900, 29914, 1783, 29889, 22230, 5499, 1495, 13, 13, 1678, 1409, 29918, 29874, 353, 7442, 29889, 24049, 29898, 29879, 277, 29895, 29889, 2577, 2588, 4591, 2940, 29898, 2492, 29918, 29874, 511, 341, 1177, 29918, 29933, 29892, 18134, 29918, 29933, 29897, 448, 341, 1177, 29918, 29933, 13, 1678, 1409, 29918, 29890, 353, 7442, 29889, 24049, 29898, 29879, 277, 29895, 29889, 2577, 2588, 4591, 2940, 29898, 2492, 29918, 29890, 511, 341, 1177, 29918, 29933, 29892, 18134, 29918, 29933, 29897, 448, 341, 1177, 29918, 29933, 13, 13, 1678, 396, 1409, 29918, 29874, 353, 313, 2378, 29918, 29874, 448, 341, 1177, 29918, 29933, 29897, 847, 313, 12648, 29918, 29933, 448, 341, 1177, 29918, 29933, 29897, 13, 1678, 396, 1409, 29918, 29890, 353, 313, 2378, 29918, 29890, 448, 341, 1177, 29918, 29933, 29897, 847, 313, 12648, 29918, 29933, 448, 341, 1177, 29918, 29933, 29897, 13, 13, 1678, 12489, 29918, 29874, 353, 4842, 305, 29889, 29911, 6073, 29898, 2378, 29918, 29874, 467, 6948, 802, 29872, 911, 29898, 6229, 29922, 29900, 467, 6948, 802, 29872, 911, 29898, 6229, 29922, 29900, 29897, 13, 1678, 12489, 29918, 29890, 353, 4842, 305, 29889, 29911, 6073, 29898, 2378, 29918, 29890, 467, 6948, 802, 29872, 911, 29898, 6229, 29922, 29900, 467, 6948, 802, 29872, 911, 29898, 6229, 29922, 29900, 29897, 13, 13, 1678, 1596, 29898, 29888, 29908, 29911, 6073, 319, 4236, 29901, 426, 20158, 29918, 29874, 29889, 3317, 28296, 1375, 29901, 426, 20158, 29918, 29874, 29889, 1195, 580, 27195, 13, 1678, 1596, 29898, 29888, 29908, 29911, 6073, 350, 4236, 29901, 426, 20158, 29918, 29890, 29889, 3317, 28296, 1375, 29901, 426, 20158, 29918, 29890, 29889, 1195, 580, 27195, 13, 13, 1678, 269, 3601, 353, 317, 5425, 1988, 2209, 580, 13, 1678, 269, 3601, 29918, 791, 353, 269, 3601, 29898, 20158, 29918, 29874, 29892, 12489, 29918, 29890, 29892, 848, 29918, 3881, 29922, 7345, 305, 29889, 8159, 3552, 29896, 29892, 29871, 29896, 29892, 29871, 29896, 29892, 29871, 29896, 511, 12489, 29918, 29874, 29889, 3317, 22130, 13, 13, 1678, 1596, 29898, 29888, 29908, 27065, 630, 317, 5425, 29924, 7865, 338, 584, 426, 893, 326, 29918, 791, 27195, 13, 2 ]
imagepy/menus/Plugins/Manager/console_wgt.py
cycleuser/imagepy
1
25337
# -*- coding: utf-8 -*- import wx from wx.py.shell import Shell import scipy.ndimage as ndimg import numpy as np # from imagepy import IPy from imagepy.core.engine import Free from sciapp import Source cmds = {'app':'app', 'np':np, 'ndimg':ndimg, 'update':None, 'get_img':None} class Macros(dict): def __init__(self): for i in Source.manager('plugin').names(): if not isinstance(i, str) or i == 'Command Line': #print(PluginsManager.plgs[i]) continue name = ''.join(list(filter(str.isalnum, i))) exec("self.run_%s = lambda para=None, plg=Source.manager('plugin').get(i):plg().start(cmds['app'], para)"%name) class Plugin(wx.Panel): title = 'Command Line' single = None def __init__(self, parent): wx.Panel.__init__ ( self, parent, id = wx.ID_ANY, pos = wx.DefaultPosition, size = wx.Size( 500,300 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL ) cmds['app'] = parent cmds['get_img'] = lambda name=None, app=self: self.app.get_img() cmds['update'] = lambda app=self: self.app.get_img().update() shell = Shell(self, locals=cmds) bSizer = wx.BoxSizer( wx.VERTICAL ) bSizer.Add( shell, 1, wx.EXPAND|wx.ALL, 5 ) self.SetSizer(bSizer) cmds['plgs'] = Macros() shell.run('# plgs.run_name() to call a ImagePy plugin.\n') shell.run('# app is avalible here, and get_img() to get the current ImagePlus, update() to redraw.\n')
[ 1, 396, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 5215, 26437, 13, 3166, 26437, 29889, 2272, 29889, 15903, 1053, 1383, 514, 13, 5215, 4560, 2272, 29889, 299, 3027, 408, 29871, 299, 2492, 13, 5215, 12655, 408, 7442, 13, 29937, 515, 1967, 2272, 1053, 5641, 29891, 13, 13, 3166, 1967, 2272, 29889, 3221, 29889, 10599, 1053, 12362, 13, 3166, 885, 423, 407, 1053, 7562, 13, 13, 9006, 29879, 353, 11117, 932, 22099, 932, 742, 525, 9302, 2396, 9302, 29892, 525, 299, 2492, 2396, 299, 2492, 29892, 525, 5504, 2396, 8516, 29892, 525, 657, 29918, 2492, 2396, 8516, 29913, 13, 13, 1990, 4326, 1883, 29898, 8977, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 363, 474, 297, 7562, 29889, 12847, 877, 8582, 2824, 7039, 7295, 13, 9651, 565, 451, 338, 8758, 29898, 29875, 29892, 851, 29897, 470, 474, 1275, 525, 6255, 7407, 2396, 13, 18884, 396, 2158, 29898, 3247, 8385, 3260, 29889, 572, 3174, 29961, 29875, 2314, 13, 18884, 6773, 13, 9651, 1024, 353, 525, 4286, 7122, 29898, 1761, 29898, 4572, 29898, 710, 29889, 275, 284, 1949, 29892, 474, 4961, 13, 9651, 2279, 703, 1311, 29889, 3389, 29918, 29995, 29879, 353, 14013, 1702, 29922, 8516, 29892, 715, 29887, 29922, 4435, 29889, 12847, 877, 8582, 2824, 657, 29898, 29875, 1125, 572, 29887, 2141, 2962, 29898, 9006, 29879, 1839, 932, 7464, 1702, 5513, 29995, 978, 29897, 13, 13, 1990, 1858, 3851, 29898, 23310, 29889, 7490, 1125, 13, 1678, 3611, 353, 525, 6255, 7407, 29915, 13, 1678, 2323, 353, 6213, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 3847, 1125, 13, 4706, 26437, 29889, 7490, 17255, 2344, 1649, 313, 1583, 29892, 3847, 29892, 1178, 353, 26437, 29889, 1367, 29918, 2190, 29979, 29892, 29871, 13, 462, 18884, 926, 353, 26437, 29889, 4592, 8003, 29892, 2159, 353, 26437, 29889, 3505, 29898, 29871, 29945, 29900, 29900, 29892, 29941, 29900, 29900, 10353, 29871, 13, 462, 18884, 3114, 353, 26437, 29889, 23397, 29918, 29943, 4717, 2303, 29918, 1254, 29979, 1307, 29989, 23310, 29889, 29911, 2882, 29918, 29911, 4717, 5348, 29903, 1964, 1723, 13, 4706, 9920, 29879, 1839, 932, 2033, 353, 3847, 13, 4706, 9920, 29879, 1839, 657, 29918, 2492, 2033, 353, 14013, 1024, 29922, 8516, 29892, 623, 29922, 1311, 29901, 1583, 29889, 932, 29889, 657, 29918, 2492, 580, 13, 4706, 9920, 29879, 1839, 5504, 2033, 353, 14013, 623, 29922, 1311, 29901, 1583, 29889, 932, 29889, 657, 29918, 2492, 2141, 5504, 580, 13, 4706, 6473, 353, 1383, 514, 29898, 1311, 29892, 1180, 1338, 29922, 9006, 29879, 29897, 13, 4706, 289, 29903, 3950, 353, 26437, 29889, 3313, 29903, 3950, 29898, 26437, 29889, 5348, 29911, 2965, 1964, 1723, 13, 4706, 289, 29903, 3950, 29889, 2528, 29898, 6473, 29892, 29871, 29896, 29892, 26437, 29889, 5746, 29925, 9468, 29989, 23310, 29889, 9818, 29892, 29871, 29945, 1723, 13, 4706, 1583, 29889, 2697, 29903, 3950, 29898, 29890, 29903, 3950, 29897, 13, 4706, 9920, 29879, 1839, 572, 3174, 2033, 353, 4326, 1883, 580, 13, 4706, 6473, 29889, 3389, 14237, 715, 3174, 29889, 3389, 29918, 978, 580, 304, 1246, 263, 7084, 19737, 7079, 7790, 29876, 1495, 13, 4706, 6473, 29889, 3389, 14237, 623, 338, 263, 791, 1821, 1244, 29892, 322, 679, 29918, 2492, 580, 304, 679, 278, 1857, 7084, 29575, 29892, 2767, 580, 304, 2654, 1610, 7790, 29876, 1495, 2 ]
kaggle_cat-in-the-dat.py
ak110/applications
0
140022
#!/usr/bin/env python3 """Categorical Feature Encoding Challengeの実験用コード。""" import pathlib import numpy as np import pandas as pd import sklearn.metrics import pytoolkit as tk nfold = 5 params = { "objective": "binary", "metric": "auc", "learning_rate": 0.01, "nthread": -1, # "verbosity": -1, # "max_bin": 511, # "num_leaves": 31, # "min_data_in_leaf": 10, "feature_fraction": "sqrt", "bagging_freq": 0, # "max_depth": 4, } seeds = np.arange(5) + 1 # split_seeds = np.arange(5) + 1 data_dir = pathlib.Path("data/kaggle_cat-in-the-dat") models_dir = pathlib.Path(f"models/{pathlib.Path(__file__).stem}") app = tk.cli.App(output_dir=models_dir) logger = tk.log.get(__name__) @app.command() def train(): train_set = load_train_data() folds = tk.validation.split(train_set, nfold, split_seed=1) create_model().cv(train_set, folds) validate() @app.command() def validate(): train_set = load_train_data() folds = tk.validation.split(train_set, nfold, split_seed=1) model = create_model().load() oofp = model.predict_oof(train_set, folds) tk.notifications.post_evals( {"auc": sklearn.metrics.roc_auc_score(train_set.labels, oofp)} ) predict() @app.command() def predict(): # TODO: ValueError: Unknown values in column 'nom_8': {'2be51c868', '1f0a80e1d', 'ec337ce4c', 'a9bf3dc47'} test_set = load_test_data() model = create_model().load() pred = model.predict(test_set) df = pd.DataFrame() df["id"] = test_set.ids df["target"] = pred df.to_csv(models_dir / "submission.csv", index=False) def load_train_data(): df = pd.read_csv(data_dir / "train.csv") return _preprocess(df) def load_test_data(): df = pd.read_csv(data_dir / "test.csv") return _preprocess(df) def _preprocess(df): df["bin_0"] = tk.preprocessing.encode_binary(df["bin_0"], 1, 0) df["bin_1"] = tk.preprocessing.encode_binary(df["bin_1"], 1, 0) df["bin_2"] = tk.preprocessing.encode_binary(df["bin_2"], 1, 0) df["bin_3"] = tk.preprocessing.encode_binary(df["bin_3"], "T", "F") df["bin_4"] = tk.preprocessing.encode_binary(df["bin_4"], "Y", "N") df["ord_1"] = tk.preprocessing.encode_ordinal( df["ord_1"], ["Novice", "Contributor", "Expert", "Master", "Grandmaster"] ) df["ord_2"] = tk.preprocessing.encode_ordinal( df["ord_2"], ["Freezing", "Cold", "Warm", "Hot", "Boiling Hot", "Lava Hot"] ) df["ord_3"] = df["ord_3"].map(ord).astype(np.int32) df["ord_4"] = df["ord_4"].map(ord).astype(np.int32) df["ord_5"] = ( df["ord_5"].apply(lambda s: ord(s[0]) * 255 + ord(s[1])).astype(np.int32) ) df[["day_sin", "day_cos"]] = tk.preprocessing.encode_cyclic(df["day"], 1, 7 + 1) df[["month_sin", "month_cos"]] = tk.preprocessing.encode_cyclic( df["month"], 1, 12 + 1 ) if "target" in df.columns.values: return tk.data.Dataset( data=df.drop(columns=["target"]), labels=df["target"].values ) else: return tk.data.Dataset(data=df) def create_model(): return tk.pipeline.LGBModel( params=params, nfold=nfold, models_dir=models_dir, seeds=seeds, preprocessors=[tk.preprocessing.FeaturesEncoder()], ) if __name__ == "__main__": app.run(default="train")
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 29941, 13, 15945, 29908, 29907, 20440, 936, 5169, 1535, 11346, 3689, 27211, 30199, 31525, 236, 171, 150, 30406, 30459, 30185, 30335, 30267, 15945, 29908, 13, 5215, 2224, 1982, 13, 13, 5215, 12655, 408, 7442, 13, 5215, 11701, 408, 10518, 13, 5215, 2071, 19668, 29889, 2527, 10817, 13, 13, 5215, 11451, 10154, 7354, 408, 18883, 13, 13, 29876, 8771, 353, 29871, 29945, 13, 7529, 353, 426, 13, 1678, 376, 3318, 573, 1115, 376, 19541, 613, 13, 1678, 376, 16414, 1115, 376, 14766, 613, 13, 1678, 376, 21891, 29918, 10492, 1115, 29871, 29900, 29889, 29900, 29896, 29892, 13, 1678, 376, 29876, 7097, 1115, 448, 29896, 29892, 13, 1678, 396, 376, 18248, 359, 537, 1115, 448, 29896, 29892, 13, 1678, 396, 376, 3317, 29918, 2109, 1115, 29871, 29945, 29896, 29896, 29892, 13, 1678, 396, 376, 1949, 29918, 280, 5989, 1115, 29871, 29941, 29896, 29892, 13, 1678, 396, 376, 1195, 29918, 1272, 29918, 262, 29918, 29500, 1115, 29871, 29896, 29900, 29892, 13, 1678, 376, 14394, 29918, 29888, 13857, 1115, 376, 3676, 613, 13, 1678, 376, 23156, 3460, 29918, 29888, 7971, 1115, 29871, 29900, 29892, 13, 1678, 396, 376, 3317, 29918, 19488, 1115, 29871, 29946, 29892, 13, 29913, 13, 344, 5779, 353, 7442, 29889, 279, 927, 29898, 29945, 29897, 718, 29871, 29896, 13, 29937, 6219, 29918, 344, 5779, 353, 7442, 29889, 279, 927, 29898, 29945, 29897, 718, 29871, 29896, 13, 1272, 29918, 3972, 353, 2224, 1982, 29889, 2605, 703, 1272, 29914, 29895, 351, 6234, 29918, 4117, 29899, 262, 29899, 1552, 29899, 4130, 1159, 13, 9794, 29918, 3972, 353, 2224, 1982, 29889, 2605, 29898, 29888, 29908, 9794, 19248, 2084, 1982, 29889, 2605, 22168, 1445, 1649, 467, 303, 331, 27195, 13, 932, 353, 18883, 29889, 11303, 29889, 2052, 29898, 4905, 29918, 3972, 29922, 9794, 29918, 3972, 29897, 13, 21707, 353, 18883, 29889, 1188, 29889, 657, 22168, 978, 1649, 29897, 13, 13, 13, 29992, 932, 29889, 6519, 580, 13, 1753, 7945, 7295, 13, 1678, 7945, 29918, 842, 353, 2254, 29918, 14968, 29918, 1272, 580, 13, 1678, 900, 6289, 353, 18883, 29889, 18157, 29889, 5451, 29898, 14968, 29918, 842, 29892, 302, 8771, 29892, 6219, 29918, 26776, 29922, 29896, 29897, 13, 1678, 1653, 29918, 4299, 2141, 11023, 29898, 14968, 29918, 842, 29892, 900, 6289, 29897, 13, 1678, 12725, 580, 13, 13, 13, 29992, 932, 29889, 6519, 580, 13, 1753, 12725, 7295, 13, 1678, 7945, 29918, 842, 353, 2254, 29918, 14968, 29918, 1272, 580, 13, 1678, 900, 6289, 353, 18883, 29889, 18157, 29889, 5451, 29898, 14968, 29918, 842, 29892, 302, 8771, 29892, 6219, 29918, 26776, 29922, 29896, 29897, 13, 1678, 1904, 353, 1653, 29918, 4299, 2141, 1359, 580, 13, 1678, 288, 974, 29886, 353, 1904, 29889, 27711, 29918, 29877, 974, 29898, 14968, 29918, 842, 29892, 900, 6289, 29897, 13, 1678, 18883, 29889, 1333, 8232, 29889, 2490, 29918, 14513, 29879, 29898, 13, 4706, 8853, 14766, 1115, 2071, 19668, 29889, 2527, 10817, 29889, 10198, 29918, 14766, 29918, 13628, 29898, 14968, 29918, 842, 29889, 21134, 29892, 288, 974, 29886, 2915, 13, 1678, 1723, 13, 1678, 8500, 580, 13, 13, 13, 29992, 932, 29889, 6519, 580, 13, 1753, 8500, 7295, 13, 1678, 396, 14402, 29901, 7865, 2392, 29901, 853, 5203, 1819, 297, 1897, 525, 11522, 29918, 29947, 2396, 11117, 29906, 915, 29945, 29896, 29883, 29947, 29953, 29947, 742, 525, 29896, 29888, 29900, 29874, 29947, 29900, 29872, 29896, 29881, 742, 525, 687, 29941, 29941, 29955, 346, 29946, 29883, 742, 525, 29874, 29929, 1635, 29941, 13891, 29946, 29955, 10827, 13, 1678, 1243, 29918, 842, 353, 2254, 29918, 1688, 29918, 1272, 580, 13, 1678, 1904, 353, 1653, 29918, 4299, 2141, 1359, 580, 13, 1678, 4450, 353, 1904, 29889, 27711, 29898, 1688, 29918, 842, 29897, 13, 1678, 4489, 353, 10518, 29889, 17271, 580, 13, 1678, 4489, 3366, 333, 3108, 353, 1243, 29918, 842, 29889, 4841, 13, 1678, 4489, 3366, 5182, 3108, 353, 4450, 13, 1678, 4489, 29889, 517, 29918, 7638, 29898, 9794, 29918, 3972, 847, 376, 1491, 6737, 29889, 7638, 613, 2380, 29922, 8824, 29897, 13, 13, 13, 1753, 2254, 29918, 14968, 29918, 1272, 7295, 13, 1678, 4489, 353, 10518, 29889, 949, 29918, 7638, 29898, 1272, 29918, 3972, 847, 376, 14968, 29889, 7638, 1159, 13, 1678, 736, 903, 1457, 5014, 29898, 2176, 29897, 13, 13, 13, 1753, 2254, 29918, 1688, 29918, 1272, 7295, 13, 1678, 4489, 353, 10518, 29889, 949, 29918, 7638, 29898, 1272, 29918, 3972, 847, 376, 1688, 29889, 7638, 1159, 13, 1678, 736, 903, 1457, 5014, 29898, 2176, 29897, 13, 13, 13, 1753, 903, 1457, 5014, 29898, 2176, 1125, 13, 1678, 4489, 3366, 2109, 29918, 29900, 3108, 353, 18883, 29889, 1457, 19170, 29889, 12508, 29918, 19541, 29898, 2176, 3366, 2109, 29918, 29900, 12436, 29871, 29896, 29892, 29871, 29900, 29897, 13, 1678, 4489, 3366, 2109, 29918, 29896, 3108, 353, 18883, 29889, 1457, 19170, 29889, 12508, 29918, 19541, 29898, 2176, 3366, 2109, 29918, 29896, 12436, 29871, 29896, 29892, 29871, 29900, 29897, 13, 1678, 4489, 3366, 2109, 29918, 29906, 3108, 353, 18883, 29889, 1457, 19170, 29889, 12508, 29918, 19541, 29898, 2176, 3366, 2109, 29918, 29906, 12436, 29871, 29896, 29892, 29871, 29900, 29897, 13, 1678, 4489, 3366, 2109, 29918, 29941, 3108, 353, 18883, 29889, 1457, 19170, 29889, 12508, 29918, 19541, 29898, 2176, 3366, 2109, 29918, 29941, 12436, 376, 29911, 613, 376, 29943, 1159, 13, 1678, 4489, 3366, 2109, 29918, 29946, 3108, 353, 18883, 29889, 1457, 19170, 29889, 12508, 29918, 19541, 29898, 2176, 3366, 2109, 29918, 29946, 12436, 376, 29979, 613, 376, 29940, 1159, 13, 1678, 4489, 3366, 536, 29918, 29896, 3108, 353, 18883, 29889, 1457, 19170, 29889, 12508, 29918, 536, 979, 29898, 13, 4706, 4489, 3366, 536, 29918, 29896, 12436, 6796, 25363, 625, 613, 376, 1323, 1091, 3406, 613, 376, 1252, 10700, 613, 376, 19203, 613, 376, 3338, 392, 6207, 3108, 13, 1678, 1723, 13, 1678, 4489, 3366, 536, 29918, 29906, 3108, 353, 18883, 29889, 1457, 19170, 29889, 12508, 29918, 536, 979, 29898, 13, 4706, 4489, 3366, 536, 29918, 29906, 12436, 6796, 20475, 19583, 613, 376, 29907, 1025, 613, 376, 29956, 2817, 613, 376, 28917, 613, 376, 8431, 6504, 8843, 613, 376, 29931, 879, 8843, 3108, 13, 1678, 1723, 13, 1678, 4489, 3366, 536, 29918, 29941, 3108, 353, 4489, 3366, 536, 29918, 29941, 16862, 1958, 29898, 536, 467, 579, 668, 29898, 9302, 29889, 524, 29941, 29906, 29897, 13, 1678, 4489, 3366, 536, 29918, 29946, 3108, 353, 4489, 3366, 536, 29918, 29946, 16862, 1958, 29898, 536, 467, 579, 668, 29898, 9302, 29889, 524, 29941, 29906, 29897, 13, 1678, 4489, 3366, 536, 29918, 29945, 3108, 353, 313, 13, 4706, 4489, 3366, 536, 29918, 29945, 16862, 7302, 29898, 2892, 269, 29901, 4356, 29898, 29879, 29961, 29900, 2314, 334, 29871, 29906, 29945, 29945, 718, 4356, 29898, 29879, 29961, 29896, 2314, 467, 579, 668, 29898, 9302, 29889, 524, 29941, 29906, 29897, 13, 1678, 1723, 13, 1678, 4489, 29961, 3366, 3250, 29918, 5223, 613, 376, 3250, 29918, 3944, 3108, 29962, 353, 18883, 29889, 1457, 19170, 29889, 12508, 29918, 8798, 506, 29898, 2176, 3366, 3250, 12436, 29871, 29896, 29892, 29871, 29955, 718, 29871, 29896, 29897, 13, 1678, 4489, 29961, 3366, 10874, 29918, 5223, 613, 376, 10874, 29918, 3944, 3108, 29962, 353, 18883, 29889, 1457, 19170, 29889, 12508, 29918, 8798, 506, 29898, 13, 4706, 4489, 3366, 10874, 12436, 29871, 29896, 29892, 29871, 29896, 29906, 718, 29871, 29896, 13, 1678, 1723, 13, 1678, 565, 376, 5182, 29908, 297, 4489, 29889, 13099, 29889, 5975, 29901, 13, 4706, 736, 18883, 29889, 1272, 29889, 16390, 24541, 29898, 13, 9651, 848, 29922, 2176, 29889, 8865, 29898, 13099, 29922, 3366, 5182, 3108, 511, 11073, 29922, 2176, 3366, 5182, 16862, 5975, 13, 4706, 1723, 13, 1678, 1683, 29901, 13, 4706, 736, 18883, 29889, 1272, 29889, 16390, 24541, 29898, 1272, 29922, 2176, 29897, 13, 13, 13, 1753, 1653, 29918, 4299, 7295, 13, 1678, 736, 18883, 29889, 13096, 5570, 29889, 29931, 7210, 3195, 29898, 13, 4706, 8636, 29922, 7529, 29892, 13, 4706, 302, 8771, 29922, 29876, 8771, 29892, 13, 4706, 4733, 29918, 3972, 29922, 9794, 29918, 3972, 29892, 13, 4706, 409, 5779, 29922, 344, 5779, 29892, 13, 4706, 758, 5014, 943, 11759, 11178, 29889, 1457, 19170, 29889, 8263, 3698, 8566, 6119, 580, 1402, 13, 1678, 1723, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 623, 29889, 3389, 29898, 4381, 543, 14968, 1159, 13, 2 ]
src/python/pymm/memoryresource.py
IBM/artemis
0
199388
<reponame>IBM/artemis # # Copyright [2021] [IBM Corporation] # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # import pymmcore import os from .metadata import * from .check import methodcheck, paramcheck class TxHandler: ''' Transaction handler for persistent memory ''' def __init__(self, name:str, memory_view:memoryview, memory_resource: pymmcore.MemoryResource): self.name = name self.memory_view = memory_view self.memory_resource = memory_resource self.tx_log = [] # undo log def tx_add(self): #pymmcore.valgrind_trigger(1) self.__tx_add_undocopy() def tx_begin(self): #pymmcore.valgrind_trigger(1) self.__tx_add_undocopy() def tx_commit(self): #pymmcore.valgrind_trigger(2) self.__tx_commit_undocopy() def __tx_add_undocopy(self): ''' Start consistent transaction (very basic copy-off undo-log) ''' name = self.name + '-' + str(len(self.tx_log)) + '-tx' (tx_handle, mem) = self.memory_resource._MemoryResource_create_named_memory(name, len(self.memory_view)) if tx_handle is None: raise RuntimeError('tx_begin failed') self.tx_log.append((tx_handle, name)) # copy data, then persist mem[:]= self.memory_view self.memory_resource._MemoryResource_persist_memory_view(self.memory_view) print('tx_begin: copy of {}:{} to ({}, {})' .format(hex(pymmcore.memoryview_addr(self.memory_view)), len(self.memory_view), name, hex(pymmcore.memoryview_addr(mem)))) def __tx_commit_undocopy(self): ''' Commit consistent transaction ''' for tx_entry in self.tx_log: self.memory_resource.release_named_memory_by_handle(tx_entry[0]) self.memory_resource.erase_named_memory(tx_entry[1]) self.tx_log = [] print('tx_commit OK!') class MemoryReference(): ''' MemoryReference represents a contiguous region of memory associated with a variable value or metadata region ''' def __init__(self, internal_handle, memory_resource, memview, name, tx_handler: TxHandler): self.handle = internal_handle self.mr = memory_resource self.buffer = memview self.varname = name self.tx_handler = tx_handler if os.getenv('PYMM_DEBUG') != None: self._debug_level = int(os.getenv('PYMM_DEBUG')) else: self._debug_level = 0 if os.getenv('PYMM_USE_SW_TX') != None: self._use_sw_tx = (int(os.getenv('PYMM_USE_SW_TX')) > 0) else: self._use_sw_tx = False def __del__(self): if self._debug_level > 0: print("releasing named memory {} @ {}".format(self.varname, hex(pymmcore.memoryview_addr(self.buffer)))) self.persist() self.mr.release_named_memory_by_handle(self.handle) def addr(self): ''' For debugging. Get address of memory view ''' return (hex(pymmcore.memoryview_addr(self.buffer)), len(self.buffer)) def tx_begin(self, value_named_memory=None, check=True): ''' Add region of memory to transaction. This is called on metadata named memory, and passed the value named memory if it exists (i.e. if it is not contiguous) ''' if value_named_memory != None: assert isinstance(value_named_memory, MemoryReference) # sanity check - but not fool proof! if check: hdr = construct_header_from_buffer(self.buffer) if metadata_check_tx_bit(hdr, TXBIT_DIRTY): return # nested, don't do anything else: hdr = construct_header_on_buffer(self.buffer) metadata_set_dirty_tx_bit(hdr) if self._use_sw_tx: # optional undo logging hook self.tx_handler.tx_begin(value_named_memory) def tx_commit(self, value_named_memory=None): ''' Commit transaction for variable ''' hdr = construct_header_from_buffer(self.buffer) # if we are in a multi-variable transaction, then delay commit if metadata_check_tx_bit(hdr, TXBIT_MULTIVAR): return self.persist() if value_named_memory != None: assert isinstance(value_named_memory, MemoryReference) value_named_memory.persist() metadata_clear_dirty_tx_bit(hdr) if self._use_sw_tx: # optional undo logging hook self.tx_handler.tx_commit(value_named_memory) def tx_multivar_commit(self, value_named_memory=None): ''' Commit variable as part of multi-variable transaction ''' hdr = construct_header_from_buffer(self.buffer) hdr.version += 1 # we might not have dirtied the memory if not metadata_check_dirty_tx_bit(hdr): metadata_clear_tx_bit(hdr, TXBIT_MULTIVAR | TXBIT_DIRTY) return # dirty bit is set if self._use_sw_tx: # optional undo logging hook self.tx_handler.tx_commit(value_named_memory) if value_named_memory != None: assert isinstance(value_named_memory, MemoryReference) value_named_memory.persist() metadata_clear_tx_bit(hdr, TXBIT_MULTIVAR | TXBIT_DIRTY) def persist(self): ''' Flush any cached memory (normally for persistence) ''' self.mr._MemoryResource_persist_memory_view(self.buffer) def persist_offset(self, offset_bytes, len_bytes): ''' Flush region of cached memory (normally for persistence) ''' if offset_bytes + len_bytes > len(self.buffer): raise RuntimeError('persist_offset: invalid offset parameter') self.mr._MemoryResource_persist_memory_view(self.buffer[offset_bytes:offset_bytes+len_bytes]) class MemoryResource(pymmcore.MemoryResource): ''' MemoryResource represents a heap allocator and physical memory resources. It is backed by an MCAS store component and corresponds to a pool. ''' def __init__(self, name, size_mb, pmem_path, load_addr, backend=None, mm_plugin=None, force_new=False): self._named_memory = {} if os.getenv('PYMM_DEBUG') != None: debug_level = int(os.getenv('PYMM_DEBUG')) else: debug_level = 0 super().__init__(pool_name=name, size_mb=size_mb, pmem_path=pmem_path, load_addr=load_addr, backend=backend, mm_plugin=mm_plugin, force_new=force_new, debug_level=debug_level) # todo check for outstanding transactions all_items = super()._MemoryResource_get_named_memory_list() recoveries = [val for val in all_items if val.endswith('-tx')] if len(recoveries) > 0: raise RuntimeError('detected outstanding undo log condition: recovery not yet implemented') @methodcheck(types=[]) def list_items(self): all_items = super()._MemoryResource_get_named_memory_list() # exclude values return [val for val in all_items if not val.endswith('-value')] @methodcheck(types=[str,int,int,bool]) def create_named_memory(self, name, size, alignment=256, zero=False): ''' Create a contiguous piece of memory and name it ''' (handle, mview) = super()._MemoryResource_create_named_memory(name, size, alignment, zero) if handle == None: return None return MemoryReference(handle, self, mview, name, TxHandler(name, mview, self)) @methodcheck(types=[str]) def open_named_memory(self, name): ''' Open existing named memory ''' (handle, mview) = super()._MemoryResource_open_named_memory(name) if handle == None: return None return MemoryReference(handle, self, mview, name, TxHandler(name, mview, self)) @methodcheck(types=[MemoryReference]) def release_named_memory(self, ref : MemoryReference): ''' Release a contiguous piece of memory (i.e. unlock) ''' super()._MemoryResource_release_named_memory(ref.handle) @methodcheck(types=[int]) def release_named_memory_by_handle(self, handle): ''' Release a contiguous piece of memory (i.e. unlock) ''' super()._MemoryResource_release_named_memory(handle) @methodcheck(types=[str]) def erase_named_memory(self, name): ''' Erase a named-memory object from the memory resource ''' super()._MemoryResource_erase_named_memory(name) @methodcheck(types=[str,bytearray]) def put_named_memory(self, name, value): ''' Copy-based crash-consistent put of named memory value ''' if not isinstance(value, bytearray): raise RuntimeError('put_named_memory requires bytearray data') super()._MemoryResource_put_named_memory(name, value) @methodcheck(types=[str]) def get_named_memory(self, name): ''' Copy-based get of named memory value ''' return super()._MemoryResource_get_named_memory(name) def get_percent_used(self): ''' Get percentage of memory used in memory resource ''' return super()._MemoryResource_get_percent_used() def atomic_swap_names(self, a: str, b: str): ''' Swap the names of two named memories; must be released ''' return super()._MemoryResource_atomic_swap_names(a,b)
[ 1, 529, 276, 1112, 420, 29958, 8979, 29924, 29914, 442, 331, 275, 13, 29937, 29871, 13, 29937, 1678, 14187, 1266, 518, 29906, 29900, 29906, 29896, 29962, 518, 8979, 29924, 15025, 29962, 13, 29937, 1678, 10413, 21144, 1090, 278, 13380, 19245, 29892, 10079, 29871, 29906, 29889, 29900, 313, 1552, 376, 29931, 293, 1947, 1496, 13, 29937, 1678, 366, 1122, 451, 671, 445, 934, 5174, 297, 752, 13036, 411, 278, 19245, 29889, 13, 29937, 1678, 887, 1122, 4017, 263, 3509, 310, 278, 19245, 472, 13, 29937, 4706, 1732, 597, 1636, 29889, 4288, 29889, 990, 29914, 506, 11259, 29914, 27888, 1430, 1660, 29899, 29906, 29889, 29900, 13, 29937, 1678, 25870, 3734, 491, 22903, 4307, 470, 15502, 304, 297, 5007, 29892, 7047, 13, 29937, 1678, 13235, 1090, 278, 19245, 338, 13235, 373, 385, 376, 3289, 8519, 29908, 350, 3289, 3235, 29892, 13, 29937, 1678, 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, 1678, 2823, 278, 19245, 363, 278, 2702, 4086, 14765, 1076, 11239, 322, 13, 29937, 1678, 27028, 1090, 278, 19245, 29889, 13, 29937, 13, 13, 5215, 282, 962, 29885, 3221, 13, 5215, 2897, 13, 13, 3166, 869, 19635, 1053, 334, 13, 3166, 869, 3198, 1053, 1158, 3198, 29892, 1828, 3198, 13, 13, 1990, 323, 29916, 4598, 29901, 13, 1678, 14550, 13, 1678, 4103, 2467, 7834, 363, 28152, 3370, 13, 1678, 14550, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1024, 29901, 710, 29892, 3370, 29918, 1493, 29901, 14834, 1493, 29892, 3370, 29918, 10314, 29901, 282, 962, 29885, 3221, 29889, 16015, 6848, 1125, 13, 4706, 1583, 29889, 978, 353, 1024, 13, 4706, 1583, 29889, 14834, 29918, 1493, 353, 3370, 29918, 1493, 13, 4706, 1583, 29889, 14834, 29918, 10314, 353, 3370, 29918, 10314, 13, 4706, 1583, 29889, 7508, 29918, 1188, 353, 5159, 29871, 396, 563, 29877, 1480, 13, 13, 1678, 822, 25568, 29918, 1202, 29898, 1311, 1125, 13, 4706, 396, 29886, 962, 29885, 3221, 29889, 791, 629, 513, 29918, 21001, 29898, 29896, 29897, 13, 4706, 1583, 17255, 7508, 29918, 1202, 29918, 870, 542, 2270, 580, 13, 13, 1678, 822, 25568, 29918, 463, 29898, 1311, 1125, 13, 4706, 396, 29886, 962, 29885, 3221, 29889, 791, 629, 513, 29918, 21001, 29898, 29896, 29897, 13, 4706, 1583, 17255, 7508, 29918, 1202, 29918, 870, 542, 2270, 580, 13, 13, 1678, 822, 25568, 29918, 15060, 29898, 1311, 1125, 13, 4706, 396, 29886, 962, 29885, 3221, 29889, 791, 629, 513, 29918, 21001, 29898, 29906, 29897, 13, 4706, 1583, 17255, 7508, 29918, 15060, 29918, 870, 542, 2270, 580, 13, 13, 1678, 822, 4770, 7508, 29918, 1202, 29918, 870, 542, 2270, 29898, 1311, 1125, 13, 4706, 14550, 13, 4706, 7370, 13747, 10804, 313, 1201, 6996, 3509, 29899, 2696, 563, 29877, 29899, 1188, 29897, 13, 4706, 14550, 13, 4706, 1024, 353, 1583, 29889, 978, 718, 17411, 29915, 718, 851, 29898, 2435, 29898, 1311, 29889, 7508, 29918, 1188, 876, 718, 17411, 7508, 29915, 29871, 13, 4706, 313, 7508, 29918, 8411, 29892, 2626, 29897, 353, 1583, 29889, 14834, 29918, 10314, 3032, 16015, 6848, 29918, 3258, 29918, 17514, 29918, 14834, 29898, 978, 29892, 7431, 29898, 1311, 29889, 14834, 29918, 1493, 876, 13, 4706, 565, 25568, 29918, 8411, 338, 6213, 29901, 13, 9651, 12020, 24875, 2392, 877, 7508, 29918, 463, 5229, 1495, 13, 13, 4706, 1583, 29889, 7508, 29918, 1188, 29889, 4397, 3552, 7508, 29918, 8411, 29892, 1024, 876, 13, 4706, 396, 3509, 848, 29892, 769, 24379, 13, 4706, 2626, 7503, 13192, 1583, 29889, 14834, 29918, 1493, 13, 4706, 1583, 29889, 14834, 29918, 10314, 3032, 16015, 6848, 29918, 6774, 391, 29918, 14834, 29918, 1493, 29898, 1311, 29889, 14834, 29918, 1493, 29897, 13, 4706, 1596, 877, 7508, 29918, 463, 29901, 3509, 310, 426, 6177, 8875, 304, 21313, 1118, 426, 1800, 29915, 13, 795, 869, 4830, 29898, 20970, 29898, 29886, 962, 29885, 3221, 29889, 14834, 1493, 29918, 10030, 29898, 1311, 29889, 14834, 29918, 1493, 8243, 7431, 29898, 1311, 29889, 14834, 29918, 1493, 511, 1024, 29892, 15090, 29898, 29886, 962, 29885, 3221, 29889, 14834, 1493, 29918, 10030, 29898, 6954, 13697, 13, 13, 1678, 822, 4770, 7508, 29918, 15060, 29918, 870, 542, 2270, 29898, 1311, 1125, 13, 4706, 14550, 13, 4706, 1876, 277, 13747, 10804, 13, 4706, 14550, 13, 4706, 363, 25568, 29918, 8269, 297, 1583, 29889, 7508, 29918, 1188, 29901, 13, 9651, 1583, 29889, 14834, 29918, 10314, 29889, 14096, 29918, 17514, 29918, 14834, 29918, 1609, 29918, 8411, 29898, 7508, 29918, 8269, 29961, 29900, 2314, 13, 9651, 1583, 29889, 14834, 29918, 10314, 29889, 261, 559, 29918, 17514, 29918, 14834, 29898, 7508, 29918, 8269, 29961, 29896, 2314, 13, 4706, 1583, 29889, 7508, 29918, 1188, 353, 5159, 13, 4706, 1596, 877, 7508, 29918, 15060, 9280, 29991, 1495, 13, 308, 13, 13, 13, 268, 13, 1990, 18914, 7422, 7295, 13, 1678, 14550, 13, 1678, 18914, 7422, 11524, 263, 640, 5526, 681, 5120, 310, 3370, 6942, 411, 263, 2286, 13, 1678, 995, 470, 15562, 5120, 13, 1678, 14550, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 7463, 29918, 8411, 29892, 3370, 29918, 10314, 29892, 2626, 1493, 29892, 1024, 29892, 25568, 29918, 13789, 29901, 323, 29916, 4598, 1125, 13, 4706, 1583, 29889, 8411, 353, 7463, 29918, 8411, 13, 4706, 1583, 29889, 29885, 29878, 353, 3370, 29918, 10314, 13, 4706, 1583, 29889, 9040, 353, 2626, 1493, 13, 4706, 1583, 29889, 1707, 978, 353, 1024, 13, 4706, 1583, 29889, 7508, 29918, 13789, 353, 25568, 29918, 13789, 13, 13, 4706, 565, 2897, 29889, 657, 6272, 877, 20055, 7428, 29918, 18525, 1495, 2804, 6213, 29901, 13, 9651, 1583, 3032, 8382, 29918, 5563, 353, 938, 29898, 359, 29889, 657, 6272, 877, 20055, 7428, 29918, 18525, 8785, 13, 4706, 1683, 29901, 13, 9651, 1583, 3032, 8382, 29918, 5563, 353, 29871, 29900, 13, 13, 4706, 565, 2897, 29889, 657, 6272, 877, 20055, 7428, 29918, 17171, 29918, 23066, 29918, 28627, 1495, 2804, 6213, 29901, 13, 9651, 1583, 3032, 1509, 29918, 2774, 29918, 7508, 353, 313, 524, 29898, 359, 29889, 657, 6272, 877, 20055, 7428, 29918, 17171, 29918, 23066, 29918, 28627, 8785, 1405, 29871, 29900, 29897, 13, 4706, 1683, 29901, 13, 9651, 1583, 3032, 1509, 29918, 2774, 29918, 7508, 353, 7700, 13, 13, 1678, 822, 4770, 6144, 12035, 1311, 1125, 13, 4706, 565, 1583, 3032, 8382, 29918, 5563, 1405, 29871, 29900, 29901, 13, 9651, 1596, 703, 276, 280, 5832, 4257, 3370, 6571, 732, 6571, 1642, 4830, 29898, 1311, 29889, 1707, 978, 29892, 15090, 29898, 29886, 962, 29885, 3221, 29889, 14834, 1493, 29918, 10030, 29898, 1311, 29889, 9040, 13697, 13, 4706, 1583, 29889, 6774, 391, 580, 13, 4706, 1583, 29889, 29885, 29878, 29889, 14096, 29918, 17514, 29918, 14834, 29918, 1609, 29918, 8411, 29898, 1311, 29889, 8411, 29897, 13, 13, 1678, 822, 28915, 29898, 1311, 1125, 13, 4706, 14550, 13, 4706, 1152, 13490, 29889, 3617, 3211, 310, 3370, 1776, 13, 4706, 14550, 13, 4706, 736, 313, 20970, 29898, 29886, 962, 29885, 3221, 29889, 14834, 1493, 29918, 10030, 29898, 1311, 29889, 9040, 8243, 7431, 29898, 1311, 29889, 9040, 876, 13, 13, 1678, 822, 25568, 29918, 463, 29898, 1311, 29892, 995, 29918, 17514, 29918, 14834, 29922, 8516, 29892, 1423, 29922, 5574, 1125, 13, 4706, 14550, 13, 4706, 3462, 5120, 310, 3370, 304, 10804, 29889, 29871, 910, 338, 2000, 373, 15562, 4257, 3370, 29892, 13, 4706, 322, 4502, 278, 995, 4257, 3370, 565, 372, 4864, 313, 29875, 29889, 29872, 29889, 565, 372, 338, 451, 640, 5526, 681, 29897, 13, 4706, 14550, 13, 4706, 565, 995, 29918, 17514, 29918, 14834, 2804, 6213, 29901, 13, 9651, 4974, 338, 8758, 29898, 1767, 29918, 17514, 29918, 14834, 29892, 18914, 7422, 29897, 13, 13, 4706, 396, 9753, 537, 1423, 448, 541, 451, 17928, 5296, 29991, 13, 4706, 565, 1423, 29901, 13, 9651, 298, 7707, 353, 3386, 29918, 6672, 29918, 3166, 29918, 9040, 29898, 1311, 29889, 9040, 29897, 13, 9651, 565, 15562, 29918, 3198, 29918, 7508, 29918, 2966, 29898, 29882, 7707, 29892, 323, 29990, 22698, 29918, 9464, 15631, 1125, 13, 18884, 736, 396, 9322, 29892, 1016, 29915, 29873, 437, 3099, 13, 4706, 1683, 29901, 13, 9651, 298, 7707, 353, 3386, 29918, 6672, 29918, 265, 29918, 9040, 29898, 1311, 29889, 9040, 29897, 13, 632, 13, 4706, 15562, 29918, 842, 29918, 3972, 1017, 29918, 7508, 29918, 2966, 29898, 29882, 7707, 29897, 13, 632, 13, 4706, 565, 1583, 3032, 1509, 29918, 2774, 29918, 7508, 29901, 396, 13136, 563, 29877, 12183, 12422, 13, 9651, 1583, 29889, 7508, 29918, 13789, 29889, 7508, 29918, 463, 29898, 1767, 29918, 17514, 29918, 14834, 29897, 13, 13, 1678, 822, 25568, 29918, 15060, 29898, 1311, 29892, 995, 29918, 17514, 29918, 14834, 29922, 8516, 1125, 13, 4706, 14550, 13, 4706, 1876, 277, 10804, 363, 2286, 13, 4706, 14550, 308, 13, 4706, 298, 7707, 353, 3386, 29918, 6672, 29918, 3166, 29918, 9040, 29898, 1311, 29889, 9040, 29897, 13, 13, 4706, 396, 565, 591, 526, 297, 263, 2473, 29899, 11918, 10804, 29892, 769, 9055, 9063, 13, 4706, 565, 15562, 29918, 3198, 29918, 7508, 29918, 2966, 29898, 29882, 7707, 29892, 323, 29990, 22698, 29918, 29924, 8647, 5667, 1718, 1125, 13, 9651, 736, 13, 13, 4706, 1583, 29889, 6774, 391, 580, 13, 4706, 565, 995, 29918, 17514, 29918, 14834, 2804, 6213, 29901, 13, 9651, 4974, 338, 8758, 29898, 1767, 29918, 17514, 29918, 14834, 29892, 18914, 7422, 29897, 13, 9651, 995, 29918, 17514, 29918, 14834, 29889, 6774, 391, 580, 13, 13, 4706, 15562, 29918, 8551, 29918, 3972, 1017, 29918, 7508, 29918, 2966, 29898, 29882, 7707, 29897, 13, 308, 13, 4706, 565, 1583, 3032, 1509, 29918, 2774, 29918, 7508, 29901, 396, 13136, 563, 29877, 12183, 12422, 13, 9651, 1583, 29889, 7508, 29918, 13789, 29889, 7508, 29918, 15060, 29898, 1767, 29918, 17514, 29918, 14834, 29897, 13, 13, 13, 13, 308, 13, 1678, 822, 25568, 29918, 4713, 440, 279, 29918, 15060, 29898, 1311, 29892, 995, 29918, 17514, 29918, 14834, 29922, 8516, 1125, 13, 4706, 14550, 13, 4706, 1876, 277, 2286, 408, 760, 310, 2473, 29899, 11918, 10804, 13, 4706, 14550, 13, 4706, 298, 7707, 353, 3386, 29918, 6672, 29918, 3166, 29918, 9040, 29898, 1311, 29889, 9040, 29897, 13, 4706, 298, 7707, 29889, 3259, 4619, 29871, 29896, 13, 308, 13, 4706, 396, 591, 1795, 451, 505, 270, 2728, 1000, 278, 3370, 13, 4706, 565, 451, 15562, 29918, 3198, 29918, 3972, 1017, 29918, 7508, 29918, 2966, 29898, 29882, 7707, 1125, 13, 9651, 15562, 29918, 8551, 29918, 7508, 29918, 2966, 29898, 29882, 7707, 29892, 323, 29990, 22698, 29918, 29924, 8647, 5667, 1718, 891, 323, 29990, 22698, 29918, 9464, 15631, 29897, 13, 9651, 736, 13, 13, 4706, 396, 26616, 2586, 338, 731, 13, 4706, 565, 1583, 3032, 1509, 29918, 2774, 29918, 7508, 29901, 396, 13136, 563, 29877, 12183, 12422, 13, 9651, 1583, 29889, 7508, 29918, 13789, 29889, 7508, 29918, 15060, 29898, 1767, 29918, 17514, 29918, 14834, 29897, 539, 13, 13, 4706, 565, 995, 29918, 17514, 29918, 14834, 2804, 6213, 29901, 13, 9651, 4974, 338, 8758, 29898, 1767, 29918, 17514, 29918, 14834, 29892, 18914, 7422, 29897, 13, 9651, 995, 29918, 17514, 29918, 14834, 29889, 6774, 391, 580, 13, 13, 4706, 15562, 29918, 8551, 29918, 7508, 29918, 2966, 29898, 29882, 7707, 29892, 323, 29990, 22698, 29918, 29924, 8647, 5667, 1718, 891, 323, 29990, 22698, 29918, 9464, 15631, 29897, 13, 308, 13, 632, 13, 1678, 822, 24379, 29898, 1311, 1125, 13, 4706, 14550, 13, 4706, 2379, 1878, 738, 22152, 3370, 313, 12324, 635, 363, 3736, 11416, 29897, 13, 4706, 14550, 13, 4706, 1583, 29889, 29885, 29878, 3032, 16015, 6848, 29918, 6774, 391, 29918, 14834, 29918, 1493, 29898, 1311, 29889, 9040, 29897, 13, 13, 308, 13, 1678, 822, 24379, 29918, 10289, 29898, 1311, 29892, 9210, 29918, 13193, 29892, 7431, 29918, 13193, 1125, 13, 4706, 14550, 13, 4706, 2379, 1878, 5120, 310, 22152, 3370, 313, 12324, 635, 363, 3736, 11416, 29897, 13, 4706, 14550, 13, 4706, 565, 9210, 29918, 13193, 718, 7431, 29918, 13193, 1405, 7431, 29898, 1311, 29889, 9040, 1125, 13, 9651, 12020, 24875, 2392, 877, 6774, 391, 29918, 10289, 29901, 8340, 9210, 3443, 1495, 13, 4706, 1583, 29889, 29885, 29878, 3032, 16015, 6848, 29918, 6774, 391, 29918, 14834, 29918, 1493, 29898, 1311, 29889, 9040, 29961, 10289, 29918, 13193, 29901, 10289, 29918, 13193, 29974, 2435, 29918, 13193, 2314, 13, 13, 13, 308, 13, 1990, 18914, 6848, 29898, 29886, 962, 29885, 3221, 29889, 16015, 6848, 1125, 13, 1678, 14550, 13, 1678, 18914, 6848, 11524, 263, 16947, 6643, 1061, 322, 9128, 3370, 13, 1678, 7788, 29889, 29871, 739, 338, 1250, 287, 491, 385, 21271, 3289, 3787, 4163, 322, 16161, 13, 1678, 304, 263, 11565, 29889, 13, 1678, 14550, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1024, 29892, 2159, 29918, 8337, 29892, 282, 6954, 29918, 2084, 29892, 2254, 29918, 10030, 29892, 14998, 29922, 8516, 29892, 5654, 29918, 8582, 29922, 8516, 29892, 4889, 29918, 1482, 29922, 8824, 1125, 13, 4706, 1583, 3032, 17514, 29918, 14834, 353, 6571, 13, 13, 4706, 565, 2897, 29889, 657, 6272, 877, 20055, 7428, 29918, 18525, 1495, 2804, 6213, 29901, 13, 9651, 4744, 29918, 5563, 353, 938, 29898, 359, 29889, 657, 6272, 877, 20055, 7428, 29918, 18525, 8785, 13, 4706, 1683, 29901, 13, 9651, 4744, 29918, 5563, 353, 29871, 29900, 13, 13, 4706, 2428, 2141, 1649, 2344, 12035, 10109, 29918, 978, 29922, 978, 29892, 2159, 29918, 8337, 29922, 2311, 29918, 8337, 29892, 282, 6954, 29918, 2084, 29922, 3358, 331, 29918, 2084, 29892, 13, 462, 308, 2254, 29918, 10030, 29922, 1359, 29918, 10030, 29892, 14998, 29922, 27852, 29892, 5654, 29918, 8582, 29922, 4317, 29918, 8582, 29892, 4889, 29918, 1482, 29922, 10118, 29918, 1482, 29892, 4744, 29918, 5563, 29922, 8382, 29918, 5563, 29897, 13, 308, 13, 4706, 396, 10481, 1423, 363, 714, 11235, 22160, 13, 4706, 599, 29918, 7076, 353, 2428, 2141, 29918, 16015, 6848, 29918, 657, 29918, 17514, 29918, 14834, 29918, 1761, 580, 13, 4706, 9792, 583, 353, 518, 791, 363, 659, 297, 599, 29918, 7076, 565, 659, 29889, 1975, 2541, 877, 29899, 7508, 1495, 29962, 13, 308, 13, 4706, 565, 7431, 29898, 3757, 957, 583, 29897, 1405, 29871, 29900, 29901, 13, 9651, 12020, 24875, 2392, 877, 4801, 26458, 714, 11235, 563, 29877, 1480, 4195, 29901, 24205, 451, 3447, 8762, 1495, 13, 13, 1678, 732, 5696, 3198, 29898, 8768, 11759, 2314, 308, 13, 1678, 822, 1051, 29918, 7076, 29898, 1311, 1125, 13, 4706, 599, 29918, 7076, 353, 2428, 2141, 29918, 16015, 6848, 29918, 657, 29918, 17514, 29918, 14834, 29918, 1761, 580, 13, 4706, 396, 19060, 1819, 13, 4706, 736, 518, 791, 363, 659, 297, 599, 29918, 7076, 565, 451, 659, 29889, 1975, 2541, 877, 29899, 1767, 1495, 29962, 13, 268, 13, 1678, 732, 5696, 3198, 29898, 8768, 11759, 710, 29892, 524, 29892, 524, 29892, 11227, 2314, 13, 1678, 822, 1653, 29918, 17514, 29918, 14834, 29898, 1311, 29892, 1024, 29892, 2159, 29892, 22239, 29922, 29906, 29945, 29953, 29892, 5225, 29922, 8824, 1125, 13, 4706, 14550, 13, 4706, 6204, 263, 640, 5526, 681, 8424, 310, 3370, 322, 1024, 372, 13, 4706, 14550, 13, 4706, 313, 8411, 29892, 286, 1493, 29897, 353, 2428, 2141, 29918, 16015, 6848, 29918, 3258, 29918, 17514, 29918, 14834, 29898, 978, 29892, 2159, 29892, 22239, 29892, 5225, 29897, 13, 4706, 565, 4386, 1275, 6213, 29901, 13, 9651, 736, 6213, 13, 13, 4706, 736, 18914, 7422, 29898, 8411, 29892, 1583, 29892, 286, 1493, 29892, 1024, 29892, 323, 29916, 4598, 29898, 978, 29892, 286, 1493, 29892, 1583, 876, 13, 13, 1678, 732, 5696, 3198, 29898, 8768, 11759, 710, 2314, 13, 1678, 822, 1722, 29918, 17514, 29918, 14834, 29898, 1311, 29892, 1024, 1125, 13, 4706, 14550, 13, 4706, 4673, 5923, 4257, 3370, 13, 4706, 14550, 13, 4706, 313, 8411, 29892, 286, 1493, 29897, 353, 2428, 2141, 29918, 16015, 6848, 29918, 3150, 29918, 17514, 29918, 14834, 29898, 978, 29897, 13, 4706, 565, 4386, 1275, 6213, 29901, 13, 9651, 736, 6213, 13, 4706, 736, 18914, 7422, 29898, 8411, 29892, 1583, 29892, 286, 1493, 29892, 1024, 29892, 323, 29916, 4598, 29898, 978, 29892, 286, 1493, 29892, 1583, 876, 13, 13, 1678, 732, 5696, 3198, 29898, 8768, 11759, 16015, 7422, 2314, 13, 1678, 822, 6507, 29918, 17514, 29918, 14834, 29898, 1311, 29892, 2143, 584, 18914, 7422, 1125, 13, 4706, 14550, 13, 4706, 23708, 263, 640, 5526, 681, 8424, 310, 3370, 313, 29875, 29889, 29872, 29889, 443, 908, 29897, 13, 4706, 14550, 13, 4706, 2428, 2141, 29918, 16015, 6848, 29918, 14096, 29918, 17514, 29918, 14834, 29898, 999, 29889, 8411, 29897, 13, 13, 1678, 732, 5696, 3198, 29898, 8768, 11759, 524, 2314, 13, 1678, 822, 6507, 29918, 17514, 29918, 14834, 29918, 1609, 29918, 8411, 29898, 1311, 29892, 4386, 1125, 13, 4706, 14550, 13, 4706, 23708, 263, 640, 5526, 681, 8424, 310, 3370, 313, 29875, 29889, 29872, 29889, 443, 908, 29897, 13, 4706, 14550, 13, 4706, 2428, 2141, 29918, 16015, 6848, 29918, 14096, 29918, 17514, 29918, 14834, 29898, 8411, 29897, 13, 13, 1678, 732, 5696, 3198, 29898, 8768, 11759, 710, 2314, 13, 1678, 822, 604, 559, 29918, 17514, 29918, 14834, 29898, 1311, 29892, 1024, 1125, 13, 4706, 14550, 13, 4706, 1425, 559, 263, 4257, 29899, 14834, 1203, 515, 278, 3370, 6503, 13, 4706, 14550, 13, 4706, 2428, 2141, 29918, 16015, 6848, 29918, 261, 559, 29918, 17514, 29918, 14834, 29898, 978, 29897, 13, 13, 1678, 732, 5696, 3198, 29898, 8768, 11759, 710, 29892, 10389, 2378, 2314, 13, 1678, 822, 1925, 29918, 17514, 29918, 14834, 29898, 1311, 29892, 1024, 29892, 995, 1125, 13, 4706, 14550, 13, 4706, 14187, 29899, 6707, 8095, 29899, 3200, 9696, 1925, 310, 4257, 3370, 995, 13, 4706, 14550, 13, 4706, 565, 451, 338, 8758, 29898, 1767, 29892, 7023, 2378, 1125, 13, 9651, 12020, 24875, 2392, 877, 649, 29918, 17514, 29918, 14834, 6858, 7023, 2378, 848, 1495, 13, 632, 13, 4706, 2428, 2141, 29918, 16015, 6848, 29918, 649, 29918, 17514, 29918, 14834, 29898, 978, 29892, 995, 29897, 13, 13, 1678, 732, 5696, 3198, 29898, 8768, 11759, 710, 2314, 13, 1678, 822, 679, 29918, 17514, 29918, 14834, 29898, 1311, 29892, 1024, 1125, 13, 4706, 14550, 13, 4706, 14187, 29899, 6707, 679, 310, 4257, 3370, 995, 13, 4706, 14550, 13, 4706, 736, 2428, 2141, 29918, 16015, 6848, 29918, 657, 29918, 17514, 29918, 14834, 29898, 978, 29897, 13, 13, 268, 13, 1678, 822, 679, 29918, 25376, 29918, 3880, 29898, 1311, 1125, 13, 4706, 14550, 13, 4706, 3617, 19649, 310, 3370, 1304, 297, 3370, 6503, 13, 4706, 14550, 13, 4706, 736, 2428, 2141, 29918, 16015, 6848, 29918, 657, 29918, 25376, 29918, 3880, 580, 13, 13, 13, 1678, 822, 23489, 29918, 26276, 29918, 7039, 29898, 1311, 29892, 263, 29901, 851, 29892, 289, 29901, 851, 1125, 13, 4706, 14550, 13, 4706, 3925, 481, 278, 2983, 310, 1023, 4257, 2626, 3842, 29936, 1818, 367, 5492, 13, 4706, 14550, 13, 4706, 736, 2428, 2141, 29918, 16015, 6848, 29918, 21641, 29918, 26276, 29918, 7039, 29898, 29874, 29892, 29890, 29897, 13, 13, 2 ]
heat/engine/attributes.py
pshchelo/heat
0
133540
<reponame>pshchelo/heat # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import collections import warnings import six from heat.common.i18n import _ from heat.engine import constraints as constr from heat.engine import support from oslo_log import log as logging LOG = logging.getLogger(__name__) class Schema(constr.Schema): """ Simple schema class for attributes. Schema objects are serialisable to dictionaries following a superset of the HOT input Parameter schema using dict(). """ KEYS = ( DESCRIPTION, TYPE ) = ( 'description', 'type', ) CACHE_MODES = ( CACHE_LOCAL, CACHE_NONE ) = ( 'cache_local', 'cache_none' ) TYPES = ( STRING, MAP, LIST, ) = ( 'String', 'Map', 'List', ) def __init__(self, description=None, support_status=support.SupportStatus(), cache_mode=CACHE_LOCAL, type=None): self.description = description self.support_status = support_status self.cache_mode = cache_mode self.type = type def __getitem__(self, key): if key == self.DESCRIPTION: if self.description is not None: return self.description elif key == self.TYPE: if self.type is not None: return self.type.lower() raise KeyError(key) @classmethod def from_attribute(cls, schema_dict): """ Return a Property Schema corresponding to a Attribute Schema. """ if isinstance(schema_dict, cls): return schema_dict warnings.warn('<name>: <description> schema definition is deprecated. ' 'Use <name>: attributes.Schema(<description>) instead.', DeprecationWarning) return cls(schema_dict) def schemata(schema): """ Return dictionary of Schema objects for given dictionary of schemata. """ return dict((n, Schema.from_attribute(s)) for n, s in schema.items()) class Attribute(object): """ An Attribute schema. """ def __init__(self, attr_name, schema): """ Initialise with a name and description. :param attr_name: the name of the attribute :param schema: attribute schema """ self.name = attr_name self.schema = Schema.from_attribute(schema) def support_status(self): return self.schema.support_status def as_output(self, resource_name, template_type='cfn'): """ Return an Output schema entry for a provider template with the given resource name. :param resource_name: the logical name of the provider resource :param template_type: the template type to generate :returns: This attribute as a template 'Output' entry for cfn template and 'output' entry for hot template """ if template_type == 'hot': return { "value": '{"get_attr": ["%s", "%s"]}' % (resource_name, self.name), "description": self.schema.description } else: return { "Value": '{"Fn::GetAtt": ["%s", "%s"]}' % (resource_name, self.name), "Description": self.schema.description } class Attributes(collections.Mapping): """Models a collection of Resource Attributes.""" def __init__(self, res_name, schema, resolver): self._resource_name = res_name self._resolver = resolver self._attributes = Attributes._make_attributes(schema) self.reset_resolved_values() def reset_resolved_values(self): self._resolved_values = {} @staticmethod def _make_attributes(schema): return dict((n, Attribute(n, d)) for n, d in schema.items()) @staticmethod def as_outputs(resource_name, resource_class, template_type='cfn'): """ :param resource_name: logical name of the resource :param resource_class: resource implementation class :returns: The attributes of the specified resource_class as a template Output map """ schema = resource_class.attributes_schema attribs = Attributes._make_attributes(schema).items() return dict((n, att.as_output(resource_name, template_type)) for n, att in attribs) @staticmethod def schema_from_outputs(json_snippet): if json_snippet: return dict((k, Schema(v.get("Description"))) for k, v in json_snippet.items()) return {} def _validate_type(self, attrib, value): if attrib.schema.type == attrib.schema.STRING: if not isinstance(value, six.string_types): LOG.warn(_("Attribute %(name)s is not of type %(att_type)s"), {'name': attrib.name, 'att_type': attrib.schema.STRING}) elif attrib.schema.type == attrib.schema.LIST: if (not isinstance(value, collections.Sequence) or isinstance(value, six.string_types)): LOG.warn(_("Attribute %(name)s is not of type %(att_type)s"), {'name': attrib.name, 'att_type': attrib.schema.LIST}) elif attrib.schema.type == attrib.schema.MAP: if not isinstance(value, collections.Mapping): LOG.warn(_("Attribute %(name)s is not of type %(att_type)s"), {'name': attrib.name, 'att_type': attrib.schema.MAP}) def __getitem__(self, key): if key not in self: raise KeyError(_('%(resource)s: Invalid attribute %(key)s') % dict(resource=self._resource_name, key=key)) attrib = self._attributes.get(key) if attrib.schema.cache_mode == Schema.CACHE_NONE: return self._resolver(key) if key in self._resolved_values: return self._resolved_values[key] value = self._resolver(key) if value is not None: # validate the value against its type self._validate_type(attrib, value) # only store if not None, it may resolve to an actual value # on subsequent calls self._resolved_values[key] = value return value def __len__(self): return len(self._attributes) def __contains__(self, key): return key in self._attributes def __iter__(self): return iter(self._attributes) def __repr__(self): return ("Attributes for %s:\n\t" % self._resource_name + '\n\t'.join(six.itervalues(self._attributes))) def select_from_attribute(attribute_value, path): ''' Select an element from an attribute value. :param attribute_value: the attribute value. :param path: a list of path components to select from the attribute. :returns: the selected attribute component value. ''' def get_path_component(collection, key): if not isinstance(collection, (collections.Mapping, collections.Sequence)): raise TypeError(_("Can't traverse attribute path")) if not isinstance(key, (six.string_types, int)): raise TypeError(_('Path components in attributes must be strings')) return collection[key] try: return six.moves.reduce(get_path_component, path, attribute_value) except (KeyError, IndexError, TypeError): return None
[ 1, 529, 276, 1112, 420, 29958, 567, 29882, 305, 7078, 29914, 354, 271, 13, 29937, 13, 29937, 1678, 10413, 21144, 1090, 278, 13380, 19245, 29892, 10079, 29871, 29906, 29889, 29900, 313, 1552, 376, 29931, 293, 1947, 1496, 366, 1122, 13, 29937, 1678, 451, 671, 445, 934, 5174, 297, 752, 13036, 411, 278, 19245, 29889, 887, 1122, 4017, 13, 29937, 1678, 263, 3509, 310, 278, 19245, 472, 13, 29937, 13, 29937, 308, 1732, 597, 1636, 29889, 4288, 29889, 990, 29914, 506, 11259, 29914, 27888, 1430, 1660, 29899, 29906, 29889, 29900, 13, 29937, 13, 29937, 1678, 25870, 3734, 491, 22903, 4307, 470, 15502, 304, 297, 5007, 29892, 7047, 13, 29937, 1678, 13235, 1090, 278, 19245, 338, 13235, 373, 385, 376, 3289, 8519, 29908, 350, 3289, 3235, 29892, 399, 1806, 8187, 2692, 13, 29937, 1678, 399, 1718, 29934, 13566, 29059, 6323, 8707, 29928, 22122, 29903, 8079, 13764, 29979, 476, 22255, 29892, 2845, 4653, 470, 2411, 2957, 29889, 2823, 278, 13, 29937, 1678, 19245, 363, 278, 2702, 4086, 14765, 1076, 11239, 322, 27028, 13, 29937, 1678, 1090, 278, 19245, 29889, 13, 13, 5215, 16250, 13, 5215, 18116, 13, 13, 5215, 4832, 13, 13, 3166, 12871, 29889, 9435, 29889, 29875, 29896, 29947, 29876, 1053, 903, 13, 3166, 12871, 29889, 10599, 1053, 11938, 408, 378, 710, 13, 3166, 12871, 29889, 10599, 1053, 2304, 13, 13, 3166, 2897, 417, 29918, 1188, 1053, 1480, 408, 12183, 13, 13, 14480, 353, 12183, 29889, 657, 16363, 22168, 978, 1649, 29897, 13, 13, 13, 1990, 1102, 2603, 29898, 535, 710, 29889, 12763, 1125, 13, 1678, 9995, 13, 1678, 12545, 10938, 770, 363, 8393, 29889, 13, 13, 1678, 1102, 2603, 3618, 526, 7797, 275, 519, 304, 21503, 4314, 1494, 263, 480, 6774, 300, 310, 13, 1678, 278, 379, 2891, 1881, 24953, 10938, 773, 9657, 2141, 13, 1678, 9995, 13, 13, 1678, 14636, 29903, 353, 313, 13, 4706, 23050, 24290, 2725, 29892, 323, 6959, 13, 1678, 1723, 353, 313, 13, 4706, 525, 8216, 742, 525, 1853, 742, 13, 1678, 1723, 13, 13, 1678, 315, 2477, 9606, 29918, 20387, 29903, 353, 313, 13, 4706, 315, 2477, 9606, 29918, 16652, 1964, 29892, 13, 4706, 315, 2477, 9606, 29918, 29940, 12413, 13, 1678, 1723, 353, 313, 13, 4706, 525, 8173, 29918, 2997, 742, 13, 4706, 525, 8173, 29918, 9290, 29915, 13, 1678, 1723, 13, 13, 1678, 323, 29979, 29925, 2890, 353, 313, 13, 4706, 29486, 4214, 29892, 341, 3301, 29892, 365, 9047, 29892, 13, 1678, 1723, 353, 313, 13, 4706, 525, 1231, 742, 525, 3388, 742, 525, 1293, 742, 13, 1678, 1723, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 6139, 29922, 8516, 29892, 13, 462, 2304, 29918, 4882, 29922, 5924, 29889, 14039, 5709, 3285, 13, 462, 7090, 29918, 8513, 29922, 29907, 2477, 9606, 29918, 16652, 1964, 29892, 13, 462, 1134, 29922, 8516, 1125, 13, 4706, 1583, 29889, 8216, 353, 6139, 13, 4706, 1583, 29889, 5924, 29918, 4882, 353, 2304, 29918, 4882, 13, 4706, 1583, 29889, 8173, 29918, 8513, 353, 7090, 29918, 8513, 13, 4706, 1583, 29889, 1853, 353, 1134, 13, 13, 1678, 822, 4770, 657, 667, 12035, 1311, 29892, 1820, 1125, 13, 4706, 565, 1820, 1275, 1583, 29889, 2287, 7187, 24290, 2725, 29901, 13, 9651, 565, 1583, 29889, 8216, 338, 451, 6213, 29901, 13, 18884, 736, 1583, 29889, 8216, 13, 13, 4706, 25342, 1820, 1275, 1583, 29889, 11116, 29901, 13, 9651, 565, 1583, 29889, 1853, 338, 451, 6213, 29901, 13, 18884, 736, 1583, 29889, 1853, 29889, 13609, 580, 13, 13, 4706, 12020, 7670, 2392, 29898, 1989, 29897, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 515, 29918, 12715, 29898, 25932, 29892, 10938, 29918, 8977, 1125, 13, 4706, 9995, 13, 4706, 7106, 263, 9079, 1102, 2603, 6590, 304, 263, 23833, 1102, 2603, 29889, 13, 4706, 9995, 13, 4706, 565, 338, 8758, 29898, 11010, 29918, 8977, 29892, 1067, 29879, 1125, 13, 9651, 736, 10938, 29918, 8977, 13, 4706, 18116, 29889, 25442, 877, 29966, 978, 23917, 529, 8216, 29958, 10938, 5023, 338, 18164, 29889, 525, 13, 462, 418, 525, 11403, 529, 978, 23917, 8393, 29889, 12763, 29898, 29966, 8216, 12948, 2012, 29889, 742, 13, 462, 418, 897, 1457, 9252, 22709, 29897, 13, 4706, 736, 1067, 29879, 29898, 11010, 29918, 8977, 29897, 13, 13, 13, 1753, 1364, 331, 532, 29898, 11010, 1125, 13, 1678, 9995, 13, 1678, 7106, 8600, 310, 1102, 2603, 3618, 363, 2183, 8600, 310, 1364, 331, 532, 29889, 13, 1678, 9995, 13, 1678, 736, 9657, 3552, 29876, 29892, 1102, 2603, 29889, 3166, 29918, 12715, 29898, 29879, 876, 363, 302, 29892, 269, 297, 10938, 29889, 7076, 3101, 13, 13, 13, 1990, 23833, 29898, 3318, 1125, 13, 1678, 9995, 13, 1678, 530, 23833, 10938, 29889, 13, 1678, 9995, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 12421, 29918, 978, 29892, 10938, 1125, 13, 4706, 9995, 13, 4706, 17250, 895, 411, 263, 1024, 322, 6139, 29889, 13, 13, 4706, 584, 3207, 12421, 29918, 978, 29901, 278, 1024, 310, 278, 5352, 13, 4706, 584, 3207, 10938, 29901, 5352, 10938, 13, 4706, 9995, 13, 4706, 1583, 29889, 978, 353, 12421, 29918, 978, 13, 4706, 1583, 29889, 11010, 353, 1102, 2603, 29889, 3166, 29918, 12715, 29898, 11010, 29897, 13, 13, 1678, 822, 2304, 29918, 4882, 29898, 1311, 1125, 13, 4706, 736, 1583, 29889, 11010, 29889, 5924, 29918, 4882, 13, 13, 1678, 822, 408, 29918, 4905, 29898, 1311, 29892, 6503, 29918, 978, 29892, 4472, 29918, 1853, 2433, 6854, 29876, 29374, 13, 4706, 9995, 13, 4706, 7106, 385, 10604, 10938, 6251, 363, 263, 13113, 4472, 411, 278, 2183, 13, 4706, 6503, 1024, 29889, 13, 13, 4706, 584, 3207, 6503, 29918, 978, 29901, 278, 16667, 1024, 310, 278, 13113, 6503, 13, 4706, 584, 3207, 4472, 29918, 1853, 29901, 278, 4472, 1134, 304, 5706, 13, 4706, 584, 18280, 29901, 910, 5352, 408, 263, 4472, 525, 6466, 29915, 6251, 363, 13, 462, 29871, 274, 9144, 4472, 322, 525, 4905, 29915, 6251, 363, 7375, 4472, 13, 4706, 9995, 13, 4706, 565, 4472, 29918, 1853, 1275, 525, 8711, 2396, 13, 9651, 736, 426, 13, 18884, 376, 1767, 1115, 525, 6377, 657, 29918, 5552, 1115, 6796, 29995, 29879, 613, 11860, 29879, 3108, 10162, 1273, 313, 10314, 29918, 978, 29892, 13, 462, 462, 462, 308, 1583, 29889, 978, 511, 13, 18884, 376, 8216, 1115, 1583, 29889, 11010, 29889, 8216, 13, 9651, 500, 13, 4706, 1683, 29901, 13, 9651, 736, 426, 13, 18884, 376, 1917, 1115, 525, 6377, 29137, 1057, 2577, 4165, 1115, 6796, 29995, 29879, 613, 11860, 29879, 3108, 10162, 1273, 313, 10314, 29918, 978, 29892, 13, 462, 462, 462, 965, 1583, 29889, 978, 511, 13, 18884, 376, 9868, 1115, 1583, 29889, 11010, 29889, 8216, 13, 9651, 500, 13, 13, 13, 1990, 6212, 5026, 29898, 29027, 29889, 15845, 1125, 13, 1678, 9995, 23785, 263, 4333, 310, 18981, 6212, 5026, 1213, 15945, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 620, 29918, 978, 29892, 10938, 29892, 3770, 369, 1125, 13, 4706, 1583, 3032, 10314, 29918, 978, 353, 620, 29918, 978, 13, 4706, 1583, 3032, 9778, 369, 353, 3770, 369, 13, 4706, 1583, 3032, 15697, 353, 6212, 5026, 3032, 5675, 29918, 15697, 29898, 11010, 29897, 13, 4706, 1583, 29889, 12071, 29918, 9778, 1490, 29918, 5975, 580, 13, 13, 1678, 822, 10092, 29918, 9778, 1490, 29918, 5975, 29898, 1311, 1125, 13, 4706, 1583, 3032, 9778, 1490, 29918, 5975, 353, 6571, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 903, 5675, 29918, 15697, 29898, 11010, 1125, 13, 4706, 736, 9657, 3552, 29876, 29892, 23833, 29898, 29876, 29892, 270, 876, 363, 302, 29892, 270, 297, 10938, 29889, 7076, 3101, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 408, 29918, 4905, 29879, 29898, 10314, 29918, 978, 29892, 6503, 29918, 1990, 29892, 4472, 29918, 1853, 2433, 6854, 29876, 29374, 13, 4706, 9995, 13, 4706, 584, 3207, 6503, 29918, 978, 29901, 16667, 1024, 310, 278, 6503, 13, 4706, 584, 3207, 6503, 29918, 1990, 29901, 6503, 5314, 770, 13, 4706, 584, 18280, 29901, 450, 8393, 310, 278, 6790, 6503, 29918, 1990, 408, 263, 4472, 13, 462, 29871, 10604, 2910, 13, 4706, 9995, 13, 4706, 10938, 353, 6503, 29918, 1990, 29889, 15697, 29918, 11010, 13, 4706, 1098, 1091, 29879, 353, 6212, 5026, 3032, 5675, 29918, 15697, 29898, 11010, 467, 7076, 580, 13, 13, 4706, 736, 9657, 3552, 29876, 29892, 1098, 29889, 294, 29918, 4905, 29898, 10314, 29918, 978, 29892, 13, 462, 462, 418, 4472, 29918, 1853, 876, 363, 302, 29892, 1098, 297, 1098, 1091, 29879, 29897, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 10938, 29918, 3166, 29918, 4905, 29879, 29898, 3126, 29918, 29879, 1240, 7988, 1125, 13, 4706, 565, 4390, 29918, 29879, 1240, 7988, 29901, 13, 9651, 736, 9657, 3552, 29895, 29892, 1102, 2603, 29898, 29894, 29889, 657, 703, 9868, 29908, 4961, 13, 462, 4706, 363, 413, 29892, 325, 297, 4390, 29918, 29879, 1240, 7988, 29889, 7076, 3101, 13, 4706, 736, 6571, 13, 13, 1678, 822, 903, 15480, 29918, 1853, 29898, 1311, 29892, 1098, 1091, 29892, 995, 1125, 13, 4706, 565, 1098, 1091, 29889, 11010, 29889, 1853, 1275, 1098, 1091, 29889, 11010, 29889, 20785, 29901, 13, 9651, 565, 451, 338, 8758, 29898, 1767, 29892, 4832, 29889, 1807, 29918, 8768, 1125, 13, 18884, 25401, 29889, 25442, 7373, 703, 6708, 1273, 29898, 978, 29897, 29879, 338, 451, 310, 1134, 1273, 29898, 1131, 29918, 1853, 29897, 29879, 4968, 13, 462, 308, 11117, 978, 2396, 1098, 1091, 29889, 978, 29892, 13, 462, 3986, 525, 1131, 29918, 1853, 2396, 1098, 1091, 29889, 11010, 29889, 20785, 1800, 13, 4706, 25342, 1098, 1091, 29889, 11010, 29889, 1853, 1275, 1098, 1091, 29889, 11010, 29889, 24360, 29901, 13, 9651, 565, 313, 1333, 338, 8758, 29898, 1767, 29892, 16250, 29889, 20529, 29897, 13, 462, 1678, 470, 338, 8758, 29898, 1767, 29892, 4832, 29889, 1807, 29918, 8768, 22164, 13, 18884, 25401, 29889, 25442, 7373, 703, 6708, 1273, 29898, 978, 29897, 29879, 338, 451, 310, 1134, 1273, 29898, 1131, 29918, 1853, 29897, 29879, 4968, 13, 462, 308, 11117, 978, 2396, 1098, 1091, 29889, 978, 29892, 13, 462, 3986, 525, 1131, 29918, 1853, 2396, 1098, 1091, 29889, 11010, 29889, 24360, 1800, 13, 4706, 25342, 1098, 1091, 29889, 11010, 29889, 1853, 1275, 1098, 1091, 29889, 11010, 29889, 23827, 29901, 13, 9651, 565, 451, 338, 8758, 29898, 1767, 29892, 16250, 29889, 15845, 1125, 13, 18884, 25401, 29889, 25442, 7373, 703, 6708, 1273, 29898, 978, 29897, 29879, 338, 451, 310, 1134, 1273, 29898, 1131, 29918, 1853, 29897, 29879, 4968, 13, 462, 308, 11117, 978, 2396, 1098, 1091, 29889, 978, 29892, 13, 462, 3986, 525, 1131, 29918, 1853, 2396, 1098, 1091, 29889, 11010, 29889, 23827, 1800, 13, 13, 1678, 822, 4770, 657, 667, 12035, 1311, 29892, 1820, 1125, 13, 4706, 565, 1820, 451, 297, 1583, 29901, 13, 9651, 12020, 7670, 2392, 7373, 877, 29995, 29898, 10314, 29897, 29879, 29901, 21403, 5352, 1273, 29898, 1989, 29897, 29879, 1495, 1273, 13, 462, 965, 9657, 29898, 10314, 29922, 1311, 3032, 10314, 29918, 978, 29892, 1820, 29922, 1989, 876, 13, 13, 4706, 1098, 1091, 353, 1583, 3032, 15697, 29889, 657, 29898, 1989, 29897, 13, 4706, 565, 1098, 1091, 29889, 11010, 29889, 8173, 29918, 8513, 1275, 1102, 2603, 29889, 29907, 2477, 9606, 29918, 29940, 12413, 29901, 13, 9651, 736, 1583, 3032, 9778, 369, 29898, 1989, 29897, 13, 13, 4706, 565, 1820, 297, 1583, 3032, 9778, 1490, 29918, 5975, 29901, 13, 9651, 736, 1583, 3032, 9778, 1490, 29918, 5975, 29961, 1989, 29962, 13, 13, 4706, 995, 353, 1583, 3032, 9778, 369, 29898, 1989, 29897, 13, 13, 4706, 565, 995, 338, 451, 6213, 29901, 13, 9651, 396, 12725, 278, 995, 2750, 967, 1134, 13, 9651, 1583, 3032, 15480, 29918, 1853, 29898, 1131, 1091, 29892, 995, 29897, 13, 9651, 396, 871, 3787, 565, 451, 6213, 29892, 372, 1122, 8814, 304, 385, 3935, 995, 13, 9651, 396, 373, 15352, 5717, 13, 9651, 1583, 3032, 9778, 1490, 29918, 5975, 29961, 1989, 29962, 353, 995, 13, 4706, 736, 995, 13, 13, 1678, 822, 4770, 2435, 12035, 1311, 1125, 13, 4706, 736, 7431, 29898, 1311, 3032, 15697, 29897, 13, 13, 1678, 822, 4770, 11516, 12035, 1311, 29892, 1820, 1125, 13, 4706, 736, 1820, 297, 1583, 3032, 15697, 13, 13, 1678, 822, 4770, 1524, 12035, 1311, 1125, 13, 4706, 736, 4256, 29898, 1311, 3032, 15697, 29897, 13, 13, 1678, 822, 4770, 276, 558, 12035, 1311, 1125, 13, 4706, 736, 4852, 15801, 363, 1273, 29879, 3583, 29876, 29905, 29873, 29908, 1273, 1583, 3032, 10314, 29918, 978, 718, 13, 18884, 11297, 29876, 29905, 29873, 4286, 7122, 29898, 28319, 29889, 1524, 5975, 29898, 1311, 3032, 15697, 4961, 13, 13, 13, 1753, 1831, 29918, 3166, 29918, 12715, 29898, 12715, 29918, 1767, 29892, 2224, 1125, 13, 1678, 14550, 13, 1678, 7605, 385, 1543, 515, 385, 5352, 995, 29889, 13, 13, 1678, 584, 3207, 5352, 29918, 1767, 29901, 278, 5352, 995, 29889, 13, 1678, 584, 3207, 2224, 29901, 263, 1051, 310, 2224, 7117, 304, 1831, 515, 278, 5352, 29889, 13, 1678, 584, 18280, 29901, 278, 4629, 5352, 4163, 995, 29889, 13, 1678, 14550, 13, 1678, 822, 679, 29918, 2084, 29918, 9700, 29898, 10855, 29892, 1820, 1125, 13, 4706, 565, 451, 338, 8758, 29898, 10855, 29892, 313, 29027, 29889, 15845, 29892, 13, 462, 462, 539, 16250, 29889, 20529, 22164, 13, 9651, 12020, 20948, 7373, 703, 6028, 29915, 29873, 29370, 5352, 2224, 5783, 13, 13, 4706, 565, 451, 338, 8758, 29898, 1989, 29892, 313, 28319, 29889, 1807, 29918, 8768, 29892, 938, 22164, 13, 9651, 12020, 20948, 7373, 877, 2605, 7117, 297, 8393, 1818, 367, 6031, 8785, 13, 13, 4706, 736, 4333, 29961, 1989, 29962, 13, 13, 1678, 1018, 29901, 13, 4706, 736, 4832, 29889, 13529, 267, 29889, 17469, 29898, 657, 29918, 2084, 29918, 9700, 29892, 2224, 29892, 5352, 29918, 1767, 29897, 13, 1678, 5174, 313, 2558, 2392, 29892, 11374, 2392, 29892, 20948, 1125, 13, 4706, 736, 6213, 13, 2 ]
config.py
vanmo9/One-Minute-Pitches
0
1614051
<filename>config.py import os class Config: SQLALCHEMY_DATABASE_URI = 'postgresql+psycopg2://mohamed:911@localhost/mo' # email configurations # We setup the SMTP server and configure the port to use the gmail SMTP server port. MAIL_SERVER = 'smtp.googlemail.com' MAIL_PORT = 587 # Then we set MAIL_USE_TLS configuration to true which enables a transport layer security to secure the emails when sending the emails. MAIL_USE_TLS = True SECRET_KEY=os.environ.get("SECRET_KEY") # MAIL_USERNAME and MAIL_PASSWORD are our email address and password to authenticate to the gmail SMTP server. We set them as environment variables. MAIL_USERNAME = os.environ.get("MAIL_USERNAME") MAIL_PASSWORD = <PASSWORD>("<PASSWORD>") pass class ProdConfig(Config): SQLALCHEMY_DATABASE_URI = os.environ.get("DATABASE_URL") class DevConfig(Config): DEBUG = True config_options = { 'development':DevConfig, 'production':ProdConfig }
[ 1, 529, 9507, 29958, 2917, 29889, 2272, 13, 5215, 2897, 29871, 13, 13, 1990, 12782, 29901, 13, 1678, 3758, 1964, 3210, 12665, 29979, 29918, 25832, 27982, 29918, 15551, 353, 525, 29272, 29974, 567, 29891, 9708, 29887, 29906, 597, 29885, 1148, 2795, 29901, 29929, 29896, 29896, 29992, 7640, 29914, 4346, 29915, 13, 1678, 13, 13, 13, 1678, 396, 29871, 4876, 22920, 13, 13, 1678, 396, 1334, 6230, 278, 13766, 3557, 1923, 322, 10822, 278, 2011, 304, 671, 278, 330, 2549, 13766, 3557, 1923, 2011, 29889, 29871, 13, 1678, 14861, 6227, 29918, 18603, 353, 525, 3844, 9392, 29889, 3608, 2549, 29889, 510, 29915, 13, 1678, 14861, 6227, 29918, 15082, 353, 29871, 29945, 29947, 29955, 13, 1678, 396, 1987, 591, 731, 14861, 6227, 29918, 17171, 29918, 29911, 8547, 5285, 304, 1565, 607, 28936, 263, 8608, 7546, 6993, 304, 11592, 278, 24609, 746, 9348, 278, 24609, 29889, 13, 1678, 14861, 6227, 29918, 17171, 29918, 29911, 8547, 353, 5852, 13, 13, 1678, 3725, 22245, 29911, 29918, 10818, 29922, 359, 29889, 21813, 29889, 657, 703, 1660, 22245, 29911, 29918, 10818, 1159, 13, 1678, 396, 14861, 6227, 29918, 11889, 5813, 322, 14861, 6227, 29918, 25711, 17013, 526, 1749, 4876, 3211, 322, 4800, 304, 15585, 403, 304, 278, 330, 2549, 13766, 3557, 1923, 29889, 1334, 731, 963, 408, 5177, 3651, 29889, 13, 1678, 14861, 6227, 29918, 11889, 5813, 353, 2897, 29889, 21813, 29889, 657, 703, 1529, 6227, 29918, 11889, 5813, 1159, 13, 1678, 14861, 6227, 29918, 25711, 17013, 353, 529, 25711, 17013, 29958, 28945, 25711, 17013, 29958, 1159, 13, 13, 1678, 1209, 13, 13, 13, 1990, 1019, 29881, 3991, 29898, 3991, 1125, 13, 1678, 3758, 1964, 3210, 12665, 29979, 29918, 25832, 27982, 29918, 15551, 353, 2897, 29889, 21813, 29889, 657, 703, 25832, 27982, 29918, 4219, 1159, 13, 13, 13, 1990, 9481, 3991, 29898, 3991, 1125, 13, 13, 1678, 21681, 353, 5852, 13, 13, 2917, 29918, 6768, 353, 426, 29871, 13, 29915, 25431, 2396, 16618, 3991, 29892, 13, 29915, 24601, 2396, 1184, 29881, 3991, 13, 29913, 2 ]
cogs/wallet.py
virtualCrypto-discord/VCrypto-Utilities
0
186621
from discord.ext import commands from bot import MyBot from virtualcrypto import AsyncVirtualCryptoClient class Wallet(commands.Cog): def __init__(self, bot: MyBot): self.bot = bot self.vcrypto: AsyncVirtualCryptoClient = self.bot.vcrypto @commands.command(aliases=['bal', 'money']) @commands.has_permissions(manage_guild=True) async def balance(self, ctx: commands.Context): currency = await self.vcrypto.get_currency_by_guild(ctx.guild.id) if currency is None: await ctx.send("このサーバーでは通貨は作成されていません。") return balance = await self.bot.get_balance(ctx.guild.id) if balance is None: value = 0 else: value = balance.amount await ctx.send(f"{value}{currency.unit}を持っています。") def setup(bot): return bot.add_cog(Wallet(bot))
[ 1, 515, 2313, 536, 29889, 1062, 1053, 8260, 13, 3166, 9225, 1053, 1619, 29933, 327, 13, 3166, 6901, 29883, 17929, 1053, 20688, 21287, 29907, 17929, 4032, 13, 13, 13, 1990, 5260, 1026, 29898, 26381, 29889, 29907, 468, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 9225, 29901, 1619, 29933, 327, 1125, 13, 4706, 1583, 29889, 7451, 353, 9225, 13, 4706, 1583, 29889, 7071, 17929, 29901, 20688, 21287, 29907, 17929, 4032, 353, 1583, 29889, 7451, 29889, 7071, 17929, 13, 13, 1678, 732, 26381, 29889, 6519, 29898, 2606, 2129, 29922, 1839, 5521, 742, 525, 29885, 4992, 11287, 13, 1678, 732, 26381, 29889, 5349, 29918, 17858, 6847, 29898, 1171, 482, 29918, 2543, 789, 29922, 5574, 29897, 13, 1678, 7465, 822, 17346, 29898, 1311, 29892, 12893, 29901, 8260, 29889, 2677, 1125, 13, 4706, 27550, 353, 7272, 1583, 29889, 7071, 17929, 29889, 657, 29918, 26095, 29918, 1609, 29918, 2543, 789, 29898, 13073, 29889, 2543, 789, 29889, 333, 29897, 13, 4706, 565, 27550, 338, 6213, 29901, 13, 9651, 7272, 12893, 29889, 6717, 703, 30589, 30199, 30615, 30185, 30517, 30185, 30499, 30449, 30768, 235, 181, 171, 30449, 30732, 30494, 30566, 30553, 30466, 30298, 30441, 31095, 30389, 30267, 1159, 13, 9651, 736, 13, 4706, 17346, 353, 7272, 1583, 29889, 7451, 29889, 657, 29918, 5521, 749, 29898, 13073, 29889, 2543, 789, 29889, 333, 29897, 13, 4706, 565, 17346, 338, 6213, 29901, 13, 9651, 995, 353, 29871, 29900, 13, 4706, 1683, 29901, 13, 9651, 995, 353, 17346, 29889, 14506, 13, 13, 4706, 7272, 12893, 29889, 6717, 29898, 29888, 29908, 29912, 1767, 1157, 26095, 29889, 5441, 29913, 30396, 31695, 30665, 30466, 30298, 30441, 30427, 30267, 1159, 13, 13, 13, 1753, 6230, 29898, 7451, 1125, 13, 1678, 736, 9225, 29889, 1202, 29918, 29883, 468, 29898, 29956, 284, 1026, 29898, 7451, 876, 13, 2 ]
CH10/CH10c_Faster_Transformer_model_serving_using_Tensorflow_Extended/main.py
sharif618/Mastering-Transformers
155
173997
<filename>CH10/CH10c_Faster_Transformer_model_serving_using_Tensorflow_Extended/main.py import uvicorn from fastapi import FastAPI from pydantic import BaseModel from transformers import BertTokenizerFast, BertConfig import requests import json import numpy as np tokenizer = BertTokenizerFast.from_pretrained("nateraw/bert-base-uncased-imdb") config = BertConfig.from_pretrained("nateraw/bert-base-uncased-imdb") class DataModel(BaseModel): text: str app = FastAPI() @app.post("/sentiment") async def sentiment_analysis(input_data: DataModel): print(input_data.text) tokenized_sentence = [dict(tokenizer(input_data.text))] data_send = {"instances": tokenized_sentence} response = requests.post("http://localhost:8501/v1/models/bert:predict", data=json.dumps(data_send)) result = np.abs(json.loads(response.text)["predictions"][0]) return {"sentiment": config.id2label[np.argmax(result)]} if __name__ == '__main__': uvicorn.run('main:app', workers=1)
[ 1, 529, 9507, 29958, 3210, 29896, 29900, 29914, 3210, 29896, 29900, 29883, 29918, 29943, 1901, 29918, 13372, 261, 29918, 4299, 29918, 643, 1747, 29918, 4746, 29918, 29911, 6073, 1731, 29918, 5647, 2760, 29914, 3396, 29889, 2272, 13, 5215, 318, 26311, 1398, 13, 3166, 5172, 2754, 1053, 23786, 8787, 13, 3166, 282, 2941, 7716, 1053, 7399, 3195, 13, 3166, 4327, 414, 1053, 16662, 6066, 3950, 29943, 579, 29892, 16662, 3991, 13, 5215, 7274, 13, 5215, 4390, 13, 5215, 12655, 408, 7442, 13, 13, 6979, 3950, 353, 16662, 6066, 3950, 29943, 579, 29889, 3166, 29918, 1457, 3018, 1312, 703, 29876, 1008, 1450, 29914, 2151, 29899, 3188, 29899, 4661, 1463, 29899, 326, 2585, 1159, 13, 2917, 353, 16662, 3991, 29889, 3166, 29918, 1457, 3018, 1312, 703, 29876, 1008, 1450, 29914, 2151, 29899, 3188, 29899, 4661, 1463, 29899, 326, 2585, 1159, 13, 13, 13, 1990, 3630, 3195, 29898, 5160, 3195, 1125, 13, 1678, 1426, 29901, 851, 13, 13, 932, 353, 23786, 8787, 580, 13, 13, 29992, 932, 29889, 2490, 11974, 18616, 2073, 1159, 13, 12674, 822, 19688, 29918, 15916, 29898, 2080, 29918, 1272, 29901, 3630, 3195, 1125, 13, 1678, 1596, 29898, 2080, 29918, 1272, 29889, 726, 29897, 13, 1678, 5993, 1891, 29918, 18616, 663, 353, 518, 8977, 29898, 6979, 3950, 29898, 2080, 29918, 1272, 29889, 726, 28166, 13, 1678, 848, 29918, 6717, 353, 8853, 2611, 2925, 1115, 5993, 1891, 29918, 18616, 663, 29913, 13, 1678, 2933, 353, 7274, 29889, 2490, 703, 1124, 597, 7640, 29901, 29947, 29945, 29900, 29896, 29914, 29894, 29896, 29914, 9794, 29914, 2151, 29901, 27711, 613, 848, 29922, 3126, 29889, 29881, 17204, 29898, 1272, 29918, 6717, 876, 13, 1678, 1121, 353, 7442, 29889, 6897, 29898, 3126, 29889, 18132, 29898, 5327, 29889, 726, 29897, 3366, 27711, 1080, 3108, 29961, 29900, 2314, 13, 1678, 736, 8853, 18616, 2073, 1115, 2295, 29889, 333, 29906, 1643, 29961, 9302, 29889, 1191, 3317, 29898, 2914, 4638, 29913, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 29871, 13, 268, 318, 26311, 1398, 29889, 3389, 877, 3396, 29901, 932, 742, 17162, 29922, 29896, 29897, 29871, 13, 2 ]
flat_sales/flat_sales/doctype/flat_payment_schedule/test_flat_payment_schedule.py
swamedh/flat_sales
1
124961
# Copyright (c) 2013, deepak and Contributors # See license.txt from __future__ import unicode_literals import frappe import unittest test_records = frappe.get_test_records('Flat Payment Schedule') class TestFlatPaymentSchedule(unittest.TestCase): pass
[ 1, 396, 14187, 1266, 313, 29883, 29897, 29871, 29906, 29900, 29896, 29941, 29892, 6483, 557, 322, 2866, 1091, 29560, 13, 29937, 2823, 19405, 29889, 3945, 13, 3166, 4770, 29888, 9130, 1649, 1053, 29104, 29918, 20889, 1338, 13, 13, 5215, 5227, 4798, 13, 5215, 443, 27958, 13, 13, 1688, 29918, 3757, 4339, 353, 5227, 4798, 29889, 657, 29918, 1688, 29918, 3757, 4339, 877, 29943, 5066, 14617, 358, 1102, 11272, 1495, 13, 13, 1990, 4321, 29943, 5066, 15467, 358, 4504, 11272, 29898, 348, 27958, 29889, 3057, 8259, 1125, 13, 12, 3364, 13, 2 ]
9020/main.py
yeonghoey/baekjoon
1
21328
MAX_N = 10000 + 1 isprime = [True] * (MAX_N) isprime[0] = False isprime[1] = False for i in range(2, MAX_N): if not isprime[i]: continue for j in range(i+i, MAX_N, i): isprime[j] = False T = int(input()) for _ in range(T): n = int(input()) for i in range(n//2, 1, -1): if isprime[i] and isprime[n-i]: print('%d %d' % (i, n-i)) break
[ 1, 18134, 29918, 29940, 353, 29871, 29896, 29900, 29900, 29900, 29900, 718, 29871, 29896, 13, 275, 10080, 353, 518, 5574, 29962, 334, 313, 12648, 29918, 29940, 29897, 13, 275, 10080, 29961, 29900, 29962, 353, 7700, 13, 275, 10080, 29961, 29896, 29962, 353, 7700, 13, 13, 1454, 474, 297, 3464, 29898, 29906, 29892, 18134, 29918, 29940, 1125, 13, 1678, 565, 451, 338, 10080, 29961, 29875, 5387, 13, 4706, 6773, 13, 1678, 363, 432, 297, 3464, 29898, 29875, 29974, 29875, 29892, 18134, 29918, 29940, 29892, 474, 1125, 13, 4706, 338, 10080, 29961, 29926, 29962, 353, 7700, 13, 13, 29911, 353, 938, 29898, 2080, 3101, 13, 1454, 903, 297, 3464, 29898, 29911, 1125, 13, 1678, 302, 353, 938, 29898, 2080, 3101, 13, 1678, 363, 474, 297, 3464, 29898, 29876, 458, 29906, 29892, 29871, 29896, 29892, 448, 29896, 1125, 13, 4706, 565, 338, 10080, 29961, 29875, 29962, 322, 338, 10080, 29961, 29876, 29899, 29875, 5387, 13, 9651, 1596, 877, 29995, 29881, 1273, 29881, 29915, 1273, 313, 29875, 29892, 302, 29899, 29875, 876, 13, 9651, 2867, 13, 2 ]
dandeliondiary/household/tests.py
amberdiehl/dandeliondiary_project
0
56233
<gh_stars>0 import datetime import json from django.core.exceptions import ObjectDoesNotExist from django.test import Client from django.test import TestCase from django.urls import reverse from django.contrib.auth.models import User, Group from account.models import Account from core.models import BudgetModel, RigType, UseType, IncomeType, VehicleMake, VehicleModel, VehicleType, \ VehiclePurchaseType, VehicleStatus, Satisfaction, BudgetGroup, BudgetCategory from compare.models import MyBudgetGroup, MyBudgetCategory from .models import RVHousehold, Member, HouseholdMembers, HouseholdInvite, Vehicle from .forms import MyInfoForm, HouseholdProfileForm, InviteMemberForm, VehicleForm # For now, all test cases for household are defined in one class class HouseholdTest(TestCase): @classmethod def setUpClass(cls): """ Set up initial test data :return: """ """ Create core model objects needed for household objects """ try: budget_model = BudgetModel.objects.get(budget_model='RVHousehold') except ObjectDoesNotExist: budget_model = BudgetModel() budget_model.budget_model = 'RVHousehold' budget_model.budget_model_description = 'Budget model for RV community' budget_model.save() rig = RigType() rig.rig_type = 'Motorhome' rig.rig_type_description = 'Motorhome' rig.save() use = UseType() use.use_type = 'Full-time' use.use_type_description = 'Full-time' use.save() income = IncomeType() income.income_type = 'Self-employed' income.income_type_description = 'Self-employed' income.save() make = VehicleMake() make.filter = 'rv' make.make = 'Tiffin' make.save() model = VehicleModel() model.make = make model.model_name = 'Allegro Bus' model.save() v_type = VehicleType() v_type.filter = 'rv' v_type.type = 'Motorhome' v_type.type_description = 'Your RV is a motorhome.' v_type.save() purchase = VehiclePurchaseType() purchase.purchase_type = 'Used-Private' purchase.purchase_description = 'Purchased directly from an individual.' purchase.save() status = VehicleStatus() status.vehicle_status = 'Owner' status.vehicle_status_description = 'Still owned by me.' status.save() satisfaction = Satisfaction() satisfaction.satisfaction_index = 5 satisfaction.satisfaction_description = 'Love it!' satisfaction.satisfaction_definition = 'Would definitely purchase again.' satisfaction.save() """ Create auth group for forum permissions """ group = Group() group.name = 'forum_customers' group.save() """ Create template budget objects """ budget_group = BudgetGroup() budget_group.budget_model = budget_model budget_group.group_name = 'Health Care' budget_group.group_description = 'Expenses associated with staying well' budget_group.group_list_order = 1 budget_group.group_perma_key = 'perma-key-value' budget_group.save() category = BudgetCategory() category.budget_group = budget_group category.category = 'Insurance' category.category_perma_key = 'perma-key-value' category.save() """ Create users and associated objects for dashboard test cases. """ # 1. Just created account, has not setup household or provided personal details User.objects.create_user('alex', email='<EMAIL>', password='password') # 2. New account, only has personal details user = User.objects.create_user('barney', email='<EMAIL>', password='password') account = Account.objects.get(user=user) member = Member() member.account = account member.phone_number = '415-413-4393' member.owner = True member.newsletter = True member.save() user.first_name = 'Barney' user.last_name = 'Balderdash' user.save() # 3. New account, has provided personal details and household information, but no vehicles user = User.objects.create_user('chuck', email='<EMAIL>', password='password') account = Account.objects.get(user=user) member = Member() member.account = account member.phone_number = '415-413-4401' member.owner = True member.newsletter = True member.save() user.first_name = 'Charles' user.last_name = 'Carter' user.save() household = RVHousehold() household.members_in_household = 2 household.oldest_birthyear = 1950 household.budget_model = budget_model household.opt_in_contribute = True household.paid_through = datetime.datetime.now().date() + datetime.timedelta(days=1000) household.subscription_status = 'Beta' household.start_year = 2000 household.rig_type = rig household.use_type = use household.income_type = income household.pets_dog = 1 household.save() household_member = HouseholdMembers() household_member.member_account = account household_member.household_membership = household household_member.save() # 4. Expired account user = User.objects.create_user('dave', email='<EMAIL>', password='password') account = Account.objects.get(user=user) member = Member() member.account = account member.phone_number = '415-413-4402' member.owner = True member.newsletter = True member.save() user.first_name = 'David' user.last_name = 'Davis' user.save() household = RVHousehold() household.members_in_household = 1 household.oldest_birthyear = 1951 household.budget_model = budget_model household.opt_in_contribute = True household.paid_through = datetime.datetime.now().date() - datetime.timedelta(days=1) household.subscription_status = 'Beta' household.start_year = 1985 household.rig_type = rig household.use_type = use household.income_type = income household.pets_dog = 0 household.save() household_member = HouseholdMembers() household_member.member_account = account household_member.household_membership = household household_member.save() """ Create users and associated objects for my info test cases. """ User.objects.create_user('eric', email='<EMAIL>', password='password') """ Create users and associated objects for household test cases. """ User.objects.create_user('fred', email='<EMAIL>', password='password') """ Create users and associated objects for household member test cases. """ # Expired membership user = User.objects.create_user('greg', email='<EMAIL>', password='password') account = Account.objects.get(user=user) member = Member() member.account = account member.phone_number = '415-413-4410' member.owner = True member.newsletter = True member.save() user.first_name = 'Greg' user.last_name = 'Gardiner' user.save() household = RVHousehold() household.members_in_household = 2 household.oldest_birthyear = 1954 household.budget_model = budget_model household.opt_in_contribute = True household.paid_through = datetime.datetime.now().date() - datetime.timedelta(days=1) household.subscription_status = 'Beta' household.start_year = 1982 household.rig_type = rig household.use_type = use household.income_type = income household.pets_dog = 1 household.save() household_member = HouseholdMembers() household_member.member_account = account household_member.household_membership = household household_member.save() # Current membership user = User.objects.create_user('harry', email='<EMAIL>', password='password') account = Account.objects.get(user=user) member = Member() member.account = account member.phone_number = '415-413-4411' member.owner = True member.newsletter = True member.save() user.first_name = 'Harry' user.last_name = 'Hughes' user.save() household = RVHousehold() household.members_in_household = 2 household.oldest_birthyear = 1951 household.budget_model = budget_model household.opt_in_contribute = True household.paid_through = datetime.datetime.now().date() + datetime.timedelta(days=1000) household.subscription_status = 'Beta' household.start_year = 1980 household.rig_type = rig household.use_type = use household.income_type = income household.pets_dog = 2 household.save() household_member = HouseholdMembers() household_member.member_account = account household_member.household_membership = household household_member.save() # Member of harry's household user = User.objects.create_user('annie', email='<EMAIL>', password='password') account = Account.objects.get(user=user) member = Member() member.account = account member.phone_number = '415-413-5511' member.owner = False member.newsletter = True member.save() user.first_name = 'Annie' user.last_name = 'Arneau-Hughes' user.save() household_member = HouseholdMembers() household_member.member_account = account household_member.household_membership = household household_member.save() # Random invites for tests invite = HouseholdInvite() invite.invite_household = household invite.email = '<EMAIL>' invite.security_code = '1234567' invite.invite_date = datetime.datetime.now().date() invite.save() invite = HouseholdInvite() invite.invite_household = household invite.email = '<EMAIL>' invite.security_code = '1234567' invite.invite_date = datetime.datetime.now().date() invite.save() @classmethod def tearDownClass(cls): pass """ Test the models """ def test_models(self): budget_model = BudgetModel.objects.get(budget_model='RVHousehold') self.assertEquals(str(budget_model), 'RVHousehold') rig = RigType.objects.get(rig_type='Motorhome') self.assertEquals(str(rig), 'Motorhome') use = UseType.objects.get(use_type='Full-time') self.assertEquals(str(use), 'Full-time') income = IncomeType.objects.get(income_type='Self-employed') self.assertEquals(str(income), 'Self-employed') make = VehicleMake.objects.get(make='Tiffin') self.assertEquals(str(make), 'Tiffin') v_model = VehicleModel.objects.get(model_name='Allegro Bus') self.assertEquals(str(v_model), 'Allegro Bus') v_type = VehicleType.objects.get(type='Motorhome') self.assertEquals(str(v_type), 'Motorhome') purchase = VehiclePurchaseType.objects.get(purchase_type='Used-Private') self.assertEquals(str(purchase), 'Used-Private') status = VehicleStatus.objects.get(vehicle_status='Owner') self.assertEquals(str(status), 'Owner') satisfaction = Satisfaction.objects.get(satisfaction_index=5) self.assertEquals(str(satisfaction), 'Love it!') member = Member.objects.get(phone_number='415-413-4393') self.assertEquals(str(member), '415-413-4393') household = RVHousehold.objects.get(pk=1) self.assertEquals(str(household), '1') household_member = HouseholdMembers.objects.all()[0] self.assertEquals(str(household_member), 'Member key: {} Household key: {}'.format( household_member.member_account, household_member.household_membership)) budget_group = BudgetGroup.objects.get(group_name='Health Care') self.assertEquals(str(budget_group), 'Health Care') category = BudgetCategory.objects.get(category='Insurance') self.assertEquals(str(category), 'Insurance') invite = HouseholdInvite.objects.get(email='<EMAIL>') self.assertEquals(str(invite), '<EMAIL>') """ Test various states and conditions for the dashboard view """ def test_dashboard_new_user(self): """ New user, hasn't setup personal information or household yet :return: """ self.client = Client() logged_in = self.client.login(username='alex', password='password') self.assertEquals(logged_in, True) response = self.client.get(reverse('household:household_dashboard'), secure=True) summary = response.context['summary'] # Tags indicating need for personal info and household information should exist self.assertEquals(summary['need_myinfo'], 'Please take a moment to provide your name and a phone number.') self.assertEquals(summary['need_household'], 'To activate your free trial, please setup your household information.') # And other tags should not exist until after those things are provided with self.assertRaises(KeyError): test = summary['need_vehicles'] test = summary['free_trial'] def test_dashboard_new_user_personal_info_provided(self): """ New user, has setup personal information but not household yet :return: """ self.client = Client() logged_in = self.client.login(username='barney', password='password') self.assertEquals(logged_in, True) response = self.client.get(reverse('household:household_dashboard'), secure=True) summary = response.context['summary'] # Personal info for Barney should exist self.assertEquals(summary['first_name'], 'Barney') self.assertEquals(summary['last_name'], 'Balderdash') self.assertEquals(summary['phone_number'], '415-413-4393') # Household info is still missing self.assertEquals(summary['need_household'], 'To activate your free trial, please setup your household information.') # And other tags should not exist until after those things are provided with self.assertRaises(KeyError): test = summary['need_vehicles'] test = summary['free_trial'] def test_dashboard_new_user_with_household_setup(self): """ New user, has provided personal info and household :return: """ self.client = Client() logged_in = self.client.login(username='chuck', password='password') self.assertEquals(logged_in, True) response = self.client.get(reverse('household:household_dashboard'), secure=True) summary = response.context['summary'] # Personal info for Charles should exist self.assertEquals(summary['first_name'], 'Charles') self.assertEquals(summary['last_name'], 'Carter') self.assertEquals(summary['phone_number'], '415-413-4401') # Household info should exist self.assertEquals(summary['start_year'], 2000) self.assertEquals(summary['pets'], 1) # And now info is displayed about subscription and vehicles self.assertEquals(summary['need_vehicles'][0:14], 'Please specify') self.assertEquals(summary['free_trial'][0:6], 'Thanks') def test_dashboard_expired_subscription(self): """ Expired subscription :return: """ self.client = Client() logged_in = self.client.login(username='dave', password='password') self.assertEquals(logged_in, True) response = self.client.get(reverse('household:household_dashboard'), secure=True) summary = response.context['summary'] # Personal info for David should exist self.assertEquals(summary['first_name'], 'David') self.assertEquals(summary['last_name'], 'Davis') self.assertEquals(summary['phone_number'], '415-413-4402') # Household info should exist self.assertEquals(summary['start_year'], 1985) self.assertEquals(summary['pets'], 0) # And now info is displayed about subscription and vehicles self.assertEquals(summary['need_vehicles'][0:14], 'Please specify') self.assertEquals(summary['expired'][0:30], 'Your subscription has expired.') """ Test my_info view and form """ def test_my_info_view(self): self.client = Client() logged_in = self.client.login(username='eric', password='password') self.assertEquals(logged_in, True) data = { 'first_name': 'Eric', 'last_name': 'Emmerson', 'phone_number': '415-413-4403', 'newsletter': True, 'owner': True } response = self.client.post(reverse('household:my_info'), data=data, secure=True) self.assertEqual(response.status_code, 200) user = User.objects.get(username='eric') account = Account.objects.get(user=user) member = Member.objects.get(account=account) self.assertEquals(user.last_name, 'Emmerson') self.assertEquals(member.phone_number, '415-413-4403') def test_my_info_form_empty(self): data = { 'first_name': '', 'last_name': '', 'phone_number': '', 'newsletter': True, 'owner': True } form = MyInfoForm(data=data) self.assertFalse(form.is_valid()) def test_my_info_form_bad_names(self): data = { 'first_name': '$', 'last_name': 'E', 'phone_number': '415-413-4403', 'newsletter': True, 'owner': True } form = MyInfoForm(data=data) self.assertFalse(form.is_valid()) def test_my_info_form_bad_phone_number(self): data = { 'first_name': 'Eric', 'last_name': 'Emmerson', 'phone_number': '555-555-5555', 'newsletter': True, 'owner': True } form = MyInfoForm(data=data) self.assertFalse(form.is_valid()) def test_my_info_form_valid(self): data = { 'first_name': 'Eric', 'last_name': 'Emmerson', 'phone_number': '415-413-4403', 'newsletter': True, 'owner': True } form = MyInfoForm(data=data) self.assertTrue(form.is_valid()) """ Test household_profile view and form """ def test_household_profile_view(self): self.client = Client() logged_in = self.client.login(username='fred', password='password') self.assertEquals(logged_in, True) rig= RigType.objects.get(rig_type='Motorhome') use = UseType.objects.get(use_type='Full-time') income = IncomeType.objects.get(income_type='Self-employed') # Test create data = { 'start_year': 1992, 'members_in_household': 2, 'oldest_birthyear': 1952, 'rig_type': rig.pk, 'use_type': use.pk, 'income_type': income.pk, 'pets_dog': 1, 'pets_cat': 0, 'pets_other': 1, 'children': 0, 'children_status': 0, 'grandchildren': 0, 'grandchildren_status': 0 } response = self.client.post(reverse('household:maintain_household'), data=data, secure=True) self.assertEqual(response.status_code, 200) user = User.objects.get(username='fred') account = Account.objects.get(user=user) household = RVHousehold.objects.get(householdmembers__member_account=account) self.assertEquals(household.start_year, 1992) my_group = MyBudgetGroup.objects.get(my_group_name='Health Care') self.assertEquals(str(my_group), 'Health Care') my_category = MyBudgetCategory.objects.get(my_category_name='Insurance') self.assertEquals(str(my_category), 'Insurance') # Test update data = { 'start_year': 1994, 'members_in_household': 2, 'oldest_birthyear': 1952, 'rig_type': rig.pk, 'use_type': use.pk, 'income_type': income.pk, 'pets_dog': 1, 'pets_cat': 1, 'pets_other': 0, 'children': 0, 'children_status': 0, 'grandchildren': 0, 'grandchildren_status': 0 } response = self.client.post(reverse('household:maintain_household'), data=data, secure=True) self.assertEqual(response.status_code, 200) user = User.objects.get(username='fred') account = Account.objects.get(user=user) household = RVHousehold.objects.get(householdmembers__member_account=account) self.assertEquals(household.start_year, 1994) def test_household_profile_form_empty(self): data = { 'start_year': 0, 'members_in_household': 0, 'oldest_birthyear': 0, 'rig_type': 0, 'use_type': 0, 'income_type': 0, 'pets_dog': 0, 'pets_cat': 0, 'pets_other': 0, 'children': 0, 'children_status': 0, 'grandchildren': 0, 'grandchildren_status': 0 } form = HouseholdProfileForm(data=data) self.assertFalse(form.is_valid()) def test_household_profile_form_need_rig_use_income(self): data = { 'start_year': 2011, 'members_in_household': 2, 'oldest_birthyear': 1963, 'rig_type': 0, 'use_type': 0, 'income_type': 0, 'pets_dog': 0, 'pets_cat': 0, 'pets_other': 0, 'children': 0, 'children_status': 0, 'grandchildren': 0, 'grandchildren_status': 0 } form = HouseholdProfileForm(data=data) self.assertFalse(form.is_valid()) def test_household_profile_form_too_many_pets(self): data = { 'start_year': 2011, 'members_in_household': 2, 'oldest_birthyear': 1963, 'rig_type': 1, 'use_type': 1, 'income_type': 1, 'pets_dog': 11, 'pets_cat': 0, 'pets_other': 0, 'children': 0, 'children_status': 0, 'grandchildren': 0, 'grandchildren_status': 0 } form = HouseholdProfileForm(data=data) self.assertFalse(form.is_valid()) def test_household_profile_form_invalid_children_status(self): data = { 'start_year': 2011, 'members_in_household': 2, 'oldest_birthyear': 1963, 'rig_type': 1, 'use_type': 1, 'income_type': 1, 'pets_dog': 1, 'pets_cat': 0, 'pets_other': 0, 'children': 1, 'children_status': 0, # <-- 'grandchildren': 1, 'grandchildren_status': 0 # <-- } form = HouseholdProfileForm(data=data) self.assertFalse(form.is_valid()) def test_household_profile_form_invalid_children_count(self): data = { 'start_year': 2011, 'members_in_household': 2, 'oldest_birthyear': 1963, 'rig_type': 1, 'use_type': 1, 'income_type': 1, 'pets_dog': 1, 'pets_cat': 0, 'pets_other': 0, 'children': 0, # <-- 'children_status': 1, 'grandchildren': 0, # <-- 'grandchildren_status': 1 } form = HouseholdProfileForm(data=data) self.assertFalse(form.is_valid()) def test_household_profile_form_valid(self): data = { 'start_year': 2011, 'members_in_household': 2, 'oldest_birthyear': 1963, 'rig_type': 1, 'use_type': 1, 'income_type': 1, 'pets_dog': 1, 'pets_cat': 1, 'pets_other': 0, 'children': 0, 'children_status': 0, 'grandchildren': 0, 'grandchildren_status': 0 } form = HouseholdProfileForm(data=data) self.assertTrue(form.is_valid()) """ Test household_members view, form, and ajax calls """ def test_household_members_view(self): self.client = Client() # Redirect for expired subscription logged_in = self.client.login(username='greg', password='password') self.assertEquals(logged_in, True) response = self.client.get(reverse('household:maintain_members'), follow=True, secure=True) chain = response.redirect_chain[0] self.assertEquals(chain[0], '/household/settings') self.assertEquals(chain[1], 302) self.assertEquals(response.status_code, 200) # Redirect because non-owner cannot invite other members logged_in = self.client.login(username='annie', password='password') self.assertEquals(logged_in, True) response = self.client.get(reverse('household:maintain_members'), follow=True, secure=True) chain = response.redirect_chain[0] self.assertEquals(chain[0], '/household/settings') self.assertEquals(chain[1], 302) self.assertEquals(response.status_code, 200) # Test invitation logged_in = self.client.login(username='harry', password='password') self.assertEquals(logged_in, True) data = { 'email': '<EMAIL>' } response = self.client.post(reverse('household:maintain_members'), data=data, secure=True) self.assertEqual(response.status_code, 200) current = response.context['current'].filter(username='annie') self.assertEquals(len(current), 1) pending = response.context['pending'].filter(email='<EMAIL>') self.assertEquals(len(pending), 1) invite = HouseholdInvite.objects.get(email='<EMAIL>') self.assertEquals(str(invite), '<EMAIL>') def test_member_invite_form_email_already_exists_account(self): data = { 'email': '<EMAIL>' } form = InviteMemberForm(data=data) self.assertFalse(form.is_valid()) def test_member_invite_form_email_already_exists_invite(self): data = { 'email': '<EMAIL>' } form = InviteMemberForm(data=data) self.assertFalse(form.is_valid()) def test_member_invite_form_email_invalid(self): data = { 'email': 'nono.nono.com' } form = InviteMemberForm(data=data) self.assertFalse(form.is_valid()) def test_member_invite_form_email_valid(self): data = { 'email': '<EMAIL>' } form = InviteMemberForm(data=data) self.assertTrue(form.is_valid()) def test_ajax_delete_invite(self): self.client = Client() logged_in = self.client.login(username='harry', password='password') self.assertEquals(logged_in, True) # Invalid data tests data0 = { 'id': '$', # <-- 'user': 'harry' } response = self.client.post('/household/ajax/delete-invite/', data=data0, secure=True) result = json.loads(response.content) self.assertEquals(response.status_code, 200) self.assertEquals(result['status'], 'ERROR') data1 = { 'id': 99999999, 'user': '$rie9%!' # <-- } response = self.client.post('/household/ajax/delete-invite/', data=data1, secure=True) result = json.loads(response.content) self.assertEquals(response.status_code, 200) self.assertEquals(result['status'], 'ERROR') # Invalid id; does not exist data2 = { 'id': 99999999, 'user': 'harry' } response = self.client.post('/household/ajax/delete-invite/', data=data2, secure=True) result = json.loads(response.content) self.assertEquals(response.status_code, 200) self.assertEquals(result['status'], 'ERROR') # Validate user name provided is same as user name logged in data3 = { 'id': 99999999, 'user': 'greg' } response = self.client.post('/household/ajax/delete-invite/', data=data3, secure=True) result = json.loads(response.content) self.assertEquals(response.status_code, 200) self.assertEquals(result['status'], 'ERROR') invite = HouseholdInvite.objects.get(email='<EMAIL>') data = { 'id': invite.pk, 'user': 'harry' } response = self.client.post('/household/ajax/delete-invite/', data=data, secure=True) result = json.loads(response.content) self.assertEquals(response.status_code, 200) self.assertEquals(result['status'], 'OK') invite = HouseholdInvite.objects.filter(email='<EMAIL>') self.assertEquals(len(invite), 0) def test_ajax_change_member_status(self): self.client = Client() logged_in = self.client.login(username='harry', password='password') self.assertEquals(logged_in, True) # Invalid data tests data0 = { 'username': 'annie', 'user': '$', # <-- 'status': 'Deactivate' } response = self.client.post('/household/ajax/change-member-status/', data=data0, secure=True) result = json.loads(response.content) self.assertEquals(response.status_code, 200) self.assertEquals(result['status'], 'ERROR') data1 = { 'username': 'annie', 'user': 'harry', 'status': 'Off' # <-- } response = self.client.post('/household/ajax/change-member-status/', data=data1, secure=True) result = json.loads(response.content) self.assertEquals(response.status_code, 200) self.assertEquals(result['status'], 'ERROR') # User (username) does not exist data2 = { 'username': 'ann-marie', 'user': 'harry', 'status': 'Deactivate' } response = self.client.post('/household/ajax/change-member-status/', data=data2, secure=True) result = json.loads(response.content) self.assertEquals(response.status_code, 200) self.assertEquals(result['status'], 'ERROR') # User (username) is not member of given household (user) data3 = { 'username': 'annie', 'user': 'greg', 'status': 'Deactivate' } response = self.client.post('/household/ajax/change-member-status/', data=data3, secure=True) result = json.loads(response.content) self.assertEquals(response.status_code, 200) self.assertEquals(result['status'], 'ERROR') # Deactivate user (username) account data_a = { 'username': 'annie', 'user': 'harry', 'status': 'Deactivate' } response = self.client.post('/household/ajax/change-member-status/', data=data_a, secure=True) result = json.loads(response.content) self.assertEquals(response.status_code, 200) self.assertEquals(result['status'], 'OK') user = User.objects.get(username='annie') self.assertFalse(user.is_active) # Reactivate user (username) account data_b = { 'username': 'annie', 'user': 'harry', 'status': 'Activate' } response = self.client.post('/household/ajax/change-member-status/', data=data_b, secure=True) result = json.loads(response.content) self.assertEquals(response.status_code, 200) self.assertEquals(result['status'], 'OK') user = User.objects.get(username='annie') self.assertTrue(user.is_active) """ Test household_vehicles view, form, and ajax calls """ def test_household_vehicles_view(self): self.client = Client() logged_in = self.client.login(username='harry', password='password') self.assertEquals(logged_in, True) # Setup by getting objects for foreign keys vehicle_type = VehicleType.objects.get(type='Motorhome') vehicle_make = VehicleMake.objects.get(make='Tiffin') vehicle_model = VehicleModel.objects.get(model_name='Allegro Bus') purchase_type = VehiclePurchaseType.objects.get(purchase_type='Used-Private') satisfaction = Satisfaction.objects.get(satisfaction_index=5) vehicle_status = VehicleStatus.objects.get(vehicle_status='Owner') # Data to create vehicle record data = { 'form-TOTAL_FORMS': '2', 'form-INITIAL_FORMS': '0', 'form-MAX_NUM_FORMS': '', 'form-0-type': vehicle_type, 'form-0-make': vehicle_make, 'form-0-model_name': vehicle_model, 'form-0-model_year': 2006, 'form-0-fuel': 'Diesel', 'form-0-purchase_year': 2015, 'form-0-purchase_price': 50000.00, 'form-0-purchase_type': purchase_type, 'form-0-finance': 'Cash', 'form-0-satisfaction': satisfaction, 'form-0-status': vehicle_status, 'form-0-gone_year': 0 } response = self.client.post(reverse('household:maintain_vehicles'), data=data, secure=True) self.assertEqual(response.status_code, 200) def test_vehicle_form_empty(self): data = { 'type': 0, 'make': 0, 'model_name': 0, 'model_year': 0, 'fuel': 0, 'purchase_year': 0, 'purchase_price': 0, 'purchase_type': 0, 'finance': 0, 'satisfaction': 0, 'status': 0, 'gone_year': 0 } form = VehicleForm(data=data) self.assertFalse(form.is_valid()) def test_vehicle_form_bad_model_year(self): data = { 'type': 1, 'make': 1, 'model_name': 1, 'model_year': 1800, 'fuel': 1, 'purchase_year': 2016, 'purchase_price': 50.00, 'purchase_type': 1, 'finance': 1, 'satisfaction': 1, 'status': 1, 'gone_year': 0 } form = VehicleForm(data=data) self.assertFalse(form.is_valid()) data['model_year'] = 2080 form = VehicleForm(data=data) self.assertFalse(form.is_valid()) def test_vehicle_form_bad_purchase_year(self): data = { 'type': 1, 'make': 1, 'model_name': 1, 'model_year': 2016, 'fuel': 1, 'purchase_year': 1900, # <-- too far in the past 'purchase_price': 50.00, 'purchase_type': 1, 'finance': 1, 'satisfaction': 1, 'status': 1, 'gone_year': 0 } form = VehicleForm(data=data) self.assertFalse(form.is_valid()) data['purchase_year'] = 2080 # <-- too far into the future form = VehicleForm(data=data) self.assertFalse(form.is_valid()) def test_vehicle_form_bad_purchase_price(self): data = { 'type': 1, 'make': 1, 'model_name': 1, 'model_year': 2016, 'fuel': 1, 'purchase_year': 2016, 'purchase_price': .99, 'purchase_type': 1, 'finance': 1, 'satisfaction': 1, 'status': 1, 'gone_year': 0 } form = VehicleForm(data=data) self.assertFalse(form.is_valid()) def test_vehicle_form_gone_year_in_future(self): data = { 'type': 1, 'make': 1, 'model_name': 1, 'model_year': 2012, 'fuel': 1, 'purchase_year': 2014, 'purchase_price': 50000.00, 'purchase_type': 1, 'finance': 1, 'satisfaction': 1, 'status': 1, 'gone_year': 2080 } form = VehicleForm(data=data) self.assertFalse(form.is_valid()) def test_vehicle_form_valid(self): data = { 'type': 1, 'make': 1, 'model_name': 1, 'model_year': 2012, 'fuel': 1, 'purchase_year': 2014, 'purchase_price': 50000.00, 'purchase_type': 1, 'finance': 1, 'satisfaction': 1, 'status': 1, 'gone_year': 0 } form = VehicleForm(data=data) self.assertTrue(form.is_valid()) def test_ajax_makes_by_type(self): vehicle_type = VehicleType.objects.get(type='Motorhome') response = self.client.get('/household/ajax/makes-by-type/' + str(vehicle_type.pk) + '/', secure=True) result = json.loads(response.content) make = VehicleMake.objects.filter(filter=vehicle_type.filter)[0] self.assertTrue(str(make.pk) in result) def test_ajax_models_by_make(self): vehicle_make = VehicleMake.objects.get(make='Tiffin') response = self.client.get('/household/ajax/models-by-make/' + str(vehicle_make.pk) + '/', secure=True) result = json.loads(response.content) model = VehicleModel.objects.filter(make=vehicle_make)[0] self.assertTrue(str(model.pk) in result) def test_ajax_add_make(self): self.client = Client() logged_in = self.client.login(username='harry', password='password') self.assertEquals(logged_in, True) vehicle_type = VehicleType.objects.get(type='Motorhome') response = self.client.post('/household/ajax/add-make/' + str(vehicle_type.pk) + '/JayCo/', secure=True) result = json.loads(response.content) self.assertEquals(result['status'], 'OK') make = VehicleMake.objects.get(pk=result['key']) self.assertEquals(make.make, 'Jayco') def test_ajax_add_model(self): self.client = Client() logged_in = self.client.login(username='harry', password='password') self.assertEquals(logged_in, True) make = VehicleMake.objects.get(make='Tiffin') response = self.client.post('/household/ajax/add-model/' + str(make.pk) + '/Phaeton/', secure=True) result = json.loads(response.content) self.assertEquals(result['status'], 'OK') vehicle_model = VehicleModel.objects.get(pk=result['key']) self.assertEquals(vehicle_model.model_name, 'Phaeton')
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 5215, 12865, 13, 5215, 4390, 13, 13, 3166, 9557, 29889, 3221, 29889, 11739, 29879, 1053, 4669, 25125, 3664, 1252, 391, 13, 13, 3166, 9557, 29889, 1688, 1053, 12477, 13, 3166, 9557, 29889, 1688, 1053, 4321, 8259, 13, 3166, 9557, 29889, 26045, 1053, 11837, 13, 13, 3166, 9557, 29889, 21570, 29889, 5150, 29889, 9794, 1053, 4911, 29892, 6431, 13, 3166, 3633, 29889, 9794, 1053, 16535, 13, 3166, 7136, 29889, 9794, 1053, 7038, 657, 3195, 29892, 390, 335, 1542, 29892, 4803, 1542, 29892, 512, 2763, 1542, 29892, 8980, 29882, 2512, 9984, 29892, 8980, 29882, 2512, 3195, 29892, 8980, 29882, 2512, 1542, 29892, 320, 13, 1678, 8980, 29882, 2512, 29925, 27574, 1542, 29892, 8980, 29882, 2512, 5709, 29892, 12178, 4492, 2467, 29892, 7038, 657, 4782, 29892, 7038, 657, 10900, 13, 3166, 7252, 29889, 9794, 1053, 1619, 29933, 566, 657, 4782, 29892, 1619, 29933, 566, 657, 10900, 13, 3166, 869, 9794, 1053, 390, 29963, 29950, 1709, 8948, 29892, 19495, 29892, 5619, 8948, 29924, 13415, 29892, 5619, 8948, 12165, 568, 29892, 8980, 29882, 2512, 13, 13, 3166, 869, 9514, 1053, 1619, 3401, 2500, 29892, 5619, 8948, 13909, 2500, 29892, 15518, 568, 13404, 2500, 29892, 8980, 29882, 2512, 2500, 13, 13, 13, 29937, 1152, 1286, 29892, 599, 1243, 4251, 363, 22329, 526, 3342, 297, 697, 770, 13, 1990, 5619, 8948, 3057, 29898, 3057, 8259, 1125, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 731, 3373, 2385, 29898, 25932, 1125, 13, 4706, 9995, 13, 4706, 3789, 701, 2847, 1243, 848, 13, 4706, 584, 2457, 29901, 13, 4706, 9995, 13, 13, 4706, 9995, 13, 4706, 6204, 7136, 1904, 3618, 4312, 363, 22329, 3618, 13, 4706, 9995, 13, 4706, 1018, 29901, 13, 9651, 23562, 29918, 4299, 353, 7038, 657, 3195, 29889, 12650, 29889, 657, 29898, 15841, 657, 29918, 4299, 2433, 29934, 29963, 29950, 1709, 8948, 1495, 13, 4706, 5174, 4669, 25125, 3664, 1252, 391, 29901, 13, 9651, 23562, 29918, 4299, 353, 7038, 657, 3195, 580, 13, 9651, 23562, 29918, 4299, 29889, 15841, 657, 29918, 4299, 353, 525, 29934, 29963, 29950, 1709, 8948, 29915, 13, 9651, 23562, 29918, 4299, 29889, 15841, 657, 29918, 4299, 29918, 8216, 353, 525, 29933, 566, 657, 1904, 363, 390, 29963, 7881, 29915, 13, 9651, 23562, 29918, 4299, 29889, 7620, 580, 13, 13, 4706, 12912, 353, 390, 335, 1542, 580, 13, 4706, 12912, 29889, 8966, 29918, 1853, 353, 525, 29924, 327, 272, 5184, 29915, 13, 4706, 12912, 29889, 8966, 29918, 1853, 29918, 8216, 353, 525, 29924, 327, 272, 5184, 29915, 13, 4706, 12912, 29889, 7620, 580, 13, 13, 4706, 671, 353, 4803, 1542, 580, 13, 4706, 671, 29889, 1509, 29918, 1853, 353, 525, 13658, 29899, 2230, 29915, 13, 4706, 671, 29889, 1509, 29918, 1853, 29918, 8216, 353, 525, 13658, 29899, 2230, 29915, 13, 4706, 671, 29889, 7620, 580, 13, 13, 4706, 17869, 353, 512, 2763, 1542, 580, 13, 4706, 17869, 29889, 262, 2763, 29918, 1853, 353, 525, 24313, 29899, 3451, 2376, 287, 29915, 13, 4706, 17869, 29889, 262, 2763, 29918, 1853, 29918, 8216, 353, 525, 24313, 29899, 3451, 2376, 287, 29915, 13, 4706, 17869, 29889, 7620, 580, 13, 13, 4706, 1207, 353, 8980, 29882, 2512, 9984, 580, 13, 4706, 1207, 29889, 4572, 353, 525, 15291, 29915, 13, 4706, 1207, 29889, 5675, 353, 525, 29911, 2593, 262, 29915, 13, 4706, 1207, 29889, 7620, 580, 13, 13, 4706, 1904, 353, 8980, 29882, 2512, 3195, 580, 13, 4706, 1904, 29889, 5675, 353, 1207, 13, 4706, 1904, 29889, 4299, 29918, 978, 353, 525, 2499, 1397, 307, 8406, 29915, 13, 4706, 1904, 29889, 7620, 580, 13, 13, 4706, 325, 29918, 1853, 353, 8980, 29882, 2512, 1542, 580, 13, 4706, 325, 29918, 1853, 29889, 4572, 353, 525, 15291, 29915, 13, 4706, 325, 29918, 1853, 29889, 1853, 353, 525, 29924, 327, 272, 5184, 29915, 13, 4706, 325, 29918, 1853, 29889, 1853, 29918, 8216, 353, 525, 10858, 390, 29963, 338, 263, 10992, 5184, 6169, 13, 4706, 325, 29918, 1853, 29889, 7620, 580, 13, 13, 4706, 20590, 353, 8980, 29882, 2512, 29925, 27574, 1542, 580, 13, 4706, 20590, 29889, 29886, 27574, 29918, 1853, 353, 525, 29965, 8485, 29899, 25207, 29915, 13, 4706, 20590, 29889, 29886, 27574, 29918, 8216, 353, 525, 29925, 2458, 1463, 4153, 515, 385, 5375, 6169, 13, 4706, 20590, 29889, 7620, 580, 13, 13, 4706, 4660, 353, 8980, 29882, 2512, 5709, 580, 13, 4706, 4660, 29889, 345, 29882, 2512, 29918, 4882, 353, 525, 28213, 29915, 13, 4706, 4660, 29889, 345, 29882, 2512, 29918, 4882, 29918, 8216, 353, 525, 855, 453, 15205, 491, 592, 6169, 13, 4706, 4660, 29889, 7620, 580, 13, 13, 4706, 26470, 353, 12178, 4492, 2467, 580, 13, 4706, 26470, 29889, 29879, 27685, 2467, 29918, 2248, 353, 29871, 29945, 13, 4706, 26470, 29889, 29879, 27685, 2467, 29918, 8216, 353, 525, 29931, 994, 372, 20714, 13, 4706, 26470, 29889, 29879, 27685, 2467, 29918, 16553, 353, 525, 29956, 483, 11630, 20590, 1449, 6169, 13, 4706, 26470, 29889, 7620, 580, 13, 13, 4706, 9995, 13, 4706, 6204, 4817, 2318, 363, 24179, 11239, 13, 4706, 9995, 13, 4706, 2318, 353, 6431, 580, 13, 4706, 2318, 29889, 978, 353, 525, 23343, 29918, 6341, 414, 29915, 13, 4706, 2318, 29889, 7620, 580, 13, 13, 4706, 9995, 13, 4706, 6204, 4472, 23562, 3618, 13, 4706, 9995, 13, 4706, 23562, 29918, 2972, 353, 7038, 657, 4782, 580, 13, 4706, 23562, 29918, 2972, 29889, 15841, 657, 29918, 4299, 353, 23562, 29918, 4299, 13, 4706, 23562, 29918, 2972, 29889, 2972, 29918, 978, 353, 525, 3868, 4298, 10057, 29915, 13, 4706, 23562, 29918, 2972, 29889, 2972, 29918, 8216, 353, 525, 9544, 11259, 6942, 411, 7952, 292, 1532, 29915, 13, 4706, 23562, 29918, 2972, 29889, 2972, 29918, 1761, 29918, 2098, 353, 29871, 29896, 13, 4706, 23562, 29918, 2972, 29889, 2972, 29918, 546, 655, 29918, 1989, 353, 525, 546, 655, 29899, 1989, 29899, 1767, 29915, 13, 4706, 23562, 29918, 2972, 29889, 7620, 580, 13, 13, 4706, 7663, 353, 7038, 657, 10900, 580, 13, 4706, 7663, 29889, 15841, 657, 29918, 2972, 353, 23562, 29918, 2972, 13, 4706, 7663, 29889, 7320, 353, 525, 797, 7610, 749, 29915, 13, 4706, 7663, 29889, 7320, 29918, 546, 655, 29918, 1989, 353, 525, 546, 655, 29899, 1989, 29899, 1767, 29915, 13, 4706, 7663, 29889, 7620, 580, 13, 13, 4706, 9995, 13, 4706, 6204, 4160, 322, 6942, 3618, 363, 12569, 3377, 1243, 4251, 29889, 13, 4706, 9995, 13, 4706, 396, 29871, 29896, 29889, 3387, 2825, 3633, 29892, 756, 451, 6230, 22329, 470, 4944, 7333, 4902, 13, 4706, 4911, 29889, 12650, 29889, 3258, 29918, 1792, 877, 744, 29916, 742, 4876, 2433, 29966, 26862, 6227, 29958, 742, 4800, 2433, 5630, 1495, 13, 13, 4706, 396, 29871, 29906, 29889, 1570, 3633, 29892, 871, 756, 7333, 4902, 13, 4706, 1404, 353, 4911, 29889, 12650, 29889, 3258, 29918, 1792, 877, 1646, 3801, 742, 4876, 2433, 29966, 26862, 6227, 29958, 742, 4800, 2433, 5630, 1495, 13, 4706, 3633, 353, 16535, 29889, 12650, 29889, 657, 29898, 1792, 29922, 1792, 29897, 13, 13, 4706, 4509, 353, 19495, 580, 13, 4706, 4509, 29889, 10149, 353, 3633, 13, 4706, 4509, 29889, 6710, 29918, 4537, 353, 525, 29946, 29896, 29945, 29899, 29946, 29896, 29941, 29899, 29946, 29941, 29929, 29941, 29915, 13, 4706, 4509, 29889, 20348, 353, 5852, 13, 4706, 4509, 29889, 15753, 15670, 353, 5852, 13, 4706, 4509, 29889, 7620, 580, 13, 13, 4706, 1404, 29889, 4102, 29918, 978, 353, 525, 4297, 3801, 29915, 13, 4706, 1404, 29889, 4230, 29918, 978, 353, 525, 22031, 672, 14592, 29915, 13, 4706, 1404, 29889, 7620, 580, 13, 13, 4706, 396, 29871, 29941, 29889, 1570, 3633, 29892, 756, 4944, 7333, 4902, 322, 22329, 2472, 29892, 541, 694, 24413, 13, 4706, 1404, 353, 4911, 29889, 12650, 29889, 3258, 29918, 1792, 877, 305, 2707, 742, 4876, 2433, 29966, 26862, 6227, 29958, 742, 4800, 2433, 5630, 1495, 13, 4706, 3633, 353, 16535, 29889, 12650, 29889, 657, 29898, 1792, 29922, 1792, 29897, 13, 13, 4706, 4509, 353, 19495, 580, 13, 4706, 4509, 29889, 10149, 353, 3633, 13, 4706, 4509, 29889, 6710, 29918, 4537, 353, 525, 29946, 29896, 29945, 29899, 29946, 29896, 29941, 29899, 29946, 29946, 29900, 29896, 29915, 13, 4706, 4509, 29889, 20348, 353, 5852, 13, 4706, 4509, 29889, 15753, 15670, 353, 5852, 13, 4706, 4509, 29889, 7620, 580, 13, 13, 4706, 1404, 29889, 4102, 29918, 978, 353, 525, 5914, 793, 29915, 13, 4706, 1404, 29889, 4230, 29918, 978, 353, 525, 29907, 4254, 29915, 13, 4706, 1404, 29889, 7620, 580, 13, 13, 4706, 22329, 353, 390, 29963, 29950, 1709, 8948, 580, 13, 4706, 22329, 29889, 28109, 29918, 262, 29918, 8697, 8948, 353, 29871, 29906, 13, 4706, 22329, 29889, 1025, 342, 29918, 29890, 7515, 6360, 353, 29871, 29896, 29929, 29945, 29900, 13, 4706, 22329, 29889, 15841, 657, 29918, 4299, 353, 23562, 29918, 4299, 13, 4706, 22329, 29889, 3670, 29918, 262, 29918, 1285, 2666, 353, 5852, 13, 4706, 22329, 29889, 3274, 333, 29918, 20678, 353, 12865, 29889, 12673, 29889, 3707, 2141, 1256, 580, 718, 12865, 29889, 9346, 287, 2554, 29898, 16700, 29922, 29896, 29900, 29900, 29900, 29897, 13, 4706, 22329, 29889, 1491, 22371, 29918, 4882, 353, 525, 29933, 1187, 29915, 13, 4706, 22329, 29889, 2962, 29918, 6360, 353, 29871, 29906, 29900, 29900, 29900, 13, 4706, 22329, 29889, 8966, 29918, 1853, 353, 12912, 13, 4706, 22329, 29889, 1509, 29918, 1853, 353, 671, 13, 4706, 22329, 29889, 262, 2763, 29918, 1853, 353, 17869, 13, 4706, 22329, 29889, 29886, 1691, 29918, 26169, 353, 29871, 29896, 13, 4706, 22329, 29889, 7620, 580, 13, 13, 4706, 22329, 29918, 14242, 353, 5619, 8948, 29924, 13415, 580, 13, 4706, 22329, 29918, 14242, 29889, 14242, 29918, 10149, 353, 3633, 13, 4706, 22329, 29918, 14242, 29889, 8697, 8948, 29918, 29885, 1590, 10475, 353, 22329, 13, 4706, 22329, 29918, 14242, 29889, 7620, 580, 13, 13, 4706, 396, 29871, 29946, 29889, 12027, 2859, 3633, 13, 4706, 1404, 353, 4911, 29889, 12650, 29889, 3258, 29918, 1792, 877, 29881, 1351, 742, 4876, 2433, 29966, 26862, 6227, 29958, 742, 4800, 2433, 5630, 1495, 13, 4706, 3633, 353, 16535, 29889, 12650, 29889, 657, 29898, 1792, 29922, 1792, 29897, 13, 13, 4706, 4509, 353, 19495, 580, 13, 4706, 4509, 29889, 10149, 353, 3633, 13, 4706, 4509, 29889, 6710, 29918, 4537, 353, 525, 29946, 29896, 29945, 29899, 29946, 29896, 29941, 29899, 29946, 29946, 29900, 29906, 29915, 13, 4706, 4509, 29889, 20348, 353, 5852, 13, 4706, 4509, 29889, 15753, 15670, 353, 5852, 13, 4706, 4509, 29889, 7620, 580, 13, 13, 4706, 1404, 29889, 4102, 29918, 978, 353, 525, 19504, 29915, 13, 4706, 1404, 29889, 4230, 29918, 978, 353, 525, 29928, 485, 275, 29915, 13, 4706, 1404, 29889, 7620, 580, 13, 13, 4706, 22329, 353, 390, 29963, 29950, 1709, 8948, 580, 13, 4706, 22329, 29889, 28109, 29918, 262, 29918, 8697, 8948, 353, 29871, 29896, 13, 4706, 22329, 29889, 1025, 342, 29918, 29890, 7515, 6360, 353, 29871, 29896, 29929, 29945, 29896, 13, 4706, 22329, 29889, 15841, 657, 29918, 4299, 353, 23562, 29918, 4299, 13, 4706, 22329, 29889, 3670, 29918, 262, 29918, 1285, 2666, 353, 5852, 13, 4706, 22329, 29889, 3274, 333, 29918, 20678, 353, 12865, 29889, 12673, 29889, 3707, 2141, 1256, 580, 448, 12865, 29889, 9346, 287, 2554, 29898, 16700, 29922, 29896, 29897, 13, 4706, 22329, 29889, 1491, 22371, 29918, 4882, 353, 525, 29933, 1187, 29915, 13, 4706, 22329, 29889, 2962, 29918, 6360, 353, 29871, 29896, 29929, 29947, 29945, 13, 4706, 22329, 29889, 8966, 29918, 1853, 353, 12912, 13, 4706, 22329, 29889, 1509, 29918, 1853, 353, 671, 13, 4706, 22329, 29889, 262, 2763, 29918, 1853, 353, 17869, 13, 4706, 22329, 29889, 29886, 1691, 29918, 26169, 353, 29871, 29900, 13, 4706, 22329, 29889, 7620, 580, 13, 13, 4706, 22329, 29918, 14242, 353, 5619, 8948, 29924, 13415, 580, 13, 4706, 22329, 29918, 14242, 29889, 14242, 29918, 10149, 353, 3633, 13, 4706, 22329, 29918, 14242, 29889, 8697, 8948, 29918, 29885, 1590, 10475, 353, 22329, 13, 4706, 22329, 29918, 14242, 29889, 7620, 580, 13, 13, 4706, 9995, 13, 4706, 6204, 4160, 322, 6942, 3618, 363, 590, 5235, 1243, 4251, 29889, 13, 4706, 9995, 13, 4706, 4911, 29889, 12650, 29889, 3258, 29918, 1792, 877, 261, 293, 742, 4876, 2433, 29966, 26862, 6227, 29958, 742, 4800, 2433, 5630, 1495, 13, 13, 4706, 9995, 13, 4706, 6204, 4160, 322, 6942, 3618, 363, 22329, 1243, 4251, 29889, 13, 4706, 9995, 13, 4706, 4911, 29889, 12650, 29889, 3258, 29918, 1792, 877, 18447, 742, 4876, 2433, 29966, 26862, 6227, 29958, 742, 4800, 2433, 5630, 1495, 13, 13, 4706, 9995, 13, 4706, 6204, 4160, 322, 6942, 3618, 363, 22329, 4509, 1243, 4251, 29889, 13, 4706, 9995, 13, 4706, 396, 12027, 2859, 28512, 13, 4706, 1404, 353, 4911, 29889, 12650, 29889, 3258, 29918, 1792, 877, 7642, 742, 4876, 2433, 29966, 26862, 6227, 29958, 742, 4800, 2433, 5630, 1495, 13, 4706, 3633, 353, 16535, 29889, 12650, 29889, 657, 29898, 1792, 29922, 1792, 29897, 13, 13, 4706, 4509, 353, 19495, 580, 13, 4706, 4509, 29889, 10149, 353, 3633, 13, 4706, 4509, 29889, 6710, 29918, 4537, 353, 525, 29946, 29896, 29945, 29899, 29946, 29896, 29941, 29899, 29946, 29946, 29896, 29900, 29915, 13, 4706, 4509, 29889, 20348, 353, 5852, 13, 4706, 4509, 29889, 15753, 15670, 353, 5852, 13, 4706, 4509, 29889, 7620, 580, 13, 13, 4706, 1404, 29889, 4102, 29918, 978, 353, 525, 29954, 1727, 29915, 13, 4706, 1404, 29889, 4230, 29918, 978, 353, 525, 29954, 538, 4983, 29915, 13, 4706, 1404, 29889, 7620, 580, 13, 13, 4706, 22329, 353, 390, 29963, 29950, 1709, 8948, 580, 13, 4706, 22329, 29889, 28109, 29918, 262, 29918, 8697, 8948, 353, 29871, 29906, 13, 4706, 22329, 29889, 1025, 342, 29918, 29890, 7515, 6360, 353, 29871, 29896, 29929, 29945, 29946, 13, 4706, 22329, 29889, 15841, 657, 29918, 4299, 353, 23562, 29918, 4299, 13, 4706, 22329, 29889, 3670, 29918, 262, 29918, 1285, 2666, 353, 5852, 13, 4706, 22329, 29889, 3274, 333, 29918, 20678, 353, 12865, 29889, 12673, 29889, 3707, 2141, 1256, 580, 448, 12865, 29889, 9346, 287, 2554, 29898, 16700, 29922, 29896, 29897, 13, 4706, 22329, 29889, 1491, 22371, 29918, 4882, 353, 525, 29933, 1187, 29915, 13, 4706, 22329, 29889, 2962, 29918, 6360, 353, 29871, 29896, 29929, 29947, 29906, 13, 4706, 22329, 29889, 8966, 29918, 1853, 353, 12912, 13, 4706, 22329, 29889, 1509, 29918, 1853, 353, 671, 13, 4706, 22329, 29889, 262, 2763, 29918, 1853, 353, 17869, 13, 4706, 22329, 29889, 29886, 1691, 29918, 26169, 353, 29871, 29896, 13, 4706, 22329, 29889, 7620, 580, 13, 13, 4706, 22329, 29918, 14242, 353, 5619, 8948, 29924, 13415, 580, 13, 4706, 22329, 29918, 14242, 29889, 14242, 29918, 10149, 353, 3633, 13, 4706, 22329, 29918, 14242, 29889, 8697, 8948, 29918, 29885, 1590, 10475, 353, 22329, 13, 4706, 22329, 29918, 14242, 29889, 7620, 580, 13, 13, 4706, 396, 9626, 28512, 13, 4706, 1404, 353, 4911, 29889, 12650, 29889, 3258, 29918, 1792, 877, 8222, 719, 742, 4876, 2433, 29966, 26862, 6227, 29958, 742, 4800, 2433, 5630, 1495, 13, 4706, 3633, 353, 16535, 29889, 12650, 29889, 657, 29898, 1792, 29922, 1792, 29897, 13, 13, 4706, 4509, 353, 19495, 580, 13, 4706, 4509, 29889, 10149, 353, 3633, 13, 4706, 4509, 29889, 6710, 29918, 4537, 353, 525, 29946, 29896, 29945, 29899, 29946, 29896, 29941, 29899, 29946, 29946, 29896, 29896, 29915, 13, 4706, 4509, 29889, 20348, 353, 5852, 13, 4706, 4509, 29889, 15753, 15670, 353, 5852, 13, 4706, 4509, 29889, 7620, 580, 13, 13, 4706, 1404, 29889, 4102, 29918, 978, 353, 525, 21972, 719, 29915, 13, 4706, 1404, 29889, 4230, 29918, 978, 353, 525, 29950, 6129, 267, 29915, 13, 4706, 1404, 29889, 7620, 580, 13, 13, 4706, 22329, 353, 390, 29963, 29950, 1709, 8948, 580, 13, 4706, 22329, 29889, 28109, 29918, 262, 29918, 8697, 8948, 353, 29871, 29906, 13, 4706, 22329, 29889, 1025, 342, 29918, 29890, 7515, 6360, 353, 29871, 29896, 29929, 29945, 29896, 13, 4706, 22329, 29889, 15841, 657, 29918, 4299, 353, 23562, 29918, 4299, 13, 4706, 22329, 29889, 3670, 29918, 262, 29918, 1285, 2666, 353, 5852, 13, 4706, 22329, 29889, 3274, 333, 29918, 20678, 353, 12865, 29889, 12673, 29889, 3707, 2141, 1256, 580, 718, 12865, 29889, 9346, 287, 2554, 29898, 16700, 29922, 29896, 29900, 29900, 29900, 29897, 13, 4706, 22329, 29889, 1491, 22371, 29918, 4882, 353, 525, 29933, 1187, 29915, 13, 4706, 22329, 29889, 2962, 29918, 6360, 353, 29871, 29896, 29929, 29947, 29900, 13, 4706, 22329, 29889, 8966, 29918, 1853, 353, 12912, 13, 4706, 22329, 29889, 1509, 29918, 1853, 353, 671, 13, 4706, 22329, 29889, 262, 2763, 29918, 1853, 353, 17869, 13, 4706, 22329, 29889, 29886, 1691, 29918, 26169, 353, 29871, 29906, 13, 4706, 22329, 29889, 7620, 580, 13, 13, 4706, 22329, 29918, 14242, 353, 5619, 8948, 29924, 13415, 580, 13, 4706, 22329, 29918, 14242, 29889, 14242, 29918, 10149, 353, 3633, 13, 4706, 22329, 29918, 14242, 29889, 8697, 8948, 29918, 29885, 1590, 10475, 353, 22329, 13, 4706, 22329, 29918, 14242, 29889, 7620, 580, 13, 13, 4706, 396, 19495, 310, 4023, 719, 29915, 29879, 22329, 13, 4706, 1404, 353, 4911, 29889, 12650, 29889, 3258, 29918, 1792, 877, 812, 347, 742, 4876, 2433, 29966, 26862, 6227, 29958, 742, 4800, 2433, 5630, 1495, 13, 4706, 3633, 353, 16535, 29889, 12650, 29889, 657, 29898, 1792, 29922, 1792, 29897, 13, 13, 4706, 4509, 353, 19495, 580, 13, 4706, 4509, 29889, 10149, 353, 3633, 13, 4706, 4509, 29889, 6710, 29918, 4537, 353, 525, 29946, 29896, 29945, 29899, 29946, 29896, 29941, 29899, 29945, 29945, 29896, 29896, 29915, 13, 4706, 4509, 29889, 20348, 353, 7700, 13, 4706, 4509, 29889, 15753, 15670, 353, 5852, 13, 4706, 4509, 29889, 7620, 580, 13, 13, 4706, 1404, 29889, 4102, 29918, 978, 353, 525, 2744, 2786, 29915, 13, 4706, 1404, 29889, 4230, 29918, 978, 353, 525, 1433, 484, 585, 29899, 29950, 6129, 267, 29915, 13, 4706, 1404, 29889, 7620, 580, 13, 13, 4706, 22329, 29918, 14242, 353, 5619, 8948, 29924, 13415, 580, 13, 4706, 22329, 29918, 14242, 29889, 14242, 29918, 10149, 353, 3633, 13, 4706, 22329, 29918, 14242, 29889, 8697, 8948, 29918, 29885, 1590, 10475, 353, 22329, 13, 4706, 22329, 29918, 14242, 29889, 7620, 580, 13, 13, 4706, 396, 16968, 2437, 3246, 363, 6987, 13, 4706, 2437, 568, 353, 5619, 8948, 12165, 568, 580, 13, 4706, 2437, 568, 29889, 11569, 568, 29918, 8697, 8948, 353, 22329, 13, 4706, 2437, 568, 29889, 5269, 353, 12801, 26862, 6227, 16299, 13, 4706, 2437, 568, 29889, 8926, 29918, 401, 353, 525, 29896, 29906, 29941, 29946, 29945, 29953, 29955, 29915, 13, 4706, 2437, 568, 29889, 11569, 568, 29918, 1256, 353, 12865, 29889, 12673, 29889, 3707, 2141, 1256, 580, 13, 4706, 2437, 568, 29889, 7620, 580, 13, 13, 4706, 2437, 568, 353, 5619, 8948, 12165, 568, 580, 13, 4706, 2437, 568, 29889, 11569, 568, 29918, 8697, 8948, 353, 22329, 13, 4706, 2437, 568, 29889, 5269, 353, 12801, 26862, 6227, 16299, 13, 4706, 2437, 568, 29889, 8926, 29918, 401, 353, 525, 29896, 29906, 29941, 29946, 29945, 29953, 29955, 29915, 13, 4706, 2437, 568, 29889, 11569, 568, 29918, 1256, 353, 12865, 29889, 12673, 29889, 3707, 2141, 1256, 580, 13, 4706, 2437, 568, 29889, 7620, 580, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 734, 279, 6767, 2385, 29898, 25932, 1125, 13, 4706, 1209, 13, 13, 1678, 9995, 13, 1678, 4321, 278, 4733, 13, 1678, 9995, 13, 1678, 822, 1243, 29918, 9794, 29898, 1311, 1125, 13, 13, 4706, 23562, 29918, 4299, 353, 7038, 657, 3195, 29889, 12650, 29889, 657, 29898, 15841, 657, 29918, 4299, 2433, 29934, 29963, 29950, 1709, 8948, 1495, 13, 4706, 1583, 29889, 9294, 14776, 29898, 710, 29898, 15841, 657, 29918, 4299, 511, 525, 29934, 29963, 29950, 1709, 8948, 1495, 13, 13, 4706, 12912, 353, 390, 335, 1542, 29889, 12650, 29889, 657, 29898, 8966, 29918, 1853, 2433, 29924, 327, 272, 5184, 1495, 13, 4706, 1583, 29889, 9294, 14776, 29898, 710, 29898, 8966, 511, 525, 29924, 327, 272, 5184, 1495, 13, 13, 4706, 671, 353, 4803, 1542, 29889, 12650, 29889, 657, 29898, 1509, 29918, 1853, 2433, 13658, 29899, 2230, 1495, 13, 4706, 1583, 29889, 9294, 14776, 29898, 710, 29898, 1509, 511, 525, 13658, 29899, 2230, 1495, 13, 13, 4706, 17869, 353, 512, 2763, 1542, 29889, 12650, 29889, 657, 29898, 262, 2763, 29918, 1853, 2433, 24313, 29899, 3451, 2376, 287, 1495, 13, 4706, 1583, 29889, 9294, 14776, 29898, 710, 29898, 262, 2763, 511, 525, 24313, 29899, 3451, 2376, 287, 1495, 13, 13, 4706, 1207, 353, 8980, 29882, 2512, 9984, 29889, 12650, 29889, 657, 29898, 5675, 2433, 29911, 2593, 262, 1495, 13, 4706, 1583, 29889, 9294, 14776, 29898, 710, 29898, 5675, 511, 525, 29911, 2593, 262, 1495, 13, 13, 4706, 325, 29918, 4299, 353, 8980, 29882, 2512, 3195, 29889, 12650, 29889, 657, 29898, 4299, 29918, 978, 2433, 2499, 1397, 307, 8406, 1495, 13, 4706, 1583, 29889, 9294, 14776, 29898, 710, 29898, 29894, 29918, 4299, 511, 525, 2499, 1397, 307, 8406, 1495, 13, 13, 4706, 325, 29918, 1853, 353, 8980, 29882, 2512, 1542, 29889, 12650, 29889, 657, 29898, 1853, 2433, 29924, 327, 272, 5184, 1495, 13, 4706, 1583, 29889, 9294, 14776, 29898, 710, 29898, 29894, 29918, 1853, 511, 525, 29924, 327, 272, 5184, 1495, 13, 13, 4706, 20590, 353, 8980, 29882, 2512, 29925, 27574, 1542, 29889, 12650, 29889, 657, 29898, 29886, 27574, 29918, 1853, 2433, 29965, 8485, 29899, 25207, 1495, 13, 4706, 1583, 29889, 9294, 14776, 29898, 710, 29898, 29886, 27574, 511, 525, 29965, 8485, 29899, 25207, 1495, 13, 13, 4706, 4660, 353, 8980, 29882, 2512, 5709, 29889, 12650, 29889, 657, 29898, 345, 29882, 2512, 29918, 4882, 2433, 28213, 1495, 13, 4706, 1583, 29889, 9294, 14776, 29898, 710, 29898, 4882, 511, 525, 28213, 1495, 13, 13, 4706, 26470, 353, 12178, 4492, 2467, 29889, 12650, 29889, 657, 29898, 29879, 27685, 2467, 29918, 2248, 29922, 29945, 29897, 13, 4706, 1583, 29889, 9294, 14776, 29898, 710, 29898, 29879, 27685, 2467, 511, 525, 29931, 994, 372, 29991, 1495, 13, 13, 4706, 4509, 353, 19495, 29889, 12650, 29889, 657, 29898, 6710, 29918, 4537, 2433, 29946, 29896, 29945, 29899, 29946, 29896, 29941, 29899, 29946, 29941, 29929, 29941, 1495, 13, 4706, 1583, 29889, 9294, 14776, 29898, 710, 29898, 14242, 511, 525, 29946, 29896, 29945, 29899, 29946, 29896, 29941, 29899, 29946, 29941, 29929, 29941, 1495, 13, 13, 4706, 22329, 353, 390, 29963, 29950, 1709, 8948, 29889, 12650, 29889, 657, 29898, 20571, 29922, 29896, 29897, 13, 4706, 1583, 29889, 9294, 14776, 29898, 710, 29898, 8697, 8948, 511, 525, 29896, 1495, 13, 13, 4706, 22329, 29918, 14242, 353, 5619, 8948, 29924, 13415, 29889, 12650, 29889, 497, 580, 29961, 29900, 29962, 13, 4706, 1583, 29889, 9294, 14776, 29898, 710, 29898, 8697, 8948, 29918, 14242, 511, 525, 13404, 1820, 29901, 6571, 29871, 5619, 8948, 1820, 29901, 6571, 4286, 4830, 29898, 13, 9651, 22329, 29918, 14242, 29889, 14242, 29918, 10149, 29892, 13, 9651, 22329, 29918, 14242, 29889, 8697, 8948, 29918, 29885, 1590, 10475, 876, 13, 13, 4706, 23562, 29918, 2972, 353, 7038, 657, 4782, 29889, 12650, 29889, 657, 29898, 2972, 29918, 978, 2433, 3868, 4298, 10057, 1495, 13, 4706, 1583, 29889, 9294, 14776, 29898, 710, 29898, 15841, 657, 29918, 2972, 511, 525, 3868, 4298, 10057, 1495, 13, 13, 4706, 7663, 353, 7038, 657, 10900, 29889, 12650, 29889, 657, 29898, 7320, 2433, 797, 7610, 749, 1495, 13, 4706, 1583, 29889, 9294, 14776, 29898, 710, 29898, 7320, 511, 525, 797, 7610, 749, 1495, 13, 13, 4706, 2437, 568, 353, 5619, 8948, 12165, 568, 29889, 12650, 29889, 657, 29898, 5269, 2433, 29966, 26862, 6227, 29958, 1495, 13, 4706, 1583, 29889, 9294, 14776, 29898, 710, 29898, 11569, 568, 511, 12801, 26862, 6227, 29958, 1495, 13, 13, 1678, 9995, 13, 1678, 4321, 5164, 5922, 322, 5855, 363, 278, 12569, 3377, 1776, 13, 1678, 9995, 13, 1678, 822, 1243, 29918, 14592, 3377, 29918, 1482, 29918, 1792, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 1570, 1404, 29892, 22602, 29915, 29873, 6230, 7333, 2472, 470, 22329, 3447, 13, 4706, 584, 2457, 29901, 13, 4706, 9995, 13, 4706, 1583, 29889, 4645, 353, 12477, 580, 13, 4706, 13817, 29918, 262, 353, 1583, 29889, 4645, 29889, 7507, 29898, 6786, 2433, 744, 29916, 742, 4800, 2433, 5630, 1495, 13, 4706, 1583, 29889, 9294, 14776, 29898, 1188, 3192, 29918, 262, 29892, 5852, 29897, 13, 13, 4706, 2933, 353, 1583, 29889, 4645, 29889, 657, 29898, 24244, 877, 8697, 8948, 29901, 8697, 8948, 29918, 14592, 3377, 5477, 11592, 29922, 5574, 29897, 13, 4706, 15837, 353, 2933, 29889, 4703, 1839, 7727, 2033, 13, 13, 4706, 396, 917, 23941, 817, 363, 7333, 5235, 322, 22329, 2472, 881, 1863, 13, 4706, 1583, 29889, 9294, 14776, 29898, 7727, 1839, 26180, 29918, 1357, 3888, 7464, 525, 12148, 2125, 263, 3256, 304, 3867, 596, 1024, 322, 263, 9008, 1353, 29889, 1495, 13, 4706, 1583, 29889, 9294, 14776, 29898, 7727, 1839, 26180, 29918, 8697, 8948, 7464, 13, 462, 3986, 525, 1762, 5039, 403, 596, 3889, 14260, 29892, 3113, 6230, 596, 22329, 2472, 29889, 1495, 13, 13, 4706, 396, 1126, 916, 8282, 881, 451, 1863, 2745, 1156, 1906, 2712, 526, 4944, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 29898, 2558, 2392, 1125, 13, 9651, 1243, 353, 15837, 1839, 26180, 29918, 345, 29882, 4027, 2033, 13, 9651, 1243, 353, 15837, 1839, 9021, 29918, 3626, 284, 2033, 13, 13, 1678, 822, 1243, 29918, 14592, 3377, 29918, 1482, 29918, 1792, 29918, 10532, 284, 29918, 3888, 29918, 16123, 2618, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 1570, 1404, 29892, 756, 6230, 7333, 2472, 541, 451, 22329, 3447, 13, 4706, 584, 2457, 29901, 13, 4706, 9995, 13, 4706, 1583, 29889, 4645, 353, 12477, 580, 13, 4706, 13817, 29918, 262, 353, 1583, 29889, 4645, 29889, 7507, 29898, 6786, 2433, 1646, 3801, 742, 4800, 2433, 5630, 1495, 13, 4706, 1583, 29889, 9294, 14776, 29898, 1188, 3192, 29918, 262, 29892, 5852, 29897, 13, 13, 4706, 2933, 353, 1583, 29889, 4645, 29889, 657, 29898, 24244, 877, 8697, 8948, 29901, 8697, 8948, 29918, 14592, 3377, 5477, 11592, 29922, 5574, 29897, 13, 4706, 15837, 353, 2933, 29889, 4703, 1839, 7727, 2033, 13, 13, 4706, 396, 16224, 5235, 363, 2261, 3801, 881, 1863, 13, 4706, 1583, 29889, 9294, 14776, 29898, 7727, 1839, 4102, 29918, 978, 7464, 525, 4297, 3801, 1495, 13, 4706, 1583, 29889, 9294, 14776, 29898, 7727, 1839, 4230, 29918, 978, 7464, 525, 22031, 672, 14592, 1495, 13, 4706, 1583, 29889, 9294, 14776, 29898, 7727, 1839, 6710, 29918, 4537, 7464, 525, 29946, 29896, 29945, 29899, 29946, 29896, 29941, 29899, 29946, 29941, 29929, 29941, 1495, 13, 13, 4706, 396, 5619, 8948, 5235, 338, 1603, 4567, 13, 4706, 1583, 29889, 9294, 14776, 29898, 7727, 1839, 26180, 29918, 8697, 8948, 7464, 13, 462, 3986, 525, 1762, 5039, 403, 596, 3889, 14260, 29892, 3113, 6230, 596, 22329, 2472, 29889, 1495, 13, 13, 4706, 396, 1126, 916, 8282, 881, 451, 1863, 2745, 1156, 1906, 2712, 526, 4944, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 29898, 2558, 2392, 1125, 13, 9651, 1243, 353, 15837, 1839, 26180, 29918, 345, 29882, 4027, 2033, 13, 9651, 1243, 353, 15837, 1839, 9021, 29918, 3626, 284, 2033, 13, 13, 1678, 822, 1243, 29918, 14592, 3377, 29918, 1482, 29918, 1792, 29918, 2541, 29918, 8697, 8948, 29918, 14669, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 1570, 1404, 29892, 756, 4944, 7333, 5235, 322, 22329, 13, 4706, 584, 2457, 29901, 13, 4706, 9995, 13, 4706, 1583, 29889, 4645, 353, 12477, 580, 13, 4706, 13817, 29918, 262, 353, 1583, 29889, 4645, 29889, 7507, 29898, 6786, 2433, 305, 2707, 742, 4800, 2433, 5630, 1495, 13, 4706, 1583, 29889, 9294, 14776, 29898, 1188, 3192, 29918, 262, 29892, 5852, 29897, 13, 13, 4706, 2933, 353, 1583, 29889, 4645, 29889, 657, 29898, 24244, 877, 8697, 8948, 29901, 8697, 8948, 29918, 14592, 3377, 5477, 11592, 29922, 5574, 29897, 13, 4706, 15837, 353, 2933, 29889, 4703, 1839, 7727, 2033, 13, 13, 4706, 396, 16224, 5235, 363, 5322, 881, 1863, 13, 4706, 1583, 29889, 9294, 14776, 29898, 7727, 1839, 4102, 29918, 978, 7464, 525, 5914, 793, 1495, 13, 4706, 1583, 29889, 9294, 14776, 29898, 7727, 1839, 4230, 29918, 978, 7464, 525, 29907, 4254, 1495, 13, 4706, 1583, 29889, 9294, 14776, 29898, 7727, 1839, 6710, 29918, 4537, 7464, 525, 29946, 29896, 29945, 29899, 29946, 29896, 29941, 29899, 29946, 29946, 29900, 29896, 1495, 13, 13, 4706, 396, 5619, 8948, 5235, 881, 1863, 13, 4706, 1583, 29889, 9294, 14776, 29898, 7727, 1839, 2962, 29918, 6360, 7464, 29871, 29906, 29900, 29900, 29900, 29897, 13, 4706, 1583, 29889, 9294, 14776, 29898, 7727, 1839, 29886, 1691, 7464, 29871, 29896, 29897, 13, 13, 4706, 396, 1126, 1286, 5235, 338, 8833, 1048, 25691, 322, 24413, 13, 4706, 1583, 29889, 9294, 14776, 29898, 7727, 1839, 26180, 29918, 345, 29882, 4027, 2033, 29961, 29900, 29901, 29896, 29946, 1402, 525, 12148, 6084, 1495, 13, 4706, 1583, 29889, 9294, 14776, 29898, 7727, 1839, 9021, 29918, 3626, 284, 2033, 29961, 29900, 29901, 29953, 1402, 525, 16894, 1495, 13, 13, 1678, 822, 1243, 29918, 14592, 3377, 29918, 4548, 2859, 29918, 1491, 22371, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 12027, 2859, 25691, 13, 4706, 584, 2457, 29901, 13, 4706, 9995, 13, 4706, 1583, 29889, 4645, 353, 12477, 580, 13, 4706, 13817, 29918, 262, 353, 1583, 29889, 4645, 29889, 7507, 29898, 6786, 2433, 29881, 1351, 742, 4800, 2433, 5630, 1495, 13, 4706, 1583, 29889, 9294, 14776, 29898, 1188, 3192, 29918, 262, 29892, 5852, 29897, 13, 13, 4706, 2933, 353, 1583, 29889, 4645, 29889, 657, 29898, 24244, 877, 8697, 8948, 29901, 8697, 8948, 29918, 14592, 3377, 5477, 11592, 29922, 5574, 29897, 13, 4706, 15837, 353, 2933, 29889, 4703, 1839, 7727, 2033, 13, 13, 4706, 396, 16224, 5235, 363, 4699, 881, 1863, 13, 4706, 1583, 29889, 9294, 14776, 29898, 7727, 1839, 4102, 29918, 978, 7464, 525, 19504, 1495, 13, 4706, 1583, 29889, 9294, 14776, 29898, 7727, 1839, 4230, 29918, 978, 7464, 525, 29928, 485, 275, 1495, 13, 4706, 1583, 29889, 9294, 14776, 29898, 7727, 1839, 6710, 29918, 4537, 7464, 525, 29946, 29896, 29945, 29899, 29946, 29896, 29941, 29899, 29946, 29946, 29900, 29906, 1495, 13, 13, 4706, 396, 5619, 8948, 5235, 881, 1863, 13, 4706, 1583, 29889, 9294, 14776, 29898, 7727, 1839, 2962, 29918, 6360, 7464, 29871, 29896, 29929, 29947, 29945, 29897, 13, 4706, 1583, 29889, 9294, 14776, 29898, 7727, 1839, 29886, 1691, 7464, 29871, 29900, 29897, 13, 13, 4706, 396, 1126, 1286, 5235, 338, 8833, 1048, 25691, 322, 24413, 13, 4706, 1583, 29889, 9294, 14776, 29898, 7727, 1839, 26180, 29918, 345, 29882, 4027, 2033, 29961, 29900, 29901, 29896, 29946, 1402, 525, 12148, 6084, 1495, 13, 4706, 1583, 29889, 9294, 14776, 29898, 7727, 1839, 4548, 2859, 2033, 29961, 29900, 29901, 29941, 29900, 1402, 525, 10858, 25691, 756, 1518, 2859, 29889, 1495, 13, 13, 1678, 9995, 13, 1678, 4321, 590, 29918, 3888, 1776, 322, 883, 13, 1678, 9995, 13, 1678, 822, 1243, 29918, 1357, 29918, 3888, 29918, 1493, 29898, 1311, 1125, 13, 13, 4706, 1583, 29889, 4645, 353, 12477, 580, 13, 4706, 13817, 29918, 262, 353, 1583, 29889, 4645, 29889, 7507, 29898, 6786, 2433, 261, 293, 742, 4800, 2433, 5630, 1495, 13, 4706, 1583, 29889, 9294, 14776, 29898, 1188, 3192, 29918, 262, 29892, 5852, 29897, 13, 13, 4706, 848, 353, 426, 13, 9651, 525, 4102, 29918, 978, 2396, 525, 2110, 293, 742, 13, 9651, 525, 4230, 29918, 978, 2396, 525, 29923, 4317, 1330, 742, 13, 9651, 525, 6710, 29918, 4537, 2396, 525, 29946, 29896, 29945, 29899, 29946, 29896, 29941, 29899, 29946, 29946, 29900, 29941, 742, 13, 9651, 525, 15753, 15670, 2396, 5852, 29892, 13, 9651, 525, 20348, 2396, 5852, 13, 4706, 500, 13, 13, 4706, 2933, 353, 1583, 29889, 4645, 29889, 2490, 29898, 24244, 877, 8697, 8948, 29901, 1357, 29918, 3888, 5477, 848, 29922, 1272, 29892, 11592, 29922, 5574, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 5327, 29889, 4882, 29918, 401, 29892, 29871, 29906, 29900, 29900, 29897, 13, 13, 4706, 1404, 353, 4911, 29889, 12650, 29889, 657, 29898, 6786, 2433, 261, 293, 1495, 13, 4706, 3633, 353, 16535, 29889, 12650, 29889, 657, 29898, 1792, 29922, 1792, 29897, 13, 4706, 4509, 353, 19495, 29889, 12650, 29889, 657, 29898, 10149, 29922, 10149, 29897, 13, 13, 4706, 1583, 29889, 9294, 14776, 29898, 1792, 29889, 4230, 29918, 978, 29892, 525, 29923, 4317, 1330, 1495, 13, 4706, 1583, 29889, 9294, 14776, 29898, 14242, 29889, 6710, 29918, 4537, 29892, 525, 29946, 29896, 29945, 29899, 29946, 29896, 29941, 29899, 29946, 29946, 29900, 29941, 1495, 13, 13, 1678, 822, 1243, 29918, 1357, 29918, 3888, 29918, 689, 29918, 6310, 29898, 1311, 1125, 13, 13, 4706, 848, 353, 426, 13, 9651, 525, 4102, 29918, 978, 2396, 15516, 13, 9651, 525, 4230, 29918, 978, 2396, 15516, 13, 9651, 525, 6710, 29918, 4537, 2396, 15516, 13, 9651, 525, 15753, 15670, 2396, 5852, 29892, 13, 9651, 525, 20348, 2396, 5852, 13, 4706, 500, 13, 4706, 883, 353, 1619, 3401, 2500, 29898, 1272, 29922, 1272, 29897, 13, 4706, 1583, 29889, 9294, 8824, 29898, 689, 29889, 275, 29918, 3084, 3101, 13, 13, 1678, 822, 1243, 29918, 1357, 29918, 3888, 29918, 689, 29918, 12313, 29918, 7039, 29898, 1311, 1125, 13, 13, 4706, 848, 353, 426, 13, 9651, 525, 4102, 29918, 978, 2396, 14180, 742, 13, 9651, 525, 4230, 29918, 978, 2396, 525, 29923, 742, 13, 9651, 525, 6710, 29918, 4537, 2396, 525, 29946, 29896, 29945, 29899, 29946, 29896, 29941, 29899, 29946, 29946, 29900, 29941, 742, 13, 9651, 525, 15753, 15670, 2396, 5852, 29892, 13, 9651, 525, 20348, 2396, 5852, 13, 4706, 500, 13, 4706, 883, 353, 1619, 3401, 2500, 29898, 1272, 29922, 1272, 29897, 13, 4706, 1583, 29889, 9294, 8824, 29898, 689, 29889, 275, 29918, 3084, 3101, 13, 13, 1678, 822, 1243, 29918, 1357, 29918, 3888, 29918, 689, 29918, 12313, 29918, 6710, 29918, 4537, 29898, 1311, 1125, 13, 13, 4706, 848, 353, 426, 13, 9651, 525, 4102, 29918, 978, 2396, 525, 2110, 293, 742, 13, 9651, 525, 4230, 29918, 978, 2396, 525, 29923, 4317, 1330, 742, 13, 9651, 525, 6710, 29918, 4537, 2396, 525, 29945, 29945, 29945, 29899, 29945, 29945, 29945, 29899, 29945, 29945, 29945, 29945, 742, 13, 9651, 525, 15753, 15670, 2396, 5852, 29892, 13, 9651, 525, 20348, 2396, 5852, 13, 4706, 500, 13, 4706, 883, 353, 1619, 3401, 2500, 29898, 1272, 29922, 1272, 29897, 13, 4706, 1583, 29889, 9294, 8824, 29898, 689, 29889, 275, 29918, 3084, 3101, 13, 13, 1678, 822, 1243, 29918, 1357, 29918, 3888, 29918, 689, 29918, 3084, 29898, 1311, 1125, 13, 13, 4706, 848, 353, 426, 13, 9651, 525, 4102, 29918, 978, 2396, 525, 2110, 293, 742, 13, 9651, 525, 4230, 29918, 978, 2396, 525, 29923, 4317, 1330, 742, 13, 9651, 525, 6710, 29918, 4537, 2396, 525, 29946, 29896, 29945, 29899, 29946, 29896, 29941, 29899, 29946, 29946, 29900, 29941, 742, 13, 9651, 525, 15753, 15670, 2396, 5852, 29892, 13, 9651, 525, 20348, 2396, 5852, 13, 4706, 500, 13, 4706, 883, 353, 1619, 3401, 2500, 29898, 1272, 29922, 1272, 29897, 13, 4706, 1583, 29889, 9294, 5574, 29898, 689, 29889, 275, 29918, 3084, 3101, 13, 13, 1678, 9995, 13, 1678, 4321, 22329, 29918, 10185, 1776, 322, 883, 13, 1678, 9995, 13, 1678, 822, 1243, 29918, 8697, 8948, 29918, 10185, 29918, 1493, 29898, 1311, 1125, 13, 13, 4706, 1583, 29889, 4645, 353, 12477, 580, 13, 4706, 13817, 29918, 262, 353, 1583, 29889, 4645, 29889, 7507, 29898, 6786, 2433, 18447, 742, 4800, 2433, 5630, 1495, 13, 4706, 1583, 29889, 9294, 14776, 29898, 1188, 3192, 29918, 262, 29892, 5852, 29897, 13, 13, 4706, 12912, 29922, 390, 335, 1542, 29889, 12650, 29889, 657, 29898, 8966, 29918, 1853, 2433, 29924, 327, 272, 5184, 1495, 13, 4706, 671, 353, 4803, 1542, 29889, 12650, 29889, 657, 29898, 1509, 29918, 1853, 2433, 13658, 29899, 2230, 1495, 13, 4706, 17869, 353, 512, 2763, 1542, 29889, 12650, 29889, 657, 29898, 262, 2763, 29918, 1853, 2433, 24313, 29899, 3451, 2376, 287, 1495, 13, 13, 4706, 396, 4321, 1653, 13, 4706, 848, 353, 426, 13, 9651, 525, 2962, 29918, 6360, 2396, 29871, 29896, 29929, 29929, 29906, 29892, 13, 9651, 525, 28109, 29918, 262, 29918, 8697, 8948, 2396, 29871, 29906, 29892, 13, 9651, 525, 1025, 342, 29918, 29890, 7515, 6360, 2396, 29871, 29896, 29929, 29945, 29906, 29892, 13, 9651, 525, 8966, 29918, 1853, 2396, 12912, 29889, 20571, 29892, 13, 9651, 525, 1509, 29918, 1853, 2396, 671, 29889, 20571, 29892, 13, 9651, 525, 262, 2763, 29918, 1853, 2396, 17869, 29889, 20571, 29892, 13, 9651, 525, 29886, 1691, 29918, 26169, 2396, 29871, 29896, 29892, 13, 9651, 525, 29886, 1691, 29918, 4117, 2396, 29871, 29900, 29892, 13, 9651, 525, 29886, 1691, 29918, 1228, 2396, 29871, 29896, 29892, 13, 9651, 525, 11991, 2396, 29871, 29900, 29892, 13, 9651, 525, 11991, 29918, 4882, 2396, 29871, 29900, 29892, 13, 9651, 525, 27857, 11991, 2396, 29871, 29900, 29892, 13, 9651, 525, 27857, 11991, 29918, 4882, 2396, 29871, 29900, 13, 4706, 500, 13, 13, 4706, 2933, 353, 1583, 29889, 4645, 29889, 2490, 29898, 24244, 877, 8697, 8948, 29901, 29885, 2365, 475, 29918, 8697, 8948, 5477, 848, 29922, 1272, 29892, 11592, 29922, 5574, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 5327, 29889, 4882, 29918, 401, 29892, 29871, 29906, 29900, 29900, 29897, 13, 13, 4706, 1404, 353, 4911, 29889, 12650, 29889, 657, 29898, 6786, 2433, 18447, 1495, 13, 4706, 3633, 353, 16535, 29889, 12650, 29889, 657, 29898, 1792, 29922, 1792, 29897, 13, 13, 4706, 22329, 353, 390, 29963, 29950, 1709, 8948, 29889, 12650, 29889, 657, 29898, 8697, 8948, 28109, 1649, 14242, 29918, 10149, 29922, 10149, 29897, 13, 4706, 1583, 29889, 9294, 14776, 29898, 8697, 8948, 29889, 2962, 29918, 6360, 29892, 29871, 29896, 29929, 29929, 29906, 29897, 13, 13, 4706, 590, 29918, 2972, 353, 1619, 29933, 566, 657, 4782, 29889, 12650, 29889, 657, 29898, 1357, 29918, 2972, 29918, 978, 2433, 3868, 4298, 10057, 1495, 13, 4706, 1583, 29889, 9294, 14776, 29898, 710, 29898, 1357, 29918, 2972, 511, 525, 3868, 4298, 10057, 1495, 13, 13, 4706, 590, 29918, 7320, 353, 1619, 29933, 566, 657, 10900, 29889, 12650, 29889, 657, 29898, 1357, 29918, 7320, 29918, 978, 2433, 797, 7610, 749, 1495, 13, 4706, 1583, 29889, 9294, 14776, 29898, 710, 29898, 1357, 29918, 7320, 511, 525, 797, 7610, 749, 1495, 13, 13, 4706, 396, 4321, 2767, 13, 4706, 848, 353, 426, 13, 9651, 525, 2962, 29918, 6360, 2396, 29871, 29896, 29929, 29929, 29946, 29892, 13, 9651, 525, 28109, 29918, 262, 29918, 8697, 8948, 2396, 29871, 29906, 29892, 13, 9651, 525, 1025, 342, 29918, 29890, 7515, 6360, 2396, 29871, 29896, 29929, 29945, 29906, 29892, 13, 9651, 525, 8966, 29918, 1853, 2396, 12912, 29889, 20571, 29892, 13, 9651, 525, 1509, 29918, 1853, 2396, 671, 29889, 20571, 29892, 13, 9651, 525, 262, 2763, 29918, 1853, 2396, 17869, 29889, 20571, 29892, 13, 9651, 525, 29886, 1691, 29918, 26169, 2396, 29871, 29896, 29892, 13, 9651, 525, 29886, 1691, 29918, 4117, 2396, 29871, 29896, 29892, 13, 9651, 525, 29886, 1691, 29918, 1228, 2396, 29871, 29900, 29892, 13, 9651, 525, 11991, 2396, 29871, 29900, 29892, 13, 9651, 525, 11991, 29918, 4882, 2396, 29871, 29900, 29892, 13, 9651, 525, 27857, 11991, 2396, 29871, 29900, 29892, 13, 9651, 525, 27857, 11991, 29918, 4882, 2396, 29871, 29900, 13, 4706, 500, 13, 13, 4706, 2933, 353, 1583, 29889, 4645, 29889, 2490, 29898, 24244, 877, 8697, 8948, 29901, 29885, 2365, 475, 29918, 8697, 8948, 5477, 848, 29922, 1272, 29892, 11592, 29922, 5574, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 5327, 29889, 4882, 29918, 401, 29892, 29871, 29906, 29900, 29900, 29897, 13, 13, 4706, 1404, 353, 4911, 29889, 12650, 29889, 657, 29898, 6786, 2433, 18447, 1495, 13, 4706, 3633, 353, 16535, 29889, 12650, 29889, 657, 29898, 1792, 29922, 1792, 29897, 13, 13, 4706, 22329, 353, 390, 29963, 29950, 1709, 8948, 29889, 12650, 29889, 657, 29898, 8697, 8948, 28109, 1649, 14242, 29918, 10149, 29922, 10149, 29897, 13, 4706, 1583, 29889, 9294, 14776, 29898, 8697, 8948, 29889, 2962, 29918, 6360, 29892, 29871, 29896, 29929, 29929, 29946, 29897, 13, 13, 1678, 822, 1243, 29918, 8697, 8948, 29918, 10185, 29918, 689, 29918, 6310, 29898, 1311, 1125, 13, 13, 4706, 848, 353, 426, 13, 9651, 525, 2962, 29918, 6360, 2396, 29871, 29900, 29892, 13, 9651, 525, 28109, 29918, 262, 29918, 8697, 8948, 2396, 29871, 29900, 29892, 13, 9651, 525, 1025, 342, 29918, 29890, 7515, 6360, 2396, 29871, 29900, 29892, 13, 9651, 525, 8966, 29918, 1853, 2396, 29871, 29900, 29892, 13, 9651, 525, 1509, 29918, 1853, 2396, 29871, 29900, 29892, 13, 9651, 525, 262, 2763, 29918, 1853, 2396, 29871, 29900, 29892, 13, 9651, 525, 29886, 1691, 29918, 26169, 2396, 29871, 29900, 29892, 13, 9651, 525, 29886, 1691, 29918, 4117, 2396, 29871, 29900, 29892, 13, 9651, 525, 29886, 1691, 29918, 1228, 2396, 29871, 29900, 29892, 13, 9651, 525, 11991, 2396, 29871, 29900, 29892, 13, 9651, 525, 11991, 29918, 4882, 2396, 29871, 29900, 29892, 13, 9651, 525, 27857, 11991, 2396, 29871, 29900, 29892, 13, 9651, 525, 27857, 11991, 29918, 4882, 2396, 29871, 29900, 13, 4706, 500, 13, 4706, 883, 353, 5619, 8948, 13909, 2500, 29898, 1272, 29922, 1272, 29897, 13, 4706, 1583, 29889, 9294, 8824, 29898, 689, 29889, 275, 29918, 3084, 3101, 13, 13, 1678, 822, 1243, 29918, 8697, 8948, 29918, 10185, 29918, 689, 29918, 26180, 29918, 8966, 29918, 1509, 29918, 262, 2763, 29898, 1311, 1125, 13, 4706, 848, 353, 426, 13, 9651, 525, 2962, 29918, 6360, 2396, 29871, 29906, 29900, 29896, 29896, 29892, 13, 9651, 525, 28109, 29918, 262, 29918, 8697, 8948, 2396, 29871, 29906, 29892, 13, 9651, 525, 1025, 342, 29918, 29890, 7515, 6360, 2396, 29871, 29896, 29929, 29953, 29941, 29892, 13, 9651, 525, 8966, 29918, 1853, 2396, 29871, 29900, 29892, 13, 9651, 525, 1509, 29918, 1853, 2396, 29871, 29900, 29892, 13, 9651, 525, 262, 2763, 29918, 1853, 2396, 29871, 29900, 29892, 13, 9651, 525, 29886, 1691, 29918, 26169, 2396, 29871, 29900, 29892, 13, 9651, 525, 29886, 1691, 29918, 4117, 2396, 29871, 29900, 29892, 13, 9651, 525, 29886, 1691, 29918, 1228, 2396, 29871, 29900, 29892, 13, 9651, 525, 11991, 2396, 29871, 29900, 29892, 13, 9651, 525, 11991, 29918, 4882, 2396, 29871, 29900, 29892, 13, 9651, 525, 27857, 11991, 2396, 29871, 29900, 29892, 13, 9651, 525, 27857, 11991, 29918, 4882, 2396, 29871, 29900, 13, 4706, 500, 13, 4706, 883, 353, 5619, 8948, 13909, 2500, 29898, 1272, 29922, 1272, 29897, 13, 4706, 1583, 29889, 9294, 8824, 29898, 689, 29889, 275, 29918, 3084, 3101, 13, 13, 1678, 822, 1243, 29918, 8697, 8948, 29918, 10185, 29918, 689, 29918, 517, 29877, 29918, 13011, 29918, 29886, 1691, 29898, 1311, 1125, 13, 4706, 848, 353, 426, 13, 9651, 525, 2962, 29918, 6360, 2396, 29871, 29906, 29900, 29896, 29896, 29892, 13, 9651, 525, 28109, 29918, 262, 29918, 8697, 8948, 2396, 29871, 29906, 29892, 13, 9651, 525, 1025, 342, 29918, 29890, 7515, 6360, 2396, 29871, 29896, 29929, 29953, 29941, 29892, 13, 9651, 525, 8966, 29918, 1853, 2396, 29871, 29896, 29892, 13, 9651, 525, 1509, 29918, 1853, 2396, 29871, 29896, 29892, 13, 9651, 525, 262, 2763, 29918, 1853, 2396, 29871, 29896, 29892, 13, 9651, 525, 29886, 1691, 29918, 26169, 2396, 29871, 29896, 29896, 29892, 13, 9651, 525, 29886, 1691, 29918, 4117, 2396, 29871, 29900, 29892, 13, 9651, 525, 29886, 1691, 29918, 1228, 2396, 29871, 29900, 29892, 13, 9651, 525, 11991, 2396, 29871, 29900, 29892, 13, 9651, 525, 11991, 29918, 4882, 2396, 29871, 29900, 29892, 13, 9651, 525, 27857, 11991, 2396, 29871, 29900, 29892, 13, 9651, 525, 27857, 11991, 29918, 4882, 2396, 29871, 29900, 13, 4706, 500, 13, 4706, 883, 353, 5619, 8948, 13909, 2500, 29898, 1272, 29922, 1272, 29897, 13, 4706, 1583, 29889, 9294, 8824, 29898, 689, 29889, 275, 29918, 3084, 3101, 13, 13, 1678, 822, 1243, 29918, 8697, 8948, 29918, 10185, 29918, 689, 29918, 20965, 29918, 11991, 29918, 4882, 29898, 1311, 1125, 13, 4706, 848, 353, 426, 13, 9651, 525, 2962, 29918, 6360, 2396, 29871, 29906, 29900, 29896, 29896, 29892, 13, 9651, 525, 28109, 29918, 262, 29918, 8697, 8948, 2396, 29871, 29906, 29892, 13, 9651, 525, 1025, 342, 29918, 29890, 7515, 6360, 2396, 29871, 29896, 29929, 29953, 29941, 29892, 13, 9651, 525, 8966, 29918, 1853, 2396, 29871, 29896, 29892, 13, 9651, 525, 1509, 29918, 1853, 2396, 29871, 29896, 29892, 13, 9651, 525, 262, 2763, 29918, 1853, 2396, 29871, 29896, 29892, 13, 9651, 525, 29886, 1691, 29918, 26169, 2396, 29871, 29896, 29892, 13, 9651, 525, 29886, 1691, 29918, 4117, 2396, 29871, 29900, 29892, 13, 9651, 525, 29886, 1691, 29918, 1228, 2396, 29871, 29900, 29892, 13, 9651, 525, 11991, 2396, 29871, 29896, 29892, 13, 9651, 525, 11991, 29918, 4882, 2396, 29871, 29900, 29892, 29871, 396, 529, 489, 13, 9651, 525, 27857, 11991, 2396, 29871, 29896, 29892, 13, 9651, 525, 27857, 11991, 29918, 4882, 2396, 29871, 29900, 29871, 396, 529, 489, 13, 4706, 500, 13, 4706, 883, 353, 5619, 8948, 13909, 2500, 29898, 1272, 29922, 1272, 29897, 13, 4706, 1583, 29889, 9294, 8824, 29898, 689, 29889, 275, 29918, 3084, 3101, 13, 13, 1678, 822, 1243, 29918, 8697, 8948, 29918, 10185, 29918, 689, 29918, 20965, 29918, 11991, 29918, 2798, 29898, 1311, 1125, 13, 4706, 848, 353, 426, 13, 9651, 525, 2962, 29918, 6360, 2396, 29871, 29906, 29900, 29896, 29896, 29892, 13, 9651, 525, 28109, 29918, 262, 29918, 8697, 8948, 2396, 29871, 29906, 29892, 13, 9651, 525, 1025, 342, 29918, 29890, 7515, 6360, 2396, 29871, 29896, 29929, 29953, 29941, 29892, 13, 9651, 525, 8966, 29918, 1853, 2396, 29871, 29896, 29892, 13, 9651, 525, 1509, 29918, 1853, 2396, 29871, 29896, 29892, 13, 9651, 525, 262, 2763, 29918, 1853, 2396, 29871, 29896, 29892, 13, 9651, 525, 29886, 1691, 29918, 26169, 2396, 29871, 29896, 29892, 13, 9651, 525, 29886, 1691, 29918, 4117, 2396, 29871, 29900, 29892, 13, 9651, 525, 29886, 1691, 29918, 1228, 2396, 29871, 29900, 29892, 13, 9651, 525, 11991, 2396, 29871, 29900, 29892, 29871, 396, 529, 489, 13, 9651, 525, 11991, 29918, 4882, 2396, 29871, 29896, 29892, 13, 9651, 525, 27857, 11991, 2396, 29871, 29900, 29892, 29871, 396, 529, 489, 13, 9651, 525, 27857, 11991, 29918, 4882, 2396, 29871, 29896, 13, 4706, 500, 13, 4706, 883, 353, 5619, 8948, 13909, 2500, 29898, 1272, 29922, 1272, 29897, 13, 4706, 1583, 29889, 9294, 8824, 29898, 689, 29889, 275, 29918, 3084, 3101, 13, 13, 1678, 822, 1243, 29918, 8697, 8948, 29918, 10185, 29918, 689, 29918, 3084, 29898, 1311, 1125, 13, 4706, 848, 353, 426, 13, 9651, 525, 2962, 29918, 6360, 2396, 29871, 29906, 29900, 29896, 29896, 29892, 13, 9651, 525, 28109, 29918, 262, 29918, 8697, 8948, 2396, 29871, 29906, 29892, 13, 9651, 525, 1025, 342, 29918, 29890, 7515, 6360, 2396, 29871, 29896, 29929, 29953, 29941, 29892, 13, 9651, 525, 8966, 29918, 1853, 2396, 29871, 29896, 29892, 13, 9651, 525, 1509, 29918, 1853, 2396, 29871, 29896, 29892, 13, 9651, 525, 262, 2763, 29918, 1853, 2396, 29871, 29896, 29892, 13, 9651, 525, 29886, 1691, 29918, 26169, 2396, 29871, 29896, 29892, 13, 9651, 525, 29886, 1691, 29918, 4117, 2396, 29871, 29896, 29892, 13, 9651, 525, 29886, 1691, 29918, 1228, 2396, 29871, 29900, 29892, 13, 9651, 525, 11991, 2396, 29871, 29900, 29892, 13, 9651, 525, 11991, 29918, 4882, 2396, 29871, 29900, 29892, 13, 9651, 525, 27857, 11991, 2396, 29871, 29900, 29892, 13, 9651, 525, 27857, 11991, 29918, 4882, 2396, 29871, 29900, 13, 4706, 500, 13, 4706, 883, 353, 5619, 8948, 13909, 2500, 29898, 1272, 29922, 1272, 29897, 13, 4706, 1583, 29889, 9294, 5574, 29898, 689, 29889, 275, 29918, 3084, 3101, 13, 13, 1678, 9995, 13, 1678, 4321, 22329, 29918, 28109, 1776, 29892, 883, 29892, 322, 9349, 5717, 13, 1678, 9995, 13, 1678, 822, 1243, 29918, 8697, 8948, 29918, 28109, 29918, 1493, 29898, 1311, 1125, 13, 13, 4706, 1583, 29889, 4645, 353, 12477, 580, 13, 13, 4706, 396, 4367, 1088, 363, 1518, 2859, 25691, 13, 4706, 13817, 29918, 262, 353, 1583, 29889, 4645, 29889, 7507, 29898, 6786, 2433, 7642, 742, 4800, 2433, 5630, 1495, 13, 4706, 1583, 29889, 9294, 14776, 29898, 1188, 3192, 29918, 262, 29892, 5852, 29897, 13, 13, 4706, 2933, 353, 1583, 29889, 4645, 29889, 657, 29898, 24244, 877, 8697, 8948, 29901, 29885, 2365, 475, 29918, 28109, 5477, 1101, 29922, 5574, 29892, 11592, 29922, 5574, 29897, 13, 4706, 9704, 353, 2933, 29889, 17886, 29918, 14153, 29961, 29900, 29962, 13, 4706, 1583, 29889, 9294, 14776, 29898, 14153, 29961, 29900, 1402, 8207, 8697, 8948, 29914, 11027, 1495, 13, 4706, 1583, 29889, 9294, 14776, 29898, 14153, 29961, 29896, 1402, 29871, 29941, 29900, 29906, 29897, 13, 4706, 1583, 29889, 9294, 14776, 29898, 5327, 29889, 4882, 29918, 401, 29892, 29871, 29906, 29900, 29900, 29897, 13, 13, 4706, 396, 4367, 1088, 1363, 1661, 29899, 20348, 2609, 2437, 568, 916, 5144, 13, 4706, 13817, 29918, 262, 353, 1583, 29889, 4645, 29889, 7507, 29898, 6786, 2433, 812, 347, 742, 4800, 2433, 5630, 1495, 13, 4706, 1583, 29889, 9294, 14776, 29898, 1188, 3192, 29918, 262, 29892, 5852, 29897, 13, 13, 4706, 2933, 353, 1583, 29889, 4645, 29889, 657, 29898, 24244, 877, 8697, 8948, 29901, 29885, 2365, 475, 29918, 28109, 5477, 1101, 29922, 5574, 29892, 11592, 29922, 5574, 29897, 13, 4706, 9704, 353, 2933, 29889, 17886, 29918, 14153, 29961, 29900, 29962, 13, 4706, 1583, 29889, 9294, 14776, 29898, 14153, 29961, 29900, 1402, 8207, 8697, 8948, 29914, 11027, 1495, 13, 4706, 1583, 29889, 9294, 14776, 29898, 14153, 29961, 29896, 1402, 29871, 29941, 29900, 29906, 29897, 13, 4706, 1583, 29889, 9294, 14776, 29898, 5327, 29889, 4882, 29918, 401, 29892, 29871, 29906, 29900, 29900, 29897, 13, 13, 4706, 396, 4321, 2437, 7018, 13, 4706, 13817, 29918, 262, 353, 1583, 29889, 4645, 29889, 7507, 29898, 6786, 2433, 8222, 719, 742, 4800, 2433, 5630, 1495, 13, 4706, 1583, 29889, 9294, 14776, 29898, 1188, 3192, 29918, 262, 29892, 5852, 29897, 13, 13, 4706, 848, 353, 426, 13, 9651, 525, 5269, 2396, 12801, 26862, 6227, 16299, 13, 4706, 500, 13, 4706, 2933, 353, 1583, 29889, 4645, 29889, 2490, 29898, 24244, 877, 8697, 8948, 29901, 29885, 2365, 475, 29918, 28109, 5477, 848, 29922, 1272, 29892, 11592, 29922, 5574, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 5327, 29889, 4882, 29918, 401, 29892, 29871, 29906, 29900, 29900, 29897, 13, 13, 4706, 1857, 353, 2933, 29889, 4703, 1839, 3784, 13359, 4572, 29898, 6786, 2433, 812, 347, 1495, 13, 4706, 1583, 29889, 9294, 14776, 29898, 2435, 29898, 3784, 511, 29871, 29896, 29897, 13, 13, 4706, 28235, 353, 2933, 29889, 4703, 1839, 29886, 2548, 13359, 4572, 29898, 5269, 2433, 29966, 26862, 6227, 29958, 1495, 13, 4706, 1583, 29889, 9294, 14776, 29898, 2435, 29898, 29886, 2548, 511, 29871, 29896, 29897, 13, 13, 4706, 2437, 568, 353, 5619, 8948, 12165, 568, 29889, 12650, 29889, 657, 29898, 5269, 2433, 29966, 26862, 6227, 29958, 1495, 13, 4706, 1583, 29889, 9294, 14776, 29898, 710, 29898, 11569, 568, 511, 12801, 26862, 6227, 29958, 1495, 13, 13, 1678, 822, 1243, 29918, 14242, 29918, 11569, 568, 29918, 689, 29918, 5269, 29918, 284, 2040, 29918, 9933, 29918, 10149, 29898, 1311, 1125, 13, 13, 4706, 848, 353, 426, 13, 9651, 525, 5269, 2396, 12801, 26862, 6227, 16299, 13, 4706, 500, 13, 4706, 883, 353, 15518, 568, 13404, 2500, 29898, 1272, 29922, 1272, 29897, 13, 4706, 1583, 29889, 9294, 8824, 29898, 689, 29889, 275, 29918, 3084, 3101, 13, 13, 1678, 822, 1243, 29918, 14242, 29918, 11569, 568, 29918, 689, 29918, 5269, 29918, 284, 2040, 29918, 9933, 29918, 11569, 568, 29898, 1311, 1125, 13, 13, 4706, 848, 353, 426, 13, 9651, 525, 5269, 2396, 12801, 26862, 6227, 16299, 13, 4706, 500, 13, 4706, 883, 353, 15518, 568, 13404, 2500, 29898, 1272, 29922, 1272, 29897, 13, 4706, 1583, 29889, 9294, 8824, 29898, 689, 29889, 275, 29918, 3084, 3101, 13, 13, 1678, 822, 1243, 29918, 14242, 29918, 11569, 568, 29918, 689, 29918, 5269, 29918, 20965, 29898, 1311, 1125, 13, 13, 4706, 848, 353, 426, 13, 9651, 525, 5269, 2396, 525, 29876, 3231, 29889, 29876, 3231, 29889, 510, 29915, 13, 4706, 500, 13, 4706, 883, 353, 15518, 568, 13404, 2500, 29898, 1272, 29922, 1272, 29897, 13, 4706, 1583, 29889, 9294, 8824, 29898, 689, 29889, 275, 29918, 3084, 3101, 13, 13, 1678, 822, 1243, 29918, 14242, 29918, 11569, 568, 29918, 689, 29918, 5269, 29918, 3084, 29898, 1311, 1125, 13, 13, 4706, 848, 353, 426, 13, 9651, 525, 5269, 2396, 12801, 26862, 6227, 16299, 13, 4706, 500, 13, 4706, 883, 353, 15518, 568, 13404, 2500, 29898, 1272, 29922, 1272, 29897, 13, 4706, 1583, 29889, 9294, 5574, 29898, 689, 29889, 275, 29918, 3084, 3101, 13, 13, 1678, 822, 1243, 29918, 6538, 29918, 8143, 29918, 11569, 568, 29898, 1311, 1125, 13, 13, 4706, 1583, 29889, 4645, 353, 12477, 580, 13, 4706, 13817, 29918, 262, 353, 1583, 29889, 4645, 29889, 7507, 29898, 6786, 2433, 8222, 719, 742, 4800, 2433, 5630, 1495, 13, 4706, 1583, 29889, 9294, 14776, 29898, 1188, 3192, 29918, 262, 29892, 5852, 29897, 13, 13, 4706, 396, 21403, 848, 6987, 13, 4706, 848, 29900, 353, 426, 13, 9651, 525, 333, 2396, 14180, 742, 29871, 396, 529, 489, 13, 9651, 525, 1792, 2396, 525, 8222, 719, 29915, 13, 4706, 500, 13, 4706, 2933, 353, 1583, 29889, 4645, 29889, 2490, 11219, 8697, 8948, 29914, 6538, 29914, 8143, 29899, 11569, 568, 29914, 742, 848, 29922, 1272, 29900, 29892, 11592, 29922, 5574, 29897, 13, 4706, 1121, 353, 4390, 29889, 18132, 29898, 5327, 29889, 3051, 29897, 13, 4706, 1583, 29889, 9294, 14776, 29898, 5327, 29889, 4882, 29918, 401, 29892, 29871, 29906, 29900, 29900, 29897, 13, 4706, 1583, 29889, 9294, 14776, 29898, 2914, 1839, 4882, 7464, 525, 11432, 1495, 13, 13, 4706, 848, 29896, 353, 426, 13, 9651, 525, 333, 2396, 29871, 29929, 29929, 29929, 29929, 29929, 29929, 29929, 29929, 29892, 13, 9651, 525, 1792, 2396, 14180, 2546, 29929, 29995, 20714, 29871, 396, 529, 489, 13, 4706, 500, 13, 4706, 2933, 353, 1583, 29889, 4645, 29889, 2490, 11219, 8697, 8948, 29914, 6538, 29914, 8143, 29899, 11569, 568, 29914, 742, 848, 29922, 1272, 29896, 29892, 11592, 29922, 5574, 29897, 13, 4706, 1121, 353, 4390, 29889, 18132, 29898, 5327, 29889, 3051, 29897, 13, 4706, 1583, 29889, 9294, 14776, 29898, 5327, 29889, 4882, 29918, 401, 29892, 29871, 29906, 29900, 29900, 29897, 13, 4706, 1583, 29889, 9294, 14776, 29898, 2914, 1839, 4882, 7464, 525, 11432, 1495, 13, 13, 4706, 396, 21403, 1178, 29936, 947, 451, 1863, 13, 4706, 848, 29906, 353, 426, 13, 9651, 525, 333, 2396, 29871, 29929, 29929, 29929, 29929, 29929, 29929, 29929, 29929, 29892, 13, 9651, 525, 1792, 2396, 525, 8222, 719, 29915, 13, 4706, 500, 13, 4706, 2933, 353, 1583, 29889, 4645, 29889, 2490, 11219, 8697, 8948, 29914, 6538, 29914, 8143, 29899, 11569, 568, 29914, 742, 848, 29922, 1272, 29906, 29892, 11592, 29922, 5574, 29897, 13, 4706, 1121, 353, 4390, 29889, 18132, 29898, 5327, 29889, 3051, 29897, 13, 4706, 1583, 29889, 9294, 14776, 29898, 5327, 29889, 4882, 29918, 401, 29892, 29871, 29906, 29900, 29900, 29897, 13, 4706, 1583, 29889, 9294, 14776, 29898, 2914, 1839, 4882, 7464, 525, 11432, 1495, 13, 13, 4706, 396, 15758, 403, 1404, 1024, 4944, 338, 1021, 408, 1404, 1024, 13817, 297, 13, 4706, 848, 29941, 353, 426, 13, 9651, 525, 333, 2396, 29871, 29929, 29929, 29929, 29929, 29929, 29929, 29929, 29929, 29892, 13, 9651, 525, 1792, 2396, 525, 7642, 29915, 13, 4706, 500, 13, 4706, 2933, 353, 1583, 29889, 4645, 29889, 2490, 11219, 8697, 8948, 29914, 6538, 29914, 8143, 29899, 11569, 568, 29914, 742, 848, 29922, 1272, 29941, 29892, 11592, 29922, 5574, 29897, 13, 4706, 1121, 353, 4390, 29889, 18132, 29898, 5327, 29889, 3051, 29897, 13, 4706, 1583, 29889, 9294, 14776, 29898, 5327, 29889, 4882, 29918, 401, 29892, 29871, 29906, 29900, 29900, 29897, 13, 4706, 1583, 29889, 9294, 14776, 29898, 2914, 1839, 4882, 7464, 525, 11432, 1495, 13, 13, 4706, 2437, 568, 353, 5619, 8948, 12165, 568, 29889, 12650, 29889, 657, 29898, 5269, 2433, 29966, 26862, 6227, 29958, 1495, 13, 4706, 848, 353, 426, 13, 9651, 525, 333, 2396, 2437, 568, 29889, 20571, 29892, 13, 9651, 525, 1792, 2396, 525, 8222, 719, 29915, 13, 4706, 500, 13, 4706, 2933, 353, 1583, 29889, 4645, 29889, 2490, 11219, 8697, 8948, 29914, 6538, 29914, 8143, 29899, 11569, 568, 29914, 742, 848, 29922, 1272, 29892, 11592, 29922, 5574, 29897, 13, 4706, 1121, 353, 4390, 29889, 18132, 29898, 5327, 29889, 3051, 29897, 13, 4706, 1583, 29889, 9294, 14776, 29898, 5327, 29889, 4882, 29918, 401, 29892, 29871, 29906, 29900, 29900, 29897, 13, 4706, 1583, 29889, 9294, 14776, 29898, 2914, 1839, 4882, 7464, 525, 8949, 1495, 13, 13, 4706, 2437, 568, 353, 5619, 8948, 12165, 568, 29889, 12650, 29889, 4572, 29898, 5269, 2433, 29966, 26862, 6227, 29958, 1495, 13, 4706, 1583, 29889, 9294, 14776, 29898, 2435, 29898, 11569, 568, 511, 29871, 29900, 29897, 13, 13, 1678, 822, 1243, 29918, 6538, 29918, 3167, 29918, 14242, 29918, 4882, 29898, 1311, 1125, 13, 13, 4706, 1583, 29889, 4645, 353, 12477, 580, 13, 4706, 13817, 29918, 262, 353, 1583, 29889, 4645, 29889, 7507, 29898, 6786, 2433, 8222, 719, 742, 4800, 2433, 5630, 1495, 13, 4706, 1583, 29889, 9294, 14776, 29898, 1188, 3192, 29918, 262, 29892, 5852, 29897, 13, 13, 4706, 396, 21403, 848, 6987, 13, 4706, 848, 29900, 353, 426, 13, 9651, 525, 6786, 2396, 525, 812, 347, 742, 13, 9651, 525, 1792, 2396, 14180, 742, 29871, 396, 529, 489, 13, 9651, 525, 4882, 2396, 525, 2772, 11236, 403, 29915, 13, 4706, 500, 13, 4706, 2933, 353, 1583, 29889, 4645, 29889, 2490, 11219, 8697, 8948, 29914, 6538, 29914, 3167, 29899, 14242, 29899, 4882, 29914, 742, 848, 29922, 1272, 29900, 29892, 11592, 29922, 5574, 29897, 13, 4706, 1121, 353, 4390, 29889, 18132, 29898, 5327, 29889, 3051, 29897, 13, 4706, 1583, 29889, 9294, 14776, 29898, 5327, 29889, 4882, 29918, 401, 29892, 29871, 29906, 29900, 29900, 29897, 13, 4706, 1583, 29889, 9294, 14776, 29898, 2914, 1839, 4882, 7464, 525, 11432, 1495, 13, 13, 4706, 848, 29896, 353, 426, 13, 9651, 525, 6786, 2396, 525, 812, 347, 742, 13, 9651, 525, 1792, 2396, 525, 8222, 719, 742, 13, 9651, 525, 4882, 2396, 525, 6880, 29915, 29871, 396, 529, 489, 13, 4706, 500, 13, 4706, 2933, 353, 1583, 29889, 4645, 29889, 2490, 11219, 8697, 8948, 29914, 6538, 29914, 3167, 29899, 14242, 29899, 4882, 29914, 742, 848, 29922, 1272, 29896, 29892, 11592, 29922, 5574, 29897, 13, 4706, 1121, 353, 4390, 29889, 18132, 29898, 5327, 29889, 3051, 29897, 13, 4706, 1583, 29889, 9294, 14776, 29898, 5327, 29889, 4882, 29918, 401, 29892, 29871, 29906, 29900, 29900, 29897, 13, 4706, 1583, 29889, 9294, 14776, 29898, 2914, 1839, 4882, 7464, 525, 11432, 1495, 13, 13, 4706, 396, 4911, 313, 6786, 29897, 947, 451, 1863, 13, 4706, 848, 29906, 353, 426, 13, 9651, 525, 6786, 2396, 525, 812, 29899, 3034, 347, 742, 13, 9651, 525, 1792, 2396, 525, 8222, 719, 742, 13, 9651, 525, 4882, 2396, 525, 2772, 11236, 403, 29915, 13, 4706, 500, 13, 4706, 2933, 353, 1583, 29889, 4645, 29889, 2490, 11219, 8697, 8948, 29914, 6538, 29914, 3167, 29899, 14242, 29899, 4882, 29914, 742, 848, 29922, 1272, 29906, 29892, 11592, 29922, 5574, 29897, 13, 4706, 1121, 353, 4390, 29889, 18132, 29898, 5327, 29889, 3051, 29897, 13, 4706, 1583, 29889, 9294, 14776, 29898, 5327, 29889, 4882, 29918, 401, 29892, 29871, 29906, 29900, 29900, 29897, 13, 4706, 1583, 29889, 9294, 14776, 29898, 2914, 1839, 4882, 7464, 525, 11432, 1495, 13, 13, 4706, 396, 4911, 313, 6786, 29897, 338, 451, 4509, 310, 2183, 22329, 313, 1792, 29897, 13, 4706, 848, 29941, 353, 426, 13, 9651, 525, 6786, 2396, 525, 812, 347, 742, 13, 9651, 525, 1792, 2396, 525, 7642, 742, 13, 9651, 525, 4882, 2396, 525, 2772, 11236, 403, 29915, 13, 4706, 500, 13, 4706, 2933, 353, 1583, 29889, 4645, 29889, 2490, 11219, 8697, 8948, 29914, 6538, 29914, 3167, 29899, 14242, 29899, 4882, 29914, 742, 848, 29922, 1272, 29941, 29892, 11592, 29922, 5574, 29897, 13, 4706, 1121, 353, 4390, 29889, 18132, 29898, 5327, 29889, 3051, 29897, 13, 4706, 1583, 29889, 9294, 14776, 29898, 5327, 29889, 4882, 29918, 401, 29892, 29871, 29906, 29900, 29900, 29897, 13, 4706, 1583, 29889, 9294, 14776, 29898, 2914, 1839, 4882, 7464, 525, 11432, 1495, 13, 13, 4706, 396, 897, 11236, 403, 1404, 313, 6786, 29897, 3633, 13, 4706, 848, 29918, 29874, 353, 426, 13, 9651, 525, 6786, 2396, 525, 812, 347, 742, 13, 9651, 525, 1792, 2396, 525, 8222, 719, 742, 13, 9651, 525, 4882, 2396, 525, 2772, 11236, 403, 29915, 13, 4706, 500, 13, 4706, 2933, 353, 1583, 29889, 4645, 29889, 2490, 11219, 8697, 8948, 29914, 6538, 29914, 3167, 29899, 14242, 29899, 4882, 29914, 742, 848, 29922, 1272, 29918, 29874, 29892, 11592, 29922, 5574, 29897, 13, 4706, 1121, 353, 4390, 29889, 18132, 29898, 5327, 29889, 3051, 29897, 13, 4706, 1583, 29889, 9294, 14776, 29898, 5327, 29889, 4882, 29918, 401, 29892, 29871, 29906, 29900, 29900, 29897, 13, 4706, 1583, 29889, 9294, 14776, 29898, 2914, 1839, 4882, 7464, 525, 8949, 1495, 13, 13, 4706, 1404, 353, 4911, 29889, 12650, 29889, 657, 29898, 6786, 2433, 812, 347, 1495, 13, 4706, 1583, 29889, 9294, 8824, 29898, 1792, 29889, 275, 29918, 4925, 29897, 13, 13, 4706, 396, 9537, 440, 403, 1404, 313, 6786, 29897, 3633, 13, 4706, 848, 29918, 29890, 353, 426, 13, 9651, 525, 6786, 2396, 525, 812, 347, 742, 13, 9651, 525, 1792, 2396, 525, 8222, 719, 742, 13, 9651, 525, 4882, 2396, 525, 21786, 403, 29915, 13, 4706, 500, 13, 4706, 2933, 353, 1583, 29889, 4645, 29889, 2490, 11219, 8697, 8948, 29914, 6538, 29914, 3167, 29899, 14242, 29899, 4882, 29914, 742, 848, 29922, 1272, 29918, 29890, 29892, 11592, 29922, 5574, 29897, 13, 4706, 1121, 353, 4390, 29889, 18132, 29898, 5327, 29889, 3051, 29897, 13, 4706, 1583, 29889, 9294, 14776, 29898, 5327, 29889, 4882, 29918, 401, 29892, 29871, 29906, 29900, 29900, 29897, 13, 4706, 1583, 29889, 9294, 14776, 29898, 2914, 1839, 4882, 7464, 525, 8949, 1495, 13, 13, 4706, 1404, 353, 4911, 29889, 12650, 29889, 657, 29898, 6786, 2433, 812, 347, 1495, 13, 4706, 1583, 29889, 9294, 5574, 29898, 1792, 29889, 275, 29918, 4925, 29897, 13, 13, 1678, 9995, 13, 1678, 4321, 22329, 29918, 345, 29882, 4027, 1776, 29892, 883, 29892, 322, 9349, 5717, 13, 1678, 9995, 13, 1678, 822, 1243, 29918, 8697, 8948, 29918, 345, 29882, 4027, 29918, 1493, 29898, 1311, 1125, 13, 13, 4706, 1583, 29889, 4645, 353, 12477, 580, 13, 4706, 13817, 29918, 262, 353, 1583, 29889, 4645, 29889, 7507, 29898, 6786, 2433, 8222, 719, 742, 4800, 2433, 5630, 1495, 13, 4706, 1583, 29889, 9294, 14776, 29898, 1188, 3192, 29918, 262, 29892, 5852, 29897, 13, 13, 4706, 396, 3789, 786, 491, 2805, 3618, 363, 9117, 6611, 13, 4706, 19716, 29918, 1853, 353, 8980, 29882, 2512, 1542, 29889, 12650, 29889, 657, 29898, 1853, 2433, 29924, 327, 272, 5184, 1495, 13, 4706, 19716, 29918, 5675, 353, 8980, 29882, 2512, 9984, 29889, 12650, 29889, 657, 29898, 5675, 2433, 29911, 2593, 262, 1495, 13, 4706, 19716, 29918, 4299, 353, 8980, 29882, 2512, 3195, 29889, 12650, 29889, 657, 29898, 4299, 29918, 978, 2433, 2499, 1397, 307, 8406, 1495, 13, 4706, 20590, 29918, 1853, 353, 8980, 29882, 2512, 29925, 27574, 1542, 29889, 12650, 29889, 657, 29898, 29886, 27574, 29918, 1853, 2433, 29965, 8485, 29899, 25207, 1495, 13, 4706, 26470, 353, 12178, 4492, 2467, 29889, 12650, 29889, 657, 29898, 29879, 27685, 2467, 29918, 2248, 29922, 29945, 29897, 13, 4706, 19716, 29918, 4882, 353, 8980, 29882, 2512, 5709, 29889, 12650, 29889, 657, 29898, 345, 29882, 2512, 29918, 4882, 2433, 28213, 1495, 13, 13, 4706, 396, 3630, 304, 1653, 19716, 2407, 13, 4706, 848, 353, 426, 13, 9651, 525, 689, 29899, 29911, 2891, 1964, 29918, 22051, 4345, 2396, 525, 29906, 742, 13, 9651, 525, 689, 29899, 26019, 25758, 29918, 22051, 4345, 2396, 525, 29900, 742, 13, 9651, 525, 689, 29899, 12648, 29918, 13967, 29918, 22051, 4345, 2396, 15516, 13, 9651, 525, 689, 29899, 29900, 29899, 1853, 2396, 19716, 29918, 1853, 29892, 13, 9651, 525, 689, 29899, 29900, 29899, 5675, 2396, 19716, 29918, 5675, 29892, 13, 9651, 525, 689, 29899, 29900, 29899, 4299, 29918, 978, 2396, 19716, 29918, 4299, 29892, 13, 9651, 525, 689, 29899, 29900, 29899, 4299, 29918, 6360, 2396, 29871, 29906, 29900, 29900, 29953, 29892, 13, 9651, 525, 689, 29899, 29900, 29899, 29888, 2491, 2396, 525, 29928, 583, 295, 742, 13, 9651, 525, 689, 29899, 29900, 29899, 29886, 27574, 29918, 6360, 2396, 29871, 29906, 29900, 29896, 29945, 29892, 13, 9651, 525, 689, 29899, 29900, 29899, 29886, 27574, 29918, 9175, 2396, 29871, 29945, 29900, 29900, 29900, 29900, 29889, 29900, 29900, 29892, 13, 9651, 525, 689, 29899, 29900, 29899, 29886, 27574, 29918, 1853, 2396, 20590, 29918, 1853, 29892, 13, 9651, 525, 689, 29899, 29900, 29899, 4951, 749, 2396, 525, 29907, 1161, 742, 13, 9651, 525, 689, 29899, 29900, 29899, 29879, 27685, 2467, 2396, 26470, 29892, 13, 9651, 525, 689, 29899, 29900, 29899, 4882, 2396, 19716, 29918, 4882, 29892, 13, 9651, 525, 689, 29899, 29900, 29899, 29887, 650, 29918, 6360, 2396, 29871, 29900, 13, 4706, 500, 13, 13, 4706, 2933, 353, 1583, 29889, 4645, 29889, 2490, 29898, 24244, 877, 8697, 8948, 29901, 29885, 2365, 475, 29918, 345, 29882, 4027, 5477, 848, 29922, 1272, 29892, 11592, 29922, 5574, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 5327, 29889, 4882, 29918, 401, 29892, 29871, 29906, 29900, 29900, 29897, 13, 13, 1678, 822, 1243, 29918, 345, 29882, 2512, 29918, 689, 29918, 6310, 29898, 1311, 1125, 13, 13, 4706, 848, 353, 426, 13, 9651, 525, 1853, 2396, 29871, 29900, 29892, 13, 9651, 525, 5675, 2396, 29871, 29900, 29892, 13, 9651, 525, 4299, 29918, 978, 2396, 29871, 29900, 29892, 13, 9651, 525, 4299, 29918, 6360, 2396, 29871, 29900, 29892, 13, 9651, 525, 29888, 2491, 2396, 29871, 29900, 29892, 13, 9651, 525, 29886, 27574, 29918, 6360, 2396, 29871, 29900, 29892, 13, 9651, 525, 29886, 27574, 29918, 9175, 2396, 29871, 29900, 29892, 13, 9651, 525, 29886, 27574, 29918, 1853, 2396, 29871, 29900, 29892, 13, 9651, 525, 4951, 749, 2396, 29871, 29900, 29892, 13, 9651, 525, 29879, 27685, 2467, 2396, 29871, 29900, 29892, 13, 9651, 525, 4882, 2396, 29871, 29900, 29892, 13, 9651, 525, 29887, 650, 29918, 6360, 2396, 29871, 29900, 13, 4706, 500, 13, 4706, 883, 353, 8980, 29882, 2512, 2500, 29898, 1272, 29922, 1272, 29897, 13, 4706, 1583, 29889, 9294, 8824, 29898, 689, 29889, 275, 29918, 3084, 3101, 13, 13, 1678, 822, 1243, 29918, 345, 29882, 2512, 29918, 689, 29918, 12313, 29918, 4299, 29918, 6360, 29898, 1311, 1125, 13, 13, 4706, 848, 353, 426, 13, 9651, 525, 1853, 2396, 29871, 29896, 29892, 13, 9651, 525, 5675, 2396, 29871, 29896, 29892, 13, 9651, 525, 4299, 29918, 978, 2396, 29871, 29896, 29892, 13, 9651, 525, 4299, 29918, 6360, 2396, 29871, 29896, 29947, 29900, 29900, 29892, 13, 9651, 525, 29888, 2491, 2396, 29871, 29896, 29892, 13, 9651, 525, 29886, 27574, 29918, 6360, 2396, 29871, 29906, 29900, 29896, 29953, 29892, 13, 9651, 525, 29886, 27574, 29918, 9175, 2396, 29871, 29945, 29900, 29889, 29900, 29900, 29892, 13, 9651, 525, 29886, 27574, 29918, 1853, 2396, 29871, 29896, 29892, 13, 9651, 525, 4951, 749, 2396, 29871, 29896, 29892, 13, 9651, 525, 29879, 27685, 2467, 2396, 29871, 29896, 29892, 13, 9651, 525, 4882, 2396, 29871, 29896, 29892, 13, 9651, 525, 29887, 650, 29918, 6360, 2396, 29871, 29900, 13, 4706, 500, 13, 4706, 883, 353, 8980, 29882, 2512, 2500, 29898, 1272, 29922, 1272, 29897, 13, 4706, 1583, 29889, 9294, 8824, 29898, 689, 29889, 275, 29918, 3084, 3101, 13, 13, 4706, 848, 1839, 4299, 29918, 6360, 2033, 353, 29871, 29906, 29900, 29947, 29900, 13, 4706, 883, 353, 8980, 29882, 2512, 2500, 29898, 1272, 29922, 1272, 29897, 13, 4706, 1583, 29889, 9294, 8824, 29898, 689, 29889, 275, 29918, 3084, 3101, 13, 13, 1678, 822, 1243, 29918, 345, 29882, 2512, 29918, 689, 29918, 12313, 29918, 29886, 27574, 29918, 6360, 29898, 1311, 1125, 13, 13, 4706, 848, 353, 426, 13, 9651, 525, 1853, 2396, 29871, 29896, 29892, 13, 9651, 525, 5675, 2396, 29871, 29896, 29892, 13, 9651, 525, 4299, 29918, 978, 2396, 29871, 29896, 29892, 13, 9651, 525, 4299, 29918, 6360, 2396, 29871, 29906, 29900, 29896, 29953, 29892, 13, 9651, 525, 29888, 2491, 2396, 29871, 29896, 29892, 13, 9651, 525, 29886, 27574, 29918, 6360, 2396, 29871, 29896, 29929, 29900, 29900, 29892, 29871, 396, 529, 489, 2086, 2215, 297, 278, 4940, 13, 9651, 525, 29886, 27574, 29918, 9175, 2396, 29871, 29945, 29900, 29889, 29900, 29900, 29892, 13, 9651, 525, 29886, 27574, 29918, 1853, 2396, 29871, 29896, 29892, 13, 9651, 525, 4951, 749, 2396, 29871, 29896, 29892, 13, 9651, 525, 29879, 27685, 2467, 2396, 29871, 29896, 29892, 13, 9651, 525, 4882, 2396, 29871, 29896, 29892, 13, 9651, 525, 29887, 650, 29918, 6360, 2396, 29871, 29900, 13, 4706, 500, 13, 4706, 883, 353, 8980, 29882, 2512, 2500, 29898, 1272, 29922, 1272, 29897, 13, 4706, 1583, 29889, 9294, 8824, 29898, 689, 29889, 275, 29918, 3084, 3101, 13, 13, 4706, 848, 1839, 29886, 27574, 29918, 6360, 2033, 353, 29871, 29906, 29900, 29947, 29900, 29871, 396, 529, 489, 2086, 2215, 964, 278, 5434, 13, 4706, 883, 353, 8980, 29882, 2512, 2500, 29898, 1272, 29922, 1272, 29897, 13, 4706, 1583, 29889, 9294, 8824, 29898, 689, 29889, 275, 29918, 3084, 3101, 13, 13, 1678, 822, 1243, 29918, 345, 29882, 2512, 29918, 689, 29918, 12313, 29918, 29886, 27574, 29918, 9175, 29898, 1311, 1125, 13, 13, 4706, 848, 353, 426, 13, 9651, 525, 1853, 2396, 29871, 29896, 29892, 13, 9651, 525, 5675, 2396, 29871, 29896, 29892, 13, 9651, 525, 4299, 29918, 978, 2396, 29871, 29896, 29892, 13, 9651, 525, 4299, 29918, 6360, 2396, 29871, 29906, 29900, 29896, 29953, 29892, 13, 9651, 525, 29888, 2491, 2396, 29871, 29896, 29892, 13, 9651, 525, 29886, 27574, 29918, 6360, 2396, 29871, 29906, 29900, 29896, 29953, 29892, 13, 9651, 525, 29886, 27574, 29918, 9175, 2396, 869, 29929, 29929, 29892, 13, 9651, 525, 29886, 27574, 29918, 1853, 2396, 29871, 29896, 29892, 13, 9651, 525, 4951, 749, 2396, 29871, 29896, 29892, 13, 9651, 525, 29879, 27685, 2467, 2396, 29871, 29896, 29892, 13, 9651, 525, 4882, 2396, 29871, 29896, 29892, 13, 9651, 525, 29887, 650, 29918, 6360, 2396, 29871, 29900, 13, 4706, 500, 13, 4706, 883, 353, 8980, 29882, 2512, 2500, 29898, 1272, 29922, 1272, 29897, 13, 4706, 1583, 29889, 9294, 8824, 29898, 689, 29889, 275, 29918, 3084, 3101, 13, 13, 1678, 822, 1243, 29918, 345, 29882, 2512, 29918, 689, 29918, 29887, 650, 29918, 6360, 29918, 262, 29918, 29888, 9130, 29898, 1311, 1125, 13, 13, 4706, 848, 353, 426, 13, 9651, 525, 1853, 2396, 29871, 29896, 29892, 13, 9651, 525, 5675, 2396, 29871, 29896, 29892, 13, 9651, 525, 4299, 29918, 978, 2396, 29871, 29896, 29892, 13, 9651, 525, 4299, 29918, 6360, 2396, 29871, 29906, 29900, 29896, 29906, 29892, 13, 9651, 525, 29888, 2491, 2396, 29871, 29896, 29892, 13, 9651, 525, 29886, 27574, 29918, 6360, 2396, 29871, 29906, 29900, 29896, 29946, 29892, 13, 9651, 525, 29886, 27574, 29918, 9175, 2396, 29871, 29945, 29900, 29900, 29900, 29900, 29889, 29900, 29900, 29892, 13, 9651, 525, 29886, 27574, 29918, 1853, 2396, 29871, 29896, 29892, 13, 9651, 525, 4951, 749, 2396, 29871, 29896, 29892, 13, 9651, 525, 29879, 27685, 2467, 2396, 29871, 29896, 29892, 13, 9651, 525, 4882, 2396, 29871, 29896, 29892, 13, 9651, 525, 29887, 650, 29918, 6360, 2396, 29871, 29906, 29900, 29947, 29900, 13, 4706, 500, 13, 4706, 883, 353, 8980, 29882, 2512, 2500, 29898, 1272, 29922, 1272, 29897, 13, 4706, 1583, 29889, 9294, 8824, 29898, 689, 29889, 275, 29918, 3084, 3101, 13, 13, 1678, 822, 1243, 29918, 345, 29882, 2512, 29918, 689, 29918, 3084, 29898, 1311, 1125, 13, 13, 4706, 848, 353, 426, 13, 9651, 525, 1853, 2396, 29871, 29896, 29892, 13, 9651, 525, 5675, 2396, 29871, 29896, 29892, 13, 9651, 525, 4299, 29918, 978, 2396, 29871, 29896, 29892, 13, 9651, 525, 4299, 29918, 6360, 2396, 29871, 29906, 29900, 29896, 29906, 29892, 13, 9651, 525, 29888, 2491, 2396, 29871, 29896, 29892, 13, 9651, 525, 29886, 27574, 29918, 6360, 2396, 29871, 29906, 29900, 29896, 29946, 29892, 13, 9651, 525, 29886, 27574, 29918, 9175, 2396, 29871, 29945, 29900, 29900, 29900, 29900, 29889, 29900, 29900, 29892, 13, 9651, 525, 29886, 27574, 29918, 1853, 2396, 29871, 29896, 29892, 13, 9651, 525, 4951, 749, 2396, 29871, 29896, 29892, 13, 9651, 525, 29879, 27685, 2467, 2396, 29871, 29896, 29892, 13, 9651, 525, 4882, 2396, 29871, 29896, 29892, 13, 9651, 525, 29887, 650, 29918, 6360, 2396, 29871, 29900, 13, 4706, 500, 13, 4706, 883, 353, 8980, 29882, 2512, 2500, 29898, 1272, 29922, 1272, 29897, 13, 4706, 1583, 29889, 9294, 5574, 29898, 689, 29889, 275, 29918, 3084, 3101, 13, 13, 1678, 822, 1243, 29918, 6538, 29918, 29885, 6926, 29918, 1609, 29918, 1853, 29898, 1311, 1125, 13, 13, 4706, 19716, 29918, 1853, 353, 8980, 29882, 2512, 1542, 29889, 12650, 29889, 657, 29898, 1853, 2433, 29924, 327, 272, 5184, 1495, 13, 13, 4706, 2933, 353, 1583, 29889, 4645, 29889, 657, 11219, 8697, 8948, 29914, 6538, 29914, 29885, 6926, 29899, 1609, 29899, 1853, 22208, 718, 851, 29898, 345, 29882, 2512, 29918, 1853, 29889, 20571, 29897, 718, 8207, 742, 11592, 29922, 5574, 29897, 13, 4706, 1121, 353, 4390, 29889, 18132, 29898, 5327, 29889, 3051, 29897, 13, 13, 4706, 1207, 353, 8980, 29882, 2512, 9984, 29889, 12650, 29889, 4572, 29898, 4572, 29922, 345, 29882, 2512, 29918, 1853, 29889, 4572, 9601, 29900, 29962, 13, 4706, 1583, 29889, 9294, 5574, 29898, 710, 29898, 5675, 29889, 20571, 29897, 297, 1121, 29897, 13, 13, 1678, 822, 1243, 29918, 6538, 29918, 9794, 29918, 1609, 29918, 5675, 29898, 1311, 1125, 13, 13, 4706, 19716, 29918, 5675, 353, 8980, 29882, 2512, 9984, 29889, 12650, 29889, 657, 29898, 5675, 2433, 29911, 2593, 262, 1495, 13, 13, 4706, 2933, 353, 1583, 29889, 4645, 29889, 657, 11219, 8697, 8948, 29914, 6538, 29914, 9794, 29899, 1609, 29899, 5675, 22208, 718, 851, 29898, 345, 29882, 2512, 29918, 5675, 29889, 20571, 29897, 718, 8207, 742, 11592, 29922, 5574, 29897, 13, 4706, 1121, 353, 4390, 29889, 18132, 29898, 5327, 29889, 3051, 29897, 13, 13, 4706, 1904, 353, 8980, 29882, 2512, 3195, 29889, 12650, 29889, 4572, 29898, 5675, 29922, 345, 29882, 2512, 29918, 5675, 9601, 29900, 29962, 13, 4706, 1583, 29889, 9294, 5574, 29898, 710, 29898, 4299, 29889, 20571, 29897, 297, 1121, 29897, 13, 13, 1678, 822, 1243, 29918, 6538, 29918, 1202, 29918, 5675, 29898, 1311, 1125, 13, 13, 4706, 1583, 29889, 4645, 353, 12477, 580, 13, 4706, 13817, 29918, 262, 353, 1583, 29889, 4645, 29889, 7507, 29898, 6786, 2433, 8222, 719, 742, 4800, 2433, 5630, 1495, 13, 4706, 1583, 29889, 9294, 14776, 29898, 1188, 3192, 29918, 262, 29892, 5852, 29897, 13, 13, 4706, 19716, 29918, 1853, 353, 8980, 29882, 2512, 1542, 29889, 12650, 29889, 657, 29898, 1853, 2433, 29924, 327, 272, 5184, 1495, 13, 4706, 2933, 353, 1583, 29889, 4645, 29889, 2490, 11219, 8697, 8948, 29914, 6538, 29914, 1202, 29899, 5675, 22208, 718, 851, 29898, 345, 29882, 2512, 29918, 1853, 29889, 20571, 29897, 718, 8207, 29967, 388, 7967, 29914, 742, 11592, 29922, 5574, 29897, 13, 4706, 1121, 353, 4390, 29889, 18132, 29898, 5327, 29889, 3051, 29897, 13, 13, 4706, 1583, 29889, 9294, 14776, 29898, 2914, 1839, 4882, 7464, 525, 8949, 1495, 13, 13, 4706, 1207, 353, 8980, 29882, 2512, 9984, 29889, 12650, 29889, 657, 29898, 20571, 29922, 2914, 1839, 1989, 11287, 13, 4706, 1583, 29889, 9294, 14776, 29898, 5675, 29889, 5675, 29892, 525, 29967, 388, 1111, 1495, 13, 13, 1678, 822, 1243, 29918, 6538, 29918, 1202, 29918, 4299, 29898, 1311, 1125, 13, 13, 4706, 1583, 29889, 4645, 353, 12477, 580, 13, 4706, 13817, 29918, 262, 353, 1583, 29889, 4645, 29889, 7507, 29898, 6786, 2433, 8222, 719, 742, 4800, 2433, 5630, 1495, 13, 4706, 1583, 29889, 9294, 14776, 29898, 1188, 3192, 29918, 262, 29892, 5852, 29897, 13, 13, 4706, 1207, 353, 8980, 29882, 2512, 9984, 29889, 12650, 29889, 657, 29898, 5675, 2433, 29911, 2593, 262, 1495, 13, 4706, 2933, 353, 1583, 29889, 4645, 29889, 2490, 11219, 8697, 8948, 29914, 6538, 29914, 1202, 29899, 4299, 22208, 718, 851, 29898, 5675, 29889, 20571, 29897, 718, 8207, 29925, 2350, 20666, 29914, 742, 11592, 29922, 5574, 29897, 13, 4706, 1121, 353, 4390, 29889, 18132, 29898, 5327, 29889, 3051, 29897, 13, 13, 4706, 1583, 29889, 9294, 14776, 29898, 2914, 1839, 4882, 7464, 525, 8949, 1495, 13, 13, 4706, 19716, 29918, 4299, 353, 8980, 29882, 2512, 3195, 29889, 12650, 29889, 657, 29898, 20571, 29922, 2914, 1839, 1989, 11287, 13, 4706, 1583, 29889, 9294, 14776, 29898, 345, 29882, 2512, 29918, 4299, 29889, 4299, 29918, 978, 29892, 525, 29925, 2350, 20666, 1495, 13, 2 ]
Language Proficiency (Python)/ginortS.py
Muntaha-Islam0019/HackerRank-Solutions
0
194929
<reponame>Muntaha-Islam0019/HackerRank-Solutions import string print(*sorted(input(), key=(string.ascii_letters + '1357902468').index), sep='')
[ 1, 529, 276, 1112, 420, 29958, 29924, 1657, 25613, 29899, 29902, 2536, 314, 29900, 29900, 29896, 29929, 29914, 29950, 28940, 29934, 804, 29899, 13296, 17925, 13, 5215, 1347, 13, 2158, 10456, 24582, 29898, 2080, 3285, 1820, 7607, 1807, 29889, 294, 18869, 29918, 1026, 2153, 718, 525, 29896, 29941, 29945, 29955, 29929, 29900, 29906, 29946, 29953, 29947, 2824, 2248, 511, 16345, 2433, 1495, 13, 2 ]
mingus/core/views.py
brixtonasias/sk-mingus
1
79133
from django.utils import simplejson from django.http import HttpResponse from django.shortcuts import get_object_or_404 from basic.blog.models import Post, Category from django.conf import settings from django import http from django.template import loader, Context from django_proxy.models import Proxy from django.views.generic import list_detail from basic.blog.models import Settings from view_cache_utils import cache_page_with_prefix from contact_form.views import contact_form as django_contact_form from contact_form.forms import ContactForm from honeypot.decorators import check_honeypot from tagging.models import Tag, TaggedItem from django.shortcuts import render_to_response from django.template import RequestContext import re from django.db.models import Q def page_key_prefix(request): '''Used by cache_page_with_prefix to create a cache key prefix.''' return request.GET.get('page','') def build_url(domainname): '''Given a domain name (ex mywebsite.com) it returns the full url.''' return 'http://%s' % domainname def post_result_item(post): '''Generates the item result object for django-springsteen integration.''' return { 'title': post.title, 'url': build_url(Settings.get_current().site.domain) + post.get_absolute_url(), 'text': post.body, } def springsteen_results(request): ''' Creates the django-springsteen compliant JSON results for only for findjango integration. Results: Published Post objects. ''' results = [ post_result_item(item) for item in Post.objects.published()[:50] ] response_dict = { 'total_results': Post.objects.published().count(), 'results': results, } return HttpResponse(simplejson.dumps(response_dict), mimetype='application/javascript') def server_error(request, template_name='500.html'): '''Handles displaying 500 server error page along with application MEDIA.''' t = loader.get_template(template_name) blog_settings = Settings.get_current() return http.HttpResponseServerError(t.render(Context({ "MEDIA_URL": settings.MEDIA_URL, "STATIC_URL": settings.STATIC_URL, "BLOG_SETTINGS": blog_settings, }))) def springsteen_firehose(request): ''' Generates django-springsteen compliant JSON results of proxy models for findjango integration. ''' def result_item(proxy): '''Generates the item result object.''' if proxy.content_type.name == 'bookmark': url = proxy.content_object.get_absolute_url() else: url = build_url(Settings.get_current().site.domain) + proxy.content_object.get_absolute_url() return { 'title': proxy.title, 'url': url, 'text': proxy.description, } posts = Proxy.objects.published().order_by('-pub_date')[:50] results = [ result_item(item) for item in posts ] response_dict = { 'total_results': Proxy.objects.published().count(), 'results': results, } return HttpResponse(simplejson.dumps(response_dict), mimetype='application/javascript') def springsteen_category(request, slug): ''' Creates the django-springsteen compliant JSON results for only for findjango integration. Results: Published Post objects by category. ''' category = get_object_or_404(Category, slug__iexact=slug) posts = category.post_set.published()[:50] results = [ post_result_item(item) for item in posts ] response_dict = { 'total_results': category.post_set.published().count(), 'results': results, } return HttpResponse(simplejson.dumps(response_dict), mimetype='application/javascript') @cache_page_with_prefix(60, page_key_prefix) def home_list(request, page=0, template_name='proxy/proxy_list.html', **kwargs): ''' Homepage. Template: ``proxy/proxy_list.html`` Context: object_list Aggregated list of Proxy instances (post, quote, bookmark). ''' posts = Proxy.objects.published().order_by('-pub_date') pagesize = Settings.get_current().page_size or 20 return list_detail.object_list( request, queryset = posts, paginate_by = pagesize, page = page, template_name = template_name, **kwargs ) def quote_list(request, template_name='quotes/quote_list.html', **kwargs): ''' A basic cxample of overriding a reusable apps view to customize. Displays quote list view. No paging added, but can be on your own. ''' from quoteme.views import quote_list favorite_jazz_album = getattr(settings, 'FAVORITE_JAZZ_ALBUM', 'Money Jungle') extra = { 'favorite_jazz_album': favorite_jazz_album, } return quote_list(request, template_name=template_name, extra_context=extra, **kwargs) def quote_detail(request, template_name='quotes/quote_detail.html', **kwargs): ''' A basic cxample of overriding a reusable apps view to customize. Displays quote detail view. ''' from quoteme.views import quote_detail favorite_food = getattr(settings, 'FAVORITE_FOOD', 'Pizza') extra = { 'favorite_food': favorite_food, } return quote_detail(request, template_name=template_name, extra_context=extra, **kwargs) def oops(request): '''An view that exists soley to provide an example of using django-db-log.''' foo = 1/0 def tag_detail(request, slug, template_name='proxy/tag_detail.html', **kwargs): ''' Display objects for all content types supported: Post and Quotes.''' tag = get_object_or_404(Tag, name__iexact=slug) #below could be prettier results = [] qs = Proxy.objects.published().filter(tags__icontains=tag.name).order_by('-pub_date') for item in qs: comma_delimited = (',' in item.tags) if comma_delimited: for t in item.tags.split(','): if t.strip(' ') == tag.name: results.append(item) else: for t in item.tags.split(' '): if t.strip(' ') == tag.name: results.append(item) return render_to_response(template_name, {'tag': tag, 'object_list': results}, context_instance=RequestContext(request), ) @check_honeypot def contact_form(request, form_class=ContactForm, template_name='contact_form/contact_form.html'): ''' Handles the contact form view. Leverages django-contact-form. This is an example of overriding another reusable apps view. This particular view also contains a form. For this example we are just doing the basic implementation by wrapping the view function and simply passing the arguments along. This view is also leveraging another reusable app, django-honeypot. The decorator you see being applied is used to protect your app from spam. ''' return django_contact_form(request, form_class=form_class, template_name=template_name) # Stop Words courtesy of http://www.dcs.gla.ac.uk/idom/ir_resources/linguistic_utils/stop_words STOP_WORDS = r"""\b(a|about|above|across|after|afterwards|again|against|all|almost|alone|along|already|also| although|always|am|among|amongst|amoungst|amount|an|and|another|any|anyhow|anyone|anything|anyway|anywhere|are| around|as|at|back|be|became|because|become|becomes|becoming|been|before|beforehand|behind|being|below|beside| besides|between|beyond|bill|both|bottom|but|by|call|can|cannot|cant|co|computer|con|could|couldnt|cry|de|describe| detail|do|done|down|due|during|each|eg|eight|either|eleven|else|elsewhere|empty|enough|etc|even|ever|every|everyone| everything|everywhere|except|few|fifteen|fify|fill|find|fire|first|five|for|former|formerly|forty|found|four|from| front|full|further|get|give|go|had|has|hasnt|have|he|hence|her|here|hereafter|hereby|herein|hereupon|hers|herself| him|himself|his|how|however|hundred|i|ie|if|in|inc|indeed|interest|into|is|it|its|itself|keep|last|latter|latterly| least|less|ltd|made|many|may|me|meanwhile|might|mill|mine|more|moreover|most|mostly|move|much|must|my|myself|name| namely|neither|never|nevertheless|next|nine|no|nobody|none|noone|nor|not|nothing|now|nowhere|of|off|often|on|once| one|only|onto|or|other|others|otherwise|our|ours|ourselves|out|over|own|part|per|perhaps|please|put|rather|re|same| see|seem|seemed|seeming|seems|serious|several|she|should|show|side|since|sincere|six|sixty|so|some|somehow|someone| something|sometime|sometimes|somewhere|still|such|system|take|ten|than|that|the|their|them|themselves|then|thence| there|thereafter|thereby|therefore|therein|thereupon|these|they|thick|thin|third|this|those|though|three|through| throughout|thru|thus|to|together|too|top|toward|towards|twelve|twenty|two|un|under|until|up|upon|us|very|via|was| we|well|were|what|whatever|when|whence|whenever|where|whereafter|whereas|whereby|wherein|whereupon|wherever|whether| which|while|whither|who|whoever|whole|whom|whose|why|will|with|within|without|would|yet|you|your|yours|yourself| yourselves)\b""" def proxy_search(request, template_name='proxy/proxy_search.html'): """ Search for proxy objects. 99.99 percent borrowed from basic-blog's search. This template will allow you to setup a simple search form that will try to return results based on given search strings. The queries will be put through a stop words filter to remove words like 'the', 'a', or 'have' to help imporve the result set. Template: ``proxy/proxy_search.html`` Context: object_list List of blog posts that match given search term(s). search_term Given search term. """ context = {} if request.GET: stop_word_list = re.compile(STOP_WORDS, re.IGNORECASE) search_term = '%s' % request.GET['q'] cleaned_search_term = stop_word_list.sub('', search_term) cleaned_search_term = cleaned_search_term.strip() if len(cleaned_search_term) != 0: post_list = Proxy.objects.filter(Q(title__icontains=cleaned_search_term) | Q(tags__icontains=cleaned_search_term) | Q(description__icontains=cleaned_search_term)).order_by('-pub_date') context = {'object_list': post_list, 'search_term':search_term} else: message = 'Search term was too vague. Please try again.' context = {'message':message} return render_to_response(template_name, context, context_instance=RequestContext(request))
[ 1, 515, 9557, 29889, 13239, 1053, 2560, 3126, 13, 3166, 9557, 29889, 1124, 1053, 9056, 5103, 13, 3166, 9557, 29889, 12759, 7582, 29879, 1053, 679, 29918, 3318, 29918, 272, 29918, 29946, 29900, 29946, 13, 3166, 6996, 29889, 7312, 29889, 9794, 1053, 4918, 29892, 17943, 13, 3166, 9557, 29889, 5527, 1053, 6055, 13, 3166, 9557, 1053, 1732, 13, 3166, 9557, 29889, 6886, 1053, 23466, 29892, 15228, 13, 3166, 9557, 29918, 14701, 29889, 9794, 1053, 1019, 3594, 13, 3166, 9557, 29889, 7406, 29889, 19206, 1053, 1051, 29918, 16432, 13, 3166, 6996, 29889, 7312, 29889, 9794, 1053, 19215, 13, 3166, 1776, 29918, 8173, 29918, 13239, 1053, 7090, 29918, 3488, 29918, 2541, 29918, 13506, 13, 3166, 6958, 29918, 689, 29889, 7406, 1053, 6958, 29918, 689, 408, 9557, 29918, 12346, 29918, 689, 13, 3166, 6958, 29918, 689, 29889, 9514, 1053, 22387, 2500, 13, 3166, 298, 650, 1478, 327, 29889, 19557, 4097, 1053, 1423, 29918, 29882, 650, 1478, 327, 13, 3166, 4055, 3460, 29889, 9794, 1053, 10522, 29892, 10522, 3192, 2001, 13, 3166, 9557, 29889, 12759, 7582, 29879, 1053, 4050, 29918, 517, 29918, 5327, 13, 3166, 9557, 29889, 6886, 1053, 10729, 2677, 13, 5215, 337, 13, 3166, 9557, 29889, 2585, 29889, 9794, 1053, 660, 13, 13, 1753, 1813, 29918, 1989, 29918, 13506, 29898, 3827, 1125, 13, 1678, 14550, 29965, 8485, 491, 7090, 29918, 3488, 29918, 2541, 29918, 13506, 304, 1653, 263, 7090, 1820, 10944, 29889, 12008, 13, 1678, 736, 2009, 29889, 7194, 29889, 657, 877, 3488, 3788, 1495, 13, 13, 13, 1753, 2048, 29918, 2271, 29898, 7247, 978, 1125, 13, 1678, 14550, 29954, 5428, 263, 5354, 1024, 313, 735, 590, 22942, 29889, 510, 29897, 372, 3639, 278, 2989, 3142, 29889, 12008, 13, 1678, 736, 525, 1124, 597, 29995, 29879, 29915, 1273, 5354, 978, 13, 13, 13, 1753, 1400, 29918, 2914, 29918, 667, 29898, 2490, 1125, 13, 1678, 14550, 5631, 1078, 278, 2944, 1121, 1203, 363, 9557, 29899, 4278, 1655, 264, 13465, 29889, 12008, 13, 1678, 736, 426, 13, 4706, 525, 3257, 2396, 1400, 29889, 3257, 29892, 13, 4706, 525, 2271, 2396, 2048, 29918, 2271, 29898, 9585, 29889, 657, 29918, 3784, 2141, 2746, 29889, 7247, 29897, 718, 1400, 29889, 657, 29918, 23552, 29918, 2271, 3285, 13, 4706, 525, 726, 2396, 1400, 29889, 2587, 29892, 13, 4706, 500, 13, 13, 1753, 6709, 1655, 264, 29918, 9902, 29898, 3827, 1125, 13, 1678, 14550, 13, 1678, 6760, 1078, 278, 9557, 29899, 4278, 1655, 264, 752, 492, 424, 4663, 2582, 363, 871, 363, 1284, 5364, 13, 1678, 13465, 29889, 13, 13, 1678, 17212, 29901, 13, 4706, 8042, 3726, 4918, 3618, 29889, 13, 1678, 14550, 13, 13, 1678, 2582, 353, 518, 1400, 29918, 2914, 29918, 667, 29898, 667, 29897, 363, 2944, 297, 4918, 29889, 12650, 29889, 5467, 3726, 580, 7503, 29945, 29900, 29962, 4514, 13, 1678, 2933, 29918, 8977, 353, 426, 525, 7827, 29918, 9902, 2396, 4918, 29889, 12650, 29889, 5467, 3726, 2141, 2798, 3285, 13, 462, 1678, 525, 9902, 2396, 2582, 29892, 500, 13, 1678, 736, 9056, 5103, 29898, 12857, 3126, 29889, 29881, 17204, 29898, 5327, 29918, 8977, 511, 286, 17528, 668, 2433, 6214, 29914, 7729, 1495, 13, 13, 13, 1753, 1923, 29918, 2704, 29898, 3827, 29892, 4472, 29918, 978, 2433, 29945, 29900, 29900, 29889, 1420, 29374, 13, 1678, 14550, 3481, 793, 16384, 29871, 29945, 29900, 29900, 1923, 1059, 1813, 3412, 411, 2280, 341, 3352, 10764, 29889, 12008, 13, 13, 1678, 260, 353, 23466, 29889, 657, 29918, 6886, 29898, 6886, 29918, 978, 29897, 13, 1678, 12618, 29918, 11027, 353, 19215, 29889, 657, 29918, 3784, 580, 13, 13, 1678, 736, 1732, 29889, 5506, 5103, 6004, 2392, 29898, 29873, 29889, 9482, 29898, 2677, 3319, 13, 4706, 376, 2303, 4571, 29909, 29918, 4219, 1115, 6055, 29889, 2303, 4571, 29909, 29918, 4219, 29892, 13, 4706, 376, 17816, 2965, 29918, 4219, 1115, 6055, 29889, 17816, 2965, 29918, 4219, 29892, 13, 4706, 376, 29933, 14480, 29918, 10490, 29911, 4214, 29903, 1115, 12618, 29918, 11027, 29892, 13, 1678, 500, 4961, 13, 13, 1753, 6709, 1655, 264, 29918, 8696, 29882, 852, 29898, 3827, 1125, 13, 1678, 14550, 13, 1678, 3251, 1078, 9557, 29899, 4278, 1655, 264, 752, 492, 424, 4663, 2582, 310, 10166, 4733, 363, 13, 1678, 1284, 5364, 13465, 29889, 13, 13, 1678, 14550, 13, 13, 1678, 822, 1121, 29918, 667, 29898, 14701, 1125, 13, 4706, 14550, 5631, 1078, 278, 2944, 1121, 1203, 29889, 12008, 13, 13, 4706, 565, 10166, 29889, 3051, 29918, 1853, 29889, 978, 1275, 525, 2909, 3502, 2396, 13, 9651, 3142, 353, 10166, 29889, 3051, 29918, 3318, 29889, 657, 29918, 23552, 29918, 2271, 580, 13, 4706, 1683, 29901, 13, 9651, 3142, 353, 2048, 29918, 2271, 29898, 9585, 29889, 657, 29918, 3784, 2141, 2746, 29889, 7247, 29897, 718, 10166, 29889, 3051, 29918, 3318, 29889, 657, 29918, 23552, 29918, 2271, 580, 13, 13, 4706, 736, 426, 13, 9651, 525, 3257, 2396, 10166, 29889, 3257, 29892, 13, 9651, 525, 2271, 2396, 3142, 29892, 13, 9651, 525, 726, 2396, 10166, 29889, 8216, 29892, 13, 9651, 500, 13, 13, 1678, 11803, 353, 1019, 3594, 29889, 12650, 29889, 5467, 3726, 2141, 2098, 29918, 1609, 877, 29899, 5467, 29918, 1256, 1495, 7503, 29945, 29900, 29962, 13, 1678, 2582, 353, 518, 1121, 29918, 667, 29898, 667, 29897, 363, 2944, 297, 11803, 4514, 13, 1678, 2933, 29918, 8977, 353, 426, 525, 7827, 29918, 9902, 2396, 1019, 3594, 29889, 12650, 29889, 5467, 3726, 2141, 2798, 3285, 13, 462, 1678, 525, 9902, 2396, 2582, 29892, 500, 13, 1678, 736, 9056, 5103, 29898, 12857, 3126, 29889, 29881, 17204, 29898, 5327, 29918, 8977, 511, 286, 17528, 668, 2433, 6214, 29914, 7729, 1495, 13, 13, 1753, 6709, 1655, 264, 29918, 7320, 29898, 3827, 29892, 2243, 688, 1125, 13, 1678, 14550, 13, 1678, 6760, 1078, 278, 9557, 29899, 4278, 1655, 264, 752, 492, 424, 4663, 2582, 363, 871, 363, 13, 1678, 1284, 5364, 13465, 29889, 13, 13, 1678, 17212, 29901, 13, 4706, 8042, 3726, 4918, 3618, 491, 7663, 29889, 13, 1678, 14550, 13, 13, 1678, 7663, 353, 679, 29918, 3318, 29918, 272, 29918, 29946, 29900, 29946, 29898, 10900, 29892, 2243, 688, 1649, 347, 29916, 627, 29922, 29517, 29897, 13, 1678, 11803, 353, 7663, 29889, 2490, 29918, 842, 29889, 5467, 3726, 580, 7503, 29945, 29900, 29962, 13, 1678, 2582, 353, 518, 1400, 29918, 2914, 29918, 667, 29898, 667, 29897, 363, 2944, 297, 11803, 4514, 13, 1678, 2933, 29918, 8977, 353, 426, 525, 7827, 29918, 9902, 2396, 7663, 29889, 2490, 29918, 842, 29889, 5467, 3726, 2141, 2798, 3285, 13, 462, 1678, 525, 9902, 2396, 2582, 29892, 500, 13, 1678, 736, 9056, 5103, 29898, 12857, 3126, 29889, 29881, 17204, 29898, 5327, 29918, 8977, 511, 13, 462, 4706, 286, 17528, 668, 2433, 6214, 29914, 7729, 1495, 13, 13, 13, 29992, 8173, 29918, 3488, 29918, 2541, 29918, 13506, 29898, 29953, 29900, 29892, 1813, 29918, 1989, 29918, 13506, 29897, 13, 1753, 3271, 29918, 1761, 29898, 3827, 29892, 1813, 29922, 29900, 29892, 4472, 29918, 978, 2433, 14701, 29914, 14701, 29918, 1761, 29889, 1420, 742, 3579, 19290, 1125, 13, 1678, 14550, 13, 1678, 8778, 3488, 29889, 13, 13, 1678, 25663, 29901, 4954, 14701, 29914, 14701, 29918, 1761, 29889, 1420, 16159, 13, 1678, 15228, 29901, 13, 4706, 1203, 29918, 1761, 13, 9651, 319, 26127, 630, 1051, 310, 1019, 3594, 8871, 313, 2490, 29892, 14978, 29892, 3143, 3502, 467, 13, 13, 1678, 14550, 13, 13, 1678, 11803, 353, 1019, 3594, 29889, 12650, 29889, 5467, 3726, 2141, 2098, 29918, 1609, 877, 29899, 5467, 29918, 1256, 1495, 13, 1678, 6515, 675, 353, 19215, 29889, 657, 29918, 3784, 2141, 3488, 29918, 2311, 470, 29871, 29906, 29900, 13, 13, 1678, 736, 1051, 29918, 16432, 29889, 3318, 29918, 1761, 29898, 13, 4706, 2009, 29892, 13, 4706, 2346, 842, 353, 11803, 29892, 13, 4706, 10203, 16976, 29918, 1609, 353, 6515, 675, 29892, 13, 4706, 1813, 353, 1813, 29892, 13, 4706, 4472, 29918, 978, 353, 4472, 29918, 978, 29892, 13, 4706, 3579, 19290, 13, 1678, 1723, 13, 13, 13, 1753, 14978, 29918, 1761, 29898, 3827, 29892, 4472, 29918, 978, 2433, 339, 4769, 29914, 1396, 29918, 1761, 29889, 1420, 742, 3579, 19290, 1125, 13, 1678, 14550, 13, 1678, 319, 6996, 28232, 981, 310, 20831, 292, 263, 337, 27979, 11446, 1776, 304, 2888, 675, 29889, 13, 13, 1678, 3295, 12922, 14978, 1051, 1776, 29889, 1939, 282, 6751, 2715, 29892, 541, 508, 367, 373, 596, 1914, 29889, 13, 1678, 14550, 13, 13, 1678, 515, 13911, 2004, 29889, 7406, 1053, 14978, 29918, 1761, 13, 1678, 25448, 29918, 29926, 7511, 29918, 10336, 353, 679, 5552, 29898, 11027, 29892, 525, 4519, 29963, 1955, 9094, 29918, 29967, 29909, 29999, 29999, 29918, 1964, 29933, 5005, 742, 525, 29924, 4992, 20260, 280, 1495, 13, 1678, 4805, 353, 426, 13, 4706, 525, 29888, 17118, 568, 29918, 29926, 7511, 29918, 10336, 2396, 25448, 29918, 29926, 7511, 29918, 10336, 29892, 13, 1678, 500, 13, 13, 1678, 736, 14978, 29918, 1761, 29898, 3827, 29892, 4472, 29918, 978, 29922, 6886, 29918, 978, 29892, 4805, 29918, 4703, 29922, 17833, 29892, 3579, 19290, 29897, 13, 13, 13, 1753, 14978, 29918, 16432, 29898, 3827, 29892, 4472, 29918, 978, 2433, 339, 4769, 29914, 1396, 29918, 16432, 29889, 1420, 742, 3579, 19290, 1125, 13, 1678, 14550, 13, 1678, 319, 6996, 28232, 981, 310, 20831, 292, 263, 337, 27979, 11446, 1776, 304, 2888, 675, 29889, 13, 13, 1678, 3295, 12922, 14978, 9493, 1776, 29889, 13, 1678, 14550, 13, 13, 1678, 515, 13911, 2004, 29889, 7406, 1053, 14978, 29918, 16432, 13, 1678, 25448, 29918, 1181, 397, 353, 679, 5552, 29898, 11027, 29892, 525, 4519, 29963, 1955, 9094, 29918, 5800, 13668, 742, 525, 29925, 24990, 1495, 13, 1678, 4805, 353, 426, 13, 4706, 525, 29888, 17118, 568, 29918, 1181, 397, 2396, 25448, 29918, 1181, 397, 29892, 13, 1678, 500, 13, 13, 1678, 736, 14978, 29918, 16432, 29898, 3827, 29892, 4472, 29918, 978, 29922, 6886, 29918, 978, 29892, 13, 462, 4706, 4805, 29918, 4703, 29922, 17833, 29892, 3579, 19290, 29897, 13, 13, 13, 1753, 288, 3554, 29898, 3827, 1125, 13, 1678, 14550, 2744, 1776, 393, 4864, 577, 2330, 304, 3867, 385, 1342, 310, 773, 9557, 29899, 2585, 29899, 1188, 29889, 12008, 13, 1678, 7953, 353, 29871, 29896, 29914, 29900, 13, 13, 13, 1753, 4055, 29918, 16432, 29898, 3827, 29892, 2243, 688, 29892, 4472, 29918, 978, 2433, 14701, 29914, 4039, 29918, 16432, 29889, 1420, 742, 3579, 19290, 1125, 13, 1678, 14550, 17440, 3618, 363, 599, 2793, 4072, 6969, 29901, 4918, 322, 751, 4769, 29889, 12008, 13, 13, 1678, 4055, 353, 679, 29918, 3318, 29918, 272, 29918, 29946, 29900, 29946, 29898, 8176, 29892, 1024, 1649, 347, 29916, 627, 29922, 29517, 29897, 13, 13, 1678, 396, 22503, 1033, 367, 758, 698, 631, 13, 1678, 2582, 353, 5159, 13, 1678, 3855, 29879, 353, 1019, 3594, 29889, 12650, 29889, 5467, 3726, 2141, 4572, 29898, 11338, 1649, 293, 609, 2708, 29922, 4039, 29889, 978, 467, 2098, 29918, 1609, 877, 29899, 5467, 29918, 1256, 1495, 13, 1678, 363, 2944, 297, 3855, 29879, 29901, 13, 4706, 16694, 29918, 6144, 326, 1573, 353, 313, 3788, 297, 2944, 29889, 11338, 29897, 13, 4706, 565, 16694, 29918, 6144, 326, 1573, 29901, 13, 9651, 363, 260, 297, 2944, 29889, 11338, 29889, 5451, 29898, 3788, 1125, 13, 18884, 565, 260, 29889, 17010, 877, 25710, 1275, 4055, 29889, 978, 29901, 13, 462, 1678, 2582, 29889, 4397, 29898, 667, 29897, 13, 4706, 1683, 29901, 13, 9651, 363, 260, 297, 2944, 29889, 11338, 29889, 5451, 877, 525, 1125, 13, 18884, 565, 260, 29889, 17010, 877, 25710, 1275, 4055, 29889, 978, 29901, 13, 462, 1678, 2582, 29889, 4397, 29898, 667, 29897, 13, 13, 1678, 736, 4050, 29918, 517, 29918, 5327, 29898, 6886, 29918, 978, 29892, 13, 462, 1678, 11117, 4039, 2396, 4055, 29892, 525, 3318, 29918, 1761, 2396, 2582, 1118, 13, 462, 1678, 3030, 29918, 8758, 29922, 3089, 2677, 29898, 3827, 511, 13, 462, 1678, 1723, 13, 13, 29992, 3198, 29918, 29882, 650, 1478, 327, 13, 1753, 6958, 29918, 689, 29898, 3827, 29892, 883, 29918, 1990, 29922, 13443, 2500, 29892, 13, 462, 4472, 29918, 978, 2433, 12346, 29918, 689, 29914, 12346, 29918, 689, 29889, 1420, 29374, 13, 13, 1678, 14550, 13, 1678, 5166, 793, 278, 6958, 883, 1776, 29889, 951, 369, 1179, 9557, 29899, 12346, 29899, 689, 29889, 13, 13, 1678, 910, 338, 385, 1342, 310, 20831, 292, 1790, 337, 27979, 11446, 1776, 29889, 910, 3153, 13, 1678, 1776, 884, 3743, 263, 883, 29889, 1152, 445, 1342, 591, 526, 925, 2599, 278, 6996, 13, 1678, 5314, 491, 28489, 278, 1776, 740, 322, 3763, 6819, 278, 13, 1678, 6273, 3412, 29889, 13, 13, 1678, 910, 1776, 338, 884, 26610, 6751, 1790, 337, 27979, 623, 29892, 9557, 29899, 29882, 650, 1478, 327, 29889, 450, 13, 1678, 10200, 1061, 366, 1074, 1641, 7436, 338, 1304, 304, 12566, 596, 623, 515, 805, 314, 29889, 13, 1678, 14550, 13, 1678, 736, 9557, 29918, 12346, 29918, 689, 29898, 3827, 29892, 883, 29918, 1990, 29922, 689, 29918, 1990, 29892, 13, 462, 4472, 29918, 978, 29922, 6886, 29918, 978, 29897, 13, 13, 13, 29937, 22303, 399, 4339, 2085, 2167, 29891, 310, 1732, 597, 1636, 29889, 29881, 2395, 29889, 29887, 433, 29889, 562, 29889, 2679, 29914, 333, 290, 29914, 381, 29918, 13237, 29914, 1847, 29884, 4695, 29918, 13239, 29914, 9847, 29918, 9303, 13, 1254, 4590, 29918, 11686, 8452, 353, 364, 15945, 26732, 29890, 29898, 29874, 29989, 12717, 29989, 27215, 29989, 562, 2124, 29989, 7045, 29989, 7045, 2935, 29989, 351, 475, 29989, 351, 475, 303, 29989, 497, 29989, 284, 3242, 29989, 18785, 29989, 284, 549, 29989, 284, 2040, 29989, 15189, 29989, 13, 26492, 29989, 21936, 29989, 314, 29989, 314, 549, 29989, 314, 549, 303, 29989, 314, 283, 865, 303, 29989, 14506, 29989, 273, 29989, 392, 29989, 23327, 29989, 1384, 29989, 1384, 3525, 29989, 1384, 650, 29989, 1384, 1918, 29989, 1384, 1582, 29989, 1384, 3062, 29989, 598, 29989, 13, 11316, 29989, 294, 29989, 271, 29989, 1627, 29989, 915, 29989, 19385, 420, 29989, 18103, 29989, 915, 2763, 29989, 915, 26807, 29989, 915, 11506, 29989, 915, 264, 29989, 11083, 29989, 11083, 3179, 29989, 915, 16887, 29989, 915, 292, 29989, 22503, 29989, 5707, 680, 29989, 13, 5707, 2247, 29989, 14811, 29989, 915, 8538, 29989, 29890, 453, 29989, 20313, 29989, 8968, 29989, 4187, 29989, 1609, 29989, 4804, 29989, 3068, 29989, 29883, 6735, 29989, 29883, 424, 29989, 1111, 29989, 12097, 261, 29989, 535, 29989, 26680, 29989, 26680, 593, 29989, 29883, 719, 29989, 311, 29989, 2783, 29581, 29989, 13, 16432, 29989, 1867, 29989, 15091, 29989, 3204, 29989, 29123, 29989, 29881, 3864, 29989, 4204, 29989, 387, 29989, 29872, 523, 29989, 29872, 2121, 29989, 6146, 854, 29989, 2870, 29989, 2870, 3062, 29989, 6310, 29989, 264, 820, 29989, 7070, 29989, 11884, 29989, 1310, 29989, 17991, 29989, 17991, 650, 29989, 13, 17991, 1918, 29989, 17991, 3062, 29989, 19499, 29989, 29888, 809, 29989, 28491, 9404, 29989, 29888, 1598, 29989, 5589, 29989, 2886, 29989, 8696, 29989, 4102, 29989, 20818, 29989, 1454, 29989, 24784, 29989, 24784, 368, 29989, 3921, 29891, 29989, 11940, 29989, 17823, 29989, 3166, 29989, 13, 8862, 29989, 8159, 29989, 22613, 721, 29989, 657, 29989, 29887, 573, 29989, 1484, 29989, 21312, 29989, 5349, 29989, 5349, 593, 29989, 17532, 29989, 354, 29989, 29882, 663, 29989, 2276, 29989, 4150, 29989, 4150, 7045, 29989, 4150, 1609, 29989, 4150, 262, 29989, 4150, 786, 265, 29989, 29882, 414, 29989, 29882, 414, 761, 29989, 13, 26994, 29989, 26994, 1311, 29989, 22880, 29989, 3525, 29989, 3525, 1310, 29989, 29882, 6453, 29989, 29875, 29989, 347, 29989, 361, 29989, 262, 29989, 3742, 29989, 25201, 287, 29989, 1639, 342, 29989, 8941, 29989, 275, 29989, 277, 29989, 1169, 29989, 1169, 761, 29989, 17462, 29989, 4230, 29989, 29880, 2620, 29989, 29880, 2620, 368, 29989, 13, 280, 579, 29989, 2222, 29989, 29880, 1594, 29989, 26350, 29989, 13011, 29989, 13029, 29989, 1004, 29989, 12676, 8000, 29989, 29885, 523, 29989, 19958, 29989, 24669, 29989, 5514, 29989, 5514, 957, 29989, 3242, 29989, 3242, 368, 29989, 11631, 29989, 29885, 987, 29989, 21969, 29989, 1357, 29989, 5781, 761, 29989, 978, 29989, 13, 8588, 873, 29989, 484, 2121, 29989, 484, 369, 29989, 484, 369, 16561, 29989, 4622, 29989, 29876, 457, 29989, 1217, 29989, 29876, 711, 1486, 29989, 9290, 29989, 1217, 650, 29989, 15459, 29989, 1333, 29989, 28450, 29989, 3707, 29989, 3707, 4150, 29989, 974, 29989, 2696, 29989, 29877, 15535, 29989, 265, 29989, 10646, 29989, 13, 650, 29989, 6194, 29989, 10268, 29989, 272, 29989, 1228, 29989, 720, 414, 29989, 1228, 3538, 29989, 473, 29989, 2470, 29989, 2470, 295, 1960, 29989, 449, 29989, 957, 29989, 776, 29989, 1595, 29989, 546, 29989, 546, 4252, 29989, 552, 559, 29989, 649, 29989, 29878, 1624, 29989, 276, 29989, 17642, 29989, 13, 4149, 29989, 344, 331, 29989, 344, 22580, 29989, 344, 331, 292, 29989, 344, 1567, 29989, 643, 2738, 29989, 344, 369, 284, 29989, 11360, 29989, 9344, 29989, 4294, 29989, 2975, 29989, 16076, 29989, 29879, 3742, 406, 29989, 28319, 29989, 1039, 29312, 29989, 578, 29989, 5372, 29989, 5372, 3525, 29989, 5372, 650, 29989, 13, 14481, 29989, 29879, 3297, 603, 29989, 29879, 14618, 29989, 5372, 3062, 29989, 303, 453, 29989, 14565, 29989, 5205, 29989, 19730, 29989, 841, 29989, 27603, 29989, 5747, 29989, 1552, 29989, 1552, 381, 29989, 386, 331, 29989, 386, 1567, 295, 1960, 29989, 6098, 29989, 386, 663, 29989, 13, 12711, 29989, 12711, 7045, 29989, 12711, 1609, 29989, 12711, 1079, 29989, 12711, 262, 29989, 12711, 786, 265, 29989, 386, 968, 29989, 19562, 29989, 27996, 29989, 386, 262, 29989, 22585, 29989, 1366, 29989, 386, 852, 29989, 3592, 29989, 17536, 29989, 20678, 29989, 13, 20678, 449, 29989, 386, 582, 29989, 386, 375, 29989, 517, 29989, 29873, 12966, 29989, 517, 29877, 29989, 3332, 29989, 29873, 340, 538, 29989, 29873, 340, 3163, 29989, 7516, 13841, 29989, 7516, 6478, 29989, 10184, 29989, 348, 29989, 5062, 29989, 29305, 29989, 786, 29989, 786, 265, 29989, 375, 29989, 1201, 29989, 6071, 29989, 11102, 29989, 13, 705, 29989, 5872, 29989, 29893, 406, 29989, 5816, 29989, 1332, 5564, 29989, 8256, 29989, 1332, 663, 29989, 8256, 1310, 29989, 3062, 29989, 3062, 7045, 29989, 3062, 294, 29989, 3062, 1609, 29989, 3062, 262, 29989, 3062, 786, 265, 29989, 3062, 369, 29989, 1332, 1979, 29989, 13, 4716, 29989, 8000, 29989, 1332, 2121, 29989, 15970, 29989, 15970, 1310, 29989, 15970, 280, 29989, 1332, 290, 29989, 1332, 852, 29989, 14606, 29989, 14043, 29989, 2541, 29989, 2541, 262, 29989, 14037, 29989, 29893, 483, 29989, 29891, 300, 29989, 6293, 29989, 8066, 29989, 29891, 2470, 29989, 8066, 1311, 29989, 13, 29891, 2470, 295, 1960, 2144, 29890, 15945, 29908, 13, 13, 1753, 10166, 29918, 4478, 29898, 3827, 29892, 4472, 29918, 978, 2433, 14701, 29914, 14701, 29918, 4478, 29889, 1420, 29374, 13, 1678, 9995, 13, 1678, 11856, 363, 10166, 3618, 29889, 29871, 29929, 29929, 29889, 29929, 29929, 10151, 27942, 287, 515, 6996, 29899, 7312, 29915, 29879, 2740, 29889, 13, 13, 1678, 910, 4472, 674, 2758, 366, 304, 6230, 263, 2560, 2740, 883, 393, 674, 1018, 304, 736, 2582, 2729, 373, 13, 1678, 2183, 2740, 6031, 29889, 450, 9365, 674, 367, 1925, 1549, 263, 5040, 3838, 4175, 304, 3349, 3838, 763, 13, 1678, 525, 1552, 742, 525, 29874, 742, 470, 525, 17532, 29915, 304, 1371, 527, 1971, 345, 278, 1121, 731, 29889, 13, 13, 1678, 25663, 29901, 4954, 14701, 29914, 14701, 29918, 4478, 29889, 1420, 16159, 13, 1678, 15228, 29901, 13, 4706, 1203, 29918, 1761, 13, 9651, 2391, 310, 12618, 11803, 393, 1993, 2183, 2740, 1840, 29898, 29879, 467, 13, 4706, 2740, 29918, 8489, 13, 9651, 11221, 2740, 1840, 29889, 13, 1678, 9995, 13, 1678, 3030, 353, 6571, 13, 1678, 565, 2009, 29889, 7194, 29901, 13, 4706, 5040, 29918, 1742, 29918, 1761, 353, 337, 29889, 12198, 29898, 1254, 4590, 29918, 11686, 8452, 29892, 337, 29889, 6259, 6632, 1525, 23487, 29897, 13, 4706, 2740, 29918, 8489, 353, 14210, 29879, 29915, 1273, 2009, 29889, 7194, 1839, 29939, 2033, 13, 4706, 5941, 287, 29918, 4478, 29918, 8489, 353, 5040, 29918, 1742, 29918, 1761, 29889, 1491, 877, 742, 2740, 29918, 8489, 29897, 13, 4706, 5941, 287, 29918, 4478, 29918, 8489, 353, 5941, 287, 29918, 4478, 29918, 8489, 29889, 17010, 580, 13, 4706, 565, 7431, 29898, 14941, 287, 29918, 4478, 29918, 8489, 29897, 2804, 29871, 29900, 29901, 13, 9651, 1400, 29918, 1761, 353, 1019, 3594, 29889, 12650, 29889, 4572, 29898, 29984, 29898, 3257, 1649, 293, 609, 2708, 29922, 14941, 287, 29918, 4478, 29918, 8489, 29897, 891, 660, 29898, 11338, 1649, 293, 609, 2708, 29922, 14941, 287, 29918, 4478, 29918, 8489, 29897, 891, 660, 29898, 8216, 1649, 293, 609, 2708, 29922, 14941, 287, 29918, 4478, 29918, 8489, 8106, 2098, 29918, 1609, 877, 29899, 5467, 29918, 1256, 1495, 13, 9651, 3030, 353, 11117, 3318, 29918, 1761, 2396, 1400, 29918, 1761, 29892, 525, 4478, 29918, 8489, 2396, 4478, 29918, 8489, 29913, 13, 4706, 1683, 29901, 13, 9651, 2643, 353, 525, 7974, 1840, 471, 2086, 25160, 29889, 3529, 1018, 1449, 6169, 13, 9651, 3030, 353, 11117, 4906, 2396, 4906, 29913, 13, 1678, 736, 4050, 29918, 517, 29918, 5327, 29898, 6886, 29918, 978, 29892, 3030, 29892, 3030, 29918, 8758, 29922, 3089, 2677, 29898, 3827, 876, 2 ]
tests/webdriver_tests/test_content.py
sean-hayes/zoom
1
196260
<filename>tests/webdriver_tests/test_content.py<gh_stars>1-10 # -*- coding: utf-8 -*- """ zoom.tests.webdriver_tests.test_admin test admin app functions """ from .common import WebdriverTestCase class ContentTests(WebdriverTestCase): """Content App""" def setUp(self): WebdriverTestCase.setUp(self) self.login('admin', 'admin') def tearDown(self): self.logout() WebdriverTestCase.tearDown(self) def add_page(self, **parts): assert parts.get('title') self.get('/content/pages/new') self.fill(parts) self.click('create_button') def delete_page(self, locator): self.get('/content/pages') self.click_link(locator) self.click_link('Delete') self.click('delete_button') def test_add_remove_page(self): self.add_page( title='Test Page', path='test-page', body='This is a test page.' ) self.assertContains('Test Page') self.delete_page('Test Page') # def add_user(self, first_name, last_name, email, username): # self.get('/admin') # self.get('/admin/users') # self.get('/admin/users/new') # self.fill( # dict( # first_name=first_name, # last_name=last_name, # email=email, # username=username, # ) # ) # self.chosen('groups', ['managers']) # self.click('create_button') # # def delete_user(self, username): # self.get('/admin') # self.get('/admin/users') # self.click_link(username) # self.click('id=delete-action') # self.click('name=delete_button') # # def test_admin_login_logout(self): # self.login('admin', 'admin') # self.logout() def test_index(self): self.get('/content') self.assertContains('Overview') self.assertContains('Pages') self.assertContains('Snippets')
[ 1, 529, 9507, 29958, 21150, 29914, 29813, 29918, 21150, 29914, 1688, 29918, 3051, 29889, 2272, 29966, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 13, 15945, 29908, 13, 1678, 19342, 29889, 21150, 29889, 29813, 29918, 21150, 29889, 1688, 29918, 6406, 13, 13, 1678, 1243, 4113, 623, 3168, 13, 15945, 29908, 13, 13, 13, 3166, 869, 9435, 1053, 2563, 9465, 3057, 8259, 13, 13, 13, 1990, 10576, 24376, 29898, 3609, 9465, 3057, 8259, 1125, 13, 1678, 9995, 3916, 2401, 15945, 29908, 13, 13, 1678, 822, 731, 3373, 29898, 1311, 1125, 13, 4706, 2563, 9465, 3057, 8259, 29889, 842, 3373, 29898, 1311, 29897, 13, 4706, 1583, 29889, 7507, 877, 6406, 742, 525, 6406, 1495, 13, 13, 1678, 822, 734, 279, 6767, 29898, 1311, 1125, 13, 4706, 1583, 29889, 1188, 449, 580, 13, 4706, 2563, 9465, 3057, 8259, 29889, 371, 279, 6767, 29898, 1311, 29897, 13, 13, 1678, 822, 788, 29918, 3488, 29898, 1311, 29892, 3579, 20895, 1125, 13, 4706, 4974, 5633, 29889, 657, 877, 3257, 1495, 13, 4706, 1583, 29889, 657, 11219, 3051, 29914, 12292, 29914, 1482, 1495, 13, 4706, 1583, 29889, 5589, 29898, 20895, 29897, 13, 4706, 1583, 29889, 3808, 877, 3258, 29918, 3092, 1495, 13, 13, 1678, 822, 5217, 29918, 3488, 29898, 1311, 29892, 1180, 1061, 1125, 13, 4706, 1583, 29889, 657, 11219, 3051, 29914, 12292, 1495, 13, 4706, 1583, 29889, 3808, 29918, 2324, 29898, 2029, 1061, 29897, 13, 4706, 1583, 29889, 3808, 29918, 2324, 877, 12498, 1495, 13, 4706, 1583, 29889, 3808, 877, 8143, 29918, 3092, 1495, 13, 13, 1678, 822, 1243, 29918, 1202, 29918, 5992, 29918, 3488, 29898, 1311, 1125, 13, 4706, 1583, 29889, 1202, 29918, 3488, 29898, 13, 9651, 3611, 2433, 3057, 9305, 742, 13, 9651, 2224, 2433, 1688, 29899, 3488, 742, 13, 9651, 3573, 2433, 4013, 338, 263, 1243, 1813, 6169, 13, 4706, 1723, 13, 4706, 1583, 29889, 9294, 21409, 877, 3057, 9305, 1495, 13, 4706, 1583, 29889, 8143, 29918, 3488, 877, 3057, 9305, 1495, 13, 13, 1678, 396, 822, 788, 29918, 1792, 29898, 1311, 29892, 937, 29918, 978, 29892, 1833, 29918, 978, 29892, 4876, 29892, 8952, 1125, 13, 1678, 396, 268, 1583, 29889, 657, 11219, 6406, 1495, 13, 1678, 396, 268, 1583, 29889, 657, 11219, 6406, 29914, 7193, 1495, 13, 1678, 396, 268, 1583, 29889, 657, 11219, 6406, 29914, 7193, 29914, 1482, 1495, 13, 1678, 396, 268, 1583, 29889, 5589, 29898, 13, 1678, 396, 308, 9657, 29898, 13, 1678, 396, 632, 937, 29918, 978, 29922, 4102, 29918, 978, 29892, 13, 1678, 396, 632, 1833, 29918, 978, 29922, 4230, 29918, 978, 29892, 13, 1678, 396, 632, 4876, 29922, 5269, 29892, 13, 1678, 396, 632, 8952, 29922, 6786, 29892, 13, 1678, 396, 308, 1723, 13, 1678, 396, 268, 1723, 13, 1678, 396, 268, 1583, 29889, 305, 7749, 877, 13155, 742, 6024, 1171, 18150, 11287, 13, 1678, 396, 268, 1583, 29889, 3808, 877, 3258, 29918, 3092, 1495, 13, 1678, 396, 13, 1678, 396, 822, 5217, 29918, 1792, 29898, 1311, 29892, 8952, 1125, 13, 1678, 396, 268, 1583, 29889, 657, 11219, 6406, 1495, 13, 1678, 396, 268, 1583, 29889, 657, 11219, 6406, 29914, 7193, 1495, 13, 1678, 396, 268, 1583, 29889, 3808, 29918, 2324, 29898, 6786, 29897, 13, 1678, 396, 268, 1583, 29889, 3808, 877, 333, 29922, 8143, 29899, 2467, 1495, 13, 1678, 396, 268, 1583, 29889, 3808, 877, 978, 29922, 8143, 29918, 3092, 1495, 13, 1678, 396, 13, 1678, 396, 822, 1243, 29918, 6406, 29918, 7507, 29918, 1188, 449, 29898, 1311, 1125, 13, 1678, 396, 268, 1583, 29889, 7507, 877, 6406, 742, 525, 6406, 1495, 13, 1678, 396, 268, 1583, 29889, 1188, 449, 580, 13, 13, 1678, 822, 1243, 29918, 2248, 29898, 1311, 1125, 13, 4706, 1583, 29889, 657, 11219, 3051, 1495, 13, 4706, 1583, 29889, 9294, 21409, 877, 3563, 1493, 1495, 13, 4706, 1583, 29889, 9294, 21409, 877, 27514, 1495, 13, 4706, 1583, 29889, 9294, 21409, 877, 29903, 1240, 27421, 1495, 13, 2 ]
mysite/Tweet_Generator/urls.py
avinsit123/Tweet-o-Pedia
1
157596
<gh_stars>1-10 from django.conf.urls import url from . import views urlpatterns=[ url(r'^$',views.Tweet_form,name='Tweetform'), url('yumyum',views.ProcessForm,name='vahmc') ]
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 3166, 9557, 29889, 5527, 29889, 26045, 1053, 3142, 13, 13, 13, 3166, 869, 1053, 8386, 13, 13, 2271, 11037, 29879, 11759, 13, 632, 3142, 29898, 29878, 29915, 29985, 29938, 742, 7406, 29889, 29911, 16668, 29918, 689, 29892, 978, 2433, 29911, 16668, 689, 5477, 13, 632, 3142, 877, 29891, 398, 29891, 398, 742, 7406, 29889, 7032, 2500, 29892, 978, 2433, 29894, 801, 14047, 1495, 13, 632, 4514, 13, 13, 2 ]
src/duplex_feature_extraction_cv.py
BorisAnimal/across_sensor_har
0
106085
from keras.models import load_model, Model import numpy as np import os from src.data.shl_data import shl_min, shl_max, mean, std from tqdm import tqdm import seaborn as sns import shutil from loguru import logger x_min = shl_min()[np.newaxis, np.newaxis, :] x_max = shl_max()[np.newaxis, np.newaxis, :] x_mean = mean() x_std = std() base = "data/interim/hips/data" logger.add("duplex_fe_cv.log", format="{time:YYYY-MM-DD at HH:mm:ss} | {level} | {message}") logger.info("CV feature extraction has started.") sensors = ["accel", "gyro", "mag"] sources = [0]*3 + [1]*3 + [2]*3 destinations = [0, 1, 2]*3 modalities = list(zip(sources, destinations)) model_names = [f"{sensors[x]}2{sensors[y]}_duplex" for (x, y) in modalities] for model_name, (in_sensor, out_sensor) in tqdm(list(zip(model_names, modalities))[5:], total=9, desc = "Modalities"): for i in tqdm(range(5), desc = "Folds", leave = False): os.makedirs(f"data/interim/hips/best_fold{i}_{model_name}_features/") model = load_model(f"models/hips/best_fold{i}_{model_name}") feature_encoder = Model(model.input, model.get_layer("features").output) rmses = [] for fname in tqdm(os.listdir(base), desc = "files", leave = False): arr = np.load(base + "/" + fname) x = (arr - x_mean) / x_std x = (x - x_min) / (x_max - x_min) x = x * 2 - 1 features = feature_encoder.predict(x[:,:,:, in_sensor]) np.save(f"data/interim/hips/best_fold{i}_{model_name}_features/{fname}", features) rmse = np.mean(np.square(model.predict(x[:, :, :, in_sensor], verbose=0)[0] - x[:, :, :, out_sensor]), axis = 1) rmses.extend(rmse) logger.info(f"{model_name} fold {i} finished with rmse = {np.mean(rmses)}")
[ 1, 515, 13023, 294, 29889, 9794, 1053, 2254, 29918, 4299, 29892, 8125, 13, 5215, 12655, 408, 7442, 13, 5215, 2897, 13, 3166, 4765, 29889, 1272, 29889, 845, 29880, 29918, 1272, 1053, 528, 29880, 29918, 1195, 29892, 528, 29880, 29918, 3317, 29892, 2099, 29892, 3659, 13, 3166, 260, 29939, 18933, 1053, 260, 29939, 18933, 13, 5215, 409, 370, 1398, 408, 269, 1983, 13, 5215, 528, 4422, 13, 3166, 1480, 20144, 1053, 17927, 13, 13, 29916, 29918, 1195, 353, 528, 29880, 29918, 1195, 580, 29961, 9302, 29889, 1482, 8990, 29892, 7442, 29889, 1482, 8990, 29892, 584, 29962, 13, 29916, 29918, 3317, 353, 528, 29880, 29918, 3317, 580, 29961, 9302, 29889, 1482, 8990, 29892, 7442, 29889, 1482, 8990, 29892, 584, 29962, 13, 29916, 29918, 12676, 353, 2099, 580, 13, 29916, 29918, 4172, 353, 3659, 580, 13, 13, 3188, 353, 376, 1272, 29914, 1639, 326, 29914, 14587, 29914, 1272, 29908, 13, 13, 21707, 29889, 1202, 703, 700, 10709, 29918, 1725, 29918, 11023, 29889, 1188, 613, 3402, 10724, 2230, 29901, 14995, 14995, 29899, 7428, 29899, 7858, 472, 379, 29950, 29901, 4317, 29901, 893, 29913, 891, 426, 5563, 29913, 891, 426, 4906, 27195, 13, 21707, 29889, 3888, 703, 15633, 4682, 4805, 428, 756, 4687, 23157, 13, 13, 23149, 943, 353, 6796, 562, 2242, 613, 376, 1927, 307, 613, 376, 11082, 3108, 13, 29879, 2863, 353, 518, 29900, 14178, 29941, 718, 518, 29896, 14178, 29941, 718, 518, 29906, 14178, 29941, 13, 7854, 262, 800, 353, 518, 29900, 29892, 29871, 29896, 29892, 29871, 29906, 14178, 29941, 29871, 13, 15601, 1907, 353, 1051, 29898, 7554, 29898, 29879, 2863, 29892, 15422, 800, 876, 13, 4299, 29918, 7039, 353, 518, 29888, 29908, 29912, 23149, 943, 29961, 29916, 12258, 29906, 29912, 23149, 943, 29961, 29891, 29962, 2403, 700, 10709, 29908, 363, 313, 29916, 29892, 343, 29897, 297, 13008, 1907, 29962, 13, 13, 1454, 1904, 29918, 978, 29892, 313, 262, 29918, 29879, 6073, 29892, 714, 29918, 29879, 6073, 29897, 297, 260, 29939, 18933, 29898, 1761, 29898, 7554, 29898, 4299, 29918, 7039, 29892, 13008, 1907, 876, 29961, 29945, 29901, 1402, 3001, 29922, 29929, 29892, 5153, 353, 376, 19751, 1907, 29908, 1125, 13, 1678, 363, 474, 297, 260, 29939, 18933, 29898, 3881, 29898, 29945, 511, 5153, 353, 376, 29943, 3361, 613, 5967, 353, 7700, 1125, 13, 13, 4706, 2897, 29889, 29885, 12535, 12935, 29898, 29888, 29908, 1272, 29914, 1639, 326, 29914, 14587, 29914, 13318, 29918, 8771, 29912, 29875, 3227, 4299, 29918, 978, 2403, 22100, 29914, 1159, 13, 308, 13, 4706, 1904, 353, 2254, 29918, 4299, 29898, 29888, 29908, 9794, 29914, 14587, 29914, 13318, 29918, 8771, 29912, 29875, 3227, 4299, 29918, 978, 27195, 13, 4706, 4682, 29918, 3977, 6119, 353, 8125, 29898, 4299, 29889, 2080, 29892, 1904, 29889, 657, 29918, 13148, 703, 22100, 2564, 4905, 29897, 13, 4706, 364, 1516, 267, 353, 5159, 13, 4706, 363, 285, 978, 297, 260, 29939, 18933, 29898, 359, 29889, 1761, 3972, 29898, 3188, 511, 5153, 353, 376, 5325, 613, 5967, 353, 7700, 1125, 13, 9651, 3948, 353, 7442, 29889, 1359, 29898, 3188, 718, 5591, 29908, 718, 285, 978, 29897, 13, 9651, 921, 353, 313, 2749, 448, 921, 29918, 12676, 29897, 847, 921, 29918, 4172, 13, 9651, 921, 353, 313, 29916, 448, 921, 29918, 1195, 29897, 847, 313, 29916, 29918, 3317, 448, 921, 29918, 1195, 29897, 13, 9651, 921, 353, 921, 334, 29871, 29906, 448, 29871, 29896, 13, 13, 9651, 5680, 353, 4682, 29918, 3977, 6119, 29889, 27711, 29898, 29916, 7503, 29892, 29901, 29892, 29901, 29892, 297, 29918, 29879, 6073, 2314, 13, 9651, 7442, 29889, 7620, 29898, 29888, 29908, 1272, 29914, 1639, 326, 29914, 14587, 29914, 13318, 29918, 8771, 29912, 29875, 3227, 4299, 29918, 978, 2403, 22100, 19248, 29888, 978, 17671, 5680, 29897, 13, 9651, 20241, 344, 353, 7442, 29889, 12676, 29898, 9302, 29889, 17619, 29898, 4299, 29889, 27711, 29898, 29916, 7503, 29892, 584, 29892, 584, 29892, 297, 29918, 29879, 6073, 1402, 26952, 29922, 29900, 9601, 29900, 29962, 448, 921, 7503, 29892, 584, 29892, 584, 29892, 714, 29918, 29879, 6073, 11724, 9685, 353, 29871, 29896, 29897, 13, 13, 9651, 364, 1516, 267, 29889, 21843, 29898, 1758, 344, 29897, 13, 4706, 17927, 29889, 3888, 29898, 29888, 29908, 29912, 4299, 29918, 978, 29913, 900, 29881, 426, 29875, 29913, 7743, 411, 20241, 344, 353, 426, 9302, 29889, 12676, 29898, 29878, 1516, 267, 2915, 1159, 2 ]
fcts/blurple-old.py
ZRunner/ZBot
19
1600443
<filename>fcts/blurple-old.py import datetime import io import math import time from io import BytesIO import aiohttp import discord from discord.ext import commands from discord.ext.commands.cooldowns import BucketType from PIL import Image, ImageEnhance, ImageSequence from resizeimage import resizeimage from utils import MyContext BLURPLE = (114, 137, 218, 255) DARK_BLURPLE = (78, 93, 148, 255) WHITE = (255, 255, 255, 255) DARK = (1,1,35,255) class BlurpleCog(commands.Cog): def __init__(self,bot): self.bot = bot self.file = 'blurple' @commands.command(name="isblurple",aliases=['blurple']) @commands.cooldown(rate=1, per=60, type=BucketType.user) async def blurple_cmd(self, ctx: MyContext, url: str = None): """Be part of the best birthday of the WORLD, and check if you're enough blurple to be cool! You can either give a user or an image URL in argument, or attach an image to your message. Plz don't forget to be cool.""" if not (ctx.guild is None or ctx.channel.permissions_for(ctx.guild.me).attach_files): return await ctx.send(await self.bot._(ctx.channel,"blurple","missing-attachment-perm")) picture = None if url is not None: try: user = await commands.UserConverter().convert(ctx,url) picture = user.display_avatar.url except Exception: picture = url else: link = ctx.message.attachments if len(link) != 0: for image in link: picture = image.url if picture is None: picture = ctx.author.display_avatar.url try: async with aiohttp.ClientSession() as cs: async with cs.get(picture) as r: response = await r.read() except ValueError: await ctx.send(str(await self.bot._(ctx.guild,"blurple","check_invalid")).format(ctx.message.author.mention)) return colourbuffer = 25 try: im = Image.open(BytesIO(response)) except Exception: await ctx.send(str(await self.bot._(ctx.guild,"blurple","check_invalid")).format(ctx.message.author.mention)) return await ctx.send(str(await self.bot._(ctx.guild,"blurple","check_intro")).format(ctx.message.author.mention)) im = im.convert('RGBA') imsize = list(im.size) impixels = imsize[0]*imsize[1] maxpixelcount = 1562500 start = time.time() if impixels > maxpixelcount: downsizefraction = math.sqrt(maxpixelcount/impixels) im = resizeimage.resize_width(im, (imsize[0]*downsizefraction)) imsize = list(im.size) impixels = imsize[0]*imsize[1] end = time.time() await ctx.send(str(await self.bot._(ctx.guild,"blurple","check_resized")).format(ctx.message.author.mention,round(end-start,2))) def imager(im): global noofblurplepixels noofblurplepixels = 0 global noofwhitepixels noofwhitepixels = 0 global noofdarkblurplepixels noofdarkblurplepixels = 0 global nooftotalpixels nooftotalpixels = 0 global noofpixels noofpixels = 0 img = im.load() for x in range(imsize[0]): for y in range(imsize[1]): pixel = img[x,y] check = 1 checkblurple = 1 checkwhite = 1 checkdarkblurple = 1 checkblack = 1 if pixel[3]<200: noofpixels += 1 nooftotalpixels += 1 img[x,y] = (pixel[0], pixel[1], pixel[2], 0) continue for i in range(3): if not(BLURPLE[i]+colourbuffer > pixel[i] > BLURPLE[i]-colourbuffer): checkblurple = 0 if not(DARK_BLURPLE[i]+colourbuffer > pixel[i] > DARK_BLURPLE[i]-colourbuffer): checkdarkblurple = 0 if not(WHITE[i]+colourbuffer > pixel[i] > WHITE[i]-colourbuffer): checkwhite = 0 if not(DARK[i]+colourbuffer > pixel[i] > DARK[i]-colourbuffer): checkblack = 0 if checkblurple == 0 and checkdarkblurple == 0 and checkwhite == 0 and checkblack == 0: check = 0 if check == 0: img[x,y] = (0, 0, 0, 255) if check == 1: nooftotalpixels += 1 if checkblurple == 1: noofblurplepixels += 1 if checkdarkblurple == 1: noofdarkblurplepixels += 1 if checkwhite == 1: noofwhitepixels += 1 noofpixels += 1 image_file_object = io.BytesIO() im.save(image_file_object, format='png') image_file_object.seek(0) return image_file_object async with aiohttp.ClientSession() as _: image = await self.bot.loop.run_in_executor(None, imager, im) image = discord.File(fp=image, filename='image.png') blurplenesspercentage = round(((nooftotalpixels/noofpixels)*100), 2) percentblurple = round(((noofblurplepixels/noofpixels)*100), 2) percentdblurple = round(((noofdarkblurplepixels/noofpixels)*100), 2) percentwhite = round(((noofwhitepixels/noofpixels)*100), 2) fields_txt = await self.bot._(ctx.guild,"blurple","check_fields") embed = discord.Embed(title = "", colour = 0x7289DA, description=fields_txt[5]) if blurplenesspercentage>=99.99: embed.add_field(name=fields_txt[0], value=f"{blurplenesspercentage}% :tada:", inline=False) else: embed.add_field(name=fields_txt[0], value=f"{blurplenesspercentage}%", inline=False) embed.add_field(name=fields_txt[1], value=f"{percentblurple}%", inline=True) embed.add_field(name=fields_txt[2], value=f"{percentwhite}%", inline=True) embed.add_field(name=fields_txt[3], value=f"{percentdblurple}%", inline=True) embed.add_field(name="Guide", value=fields_txt[4], inline=False) embed.set_footer(text=fields_txt[6].format(ctx.author)) embed.set_image(url="attachment://image.png") embed.set_thumbnail(url=picture) await ctx.send(embed=embed, file=image) if blurplenesspercentage>95 and str(picture)==str(ctx.author.display_avatar): date = datetime.datetime.today() if not await ctx.bot.get_cog('Utilities').has_blurple_card(ctx.author) and 6<date.day<20 and date.month==5: pr = await self.bot.get_prefix(ctx.message) em = ':tada:' if ctx.guild is not None and ctx.channel.permissions_for(ctx.guild.me).external_emojis: em = '<:blurpletada:575696286905401345>' await ctx.bot.get_cog('Utilities').change_db_userinfo(ctx.author.id,'unlocked_blurple',True) await ctx.send(str(await self.bot._(ctx.channel,'blurple','won-card')).format(ctx.author.mention,pr[-1],em)) @commands.command(aliases=['blurplfy', 'blurplefier']) @commands.cooldown(rate=3, per=90, type=BucketType.user) async def blurplefy(self,ctx, url = None): """Be even more cool, and blurpelize your avatar for this coolest birthday of the century. You can either give a user or an image URL in argument, or attach an image to your message. Plz don't forget to be cool.""" await self.create(ctx,url) async def create(self,ctx,url): picture = None if url is not None: try: user = await commands.UserConverter().convert(ctx,url) picture = str(user.display_avatar) except Exception: picture = url else: link = ctx.message.attachments if len(link) != 0: for image in link: picture = image.url if picture is None: picture = ctx.author.display_avatar try: async with aiohttp.ClientSession() as cs: async with cs.get(str(picture)) as r: response = await r.read() except ValueError: await ctx.send(str(await self.bot._(ctx.guild,"blurple","check_invalid")).format(ctx.message.author.mention)) return try: im = Image.open(BytesIO(response)) except Exception: await ctx.send(str(await self.bot._(ctx.guild,"blurple","check_invalid")).format(ctx.message.author.mention)) return imsize = list(im.size) impixels = imsize[0]*imsize[1] maxpixelcount = 1562500 await ctx.send(str(await self.bot._(ctx.guild,"blurple","check_intro")).format(ctx.message.author.mention)) try: _ = im.info["version"] isgif = True gifloop = int(im.info["loop"]) except Exception: isgif = False if impixels > maxpixelcount: downsizefraction = math.sqrt(maxpixelcount/impixels) im = resizeimage.resize_width(im, (imsize[0]*downsizefraction)) imsize = list(im.size) impixels = imsize[0]*imsize[1] def imager(im): im = im.convert(mode='RGBA') im = ImageEnhance.Contrast(im).enhance(1000) #im = ImageEnhance.Contrast(im).enhance(2.2) im = im.convert(mode='RGBA') img = im.load() for x in range(imsize[0]): for y in range(imsize[1]): pixel = img[x, y] if pixel[3] > 220: if sum(pixel[:3])/3 > 222: img[x,y] = WHITE elif sum(pixel[:3])/3 > 100: img[x,y] = BLURPLE elif sum(pixel[:3])/3 > 0.01: img[x,y] = DARK_BLURPLE else: img[x,y] = DARK else: img[x,y] = BLURPLE[:3]+tuple([pixel[3]]) image_file_object = io.BytesIO() im.save(image_file_object, format='png') image_file_object.seek(0) return image_file_object def gifimager(im, _gifloop): frames = [frame.copy() for frame in ImageSequence.Iterator(im)] newgif = [] for frame in frames: frame = frame.convert(mode='RGBA') frame = ImageEnhance.Contrast(frame).enhance(1.7) frame = frame.convert(mode='RGBA') img = frame.load() for x in range(imsize[0]): for y in range(imsize[1]): pixel = img[x, y] if pixel[3] > 230: if sum(pixel[:3])/3 > 222: img[x,y] = WHITE elif sum(pixel[:3])/3 > 100: img[x,y] = BLURPLE elif sum(pixel[:3])/3 > 0.01: img[x,y] = DARK_BLURPLE else: img[x,y] = DARK else: img[x,y] = BLURPLE[:3]+tuple([pixel[3]]) # for x in range(imsize[0]): # for y in range(imsize[1]): # pixel = img[x, y] # if pixel != (255, 255, 255): # img[x, y] = (114, 137, 218) newgif.append(frame) image_file_object = io.BytesIO() gif = newgif[0] gif.save(image_file_object, format='gif', save_all=True, append_images=newgif[1:], loop=0) image_file_object.seek(0) return image_file_object async with aiohttp.ClientSession() as _: if not isgif: image = await self.bot.loop.run_in_executor(None, imager, im) else: image = await self.bot.loop.run_in_executor(None, gifimager, im, gifloop) if not isgif: image = discord.File(fp=image, filename='image.png') else: image = discord.File(fp=image, filename='image.gif') try: fields_txt = await self.bot._(ctx.guild,"blurple","check_fields") embed = discord.Embed(title = "", colour = 0x7289DA, description=fields_txt[5]) embed.set_author(name=await self.bot._(ctx.guild,'blurple','create_title')) if not isgif: embed.set_image(url="attachment://image.png") embed.set_footer(text=str(await self.bot._(ctx.guild,'blurple','create_footer_1')).format(ctx.author)) else: embed.set_image(url="attachment://image.gif") embed.set_footer(text=str(await self.bot._(ctx.guild,'blurple','create_footer_2')).format(ctx.author)) embed.set_thumbnail(url=picture) await ctx.send(embed=embed, file=image) except Exception: await ctx.send(str(await self.bot._(ctx.guild,'blurple','create_footer_2')).format(ctx.author.mention)) def setup(bot): bot.add_cog(BlurpleCog(bot))
[ 1, 529, 9507, 29958, 29888, 312, 29879, 29914, 2204, 332, 552, 29899, 1025, 29889, 2272, 13, 5215, 12865, 13, 5215, 12013, 13, 5215, 5844, 13, 5215, 931, 13, 3166, 12013, 1053, 2648, 2167, 5971, 13, 13, 5215, 263, 601, 1124, 13, 5215, 2313, 536, 13, 3166, 2313, 536, 29889, 1062, 1053, 8260, 13, 3166, 2313, 536, 29889, 1062, 29889, 26381, 29889, 1111, 1025, 776, 29879, 1053, 16281, 300, 1542, 13, 3166, 349, 6227, 1053, 7084, 29892, 7084, 2369, 29882, 749, 29892, 7084, 20529, 13, 3166, 19490, 3027, 1053, 19490, 3027, 13, 3166, 3667, 29879, 1053, 1619, 2677, 13, 13, 13367, 4574, 29925, 1307, 353, 313, 29896, 29896, 29946, 29892, 29871, 29896, 29941, 29955, 29892, 29871, 29906, 29896, 29947, 29892, 29871, 29906, 29945, 29945, 29897, 13, 29928, 1718, 29968, 29918, 13367, 4574, 29925, 1307, 353, 313, 29955, 29947, 29892, 29871, 29929, 29941, 29892, 29871, 29896, 29946, 29947, 29892, 29871, 29906, 29945, 29945, 29897, 13, 25039, 9094, 353, 313, 29906, 29945, 29945, 29892, 29871, 29906, 29945, 29945, 29892, 29871, 29906, 29945, 29945, 29892, 29871, 29906, 29945, 29945, 29897, 13, 29928, 1718, 29968, 353, 313, 29896, 29892, 29896, 29892, 29941, 29945, 29892, 29906, 29945, 29945, 29897, 13, 13, 1990, 3164, 332, 552, 29907, 468, 29898, 26381, 29889, 29907, 468, 1125, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 7451, 1125, 13, 4706, 1583, 29889, 7451, 353, 9225, 13, 4706, 1583, 29889, 1445, 353, 525, 2204, 332, 552, 29915, 13, 13, 13, 1678, 732, 26381, 29889, 6519, 29898, 978, 543, 275, 2204, 332, 552, 613, 2606, 2129, 29922, 1839, 2204, 332, 552, 11287, 13, 1678, 732, 26381, 29889, 1111, 1025, 776, 29898, 10492, 29922, 29896, 29892, 639, 29922, 29953, 29900, 29892, 1134, 29922, 29933, 2707, 300, 1542, 29889, 1792, 29897, 13, 1678, 7465, 822, 1999, 332, 552, 29918, 9006, 29898, 1311, 29892, 12893, 29901, 1619, 2677, 29892, 3142, 29901, 851, 353, 6213, 1125, 13, 4706, 9995, 3629, 760, 310, 278, 1900, 12060, 3250, 310, 278, 399, 1955, 10249, 29892, 322, 1423, 565, 366, 29915, 276, 3307, 1999, 332, 552, 304, 367, 12528, 29991, 13, 4706, 887, 508, 2845, 2367, 263, 1404, 470, 385, 1967, 3988, 297, 2980, 29892, 470, 10641, 385, 1967, 304, 596, 2643, 29889, 1858, 29920, 1016, 29915, 29873, 9566, 304, 367, 12528, 1213, 15945, 13, 4706, 565, 451, 313, 13073, 29889, 2543, 789, 338, 6213, 470, 12893, 29889, 12719, 29889, 17858, 6847, 29918, 1454, 29898, 13073, 29889, 2543, 789, 29889, 1004, 467, 14930, 29918, 5325, 1125, 13, 9651, 736, 7272, 12893, 29889, 6717, 29898, 20675, 1583, 29889, 7451, 3032, 29898, 13073, 29889, 12719, 1699, 2204, 332, 552, 3284, 27259, 29899, 14930, 358, 29899, 17858, 5783, 13, 13, 4706, 7623, 353, 6213, 13, 13, 4706, 565, 3142, 338, 451, 6213, 29901, 13, 9651, 1018, 29901, 13, 18884, 1404, 353, 7272, 8260, 29889, 2659, 18545, 2141, 13441, 29898, 13073, 29892, 2271, 29897, 13, 18884, 7623, 353, 1404, 29889, 4990, 29918, 485, 14873, 29889, 2271, 13, 9651, 5174, 8960, 29901, 13, 18884, 7623, 353, 3142, 13, 4706, 1683, 29901, 13, 9651, 1544, 353, 12893, 29889, 4906, 29889, 14930, 1860, 13, 9651, 565, 7431, 29898, 2324, 29897, 2804, 29871, 29900, 29901, 13, 18884, 363, 1967, 297, 1544, 29901, 13, 462, 1678, 7623, 353, 1967, 29889, 2271, 13, 13, 4706, 565, 7623, 338, 6213, 29901, 13, 9651, 7623, 353, 12893, 29889, 8921, 29889, 4990, 29918, 485, 14873, 29889, 2271, 13, 13, 4706, 1018, 29901, 13, 9651, 7465, 411, 263, 601, 1124, 29889, 4032, 7317, 580, 408, 5939, 29901, 13, 18884, 7465, 411, 5939, 29889, 657, 29898, 12095, 29897, 408, 364, 29901, 13, 462, 1678, 2933, 353, 7272, 364, 29889, 949, 580, 13, 4706, 5174, 7865, 2392, 29901, 13, 9651, 7272, 12893, 29889, 6717, 29898, 710, 29898, 20675, 1583, 29889, 7451, 3032, 29898, 13073, 29889, 2543, 789, 1699, 2204, 332, 552, 3284, 3198, 29918, 20965, 1159, 467, 4830, 29898, 13073, 29889, 4906, 29889, 8921, 29889, 358, 291, 876, 13, 9651, 736, 13, 13, 4706, 12384, 9040, 353, 29871, 29906, 29945, 13, 13, 4706, 1018, 29901, 13, 9651, 527, 353, 7084, 29889, 3150, 29898, 11207, 5971, 29898, 5327, 876, 13, 4706, 5174, 8960, 29901, 13, 9651, 7272, 12893, 29889, 6717, 29898, 710, 29898, 20675, 1583, 29889, 7451, 3032, 29898, 13073, 29889, 2543, 789, 1699, 2204, 332, 552, 3284, 3198, 29918, 20965, 1159, 467, 4830, 29898, 13073, 29889, 4906, 29889, 8921, 29889, 358, 291, 876, 13, 9651, 736, 13, 13, 4706, 7272, 12893, 29889, 6717, 29898, 710, 29898, 20675, 1583, 29889, 7451, 3032, 29898, 13073, 29889, 2543, 789, 1699, 2204, 332, 552, 3284, 3198, 29918, 23333, 1159, 467, 4830, 29898, 13073, 29889, 4906, 29889, 8921, 29889, 358, 291, 876, 13, 13, 4706, 527, 353, 527, 29889, 13441, 877, 29934, 29954, 5688, 1495, 13, 4706, 527, 2311, 353, 1051, 29898, 326, 29889, 2311, 29897, 13, 4706, 2411, 861, 1379, 353, 527, 2311, 29961, 29900, 14178, 326, 2311, 29961, 29896, 29962, 13, 4706, 4236, 29886, 15711, 2798, 353, 29871, 29896, 29945, 29953, 29906, 29945, 29900, 29900, 13, 13, 4706, 1369, 353, 931, 29889, 2230, 580, 13, 4706, 565, 2411, 861, 1379, 1405, 4236, 29886, 15711, 2798, 29901, 13, 9651, 1623, 2311, 29888, 13857, 353, 5844, 29889, 3676, 29898, 3317, 29886, 15711, 2798, 29914, 6574, 861, 1379, 29897, 13, 9651, 527, 353, 19490, 3027, 29889, 21476, 29918, 2103, 29898, 326, 29892, 313, 326, 2311, 29961, 29900, 14178, 3204, 2311, 29888, 13857, 876, 13, 9651, 527, 2311, 353, 1051, 29898, 326, 29889, 2311, 29897, 13, 9651, 2411, 861, 1379, 353, 527, 2311, 29961, 29900, 14178, 326, 2311, 29961, 29896, 29962, 13, 9651, 1095, 353, 931, 29889, 2230, 580, 13, 9651, 7272, 12893, 29889, 6717, 29898, 710, 29898, 20675, 1583, 29889, 7451, 3032, 29898, 13073, 29889, 2543, 789, 1699, 2204, 332, 552, 3284, 3198, 29918, 690, 1891, 1159, 467, 4830, 29898, 13073, 29889, 4906, 29889, 8921, 29889, 358, 291, 29892, 14486, 29898, 355, 29899, 2962, 29892, 29906, 4961, 13, 13, 4706, 822, 527, 1875, 29898, 326, 1125, 13, 9651, 5534, 694, 974, 2204, 332, 552, 29886, 861, 1379, 13, 9651, 694, 974, 2204, 332, 552, 29886, 861, 1379, 353, 29871, 29900, 13, 9651, 5534, 694, 974, 10921, 29886, 861, 1379, 13, 9651, 694, 974, 10921, 29886, 861, 1379, 353, 29871, 29900, 13, 9651, 5534, 694, 974, 26031, 2204, 332, 552, 29886, 861, 1379, 13, 9651, 694, 974, 26031, 2204, 332, 552, 29886, 861, 1379, 353, 29871, 29900, 13, 9651, 5534, 694, 29877, 615, 7288, 29886, 861, 1379, 13, 9651, 694, 29877, 615, 7288, 29886, 861, 1379, 353, 29871, 29900, 13, 9651, 5534, 694, 974, 29886, 861, 1379, 13, 9651, 694, 974, 29886, 861, 1379, 353, 29871, 29900, 13, 13, 9651, 10153, 353, 527, 29889, 1359, 580, 13, 13, 9651, 363, 921, 297, 3464, 29898, 326, 2311, 29961, 29900, 29962, 1125, 13, 18884, 363, 343, 297, 3464, 29898, 326, 2311, 29961, 29896, 29962, 1125, 13, 462, 1678, 15526, 353, 10153, 29961, 29916, 29892, 29891, 29962, 13, 462, 1678, 1423, 353, 29871, 29896, 13, 462, 1678, 1423, 2204, 332, 552, 353, 29871, 29896, 13, 462, 1678, 1423, 10921, 353, 29871, 29896, 13, 462, 1678, 1423, 26031, 2204, 332, 552, 353, 29871, 29896, 13, 462, 1678, 1423, 8517, 353, 29871, 29896, 13, 462, 1678, 565, 15526, 29961, 29941, 29962, 29966, 29906, 29900, 29900, 29901, 13, 462, 4706, 694, 974, 29886, 861, 1379, 4619, 29871, 29896, 13, 462, 4706, 694, 29877, 615, 7288, 29886, 861, 1379, 4619, 29871, 29896, 13, 462, 4706, 10153, 29961, 29916, 29892, 29891, 29962, 353, 313, 29886, 15711, 29961, 29900, 1402, 15526, 29961, 29896, 1402, 15526, 29961, 29906, 1402, 29871, 29900, 29897, 13, 462, 4706, 6773, 13, 462, 1678, 363, 474, 297, 3464, 29898, 29941, 1125, 13, 462, 4706, 565, 451, 29898, 13367, 4574, 29925, 1307, 29961, 29875, 10062, 1054, 473, 9040, 1405, 15526, 29961, 29875, 29962, 1405, 350, 29931, 4574, 29925, 1307, 29961, 29875, 29962, 29899, 1054, 473, 9040, 1125, 13, 462, 9651, 1423, 2204, 332, 552, 353, 29871, 29900, 13, 462, 4706, 565, 451, 29898, 29928, 1718, 29968, 29918, 13367, 4574, 29925, 1307, 29961, 29875, 10062, 1054, 473, 9040, 1405, 15526, 29961, 29875, 29962, 1405, 360, 1718, 29968, 29918, 13367, 4574, 29925, 1307, 29961, 29875, 29962, 29899, 1054, 473, 9040, 1125, 13, 462, 9651, 1423, 26031, 2204, 332, 552, 353, 29871, 29900, 13, 462, 4706, 565, 451, 29898, 25039, 9094, 29961, 29875, 10062, 1054, 473, 9040, 1405, 15526, 29961, 29875, 29962, 1405, 12317, 9094, 29961, 29875, 29962, 29899, 1054, 473, 9040, 1125, 13, 462, 9651, 1423, 10921, 353, 29871, 29900, 13, 462, 4706, 565, 451, 29898, 29928, 1718, 29968, 29961, 29875, 10062, 1054, 473, 9040, 1405, 15526, 29961, 29875, 29962, 1405, 360, 1718, 29968, 29961, 29875, 29962, 29899, 1054, 473, 9040, 1125, 13, 462, 9651, 1423, 8517, 353, 29871, 29900, 13, 462, 4706, 565, 1423, 2204, 332, 552, 1275, 29871, 29900, 322, 1423, 26031, 2204, 332, 552, 1275, 29871, 29900, 322, 1423, 10921, 1275, 29871, 29900, 322, 1423, 8517, 1275, 29871, 29900, 29901, 13, 462, 9651, 1423, 353, 29871, 29900, 13, 462, 1678, 565, 1423, 1275, 29871, 29900, 29901, 13, 462, 4706, 10153, 29961, 29916, 29892, 29891, 29962, 353, 313, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29906, 29945, 29945, 29897, 13, 462, 1678, 565, 1423, 1275, 29871, 29896, 29901, 13, 462, 4706, 694, 29877, 615, 7288, 29886, 861, 1379, 4619, 29871, 29896, 13, 462, 1678, 565, 1423, 2204, 332, 552, 1275, 29871, 29896, 29901, 13, 462, 4706, 694, 974, 2204, 332, 552, 29886, 861, 1379, 4619, 29871, 29896, 13, 462, 1678, 565, 1423, 26031, 2204, 332, 552, 1275, 29871, 29896, 29901, 13, 462, 4706, 694, 974, 26031, 2204, 332, 552, 29886, 861, 1379, 4619, 29871, 29896, 13, 462, 1678, 565, 1423, 10921, 1275, 29871, 29896, 29901, 13, 462, 4706, 694, 974, 10921, 29886, 861, 1379, 4619, 29871, 29896, 13, 462, 1678, 694, 974, 29886, 861, 1379, 4619, 29871, 29896, 13, 13, 9651, 1967, 29918, 1445, 29918, 3318, 353, 12013, 29889, 11207, 5971, 580, 13, 9651, 527, 29889, 7620, 29898, 3027, 29918, 1445, 29918, 3318, 29892, 3402, 2433, 2732, 1495, 13, 9651, 1967, 29918, 1445, 29918, 3318, 29889, 344, 1416, 29898, 29900, 29897, 13, 9651, 736, 1967, 29918, 1445, 29918, 3318, 13, 13, 4706, 7465, 411, 263, 601, 1124, 29889, 4032, 7317, 580, 408, 903, 29901, 13, 9651, 1967, 353, 7272, 1583, 29889, 7451, 29889, 7888, 29889, 3389, 29918, 262, 29918, 4258, 3406, 29898, 8516, 29892, 527, 1875, 29892, 527, 29897, 13, 9651, 1967, 353, 2313, 536, 29889, 2283, 29898, 18091, 29922, 3027, 29892, 10422, 2433, 3027, 29889, 2732, 1495, 13, 13, 9651, 1999, 332, 572, 18543, 25376, 482, 353, 4513, 3552, 29898, 1217, 29877, 615, 7288, 29886, 861, 1379, 29914, 1217, 974, 29886, 861, 1379, 11877, 29896, 29900, 29900, 511, 29871, 29906, 29897, 13, 9651, 10151, 2204, 332, 552, 353, 4513, 3552, 29898, 1217, 974, 2204, 332, 552, 29886, 861, 1379, 29914, 1217, 974, 29886, 861, 1379, 11877, 29896, 29900, 29900, 511, 29871, 29906, 29897, 13, 9651, 10151, 29881, 2204, 332, 552, 353, 4513, 3552, 29898, 1217, 974, 26031, 2204, 332, 552, 29886, 861, 1379, 29914, 1217, 974, 29886, 861, 1379, 11877, 29896, 29900, 29900, 511, 29871, 29906, 29897, 13, 9651, 10151, 10921, 353, 4513, 3552, 29898, 1217, 974, 10921, 29886, 861, 1379, 29914, 1217, 974, 29886, 861, 1379, 11877, 29896, 29900, 29900, 511, 29871, 29906, 29897, 13, 13, 9651, 4235, 29918, 3945, 353, 7272, 1583, 29889, 7451, 3032, 29898, 13073, 29889, 2543, 789, 1699, 2204, 332, 552, 3284, 3198, 29918, 9621, 1159, 13, 9651, 8297, 353, 2313, 536, 29889, 6026, 2580, 29898, 3257, 353, 12633, 12384, 353, 29871, 29900, 29916, 29955, 29906, 29947, 29929, 7698, 29892, 6139, 29922, 9621, 29918, 3945, 29961, 29945, 2314, 13, 9651, 565, 1999, 332, 572, 18543, 25376, 482, 18572, 29929, 29929, 29889, 29929, 29929, 29901, 13, 18884, 8297, 29889, 1202, 29918, 2671, 29898, 978, 29922, 9621, 29918, 3945, 29961, 29900, 1402, 995, 29922, 29888, 29908, 29912, 2204, 332, 572, 18543, 25376, 482, 10560, 584, 29873, 1114, 29901, 613, 10583, 29922, 8824, 29897, 13, 9651, 1683, 29901, 13, 18884, 8297, 29889, 1202, 29918, 2671, 29898, 978, 29922, 9621, 29918, 3945, 29961, 29900, 1402, 995, 29922, 29888, 29908, 29912, 2204, 332, 572, 18543, 25376, 482, 10560, 613, 10583, 29922, 8824, 29897, 13, 9651, 8297, 29889, 1202, 29918, 2671, 29898, 978, 29922, 9621, 29918, 3945, 29961, 29896, 1402, 995, 29922, 29888, 29908, 29912, 25376, 2204, 332, 552, 10560, 613, 10583, 29922, 5574, 29897, 13, 9651, 8297, 29889, 1202, 29918, 2671, 29898, 978, 29922, 9621, 29918, 3945, 29961, 29906, 1402, 995, 29922, 29888, 29908, 29912, 25376, 10921, 10560, 613, 10583, 29922, 5574, 29897, 13, 9651, 8297, 29889, 1202, 29918, 2671, 29898, 978, 29922, 9621, 29918, 3945, 29961, 29941, 1402, 995, 29922, 29888, 29908, 29912, 25376, 29881, 2204, 332, 552, 10560, 613, 10583, 29922, 5574, 29897, 13, 9651, 8297, 29889, 1202, 29918, 2671, 29898, 978, 543, 9485, 680, 613, 995, 29922, 9621, 29918, 3945, 29961, 29946, 1402, 10583, 29922, 8824, 29897, 13, 9651, 8297, 29889, 842, 29918, 21720, 29898, 726, 29922, 9621, 29918, 3945, 29961, 29953, 1822, 4830, 29898, 13073, 29889, 8921, 876, 13, 9651, 8297, 29889, 842, 29918, 3027, 29898, 2271, 543, 14930, 358, 597, 3027, 29889, 2732, 1159, 13, 9651, 8297, 29889, 842, 29918, 386, 21145, 29898, 2271, 29922, 12095, 29897, 13, 9651, 7272, 12893, 29889, 6717, 29898, 17987, 29922, 17987, 29892, 934, 29922, 3027, 29897, 13, 4706, 565, 1999, 332, 572, 18543, 25376, 482, 29958, 29929, 29945, 322, 851, 29898, 12095, 29897, 1360, 710, 29898, 13073, 29889, 8921, 29889, 4990, 29918, 485, 14873, 1125, 13, 9651, 2635, 353, 12865, 29889, 12673, 29889, 27765, 580, 13, 9651, 565, 451, 7272, 12893, 29889, 7451, 29889, 657, 29918, 29883, 468, 877, 7270, 1907, 2824, 5349, 29918, 2204, 332, 552, 29918, 7543, 29898, 13073, 29889, 8921, 29897, 322, 29871, 29953, 29966, 1256, 29889, 3250, 29966, 29906, 29900, 322, 2635, 29889, 10874, 1360, 29945, 29901, 13, 18884, 544, 353, 7272, 1583, 29889, 7451, 29889, 657, 29918, 13506, 29898, 13073, 29889, 4906, 29897, 13, 18884, 953, 353, 525, 29901, 29873, 1114, 11283, 13, 18884, 565, 12893, 29889, 2543, 789, 338, 451, 6213, 322, 12893, 29889, 12719, 29889, 17858, 6847, 29918, 1454, 29898, 13073, 29889, 2543, 789, 29889, 1004, 467, 23176, 29918, 331, 3848, 275, 29901, 13, 462, 1678, 953, 353, 12801, 29901, 2204, 332, 552, 29873, 1114, 29901, 29945, 29955, 29945, 29953, 29929, 29953, 29906, 29947, 29953, 29929, 29900, 29945, 29946, 29900, 29896, 29941, 29946, 29945, 16299, 13, 18884, 7272, 12893, 29889, 7451, 29889, 657, 29918, 29883, 468, 877, 7270, 1907, 2824, 3167, 29918, 2585, 29918, 1792, 3888, 29898, 13073, 29889, 8921, 29889, 333, 5501, 348, 29113, 29918, 2204, 332, 552, 742, 5574, 29897, 13, 18884, 7272, 12893, 29889, 6717, 29898, 710, 29898, 20675, 1583, 29889, 7451, 3032, 29898, 13073, 29889, 12719, 5501, 2204, 332, 552, 3788, 12620, 29899, 7543, 1495, 467, 4830, 29898, 13073, 29889, 8921, 29889, 358, 291, 29892, 558, 14352, 29896, 1402, 331, 876, 13, 13, 1678, 732, 26381, 29889, 6519, 29898, 2606, 2129, 29922, 1839, 2204, 332, 572, 29888, 29891, 742, 525, 2204, 332, 552, 29888, 631, 11287, 13, 1678, 732, 26381, 29889, 1111, 1025, 776, 29898, 10492, 29922, 29941, 29892, 639, 29922, 29929, 29900, 29892, 1134, 29922, 29933, 2707, 300, 1542, 29889, 1792, 29897, 13, 1678, 7465, 822, 1999, 332, 552, 29888, 29891, 29898, 1311, 29892, 13073, 29892, 3142, 353, 6213, 1125, 13, 4706, 9995, 3629, 1584, 901, 12528, 29892, 322, 1999, 332, 13111, 675, 596, 1029, 14873, 363, 445, 12528, 342, 12060, 3250, 310, 278, 6462, 29889, 13, 4706, 887, 508, 2845, 2367, 263, 1404, 470, 385, 1967, 3988, 297, 2980, 29892, 470, 10641, 385, 1967, 304, 596, 2643, 29889, 1858, 29920, 1016, 29915, 29873, 9566, 304, 367, 12528, 1213, 15945, 13, 4706, 7272, 1583, 29889, 3258, 29898, 13073, 29892, 2271, 29897, 13, 13, 13, 1678, 7465, 822, 1653, 29898, 1311, 29892, 13073, 29892, 2271, 1125, 13, 4706, 7623, 353, 6213, 13, 13, 4706, 565, 3142, 338, 451, 6213, 29901, 13, 9651, 1018, 29901, 13, 18884, 1404, 353, 7272, 8260, 29889, 2659, 18545, 2141, 13441, 29898, 13073, 29892, 2271, 29897, 13, 18884, 7623, 353, 851, 29898, 1792, 29889, 4990, 29918, 485, 14873, 29897, 13, 9651, 5174, 8960, 29901, 13, 18884, 7623, 353, 3142, 13, 4706, 1683, 29901, 13, 9651, 1544, 353, 12893, 29889, 4906, 29889, 14930, 1860, 13, 9651, 565, 7431, 29898, 2324, 29897, 2804, 29871, 29900, 29901, 13, 18884, 363, 1967, 297, 1544, 29901, 13, 462, 1678, 7623, 353, 1967, 29889, 2271, 13, 13, 4706, 565, 7623, 338, 6213, 29901, 13, 9651, 7623, 353, 12893, 29889, 8921, 29889, 4990, 29918, 485, 14873, 13, 13, 4706, 1018, 29901, 13, 9651, 7465, 411, 263, 601, 1124, 29889, 4032, 7317, 580, 408, 5939, 29901, 13, 18884, 7465, 411, 5939, 29889, 657, 29898, 710, 29898, 12095, 876, 408, 364, 29901, 13, 462, 1678, 2933, 353, 7272, 364, 29889, 949, 580, 13, 4706, 5174, 7865, 2392, 29901, 13, 9651, 7272, 12893, 29889, 6717, 29898, 710, 29898, 20675, 1583, 29889, 7451, 3032, 29898, 13073, 29889, 2543, 789, 1699, 2204, 332, 552, 3284, 3198, 29918, 20965, 1159, 467, 4830, 29898, 13073, 29889, 4906, 29889, 8921, 29889, 358, 291, 876, 13, 9651, 736, 13, 13, 13, 4706, 1018, 29901, 13, 9651, 527, 353, 7084, 29889, 3150, 29898, 11207, 5971, 29898, 5327, 876, 13, 4706, 5174, 8960, 29901, 13, 9651, 7272, 12893, 29889, 6717, 29898, 710, 29898, 20675, 1583, 29889, 7451, 3032, 29898, 13073, 29889, 2543, 789, 1699, 2204, 332, 552, 3284, 3198, 29918, 20965, 1159, 467, 4830, 29898, 13073, 29889, 4906, 29889, 8921, 29889, 358, 291, 876, 13, 9651, 736, 13, 13, 4706, 527, 2311, 353, 1051, 29898, 326, 29889, 2311, 29897, 13, 4706, 2411, 861, 1379, 353, 527, 2311, 29961, 29900, 14178, 326, 2311, 29961, 29896, 29962, 13, 4706, 4236, 29886, 15711, 2798, 353, 29871, 29896, 29945, 29953, 29906, 29945, 29900, 29900, 13, 13, 4706, 7272, 12893, 29889, 6717, 29898, 710, 29898, 20675, 1583, 29889, 7451, 3032, 29898, 13073, 29889, 2543, 789, 1699, 2204, 332, 552, 3284, 3198, 29918, 23333, 1159, 467, 4830, 29898, 13073, 29889, 4906, 29889, 8921, 29889, 358, 291, 876, 13, 13, 4706, 1018, 29901, 13, 9651, 903, 353, 527, 29889, 3888, 3366, 3259, 3108, 13, 9651, 338, 18660, 353, 5852, 13, 9651, 330, 361, 7888, 353, 938, 29898, 326, 29889, 3888, 3366, 7888, 20068, 13, 4706, 5174, 8960, 29901, 13, 9651, 338, 18660, 353, 7700, 13, 13, 4706, 565, 2411, 861, 1379, 1405, 4236, 29886, 15711, 2798, 29901, 13, 9651, 1623, 2311, 29888, 13857, 353, 5844, 29889, 3676, 29898, 3317, 29886, 15711, 2798, 29914, 6574, 861, 1379, 29897, 13, 9651, 527, 353, 19490, 3027, 29889, 21476, 29918, 2103, 29898, 326, 29892, 313, 326, 2311, 29961, 29900, 14178, 3204, 2311, 29888, 13857, 876, 13, 9651, 527, 2311, 353, 1051, 29898, 326, 29889, 2311, 29897, 13, 9651, 2411, 861, 1379, 353, 527, 2311, 29961, 29900, 14178, 326, 2311, 29961, 29896, 29962, 13, 13, 4706, 822, 527, 1875, 29898, 326, 1125, 13, 9651, 527, 353, 527, 29889, 13441, 29898, 8513, 2433, 29934, 29954, 5688, 1495, 13, 9651, 527, 353, 7084, 2369, 29882, 749, 29889, 1168, 509, 579, 29898, 326, 467, 264, 29882, 749, 29898, 29896, 29900, 29900, 29900, 29897, 13, 9651, 396, 326, 353, 7084, 2369, 29882, 749, 29889, 1168, 509, 579, 29898, 326, 467, 264, 29882, 749, 29898, 29906, 29889, 29906, 29897, 13, 9651, 527, 353, 527, 29889, 13441, 29898, 8513, 2433, 29934, 29954, 5688, 1495, 13, 13, 9651, 10153, 353, 527, 29889, 1359, 580, 13, 9651, 363, 921, 297, 3464, 29898, 326, 2311, 29961, 29900, 29962, 1125, 13, 18884, 363, 343, 297, 3464, 29898, 326, 2311, 29961, 29896, 29962, 1125, 13, 462, 1678, 15526, 353, 10153, 29961, 29916, 29892, 343, 29962, 13, 13, 462, 1678, 565, 15526, 29961, 29941, 29962, 1405, 29871, 29906, 29906, 29900, 29901, 13, 462, 4706, 565, 2533, 29898, 29886, 15711, 7503, 29941, 2314, 29914, 29941, 1405, 29871, 29906, 29906, 29906, 29901, 13, 462, 9651, 10153, 29961, 29916, 29892, 29891, 29962, 353, 12317, 9094, 13, 462, 4706, 25342, 2533, 29898, 29886, 15711, 7503, 29941, 2314, 29914, 29941, 1405, 29871, 29896, 29900, 29900, 29901, 13, 462, 9651, 10153, 29961, 29916, 29892, 29891, 29962, 353, 350, 29931, 4574, 29925, 1307, 13, 462, 4706, 25342, 2533, 29898, 29886, 15711, 7503, 29941, 2314, 29914, 29941, 1405, 29871, 29900, 29889, 29900, 29896, 29901, 13, 462, 9651, 10153, 29961, 29916, 29892, 29891, 29962, 353, 360, 1718, 29968, 29918, 13367, 4574, 29925, 1307, 13, 462, 4706, 1683, 29901, 13, 462, 9651, 10153, 29961, 29916, 29892, 29891, 29962, 353, 360, 1718, 29968, 13, 462, 1678, 1683, 29901, 13, 462, 4706, 10153, 29961, 29916, 29892, 29891, 29962, 353, 350, 29931, 4574, 29925, 1307, 7503, 29941, 10062, 23583, 4197, 29886, 15711, 29961, 29941, 24960, 13, 13, 9651, 1967, 29918, 1445, 29918, 3318, 353, 12013, 29889, 11207, 5971, 580, 13, 9651, 527, 29889, 7620, 29898, 3027, 29918, 1445, 29918, 3318, 29892, 3402, 2433, 2732, 1495, 13, 9651, 1967, 29918, 1445, 29918, 3318, 29889, 344, 1416, 29898, 29900, 29897, 13, 9651, 736, 1967, 29918, 1445, 29918, 3318, 13, 13, 4706, 822, 330, 361, 326, 1875, 29898, 326, 29892, 903, 18660, 7888, 1125, 13, 9651, 16608, 353, 518, 2557, 29889, 8552, 580, 363, 3515, 297, 7084, 20529, 29889, 20277, 29898, 326, 4638, 13, 9651, 716, 18660, 353, 5159, 13, 13, 9651, 363, 3515, 297, 16608, 29901, 13, 18884, 3515, 353, 3515, 29889, 13441, 29898, 8513, 2433, 29934, 29954, 5688, 1495, 13, 18884, 3515, 353, 7084, 2369, 29882, 749, 29889, 1168, 509, 579, 29898, 2557, 467, 264, 29882, 749, 29898, 29896, 29889, 29955, 29897, 13, 18884, 3515, 353, 3515, 29889, 13441, 29898, 8513, 2433, 29934, 29954, 5688, 1495, 13, 13, 18884, 10153, 353, 3515, 29889, 1359, 580, 13, 13, 18884, 363, 921, 297, 3464, 29898, 326, 2311, 29961, 29900, 29962, 1125, 13, 462, 1678, 363, 343, 297, 3464, 29898, 326, 2311, 29961, 29896, 29962, 1125, 13, 462, 4706, 15526, 353, 10153, 29961, 29916, 29892, 343, 29962, 13, 13, 462, 4706, 565, 15526, 29961, 29941, 29962, 1405, 29871, 29906, 29941, 29900, 29901, 13, 462, 9651, 565, 2533, 29898, 29886, 15711, 7503, 29941, 2314, 29914, 29941, 1405, 29871, 29906, 29906, 29906, 29901, 13, 462, 18884, 10153, 29961, 29916, 29892, 29891, 29962, 353, 12317, 9094, 13, 462, 9651, 25342, 2533, 29898, 29886, 15711, 7503, 29941, 2314, 29914, 29941, 1405, 29871, 29896, 29900, 29900, 29901, 13, 462, 18884, 10153, 29961, 29916, 29892, 29891, 29962, 353, 350, 29931, 4574, 29925, 1307, 13, 462, 9651, 25342, 2533, 29898, 29886, 15711, 7503, 29941, 2314, 29914, 29941, 1405, 29871, 29900, 29889, 29900, 29896, 29901, 13, 462, 18884, 10153, 29961, 29916, 29892, 29891, 29962, 353, 360, 1718, 29968, 29918, 13367, 4574, 29925, 1307, 13, 462, 9651, 1683, 29901, 13, 462, 18884, 10153, 29961, 29916, 29892, 29891, 29962, 353, 360, 1718, 29968, 13, 462, 4706, 1683, 29901, 13, 462, 9651, 10153, 29961, 29916, 29892, 29891, 29962, 353, 350, 29931, 4574, 29925, 1307, 7503, 29941, 10062, 23583, 4197, 29886, 15711, 29961, 29941, 24960, 13, 18884, 396, 363, 921, 297, 3464, 29898, 326, 2311, 29961, 29900, 29962, 1125, 13, 18884, 396, 268, 363, 343, 297, 3464, 29898, 326, 2311, 29961, 29896, 29962, 1125, 13, 18884, 396, 308, 15526, 353, 10153, 29961, 29916, 29892, 343, 29962, 13, 13, 18884, 396, 308, 565, 15526, 2804, 313, 29906, 29945, 29945, 29892, 29871, 29906, 29945, 29945, 29892, 29871, 29906, 29945, 29945, 1125, 13, 18884, 396, 632, 10153, 29961, 29916, 29892, 343, 29962, 353, 313, 29896, 29896, 29946, 29892, 29871, 29896, 29941, 29955, 29892, 29871, 29906, 29896, 29947, 29897, 13, 13, 18884, 716, 18660, 29889, 4397, 29898, 2557, 29897, 13, 13, 9651, 1967, 29918, 1445, 29918, 3318, 353, 12013, 29889, 11207, 5971, 580, 13, 13, 9651, 330, 361, 353, 716, 18660, 29961, 29900, 29962, 13, 9651, 330, 361, 29889, 7620, 29898, 3027, 29918, 1445, 29918, 3318, 29892, 3402, 2433, 18660, 742, 4078, 29918, 497, 29922, 5574, 29892, 9773, 29918, 8346, 29922, 1482, 18660, 29961, 29896, 29901, 1402, 2425, 29922, 29900, 29897, 13, 13, 9651, 1967, 29918, 1445, 29918, 3318, 29889, 344, 1416, 29898, 29900, 29897, 13, 9651, 736, 1967, 29918, 1445, 29918, 3318, 13, 13, 4706, 7465, 411, 263, 601, 1124, 29889, 4032, 7317, 580, 408, 903, 29901, 13, 9651, 565, 451, 338, 18660, 29901, 13, 18884, 1967, 353, 7272, 1583, 29889, 7451, 29889, 7888, 29889, 3389, 29918, 262, 29918, 4258, 3406, 29898, 8516, 29892, 527, 1875, 29892, 527, 29897, 13, 9651, 1683, 29901, 13, 18884, 1967, 353, 7272, 1583, 29889, 7451, 29889, 7888, 29889, 3389, 29918, 262, 29918, 4258, 3406, 29898, 8516, 29892, 330, 361, 326, 1875, 29892, 527, 29892, 330, 361, 7888, 29897, 13, 9651, 565, 451, 338, 18660, 29901, 13, 18884, 1967, 353, 2313, 536, 29889, 2283, 29898, 18091, 29922, 3027, 29892, 10422, 2433, 3027, 29889, 2732, 1495, 13, 9651, 1683, 29901, 13, 18884, 1967, 353, 2313, 536, 29889, 2283, 29898, 18091, 29922, 3027, 29892, 10422, 2433, 3027, 29889, 18660, 1495, 13, 9651, 1018, 29901, 13, 18884, 4235, 29918, 3945, 353, 7272, 1583, 29889, 7451, 3032, 29898, 13073, 29889, 2543, 789, 1699, 2204, 332, 552, 3284, 3198, 29918, 9621, 1159, 13, 18884, 8297, 353, 2313, 536, 29889, 6026, 2580, 29898, 3257, 353, 12633, 12384, 353, 29871, 29900, 29916, 29955, 29906, 29947, 29929, 7698, 29892, 6139, 29922, 9621, 29918, 3945, 29961, 29945, 2314, 13, 18884, 8297, 29889, 842, 29918, 8921, 29898, 978, 29922, 20675, 1583, 29889, 7451, 3032, 29898, 13073, 29889, 2543, 789, 5501, 2204, 332, 552, 3788, 3258, 29918, 3257, 8785, 13, 18884, 565, 451, 338, 18660, 29901, 13, 462, 1678, 8297, 29889, 842, 29918, 3027, 29898, 2271, 543, 14930, 358, 597, 3027, 29889, 2732, 1159, 13, 462, 1678, 8297, 29889, 842, 29918, 21720, 29898, 726, 29922, 710, 29898, 20675, 1583, 29889, 7451, 3032, 29898, 13073, 29889, 2543, 789, 5501, 2204, 332, 552, 3788, 3258, 29918, 21720, 29918, 29896, 1495, 467, 4830, 29898, 13073, 29889, 8921, 876, 13, 18884, 1683, 29901, 13, 462, 1678, 8297, 29889, 842, 29918, 3027, 29898, 2271, 543, 14930, 358, 597, 3027, 29889, 18660, 1159, 13, 462, 1678, 8297, 29889, 842, 29918, 21720, 29898, 726, 29922, 710, 29898, 20675, 1583, 29889, 7451, 3032, 29898, 13073, 29889, 2543, 789, 5501, 2204, 332, 552, 3788, 3258, 29918, 21720, 29918, 29906, 1495, 467, 4830, 29898, 13073, 29889, 8921, 876, 13, 18884, 8297, 29889, 842, 29918, 386, 21145, 29898, 2271, 29922, 12095, 29897, 13, 18884, 7272, 12893, 29889, 6717, 29898, 17987, 29922, 17987, 29892, 934, 29922, 3027, 29897, 13, 9651, 5174, 8960, 29901, 13, 18884, 7272, 12893, 29889, 6717, 29898, 710, 29898, 20675, 1583, 29889, 7451, 3032, 29898, 13073, 29889, 2543, 789, 5501, 2204, 332, 552, 3788, 3258, 29918, 21720, 29918, 29906, 1495, 467, 4830, 29898, 13073, 29889, 8921, 29889, 358, 291, 876, 13, 13, 1753, 6230, 29898, 7451, 1125, 13, 1678, 9225, 29889, 1202, 29918, 29883, 468, 29898, 10358, 332, 552, 29907, 468, 29898, 7451, 876, 13, 2 ]
Colab_setup/sample_colab_cell.py
FredAmouzgar/46_Simple_python_Exercise
0
98992
<gh_stars>0 """ Instruction: Copy this code to the first cell of the Jupyter notebook you want to run in the Google Colab. It automatically configures it for rendering. """ import sys, os if 'google.colab' in sys.modules and not os.path.exists('.done'): !wget -q https://raw.githubusercontent.com/FredAmouzgar/python_Exercise/master/Colab_setup/setup_colab.sh -O- | bash !touch .done # Creating a virtual display to draw game images on. if type(os.environ.get("DISPLAY")) is not str or len(os.environ.get("DISPLAY")) == 0: !bash ../xvfb start os.environ['DISPLAY'] = ':1'
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 15945, 29908, 13, 3379, 4080, 29901, 13, 1678, 14187, 445, 775, 304, 278, 937, 3038, 310, 278, 27441, 25547, 451, 19273, 366, 864, 304, 1065, 297, 278, 5087, 1530, 370, 29889, 739, 6336, 2295, 1973, 372, 363, 15061, 29889, 13, 15945, 29908, 13, 5215, 10876, 29892, 2897, 13, 361, 525, 3608, 29889, 1054, 370, 29915, 297, 10876, 29889, 7576, 322, 451, 2897, 29889, 2084, 29889, 9933, 12839, 15091, 29374, 13, 1678, 1738, 29893, 657, 448, 29939, 2045, 597, 1610, 29889, 3292, 1792, 3051, 29889, 510, 29914, 29943, 1127, 6833, 283, 29920, 5397, 29914, 4691, 29918, 1252, 6269, 895, 29914, 6207, 29914, 1625, 370, 29918, 14669, 29914, 14669, 29918, 1054, 370, 29889, 845, 448, 29949, 29899, 891, 10891, 13, 1678, 1738, 16747, 869, 15091, 13, 13, 29937, 26221, 263, 6901, 2479, 304, 4216, 3748, 4558, 373, 29889, 13, 361, 1134, 29898, 359, 29889, 21813, 29889, 657, 703, 23711, 29925, 18799, 5783, 338, 451, 851, 470, 7431, 29898, 359, 29889, 21813, 29889, 657, 703, 23711, 29925, 18799, 5783, 1275, 29871, 29900, 29901, 13, 1678, 1738, 13067, 29772, 29916, 29894, 14943, 1369, 13, 1678, 2897, 29889, 21813, 1839, 23711, 29925, 18799, 2033, 353, 525, 29901, 29896, 29915, 13, 2 ]
changePositionToIndexUpstream.py
oicr-gsi/bam-statistics
0
44427
#!/usr/bin/python ## my upstream target intervals were of size 1000 each. import sys # use stdin if stdin is full if not sys.stdin.isatty(): indexFile = sys.stdin #otherwise, read from input else: try: input_file = sys.argv[1] except IndexError: message = 'need filename as first argument if stdin is not full' raise IndexError(message) else: indexFile = open(input_file, 'rU') count = 999; start = 0; for line in indexFile: if start==0: print count start = int(line) count=count-1 else: val = int(line) if start == val - 1: print count count=count-1 start = int(line) else: print 999 count = 998 start = int(line)
[ 1, 18787, 4855, 29914, 2109, 29914, 4691, 13, 13, 2277, 590, 701, 5461, 3646, 18747, 892, 310, 2159, 29871, 29896, 29900, 29900, 29900, 1269, 29889, 13, 13, 13, 5215, 10876, 13, 13, 29937, 671, 3659, 262, 565, 3659, 262, 338, 2989, 13, 361, 451, 10876, 29889, 4172, 262, 29889, 24766, 1017, 7295, 13, 12, 2248, 2283, 353, 10876, 29889, 4172, 262, 13, 13, 29937, 1228, 3538, 29892, 1303, 515, 1881, 13, 2870, 29901, 13, 12, 2202, 29901, 13, 12, 12, 2080, 29918, 1445, 353, 10876, 29889, 19218, 29961, 29896, 29962, 13, 12, 19499, 11374, 2392, 29901, 13, 12, 12, 4906, 353, 525, 26180, 10422, 408, 937, 2980, 565, 3659, 262, 338, 451, 2989, 29915, 13, 12, 12, 22692, 11374, 2392, 29898, 4906, 29897, 13, 12, 2870, 29901, 13, 12, 12, 2248, 2283, 353, 1722, 29898, 2080, 29918, 1445, 29892, 525, 29878, 29965, 1495, 13, 13, 13, 2798, 353, 29871, 29929, 29929, 29929, 29936, 13, 2962, 353, 29871, 29900, 29936, 13, 13, 1454, 1196, 297, 2380, 2283, 29901, 13, 13, 4706, 565, 1369, 1360, 29900, 29901, 13, 18884, 1596, 2302, 13, 18884, 1369, 353, 938, 29898, 1220, 29897, 13, 18884, 2302, 29922, 2798, 29899, 29896, 13, 4706, 1683, 29901, 13, 18884, 659, 353, 938, 29898, 1220, 29897, 13, 18884, 565, 1369, 1275, 659, 448, 29871, 29896, 29901, 13, 462, 4706, 1596, 2302, 13, 462, 4706, 2302, 29922, 2798, 29899, 29896, 13, 462, 4706, 1369, 353, 938, 29898, 1220, 29897, 13, 18884, 1683, 29901, 13, 462, 4706, 1596, 29871, 29929, 29929, 29929, 13, 462, 4706, 2302, 353, 29871, 29929, 29929, 29947, 13, 462, 4706, 1369, 353, 938, 29898, 1220, 29897, 13, 2 ]
ccnpy/tests/test_Name.py
mmosko/ccnpy
1
74549
# Copyright 2019 <NAME> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import array import unittest import ccnpy class Name_Test(unittest.TestCase): def test_from_uri(self): uri='ccnx:/apple/banana/cherry/durian' name = ccnpy.Name.from_uri(uri) wire_format = name.serialize() truth = array.array('B', [0, 0, 0, 39, 0, 1, 0, 5, 97, 112, 112, 108, 101, 0, 1, 0, 6, 98, 97, 110, 97, 110, 97, 0, 1, 0, 6, 99, 104, 101, 114, 114, 121, 0, 1, 0, 6, 100, 117, 114, 105, 97, 110]) self.assertEqual(wire_format, truth, 'incorrect wire format') def test_components(self): uri='ccnx:/apple/banana/cherry/durian' name = ccnpy.Name.from_uri(uri) self.assertEqual(name.count(), 4) self.assertEqual(name[0], 'apple') self.assertEqual(name[1], 'banana') self.assertEqual(name[2], 'cherry') self.assertEqual(name[3], 'durian') def test_deserialize(self): wire_format = array.array('B', [0, 0, 0, 39, 0, 1, 0, 5, 97, 112, 112, 108, 101, 0, 1, 0, 6, 98, 97, 110, 97, 110, 97, 0, 1, 0, 6, 99, 104, 101, 114, 114, 121, 0, 1, 0, 6, 100, 117, 114, 105, 97, 110]) tlv = ccnpy.Tlv.deserialize(wire_format) actual = ccnpy.Name.parse(tlv) expected = ccnpy.Name.from_uri('ccnx:/apple/banana/cherry/durian') self.assertEqual(expected, actual, "Incorrect deserialize")
[ 1, 396, 29871, 14187, 1266, 29871, 29906, 29900, 29896, 29929, 529, 5813, 29958, 13, 29937, 13, 29937, 29871, 10413, 21144, 1090, 278, 13380, 19245, 29892, 10079, 29871, 29906, 29889, 29900, 313, 1552, 376, 29931, 293, 1947, 1496, 13, 29937, 29871, 366, 1122, 451, 671, 445, 934, 5174, 297, 752, 13036, 411, 278, 19245, 29889, 13, 29937, 29871, 887, 1122, 4017, 263, 3509, 310, 278, 19245, 472, 13, 29937, 13, 29937, 418, 1732, 597, 1636, 29889, 4288, 29889, 990, 29914, 506, 11259, 29914, 27888, 1430, 1660, 29899, 29906, 29889, 29900, 13, 29937, 13, 29937, 29871, 25870, 3734, 491, 22903, 4307, 470, 15502, 304, 297, 5007, 29892, 7047, 13, 29937, 29871, 13235, 1090, 278, 19245, 338, 13235, 373, 385, 376, 3289, 8519, 29908, 350, 3289, 3235, 29892, 13, 29937, 29871, 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, 29871, 2823, 278, 19245, 363, 278, 2702, 4086, 14765, 1076, 11239, 322, 13, 29937, 29871, 27028, 1090, 278, 19245, 29889, 13, 13, 13, 5215, 1409, 13, 5215, 443, 27958, 13, 13, 5215, 274, 18038, 2272, 13, 13, 13, 1990, 4408, 29918, 3057, 29898, 348, 27958, 29889, 3057, 8259, 1125, 13, 1678, 822, 1243, 29918, 3166, 29918, 5338, 29898, 1311, 1125, 13, 4706, 21333, 2433, 617, 23818, 8419, 11548, 29914, 2571, 1648, 29914, 4630, 719, 29914, 29881, 332, 713, 29915, 13, 4706, 1024, 353, 274, 18038, 2272, 29889, 1170, 29889, 3166, 29918, 5338, 29898, 5338, 29897, 13, 4706, 8014, 29918, 4830, 353, 1024, 29889, 643, 6646, 580, 13, 4706, 8760, 353, 1409, 29889, 2378, 877, 29933, 742, 518, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29941, 29929, 29892, 13, 462, 462, 259, 29900, 29892, 29871, 29896, 29892, 29871, 29900, 29892, 29871, 29945, 29892, 29871, 29929, 29955, 29892, 29871, 29896, 29896, 29906, 29892, 29871, 29896, 29896, 29906, 29892, 29871, 29896, 29900, 29947, 29892, 29871, 29896, 29900, 29896, 29892, 13, 462, 462, 259, 29900, 29892, 29871, 29896, 29892, 29871, 29900, 29892, 29871, 29953, 29892, 29871, 29929, 29947, 29892, 29871, 29929, 29955, 29892, 29871, 29896, 29896, 29900, 29892, 29871, 29929, 29955, 29892, 29871, 29896, 29896, 29900, 29892, 29871, 29929, 29955, 29892, 13, 462, 462, 259, 29900, 29892, 29871, 29896, 29892, 29871, 29900, 29892, 29871, 29953, 29892, 29871, 29929, 29929, 29892, 29871, 29896, 29900, 29946, 29892, 29871, 29896, 29900, 29896, 29892, 29871, 29896, 29896, 29946, 29892, 29871, 29896, 29896, 29946, 29892, 29871, 29896, 29906, 29896, 29892, 13, 462, 462, 259, 29900, 29892, 29871, 29896, 29892, 29871, 29900, 29892, 29871, 29953, 29892, 29871, 29896, 29900, 29900, 29892, 29871, 29896, 29896, 29955, 29892, 29871, 29896, 29896, 29946, 29892, 29871, 29896, 29900, 29945, 29892, 29871, 29929, 29955, 29892, 29871, 29896, 29896, 29900, 2314, 13, 13, 4706, 1583, 29889, 9294, 9843, 29898, 22376, 29918, 4830, 29892, 8760, 29892, 525, 262, 15728, 8014, 3402, 1495, 13, 13, 1678, 822, 1243, 29918, 14036, 29898, 1311, 1125, 13, 4706, 21333, 2433, 617, 23818, 8419, 11548, 29914, 2571, 1648, 29914, 4630, 719, 29914, 29881, 332, 713, 29915, 13, 4706, 1024, 353, 274, 18038, 2272, 29889, 1170, 29889, 3166, 29918, 5338, 29898, 5338, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 978, 29889, 2798, 3285, 29871, 29946, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 978, 29961, 29900, 1402, 525, 11548, 1495, 13, 4706, 1583, 29889, 9294, 9843, 29898, 978, 29961, 29896, 1402, 525, 2571, 1648, 1495, 13, 4706, 1583, 29889, 9294, 9843, 29898, 978, 29961, 29906, 1402, 525, 4630, 719, 1495, 13, 4706, 1583, 29889, 9294, 9843, 29898, 978, 29961, 29941, 1402, 525, 29881, 332, 713, 1495, 13, 13, 1678, 822, 1243, 29918, 2783, 261, 6646, 29898, 1311, 1125, 13, 4706, 8014, 29918, 4830, 353, 1409, 29889, 2378, 877, 29933, 742, 518, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29941, 29929, 29892, 13, 462, 462, 308, 29900, 29892, 29871, 29896, 29892, 29871, 29900, 29892, 29871, 29945, 29892, 29871, 29929, 29955, 29892, 29871, 29896, 29896, 29906, 29892, 29871, 29896, 29896, 29906, 29892, 29871, 29896, 29900, 29947, 29892, 29871, 29896, 29900, 29896, 29892, 13, 462, 462, 308, 29900, 29892, 29871, 29896, 29892, 29871, 29900, 29892, 29871, 29953, 29892, 29871, 29929, 29947, 29892, 29871, 29929, 29955, 29892, 29871, 29896, 29896, 29900, 29892, 29871, 29929, 29955, 29892, 29871, 29896, 29896, 29900, 29892, 29871, 29929, 29955, 29892, 13, 462, 462, 308, 29900, 29892, 29871, 29896, 29892, 29871, 29900, 29892, 29871, 29953, 29892, 29871, 29929, 29929, 29892, 29871, 29896, 29900, 29946, 29892, 29871, 29896, 29900, 29896, 29892, 29871, 29896, 29896, 29946, 29892, 29871, 29896, 29896, 29946, 29892, 29871, 29896, 29906, 29896, 29892, 13, 462, 462, 308, 29900, 29892, 29871, 29896, 29892, 29871, 29900, 29892, 29871, 29953, 29892, 29871, 29896, 29900, 29900, 29892, 29871, 29896, 29896, 29955, 29892, 29871, 29896, 29896, 29946, 29892, 29871, 29896, 29900, 29945, 29892, 29871, 29929, 29955, 29892, 29871, 29896, 29896, 29900, 2314, 13, 4706, 260, 28463, 353, 274, 18038, 2272, 29889, 29911, 28463, 29889, 2783, 261, 6646, 29898, 22376, 29918, 4830, 29897, 13, 4706, 3935, 353, 274, 18038, 2272, 29889, 1170, 29889, 5510, 29898, 15206, 29894, 29897, 13, 4706, 3806, 353, 274, 18038, 2272, 29889, 1170, 29889, 3166, 29918, 5338, 877, 617, 23818, 8419, 11548, 29914, 2571, 1648, 29914, 4630, 719, 29914, 29881, 332, 713, 1495, 13, 4706, 1583, 29889, 9294, 9843, 29898, 9684, 29892, 3935, 29892, 376, 797, 15728, 16964, 6646, 1159, 13, 2 ]
codes/blocks/sand.py
shenjackyuanjie/Minecraft
2
121871
def ben_update(): return def ben_random_tick(): return
[ 1, 29871, 13, 13, 1753, 3856, 29918, 5504, 7295, 13, 1678, 736, 13, 13, 13, 1753, 3856, 29918, 8172, 29918, 24667, 7295, 13, 1678, 736, 13, 2 ]
assets/src/ba_data/python/bastd/ui/purchase.py
SahandAslani/ballistica
0
162978
# Copyright (c) 2011-2020 <NAME> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. # ----------------------------------------------------------------------------- """UI related to purchasing items.""" from __future__ import annotations from typing import TYPE_CHECKING import _ba import ba if TYPE_CHECKING: from typing import Any, Dict, List, Optional class PurchaseWindow(ba.Window): """Window for purchasing one or more items.""" def __init__(self, items: List[str], transition: str = 'in_right', header_text: ba.Lstr = None): from ba.internal import get_store_item_display_size from bastd.ui.store import item as storeitemui if header_text is None: header_text = ba.Lstr(resource='unlockThisText', fallback_resource='unlockThisInTheStoreText') if len(items) != 1: raise ValueError('expected exactly 1 item') self._items = list(items) self._width = 580 self._height = 520 uiscale = ba.app.uiscale super().__init__(root_widget=ba.containerwidget( size=(self._width, self._height), transition=transition, toolbar_visibility='menu_currency', scale=(1.2 if uiscale is ba.UIScale.SMALL else 1.1 if uiscale is ba.UIScale.MEDIUM else 1.0), stack_offset=(0, -15) if uiscale is ba.UIScale.SMALL else (0, 0))) self._is_double = False self._title_text = ba.textwidget(parent=self._root_widget, position=(self._width * 0.5, self._height - 30), size=(0, 0), text=header_text, h_align='center', v_align='center', maxwidth=self._width * 0.9 - 120, scale=1.2, color=(1, 0.8, 0.3, 1)) size = get_store_item_display_size(items[0]) display: Dict[str, Any] = {} storeitemui.instantiate_store_item_display( items[0], display, parent_widget=self._root_widget, b_pos=(self._width * 0.5 - size[0] * 0.5 + 10 - ((size[0] * 0.5 + 30) if self._is_double else 0), self._height * 0.5 - size[1] * 0.5 + 30 + (20 if self._is_double else 0)), b_width=size[0], b_height=size[1], button=False) # Wire up the parts we need. if self._is_double: pass # not working else: if self._items == ['pro']: price_str = _ba.get_price(self._items[0]) pyoffs = -15 else: pyoffs = 0 price = self._price = _ba.get_account_misc_read_val( 'price.' + str(items[0]), -1) price_str = ba.charstr(ba.SpecialChar.TICKET) + str(price) self._price_text = ba.textwidget(parent=self._root_widget, position=(self._width * 0.5, 150 + pyoffs), size=(0, 0), text=price_str, h_align='center', v_align='center', maxwidth=self._width * 0.9, scale=1.4, color=(0.2, 1, 0.2)) self._update_timer = ba.Timer(1.0, ba.WeakCall(self._update), timetype=ba.TimeType.REAL, repeat=True) self._cancel_button = ba.buttonwidget( parent=self._root_widget, position=(50, 40), size=(150, 60), scale=1.0, on_activate_call=self._cancel, autoselect=True, label=ba.Lstr(resource='cancelText')) self._purchase_button = ba.buttonwidget( parent=self._root_widget, position=(self._width - 200, 40), size=(150, 60), scale=1.0, on_activate_call=self._purchase, autoselect=True, label=ba.Lstr(resource='store.purchaseText')) ba.containerwidget(edit=self._root_widget, cancel_button=self._cancel_button, start_button=self._purchase_button, selected_child=self._purchase_button) def _update(self) -> None: from ba.internal import have_pro can_die = False # We go away if we see that our target item is owned. if self._items == ['pro']: if have_pro(): can_die = True else: if _ba.get_purchased(self._items[0]): can_die = True if can_die: ba.containerwidget(edit=self._root_widget, transition='out_left') def _purchase(self) -> None: from bastd.ui import getcurrency if self._items == ['pro']: _ba.purchase('pro') else: ticket_count: Optional[int] try: ticket_count = _ba.get_account_ticket_count() except Exception: ticket_count = None if ticket_count is not None and ticket_count < self._price: getcurrency.show_get_tickets_prompt() ba.playsound(ba.getsound('error')) return def do_it() -> None: _ba.in_game_purchase(self._items[0], self._price) ba.playsound(ba.getsound('swish')) do_it() def _cancel(self) -> None: ba.containerwidget(edit=self._root_widget, transition='out_right')
[ 1, 396, 14187, 1266, 313, 29883, 29897, 29871, 29906, 29900, 29896, 29896, 29899, 29906, 29900, 29906, 29900, 529, 5813, 29958, 13, 29937, 13, 29937, 20894, 2333, 338, 1244, 1609, 16896, 29892, 3889, 310, 8323, 29892, 304, 738, 2022, 4017, 292, 263, 3509, 13, 29937, 310, 445, 7047, 322, 6942, 5106, 2066, 313, 1552, 376, 6295, 14093, 4968, 304, 5376, 13, 29937, 297, 278, 18540, 1728, 24345, 29892, 3704, 1728, 29485, 278, 10462, 13, 29937, 304, 671, 29892, 3509, 29892, 6623, 29892, 10366, 29892, 9805, 29892, 1320, 2666, 29892, 269, 803, 1947, 29892, 322, 29914, 272, 19417, 13, 29937, 14591, 310, 278, 18540, 29892, 322, 304, 14257, 12407, 304, 6029, 278, 18540, 338, 13, 29937, 15252, 3276, 304, 437, 577, 29892, 4967, 304, 278, 1494, 5855, 29901, 13, 29937, 13, 29937, 450, 2038, 3509, 1266, 8369, 322, 445, 10751, 8369, 4091, 367, 5134, 297, 13, 29937, 599, 14591, 470, 23228, 2011, 1080, 310, 278, 18540, 29889, 13, 29937, 13, 29937, 6093, 7791, 7818, 12982, 1525, 8519, 13756, 13044, 3352, 376, 3289, 8519, 613, 399, 1806, 8187, 2692, 399, 1718, 29934, 13566, 29979, 8079, 13764, 29979, 476, 22255, 29892, 8528, 15094, 1799, 6323, 13, 29937, 306, 3580, 5265, 3352, 29892, 2672, 6154, 15789, 4214, 350, 2692, 6058, 27848, 3352, 7495, 6093, 399, 1718, 29934, 13566, 29059, 8079, 341, 1001, 3210, 13566, 2882, 6227, 11937, 29892, 13, 29937, 383, 1806, 8186, 1799, 15842, 319, 349, 8322, 2965, 13309, 1718, 349, 4574, 13152, 1660, 5300, 405, 1164, 1177, 15860, 1177, 1692, 13780, 29889, 2672, 11698, 382, 29963, 3919, 24972, 9818, 6093, 13, 29937, 26524, 29950, 24125, 6323, 315, 4590, 29979, 22789, 3912, 379, 5607, 8032, 29903, 20700, 17705, 6181, 15842, 13764, 29979, 315, 4375, 7833, 29892, 21330, 1529, 1692, 29903, 6323, 438, 29911, 4448, 13, 29937, 17705, 2882, 6227, 11937, 29892, 12317, 2544, 4448, 2672, 13764, 319, 9838, 8079, 8707, 29911, 4717, 1783, 29892, 323, 8476, 6323, 438, 29911, 4448, 22119, 1660, 29892, 9033, 3235, 4214, 3895, 29892, 13, 29937, 19474, 8079, 6323, 2672, 8707, 8186, 9838, 22659, 6093, 7791, 7818, 12982, 1525, 6323, 6093, 501, 1660, 6323, 438, 29911, 4448, 5012, 1964, 4214, 29903, 2672, 6093, 13, 29937, 7791, 7818, 12982, 1525, 29889, 13, 29937, 448, 2683, 2683, 2683, 2683, 9072, 13, 15945, 29908, 3120, 4475, 304, 10596, 5832, 4452, 1213, 15945, 13, 13, 3166, 4770, 29888, 9130, 1649, 1053, 25495, 13, 13, 3166, 19229, 1053, 323, 6959, 29918, 3210, 16658, 4214, 13, 13, 5215, 903, 2291, 13, 5215, 9922, 13, 13, 361, 323, 6959, 29918, 3210, 16658, 4214, 29901, 13, 1678, 515, 19229, 1053, 3139, 29892, 360, 919, 29892, 2391, 29892, 28379, 13, 13, 13, 1990, 349, 27574, 5907, 29898, 2291, 29889, 5907, 1125, 13, 1678, 9995, 5907, 363, 10596, 5832, 697, 470, 901, 4452, 1213, 15945, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 13, 462, 4452, 29901, 2391, 29961, 710, 1402, 13, 462, 9558, 29901, 851, 353, 525, 262, 29918, 1266, 742, 13, 462, 4839, 29918, 726, 29901, 9922, 29889, 29931, 710, 353, 6213, 1125, 13, 4706, 515, 9922, 29889, 7564, 1053, 679, 29918, 8899, 29918, 667, 29918, 4990, 29918, 2311, 13, 4706, 515, 21156, 29881, 29889, 1481, 29889, 8899, 1053, 2944, 408, 3787, 667, 1481, 13, 4706, 565, 4839, 29918, 726, 338, 6213, 29901, 13, 9651, 4839, 29918, 726, 353, 9922, 29889, 29931, 710, 29898, 10314, 2433, 348, 908, 4013, 1626, 742, 13, 462, 462, 29871, 6416, 1627, 29918, 10314, 2433, 348, 908, 4013, 797, 1576, 9044, 1626, 1495, 13, 4706, 565, 7431, 29898, 7076, 29897, 2804, 29871, 29896, 29901, 13, 9651, 12020, 7865, 2392, 877, 9684, 3721, 29871, 29896, 2944, 1495, 13, 4706, 1583, 3032, 7076, 353, 1051, 29898, 7076, 29897, 13, 4706, 1583, 3032, 2103, 353, 29871, 29945, 29947, 29900, 13, 4706, 1583, 3032, 3545, 353, 29871, 29945, 29906, 29900, 13, 4706, 318, 10669, 744, 353, 9922, 29889, 932, 29889, 4664, 29883, 744, 13, 4706, 2428, 2141, 1649, 2344, 12035, 4632, 29918, 8030, 29922, 2291, 29889, 7611, 8030, 29898, 13, 9651, 2159, 7607, 1311, 3032, 2103, 29892, 1583, 3032, 3545, 511, 13, 9651, 9558, 29922, 20543, 29892, 13, 9651, 29840, 29918, 28814, 2433, 6510, 29918, 26095, 742, 13, 9651, 6287, 7607, 29896, 29889, 29906, 565, 318, 10669, 744, 338, 9922, 29889, 3120, 17185, 29889, 29903, 1529, 2208, 1683, 13, 462, 1678, 29896, 29889, 29896, 565, 318, 10669, 744, 338, 9922, 29889, 3120, 17185, 29889, 2303, 4571, 5005, 1683, 29871, 29896, 29889, 29900, 511, 13, 9651, 5096, 29918, 10289, 7607, 29900, 29892, 448, 29896, 29945, 29897, 565, 318, 10669, 744, 338, 9922, 29889, 3120, 17185, 29889, 29903, 1529, 2208, 1683, 313, 29900, 29892, 29871, 29900, 4961, 13, 4706, 1583, 3032, 275, 29918, 8896, 353, 7700, 13, 4706, 1583, 3032, 3257, 29918, 726, 353, 9922, 29889, 726, 8030, 29898, 3560, 29922, 1311, 3032, 4632, 29918, 8030, 29892, 13, 462, 462, 308, 2602, 7607, 1311, 3032, 2103, 334, 29871, 29900, 29889, 29945, 29892, 13, 462, 462, 462, 259, 1583, 3032, 3545, 448, 29871, 29941, 29900, 511, 13, 462, 462, 308, 2159, 7607, 29900, 29892, 29871, 29900, 511, 13, 462, 462, 308, 1426, 29922, 6672, 29918, 726, 29892, 13, 462, 462, 308, 298, 29918, 2520, 2433, 5064, 742, 13, 462, 462, 308, 325, 29918, 2520, 2433, 5064, 742, 13, 462, 462, 308, 4236, 2103, 29922, 1311, 3032, 2103, 334, 29871, 29900, 29889, 29929, 448, 29871, 29896, 29906, 29900, 29892, 13, 462, 462, 308, 6287, 29922, 29896, 29889, 29906, 29892, 13, 462, 462, 308, 2927, 7607, 29896, 29892, 29871, 29900, 29889, 29947, 29892, 29871, 29900, 29889, 29941, 29892, 29871, 29896, 876, 13, 4706, 2159, 353, 679, 29918, 8899, 29918, 667, 29918, 4990, 29918, 2311, 29898, 7076, 29961, 29900, 2314, 13, 4706, 2479, 29901, 360, 919, 29961, 710, 29892, 3139, 29962, 353, 6571, 13, 4706, 3787, 667, 1481, 29889, 2611, 3656, 403, 29918, 8899, 29918, 667, 29918, 4990, 29898, 13, 9651, 4452, 29961, 29900, 1402, 13, 9651, 2479, 29892, 13, 9651, 3847, 29918, 8030, 29922, 1311, 3032, 4632, 29918, 8030, 29892, 13, 9651, 289, 29918, 1066, 7607, 1311, 3032, 2103, 334, 29871, 29900, 29889, 29945, 448, 2159, 29961, 29900, 29962, 334, 29871, 29900, 29889, 29945, 718, 29871, 29896, 29900, 448, 13, 462, 259, 5135, 2311, 29961, 29900, 29962, 334, 29871, 29900, 29889, 29945, 718, 29871, 29941, 29900, 29897, 565, 1583, 3032, 275, 29918, 8896, 1683, 29871, 29900, 511, 13, 462, 259, 1583, 3032, 3545, 334, 29871, 29900, 29889, 29945, 448, 2159, 29961, 29896, 29962, 334, 29871, 29900, 29889, 29945, 718, 29871, 29941, 29900, 718, 13, 462, 259, 313, 29906, 29900, 565, 1583, 3032, 275, 29918, 8896, 1683, 29871, 29900, 8243, 13, 9651, 289, 29918, 2103, 29922, 2311, 29961, 29900, 1402, 13, 9651, 289, 29918, 3545, 29922, 2311, 29961, 29896, 1402, 13, 9651, 2826, 29922, 8824, 29897, 13, 13, 4706, 396, 399, 533, 701, 278, 5633, 591, 817, 29889, 13, 4706, 565, 1583, 3032, 275, 29918, 8896, 29901, 13, 9651, 1209, 29871, 396, 451, 1985, 13, 4706, 1683, 29901, 13, 9651, 565, 1583, 3032, 7076, 1275, 6024, 771, 2033, 29901, 13, 18884, 8666, 29918, 710, 353, 903, 2291, 29889, 657, 29918, 9175, 29898, 1311, 3032, 7076, 29961, 29900, 2314, 13, 18884, 11451, 22450, 353, 448, 29896, 29945, 13, 9651, 1683, 29901, 13, 18884, 11451, 22450, 353, 29871, 29900, 13, 18884, 8666, 353, 1583, 3032, 9175, 353, 903, 2291, 29889, 657, 29918, 10149, 29918, 29885, 10669, 29918, 949, 29918, 791, 29898, 13, 462, 1678, 525, 9175, 6169, 718, 851, 29898, 7076, 29961, 29900, 11724, 448, 29896, 29897, 13, 18884, 8666, 29918, 710, 353, 9922, 29889, 3090, 710, 29898, 2291, 29889, 24780, 5914, 29889, 29911, 2965, 29968, 2544, 29897, 718, 851, 29898, 9175, 29897, 13, 9651, 1583, 3032, 9175, 29918, 726, 353, 9922, 29889, 726, 8030, 29898, 3560, 29922, 1311, 3032, 4632, 29918, 8030, 29892, 13, 462, 462, 632, 2602, 7607, 1311, 3032, 2103, 334, 29871, 29900, 29889, 29945, 29892, 13, 462, 462, 462, 4706, 29896, 29945, 29900, 718, 11451, 22450, 511, 13, 462, 462, 632, 2159, 7607, 29900, 29892, 29871, 29900, 511, 13, 462, 462, 632, 1426, 29922, 9175, 29918, 710, 29892, 13, 462, 462, 632, 298, 29918, 2520, 2433, 5064, 742, 13, 462, 462, 632, 325, 29918, 2520, 2433, 5064, 742, 13, 462, 462, 632, 4236, 2103, 29922, 1311, 3032, 2103, 334, 29871, 29900, 29889, 29929, 29892, 13, 462, 462, 632, 6287, 29922, 29896, 29889, 29946, 29892, 13, 462, 462, 632, 2927, 7607, 29900, 29889, 29906, 29892, 29871, 29896, 29892, 29871, 29900, 29889, 29906, 876, 13, 13, 4706, 1583, 3032, 5504, 29918, 20404, 353, 9922, 29889, 14745, 29898, 29896, 29889, 29900, 29892, 13, 462, 462, 418, 9922, 29889, 4806, 557, 5594, 29898, 1311, 3032, 5504, 511, 13, 462, 462, 418, 5335, 300, 668, 29922, 2291, 29889, 2481, 1542, 29889, 1525, 1964, 29892, 13, 462, 462, 418, 12312, 29922, 5574, 29897, 13, 13, 4706, 1583, 3032, 20713, 29918, 3092, 353, 9922, 29889, 3092, 8030, 29898, 13, 9651, 3847, 29922, 1311, 3032, 4632, 29918, 8030, 29892, 13, 9651, 2602, 7607, 29945, 29900, 29892, 29871, 29946, 29900, 511, 13, 9651, 2159, 7607, 29896, 29945, 29900, 29892, 29871, 29953, 29900, 511, 13, 9651, 6287, 29922, 29896, 29889, 29900, 29892, 13, 9651, 373, 29918, 11236, 403, 29918, 4804, 29922, 1311, 3032, 20713, 29892, 13, 9651, 1120, 852, 781, 29922, 5574, 29892, 13, 9651, 3858, 29922, 2291, 29889, 29931, 710, 29898, 10314, 2433, 20713, 1626, 8785, 13, 4706, 1583, 3032, 29886, 27574, 29918, 3092, 353, 9922, 29889, 3092, 8030, 29898, 13, 9651, 3847, 29922, 1311, 3032, 4632, 29918, 8030, 29892, 13, 9651, 2602, 7607, 1311, 3032, 2103, 448, 29871, 29906, 29900, 29900, 29892, 29871, 29946, 29900, 511, 13, 9651, 2159, 7607, 29896, 29945, 29900, 29892, 29871, 29953, 29900, 511, 13, 9651, 6287, 29922, 29896, 29889, 29900, 29892, 13, 9651, 373, 29918, 11236, 403, 29918, 4804, 29922, 1311, 3032, 29886, 27574, 29892, 13, 9651, 1120, 852, 781, 29922, 5574, 29892, 13, 9651, 3858, 29922, 2291, 29889, 29931, 710, 29898, 10314, 2433, 8899, 29889, 29886, 27574, 1626, 8785, 13, 13, 4706, 9922, 29889, 7611, 8030, 29898, 5628, 29922, 1311, 3032, 4632, 29918, 8030, 29892, 13, 462, 965, 12611, 29918, 3092, 29922, 1311, 3032, 20713, 29918, 3092, 29892, 13, 462, 965, 1369, 29918, 3092, 29922, 1311, 3032, 29886, 27574, 29918, 3092, 29892, 13, 462, 965, 4629, 29918, 5145, 29922, 1311, 3032, 29886, 27574, 29918, 3092, 29897, 13, 13, 1678, 822, 903, 5504, 29898, 1311, 29897, 1599, 6213, 29901, 13, 4706, 515, 9922, 29889, 7564, 1053, 505, 29918, 771, 13, 4706, 508, 29918, 16217, 353, 7700, 13, 13, 4706, 396, 1334, 748, 3448, 565, 591, 1074, 393, 1749, 3646, 2944, 338, 15205, 29889, 13, 4706, 565, 1583, 3032, 7076, 1275, 6024, 771, 2033, 29901, 13, 9651, 565, 505, 29918, 771, 7295, 13, 18884, 508, 29918, 16217, 353, 5852, 13, 4706, 1683, 29901, 13, 9651, 565, 903, 2291, 29889, 657, 29918, 29886, 2458, 1463, 29898, 1311, 3032, 7076, 29961, 29900, 29962, 1125, 13, 18884, 508, 29918, 16217, 353, 5852, 13, 13, 4706, 565, 508, 29918, 16217, 29901, 13, 9651, 9922, 29889, 7611, 8030, 29898, 5628, 29922, 1311, 3032, 4632, 29918, 8030, 29892, 9558, 2433, 449, 29918, 1563, 1495, 13, 13, 1678, 822, 903, 29886, 27574, 29898, 1311, 29897, 1599, 6213, 29901, 13, 4706, 515, 21156, 29881, 29889, 1481, 1053, 679, 26095, 13, 4706, 565, 1583, 3032, 7076, 1275, 6024, 771, 2033, 29901, 13, 9651, 903, 2291, 29889, 29886, 27574, 877, 771, 1495, 13, 4706, 1683, 29901, 13, 9651, 23381, 29918, 2798, 29901, 28379, 29961, 524, 29962, 13, 9651, 1018, 29901, 13, 18884, 23381, 29918, 2798, 353, 903, 2291, 29889, 657, 29918, 10149, 29918, 29873, 8522, 29918, 2798, 580, 13, 9651, 5174, 8960, 29901, 13, 18884, 23381, 29918, 2798, 353, 6213, 13, 9651, 565, 23381, 29918, 2798, 338, 451, 6213, 322, 23381, 29918, 2798, 529, 1583, 3032, 9175, 29901, 13, 18884, 679, 26095, 29889, 4294, 29918, 657, 29918, 24667, 1691, 29918, 14032, 415, 580, 13, 18884, 9922, 29889, 12922, 618, 29898, 2291, 29889, 20078, 618, 877, 2704, 8785, 13, 18884, 736, 13, 13, 9651, 822, 437, 29918, 277, 580, 1599, 6213, 29901, 13, 18884, 903, 2291, 29889, 262, 29918, 11802, 29918, 29886, 27574, 29898, 1311, 3032, 7076, 29961, 29900, 1402, 1583, 3032, 9175, 29897, 13, 13, 9651, 9922, 29889, 12922, 618, 29898, 2291, 29889, 20078, 618, 877, 2774, 728, 8785, 13, 9651, 437, 29918, 277, 580, 13, 13, 1678, 822, 903, 20713, 29898, 1311, 29897, 1599, 6213, 29901, 13, 4706, 9922, 29889, 7611, 8030, 29898, 5628, 29922, 1311, 3032, 4632, 29918, 8030, 29892, 9558, 2433, 449, 29918, 1266, 1495, 13, 2 ]
models/ir_model.py
OSevangelist/vsf-odoo
84
71571
from odoo import fields, models class IrModel(models.Model): _inherit = 'ir.model' rest_api = fields.Boolean('REST API', default=True, help="Allow this model to be fetched through REST API")
[ 1, 515, 288, 1867, 29877, 1053, 29871, 4235, 29892, 4733, 13, 13, 1990, 6600, 3195, 29898, 9794, 29889, 3195, 1125, 13, 13, 1678, 903, 262, 27069, 353, 525, 381, 29889, 4299, 29915, 13, 1678, 1791, 29918, 2754, 353, 4235, 29889, 18146, 877, 1525, 1254, 3450, 742, 2322, 29922, 5574, 29892, 13, 462, 795, 1371, 543, 15930, 445, 1904, 304, 367, 6699, 287, 1549, 16759, 3450, 1159, 13, 2 ]
models/Family.py
Eric-Fernandes-529/Final_Project_SW555
0
171104
class Family: ''' This is the class for Family. id is the only variable that is required. If other variable does not exist, it would return None If children does not exist, it would return an empty list all date value are passed in as str, and saved as tuple with formate (year, month, day) ''' def __init__(self, id: str): # from Individual import Individual self.id = id self._husband = None self._wife = None self._marriedDate = None self._divorced = None self._children = [] self._lineNum = {} def get_lineNum(self) -> {}: return self._lineNum def get_id(self) -> str: return self.id def get_husband(self): return self._husband def get_wife(self): return self._wife def get_marriedDate(self) -> tuple: return self._marriedDate def get_divorcedDate(self) -> tuple: return self._divorced def get_children(self) -> list: return self._children def set_lineNum(self, lineNumberDict)->None: self._lineNum = lineNumberDict def set_husband(self, husband) -> None: ##if not isinstance(husband, Individual): raise TypeError("input has to be a Individual type") self._husband = husband def set_wife(self, wife) -> None: ##if not isinstance(wife, Individual): raise TypeError("input has to be a Individual type") self._wife = wife def set_marriedDate(self, married_date: tuple) -> None: ##if not isinstance(married_date, str): raise TypeError("input has to be a str type") if all(isinstance(v, int) for v in married_date): self._marriedDate = married_date return self._marriedDate = self.change_date_formate(married_date) def set_divorcedDate(self, divorced_date: tuple) -> None: ##if not isinstance(divorced_date, str): raise TypeError("input has to be a str type") if all(isinstance(v, int) for v in divorced_date): self._divorcedDate = divorced_date return self._divorced = self.change_date_formate(divorced_date) def set_children(self, children_list: list) -> None: ##if not isinstance(children_list, list): raise TypeError("input has to be a list type") self._children = children_list def add_child(self, child) -> None: ''' this function would add one kid into the children list ''' ##if not isinstance(child, Individual): raise TypeError("input has to be a Individual type") self._children.append(child) def change_date_formate(self, date: list) -> tuple: ''' Would take the string input and convert it into a int tuple:(year, month, day) ''' monthList = {"JAN": 1, "FEB": 2, "MAR": 3, "APR": 4, "MAY": 5, "JUN": 6, "JUL": 7, "AUG": 8, "SEP": 9, "OCT": 10, "NOV": 11, "DEC": 12} return int(date[2]), monthList[date[1]], int(date[0]) def multiple_births_lessOrEqual_than_5(self): # cannot catch multi multiples; not sure if need to from datetime import date today = date.today() try: births = sorted( list(map(lambda i: abs((date(*i) - today).days), [x.get_birthDate() for x in self.get_children()]))) except AttributeError: raise AttributeError("Missing birthdate for children") if len(births) <= 5: return True multi, sameDay, pre = 0, 0, births[0] for i in range(len(births)): if pre == births[i]: multi += 1 sameDay += 1 elif births[i] - pre == 1: multi, sameDay = sameDay + 1, 1 else: multi, sameDay = 1, 1 pre = births[i] if multi >= 5: return False return True def parents_not_too_old(self): if not self._husband or not self._wife: raise AttributeError("Error: missing husband or wife") if not self._husband.get_age() or not self._wife.get_age(): raise AttributeError( "Error: missing age for husband or wife") if not self._husband.get_age() or not self._wife.get_age(): raise AttributeError("Error: missing age for husband or wife") wife_age = self._wife.get_age() husband_age = self._husband.get_age() for child in self._children: if not child.get_age(): raise AttributeError("Error: missing child age") wife_diff = wife_age - child.get_age() husband_diff = husband_age - child.get_age() if wife_diff >= 60 or husband_diff >= 80: return False return True def marriage_before_divorce(self): from datetime import date marriage = self.get_marriedDate() divorce = self.get_divorcedDate() if not marriage: raise AttributeError("Missing marriage date") if not divorce: return True timedelta = date(*marriage) - date(*divorce) return timedelta.days < 0 def marriage_after_14(self) -> bool: from datetime import date if not self._husband or not self._wife or not self._marriedDate: raise AttributeError( "Missing husband/wife/marriedDate") if not self._husband.get_birthDate() or not self._wife.get_birthDate(): raise AttributeError( "Missing birthdate for husband/wife") if not self._husband or not self._wife or not self._marriedDate: raise AttributeError("Missing husband/wife/marriedDate") if not self._husband.get_birthDate() or not self._wife.get_birthDate(): raise AttributeError("Missing birthdate for husband/wife") husbandMarryAge = (date(*self._marriedDate) - date(*self._husband.get_birthDate())).days // 365 wifeMarryAge = (date(*self._marriedDate) - date(*self._wife.get_birthDate())).days // 365 return husbandMarryAge > 14 and wifeMarryAge > 14 def marriage_before_death(self): from datetime import date if not self._husband or not self._wife or not self.get_marriedDate(): raise AttributeError( "Missing husband/wife/marriedDate") if not self._husband.get_deathDate() and not self._wife.get_deathDate(): return True death = None if not self._husband.get_deathDate(): death = self._wife.get_deathDate() elif not self._wife.get_deathDate(): death = self._husband.get_deathDate() if not self._husband or not self._wife or not self.get_marriedDate(): raise AttributeError("Missing husband/wife/marriedDate") if not self._husband.get_deathDate() and not self._wife.get_deathDate(): return True death = None if not self._husband.get_deathDate(): death = self._wife.get_deathDate() elif not self._wife.get_deathDate(): death = self._husband.get_deathDate() else: if self._husband.get_deathDate() > self._wife.get_deathDate(): death = self._wife.get_deathDate() else: death = self._husband.get_deathDate() marriage = self._marriedDate timedelta = date(*marriage) - date(*death) return timedelta.days <= 0 def divorce_before_death(self) -> bool: from datetime import date if not self._husband or not self._wife: raise AttributeError("Missing husband/wife") if not self._husband.get_deathDate() and not self._wife.get_deathDate(): return True if not self._divorced: return True deathdays = None if not self._husband.get_deathDate(): deathdays = (date(*self._divorced) - date(*self._husband.get_deathDate())).days elif not self._wife.get_deathDate(): deathdays = (date(*self._divorced) - date(*self._wife.get_deathDate())).days else: deathdays = (date(*self._divorced) - date(*self._husband.get_deathDate())).days if deathdays > (date(*self._divorced) - date(*self._wife.get_deathDate())).days: deathdays = (date(*self._divorced) - date(*self._wife.get_deathDate())).days return deathdays < 0 def birth_before_marriage_of_parents(self): if not self._husband or not self._wife: raise AttributeError("Missing husband/wife") if not self.get_marriedDate():raise AttributeError("Missing marrageDate") for c in self._children: if not c.get_birthDate(): raise AttributeError("Missing child birthDate") if c.get_birthDate() <= self.get_marriedDate(): return False return True def birth_before_death_of_parents(self): if not self._husband or not self._wife: raise AttributeError("Missing husband/wife") if not self._husband.get_deathDate() and not self._wife.get_deathDate(): return True if len(self._children) == 0: return True death = self._wife.get_deathDate() hDeath = self._husband.get_deathDate() if not hDeath: for c in self._children: if c.get_birthDate() > death: return False return True hDeath = hDeath + (0, 9, 0) if hDeath[1] > 12: hDeath[1] = hDeath[1] % 12 hDeath[0] = hDeath[0] + 1 if not death: for c in self._children: if c.get_birthDate() > hDeath: return False return True if hDeath < death: if not death and not hDeath: return True if hDeath: hDeath = tuple(map(sum, zip(hDeath, (0,9,0)))) if hDeath[1] > 12: hDeath[1] = hDeath[1] % 12 hDeath[0] = hDeath[0] + 1 if death is None or hDeath < death: death = hDeath for c in self._children: if c.get_birthDate() > death: return False return True def siblings_spacing(self): from datetime import date threshold = [1, 240] # 8 month is ambiguous, let's just assume 8*30=240 days n = len(self.get_children()) if n < 2: return True sumOfDifference = 0 for i in range(n - 1): timedelta = date(*self.get_children()[i].get_birthDate()) - date(*self.get_children()[i + 1].get_birthDate()) sumOfDifference += abs(timedelta.days) return not (threshold[0] < sumOfDifference // (n - 1) < threshold[1]) def fewer_than_15_siblings(self): """ if self._children is empty, it is a empty list which the length is 0 :return: boolean if the length of self._children is less then 15 """ return len(self._children) < 15 def correct_gender_for_role(self): """ throw error when missing husband/wife or missing gender of husband/wife :return: boolean from compare the string of husband and wife gender """ if (not self._husband or not self._wife): raise AttributeError("missing husband or wife") if (not self._husband.get_gender() or not self._wife.get_gender()): raise AttributeError( "missing gender of husband or wife") return self._husband.get_gender() == "M" and self._wife.get_gender() == "F" def male_last_names(self): if not self._husband: raise AttributeError("Missing Father") if not self._husband.get_name(): raise AttributeError("Missing Father's name") check_last_name = self._husband.get_name().split(' ')[1] def dfs(family, last_name): flag = True for child in family.get_children(): if child.get_gender() == None: raise AttributeError("child's gender is not set yet") if child.get_gender() == "F": continue if not child.get_name(): raise AttributeError("Child's name is missing") if child.get_name().split(' ')[1] != last_name: return False for fam in child.get_family(): flag = dfs(fam) and flag return flag return dfs(self, check_last_name) def siblings_should_not_marry(self): if not self._husband or not self._wife: raise AttributeError("Missing husband or wife") if not self._husband.get_parent_family() and not self._wife.get_parent_family(): raise AttributeError("Missing husband and wife parent") return not self._husband.get_parent_family().get_id() == self._wife.get_parent_family().get_id() def order_siblings_by_age(self): """ Need one extra step which filters out the Nones. Not sure if necessary. :return: list of references in the order of descending age """ res = sorted(self.get_children(), key=lambda x: x.get_age(days=True), reverse=True) return list(filter(lambda x: x.get_birthDate() != None, res)) if __name__ == "__main__": pass # from models.Individual import Individual #from models.Individual import Individual # ---------------------------testing cases below---------------------------
[ 1, 770, 14662, 29901, 13, 1678, 14550, 13, 1678, 910, 338, 278, 770, 363, 14662, 29889, 13, 1678, 1178, 338, 278, 871, 2286, 393, 338, 3734, 29889, 960, 916, 2286, 947, 451, 1863, 29892, 372, 723, 736, 6213, 13, 1678, 960, 4344, 947, 451, 1863, 29892, 372, 723, 736, 385, 4069, 1051, 13, 1678, 599, 2635, 995, 526, 4502, 297, 408, 851, 29892, 322, 7160, 408, 18761, 411, 883, 403, 313, 6360, 29892, 4098, 29892, 2462, 29897, 13, 1678, 14550, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1178, 29901, 851, 1125, 13, 4706, 396, 515, 1894, 23352, 1053, 1894, 23352, 13, 4706, 1583, 29889, 333, 353, 1178, 13, 4706, 1583, 3032, 14116, 4980, 353, 6213, 13, 4706, 1583, 3032, 29893, 1607, 353, 6213, 13, 4706, 1583, 3032, 3034, 1255, 2539, 353, 6213, 13, 4706, 1583, 3032, 4563, 272, 1133, 353, 6213, 13, 4706, 1583, 3032, 11991, 353, 5159, 13, 4706, 1583, 3032, 1220, 8009, 353, 6571, 13, 13, 1678, 822, 679, 29918, 1220, 8009, 29898, 1311, 29897, 1599, 426, 6177, 13, 4706, 736, 1583, 3032, 1220, 8009, 13, 13, 1678, 822, 679, 29918, 333, 29898, 1311, 29897, 1599, 851, 29901, 13, 4706, 736, 1583, 29889, 333, 13, 13, 1678, 822, 679, 29918, 14116, 4980, 29898, 1311, 1125, 13, 4706, 736, 1583, 3032, 14116, 4980, 13, 13, 1678, 822, 679, 29918, 29893, 1607, 29898, 1311, 1125, 13, 4706, 736, 1583, 3032, 29893, 1607, 13, 13, 1678, 822, 679, 29918, 3034, 1255, 2539, 29898, 1311, 29897, 1599, 18761, 29901, 13, 4706, 736, 1583, 3032, 3034, 1255, 2539, 13, 13, 1678, 822, 679, 29918, 4563, 272, 1133, 2539, 29898, 1311, 29897, 1599, 18761, 29901, 13, 4706, 736, 1583, 3032, 4563, 272, 1133, 13, 13, 1678, 822, 679, 29918, 11991, 29898, 1311, 29897, 1599, 1051, 29901, 13, 4706, 736, 1583, 3032, 11991, 13, 13, 1678, 822, 731, 29918, 1220, 8009, 29898, 1311, 29892, 1196, 4557, 21533, 19969, 8516, 29901, 13, 308, 1583, 3032, 1220, 8009, 353, 1196, 4557, 21533, 13, 13, 1678, 822, 731, 29918, 14116, 4980, 29898, 1311, 29892, 10216, 29897, 1599, 6213, 29901, 13, 4706, 444, 361, 451, 338, 8758, 29898, 14116, 4980, 29892, 1894, 23352, 1125, 12020, 20948, 703, 2080, 756, 304, 367, 263, 1894, 23352, 1134, 1159, 13, 4706, 1583, 3032, 14116, 4980, 353, 10216, 13, 13, 1678, 822, 731, 29918, 29893, 1607, 29898, 1311, 29892, 6532, 29897, 1599, 6213, 29901, 13, 13, 4706, 444, 361, 451, 338, 8758, 29898, 29893, 1607, 29892, 1894, 23352, 1125, 12020, 20948, 703, 2080, 756, 304, 367, 263, 1894, 23352, 1134, 1159, 13, 4706, 1583, 3032, 29893, 1607, 353, 6532, 13, 13, 1678, 822, 731, 29918, 3034, 1255, 2539, 29898, 1311, 29892, 8300, 29918, 1256, 29901, 18761, 29897, 1599, 6213, 29901, 13, 13, 4706, 444, 361, 451, 338, 8758, 29898, 3034, 1255, 29918, 1256, 29892, 851, 1125, 12020, 20948, 703, 2080, 756, 304, 367, 263, 851, 1134, 1159, 13, 4706, 565, 599, 29898, 275, 8758, 29898, 29894, 29892, 938, 29897, 363, 325, 297, 8300, 29918, 1256, 1125, 13, 9651, 1583, 3032, 3034, 1255, 2539, 353, 8300, 29918, 1256, 13, 9651, 736, 13, 4706, 1583, 3032, 3034, 1255, 2539, 353, 1583, 29889, 3167, 29918, 1256, 29918, 689, 403, 29898, 3034, 1255, 29918, 1256, 29897, 13, 13, 1678, 822, 731, 29918, 4563, 272, 1133, 2539, 29898, 1311, 29892, 25074, 1133, 29918, 1256, 29901, 18761, 29897, 1599, 6213, 29901, 13, 13, 4706, 444, 361, 451, 338, 8758, 29898, 4563, 272, 1133, 29918, 1256, 29892, 851, 1125, 12020, 20948, 703, 2080, 756, 304, 367, 263, 851, 1134, 1159, 13, 4706, 565, 599, 29898, 275, 8758, 29898, 29894, 29892, 938, 29897, 363, 325, 297, 25074, 1133, 29918, 1256, 1125, 13, 9651, 1583, 3032, 4563, 272, 1133, 2539, 353, 25074, 1133, 29918, 1256, 13, 9651, 736, 13, 4706, 1583, 3032, 4563, 272, 1133, 353, 1583, 29889, 3167, 29918, 1256, 29918, 689, 403, 29898, 4563, 272, 1133, 29918, 1256, 29897, 13, 13, 1678, 822, 731, 29918, 11991, 29898, 1311, 29892, 4344, 29918, 1761, 29901, 1051, 29897, 1599, 6213, 29901, 13, 4706, 444, 361, 451, 338, 8758, 29898, 11991, 29918, 1761, 29892, 1051, 1125, 12020, 20948, 703, 2080, 756, 304, 367, 263, 1051, 1134, 1159, 13, 4706, 1583, 3032, 11991, 353, 4344, 29918, 1761, 13, 13, 1678, 822, 788, 29918, 5145, 29898, 1311, 29892, 2278, 29897, 1599, 6213, 29901, 13, 4706, 14550, 13, 4706, 445, 740, 723, 788, 697, 26397, 964, 278, 4344, 1051, 13, 4706, 14550, 13, 4706, 444, 361, 451, 338, 8758, 29898, 5145, 29892, 1894, 23352, 1125, 12020, 20948, 703, 2080, 756, 304, 367, 263, 1894, 23352, 1134, 1159, 13, 4706, 1583, 3032, 11991, 29889, 4397, 29898, 5145, 29897, 13, 13, 1678, 822, 1735, 29918, 1256, 29918, 689, 403, 29898, 1311, 29892, 2635, 29901, 1051, 29897, 1599, 18761, 29901, 13, 4706, 14550, 13, 4706, 10878, 2125, 278, 1347, 1881, 322, 3588, 372, 964, 263, 938, 18761, 5919, 6360, 29892, 4098, 29892, 2462, 29897, 13, 4706, 14550, 13, 4706, 4098, 1293, 353, 8853, 29967, 2190, 1115, 29871, 29896, 29892, 376, 16359, 29933, 1115, 29871, 29906, 29892, 376, 1529, 29934, 1115, 29871, 29941, 29892, 376, 3301, 29934, 1115, 29871, 29946, 29892, 376, 1529, 29979, 1115, 29871, 29945, 29892, 376, 29967, 3904, 1115, 29871, 29953, 29892, 376, 29967, 13309, 1115, 29871, 29955, 29892, 376, 29909, 23338, 1115, 29871, 29947, 29892, 376, 1660, 29925, 1115, 29871, 29929, 29892, 13, 462, 268, 376, 29949, 1783, 1115, 29871, 29896, 29900, 29892, 376, 6632, 29963, 1115, 29871, 29896, 29896, 29892, 376, 2287, 29907, 1115, 29871, 29896, 29906, 29913, 13, 4706, 736, 938, 29898, 1256, 29961, 29906, 11724, 4098, 1293, 29961, 1256, 29961, 29896, 20526, 938, 29898, 1256, 29961, 29900, 2314, 13, 13, 1678, 822, 2999, 29918, 29890, 7515, 29879, 29918, 2222, 2816, 9843, 29918, 27603, 29918, 29945, 29898, 1311, 1125, 29871, 396, 2609, 4380, 2473, 2473, 2701, 29936, 451, 1854, 565, 817, 304, 13, 4706, 515, 12865, 1053, 2635, 13, 4706, 9826, 353, 2635, 29889, 27765, 580, 13, 4706, 1018, 29901, 13, 9651, 12060, 29879, 353, 12705, 29898, 13, 18884, 1051, 29898, 1958, 29898, 2892, 474, 29901, 6425, 3552, 1256, 10456, 29875, 29897, 448, 9826, 467, 16700, 511, 518, 29916, 29889, 657, 29918, 29890, 7515, 2539, 580, 363, 921, 297, 1583, 29889, 657, 29918, 11991, 580, 29962, 4961, 13, 4706, 5174, 23833, 2392, 29901, 13, 9651, 12020, 23833, 2392, 703, 18552, 292, 12060, 1256, 363, 4344, 1159, 13, 4706, 565, 7431, 29898, 29890, 7515, 29879, 29897, 5277, 29871, 29945, 29901, 13, 9651, 736, 5852, 13, 4706, 2473, 29892, 1021, 12742, 29892, 758, 353, 29871, 29900, 29892, 29871, 29900, 29892, 12060, 29879, 29961, 29900, 29962, 13, 4706, 363, 474, 297, 3464, 29898, 2435, 29898, 29890, 7515, 29879, 22164, 13, 9651, 565, 758, 1275, 12060, 29879, 29961, 29875, 5387, 13, 18884, 2473, 4619, 29871, 29896, 13, 18884, 1021, 12742, 4619, 29871, 29896, 13, 9651, 25342, 12060, 29879, 29961, 29875, 29962, 448, 758, 1275, 29871, 29896, 29901, 13, 18884, 2473, 29892, 1021, 12742, 353, 1021, 12742, 718, 29871, 29896, 29892, 29871, 29896, 13, 9651, 1683, 29901, 13, 18884, 2473, 29892, 1021, 12742, 353, 29871, 29896, 29892, 29871, 29896, 13, 9651, 758, 353, 12060, 29879, 29961, 29875, 29962, 13, 9651, 565, 2473, 6736, 29871, 29945, 29901, 13, 18884, 736, 7700, 13, 4706, 736, 5852, 13, 13, 1678, 822, 11825, 29918, 1333, 29918, 517, 29877, 29918, 1025, 29898, 1311, 1125, 13, 4706, 565, 451, 1583, 3032, 14116, 4980, 470, 451, 1583, 3032, 29893, 1607, 29901, 12020, 23833, 2392, 703, 2392, 29901, 4567, 10216, 470, 6532, 1159, 13, 13, 4706, 565, 451, 1583, 3032, 14116, 4980, 29889, 657, 29918, 482, 580, 470, 451, 1583, 3032, 29893, 1607, 29889, 657, 29918, 482, 7295, 12020, 23833, 2392, 29898, 13, 9651, 376, 2392, 29901, 4567, 5046, 363, 10216, 470, 6532, 1159, 13, 13, 4706, 565, 451, 1583, 3032, 14116, 4980, 29889, 657, 29918, 482, 580, 470, 451, 1583, 3032, 29893, 1607, 29889, 657, 29918, 482, 7295, 12020, 23833, 2392, 703, 2392, 29901, 4567, 5046, 363, 10216, 470, 6532, 1159, 13, 13, 4706, 6532, 29918, 482, 353, 1583, 3032, 29893, 1607, 29889, 657, 29918, 482, 580, 13, 4706, 10216, 29918, 482, 353, 1583, 3032, 14116, 4980, 29889, 657, 29918, 482, 580, 13, 4706, 363, 2278, 297, 1583, 3032, 11991, 29901, 13, 9651, 565, 451, 2278, 29889, 657, 29918, 482, 7295, 12020, 23833, 2392, 703, 2392, 29901, 4567, 2278, 5046, 1159, 13, 9651, 6532, 29918, 12765, 353, 6532, 29918, 482, 448, 2278, 29889, 657, 29918, 482, 580, 13, 9651, 10216, 29918, 12765, 353, 10216, 29918, 482, 448, 2278, 29889, 657, 29918, 482, 580, 13, 9651, 565, 6532, 29918, 12765, 6736, 29871, 29953, 29900, 470, 10216, 29918, 12765, 6736, 29871, 29947, 29900, 29901, 736, 7700, 13, 4706, 736, 5852, 13, 13, 1678, 822, 13718, 29918, 11083, 29918, 4563, 272, 346, 29898, 1311, 1125, 13, 4706, 515, 12865, 1053, 2635, 13, 4706, 13718, 353, 1583, 29889, 657, 29918, 3034, 1255, 2539, 580, 13, 4706, 25074, 346, 353, 1583, 29889, 657, 29918, 4563, 272, 1133, 2539, 580, 13, 4706, 565, 451, 13718, 29901, 12020, 23833, 2392, 703, 18552, 292, 13718, 2635, 1159, 13, 4706, 565, 451, 25074, 346, 29901, 736, 5852, 13, 4706, 5335, 287, 2554, 353, 2635, 10456, 3034, 9081, 29897, 448, 2635, 10456, 4563, 272, 346, 29897, 13, 4706, 736, 5335, 287, 2554, 29889, 16700, 529, 29871, 29900, 13, 13, 1678, 822, 13718, 29918, 7045, 29918, 29896, 29946, 29898, 1311, 29897, 1599, 6120, 29901, 13, 4706, 515, 12865, 1053, 2635, 13, 13, 4706, 565, 451, 1583, 3032, 14116, 4980, 470, 451, 1583, 3032, 29893, 1607, 470, 451, 1583, 3032, 3034, 1255, 2539, 29901, 12020, 23833, 2392, 29898, 13, 9651, 376, 18552, 292, 10216, 29914, 29893, 1607, 29914, 3034, 1255, 2539, 1159, 13, 4706, 565, 451, 1583, 3032, 14116, 4980, 29889, 657, 29918, 29890, 7515, 2539, 580, 470, 451, 1583, 3032, 29893, 1607, 29889, 657, 29918, 29890, 7515, 2539, 7295, 12020, 23833, 2392, 29898, 13, 9651, 376, 18552, 292, 12060, 1256, 363, 10216, 29914, 29893, 1607, 1159, 13, 13, 4706, 565, 451, 1583, 3032, 14116, 4980, 470, 451, 1583, 3032, 29893, 1607, 470, 451, 1583, 3032, 3034, 1255, 2539, 29901, 12020, 23833, 2392, 703, 18552, 292, 10216, 29914, 29893, 1607, 29914, 3034, 1255, 2539, 1159, 13, 4706, 565, 451, 1583, 3032, 14116, 4980, 29889, 657, 29918, 29890, 7515, 2539, 580, 470, 451, 1583, 3032, 29893, 1607, 29889, 657, 29918, 29890, 7515, 2539, 7295, 12020, 23833, 2392, 703, 18552, 292, 12060, 1256, 363, 10216, 29914, 29893, 1607, 1159, 13, 4706, 10216, 7083, 719, 22406, 353, 313, 1256, 10456, 1311, 3032, 3034, 1255, 2539, 29897, 448, 2635, 10456, 1311, 3032, 14116, 4980, 29889, 657, 29918, 29890, 7515, 2539, 3101, 467, 16700, 849, 29871, 29941, 29953, 29945, 13, 4706, 6532, 7083, 719, 22406, 353, 313, 1256, 10456, 1311, 3032, 3034, 1255, 2539, 29897, 448, 2635, 10456, 1311, 3032, 29893, 1607, 29889, 657, 29918, 29890, 7515, 2539, 3101, 467, 16700, 849, 29871, 29941, 29953, 29945, 13, 4706, 736, 10216, 7083, 719, 22406, 1405, 29871, 29896, 29946, 322, 6532, 7083, 719, 22406, 1405, 29871, 29896, 29946, 13, 13, 1678, 822, 13718, 29918, 11083, 29918, 311, 493, 29898, 1311, 1125, 13, 4706, 515, 12865, 1053, 2635, 13, 13, 4706, 565, 451, 1583, 3032, 14116, 4980, 470, 451, 1583, 3032, 29893, 1607, 470, 451, 1583, 29889, 657, 29918, 3034, 1255, 2539, 7295, 12020, 23833, 2392, 29898, 13, 9651, 376, 18552, 292, 10216, 29914, 29893, 1607, 29914, 3034, 1255, 2539, 1159, 13, 4706, 565, 451, 1583, 3032, 14116, 4980, 29889, 657, 29918, 311, 493, 2539, 580, 322, 451, 1583, 3032, 29893, 1607, 29889, 657, 29918, 311, 493, 2539, 7295, 736, 5852, 13, 13, 4706, 4892, 353, 6213, 13, 4706, 565, 451, 1583, 3032, 14116, 4980, 29889, 657, 29918, 311, 493, 2539, 7295, 13, 9651, 4892, 353, 1583, 3032, 29893, 1607, 29889, 657, 29918, 311, 493, 2539, 580, 13, 4706, 25342, 451, 1583, 3032, 29893, 1607, 29889, 657, 29918, 311, 493, 2539, 7295, 13, 9651, 4892, 353, 1583, 3032, 14116, 4980, 29889, 657, 29918, 311, 493, 2539, 580, 13, 13, 4706, 565, 451, 1583, 3032, 14116, 4980, 470, 451, 1583, 3032, 29893, 1607, 470, 451, 1583, 29889, 657, 29918, 3034, 1255, 2539, 7295, 12020, 23833, 2392, 703, 18552, 292, 10216, 29914, 29893, 1607, 29914, 3034, 1255, 2539, 1159, 13, 4706, 565, 451, 1583, 3032, 14116, 4980, 29889, 657, 29918, 311, 493, 2539, 580, 322, 451, 1583, 3032, 29893, 1607, 29889, 657, 29918, 311, 493, 2539, 7295, 736, 5852, 13, 13, 4706, 4892, 353, 6213, 13, 4706, 565, 451, 1583, 3032, 14116, 4980, 29889, 657, 29918, 311, 493, 2539, 7295, 4892, 353, 1583, 3032, 29893, 1607, 29889, 657, 29918, 311, 493, 2539, 580, 13, 4706, 25342, 451, 1583, 3032, 29893, 1607, 29889, 657, 29918, 311, 493, 2539, 7295, 4892, 353, 1583, 3032, 14116, 4980, 29889, 657, 29918, 311, 493, 2539, 580, 13, 13, 4706, 1683, 29901, 13, 9651, 565, 1583, 3032, 14116, 4980, 29889, 657, 29918, 311, 493, 2539, 580, 1405, 1583, 3032, 29893, 1607, 29889, 657, 29918, 311, 493, 2539, 7295, 13, 18884, 4892, 353, 1583, 3032, 29893, 1607, 29889, 657, 29918, 311, 493, 2539, 580, 13, 9651, 1683, 29901, 13, 18884, 4892, 353, 1583, 3032, 14116, 4980, 29889, 657, 29918, 311, 493, 2539, 580, 13, 4706, 13718, 353, 1583, 3032, 3034, 1255, 2539, 13, 4706, 5335, 287, 2554, 353, 2635, 10456, 3034, 9081, 29897, 448, 2635, 10456, 311, 493, 29897, 13, 4706, 736, 5335, 287, 2554, 29889, 16700, 5277, 29871, 29900, 13, 13, 1678, 822, 25074, 346, 29918, 11083, 29918, 311, 493, 29898, 1311, 29897, 1599, 6120, 29901, 13, 4706, 515, 12865, 1053, 2635, 13, 4706, 565, 451, 1583, 3032, 14116, 4980, 470, 451, 1583, 3032, 29893, 1607, 29901, 12020, 23833, 2392, 703, 18552, 292, 10216, 29914, 29893, 1607, 1159, 13, 4706, 565, 451, 1583, 3032, 14116, 4980, 29889, 657, 29918, 311, 493, 2539, 580, 322, 451, 1583, 3032, 29893, 1607, 29889, 657, 29918, 311, 493, 2539, 7295, 736, 5852, 13, 4706, 565, 451, 1583, 3032, 4563, 272, 1133, 29901, 736, 5852, 13, 13, 4706, 4892, 16700, 353, 6213, 13, 4706, 565, 451, 1583, 3032, 14116, 4980, 29889, 657, 29918, 311, 493, 2539, 7295, 13, 9651, 4892, 16700, 353, 313, 1256, 10456, 1311, 3032, 4563, 272, 1133, 29897, 448, 2635, 10456, 1311, 3032, 14116, 4980, 29889, 657, 29918, 311, 493, 2539, 3101, 467, 16700, 13, 4706, 25342, 451, 1583, 3032, 29893, 1607, 29889, 657, 29918, 311, 493, 2539, 7295, 13, 9651, 4892, 16700, 353, 313, 1256, 10456, 1311, 3032, 4563, 272, 1133, 29897, 448, 2635, 10456, 1311, 3032, 29893, 1607, 29889, 657, 29918, 311, 493, 2539, 3101, 467, 16700, 13, 4706, 1683, 29901, 13, 9651, 4892, 16700, 353, 313, 1256, 10456, 1311, 3032, 4563, 272, 1133, 29897, 448, 2635, 10456, 1311, 3032, 14116, 4980, 29889, 657, 29918, 311, 493, 2539, 3101, 467, 16700, 13, 9651, 565, 4892, 16700, 1405, 313, 1256, 10456, 1311, 3032, 4563, 272, 1133, 29897, 448, 2635, 10456, 1311, 3032, 29893, 1607, 29889, 657, 29918, 311, 493, 2539, 3101, 467, 16700, 29901, 13, 18884, 4892, 16700, 353, 313, 1256, 10456, 1311, 3032, 4563, 272, 1133, 29897, 448, 2635, 10456, 1311, 3032, 29893, 1607, 29889, 657, 29918, 311, 493, 2539, 3101, 467, 16700, 13, 13, 4706, 736, 4892, 16700, 529, 29871, 29900, 13, 13, 13, 1678, 822, 12060, 29918, 11083, 29918, 3034, 9081, 29918, 974, 29918, 862, 1237, 29898, 1311, 1125, 13, 4706, 565, 451, 1583, 3032, 14116, 4980, 470, 451, 1583, 3032, 29893, 1607, 29901, 12020, 23833, 2392, 703, 18552, 292, 10216, 29914, 29893, 1607, 1159, 13, 4706, 565, 451, 1583, 29889, 657, 29918, 3034, 1255, 2539, 7295, 22692, 23833, 2392, 703, 18552, 292, 1766, 6617, 2539, 1159, 13, 13, 4706, 363, 274, 297, 1583, 3032, 11991, 29901, 13, 9651, 565, 451, 274, 29889, 657, 29918, 29890, 7515, 2539, 7295, 12020, 23833, 2392, 703, 18552, 292, 2278, 12060, 2539, 1159, 13, 9651, 565, 274, 29889, 657, 29918, 29890, 7515, 2539, 580, 5277, 1583, 29889, 657, 29918, 3034, 1255, 2539, 7295, 736, 7700, 13, 4706, 736, 5852, 13, 13, 1678, 822, 12060, 29918, 11083, 29918, 311, 493, 29918, 974, 29918, 862, 1237, 29898, 1311, 1125, 13, 4706, 565, 451, 1583, 3032, 14116, 4980, 470, 451, 1583, 3032, 29893, 1607, 29901, 12020, 23833, 2392, 703, 18552, 292, 10216, 29914, 29893, 1607, 1159, 13, 4706, 565, 451, 1583, 3032, 14116, 4980, 29889, 657, 29918, 311, 493, 2539, 580, 322, 451, 1583, 3032, 29893, 1607, 29889, 657, 29918, 311, 493, 2539, 7295, 736, 5852, 13, 4706, 565, 7431, 29898, 1311, 3032, 11991, 29897, 1275, 29871, 29900, 29901, 736, 5852, 13, 4706, 4892, 353, 1583, 3032, 29893, 1607, 29889, 657, 29918, 311, 493, 2539, 580, 13, 4706, 298, 2772, 493, 353, 1583, 3032, 14116, 4980, 29889, 657, 29918, 311, 493, 2539, 580, 13, 13, 13, 4706, 565, 451, 298, 2772, 493, 29901, 13, 9651, 363, 274, 297, 1583, 3032, 11991, 29901, 13, 18884, 565, 274, 29889, 657, 29918, 29890, 7515, 2539, 580, 1405, 4892, 29901, 736, 7700, 13, 9651, 736, 5852, 13, 13, 4706, 298, 2772, 493, 353, 298, 2772, 493, 718, 313, 29900, 29892, 29871, 29929, 29892, 29871, 29900, 29897, 13, 4706, 565, 298, 2772, 493, 29961, 29896, 29962, 1405, 29871, 29896, 29906, 29901, 13, 9651, 298, 2772, 493, 29961, 29896, 29962, 353, 298, 2772, 493, 29961, 29896, 29962, 1273, 29871, 29896, 29906, 13, 9651, 298, 2772, 493, 29961, 29900, 29962, 353, 298, 2772, 493, 29961, 29900, 29962, 718, 29871, 29896, 13, 4706, 565, 451, 4892, 29901, 13, 9651, 363, 274, 297, 1583, 3032, 11991, 29901, 13, 18884, 565, 274, 29889, 657, 29918, 29890, 7515, 2539, 580, 1405, 298, 2772, 493, 29901, 736, 7700, 13, 9651, 736, 5852, 13, 13, 4706, 565, 298, 2772, 493, 529, 4892, 29901, 13, 13, 9651, 565, 451, 4892, 322, 451, 298, 2772, 493, 29901, 13, 18884, 736, 5852, 13, 4706, 565, 298, 2772, 493, 29901, 13, 9651, 298, 2772, 493, 353, 18761, 29898, 1958, 29898, 2083, 29892, 14319, 29898, 29882, 2772, 493, 29892, 313, 29900, 29892, 29929, 29892, 29900, 13697, 13, 9651, 565, 298, 2772, 493, 29961, 29896, 29962, 1405, 29871, 29896, 29906, 29901, 13, 18884, 298, 2772, 493, 29961, 29896, 29962, 353, 298, 2772, 493, 29961, 29896, 29962, 1273, 29871, 29896, 29906, 13, 18884, 298, 2772, 493, 29961, 29900, 29962, 353, 298, 2772, 493, 29961, 29900, 29962, 718, 29871, 29896, 13, 4706, 565, 4892, 338, 6213, 470, 298, 2772, 493, 529, 4892, 29901, 13, 13, 9651, 4892, 353, 298, 2772, 493, 13, 13, 4706, 363, 274, 297, 1583, 3032, 11991, 29901, 13, 9651, 565, 274, 29889, 657, 29918, 29890, 7515, 2539, 580, 1405, 4892, 29901, 736, 7700, 13, 4706, 736, 5852, 13, 13, 1678, 822, 27767, 18964, 29918, 1028, 9390, 29898, 1311, 1125, 13, 4706, 515, 12865, 1053, 2635, 13, 4706, 16897, 353, 518, 29896, 29892, 29871, 29906, 29946, 29900, 29962, 29871, 396, 29871, 29947, 4098, 338, 22363, 681, 29892, 1235, 29915, 29879, 925, 5251, 29871, 29947, 29930, 29941, 29900, 29922, 29906, 29946, 29900, 3841, 13, 4706, 302, 353, 7431, 29898, 1311, 29889, 657, 29918, 11991, 3101, 13, 4706, 565, 302, 529, 29871, 29906, 29901, 736, 5852, 13, 4706, 2533, 2776, 29928, 17678, 353, 29871, 29900, 13, 4706, 363, 474, 297, 3464, 29898, 29876, 448, 29871, 29896, 1125, 13, 9651, 5335, 287, 2554, 353, 2635, 10456, 1311, 29889, 657, 29918, 11991, 580, 29961, 29875, 1822, 657, 29918, 29890, 7515, 2539, 3101, 448, 2635, 10456, 1311, 29889, 657, 29918, 11991, 580, 29961, 29875, 718, 29871, 29896, 1822, 657, 29918, 29890, 7515, 2539, 3101, 13, 9651, 2533, 2776, 29928, 17678, 4619, 6425, 29898, 9346, 287, 2554, 29889, 16700, 29897, 13, 4706, 736, 451, 313, 386, 12268, 29961, 29900, 29962, 529, 2533, 2776, 29928, 17678, 849, 313, 29876, 448, 29871, 29896, 29897, 529, 16897, 29961, 29896, 2314, 13, 13, 1678, 822, 28145, 29918, 27603, 29918, 29896, 29945, 29918, 29879, 747, 18964, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 565, 1583, 3032, 11991, 338, 4069, 29892, 372, 338, 263, 4069, 1051, 607, 278, 3309, 338, 29871, 29900, 13, 4706, 584, 2457, 29901, 7223, 565, 278, 3309, 310, 1583, 3032, 11991, 338, 3109, 769, 29871, 29896, 29945, 13, 4706, 9995, 13, 4706, 736, 7431, 29898, 1311, 3032, 11991, 29897, 529, 29871, 29896, 29945, 13, 13, 1678, 822, 1959, 29918, 26098, 29918, 1454, 29918, 12154, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 3183, 1059, 746, 4567, 10216, 29914, 29893, 1607, 470, 4567, 23346, 310, 10216, 29914, 29893, 1607, 13, 4706, 584, 2457, 29901, 7223, 515, 7252, 278, 1347, 310, 10216, 322, 6532, 23346, 13, 4706, 9995, 13, 4706, 565, 313, 1333, 1583, 3032, 14116, 4980, 470, 451, 1583, 3032, 29893, 1607, 1125, 12020, 23833, 2392, 703, 27259, 10216, 470, 6532, 1159, 13, 4706, 565, 313, 1333, 1583, 3032, 14116, 4980, 29889, 657, 29918, 26098, 580, 470, 451, 1583, 3032, 29893, 1607, 29889, 657, 29918, 26098, 580, 1125, 12020, 23833, 2392, 29898, 13, 9651, 376, 27259, 23346, 310, 10216, 470, 6532, 1159, 13, 4706, 736, 1583, 3032, 14116, 4980, 29889, 657, 29918, 26098, 580, 1275, 376, 29924, 29908, 322, 1583, 3032, 29893, 1607, 29889, 657, 29918, 26098, 580, 1275, 376, 29943, 29908, 13, 13, 1678, 822, 14263, 29918, 4230, 29918, 7039, 29898, 1311, 1125, 13, 4706, 565, 451, 1583, 3032, 14116, 4980, 29901, 12020, 23833, 2392, 703, 18552, 292, 17852, 1159, 13, 4706, 565, 451, 1583, 3032, 14116, 4980, 29889, 657, 29918, 978, 7295, 12020, 23833, 2392, 703, 18552, 292, 17852, 29915, 29879, 1024, 1159, 13, 13, 4706, 1423, 29918, 4230, 29918, 978, 353, 1583, 3032, 14116, 4980, 29889, 657, 29918, 978, 2141, 5451, 877, 525, 9601, 29896, 29962, 13, 4706, 822, 4489, 29879, 29898, 11922, 29892, 1833, 29918, 978, 1125, 13, 9651, 7353, 353, 5852, 13, 9651, 363, 2278, 297, 3942, 29889, 657, 29918, 11991, 7295, 13, 18884, 565, 2278, 29889, 657, 29918, 26098, 580, 1275, 6213, 29901, 12020, 23833, 2392, 703, 5145, 29915, 29879, 23346, 338, 451, 731, 3447, 1159, 13, 462, 13, 18884, 565, 2278, 29889, 657, 29918, 26098, 580, 1275, 376, 29943, 1115, 6773, 13, 18884, 565, 451, 2278, 29889, 657, 29918, 978, 7295, 12020, 23833, 2392, 703, 5938, 29915, 29879, 1024, 338, 4567, 1159, 13, 18884, 565, 2278, 29889, 657, 29918, 978, 2141, 5451, 877, 525, 9601, 29896, 29962, 2804, 1833, 29918, 978, 29901, 736, 7700, 13, 18884, 363, 5216, 297, 2278, 29889, 657, 29918, 11922, 7295, 13, 462, 1678, 7353, 353, 4489, 29879, 29898, 29888, 314, 29897, 322, 7353, 13, 9651, 736, 7353, 13, 13, 4706, 736, 4489, 29879, 29898, 1311, 29892, 1423, 29918, 4230, 29918, 978, 29897, 13, 13, 13, 1678, 822, 27767, 18964, 29918, 9344, 29918, 1333, 29918, 3034, 719, 29898, 1311, 1125, 13, 4706, 565, 451, 1583, 3032, 14116, 4980, 470, 451, 1583, 3032, 29893, 1607, 29901, 12020, 23833, 2392, 703, 18552, 292, 10216, 470, 6532, 1159, 13, 4706, 565, 451, 1583, 3032, 14116, 4980, 29889, 657, 29918, 3560, 29918, 11922, 580, 322, 451, 1583, 3032, 29893, 1607, 29889, 657, 29918, 3560, 29918, 11922, 7295, 12020, 23833, 2392, 703, 18552, 292, 10216, 322, 6532, 3847, 1159, 13, 4706, 736, 451, 1583, 3032, 14116, 4980, 29889, 657, 29918, 3560, 29918, 11922, 2141, 657, 29918, 333, 580, 1275, 1583, 3032, 29893, 1607, 29889, 657, 29918, 3560, 29918, 11922, 2141, 657, 29918, 333, 580, 13, 13, 1678, 822, 1797, 29918, 29879, 747, 18964, 29918, 1609, 29918, 482, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 20768, 697, 4805, 4331, 607, 18094, 714, 278, 405, 2873, 29889, 2216, 1854, 565, 5181, 29889, 13, 4706, 584, 2457, 29901, 1051, 310, 9282, 297, 278, 1797, 310, 5153, 2548, 5046, 13, 4706, 9995, 13, 4706, 620, 353, 12705, 29898, 1311, 29889, 657, 29918, 11991, 3285, 1820, 29922, 2892, 921, 29901, 921, 29889, 657, 29918, 482, 29898, 16700, 29922, 5574, 511, 11837, 29922, 5574, 29897, 13, 4706, 736, 1051, 29898, 4572, 29898, 2892, 921, 29901, 921, 29889, 657, 29918, 29890, 7515, 2539, 580, 2804, 6213, 29892, 620, 876, 13, 13, 13, 13, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 1209, 13, 13, 1678, 396, 515, 4733, 29889, 2568, 23352, 1053, 1894, 23352, 13, 13, 1678, 396, 3166, 4733, 29889, 2568, 23352, 1053, 1894, 23352, 13, 1678, 396, 448, 2683, 28400, 13424, 4251, 2400, 2683, 1378, 5634, 2 ]
thermo/flash/__init__.py
RoryKurek/thermo
380
188466
# -*- coding: utf-8 -*- '''Chemical Engineering Design Library (ChEDL). Utilities for process modeling. Copyright (C) 2019, 2020 <NAME> <<EMAIL>> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. This module contains classes and functions for performing flash calculations. For reporting bugs, adding feature requests, or submitting pull requests, please use the `GitHub issue tracker <https://github.com/CalebBell/thermo/>`_. .. contents:: :local: Main Interfaces =============== Pure Components --------------- .. autoclass:: FlashPureVLS :show-inheritance: :members: __init__ :exclude-members: __init__ Vapor-Liquid Systems -------------------- .. autoclass:: FlashVL :show-inheritance: :members: __init__ :exclude-members: __init__ Vapor and Multiple Liquid Systems --------------------------------- .. autoclass:: FlashVLN :show-inheritance: :members: __init__ :exclude-members: __init__ Base Flash Class ---------------- .. autoclass:: Flash :show-inheritance: :members: flash, plot_TP :exclude-members: Specific Flash Algorithms ========================= It is recommended to use the Flash classes, which are designed to have generic interfaces. The implemented specific flash algorithms may be changed in the future, but reading their source code may be helpful for instructive purposes. ''' from . import flash_utils from . import flash_base from . import flash_vl from . import flash_vln from . import flash_pure_vls from .flash_utils import * from .flash_base import * from .flash_vl import * from .flash_vln import * from .flash_pure_vls import * __all__ = (flash_utils.__all__ + flash_base.__all__ + flash_vl.__all__ + flash_vln.__all__ + flash_pure_vls.__all__)
[ 1, 396, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 12008, 1451, 331, 936, 22557, 12037, 9538, 313, 1451, 3352, 29931, 467, 22310, 1907, 363, 1889, 1904, 292, 29889, 13, 11882, 1266, 313, 29907, 29897, 29871, 29906, 29900, 29896, 29929, 29892, 29871, 29906, 29900, 29906, 29900, 529, 5813, 29958, 3532, 26862, 6227, 6778, 13, 13, 27293, 338, 1244, 1609, 16896, 29892, 3889, 310, 8323, 29892, 304, 738, 2022, 4017, 292, 263, 3509, 13, 974, 445, 7047, 322, 6942, 5106, 2066, 313, 1552, 376, 6295, 14093, 4968, 304, 5376, 13, 262, 278, 18540, 1728, 24345, 29892, 3704, 1728, 29485, 278, 10462, 13, 517, 671, 29892, 3509, 29892, 6623, 29892, 10366, 29892, 9805, 29892, 1320, 2666, 29892, 269, 803, 1947, 29892, 322, 29914, 272, 19417, 13, 9708, 583, 310, 278, 18540, 29892, 322, 304, 14257, 12407, 304, 6029, 278, 18540, 338, 13, 29888, 595, 3276, 304, 437, 577, 29892, 4967, 304, 278, 1494, 5855, 29901, 13, 13, 1576, 2038, 3509, 1266, 8369, 322, 445, 10751, 8369, 4091, 367, 5134, 297, 599, 13, 9708, 583, 470, 23228, 2011, 1080, 310, 278, 18540, 29889, 13, 13, 28350, 7791, 7818, 12982, 1525, 8519, 13756, 13044, 3352, 376, 3289, 8519, 613, 399, 1806, 8187, 2692, 399, 1718, 29934, 13566, 29979, 8079, 13764, 29979, 476, 22255, 29892, 8528, 15094, 1799, 6323, 13, 29902, 3580, 5265, 3352, 29892, 2672, 6154, 15789, 4214, 350, 2692, 6058, 27848, 3352, 7495, 6093, 399, 1718, 29934, 13566, 29059, 8079, 341, 1001, 3210, 13566, 2882, 6227, 11937, 29892, 13, 29943, 1806, 8186, 1799, 15842, 319, 349, 8322, 2965, 13309, 1718, 349, 4574, 13152, 1660, 5300, 405, 1164, 1177, 15860, 1177, 1692, 13780, 29889, 2672, 11698, 382, 29963, 3919, 24972, 9818, 6093, 13, 20656, 29950, 24125, 6323, 315, 4590, 29979, 22789, 3912, 379, 5607, 8032, 29903, 20700, 17705, 6181, 15842, 13764, 29979, 315, 4375, 7833, 29892, 21330, 1529, 1692, 29903, 6323, 438, 29911, 4448, 13, 5265, 2882, 6227, 11937, 29892, 12317, 2544, 4448, 2672, 13764, 319, 9838, 8079, 8707, 29911, 4717, 1783, 29892, 323, 8476, 6323, 438, 29911, 4448, 22119, 1660, 29892, 9033, 3235, 4214, 3895, 29892, 13, 12015, 8079, 6323, 2672, 8707, 8186, 9838, 22659, 6093, 7791, 7818, 12982, 1525, 6323, 6093, 501, 1660, 6323, 438, 29911, 4448, 5012, 1964, 4214, 29903, 2672, 6093, 13, 6156, 7818, 12982, 1525, 29889, 13, 13, 4013, 3883, 3743, 4413, 322, 3168, 363, 15859, 11013, 17203, 29889, 13, 13, 2831, 23415, 24557, 29892, 4417, 4682, 7274, 29892, 470, 11834, 5367, 8206, 7274, 29892, 13, 552, 559, 671, 278, 421, 28712, 16046, 2228, 1020, 4937, 529, 991, 597, 3292, 29889, 510, 29914, 29907, 744, 29890, 29933, 514, 29914, 721, 4346, 3779, 29952, 5396, 13, 13, 636, 8118, 1057, 584, 2997, 29901, 13, 13, 6330, 4124, 8726, 13, 4936, 2751, 25512, 13, 13, 29925, 545, 422, 9340, 13, 9072, 5634, 13, 636, 1120, 542, 605, 1057, 21967, 29925, 545, 29963, 8547, 13, 259, 584, 4294, 29899, 262, 27069, 749, 29901, 13, 259, 584, 28109, 29901, 4770, 2344, 1649, 13, 259, 584, 735, 2325, 29899, 28109, 29901, 4770, 2344, 1649, 13, 13, 29963, 26191, 29899, 29931, 8105, 333, 23985, 13, 2683, 807, 13, 636, 1120, 542, 605, 1057, 21967, 29963, 29931, 13, 259, 584, 4294, 29899, 262, 27069, 749, 29901, 13, 259, 584, 28109, 29901, 4770, 2344, 1649, 13, 259, 584, 735, 2325, 29899, 28109, 29901, 4770, 2344, 1649, 13, 13, 29963, 26191, 322, 26905, 2718, 339, 333, 23985, 13, 2683, 2683, 29899, 13, 636, 1120, 542, 605, 1057, 21967, 29963, 29931, 29940, 13, 259, 584, 4294, 29899, 262, 27069, 749, 29901, 13, 259, 584, 28109, 29901, 4770, 2344, 1649, 13, 259, 584, 735, 2325, 29899, 28109, 29901, 4770, 2344, 1649, 13, 13, 5160, 21967, 4134, 13, 2683, 13, 636, 1120, 542, 605, 1057, 21967, 13, 259, 584, 4294, 29899, 262, 27069, 749, 29901, 13, 259, 584, 28109, 29901, 11013, 29892, 6492, 29918, 3557, 13, 259, 584, 735, 2325, 29899, 28109, 29901, 13, 13, 13, 10299, 928, 21967, 11545, 12404, 13, 9166, 4936, 29922, 13, 3112, 338, 13622, 304, 671, 278, 21967, 4413, 29892, 607, 526, 8688, 304, 505, 10035, 13, 1639, 8726, 29889, 450, 8762, 2702, 11013, 14009, 1122, 367, 3939, 297, 278, 13, 29888, 9130, 29892, 541, 5183, 1009, 2752, 775, 1122, 367, 8444, 363, 18690, 573, 11976, 29889, 13, 13, 12008, 13, 3166, 869, 1053, 11013, 29918, 13239, 13, 3166, 869, 1053, 11013, 29918, 3188, 13, 3166, 869, 1053, 11013, 29918, 20901, 13, 3166, 869, 1053, 11013, 29918, 29894, 3083, 13, 3166, 869, 1053, 11013, 29918, 29886, 545, 29918, 29894, 3137, 13, 13, 3166, 869, 28041, 29918, 13239, 1053, 334, 13, 3166, 869, 28041, 29918, 3188, 1053, 334, 13, 3166, 869, 28041, 29918, 20901, 1053, 334, 13, 3166, 869, 28041, 29918, 29894, 3083, 1053, 334, 13, 3166, 869, 28041, 29918, 29886, 545, 29918, 29894, 3137, 1053, 334, 13, 13, 1649, 497, 1649, 353, 313, 28041, 29918, 13239, 17255, 497, 1649, 718, 11013, 29918, 3188, 17255, 497, 1649, 718, 11013, 29918, 20901, 17255, 497, 1649, 13, 965, 718, 11013, 29918, 29894, 3083, 17255, 497, 1649, 718, 11013, 29918, 29886, 545, 29918, 29894, 3137, 17255, 497, 1649, 29897, 13, 13, 2 ]
improved_ddm/run_multihead_split.py
mlii/variational-continual-learning
0
168059
import numpy as np import tensorflow as tf import gzip import cPickle import sys sys.path.extend(['alg/']) import vcl import coreset import utils class SplitMnistGenerator(): def __init__(self): # Open data file f = gzip.open('data/mnist.pkl.gz', 'rb') train_set, valid_set, test_set = cPickle.load(f) f.close() # Define train and test data self.X_train = np.vstack((train_set[0], valid_set[0])) self.X_test = test_set[0] self.train_label = np.hstack((train_set[1], valid_set[1])) self.test_label = test_set[1] # split MNIST task1 = [0, 1] task2 = [2, 3] task3 = [4, 5] task4 = [6, 7] task5 = [8, 9] self.sets = [task1, task2, task3, task4, task5] self.max_iter = len(self.sets) self.out_dim = 0 # Total number of unique classes self.class_list = [] # List of unique classes being considered, in the order they appear for task_id in range(self.max_iter): for class_index in range(len(self.sets[task_id])): if self.sets[task_id][class_index] not in self.class_list: # Convert from MNIST digit numbers to class index number by using self.class_list.index(), # which is done in self.classes self.class_list.append(self.sets[task_id][class_index]) self.out_dim = self.out_dim + 1 # self.classes is the classes (with correct indices for training/testing) of interest at each task_id self.classes = [] for task_id in range(self.max_iter): class_idx = [] for i in range(len(self.sets[task_id])): class_idx.append(self.class_list.index(self.sets[task_id][i])) self.classes.append(class_idx) self.cur_iter = 0 def get_dims(self): # Get data input and output dimensions return self.X_train.shape[1], self.out_dim def next_task(self): if self.cur_iter >= self.max_iter: raise Exception('Number of tasks exceeded!') else: next_x_train = [] next_y_train = [] next_x_test = [] next_y_test = [] # Loop over all classes in current iteration for class_index in range(np.size(self.sets[self.cur_iter])): # Find the correct set of training inputs train_id = np.where(self.train_label == self.sets[self.cur_iter][class_index])[0] # Stack the training inputs if class_index == 0: next_x_train = self.X_train[train_id] else: next_x_train = np.vstack((next_x_train, self.X_train[train_id])) # Initialise next_y_train to zeros, then change relevant entries to ones, and then stack next_y_train_interm = np.zeros((len(train_id), self.out_dim)) next_y_train_interm[:, self.classes[self.cur_iter][class_index]] = 1 if class_index == 0: next_y_train = next_y_train_interm else: next_y_train = np.vstack((next_y_train, next_y_train_interm)) # Repeat above process for test inputs test_id = np.where(self.test_label == self.sets[self.cur_iter][class_index])[0] if class_index == 0: next_x_test = self.X_test[test_id] else: next_x_test = np.vstack((next_x_test, self.X_test[test_id])) next_y_test_interm = np.zeros((len(test_id), self.out_dim)) next_y_test_interm[:, self.classes[self.cur_iter][class_index]] = 1 if class_index == 0: next_y_test = next_y_test_interm else: next_y_test = np.vstack((next_y_test, next_y_test_interm)) self.cur_iter += 1 return next_x_train, next_y_train, next_x_test, next_y_test def reset(self): self.cur_iter = 0 store_weights = True # Store weights after training on each task (for plotting later) multi_head = True # Multi-head or single-head network hidden_size = [200] # Size and number of hidden layers batch_size = 256 # Batch size no_epochs = 600 # Number of training epochs per task # No coreset tf.compat.v1.reset_default_graph() random_seed = 0 tf.compat.v1.set_random_seed(random_seed+1) np.random.seed(random_seed) path = 'model_storage/split/' # Path where to store files data_gen = SplitMnistGenerator() coreset_size = 0 vcl_result = vcl.run_vcl_shared(hidden_size, no_epochs, data_gen, coreset.rand_from_batch, coreset_size, batch_size, path, multi_head, store_weights=store_weights) # Store accuracies np.savez(path + 'test_acc.npz', acc=vcl_result) # Random coreset tf.compat.v1.reset_default_graph() random_seed = 0 tf.compat.v1.set_random_seed(random_seed+1) np.random.seed(random_seed) path = 'model_storage/split_coreset/' # Path where to store files data_gen = SplitMnistGenerator() coreset_size = 40 vcl_result_coresets = vcl.run_vcl_shared(hidden_size, no_epochs, data_gen, coreset.rand_from_batch, coreset_size, batch_size, path, multi_head, store_weights=store_weights) # Store accuracies np.savez(path + 'test_acc.npz', acc=vcl_result_coresets) # Plot average accuracy utils.plot('model_storage/split_mnist_', vcl_result, vcl_result_coresets)
[ 1, 1053, 12655, 408, 7442, 13, 5215, 26110, 408, 15886, 13, 5215, 330, 7554, 13, 5215, 274, 29925, 860, 280, 13, 5215, 10876, 13, 9675, 29889, 2084, 29889, 21843, 18959, 9564, 29914, 11287, 13, 5215, 325, 695, 13, 5215, 28337, 300, 13, 5215, 3667, 29879, 13, 13, 13, 1990, 26178, 29924, 29876, 391, 21575, 7295, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 396, 4673, 848, 934, 13, 4706, 285, 353, 330, 7554, 29889, 3150, 877, 1272, 29914, 23521, 391, 29889, 29886, 6321, 29889, 18828, 742, 525, 6050, 1495, 13, 4706, 7945, 29918, 842, 29892, 2854, 29918, 842, 29892, 1243, 29918, 842, 353, 274, 29925, 860, 280, 29889, 1359, 29898, 29888, 29897, 13, 4706, 285, 29889, 5358, 580, 13, 13, 4706, 396, 22402, 7945, 322, 1243, 848, 13, 4706, 1583, 29889, 29990, 29918, 14968, 353, 7442, 29889, 29894, 1429, 3552, 14968, 29918, 842, 29961, 29900, 1402, 2854, 29918, 842, 29961, 29900, 12622, 13, 4706, 1583, 29889, 29990, 29918, 1688, 353, 1243, 29918, 842, 29961, 29900, 29962, 13, 4706, 1583, 29889, 14968, 29918, 1643, 353, 7442, 29889, 29882, 1429, 3552, 14968, 29918, 842, 29961, 29896, 1402, 2854, 29918, 842, 29961, 29896, 12622, 13, 4706, 1583, 29889, 1688, 29918, 1643, 353, 1243, 29918, 842, 29961, 29896, 29962, 13, 13, 4706, 396, 6219, 341, 29940, 9047, 13, 4706, 3414, 29896, 353, 518, 29900, 29892, 29871, 29896, 29962, 13, 4706, 3414, 29906, 353, 518, 29906, 29892, 29871, 29941, 29962, 13, 4706, 3414, 29941, 353, 518, 29946, 29892, 29871, 29945, 29962, 13, 4706, 3414, 29946, 353, 518, 29953, 29892, 29871, 29955, 29962, 13, 4706, 3414, 29945, 353, 518, 29947, 29892, 29871, 29929, 29962, 13, 4706, 1583, 29889, 7224, 353, 518, 7662, 29896, 29892, 3414, 29906, 29892, 3414, 29941, 29892, 3414, 29946, 29892, 3414, 29945, 29962, 13, 13, 4706, 1583, 29889, 3317, 29918, 1524, 353, 7431, 29898, 1311, 29889, 7224, 29897, 13, 13, 4706, 1583, 29889, 449, 29918, 6229, 353, 29871, 29900, 4706, 396, 14990, 1353, 310, 5412, 4413, 13, 4706, 1583, 29889, 1990, 29918, 1761, 353, 5159, 1678, 396, 2391, 310, 5412, 4413, 1641, 5545, 29892, 297, 278, 1797, 896, 2615, 13, 4706, 363, 3414, 29918, 333, 297, 3464, 29898, 1311, 29889, 3317, 29918, 1524, 1125, 13, 9651, 363, 770, 29918, 2248, 297, 3464, 29898, 2435, 29898, 1311, 29889, 7224, 29961, 7662, 29918, 333, 12622, 29901, 13, 18884, 565, 1583, 29889, 7224, 29961, 7662, 29918, 333, 3816, 1990, 29918, 2248, 29962, 451, 297, 1583, 29889, 1990, 29918, 1761, 29901, 13, 462, 1678, 396, 14806, 515, 341, 29940, 9047, 13615, 3694, 304, 770, 2380, 1353, 491, 773, 1583, 29889, 1990, 29918, 1761, 29889, 2248, 3285, 13, 462, 1678, 396, 607, 338, 2309, 297, 1583, 29889, 13203, 13, 462, 1678, 1583, 29889, 1990, 29918, 1761, 29889, 4397, 29898, 1311, 29889, 7224, 29961, 7662, 29918, 333, 3816, 1990, 29918, 2248, 2314, 13, 462, 1678, 1583, 29889, 449, 29918, 6229, 353, 1583, 29889, 449, 29918, 6229, 718, 29871, 29896, 13, 13, 4706, 396, 1583, 29889, 13203, 338, 278, 4413, 313, 2541, 1959, 16285, 363, 6694, 29914, 13424, 29897, 310, 4066, 472, 1269, 3414, 29918, 333, 13, 4706, 1583, 29889, 13203, 353, 5159, 13, 4706, 363, 3414, 29918, 333, 297, 3464, 29898, 1311, 29889, 3317, 29918, 1524, 1125, 13, 9651, 770, 29918, 13140, 353, 5159, 13, 9651, 363, 474, 297, 3464, 29898, 2435, 29898, 1311, 29889, 7224, 29961, 7662, 29918, 333, 12622, 29901, 13, 18884, 770, 29918, 13140, 29889, 4397, 29898, 1311, 29889, 1990, 29918, 1761, 29889, 2248, 29898, 1311, 29889, 7224, 29961, 7662, 29918, 333, 3816, 29875, 12622, 13, 9651, 1583, 29889, 13203, 29889, 4397, 29898, 1990, 29918, 13140, 29897, 13, 13, 4706, 1583, 29889, 2764, 29918, 1524, 353, 29871, 29900, 13, 13, 1678, 822, 679, 29918, 6229, 29879, 29898, 1311, 1125, 13, 4706, 396, 3617, 848, 1881, 322, 1962, 13391, 13, 4706, 736, 1583, 29889, 29990, 29918, 14968, 29889, 12181, 29961, 29896, 1402, 1583, 29889, 449, 29918, 6229, 13, 13, 1678, 822, 2446, 29918, 7662, 29898, 1311, 1125, 13, 4706, 565, 1583, 29889, 2764, 29918, 1524, 6736, 1583, 29889, 3317, 29918, 1524, 29901, 13, 9651, 12020, 8960, 877, 4557, 310, 9595, 13461, 287, 29991, 1495, 13, 4706, 1683, 29901, 13, 9651, 2446, 29918, 29916, 29918, 14968, 353, 5159, 13, 9651, 2446, 29918, 29891, 29918, 14968, 353, 5159, 13, 9651, 2446, 29918, 29916, 29918, 1688, 353, 5159, 13, 9651, 2446, 29918, 29891, 29918, 1688, 353, 5159, 13, 13, 9651, 396, 21493, 975, 599, 4413, 297, 1857, 12541, 13, 9651, 363, 770, 29918, 2248, 297, 3464, 29898, 9302, 29889, 2311, 29898, 1311, 29889, 7224, 29961, 1311, 29889, 2764, 29918, 1524, 12622, 29901, 13, 13, 18884, 396, 10987, 278, 1959, 731, 310, 6694, 10970, 13, 18884, 7945, 29918, 333, 353, 7442, 29889, 3062, 29898, 1311, 29889, 14968, 29918, 1643, 1275, 1583, 29889, 7224, 29961, 1311, 29889, 2764, 29918, 1524, 3816, 1990, 29918, 2248, 2314, 29961, 29900, 29962, 13, 18884, 396, 10292, 278, 6694, 10970, 13, 18884, 565, 770, 29918, 2248, 1275, 29871, 29900, 29901, 13, 462, 1678, 2446, 29918, 29916, 29918, 14968, 353, 1583, 29889, 29990, 29918, 14968, 29961, 14968, 29918, 333, 29962, 13, 18884, 1683, 29901, 13, 462, 1678, 2446, 29918, 29916, 29918, 14968, 353, 7442, 29889, 29894, 1429, 3552, 4622, 29918, 29916, 29918, 14968, 29892, 1583, 29889, 29990, 29918, 14968, 29961, 14968, 29918, 333, 12622, 13, 13, 18884, 396, 17250, 895, 2446, 29918, 29891, 29918, 14968, 304, 24786, 29892, 769, 1735, 8018, 9976, 304, 6743, 29892, 322, 769, 5096, 13, 18884, 2446, 29918, 29891, 29918, 14968, 29918, 1639, 29885, 353, 7442, 29889, 3298, 359, 3552, 2435, 29898, 14968, 29918, 333, 511, 1583, 29889, 449, 29918, 6229, 876, 13, 18884, 2446, 29918, 29891, 29918, 14968, 29918, 1639, 29885, 7503, 29892, 1583, 29889, 13203, 29961, 1311, 29889, 2764, 29918, 1524, 3816, 1990, 29918, 2248, 5262, 353, 29871, 29896, 13, 18884, 565, 770, 29918, 2248, 1275, 29871, 29900, 29901, 13, 462, 1678, 2446, 29918, 29891, 29918, 14968, 353, 2446, 29918, 29891, 29918, 14968, 29918, 1639, 29885, 13, 18884, 1683, 29901, 13, 462, 1678, 2446, 29918, 29891, 29918, 14968, 353, 7442, 29889, 29894, 1429, 3552, 4622, 29918, 29891, 29918, 14968, 29892, 2446, 29918, 29891, 29918, 14968, 29918, 1639, 29885, 876, 13, 13, 18884, 396, 830, 11666, 2038, 1889, 363, 1243, 10970, 13, 18884, 1243, 29918, 333, 353, 7442, 29889, 3062, 29898, 1311, 29889, 1688, 29918, 1643, 1275, 1583, 29889, 7224, 29961, 1311, 29889, 2764, 29918, 1524, 3816, 1990, 29918, 2248, 2314, 29961, 29900, 29962, 13, 18884, 565, 770, 29918, 2248, 1275, 29871, 29900, 29901, 13, 462, 1678, 2446, 29918, 29916, 29918, 1688, 353, 1583, 29889, 29990, 29918, 1688, 29961, 1688, 29918, 333, 29962, 13, 18884, 1683, 29901, 13, 462, 1678, 2446, 29918, 29916, 29918, 1688, 353, 7442, 29889, 29894, 1429, 3552, 4622, 29918, 29916, 29918, 1688, 29892, 1583, 29889, 29990, 29918, 1688, 29961, 1688, 29918, 333, 12622, 13, 13, 18884, 2446, 29918, 29891, 29918, 1688, 29918, 1639, 29885, 353, 7442, 29889, 3298, 359, 3552, 2435, 29898, 1688, 29918, 333, 511, 1583, 29889, 449, 29918, 6229, 876, 13, 18884, 2446, 29918, 29891, 29918, 1688, 29918, 1639, 29885, 7503, 29892, 1583, 29889, 13203, 29961, 1311, 29889, 2764, 29918, 1524, 3816, 1990, 29918, 2248, 5262, 353, 29871, 29896, 13, 18884, 565, 770, 29918, 2248, 1275, 29871, 29900, 29901, 13, 462, 1678, 2446, 29918, 29891, 29918, 1688, 353, 2446, 29918, 29891, 29918, 1688, 29918, 1639, 29885, 13, 18884, 1683, 29901, 13, 462, 1678, 2446, 29918, 29891, 29918, 1688, 353, 7442, 29889, 29894, 1429, 3552, 4622, 29918, 29891, 29918, 1688, 29892, 2446, 29918, 29891, 29918, 1688, 29918, 1639, 29885, 876, 13, 13, 9651, 1583, 29889, 2764, 29918, 1524, 4619, 29871, 29896, 13, 13, 9651, 736, 2446, 29918, 29916, 29918, 14968, 29892, 2446, 29918, 29891, 29918, 14968, 29892, 2446, 29918, 29916, 29918, 1688, 29892, 2446, 29918, 29891, 29918, 1688, 13, 13, 1678, 822, 10092, 29898, 1311, 1125, 13, 4706, 1583, 29889, 2764, 29918, 1524, 353, 29871, 29900, 13, 13, 13, 8899, 29918, 705, 5861, 353, 5852, 1678, 396, 14491, 18177, 1156, 6694, 373, 1269, 3414, 313, 1454, 6492, 1259, 2678, 29897, 13, 9910, 29918, 2813, 353, 5852, 539, 396, 14974, 29899, 2813, 470, 2323, 29899, 2813, 3564, 13, 13, 10892, 29918, 2311, 353, 518, 29906, 29900, 29900, 29962, 268, 396, 21179, 322, 1353, 310, 7934, 15359, 13, 16175, 29918, 2311, 353, 29871, 29906, 29945, 29953, 4706, 396, 350, 905, 2159, 13, 1217, 29918, 1022, 2878, 29879, 353, 29871, 29953, 29900, 29900, 308, 396, 9681, 310, 6694, 21502, 12168, 639, 3414, 13, 13, 13, 29937, 1939, 28337, 300, 13, 13264, 29889, 12667, 29889, 29894, 29896, 29889, 12071, 29918, 4381, 29918, 4262, 580, 13, 8172, 29918, 26776, 353, 29871, 29900, 13, 13264, 29889, 12667, 29889, 29894, 29896, 29889, 842, 29918, 8172, 29918, 26776, 29898, 8172, 29918, 26776, 29974, 29896, 29897, 13, 9302, 29889, 8172, 29889, 26776, 29898, 8172, 29918, 26776, 29897, 13, 13, 2084, 353, 525, 4299, 29918, 12925, 29914, 5451, 22208, 259, 396, 10802, 988, 304, 3787, 2066, 13, 1272, 29918, 1885, 353, 26178, 29924, 29876, 391, 21575, 580, 13, 29883, 2361, 300, 29918, 2311, 353, 29871, 29900, 13, 29894, 695, 29918, 2914, 353, 325, 695, 29889, 3389, 29918, 29894, 695, 29918, 12366, 29898, 10892, 29918, 2311, 29892, 694, 29918, 1022, 2878, 29879, 29892, 848, 29918, 1885, 29892, 13, 1678, 28337, 300, 29889, 9502, 29918, 3166, 29918, 16175, 29892, 28337, 300, 29918, 2311, 29892, 9853, 29918, 2311, 29892, 2224, 29892, 2473, 29918, 2813, 29892, 3787, 29918, 705, 5861, 29922, 8899, 29918, 705, 5861, 29897, 13, 13, 29937, 14491, 1035, 2002, 2478, 13, 9302, 29889, 7620, 29920, 29898, 2084, 718, 525, 1688, 29918, 5753, 29889, 9302, 29920, 742, 1035, 29922, 29894, 695, 29918, 2914, 29897, 13, 13, 13, 29937, 16968, 28337, 300, 13, 13264, 29889, 12667, 29889, 29894, 29896, 29889, 12071, 29918, 4381, 29918, 4262, 580, 13, 8172, 29918, 26776, 353, 29871, 29900, 13, 13264, 29889, 12667, 29889, 29894, 29896, 29889, 842, 29918, 8172, 29918, 26776, 29898, 8172, 29918, 26776, 29974, 29896, 29897, 13, 9302, 29889, 8172, 29889, 26776, 29898, 8172, 29918, 26776, 29897, 13, 13, 2084, 353, 525, 4299, 29918, 12925, 29914, 5451, 29918, 29883, 2361, 300, 22208, 259, 396, 10802, 988, 304, 3787, 2066, 13, 1272, 29918, 1885, 353, 26178, 29924, 29876, 391, 21575, 580, 13, 29883, 2361, 300, 29918, 2311, 353, 29871, 29946, 29900, 13, 29894, 695, 29918, 2914, 29918, 29883, 2361, 1691, 353, 325, 695, 29889, 3389, 29918, 29894, 695, 29918, 12366, 29898, 10892, 29918, 2311, 29892, 694, 29918, 1022, 2878, 29879, 29892, 848, 29918, 1885, 29892, 13, 1678, 28337, 300, 29889, 9502, 29918, 3166, 29918, 16175, 29892, 28337, 300, 29918, 2311, 29892, 9853, 29918, 2311, 29892, 2224, 29892, 2473, 29918, 2813, 29892, 3787, 29918, 705, 5861, 29922, 8899, 29918, 705, 5861, 29897, 13, 13, 29937, 14491, 1035, 2002, 2478, 13, 9302, 29889, 7620, 29920, 29898, 2084, 718, 525, 1688, 29918, 5753, 29889, 9302, 29920, 742, 1035, 29922, 29894, 695, 29918, 2914, 29918, 29883, 2361, 1691, 29897, 13, 13, 29937, 18399, 6588, 13600, 13, 13239, 29889, 5317, 877, 4299, 29918, 12925, 29914, 5451, 29918, 23521, 391, 29918, 742, 325, 695, 29918, 2914, 29892, 325, 695, 29918, 2914, 29918, 29883, 2361, 1691, 29897, 2 ]
django_push/__init__.py
bwold001/django-push
38
1615540
__version__ = '1.1' UA = 'django-push/{0}'.format(__version__)
[ 1, 4770, 3259, 1649, 353, 525, 29896, 29889, 29896, 29915, 13, 13, 29965, 29909, 353, 525, 14095, 29899, 5910, 19248, 29900, 29913, 4286, 4830, 22168, 3259, 1649, 29897, 13, 2 ]
catalog/client/services/catalog.py
eoss-cloud/madxxx_catalog_api
0
11611
<gh_stars>0 #-*- coding: utf-8 -*- """ EOSS catalog system functionality for the catalog endpoint """ from utilities.web_utils import remote_file_exists __author__ = "<NAME>, <NAME>" __copyright__ = "Copyright 2016, EOSS GmbH" __credits__ = ["<NAME>", "<NAME>"] __license__ = "GPL" __version__ = "1.0.0" __maintainer__ = "<NAME>" __email__ = "<EMAIL>" __status__ = "Production" import datetime import ujson import time import dateparser import falcon try: import cStringIO as StringIO except ImportError: import StringIO import csv from xlsxwriter import Workbook from dateutil.parser import parse import numpy from sqlalchemy import and_ import logging from collections import defaultdict from model.orm import Catalog_Dataset, Spatial_Reference from api import General_Structure from .db_calls import Persistance from . import getKeysFromDict from .tools import get_base_url, can_zip_response, compress_body, serialize, make_GeoJson from api_logging import logger def date_handler(obj): if hasattr(obj, 'isoformat'): return obj.isoformat() else: raise TypeError GRID_SYSTEMS = {'Sentinel - 2A': 10, 'LANDSAT_ETM': 11, 'LANDSAT_ETM_SLC_OFF': 11, 'OLI_TIRS': 11, 'TIRS': 11} class Catalog(object): """ EOSS catalog class from web API """ def __init__(self): self.logger = logging.getLogger('eoss.' + __name__) self.aggregations = defaultdict(list) for agg in Persistance().get_all_sensor_aggregations(): self.aggregations[agg.aggregation_name.lower()].append(agg) def _query_(self, areas, dates, sensors, clouds): sensors_filter = list() grid_list = defaultdict(set) for sensor_grid in set(GRID_SYSTEMS.values()): if 'ref_group' in areas[0].keys(): ref_type_id, ref_id = areas[0]['ref_group'], areas[0]['ref_id'] spatial_query = Persistance().get_reference_by_sensorgrid(ref_id, ref_type_id, sensor_grid) elif 'aoi' in areas[0].keys(): aoi = areas[0]['aoi'] spatial_query = Persistance().get_referencebyaoi(aoi, sensor_grid) for grid in spatial_query.all(): grid_list[sensor_grid].add(grid) if len(grid_list) == 0: description = 'Please specify valid reference object for data. (type:%s, id:%s)' \ % (ref_type_id, ref_id) raise falcon.HTTPBadRequest('SensorGrid', description, href='http://docs.example.com/auth') joint_gridset = grid_list[10] | grid_list[11] # TODO: better grid system handling from extra table? for item in sensors: sensor, level = item['sensor_name'], item['level'] if len(sensor) > 0 and len(level) > 0: sensors_filter.append(and_(Catalog_Dataset.level == level, Catalog_Dataset.sensor == sensor)) elif len(sensor) == 0 and len(level) > 0: sensors_filter.append(Catalog_Dataset.level == level) elif len(sensor) > 0 and len(level) == 0: sensors_filter.append(Catalog_Dataset.sensor == sensor) dates_filter = list() for item in dates: # ExtJS POST requests has provides unicode body if type(item["start_date"]) is unicode: item["start_date"] = parse(item["start_date"]) if type(item["end_date"]) is unicode: item["end_date"] = parse(item["end_date"]) dates_filter.append( and_(Catalog_Dataset.acq_time >= item["start_date"].isoformat(), Catalog_Dataset.acq_time <= item["end_date"].isoformat())) query = Persistance().find_dataset(dates_filter, sensors_filter, grid_list, joint_gridset, clouds) return query def _get_datasets(self, query): query_result = list() for ds in query: values = dict() types = dict() for k, v in ds.__dict__.iteritems(): if '_' != k[0]: values[k] = v types[k] = type(v) x = General_Structure(values, types) x.__class__.__name__ = 'Catalog_Dataset' query_result.append(serialize(x, as_json=False)['data']) return query_result # TODO: tiles list as input - only first will be returned or exception thrown ! def _query_tile_geom(self, tiles): tile_objs = Persistance().get_tile_geom(tiles) return tile_objs.all() def _export_query(self, found_dataset): row_keys = ['tile_identifier', 'entity_id', 'acq_time', 'clouds'] resources = [('resources', 'metadata'), ('resources', 'quicklook')] row = list() rows = list() for k in row_keys: row.append(k) for k in resources: row.append(' '.join(k)) row.append('data') rows.append(row) for ds in found_dataset: row = list() for k in row_keys: row.append(ds.get(k)) for k in resources: row.append(getKeysFromDict(ds, k)) if ds.get('sensor') in ['LANDSAT_TM', 'LANDSAT_ETM', 'LANDSAT_ETM_SLC_OFF']: if 'google' in ds.get('resources').keys(): row.append(getKeysFromDict(ds, ('resources', 'google', 'link'))) elif 'usgs' in ds.get('resources').keys(): row.append(getKeysFromDict(ds, ('resources', 'usgs', 'link'))) else: row.append('?') elif ds.get('sensor') in ['OLI_TIRS', 'OLI', 'TIRS']: if 's3public' in ds.get('resources').keys(): row.append(getKeysFromDict(ds, ('resources', 's3public', 'zip'))) elif 'google' in ds.get('resources').keys(): row.append(getKeysFromDict(ds, ('resources', 'google', 'link'))) elif ds.get('sensor') in ['Sentinel-2A']: if 's3public' in ds.get('resources').keys(): if getKeysFromDict(ds, ('resources', 's3public')) != None: row.append(getKeysFromDict(ds, ('resources', 's3public', 'zip'))) else: row.append('?') else: row.append('?') rows.append(row) return rows class CatalogApi(Catalog): def __init__(self, my_router): Catalog.__init__(self) self.router = my_router def on_get(self, req, resp, format, check_resources=False): """Handles GET requests http://localhost:8000/catalog/search/result.json?from_date=2016-05-01&to_date=2016-06-02&sensor=sentinel2&ref_group=9&ref_id=73&clouds=50 """ BASE_URL = get_base_url(req.url) start_time = time.time() query_filter = req.params results = dict() results['action'] = 'catalog search' results['action-time'] = str(datetime.datetime.now()) results.update({'query': query_filter}) dates = list() sensor_list = list() try: for date_string in ['from_date', 'to_date']: date = dateparser.parse(req.params[date_string]) if date is None: description = 'Please format date propery, used %s:%s.' % (date_string, date) raise falcon.HTTPBadRequest('DateFormat', description, href='http://docs.example.com/auth') else: dates.append(date) if dates[0] == dates[1]: description = 'Given dates didnt cover date range. Please correct date span. (%s-%s)' \ % (req.params['from_date'], req.params['to_date']) raise falcon.HTTPBadRequest('DateFormat', description, href='http://docs.example.com/auth') elif dates[0] > dates[1]: description = 'Given end date is before start date. Please reverse dates. (%s-%s)' \ % (req.params['from_date'], req.params['to_date']) raise falcon.HTTPBadRequest('DateFormat', description, href='http://docs.example.com/auth') if not req.params['sensor'].lower() in self.aggregations.keys(): description = 'Sensor label is unknown in aggregation table, use %s' % str(map(str, self.aggregations.keys())) raise falcon.HTTPBadRequest('DateFormat', description, href='http://docs.example.com/auth') for agg in self.aggregations[req.params['sensor'].lower()]: sensor_list.append({"sensor_name": agg.sensor, "level": agg.level}) ref_group, ref_id, clouds = int(req.params['ref_group']), int(req.params['ref_id']), int(req.params['clouds']) except KeyError, e: description = 'Search key: %s missing in query.' % e raise falcon.HTTPBadRequest('KeyError', description, href='http://docs.example.com/auth') except ValueError, e: description = 'Given parameters contain bad values: %s'% str(e) raise falcon.HTTPBadRequest('KeyError', description, href='http://docs.example.com/auth') query = self._query_([{"ref_group": ref_group, "ref_id": ref_id}], [{"start_date": dates[0], "end_date": dates[1]}], sensor_list, clouds) query_struct = {'area':[{"ref_group": ref_group, "ref_id": ref_id}], 'dates':[{"start_date": dates[0], "end_date": dates[1]}], 'sensors':sensor_list, 'clouds':clouds } found_dataset = self._get_datasets(query) logger.info('[GET] /catalog/search/result.%s' % format, extra={x:str(y) for x,y in query_struct.iteritems()}) if check_resources: for ds in found_dataset: if 's3public' in ds['resources'].keys(): if 'zip' in ds['resources']['s3public'].keys(): if not remote_file_exists( ds['resources']['s3public']['zip']): print '%s missing' % ds['resources']['s3public']['zip'] if format.lower() == 'json': if 'search/count' in req.url: results['count'] = query.count() else: results['count'] = query.count() results['found_dataset'] = found_dataset results['found_tiles'] = sorted(list(set([x['tile_identifier'] for x in found_dataset]))) results['found_resources'] = [BASE_URL + self.router.reverse('dataset_entity', entity_id=x['entity_id']) for x in results['found_dataset']] results['processing_time'] = time.time() - start_time elif format.lower() == 'geojson': tilegrids = defaultdict(lambda: defaultdict(list)) geoms, attrs = list(), list() for x in found_dataset: tilegrids[x['tile_identifier']]['acq_time'].append(x['acq_time']) # tilegrids[x['tile_identifier']]['acq_time_js'].append( # int(time.mktime(dateparser.parse(x['acq_time']).timetuple())) * 1000) tilegrids[x['tile_identifier']]['tile_identifier'].append(x['tile_identifier']) tilegrids[x['tile_identifier']]['clouds'].append(x['clouds']) for tile_id in tilegrids.keys(): tilegrids[tile_id]['count'] = len(tilegrids[tile_id]['clouds']) tilegrids[tile_id]['tile_identifier'] = tilegrids[tile_id]['tile_identifier'][0] tiles_dict = dict() if len(tilegrids.keys()) > 0: for ref_name, geom in self._query_tile_geom(tilegrids.keys()): tiles_dict[ref_name] = geom for tile_id in tilegrids.keys(): geoms.append(ujson.loads(tiles_dict[tile_id])) attrs.append(tilegrids[tile_id]) results = make_GeoJson(geoms, attrs) elif format.lower() == 'csv': rows = self._export_query(found_dataset) si = StringIO.StringIO() cw = csv.writer(si, delimiter='\t') for row in rows: cw.writerow(row) results = si.getvalue().strip('\r\n') elif format.lower() == 'xlsx': rows = self._export_query(found_dataset) strIO = StringIO.StringIO() workbook = Workbook(strIO, {'in_memory': True, 'constant_memory': True}) bold = workbook.add_format({'bold': True}) big_bold = workbook.add_format({'bold': True, 'size': 20}) italic = workbook.add_format({'italic': True}) worksheet = workbook.add_worksheet(name='EOSS analysis') worksheet.write(0, 0, 'EOSS data analysis', big_bold) ref_obj = Persistance().get_reference(query_filter.get('ref_id'), query_filter.get('ref_group')).one() query_filter['reference_name'] = ref_obj.ref_name query_filter['reference_type'] = ref_obj.referencetype.name # {'clouds': '60', 'ref_id': '5502', 'from_date': '09/07/2016', 'to_date': '10/07/2016', 'ref_group': '12', 'sensor': 'Sentinel2'} r = 3 worksheet.write(r - 1, 0, 'query filter:', big_bold) for c, k in enumerate(['sensor', 'from_date', 'to_date', 'clouds', 'reference_name', 'reference_type']): worksheet.write(r + c, 0, k, bold) worksheet.write(r + c, 1, query_filter[k]) r = 13 worksheet.write(r - 2, 0, 'query set:', big_bold) for c, k in enumerate(rows[0]): worksheet.write(r - 1, c, k, bold) for values in rows[1:]: for c, v in enumerate(values): worksheet.write(r, c, v) r += 1 workbook.close() strIO.seek(0) results = strIO.read() elif format.lower() == 'hist': found_tiles = sorted(list(set([x['tile_identifier'] for x in found_dataset]))) result_list = [] first = dict() first['tile_identifier'] = 'percentagelabel' first['span'] = 100 result_list.append(first) data = numpy.zeros((len(found_dataset))) tileslist = [] i = 0 for x in found_dataset: tileslist.append(x['tile_identifier']) data[i] = float(x['clouds']) i = i + 1 for t in found_tiles: ix = numpy.array(tileslist) == t subset_clouds = data[ix] num_scenes = sum(ix) hist_abs = numpy.histogram(subset_clouds, bins=[-1] + range(0, 120, 20)) hist_rel = hist_abs[0] * 1.0 / num_scenes hist_struct = dict() hist_struct['tile_identifier'] = t hist_struct['span'] = 100 hist_struct['scenes_perc_-1'] = hist_rel[0] hist_struct['scenes_perc_20'] = hist_rel[1] hist_struct['scenes_perc_40'] = hist_rel[2] hist_struct['scenes_perc_60'] = hist_rel[3] hist_struct['scenes_perc_80'] = hist_rel[4] hist_struct['scenes_perc_100'] = hist_rel[5] hist_struct['scenes_abs_-1'] = hist_abs[0][0] hist_struct['scenes_abs_20'] = hist_abs[0][1] hist_struct['scenes_abs_40'] = hist_abs[0][2] hist_struct['scenes_abs_60'] = hist_abs[0][3] hist_struct['scenes_abs_80'] = hist_abs[0][4] hist_struct['scenes_abs_100'] = hist_abs[0][5] result_list.append(hist_struct) results['found_tiles'] = result_list resp.status = falcon.HTTP_200 if can_zip_response(req.headers): if format.lower() in ['hist', 'json', 'geojson']: resp.set_header('Content-Type', 'application/json') resp.set_header('Content-Encoding', 'gzip') resp.body = compress_body(ujson.dumps(results)) elif format.lower() == 'csv': resp.set_header('Content-Type', 'text/csv') resp.set_header('Content-disposition', 'attachment;filename=%s;' % self.create_output_name('csv')) resp.set_header('Content-Encoding', 'gzip') resp.body = compress_body(results) elif format.lower() == 'xlsx': resp.set_header('Content-Type', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet') resp.set_header('Content-disposition', 'attachment;filename=%s;' % self.create_output_name('xlsx')) resp.set_header('Content-Encoding', 'gzip') resp.body = compress_body(results) else: if format.lower() in ['hist', 'json', 'geojson']: resp.set_header('Content-Type', 'application/json') resp.body = ujson.dumps(results) elif format.lower() == 'csv': resp.set_header('Content-Type', 'text/csv') resp.set_header('Content-disposition', 'attachment;filename=%s;' % self.create_output_name('csv')) resp.body = results elif format.lower() == 'xlsx': resp.set_header('Content-Type', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet') resp.set_header('Content-disposition', 'attachment;filename=%s;' % self.create_output_name('xlsx')) resp.body = results def create_output_name(self, extension): return 'EOSS_analysis_%s.%s' % (datetime.datetime.now().isoformat(), extension) def on_post(self, req, resp, format): """Handles POST requests { "daterange": [{ "start_date": "05/31/2000", "end_date": "07/02/2003" }], "clouds": 1, "sensors": [ {"sensor_name": "LANDSAT_ETM", "level": "" }], "areas": [{ "ref_group": 12, "ref_id": 6208 }] } {"clouds":20,"daterange":[{"start_date":"09/02/2015","end_date":"09/14/2016"}], "sensors":[{"name":"landsat"}], "areas":[{"ref_id":362,"ref_group":"9"}]} """ # TODO: loop over areas sensor_list = list() results = dict() start_time = time.time() output = StringIO.StringIO() while True: chunk = req.stream.read(4096) if not chunk: break output.write(chunk) body = output.getvalue() output.close() try: struct = ujson.loads(body.decode('utf-8')) except ValueError, e: # try decode x-www-form-urlencoded query_str = falcon.util.uri.decode(body.decode('utf-8')) query_str = query_str[query_str.find('{'):query_str.rfind('}') + 1] try: struct = ujson.loads(query_str) except ValueError, e: description = 'Give request is no valid JSON nor urlencoded psot body.' raise falcon.HTTPUnsupportedMediaType(description, href='http://docs.example.com/auth') try: for s in struct['sensors']: if 'sensor_name' in s.keys() and 'level' in s.keys(): sensor_list.append(s) elif 'name' in s.keys(): if not s['name'].lower() in self.aggregations.keys(): description = 'Sensor label is unknown in aggregation table' raise falcon.HTTPBadRequest('Catalog', description, href='http://docs.example.com/auth') for agg in self.aggregations[s['name'].lower()]: sensor_list.append({"sensor_name": agg.sensor, "level": agg.level}) else: description = 'Sensor is not specified in query' raise falcon.HTTPBadRequest('Catalog', description, href='http://docs.example.com/auth') query = self._query_(struct['areas'], struct['daterange'], sensor_list, struct['clouds']) query_struct = {'area': struct['areas'], 'dates': struct['daterange'], 'sensors': sensor_list, 'clouds': struct['clouds'] } logger.info('[POST] /catalog/search/result.%s' % format, extra={x:str(y) for x,y in query_struct.iteritems()}) except KeyError, e: description = 'Search key: %s missing in query.' % e raise falcon.HTTPBadRequest('KeyError', description, href='http://docs.example.com/auth') results['count'] = query.count() found_dataset = self._get_datasets(query) results['found_dataset'] = found_dataset results['found_tiles'] = sorted(list(set([x['tile_identifier'] for x in found_dataset]))) # results.update({'query': struct}) resp.body = ujson.dumps(results) resp.status = falcon.HTTP_200 results['processing_time'] = time.time() - start_time if can_zip_response(req.headers): resp.set_header('Content-Type', 'application/json') resp.set_header('Content-Encoding', 'gzip') resp.body = compress_body(ujson.dumps(results)) else: resp.set_header('Content-Type', 'application/json') resp.body = ujson.dumps(results)
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 29937, 29899, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 13, 15945, 29908, 382, 29949, 1799, 16653, 1788, 13, 9863, 363, 278, 16653, 16248, 13, 15945, 29908, 13, 3166, 3667, 1907, 29889, 2676, 29918, 13239, 1053, 7592, 29918, 1445, 29918, 9933, 13, 13, 1649, 8921, 1649, 353, 9872, 5813, 10202, 529, 5813, 11903, 13, 1649, 8552, 1266, 1649, 353, 376, 11882, 1266, 29871, 29906, 29900, 29896, 29953, 29892, 382, 29949, 1799, 18156, 29908, 13, 1649, 11944, 1169, 1649, 353, 6796, 29966, 5813, 28341, 9872, 5813, 29958, 3108, 13, 1649, 506, 1947, 1649, 353, 376, 29954, 7390, 29908, 13, 1649, 3259, 1649, 353, 376, 29896, 29889, 29900, 29889, 29900, 29908, 13, 1649, 29885, 2365, 4008, 1649, 353, 9872, 5813, 11903, 13, 1649, 5269, 1649, 353, 9872, 26862, 6227, 11903, 13, 1649, 4882, 1649, 353, 376, 23665, 428, 29908, 13, 13, 5215, 12865, 13, 5215, 318, 3126, 13, 5215, 931, 13, 13, 5215, 2635, 16680, 13, 5215, 11092, 535, 13, 13, 2202, 29901, 13, 1678, 1053, 274, 1231, 5971, 408, 1714, 5971, 13, 19499, 16032, 2392, 29901, 13, 1678, 1053, 1714, 5971, 13, 13, 5215, 11799, 13, 3166, 921, 3137, 29916, 13236, 1053, 5244, 2909, 13, 3166, 2635, 4422, 29889, 16680, 1053, 6088, 13, 5215, 12655, 13, 3166, 4576, 284, 305, 6764, 1053, 322, 29918, 13, 5215, 12183, 13, 3166, 16250, 1053, 2322, 8977, 13, 13, 3166, 1904, 29889, 555, 1053, 5725, 29918, 16390, 24541, 29892, 1706, 15238, 29918, 7422, 13, 3166, 7882, 1053, 4593, 29918, 5015, 12425, 13, 13, 3166, 869, 2585, 29918, 29883, 4293, 1053, 9034, 21558, 13, 3166, 869, 1053, 679, 15506, 4591, 21533, 13, 3166, 869, 8504, 1053, 679, 29918, 3188, 29918, 2271, 29892, 508, 29918, 7554, 29918, 5327, 29892, 27122, 29918, 2587, 29892, 28755, 29892, 1207, 29918, 7999, 29877, 8148, 13, 3166, 7882, 29918, 21027, 1053, 17927, 13, 13, 1753, 2635, 29918, 13789, 29898, 5415, 1125, 13, 1678, 565, 756, 5552, 29898, 5415, 29892, 525, 10718, 4830, 29374, 13, 4706, 736, 5446, 29889, 10718, 4830, 580, 13, 1678, 1683, 29901, 13, 4706, 12020, 20948, 13, 13, 14345, 1367, 29918, 14816, 1254, 29923, 4345, 353, 11117, 29903, 15440, 295, 448, 29871, 29906, 29909, 2396, 29871, 29896, 29900, 29892, 13, 462, 4706, 525, 29931, 2190, 8452, 1299, 29918, 2544, 29924, 2396, 29871, 29896, 29896, 29892, 13, 462, 4706, 525, 29931, 2190, 8452, 1299, 29918, 2544, 29924, 29918, 29903, 12182, 29918, 27681, 2396, 29871, 29896, 29896, 29892, 13, 462, 4706, 525, 29949, 5265, 29918, 29911, 8193, 29903, 2396, 29871, 29896, 29896, 29892, 13, 462, 4706, 525, 29911, 8193, 29903, 2396, 29871, 29896, 29896, 29913, 13, 13, 1990, 5725, 29898, 3318, 1125, 13, 1678, 9995, 13, 539, 382, 29949, 1799, 16653, 770, 515, 1856, 3450, 13, 539, 9995, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 1583, 29889, 21707, 353, 12183, 29889, 657, 16363, 877, 29872, 2209, 6169, 718, 4770, 978, 1649, 29897, 13, 4706, 1583, 29889, 26193, 800, 353, 2322, 8977, 29898, 1761, 29897, 13, 4706, 363, 946, 29887, 297, 9034, 21558, 2141, 657, 29918, 497, 29918, 29879, 6073, 29918, 26193, 800, 7295, 13, 9651, 1583, 29889, 26193, 800, 29961, 16170, 29889, 26193, 362, 29918, 978, 29889, 13609, 580, 1822, 4397, 29898, 16170, 29897, 13, 13, 1678, 822, 903, 1972, 23538, 1311, 29892, 10161, 29892, 10116, 29892, 4771, 943, 29892, 27091, 1125, 13, 4706, 4771, 943, 29918, 4572, 353, 1051, 580, 13, 4706, 6856, 29918, 1761, 353, 2322, 8977, 29898, 842, 29897, 13, 13, 4706, 363, 23530, 29918, 7720, 297, 731, 29898, 14345, 1367, 29918, 14816, 1254, 29923, 4345, 29889, 5975, 580, 1125, 13, 9651, 565, 525, 999, 29918, 2972, 29915, 297, 10161, 29961, 29900, 1822, 8149, 7295, 13, 18884, 2143, 29918, 1853, 29918, 333, 29892, 2143, 29918, 333, 353, 10161, 29961, 29900, 22322, 999, 29918, 2972, 7464, 10161, 29961, 29900, 22322, 999, 29918, 333, 2033, 13, 18884, 18652, 29918, 1972, 353, 9034, 21558, 2141, 657, 29918, 5679, 29918, 1609, 29918, 29879, 6073, 7720, 29898, 999, 29918, 333, 29892, 2143, 29918, 1853, 29918, 333, 29892, 23530, 29918, 7720, 29897, 13, 9651, 25342, 525, 6241, 29875, 29915, 297, 10161, 29961, 29900, 1822, 8149, 7295, 13, 18884, 5017, 29875, 353, 10161, 29961, 29900, 22322, 6241, 29875, 2033, 13, 18884, 18652, 29918, 1972, 353, 9034, 21558, 2141, 657, 29918, 5679, 1609, 6241, 29875, 29898, 6241, 29875, 29892, 23530, 29918, 7720, 29897, 13, 9651, 363, 6856, 297, 18652, 29918, 1972, 29889, 497, 7295, 13, 18884, 6856, 29918, 1761, 29961, 29879, 6073, 29918, 7720, 1822, 1202, 29898, 7720, 29897, 13, 13, 4706, 565, 7431, 29898, 7720, 29918, 1761, 29897, 1275, 29871, 29900, 29901, 13, 9651, 6139, 353, 525, 12148, 6084, 2854, 3407, 1203, 363, 848, 29889, 313, 1853, 16664, 29879, 29892, 1178, 16664, 29879, 16029, 320, 13, 462, 3986, 1273, 313, 999, 29918, 1853, 29918, 333, 29892, 2143, 29918, 333, 29897, 13, 9651, 12020, 11092, 535, 29889, 10493, 22050, 3089, 877, 29903, 6073, 5756, 742, 6139, 29892, 13, 462, 462, 4706, 2822, 2433, 1124, 597, 2640, 29889, 4773, 29889, 510, 29914, 5150, 1495, 13, 13, 4706, 14002, 29918, 7720, 842, 353, 6856, 29918, 1761, 29961, 29896, 29900, 29962, 891, 6856, 29918, 1761, 29961, 29896, 29896, 29962, 29871, 396, 14402, 29901, 2253, 6856, 1788, 11415, 515, 4805, 1591, 29973, 13, 13, 4706, 363, 2944, 297, 4771, 943, 29901, 13, 9651, 23530, 29892, 3233, 353, 2944, 1839, 29879, 6073, 29918, 978, 7464, 2944, 1839, 5563, 2033, 13, 13, 9651, 565, 7431, 29898, 29879, 6073, 29897, 1405, 29871, 29900, 322, 7431, 29898, 5563, 29897, 1405, 29871, 29900, 29901, 13, 18884, 4771, 943, 29918, 4572, 29889, 4397, 29898, 392, 23538, 29907, 3968, 29918, 16390, 24541, 29889, 5563, 1275, 3233, 29892, 5725, 29918, 16390, 24541, 29889, 29879, 6073, 1275, 23530, 876, 13, 9651, 25342, 7431, 29898, 29879, 6073, 29897, 1275, 29871, 29900, 322, 7431, 29898, 5563, 29897, 1405, 29871, 29900, 29901, 13, 18884, 4771, 943, 29918, 4572, 29889, 4397, 29898, 29907, 3968, 29918, 16390, 24541, 29889, 5563, 1275, 3233, 29897, 13, 9651, 25342, 7431, 29898, 29879, 6073, 29897, 1405, 29871, 29900, 322, 7431, 29898, 5563, 29897, 1275, 29871, 29900, 29901, 13, 18884, 4771, 943, 29918, 4572, 29889, 4397, 29898, 29907, 3968, 29918, 16390, 24541, 29889, 29879, 6073, 1275, 23530, 29897, 13, 13, 4706, 10116, 29918, 4572, 353, 1051, 580, 13, 4706, 363, 2944, 297, 10116, 29901, 13, 9651, 396, 7338, 8700, 11971, 7274, 756, 8128, 29104, 3573, 13, 9651, 565, 1134, 29898, 667, 3366, 2962, 29918, 1256, 20068, 338, 29104, 29901, 13, 18884, 2944, 3366, 2962, 29918, 1256, 3108, 353, 6088, 29898, 667, 3366, 2962, 29918, 1256, 20068, 13, 9651, 565, 1134, 29898, 667, 3366, 355, 29918, 1256, 20068, 338, 29104, 29901, 13, 18884, 2944, 3366, 355, 29918, 1256, 3108, 353, 6088, 29898, 667, 3366, 355, 29918, 1256, 20068, 13, 13, 9651, 10116, 29918, 4572, 29889, 4397, 29898, 13, 18884, 322, 23538, 29907, 3968, 29918, 16390, 24541, 29889, 562, 29939, 29918, 2230, 6736, 2944, 3366, 2962, 29918, 1256, 16862, 10718, 4830, 3285, 5725, 29918, 16390, 24541, 29889, 562, 29939, 29918, 2230, 5277, 2944, 3366, 355, 29918, 1256, 16862, 10718, 4830, 22130, 13, 13, 4706, 2346, 353, 9034, 21558, 2141, 2886, 29918, 24713, 29898, 15190, 29918, 4572, 29892, 4771, 943, 29918, 4572, 29892, 6856, 29918, 1761, 29892, 14002, 29918, 7720, 842, 29892, 27091, 29897, 13, 4706, 736, 2346, 13, 13, 1678, 822, 903, 657, 29918, 14538, 1691, 29898, 1311, 29892, 2346, 1125, 13, 4706, 2346, 29918, 2914, 353, 1051, 580, 13, 4706, 363, 18031, 297, 2346, 29901, 13, 9651, 1819, 353, 9657, 580, 13, 9651, 4072, 353, 9657, 580, 13, 9651, 363, 413, 29892, 325, 297, 18031, 17255, 8977, 26914, 1524, 7076, 7295, 13, 18884, 565, 22868, 29915, 2804, 413, 29961, 29900, 5387, 13, 462, 1678, 1819, 29961, 29895, 29962, 353, 325, 13, 462, 1678, 4072, 29961, 29895, 29962, 353, 1134, 29898, 29894, 29897, 13, 9651, 921, 353, 4593, 29918, 5015, 12425, 29898, 5975, 29892, 4072, 29897, 13, 9651, 921, 17255, 1990, 1649, 17255, 978, 1649, 353, 525, 29907, 3968, 29918, 16390, 24541, 29915, 13, 13, 9651, 2346, 29918, 2914, 29889, 4397, 29898, 643, 6646, 29898, 29916, 29892, 408, 29918, 3126, 29922, 8824, 29897, 1839, 1272, 11287, 13, 13, 4706, 736, 2346, 29918, 2914, 13, 13, 1678, 396, 14402, 29901, 260, 5475, 1051, 408, 1881, 448, 871, 937, 674, 367, 4133, 470, 3682, 12005, 1738, 13, 1678, 822, 903, 1972, 29918, 29873, 488, 29918, 479, 290, 29898, 1311, 29892, 260, 5475, 1125, 13, 4706, 25900, 29918, 711, 1315, 353, 9034, 21558, 2141, 657, 29918, 29873, 488, 29918, 479, 290, 29898, 1376, 267, 29897, 13, 4706, 736, 25900, 29918, 711, 1315, 29889, 497, 580, 13, 13, 1678, 822, 903, 15843, 29918, 1972, 29898, 1311, 29892, 1476, 29918, 24713, 1125, 13, 4706, 1948, 29918, 8149, 353, 6024, 29873, 488, 29918, 25378, 742, 525, 10041, 29918, 333, 742, 525, 562, 29939, 29918, 2230, 742, 525, 9274, 29879, 2033, 13, 4706, 7788, 353, 518, 877, 13237, 742, 525, 19635, 5477, 6702, 13237, 742, 525, 24561, 6914, 1495, 29962, 13, 13, 4706, 1948, 353, 1051, 580, 13, 4706, 4206, 353, 1051, 580, 13, 4706, 363, 413, 297, 1948, 29918, 8149, 29901, 13, 9651, 1948, 29889, 4397, 29898, 29895, 29897, 13, 4706, 363, 413, 297, 7788, 29901, 13, 9651, 1948, 29889, 4397, 877, 15300, 7122, 29898, 29895, 876, 13, 4706, 1948, 29889, 4397, 877, 1272, 1495, 13, 4706, 4206, 29889, 4397, 29898, 798, 29897, 13, 13, 4706, 363, 18031, 297, 1476, 29918, 24713, 29901, 13, 9651, 1948, 353, 1051, 580, 13, 9651, 363, 413, 297, 1948, 29918, 8149, 29901, 13, 18884, 1948, 29889, 4397, 29898, 6289, 29889, 657, 29898, 29895, 876, 13, 9651, 363, 413, 297, 7788, 29901, 13, 18884, 1948, 29889, 4397, 29898, 657, 15506, 4591, 21533, 29898, 6289, 29892, 413, 876, 13, 9651, 565, 18031, 29889, 657, 877, 29879, 6073, 1495, 297, 6024, 29931, 2190, 8452, 1299, 29918, 23081, 742, 525, 29931, 2190, 8452, 1299, 29918, 2544, 29924, 742, 525, 29931, 2190, 8452, 1299, 29918, 2544, 29924, 29918, 29903, 12182, 29918, 27681, 2033, 29901, 13, 18884, 565, 525, 3608, 29915, 297, 18031, 29889, 657, 877, 13237, 2824, 8149, 7295, 13, 462, 1678, 1948, 29889, 4397, 29898, 657, 15506, 4591, 21533, 29898, 6289, 29892, 6702, 13237, 742, 525, 3608, 742, 525, 2324, 29915, 4961, 13, 18884, 25342, 525, 375, 3174, 29915, 297, 18031, 29889, 657, 877, 13237, 2824, 8149, 7295, 13, 462, 1678, 1948, 29889, 4397, 29898, 657, 15506, 4591, 21533, 29898, 6289, 29892, 6702, 13237, 742, 525, 375, 3174, 742, 525, 2324, 29915, 4961, 13, 18884, 1683, 29901, 13, 462, 1678, 1948, 29889, 4397, 877, 29973, 1495, 13, 9651, 25342, 18031, 29889, 657, 877, 29879, 6073, 1495, 297, 6024, 29949, 5265, 29918, 29911, 8193, 29903, 742, 525, 29949, 5265, 742, 525, 29911, 8193, 29903, 2033, 29901, 13, 18884, 565, 525, 29879, 29941, 3597, 29915, 297, 18031, 29889, 657, 877, 13237, 2824, 8149, 7295, 13, 462, 1678, 1948, 29889, 4397, 29898, 657, 15506, 4591, 21533, 29898, 6289, 29892, 6702, 13237, 742, 525, 29879, 29941, 3597, 742, 525, 7554, 29915, 4961, 13, 18884, 25342, 525, 3608, 29915, 297, 18031, 29889, 657, 877, 13237, 2824, 8149, 7295, 13, 462, 1678, 1948, 29889, 4397, 29898, 657, 15506, 4591, 21533, 29898, 6289, 29892, 6702, 13237, 742, 525, 3608, 742, 525, 2324, 29915, 4961, 13, 9651, 25342, 18031, 29889, 657, 877, 29879, 6073, 1495, 297, 6024, 29903, 15440, 295, 29899, 29906, 29909, 2033, 29901, 13, 18884, 565, 525, 29879, 29941, 3597, 29915, 297, 18031, 29889, 657, 877, 13237, 2824, 8149, 7295, 13, 462, 1678, 565, 679, 15506, 4591, 21533, 29898, 6289, 29892, 6702, 13237, 742, 525, 29879, 29941, 3597, 8785, 2804, 6213, 29901, 13, 462, 4706, 1948, 29889, 4397, 29898, 657, 15506, 4591, 21533, 29898, 6289, 29892, 6702, 13237, 742, 525, 29879, 29941, 3597, 742, 525, 7554, 29915, 4961, 13, 462, 1678, 1683, 29901, 13, 462, 4706, 1948, 29889, 4397, 877, 29973, 1495, 13, 18884, 1683, 29901, 13, 462, 1678, 1948, 29889, 4397, 877, 29973, 1495, 13, 13, 9651, 4206, 29889, 4397, 29898, 798, 29897, 13, 4706, 736, 4206, 13, 13, 13, 1990, 5725, 11713, 29898, 29907, 3968, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 590, 29918, 15140, 1125, 13, 4706, 5725, 17255, 2344, 12035, 1311, 29897, 13, 4706, 1583, 29889, 15140, 353, 590, 29918, 15140, 13, 13, 13, 1678, 822, 373, 29918, 657, 29898, 1311, 29892, 12428, 29892, 4613, 29892, 3402, 29892, 1423, 29918, 13237, 29922, 8824, 1125, 13, 4706, 9995, 3481, 793, 12354, 7274, 13, 4706, 1732, 597, 7640, 29901, 29947, 29900, 29900, 29900, 29914, 28045, 29914, 4478, 29914, 2914, 29889, 3126, 29973, 3166, 29918, 1256, 29922, 29906, 29900, 29896, 29953, 29899, 29900, 29945, 29899, 29900, 29896, 29987, 517, 29918, 1256, 29922, 29906, 29900, 29896, 29953, 29899, 29900, 29953, 29899, 29900, 29906, 29987, 29879, 6073, 29922, 29879, 15440, 295, 29906, 29987, 999, 29918, 2972, 29922, 29929, 29987, 999, 29918, 333, 29922, 29955, 29941, 29987, 9274, 29879, 29922, 29945, 29900, 13, 4706, 9995, 13, 13, 4706, 350, 8127, 29918, 4219, 353, 679, 29918, 3188, 29918, 2271, 29898, 7971, 29889, 2271, 29897, 13, 4706, 1369, 29918, 2230, 353, 931, 29889, 2230, 580, 13, 4706, 2346, 29918, 4572, 353, 12428, 29889, 7529, 13, 4706, 2582, 353, 9657, 580, 13, 4706, 2582, 1839, 2467, 2033, 353, 525, 28045, 2740, 29915, 13, 4706, 2582, 1839, 2467, 29899, 2230, 2033, 353, 851, 29898, 12673, 29889, 12673, 29889, 3707, 3101, 13, 4706, 2582, 29889, 5504, 3319, 29915, 1972, 2396, 2346, 29918, 4572, 1800, 13, 4706, 10116, 353, 1051, 580, 13, 4706, 23530, 29918, 1761, 353, 1051, 580, 13, 13, 4706, 1018, 29901, 13, 9651, 363, 2635, 29918, 1807, 297, 6024, 3166, 29918, 1256, 742, 525, 517, 29918, 1256, 2033, 29901, 13, 18884, 2635, 353, 2635, 16680, 29889, 5510, 29898, 7971, 29889, 7529, 29961, 1256, 29918, 1807, 2314, 13, 18884, 565, 2635, 338, 6213, 29901, 13, 462, 1678, 6139, 353, 525, 12148, 3402, 2635, 1571, 29891, 29892, 1304, 1273, 29879, 16664, 29879, 6169, 1273, 313, 1256, 29918, 1807, 29892, 2635, 29897, 13, 462, 1678, 12020, 11092, 535, 29889, 10493, 22050, 3089, 877, 29795, 742, 6139, 29892, 13, 462, 462, 18884, 2822, 2433, 1124, 597, 2640, 29889, 4773, 29889, 510, 29914, 5150, 1495, 13, 18884, 1683, 29901, 13, 462, 1678, 10116, 29889, 4397, 29898, 1256, 29897, 13, 13, 9651, 565, 10116, 29961, 29900, 29962, 1275, 10116, 29961, 29896, 5387, 13, 18884, 6139, 353, 525, 29954, 5428, 10116, 28950, 4612, 2635, 3464, 29889, 3529, 1959, 2635, 10638, 29889, 313, 29995, 29879, 19222, 29879, 16029, 320, 13, 462, 795, 1273, 313, 7971, 29889, 7529, 1839, 3166, 29918, 1256, 7464, 12428, 29889, 7529, 1839, 517, 29918, 1256, 11287, 13, 18884, 12020, 11092, 535, 29889, 10493, 22050, 3089, 877, 29795, 742, 6139, 29892, 13, 462, 462, 9651, 2822, 2433, 1124, 597, 2640, 29889, 4773, 29889, 510, 29914, 5150, 1495, 13, 9651, 25342, 10116, 29961, 29900, 29962, 1405, 10116, 29961, 29896, 5387, 13, 18884, 6139, 353, 525, 29954, 5428, 1095, 2635, 338, 1434, 1369, 2635, 29889, 3529, 11837, 10116, 29889, 313, 29995, 29879, 19222, 29879, 16029, 320, 13, 462, 795, 1273, 313, 7971, 29889, 7529, 1839, 3166, 29918, 1256, 7464, 12428, 29889, 7529, 1839, 517, 29918, 1256, 11287, 13, 18884, 12020, 11092, 535, 29889, 10493, 22050, 3089, 877, 29795, 742, 6139, 29892, 13, 462, 462, 9651, 2822, 2433, 1124, 597, 2640, 29889, 4773, 29889, 510, 29914, 5150, 1495, 13, 9651, 565, 451, 12428, 29889, 7529, 1839, 29879, 6073, 13359, 13609, 580, 297, 1583, 29889, 26193, 800, 29889, 8149, 7295, 13, 18884, 6139, 353, 525, 29903, 6073, 3858, 338, 9815, 297, 11404, 362, 1591, 29892, 671, 1273, 29879, 29915, 1273, 851, 29898, 1958, 29898, 710, 29892, 1583, 29889, 26193, 800, 29889, 8149, 22130, 13, 18884, 12020, 11092, 535, 29889, 10493, 22050, 3089, 877, 29795, 742, 6139, 29892, 13, 462, 462, 9651, 2822, 2433, 1124, 597, 2640, 29889, 4773, 29889, 510, 29914, 5150, 1495, 13, 13, 9651, 363, 946, 29887, 297, 1583, 29889, 26193, 800, 29961, 7971, 29889, 7529, 1839, 29879, 6073, 13359, 13609, 580, 5387, 13, 18884, 23530, 29918, 1761, 29889, 4397, 3319, 29908, 29879, 6073, 29918, 978, 1115, 946, 29887, 29889, 29879, 6073, 29892, 376, 5563, 1115, 946, 29887, 29889, 5563, 1800, 13, 13, 9651, 2143, 29918, 2972, 29892, 2143, 29918, 333, 29892, 27091, 353, 938, 29898, 7971, 29889, 7529, 1839, 999, 29918, 2972, 2033, 511, 938, 29898, 7971, 29889, 7529, 1839, 999, 29918, 333, 2033, 511, 938, 29898, 7971, 29889, 7529, 1839, 9274, 29879, 11287, 13, 13, 13, 4706, 5174, 7670, 2392, 29892, 321, 29901, 13, 9651, 6139, 353, 525, 7974, 1820, 29901, 1273, 29879, 4567, 297, 2346, 6169, 1273, 321, 13, 9651, 12020, 11092, 535, 29889, 10493, 22050, 3089, 877, 2558, 2392, 742, 6139, 29892, 13, 462, 462, 4706, 2822, 2433, 1124, 597, 2640, 29889, 4773, 29889, 510, 29914, 5150, 1495, 13, 4706, 5174, 7865, 2392, 29892, 321, 29901, 13, 9651, 6139, 353, 525, 29954, 5428, 4128, 1712, 4319, 1819, 29901, 1273, 29879, 29915, 29995, 851, 29898, 29872, 29897, 13, 9651, 12020, 11092, 535, 29889, 10493, 22050, 3089, 877, 2558, 2392, 742, 6139, 29892, 13, 462, 462, 4706, 2822, 2433, 1124, 597, 2640, 29889, 4773, 29889, 510, 29914, 5150, 1495, 13, 13, 4706, 2346, 353, 1583, 3032, 1972, 29918, 4197, 6377, 999, 29918, 2972, 1115, 2143, 29918, 2972, 29892, 376, 999, 29918, 333, 1115, 2143, 29918, 333, 29913, 1402, 13, 462, 632, 518, 6377, 2962, 29918, 1256, 1115, 10116, 29961, 29900, 1402, 376, 355, 29918, 1256, 1115, 10116, 29961, 29896, 12258, 1402, 13, 462, 632, 23530, 29918, 1761, 29892, 27091, 29897, 13, 4706, 2346, 29918, 4984, 353, 11117, 6203, 2396, 29961, 6377, 999, 29918, 2972, 1115, 2143, 29918, 2972, 29892, 376, 999, 29918, 333, 1115, 2143, 29918, 333, 29913, 1402, 13, 462, 4706, 525, 15190, 2396, 29961, 6377, 2962, 29918, 1256, 1115, 10116, 29961, 29900, 1402, 376, 355, 29918, 1256, 1115, 10116, 29961, 29896, 12258, 1402, 13, 462, 4706, 525, 23149, 943, 2396, 29879, 6073, 29918, 1761, 29892, 525, 9274, 29879, 2396, 9274, 29879, 13, 462, 539, 500, 13, 13, 4706, 1476, 29918, 24713, 353, 1583, 3032, 657, 29918, 14538, 1691, 29898, 1972, 29897, 13, 4706, 17927, 29889, 3888, 877, 29961, 7194, 29962, 847, 28045, 29914, 4478, 29914, 2914, 29889, 29995, 29879, 29915, 1273, 3402, 29892, 4805, 3790, 29916, 29901, 710, 29898, 29891, 29897, 363, 921, 29892, 29891, 297, 2346, 29918, 4984, 29889, 1524, 7076, 580, 1800, 13, 4706, 565, 1423, 29918, 13237, 29901, 13, 9651, 363, 18031, 297, 1476, 29918, 24713, 29901, 13, 18884, 565, 525, 29879, 29941, 3597, 29915, 297, 18031, 1839, 13237, 13359, 8149, 7295, 13, 462, 1678, 565, 525, 7554, 29915, 297, 18031, 1839, 13237, 16215, 29879, 29941, 3597, 13359, 8149, 7295, 13, 462, 4706, 565, 451, 7592, 29918, 1445, 29918, 9933, 29898, 18031, 1839, 13237, 16215, 29879, 29941, 3597, 16215, 7554, 2033, 1125, 13, 462, 9651, 1596, 14210, 29879, 4567, 29915, 1273, 18031, 1839, 13237, 16215, 29879, 29941, 3597, 16215, 7554, 2033, 13, 13, 4706, 565, 3402, 29889, 13609, 580, 1275, 525, 3126, 2396, 13, 9651, 565, 525, 4478, 29914, 2798, 29915, 297, 12428, 29889, 2271, 29901, 13, 18884, 2582, 1839, 2798, 2033, 353, 2346, 29889, 2798, 580, 13, 9651, 1683, 29901, 13, 18884, 2582, 1839, 2798, 2033, 353, 2346, 29889, 2798, 580, 13, 18884, 2582, 1839, 11940, 29918, 24713, 2033, 353, 1476, 29918, 24713, 13, 18884, 2582, 1839, 11940, 29918, 1376, 267, 2033, 353, 12705, 29898, 1761, 29898, 842, 4197, 29916, 1839, 29873, 488, 29918, 25378, 2033, 363, 921, 297, 1476, 29918, 24713, 29962, 4961, 13, 18884, 2582, 1839, 11940, 29918, 13237, 2033, 353, 518, 25416, 29918, 4219, 718, 1583, 29889, 15140, 29889, 24244, 877, 24713, 29918, 10041, 742, 7855, 29918, 333, 29922, 29916, 1839, 10041, 29918, 333, 11287, 13, 462, 462, 795, 363, 921, 297, 2582, 1839, 11940, 29918, 24713, 2033, 29962, 13, 9651, 2582, 1839, 19170, 29918, 2230, 2033, 353, 931, 29889, 2230, 580, 448, 1369, 29918, 2230, 13, 4706, 25342, 3402, 29889, 13609, 580, 1275, 525, 24756, 3126, 2396, 13, 9651, 25900, 629, 4841, 353, 2322, 8977, 29898, 2892, 29901, 2322, 8977, 29898, 1761, 876, 13, 9651, 1737, 4835, 29892, 12421, 29879, 353, 1051, 3285, 1051, 580, 13, 9651, 363, 921, 297, 1476, 29918, 24713, 29901, 13, 18884, 25900, 629, 4841, 29961, 29916, 1839, 29873, 488, 29918, 25378, 2033, 22322, 562, 29939, 29918, 2230, 13359, 4397, 29898, 29916, 1839, 562, 29939, 29918, 2230, 11287, 13, 18884, 396, 25900, 629, 4841, 29961, 29916, 1839, 29873, 488, 29918, 25378, 2033, 22322, 562, 29939, 29918, 2230, 29918, 1315, 13359, 4397, 29898, 13, 18884, 396, 268, 938, 29898, 2230, 29889, 29885, 1193, 603, 29898, 1256, 16680, 29889, 5510, 29898, 29916, 1839, 562, 29939, 29918, 2230, 2033, 467, 9346, 24120, 552, 22130, 334, 29871, 29896, 29900, 29900, 29900, 29897, 13, 18884, 25900, 629, 4841, 29961, 29916, 1839, 29873, 488, 29918, 25378, 2033, 22322, 29873, 488, 29918, 25378, 13359, 4397, 29898, 29916, 1839, 29873, 488, 29918, 25378, 11287, 13, 18884, 25900, 629, 4841, 29961, 29916, 1839, 29873, 488, 29918, 25378, 2033, 22322, 9274, 29879, 13359, 4397, 29898, 29916, 1839, 9274, 29879, 11287, 13, 13, 9651, 363, 25900, 29918, 333, 297, 25900, 629, 4841, 29889, 8149, 7295, 13, 18884, 25900, 629, 4841, 29961, 29873, 488, 29918, 333, 22322, 2798, 2033, 353, 7431, 29898, 29873, 488, 629, 4841, 29961, 29873, 488, 29918, 333, 22322, 9274, 29879, 11287, 13, 18884, 25900, 629, 4841, 29961, 29873, 488, 29918, 333, 22322, 29873, 488, 29918, 25378, 2033, 353, 25900, 629, 4841, 29961, 29873, 488, 29918, 333, 22322, 29873, 488, 29918, 25378, 2033, 29961, 29900, 29962, 13, 13, 9651, 260, 5475, 29918, 8977, 353, 9657, 580, 13, 9651, 565, 7431, 29898, 29873, 488, 629, 4841, 29889, 8149, 3101, 1405, 29871, 29900, 29901, 13, 18884, 363, 2143, 29918, 978, 29892, 23216, 297, 1583, 3032, 1972, 29918, 29873, 488, 29918, 479, 290, 29898, 29873, 488, 629, 4841, 29889, 8149, 580, 1125, 13, 462, 1678, 260, 5475, 29918, 8977, 29961, 999, 29918, 978, 29962, 353, 23216, 13, 18884, 363, 25900, 29918, 333, 297, 25900, 629, 4841, 29889, 8149, 7295, 13, 462, 1678, 1737, 4835, 29889, 4397, 29898, 29884, 3126, 29889, 18132, 29898, 1376, 267, 29918, 8977, 29961, 29873, 488, 29918, 333, 12622, 13, 462, 1678, 12421, 29879, 29889, 4397, 29898, 29873, 488, 629, 4841, 29961, 29873, 488, 29918, 333, 2314, 13, 9651, 2582, 353, 1207, 29918, 7999, 29877, 8148, 29898, 479, 4835, 29892, 12421, 29879, 29897, 13, 4706, 25342, 3402, 29889, 13609, 580, 1275, 525, 7638, 2396, 13, 9651, 4206, 353, 1583, 3032, 15843, 29918, 1972, 29898, 11940, 29918, 24713, 29897, 13, 9651, 1354, 353, 1714, 5971, 29889, 1231, 5971, 580, 13, 9651, 274, 29893, 353, 11799, 29889, 13236, 29898, 1039, 29892, 28552, 2433, 29905, 29873, 1495, 13, 9651, 363, 1948, 297, 4206, 29901, 13, 18884, 274, 29893, 29889, 13236, 340, 29898, 798, 29897, 13, 9651, 2582, 353, 1354, 29889, 657, 1767, 2141, 17010, 28909, 29878, 29905, 29876, 1495, 13, 4706, 25342, 3402, 29889, 13609, 580, 1275, 525, 20267, 29916, 2396, 13, 9651, 4206, 353, 1583, 3032, 15843, 29918, 1972, 29898, 11940, 29918, 24713, 29897, 13, 9651, 851, 5971, 353, 1714, 5971, 29889, 1231, 5971, 580, 13, 9651, 664, 2909, 353, 5244, 2909, 29898, 710, 5971, 29892, 11117, 262, 29918, 14834, 2396, 5852, 29892, 525, 23362, 29918, 14834, 2396, 5852, 1800, 13, 9651, 14288, 353, 664, 2909, 29889, 1202, 29918, 4830, 3319, 29915, 8934, 2396, 5852, 1800, 13, 9651, 4802, 29918, 8934, 353, 664, 2909, 29889, 1202, 29918, 4830, 3319, 29915, 8934, 2396, 5852, 29892, 525, 2311, 2396, 29871, 29906, 29900, 1800, 13, 9651, 4698, 293, 353, 664, 2909, 29889, 1202, 29918, 4830, 3319, 29915, 2410, 293, 2396, 5852, 1800, 13, 13, 9651, 1736, 4155, 353, 664, 2909, 29889, 1202, 29918, 1287, 9855, 29898, 978, 2433, 29923, 29949, 1799, 7418, 1495, 13, 13, 9651, 1736, 4155, 29889, 3539, 29898, 29900, 29892, 29871, 29900, 29892, 525, 29923, 29949, 1799, 848, 7418, 742, 4802, 29918, 8934, 29897, 13, 13, 9651, 2143, 29918, 5415, 353, 9034, 21558, 2141, 657, 29918, 5679, 29898, 1972, 29918, 4572, 29889, 657, 877, 999, 29918, 333, 5477, 2346, 29918, 4572, 29889, 657, 877, 999, 29918, 2972, 1495, 467, 650, 580, 13, 13, 9651, 2346, 29918, 4572, 1839, 5679, 29918, 978, 2033, 353, 2143, 29918, 5415, 29889, 999, 29918, 978, 13, 9651, 2346, 29918, 4572, 1839, 5679, 29918, 1853, 2033, 353, 2143, 29918, 5415, 29889, 20275, 3977, 300, 668, 29889, 978, 13, 9651, 396, 11117, 9274, 29879, 2396, 525, 29953, 29900, 742, 525, 999, 29918, 333, 2396, 525, 29945, 29945, 29900, 29906, 742, 525, 3166, 29918, 1256, 2396, 525, 29900, 29929, 29914, 29900, 29955, 29914, 29906, 29900, 29896, 29953, 742, 525, 517, 29918, 1256, 2396, 525, 29896, 29900, 29914, 29900, 29955, 29914, 29906, 29900, 29896, 29953, 742, 525, 999, 29918, 2972, 2396, 525, 29896, 29906, 742, 525, 29879, 6073, 2396, 525, 29903, 15440, 295, 29906, 10827, 13, 9651, 364, 353, 29871, 29941, 13, 9651, 1736, 4155, 29889, 3539, 29898, 29878, 448, 29871, 29896, 29892, 29871, 29900, 29892, 525, 1972, 4175, 29901, 742, 4802, 29918, 8934, 29897, 13, 9651, 363, 274, 29892, 413, 297, 26985, 18959, 29879, 6073, 742, 525, 3166, 29918, 1256, 742, 525, 517, 29918, 1256, 742, 525, 9274, 29879, 742, 525, 5679, 29918, 978, 742, 525, 5679, 29918, 1853, 2033, 1125, 13, 18884, 1736, 4155, 29889, 3539, 29898, 29878, 718, 274, 29892, 29871, 29900, 29892, 413, 29892, 14288, 29897, 13, 18884, 1736, 4155, 29889, 3539, 29898, 29878, 718, 274, 29892, 29871, 29896, 29892, 2346, 29918, 4572, 29961, 29895, 2314, 13, 13, 9651, 364, 353, 29871, 29896, 29941, 13, 9651, 1736, 4155, 29889, 3539, 29898, 29878, 448, 29871, 29906, 29892, 29871, 29900, 29892, 525, 1972, 731, 29901, 742, 4802, 29918, 8934, 29897, 13, 9651, 363, 274, 29892, 413, 297, 26985, 29898, 5727, 29961, 29900, 29962, 1125, 13, 18884, 1736, 4155, 29889, 3539, 29898, 29878, 448, 29871, 29896, 29892, 274, 29892, 413, 29892, 14288, 29897, 13, 13, 9651, 363, 1819, 297, 4206, 29961, 29896, 29901, 5387, 13, 18884, 363, 274, 29892, 325, 297, 26985, 29898, 5975, 1125, 13, 462, 1678, 1736, 4155, 29889, 3539, 29898, 29878, 29892, 274, 29892, 325, 29897, 13, 18884, 364, 4619, 29871, 29896, 13, 13, 9651, 664, 2909, 29889, 5358, 580, 13, 9651, 851, 5971, 29889, 344, 1416, 29898, 29900, 29897, 13, 9651, 2582, 353, 851, 5971, 29889, 949, 580, 13, 13, 4706, 25342, 3402, 29889, 13609, 580, 1275, 525, 29882, 391, 2396, 13, 9651, 1476, 29918, 1376, 267, 353, 12705, 29898, 1761, 29898, 842, 4197, 29916, 1839, 29873, 488, 29918, 25378, 2033, 363, 921, 297, 1476, 29918, 24713, 29962, 4961, 13, 9651, 1121, 29918, 1761, 353, 5159, 13, 13, 9651, 937, 353, 9657, 580, 13, 9651, 937, 1839, 29873, 488, 29918, 25378, 2033, 353, 525, 25376, 351, 295, 1107, 29915, 13, 9651, 937, 1839, 9653, 2033, 353, 29871, 29896, 29900, 29900, 13, 9651, 1121, 29918, 1761, 29889, 4397, 29898, 4102, 29897, 13, 13, 9651, 848, 353, 12655, 29889, 3298, 359, 3552, 2435, 29898, 11940, 29918, 24713, 4961, 13, 9651, 260, 5475, 1761, 353, 5159, 13, 13, 9651, 474, 353, 29871, 29900, 13, 9651, 363, 921, 297, 1476, 29918, 24713, 29901, 13, 18884, 260, 5475, 1761, 29889, 4397, 29898, 29916, 1839, 29873, 488, 29918, 25378, 11287, 13, 18884, 848, 29961, 29875, 29962, 353, 5785, 29898, 29916, 1839, 9274, 29879, 11287, 13, 18884, 474, 353, 474, 718, 29871, 29896, 13, 13, 9651, 363, 260, 297, 1476, 29918, 1376, 267, 29901, 13, 18884, 474, 29916, 353, 12655, 29889, 2378, 29898, 1376, 267, 1761, 29897, 1275, 260, 13, 18884, 11306, 29918, 9274, 29879, 353, 848, 29961, 861, 29962, 13, 13, 18884, 954, 29918, 1557, 25487, 353, 2533, 29898, 861, 29897, 13, 18884, 9825, 29918, 6897, 353, 12655, 29889, 29882, 391, 13342, 29898, 6484, 29918, 9274, 29879, 29892, 289, 1144, 11759, 29899, 29896, 29962, 718, 3464, 29898, 29900, 29892, 29871, 29896, 29906, 29900, 29892, 29871, 29906, 29900, 876, 13, 18884, 9825, 29918, 2674, 353, 9825, 29918, 6897, 29961, 29900, 29962, 334, 29871, 29896, 29889, 29900, 847, 954, 29918, 1557, 25487, 13, 13, 18884, 9825, 29918, 4984, 353, 9657, 580, 13, 18884, 9825, 29918, 4984, 1839, 29873, 488, 29918, 25378, 2033, 353, 260, 13, 18884, 9825, 29918, 4984, 1839, 9653, 2033, 353, 29871, 29896, 29900, 29900, 13, 18884, 9825, 29918, 4984, 1839, 1557, 25487, 29918, 546, 29883, 29918, 29899, 29896, 2033, 353, 9825, 29918, 2674, 29961, 29900, 29962, 13, 18884, 9825, 29918, 4984, 1839, 1557, 25487, 29918, 546, 29883, 29918, 29906, 29900, 2033, 353, 9825, 29918, 2674, 29961, 29896, 29962, 13, 18884, 9825, 29918, 4984, 1839, 1557, 25487, 29918, 546, 29883, 29918, 29946, 29900, 2033, 353, 9825, 29918, 2674, 29961, 29906, 29962, 13, 18884, 9825, 29918, 4984, 1839, 1557, 25487, 29918, 546, 29883, 29918, 29953, 29900, 2033, 353, 9825, 29918, 2674, 29961, 29941, 29962, 13, 18884, 9825, 29918, 4984, 1839, 1557, 25487, 29918, 546, 29883, 29918, 29947, 29900, 2033, 353, 9825, 29918, 2674, 29961, 29946, 29962, 13, 18884, 9825, 29918, 4984, 1839, 1557, 25487, 29918, 546, 29883, 29918, 29896, 29900, 29900, 2033, 353, 9825, 29918, 2674, 29961, 29945, 29962, 13, 18884, 9825, 29918, 4984, 1839, 1557, 25487, 29918, 6897, 29918, 29899, 29896, 2033, 353, 9825, 29918, 6897, 29961, 29900, 3816, 29900, 29962, 13, 18884, 9825, 29918, 4984, 1839, 1557, 25487, 29918, 6897, 29918, 29906, 29900, 2033, 353, 9825, 29918, 6897, 29961, 29900, 3816, 29896, 29962, 13, 18884, 9825, 29918, 4984, 1839, 1557, 25487, 29918, 6897, 29918, 29946, 29900, 2033, 353, 9825, 29918, 6897, 29961, 29900, 3816, 29906, 29962, 13, 18884, 9825, 29918, 4984, 1839, 1557, 25487, 29918, 6897, 29918, 29953, 29900, 2033, 353, 9825, 29918, 6897, 29961, 29900, 3816, 29941, 29962, 13, 18884, 9825, 29918, 4984, 1839, 1557, 25487, 29918, 6897, 29918, 29947, 29900, 2033, 353, 9825, 29918, 6897, 29961, 29900, 3816, 29946, 29962, 13, 18884, 9825, 29918, 4984, 1839, 1557, 25487, 29918, 6897, 29918, 29896, 29900, 29900, 2033, 353, 9825, 29918, 6897, 29961, 29900, 3816, 29945, 29962, 13, 18884, 1121, 29918, 1761, 29889, 4397, 29898, 29882, 391, 29918, 4984, 29897, 13, 13, 9651, 2582, 1839, 11940, 29918, 1376, 267, 2033, 353, 1121, 29918, 1761, 13, 13, 4706, 4613, 29889, 4882, 353, 11092, 535, 29889, 10493, 29918, 29906, 29900, 29900, 13, 13, 4706, 565, 508, 29918, 7554, 29918, 5327, 29898, 7971, 29889, 13662, 1125, 13, 9651, 565, 3402, 29889, 13609, 580, 297, 6024, 29882, 391, 742, 525, 3126, 742, 525, 24756, 3126, 2033, 29901, 13, 18884, 4613, 29889, 842, 29918, 6672, 877, 3916, 29899, 1542, 742, 525, 6214, 29914, 3126, 1495, 13, 18884, 4613, 29889, 842, 29918, 6672, 877, 3916, 29899, 14934, 742, 525, 29887, 7554, 1495, 13, 18884, 4613, 29889, 2587, 353, 27122, 29918, 2587, 29898, 29884, 3126, 29889, 29881, 17204, 29898, 9902, 876, 13, 9651, 25342, 3402, 29889, 13609, 580, 1275, 525, 7638, 2396, 13, 18884, 4613, 29889, 842, 29918, 6672, 877, 3916, 29899, 1542, 742, 525, 726, 29914, 7638, 1495, 13, 18884, 4613, 29889, 842, 29918, 6672, 877, 3916, 29899, 2218, 3283, 742, 525, 14930, 358, 29936, 9507, 16328, 29879, 29936, 29915, 1273, 1583, 29889, 3258, 29918, 4905, 29918, 978, 877, 7638, 8785, 13, 18884, 4613, 29889, 842, 29918, 6672, 877, 3916, 29899, 14934, 742, 525, 29887, 7554, 1495, 13, 18884, 4613, 29889, 2587, 353, 27122, 29918, 2587, 29898, 9902, 29897, 13, 9651, 25342, 3402, 29889, 13609, 580, 1275, 525, 20267, 29916, 2396, 13, 18884, 4613, 29889, 842, 29918, 6672, 877, 3916, 29899, 1542, 742, 525, 6214, 29914, 29894, 299, 29889, 3150, 3134, 689, 1446, 29899, 29877, 2416, 287, 4463, 29889, 1028, 27844, 828, 29889, 9855, 1495, 13, 18884, 4613, 29889, 842, 29918, 6672, 877, 3916, 29899, 2218, 3283, 742, 525, 14930, 358, 29936, 9507, 16328, 29879, 29936, 29915, 1273, 1583, 29889, 3258, 29918, 4905, 29918, 978, 877, 20267, 29916, 8785, 13, 18884, 4613, 29889, 842, 29918, 6672, 877, 3916, 29899, 14934, 742, 525, 29887, 7554, 1495, 13, 18884, 4613, 29889, 2587, 353, 27122, 29918, 2587, 29898, 9902, 29897, 13, 4706, 1683, 29901, 13, 9651, 565, 3402, 29889, 13609, 580, 297, 6024, 29882, 391, 742, 525, 3126, 742, 525, 24756, 3126, 2033, 29901, 13, 18884, 4613, 29889, 842, 29918, 6672, 877, 3916, 29899, 1542, 742, 525, 6214, 29914, 3126, 1495, 13, 18884, 4613, 29889, 2587, 353, 318, 3126, 29889, 29881, 17204, 29898, 9902, 29897, 13, 9651, 25342, 3402, 29889, 13609, 580, 1275, 525, 7638, 2396, 13, 18884, 4613, 29889, 842, 29918, 6672, 877, 3916, 29899, 1542, 742, 525, 726, 29914, 7638, 1495, 13, 18884, 4613, 29889, 842, 29918, 6672, 877, 3916, 29899, 2218, 3283, 742, 525, 14930, 358, 29936, 9507, 16328, 29879, 29936, 29915, 1273, 1583, 29889, 3258, 29918, 4905, 29918, 978, 877, 7638, 8785, 13, 18884, 4613, 29889, 2587, 353, 2582, 13, 9651, 25342, 3402, 29889, 13609, 580, 1275, 525, 20267, 29916, 2396, 13, 18884, 4613, 29889, 842, 29918, 6672, 877, 3916, 29899, 1542, 742, 525, 6214, 29914, 29894, 299, 29889, 3150, 3134, 689, 1446, 29899, 29877, 2416, 287, 4463, 29889, 1028, 27844, 828, 29889, 9855, 1495, 13, 18884, 4613, 29889, 842, 29918, 6672, 877, 3916, 29899, 2218, 3283, 742, 525, 14930, 358, 29936, 9507, 16328, 29879, 29936, 29915, 1273, 1583, 29889, 3258, 29918, 4905, 29918, 978, 877, 20267, 29916, 8785, 13, 18884, 4613, 29889, 2587, 353, 2582, 13, 13, 1678, 822, 1653, 29918, 4905, 29918, 978, 29898, 1311, 29892, 6081, 1125, 13, 4706, 736, 525, 29923, 29949, 1799, 29918, 15916, 29918, 29995, 29879, 29889, 29995, 29879, 29915, 1273, 313, 12673, 29889, 12673, 29889, 3707, 2141, 10718, 4830, 3285, 6081, 29897, 13, 13, 1678, 822, 373, 29918, 2490, 29898, 1311, 29892, 12428, 29892, 4613, 29892, 3402, 1125, 13, 4706, 9995, 3481, 793, 11971, 7274, 13, 4706, 426, 13, 12, 29908, 29881, 1008, 927, 1115, 15974, 13, 12, 12, 29908, 2962, 29918, 1256, 1115, 376, 29900, 29945, 29914, 29941, 29896, 29914, 29906, 29900, 29900, 29900, 613, 13, 12, 12, 29908, 355, 29918, 1256, 1115, 376, 29900, 29955, 29914, 29900, 29906, 29914, 29906, 29900, 29900, 29941, 29908, 13, 12, 29913, 1402, 13, 12, 29908, 9274, 29879, 1115, 29871, 29896, 29892, 13, 12, 29908, 23149, 943, 1115, 518, 13, 1678, 8853, 29879, 6073, 29918, 978, 1115, 376, 29931, 2190, 8452, 1299, 29918, 2544, 29924, 613, 376, 5563, 1115, 5124, 500, 1402, 13, 12, 29908, 598, 294, 1115, 15974, 13, 12, 12, 29908, 999, 29918, 2972, 1115, 29871, 29896, 29906, 29892, 13, 12, 12, 29908, 999, 29918, 333, 1115, 29871, 29953, 29906, 29900, 29947, 13, 12, 6525, 13, 29913, 13, 13, 6377, 9274, 29879, 1115, 29906, 29900, 1699, 29881, 1008, 927, 1115, 29961, 6377, 2962, 29918, 1256, 4710, 29900, 29929, 29914, 29900, 29906, 29914, 29906, 29900, 29896, 29945, 3284, 355, 29918, 1256, 4710, 29900, 29929, 29914, 29896, 29946, 29914, 29906, 29900, 29896, 29953, 9092, 1402, 13, 29871, 376, 23149, 943, 1115, 29961, 6377, 978, 4710, 5252, 271, 9092, 1402, 13, 1678, 376, 598, 294, 1115, 29961, 6377, 999, 29918, 333, 1115, 29941, 29953, 29906, 1699, 999, 29918, 2972, 4710, 29929, 29908, 6525, 29913, 13, 4706, 9995, 13, 13, 4706, 396, 14402, 29901, 2425, 975, 10161, 13, 4706, 23530, 29918, 1761, 353, 1051, 580, 13, 4706, 2582, 353, 9657, 580, 13, 4706, 1369, 29918, 2230, 353, 931, 29889, 2230, 580, 13, 4706, 1962, 353, 1714, 5971, 29889, 1231, 5971, 580, 13, 4706, 1550, 5852, 29901, 13, 9651, 19875, 353, 12428, 29889, 5461, 29889, 949, 29898, 29946, 29900, 29929, 29953, 29897, 13, 9651, 565, 451, 19875, 29901, 13, 18884, 2867, 13, 9651, 1962, 29889, 3539, 29898, 29812, 29897, 13, 13, 4706, 3573, 353, 1962, 29889, 657, 1767, 580, 13, 4706, 1962, 29889, 5358, 580, 13, 4706, 1018, 29901, 13, 9651, 2281, 353, 318, 3126, 29889, 18132, 29898, 2587, 29889, 13808, 877, 9420, 29899, 29947, 8785, 13, 13, 4706, 5174, 7865, 2392, 29892, 321, 29901, 13, 9651, 396, 1018, 21822, 29871, 921, 29899, 1636, 29899, 689, 29899, 2271, 26716, 13, 9651, 2346, 29918, 710, 353, 11092, 535, 29889, 4422, 29889, 5338, 29889, 13808, 29898, 2587, 29889, 13808, 877, 9420, 29899, 29947, 8785, 13, 9651, 2346, 29918, 710, 353, 2346, 29918, 710, 29961, 1972, 29918, 710, 29889, 2886, 877, 10998, 1125, 1972, 29918, 710, 29889, 29878, 2886, 877, 29913, 1495, 718, 29871, 29896, 29962, 13, 9651, 1018, 29901, 13, 18884, 2281, 353, 318, 3126, 29889, 18132, 29898, 1972, 29918, 710, 29897, 13, 9651, 5174, 7865, 2392, 29892, 321, 29901, 13, 18884, 6139, 353, 525, 29954, 573, 2009, 338, 694, 2854, 4663, 3643, 3142, 26716, 6529, 327, 3573, 6169, 13, 18884, 12020, 11092, 535, 29889, 10493, 25807, 29884, 3016, 287, 10572, 1542, 29898, 8216, 29892, 13, 462, 462, 462, 418, 2822, 2433, 1124, 597, 2640, 29889, 4773, 29889, 510, 29914, 5150, 1495, 13, 13, 4706, 1018, 29901, 13, 9651, 363, 269, 297, 2281, 1839, 23149, 943, 2033, 29901, 13, 18884, 565, 525, 29879, 6073, 29918, 978, 29915, 297, 269, 29889, 8149, 580, 322, 525, 5563, 29915, 297, 269, 29889, 8149, 7295, 13, 462, 1678, 23530, 29918, 1761, 29889, 4397, 29898, 29879, 29897, 13, 18884, 25342, 525, 978, 29915, 297, 269, 29889, 8149, 7295, 13, 462, 1678, 565, 451, 269, 1839, 978, 13359, 13609, 580, 297, 1583, 29889, 26193, 800, 29889, 8149, 7295, 13, 462, 4706, 6139, 353, 525, 29903, 6073, 3858, 338, 9815, 297, 11404, 362, 1591, 29915, 13, 462, 4706, 12020, 11092, 535, 29889, 10493, 22050, 3089, 877, 29907, 3968, 742, 6139, 29892, 13, 462, 462, 462, 1678, 2822, 2433, 1124, 597, 2640, 29889, 4773, 29889, 510, 29914, 5150, 1495, 13, 462, 1678, 363, 946, 29887, 297, 1583, 29889, 26193, 800, 29961, 29879, 1839, 978, 13359, 13609, 580, 5387, 13, 462, 4706, 23530, 29918, 1761, 29889, 4397, 3319, 29908, 29879, 6073, 29918, 978, 1115, 946, 29887, 29889, 29879, 6073, 29892, 376, 5563, 1115, 946, 29887, 29889, 5563, 1800, 13, 18884, 1683, 29901, 13, 462, 1678, 6139, 353, 525, 29903, 6073, 338, 451, 6790, 297, 2346, 29915, 13, 462, 1678, 12020, 11092, 535, 29889, 10493, 22050, 3089, 877, 29907, 3968, 742, 6139, 29892, 13, 462, 462, 18884, 2822, 2433, 1124, 597, 2640, 29889, 4773, 29889, 510, 29914, 5150, 1495, 13, 13, 9651, 2346, 353, 1583, 3032, 1972, 23538, 4984, 1839, 598, 294, 7464, 2281, 1839, 29881, 1008, 927, 7464, 23530, 29918, 1761, 29892, 2281, 1839, 9274, 29879, 11287, 13, 9651, 2346, 29918, 4984, 353, 11117, 6203, 2396, 2281, 1839, 598, 294, 7464, 13, 462, 9651, 525, 15190, 2396, 2281, 1839, 29881, 1008, 927, 7464, 13, 462, 9651, 525, 23149, 943, 2396, 23530, 29918, 1761, 29892, 525, 9274, 29879, 2396, 2281, 1839, 9274, 29879, 2033, 13, 462, 9651, 500, 13, 9651, 17927, 29889, 3888, 877, 29961, 5438, 29962, 847, 28045, 29914, 4478, 29914, 2914, 29889, 29995, 29879, 29915, 1273, 3402, 29892, 4805, 3790, 29916, 29901, 710, 29898, 29891, 29897, 363, 921, 29892, 29891, 297, 2346, 29918, 4984, 29889, 1524, 7076, 580, 1800, 13, 13, 13, 4706, 5174, 7670, 2392, 29892, 321, 29901, 13, 9651, 6139, 353, 525, 7974, 1820, 29901, 1273, 29879, 4567, 297, 2346, 6169, 1273, 321, 13, 9651, 12020, 11092, 535, 29889, 10493, 22050, 3089, 877, 2558, 2392, 742, 6139, 29892, 13, 462, 462, 4706, 2822, 2433, 1124, 597, 2640, 29889, 4773, 29889, 510, 29914, 5150, 1495, 13, 4706, 2582, 1839, 2798, 2033, 353, 2346, 29889, 2798, 580, 13, 13, 4706, 1476, 29918, 24713, 353, 1583, 3032, 657, 29918, 14538, 1691, 29898, 1972, 29897, 13, 4706, 2582, 1839, 11940, 29918, 24713, 2033, 353, 1476, 29918, 24713, 13, 4706, 2582, 1839, 11940, 29918, 1376, 267, 2033, 353, 12705, 29898, 1761, 29898, 842, 4197, 29916, 1839, 29873, 488, 29918, 25378, 2033, 363, 921, 297, 1476, 29918, 24713, 29962, 4961, 13, 4706, 396, 2582, 29889, 5504, 3319, 29915, 1972, 2396, 2281, 1800, 13, 13, 4706, 4613, 29889, 2587, 353, 318, 3126, 29889, 29881, 17204, 29898, 9902, 29897, 13, 13, 4706, 4613, 29889, 4882, 353, 11092, 535, 29889, 10493, 29918, 29906, 29900, 29900, 13, 4706, 2582, 1839, 19170, 29918, 2230, 2033, 353, 931, 29889, 2230, 580, 448, 1369, 29918, 2230, 13, 4706, 565, 508, 29918, 7554, 29918, 5327, 29898, 7971, 29889, 13662, 1125, 13, 9651, 4613, 29889, 842, 29918, 6672, 877, 3916, 29899, 1542, 742, 525, 6214, 29914, 3126, 1495, 13, 9651, 4613, 29889, 842, 29918, 6672, 877, 3916, 29899, 14934, 742, 525, 29887, 7554, 1495, 13, 9651, 4613, 29889, 2587, 353, 27122, 29918, 2587, 29898, 29884, 3126, 29889, 29881, 17204, 29898, 9902, 876, 13, 4706, 1683, 29901, 13, 9651, 4613, 29889, 842, 29918, 6672, 877, 3916, 29899, 1542, 742, 525, 6214, 29914, 3126, 1495, 13, 9651, 4613, 29889, 2587, 353, 318, 3126, 29889, 29881, 17204, 29898, 9902, 29897, 13, 2 ]
wmt-etl/config.py
ministryofjustice/hmpps-wmt
3
31555
import os DB_SERVER = os.getenv('WMT_DB_SERVER', 'localhost') DB_NAME = os.getenv('WMT_DB_NAME', 'wmt_db') DB_USERNAME = os.getenv('WMT_DB_USERNAME', 'wmt') DB_PASSWORD = os.getenv('WMT_DB_PASSWORD', '<PASSWORD>')
[ 1, 1053, 2897, 13, 13, 4051, 29918, 18603, 353, 2897, 29889, 657, 6272, 877, 29956, 11490, 29918, 4051, 29918, 18603, 742, 525, 7640, 1495, 13, 4051, 29918, 5813, 353, 2897, 29889, 657, 6272, 877, 29956, 11490, 29918, 4051, 29918, 5813, 742, 525, 29893, 4378, 29918, 2585, 1495, 13, 4051, 29918, 11889, 5813, 353, 2897, 29889, 657, 6272, 877, 29956, 11490, 29918, 4051, 29918, 11889, 5813, 742, 525, 29893, 4378, 1495, 13, 4051, 29918, 25711, 17013, 353, 2897, 29889, 657, 6272, 877, 29956, 11490, 29918, 4051, 29918, 25711, 17013, 742, 12801, 25711, 17013, 29958, 1495, 13, 2 ]