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
07_Greedy/distribute_candy.py
Sheetal0601/InterviewBit
61
54117
# Distribute Candy # https://www.interviewbit.com/problems/distribute-candy/ # # There are N children standing in a line. Each child is assigned a rating value. # # You are giving candies to these children subjected to the following requirements: # Each child must have at least one candy. # Children with a higher rating get more candies than their neighbors. # What is the minimum candies you must give? # # Sample Input : # # Ratings : [1 2] # Sample Output : # # 3 # The candidate with 1 rating gets 1 candy and candidate with rating cannot get 1 candy as 1 is # its neighbor. So rating 2 candidate gets 2 candies. In total, 2+1 = 3 candies need to be given out. # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # class Solution: # @param A : list of integers # @return an integer def candy(self, A): candies = [1] for i in range(1, len(A)): candies.append(candies[-1] + 1 if A[i] > A[i - 1] else 1) result = candies[-1] for i in range(len(A) - 2, -1, -1): curr = candies[i + 1] + 1 if A[i] > A[i + 1] else 1 result += max(curr, candies[i]) candies[i] = curr return result # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # if __name__ == "__main__": s = Solution() print(s.candy([1, 2]))
[ 1, 396, 6652, 2666, 315, 13910, 13, 29937, 2045, 597, 1636, 29889, 1639, 1493, 2966, 29889, 510, 29914, 17199, 29879, 29914, 5721, 2666, 29899, 29883, 13910, 29914, 13, 29937, 13, 29937, 1670, 526, 405, 4344, 13407, 297, 263, 1196, 29889, 7806, 2278, 338, 9859, 263, 21700, 995, 29889, 13, 29937, 13, 29937, 29871, 887, 526, 6820, 23794, 583, 304, 1438, 4344, 4967, 287, 304, 278, 1494, 11780, 29901, 13, 29937, 7806, 2278, 1818, 505, 472, 3203, 697, 274, 13910, 29889, 13, 29937, 20986, 411, 263, 6133, 21700, 679, 901, 23794, 583, 1135, 1009, 22092, 943, 29889, 13, 29937, 1724, 338, 278, 9212, 23794, 583, 366, 1818, 2367, 29973, 13, 29937, 13, 29937, 21029, 10567, 584, 13, 29937, 13, 29937, 17450, 886, 584, 518, 29896, 29871, 29906, 29962, 13, 29937, 21029, 10604, 584, 13, 29937, 13, 29937, 29871, 29941, 13, 29937, 450, 14020, 411, 29871, 29896, 21700, 4947, 29871, 29896, 274, 13910, 322, 14020, 411, 21700, 2609, 679, 29871, 29896, 274, 13910, 408, 29871, 29896, 338, 13, 29937, 967, 12307, 29889, 1105, 21700, 29871, 29906, 14020, 4947, 29871, 29906, 23794, 583, 29889, 512, 3001, 29892, 29871, 29906, 29974, 29896, 353, 29871, 29941, 23794, 583, 817, 304, 367, 2183, 714, 29889, 13, 29937, 13, 29937, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 13, 13, 1990, 24380, 29901, 13, 1678, 396, 732, 3207, 319, 584, 1051, 310, 11920, 13, 1678, 396, 732, 2457, 385, 6043, 13, 1678, 822, 274, 13910, 29898, 1311, 29892, 319, 1125, 13, 4706, 23794, 583, 353, 518, 29896, 29962, 13, 13, 4706, 363, 474, 297, 3464, 29898, 29896, 29892, 7431, 29898, 29909, 22164, 13, 9651, 23794, 583, 29889, 4397, 29898, 29883, 392, 583, 14352, 29896, 29962, 718, 29871, 29896, 565, 319, 29961, 29875, 29962, 1405, 319, 29961, 29875, 448, 29871, 29896, 29962, 1683, 29871, 29896, 29897, 13, 13, 4706, 1121, 353, 23794, 583, 14352, 29896, 29962, 13, 4706, 363, 474, 297, 3464, 29898, 2435, 29898, 29909, 29897, 448, 29871, 29906, 29892, 448, 29896, 29892, 448, 29896, 1125, 13, 9651, 16256, 353, 23794, 583, 29961, 29875, 718, 29871, 29896, 29962, 718, 29871, 29896, 565, 319, 29961, 29875, 29962, 1405, 319, 29961, 29875, 718, 29871, 29896, 29962, 1683, 29871, 29896, 13, 9651, 1121, 4619, 4236, 29898, 21962, 29892, 23794, 583, 29961, 29875, 2314, 13, 9651, 23794, 583, 29961, 29875, 29962, 353, 16256, 13, 13, 4706, 736, 1121, 13, 13, 29937, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 269, 353, 24380, 580, 13, 1678, 1596, 29898, 29879, 29889, 29883, 13910, 4197, 29896, 29892, 29871, 29906, 12622, 13, 13, 13, 2 ]
foundation/backend/controller/__init__.py
tbone255/foundation
0
121741
<reponame>tbone255/foundation<gh_stars>0 from .base import * from .mixins import *
[ 1, 529, 276, 1112, 420, 29958, 29873, 15933, 29906, 29945, 29945, 29914, 11940, 362, 29966, 12443, 29918, 303, 1503, 29958, 29900, 13, 3166, 869, 3188, 1053, 334, 13, 3166, 869, 28084, 1144, 1053, 334, 13, 2 ]
solutions/previous_solution_python/leetcode_1041.py
YuhanShi53/Leetcode_solutions
0
46203
""" Leetcode 1041 - Robot Bounded in Circle https://leetcode.com/problems/robot-bounded-in-circle/ """ class Solution1: """ 1. MINE Straight-Forward """ def is_robot_bounded(self, instructions: str) -> bool: nums = {'G': 0, 'R': 1, 'L': -1} direction = [1, -1] position = [0, 0] idx = 0 summation = 0 factor = 1 for x in instructions: summation += nums[x] if x in ('R', 'L'): idx = 1 - idx factor *= nums[x] * direction[idx] else: position[idx] += factor * 1 if summation % 4 == 0 and position != [0, 0]: return False return True if __name__ == '__main__': instructions = "GGG" res = Solution1().is_robot_bounded(instructions) print(res)
[ 1, 9995, 951, 300, 401, 29871, 29896, 29900, 29946, 29896, 448, 6417, 327, 350, 7261, 297, 27927, 13, 13, 991, 597, 280, 300, 401, 29889, 510, 29914, 17199, 29879, 29914, 307, 7451, 29899, 29306, 29899, 262, 29899, 16622, 29914, 13, 13, 13, 15945, 29908, 13, 13, 13, 1990, 24380, 29896, 29901, 13, 1678, 9995, 29871, 29896, 29889, 341, 8895, 7357, 523, 29899, 2831, 1328, 9995, 13, 13, 1678, 822, 338, 29918, 307, 7451, 29918, 29306, 29898, 1311, 29892, 11994, 29901, 851, 29897, 1599, 6120, 29901, 13, 4706, 954, 29879, 353, 11117, 29954, 2396, 29871, 29900, 29892, 525, 29934, 2396, 29871, 29896, 29892, 525, 29931, 2396, 448, 29896, 29913, 13, 4706, 5305, 353, 518, 29896, 29892, 448, 29896, 29962, 13, 4706, 2602, 353, 518, 29900, 29892, 29871, 29900, 29962, 13, 4706, 22645, 353, 29871, 29900, 13, 4706, 22792, 362, 353, 29871, 29900, 13, 4706, 7329, 353, 29871, 29896, 13, 13, 4706, 363, 921, 297, 11994, 29901, 13, 9651, 22792, 362, 4619, 954, 29879, 29961, 29916, 29962, 13, 9651, 565, 921, 297, 6702, 29934, 742, 525, 29931, 29374, 13, 18884, 22645, 353, 29871, 29896, 448, 22645, 13, 18884, 7329, 334, 29922, 954, 29879, 29961, 29916, 29962, 334, 5305, 29961, 13140, 29962, 13, 9651, 1683, 29901, 13, 18884, 2602, 29961, 13140, 29962, 4619, 7329, 334, 29871, 29896, 13, 13, 4706, 565, 22792, 362, 1273, 29871, 29946, 1275, 29871, 29900, 322, 2602, 2804, 518, 29900, 29892, 29871, 29900, 5387, 13, 9651, 736, 7700, 13, 4706, 736, 5852, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 11994, 353, 376, 26788, 29954, 29908, 13, 1678, 620, 353, 24380, 29896, 2141, 275, 29918, 307, 7451, 29918, 29306, 29898, 2611, 582, 1953, 29897, 13, 1678, 1596, 29898, 690, 29897, 13, 2 ]
behave/reporter/summary.py
fluendo/behave
0
18121
# -*- coding: UTF-8 -*- """ Provides a summary after each test run. """ from __future__ import absolute_import, division, print_function import sys from time import time as time_now from behave.model import Rule, ScenarioOutline # MAYBE: Scenario from behave.model_core import Status from behave.reporter.base import Reporter from behave.formatter.base import StreamOpener # --------------------------------------------------------------------------- # CONSTANTS: # --------------------------------------------------------------------------- # -- DISABLED: OPTIONAL_STEPS = ('untested', 'undefined') OPTIONAL_STEPS = (Status.untested,) # MAYBE: Status.undefined STATUS_ORDER = (Status.passed, Status.failed, Status.skipped, Status.undefined, Status.untested) # --------------------------------------------------------------------------- # UTILITY FUNCTIONS: # --------------------------------------------------------------------------- def pluralize(word, count=1, suffix="s"): if count == 1: return word # -- OTHERWISE: return "{0}{1}".format(word, suffix) def compute_summary_sum(summary): """Compute sum of all summary counts (except: all) :param summary: Summary counts (as dict). :return: Sum of all counts (as integer). """ counts_sum = 0 for name, count in summary.items(): if name == "all": continue # IGNORE IT. counts_sum += count return counts_sum def format_summary0(statement_type, summary): parts = [] for status in STATUS_ORDER: if status.name not in summary: continue counts = summary[status.name] if status in OPTIONAL_STEPS and counts == 0: # -- SHOW-ONLY: For relevant counts, suppress: untested items, etc. continue if not parts: # -- FIRST ITEM: Add statement_type to counter. label = statement_type if counts != 1: label += 's' part = u"%d %s %s" % (counts, label, status.name) else: part = u"%d %s" % (counts, status.name) parts.append(part) return ", ".join(parts) + "\n" def format_summary(statement_type, summary): parts = [] for status in STATUS_ORDER: if status.name not in summary: continue counts = summary[status.name] if status in OPTIONAL_STEPS and counts == 0: # -- SHOW-ONLY: For relevant counts, suppress: untested items, etc. continue name = status.name if status.name == "passed": statement = pluralize(statement_type, counts) name = u"%s passed" % statement part = u"%d %s" % (counts, name) parts.append(part) return ", ".join(parts) + "\n" # -- PREPARED: def format_summary2(statement_type, summary, end="\n"): """Format the summary line for one statement type. .. code-block:: 6 scenarios (passed: 5, failed: 1, skipped: 0, untested: 0) :param statement_type: :param summary: :return: """ parts = [] for status in STATUS_ORDER: if status.name not in summary: continue counts = summary[status.name] if status in OPTIONAL_STEPS and counts == 0: # -- SHOW-ONLY: For relevant counts, suppress: untested items, etc. continue parts.append((status.name, counts)) counts_sum = summary["all"] statement = pluralize(statement_type, sum) parts_text = ", ".join(["{0}: {1}".format(name, value) for name, value in parts]) return "{count:4} {statement:<9} ({parts}){end}".format( count=counts_sum, statement=statement, parts=parts_text, end=end) # --------------------------------------------------------------------------- # REPORTERS: # --------------------------------------------------------------------------- class SummaryReporter(Reporter): show_failed_scenarios = True output_stream_name = "stdout" def __init__(self, config): super(SummaryReporter, self).__init__(config) stream = getattr(sys, self.output_stream_name, sys.stderr) self.stream = StreamOpener.ensure_stream_with_encoder(stream) summary_zero_data = { "all": 0, Status.passed.name: 0, Status.failed.name: 0, Status.skipped.name: 0, Status.untested.name: 0 } self.feature_summary = summary_zero_data.copy() self.rule_summary = summary_zero_data.copy() self.scenario_summary = summary_zero_data.copy() self.step_summary = {Status.undefined.name: 0} self.step_summary.update(summary_zero_data) self.duration = 0.0 self.run_starttime = 0 self.run_endtime = 0 self.failed_scenarios = [] self.show_rules = True def testrun_started(self, timestamp=None): if timestamp is None: timestamp = time_now() self.run_starttime = timestamp def testrun_finished(self, timestamp=None): if timestamp is None: timestamp = time_now() self.run_endtime = timestamp def print_failing_scenarios(self, stream=None): if stream is None: stream = self.stream stream.write("\nFailing scenarios:\n") for scenario in self.failed_scenarios: # add the list of tags matching ###-### so we will show the issue identifier with the error OPE-1234 stream.write(u" %s %s %s\n" % (', '.join(t for t in scenario.tags if len(t.split('-'))==2 ), scenario.location, scenario.name)) def compute_summary_sums(self): """(Re)Compute summary sum of all counts (except: all).""" summaries = [ self.feature_summary, self.rule_summary, self.scenario_summary, self.step_summary ] for summary in summaries: summary["all"] = compute_summary_sum(summary) def print_summary(self, stream=None, with_duration=True): if stream is None: stream = self.stream self.compute_summary_sums() has_rules = (self.rule_summary["all"] > 0) stream.write(format_summary("feature", self.feature_summary)) if self.show_rules and has_rules: # -- HINT: Show only rules, if any exists. self.stream.write(format_summary("rule", self.rule_summary)) stream.write(format_summary("scenario", self.scenario_summary)) stream.write(format_summary("step", self.step_summary)) # -- DURATION: if with_duration: timings = (int(self.duration / 60.0), self.duration % 60) stream.write('Took %dm%02.3fs\n' % timings) # -- REPORTER-API: def feature(self, feature): if self.run_starttime == 0: # -- DISCOVER: TEST-RUN started. self.testrun_started() self.process_feature(feature) def end(self): self.testrun_finished() # -- SHOW FAILED SCENARIOS (optional): if self.show_failed_scenarios and self.failed_scenarios: self.print_failing_scenarios() self.stream.write("\n") # -- SHOW SUMMARY COUNTS: self.print_summary() def process_run_items_for(self, parent): for run_item in parent: if isinstance(run_item, Rule): self.process_rule(run_item) elif isinstance(run_item, ScenarioOutline): self.process_scenario_outline(run_item) else: # assert isinstance(run_item, Scenario) self.process_scenario(run_item) def process_feature(self, feature): self.duration += feature.duration self.feature_summary[feature.status.name] += 1 self.process_run_items_for(feature) def process_rule(self, rule): self.rule_summary[rule.status.name] += 1 self.process_run_items_for(rule) def process_scenario(self, scenario): if scenario.status == Status.failed: self.failed_scenarios.append(scenario) self.scenario_summary[scenario.status.name] += 1 for step in scenario: self.step_summary[step.status.name] += 1 def process_scenario_outline(self, scenario_outline): for scenario in scenario_outline.scenarios: self.process_scenario(scenario)
[ 1, 396, 448, 29930, 29899, 14137, 29901, 18351, 29899, 29947, 448, 29930, 29899, 13, 15945, 29908, 13, 1184, 29894, 2247, 263, 15837, 1156, 1269, 1243, 1065, 29889, 13, 15945, 29908, 13, 13, 3166, 4770, 29888, 9130, 1649, 1053, 8380, 29918, 5215, 29892, 8542, 29892, 1596, 29918, 2220, 13, 5215, 10876, 13, 3166, 931, 1053, 931, 408, 931, 29918, 3707, 13, 3166, 23389, 29889, 4299, 1053, 27308, 29892, 2522, 24893, 3744, 1220, 29871, 396, 14861, 29979, 15349, 29901, 2522, 24893, 13, 3166, 23389, 29889, 4299, 29918, 3221, 1053, 16034, 13, 3166, 23389, 29889, 276, 18505, 29889, 3188, 1053, 830, 18505, 13, 3166, 23389, 29889, 689, 2620, 29889, 3188, 1053, 13763, 11746, 759, 13, 13, 13, 29937, 448, 2683, 2683, 2683, 2683, 28400, 13, 29937, 8707, 1254, 2190, 9375, 29901, 13, 29937, 448, 2683, 2683, 2683, 2683, 28400, 13, 29937, 1192, 28657, 6181, 29928, 29901, 6418, 29911, 2725, 1964, 29918, 1254, 29923, 7024, 353, 6702, 1657, 2868, 742, 525, 15955, 1495, 13, 14094, 2725, 1964, 29918, 1254, 29923, 7024, 353, 313, 5709, 29889, 1657, 2868, 29892, 29897, 396, 14861, 29979, 15349, 29901, 16034, 29889, 15955, 13, 27047, 29918, 22364, 353, 313, 5709, 29889, 3364, 287, 29892, 16034, 29889, 26061, 29892, 16034, 29889, 2574, 2986, 29892, 13, 18884, 16034, 29889, 15955, 29892, 16034, 29889, 1657, 2868, 29897, 13, 13, 13, 29937, 448, 2683, 2683, 2683, 2683, 28400, 13, 29937, 501, 29911, 6227, 11937, 383, 28700, 29903, 29901, 13, 29937, 448, 2683, 2683, 2683, 2683, 28400, 13, 1753, 715, 3631, 675, 29898, 1742, 29892, 2302, 29922, 29896, 29892, 25557, 543, 29879, 29908, 1125, 13, 1678, 565, 2302, 1275, 29871, 29896, 29901, 13, 4706, 736, 1734, 13, 1678, 396, 1192, 438, 29911, 4448, 22119, 1660, 29901, 13, 1678, 736, 29850, 29900, 1157, 29896, 29913, 1642, 4830, 29898, 1742, 29892, 25557, 29897, 13, 13, 13, 1753, 10272, 29918, 7727, 29918, 2083, 29898, 7727, 1125, 13, 1678, 9995, 20606, 29872, 2533, 310, 599, 15837, 18139, 313, 19499, 29901, 599, 29897, 13, 13, 1678, 584, 3207, 15837, 29901, 6991, 5219, 18139, 313, 294, 9657, 467, 13, 1678, 584, 2457, 29901, 6991, 310, 599, 18139, 313, 294, 6043, 467, 13, 1678, 9995, 13, 1678, 18139, 29918, 2083, 353, 29871, 29900, 13, 1678, 363, 1024, 29892, 2302, 297, 15837, 29889, 7076, 7295, 13, 4706, 565, 1024, 1275, 376, 497, 1115, 13, 9651, 6773, 1678, 396, 306, 29954, 6632, 1525, 13315, 29889, 13, 4706, 18139, 29918, 2083, 4619, 2302, 13, 1678, 736, 18139, 29918, 2083, 13, 13, 13, 1753, 3402, 29918, 7727, 29900, 29898, 20788, 29918, 1853, 29892, 15837, 1125, 13, 1678, 5633, 353, 5159, 13, 1678, 363, 4660, 297, 6850, 1299, 3308, 29918, 22364, 29901, 13, 4706, 565, 4660, 29889, 978, 451, 297, 15837, 29901, 13, 9651, 6773, 13, 4706, 18139, 353, 15837, 29961, 4882, 29889, 978, 29962, 13, 4706, 565, 4660, 297, 6418, 29911, 2725, 1964, 29918, 1254, 29923, 7024, 322, 18139, 1275, 29871, 29900, 29901, 13, 9651, 396, 1192, 317, 8187, 29956, 29899, 1164, 16786, 29901, 1152, 8018, 18139, 29892, 21301, 29901, 443, 1688, 287, 4452, 29892, 2992, 29889, 13, 9651, 6773, 13, 13, 4706, 565, 451, 5633, 29901, 13, 9651, 396, 1192, 383, 8193, 1254, 306, 4330, 29924, 29901, 3462, 3229, 29918, 1853, 304, 6795, 29889, 13, 9651, 3858, 353, 3229, 29918, 1853, 13, 9651, 565, 18139, 2804, 29871, 29896, 29901, 13, 18884, 3858, 4619, 525, 29879, 29915, 13, 9651, 760, 353, 318, 29908, 29995, 29881, 1273, 29879, 1273, 29879, 29908, 1273, 313, 2798, 29879, 29892, 3858, 29892, 4660, 29889, 978, 29897, 13, 4706, 1683, 29901, 13, 9651, 760, 353, 318, 29908, 29995, 29881, 1273, 29879, 29908, 1273, 313, 2798, 29879, 29892, 4660, 29889, 978, 29897, 13, 4706, 5633, 29889, 4397, 29898, 1595, 29897, 13, 1678, 736, 9162, 11393, 7122, 29898, 20895, 29897, 718, 6634, 29876, 29908, 13, 13, 13, 1753, 3402, 29918, 7727, 29898, 20788, 29918, 1853, 29892, 15837, 1125, 13, 1678, 5633, 353, 5159, 13, 1678, 363, 4660, 297, 6850, 1299, 3308, 29918, 22364, 29901, 13, 4706, 565, 4660, 29889, 978, 451, 297, 15837, 29901, 13, 9651, 6773, 13, 4706, 18139, 353, 15837, 29961, 4882, 29889, 978, 29962, 13, 4706, 565, 4660, 297, 6418, 29911, 2725, 1964, 29918, 1254, 29923, 7024, 322, 18139, 1275, 29871, 29900, 29901, 13, 9651, 396, 1192, 317, 8187, 29956, 29899, 1164, 16786, 29901, 1152, 8018, 18139, 29892, 21301, 29901, 443, 1688, 287, 4452, 29892, 2992, 29889, 13, 9651, 6773, 13, 13, 4706, 1024, 353, 4660, 29889, 978, 13, 4706, 565, 4660, 29889, 978, 1275, 376, 3364, 287, 1115, 13, 9651, 3229, 353, 715, 3631, 675, 29898, 20788, 29918, 1853, 29892, 18139, 29897, 13, 9651, 1024, 353, 318, 29908, 29995, 29879, 4502, 29908, 1273, 3229, 13, 4706, 760, 353, 318, 29908, 29995, 29881, 1273, 29879, 29908, 1273, 313, 2798, 29879, 29892, 1024, 29897, 13, 4706, 5633, 29889, 4397, 29898, 1595, 29897, 13, 1678, 736, 9162, 11393, 7122, 29898, 20895, 29897, 718, 6634, 29876, 29908, 13, 13, 13, 29937, 1192, 349, 1525, 7228, 19386, 29901, 13, 1753, 3402, 29918, 7727, 29906, 29898, 20788, 29918, 1853, 29892, 15837, 29892, 1095, 543, 29905, 29876, 29908, 1125, 13, 1678, 9995, 5809, 278, 15837, 1196, 363, 697, 3229, 1134, 29889, 13, 13, 1678, 6317, 775, 29899, 1271, 1057, 13, 13, 308, 29953, 21846, 313, 3364, 287, 29901, 29871, 29945, 29892, 5229, 29901, 29871, 29896, 29892, 14993, 2986, 29901, 29871, 29900, 29892, 443, 1688, 287, 29901, 29871, 29900, 29897, 13, 13, 1678, 584, 3207, 3229, 29918, 1853, 29901, 13, 1678, 584, 3207, 15837, 29901, 13, 1678, 584, 2457, 29901, 13, 1678, 9995, 13, 1678, 5633, 353, 5159, 13, 1678, 363, 4660, 297, 6850, 1299, 3308, 29918, 22364, 29901, 13, 4706, 565, 4660, 29889, 978, 451, 297, 15837, 29901, 13, 9651, 6773, 13, 4706, 18139, 353, 15837, 29961, 4882, 29889, 978, 29962, 13, 4706, 565, 4660, 297, 6418, 29911, 2725, 1964, 29918, 1254, 29923, 7024, 322, 18139, 1275, 29871, 29900, 29901, 13, 9651, 396, 1192, 317, 8187, 29956, 29899, 1164, 16786, 29901, 1152, 8018, 18139, 29892, 21301, 29901, 443, 1688, 287, 4452, 29892, 2992, 29889, 13, 9651, 6773, 13, 4706, 5633, 29889, 4397, 3552, 4882, 29889, 978, 29892, 18139, 876, 13, 13, 1678, 18139, 29918, 2083, 353, 15837, 3366, 497, 3108, 13, 1678, 3229, 353, 715, 3631, 675, 29898, 20788, 29918, 1853, 29892, 2533, 29897, 13, 1678, 5633, 29918, 726, 353, 9162, 11393, 7122, 29898, 3366, 29912, 29900, 6177, 426, 29896, 29913, 1642, 4830, 29898, 978, 29892, 995, 29897, 13, 462, 9651, 363, 1024, 29892, 995, 297, 5633, 2314, 13, 1678, 736, 29850, 2798, 29901, 29946, 29913, 426, 20788, 29901, 29966, 29929, 29913, 21313, 20895, 1800, 29912, 355, 29913, 1642, 4830, 29898, 13, 4706, 2302, 29922, 2798, 29879, 29918, 2083, 29892, 3229, 29922, 20788, 29892, 5633, 29922, 20895, 29918, 726, 29892, 1095, 29922, 355, 29897, 13, 13, 13, 29937, 448, 2683, 2683, 2683, 2683, 28400, 13, 29937, 5195, 29925, 1955, 4945, 29903, 29901, 13, 29937, 448, 2683, 2683, 2683, 2683, 28400, 13, 1990, 6991, 5219, 5612, 9555, 29898, 5612, 9555, 1125, 13, 1678, 1510, 29918, 26061, 29918, 1557, 264, 8596, 353, 5852, 13, 1678, 1962, 29918, 5461, 29918, 978, 353, 376, 25393, 29908, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 2295, 1125, 13, 4706, 2428, 29898, 26289, 5612, 9555, 29892, 1583, 467, 1649, 2344, 12035, 2917, 29897, 13, 4706, 4840, 353, 679, 5552, 29898, 9675, 29892, 1583, 29889, 4905, 29918, 5461, 29918, 978, 29892, 10876, 29889, 303, 20405, 29897, 13, 4706, 1583, 29889, 5461, 353, 13763, 11746, 759, 29889, 7469, 29918, 5461, 29918, 2541, 29918, 3977, 6119, 29898, 5461, 29897, 13, 4706, 15837, 29918, 9171, 29918, 1272, 353, 426, 13, 9651, 376, 497, 1115, 29871, 29900, 29892, 13, 9651, 16034, 29889, 3364, 287, 29889, 978, 29901, 29871, 29900, 29892, 13, 9651, 16034, 29889, 26061, 29889, 978, 29901, 29871, 29900, 29892, 13, 9651, 16034, 29889, 2574, 2986, 29889, 978, 29901, 29871, 29900, 29892, 13, 9651, 16034, 29889, 1657, 2868, 29889, 978, 29901, 29871, 29900, 13, 4706, 500, 13, 4706, 1583, 29889, 14394, 29918, 7727, 353, 15837, 29918, 9171, 29918, 1272, 29889, 8552, 580, 13, 4706, 1583, 29889, 7491, 29918, 7727, 353, 15837, 29918, 9171, 29918, 1272, 29889, 8552, 580, 13, 4706, 1583, 29889, 1557, 24893, 29918, 7727, 353, 15837, 29918, 9171, 29918, 1272, 29889, 8552, 580, 13, 4706, 1583, 29889, 10568, 29918, 7727, 353, 426, 5709, 29889, 15955, 29889, 978, 29901, 29871, 29900, 29913, 13, 4706, 1583, 29889, 10568, 29918, 7727, 29889, 5504, 29898, 7727, 29918, 9171, 29918, 1272, 29897, 13, 4706, 1583, 29889, 19708, 353, 29871, 29900, 29889, 29900, 13, 4706, 1583, 29889, 3389, 29918, 2962, 2230, 353, 29871, 29900, 13, 4706, 1583, 29889, 3389, 29918, 355, 2230, 353, 29871, 29900, 13, 4706, 1583, 29889, 26061, 29918, 1557, 264, 8596, 353, 5159, 13, 4706, 1583, 29889, 4294, 29918, 19238, 353, 5852, 13, 13, 1678, 822, 1243, 3389, 29918, 2962, 287, 29898, 1311, 29892, 14334, 29922, 8516, 1125, 13, 4706, 565, 14334, 338, 6213, 29901, 13, 9651, 14334, 353, 931, 29918, 3707, 580, 13, 4706, 1583, 29889, 3389, 29918, 2962, 2230, 353, 14334, 13, 13, 1678, 822, 1243, 3389, 29918, 4951, 3276, 29898, 1311, 29892, 14334, 29922, 8516, 1125, 13, 4706, 565, 14334, 338, 6213, 29901, 13, 9651, 14334, 353, 931, 29918, 3707, 580, 13, 4706, 1583, 29889, 3389, 29918, 355, 2230, 353, 14334, 13, 13, 1678, 822, 1596, 29918, 14057, 292, 29918, 1557, 264, 8596, 29898, 1311, 29892, 4840, 29922, 8516, 1125, 13, 4706, 565, 4840, 338, 6213, 29901, 13, 9651, 4840, 353, 1583, 29889, 5461, 13, 13, 4706, 4840, 29889, 3539, 14182, 29876, 16243, 292, 21846, 3583, 29876, 1159, 13, 4706, 363, 10483, 297, 1583, 29889, 26061, 29918, 1557, 264, 8596, 29901, 13, 9651, 396, 788, 278, 1051, 310, 8282, 9686, 835, 29899, 2277, 29937, 577, 591, 674, 1510, 278, 2228, 15882, 411, 278, 1059, 438, 4162, 29899, 29896, 29906, 29941, 29946, 13, 9651, 4840, 29889, 3539, 29898, 29884, 29908, 29871, 1273, 29879, 1273, 29879, 29871, 1273, 29879, 29905, 29876, 29908, 1273, 313, 742, 15300, 7122, 29898, 29873, 363, 260, 297, 10483, 29889, 11338, 565, 7431, 29898, 29873, 29889, 5451, 877, 29899, 8785, 1360, 29906, 10353, 10483, 29889, 5479, 29892, 10483, 29889, 978, 876, 13, 13, 1678, 822, 10272, 29918, 7727, 29918, 2083, 29879, 29898, 1311, 1125, 13, 4706, 9995, 29898, 1123, 29897, 20606, 29872, 15837, 2533, 310, 599, 18139, 313, 19499, 29901, 599, 467, 15945, 29908, 13, 4706, 19138, 583, 353, 518, 13, 9651, 1583, 29889, 14394, 29918, 7727, 29892, 13, 9651, 1583, 29889, 7491, 29918, 7727, 29892, 13, 9651, 1583, 29889, 1557, 24893, 29918, 7727, 29892, 13, 9651, 1583, 29889, 10568, 29918, 7727, 13, 4706, 4514, 13, 4706, 363, 15837, 297, 19138, 583, 29901, 13, 9651, 15837, 3366, 497, 3108, 353, 10272, 29918, 7727, 29918, 2083, 29898, 7727, 29897, 13, 13, 1678, 822, 1596, 29918, 7727, 29898, 1311, 29892, 4840, 29922, 8516, 29892, 411, 29918, 19708, 29922, 5574, 1125, 13, 4706, 565, 4840, 338, 6213, 29901, 13, 9651, 4840, 353, 1583, 29889, 5461, 13, 13, 4706, 1583, 29889, 26017, 29918, 7727, 29918, 2083, 29879, 580, 13, 4706, 756, 29918, 19238, 353, 313, 1311, 29889, 7491, 29918, 7727, 3366, 497, 3108, 1405, 29871, 29900, 29897, 13, 13, 4706, 4840, 29889, 3539, 29898, 4830, 29918, 7727, 703, 14394, 613, 1583, 29889, 14394, 29918, 7727, 876, 13, 4706, 565, 1583, 29889, 4294, 29918, 19238, 322, 756, 29918, 19238, 29901, 13, 9651, 396, 1192, 379, 10192, 29901, 7704, 871, 6865, 29892, 565, 738, 4864, 29889, 13, 9651, 1583, 29889, 5461, 29889, 3539, 29898, 4830, 29918, 7727, 703, 7491, 613, 1583, 29889, 7491, 29918, 7727, 876, 13, 4706, 4840, 29889, 3539, 29898, 4830, 29918, 7727, 703, 1557, 24893, 613, 1583, 29889, 1557, 24893, 29918, 7727, 876, 13, 4706, 4840, 29889, 3539, 29898, 4830, 29918, 7727, 703, 10568, 613, 1583, 29889, 10568, 29918, 7727, 876, 13, 13, 4706, 396, 1192, 360, 4574, 8098, 29901, 13, 4706, 565, 411, 29918, 19708, 29901, 13, 9651, 5335, 886, 353, 313, 524, 29898, 1311, 29889, 19708, 847, 29871, 29953, 29900, 29889, 29900, 511, 1583, 29889, 19708, 1273, 29871, 29953, 29900, 29897, 13, 9651, 4840, 29889, 3539, 877, 1762, 554, 1273, 18933, 29995, 29900, 29906, 29889, 29941, 5847, 29905, 29876, 29915, 1273, 5335, 886, 29897, 13, 13, 1678, 396, 1192, 5195, 29925, 1955, 4945, 29899, 8787, 29901, 13, 1678, 822, 4682, 29898, 1311, 29892, 4682, 1125, 13, 4706, 565, 1583, 29889, 3389, 29918, 2962, 2230, 1275, 29871, 29900, 29901, 13, 9651, 396, 1192, 28657, 3217, 5348, 29901, 17067, 1254, 29899, 29934, 3904, 4687, 29889, 13, 9651, 1583, 29889, 1688, 3389, 29918, 2962, 287, 580, 13, 13, 4706, 1583, 29889, 5014, 29918, 14394, 29898, 14394, 29897, 13, 13, 1678, 822, 1095, 29898, 1311, 1125, 13, 4706, 1583, 29889, 1688, 3389, 29918, 4951, 3276, 580, 13, 13, 4706, 396, 1192, 317, 8187, 29956, 13515, 29902, 20566, 12314, 1430, 1718, 25925, 313, 25253, 1125, 13, 4706, 565, 1583, 29889, 4294, 29918, 26061, 29918, 1557, 264, 8596, 322, 1583, 29889, 26061, 29918, 1557, 264, 8596, 29901, 13, 9651, 1583, 29889, 2158, 29918, 14057, 292, 29918, 1557, 264, 8596, 580, 13, 9651, 1583, 29889, 5461, 29889, 3539, 14182, 29876, 1159, 13, 13, 4706, 396, 1192, 317, 8187, 29956, 22753, 1529, 13207, 4810, 3904, 9375, 29901, 13, 4706, 1583, 29889, 2158, 29918, 7727, 580, 13, 13, 1678, 822, 1889, 29918, 3389, 29918, 7076, 29918, 1454, 29898, 1311, 29892, 3847, 1125, 13, 4706, 363, 1065, 29918, 667, 297, 3847, 29901, 13, 9651, 565, 338, 8758, 29898, 3389, 29918, 667, 29892, 27308, 1125, 13, 18884, 1583, 29889, 5014, 29918, 7491, 29898, 3389, 29918, 667, 29897, 13, 9651, 25342, 338, 8758, 29898, 3389, 29918, 667, 29892, 2522, 24893, 3744, 1220, 1125, 13, 18884, 1583, 29889, 5014, 29918, 1557, 24893, 29918, 449, 1220, 29898, 3389, 29918, 667, 29897, 13, 9651, 1683, 29901, 13, 18884, 396, 4974, 338, 8758, 29898, 3389, 29918, 667, 29892, 2522, 24893, 29897, 13, 18884, 1583, 29889, 5014, 29918, 1557, 24893, 29898, 3389, 29918, 667, 29897, 13, 13, 1678, 822, 1889, 29918, 14394, 29898, 1311, 29892, 4682, 1125, 13, 4706, 1583, 29889, 19708, 4619, 4682, 29889, 19708, 13, 4706, 1583, 29889, 14394, 29918, 7727, 29961, 14394, 29889, 4882, 29889, 978, 29962, 4619, 29871, 29896, 13, 4706, 1583, 29889, 5014, 29918, 3389, 29918, 7076, 29918, 1454, 29898, 14394, 29897, 13, 13, 1678, 822, 1889, 29918, 7491, 29898, 1311, 29892, 5751, 1125, 13, 4706, 1583, 29889, 7491, 29918, 7727, 29961, 7491, 29889, 4882, 29889, 978, 29962, 4619, 29871, 29896, 13, 4706, 1583, 29889, 5014, 29918, 3389, 29918, 7076, 29918, 1454, 29898, 7491, 29897, 13, 13, 1678, 822, 1889, 29918, 1557, 24893, 29898, 1311, 29892, 10483, 1125, 13, 4706, 565, 10483, 29889, 4882, 1275, 16034, 29889, 26061, 29901, 13, 9651, 1583, 29889, 26061, 29918, 1557, 264, 8596, 29889, 4397, 29898, 1557, 24893, 29897, 13, 13, 4706, 1583, 29889, 1557, 24893, 29918, 7727, 29961, 1557, 24893, 29889, 4882, 29889, 978, 29962, 4619, 29871, 29896, 13, 4706, 363, 4331, 297, 10483, 29901, 13, 9651, 1583, 29889, 10568, 29918, 7727, 29961, 10568, 29889, 4882, 29889, 978, 29962, 4619, 29871, 29896, 13, 13, 1678, 822, 1889, 29918, 1557, 24893, 29918, 449, 1220, 29898, 1311, 29892, 10483, 29918, 449, 1220, 1125, 13, 4706, 363, 10483, 297, 10483, 29918, 449, 1220, 29889, 1557, 264, 8596, 29901, 13, 9651, 1583, 29889, 5014, 29918, 1557, 24893, 29898, 1557, 24893, 29897, 13, 2 ]
utils/crop_image.py
Mhaiyang/iccv
2
47300
""" @Time : 203/21/19 17:11 @Author : TaylorMei @Email : <EMAIL> @Project : iccv @File : crop_image.py @Function: """ import os import numpy as np import skimage.io input_path = '/media/iccd/TAYLORMEI/depth/image' output_path = '/media/iccd/TAYLORMEI/depth/crop' if not os.path.exists(output_path): os.mkdir(output_path) imglist = os.listdir(input_path) for i, imgname in enumerate(imglist): print(i, imgname) image = skimage.io.imread(os.path.join(input_path, imgname)) print(np.sum(image[80, :, :])) for j in range(640): if np.sum(image[j, :, :]) !=0 and np.sum(image[j, :, :]) !=367200: print(j) break # crop = image[80:560, :, :] # skimage.io.imsave(os.path.join(output_path, imgname), crop)
[ 1, 9995, 13, 732, 2481, 1678, 584, 29871, 29906, 29900, 29941, 29914, 29906, 29896, 29914, 29896, 29929, 29871, 29896, 29955, 29901, 29896, 29896, 13, 732, 13720, 29871, 584, 12537, 6816, 29875, 13, 732, 9823, 259, 584, 529, 26862, 6227, 29958, 13, 29871, 13, 732, 7653, 584, 16077, 11023, 13, 732, 2283, 1678, 584, 274, 1336, 29918, 3027, 29889, 2272, 13, 732, 6678, 29901, 13, 29871, 13, 15945, 29908, 13, 5215, 2897, 13, 5215, 12655, 408, 7442, 13, 5215, 2071, 3027, 29889, 601, 13, 13, 2080, 29918, 2084, 353, 8207, 9799, 29914, 293, 2252, 29914, 6040, 29979, 29931, 1955, 2303, 29902, 29914, 19488, 29914, 3027, 29915, 13, 4905, 29918, 2084, 353, 8207, 9799, 29914, 293, 2252, 29914, 6040, 29979, 29931, 1955, 2303, 29902, 29914, 19488, 29914, 29883, 1336, 29915, 13, 361, 451, 2897, 29889, 2084, 29889, 9933, 29898, 4905, 29918, 2084, 1125, 13, 1678, 2897, 29889, 11256, 3972, 29898, 4905, 29918, 2084, 29897, 13, 13, 2492, 1761, 353, 2897, 29889, 1761, 3972, 29898, 2080, 29918, 2084, 29897, 13, 1454, 474, 29892, 10153, 978, 297, 26985, 29898, 2492, 1761, 1125, 13, 1678, 1596, 29898, 29875, 29892, 10153, 978, 29897, 13, 1678, 1967, 353, 2071, 3027, 29889, 601, 29889, 326, 949, 29898, 359, 29889, 2084, 29889, 7122, 29898, 2080, 29918, 2084, 29892, 10153, 978, 876, 13, 1678, 1596, 29898, 9302, 29889, 2083, 29898, 3027, 29961, 29947, 29900, 29892, 584, 29892, 584, 12622, 13, 1678, 363, 432, 297, 3464, 29898, 29953, 29946, 29900, 1125, 13, 4706, 565, 7442, 29889, 2083, 29898, 3027, 29961, 29926, 29892, 584, 29892, 584, 2314, 2804, 29900, 322, 7442, 29889, 2083, 29898, 3027, 29961, 29926, 29892, 584, 29892, 584, 2314, 2804, 29941, 29953, 29955, 29906, 29900, 29900, 29901, 13, 9651, 1596, 29898, 29926, 29897, 13, 9651, 2867, 13, 1678, 396, 274, 1336, 353, 1967, 29961, 29947, 29900, 29901, 29945, 29953, 29900, 29892, 584, 29892, 584, 29962, 13, 1678, 396, 2071, 3027, 29889, 601, 29889, 326, 7620, 29898, 359, 29889, 2084, 29889, 7122, 29898, 4905, 29918, 2084, 29892, 10153, 978, 511, 274, 1336, 29897, 13, 13, 2 ]
entities/api_renderers.py
acdh-oeaw/daacda-go-digital
0
1615613
import json from rest_framework import renderers class GeoJsonRenderer(renderers.BaseRenderer): media_type = 'text/json' format = 'geojson' def render(self, data, media_type=None, renderer_context=None): geojson_start = """{"type": "FeatureCollection","features": """ geolist = [] for x in data: if x: geolist.append(x) else: pass geojson_end = "}" geolist = json.dumps(geolist) geojson = "{}{}{}".format(geojson_start, geolist, geojson_end) return geojson
[ 1, 1053, 4390, 13, 3166, 1791, 29918, 4468, 1053, 4050, 414, 13, 13, 13, 1990, 1879, 29877, 8148, 21323, 29898, 9482, 414, 29889, 5160, 21323, 1125, 13, 1678, 5745, 29918, 1853, 353, 525, 726, 29914, 3126, 29915, 13, 1678, 3402, 353, 525, 24756, 3126, 29915, 13, 13, 1678, 822, 4050, 29898, 1311, 29892, 848, 29892, 5745, 29918, 1853, 29922, 8516, 29892, 4050, 261, 29918, 4703, 29922, 8516, 1125, 13, 4706, 1737, 29877, 3126, 29918, 2962, 353, 9995, 6377, 1853, 1115, 376, 19132, 7196, 3284, 22100, 1115, 9995, 13, 4706, 1737, 324, 391, 353, 5159, 13, 4706, 363, 921, 297, 848, 29901, 13, 9651, 565, 921, 29901, 13, 18884, 1737, 324, 391, 29889, 4397, 29898, 29916, 29897, 13, 9651, 1683, 29901, 13, 18884, 1209, 13, 4706, 1737, 29877, 3126, 29918, 355, 353, 376, 5038, 13, 4706, 1737, 324, 391, 353, 4390, 29889, 29881, 17204, 29898, 479, 324, 391, 29897, 13, 4706, 1737, 29877, 3126, 353, 29850, 1157, 1157, 29913, 1642, 4830, 29898, 24756, 3126, 29918, 2962, 29892, 1737, 324, 391, 29892, 1737, 29877, 3126, 29918, 355, 29897, 13, 4706, 736, 1737, 29877, 3126, 13, 2 ]
networkforgat.py
LouGalata/MAGAT
3
71691
import torch import torch.nn as nn import torch.nn.functional as f import numpy as np from layers import GraphAttentionLayer def hidden_init(layer): fan_in = layer.weight.data.size()[0] lim = 1. / np.sqrt(fan_in) return (-lim, lim) class GAT(nn.Module): def __init__(self, nfeat, nhid, nclass, dropout, alpha, nheads): """Dense version of GAT.""" super(GAT, self).__init__() self.dropout = dropout self.attentions = [GraphAttentionLayer(nfeat, nhid, dropout=dropout, alpha=alpha, concat=True) for _ in range(nheads)] for i, attention in enumerate(self.attentions): self.add_module('attention_{}'.format(i), attention) self.out_att = GraphAttentionLayer(nhid * nheads, nclass, dropout=dropout, alpha=alpha, concat=False) def forward(self, x, adj): x = f.dropout(x, self.dropout, training=self.training) x = torch.cat([att(x, adj) for att in self.attentions], dim=-1) x = f.dropout(x, self.dropout, training=self.training) x = f.elu(self.out_att(x, adj)) return x # return F.log_softmax(x, dim=1) class CriticNetwork(nn.Module): def __init__(self, input_dim, hidden_gat_dim, hidden_in_dim, hidden_out_dim, output_dim, actor=False): super(CriticNetwork, self).__init__() """self.input_norm = nn.BatchNorm1d(input_dim) self.input_norm.weight.data.fill_(1) self.input_norm.bias.data.fill_(0)""" self.gat = GAT(nfeat=input_dim, nhid=hidden_gat_dim, nclass=input_dim, dropout=0.0, nheads=4, alpha=0.1) self.gat2 = GAT(nfeat=input_dim, nhid=hidden_gat_dim, nclass=input_dim, dropout=0.0, nheads=4, alpha=0.1) # dense_input_dim = input_dim * 5 * 2 # num_agents * res connections dense_input_dim = input_dim * 5 * 2 self.fc1 = nn.Linear(dense_input_dim, hidden_in_dim) self.fc2 = nn.Linear(hidden_in_dim, hidden_out_dim) self.fc3 = nn.Linear(hidden_out_dim, output_dim) # self.fc3 = nn.Linear(hidden_in_dim, output_dim) # self.nonlin = f.relu # leaky_relu self.nonlin = f.leaky_relu self.actor = actor # self.reset_parameters() def reset_parameters(self): self.gat.weight.data.uniform_(*hidden_init(self.gat)) self.gat2.weight.data.uniform_(*hidden_init(self.gat2)) self.fc1.weight.data.uniform_(*hidden_init(self.fc1)) self.fc2.weight.data.uniform_(*hidden_init(self.fc2)) self.fc3.weight.data.uniform_(-1e-3, 1e-3) def forward(self, x, adj): gat = self.gat(x, adj) gat = self.gat2(gat, adj) resgat = torch.cat((x, gat), dim=-1) # review flatten = torch.flatten(gat, start_dim=1) h1 = self.nonlin(self.fc1(flatten)) h2 = self.nonlin(self.fc2(h1)) h3 = (self.fc3(h2)) return h3 class ActorNetwork(nn.Module): def __init__(self, input_dim, hidden_in_dim, hidden_out_dim, output_dim, actor=False): super(ActorNetwork, self).__init__() """self.input_norm = nn.BatchNorm1d(input_dim) self.input_norm.weight.data.fill_(1) self.input_norm.bias.data.fill_(0)""" self.fc1 = nn.Linear(input_dim, hidden_in_dim) self.fc2 = nn.Linear(hidden_in_dim, hidden_out_dim) self.fc3 = nn.Linear(hidden_out_dim, output_dim) self.nonlin = f.relu # leaky_relu self.actor = actor # self.reset_parameters() def reset_parameters(self): self.fc1.weight.data.uniform_(*hidden_init(self.fc1)) self.fc2.weight.data.uniform_(*hidden_init(self.fc2)) self.fc3.weight.data.uniform_(-1e-3, 1e-3) def forward(self, x): # return a vector of the force h1 = self.nonlin(self.fc1(x)) h2 = self.nonlin(self.fc2(h1)) h3 = (self.fc3(h2)) norm = torch.norm(h3) # h3 is a 2D vector (a force that is applied to the agent) # we bound the norm of the vector to be between 0 and 10 # return 10.0*(torch.tanh(norm))*h3/norm if norm > 0 else 10*h3 return 1.0 * (torch.tanh(norm)) * h3 / norm if norm > 0 else 1 * h3
[ 1, 1053, 4842, 305, 13, 5215, 4842, 305, 29889, 15755, 408, 302, 29876, 13, 5215, 4842, 305, 29889, 15755, 29889, 2220, 284, 408, 285, 13, 5215, 12655, 408, 7442, 13, 3166, 15359, 1053, 12367, 4165, 2509, 14420, 13, 13, 13, 1753, 7934, 29918, 2344, 29898, 13148, 1125, 13, 1678, 13524, 29918, 262, 353, 7546, 29889, 7915, 29889, 1272, 29889, 2311, 580, 29961, 29900, 29962, 13, 1678, 2485, 353, 29871, 29896, 29889, 847, 7442, 29889, 3676, 29898, 12963, 29918, 262, 29897, 13, 1678, 736, 8521, 2576, 29892, 2485, 29897, 13, 13, 13, 1990, 402, 1299, 29898, 15755, 29889, 7355, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 302, 1725, 271, 29892, 302, 29882, 333, 29892, 302, 1990, 29892, 5768, 449, 29892, 15595, 29892, 302, 2813, 29879, 1125, 13, 4706, 9995, 29928, 1947, 1873, 310, 402, 1299, 1213, 15945, 13, 4706, 2428, 29898, 29954, 1299, 29892, 1583, 467, 1649, 2344, 1649, 580, 13, 4706, 1583, 29889, 8865, 449, 353, 5768, 449, 13, 13, 4706, 1583, 29889, 1131, 296, 1080, 353, 518, 9527, 4165, 2509, 14420, 29898, 29876, 1725, 271, 29892, 302, 29882, 333, 29892, 5768, 449, 29922, 8865, 449, 29892, 15595, 29922, 2312, 29892, 3022, 271, 29922, 5574, 29897, 363, 903, 297, 13, 462, 965, 3464, 29898, 29876, 2813, 29879, 4638, 13, 4706, 363, 474, 29892, 8570, 297, 26985, 29898, 1311, 29889, 1131, 296, 1080, 1125, 13, 9651, 1583, 29889, 1202, 29918, 5453, 877, 1131, 2509, 648, 29913, 4286, 4830, 29898, 29875, 511, 8570, 29897, 13, 13, 4706, 1583, 29889, 449, 29918, 1131, 353, 12367, 4165, 2509, 14420, 29898, 29876, 29882, 333, 334, 302, 2813, 29879, 29892, 302, 1990, 29892, 5768, 449, 29922, 8865, 449, 29892, 15595, 29922, 2312, 29892, 3022, 271, 29922, 8824, 29897, 13, 13, 1678, 822, 6375, 29898, 1311, 29892, 921, 29892, 12109, 1125, 13, 4706, 921, 353, 285, 29889, 8865, 449, 29898, 29916, 29892, 1583, 29889, 8865, 449, 29892, 6694, 29922, 1311, 29889, 26495, 29897, 13, 4706, 921, 353, 4842, 305, 29889, 4117, 4197, 1131, 29898, 29916, 29892, 12109, 29897, 363, 1098, 297, 1583, 29889, 1131, 296, 1080, 1402, 3964, 10457, 29896, 29897, 13, 4706, 921, 353, 285, 29889, 8865, 449, 29898, 29916, 29892, 1583, 29889, 8865, 449, 29892, 6694, 29922, 1311, 29889, 26495, 29897, 13, 4706, 921, 353, 285, 29889, 295, 29884, 29898, 1311, 29889, 449, 29918, 1131, 29898, 29916, 29892, 12109, 876, 13, 4706, 736, 921, 13, 4706, 396, 736, 383, 29889, 1188, 29918, 2695, 3317, 29898, 29916, 29892, 3964, 29922, 29896, 29897, 13, 13, 13, 1990, 15976, 293, 13724, 29898, 15755, 29889, 7355, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1881, 29918, 6229, 29892, 7934, 29918, 28818, 29918, 6229, 29892, 7934, 29918, 262, 29918, 6229, 29892, 7934, 29918, 449, 29918, 6229, 29892, 1962, 29918, 6229, 29892, 11339, 29922, 8824, 1125, 13, 4706, 2428, 29898, 29907, 768, 293, 13724, 29892, 1583, 467, 1649, 2344, 1649, 580, 13, 13, 4706, 9995, 1311, 29889, 2080, 29918, 12324, 353, 302, 29876, 29889, 23145, 29940, 555, 29896, 29881, 29898, 2080, 29918, 6229, 29897, 13, 4706, 1583, 29889, 2080, 29918, 12324, 29889, 7915, 29889, 1272, 29889, 5589, 23538, 29896, 29897, 13, 4706, 1583, 29889, 2080, 29918, 12324, 29889, 29890, 3173, 29889, 1272, 29889, 5589, 23538, 29900, 5513, 15945, 13, 4706, 1583, 29889, 28818, 353, 402, 1299, 29898, 29876, 1725, 271, 29922, 2080, 29918, 6229, 29892, 13, 462, 1678, 302, 29882, 333, 29922, 10892, 29918, 28818, 29918, 6229, 29892, 13, 462, 1678, 302, 1990, 29922, 2080, 29918, 6229, 29892, 13, 462, 1678, 5768, 449, 29922, 29900, 29889, 29900, 29892, 13, 462, 1678, 302, 2813, 29879, 29922, 29946, 29892, 13, 462, 1678, 15595, 29922, 29900, 29889, 29896, 29897, 13, 13, 4706, 1583, 29889, 28818, 29906, 353, 402, 1299, 29898, 29876, 1725, 271, 29922, 2080, 29918, 6229, 29892, 13, 462, 1678, 302, 29882, 333, 29922, 10892, 29918, 28818, 29918, 6229, 29892, 13, 462, 1678, 302, 1990, 29922, 2080, 29918, 6229, 29892, 13, 462, 1678, 5768, 449, 29922, 29900, 29889, 29900, 29892, 13, 462, 1678, 302, 2813, 29879, 29922, 29946, 29892, 13, 462, 1678, 15595, 29922, 29900, 29889, 29896, 29897, 13, 13, 4706, 396, 20619, 29918, 2080, 29918, 6229, 353, 1881, 29918, 6229, 334, 29871, 29945, 334, 29871, 29906, 396, 954, 29918, 351, 1237, 334, 620, 12368, 13, 4706, 20619, 29918, 2080, 29918, 6229, 353, 1881, 29918, 6229, 334, 29871, 29945, 334, 29871, 29906, 13, 4706, 1583, 29889, 13801, 29896, 353, 302, 29876, 29889, 12697, 29898, 1145, 344, 29918, 2080, 29918, 6229, 29892, 7934, 29918, 262, 29918, 6229, 29897, 13, 4706, 1583, 29889, 13801, 29906, 353, 302, 29876, 29889, 12697, 29898, 10892, 29918, 262, 29918, 6229, 29892, 7934, 29918, 449, 29918, 6229, 29897, 13, 4706, 1583, 29889, 13801, 29941, 353, 302, 29876, 29889, 12697, 29898, 10892, 29918, 449, 29918, 6229, 29892, 1962, 29918, 6229, 29897, 13, 4706, 396, 1583, 29889, 13801, 29941, 353, 302, 29876, 29889, 12697, 29898, 10892, 29918, 262, 29918, 6229, 29892, 1962, 29918, 6229, 29897, 13, 4706, 396, 1583, 29889, 5464, 1915, 353, 285, 29889, 2674, 29884, 29871, 396, 24993, 29891, 29918, 2674, 29884, 13, 4706, 1583, 29889, 5464, 1915, 353, 285, 29889, 280, 557, 29891, 29918, 2674, 29884, 13, 4706, 1583, 29889, 7168, 353, 11339, 13, 4706, 396, 1583, 29889, 12071, 29918, 16744, 580, 13, 13, 1678, 822, 10092, 29918, 16744, 29898, 1311, 1125, 13, 4706, 1583, 29889, 28818, 29889, 7915, 29889, 1272, 29889, 29590, 29918, 10456, 10892, 29918, 2344, 29898, 1311, 29889, 28818, 876, 13, 4706, 1583, 29889, 28818, 29906, 29889, 7915, 29889, 1272, 29889, 29590, 29918, 10456, 10892, 29918, 2344, 29898, 1311, 29889, 28818, 29906, 876, 13, 4706, 1583, 29889, 13801, 29896, 29889, 7915, 29889, 1272, 29889, 29590, 29918, 10456, 10892, 29918, 2344, 29898, 1311, 29889, 13801, 29896, 876, 13, 4706, 1583, 29889, 13801, 29906, 29889, 7915, 29889, 1272, 29889, 29590, 29918, 10456, 10892, 29918, 2344, 29898, 1311, 29889, 13801, 29906, 876, 13, 4706, 1583, 29889, 13801, 29941, 29889, 7915, 29889, 1272, 29889, 29590, 29918, 6278, 29896, 29872, 29899, 29941, 29892, 29871, 29896, 29872, 29899, 29941, 29897, 13, 13, 1678, 822, 6375, 29898, 1311, 29892, 921, 29892, 12109, 1125, 13, 4706, 26989, 353, 1583, 29889, 28818, 29898, 29916, 29892, 12109, 29897, 13, 4706, 26989, 353, 1583, 29889, 28818, 29906, 29898, 28818, 29892, 12109, 29897, 13, 4706, 620, 28818, 353, 4842, 305, 29889, 4117, 3552, 29916, 29892, 26989, 511, 3964, 10457, 29896, 29897, 29871, 396, 9076, 13, 4706, 1652, 8606, 353, 4842, 305, 29889, 1579, 8606, 29898, 28818, 29892, 1369, 29918, 6229, 29922, 29896, 29897, 13, 4706, 298, 29896, 353, 1583, 29889, 5464, 1915, 29898, 1311, 29889, 13801, 29896, 29898, 1579, 8606, 876, 13, 4706, 298, 29906, 353, 1583, 29889, 5464, 1915, 29898, 1311, 29889, 13801, 29906, 29898, 29882, 29896, 876, 13, 4706, 298, 29941, 353, 313, 1311, 29889, 13801, 29941, 29898, 29882, 29906, 876, 13, 4706, 736, 298, 29941, 13, 13, 13, 1990, 319, 2801, 13724, 29898, 15755, 29889, 7355, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1881, 29918, 6229, 29892, 7934, 29918, 262, 29918, 6229, 29892, 7934, 29918, 449, 29918, 6229, 29892, 1962, 29918, 6229, 29892, 11339, 29922, 8824, 1125, 13, 4706, 2428, 29898, 29909, 2801, 13724, 29892, 1583, 467, 1649, 2344, 1649, 580, 13, 13, 4706, 9995, 1311, 29889, 2080, 29918, 12324, 353, 302, 29876, 29889, 23145, 29940, 555, 29896, 29881, 29898, 2080, 29918, 6229, 29897, 13, 4706, 1583, 29889, 2080, 29918, 12324, 29889, 7915, 29889, 1272, 29889, 5589, 23538, 29896, 29897, 13, 4706, 1583, 29889, 2080, 29918, 12324, 29889, 29890, 3173, 29889, 1272, 29889, 5589, 23538, 29900, 5513, 15945, 13, 13, 4706, 1583, 29889, 13801, 29896, 353, 302, 29876, 29889, 12697, 29898, 2080, 29918, 6229, 29892, 7934, 29918, 262, 29918, 6229, 29897, 13, 4706, 1583, 29889, 13801, 29906, 353, 302, 29876, 29889, 12697, 29898, 10892, 29918, 262, 29918, 6229, 29892, 7934, 29918, 449, 29918, 6229, 29897, 13, 4706, 1583, 29889, 13801, 29941, 353, 302, 29876, 29889, 12697, 29898, 10892, 29918, 449, 29918, 6229, 29892, 1962, 29918, 6229, 29897, 13, 4706, 1583, 29889, 5464, 1915, 353, 285, 29889, 2674, 29884, 29871, 396, 24993, 29891, 29918, 2674, 29884, 13, 4706, 1583, 29889, 7168, 353, 11339, 13, 4706, 396, 1583, 29889, 12071, 29918, 16744, 580, 13, 13, 1678, 822, 10092, 29918, 16744, 29898, 1311, 1125, 13, 4706, 1583, 29889, 13801, 29896, 29889, 7915, 29889, 1272, 29889, 29590, 29918, 10456, 10892, 29918, 2344, 29898, 1311, 29889, 13801, 29896, 876, 13, 4706, 1583, 29889, 13801, 29906, 29889, 7915, 29889, 1272, 29889, 29590, 29918, 10456, 10892, 29918, 2344, 29898, 1311, 29889, 13801, 29906, 876, 13, 4706, 1583, 29889, 13801, 29941, 29889, 7915, 29889, 1272, 29889, 29590, 29918, 6278, 29896, 29872, 29899, 29941, 29892, 29871, 29896, 29872, 29899, 29941, 29897, 13, 13, 1678, 822, 6375, 29898, 1311, 29892, 921, 1125, 13, 4706, 396, 736, 263, 4608, 310, 278, 4889, 13, 4706, 298, 29896, 353, 1583, 29889, 5464, 1915, 29898, 1311, 29889, 13801, 29896, 29898, 29916, 876, 13, 4706, 298, 29906, 353, 1583, 29889, 5464, 1915, 29898, 1311, 29889, 13801, 29906, 29898, 29882, 29896, 876, 13, 4706, 298, 29941, 353, 313, 1311, 29889, 13801, 29941, 29898, 29882, 29906, 876, 13, 4706, 6056, 353, 4842, 305, 29889, 12324, 29898, 29882, 29941, 29897, 13, 13, 4706, 396, 298, 29941, 338, 263, 29871, 29906, 29928, 4608, 313, 29874, 4889, 393, 338, 7436, 304, 278, 10823, 29897, 13, 4706, 396, 591, 3216, 278, 6056, 310, 278, 4608, 304, 367, 1546, 29871, 29900, 322, 29871, 29896, 29900, 13, 4706, 396, 736, 29871, 29896, 29900, 29889, 29900, 16395, 7345, 305, 29889, 13161, 29882, 29898, 12324, 876, 29930, 29882, 29941, 29914, 12324, 565, 6056, 1405, 29871, 29900, 1683, 29871, 29896, 29900, 29930, 29882, 29941, 13, 4706, 736, 29871, 29896, 29889, 29900, 334, 313, 7345, 305, 29889, 13161, 29882, 29898, 12324, 876, 334, 298, 29941, 847, 6056, 565, 6056, 1405, 29871, 29900, 1683, 29871, 29896, 334, 298, 29941, 13, 2 ]
lib/event.py
PaulMndn/Fenrir-Discord-Bot
1
190444
<reponame>PaulMndn/Fenrir-Discord-Bot import discord import datetime as dt class Event: def __init__(self, title: str, date_time: dt.datetime, event_channel_id: int, msg_id: int = None): self.title = title self.date_time = date_time self.event_channel_id = event_channel_id self.msg_id = msg_id def __str__(self): return f"**{self.title}** {self.date_time.strftime('%d.%m.%Y at %I:%M%p')}" def __lt__(self, other): if isinstance(other, Event): return self.date_time < other.date_time elif isinstance(other, dt.datetime): return self.date_time < other elif isinstance(other, dt.date): return self.date_time.date() < other else: raise NotImplementedError(f"Can't compare type '{type(self)}'v to type '{type(other)}'.") def __le__(self, other): if isinstance(other, Event): return self.date_time <= other.date_time elif isinstance(other, dt.datetime): return self.date_time <= other elif isinstance(other, dt.date): return self.date_time.date() <= other else: raise NotImplementedError(f"Can't compare type '{type(self)}' to type '{type(other)}'.") def __ge__(self, other): if isinstance(other, Event): return self.date_time >= other.date_time elif isinstance(other, dt.datetime): return self.date_time >= other elif isinstance(other, dt.date): return self.date_time.date() >= other else: raise NotImplementedError(f"Can't compare type '{type(self)}' to type '{type(other)}'.") def __eq__(self, other): if isinstance(other, Event): return self.date_time == other.date_time elif isinstance(other, dt.datetime): return self.date_time == other elif isinstance(other, dt.date): return self.date_time.date() == other else: raise NotImplementedError(f"Can't compare type '{type(self)}' to type '{type(other)}'.") @property def key(self): '''Message ID if it exists. Otherwise the datetime in iso-format.''' return str(self.msg_id) if self.msg_id is not None else self.date_time.isoformat() if __name__ == "__main__": pass
[ 1, 529, 276, 1112, 420, 29958, 18275, 29924, 299, 29876, 29914, 29943, 264, 12416, 29899, 4205, 16090, 29899, 29933, 327, 13, 5215, 2313, 536, 13, 5215, 12865, 408, 11636, 13, 13, 13, 1990, 6864, 29901, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 3611, 29901, 851, 29892, 2635, 29918, 2230, 29901, 11636, 29889, 12673, 29892, 1741, 29918, 12719, 29918, 333, 29901, 938, 29892, 10191, 29918, 333, 29901, 938, 353, 6213, 1125, 13, 4706, 1583, 29889, 3257, 353, 3611, 13, 4706, 1583, 29889, 1256, 29918, 2230, 353, 2635, 29918, 2230, 13, 4706, 1583, 29889, 3696, 29918, 12719, 29918, 333, 353, 1741, 29918, 12719, 29918, 333, 13, 4706, 1583, 29889, 7645, 29918, 333, 353, 10191, 29918, 333, 13, 268, 13, 1678, 822, 4770, 710, 12035, 1311, 1125, 13, 4706, 736, 285, 29908, 1068, 29912, 1311, 29889, 3257, 29913, 1068, 426, 1311, 29889, 1256, 29918, 2230, 29889, 710, 615, 603, 877, 29995, 29881, 29889, 29995, 29885, 29889, 29995, 29979, 472, 1273, 29902, 16664, 29924, 29995, 29886, 1495, 5038, 13, 268, 13, 1678, 822, 4770, 1896, 12035, 1311, 29892, 916, 1125, 13, 4706, 565, 338, 8758, 29898, 1228, 29892, 6864, 1125, 13, 9651, 736, 1583, 29889, 1256, 29918, 2230, 529, 916, 29889, 1256, 29918, 2230, 13, 4706, 25342, 338, 8758, 29898, 1228, 29892, 11636, 29889, 12673, 1125, 13, 9651, 736, 1583, 29889, 1256, 29918, 2230, 529, 916, 13, 4706, 25342, 338, 8758, 29898, 1228, 29892, 11636, 29889, 1256, 1125, 13, 9651, 736, 1583, 29889, 1256, 29918, 2230, 29889, 1256, 580, 529, 916, 13, 4706, 1683, 29901, 13, 9651, 12020, 2216, 1888, 2037, 287, 2392, 29898, 29888, 29908, 6028, 29915, 29873, 7252, 1134, 22372, 1853, 29898, 1311, 2915, 29915, 29894, 304, 1134, 22372, 1853, 29898, 1228, 2915, 4286, 1159, 13, 13, 1678, 822, 4770, 280, 12035, 1311, 29892, 916, 1125, 13, 4706, 565, 338, 8758, 29898, 1228, 29892, 6864, 1125, 13, 9651, 736, 1583, 29889, 1256, 29918, 2230, 5277, 916, 29889, 1256, 29918, 2230, 13, 4706, 25342, 338, 8758, 29898, 1228, 29892, 11636, 29889, 12673, 1125, 13, 9651, 736, 1583, 29889, 1256, 29918, 2230, 5277, 916, 13, 4706, 25342, 338, 8758, 29898, 1228, 29892, 11636, 29889, 1256, 1125, 13, 9651, 736, 1583, 29889, 1256, 29918, 2230, 29889, 1256, 580, 5277, 916, 13, 4706, 1683, 29901, 13, 9651, 12020, 2216, 1888, 2037, 287, 2392, 29898, 29888, 29908, 6028, 29915, 29873, 7252, 1134, 22372, 1853, 29898, 1311, 2915, 29915, 304, 1134, 22372, 1853, 29898, 1228, 2915, 4286, 1159, 13, 268, 13, 1678, 822, 4770, 479, 12035, 1311, 29892, 916, 1125, 13, 4706, 565, 338, 8758, 29898, 1228, 29892, 6864, 1125, 13, 9651, 736, 1583, 29889, 1256, 29918, 2230, 6736, 916, 29889, 1256, 29918, 2230, 13, 4706, 25342, 338, 8758, 29898, 1228, 29892, 11636, 29889, 12673, 1125, 13, 9651, 736, 1583, 29889, 1256, 29918, 2230, 6736, 916, 13, 4706, 25342, 338, 8758, 29898, 1228, 29892, 11636, 29889, 1256, 1125, 13, 9651, 736, 1583, 29889, 1256, 29918, 2230, 29889, 1256, 580, 6736, 916, 13, 4706, 1683, 29901, 13, 9651, 12020, 2216, 1888, 2037, 287, 2392, 29898, 29888, 29908, 6028, 29915, 29873, 7252, 1134, 22372, 1853, 29898, 1311, 2915, 29915, 304, 1134, 22372, 1853, 29898, 1228, 2915, 4286, 1159, 13, 268, 13, 1678, 822, 4770, 1837, 12035, 1311, 29892, 916, 1125, 13, 4706, 565, 338, 8758, 29898, 1228, 29892, 6864, 1125, 13, 9651, 736, 1583, 29889, 1256, 29918, 2230, 1275, 916, 29889, 1256, 29918, 2230, 13, 4706, 25342, 338, 8758, 29898, 1228, 29892, 11636, 29889, 12673, 1125, 13, 9651, 736, 1583, 29889, 1256, 29918, 2230, 1275, 916, 13, 4706, 25342, 338, 8758, 29898, 1228, 29892, 11636, 29889, 1256, 1125, 13, 9651, 736, 1583, 29889, 1256, 29918, 2230, 29889, 1256, 580, 1275, 916, 13, 4706, 1683, 29901, 13, 9651, 12020, 2216, 1888, 2037, 287, 2392, 29898, 29888, 29908, 6028, 29915, 29873, 7252, 1134, 22372, 1853, 29898, 1311, 2915, 29915, 304, 1134, 22372, 1853, 29898, 1228, 2915, 4286, 1159, 13, 268, 13, 1678, 732, 6799, 13, 1678, 822, 1820, 29898, 1311, 1125, 13, 4706, 14550, 3728, 3553, 565, 372, 4864, 29889, 13466, 278, 12865, 297, 338, 29877, 29899, 4830, 29889, 12008, 13, 4706, 736, 851, 29898, 1311, 29889, 7645, 29918, 333, 29897, 565, 1583, 29889, 7645, 29918, 333, 338, 451, 6213, 1683, 1583, 29889, 1256, 29918, 2230, 29889, 10718, 4830, 580, 13, 13, 13, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 1209, 2 ]
exercises_and_metrics_types/MetricSingleInputWidget.py
noooway/exj
1
59756
from kivy.app import App from kivy.uix.boxlayout import BoxLayout from kivy.uix.gridlayout import GridLayout from kivy.uix.button import Button from kivy.uix.label import Label from kivy.uix.textinput import TextInput from MetricSingle import * class MetricSingleInputWidget( GridLayout ): def __init__( self, metric_single, current_training_screen, **kwargs ): super( MetricSingleInputWidget, self ).__init__( **kwargs ) self.cols = 1 self.spacing = 1 self.row_default_height = 40 self.row_force_default = True self.size_hint_y = None self.bind( minimum_height = self.setter('height') ) self.metric_name = metric_single.description['name'] input_layout = BoxLayout( orientation = 'horizontal', spacing = 30 ) metric_label = Label( text = self.metric_name ) input_layout.add_widget( metric_label ) self.value_input = TextInput( hint_text = str( metric_single.description['value'] ) ) self.value_input.bind( text = current_training_screen.update_training_from_user_input) input_layout.add_widget( self.value_input ) del_metric_btn = Button( text = "Del Metr", size_hint_x = 0.3 ) del_metric_btn.on_press = \ lambda: current_training_screen.remove_exercise( self ) input_layout.add_widget( del_metric_btn ) self.add_widget( input_layout ) comment_text = metric_single.description.get( 'comment', 'Comment Metric') self.comment = TextInput( hint_text = comment_text ) self.comment.bind( text = current_training_screen.update_training_from_user_input) self.add_widget( self.comment ) def exercise_from_user_input( self ): # todo: add input check value_input = self.value_input.text comment = self.comment.text metric = MetricSingle( name = self.metric_name, value = value_input, description_dict = { 'comment': comment } ) return( metric )
[ 1, 515, 413, 440, 29891, 29889, 932, 1053, 2401, 13, 3166, 413, 440, 29891, 29889, 29884, 861, 29889, 1884, 2680, 1053, 11773, 3453, 13, 3166, 413, 440, 29891, 29889, 29884, 861, 29889, 7720, 2680, 1053, 11657, 3453, 13, 3166, 413, 440, 29891, 29889, 29884, 861, 29889, 3092, 1053, 11025, 13, 3166, 413, 440, 29891, 29889, 29884, 861, 29889, 1643, 1053, 15796, 13, 3166, 413, 440, 29891, 29889, 29884, 861, 29889, 726, 2080, 1053, 3992, 4290, 13, 13, 3166, 4737, 2200, 15771, 1053, 334, 13, 13, 1990, 4737, 2200, 15771, 4290, 8801, 29898, 11657, 3453, 29871, 1125, 13, 1678, 822, 4770, 2344, 12035, 1583, 29892, 12714, 29918, 14369, 29892, 13, 462, 29871, 1857, 29918, 26495, 29918, 10525, 29892, 3579, 19290, 29871, 1125, 13, 4706, 2428, 29898, 4737, 2200, 15771, 4290, 8801, 29892, 1583, 13742, 1649, 2344, 12035, 3579, 19290, 1723, 13, 4706, 1583, 29889, 22724, 353, 29871, 29896, 13, 4706, 1583, 29889, 1028, 9390, 353, 29871, 29896, 13, 4706, 1583, 29889, 798, 29918, 4381, 29918, 3545, 353, 29871, 29946, 29900, 13, 4706, 1583, 29889, 798, 29918, 10118, 29918, 4381, 353, 5852, 13, 4706, 1583, 29889, 2311, 29918, 29882, 524, 29918, 29891, 353, 6213, 13, 4706, 1583, 29889, 5355, 29898, 9212, 29918, 3545, 353, 1583, 29889, 842, 357, 877, 3545, 1495, 1723, 13, 4706, 1583, 29889, 16414, 29918, 978, 353, 12714, 29918, 14369, 29889, 8216, 1839, 978, 2033, 13, 4706, 1881, 29918, 2680, 353, 11773, 3453, 29898, 19843, 353, 525, 22672, 742, 13, 462, 462, 29871, 29250, 353, 29871, 29941, 29900, 1723, 13, 4706, 12714, 29918, 1643, 353, 15796, 29898, 1426, 353, 1583, 29889, 16414, 29918, 978, 1723, 13, 4706, 1881, 29918, 2680, 29889, 1202, 29918, 8030, 29898, 12714, 29918, 1643, 1723, 13, 4706, 1583, 29889, 1767, 29918, 2080, 353, 3992, 4290, 29898, 13, 9651, 13182, 29918, 726, 353, 851, 29898, 12714, 29918, 14369, 29889, 8216, 1839, 1767, 2033, 1723, 1723, 13, 4706, 1583, 29889, 1767, 29918, 2080, 29889, 5355, 29898, 13, 9651, 1426, 353, 1857, 29918, 26495, 29918, 10525, 29889, 5504, 29918, 26495, 29918, 3166, 29918, 1792, 29918, 2080, 29897, 13, 4706, 1881, 29918, 2680, 29889, 1202, 29918, 8030, 29898, 1583, 29889, 1767, 29918, 2080, 1723, 13, 4706, 628, 29918, 16414, 29918, 7290, 353, 11025, 29898, 1426, 353, 376, 13157, 4737, 29878, 613, 2159, 29918, 29882, 524, 29918, 29916, 353, 29871, 29900, 29889, 29941, 1723, 13, 4706, 628, 29918, 16414, 29918, 7290, 29889, 265, 29918, 2139, 353, 320, 13, 9651, 14013, 29901, 1857, 29918, 26495, 29918, 10525, 29889, 5992, 29918, 735, 6269, 895, 29898, 1583, 1723, 13, 4706, 1881, 29918, 2680, 29889, 1202, 29918, 8030, 29898, 628, 29918, 16414, 29918, 7290, 1723, 13, 4706, 1583, 29889, 1202, 29918, 8030, 29898, 1881, 29918, 2680, 1723, 13, 4706, 3440, 29918, 726, 353, 12714, 29918, 14369, 29889, 8216, 29889, 657, 29898, 13, 18884, 525, 9342, 742, 525, 20001, 4737, 2200, 1495, 13, 4706, 1583, 29889, 9342, 353, 3992, 4290, 29898, 13182, 29918, 726, 353, 3440, 29918, 726, 1723, 13, 4706, 1583, 29889, 9342, 29889, 5355, 29898, 13, 9651, 1426, 353, 1857, 29918, 26495, 29918, 10525, 29889, 5504, 29918, 26495, 29918, 3166, 29918, 1792, 29918, 2080, 29897, 13, 4706, 1583, 29889, 1202, 29918, 8030, 29898, 1583, 29889, 9342, 1723, 13, 13, 1678, 822, 15058, 29918, 3166, 29918, 1792, 29918, 2080, 29898, 1583, 29871, 1125, 13, 4706, 396, 10481, 29901, 788, 1881, 1423, 13, 4706, 995, 29918, 2080, 353, 1583, 29889, 1767, 29918, 2080, 29889, 726, 13, 4706, 3440, 353, 1583, 29889, 9342, 29889, 726, 13, 4706, 12714, 353, 4737, 2200, 15771, 29898, 1024, 353, 1583, 29889, 16414, 29918, 978, 29892, 13, 462, 1669, 995, 353, 995, 29918, 2080, 29892, 13, 462, 1669, 6139, 29918, 8977, 353, 426, 525, 9342, 2396, 3440, 500, 1723, 13, 4706, 736, 29898, 12714, 1723, 13, 2 ]
bounce2.py
Yokohama-Miyazawa/bounce_games
4
27099
from tkinter import * import random import time class Widget(object): # 画面上で動く物の基本となるクラス def __init__(self, window, size, color, pos, speed=[0, 0]): self.window = window self.size = size self.color = color self.pos = pos self.speed = speed def acty(self): # インスタンスを動かす self.window.move(self.id, self.speed[0], self.speed[1]) def xturn(self): # 横軸の方向転換 self.speed[0] *= -1 def yturn(self): # 縦軸の方向転換 self.speed[1] *= -1 def current_speed(self): # 現在の速度 return self.speed class Ball(Widget): # Widgetを継承する、ボールのためのクラス def __init__(self, window, size, color, pos, speed): super().__init__(window, size, color, pos, speed) self.id = self.window.create_oval(self.pos[0], self.pos[1], self.pos[0]+self.size, self.pos[1]+self.size, fill=self.color) def current_place(self): # 今いる場所 return self.window.coords(self.id) def hit_check(self, obj): # 当たったかどうかのチェック own_pos = self.current_place() obj_pos = obj.current_place() own_center = (own_pos[0] + own_pos[2])/2 if (own_center > obj_pos[0] and own_center < obj_pos[2]) \ and (own_pos[1] <= obj_pos[3] and own_pos[3] >= obj_pos[1]): return 1 else: return 0 class Bar(Widget): # Widgetを継承する、長方形物体用のクラス def __init__(self, window, size, color, pos): super().__init__(window, size, color, pos) self.point = 0 self.id = self.window.create_rectangle(self.pos[0], self.pos[1], self.pos[0]+self.size[0], self.pos[1]+self.size[1], fill=self.color) def current_place(self): # 今いる場所 return self.window.coords(self.id) def current_point(self): # ☆現在の得点 return self.point def add_point(self, add=1): # ☆得点加算 self.point += add class Player_Racket(Bar): # Barを継承する、プレイヤーラケット用のクラス def __init__(self, window, size, color, pos, step=10): super().__init__(window, size, color, pos) self.step = step self.window.bind_all('<Key>', self.control) def control(self, event): # 操作設定 if event.keysym == "Right": self.speed = [self.step, 0] elif event.keysym == "Left": self.speed = [-self.step, 0] else: return self.acty() class COM_Racket(Bar): # ☆Barを継承する、COMラケット用のクラス def __init__(self, window, size, color, pos, step=10, count=10, distance=100): super().__init__(window, size, color, pos) self.step = step self.count_range = count self.counter = 0 self.distance = distance def control(self, obj): self.counter += 1 if self.counter == self.count_range: self.counter = 0 self.speed[0] = random.randrange(-self.step, self.step) if (obj.current_place()[0] - self.current_place()[0] >= self.distance and self.speed[0] < 0) \ or (self.current_place()[2] - obj.current_place()[2] >= self.distance and self.speed[0] > 0): self.xturn() self.acty() # ウィンドウの設定 tk = Tk() canvas_size = [500, 400] canvas = Canvas(tk, width=canvas_size[0], height=canvas_size[1]) tk.title("熱くなれよ!!!") canvas.pack() # ☆画面表示の設定 canvas.create_text(50, 150, text='COM', fill='green', font=('メイリオ', 20)) canvas.create_text(50, 250, text='YOU', fill='red', font=('メイリオ', 20)) canvas.create_text(50, 200, text='TIME', fill='purple', font=('メイリオ', 20)) enemy_score = canvas.create_text(130, 150, fill='green', font=('メイリオ', 20)) my_score = canvas.create_text(130, 250, fill='red', font=('メイリオ', 20)) play_time = canvas.create_text(130, 200, fill='purple', font=('メイリオ', 20)) def show_score(player_score, score): canvas.itemconfig(player_score, text=str(score)) def show_time(time_text, time_game): canvas.itemconfig(time_text, text=str(time_game)) # ☆試合の設定 finish_point = 3 # ボールとラケットの設定 ball_radius = 50 ball_start = [random.randrange(50, 400), random.randrange(50, 100)] ball_init_speed = [2.0, 2.0] bar_size = [100, 10] player_start = [200, 340] # ☆COMの設定 com_start = [200, 50] com_distance = 100 # ボールとラケットのインスタンス作成 ball = Ball(canvas, ball_radius, 'blue', ball_start, ball_init_speed) player_racket = Player_Racket(canvas, bar_size, 'red', pos=player_start) com_racket = COM_Racket(canvas, bar_size, 'green', pos=com_start, distance=com_distance) # ☆時刻設定 game_start = int(time.perf_counter()) game_time = game_start while True: ball.acty() # ボールを動かす ball_pos = ball.current_place() ball_speed = ball.current_speed() com_racket.control(ball) # ☆COMを動かす # ☆画面表示の更新 show_score(my_score, player_racket.current_point()) show_score(enemy_score, com_racket.current_point()) show_time(play_time, game_time-game_start) now_time = int(time.perf_counter()) if now_time - game_time >= 1: # ☆一秒経過したら時刻表示切り替え game_time = now_time if player_racket.current_point() >= finish_point: # ☆プレイヤーの勝利 judge_text = 'YOU WIN' judge_color = 'blue' break if com_racket.current_point() >= finish_point: # ☆COMの勝利 judge_text = 'YOU LOSE' judge_color = 'red' break if ball_pos[2] >= canvas_size[0] or ball_pos[0] <= 0: ball.xturn() if ball_pos[3] >= canvas_size[1]: # ☆COMの得点 com_racket.add_point() ball.yturn() if ball_pos[1] <= 0: # ☆プレイヤーの得点 player_racket.add_point() ball.yturn() if (ball.hit_check(player_racket) == 1 and ball_speed[1] > 0) \ or (ball.hit_check(com_racket) == 1 and ball_speed[1] < 0): ball.yturn() # ☆相手のラケットに当たった場合を追加 tk.update() time.sleep(0.01) # ☆結果発表 canvas.create_text(250, 200, text=judge_text, fill=judge_color, font=('メイリオ', 30)) tk.update() time.sleep(10)
[ 1, 515, 18883, 1639, 1053, 334, 13, 5215, 4036, 13, 5215, 931, 13, 13, 13, 1990, 27080, 29898, 3318, 1125, 29871, 396, 29871, 31046, 30806, 30429, 30499, 31124, 30568, 30834, 30199, 31359, 30346, 30364, 30371, 30332, 30305, 30281, 30255, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 3474, 29892, 2159, 29892, 2927, 29892, 926, 29892, 6210, 11759, 29900, 29892, 29871, 29900, 29962, 1125, 13, 4706, 1583, 29889, 7165, 353, 3474, 13, 4706, 1583, 29889, 2311, 353, 2159, 13, 4706, 1583, 29889, 2780, 353, 2927, 13, 4706, 1583, 29889, 1066, 353, 926, 13, 4706, 1583, 29889, 19322, 353, 6210, 13, 13, 1678, 822, 1044, 29891, 29898, 1311, 1125, 29871, 396, 29871, 30260, 30203, 30255, 30369, 30203, 30255, 30396, 31124, 30412, 30427, 13, 4706, 1583, 29889, 7165, 29889, 11631, 29898, 1311, 29889, 333, 29892, 1583, 29889, 19322, 29961, 29900, 1402, 1583, 29889, 19322, 29961, 29896, 2314, 13, 13, 1678, 822, 29871, 486, 595, 29898, 1311, 1125, 29871, 396, 29871, 233, 171, 173, 235, 190, 187, 30199, 30525, 31331, 235, 190, 165, 233, 146, 158, 13, 4706, 1583, 29889, 19322, 29961, 29900, 29962, 334, 29922, 448, 29896, 13, 13, 1678, 822, 343, 685, 29898, 1311, 1125, 29871, 396, 29871, 234, 187, 169, 235, 190, 187, 30199, 30525, 31331, 235, 190, 165, 233, 146, 158, 13, 4706, 1583, 29889, 19322, 29961, 29896, 29962, 334, 29922, 448, 29896, 13, 13, 1678, 822, 1857, 29918, 19322, 29898, 1311, 1125, 29871, 396, 29871, 31928, 30505, 30199, 31859, 30898, 13, 4706, 736, 1583, 29889, 19322, 13, 13, 13, 1990, 13402, 29898, 8801, 1125, 29871, 396, 27080, 30396, 234, 185, 156, 233, 140, 194, 30427, 30332, 30330, 31003, 30185, 30258, 30199, 30366, 30954, 30199, 30305, 30281, 30255, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 3474, 29892, 2159, 29892, 2927, 29892, 926, 29892, 6210, 1125, 13, 4706, 2428, 2141, 1649, 2344, 12035, 7165, 29892, 2159, 29892, 2927, 29892, 926, 29892, 6210, 29897, 13, 4706, 1583, 29889, 333, 353, 1583, 29889, 7165, 29889, 3258, 29918, 10611, 29898, 1311, 29889, 1066, 29961, 29900, 1402, 1583, 29889, 1066, 29961, 29896, 1402, 13, 462, 462, 3986, 1583, 29889, 1066, 29961, 29900, 10062, 1311, 29889, 2311, 29892, 13, 462, 462, 3986, 1583, 29889, 1066, 29961, 29896, 10062, 1311, 29889, 2311, 29892, 13, 462, 462, 3986, 5445, 29922, 1311, 29889, 2780, 29897, 13, 13, 1678, 822, 1857, 29918, 6689, 29898, 1311, 1125, 29871, 396, 29871, 31482, 30298, 30332, 31045, 30744, 13, 4706, 736, 1583, 29889, 7165, 29889, 1111, 4339, 29898, 1311, 29889, 333, 29897, 13, 13, 1678, 822, 7124, 29918, 3198, 29898, 1311, 29892, 5446, 1125, 29871, 396, 29871, 30948, 30366, 30665, 30366, 30412, 31250, 30465, 30412, 30199, 30656, 30887, 30317, 30305, 13, 4706, 1914, 29918, 1066, 353, 1583, 29889, 3784, 29918, 6689, 580, 13, 4706, 5446, 29918, 1066, 353, 5446, 29889, 3784, 29918, 6689, 580, 13, 4706, 1914, 29918, 5064, 353, 313, 776, 29918, 1066, 29961, 29900, 29962, 718, 1914, 29918, 1066, 29961, 29906, 2314, 29914, 29906, 13, 4706, 565, 313, 776, 29918, 5064, 1405, 5446, 29918, 1066, 29961, 29900, 29962, 322, 1914, 29918, 5064, 529, 5446, 29918, 1066, 29961, 29906, 2314, 320, 13, 18884, 322, 313, 776, 29918, 1066, 29961, 29896, 29962, 5277, 5446, 29918, 1066, 29961, 29941, 29962, 322, 1914, 29918, 1066, 29961, 29941, 29962, 6736, 5446, 29918, 1066, 29961, 29896, 29962, 1125, 13, 9651, 736, 29871, 29896, 13, 4706, 1683, 29901, 13, 9651, 736, 29871, 29900, 13, 13, 13, 1990, 2261, 29898, 8801, 1125, 29871, 396, 27080, 30396, 234, 185, 156, 233, 140, 194, 30427, 30332, 30330, 30899, 30525, 31305, 30834, 30988, 30406, 30199, 30305, 30281, 30255, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 3474, 29892, 2159, 29892, 2927, 29892, 926, 1125, 13, 4706, 2428, 2141, 1649, 2344, 12035, 7165, 29892, 2159, 29892, 2927, 29892, 926, 29897, 13, 4706, 1583, 29889, 3149, 353, 29871, 29900, 13, 4706, 1583, 29889, 333, 353, 1583, 29889, 7165, 29889, 3258, 29918, 1621, 2521, 29898, 1311, 29889, 1066, 29961, 29900, 1402, 1583, 29889, 1066, 29961, 29896, 1402, 13, 462, 462, 1669, 1583, 29889, 1066, 29961, 29900, 10062, 1311, 29889, 2311, 29961, 29900, 1402, 13, 462, 462, 1669, 1583, 29889, 1066, 29961, 29896, 10062, 1311, 29889, 2311, 29961, 29896, 1402, 13, 462, 462, 1669, 5445, 29922, 1311, 29889, 2780, 29897, 13, 13, 1678, 822, 1857, 29918, 6689, 29898, 1311, 1125, 29871, 396, 29871, 31482, 30298, 30332, 31045, 30744, 13, 4706, 736, 1583, 29889, 7165, 29889, 1111, 4339, 29898, 1311, 29889, 333, 29897, 13, 13, 1678, 822, 1857, 29918, 3149, 29898, 1311, 1125, 29871, 396, 29871, 31048, 31928, 30505, 30199, 31050, 30940, 13, 4706, 736, 1583, 29889, 3149, 13, 13, 1678, 822, 788, 29918, 3149, 29898, 1311, 29892, 788, 29922, 29896, 1125, 29871, 396, 29871, 31048, 31050, 30940, 30666, 31565, 13, 4706, 1583, 29889, 3149, 4619, 788, 13, 13, 13, 1990, 14574, 29918, 29934, 547, 300, 29898, 4297, 1125, 29871, 396, 2261, 30396, 234, 185, 156, 233, 140, 194, 30427, 30332, 30330, 30605, 30420, 30260, 31258, 30185, 30281, 30978, 30317, 30279, 30406, 30199, 30305, 30281, 30255, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 3474, 29892, 2159, 29892, 2927, 29892, 926, 29892, 4331, 29922, 29896, 29900, 1125, 13, 4706, 2428, 2141, 1649, 2344, 12035, 7165, 29892, 2159, 29892, 2927, 29892, 926, 29897, 13, 4706, 1583, 29889, 10568, 353, 4331, 13, 4706, 1583, 29889, 7165, 29889, 5355, 29918, 497, 877, 29966, 2558, 29958, 742, 1583, 29889, 6451, 29897, 13, 13, 1678, 822, 2761, 29898, 1311, 29892, 1741, 1125, 29871, 396, 29871, 31904, 30732, 31770, 30495, 13, 4706, 565, 1741, 29889, 8149, 962, 1275, 376, 7341, 1115, 13, 9651, 1583, 29889, 19322, 353, 518, 1311, 29889, 10568, 29892, 29871, 29900, 29962, 13, 4706, 25342, 1741, 29889, 8149, 962, 1275, 376, 8091, 1115, 13, 9651, 1583, 29889, 19322, 353, 21069, 1311, 29889, 10568, 29892, 29871, 29900, 29962, 13, 4706, 1683, 29901, 13, 9651, 736, 13, 4706, 1583, 29889, 627, 29891, 580, 13, 13, 13, 1990, 23353, 29918, 29934, 547, 300, 29898, 4297, 1125, 29871, 396, 29871, 31048, 4297, 30396, 234, 185, 156, 233, 140, 194, 30427, 30332, 30330, 19795, 30281, 30978, 30317, 30279, 30406, 30199, 30305, 30281, 30255, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 3474, 29892, 2159, 29892, 2927, 29892, 926, 29892, 4331, 29922, 29896, 29900, 29892, 2302, 29922, 29896, 29900, 29892, 13, 462, 5418, 29922, 29896, 29900, 29900, 1125, 13, 4706, 2428, 2141, 1649, 2344, 12035, 7165, 29892, 2159, 29892, 2927, 29892, 926, 29897, 13, 4706, 1583, 29889, 10568, 353, 4331, 13, 4706, 1583, 29889, 2798, 29918, 3881, 353, 2302, 13, 4706, 1583, 29889, 11808, 353, 29871, 29900, 13, 4706, 1583, 29889, 19244, 353, 5418, 13, 13, 1678, 822, 2761, 29898, 1311, 29892, 5446, 1125, 13, 4706, 1583, 29889, 11808, 4619, 29871, 29896, 13, 4706, 565, 1583, 29889, 11808, 1275, 1583, 29889, 2798, 29918, 3881, 29901, 13, 9651, 1583, 29889, 11808, 353, 29871, 29900, 13, 9651, 1583, 29889, 19322, 29961, 29900, 29962, 353, 4036, 29889, 9502, 3881, 6278, 1311, 29889, 10568, 29892, 1583, 29889, 10568, 29897, 13, 9651, 565, 313, 5415, 29889, 3784, 29918, 6689, 580, 29961, 29900, 29962, 448, 1583, 29889, 3784, 29918, 6689, 580, 29961, 29900, 29962, 6736, 13, 18884, 1583, 29889, 19244, 322, 1583, 29889, 19322, 29961, 29900, 29962, 529, 29871, 29900, 29897, 320, 13, 462, 1678, 470, 313, 1311, 29889, 3784, 29918, 6689, 580, 29961, 29906, 29962, 448, 5446, 29889, 3784, 29918, 6689, 580, 29961, 29906, 29962, 6736, 13, 462, 4706, 1583, 29889, 19244, 322, 1583, 29889, 19322, 29961, 29900, 29962, 1405, 29871, 29900, 1125, 13, 18884, 1583, 29889, 486, 595, 580, 13, 4706, 1583, 29889, 627, 29891, 580, 13, 13, 13, 29937, 29871, 30537, 30532, 30203, 30335, 30537, 30199, 31770, 30495, 13, 11178, 353, 323, 29895, 580, 13, 15257, 29918, 2311, 353, 518, 29945, 29900, 29900, 29892, 29871, 29946, 29900, 29900, 29962, 13, 15257, 353, 1815, 4428, 29898, 11178, 29892, 2920, 29922, 15257, 29918, 2311, 29961, 29900, 1402, 3171, 29922, 15257, 29918, 2311, 29961, 29896, 2314, 13, 11178, 29889, 3257, 703, 234, 137, 180, 30568, 30371, 30553, 30787, 21004, 1159, 13, 15257, 29889, 4058, 580, 13, 13, 29937, 29871, 31048, 31046, 30806, 30746, 30858, 30199, 31770, 30495, 13, 15257, 29889, 3258, 29918, 726, 29898, 29945, 29900, 29892, 29871, 29896, 29945, 29900, 29892, 1426, 2433, 19795, 742, 5445, 2433, 12692, 742, 4079, 29922, 877, 30604, 30260, 30303, 30514, 742, 29871, 29906, 29900, 876, 13, 15257, 29889, 3258, 29918, 726, 29898, 29945, 29900, 29892, 29871, 29906, 29945, 29900, 29892, 1426, 2433, 29979, 27269, 742, 5445, 2433, 1127, 742, 4079, 29922, 877, 30604, 30260, 30303, 30514, 742, 29871, 29906, 29900, 876, 13, 15257, 29889, 3258, 29918, 726, 29898, 29945, 29900, 29892, 29871, 29906, 29900, 29900, 29892, 1426, 2433, 15307, 742, 5445, 2433, 15503, 552, 742, 4079, 29922, 877, 30604, 30260, 30303, 30514, 742, 29871, 29906, 29900, 876, 13, 264, 6764, 29918, 13628, 353, 10508, 29889, 3258, 29918, 726, 29898, 29896, 29941, 29900, 29892, 29871, 29896, 29945, 29900, 29892, 5445, 2433, 12692, 742, 4079, 29922, 877, 30604, 30260, 30303, 30514, 742, 29871, 29906, 29900, 876, 13, 1357, 29918, 13628, 353, 10508, 29889, 3258, 29918, 726, 29898, 29896, 29941, 29900, 29892, 29871, 29906, 29945, 29900, 29892, 5445, 2433, 1127, 742, 4079, 29922, 877, 30604, 30260, 30303, 30514, 742, 29871, 29906, 29900, 876, 13, 1456, 29918, 2230, 353, 10508, 29889, 3258, 29918, 726, 29898, 29896, 29941, 29900, 29892, 29871, 29906, 29900, 29900, 29892, 5445, 2433, 15503, 552, 742, 4079, 29922, 877, 30604, 30260, 30303, 30514, 742, 29871, 29906, 29900, 876, 13, 13, 13, 1753, 1510, 29918, 13628, 29898, 9106, 29918, 13628, 29892, 8158, 1125, 13, 1678, 10508, 29889, 667, 2917, 29898, 9106, 29918, 13628, 29892, 1426, 29922, 710, 29898, 13628, 876, 13, 13, 13, 1753, 1510, 29918, 2230, 29898, 2230, 29918, 726, 29892, 931, 29918, 11802, 1125, 13, 1678, 10508, 29889, 667, 2917, 29898, 2230, 29918, 726, 29892, 1426, 29922, 710, 29898, 2230, 29918, 11802, 876, 13, 13, 13, 29937, 29871, 31048, 235, 172, 169, 30733, 30199, 31770, 30495, 13, 4951, 728, 29918, 3149, 353, 29871, 29941, 13, 13, 29937, 29871, 31003, 30185, 30258, 30364, 30281, 30978, 30317, 30279, 30199, 31770, 30495, 13, 2135, 29918, 13471, 353, 29871, 29945, 29900, 13, 2135, 29918, 2962, 353, 518, 8172, 29889, 9502, 3881, 29898, 29945, 29900, 29892, 29871, 29946, 29900, 29900, 511, 4036, 29889, 9502, 3881, 29898, 29945, 29900, 29892, 29871, 29896, 29900, 29900, 4638, 13, 2135, 29918, 2344, 29918, 19322, 353, 518, 29906, 29889, 29900, 29892, 29871, 29906, 29889, 29900, 29962, 13, 1646, 29918, 2311, 353, 518, 29896, 29900, 29900, 29892, 29871, 29896, 29900, 29962, 13, 9106, 29918, 2962, 353, 518, 29906, 29900, 29900, 29892, 29871, 29941, 29946, 29900, 29962, 13, 29937, 29871, 31048, 19795, 30199, 31770, 30495, 13, 510, 29918, 2962, 353, 518, 29906, 29900, 29900, 29892, 29871, 29945, 29900, 29962, 13, 510, 29918, 19244, 353, 29871, 29896, 29900, 29900, 13, 13, 29937, 29871, 31003, 30185, 30258, 30364, 30281, 30978, 30317, 30279, 30199, 30260, 30203, 30255, 30369, 30203, 30255, 30732, 30494, 13, 2135, 353, 13402, 29898, 15257, 29892, 8287, 29918, 13471, 29892, 525, 9539, 742, 8287, 29918, 2962, 29892, 8287, 29918, 2344, 29918, 19322, 29897, 13, 9106, 29918, 336, 3522, 353, 14574, 29918, 29934, 547, 300, 29898, 15257, 29892, 2594, 29918, 2311, 29892, 525, 1127, 742, 926, 29922, 9106, 29918, 2962, 29897, 13, 510, 29918, 336, 3522, 353, 23353, 29918, 29934, 547, 300, 29898, 15257, 29892, 2594, 29918, 2311, 29892, 525, 12692, 742, 926, 29922, 510, 29918, 2962, 29892, 13, 462, 4706, 5418, 29922, 510, 29918, 19244, 29897, 13, 13, 29937, 29871, 31048, 30974, 232, 139, 190, 31770, 30495, 13, 11802, 29918, 2962, 353, 938, 29898, 2230, 29889, 546, 29888, 29918, 11808, 3101, 13, 11802, 29918, 2230, 353, 3748, 29918, 2962, 13, 13, 8000, 5852, 29901, 13, 1678, 8287, 29889, 627, 29891, 580, 29871, 396, 29871, 31003, 30185, 30258, 30396, 31124, 30412, 30427, 13, 1678, 8287, 29918, 1066, 353, 8287, 29889, 3784, 29918, 6689, 580, 13, 1678, 8287, 29918, 19322, 353, 8287, 29889, 3784, 29918, 19322, 580, 13, 13, 1678, 419, 29918, 336, 3522, 29889, 6451, 29898, 2135, 29897, 29871, 396, 29871, 31048, 19795, 30396, 31124, 30412, 30427, 13, 13, 1678, 396, 29871, 31048, 31046, 30806, 30746, 30858, 30199, 31100, 30374, 13, 1678, 1510, 29918, 13628, 29898, 1357, 29918, 13628, 29892, 4847, 29918, 336, 3522, 29889, 3784, 29918, 3149, 3101, 13, 1678, 1510, 29918, 13628, 29898, 264, 6764, 29918, 13628, 29892, 419, 29918, 336, 3522, 29889, 3784, 29918, 3149, 3101, 13, 1678, 1510, 29918, 2230, 29898, 1456, 29918, 2230, 29892, 3748, 29918, 2230, 29899, 11802, 29918, 2962, 29897, 13, 1678, 1286, 29918, 2230, 353, 938, 29898, 2230, 29889, 546, 29888, 29918, 11808, 3101, 13, 13, 1678, 565, 1286, 29918, 2230, 448, 3748, 29918, 2230, 6736, 29871, 29896, 29901, 29871, 396, 29871, 31048, 30287, 234, 170, 149, 234, 184, 143, 236, 132, 145, 30326, 30366, 30513, 30974, 232, 139, 190, 30746, 30858, 31757, 30453, 233, 158, 194, 30914, 13, 4706, 3748, 29918, 2230, 353, 1286, 29918, 2230, 13, 13, 1678, 565, 4847, 29918, 336, 3522, 29889, 3784, 29918, 3149, 580, 6736, 8341, 29918, 3149, 29901, 29871, 396, 29871, 31048, 30605, 30420, 30260, 31258, 30185, 30199, 31721, 31107, 13, 4706, 16833, 29918, 726, 353, 525, 29979, 27269, 399, 1177, 29915, 13, 4706, 16833, 29918, 2780, 353, 525, 9539, 29915, 13, 4706, 2867, 13, 1678, 565, 419, 29918, 336, 3522, 29889, 3784, 29918, 3149, 580, 6736, 8341, 29918, 3149, 29901, 29871, 396, 29871, 31048, 19795, 30199, 31721, 31107, 13, 4706, 16833, 29918, 726, 353, 525, 29979, 27269, 11247, 1660, 29915, 13, 4706, 16833, 29918, 2780, 353, 525, 1127, 29915, 13, 4706, 2867, 13, 1678, 565, 8287, 29918, 1066, 29961, 29906, 29962, 6736, 10508, 29918, 2311, 29961, 29900, 29962, 470, 8287, 29918, 1066, 29961, 29900, 29962, 5277, 29871, 29900, 29901, 13, 4706, 8287, 29889, 486, 595, 580, 13, 1678, 565, 8287, 29918, 1066, 29961, 29941, 29962, 6736, 10508, 29918, 2311, 29961, 29896, 5387, 29871, 396, 29871, 31048, 19795, 30199, 31050, 30940, 13, 4706, 419, 29918, 336, 3522, 29889, 1202, 29918, 3149, 580, 13, 4706, 8287, 29889, 29891, 685, 580, 13, 1678, 565, 8287, 29918, 1066, 29961, 29896, 29962, 5277, 29871, 29900, 29901, 29871, 396, 29871, 31048, 30605, 30420, 30260, 31258, 30185, 30199, 31050, 30940, 13, 4706, 4847, 29918, 336, 3522, 29889, 1202, 29918, 3149, 580, 13, 4706, 8287, 29889, 29891, 685, 580, 13, 1678, 565, 313, 2135, 29889, 27342, 29918, 3198, 29898, 9106, 29918, 336, 3522, 29897, 1275, 29871, 29896, 322, 8287, 29918, 19322, 29961, 29896, 29962, 1405, 29871, 29900, 29897, 320, 13, 9651, 470, 313, 2135, 29889, 27342, 29918, 3198, 29898, 510, 29918, 336, 3522, 29897, 1275, 29871, 29896, 322, 8287, 29918, 19322, 29961, 29896, 29962, 529, 29871, 29900, 1125, 13, 4706, 8287, 29889, 29891, 685, 580, 29871, 396, 29871, 31048, 30990, 30880, 30199, 30281, 30978, 30317, 30279, 30353, 30948, 30366, 30665, 30366, 31045, 30733, 30396, 235, 194, 192, 30666, 13, 13, 1678, 18883, 29889, 5504, 580, 13, 1678, 931, 29889, 17059, 29898, 29900, 29889, 29900, 29896, 29897, 13, 13, 29937, 29871, 31048, 31711, 30801, 31657, 30746, 13, 15257, 29889, 3258, 29918, 726, 29898, 29906, 29945, 29900, 29892, 29871, 29906, 29900, 29900, 29892, 1426, 29922, 17675, 479, 29918, 726, 29892, 13, 462, 259, 5445, 29922, 17675, 479, 29918, 2780, 29892, 4079, 29922, 877, 30604, 30260, 30303, 30514, 742, 29871, 29941, 29900, 876, 13, 11178, 29889, 5504, 580, 13, 2230, 29889, 17059, 29898, 29896, 29900, 29897, 13, 2 ]
microproxy/test/interceptor/test_msg_publisher.py
mike820324/microProxy
20
50068
<reponame>mike820324/microProxy<gh_stars>10-100 import json import unittest import mock from microproxy.context import ViewerContext from microproxy.interceptor.msg_publisher import MsgPublisher from microproxy.version import VERSION class TestMsgPublisher(unittest.TestCase): def setUp(self): self.zmq_socket = mock.Mock() self.msg_publisher = MsgPublisher(None, self.zmq_socket) def test_publish(self): ctx_data = { "scheme": "https", "host": "example.com", "path": "/index", "port": 443, "version": VERSION, "client_tls": None, "server_tls": None, "response": None, "request": None, } ctx = ViewerContext.deserialize(ctx_data) self.msg_publisher.publish(ctx) self.zmq_socket.send_multipart.assert_called_with([ "message", JsonStrMatcher(ctx_data)]) class JsonStrMatcher(object): def __init__(self, data): self.data = data def __eq__(self, other): return json.loads(other) == self.data def __str__(self): return str(self.data)
[ 1, 529, 276, 1112, 420, 29958, 2460, 446, 29947, 29906, 29900, 29941, 29906, 29946, 29914, 29885, 2357, 14048, 29966, 12443, 29918, 303, 1503, 29958, 29896, 29900, 29899, 29896, 29900, 29900, 13, 5215, 4390, 13, 5215, 443, 27958, 13, 5215, 11187, 13, 13, 3166, 9200, 14701, 29889, 4703, 1053, 478, 15580, 2677, 13, 3166, 9200, 14701, 29889, 1639, 14268, 29889, 7645, 29918, 23679, 261, 1053, 28264, 21076, 1674, 261, 13, 3166, 9200, 14701, 29889, 3259, 1053, 478, 1001, 13381, 13, 13, 13, 1990, 4321, 16190, 21076, 1674, 261, 29898, 348, 27958, 29889, 3057, 8259, 1125, 13, 1678, 822, 731, 3373, 29898, 1311, 1125, 13, 4706, 1583, 29889, 14018, 29939, 29918, 11514, 353, 11187, 29889, 18680, 580, 13, 4706, 1583, 29889, 7645, 29918, 23679, 261, 353, 28264, 21076, 1674, 261, 29898, 8516, 29892, 1583, 29889, 14018, 29939, 29918, 11514, 29897, 13, 13, 1678, 822, 1243, 29918, 23679, 29898, 1311, 1125, 13, 4706, 12893, 29918, 1272, 353, 426, 13, 9651, 376, 816, 2004, 1115, 376, 991, 613, 13, 9651, 376, 3069, 1115, 376, 4773, 29889, 510, 613, 13, 9651, 376, 2084, 1115, 5591, 2248, 613, 13, 9651, 376, 637, 1115, 29871, 29946, 29946, 29941, 29892, 13, 9651, 376, 3259, 1115, 478, 1001, 13381, 29892, 13, 9651, 376, 4645, 29918, 29873, 3137, 1115, 6213, 29892, 13, 9651, 376, 2974, 29918, 29873, 3137, 1115, 6213, 29892, 13, 9651, 376, 5327, 1115, 6213, 29892, 13, 9651, 376, 3827, 1115, 6213, 29892, 13, 4706, 500, 13, 4706, 12893, 353, 478, 15580, 2677, 29889, 2783, 261, 6646, 29898, 13073, 29918, 1272, 29897, 13, 4706, 1583, 29889, 7645, 29918, 23679, 261, 29889, 23679, 29898, 13073, 29897, 13, 13, 4706, 1583, 29889, 14018, 29939, 29918, 11514, 29889, 6717, 29918, 18056, 442, 29889, 9294, 29918, 13998, 29918, 2541, 4197, 13, 9651, 376, 4906, 613, 13, 9651, 14355, 5015, 9652, 261, 29898, 13073, 29918, 1272, 29897, 2314, 13, 13, 13, 1990, 14355, 5015, 9652, 261, 29898, 3318, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 848, 1125, 13, 4706, 1583, 29889, 1272, 353, 848, 13, 13, 1678, 822, 4770, 1837, 12035, 1311, 29892, 916, 1125, 13, 4706, 736, 4390, 29889, 18132, 29898, 1228, 29897, 1275, 1583, 29889, 1272, 13, 13, 1678, 822, 4770, 710, 12035, 1311, 1125, 13, 4706, 736, 851, 29898, 1311, 29889, 1272, 29897, 13, 2 ]
contests/2020_spring/1.py
clarkchen/leetcode_python
0
113948
<filename>contests/2020_spring/1.py<gh_stars>0 from typing import List class Solution: def minCount(self, coins: List[int]) -> int: res = [] for x in coins: res.append(x//2+x%2) return sum(res) if __name__ == '__main__': s = Solution() ans = s.minCount([4,2,1]) print(ans) ans = s.minCount([2,3,10]) print(ans) ans = s.minCount([1]) print(ans) ans = s.minCount([2]) print(ans)
[ 1, 529, 9507, 29958, 1285, 9197, 29914, 29906, 29900, 29906, 29900, 29918, 4278, 29914, 29896, 29889, 2272, 29966, 12443, 29918, 303, 1503, 29958, 29900, 13, 3166, 19229, 1053, 2391, 13, 13, 13, 1990, 24380, 29901, 13, 1678, 822, 1375, 3981, 29898, 1311, 29892, 1302, 1144, 29901, 2391, 29961, 524, 2314, 1599, 938, 29901, 13, 4706, 620, 353, 5159, 13, 4706, 363, 921, 297, 29871, 1302, 1144, 29901, 13, 9651, 620, 29889, 4397, 29898, 29916, 458, 29906, 29974, 29916, 29995, 29906, 29897, 13, 4706, 736, 2533, 29898, 690, 29897, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 269, 353, 24380, 580, 13, 1678, 6063, 353, 269, 29889, 1195, 3981, 4197, 29946, 29892, 29906, 29892, 29896, 2314, 13, 1678, 1596, 29898, 550, 29897, 13, 13, 1678, 6063, 353, 269, 29889, 1195, 3981, 4197, 29906, 29892, 29941, 29892, 29896, 29900, 2314, 13, 1678, 1596, 29898, 550, 29897, 13, 13, 1678, 6063, 353, 269, 29889, 1195, 3981, 4197, 29896, 2314, 13, 1678, 1596, 29898, 550, 29897, 13, 13, 1678, 6063, 353, 269, 29889, 1195, 3981, 4197, 29906, 2314, 13, 1678, 1596, 29898, 550, 29897, 2 ]
src/icemac/addressbook/tests/test_entities.py
icemac/icemac.addressbook
1
101286
from icemac.addressbook.address import phone_number_entity from icemac.addressbook.address import postal_address_entity from icemac.addressbook.addressbook import address_book_entity from icemac.addressbook.entities import Entities, PersistentEntities, Field from icemac.addressbook.entities import Entity, get_bound_schema_field from icemac.addressbook.entities import EntityOrder from icemac.addressbook.entities import FieldCustomization from icemac.addressbook.entities import NoFieldCustomization from icemac.addressbook.interfaces import IAddressBook, IHomePageAddress from icemac.addressbook.interfaces import IEntities, IEntityOrder, IEntity from icemac.addressbook.interfaces import IField, IOrderStorage from icemac.addressbook.interfaces import IFieldCustomization from icemac.addressbook.interfaces import IPhoneNumber, IPerson, IKeyword from icemac.addressbook.interfaces import IUserFieldStorage from icemac.addressbook.testing import pyTestStackDemoStorage from icemac.addressbook.tests.conftest import IDog, IKwack, Kwack import persistent import pytest import zope.component import zope.component.hooks import zope.interface import zope.interface.verify import zope.schema import zope.schema.interfaces # Constants DEFAULT_ORDER = [u'person', u'postal address', u'phone number', u'e-mail address', u'home page address'] # Fixtures @pytest.fixture(scope='function') def entityOrder(address_book): """Get the entity order utility.""" return zope.component.getUtility(IEntityOrder) @pytest.fixture(scope='module') def unknownEntity(): """Get an entity which is not known in the address book.""" return Entity(u'', IEntities, 'icemac.addressbook.entities.Entities') @pytest.fixture(scope='function') def minimalEntity(address_book): """Get an entity which is not registered in the address book.""" return IEntity(IEntities) @pytest.fixture(scope='function') def field(): """Get a user defined field.""" field = Field() field.type = 'TextLine' return field @pytest.fixture(scope='function') def schemaized_field(field): """Get a user defined field adapted to a `zope.schema` field.""" return zope.schema.interfaces.IField(field) @pytest.fixture(scope='function') def entity(): """Get a custom entity.""" return Entity( u'Dummy', IDummy, 'icemac.addressbook.tests.test_entities.Dummy') @pytest.fixture(scope='function') def entity_with_field(address_book, entity, field): """Get a custom entity with a user defined field.""" entity.addField(field) return entity @pytest.fixture(scope='function') def entities(address_book): """Get the entities utility.""" return zope.component.getUtility(IEntities) @pytest.yield_fixture(scope='function') def root_folder(zodbS): """Get the root folder of the ZODB.""" for connection in pyTestStackDemoStorage(zodbS, 'root_folder'): yield connection.rootFolder # Helper classes class IDummy(zope.interface.Interface): """Interface for test entity.""" dummy = zope.schema.Text(title=u'dummy') dummy2 = zope.schema.Text(title=u'dummy2') @zope.interface.implementer(IDummy) class Dummy(object): """Test entity.""" # Helper functions def getMainEntities_titles(sorted): """Return the entities titles when calling `getMainEntities()`.""" entities = zope.component.getUtility(IEntities) return [x.title for x in entities.getMainEntities(sorted=sorted)] # Tests def test_entities__Entities__1(): """`Entities` fulfills the `IEntities` interface.""" zope.interface.verify.verifyObject(IEntities, Entities()) def test_entities__PersistentEntities__1(): """`PersistentEntities` fulfills the `IEntities` interface.""" zope.interface.verify.verifyObject(IEntities, PersistentEntities()) def test_entities__EntityOrder__1(): """`EntityOrder` fulfills the `IEntityOrder` interface.""" zope.interface.verify.verifyObject(IEntityOrder, EntityOrder()) def test_entities__Field__1(): """`Field` fulfills the `IField` interface.""" zope.interface.verify.verifyObject(IField, Field()) def test_entities__Entity__1(): """`Entity` fulfills the `IEntity` interface.""" entity = Entity(None, IEntity, 'Entity') zope.interface.verify.verifyObject(IEntity, entity) def test_entities__getEntities__1(stubSortOrder, stubEntities): """`(Persistent)Entities.getEntities()` returns entities sorted. The sort order is defined in the sort order storage. """ e = stubEntities assert [e.cat, e.kwack, e.duck] == e.entities.getEntities() def test_entities__getEntities__2(stubEntities): """`(Persistent)Entities.getEntities()` might return entities unsorted.""" e = stubEntities assert (set([e.kwack, e.duck, e.cat]) == set(e.entities.getEntities(sorted=False))) def test_entities__getEntities__3(stubSortOrder, stubEntities): """`(Persistent)Entities.getEntities()` respects changes in sort order.""" e = stubEntities stubSortOrder.up(e.duck) assert [e.cat, e.duck, e.kwack] == e.entities.getEntities() def test_entities__PersistentEntities__getMainEntities__1(address_book): """By default the result of `getMainEntities()` is sort independent.""" assert DEFAULT_ORDER == getMainEntities_titles(True) assert DEFAULT_ORDER == getMainEntities_titles(False) def test_entities__PersistentEntities__getMainEntities__2(entityOrder): """`getMainEntities()` respects a changed sort order.""" entityOrder.up(IEntity(IPhoneNumber)) assert ([u'person', u'phone number', u'postal address', u'e-mail address', u'home page address'] == getMainEntities_titles(True)) # The unordered variant still returns the default order: assert DEFAULT_ORDER == getMainEntities_titles(False) def test_entities__EntityOrder__get__1(entityOrder): """`get()` returns the position of the entity.""" assert 1 == entityOrder.get(IEntity(IPerson)) assert 8 == entityOrder.get(IEntity(IKeyword)) def test_entities__EntityOrder__get__2(entityOrder, unknownEntity): """`get()` raises a KeyError if entity is not known to the sort order.""" with pytest.raises(KeyError): entityOrder.get(unknownEntity) def test_entities__EntityOrder__get__3(entityOrder, minimalEntity): """`get()` raises a KeyError if the entity has no name.""" with pytest.raises(KeyError): entityOrder.get(minimalEntity) def test_entities__EntityOrder__get__4(entityOrder, AddressBookFactory): """It accesses the address book in `zope.component.hooks.site`.""" other_address_book = AddressBookFactory('other_address_book') # Changes in an address book ... person = IEntity(IPerson) assert 1 == entityOrder.get(person) entityOrder.down(person) assert 2 == entityOrder.get(person) # ... are not reflected in another address book: with zope.component.hooks.site(other_address_book): assert 1 == entityOrder.get(person) def test_entities__EntityOrder__get__5(entityOrder): """`get()` raises a ComponentLookupError if no site is set.""" person = IEntity(IPerson) with zope.component.hooks.site(None): with pytest.raises(zope.component.ComponentLookupError): entityOrder.get(person) def test_entities__EntityOrder__isFirst__1(entityOrder): """`isFirst()` returns `True` for the first entity.""" assert entityOrder.isFirst(IEntity(IAddressBook)) def test_entities__EntityOrder__isFirst__2(entityOrder): """`isFirst()` returns `False` for an entity which is not the first.""" assert not entityOrder.isFirst(IEntity(IPhoneNumber)) def test_entities__EntityOrder__isFirst__3(entityOrder, unknownEntity): """`isFirst()` raises KeyError if entity is not known to the sort order.""" with pytest.raises(KeyError): entityOrder.isFirst(unknownEntity) def test_entities__EntityOrder__isFirst__4(entityOrder, minimalEntity): """`isFirst()` raises KeyError if the entity has no name.""" with pytest.raises(KeyError): entityOrder.isFirst(minimalEntity) def test_entities__EntityOrder__isLast__1(entityOrder): """`isLast()` returns `True` for the first entity.""" assert entityOrder.isLast(IEntity(IKeyword)) def test_entities__EntityOrder__isLast__2(entityOrder): """`isLast()` returns `False` for an entity which is not the first.""" assert not entityOrder.isLast(IEntity(IPhoneNumber)) def test_entities__EntityOrder__isLast__3(entityOrder, unknownEntity): """`isLast()` raises KeyError if entity is not known to the sort order.""" with pytest.raises(KeyError): entityOrder.isLast(unknownEntity) def test_entities__EntityOrder__isLast__4(entityOrder, minimalEntity): """`isLast()` raises KeyError if the entity has no name.""" with pytest.raises(KeyError): entityOrder.isLast(minimalEntity) def test_entities__EntityOrder____iter____1(entityOrder): """It is iterable, returning entity names.""" assert ([ 'IcemacAddressbookAddressbookAddressbook', 'IcemacAddressbookPersonPerson', 'IcemacAddressbookPersonPersondefaults', 'IcemacAddressbookAddressPostaladdress', 'IcemacAddressbookAddressPhonenumber', 'IcemacAddressbookAddressEmailaddress', 'IcemacAddressbookAddressHomepageaddress', 'IcemacAddressbookFileFileFile', 'IcemacAddressbookKeywordKeyword', ] == list(iter(entityOrder))) def test_entities__EntityOrder__up__1(entityOrder): """`up()` moved one position up.""" person = IEntity(IPerson) assert 1 == entityOrder.get(person) entityOrder.up(person) assert 0 == entityOrder.get(person) def test_entities__EntityOrder__up__2(entityOrder): """`up(n)` moves n positions up.""" hp = IEntity(IHomePageAddress) assert 6 == entityOrder.get(hp) entityOrder.up(hp, 3) assert 3 == entityOrder.get(hp) def test_entities__EntityOrder__up__3(entityOrder): """If the delta is too big when calling `up()` a ValueError is raised.""" person = IEntity(IPerson) assert 1 == entityOrder.get(person) with pytest.raises(ValueError): entityOrder.up(person, 2) def test_entities__EntityOrder__down__1(entityOrder): """`down()` moved one position down.""" person = IEntity(IPerson) assert 1 == entityOrder.get(person) entityOrder.down(person) assert 2 == entityOrder.get(person) def test_entities__EntityOrder__down__2(entityOrder): """`down(n)` moves n positions down.""" ab = IEntity(IAddressBook) assert 0 == entityOrder.get(ab) entityOrder.down(ab, 3) assert 3 == entityOrder.get(ab) def test_entities__EntityOrder__down__3(entityOrder): """If the delta is too big when calling `down()` a ValueError is raised.""" person = IEntity(IPerson) assert 1 == entityOrder.get(person) with pytest.raises(ValueError): entityOrder.down(person, 8) def test_entities__entity_by_name__1(stubEntities, entityAdapters): """`entity_by_name` raises a `ValueError` if string name is unknown.""" with pytest.raises(ValueError): IEntity('asdf') def test_entities__entity_by_name__2(stubEntities, entityAdapters): """`entity_by_name` raises a `ValueError` if unicode name is unknown.""" with pytest.raises(ValueError): IEntity(u'asdf') def test_entities__entity_by_name__3(stubEntities, entityAdapters): """`entity_by_name` raises a `ValueError` if class name is used.""" with pytest.raises(ValueError): IEntity('icemac.addressbook.tests.stubs.Duck') def test_entities__entity_by_name__4(stubEntities, entityAdapters): """`entity_by_name` raises a `ValueError` if class name is used.""" with pytest.raises(ValueError): IEntity('icemac.addressbook.tests.conftest.Duck') def test_entities__entity_by_name__5(stubEntities, entityAdapters): """`entity_by_name` adapts from string entity name.""" assert stubEntities.duck == IEntity('IcemacAddressbookTestsConftestDuck') def test_entities__entity_by_name__6(stubEntities, entityAdapters): """`entity_by_name` adapts from unicode entity name.""" assert stubEntities.duck == IEntity(u'IcemacAddressbookTestsConftestDuck') def test_entities__entity_by_interface__1(stubEntities, entityAdapters): """`entity_by_interface` returns a minimal entity for unknown interface.""" entity = IEntity(IDog) assert None is entity.title assert IDog is entity.interface assert None is entity.class_name def test_entities__entity_by_interface__2(stubEntities, entityAdapters): """`entity_by_interface` returns the entity for a known interface.""" assert stubEntities.kwack == IEntity(IKwack) def test_entities__entity_by_obj__1(stubEntities, entityAdapters): """`entity_by_obj` raises a ValueError for an unknown instance.""" obj = persistent.Persistent() with pytest.raises(ValueError): IEntity(obj) def test_entities__entity_by_obj__2(stubEntities, entityAdapters): """`entity_by_obj` returns the instance for a known instance.""" assert stubEntities.kwack == IEntity(Kwack()) def test_entities__Entity__addField__1(entities, entity, field): """It adds a field to an entity.""" entity.addField(field) assert ['Field-1'] == list(entities.keys()) assert field is entities[u'Field-1'] def test_entities__Entity__addField__2(entities, entity, field): """It stores the interface of the entity on the field.""" entity.addField(field) assert IDummy == entities[u'Field-1'].interface def test_entities__Entity__addField__3(address_book, field): """It registers an adapter for the field.""" address_book_entity.addField(field) adapted_entity = zope.component.getMultiAdapter( (address_book_entity, address_book), IField, name=u'Field-1') assert field is adapted_entity def test_entities__entity_for_field__1(address_book, field): """It adapts a field to its entity.""" address_book_entity.addField(field) adapted_field = IEntity(field) assert address_book_entity == adapted_field def test_entities__Entity__removeField__1(entities, entity_with_field, field): """It removes a field from an entity.""" assert field in entities.values() entity_with_field.removeField(field) assert field not in entities.values() def test_entities__Entity__removeField__2(entity_with_field, field): """It removes the interface of the entity from the field.""" entity_with_field.removeField(field) assert field.interface is None def test_entities__Entity__removeField__3(entity_with_field, field): """It removes the adapter registrations for the field.""" entity_with_field.removeField(field) assert None is zope.component.queryMultiAdapter( (entity, Dummy()), IField, name=u'Field') assert None is IEntity(field, None) def test_entities__Entity__setFieldOrder__1(entity_with_field, field): """It changes the initial (empty) order.""" assert [] == entity_with_field.getFieldOrder() entity_with_field.setFieldOrder(['dummy2', field.__name__, 'dummy']) assert (['dummy2', field.__name__, 'dummy'] == entity_with_field.getFieldOrder()) def test_entities__Entity__setFieldOrder__2(entity_with_field): """It ignores unknown field names and does not store them.""" entity = entity_with_field entity.setFieldOrder(['dummy2', 'I-do-not-exist', 'dummy']) assert ['dummy2', 'dummy'] == entity.getFieldOrder() # Unknown field names are not written into storage: order_storage = zope.component.getUtility(IOrderStorage) assert (['dummy2', 'dummy'] == order_storage.byNamespace(entity.order_storage_namespace)) def test_entities__Entity__getFieldOrder__1(entity): """It returns the initially emtpy field order.""" assert [] == entity.getFieldOrder() def test_entities__Entity__getFieldOrder__2(entity_with_field, field): """It only contains the values set by `setFieldOrder`.""" entity = entity_with_field entity.setFieldOrder([field.__name__, 'dummy']) assert [field.__name__, 'dummy'] == entity.getFieldOrder() def test_entities__Entity__getFieldOrder__3(address_book): """It returns `[]` if the namespace cannot be computed.""" # The namespace in the order utility depends on the name of the # entity which itself depends on the class_name stored on the # entity. But this class name is optional, so the name might not be # computable: entity = Entity(u'Dummy', IDummy, None) assert [] == entity.getFieldOrder() def test_entities__Entity__name__1(entity): """`name` is the name of the entity containing the module path.""" assert 'IcemacAddressbookTestsTestEntitiesDummy' == entity.name def test_entities__Entity__name__2(address_book): """`name` raises a ValueError if no class name is set.""" entity = Entity(None, IDummy, None) with pytest.raises(ValueError): entity.name def test_entities__Entity__getRawFields__1(entity_with_field, field): """`getRawFields` sorts fields missing in sort order to the end.""" entity = entity_with_field entity.setFieldOrder([field.__name__, 'dummy']) assert ([field.__name__, 'dummy', 'dummy2'] == [x[0] for x in entity.getRawFields()]) def test_entities__Entity__getRawFields__2(entity_with_field, field): """`getRawFields` returns the fields sorted by the field order.""" entity = entity_with_field entity.setFieldOrder(['dummy2', field.__name__, 'dummy']) assert ([('dummy2', IDummy['dummy2']), (field.__name__, field), ('dummy', IDummy['dummy'])] == list(entity.getRawFields())) def test_entities__Entity__getRawFields__3(entity_with_field, field): """`getRawFields` is able to return the fields unsorted (default order). When `sorted` is `False` the `zope.schema` fields are returned first (the order is defined by the order in the interface) and than the user defined fields (order is undefined here.) """ entity = entity_with_field entity.setFieldOrder(['dummy2', 'Field', 'dummy']) assert ([('dummy', IDummy['dummy']), ('dummy2', IDummy['dummy2']), (field.__name__, field)] == list(entity.getRawFields(sorted=False))) def test_entities__Entity__getFields__1(entity_with_field, schemaized_field): """`getFields` returns all fields as `zope.schema` in order.""" entity = entity_with_field entity.setFieldOrder(['dummy2', schemaized_field.__name__, 'dummy']) assert ([('dummy2', IDummy['dummy2']), (schemaized_field.__name__, schemaized_field), ('dummy', IDummy['dummy'])] == list(entity.getFields())) def test_entities__Entity__getFields__2(entity_with_field, schemaized_field): """`geFields` is able to return the fields unsorted (default order). When `sorted` is `False` the `zope.schema` fields are returned first (the order is defined by the order in the interface) and then the user defined fields (order is undefined here.) """ entity = entity_with_field entity.setFieldOrder(['dummy2', schemaized_field.__name__, 'dummy']) assert ([('dummy', IDummy['dummy']), ('dummy2', IDummy['dummy2']), (schemaized_field.__name__, schemaized_field)] == list(entity.getFields(sorted=False))) def test_entities__Entity__getFieldValues__1( entity_with_field, schemaized_field): """`getFieldValues` returns all fields as `zope.schema` in order.""" entity = entity_with_field entity.setFieldOrder(['dummy2', schemaized_field.__name__, 'dummy']) assert ([IDummy['dummy2'], schemaized_field, IDummy['dummy']] == entity.getFieldValues()) def test_entities__Entity__getFieldValues__2( entity_with_field, schemaized_field): """`getFieldValues` is able to return the fields unsorted (default order). When `sorted` is `False` the `zope.schema` fields are returned first (the order is defined by the order in the interface) and then the user defined fields (order is undefined here.) """ entity = entity_with_field entity.setFieldOrder(['dummy2', schemaized_field.__name__, 'dummy']) assert ([IDummy['dummy'], IDummy['dummy2'], schemaized_field] == entity.getFieldValues(sorted=False)) def test_entities__Entity__getField__1(entity): """`getField` raises a `KeyError` for an unknown field name.""" with pytest.raises(KeyError): entity.getField('asdf') def test_entities__Entity__getField__2(entity): """`getField` can return a `zope.schema` field.""" assert IDummy['dummy2'] == entity.getField('dummy2') def test_entities__Entity__getField__3(entity_with_field, schemaized_field): """`getField` can return a user defined field as `zope.schema` field.""" assert (schemaized_field == entity_with_field.getField(schemaized_field.__name__)) def test_entities__Entity__getRawField__1(entity): """`getRawField` raises a `KeyError` for an unknown field name.""" with pytest.raises(KeyError): entity.getRawField('asdf') def test_entities__Entity__getRawField__2(entity): """`getRawField` can return a `zope.schema` field.""" assert IDummy['dummy2'] == entity.getRawField('dummy2') def test_entities__Entity__getRawField__3(entity_with_field, field): """`getRawField` can return a user defined field.""" assert field == entity_with_field.getRawField(field.__name__) def test_entities__Entity__getClass__1(entity): """`getClass` returns the class object associated with the entity.""" assert Dummy == entity.getClass() def test_entities__Entity__getClass__2(): """`getClass` raises a `ValueError` if no `class_name` is set.""" e = Entity(None, IDummy, None) with pytest.raises(ValueError): e.getClass() def test_entities__Entity__tagged_values__1(): """`tagged_values` is a dict of the kwargs used during entity __init__.""" e = Entity(u'Dummy', IDummy, 'Dummy', a=1, b='asdf') assert dict(a=1, b='asdf') == e.tagged_values def test_entities__Entity__tagged_values__2(): """`tagged_values` is actually a copy of the kwargs dict. Tagged values not modifiable by modifying the returned dict. """ e = Entity(u'Dummy', IDummy, 'Dummy', a=1, b='asdf') e.tagged_values['a'] = 2 assert dict(a=1, b='asdf') == e.tagged_values def test_entities__get_bound_schema_field__1(address_book): """It returns the schema field if the obj provides the entity interface.""" field = get_bound_schema_field(address_book, address_book_entity, address_book_entity.getRawField('title')) assert address_book == field.context assert 'title' == field.__name__ assert isinstance(field, zope.schema.TextLine) def test_entities__get_bound_schema_field__2(address_book, FullPersonFactory): """It looks up the default obj on obj if iface is not provided by obj.""" person = FullPersonFactory(address_book, u'Koch') field = get_bound_schema_field( person, postal_address_entity, postal_address_entity.getRawField('country')) assert person.default_postal_address == field.context assert 'country' == field.__name__ assert isinstance(field, zope.schema.Choice) def test_entities__get_bound_schema_field__3(address_book, FullPersonFactory): """It binds field to obj if `default_attrib_fallback` is `False`. Additional condition: The interface is not provided by obj. """ person = FullPersonFactory(address_book, u'Koch') field = get_bound_schema_field( person, postal_address_entity, postal_address_entity.getRawField('country'), default_attrib_fallback=False) assert person == field.context def test_entities__get_bound_schema_field__4( address_book, FullPersonFactory, FieldFactory): """It returns a user defined field as a `zope.schema` field.""" person = FullPersonFactory(address_book, u'Koch') FieldFactory(address_book, IPhoneNumber, 'Datetime', u'last call', notes=u'using a phone') field = get_bound_schema_field( person, phone_number_entity, phone_number_entity.getRawField('Field-1')) assert IUserFieldStorage(person.default_phone_number) == field.context assert 'Field-1' == field.__name__ assert 'using a phone' == field.description assert isinstance(field, zope.schema.Datetime) def test_entities__NoFieldCustomization__1(root_folder): """It implements the IFieldCustomization interface.""" nfc = IFieldCustomization(root_folder) assert isinstance(nfc, NoFieldCustomization) assert zope.interface.verify.verifyObject(IFieldCustomization, nfc) def test_entities__NoFieldCustomization__get_value__1(root_folder): """It raises a KeyError.""" nfc = IFieldCustomization(root_folder) with pytest.raises(KeyError): nfc.get_value(IAddressBook['time_zone'], 'label') def test_entities__NoFieldCustomization__default_value__1(root_folder): """It returns the title of the field (default value).""" nfc = IFieldCustomization(root_folder) assert u'Time zone' == nfc.default_value( IAddressBook['time_zone'], 'label') @pytest.mark.parametrize( 'kind, result', ((u'label', u'Time zone'), (u'description', u'Fallback in case a user has not set up his personal' u' time zone in the preferences.'))) def test_entities__NoFieldCustomization__query_value__1( root_folder, kind, result): """It returns the default value.""" nfc = IFieldCustomization(root_folder) assert result == nfc.query_value(IAddressBook['time_zone'], kind) def test_entities__NoFieldCustomization__set_value__1(root_folder): """It is not implemented.""" nfc = IFieldCustomization(root_folder) with pytest.raises(NotImplementedError): nfc.set_value(IAddressBook['time_zone'], u'label', u'foo') def test_entities__FieldCustomization__1(address_book): """It implements the IFieldCustomization interface.""" fc = IFieldCustomization(address_book) assert isinstance(fc, FieldCustomization) assert zope.interface.verify.verifyObject(IFieldCustomization, fc) def test_entities__FieldCustomization__get_value__1(address_book): """It raises a KeyError if no custom value is stored.""" fc = IFieldCustomization(address_book) with pytest.raises(KeyError): fc.get_value(IAddressBook['time_zone'], 'label') def test_entities__FieldCustomization__get_value__2(address_book): """It raises a KeyError if the field does not belong to an interface.""" fc = IFieldCustomization(address_book) field = zope.schema.Text() with pytest.raises(KeyError): fc.get_value(field, 'label') def test_entities__FieldCustomization__default_value__1(address_book): """It returns the title of the field (default value).""" fc = IFieldCustomization(address_book) assert u'Time zone' == fc.default_value(IAddressBook['time_zone'], 'label') @pytest.mark.parametrize( 'kind, result', ((u'label', u'Time zone'), (u'description', u'Fallback in case a user has not set up his personal' u' time zone in the preferences.'))) def test_entities__FieldCustomization__query_value__1( address_book, kind, result): """It returns the default value if no custom label is stored.""" fc = IFieldCustomization(address_book) assert result == fc.query_value(IAddressBook['time_zone'], kind) def test_entities__FieldCustomization__set_value__1(address_book): """It stores the given custom value.""" fc = IFieldCustomization(address_book) field = IAddressBook['time_zone'] fc.set_value(field, u'label', u'Default time zone value 123') assert u'Default time zone value 123' == fc.get_value(field, 'label') assert u'Default time zone value 123' == fc.query_value(field, 'label') def test_entities__FieldCustomization__set_value__2(address_book): """Storing `None` removes the custom value.""" fc = IFieldCustomization(address_book) field = IAddressBook['time_zone'] fc.set_value(field, u'label', u'Default time zone value 123') fc.set_value(field, u'label', None) with pytest.raises(KeyError): fc.get_value(field, 'label') def test_entities__FieldCustomization__set_value__3(address_book): """It does not break on storing `None` with no custom value stored.""" fc = IFieldCustomization(address_book) field = IAddressBook['time_zone'] fc.set_value(field, u'label', None) with pytest.raises(KeyError): fc.get_value(field, 'label')
[ 1, 515, 16077, 331, 562, 29889, 7328, 2909, 29889, 7328, 1053, 9008, 29918, 4537, 29918, 10041, 13, 3166, 16077, 331, 562, 29889, 7328, 2909, 29889, 7328, 1053, 29767, 29918, 7328, 29918, 10041, 13, 3166, 16077, 331, 562, 29889, 7328, 2909, 29889, 7328, 2909, 1053, 3211, 29918, 2909, 29918, 10041, 13, 3166, 16077, 331, 562, 29889, 7328, 2909, 29889, 296, 1907, 1053, 4284, 1907, 29892, 9034, 9696, 5292, 1907, 29892, 8989, 13, 3166, 16077, 331, 562, 29889, 7328, 2909, 29889, 296, 1907, 1053, 14945, 29892, 679, 29918, 9917, 29918, 11010, 29918, 2671, 13, 3166, 16077, 331, 562, 29889, 7328, 2909, 29889, 296, 1907, 1053, 14945, 7514, 13, 3166, 16077, 331, 562, 29889, 7328, 2909, 29889, 296, 1907, 1053, 8989, 7281, 2133, 13, 3166, 16077, 331, 562, 29889, 7328, 2909, 29889, 296, 1907, 1053, 1939, 3073, 7281, 2133, 13, 3166, 16077, 331, 562, 29889, 7328, 2909, 29889, 1639, 8726, 1053, 306, 7061, 10967, 29892, 306, 11184, 5074, 7061, 13, 3166, 16077, 331, 562, 29889, 7328, 2909, 29889, 1639, 8726, 1053, 306, 5292, 1907, 29892, 306, 6691, 7514, 29892, 306, 6691, 13, 3166, 16077, 331, 562, 29889, 7328, 2909, 29889, 1639, 8726, 1053, 306, 3073, 29892, 306, 7514, 10486, 13, 3166, 16077, 331, 562, 29889, 7328, 2909, 29889, 1639, 8726, 1053, 306, 3073, 7281, 2133, 13, 3166, 16077, 331, 562, 29889, 7328, 2909, 29889, 1639, 8726, 1053, 306, 9861, 4557, 29892, 5641, 1330, 29892, 306, 2558, 1742, 13, 3166, 16077, 331, 562, 29889, 7328, 2909, 29889, 1639, 8726, 1053, 306, 2659, 3073, 10486, 13, 3166, 16077, 331, 562, 29889, 7328, 2909, 29889, 13424, 1053, 11451, 3057, 7264, 23444, 10486, 13, 3166, 16077, 331, 562, 29889, 7328, 2909, 29889, 21150, 29889, 535, 615, 342, 1053, 3553, 468, 29892, 306, 29968, 29893, 547, 29892, 476, 29893, 547, 13, 5215, 28152, 13, 5215, 11451, 1688, 13, 5215, 503, 2300, 29889, 9700, 13, 5215, 503, 2300, 29889, 9700, 29889, 1251, 12117, 13, 5215, 503, 2300, 29889, 13248, 13, 5215, 503, 2300, 29889, 13248, 29889, 27902, 13, 5215, 503, 2300, 29889, 11010, 13, 5215, 503, 2300, 29889, 11010, 29889, 1639, 8726, 13, 13, 13, 29937, 5798, 1934, 13, 13, 23397, 29918, 22364, 353, 518, 29884, 29915, 10532, 742, 13, 462, 318, 29915, 2490, 284, 3211, 742, 13, 462, 318, 29915, 6710, 1353, 742, 13, 462, 318, 29915, 29872, 29899, 2549, 3211, 742, 13, 462, 318, 29915, 5184, 1813, 3211, 2033, 13, 13, 13, 29937, 383, 29875, 486, 1973, 13, 13, 29992, 2272, 1688, 29889, 7241, 15546, 29898, 6078, 2433, 2220, 1495, 13, 1753, 7855, 7514, 29898, 7328, 29918, 2909, 1125, 13, 1678, 9995, 2577, 278, 7855, 1797, 19725, 1213, 15945, 13, 1678, 736, 503, 2300, 29889, 9700, 29889, 657, 7270, 537, 29898, 29902, 6691, 7514, 29897, 13, 13, 13, 29992, 2272, 1688, 29889, 7241, 15546, 29898, 6078, 2433, 5453, 1495, 13, 1753, 9815, 6691, 7295, 13, 1678, 9995, 2577, 385, 7855, 607, 338, 451, 2998, 297, 278, 3211, 3143, 1213, 15945, 13, 1678, 736, 14945, 29898, 29884, 29915, 742, 306, 5292, 1907, 29892, 525, 293, 331, 562, 29889, 7328, 2909, 29889, 296, 1907, 29889, 5292, 1907, 1495, 13, 13, 13, 29992, 2272, 1688, 29889, 7241, 15546, 29898, 6078, 2433, 2220, 1495, 13, 1753, 13114, 6691, 29898, 7328, 29918, 2909, 1125, 13, 1678, 9995, 2577, 385, 7855, 607, 338, 451, 15443, 297, 278, 3211, 3143, 1213, 15945, 13, 1678, 736, 306, 6691, 29898, 29902, 5292, 1907, 29897, 13, 13, 13, 29992, 2272, 1688, 29889, 7241, 15546, 29898, 6078, 2433, 2220, 1495, 13, 1753, 1746, 7295, 13, 1678, 9995, 2577, 263, 1404, 3342, 1746, 1213, 15945, 13, 1678, 1746, 353, 8989, 580, 13, 1678, 1746, 29889, 1853, 353, 525, 1626, 3542, 29915, 13, 1678, 736, 1746, 13, 13, 13, 29992, 2272, 1688, 29889, 7241, 15546, 29898, 6078, 2433, 2220, 1495, 13, 1753, 10938, 1891, 29918, 2671, 29898, 2671, 1125, 13, 1678, 9995, 2577, 263, 1404, 3342, 1746, 23430, 304, 263, 421, 29920, 2300, 29889, 11010, 29952, 1746, 1213, 15945, 13, 1678, 736, 503, 2300, 29889, 11010, 29889, 1639, 8726, 29889, 29902, 3073, 29898, 2671, 29897, 13, 13, 13, 29992, 2272, 1688, 29889, 7241, 15546, 29898, 6078, 2433, 2220, 1495, 13, 1753, 7855, 7295, 13, 1678, 9995, 2577, 263, 2888, 7855, 1213, 15945, 13, 1678, 736, 14945, 29898, 13, 4706, 318, 29915, 29928, 11770, 742, 3553, 11770, 29892, 525, 293, 331, 562, 29889, 7328, 2909, 29889, 21150, 29889, 1688, 29918, 296, 1907, 29889, 29928, 11770, 1495, 13, 13, 13, 29992, 2272, 1688, 29889, 7241, 15546, 29898, 6078, 2433, 2220, 1495, 13, 1753, 7855, 29918, 2541, 29918, 2671, 29898, 7328, 29918, 2909, 29892, 7855, 29892, 1746, 1125, 13, 1678, 9995, 2577, 263, 2888, 7855, 411, 263, 1404, 3342, 1746, 1213, 15945, 13, 1678, 7855, 29889, 1202, 3073, 29898, 2671, 29897, 13, 1678, 736, 7855, 13, 13, 13, 29992, 2272, 1688, 29889, 7241, 15546, 29898, 6078, 2433, 2220, 1495, 13, 1753, 16212, 29898, 7328, 29918, 2909, 1125, 13, 1678, 9995, 2577, 278, 16212, 19725, 1213, 15945, 13, 1678, 736, 503, 2300, 29889, 9700, 29889, 657, 7270, 537, 29898, 29902, 5292, 1907, 29897, 13, 13, 13, 29992, 2272, 1688, 29889, 29891, 969, 29918, 7241, 15546, 29898, 6078, 2433, 2220, 1495, 13, 1753, 3876, 29918, 12083, 29898, 29920, 10396, 29903, 1125, 13, 1678, 9995, 2577, 278, 3876, 4138, 310, 278, 796, 29949, 4051, 1213, 15945, 13, 1678, 363, 3957, 297, 11451, 3057, 7264, 23444, 10486, 29898, 29920, 10396, 29903, 29892, 525, 4632, 29918, 12083, 29374, 13, 4706, 7709, 3957, 29889, 4632, 12924, 13, 13, 13, 29937, 6162, 546, 4413, 13, 13, 13, 1990, 3553, 11770, 29898, 29920, 2300, 29889, 13248, 29889, 10448, 1125, 13, 1678, 9995, 10448, 363, 1243, 7855, 1213, 15945, 13, 13, 1678, 20254, 353, 503, 2300, 29889, 11010, 29889, 1626, 29898, 3257, 29922, 29884, 29915, 29881, 11770, 1495, 13, 1678, 20254, 29906, 353, 503, 2300, 29889, 11010, 29889, 1626, 29898, 3257, 29922, 29884, 29915, 29881, 11770, 29906, 1495, 13, 13, 13, 29992, 29920, 2300, 29889, 13248, 29889, 326, 2037, 261, 29898, 1367, 11770, 29897, 13, 1990, 360, 11770, 29898, 3318, 1125, 13, 1678, 9995, 3057, 7855, 1213, 15945, 13, 13, 13, 29937, 6162, 546, 3168, 13, 13, 1753, 679, 6330, 5292, 1907, 29918, 23545, 793, 29898, 24582, 1125, 13, 1678, 9995, 11609, 278, 16212, 17735, 746, 5432, 421, 657, 6330, 5292, 1907, 2555, 1213, 15945, 13, 1678, 16212, 353, 503, 2300, 29889, 9700, 29889, 657, 7270, 537, 29898, 29902, 5292, 1907, 29897, 13, 1678, 736, 518, 29916, 29889, 3257, 363, 921, 297, 16212, 29889, 657, 6330, 5292, 1907, 29898, 24582, 29922, 24582, 4638, 13, 13, 13, 29937, 4321, 29879, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 5292, 1907, 1649, 29896, 7295, 13, 1678, 5124, 6937, 5292, 1907, 29952, 6095, 5589, 29879, 278, 421, 29902, 5292, 1907, 29952, 5067, 1213, 15945, 13, 1678, 503, 2300, 29889, 13248, 29889, 27902, 29889, 27902, 2061, 29898, 29902, 5292, 1907, 29892, 4284, 1907, 3101, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 15136, 9696, 5292, 1907, 1649, 29896, 7295, 13, 1678, 5124, 6937, 15136, 9696, 5292, 1907, 29952, 6095, 5589, 29879, 278, 421, 29902, 5292, 1907, 29952, 5067, 1213, 15945, 13, 1678, 503, 2300, 29889, 13248, 29889, 27902, 29889, 27902, 2061, 29898, 29902, 5292, 1907, 29892, 9034, 9696, 5292, 1907, 3101, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 6691, 7514, 1649, 29896, 7295, 13, 1678, 5124, 6937, 6691, 7514, 29952, 6095, 5589, 29879, 278, 421, 29902, 6691, 7514, 29952, 5067, 1213, 15945, 13, 1678, 503, 2300, 29889, 13248, 29889, 27902, 29889, 27902, 2061, 29898, 29902, 6691, 7514, 29892, 14945, 7514, 3101, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 3073, 1649, 29896, 7295, 13, 1678, 5124, 6937, 3073, 29952, 6095, 5589, 29879, 278, 421, 29902, 3073, 29952, 5067, 1213, 15945, 13, 1678, 503, 2300, 29889, 13248, 29889, 27902, 29889, 27902, 2061, 29898, 29902, 3073, 29892, 8989, 3101, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 6691, 1649, 29896, 7295, 13, 1678, 5124, 6937, 6691, 29952, 6095, 5589, 29879, 278, 421, 29902, 6691, 29952, 5067, 1213, 15945, 13, 1678, 7855, 353, 14945, 29898, 8516, 29892, 306, 6691, 29892, 525, 6691, 1495, 13, 1678, 503, 2300, 29889, 13248, 29889, 27902, 29889, 27902, 2061, 29898, 29902, 6691, 29892, 7855, 29897, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 657, 5292, 1907, 1649, 29896, 29898, 303, 431, 13685, 7514, 29892, 19281, 5292, 1907, 1125, 13, 1678, 5124, 6937, 29898, 15136, 9696, 29897, 5292, 1907, 29889, 657, 5292, 1907, 2555, 3639, 16212, 12705, 29889, 13, 13, 1678, 450, 2656, 1797, 338, 3342, 297, 278, 2656, 1797, 8635, 29889, 13, 1678, 9995, 13, 1678, 321, 353, 19281, 5292, 1907, 13, 1678, 4974, 518, 29872, 29889, 4117, 29892, 321, 29889, 11022, 547, 29892, 321, 29889, 700, 384, 29962, 1275, 321, 29889, 296, 1907, 29889, 657, 5292, 1907, 580, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 657, 5292, 1907, 1649, 29906, 29898, 303, 431, 5292, 1907, 1125, 13, 1678, 5124, 6937, 29898, 15136, 9696, 29897, 5292, 1907, 29889, 657, 5292, 1907, 2555, 1795, 736, 16212, 443, 24582, 1213, 15945, 13, 1678, 321, 353, 19281, 5292, 1907, 13, 1678, 4974, 313, 842, 4197, 29872, 29889, 11022, 547, 29892, 321, 29889, 700, 384, 29892, 321, 29889, 4117, 2314, 1275, 13, 9651, 731, 29898, 29872, 29889, 296, 1907, 29889, 657, 5292, 1907, 29898, 24582, 29922, 8824, 4961, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 657, 5292, 1907, 1649, 29941, 29898, 303, 431, 13685, 7514, 29892, 19281, 5292, 1907, 1125, 13, 1678, 5124, 6937, 29898, 15136, 9696, 29897, 5292, 1907, 29889, 657, 5292, 1907, 2555, 3390, 29879, 3620, 297, 2656, 1797, 1213, 15945, 13, 1678, 321, 353, 19281, 5292, 1907, 13, 1678, 19281, 13685, 7514, 29889, 786, 29898, 29872, 29889, 700, 384, 29897, 13, 1678, 4974, 518, 29872, 29889, 4117, 29892, 321, 29889, 700, 384, 29892, 321, 29889, 11022, 547, 29962, 1275, 321, 29889, 296, 1907, 29889, 657, 5292, 1907, 580, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 15136, 9696, 5292, 1907, 1649, 657, 6330, 5292, 1907, 1649, 29896, 29898, 7328, 29918, 2909, 1125, 13, 1678, 9995, 2059, 2322, 278, 1121, 310, 421, 657, 6330, 5292, 1907, 2555, 338, 2656, 7417, 1213, 15945, 13, 1678, 4974, 22236, 29918, 22364, 1275, 679, 6330, 5292, 1907, 29918, 23545, 793, 29898, 5574, 29897, 13, 1678, 4974, 22236, 29918, 22364, 1275, 679, 6330, 5292, 1907, 29918, 23545, 793, 29898, 8824, 29897, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 15136, 9696, 5292, 1907, 1649, 657, 6330, 5292, 1907, 1649, 29906, 29898, 10041, 7514, 1125, 13, 1678, 5124, 6937, 657, 6330, 5292, 1907, 2555, 3390, 29879, 263, 3939, 2656, 1797, 1213, 15945, 13, 1678, 7855, 7514, 29889, 786, 29898, 29902, 6691, 29898, 29902, 9861, 4557, 876, 13, 1678, 4974, 9310, 29884, 29915, 10532, 742, 13, 632, 318, 29915, 6710, 1353, 742, 13, 632, 318, 29915, 2490, 284, 3211, 742, 13, 632, 318, 29915, 29872, 29899, 2549, 3211, 742, 13, 632, 318, 29915, 5184, 1813, 3211, 2033, 1275, 679, 6330, 5292, 1907, 29918, 23545, 793, 29898, 5574, 876, 13, 1678, 396, 450, 443, 21693, 17305, 1603, 3639, 278, 2322, 1797, 29901, 13, 1678, 4974, 22236, 29918, 22364, 1275, 679, 6330, 5292, 1907, 29918, 23545, 793, 29898, 8824, 29897, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 6691, 7514, 1649, 657, 1649, 29896, 29898, 10041, 7514, 1125, 13, 1678, 5124, 6937, 657, 2555, 3639, 278, 2602, 310, 278, 7855, 1213, 15945, 13, 1678, 4974, 29871, 29896, 1275, 7855, 7514, 29889, 657, 29898, 29902, 6691, 29898, 5690, 1330, 876, 13, 1678, 4974, 29871, 29947, 1275, 7855, 7514, 29889, 657, 29898, 29902, 6691, 29898, 29902, 2558, 1742, 876, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 6691, 7514, 1649, 657, 1649, 29906, 29898, 10041, 7514, 29892, 9815, 6691, 1125, 13, 1678, 5124, 6937, 657, 2555, 1153, 4637, 263, 7670, 2392, 565, 7855, 338, 451, 2998, 304, 278, 2656, 1797, 1213, 15945, 13, 1678, 411, 11451, 1688, 29889, 336, 4637, 29898, 2558, 2392, 1125, 13, 4706, 7855, 7514, 29889, 657, 29898, 26690, 6691, 29897, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 6691, 7514, 1649, 657, 1649, 29941, 29898, 10041, 7514, 29892, 13114, 6691, 1125, 13, 1678, 5124, 6937, 657, 2555, 1153, 4637, 263, 7670, 2392, 565, 278, 7855, 756, 694, 1024, 1213, 15945, 13, 1678, 411, 11451, 1688, 29889, 336, 4637, 29898, 2558, 2392, 1125, 13, 4706, 7855, 7514, 29889, 657, 29898, 1195, 3039, 6691, 29897, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 6691, 7514, 1649, 657, 1649, 29946, 29898, 10041, 7514, 29892, 16428, 10967, 5126, 1125, 13, 1678, 9995, 3112, 2130, 267, 278, 3211, 3143, 297, 421, 29920, 2300, 29889, 9700, 29889, 1251, 12117, 29889, 2746, 29952, 1213, 15945, 13, 1678, 916, 29918, 7328, 29918, 2909, 353, 16428, 10967, 5126, 877, 1228, 29918, 7328, 29918, 2909, 1495, 13, 1678, 396, 678, 6916, 297, 385, 3211, 3143, 2023, 13, 1678, 2022, 353, 306, 6691, 29898, 5690, 1330, 29897, 13, 1678, 4974, 29871, 29896, 1275, 7855, 7514, 29889, 657, 29898, 10532, 29897, 13, 1678, 7855, 7514, 29889, 3204, 29898, 10532, 29897, 13, 1678, 4974, 29871, 29906, 1275, 7855, 7514, 29889, 657, 29898, 10532, 29897, 13, 1678, 396, 2023, 526, 451, 25312, 297, 1790, 3211, 3143, 29901, 13, 1678, 411, 503, 2300, 29889, 9700, 29889, 1251, 12117, 29889, 2746, 29898, 1228, 29918, 7328, 29918, 2909, 1125, 13, 4706, 4974, 29871, 29896, 1275, 7855, 7514, 29889, 657, 29898, 10532, 29897, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 6691, 7514, 1649, 657, 1649, 29945, 29898, 10041, 7514, 1125, 13, 1678, 5124, 6937, 657, 2555, 1153, 4637, 263, 15924, 14959, 786, 2392, 565, 694, 3268, 338, 731, 1213, 15945, 13, 1678, 2022, 353, 306, 6691, 29898, 5690, 1330, 29897, 13, 1678, 411, 503, 2300, 29889, 9700, 29889, 1251, 12117, 29889, 2746, 29898, 8516, 1125, 13, 4706, 411, 11451, 1688, 29889, 336, 4637, 29898, 29920, 2300, 29889, 9700, 29889, 5308, 14959, 786, 2392, 1125, 13, 9651, 7855, 7514, 29889, 657, 29898, 10532, 29897, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 6691, 7514, 1649, 275, 6730, 1649, 29896, 29898, 10041, 7514, 1125, 13, 1678, 5124, 6937, 275, 6730, 2555, 3639, 421, 5574, 29952, 363, 278, 937, 7855, 1213, 15945, 13, 1678, 4974, 7855, 7514, 29889, 275, 6730, 29898, 29902, 6691, 29898, 29902, 7061, 10967, 876, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 6691, 7514, 1649, 275, 6730, 1649, 29906, 29898, 10041, 7514, 1125, 13, 1678, 5124, 6937, 275, 6730, 2555, 3639, 421, 8824, 29952, 363, 385, 7855, 607, 338, 451, 278, 937, 1213, 15945, 13, 1678, 4974, 451, 7855, 7514, 29889, 275, 6730, 29898, 29902, 6691, 29898, 29902, 9861, 4557, 876, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 6691, 7514, 1649, 275, 6730, 1649, 29941, 29898, 10041, 7514, 29892, 9815, 6691, 1125, 13, 1678, 5124, 6937, 275, 6730, 2555, 1153, 4637, 7670, 2392, 565, 7855, 338, 451, 2998, 304, 278, 2656, 1797, 1213, 15945, 13, 1678, 411, 11451, 1688, 29889, 336, 4637, 29898, 2558, 2392, 1125, 13, 4706, 7855, 7514, 29889, 275, 6730, 29898, 26690, 6691, 29897, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 6691, 7514, 1649, 275, 6730, 1649, 29946, 29898, 10041, 7514, 29892, 13114, 6691, 1125, 13, 1678, 5124, 6937, 275, 6730, 2555, 1153, 4637, 7670, 2392, 565, 278, 7855, 756, 694, 1024, 1213, 15945, 13, 1678, 411, 11451, 1688, 29889, 336, 4637, 29898, 2558, 2392, 1125, 13, 4706, 7855, 7514, 29889, 275, 6730, 29898, 1195, 3039, 6691, 29897, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 6691, 7514, 1649, 275, 8897, 1649, 29896, 29898, 10041, 7514, 1125, 13, 1678, 5124, 6937, 275, 8897, 2555, 3639, 421, 5574, 29952, 363, 278, 937, 7855, 1213, 15945, 13, 1678, 4974, 7855, 7514, 29889, 275, 8897, 29898, 29902, 6691, 29898, 29902, 2558, 1742, 876, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 6691, 7514, 1649, 275, 8897, 1649, 29906, 29898, 10041, 7514, 1125, 13, 1678, 5124, 6937, 275, 8897, 2555, 3639, 421, 8824, 29952, 363, 385, 7855, 607, 338, 451, 278, 937, 1213, 15945, 13, 1678, 4974, 451, 7855, 7514, 29889, 275, 8897, 29898, 29902, 6691, 29898, 29902, 9861, 4557, 876, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 6691, 7514, 1649, 275, 8897, 1649, 29941, 29898, 10041, 7514, 29892, 9815, 6691, 1125, 13, 1678, 5124, 6937, 275, 8897, 2555, 1153, 4637, 7670, 2392, 565, 7855, 338, 451, 2998, 304, 278, 2656, 1797, 1213, 15945, 13, 1678, 411, 11451, 1688, 29889, 336, 4637, 29898, 2558, 2392, 1125, 13, 4706, 7855, 7514, 29889, 275, 8897, 29898, 26690, 6691, 29897, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 6691, 7514, 1649, 275, 8897, 1649, 29946, 29898, 10041, 7514, 29892, 13114, 6691, 1125, 13, 1678, 5124, 6937, 275, 8897, 2555, 1153, 4637, 7670, 2392, 565, 278, 7855, 756, 694, 1024, 1213, 15945, 13, 1678, 411, 11451, 1688, 29889, 336, 4637, 29898, 2558, 2392, 1125, 13, 4706, 7855, 7514, 29889, 275, 8897, 29898, 1195, 3039, 6691, 29897, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 6691, 7514, 7652, 1524, 7652, 29896, 29898, 10041, 7514, 1125, 13, 1678, 9995, 3112, 338, 4256, 519, 29892, 7863, 7855, 2983, 1213, 15945, 13, 1678, 4974, 9310, 13, 4706, 525, 29902, 19335, 562, 7061, 2909, 7061, 2909, 7061, 2909, 742, 13, 4706, 525, 29902, 19335, 562, 7061, 2909, 7435, 7435, 742, 13, 4706, 525, 29902, 19335, 562, 7061, 2909, 7435, 7435, 4381, 29879, 742, 13, 4706, 525, 29902, 19335, 562, 7061, 2909, 7061, 6747, 284, 7328, 742, 13, 4706, 525, 29902, 19335, 562, 7061, 2909, 7061, 4819, 19131, 2807, 742, 13, 4706, 525, 29902, 19335, 562, 7061, 2909, 7061, 9823, 7328, 742, 13, 4706, 525, 29902, 19335, 562, 7061, 2909, 7061, 11184, 3488, 7328, 742, 13, 4706, 525, 29902, 19335, 562, 7061, 2909, 2283, 2283, 2283, 742, 13, 4706, 525, 29902, 19335, 562, 7061, 2909, 2558, 1742, 2558, 1742, 742, 13, 1678, 4514, 1275, 1051, 29898, 1524, 29898, 10041, 7514, 4961, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 6691, 7514, 1649, 786, 1649, 29896, 29898, 10041, 7514, 1125, 13, 1678, 5124, 6937, 786, 2555, 6153, 697, 2602, 701, 1213, 15945, 13, 1678, 2022, 353, 306, 6691, 29898, 5690, 1330, 29897, 13, 1678, 4974, 29871, 29896, 1275, 7855, 7514, 29889, 657, 29898, 10532, 29897, 13, 1678, 7855, 7514, 29889, 786, 29898, 10532, 29897, 13, 1678, 4974, 29871, 29900, 1275, 7855, 7514, 29889, 657, 29898, 10532, 29897, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 6691, 7514, 1649, 786, 1649, 29906, 29898, 10041, 7514, 1125, 13, 1678, 5124, 6937, 786, 29898, 29876, 3569, 16229, 302, 11909, 701, 1213, 15945, 13, 1678, 298, 29886, 353, 306, 6691, 29898, 29902, 11184, 5074, 7061, 29897, 13, 1678, 4974, 29871, 29953, 1275, 7855, 7514, 29889, 657, 29898, 28887, 29897, 13, 1678, 7855, 7514, 29889, 786, 29898, 28887, 29892, 29871, 29941, 29897, 13, 1678, 4974, 29871, 29941, 1275, 7855, 7514, 29889, 657, 29898, 28887, 29897, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 6691, 7514, 1649, 786, 1649, 29941, 29898, 10041, 7514, 1125, 13, 1678, 9995, 3644, 278, 19471, 338, 2086, 4802, 746, 5432, 421, 786, 2555, 263, 7865, 2392, 338, 10425, 1213, 15945, 13, 1678, 2022, 353, 306, 6691, 29898, 5690, 1330, 29897, 13, 1678, 4974, 29871, 29896, 1275, 7855, 7514, 29889, 657, 29898, 10532, 29897, 13, 1678, 411, 11451, 1688, 29889, 336, 4637, 29898, 1917, 2392, 1125, 13, 4706, 7855, 7514, 29889, 786, 29898, 10532, 29892, 29871, 29906, 29897, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 6691, 7514, 1649, 3204, 1649, 29896, 29898, 10041, 7514, 1125, 13, 1678, 5124, 6937, 3204, 2555, 6153, 697, 2602, 1623, 1213, 15945, 13, 1678, 2022, 353, 306, 6691, 29898, 5690, 1330, 29897, 13, 1678, 4974, 29871, 29896, 1275, 7855, 7514, 29889, 657, 29898, 10532, 29897, 13, 1678, 7855, 7514, 29889, 3204, 29898, 10532, 29897, 13, 1678, 4974, 29871, 29906, 1275, 7855, 7514, 29889, 657, 29898, 10532, 29897, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 6691, 7514, 1649, 3204, 1649, 29906, 29898, 10041, 7514, 1125, 13, 1678, 5124, 6937, 3204, 29898, 29876, 3569, 16229, 302, 11909, 1623, 1213, 15945, 13, 1678, 633, 353, 306, 6691, 29898, 29902, 7061, 10967, 29897, 13, 1678, 4974, 29871, 29900, 1275, 7855, 7514, 29889, 657, 29898, 370, 29897, 13, 1678, 7855, 7514, 29889, 3204, 29898, 370, 29892, 29871, 29941, 29897, 13, 1678, 4974, 29871, 29941, 1275, 7855, 7514, 29889, 657, 29898, 370, 29897, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 6691, 7514, 1649, 3204, 1649, 29941, 29898, 10041, 7514, 1125, 13, 1678, 9995, 3644, 278, 19471, 338, 2086, 4802, 746, 5432, 421, 3204, 2555, 263, 7865, 2392, 338, 10425, 1213, 15945, 13, 1678, 2022, 353, 306, 6691, 29898, 5690, 1330, 29897, 13, 1678, 4974, 29871, 29896, 1275, 7855, 7514, 29889, 657, 29898, 10532, 29897, 13, 1678, 411, 11451, 1688, 29889, 336, 4637, 29898, 1917, 2392, 1125, 13, 4706, 7855, 7514, 29889, 3204, 29898, 10532, 29892, 29871, 29947, 29897, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 10041, 29918, 1609, 29918, 978, 1649, 29896, 29898, 303, 431, 5292, 1907, 29892, 7855, 3253, 481, 2153, 1125, 13, 1678, 5124, 6937, 10041, 29918, 1609, 29918, 978, 29952, 1153, 4637, 263, 421, 1917, 2392, 29952, 565, 1347, 1024, 338, 9815, 1213, 15945, 13, 1678, 411, 11451, 1688, 29889, 336, 4637, 29898, 1917, 2392, 1125, 13, 4706, 306, 6691, 877, 294, 2176, 1495, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 10041, 29918, 1609, 29918, 978, 1649, 29906, 29898, 303, 431, 5292, 1907, 29892, 7855, 3253, 481, 2153, 1125, 13, 1678, 5124, 6937, 10041, 29918, 1609, 29918, 978, 29952, 1153, 4637, 263, 421, 1917, 2392, 29952, 565, 29104, 1024, 338, 9815, 1213, 15945, 13, 1678, 411, 11451, 1688, 29889, 336, 4637, 29898, 1917, 2392, 1125, 13, 4706, 306, 6691, 29898, 29884, 29915, 294, 2176, 1495, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 10041, 29918, 1609, 29918, 978, 1649, 29941, 29898, 303, 431, 5292, 1907, 29892, 7855, 3253, 481, 2153, 1125, 13, 1678, 5124, 6937, 10041, 29918, 1609, 29918, 978, 29952, 1153, 4637, 263, 421, 1917, 2392, 29952, 565, 770, 1024, 338, 1304, 1213, 15945, 13, 1678, 411, 11451, 1688, 29889, 336, 4637, 29898, 1917, 2392, 1125, 13, 4706, 306, 6691, 877, 293, 331, 562, 29889, 7328, 2909, 29889, 21150, 29889, 303, 23954, 29889, 29928, 2707, 1495, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 10041, 29918, 1609, 29918, 978, 1649, 29946, 29898, 303, 431, 5292, 1907, 29892, 7855, 3253, 481, 2153, 1125, 13, 1678, 5124, 6937, 10041, 29918, 1609, 29918, 978, 29952, 1153, 4637, 263, 421, 1917, 2392, 29952, 565, 770, 1024, 338, 1304, 1213, 15945, 13, 1678, 411, 11451, 1688, 29889, 336, 4637, 29898, 1917, 2392, 1125, 13, 4706, 306, 6691, 877, 293, 331, 562, 29889, 7328, 2909, 29889, 21150, 29889, 535, 615, 342, 29889, 29928, 2707, 1495, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 10041, 29918, 1609, 29918, 978, 1649, 29945, 29898, 303, 431, 5292, 1907, 29892, 7855, 3253, 481, 2153, 1125, 13, 1678, 5124, 6937, 10041, 29918, 1609, 29918, 978, 29952, 7744, 29879, 515, 1347, 7855, 1024, 1213, 15945, 13, 1678, 4974, 19281, 5292, 1907, 29889, 700, 384, 1275, 306, 6691, 877, 29902, 19335, 562, 7061, 2909, 24376, 1168, 615, 342, 29928, 2707, 1495, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 10041, 29918, 1609, 29918, 978, 1649, 29953, 29898, 303, 431, 5292, 1907, 29892, 7855, 3253, 481, 2153, 1125, 13, 1678, 5124, 6937, 10041, 29918, 1609, 29918, 978, 29952, 7744, 29879, 515, 29104, 7855, 1024, 1213, 15945, 13, 1678, 4974, 19281, 5292, 1907, 29889, 700, 384, 1275, 306, 6691, 29898, 29884, 29915, 29902, 19335, 562, 7061, 2909, 24376, 1168, 615, 342, 29928, 2707, 1495, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 10041, 29918, 1609, 29918, 13248, 1649, 29896, 29898, 303, 431, 5292, 1907, 29892, 7855, 3253, 481, 2153, 1125, 13, 1678, 5124, 6937, 10041, 29918, 1609, 29918, 13248, 29952, 3639, 263, 13114, 7855, 363, 9815, 5067, 1213, 15945, 13, 1678, 7855, 353, 306, 6691, 29898, 1367, 468, 29897, 13, 1678, 4974, 6213, 338, 7855, 29889, 3257, 13, 1678, 4974, 3553, 468, 338, 7855, 29889, 13248, 13, 1678, 4974, 6213, 338, 7855, 29889, 1990, 29918, 978, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 10041, 29918, 1609, 29918, 13248, 1649, 29906, 29898, 303, 431, 5292, 1907, 29892, 7855, 3253, 481, 2153, 1125, 13, 1678, 5124, 6937, 10041, 29918, 1609, 29918, 13248, 29952, 3639, 278, 7855, 363, 263, 2998, 5067, 1213, 15945, 13, 1678, 4974, 19281, 5292, 1907, 29889, 11022, 547, 1275, 306, 6691, 29898, 23328, 29893, 547, 29897, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 10041, 29918, 1609, 29918, 5415, 1649, 29896, 29898, 303, 431, 5292, 1907, 29892, 7855, 3253, 481, 2153, 1125, 13, 1678, 5124, 6937, 10041, 29918, 1609, 29918, 5415, 29952, 1153, 4637, 263, 7865, 2392, 363, 385, 9815, 2777, 1213, 15945, 13, 1678, 5446, 353, 28152, 29889, 15136, 9696, 580, 13, 1678, 411, 11451, 1688, 29889, 336, 4637, 29898, 1917, 2392, 1125, 13, 4706, 306, 6691, 29898, 5415, 29897, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 10041, 29918, 1609, 29918, 5415, 1649, 29906, 29898, 303, 431, 5292, 1907, 29892, 7855, 3253, 481, 2153, 1125, 13, 1678, 5124, 6937, 10041, 29918, 1609, 29918, 5415, 29952, 3639, 278, 2777, 363, 263, 2998, 2777, 1213, 15945, 13, 1678, 4974, 19281, 5292, 1907, 29889, 11022, 547, 1275, 306, 6691, 29898, 29968, 29893, 547, 3101, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 6691, 1649, 1202, 3073, 1649, 29896, 29898, 296, 1907, 29892, 7855, 29892, 1746, 1125, 13, 1678, 9995, 3112, 12778, 263, 1746, 304, 385, 7855, 1213, 15945, 13, 1678, 7855, 29889, 1202, 3073, 29898, 2671, 29897, 13, 1678, 4974, 6024, 3073, 29899, 29896, 2033, 1275, 1051, 29898, 296, 1907, 29889, 8149, 3101, 13, 1678, 4974, 1746, 338, 16212, 29961, 29884, 29915, 3073, 29899, 29896, 2033, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 6691, 1649, 1202, 3073, 1649, 29906, 29898, 296, 1907, 29892, 7855, 29892, 1746, 1125, 13, 1678, 9995, 3112, 14422, 278, 5067, 310, 278, 7855, 373, 278, 1746, 1213, 15945, 13, 1678, 7855, 29889, 1202, 3073, 29898, 2671, 29897, 13, 1678, 4974, 3553, 11770, 1275, 16212, 29961, 29884, 29915, 3073, 29899, 29896, 13359, 13248, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 6691, 1649, 1202, 3073, 1649, 29941, 29898, 7328, 29918, 2909, 29892, 1746, 1125, 13, 1678, 9995, 3112, 28975, 385, 13304, 363, 278, 1746, 1213, 15945, 13, 1678, 3211, 29918, 2909, 29918, 10041, 29889, 1202, 3073, 29898, 2671, 29897, 13, 1678, 23430, 29918, 10041, 353, 503, 2300, 29889, 9700, 29889, 657, 15329, 6168, 29898, 13, 4706, 313, 7328, 29918, 2909, 29918, 10041, 29892, 3211, 29918, 2909, 511, 306, 3073, 29892, 1024, 29922, 29884, 29915, 3073, 29899, 29896, 1495, 13, 1678, 4974, 1746, 338, 23430, 29918, 10041, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 10041, 29918, 1454, 29918, 2671, 1649, 29896, 29898, 7328, 29918, 2909, 29892, 1746, 1125, 13, 1678, 9995, 3112, 7744, 29879, 263, 1746, 304, 967, 7855, 1213, 15945, 13, 1678, 3211, 29918, 2909, 29918, 10041, 29889, 1202, 3073, 29898, 2671, 29897, 13, 13, 1678, 23430, 29918, 2671, 353, 306, 6691, 29898, 2671, 29897, 13, 1678, 4974, 3211, 29918, 2909, 29918, 10041, 1275, 23430, 29918, 2671, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 6691, 1649, 5992, 3073, 1649, 29896, 29898, 296, 1907, 29892, 7855, 29918, 2541, 29918, 2671, 29892, 1746, 1125, 13, 1678, 9995, 3112, 25388, 263, 1746, 515, 385, 7855, 1213, 15945, 13, 1678, 4974, 1746, 297, 16212, 29889, 5975, 580, 13, 1678, 7855, 29918, 2541, 29918, 2671, 29889, 5992, 3073, 29898, 2671, 29897, 13, 1678, 4974, 1746, 451, 297, 16212, 29889, 5975, 580, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 6691, 1649, 5992, 3073, 1649, 29906, 29898, 10041, 29918, 2541, 29918, 2671, 29892, 1746, 1125, 13, 1678, 9995, 3112, 25388, 278, 5067, 310, 278, 7855, 515, 278, 1746, 1213, 15945, 13, 1678, 7855, 29918, 2541, 29918, 2671, 29889, 5992, 3073, 29898, 2671, 29897, 13, 1678, 4974, 1746, 29889, 13248, 338, 6213, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 6691, 1649, 5992, 3073, 1649, 29941, 29898, 10041, 29918, 2541, 29918, 2671, 29892, 1746, 1125, 13, 1678, 9995, 3112, 25388, 278, 13304, 21557, 800, 363, 278, 1746, 1213, 15945, 13, 1678, 7855, 29918, 2541, 29918, 2671, 29889, 5992, 3073, 29898, 2671, 29897, 13, 1678, 4974, 6213, 338, 503, 2300, 29889, 9700, 29889, 1972, 15329, 6168, 29898, 13, 4706, 313, 10041, 29892, 360, 11770, 25739, 306, 3073, 29892, 1024, 29922, 29884, 29915, 3073, 1495, 13, 1678, 4974, 6213, 338, 306, 6691, 29898, 2671, 29892, 6213, 29897, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 6691, 1649, 842, 3073, 7514, 1649, 29896, 29898, 10041, 29918, 2541, 29918, 2671, 29892, 1746, 1125, 13, 1678, 9995, 3112, 3620, 278, 2847, 313, 6310, 29897, 1797, 1213, 15945, 13, 1678, 4974, 5159, 1275, 7855, 29918, 2541, 29918, 2671, 29889, 657, 3073, 7514, 580, 13, 1678, 7855, 29918, 2541, 29918, 2671, 29889, 842, 3073, 7514, 18959, 29881, 11770, 29906, 742, 1746, 17255, 978, 1649, 29892, 525, 29881, 11770, 11287, 13, 1678, 4974, 313, 1839, 29881, 11770, 29906, 742, 1746, 17255, 978, 1649, 29892, 525, 29881, 11770, 2033, 1275, 13, 9651, 7855, 29918, 2541, 29918, 2671, 29889, 657, 3073, 7514, 3101, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 6691, 1649, 842, 3073, 7514, 1649, 29906, 29898, 10041, 29918, 2541, 29918, 2671, 1125, 13, 1678, 9995, 3112, 5330, 2361, 9815, 1746, 2983, 322, 947, 451, 3787, 963, 1213, 15945, 13, 1678, 7855, 353, 7855, 29918, 2541, 29918, 2671, 13, 1678, 7855, 29889, 842, 3073, 7514, 18959, 29881, 11770, 29906, 742, 525, 29902, 29899, 1867, 29899, 1333, 29899, 28997, 742, 525, 29881, 11770, 11287, 13, 1678, 4974, 6024, 29881, 11770, 29906, 742, 525, 29881, 11770, 2033, 1275, 7855, 29889, 657, 3073, 7514, 580, 13, 1678, 396, 853, 5203, 1746, 2983, 526, 451, 3971, 964, 8635, 29901, 13, 1678, 1797, 29918, 12925, 353, 503, 2300, 29889, 9700, 29889, 657, 7270, 537, 29898, 29902, 7514, 10486, 29897, 13, 1678, 4974, 313, 1839, 29881, 11770, 29906, 742, 525, 29881, 11770, 2033, 1275, 13, 9651, 1797, 29918, 12925, 29889, 1609, 23335, 29898, 10041, 29889, 2098, 29918, 12925, 29918, 22377, 876, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 6691, 1649, 657, 3073, 7514, 1649, 29896, 29898, 10041, 1125, 13, 1678, 9995, 3112, 3639, 278, 12919, 953, 29873, 2272, 1746, 1797, 1213, 15945, 13, 1678, 4974, 5159, 1275, 7855, 29889, 657, 3073, 7514, 580, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 6691, 1649, 657, 3073, 7514, 1649, 29906, 29898, 10041, 29918, 2541, 29918, 2671, 29892, 1746, 1125, 13, 1678, 9995, 3112, 871, 3743, 278, 1819, 731, 491, 421, 842, 3073, 7514, 29952, 1213, 15945, 13, 1678, 7855, 353, 7855, 29918, 2541, 29918, 2671, 13, 1678, 7855, 29889, 842, 3073, 7514, 4197, 2671, 17255, 978, 1649, 29892, 525, 29881, 11770, 11287, 13, 1678, 4974, 518, 2671, 17255, 978, 1649, 29892, 525, 29881, 11770, 2033, 1275, 7855, 29889, 657, 3073, 7514, 580, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 6691, 1649, 657, 3073, 7514, 1649, 29941, 29898, 7328, 29918, 2909, 1125, 13, 1678, 9995, 3112, 3639, 421, 2636, 29952, 565, 278, 7397, 2609, 367, 15712, 1213, 15945, 13, 1678, 396, 450, 7397, 297, 278, 1797, 19725, 7111, 373, 278, 1024, 310, 278, 13, 1678, 396, 7855, 607, 3528, 7111, 373, 278, 770, 29918, 978, 6087, 373, 278, 13, 1678, 396, 7855, 29889, 1205, 445, 770, 1024, 338, 13136, 29892, 577, 278, 1024, 1795, 451, 367, 13, 1678, 396, 2912, 519, 29901, 13, 1678, 7855, 353, 14945, 29898, 29884, 29915, 29928, 11770, 742, 3553, 11770, 29892, 6213, 29897, 13, 1678, 4974, 5159, 1275, 7855, 29889, 657, 3073, 7514, 580, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 6691, 1649, 978, 1649, 29896, 29898, 10041, 1125, 13, 1678, 5124, 6937, 978, 29952, 338, 278, 1024, 310, 278, 7855, 6943, 278, 3883, 2224, 1213, 15945, 13, 1678, 4974, 525, 29902, 19335, 562, 7061, 2909, 24376, 3057, 5292, 1907, 29928, 11770, 29915, 1275, 7855, 29889, 978, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 6691, 1649, 978, 1649, 29906, 29898, 7328, 29918, 2909, 1125, 13, 1678, 5124, 6937, 978, 29952, 1153, 4637, 263, 7865, 2392, 565, 694, 770, 1024, 338, 731, 1213, 15945, 13, 1678, 7855, 353, 14945, 29898, 8516, 29892, 3553, 11770, 29892, 6213, 29897, 13, 1678, 411, 11451, 1688, 29889, 336, 4637, 29898, 1917, 2392, 1125, 13, 4706, 7855, 29889, 978, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 6691, 1649, 657, 22131, 14256, 1649, 29896, 29898, 10041, 29918, 2541, 29918, 2671, 29892, 1746, 1125, 13, 1678, 5124, 6937, 657, 22131, 14256, 29952, 23551, 4235, 4567, 297, 2656, 1797, 304, 278, 1095, 1213, 15945, 13, 1678, 7855, 353, 7855, 29918, 2541, 29918, 2671, 13, 1678, 7855, 29889, 842, 3073, 7514, 4197, 2671, 17255, 978, 1649, 29892, 525, 29881, 11770, 11287, 13, 1678, 4974, 9310, 2671, 17255, 978, 1649, 29892, 525, 29881, 11770, 742, 525, 29881, 11770, 29906, 2033, 1275, 13, 9651, 518, 29916, 29961, 29900, 29962, 363, 921, 297, 7855, 29889, 657, 22131, 14256, 580, 2314, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 6691, 1649, 657, 22131, 14256, 1649, 29906, 29898, 10041, 29918, 2541, 29918, 2671, 29892, 1746, 1125, 13, 1678, 5124, 6937, 657, 22131, 14256, 29952, 3639, 278, 4235, 12705, 491, 278, 1746, 1797, 1213, 15945, 13, 1678, 7855, 353, 7855, 29918, 2541, 29918, 2671, 13, 1678, 7855, 29889, 842, 3073, 7514, 18959, 29881, 11770, 29906, 742, 1746, 17255, 978, 1649, 29892, 525, 29881, 11770, 11287, 13, 1678, 4974, 9310, 877, 29881, 11770, 29906, 742, 3553, 11770, 1839, 29881, 11770, 29906, 2033, 511, 13, 632, 313, 2671, 17255, 978, 1649, 29892, 1746, 511, 13, 632, 6702, 29881, 11770, 742, 3553, 11770, 1839, 29881, 11770, 2033, 4638, 1275, 1051, 29898, 10041, 29889, 657, 22131, 14256, 22130, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 6691, 1649, 657, 22131, 14256, 1649, 29941, 29898, 10041, 29918, 2541, 29918, 2671, 29892, 1746, 1125, 13, 1678, 5124, 6937, 657, 22131, 14256, 29952, 338, 2221, 304, 736, 278, 4235, 443, 24582, 313, 4381, 1797, 467, 13, 13, 1678, 1932, 421, 24582, 29952, 338, 421, 8824, 29952, 278, 421, 29920, 2300, 29889, 11010, 29952, 4235, 526, 4133, 937, 313, 1552, 13, 1678, 1797, 338, 3342, 491, 278, 1797, 297, 278, 5067, 29897, 322, 1135, 278, 1404, 3342, 13, 1678, 4235, 313, 2098, 338, 7580, 1244, 1846, 13, 1678, 9995, 13, 1678, 7855, 353, 7855, 29918, 2541, 29918, 2671, 13, 1678, 7855, 29889, 842, 3073, 7514, 18959, 29881, 11770, 29906, 742, 525, 3073, 742, 525, 29881, 11770, 11287, 13, 1678, 4974, 9310, 877, 29881, 11770, 742, 3553, 11770, 1839, 29881, 11770, 2033, 511, 13, 632, 6702, 29881, 11770, 29906, 742, 3553, 11770, 1839, 29881, 11770, 29906, 2033, 511, 13, 632, 313, 2671, 17255, 978, 1649, 29892, 1746, 4638, 1275, 13, 9651, 1051, 29898, 10041, 29889, 657, 22131, 14256, 29898, 24582, 29922, 8824, 4961, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 6691, 1649, 657, 14256, 1649, 29896, 29898, 10041, 29918, 2541, 29918, 2671, 29892, 10938, 1891, 29918, 2671, 1125, 13, 1678, 5124, 6937, 657, 14256, 29952, 3639, 599, 4235, 408, 421, 29920, 2300, 29889, 11010, 29952, 297, 1797, 1213, 15945, 13, 1678, 7855, 353, 7855, 29918, 2541, 29918, 2671, 13, 1678, 7855, 29889, 842, 3073, 7514, 18959, 29881, 11770, 29906, 742, 10938, 1891, 29918, 2671, 17255, 978, 1649, 29892, 525, 29881, 11770, 11287, 13, 1678, 4974, 9310, 877, 29881, 11770, 29906, 742, 3553, 11770, 1839, 29881, 11770, 29906, 2033, 511, 13, 632, 313, 11010, 1891, 29918, 2671, 17255, 978, 1649, 29892, 10938, 1891, 29918, 2671, 511, 13, 632, 6702, 29881, 11770, 742, 3553, 11770, 1839, 29881, 11770, 2033, 4638, 1275, 1051, 29898, 10041, 29889, 657, 14256, 22130, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 6691, 1649, 657, 14256, 1649, 29906, 29898, 10041, 29918, 2541, 29918, 2671, 29892, 10938, 1891, 29918, 2671, 1125, 13, 1678, 5124, 6937, 479, 14256, 29952, 338, 2221, 304, 736, 278, 4235, 443, 24582, 313, 4381, 1797, 467, 13, 13, 1678, 1932, 421, 24582, 29952, 338, 421, 8824, 29952, 278, 421, 29920, 2300, 29889, 11010, 29952, 4235, 526, 4133, 937, 313, 1552, 13, 1678, 1797, 338, 3342, 491, 278, 1797, 297, 278, 5067, 29897, 322, 769, 278, 1404, 3342, 13, 1678, 4235, 313, 2098, 338, 7580, 1244, 1846, 13, 1678, 9995, 13, 1678, 7855, 353, 7855, 29918, 2541, 29918, 2671, 13, 1678, 7855, 29889, 842, 3073, 7514, 18959, 29881, 11770, 29906, 742, 10938, 1891, 29918, 2671, 17255, 978, 1649, 29892, 525, 29881, 11770, 11287, 13, 1678, 4974, 9310, 877, 29881, 11770, 742, 3553, 11770, 1839, 29881, 11770, 2033, 511, 13, 632, 6702, 29881, 11770, 29906, 742, 3553, 11770, 1839, 29881, 11770, 29906, 2033, 511, 13, 632, 313, 11010, 1891, 29918, 2671, 17255, 978, 1649, 29892, 10938, 1891, 29918, 2671, 4638, 1275, 13, 9651, 1051, 29898, 10041, 29889, 657, 14256, 29898, 24582, 29922, 8824, 4961, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 6691, 1649, 657, 3073, 9065, 1649, 29896, 29898, 13, 4706, 7855, 29918, 2541, 29918, 2671, 29892, 10938, 1891, 29918, 2671, 1125, 13, 1678, 5124, 6937, 657, 3073, 9065, 29952, 3639, 599, 4235, 408, 421, 29920, 2300, 29889, 11010, 29952, 297, 1797, 1213, 15945, 13, 1678, 7855, 353, 7855, 29918, 2541, 29918, 2671, 13, 1678, 7855, 29889, 842, 3073, 7514, 18959, 29881, 11770, 29906, 742, 10938, 1891, 29918, 2671, 17255, 978, 1649, 29892, 525, 29881, 11770, 11287, 13, 1678, 4974, 9310, 1367, 11770, 1839, 29881, 11770, 29906, 7464, 10938, 1891, 29918, 2671, 29892, 3553, 11770, 1839, 29881, 11770, 2033, 29962, 1275, 13, 9651, 7855, 29889, 657, 3073, 9065, 3101, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 6691, 1649, 657, 3073, 9065, 1649, 29906, 29898, 13, 4706, 7855, 29918, 2541, 29918, 2671, 29892, 10938, 1891, 29918, 2671, 1125, 13, 1678, 5124, 6937, 657, 3073, 9065, 29952, 338, 2221, 304, 736, 278, 4235, 443, 24582, 313, 4381, 1797, 467, 13, 13, 1678, 1932, 421, 24582, 29952, 338, 421, 8824, 29952, 278, 421, 29920, 2300, 29889, 11010, 29952, 4235, 526, 4133, 937, 313, 1552, 13, 1678, 1797, 338, 3342, 491, 278, 1797, 297, 278, 5067, 29897, 322, 769, 278, 1404, 3342, 13, 1678, 4235, 313, 2098, 338, 7580, 1244, 1846, 13, 1678, 9995, 13, 1678, 7855, 353, 7855, 29918, 2541, 29918, 2671, 13, 1678, 7855, 29889, 842, 3073, 7514, 18959, 29881, 11770, 29906, 742, 10938, 1891, 29918, 2671, 17255, 978, 1649, 29892, 525, 29881, 11770, 11287, 13, 1678, 4974, 9310, 1367, 11770, 1839, 29881, 11770, 7464, 3553, 11770, 1839, 29881, 11770, 29906, 7464, 10938, 1891, 29918, 2671, 29962, 1275, 13, 9651, 7855, 29889, 657, 3073, 9065, 29898, 24582, 29922, 8824, 876, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 6691, 1649, 657, 3073, 1649, 29896, 29898, 10041, 1125, 13, 1678, 5124, 6937, 657, 3073, 29952, 1153, 4637, 263, 421, 2558, 2392, 29952, 363, 385, 9815, 1746, 1024, 1213, 15945, 13, 1678, 411, 11451, 1688, 29889, 336, 4637, 29898, 2558, 2392, 1125, 13, 4706, 7855, 29889, 657, 3073, 877, 294, 2176, 1495, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 6691, 1649, 657, 3073, 1649, 29906, 29898, 10041, 1125, 13, 1678, 5124, 6937, 657, 3073, 29952, 508, 736, 263, 421, 29920, 2300, 29889, 11010, 29952, 1746, 1213, 15945, 13, 1678, 4974, 3553, 11770, 1839, 29881, 11770, 29906, 2033, 1275, 7855, 29889, 657, 3073, 877, 29881, 11770, 29906, 1495, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 6691, 1649, 657, 3073, 1649, 29941, 29898, 10041, 29918, 2541, 29918, 2671, 29892, 10938, 1891, 29918, 2671, 1125, 13, 1678, 5124, 6937, 657, 3073, 29952, 508, 736, 263, 1404, 3342, 1746, 408, 421, 29920, 2300, 29889, 11010, 29952, 1746, 1213, 15945, 13, 1678, 4974, 313, 11010, 1891, 29918, 2671, 1275, 13, 9651, 7855, 29918, 2541, 29918, 2671, 29889, 657, 3073, 29898, 11010, 1891, 29918, 2671, 17255, 978, 1649, 876, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 6691, 1649, 657, 22131, 3073, 1649, 29896, 29898, 10041, 1125, 13, 1678, 5124, 6937, 657, 22131, 3073, 29952, 1153, 4637, 263, 421, 2558, 2392, 29952, 363, 385, 9815, 1746, 1024, 1213, 15945, 13, 1678, 411, 11451, 1688, 29889, 336, 4637, 29898, 2558, 2392, 1125, 13, 4706, 7855, 29889, 657, 22131, 3073, 877, 294, 2176, 1495, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 6691, 1649, 657, 22131, 3073, 1649, 29906, 29898, 10041, 1125, 13, 1678, 5124, 6937, 657, 22131, 3073, 29952, 508, 736, 263, 421, 29920, 2300, 29889, 11010, 29952, 1746, 1213, 15945, 13, 1678, 4974, 3553, 11770, 1839, 29881, 11770, 29906, 2033, 1275, 7855, 29889, 657, 22131, 3073, 877, 29881, 11770, 29906, 1495, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 6691, 1649, 657, 22131, 3073, 1649, 29941, 29898, 10041, 29918, 2541, 29918, 2671, 29892, 1746, 1125, 13, 1678, 5124, 6937, 657, 22131, 3073, 29952, 508, 736, 263, 1404, 3342, 1746, 1213, 15945, 13, 1678, 4974, 1746, 1275, 7855, 29918, 2541, 29918, 2671, 29889, 657, 22131, 3073, 29898, 2671, 17255, 978, 1649, 29897, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 6691, 1649, 657, 2385, 1649, 29896, 29898, 10041, 1125, 13, 1678, 5124, 6937, 657, 2385, 29952, 3639, 278, 770, 1203, 6942, 411, 278, 7855, 1213, 15945, 13, 1678, 4974, 360, 11770, 1275, 7855, 29889, 657, 2385, 580, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 6691, 1649, 657, 2385, 1649, 29906, 7295, 13, 1678, 5124, 6937, 657, 2385, 29952, 1153, 4637, 263, 421, 1917, 2392, 29952, 565, 694, 421, 1990, 29918, 978, 29952, 338, 731, 1213, 15945, 13, 1678, 321, 353, 14945, 29898, 8516, 29892, 3553, 11770, 29892, 6213, 29897, 13, 1678, 411, 11451, 1688, 29889, 336, 4637, 29898, 1917, 2392, 1125, 13, 4706, 321, 29889, 657, 2385, 580, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 6691, 1649, 4039, 3192, 29918, 5975, 1649, 29896, 7295, 13, 1678, 5124, 6937, 4039, 3192, 29918, 5975, 29952, 338, 263, 9657, 310, 278, 9049, 5085, 1304, 2645, 7855, 4770, 2344, 1649, 1213, 15945, 13, 1678, 321, 353, 14945, 29898, 29884, 29915, 29928, 11770, 742, 3553, 11770, 29892, 525, 29928, 11770, 742, 263, 29922, 29896, 29892, 289, 2433, 294, 2176, 1495, 13, 1678, 4974, 9657, 29898, 29874, 29922, 29896, 29892, 289, 2433, 294, 2176, 1495, 1275, 321, 29889, 4039, 3192, 29918, 5975, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 6691, 1649, 4039, 3192, 29918, 5975, 1649, 29906, 7295, 13, 1678, 5124, 6937, 4039, 3192, 29918, 5975, 29952, 338, 2869, 263, 3509, 310, 278, 9049, 5085, 9657, 29889, 13, 13, 1678, 10522, 3192, 1819, 451, 878, 28677, 491, 23815, 278, 4133, 9657, 29889, 13, 1678, 9995, 13, 1678, 321, 353, 14945, 29898, 29884, 29915, 29928, 11770, 742, 3553, 11770, 29892, 525, 29928, 11770, 742, 263, 29922, 29896, 29892, 289, 2433, 294, 2176, 1495, 13, 1678, 321, 29889, 4039, 3192, 29918, 5975, 1839, 29874, 2033, 353, 29871, 29906, 13, 1678, 4974, 9657, 29898, 29874, 29922, 29896, 29892, 289, 2433, 294, 2176, 1495, 1275, 321, 29889, 4039, 3192, 29918, 5975, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 657, 29918, 9917, 29918, 11010, 29918, 2671, 1649, 29896, 29898, 7328, 29918, 2909, 1125, 13, 1678, 9995, 3112, 3639, 278, 10938, 1746, 565, 278, 5446, 8128, 278, 7855, 5067, 1213, 15945, 13, 1678, 1746, 353, 679, 29918, 9917, 29918, 11010, 29918, 2671, 29898, 7328, 29918, 2909, 29892, 3211, 29918, 2909, 29918, 10041, 29892, 13, 462, 462, 259, 3211, 29918, 2909, 29918, 10041, 29889, 657, 22131, 3073, 877, 3257, 8785, 13, 1678, 4974, 3211, 29918, 2909, 1275, 1746, 29889, 4703, 13, 1678, 4974, 525, 3257, 29915, 1275, 1746, 17255, 978, 1649, 13, 1678, 4974, 338, 8758, 29898, 2671, 29892, 503, 2300, 29889, 11010, 29889, 1626, 3542, 29897, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 657, 29918, 9917, 29918, 11010, 29918, 2671, 1649, 29906, 29898, 7328, 29918, 2909, 29892, 14846, 7435, 5126, 1125, 13, 1678, 9995, 3112, 3430, 701, 278, 2322, 5446, 373, 5446, 565, 565, 815, 338, 451, 4944, 491, 5446, 1213, 15945, 13, 1678, 2022, 353, 14846, 7435, 5126, 29898, 7328, 29918, 2909, 29892, 318, 29915, 29968, 2878, 1495, 13, 1678, 1746, 353, 679, 29918, 9917, 29918, 11010, 29918, 2671, 29898, 13, 4706, 2022, 29892, 29767, 29918, 7328, 29918, 10041, 29892, 13, 4706, 29767, 29918, 7328, 29918, 10041, 29889, 657, 22131, 3073, 877, 13509, 8785, 13, 1678, 4974, 2022, 29889, 4381, 29918, 2490, 284, 29918, 7328, 1275, 1746, 29889, 4703, 13, 1678, 4974, 525, 13509, 29915, 1275, 1746, 17255, 978, 1649, 13, 1678, 4974, 338, 8758, 29898, 2671, 29892, 503, 2300, 29889, 11010, 29889, 29620, 29897, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 657, 29918, 9917, 29918, 11010, 29918, 2671, 1649, 29941, 29898, 7328, 29918, 2909, 29892, 14846, 7435, 5126, 1125, 13, 1678, 9995, 3112, 7868, 29879, 1746, 304, 5446, 565, 421, 4381, 29918, 1131, 1091, 29918, 11950, 1627, 29952, 338, 421, 8824, 1412, 13, 13, 1678, 3462, 3245, 4195, 29901, 450, 5067, 338, 451, 4944, 491, 5446, 29889, 13, 1678, 9995, 13, 1678, 2022, 353, 14846, 7435, 5126, 29898, 7328, 29918, 2909, 29892, 318, 29915, 29968, 2878, 1495, 13, 1678, 1746, 353, 679, 29918, 9917, 29918, 11010, 29918, 2671, 29898, 13, 4706, 2022, 29892, 29767, 29918, 7328, 29918, 10041, 29892, 13, 4706, 29767, 29918, 7328, 29918, 10041, 29889, 657, 22131, 3073, 877, 13509, 5477, 13, 4706, 2322, 29918, 1131, 1091, 29918, 11950, 1627, 29922, 8824, 29897, 13, 1678, 4974, 2022, 1275, 1746, 29889, 4703, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 657, 29918, 9917, 29918, 11010, 29918, 2671, 1649, 29946, 29898, 13, 4706, 3211, 29918, 2909, 29892, 14846, 7435, 5126, 29892, 8989, 5126, 1125, 13, 1678, 9995, 3112, 3639, 263, 1404, 3342, 1746, 408, 263, 421, 29920, 2300, 29889, 11010, 29952, 1746, 1213, 15945, 13, 1678, 2022, 353, 14846, 7435, 5126, 29898, 7328, 29918, 2909, 29892, 318, 29915, 29968, 2878, 1495, 13, 1678, 8989, 5126, 29898, 7328, 29918, 2909, 29892, 306, 9861, 4557, 29892, 525, 16390, 5410, 742, 318, 29915, 4230, 1246, 742, 13, 462, 11486, 29922, 29884, 29915, 4746, 263, 9008, 1495, 13, 1678, 1746, 353, 679, 29918, 9917, 29918, 11010, 29918, 2671, 29898, 13, 4706, 2022, 29892, 9008, 29918, 4537, 29918, 10041, 29892, 13, 4706, 9008, 29918, 4537, 29918, 10041, 29889, 657, 22131, 3073, 877, 3073, 29899, 29896, 8785, 13, 1678, 4974, 306, 2659, 3073, 10486, 29898, 10532, 29889, 4381, 29918, 6710, 29918, 4537, 29897, 1275, 1746, 29889, 4703, 13, 1678, 4974, 525, 3073, 29899, 29896, 29915, 1275, 1746, 17255, 978, 1649, 13, 1678, 4974, 525, 4746, 263, 9008, 29915, 1275, 1746, 29889, 8216, 13, 1678, 4974, 338, 8758, 29898, 2671, 29892, 503, 2300, 29889, 11010, 29889, 16390, 5410, 29897, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 3782, 3073, 7281, 2133, 1649, 29896, 29898, 4632, 29918, 12083, 1125, 13, 1678, 9995, 3112, 10703, 278, 306, 3073, 7281, 2133, 5067, 1213, 15945, 13, 1678, 302, 13801, 353, 306, 3073, 7281, 2133, 29898, 4632, 29918, 12083, 29897, 13, 1678, 4974, 338, 8758, 29898, 29876, 13801, 29892, 1939, 3073, 7281, 2133, 29897, 13, 1678, 4974, 503, 2300, 29889, 13248, 29889, 27902, 29889, 27902, 2061, 29898, 29902, 3073, 7281, 2133, 29892, 302, 13801, 29897, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 3782, 3073, 7281, 2133, 1649, 657, 29918, 1767, 1649, 29896, 29898, 4632, 29918, 12083, 1125, 13, 1678, 9995, 3112, 1153, 4637, 263, 7670, 2392, 1213, 15945, 13, 1678, 302, 13801, 353, 306, 3073, 7281, 2133, 29898, 4632, 29918, 12083, 29897, 13, 1678, 411, 11451, 1688, 29889, 336, 4637, 29898, 2558, 2392, 1125, 13, 4706, 302, 13801, 29889, 657, 29918, 1767, 29898, 29902, 7061, 10967, 1839, 2230, 29918, 8028, 7464, 525, 1643, 1495, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 3782, 3073, 7281, 2133, 1649, 4381, 29918, 1767, 1649, 29896, 29898, 4632, 29918, 12083, 1125, 13, 1678, 9995, 3112, 3639, 278, 3611, 310, 278, 1746, 313, 4381, 995, 467, 15945, 29908, 13, 1678, 302, 13801, 353, 306, 3073, 7281, 2133, 29898, 4632, 29918, 12083, 29897, 13, 1678, 4974, 318, 29915, 2481, 10640, 29915, 1275, 302, 13801, 29889, 4381, 29918, 1767, 29898, 13, 4706, 306, 7061, 10967, 1839, 2230, 29918, 8028, 7464, 525, 1643, 1495, 13, 13, 13, 29992, 2272, 1688, 29889, 3502, 29889, 3207, 300, 374, 911, 29898, 13, 1678, 525, 14380, 29892, 1121, 742, 13, 1678, 5135, 29884, 29915, 1643, 742, 318, 29915, 2481, 10640, 5477, 13, 268, 313, 29884, 29915, 8216, 742, 318, 29915, 29943, 497, 1627, 297, 1206, 263, 1404, 756, 451, 731, 701, 670, 7333, 29915, 13, 462, 418, 318, 29915, 931, 10640, 297, 278, 5821, 2063, 6169, 4961, 13, 1753, 1243, 29918, 296, 1907, 1649, 3782, 3073, 7281, 2133, 1649, 1972, 29918, 1767, 1649, 29896, 29898, 13, 4706, 3876, 29918, 12083, 29892, 2924, 29892, 1121, 1125, 13, 1678, 9995, 3112, 3639, 278, 2322, 995, 1213, 15945, 13, 1678, 302, 13801, 353, 306, 3073, 7281, 2133, 29898, 4632, 29918, 12083, 29897, 13, 1678, 4974, 1121, 1275, 302, 13801, 29889, 1972, 29918, 1767, 29898, 29902, 7061, 10967, 1839, 2230, 29918, 8028, 7464, 2924, 29897, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 3782, 3073, 7281, 2133, 1649, 842, 29918, 1767, 1649, 29896, 29898, 4632, 29918, 12083, 1125, 13, 1678, 9995, 3112, 338, 451, 8762, 1213, 15945, 13, 1678, 302, 13801, 353, 306, 3073, 7281, 2133, 29898, 4632, 29918, 12083, 29897, 13, 1678, 411, 11451, 1688, 29889, 336, 4637, 29898, 3664, 1888, 2037, 287, 2392, 1125, 13, 4706, 302, 13801, 29889, 842, 29918, 1767, 29898, 29902, 7061, 10967, 1839, 2230, 29918, 8028, 7464, 318, 29915, 1643, 742, 318, 29915, 5431, 1495, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 3073, 7281, 2133, 1649, 29896, 29898, 7328, 29918, 2909, 1125, 13, 1678, 9995, 3112, 10703, 278, 306, 3073, 7281, 2133, 5067, 1213, 15945, 13, 1678, 285, 29883, 353, 306, 3073, 7281, 2133, 29898, 7328, 29918, 2909, 29897, 13, 1678, 4974, 338, 8758, 29898, 13801, 29892, 8989, 7281, 2133, 29897, 13, 1678, 4974, 503, 2300, 29889, 13248, 29889, 27902, 29889, 27902, 2061, 29898, 29902, 3073, 7281, 2133, 29892, 285, 29883, 29897, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 3073, 7281, 2133, 1649, 657, 29918, 1767, 1649, 29896, 29898, 7328, 29918, 2909, 1125, 13, 1678, 9995, 3112, 1153, 4637, 263, 7670, 2392, 565, 694, 2888, 995, 338, 6087, 1213, 15945, 13, 1678, 285, 29883, 353, 306, 3073, 7281, 2133, 29898, 7328, 29918, 2909, 29897, 13, 1678, 411, 11451, 1688, 29889, 336, 4637, 29898, 2558, 2392, 1125, 13, 4706, 285, 29883, 29889, 657, 29918, 1767, 29898, 29902, 7061, 10967, 1839, 2230, 29918, 8028, 7464, 525, 1643, 1495, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 3073, 7281, 2133, 1649, 657, 29918, 1767, 1649, 29906, 29898, 7328, 29918, 2909, 1125, 13, 1678, 9995, 3112, 1153, 4637, 263, 7670, 2392, 565, 278, 1746, 947, 451, 6852, 304, 385, 5067, 1213, 15945, 13, 1678, 285, 29883, 353, 306, 3073, 7281, 2133, 29898, 7328, 29918, 2909, 29897, 13, 1678, 1746, 353, 503, 2300, 29889, 11010, 29889, 1626, 580, 13, 1678, 411, 11451, 1688, 29889, 336, 4637, 29898, 2558, 2392, 1125, 13, 4706, 285, 29883, 29889, 657, 29918, 1767, 29898, 2671, 29892, 525, 1643, 1495, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 3073, 7281, 2133, 1649, 4381, 29918, 1767, 1649, 29896, 29898, 7328, 29918, 2909, 1125, 13, 1678, 9995, 3112, 3639, 278, 3611, 310, 278, 1746, 313, 4381, 995, 467, 15945, 29908, 13, 1678, 285, 29883, 353, 306, 3073, 7281, 2133, 29898, 7328, 29918, 2909, 29897, 13, 1678, 4974, 318, 29915, 2481, 10640, 29915, 1275, 285, 29883, 29889, 4381, 29918, 1767, 29898, 29902, 7061, 10967, 1839, 2230, 29918, 8028, 7464, 525, 1643, 1495, 13, 13, 13, 29992, 2272, 1688, 29889, 3502, 29889, 3207, 300, 374, 911, 29898, 13, 1678, 525, 14380, 29892, 1121, 742, 13, 1678, 5135, 29884, 29915, 1643, 742, 318, 29915, 2481, 10640, 5477, 13, 268, 313, 29884, 29915, 8216, 742, 318, 29915, 29943, 497, 1627, 297, 1206, 263, 1404, 756, 451, 731, 701, 670, 7333, 29915, 13, 462, 418, 318, 29915, 931, 10640, 297, 278, 5821, 2063, 6169, 4961, 13, 1753, 1243, 29918, 296, 1907, 1649, 3073, 7281, 2133, 1649, 1972, 29918, 1767, 1649, 29896, 29898, 13, 4706, 3211, 29918, 2909, 29892, 2924, 29892, 1121, 1125, 13, 1678, 9995, 3112, 3639, 278, 2322, 995, 565, 694, 2888, 3858, 338, 6087, 1213, 15945, 13, 1678, 285, 29883, 353, 306, 3073, 7281, 2133, 29898, 7328, 29918, 2909, 29897, 13, 1678, 4974, 1121, 1275, 285, 29883, 29889, 1972, 29918, 1767, 29898, 29902, 7061, 10967, 1839, 2230, 29918, 8028, 7464, 2924, 29897, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 3073, 7281, 2133, 1649, 842, 29918, 1767, 1649, 29896, 29898, 7328, 29918, 2909, 1125, 13, 1678, 9995, 3112, 14422, 278, 2183, 2888, 995, 1213, 15945, 13, 1678, 285, 29883, 353, 306, 3073, 7281, 2133, 29898, 7328, 29918, 2909, 29897, 13, 1678, 1746, 353, 306, 7061, 10967, 1839, 2230, 29918, 8028, 2033, 13, 1678, 285, 29883, 29889, 842, 29918, 1767, 29898, 2671, 29892, 318, 29915, 1643, 742, 318, 29915, 4592, 931, 10640, 995, 29871, 29896, 29906, 29941, 1495, 13, 1678, 4974, 318, 29915, 4592, 931, 10640, 995, 29871, 29896, 29906, 29941, 29915, 1275, 285, 29883, 29889, 657, 29918, 1767, 29898, 2671, 29892, 525, 1643, 1495, 13, 1678, 4974, 318, 29915, 4592, 931, 10640, 995, 29871, 29896, 29906, 29941, 29915, 1275, 285, 29883, 29889, 1972, 29918, 1767, 29898, 2671, 29892, 525, 1643, 1495, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 3073, 7281, 2133, 1649, 842, 29918, 1767, 1649, 29906, 29898, 7328, 29918, 2909, 1125, 13, 1678, 9995, 855, 8253, 421, 8516, 29952, 25388, 278, 2888, 995, 1213, 15945, 13, 1678, 285, 29883, 353, 306, 3073, 7281, 2133, 29898, 7328, 29918, 2909, 29897, 13, 1678, 1746, 353, 306, 7061, 10967, 1839, 2230, 29918, 8028, 2033, 13, 1678, 285, 29883, 29889, 842, 29918, 1767, 29898, 2671, 29892, 318, 29915, 1643, 742, 318, 29915, 4592, 931, 10640, 995, 29871, 29896, 29906, 29941, 1495, 13, 1678, 285, 29883, 29889, 842, 29918, 1767, 29898, 2671, 29892, 318, 29915, 1643, 742, 6213, 29897, 13, 1678, 411, 11451, 1688, 29889, 336, 4637, 29898, 2558, 2392, 1125, 13, 4706, 285, 29883, 29889, 657, 29918, 1767, 29898, 2671, 29892, 525, 1643, 1495, 13, 13, 13, 1753, 1243, 29918, 296, 1907, 1649, 3073, 7281, 2133, 1649, 842, 29918, 1767, 1649, 29941, 29898, 7328, 29918, 2909, 1125, 13, 1678, 9995, 3112, 947, 451, 2867, 373, 15446, 421, 8516, 29952, 411, 694, 2888, 995, 6087, 1213, 15945, 13, 1678, 285, 29883, 353, 306, 3073, 7281, 2133, 29898, 7328, 29918, 2909, 29897, 13, 1678, 1746, 353, 306, 7061, 10967, 1839, 2230, 29918, 8028, 2033, 13, 1678, 285, 29883, 29889, 842, 29918, 1767, 29898, 2671, 29892, 318, 29915, 1643, 742, 6213, 29897, 13, 1678, 411, 11451, 1688, 29889, 336, 4637, 29898, 2558, 2392, 1125, 13, 4706, 285, 29883, 29889, 657, 29918, 1767, 29898, 2671, 29892, 525, 1643, 1495, 13, 2 ]
resources/org/caf/normalize-build-matrix.py
actor-framework/continuous-integration
0
97696
#!/usr/bin/env python import sys, json from functools import reduce inputFile = sys.argv[1] outputFile = sys.argv[2] with open(inputFile, 'r') as f: data = f.read() config = json.loads(data) def copy_without(xs, key): ys = xs.copy() ys.pop(key) return ys def merge_filtered(result, xs, pred): for key, val in xs.items(): if pred(key): result[key] = val return result def make_pipeline(*functions): return reduce(lambda f, g: lambda x: g(f(x)), functions) def filter_step(f): return lambda xs: filter(f, xs) def map_step(f): return lambda xs: map(f, xs) def reduce_step(f): return lambda xs: reduce(f, xs) def lift_builds(os, settings): res = map(lambda build: [os, build, copy_without(settings, 'builds')], settings['builds']) return list(res) def normalize(what, settings, buildType, defaults): key1 = 'extraBuild{}'.format(what.capitalize()) key2 = 'extra{}Build{}'.format(buildType.capitalize(), what.capitalize()) res1 = settings[key1] if key1 in settings else [] res2 = settings[key2] if key2 in settings else [] return merge_filtered({ what: defaults + res1 + res2 }, settings, lambda key: not key.endswith(what.capitalize())) def normalize_entry(os, build_type, settings, what): key = 'build{}'.format(what.capitalize()) defaults = config[key] if key in config else [] return [os, build_type, normalize(what, settings, build_type, defaults)] def add_tags_if_missing(os, build_type, settings): res = settings if not 'tags' in res: res['tags'] = [] return [os, build_type, res] def call(f, args): return f(*args) buildMatrix = config['buildMatrix'] pipeline = make_pipeline( \ map_step(lambda entry: lift_builds(*entry)), reduce_step(lambda x, y: x + y), map_step(lambda entry: call(normalize_entry, entry + ['flags'])), map_step(lambda entry: call(normalize_entry, entry + ['env'])), map_step(lambda entry: add_tags_if_missing(*entry))) normalizedBuildMatrix = list(pipeline(buildMatrix)) with open(outputFile, 'w') as f: json.dump(normalizedBuildMatrix, f, indent=2)
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 13, 13, 5215, 10876, 29892, 4390, 13, 13, 3166, 2090, 312, 8789, 1053, 10032, 13, 13, 2080, 2283, 353, 10876, 29889, 19218, 29961, 29896, 29962, 13, 4905, 2283, 353, 10876, 29889, 19218, 29961, 29906, 29962, 13, 13, 2541, 1722, 29898, 2080, 2283, 29892, 525, 29878, 1495, 408, 285, 29901, 13, 1678, 848, 353, 285, 29889, 949, 580, 13, 2917, 353, 4390, 29889, 18132, 29898, 1272, 29897, 13, 13, 1753, 3509, 29918, 14037, 29898, 10351, 29892, 1820, 1125, 13, 1678, 343, 29879, 353, 14492, 29889, 8552, 580, 13, 1678, 343, 29879, 29889, 7323, 29898, 1989, 29897, 13, 1678, 736, 343, 29879, 13, 13, 1753, 10366, 29918, 4572, 287, 29898, 2914, 29892, 14492, 29892, 4450, 1125, 13, 1678, 363, 1820, 29892, 659, 297, 14492, 29889, 7076, 7295, 13, 4706, 565, 4450, 29898, 1989, 1125, 13, 9651, 1121, 29961, 1989, 29962, 353, 659, 13, 1678, 736, 1121, 13, 13, 1753, 1207, 29918, 13096, 5570, 10456, 12171, 1125, 13, 1678, 736, 10032, 29898, 2892, 285, 29892, 330, 29901, 14013, 921, 29901, 330, 29898, 29888, 29898, 29916, 8243, 3168, 29897, 13, 13, 1753, 4175, 29918, 10568, 29898, 29888, 1125, 13, 1678, 736, 14013, 14492, 29901, 4175, 29898, 29888, 29892, 14492, 29897, 13, 13, 1753, 2910, 29918, 10568, 29898, 29888, 1125, 13, 1678, 736, 14013, 14492, 29901, 2910, 29898, 29888, 29892, 14492, 29897, 13, 13, 1753, 10032, 29918, 10568, 29898, 29888, 1125, 13, 1678, 736, 14013, 14492, 29901, 10032, 29898, 29888, 29892, 14492, 29897, 13, 13, 1753, 13777, 29918, 4282, 29879, 29898, 359, 29892, 6055, 1125, 13, 1678, 620, 353, 2910, 29898, 2892, 2048, 29901, 518, 359, 29892, 2048, 29892, 3509, 29918, 14037, 29898, 11027, 29892, 525, 4282, 29879, 1495, 1402, 13, 795, 6055, 1839, 4282, 29879, 11287, 13, 1678, 736, 1051, 29898, 690, 29897, 13, 13, 1753, 4226, 675, 29898, 5816, 29892, 6055, 29892, 2048, 1542, 29892, 21274, 1125, 13, 1678, 1820, 29896, 353, 525, 17833, 8893, 8875, 4286, 4830, 29898, 5816, 29889, 5030, 2410, 675, 3101, 13, 1678, 1820, 29906, 353, 525, 17833, 8875, 8893, 8875, 4286, 4830, 29898, 4282, 1542, 29889, 5030, 2410, 675, 3285, 825, 29889, 5030, 2410, 675, 3101, 13, 1678, 620, 29896, 353, 6055, 29961, 1989, 29896, 29962, 565, 1820, 29896, 297, 6055, 1683, 5159, 13, 1678, 620, 29906, 353, 6055, 29961, 1989, 29906, 29962, 565, 1820, 29906, 297, 6055, 1683, 5159, 13, 1678, 736, 10366, 29918, 4572, 287, 3319, 825, 29901, 21274, 718, 620, 29896, 718, 620, 29906, 2981, 13, 462, 3986, 6055, 29892, 13, 462, 3986, 14013, 1820, 29901, 451, 1820, 29889, 1975, 2541, 29898, 5816, 29889, 5030, 2410, 675, 22130, 13, 13, 1753, 4226, 675, 29918, 8269, 29898, 359, 29892, 2048, 29918, 1853, 29892, 6055, 29892, 825, 1125, 13, 1678, 1820, 353, 525, 4282, 8875, 4286, 4830, 29898, 5816, 29889, 5030, 2410, 675, 3101, 13, 1678, 21274, 353, 2295, 29961, 1989, 29962, 565, 1820, 297, 2295, 1683, 5159, 13, 1678, 736, 518, 359, 29892, 2048, 29918, 1853, 29892, 4226, 675, 29898, 5816, 29892, 6055, 29892, 2048, 29918, 1853, 29892, 21274, 4638, 13, 13, 1753, 788, 29918, 11338, 29918, 361, 29918, 27259, 29898, 359, 29892, 2048, 29918, 1853, 29892, 6055, 1125, 13, 1678, 620, 353, 6055, 13, 1678, 565, 451, 525, 11338, 29915, 297, 620, 29901, 13, 4706, 620, 1839, 11338, 2033, 353, 5159, 13, 1678, 736, 518, 359, 29892, 2048, 29918, 1853, 29892, 620, 29962, 13, 13, 1753, 1246, 29898, 29888, 29892, 6389, 1125, 13, 1678, 736, 285, 10456, 5085, 29897, 13, 13, 13, 4282, 14609, 353, 2295, 1839, 4282, 14609, 2033, 13, 13, 13096, 5570, 353, 1207, 29918, 13096, 5570, 29898, 320, 13, 1678, 2910, 29918, 10568, 29898, 2892, 6251, 29901, 13777, 29918, 4282, 29879, 10456, 8269, 8243, 13, 1678, 10032, 29918, 10568, 29898, 2892, 921, 29892, 343, 29901, 921, 718, 343, 511, 13, 1678, 2910, 29918, 10568, 29898, 2892, 6251, 29901, 1246, 29898, 8945, 675, 29918, 8269, 29892, 6251, 718, 6024, 15764, 2033, 8243, 13, 1678, 2910, 29918, 10568, 29898, 2892, 6251, 29901, 1246, 29898, 8945, 675, 29918, 8269, 29892, 6251, 718, 6024, 6272, 2033, 8243, 13, 1678, 2910, 29918, 10568, 29898, 2892, 6251, 29901, 788, 29918, 11338, 29918, 361, 29918, 27259, 10456, 8269, 4961, 13, 13, 8945, 1891, 8893, 14609, 353, 1051, 29898, 13096, 5570, 29898, 4282, 14609, 876, 13, 13, 2541, 1722, 29898, 4905, 2283, 29892, 525, 29893, 1495, 408, 285, 29901, 13, 1678, 4390, 29889, 15070, 29898, 8945, 1891, 8893, 14609, 29892, 285, 29892, 29536, 29922, 29906, 29897, 13, 2 ]
nine/c5.py
xiaolinzi-xl/python_imooc
0
40575
from c6 import People # Student类继承People class Student(People): def __init__(self,school,name,age): self.school = school # People.__init__(self,name,age) super(Student,self).__init__(name,age) Student.sum += 1 def do_homework(self): print('do homework') student1 = Student('农村小学',"石敢当",19) print(student1.sum) print(Student.sum) print(student1.name) print(student1.age) People.do_homework("","xiaolinzi")
[ 1, 515, 274, 29953, 1053, 11647, 13, 13, 29937, 15740, 30832, 234, 190, 170, 233, 140, 194, 15666, 1991, 13, 1990, 15740, 29898, 15666, 1991, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 27041, 29892, 978, 29892, 482, 1125, 13, 4706, 1583, 29889, 27041, 353, 3762, 13, 4706, 396, 11647, 17255, 2344, 12035, 1311, 29892, 978, 29892, 482, 29897, 13, 4706, 2428, 29898, 20791, 29892, 1311, 467, 1649, 2344, 12035, 978, 29892, 482, 29897, 13, 4706, 15740, 29889, 2083, 4619, 29871, 29896, 13, 268, 13, 1678, 822, 437, 29918, 5184, 1287, 29898, 1311, 1125, 13, 4706, 1596, 877, 1867, 3271, 1287, 1495, 13, 13, 18945, 29896, 353, 15740, 877, 232, 137, 159, 30402, 30446, 30415, 742, 29908, 30814, 233, 152, 165, 30948, 613, 29896, 29929, 29897, 13, 2158, 29898, 18945, 29896, 29889, 2083, 29897, 13, 2158, 29898, 20791, 29889, 2083, 29897, 13, 2158, 29898, 18945, 29896, 29889, 978, 29897, 13, 2158, 29898, 18945, 29896, 29889, 482, 29897, 13, 15666, 1991, 29889, 1867, 29918, 5184, 1287, 703, 3284, 29916, 423, 22878, 2526, 1159, 13, 2 ]
AUTOENCODERS/DataPreparing/CICIDSPreprocessor.py
pawelptak/AI-Anomaly-Detection
1
20201
from sklearn.preprocessing import StandardScaler, LabelEncoder, MinMaxScaler, OneHotEncoder import numpy as np import pandas as pd import tqdm """ Class for Preprocessing CICIDS2017 Data represented as rows """ class CICIDSPreprocessor: def __init__(self): self.to_delete_columns = ['Flow ID', ' Timestamp'] self.label_column = ' Label' def preprocess_train_data(self, df: pd.DataFrame, label="BENIGN"): df = df.drop(self.to_delete_columns, axis=1) df = df[df[self.label_column] == label] df.reset_index(drop=True, inplace=True) df.drop(self.label_column, axis=1, inplace=True) return df.fillna(0) def preprocess_test_data(self, df: pd.DataFrame, label="BENIGN"): df = df.drop(self.to_delete_columns, axis=1) df = df[df[self.label_column] == label] df.reset_index(drop=True, inplace=True) df.drop(self.label_column, axis=1, inplace=True) return df.fillna(0) def __get_windows(self, df, window_size=20, stride=10): windows_arr = [] for i in tqdm.tqdm(range(0, len(df)-window_size+1, stride)): windows_arr.append(df.iloc[i:i+window_size, :].to_numpy()) return np.array(windows_arr)
[ 1, 515, 2071, 19668, 29889, 1457, 19170, 1053, 10117, 29636, 261, 29892, 15796, 8566, 6119, 29892, 3080, 7976, 29636, 261, 29892, 3118, 28917, 8566, 6119, 13, 5215, 12655, 408, 7442, 13, 5215, 11701, 408, 10518, 13, 5215, 260, 29939, 18933, 13, 13, 15945, 29908, 13, 2385, 363, 4721, 19170, 315, 2965, 1367, 29903, 29906, 29900, 29896, 29955, 3630, 9875, 408, 4206, 13, 15945, 29908, 13, 13, 13, 1990, 315, 2965, 1367, 5550, 276, 26482, 29901, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 1583, 29889, 517, 29918, 8143, 29918, 13099, 353, 6024, 17907, 3553, 742, 525, 7870, 7416, 2033, 13, 4706, 1583, 29889, 1643, 29918, 4914, 353, 525, 15796, 29915, 13, 13, 1678, 822, 758, 5014, 29918, 14968, 29918, 1272, 29898, 1311, 29892, 4489, 29901, 10518, 29889, 17271, 29892, 3858, 543, 29933, 1430, 17298, 29908, 1125, 13, 4706, 4489, 353, 4489, 29889, 8865, 29898, 1311, 29889, 517, 29918, 8143, 29918, 13099, 29892, 9685, 29922, 29896, 29897, 13, 4706, 4489, 353, 4489, 29961, 2176, 29961, 1311, 29889, 1643, 29918, 4914, 29962, 1275, 3858, 29962, 13, 4706, 4489, 29889, 12071, 29918, 2248, 29898, 8865, 29922, 5574, 29892, 297, 6689, 29922, 5574, 29897, 13, 4706, 4489, 29889, 8865, 29898, 1311, 29889, 1643, 29918, 4914, 29892, 9685, 29922, 29896, 29892, 297, 6689, 29922, 5574, 29897, 13, 13, 4706, 736, 4489, 29889, 5589, 1056, 29898, 29900, 29897, 13, 13, 1678, 822, 758, 5014, 29918, 1688, 29918, 1272, 29898, 1311, 29892, 4489, 29901, 10518, 29889, 17271, 29892, 3858, 543, 29933, 1430, 17298, 29908, 1125, 13, 4706, 4489, 353, 4489, 29889, 8865, 29898, 1311, 29889, 517, 29918, 8143, 29918, 13099, 29892, 9685, 29922, 29896, 29897, 13, 4706, 4489, 353, 4489, 29961, 2176, 29961, 1311, 29889, 1643, 29918, 4914, 29962, 1275, 3858, 29962, 13, 4706, 4489, 29889, 12071, 29918, 2248, 29898, 8865, 29922, 5574, 29892, 297, 6689, 29922, 5574, 29897, 13, 4706, 4489, 29889, 8865, 29898, 1311, 29889, 1643, 29918, 4914, 29892, 9685, 29922, 29896, 29892, 297, 6689, 29922, 5574, 29897, 13, 13, 4706, 736, 4489, 29889, 5589, 1056, 29898, 29900, 29897, 13, 13, 1678, 822, 4770, 657, 29918, 10499, 29898, 1311, 29892, 4489, 29892, 3474, 29918, 2311, 29922, 29906, 29900, 29892, 380, 2426, 29922, 29896, 29900, 1125, 13, 4706, 5417, 29918, 2749, 353, 5159, 13, 4706, 363, 474, 297, 260, 29939, 18933, 29889, 29873, 29939, 18933, 29898, 3881, 29898, 29900, 29892, 7431, 29898, 2176, 6817, 7165, 29918, 2311, 29974, 29896, 29892, 380, 2426, 22164, 13, 9651, 5417, 29918, 2749, 29889, 4397, 29898, 2176, 29889, 309, 542, 29961, 29875, 29901, 29875, 29974, 7165, 29918, 2311, 29892, 584, 1822, 517, 29918, 23749, 3101, 13, 4706, 736, 7442, 29889, 2378, 29898, 10499, 29918, 2749, 29897, 13, 2 ]
Lib/filibuster/titlecase.py
LettError/filibuster
10
130633
<reponame>LettError/filibuster<filename>Lib/filibuster/titlecase.py # -*- coding: UTF-8 -*- """ titlecase.py v0.2 Original Perl version by: <NAME> http://daringfireball.net/ 10 May 2008 Python version by <NAME> http://muffinresearch.co.uk License: http://www.opensource.org/licenses/mit-license.php """ import unittest import sys import re SMALL = 'a|an|and|as|at|but|by|en|for|if|in|of|on|or|the|to|v\.?|via|vs\.?' PUNCT = "[!\"#$%&'‘()*+,-./:;?@[\\\\\\]_`{|}~]" SMALL_WORDS = re.compile(r'^(%s)$' % SMALL, re.I) INLINE_PERIOD = re.compile(r'[a-zA-Z][.][a-zA-Z]') UC_ELSEWHERE = re.compile(r'%s*?[a-zA-Z]+[A-Z]+?' % PUNCT) CAPFIRST = re.compile(r"^%s*?([A-Za-z])" % PUNCT) SMALL_FIRST = re.compile(r'^(%s*)(%s)\b' % (PUNCT, SMALL), re.I) SMALL_LAST = re.compile(r'\b(%s)%s?$' % (SMALL, PUNCT), re.I) SUBPHRASE = re.compile(r'([:.;?!][ ])(%s)' % SMALL) def titlecase(text): """ Titlecases input text This filter changes all words to Title Caps, and attempts to be clever about *un*capitalizing SMALL words like a/an/the in the input. The list of "SMALL words" which are not capped comes from the New York Times Manual of Style, plus 'vs' and 'v'. """ words = re.split('\s', text) line = [] for word in words: if INLINE_PERIOD.search(word) or UC_ELSEWHERE.match(word): line.append(word) continue if SMALL_WORDS.match(word): line.append(word.lower()) continue line.append(CAPFIRST.sub(lambda m: m.group(0).upper(), word)) line = " ".join(line) line = SMALL_FIRST.sub(lambda m: '%s%s' % ( m.group(1), m.group(2).capitalize() ), line) line = SMALL_LAST.sub(lambda m: m.group(0).capitalize(), line) line = SUBPHRASE.sub(lambda m: '%s%s' % ( m.group(1), m.group(2).capitalize() ), line) return line class TitlecaseTests(unittest.TestCase): """Tests to ensure titlecase follows all of the rules""" def test_q_and_a(self): u"""Testing: Q&A With <NAME>: 'That’s What Happens In Technology' """ text = titlecase( u"Q&A with steve jobs: 'that’s what happens in technology'" ) result = u"Q&A With Steve Jobs: 'That’s What Happens in Technology'" self.assertEqual(text, result, "%s should be: %s" % (text, result, )) def test_at_and_t(self): u"""Testing: What Is AT&T's Problem?""" text = titlecase(u"What is AT&T’s problem?") result = u"What Is AT&T’s Problem?" self.assertEqual(text, result, "%s should be: %s" % (text, result, )) def test_apple_deal(self): """Testing: Apple Deal With AT&T Falls Through""" text = titlecase("Apple deal with AT&T falls through") result = "Apple Deal With AT&T Falls Through" self.assertEqual(text, result, "%s should be: %s" % (text, result, )) def test_this_v_that(self): """Testing: this v that""" text = titlecase("this v that") result = "This v That" self.assertEqual(text, result, "%s should be: %s" % (text, result, )) def test_this_v_that2(self): """Testing: this v. that""" text = titlecase("this v. that") result = "This v. That" self.assertEqual(text, result, "%s should be: %s" % (text, result, )) def test_this_vs_that(self): """Testing: this vs that""" text = titlecase("this vs that") result = "This vs That" self.assertEqual(text, result, "%s should be: %s" % (text, result, )) def test_this_vs_that2(self): """Testing: this vs. that""" text = titlecase("this vs. that") result = "This vs. That" self.assertEqual(text, result, "%s should be: %s" % (text, result, )) def test_apple_sec(self): u"""Testing: The SEC’s Apple Probe: What You Need to Know""" text = titlecase("The SEC’s Apple Probe: What You Need to Know") result = u"The SEC’s Apple Probe: What You Need to Know" self.assertEqual(text, result, "%s should be: %s" % (text, result, )) def test_small_word_quoted(self): """Testing: 'by the Way, Small word at the start but within quotes.'""" text = titlecase( "'by the Way, small word at the start but within quotes.'" ) result = "'By the Way, Small Word at the Start but Within Quotes.'" self.assertEqual(text, result, "%s should be: %s" % (text, result, )) def test_small_word_end(self): """Testing: Small word at end is nothing to be afraid of""" text = titlecase("Small word at end is nothing to be afraid of") result = "Small Word at End Is Nothing to Be Afraid Of" self.assertEqual(text, result, "%s should be: %s" % (text, result, )) def test_sub_phrase_small_word(self): """Testing: Starting Sub-Phrase With a Small Word: a Trick, Perhaps?""" text = titlecase( "Starting Sub-Phrase With a Small Word: a Trick, Perhaps?" ) result = "Starting Sub-Phrase With a Small Word: A Trick, Perhaps?" self.assertEqual(text, result, "%s should be: %s" % (text, result, )) def test_small_word_quotes(self): """Testing: Sub-Phrase With a Small Word in Quotes: 'a Trick...""" text = titlecase( "Sub-Phrase With a Small Word in Quotes: 'a Trick, Perhaps?'" ) result = "Sub-Phrase With a Small Word in Quotes: 'A Trick, Perhaps?'" self.assertEqual(text, result, "%s should be: %s" % (text, result, )) def test_small_word_double_quotes(self): """Testing: Sub-Phrase With a Small Word in Quotes: \"a Trick...""" text = titlecase( 'Sub-Phrase With a Small Word in Quotes: "a Trick, Perhaps?"' ) result = 'Sub-Phrase With a Small Word in Quotes: "A Trick, Perhaps?"' self.assertEqual(text, result, "%s should be: %s" % (text, result, )) def test_nothing_to_be_afraid_of(self): """Testing: \"Nothing to Be Afraid of?\"""" text = titlecase('"Nothing to Be Afraid of?"') result = '"Nothing to Be Afraid Of?"' self.assertEqual(text, result, "%s should be: %s" % (text, result, )) def test_nothing_to_be_afraid_of2(self): """Testing: \"Nothing to Be Afraid Of?\"""" text = titlecase('"Nothing to be Afraid Of?"') result = '"Nothing to Be Afraid Of?"' self.assertEqual(text, result, "%s should be: %s" % (text, result, )) def test_a_thing(self): """Testing: a thing""" text = titlecase('a thing') result = 'A Thing' self.assertEqual(text, result, "%s should be: %s" % (text, result, )) def test_vapourware(self): """Testing: 2lmc Spool: 'Gruber on OmniFocus and Vapo(u)rware'""" text = titlecase( "2lmc Spool: 'gruber on OmniFocus and vapo(u)rware'" ) result = "2lmc Spool: 'Gruber on OmniFocus and Vapo(u)rware'" self.assertEqual(text, result, "%s should be: %s" % (text, result, )) def test_domains(self): """Testing: this is just an example.com""" text = titlecase('this is just an example.com') result = 'This Is Just an example.com' self.assertEqual(text, result, "%s should be: %s" % (text, result, )) def test_domains2(self): """Testing: this is something listed on an del.icio.us""" text = titlecase('this is something listed on del.icio.us') result = 'This Is Something Listed on del.icio.us' self.assertEqual(text, result, "%s should be: %s" % (text, result, )) def test_itunes(self): """Testing: iTunes should be unmolested""" text = titlecase('iTunes should be unmolested') result = 'iTunes Should Be Unmolested' self.assertEqual(text, result, "%s should be: %s" % (text, result, )) def test_thoughts_on_music(self): u"""Testing: Reading Between the Lines of Steve Jobs’s...""" text = titlecase( u'Reading between the lines of steve jobs’s ‘thoughts on music’' ) result = u'Reading Between the Lines of Steve Jobs’s ‘Thoughts on Music’' self.assertEqual(text, result, "%s should be: %s" % (text, result, )) def test_repair_perms(self): u"""Testing: Seriously, ‘Repair Permissions’ Is Voodoo""" text = titlecase(u'seriously, ‘repair permissions’ is voodoo') result = u'Seriously, ‘Repair Permissions’ Is Voodoo' self.assertEqual(text, result, "%s should be: %s" % (text, result, )) def test_generalissimo(self): """Testing: General<NAME>...""" text = titlecase( 'generalissimo francisco franco: still dead; <NAME>: '\ 'still a jackass' ) result = u"""Generalissimo Francisco Franco: Still Dead; <NAME>: Still a Jackass.""" self.assertEqual(text, result, "%s should be: %s" % (text, result, )) if __name__ == '__main__': if not sys.stdin.isatty(): for line in sys.stdin: print(titlecase(line)) else: suite = unittest.TestLoader().loadTestsFromTestCase(TitlecaseTests) unittest.TextTestRunner(verbosity=2).run(suite)
[ 1, 529, 276, 1112, 420, 29958, 29931, 1803, 2392, 29914, 1777, 747, 5402, 29966, 9507, 29958, 14868, 29914, 1777, 747, 5402, 29914, 3257, 4878, 29889, 2272, 13, 29937, 448, 29930, 29899, 14137, 29901, 18351, 29899, 29947, 448, 29930, 29899, 13, 13, 15945, 29908, 13, 3257, 4878, 29889, 2272, 325, 29900, 29889, 29906, 13, 26036, 23907, 1873, 491, 29901, 529, 5813, 29958, 1732, 597, 29881, 4362, 8696, 2135, 29889, 1212, 29914, 29871, 29896, 29900, 2610, 29871, 29906, 29900, 29900, 29947, 13, 11980, 1873, 491, 529, 5813, 29958, 1732, 597, 2589, 600, 262, 690, 2842, 29889, 1111, 29889, 2679, 13, 29931, 293, 1947, 29901, 1732, 597, 1636, 29889, 22156, 1167, 29889, 990, 29914, 506, 11259, 29914, 2415, 29899, 506, 1947, 29889, 1961, 13, 15945, 29908, 13, 13, 5215, 443, 27958, 13, 5215, 10876, 13, 5215, 337, 13, 13, 13, 29903, 1529, 2208, 353, 525, 29874, 29989, 273, 29989, 392, 29989, 294, 29989, 271, 29989, 4187, 29989, 1609, 29989, 264, 29989, 1454, 29989, 361, 29989, 262, 29989, 974, 29989, 265, 29989, 272, 29989, 1552, 29989, 517, 29989, 29894, 23301, 29973, 29989, 6071, 29989, 4270, 23301, 17901, 13, 29925, 3904, 1783, 353, 14704, 29991, 5931, 29937, 29938, 29995, 29987, 29915, 30086, 580, 29930, 29974, 6653, 6904, 29901, 29936, 29973, 29992, 29961, 1966, 1966, 1966, 21540, 29952, 28437, 29913, 30022, 18017, 13, 13, 29903, 1529, 2208, 29918, 11686, 8452, 353, 337, 29889, 12198, 29898, 29878, 29915, 23733, 29995, 29879, 1262, 29915, 1273, 317, 1529, 2208, 29892, 337, 29889, 29902, 29897, 13, 1177, 18521, 29918, 13171, 5971, 29928, 353, 337, 29889, 12198, 29898, 29878, 29915, 29961, 29874, 29899, 25265, 29899, 29999, 3816, 29889, 3816, 29874, 29899, 25265, 29899, 29999, 29962, 1495, 13, 23129, 29918, 6670, 1660, 22043, 353, 337, 29889, 12198, 29898, 29878, 29915, 29995, 29879, 29930, 29973, 29961, 29874, 29899, 25265, 29899, 29999, 10062, 29961, 29909, 29899, 29999, 10062, 17901, 1273, 349, 3904, 1783, 29897, 13, 29907, 3301, 3738, 29934, 1254, 353, 337, 29889, 12198, 29898, 29878, 29908, 29985, 29995, 29879, 29930, 29973, 4197, 29909, 29899, 29999, 29874, 29899, 29920, 2314, 29908, 1273, 349, 3904, 1783, 29897, 13, 29903, 1529, 2208, 29918, 3738, 29934, 1254, 353, 337, 29889, 12198, 29898, 29878, 29915, 23733, 29995, 29879, 29930, 5033, 29995, 29879, 2144, 29890, 29915, 1273, 313, 29925, 3904, 1783, 29892, 317, 1529, 2208, 511, 337, 29889, 29902, 29897, 13, 29903, 1529, 2208, 29918, 4375, 1254, 353, 337, 29889, 12198, 29898, 29878, 12764, 29890, 29414, 29879, 29897, 29995, 29879, 29973, 29938, 29915, 1273, 313, 29903, 1529, 2208, 29892, 349, 3904, 1783, 511, 337, 29889, 29902, 29897, 13, 20633, 19689, 4717, 1660, 353, 337, 29889, 12198, 29898, 29878, 29915, 4197, 29901, 8670, 29973, 29991, 3816, 29871, 2314, 29414, 29879, 16029, 1273, 317, 1529, 2208, 29897, 13, 13, 1753, 3611, 4878, 29898, 726, 1125, 13, 13, 1678, 9995, 13, 1678, 18527, 11436, 1881, 1426, 13, 13, 1678, 910, 4175, 3620, 599, 3838, 304, 18527, 315, 2547, 29892, 322, 14734, 304, 367, 23455, 13, 1678, 1048, 334, 348, 29930, 5030, 2410, 5281, 317, 1529, 2208, 3838, 763, 263, 29914, 273, 29914, 1552, 297, 278, 1881, 29889, 13, 13, 1678, 450, 1051, 310, 376, 29903, 1529, 2208, 3838, 29908, 607, 526, 451, 274, 17280, 5304, 515, 13, 1678, 278, 1570, 3088, 10277, 2315, 950, 310, 22135, 29892, 2298, 525, 4270, 29915, 322, 525, 29894, 4286, 13, 13, 1678, 9995, 13, 13, 1678, 3838, 353, 337, 29889, 5451, 28909, 29879, 742, 1426, 29897, 13, 1678, 1196, 353, 5159, 13, 1678, 363, 1734, 297, 3838, 29901, 13, 4706, 565, 2672, 18521, 29918, 13171, 5971, 29928, 29889, 4478, 29898, 1742, 29897, 470, 501, 29907, 29918, 6670, 1660, 22043, 29889, 4352, 29898, 1742, 1125, 13, 9651, 1196, 29889, 4397, 29898, 1742, 29897, 13, 9651, 6773, 13, 4706, 565, 317, 1529, 2208, 29918, 11686, 8452, 29889, 4352, 29898, 1742, 1125, 13, 9651, 1196, 29889, 4397, 29898, 1742, 29889, 13609, 3101, 13, 9651, 6773, 13, 4706, 1196, 29889, 4397, 29898, 29907, 3301, 3738, 29934, 1254, 29889, 1491, 29898, 2892, 286, 29901, 286, 29889, 2972, 29898, 29900, 467, 21064, 3285, 1734, 876, 13, 13, 1678, 1196, 353, 376, 11393, 7122, 29898, 1220, 29897, 13, 13, 1678, 1196, 353, 317, 1529, 2208, 29918, 3738, 29934, 1254, 29889, 1491, 29898, 2892, 286, 29901, 14210, 29879, 29995, 29879, 29915, 1273, 313, 13, 4706, 286, 29889, 2972, 29898, 29896, 511, 13, 4706, 286, 29889, 2972, 29898, 29906, 467, 5030, 2410, 675, 580, 13, 1678, 10353, 1196, 29897, 13, 13, 1678, 1196, 353, 317, 1529, 2208, 29918, 4375, 1254, 29889, 1491, 29898, 2892, 286, 29901, 286, 29889, 2972, 29898, 29900, 467, 5030, 2410, 675, 3285, 1196, 29897, 13, 13, 1678, 1196, 353, 27092, 19689, 4717, 1660, 29889, 1491, 29898, 2892, 286, 29901, 14210, 29879, 29995, 29879, 29915, 1273, 313, 13, 4706, 286, 29889, 2972, 29898, 29896, 511, 13, 4706, 286, 29889, 2972, 29898, 29906, 467, 5030, 2410, 675, 580, 13, 1678, 10353, 1196, 29897, 13, 13, 1678, 736, 1196, 13, 13, 1990, 18527, 4878, 24376, 29898, 348, 27958, 29889, 3057, 8259, 1125, 13, 13, 1678, 9995, 24376, 304, 9801, 3611, 4878, 4477, 599, 310, 278, 6865, 15945, 29908, 13, 13, 1678, 822, 1243, 29918, 29939, 29918, 392, 29918, 29874, 29898, 1311, 1125, 13, 4706, 318, 15945, 29908, 3057, 292, 29901, 660, 29987, 29909, 2973, 529, 5813, 23917, 525, 7058, 30010, 29879, 1724, 379, 932, 575, 512, 17968, 29915, 9995, 13, 4706, 1426, 353, 3611, 4878, 29898, 13, 9651, 318, 29908, 29984, 29987, 29909, 411, 1886, 345, 17643, 29901, 525, 5747, 30010, 29879, 825, 5930, 297, 15483, 11838, 13, 4706, 1723, 13, 4706, 1121, 353, 318, 29908, 29984, 29987, 29909, 2973, 13981, 17163, 29879, 29901, 525, 7058, 30010, 29879, 1724, 379, 932, 575, 297, 17968, 11838, 13, 4706, 1583, 29889, 9294, 9843, 29898, 726, 29892, 1121, 29892, 11860, 29879, 881, 367, 29901, 1273, 29879, 29908, 1273, 313, 726, 29892, 1121, 29892, 29871, 876, 13, 13, 1678, 822, 1243, 29918, 271, 29918, 392, 29918, 29873, 29898, 1311, 1125, 13, 4706, 318, 15945, 29908, 3057, 292, 29901, 1724, 1317, 15531, 29987, 29911, 29915, 29879, 11583, 3026, 15945, 13, 13, 4706, 1426, 353, 3611, 4878, 29898, 29884, 29908, 5618, 338, 15531, 29987, 29911, 30010, 29879, 1108, 29973, 1159, 13, 4706, 1121, 353, 318, 29908, 5618, 1317, 15531, 29987, 29911, 30010, 29879, 11583, 3026, 13, 4706, 1583, 29889, 9294, 9843, 29898, 726, 29892, 1121, 29892, 11860, 29879, 881, 367, 29901, 1273, 29879, 29908, 1273, 313, 726, 29892, 1121, 29892, 29871, 876, 13, 13, 1678, 822, 1243, 29918, 11548, 29918, 311, 284, 29898, 1311, 1125, 13, 4706, 9995, 3057, 292, 29901, 12113, 897, 284, 2973, 15531, 29987, 29911, 383, 4293, 17044, 15945, 29908, 13, 13, 4706, 1426, 353, 3611, 4878, 703, 2052, 280, 5376, 411, 15531, 29987, 29911, 20074, 1549, 1159, 13, 4706, 1121, 353, 376, 2052, 280, 897, 284, 2973, 15531, 29987, 29911, 383, 4293, 17044, 29908, 13, 4706, 1583, 29889, 9294, 9843, 29898, 726, 29892, 1121, 29892, 11860, 29879, 881, 367, 29901, 1273, 29879, 29908, 1273, 313, 726, 29892, 1121, 29892, 29871, 876, 13, 13, 1678, 822, 1243, 29918, 1366, 29918, 29894, 29918, 5747, 29898, 1311, 1125, 13, 4706, 9995, 3057, 292, 29901, 445, 325, 393, 15945, 29908, 13, 4706, 1426, 353, 3611, 4878, 703, 1366, 325, 393, 1159, 13, 4706, 1121, 353, 376, 4013, 325, 2193, 29908, 13, 4706, 1583, 29889, 9294, 9843, 29898, 726, 29892, 1121, 29892, 11860, 29879, 881, 367, 29901, 1273, 29879, 29908, 1273, 313, 726, 29892, 1121, 29892, 29871, 876, 13, 13, 1678, 822, 1243, 29918, 1366, 29918, 29894, 29918, 5747, 29906, 29898, 1311, 1125, 13, 4706, 9995, 3057, 292, 29901, 445, 325, 29889, 393, 15945, 29908, 13, 13, 4706, 1426, 353, 3611, 4878, 703, 1366, 325, 29889, 393, 1159, 13, 4706, 1121, 353, 376, 4013, 325, 29889, 2193, 29908, 13, 4706, 1583, 29889, 9294, 9843, 29898, 726, 29892, 1121, 29892, 11860, 29879, 881, 367, 29901, 1273, 29879, 29908, 1273, 313, 726, 29892, 1121, 29892, 29871, 876, 13, 13, 1678, 822, 1243, 29918, 1366, 29918, 4270, 29918, 5747, 29898, 1311, 1125, 13, 4706, 9995, 3057, 292, 29901, 445, 7186, 393, 15945, 29908, 13, 13, 4706, 1426, 353, 3611, 4878, 703, 1366, 7186, 393, 1159, 13, 4706, 1121, 353, 376, 4013, 7186, 2193, 29908, 13, 4706, 1583, 29889, 9294, 9843, 29898, 726, 29892, 1121, 29892, 11860, 29879, 881, 367, 29901, 1273, 29879, 29908, 1273, 313, 726, 29892, 1121, 29892, 29871, 876, 13, 13, 1678, 822, 1243, 29918, 1366, 29918, 4270, 29918, 5747, 29906, 29898, 1311, 1125, 13, 4706, 9995, 3057, 292, 29901, 445, 7186, 29889, 393, 15945, 29908, 13, 13, 4706, 1426, 353, 3611, 4878, 703, 1366, 7186, 29889, 393, 1159, 13, 4706, 1121, 353, 376, 4013, 7186, 29889, 2193, 29908, 13, 4706, 1583, 29889, 9294, 9843, 29898, 726, 29892, 1121, 29892, 11860, 29879, 881, 367, 29901, 1273, 29879, 29908, 1273, 313, 726, 29892, 1121, 29892, 29871, 876, 13, 13, 1678, 822, 1243, 29918, 11548, 29918, 3471, 29898, 1311, 1125, 13, 4706, 318, 15945, 29908, 3057, 292, 29901, 450, 3725, 29907, 30010, 29879, 12113, 1019, 915, 29901, 1724, 887, 20768, 304, 19320, 15945, 29908, 13, 13, 4706, 1426, 353, 3611, 4878, 703, 1576, 3725, 29907, 30010, 29879, 12113, 1019, 915, 29901, 1724, 887, 20768, 304, 19320, 1159, 13, 4706, 1121, 353, 318, 29908, 1576, 3725, 29907, 30010, 29879, 12113, 1019, 915, 29901, 1724, 887, 20768, 304, 19320, 29908, 13, 4706, 1583, 29889, 9294, 9843, 29898, 726, 29892, 1121, 29892, 11860, 29879, 881, 367, 29901, 1273, 29879, 29908, 1273, 313, 726, 29892, 1121, 29892, 29871, 876, 13, 13, 1678, 822, 1243, 29918, 9278, 29918, 1742, 29918, 339, 5715, 29898, 1311, 1125, 13, 4706, 9995, 3057, 292, 29901, 525, 1609, 278, 5307, 29892, 18285, 1734, 472, 278, 1369, 541, 2629, 11839, 6169, 15945, 29908, 13, 13, 4706, 1426, 353, 3611, 4878, 29898, 13, 9651, 13577, 1609, 278, 5307, 29892, 2319, 1734, 472, 278, 1369, 541, 2629, 11839, 6169, 29908, 13, 4706, 1723, 13, 4706, 1121, 353, 13577, 2059, 278, 5307, 29892, 18285, 10803, 472, 278, 7370, 541, 23732, 751, 4769, 6169, 29908, 13, 4706, 1583, 29889, 9294, 9843, 29898, 726, 29892, 1121, 29892, 11860, 29879, 881, 367, 29901, 1273, 29879, 29908, 1273, 313, 726, 29892, 1121, 29892, 29871, 876, 13, 13, 1678, 822, 1243, 29918, 9278, 29918, 1742, 29918, 355, 29898, 1311, 1125, 13, 4706, 9995, 3057, 292, 29901, 18285, 1734, 472, 1095, 338, 3078, 304, 367, 13421, 310, 15945, 29908, 13, 13, 4706, 1426, 353, 3611, 4878, 703, 12636, 497, 1734, 472, 1095, 338, 3078, 304, 367, 13421, 310, 1159, 13, 4706, 1121, 353, 376, 12636, 497, 10803, 472, 2796, 1317, 9531, 304, 1522, 10393, 12240, 4587, 29908, 13, 4706, 1583, 29889, 9294, 9843, 29898, 726, 29892, 1121, 29892, 11860, 29879, 881, 367, 29901, 1273, 29879, 29908, 1273, 313, 726, 29892, 1121, 29892, 29871, 876, 13, 13, 1678, 822, 1243, 29918, 1491, 29918, 24588, 559, 29918, 9278, 29918, 1742, 29898, 1311, 1125, 13, 4706, 9995, 3057, 292, 29901, 23748, 3323, 29899, 29925, 1092, 559, 2973, 263, 18285, 10803, 29901, 263, 1605, 860, 29892, 11637, 3026, 15945, 13, 13, 4706, 1426, 353, 3611, 4878, 29898, 13, 9651, 376, 4763, 292, 3323, 29899, 29925, 1092, 559, 2973, 263, 18285, 10803, 29901, 263, 1605, 860, 29892, 11637, 3026, 13, 4706, 1723, 13, 4706, 1121, 353, 376, 4763, 292, 3323, 29899, 29925, 1092, 559, 2973, 263, 18285, 10803, 29901, 319, 1605, 860, 29892, 11637, 3026, 13, 4706, 1583, 29889, 9294, 9843, 29898, 726, 29892, 1121, 29892, 11860, 29879, 881, 367, 29901, 1273, 29879, 29908, 1273, 313, 726, 29892, 1121, 29892, 29871, 876, 13, 13, 1678, 822, 1243, 29918, 9278, 29918, 1742, 29918, 339, 4769, 29898, 1311, 1125, 13, 4706, 9995, 3057, 292, 29901, 3323, 29899, 29925, 1092, 559, 2973, 263, 18285, 10803, 297, 751, 4769, 29901, 525, 29874, 1605, 860, 856, 15945, 29908, 13, 13, 4706, 1426, 353, 3611, 4878, 29898, 13, 9651, 376, 4035, 29899, 29925, 1092, 559, 2973, 263, 18285, 10803, 297, 751, 4769, 29901, 525, 29874, 1605, 860, 29892, 11637, 29973, 11838, 13, 4706, 1723, 13, 4706, 1121, 353, 376, 4035, 29899, 29925, 1092, 559, 2973, 263, 18285, 10803, 297, 751, 4769, 29901, 525, 29909, 1605, 860, 29892, 11637, 29973, 11838, 13, 4706, 1583, 29889, 9294, 9843, 29898, 726, 29892, 1121, 29892, 11860, 29879, 881, 367, 29901, 1273, 29879, 29908, 1273, 313, 726, 29892, 1121, 29892, 29871, 876, 13, 13, 1678, 822, 1243, 29918, 9278, 29918, 1742, 29918, 8896, 29918, 339, 4769, 29898, 1311, 1125, 13, 4706, 9995, 3057, 292, 29901, 3323, 29899, 29925, 1092, 559, 2973, 263, 18285, 10803, 297, 751, 4769, 29901, 13218, 29874, 1605, 860, 856, 15945, 29908, 13, 4706, 1426, 353, 3611, 4878, 29898, 13, 9651, 525, 4035, 29899, 29925, 1092, 559, 2973, 263, 18285, 10803, 297, 751, 4769, 29901, 376, 29874, 1605, 860, 29892, 11637, 3026, 29915, 13, 4706, 1723, 13, 4706, 1121, 353, 525, 4035, 29899, 29925, 1092, 559, 2973, 263, 18285, 10803, 297, 751, 4769, 29901, 376, 29909, 1605, 860, 29892, 11637, 3026, 29915, 13, 4706, 1583, 29889, 9294, 9843, 29898, 726, 29892, 1121, 29892, 11860, 29879, 881, 367, 29901, 1273, 29879, 29908, 1273, 313, 726, 29892, 1121, 29892, 29871, 876, 13, 13, 1678, 822, 1243, 29918, 28450, 29918, 517, 29918, 915, 29918, 2142, 12240, 29918, 974, 29898, 1311, 1125, 13, 4706, 9995, 3057, 292, 29901, 13218, 26521, 304, 1522, 10393, 12240, 310, 29973, 5931, 15945, 29908, 13, 4706, 1426, 353, 3611, 4878, 877, 29908, 26521, 304, 1522, 10393, 12240, 310, 3026, 1495, 13, 4706, 1121, 353, 18793, 26521, 304, 1522, 10393, 12240, 4587, 3026, 29915, 13, 4706, 1583, 29889, 9294, 9843, 29898, 726, 29892, 1121, 29892, 11860, 29879, 881, 367, 29901, 1273, 29879, 29908, 1273, 313, 726, 29892, 1121, 29892, 29871, 876, 13, 13, 1678, 822, 1243, 29918, 28450, 29918, 517, 29918, 915, 29918, 2142, 12240, 29918, 974, 29906, 29898, 1311, 1125, 13, 4706, 9995, 3057, 292, 29901, 13218, 26521, 304, 1522, 10393, 12240, 4587, 29973, 5931, 15945, 29908, 13, 13, 4706, 1426, 353, 3611, 4878, 877, 29908, 26521, 304, 367, 10393, 12240, 4587, 3026, 1495, 13, 4706, 1121, 353, 18793, 26521, 304, 1522, 10393, 12240, 4587, 3026, 29915, 13, 4706, 1583, 29889, 9294, 9843, 29898, 726, 29892, 1121, 29892, 11860, 29879, 881, 367, 29901, 1273, 29879, 29908, 1273, 313, 726, 29892, 1121, 29892, 29871, 876, 13, 13, 1678, 822, 1243, 29918, 29874, 29918, 1918, 29898, 1311, 1125, 13, 4706, 9995, 3057, 292, 29901, 263, 2655, 15945, 29908, 13, 13, 4706, 1426, 353, 3611, 4878, 877, 29874, 2655, 1495, 13, 4706, 1121, 353, 525, 29909, 498, 292, 29915, 13, 4706, 1583, 29889, 9294, 9843, 29898, 726, 29892, 1121, 29892, 11860, 29879, 881, 367, 29901, 1273, 29879, 29908, 1273, 313, 726, 29892, 1121, 29892, 29871, 876, 13, 13, 1678, 822, 1243, 29918, 29894, 481, 473, 2519, 29898, 1311, 1125, 13, 4706, 9995, 3057, 292, 29901, 29871, 29906, 29880, 14047, 317, 10109, 29901, 525, 3338, 11234, 373, 13352, 1240, 20560, 322, 478, 481, 29877, 29898, 29884, 29897, 29878, 2519, 11838, 15945, 13, 4706, 1426, 353, 3611, 4878, 29898, 13, 9651, 376, 29906, 29880, 14047, 317, 10109, 29901, 525, 629, 11234, 373, 13352, 1240, 20560, 322, 325, 481, 29877, 29898, 29884, 29897, 29878, 2519, 11838, 13, 4706, 1723, 13, 4706, 1121, 353, 376, 29906, 29880, 14047, 317, 10109, 29901, 525, 3338, 11234, 373, 13352, 1240, 20560, 322, 478, 481, 29877, 29898, 29884, 29897, 29878, 2519, 11838, 13, 4706, 1583, 29889, 9294, 9843, 29898, 726, 29892, 1121, 29892, 11860, 29879, 881, 367, 29901, 1273, 29879, 29908, 1273, 313, 726, 29892, 1121, 29892, 29871, 876, 13, 13, 1678, 822, 1243, 29918, 3129, 2708, 29898, 1311, 1125, 13, 4706, 9995, 3057, 292, 29901, 445, 338, 925, 385, 1342, 29889, 510, 15945, 29908, 13, 4706, 1426, 353, 3611, 4878, 877, 1366, 338, 925, 385, 1342, 29889, 510, 1495, 13, 4706, 1121, 353, 525, 4013, 1317, 3387, 385, 1342, 29889, 510, 29915, 13, 4706, 1583, 29889, 9294, 9843, 29898, 726, 29892, 1121, 29892, 11860, 29879, 881, 367, 29901, 1273, 29879, 29908, 1273, 313, 726, 29892, 1121, 29892, 29871, 876, 13, 13, 1678, 822, 1243, 29918, 3129, 2708, 29906, 29898, 1311, 1125, 13, 4706, 9995, 3057, 292, 29901, 445, 338, 1554, 9904, 373, 385, 628, 29889, 11088, 29889, 375, 15945, 29908, 13, 13, 4706, 1426, 353, 3611, 4878, 877, 1366, 338, 1554, 9904, 373, 628, 29889, 11088, 29889, 375, 1495, 13, 4706, 1121, 353, 525, 4013, 1317, 12538, 2391, 287, 373, 628, 29889, 11088, 29889, 375, 29915, 13, 4706, 1583, 29889, 9294, 9843, 29898, 726, 29892, 1121, 29892, 11860, 29879, 881, 367, 29901, 1273, 29879, 29908, 1273, 313, 726, 29892, 1121, 29892, 29871, 876, 13, 13, 1678, 822, 1243, 29918, 277, 7844, 29898, 1311, 1125, 13, 4706, 9995, 3057, 292, 29901, 474, 29911, 7844, 881, 367, 443, 29885, 324, 2868, 15945, 29908, 13, 13, 4706, 1426, 353, 3611, 4878, 877, 29875, 29911, 7844, 881, 367, 443, 29885, 324, 2868, 1495, 13, 4706, 1121, 353, 525, 29875, 29911, 7844, 10575, 1522, 853, 29885, 324, 2868, 29915, 13, 4706, 1583, 29889, 9294, 9843, 29898, 726, 29892, 1121, 29892, 11860, 29879, 881, 367, 29901, 1273, 29879, 29908, 1273, 313, 726, 29892, 1121, 29892, 29871, 876, 13, 13, 1678, 822, 1243, 29918, 386, 1774, 29879, 29918, 265, 29918, 23596, 29898, 1311, 1125, 13, 4706, 318, 15945, 29908, 3057, 292, 29901, 21439, 21674, 278, 365, 1475, 310, 13981, 17163, 29879, 30010, 29879, 856, 15945, 29908, 13, 13, 4706, 1426, 353, 3611, 4878, 29898, 13, 9651, 318, 29915, 6359, 292, 1546, 278, 3454, 310, 1886, 345, 17643, 30010, 29879, 5129, 386, 1774, 29879, 373, 4696, 30010, 29915, 13, 4706, 1723, 13, 4706, 1121, 353, 318, 29915, 6359, 292, 21674, 278, 365, 1475, 310, 13981, 17163, 29879, 30010, 29879, 5129, 1349, 1774, 29879, 373, 6125, 30010, 29915, 13, 4706, 1583, 29889, 9294, 9843, 29898, 726, 29892, 1121, 29892, 11860, 29879, 881, 367, 29901, 1273, 29879, 29908, 1273, 313, 726, 29892, 1121, 29892, 29871, 876, 13, 13, 1678, 822, 1243, 29918, 3445, 1466, 29918, 546, 1516, 29898, 1311, 1125, 13, 4706, 318, 15945, 29908, 3057, 292, 29901, 1816, 17365, 29892, 5129, 5612, 1466, 20894, 6847, 30010, 1317, 478, 2092, 3634, 15945, 29908, 13, 13, 4706, 1426, 353, 3611, 4878, 29898, 29884, 29915, 643, 17365, 29892, 5129, 3445, 1466, 11239, 30010, 338, 992, 397, 3634, 1495, 13, 4706, 1121, 353, 318, 29915, 1748, 17365, 29892, 5129, 5612, 1466, 20894, 6847, 30010, 1317, 478, 2092, 3634, 29915, 13, 4706, 1583, 29889, 9294, 9843, 29898, 726, 29892, 1121, 29892, 11860, 29879, 881, 367, 29901, 1273, 29879, 29908, 1273, 313, 726, 29892, 1121, 29892, 29871, 876, 13, 13, 1678, 822, 1243, 29918, 17492, 790, 4200, 29898, 1311, 1125, 13, 4706, 9995, 3057, 292, 29901, 4593, 29966, 5813, 29958, 856, 15945, 29908, 13, 13, 4706, 1426, 353, 3611, 4878, 29898, 13, 9651, 525, 17492, 790, 4200, 2524, 3476, 1111, 2524, 1111, 29901, 1603, 7123, 29936, 529, 5813, 23917, 11297, 13, 18884, 525, 303, 453, 263, 28015, 465, 29915, 13, 4706, 1723, 13, 4706, 1121, 353, 318, 15945, 29908, 15263, 790, 4200, 8970, 20923, 29901, 12074, 16992, 29936, 529, 5813, 23917, 12074, 263, 5457, 465, 1213, 15945, 13, 4706, 1583, 29889, 9294, 9843, 29898, 726, 29892, 1121, 29892, 11860, 29879, 881, 367, 29901, 1273, 29879, 29908, 1273, 313, 726, 29892, 1121, 29892, 29871, 876, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 565, 451, 10876, 29889, 4172, 262, 29889, 24766, 1017, 7295, 13, 4706, 363, 1196, 297, 10876, 29889, 4172, 262, 29901, 13, 9651, 1596, 29898, 3257, 4878, 29898, 1220, 876, 13, 13, 1678, 1683, 29901, 13, 4706, 9460, 353, 443, 27958, 29889, 3057, 10036, 2141, 1359, 24376, 4591, 3057, 8259, 29898, 7030, 4878, 24376, 29897, 13, 4706, 443, 27958, 29889, 1626, 3057, 16802, 29898, 18248, 359, 537, 29922, 29906, 467, 3389, 29898, 13495, 29897, 13, 13, 2 ]
tests/db_test.py
hall-lab/lah
0
92369
import filecmp, os, tempfile, unittest from lah.db import LahDb class LahDbTest(unittest.TestCase): def setUp(self): self.data_d = os.path.join(os.path.dirname(__file__), "data", "dataset") self.dbfile = os.path.join(self.data_d, "test.db") self.temp_d = tempfile.TemporaryDirectory() self.new_dbfile = os.path.join(self.temp_d.name, "new.db") def tearDown(self): self.temp_d.cleanup() def test0_db_init(self): db = LahDb(dbfile=self.dbfile) self.assertIsNotNone(db) self.assertEqual(db, LahDb.current()) self.assertEqual(db.dbfile, self.dbfile) self.assertEqual(db.dburl(), "sqlite:///"+self.dbfile) def test1_lah_db_connect(self): db = LahDb(dbfile=self.dbfile) self.assertIsNotNone(db) self.assertEqual(db, LahDb.current()) db.connect() self.assertIsNotNone(db.sessionmaker) session = LahDb.session() self.assertIsNotNone(session) def test2_lah_db_create(self): new_dbfile = self.new_dbfile db = LahDb(dbfile=new_dbfile) db.create() self.assertTrue(os.path.exists(new_dbfile)) self.assertTrue(os.path.getsize(new_dbfile), 61440) db = LahDb(dbfile=new_dbfile) db.connect() session = db.session() self.assertIsNotNone(session) # -- LahDbTest if __name__ == '__main__': unittest.main(verbosity=2) #-- __main__
[ 1, 1053, 934, 21058, 29892, 2897, 29892, 5694, 1445, 29892, 443, 27958, 13, 13, 3166, 425, 29882, 29889, 2585, 1053, 365, 801, 10234, 13, 13, 1990, 365, 801, 10234, 3057, 29898, 348, 27958, 29889, 3057, 8259, 1125, 13, 1678, 822, 731, 3373, 29898, 1311, 1125, 13, 4706, 1583, 29889, 1272, 29918, 29881, 353, 2897, 29889, 2084, 29889, 7122, 29898, 359, 29889, 2084, 29889, 25721, 22168, 1445, 1649, 511, 376, 1272, 613, 376, 24713, 1159, 13, 4706, 1583, 29889, 2585, 1445, 353, 2897, 29889, 2084, 29889, 7122, 29898, 1311, 29889, 1272, 29918, 29881, 29892, 376, 1688, 29889, 2585, 1159, 13, 13, 4706, 1583, 29889, 7382, 29918, 29881, 353, 5694, 1445, 29889, 5776, 1971, 653, 9882, 580, 13, 4706, 1583, 29889, 1482, 29918, 2585, 1445, 353, 2897, 29889, 2084, 29889, 7122, 29898, 1311, 29889, 7382, 29918, 29881, 29889, 978, 29892, 376, 1482, 29889, 2585, 1159, 13, 13, 1678, 822, 734, 279, 6767, 29898, 1311, 1125, 13, 4706, 1583, 29889, 7382, 29918, 29881, 29889, 14941, 786, 580, 13, 13, 1678, 822, 1243, 29900, 29918, 2585, 29918, 2344, 29898, 1311, 1125, 13, 4706, 4833, 353, 365, 801, 10234, 29898, 2585, 1445, 29922, 1311, 29889, 2585, 1445, 29897, 13, 4706, 1583, 29889, 9294, 3624, 3664, 8516, 29898, 2585, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 2585, 29892, 365, 801, 10234, 29889, 3784, 3101, 13, 4706, 1583, 29889, 9294, 9843, 29898, 2585, 29889, 2585, 1445, 29892, 1583, 29889, 2585, 1445, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 2585, 29889, 2585, 2271, 3285, 376, 22793, 597, 12975, 29974, 1311, 29889, 2585, 1445, 29897, 13, 13, 1678, 822, 1243, 29896, 29918, 8083, 29918, 2585, 29918, 6915, 29898, 1311, 1125, 13, 4706, 4833, 353, 365, 801, 10234, 29898, 2585, 1445, 29922, 1311, 29889, 2585, 1445, 29897, 13, 4706, 1583, 29889, 9294, 3624, 3664, 8516, 29898, 2585, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 2585, 29892, 365, 801, 10234, 29889, 3784, 3101, 13, 13, 4706, 4833, 29889, 6915, 580, 13, 4706, 1583, 29889, 9294, 3624, 3664, 8516, 29898, 2585, 29889, 7924, 28107, 29897, 13, 4706, 4867, 353, 365, 801, 10234, 29889, 7924, 580, 13, 4706, 1583, 29889, 9294, 3624, 3664, 8516, 29898, 7924, 29897, 13, 13, 1678, 822, 1243, 29906, 29918, 8083, 29918, 2585, 29918, 3258, 29898, 1311, 1125, 13, 4706, 716, 29918, 2585, 1445, 353, 1583, 29889, 1482, 29918, 2585, 1445, 13, 4706, 4833, 353, 365, 801, 10234, 29898, 2585, 1445, 29922, 1482, 29918, 2585, 1445, 29897, 13, 4706, 4833, 29889, 3258, 580, 13, 4706, 1583, 29889, 9294, 5574, 29898, 359, 29889, 2084, 29889, 9933, 29898, 1482, 29918, 2585, 1445, 876, 13, 4706, 1583, 29889, 9294, 5574, 29898, 359, 29889, 2084, 29889, 657, 2311, 29898, 1482, 29918, 2585, 1445, 511, 29871, 29953, 29896, 29946, 29946, 29900, 29897, 13, 13, 4706, 4833, 353, 365, 801, 10234, 29898, 2585, 1445, 29922, 1482, 29918, 2585, 1445, 29897, 13, 4706, 4833, 29889, 6915, 580, 13, 4706, 4867, 353, 4833, 29889, 7924, 580, 13, 4706, 1583, 29889, 9294, 3624, 3664, 8516, 29898, 7924, 29897, 13, 13, 29937, 1192, 365, 801, 10234, 3057, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 443, 27958, 29889, 3396, 29898, 18248, 359, 537, 29922, 29906, 29897, 13, 13, 29937, 489, 4770, 3396, 1649, 13, 2 ]
src/domain/node.py
kovanostra/graph-to-graph
1
101197
<reponame>kovanostra/graph-to-graph import numpy as np from src.domain.graph import Graph class Node: def __init__(self, graph: Graph, node_id: int): self.node_id = node_id self.features = self._get_node_features(graph) self.neighbors = self._get_neighbors(graph) self.neighbors_count = len(self.neighbors) def _get_node_features(self, graph: Graph) -> np.ndarray: return graph.node_features[self.node_id] def _get_neighbors(self, graph: Graph) -> np.ndarray: return np.nonzero(graph.adjacency_matrix[self.node_id])[0]
[ 1, 529, 276, 1112, 420, 29958, 9756, 273, 520, 336, 29914, 4262, 29899, 517, 29899, 4262, 13, 5215, 12655, 408, 7442, 13, 13, 3166, 4765, 29889, 7247, 29889, 4262, 1053, 12367, 13, 13, 13, 1990, 9071, 29901, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 3983, 29901, 12367, 29892, 2943, 29918, 333, 29901, 938, 1125, 13, 4706, 1583, 29889, 3177, 29918, 333, 353, 2943, 29918, 333, 13, 4706, 1583, 29889, 22100, 353, 1583, 3032, 657, 29918, 3177, 29918, 22100, 29898, 4262, 29897, 13, 4706, 1583, 29889, 484, 1141, 29890, 943, 353, 1583, 3032, 657, 29918, 484, 1141, 29890, 943, 29898, 4262, 29897, 13, 4706, 1583, 29889, 484, 1141, 29890, 943, 29918, 2798, 353, 7431, 29898, 1311, 29889, 484, 1141, 29890, 943, 29897, 13, 13, 1678, 822, 903, 657, 29918, 3177, 29918, 22100, 29898, 1311, 29892, 3983, 29901, 12367, 29897, 1599, 7442, 29889, 299, 2378, 29901, 13, 4706, 736, 3983, 29889, 3177, 29918, 22100, 29961, 1311, 29889, 3177, 29918, 333, 29962, 13, 13, 1678, 822, 903, 657, 29918, 484, 1141, 29890, 943, 29898, 1311, 29892, 3983, 29901, 12367, 29897, 1599, 7442, 29889, 299, 2378, 29901, 13, 4706, 736, 7442, 29889, 5464, 9171, 29898, 4262, 29889, 26859, 562, 3819, 29918, 5344, 29961, 1311, 29889, 3177, 29918, 333, 2314, 29961, 29900, 29962, 13, 2 ]
securify/analyses/patterns/source/rtlo_pattern.py
AlexandreH/securify2
258
190816
import bisect import re from typing import List, Dict from securify.analyses.patterns.abstract_pattern import AbstractPattern, PatternMatch, Level, Severity, PatternMatchError, \ MatchComment, MatchSourceLocation class RightToLeftOverridePattern(AbstractPattern): regex_pattern = re.compile("\u202e".encode('utf-8')) @property def name(self) -> str: return "Right-to-left-override pattern" @property def description(self) -> str: return "Finds usages of the Right-To-Left-Override (U+202E) character in source code" @property def severity(self) -> Severity: return Severity.CRITICAL @property def level(self) -> Level: return Level.SOURCE @property def tags(self) -> Dict[str, str]: return {} def find_matches(self) -> List[PatternMatch]: analysis_context = self.analysis_context if analysis_context.source_code is None: raise PatternMatchError("Source code is not available.") encoding = analysis_context.config.encoding source_code = analysis_context.source_code.encode(encoding) rtlo_pattern = re.compile("\u202e".encode(encoding)) newl_pattern = re.compile("\n".encode(encoding)) newlines = sorted((m.start() for m in newl_pattern.finditer(source_code))) def get_line(b): return bisect.bisect(newlines, b) + 1 def get_contract(source_code, until_line): source_code_lines = str(source_code).split("\n")[:until_line] last_contract_line = [c for c in source_code_lines if "contract" in c][-1] if not last_contract_line: return "no contract" m = re.search('contract (\2w+)', last_contract_line) if m: return m.group(1) matches = [ self.match_violation().with_info( MatchComment( "Found right-to-left-override character" ), MatchSourceLocation( encoding, m.start(), m.end(), get_line(m.start()), get_contract(source_code, get_line(m.start())) ) ) for m in rtlo_pattern.finditer(source_code)] if not matches: return [self.match_compliant()] return matches
[ 1, 1053, 2652, 522, 13, 5215, 337, 13, 3166, 19229, 1053, 2391, 29892, 360, 919, 13, 13, 3166, 409, 2764, 1598, 29889, 7054, 952, 267, 29889, 11037, 29879, 29889, 16595, 29918, 11037, 1053, 25513, 17144, 29892, 25860, 9652, 29892, 21597, 29892, 14621, 537, 29892, 25860, 9652, 2392, 29892, 320, 13, 1678, 14514, 20001, 29892, 14514, 4435, 6508, 13, 13, 13, 1990, 10428, 1762, 8091, 4640, 17144, 29898, 9118, 17144, 1125, 13, 1678, 6528, 29918, 11037, 353, 337, 29889, 12198, 14182, 29884, 29906, 29900, 29906, 29872, 1642, 12508, 877, 9420, 29899, 29947, 8785, 13, 13, 1678, 732, 6799, 13, 1678, 822, 1024, 29898, 1311, 29897, 1599, 851, 29901, 13, 4706, 736, 376, 7341, 29899, 517, 29899, 1563, 29899, 15752, 4766, 29908, 13, 13, 1678, 732, 6799, 13, 1678, 822, 6139, 29898, 1311, 29897, 1599, 851, 29901, 13, 4706, 736, 376, 12542, 29879, 502, 1179, 310, 278, 10428, 29899, 1762, 29899, 8091, 29899, 4640, 313, 29965, 29974, 29906, 29900, 29906, 29923, 29897, 2931, 297, 2752, 775, 29908, 13, 13, 1678, 732, 6799, 13, 1678, 822, 2775, 537, 29898, 1311, 29897, 1599, 14621, 537, 29901, 13, 4706, 736, 14621, 537, 29889, 11341, 1806, 2965, 1964, 13, 13, 1678, 732, 6799, 13, 1678, 822, 3233, 29898, 1311, 29897, 1599, 21597, 29901, 13, 4706, 736, 21597, 29889, 27839, 4741, 13, 13, 1678, 732, 6799, 13, 1678, 822, 8282, 29898, 1311, 29897, 1599, 360, 919, 29961, 710, 29892, 851, 5387, 13, 4706, 736, 6571, 13, 13, 1678, 822, 1284, 29918, 20317, 29898, 1311, 29897, 1599, 2391, 29961, 17144, 9652, 5387, 13, 4706, 7418, 29918, 4703, 353, 1583, 29889, 15916, 29918, 4703, 13, 13, 4706, 565, 7418, 29918, 4703, 29889, 4993, 29918, 401, 338, 6213, 29901, 13, 9651, 12020, 25860, 9652, 2392, 703, 4435, 775, 338, 451, 3625, 23157, 13, 13, 4706, 8025, 353, 7418, 29918, 4703, 29889, 2917, 29889, 22331, 13, 13, 4706, 2752, 29918, 401, 353, 7418, 29918, 4703, 29889, 4993, 29918, 401, 29889, 12508, 29898, 22331, 29897, 13, 13, 4706, 364, 29873, 417, 29918, 11037, 353, 337, 29889, 12198, 14182, 29884, 29906, 29900, 29906, 29872, 1642, 12508, 29898, 22331, 876, 13, 4706, 716, 29880, 29918, 11037, 353, 337, 29889, 12198, 14182, 29876, 1642, 12508, 29898, 22331, 876, 13, 13, 4706, 716, 9012, 353, 12705, 3552, 29885, 29889, 2962, 580, 363, 286, 297, 716, 29880, 29918, 11037, 29889, 2886, 1524, 29898, 4993, 29918, 401, 4961, 13, 13, 4706, 822, 679, 29918, 1220, 29898, 29890, 1125, 13, 9651, 736, 2652, 522, 29889, 18809, 522, 29898, 1482, 9012, 29892, 289, 29897, 718, 29871, 29896, 13, 13, 4706, 822, 679, 29918, 1285, 1461, 29898, 4993, 29918, 401, 29892, 2745, 29918, 1220, 1125, 13, 9651, 2752, 29918, 401, 29918, 9012, 353, 851, 29898, 4993, 29918, 401, 467, 5451, 14182, 29876, 1159, 7503, 29305, 29918, 1220, 29962, 13, 9651, 1833, 29918, 1285, 1461, 29918, 1220, 353, 518, 29883, 363, 274, 297, 2752, 29918, 401, 29918, 9012, 565, 376, 1285, 1461, 29908, 297, 274, 3816, 29899, 29896, 29962, 13, 9651, 565, 451, 1833, 29918, 1285, 1461, 29918, 1220, 29901, 13, 18884, 736, 376, 1217, 8078, 29908, 13, 9651, 286, 353, 337, 29889, 4478, 877, 1285, 1461, 3441, 29906, 29893, 28135, 742, 1833, 29918, 1285, 1461, 29918, 1220, 29897, 13, 9651, 565, 286, 29901, 13, 18884, 736, 286, 29889, 2972, 29898, 29896, 29897, 13, 13, 13, 13, 13, 4706, 7087, 353, 518, 13, 9651, 1583, 29889, 4352, 29918, 1403, 22671, 2141, 2541, 29918, 3888, 29898, 13, 18884, 14514, 20001, 29898, 13, 462, 1678, 376, 9692, 1492, 29899, 517, 29899, 1563, 29899, 15752, 2931, 29908, 13, 18884, 10353, 13, 18884, 14514, 4435, 6508, 29898, 13, 462, 1678, 8025, 29892, 13, 462, 1678, 286, 29889, 2962, 3285, 13, 462, 1678, 286, 29889, 355, 3285, 13, 462, 1678, 679, 29918, 1220, 29898, 29885, 29889, 2962, 25739, 13, 462, 1678, 679, 29918, 1285, 1461, 29898, 4993, 29918, 401, 29892, 679, 29918, 1220, 29898, 29885, 29889, 2962, 22130, 13, 18884, 1723, 13, 9651, 1723, 363, 286, 297, 364, 29873, 417, 29918, 11037, 29889, 2886, 1524, 29898, 4993, 29918, 401, 4638, 13, 13, 4706, 565, 451, 7087, 29901, 13, 9651, 736, 518, 1311, 29889, 4352, 29918, 2388, 492, 424, 580, 29962, 13, 13, 4706, 736, 7087, 13, 2 ]
bdsim/blocks/__init__.py
petercorke/bdsim
64
44469
from .functions import * from .sources import * from .sinks import * from .transfers import * from .discrete import * from .linalg import * from .displays import * from .connections import * url = "https://petercorke.github.io/bdsim/" + __package__
[ 1, 515, 869, 12171, 1053, 334, 13, 3166, 869, 29879, 2863, 1053, 334, 13, 3166, 869, 29879, 19363, 1053, 334, 13, 3166, 869, 3286, 25534, 1053, 334, 13, 3166, 869, 2218, 9084, 1053, 334, 13, 3166, 869, 29880, 979, 29887, 1053, 334, 13, 3166, 869, 2218, 12922, 1053, 334, 13, 3166, 869, 11958, 1953, 1053, 334, 13, 13, 2271, 353, 376, 991, 597, 29886, 1308, 2616, 446, 29889, 3292, 29889, 601, 29914, 6448, 3601, 12975, 718, 4770, 5113, 1649, 13, 2 ]
PaddleCV/image_classification/infer.py
nepeplwu/models
1
194064
from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import numpy as np import time import sys import paddle import paddle.fluid as fluid import reader import argparse import functools import models import utils from utils.utility import add_arguments,print_arguments import math parser = argparse.ArgumentParser(description=__doc__) # yapf: disable add_arg = functools.partial(add_arguments, argparser=parser) add_arg('use_gpu', bool, True, "Whether to use GPU or not.") add_arg('class_dim', int, 1000, "Class number.") add_arg('image_shape', str, "3,224,224", "Input image size") add_arg('with_mem_opt', bool, True, "Whether to use memory optimization or not.") add_arg('pretrained_model', str, None, "Whether to use pretrained model.") add_arg('model', str, "SE_ResNeXt50_32x4d", "Set the network to use.") add_arg('save_inference', bool, False, "Whether to save inference model or not") # yapf: enable def infer(args): # parameters from arguments class_dim = args.class_dim model_name = args.model save_inference = args.save_inference pretrained_model = args.pretrained_model with_memory_optimization = args.with_mem_opt image_shape = [int(m) for m in args.image_shape.split(",")] model_list = [m for m in dir(models) if "__" not in m] assert model_name in model_list, "{} is not in lists: {}".format(args.model, model_list) image = fluid.layers.data(name='image', shape=image_shape, dtype='float32') # model definition model = models.__dict__[model_name]() if model_name == "GoogleNet": out, _, _ = model.net(input=image, class_dim=class_dim) else: out = model.net(input=image, class_dim=class_dim) out = fluid.layers.softmax(out) test_program = fluid.default_main_program().clone(for_test=True) fetch_list = [out.name] if with_memory_optimization and not save_inference: fluid.memory_optimize( fluid.default_main_program(), skip_opt_set=set(fetch_list)) place = fluid.CUDAPlace(0) if args.use_gpu else fluid.CPUPlace() exe = fluid.Executor(place) exe.run(fluid.default_startup_program()) if pretrained_model: def if_exist(var): return os.path.exists(os.path.join(pretrained_model, var.name)) fluid.io.load_vars(exe, pretrained_model, predicate=if_exist) if save_inference: fluid.io.save_inference_model( dirname=model_name, feeded_var_names=['image'], main_program=test_program, target_vars=out, executor=exe, model_filename='model', params_filename='params') print("model: ",model_name," is already saved") exit(0) test_batch_size = 1 test_reader = paddle.batch(reader.test(), batch_size=test_batch_size) feeder = fluid.DataFeeder(place=place, feed_list=[image]) TOPK = 1 for batch_id, data in enumerate(test_reader()): result = exe.run(test_program, fetch_list=fetch_list, feed=feeder.feed(data)) result = result[0][0] pred_label = np.argsort(result)[::-1][:TOPK] print("Test-{0}-score: {1}, class {2}" .format(batch_id, result[pred_label], pred_label)) sys.stdout.flush() def main(): args = parser.parse_args() print_arguments(args) infer(args) if __name__ == '__main__': main()
[ 1, 515, 4770, 29888, 9130, 1649, 1053, 8380, 29918, 5215, 13, 3166, 4770, 29888, 9130, 1649, 1053, 8542, 13, 3166, 4770, 29888, 9130, 1649, 1053, 1596, 29918, 2220, 13, 5215, 2897, 13, 5215, 12655, 408, 7442, 13, 5215, 931, 13, 5215, 10876, 13, 5215, 282, 22352, 13, 5215, 282, 22352, 29889, 1579, 5416, 408, 22576, 13, 5215, 9591, 13, 5215, 1852, 5510, 13, 5215, 2090, 312, 8789, 13, 5215, 4733, 13, 5215, 3667, 29879, 13, 3166, 3667, 29879, 29889, 329, 1793, 1053, 788, 29918, 25699, 29892, 2158, 29918, 25699, 13, 5215, 5844, 13, 13, 16680, 353, 1852, 5510, 29889, 15730, 11726, 29898, 8216, 29922, 1649, 1514, 1649, 29897, 13, 29937, 343, 481, 29888, 29901, 11262, 13, 1202, 29918, 1191, 353, 2090, 312, 8789, 29889, 3846, 29898, 1202, 29918, 25699, 29892, 1852, 16680, 29922, 16680, 29897, 13, 1202, 29918, 1191, 877, 1509, 29918, 29887, 3746, 742, 3986, 6120, 29892, 5852, 29892, 462, 376, 8809, 1979, 304, 671, 22796, 470, 451, 23157, 13, 1202, 29918, 1191, 877, 1990, 29918, 6229, 742, 4706, 938, 29892, 259, 29896, 29900, 29900, 29900, 29892, 462, 376, 2385, 1353, 23157, 13, 1202, 29918, 1191, 877, 3027, 29918, 12181, 742, 418, 851, 29892, 29871, 376, 29941, 29892, 29906, 29906, 29946, 29892, 29906, 29906, 29946, 613, 3986, 376, 4290, 1967, 2159, 1159, 13, 1202, 29918, 1191, 877, 2541, 29918, 6954, 29918, 3670, 742, 268, 6120, 29892, 5852, 29892, 462, 376, 8809, 1979, 304, 671, 3370, 13883, 470, 451, 23157, 13, 1202, 29918, 1191, 877, 1457, 3018, 1312, 29918, 4299, 742, 851, 29892, 29871, 6213, 29892, 462, 376, 8809, 1979, 304, 671, 758, 3018, 1312, 1904, 23157, 13, 1202, 29918, 1191, 877, 4299, 742, 9651, 851, 29892, 29871, 376, 1660, 29918, 1666, 8139, 29990, 29873, 29945, 29900, 29918, 29941, 29906, 29916, 29946, 29881, 613, 376, 2697, 278, 3564, 304, 671, 23157, 13, 1202, 29918, 1191, 877, 7620, 29918, 262, 1659, 742, 259, 6120, 29892, 7700, 29892, 462, 376, 8809, 1979, 304, 4078, 27262, 1904, 470, 451, 1159, 13, 29937, 343, 481, 29888, 29901, 9025, 13, 13, 1753, 10115, 29898, 5085, 1125, 13, 1678, 396, 4128, 515, 6273, 13, 1678, 770, 29918, 6229, 353, 6389, 29889, 1990, 29918, 6229, 13, 1678, 1904, 29918, 978, 353, 6389, 29889, 4299, 13, 1678, 4078, 29918, 262, 1659, 353, 6389, 29889, 7620, 29918, 262, 1659, 13, 1678, 758, 3018, 1312, 29918, 4299, 353, 6389, 29889, 1457, 3018, 1312, 29918, 4299, 13, 1678, 411, 29918, 14834, 29918, 20640, 2133, 353, 6389, 29889, 2541, 29918, 6954, 29918, 3670, 13, 1678, 1967, 29918, 12181, 353, 518, 524, 29898, 29885, 29897, 363, 286, 297, 6389, 29889, 3027, 29918, 12181, 29889, 5451, 28165, 13531, 13, 1678, 1904, 29918, 1761, 353, 518, 29885, 363, 286, 297, 4516, 29898, 9794, 29897, 565, 376, 1649, 29908, 451, 297, 286, 29962, 13, 1678, 4974, 1904, 29918, 978, 297, 1904, 29918, 1761, 29892, 376, 8875, 338, 451, 297, 8857, 29901, 6571, 1642, 4830, 29898, 5085, 29889, 4299, 29892, 13, 462, 462, 462, 462, 268, 1904, 29918, 1761, 29897, 13, 13, 1678, 1967, 353, 22576, 29889, 29277, 29889, 1272, 29898, 978, 2433, 3027, 742, 8267, 29922, 3027, 29918, 12181, 29892, 26688, 2433, 7411, 29941, 29906, 1495, 13, 13, 1678, 396, 1904, 5023, 13, 1678, 1904, 353, 4733, 17255, 8977, 1649, 29961, 4299, 29918, 978, 29962, 580, 13, 1678, 565, 1904, 29918, 978, 1275, 376, 14207, 6779, 1115, 13, 4706, 714, 29892, 17117, 903, 353, 1904, 29889, 1212, 29898, 2080, 29922, 3027, 29892, 770, 29918, 6229, 29922, 1990, 29918, 6229, 29897, 13, 1678, 1683, 29901, 13, 4706, 714, 353, 1904, 29889, 1212, 29898, 2080, 29922, 3027, 29892, 770, 29918, 6229, 29922, 1990, 29918, 6229, 29897, 13, 4706, 714, 353, 22576, 29889, 29277, 29889, 2695, 3317, 29898, 449, 29897, 13, 13, 1678, 1243, 29918, 8860, 353, 22576, 29889, 4381, 29918, 3396, 29918, 8860, 2141, 16513, 29898, 1454, 29918, 1688, 29922, 5574, 29897, 13, 13, 1678, 6699, 29918, 1761, 353, 518, 449, 29889, 978, 29962, 13, 1678, 565, 411, 29918, 14834, 29918, 20640, 2133, 322, 451, 4078, 29918, 262, 1659, 29901, 13, 4706, 22576, 29889, 14834, 29918, 20640, 675, 29898, 13, 9651, 22576, 29889, 4381, 29918, 3396, 29918, 8860, 3285, 14383, 29918, 3670, 29918, 842, 29922, 842, 29898, 9155, 29918, 1761, 876, 13, 13, 1678, 2058, 353, 22576, 29889, 29907, 15789, 3301, 1265, 29898, 29900, 29897, 565, 6389, 29889, 1509, 29918, 29887, 3746, 1683, 22576, 29889, 6271, 4897, 1265, 580, 13, 1678, 429, 29872, 353, 22576, 29889, 13366, 29898, 6689, 29897, 13, 1678, 429, 29872, 29889, 3389, 29898, 1579, 5416, 29889, 4381, 29918, 2962, 786, 29918, 8860, 3101, 13, 13, 1678, 565, 758, 3018, 1312, 29918, 4299, 29901, 13, 13, 4706, 822, 565, 29918, 28997, 29898, 1707, 1125, 13, 9651, 736, 2897, 29889, 2084, 29889, 9933, 29898, 359, 29889, 2084, 29889, 7122, 29898, 1457, 3018, 1312, 29918, 4299, 29892, 722, 29889, 978, 876, 13, 13, 4706, 22576, 29889, 601, 29889, 1359, 29918, 16908, 29898, 8097, 29892, 758, 3018, 1312, 29918, 4299, 29892, 24384, 29922, 361, 29918, 28997, 29897, 13, 1678, 565, 4078, 29918, 262, 1659, 29901, 13, 4706, 22576, 29889, 601, 29889, 7620, 29918, 262, 1659, 29918, 4299, 29898, 13, 18884, 4516, 978, 29922, 4299, 29918, 978, 29892, 13, 18884, 8343, 287, 29918, 1707, 29918, 7039, 29922, 1839, 3027, 7464, 13, 18884, 1667, 29918, 8860, 29922, 1688, 29918, 8860, 29892, 13, 18884, 3646, 29918, 16908, 29922, 449, 29892, 13, 18884, 2279, 3406, 29922, 8097, 29892, 13, 18884, 1904, 29918, 9507, 2433, 4299, 742, 13, 18884, 8636, 29918, 9507, 2433, 7529, 1495, 13, 4706, 1596, 703, 4299, 29901, 9162, 4299, 29918, 978, 1699, 338, 2307, 7160, 1159, 13, 4706, 6876, 29898, 29900, 29897, 13, 1678, 1243, 29918, 16175, 29918, 2311, 353, 29871, 29896, 13, 1678, 1243, 29918, 16950, 353, 282, 22352, 29889, 16175, 29898, 16950, 29889, 1688, 3285, 9853, 29918, 2311, 29922, 1688, 29918, 16175, 29918, 2311, 29897, 13, 1678, 1238, 2447, 353, 22576, 29889, 1469, 8263, 2447, 29898, 6689, 29922, 6689, 29892, 8343, 29918, 1761, 11759, 3027, 2314, 13, 13, 1678, 323, 4590, 29968, 353, 29871, 29896, 13, 1678, 363, 9853, 29918, 333, 29892, 848, 297, 26985, 29898, 1688, 29918, 16950, 580, 1125, 13, 4706, 1121, 353, 429, 29872, 29889, 3389, 29898, 1688, 29918, 8860, 29892, 13, 462, 308, 6699, 29918, 1761, 29922, 9155, 29918, 1761, 29892, 13, 462, 308, 8343, 29922, 1725, 2447, 29889, 18798, 29898, 1272, 876, 13, 4706, 1121, 353, 1121, 29961, 29900, 3816, 29900, 29962, 13, 4706, 4450, 29918, 1643, 353, 7442, 29889, 5085, 441, 29898, 2914, 9601, 1057, 29899, 29896, 3816, 29901, 29911, 4590, 29968, 29962, 13, 4706, 1596, 703, 3057, 29899, 29912, 29900, 7402, 13628, 29901, 426, 29896, 1118, 770, 426, 29906, 5038, 13, 795, 869, 4830, 29898, 16175, 29918, 333, 29892, 1121, 29961, 11965, 29918, 1643, 1402, 4450, 29918, 1643, 876, 13, 4706, 10876, 29889, 25393, 29889, 23126, 580, 13, 13, 13, 1753, 1667, 7295, 13, 1678, 6389, 353, 13812, 29889, 5510, 29918, 5085, 580, 13, 1678, 1596, 29918, 25699, 29898, 5085, 29897, 13, 1678, 10115, 29898, 5085, 29897, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 1667, 580, 13, 2 ]
test/msan/lit.cfg.py
QuarkTheAwesome/compiler-rt-be-aeabi
118
9489
# -*- Python -*- import os # Setup config name. config.name = 'MemorySanitizer' + getattr(config, 'name_suffix', 'default') # Setup source root. config.test_source_root = os.path.dirname(__file__) # Setup default compiler flags used with -fsanitize=memory option. clang_msan_cflags = (["-fsanitize=memory", "-mno-omit-leaf-frame-pointer", "-fno-omit-frame-pointer", "-fno-optimize-sibling-calls"] + [config.target_cflags] + config.debug_info_flags) # Some Msan tests leverage backtrace() which requires libexecinfo on FreeBSD. if config.host_os == 'FreeBSD': clang_msan_cflags += ["-lexecinfo", "-fPIC"] clang_msan_cxxflags = config.cxx_mode_flags + clang_msan_cflags # Flags for KMSAN invocation. This is C-only, we're not interested in C++. clang_kmsan_cflags = (["-fsanitize=kernel-memory"] + [config.target_cflags] + config.debug_info_flags) def build_invocation(compile_flags): return " " + " ".join([config.clang] + compile_flags) + " " config.substitutions.append( ("%clang_msan ", build_invocation(clang_msan_cflags)) ) config.substitutions.append( ("%clangxx_msan ", build_invocation(clang_msan_cxxflags)) ) config.substitutions.append( ("%clang_kmsan ", build_invocation(clang_kmsan_cflags)) ) # Default test suffixes. config.suffixes = ['.c', '.cc', '.cpp'] if config.host_os not in ['Linux', 'NetBSD', 'FreeBSD']: config.unsupported = True # For mips64, mips64el we have forced store_context_size to 1 because these # archs use slow unwinder which is not async signal safe. Therefore we only # check the first frame since store_context size is 1. if config.host_arch in ['mips64', 'mips64el']: config.substitutions.append( ('CHECK-%short-stack', 'CHECK-SHORT-STACK')) else: config.substitutions.append( ('CHECK-%short-stack', 'CHECK-FULL-STACK'))
[ 1, 396, 448, 29930, 29899, 5132, 448, 29930, 29899, 13, 13, 5215, 2897, 13, 13, 29937, 3789, 786, 2295, 1024, 29889, 13, 2917, 29889, 978, 353, 525, 16015, 22509, 277, 3950, 29915, 718, 679, 5552, 29898, 2917, 29892, 525, 978, 29918, 2146, 600, 861, 742, 525, 4381, 1495, 13, 13, 29937, 3789, 786, 2752, 3876, 29889, 13, 2917, 29889, 1688, 29918, 4993, 29918, 4632, 353, 2897, 29889, 2084, 29889, 25721, 22168, 1445, 1649, 29897, 13, 13, 29937, 3789, 786, 2322, 6516, 13449, 1304, 411, 448, 5847, 273, 277, 675, 29922, 14834, 2984, 29889, 13, 695, 574, 29918, 1516, 273, 29918, 29883, 15764, 353, 313, 3366, 29899, 5847, 273, 277, 675, 29922, 14834, 613, 13, 462, 418, 11663, 29885, 1217, 29899, 290, 277, 29899, 29500, 29899, 2557, 29899, 17226, 613, 13, 462, 418, 11663, 29888, 1217, 29899, 290, 277, 29899, 2557, 29899, 17226, 613, 13, 462, 418, 11663, 29888, 1217, 29899, 20640, 675, 29899, 29879, 747, 1847, 29899, 29883, 4293, 3108, 718, 13, 462, 418, 518, 2917, 29889, 5182, 29918, 29883, 15764, 29962, 718, 13, 462, 418, 2295, 29889, 8382, 29918, 3888, 29918, 15764, 29897, 13, 29937, 3834, 341, 28455, 6987, 454, 19698, 1250, 15003, 580, 607, 6858, 4303, 4258, 3888, 373, 12362, 29933, 7230, 29889, 13, 361, 2295, 29889, 3069, 29918, 359, 1275, 525, 20475, 29933, 7230, 2396, 13, 29871, 1067, 574, 29918, 1516, 273, 29918, 29883, 15764, 4619, 6796, 29899, 2506, 687, 3888, 613, 11663, 29888, 2227, 29907, 3108, 13, 695, 574, 29918, 1516, 273, 29918, 29883, 4419, 15764, 353, 2295, 29889, 29883, 4419, 29918, 8513, 29918, 15764, 718, 1067, 574, 29918, 1516, 273, 29918, 29883, 15764, 13, 13, 29937, 2379, 810, 363, 476, 4345, 2190, 2437, 10610, 29889, 910, 338, 315, 29899, 6194, 29892, 591, 29915, 276, 451, 8852, 297, 315, 1817, 29889, 13, 695, 574, 29918, 29895, 1516, 273, 29918, 29883, 15764, 353, 313, 3366, 29899, 5847, 273, 277, 675, 29922, 17460, 29899, 14834, 3108, 718, 13, 462, 418, 518, 2917, 29889, 5182, 29918, 29883, 15764, 29962, 718, 13, 462, 418, 2295, 29889, 8382, 29918, 3888, 29918, 15764, 29897, 13, 13, 1753, 2048, 29918, 11569, 10610, 29898, 12198, 29918, 15764, 1125, 13, 29871, 736, 376, 376, 718, 376, 11393, 7122, 4197, 2917, 29889, 695, 574, 29962, 718, 6633, 29918, 15764, 29897, 718, 376, 376, 13, 13, 2917, 29889, 22492, 5008, 29879, 29889, 4397, 29898, 4852, 29995, 695, 574, 29918, 1516, 273, 9162, 2048, 29918, 11569, 10610, 29898, 695, 574, 29918, 1516, 273, 29918, 29883, 15764, 876, 1723, 13, 2917, 29889, 22492, 5008, 29879, 29889, 4397, 29898, 4852, 29995, 695, 574, 4419, 29918, 1516, 273, 9162, 2048, 29918, 11569, 10610, 29898, 695, 574, 29918, 1516, 273, 29918, 29883, 4419, 15764, 876, 1723, 13, 2917, 29889, 22492, 5008, 29879, 29889, 4397, 29898, 4852, 29995, 695, 574, 29918, 29895, 1516, 273, 9162, 2048, 29918, 11569, 10610, 29898, 695, 574, 29918, 29895, 1516, 273, 29918, 29883, 15764, 876, 1723, 13, 13, 29937, 13109, 1243, 25557, 267, 29889, 13, 2917, 29889, 2146, 600, 861, 267, 353, 518, 4286, 29883, 742, 15300, 617, 742, 15300, 8223, 2033, 13, 13, 361, 2295, 29889, 3069, 29918, 359, 451, 297, 6024, 24085, 742, 525, 6779, 29933, 7230, 742, 525, 20475, 29933, 7230, 2033, 29901, 13, 29871, 2295, 29889, 348, 23765, 353, 5852, 13, 13, 29937, 1152, 3737, 567, 29953, 29946, 29892, 3737, 567, 29953, 29946, 295, 591, 505, 11826, 3787, 29918, 4703, 29918, 2311, 304, 29871, 29896, 1363, 1438, 13, 29937, 3190, 29879, 671, 5232, 18500, 4995, 607, 338, 451, 7465, 7182, 9109, 29889, 7857, 591, 871, 13, 29937, 1423, 278, 937, 3515, 1951, 3787, 29918, 4703, 2159, 338, 29871, 29896, 29889, 13, 361, 2295, 29889, 3069, 29918, 1279, 297, 6024, 2460, 567, 29953, 29946, 742, 525, 2460, 567, 29953, 29946, 295, 2033, 29901, 13, 29871, 2295, 29889, 22492, 5008, 29879, 29889, 4397, 29898, 6702, 3210, 16658, 19222, 12759, 29899, 1429, 742, 525, 3210, 16658, 29899, 7068, 8476, 29899, 1254, 11375, 8785, 13, 2870, 29901, 13, 29871, 2295, 29889, 22492, 5008, 29879, 29889, 4397, 29898, 6702, 3210, 16658, 19222, 12759, 29899, 1429, 742, 525, 3210, 16658, 29899, 29943, 3299, 29899, 1254, 11375, 8785, 13, 2 ]
mac.py
cosven/feeluown-mac-hotkey-plugin
2
169466
<filename>mac.py # -*- coding=utf8 -*- import asyncio import logging import os import socket import threading logger = logging.getLogger(__name__) def send_cmd(cmd): sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect(('0.0.0.0', 23333)) sock.recv(1024) sock.sendall(bytes(cmd, 'utf-8') + b'\n') sock.close() def keyboard_tap_callback(proxy, type_, event, refcon): from AppKit import NSKeyUp, NSEvent, NSBundle NSBundle.mainBundle().infoDictionary()['NSAppTransportSecurity'] =\ dict(NSAllowsArbitraryLoads=True) if type_ < 0 or type_ > 0x7fffffff: logger.error('Unkown mac event') run_event_loop() logger.error('restart mac key board event loop') return event try: key_event = NSEvent.eventWithCGEvent_(event) except: logger.info("mac event cast error") return event if key_event.subtype() == 8: key_code = (key_event.data1() & 0xFFFF0000) >> 16 key_state = (key_event.data1() & 0xFF00) >> 8 if key_code in (16, 19, 20): # 16 for play-pause, 19 for next, 20 for previous if key_state == NSKeyUp: if key_code is 19: logger.info('mac hotkey: play next') send_cmd('next') elif key_code is 20: logger.info('mac hotkey: play last') send_cmd('previous') elif key_code is 16: os.system('echo "play_pause" | nc -4u -w0 localhost 8000') send_cmd('toggle') return None return event def run_event_loop(): logger.info("try to load mac hotkey event loop") import Quartz from AppKit import NSSystemDefined # Set up a tap, with type of tap, location, options and event mask tap = Quartz.CGEventTapCreate( Quartz.kCGSessionEventTap, # Session level is enough for our needs Quartz.kCGHeadInsertEventTap, # Insert wherever, we do not filter Quartz.kCGEventTapOptionDefault, # NSSystemDefined for media keys Quartz.CGEventMaskBit(NSSystemDefined), keyboard_tap_callback, None ) run_loop_source = Quartz.CFMachPortCreateRunLoopSource( None, tap, 0) Quartz.CFRunLoopAddSource( Quartz.CFRunLoopGetCurrent(), run_loop_source, Quartz.kCFRunLoopDefaultMode ) # Enable the tap Quartz.CGEventTapEnable(tap, True) # and run! This won't return until we exit or are terminated. Quartz.CFRunLoopRun() logger.error('Mac hotkey event loop exit') return [] def run(): t = threading.Thread(target=run_event_loop, name='MacHotkeyThread') t.daemon = True t.start() logger.info('mac hotkey listener started.')
[ 1, 529, 9507, 29958, 8628, 29889, 2272, 13, 29937, 448, 29930, 29899, 14137, 29922, 9420, 29947, 448, 29930, 29899, 13, 13, 5215, 408, 948, 3934, 13, 5215, 12183, 13, 5215, 2897, 13, 5215, 9909, 13, 5215, 3244, 292, 13, 13, 21707, 353, 12183, 29889, 657, 16363, 22168, 978, 1649, 29897, 13, 13, 13, 1753, 3638, 29918, 9006, 29898, 9006, 1125, 13, 1678, 577, 384, 353, 9909, 29889, 11514, 29898, 11514, 29889, 5098, 29918, 1177, 2544, 29892, 9909, 29889, 6156, 7077, 29918, 1254, 1525, 5194, 29897, 13, 1678, 577, 384, 29889, 6915, 29898, 877, 29900, 29889, 29900, 29889, 29900, 29889, 29900, 742, 29871, 29906, 29941, 29941, 29941, 29941, 876, 13, 1678, 577, 384, 29889, 3757, 29894, 29898, 29896, 29900, 29906, 29946, 29897, 13, 1678, 577, 384, 29889, 6717, 497, 29898, 13193, 29898, 9006, 29892, 525, 9420, 29899, 29947, 1495, 718, 289, 12764, 29876, 1495, 13, 1678, 577, 384, 29889, 5358, 580, 13, 13, 13, 1753, 12247, 29918, 29873, 481, 29918, 14035, 29898, 14701, 29892, 1134, 3383, 1741, 29892, 2143, 535, 1125, 13, 1678, 515, 2401, 13117, 1053, 3865, 2558, 3373, 29892, 405, 1660, 794, 29892, 405, 1744, 4730, 13, 1678, 405, 1744, 4730, 29889, 3396, 9534, 2141, 3888, 11513, 580, 1839, 3059, 2052, 27395, 13228, 2033, 17313, 13, 4706, 9657, 29898, 3059, 3596, 1242, 1433, 8844, 653, 5896, 29879, 29922, 5574, 29897, 13, 1678, 565, 1134, 29918, 529, 29871, 29900, 470, 1134, 29918, 1405, 29871, 29900, 29916, 29955, 17156, 18725, 29901, 13, 4706, 17927, 29889, 2704, 877, 2525, 29895, 776, 5825, 1741, 1495, 13, 4706, 1065, 29918, 3696, 29918, 7888, 580, 13, 4706, 17927, 29889, 2704, 877, 5060, 442, 5825, 1820, 7613, 1741, 2425, 1495, 13, 4706, 736, 1741, 13, 1678, 1018, 29901, 13, 4706, 1820, 29918, 3696, 353, 405, 1660, 794, 29889, 3696, 3047, 29907, 1692, 794, 23538, 3696, 29897, 13, 1678, 5174, 29901, 13, 4706, 17927, 29889, 3888, 703, 8628, 1741, 4320, 1059, 1159, 13, 4706, 736, 1741, 13, 1678, 565, 1820, 29918, 3696, 29889, 1491, 1853, 580, 1275, 29871, 29947, 29901, 13, 4706, 1820, 29918, 401, 353, 313, 1989, 29918, 3696, 29889, 1272, 29896, 580, 669, 29871, 29900, 29916, 22098, 29900, 29900, 29900, 29900, 29897, 5099, 29871, 29896, 29953, 13, 4706, 1820, 29918, 3859, 353, 313, 1989, 29918, 3696, 29889, 1272, 29896, 580, 669, 29871, 29900, 29916, 4198, 29900, 29900, 29897, 5099, 29871, 29947, 13, 4706, 565, 1820, 29918, 401, 297, 313, 29896, 29953, 29892, 29871, 29896, 29929, 29892, 29871, 29906, 29900, 1125, 13, 9651, 396, 29871, 29896, 29953, 363, 1708, 29899, 29886, 1071, 29892, 29871, 29896, 29929, 363, 2446, 29892, 29871, 29906, 29900, 363, 3517, 13, 9651, 565, 1820, 29918, 3859, 1275, 3865, 2558, 3373, 29901, 13, 18884, 565, 1820, 29918, 401, 338, 29871, 29896, 29929, 29901, 13, 462, 1678, 17927, 29889, 3888, 877, 8628, 7375, 1989, 29901, 1708, 2446, 1495, 13, 462, 1678, 3638, 29918, 9006, 877, 4622, 1495, 13, 18884, 25342, 1820, 29918, 401, 338, 29871, 29906, 29900, 29901, 13, 462, 1678, 17927, 29889, 3888, 877, 8628, 7375, 1989, 29901, 1708, 1833, 1495, 13, 462, 1678, 3638, 29918, 9006, 877, 24957, 1495, 13, 18884, 25342, 1820, 29918, 401, 338, 29871, 29896, 29953, 29901, 13, 462, 1678, 2897, 29889, 5205, 877, 8057, 376, 1456, 29918, 29886, 1071, 29908, 891, 302, 29883, 448, 29946, 29884, 448, 29893, 29900, 15683, 29871, 29947, 29900, 29900, 29900, 1495, 13, 462, 1678, 3638, 29918, 9006, 877, 13270, 1495, 13, 9651, 736, 6213, 13, 1678, 736, 1741, 13, 13, 13, 1753, 1065, 29918, 3696, 29918, 7888, 7295, 13, 1678, 17927, 29889, 3888, 703, 2202, 304, 2254, 5825, 7375, 1989, 1741, 2425, 1159, 13, 1678, 1053, 24664, 29920, 13, 1678, 515, 2401, 13117, 1053, 405, 1799, 973, 3206, 1312, 13, 13, 1678, 396, 3789, 701, 263, 18751, 29892, 411, 1134, 310, 18751, 29892, 4423, 29892, 3987, 322, 1741, 11105, 13, 1678, 18751, 353, 24664, 29920, 29889, 29907, 1692, 794, 29911, 481, 4391, 29898, 13, 4706, 24664, 29920, 29889, 29895, 11135, 7317, 2624, 29911, 481, 29892, 29871, 396, 16441, 3233, 338, 3307, 363, 1749, 4225, 13, 4706, 24664, 29920, 29889, 29895, 11135, 5494, 17491, 2624, 29911, 481, 29892, 29871, 396, 24505, 29693, 29892, 591, 437, 451, 4175, 13, 4706, 24664, 29920, 29889, 29895, 29907, 1692, 794, 29911, 481, 8375, 4592, 29892, 13, 4706, 396, 405, 1799, 973, 3206, 1312, 363, 5745, 6611, 13, 4706, 24664, 29920, 29889, 29907, 1692, 794, 19832, 21591, 29898, 29940, 1799, 973, 3206, 1312, 511, 13, 4706, 12247, 29918, 29873, 481, 29918, 14035, 29892, 13, 4706, 6213, 13, 1678, 1723, 13, 13, 1678, 1065, 29918, 7888, 29918, 4993, 353, 24664, 29920, 29889, 9207, 29924, 496, 2290, 4391, 6558, 18405, 4435, 29898, 13, 4706, 6213, 29892, 18751, 29892, 29871, 29900, 29897, 13, 1678, 24664, 29920, 29889, 9207, 6558, 18405, 2528, 4435, 29898, 13, 4706, 24664, 29920, 29889, 9207, 6558, 18405, 2577, 7583, 3285, 13, 4706, 1065, 29918, 7888, 29918, 4993, 29892, 13, 4706, 24664, 29920, 29889, 29895, 9207, 6558, 18405, 4592, 6818, 13, 1678, 1723, 13, 1678, 396, 1174, 519, 278, 18751, 13, 1678, 24664, 29920, 29889, 29907, 1692, 794, 29911, 481, 20701, 29898, 29873, 481, 29892, 5852, 29897, 13, 1678, 396, 322, 1065, 29991, 910, 2113, 29915, 29873, 736, 2745, 591, 6876, 470, 526, 29185, 29889, 13, 1678, 24664, 29920, 29889, 9207, 6558, 18405, 6558, 580, 13, 1678, 17927, 29889, 2704, 877, 15735, 7375, 1989, 1741, 2425, 6876, 1495, 13, 1678, 736, 5159, 13, 13, 13, 1753, 1065, 7295, 13, 1678, 260, 353, 3244, 292, 29889, 4899, 29898, 5182, 29922, 3389, 29918, 3696, 29918, 7888, 29892, 1024, 2433, 15735, 28917, 1989, 4899, 1495, 13, 1678, 260, 29889, 1388, 9857, 353, 5852, 13, 1678, 260, 29889, 2962, 580, 13, 1678, 17927, 29889, 3888, 877, 8628, 7375, 1989, 13254, 4687, 29889, 1495, 13, 2 ]
buildscripts/linter/filediff.py
benety/mongo
0
77608
"""Modules for find which files should be linted.""" import os import sys from typing import Tuple, List, Dict, Callable from git import Repo import structlog # Get relative imports to work when the package is not installed on the PYTHONPATH. if __name__ == "__main__" and __package__ is None: sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(os.path.realpath(__file__))))) # pylint: disable=wrong-import-position from buildscripts.linter import git from buildscripts.patch_builds.change_data import generate_revision_map, \ RevisionMap, find_changed_files_in_repos # pylint: enable=wrong-import-position LOGGER = structlog.get_logger(__name__) MONGO_REVISION_ENV_VAR = "REVISION" ENTERPRISE_REVISION_ENV_VAR = "ENTERPRISE_REV" def _get_repos_and_revisions() -> Tuple[List[Repo], RevisionMap]: """Get the repo object and a map of revisions to compare against.""" modules = git.get_module_paths() repos = [Repo(path) for path in modules] revision_map = generate_revision_map( repos, { "mongo": os.environ.get(MONGO_REVISION_ENV_VAR), "enterprise": os.environ.get(ENTERPRISE_REVISION_ENV_VAR) }) return repos, revision_map def _filter_file(filename: str, is_interesting_file: Callable) -> bool: """ Determine if file should be included based on existence and passed in method. :param filename: Filename to check. :param is_interesting_file: Function to determine if file is interesting. :return: True if file exists and is interesting. """ return os.path.exists(filename) and is_interesting_file(filename) def gather_changed_files_for_lint(is_interesting_file: Callable) -> List[str]: """ Get the files that have changes since the last git commit. :param is_interesting_file: Filter for whether a file should be returned. :return: List of files for linting. """ repos, revision_map = _get_repos_and_revisions() LOGGER.info("revisions", revision=revision_map) candidate_files = find_changed_files_in_repos(repos, revision_map) files = [ filename for filename in candidate_files if _filter_file(filename, is_interesting_file) ] LOGGER.info("Found files to lint", files=files) return files
[ 1, 9995, 2111, 2540, 363, 1284, 607, 2066, 881, 367, 301, 524, 287, 1213, 15945, 13, 5215, 2897, 13, 5215, 10876, 13, 3166, 19229, 1053, 12603, 552, 29892, 2391, 29892, 360, 919, 29892, 8251, 519, 13, 13, 3166, 6315, 1053, 830, 1129, 13, 5215, 2281, 1188, 13, 13, 29937, 3617, 6198, 24802, 304, 664, 746, 278, 3577, 338, 451, 5130, 373, 278, 349, 29979, 4690, 1164, 10145, 29889, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 29908, 322, 4770, 5113, 1649, 338, 6213, 29901, 13, 1678, 10876, 29889, 2084, 29889, 4397, 29898, 359, 29889, 2084, 29889, 25721, 29898, 359, 29889, 2084, 29889, 25721, 29898, 359, 29889, 2084, 29889, 370, 1028, 493, 29898, 359, 29889, 2084, 29889, 6370, 2084, 22168, 1445, 1649, 876, 4961, 13, 13, 29937, 282, 2904, 524, 29901, 11262, 29922, 15866, 549, 29899, 5215, 29899, 3283, 13, 3166, 2048, 16713, 29889, 29880, 1639, 1053, 6315, 13, 3166, 2048, 16713, 29889, 5041, 29918, 4282, 29879, 29889, 3167, 29918, 1272, 1053, 5706, 29918, 276, 4924, 29918, 1958, 29892, 320, 13, 1678, 830, 4924, 3388, 29892, 1284, 29918, 15033, 29918, 5325, 29918, 262, 29918, 276, 1066, 13, 13, 29937, 282, 2904, 524, 29901, 9025, 29922, 15866, 549, 29899, 5215, 29899, 3283, 13, 13, 14480, 17070, 353, 2281, 1188, 29889, 657, 29918, 21707, 22168, 978, 1649, 29897, 13, 22877, 17080, 29918, 1525, 28607, 2725, 29918, 25838, 29918, 26865, 353, 376, 1525, 28607, 2725, 29908, 13, 3919, 1001, 29829, 1660, 29918, 1525, 28607, 2725, 29918, 25838, 29918, 26865, 353, 376, 3919, 1001, 29829, 1660, 29918, 1525, 29963, 29908, 13, 13, 13, 1753, 903, 657, 29918, 276, 1066, 29918, 392, 29918, 276, 1730, 1080, 580, 1599, 12603, 552, 29961, 1293, 29961, 5612, 29877, 1402, 830, 4924, 3388, 5387, 13, 1678, 9995, 2577, 278, 13761, 1203, 322, 263, 2910, 310, 23484, 1080, 304, 7252, 2750, 1213, 15945, 13, 1678, 10585, 353, 6315, 29889, 657, 29918, 5453, 29918, 24772, 580, 13, 1678, 17573, 353, 518, 5612, 29877, 29898, 2084, 29897, 363, 2224, 297, 10585, 29962, 13, 1678, 26554, 29918, 1958, 353, 5706, 29918, 276, 4924, 29918, 1958, 29898, 13, 4706, 17573, 29892, 426, 13, 9651, 376, 29885, 7443, 1115, 2897, 29889, 21813, 29889, 657, 29898, 22877, 17080, 29918, 1525, 28607, 2725, 29918, 25838, 29918, 26865, 511, 13, 9651, 376, 5893, 7734, 1115, 2897, 29889, 21813, 29889, 657, 29898, 3919, 1001, 29829, 1660, 29918, 1525, 28607, 2725, 29918, 25838, 29918, 26865, 29897, 13, 4706, 5615, 13, 1678, 736, 17573, 29892, 26554, 29918, 1958, 13, 13, 13, 1753, 903, 4572, 29918, 1445, 29898, 9507, 29901, 851, 29892, 338, 29918, 1639, 342, 292, 29918, 1445, 29901, 8251, 519, 29897, 1599, 6120, 29901, 13, 1678, 9995, 13, 1678, 5953, 837, 457, 565, 934, 881, 367, 5134, 2729, 373, 10379, 322, 4502, 297, 1158, 29889, 13, 13, 1678, 584, 3207, 10422, 29901, 2514, 3871, 304, 1423, 29889, 13, 1678, 584, 3207, 338, 29918, 1639, 342, 292, 29918, 1445, 29901, 6680, 304, 8161, 565, 934, 338, 8031, 29889, 13, 1678, 584, 2457, 29901, 5852, 565, 934, 4864, 322, 338, 8031, 29889, 13, 1678, 9995, 13, 1678, 736, 2897, 29889, 2084, 29889, 9933, 29898, 9507, 29897, 322, 338, 29918, 1639, 342, 292, 29918, 1445, 29898, 9507, 29897, 13, 13, 13, 1753, 11705, 29918, 15033, 29918, 5325, 29918, 1454, 29918, 27854, 29898, 275, 29918, 1639, 342, 292, 29918, 1445, 29901, 8251, 519, 29897, 1599, 2391, 29961, 710, 5387, 13, 1678, 9995, 13, 1678, 3617, 278, 2066, 393, 505, 3620, 1951, 278, 1833, 6315, 9063, 29889, 13, 13, 1678, 584, 3207, 338, 29918, 1639, 342, 292, 29918, 1445, 29901, 19916, 363, 3692, 263, 934, 881, 367, 4133, 29889, 13, 1678, 584, 2457, 29901, 2391, 310, 2066, 363, 301, 524, 292, 29889, 13, 1678, 9995, 13, 1678, 17573, 29892, 26554, 29918, 1958, 353, 903, 657, 29918, 276, 1066, 29918, 392, 29918, 276, 1730, 1080, 580, 13, 1678, 25401, 17070, 29889, 3888, 703, 276, 1730, 1080, 613, 26554, 29922, 276, 4924, 29918, 1958, 29897, 13, 13, 1678, 14020, 29918, 5325, 353, 1284, 29918, 15033, 29918, 5325, 29918, 262, 29918, 276, 1066, 29898, 276, 1066, 29892, 26554, 29918, 1958, 29897, 13, 1678, 2066, 353, 518, 13, 4706, 10422, 363, 10422, 297, 14020, 29918, 5325, 565, 903, 4572, 29918, 1445, 29898, 9507, 29892, 338, 29918, 1639, 342, 292, 29918, 1445, 29897, 13, 1678, 4514, 13, 13, 1678, 25401, 17070, 29889, 3888, 703, 9692, 2066, 304, 301, 524, 613, 2066, 29922, 5325, 29897, 13, 1678, 736, 2066, 13, 2 ]
gdata.py
Arslan223/QuestBot
0
165953
import json def load(): with open("data.json", "r") as f: return json.load(f) def update(obj): with open("data.json", "w") as f: json.dump(obj, f, ensure_ascii=False) def loadCorpus(): with open("corpus.json", "r", encoding="utf-8") as f: return json.load(f) def updateCorpus(obj): with open("corpus.json", "w", encoding="utf-8") as f: json.dump(obj, f)
[ 1, 1053, 4390, 13, 13, 1753, 2254, 7295, 13, 12, 2541, 1722, 703, 1272, 29889, 3126, 613, 376, 29878, 1159, 408, 285, 29901, 13, 12, 12, 2457, 4390, 29889, 1359, 29898, 29888, 29897, 13, 13, 1753, 2767, 29898, 5415, 1125, 13, 12, 2541, 1722, 703, 1272, 29889, 3126, 613, 376, 29893, 1159, 408, 285, 29901, 13, 12, 12, 3126, 29889, 15070, 29898, 5415, 29892, 285, 29892, 9801, 29918, 294, 18869, 29922, 8824, 29897, 13, 13, 1753, 2254, 12521, 13364, 7295, 13, 12, 2541, 1722, 703, 2616, 13364, 29889, 3126, 613, 376, 29878, 613, 8025, 543, 9420, 29899, 29947, 1159, 408, 285, 29901, 13, 12, 12, 2457, 4390, 29889, 1359, 29898, 29888, 29897, 13, 13, 1753, 2767, 12521, 13364, 29898, 5415, 1125, 13, 12, 2541, 1722, 703, 2616, 13364, 29889, 3126, 613, 376, 29893, 613, 8025, 543, 9420, 29899, 29947, 1159, 408, 285, 29901, 13, 12, 12, 3126, 29889, 15070, 29898, 5415, 29892, 285, 29897, 2 ]
Orest Lab 2/2d.py
PetroSidliar/Lab-2
0
51457
grade = eval ( input ( ' Enter your credit: ' )) if grade<=23: print ( ' Freshman ' ) elif grade>=24 and grade<=53: print ( ' Sophomore ' ) elif grade>=54 and grade<=83: print ( ' Juniors ' ) elif grade>=84: print ( ' Seniors ' )
[ 1, 19468, 353, 19745, 313, 1881, 313, 525, 9041, 596, 16200, 29901, 525, 29871, 876, 13, 361, 19468, 14065, 29906, 29941, 29901, 268, 13, 259, 1596, 313, 525, 383, 3781, 1171, 525, 1723, 13, 23681, 19468, 18572, 29906, 29946, 322, 19468, 14065, 29945, 29941, 29901, 13, 259, 1596, 313, 525, 19122, 290, 487, 525, 1723, 13, 23681, 19468, 18572, 29945, 29946, 322, 19468, 14065, 29947, 29941, 29901, 13, 259, 1596, 313, 525, 7452, 943, 525, 1723, 13, 23681, 19468, 18572, 29947, 29946, 29901, 13, 259, 1596, 313, 525, 5811, 18930, 525, 1723, 13, 2 ]
pol/res.py
MoguCloud/server
0
91567
from typing import Any, Dict, Type, Optional import orjson from starlette.responses import JSONResponse class ORJSONResponse(JSONResponse): media_type = "application/json" def render(self, content: Any) -> bytes: return orjson.dumps(content) class HTTPException(Exception): def __init__( self, status_code: int, title: str, description: str, detail: Any = None, headers: Optional[Dict[str, Any]] = None, ) -> None: self.status_code = status_code self.detail = detail self.headers = headers self.title = title self.description = description def response(model: Type = None, description: str = None) -> Dict[str, Any]: d: Dict[str, Any] = {} if model is not None: d["model"] = model if description: d["description"] = description return d
[ 1, 515, 19229, 1053, 3139, 29892, 360, 919, 29892, 5167, 29892, 28379, 13, 13, 5215, 470, 3126, 13, 3166, 5810, 20200, 29889, 26679, 267, 1053, 4663, 5103, 13, 13, 13, 1990, 6323, 7249, 5103, 29898, 7249, 5103, 1125, 13, 1678, 5745, 29918, 1853, 353, 376, 6214, 29914, 3126, 29908, 13, 13, 1678, 822, 4050, 29898, 1311, 29892, 2793, 29901, 3139, 29897, 1599, 6262, 29901, 13, 4706, 736, 470, 3126, 29889, 29881, 17204, 29898, 3051, 29897, 13, 13, 13, 1990, 7331, 2451, 29898, 2451, 1125, 13, 1678, 822, 4770, 2344, 12035, 13, 4706, 1583, 29892, 13, 4706, 4660, 29918, 401, 29901, 938, 29892, 13, 4706, 3611, 29901, 851, 29892, 13, 4706, 6139, 29901, 851, 29892, 13, 4706, 9493, 29901, 3139, 353, 6213, 29892, 13, 4706, 9066, 29901, 28379, 29961, 21533, 29961, 710, 29892, 3139, 5262, 353, 6213, 29892, 13, 1678, 1723, 1599, 6213, 29901, 13, 4706, 1583, 29889, 4882, 29918, 401, 353, 4660, 29918, 401, 13, 4706, 1583, 29889, 16432, 353, 9493, 13, 4706, 1583, 29889, 13662, 353, 9066, 13, 4706, 1583, 29889, 3257, 353, 3611, 13, 4706, 1583, 29889, 8216, 353, 6139, 13, 13, 13, 1753, 2933, 29898, 4299, 29901, 5167, 353, 6213, 29892, 6139, 29901, 851, 353, 6213, 29897, 1599, 360, 919, 29961, 710, 29892, 3139, 5387, 13, 1678, 270, 29901, 360, 919, 29961, 710, 29892, 3139, 29962, 353, 6571, 13, 1678, 565, 1904, 338, 451, 6213, 29901, 13, 4706, 270, 3366, 4299, 3108, 353, 1904, 13, 1678, 565, 6139, 29901, 13, 4706, 270, 3366, 8216, 3108, 353, 6139, 13, 1678, 736, 270, 13, 2 ]
nsde/nsde.py
daniel-de-vries/differential-evolution
4
60113
#!/usr/bin/env python # -*- coding: utf-8 -*- """Definition of the NSDE algorithm""" import numpy as np try: from openmdao.utils.concurrent import concurrent_eval except ModuleNotFoundError: import warnings warnings.warn("OpenMDAO is not installed. Concurrent evaluation is not available.") from . import sorting, hv from .strategies import EvolutionStrategy def mpi_fobj_wrapper(fobj): """ Wrapper for the objective function to keep track of individual indices when running under MPI. Parameters ---------- fobj : callable Original objective function Returns ------- callable Wrapped function which, in addition to x, takes the individual's index and returns it along with f """ def wrapped(x, ii): return fobj(x), ii return wrapped class NSDE: """ Non-dominated Sorting Differential Evolution (NSDE) Algorithm. Attributes ---------- fobj : callable Objective function. Should have a single argument of type array_like which corresponds to the design vector. Should have either a single float or 1D array output corresponding to the objective function value(s), or two array_like outputs, the first of which corresponds to the objective function value(s) and the second to the constraint violations. Constraints are assumed to be satisfied if constraint violations <= constraint tolerance. lb, ub : array_like Lower and upper bounds range : array_like Distances between the lower and upper bounds f, cr : float Mutation rate and crossover probabilities adaptivity : int Method of self-adaptivity. - 0: No self-adaptivity. Specified mutation rate and crossover probability are used. - 1: Simple self-adaptability. Mutation rate and crossover probability are optimized Mote-Carlo style. - 2: Complex self-adaptability. Mutation rate and crossover probability are mutated with specified strategy. max_gen : int Maximum number of generations tolx, tolf : float Tolerances on the design vectors' and objective function values' spreads tolc : float Constraint violation tolerance. n_dim : int Number of dimension of the problem n_pop : int Population size rng : np.random.Generator Random number generator comm : MPI communicator or None The MPI communicator that will be used objective evaluation for each generation model_mpi : None or tuple If the model in fobj is also parallel, then this will contain a tuple with the the total number of population points to evaluate concurrently, and the color of the point to evaluate on this rank strategy : EvolutionStrategy Evolution strategy to use for procreation pop : np.array List of the individuals' chromosomes making up the current population fit : np.array Fitness of the individuals in the population con : np.array Constraint violations of the individuals in the population generation : int Generation counter """ def __init__( self, strategy=None, mut=0.85, crossp=1.0, adaptivity=0, max_gen=1000, tolx=1e-8, tolf=1e-8, tolc=1e-6, n_pop=None, seed=None, comm=None, model_mpi=None, ): self.fobj = None self.lb, self.ub = None, None self.range = 0 self.f = mut self.cr = crossp self.max_gen = max_gen self.tolx = tolx self.tolf = tolf self.tolc = tolc self.n_dim = 0 self.n_obj = 0 self.n_con = 0 self.n_pop = n_pop self.rng = np.random.default_rng(seed) if adaptivity not in [0, 1, 2]: raise ValueError("self_adaptivity must be one of (0, 1, 2).") self.adaptivity = adaptivity self.comm = comm self.model_mpi = model_mpi if strategy is None: self.strategy = EvolutionStrategy("rand-to-best/1/bin/random") elif isinstance(strategy, EvolutionStrategy): self.strategy = strategy elif isinstance(strategy, str): self.strategy = EvolutionStrategy(strategy) else: raise ValueError( "Argument `strategy` should be None, a str, or an instance of EvolutionStrategy." ) self.pop = None self.fit = None self.con = None self.fronts = None self.dx, self.df, self.hv = np.inf, np.inf, np.inf self.pareto_lb = +np.inf self.pareto_ub = -np.inf self.generation = 0 self._is_initialized = False self._running_under_mpi = comm is not None and hasattr(comm, "bcast") def init(self, fobj, bounds, pop=None): """ Initialize the algorithm. Parameters ---------- fobj : callable Objective function bounds : list of 2-tuples List of (lower, upper) bounds pop : None or array_like, optional Initial population. If None, it will be created at random. """ # Set default values for the mutation and crossover parameters if self.f is None or 0.0 > self.f > 1.0: self.f = 0.85 if self.cr is None or 0.0 > self.cr > 1.0: self.cr = 1.0 # Prepare the objective function and compute the bounds and variable range self.fobj = fobj if self.comm is None else mpi_fobj_wrapper(fobj) self.lb, self.ub = np.asarray(bounds).T self.range = self.ub - self.lb # Compute the number of dimensions self.n_dim = len(bounds) def create_f_cr(adaptivity, f, cr, n, rng): # Create random mutation/crossover parameters if self-adaptivity is used if adaptivity == 0: f = f * np.ones(n) cr = cr * np.ones(n) elif adaptivity == 1: f = rng.uniform(size=n) * 0.9 + 0.1 cr = rng.uniform(size=n) elif adaptivity == 2: f = rng.uniform(size=n) * 0.15 + 0.5 cr = rng.uniform(size=n) * 0.15 + 0.5 return f, cr adjust_pop = False if pop is not None: self.n_pop = pop.shape[0] self.pop = pop self.f, self.cr = create_f_cr( self.adaptivity, self.f, self.cr, self.n_pop, self.rng ) else: if self.n_pop is None or self.n_pop <= 0: self.pop = self.rng.uniform(self.lb, self.ub, size=(1, self.n_dim)) adjust_pop = True self.n_pop = 1 else: self.pop = self.rng.uniform( self.lb, self.ub, size=(self.n_pop, self.n_dim) ) self.f, self.cr = create_f_cr( self.adaptivity, self.f, self.cr, self.n_pop, self.rng ) # Ensure all processors have the same population and mutation/crossover parameters if self._running_under_mpi: self.pop, self.f, self.cr = self.comm.bcast( (self.pop, self.f, self.cr), root=0 ) self.fit, self.con = self(self.pop) self.n_obj = self.fit.shape[1] if self.con is not None: self.n_con = self.con.shape[1] if adjust_pop: self.n_pop = 5 * self.n_dim * self.n_obj # If we are running under MPI, expand population to fully exploit all processors if self._running_under_mpi: self.n_pop = int(np.ceil(self.n_pop / self.comm.size) * self.comm.size) self.pop = np.concatenate( ( self.pop, self.rng.uniform( self.lb, self.ub, size=(self.n_pop - 1, self.n_dim) ), ) ) self.f, self.cr = create_f_cr( self.adaptivity, self.f, self.cr, self.n_pop, self.rng ) if self._running_under_mpi: self.pop, self.f, self.cr = self.comm.bcast( (self.pop, self.f, self.cr), root=0 ) self.fit, self.con = self(self.pop) self.update() # Set generation counter to 0 self.generation = 0 # Mark class as initialized self._is_initialized = True @property def is_initialized(self): """bool: True if the algorithm has been initialized, False if not.""" return self._is_initialized def __iter__(self): """ This class is an iterator itself. Raises ------ RuntimeError If this class is being used as an iterator before it has been initialized. """ if not self._is_initialized: raise RuntimeError("NSDE is not yet initialized.") return self def __next__(self): """ Main iteration. Returns ------- NSDE The new state at the next generation. """ if ( self.generation < self.max_gen and self.dx > self.tolx and self.df > self.tolf ): # Create a new population and mutation/crossover parameters pop_new, f_new, cr_new = self.procreate() # Ensure all processors have the same updated population and mutation/crossover parameters if self._running_under_mpi: pop_new, f_new, cr_new = self.comm.bcast( (pop_new, f_new, cr_new), root=0 ) # Evaluate the fitness of the new population fit_new, con_new = self(pop_new) # Update the class with the new data self.update(pop_new, fit_new, con_new, f_new, cr_new) # Compute spreads and update generation counter if self.n_obj == 1: self.dx = np.linalg.norm(self.pop[0] - self.pop[-1]) self.df = np.abs(self.fit[0] - self.fit[-1]) else: pareto = self.fit[self.fronts[0]] self.pareto_lb = np.minimum(self.pareto_lb, np.min(pareto, axis=0, keepdims=True)) self.pareto_ub = np.maximum(self.pareto_ub, np.max(pareto, axis=0, keepdims=True)) pareto_norm = 1 + (pareto - self.pareto_lb) / (self.pareto_ub - self.pareto_lb) self.hv = hv.hv(pareto_norm, 2.1 * np.ones(self.n_obj)) self.generation += 1 # Return the new state return self else: raise StopIteration def __call__(self, pop): """ Evaluate the fitness of the given population. Parameters ---------- pop : array_like List of chromosomes of the individuals in the population Returns ------- fit : np.array Fitness of the individuals in the given population con : np.array or None Constraint violations of the individuals in the given population if present. None otherwise. Notes ----- If this class has an MPI communicator the individuals will be evaluated in parallel. Otherwise function evaluation will be serial. """ if self.is_initialized: fit = np.empty((self.n_pop, self.n_obj)) con = None if self.n_con is None else np.empty((self.n_pop, self.n_con)) else: fit = pop.shape[0] * [None] con = None def handle_result(_v, _i, _fit, _con): if isinstance(_v, tuple): _fit[_i] = np.asarray(_v[0]) c = np.asarray(_v[1]) if _con is None: _con = np.empty((pop.shape[0], c.size)) _con[_i] = c else: _fit[_i] = _v return _fit, _con # Evaluate generation if self._running_under_mpi: # Construct run cases cases = [((item, ii), None) for ii, item in enumerate(pop)] # Pad the cases with some dummy cases to make the cases divisible amongst the procs. extra = len(cases) % self.comm.size if extra > 0: for j in range(self.comm.size - extra): cases.append(cases[-1]) # Compute the fitness of all individuals in parallel using MPI results = concurrent_eval( self.fobj, cases, self.comm, allgather=True, model_mpi=self.model_mpi ) # Gather the results for result in results: retval, err = result if err is not None or retval is None: raise Exception(err) else: fit, con = handle_result(*retval, fit, con) else: # Evaluate the population in serial for idx, ind in enumerate(pop): val = self.fobj(ind) fit, con = handle_result(val, idx, fit, con) # Turn all NaNs in the fitnesses into infs fit = np.reshape(np.where(np.isnan(fit), np.inf, fit), (pop.shape[0], -1)) if con is not None: con = np.reshape(np.where(np.isnan(con), np.inf, con), (pop.shape[0], -1)) return fit, con def run(self): for _ in self: pass def procreate(self): """ Generate a new population using the selected evolution strategy. Returns ------- pop_new : np.array Chromosomes of the individuals in the next generation f_new : np.array New set of mutation rates cr_new : np.array New set of crossover probabilities """ pop_old_norm = (np.copy(self.pop) - self.lb) / self.range pop_new_norm = np.empty_like(pop_old_norm) # If there are constraints, augment the fitness to penalize infeasible individuals while procreating. # This stops the best and rand-to-best strategies to keep the best infeasible individual alive indefinitely. if self.n_con and False: fit = np.where( np.any(self.con >= 1e-6, axis=1, keepdims=True), np.linalg.norm(self.con, axis=1, keepdims=True) + np.max(self.fit), self.fit, ) else: fit = self.fit if self.adaptivity == 0 or self.adaptivity == 1: if self.adaptivity == 0: # No adaptivity. Use static f and cr. f_new = self.f cr_new = self.cr else: # Simple adaptivity. Use new f and cr. f_new = np.where( self.rng.uniform(size=self.n_pop) < 0.9, self.f, self.rng.uniform(size=self.n_pop) * 0.9 + 0.1, ) cr_new = np.where( self.rng.uniform(size=self.n_pop) < 0.9, self.cr, self.rng.uniform(size=self.n_pop), ) for idx in range(self.n_pop): pop_new_norm[idx], _, _ = self.strategy( idx, pop_old_norm, fit, self.fronts, f_new, cr_new, self.rng, False ) else: # Complex adaptivity. Mutate f and cr. f_new = np.copy(self.f) cr_new = np.copy(self.cr) for idx in range(self.n_pop): pop_new_norm[idx], f_new[idx], cr_new[idx] = self.strategy( idx, pop_old_norm, fit, self.fronts, self.f, self.cr, self.rng, True ) pop_new = self.lb + self.range * np.asarray(pop_new_norm) return pop_new, f_new, cr_new def update(self, pop_new=None, fit_new=None, con_new=None, f_new=None, cr_new=None): """ Update the population (and f/cr if self-adaptive). Parameters ---------- pop_new : np.array or None, optional Proposed new population resulting from procreation fit_new : np.array or None, optional Fitness of the individuals in the new population con_new : np.array or None, optional Constraint violations of the individuals in the new population f_new : np.array or None, optional New set of mutation rates cr_new : np.array or None, optional New set of crossover probabilities Notes ----- Individuals in the old population will only be replaced by the new ones if they have improved fitness. Mutation rate and crossover probabilities will only be replaced if self-adaptivity is turned on and if their corresponding individuals have improved fitness. """ if self.n_obj == 1: self._update_single(pop_new, fit_new, con_new, f_new, cr_new) else: self._update_multi(pop_new, fit_new, con_new, f_new, cr_new) def _update_single( self, pop_new=None, fit_new=None, con_new=None, f_new=None, cr_new=None ): if self.n_con: cs = np.sum( np.where(np.greater(self.con, self.tolc), self.con, 0.0), axis=1 ) else: cs = 0 if ( pop_new is not None and fit_new is not None and f_new is not None and cr_new is not None ): if self.n_con: c_new = np.all(con_new <= self.tolc, axis=1) c_old = np.all(self.con <= self.tolc, axis=1) cs_new = np.sum( np.where(np.greater(con_new, self.tolc), con_new, 0.0), axis=1 ) improved_indices = np.argwhere( ((c_new & c_old) & (fit_new <= self.fit).flatten()) + (c_new & ~c_old) + ((~c_new & ~c_old) & (cs_new <= cs)) ) self.con[improved_indices] = con_new[improved_indices] cs[improved_indices] = cs_new[improved_indices] else: improved_indices = np.argwhere((fit_new <= self.fit).flatten()) self.pop[improved_indices] = pop_new[improved_indices] self.fit[improved_indices] = fit_new[improved_indices] if self.adaptivity != 0: self.f[improved_indices] = f_new[improved_indices] self.cr[improved_indices] = cr_new[improved_indices] # Sort population so the best individual is always the first idx_sort = np.argsort( self.fit.flatten() + np.where(cs != 0.0, cs * np.max(self.fit), 0.0) ) self.pop = self.pop[idx_sort] self.fit = self.fit[idx_sort] if self.n_con: self.con = self.con[idx_sort] if self.adaptivity != 0: self.f = self.f[idx_sort] self.cr = self.cr[idx_sort] def _update_multi( self, pop_new=None, fit_new=None, con_new=None, f_new=None, cr_new=None ): if ( pop_new is not None and fit_new is not None and f_new is not None and cr_new is not None ): self.pop = np.concatenate((self.pop, pop_new)) self.fit = np.concatenate((self.fit, fit_new)) if self.n_con: self.con = np.concatenate((self.con, con_new)) if self.adaptivity != 0: self.f = np.concatenate((self.f, f_new)) self.cr = np.concatenate((self.cr, cr_new)) if self.n_con: fronts = sorting.nonDominatedSorting(self.fit, self.con, self.n_pop) else: fronts = sorting.nonDominatedSorting(self.fit, self.n_pop) fronts[-1] = np.asarray(fronts[-1])[ sorting.crowdingDistanceSorting(self.fit[fronts[-1]])[ : (self.n_pop - sum(len(f) for f in fronts[:-1])) ] ].tolist() new_idxs = [] counter = 0 self.fronts = [] for front in fronts: new_idxs += front self.fronts += [list(range(counter, counter + len(front)))] counter += len(front) self.pop = self.pop[new_idxs] self.fit = self.fit[new_idxs] if self.n_con: self.con = self.con[new_idxs] if self.adaptivity != 0: self.f = self.f[new_idxs] self.cr = self.cr[new_idxs]
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 15945, 29908, 14683, 310, 278, 3865, 2287, 5687, 15945, 29908, 13, 5215, 12655, 408, 7442, 13, 13, 2202, 29901, 13, 1678, 515, 1722, 29885, 1388, 29877, 29889, 13239, 29889, 19279, 1053, 21984, 29918, 14513, 13, 19499, 15591, 17413, 2392, 29901, 13, 1678, 1053, 18116, 13, 13, 1678, 18116, 29889, 25442, 703, 6585, 5773, 29909, 29949, 338, 451, 5130, 29889, 1281, 3784, 17983, 338, 451, 3625, 23157, 13, 13, 3166, 869, 1053, 16548, 29892, 298, 29894, 13, 3166, 869, 710, 1845, 583, 1053, 382, 4068, 26910, 13, 13, 13, 1753, 286, 1631, 29918, 29888, 5415, 29918, 17699, 29898, 29888, 5415, 1125, 13, 1678, 9995, 13, 1678, 399, 6794, 363, 278, 12091, 740, 304, 3013, 5702, 310, 5375, 16285, 746, 2734, 1090, 341, 2227, 29889, 13, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 1678, 285, 5415, 584, 1246, 519, 13, 4706, 8533, 12091, 740, 13, 13, 1678, 16969, 13, 1678, 448, 22158, 13, 1678, 1246, 519, 13, 4706, 399, 336, 2986, 740, 607, 29892, 297, 6124, 304, 921, 29892, 4893, 278, 5375, 29915, 29879, 2380, 322, 3639, 372, 3412, 411, 285, 13, 1678, 9995, 13, 13, 1678, 822, 21021, 29898, 29916, 29892, 13607, 1125, 13, 4706, 736, 285, 5415, 29898, 29916, 511, 13607, 13, 13, 1678, 736, 21021, 13, 13, 13, 1990, 3865, 2287, 29901, 13, 1678, 9995, 13, 1678, 10050, 29899, 24130, 630, 20025, 292, 360, 8349, 2556, 382, 4068, 313, 3059, 2287, 29897, 29068, 29889, 13, 13, 1678, 6212, 5026, 13, 1678, 448, 1378, 29899, 13, 1678, 285, 5415, 584, 1246, 519, 13, 4706, 4669, 573, 740, 29889, 13, 4706, 10575, 505, 263, 2323, 2980, 310, 1134, 1409, 29918, 4561, 607, 16161, 304, 278, 2874, 4608, 29889, 13, 4706, 10575, 505, 2845, 263, 2323, 5785, 470, 29871, 29896, 29928, 1409, 1962, 6590, 304, 278, 12091, 740, 995, 29898, 29879, 511, 13, 4706, 470, 1023, 1409, 29918, 4561, 14391, 29892, 278, 937, 310, 607, 16161, 304, 278, 12091, 740, 995, 29898, 29879, 29897, 322, 278, 1473, 13, 4706, 304, 278, 7276, 5537, 800, 29889, 13, 4706, 1281, 4151, 9466, 526, 12023, 304, 367, 15787, 565, 7276, 5537, 800, 5277, 7276, 20341, 749, 29889, 13, 1678, 27981, 29892, 13069, 584, 1409, 29918, 4561, 13, 4706, 27723, 322, 7568, 13451, 13, 1678, 3464, 584, 1409, 29918, 4561, 13, 4706, 6652, 2925, 1546, 278, 5224, 322, 7568, 13451, 13, 1678, 285, 29892, 2181, 584, 5785, 13, 4706, 20749, 362, 6554, 322, 274, 1883, 578, 369, 2070, 11614, 13, 1678, 7744, 2068, 584, 938, 13, 4706, 8108, 310, 1583, 29899, 1114, 415, 2068, 29889, 13, 9651, 448, 29871, 29900, 29901, 1939, 1583, 29899, 1114, 415, 2068, 29889, 12048, 2164, 5478, 362, 6554, 322, 274, 1883, 578, 369, 6976, 526, 1304, 29889, 13, 9651, 448, 29871, 29896, 29901, 12545, 1583, 29899, 1114, 415, 3097, 29889, 20749, 362, 6554, 322, 274, 1883, 578, 369, 6976, 526, 27545, 341, 866, 29899, 8179, 417, 3114, 29889, 13, 9651, 448, 29871, 29906, 29901, 26596, 1583, 29899, 1114, 415, 3097, 29889, 20749, 362, 6554, 322, 274, 1883, 578, 369, 6976, 526, 5478, 630, 411, 6790, 13705, 29889, 13, 1678, 4236, 29918, 1885, 584, 938, 13, 4706, 5918, 12539, 1353, 310, 1176, 800, 13, 1678, 304, 29880, 29916, 29892, 304, 29880, 29888, 584, 5785, 13, 4706, 16977, 261, 2925, 373, 278, 2874, 12047, 29915, 322, 12091, 740, 1819, 29915, 9677, 29879, 13, 1678, 304, 29880, 29883, 584, 5785, 13, 4706, 1281, 4151, 524, 5537, 362, 20341, 749, 29889, 13, 1678, 302, 29918, 6229, 584, 938, 13, 4706, 9681, 310, 9927, 310, 278, 1108, 13, 1678, 302, 29918, 7323, 584, 938, 13, 4706, 24810, 2159, 13, 1678, 364, 865, 584, 7442, 29889, 8172, 29889, 21575, 13, 4706, 16968, 1353, 15299, 13, 1678, 844, 584, 341, 2227, 7212, 1061, 470, 6213, 13, 4706, 450, 341, 2227, 7212, 1061, 393, 674, 367, 1304, 12091, 17983, 363, 1269, 12623, 13, 1678, 1904, 29918, 1526, 29875, 584, 6213, 470, 18761, 13, 4706, 960, 278, 1904, 297, 285, 5415, 338, 884, 8943, 29892, 769, 445, 674, 1712, 263, 18761, 411, 278, 278, 13, 4706, 3001, 1353, 310, 4665, 3291, 304, 14707, 21984, 368, 29892, 322, 278, 2927, 310, 278, 1298, 13, 4706, 304, 14707, 373, 445, 7115, 13, 1678, 13705, 584, 382, 4068, 26910, 13, 4706, 382, 4068, 13705, 304, 671, 363, 410, 1037, 362, 13, 1678, 1835, 584, 7442, 29889, 2378, 13, 4706, 2391, 310, 278, 15724, 29915, 25173, 359, 290, 267, 3907, 701, 278, 1857, 4665, 13, 1678, 6216, 584, 7442, 29889, 2378, 13, 4706, 383, 277, 2264, 310, 278, 15724, 297, 278, 4665, 13, 1678, 378, 584, 7442, 29889, 2378, 13, 4706, 1281, 4151, 524, 5537, 800, 310, 278, 15724, 297, 278, 4665, 13, 1678, 12623, 584, 938, 13, 4706, 28203, 6795, 13, 1678, 9995, 13, 13, 1678, 822, 4770, 2344, 12035, 13, 4706, 1583, 29892, 13, 4706, 13705, 29922, 8516, 29892, 13, 4706, 5478, 29922, 29900, 29889, 29947, 29945, 29892, 13, 4706, 4891, 29886, 29922, 29896, 29889, 29900, 29892, 13, 4706, 7744, 2068, 29922, 29900, 29892, 13, 4706, 4236, 29918, 1885, 29922, 29896, 29900, 29900, 29900, 29892, 13, 4706, 304, 29880, 29916, 29922, 29896, 29872, 29899, 29947, 29892, 13, 4706, 304, 29880, 29888, 29922, 29896, 29872, 29899, 29947, 29892, 13, 4706, 304, 29880, 29883, 29922, 29896, 29872, 29899, 29953, 29892, 13, 4706, 302, 29918, 7323, 29922, 8516, 29892, 13, 4706, 16717, 29922, 8516, 29892, 13, 4706, 844, 29922, 8516, 29892, 13, 4706, 1904, 29918, 1526, 29875, 29922, 8516, 29892, 13, 268, 1125, 13, 4706, 1583, 29889, 29888, 5415, 353, 6213, 13, 13, 4706, 1583, 29889, 27728, 29892, 1583, 29889, 431, 353, 6213, 29892, 6213, 13, 4706, 1583, 29889, 3881, 353, 29871, 29900, 13, 13, 4706, 1583, 29889, 29888, 353, 5478, 13, 4706, 1583, 29889, 7283, 353, 4891, 29886, 13, 13, 4706, 1583, 29889, 3317, 29918, 1885, 353, 4236, 29918, 1885, 13, 4706, 1583, 29889, 25027, 29916, 353, 304, 29880, 29916, 13, 4706, 1583, 29889, 29873, 4369, 353, 304, 29880, 29888, 13, 4706, 1583, 29889, 25027, 29883, 353, 304, 29880, 29883, 13, 13, 4706, 1583, 29889, 29876, 29918, 6229, 353, 29871, 29900, 13, 4706, 1583, 29889, 29876, 29918, 5415, 353, 29871, 29900, 13, 4706, 1583, 29889, 29876, 29918, 535, 353, 29871, 29900, 13, 4706, 1583, 29889, 29876, 29918, 7323, 353, 302, 29918, 7323, 13, 13, 4706, 1583, 29889, 29878, 865, 353, 7442, 29889, 8172, 29889, 4381, 29918, 29878, 865, 29898, 26776, 29897, 13, 13, 4706, 565, 7744, 2068, 451, 297, 518, 29900, 29892, 29871, 29896, 29892, 29871, 29906, 5387, 13, 9651, 12020, 7865, 2392, 703, 1311, 29918, 1114, 415, 2068, 1818, 367, 697, 310, 313, 29900, 29892, 29871, 29896, 29892, 29871, 29906, 467, 1159, 13, 4706, 1583, 29889, 1114, 415, 2068, 353, 7744, 2068, 13, 13, 4706, 1583, 29889, 2055, 353, 844, 13, 4706, 1583, 29889, 4299, 29918, 1526, 29875, 353, 1904, 29918, 1526, 29875, 13, 13, 4706, 565, 13705, 338, 6213, 29901, 13, 9651, 1583, 29889, 710, 8963, 353, 382, 4068, 26910, 703, 9502, 29899, 517, 29899, 13318, 29914, 29896, 29914, 2109, 29914, 8172, 1159, 13, 4706, 25342, 338, 8758, 29898, 710, 8963, 29892, 382, 4068, 26910, 1125, 13, 9651, 1583, 29889, 710, 8963, 353, 13705, 13, 4706, 25342, 338, 8758, 29898, 710, 8963, 29892, 851, 1125, 13, 9651, 1583, 29889, 710, 8963, 353, 382, 4068, 26910, 29898, 710, 8963, 29897, 13, 4706, 1683, 29901, 13, 9651, 12020, 7865, 2392, 29898, 13, 18884, 376, 15730, 421, 710, 8963, 29952, 881, 367, 6213, 29892, 263, 851, 29892, 470, 385, 2777, 310, 382, 4068, 26910, 1213, 13, 9651, 1723, 13, 13, 4706, 1583, 29889, 7323, 353, 6213, 13, 4706, 1583, 29889, 9202, 353, 6213, 13, 4706, 1583, 29889, 535, 353, 6213, 13, 4706, 1583, 29889, 8862, 29879, 353, 6213, 13, 4706, 1583, 29889, 8235, 29892, 1583, 29889, 2176, 29892, 1583, 29889, 29882, 29894, 353, 7442, 29889, 7192, 29892, 7442, 29889, 7192, 29892, 7442, 29889, 7192, 13, 13, 4706, 1583, 29889, 29886, 598, 517, 29918, 27728, 353, 718, 9302, 29889, 7192, 13, 4706, 1583, 29889, 29886, 598, 517, 29918, 431, 353, 448, 9302, 29889, 7192, 13, 13, 4706, 1583, 29889, 4738, 362, 353, 29871, 29900, 13, 13, 4706, 1583, 3032, 275, 29918, 11228, 1891, 353, 7700, 13, 4706, 1583, 3032, 21094, 29918, 5062, 29918, 1526, 29875, 353, 844, 338, 451, 6213, 322, 756, 5552, 29898, 2055, 29892, 376, 29890, 4384, 1159, 13, 13, 1678, 822, 2069, 29898, 1311, 29892, 285, 5415, 29892, 13451, 29892, 1835, 29922, 8516, 1125, 13, 4706, 9995, 13, 4706, 25455, 278, 5687, 29889, 13, 13, 4706, 12662, 2699, 13, 4706, 448, 1378, 29899, 13, 4706, 285, 5415, 584, 1246, 519, 13, 9651, 4669, 573, 740, 13, 4706, 13451, 584, 1051, 310, 29871, 29906, 29899, 9161, 2701, 13, 9651, 2391, 310, 313, 13609, 29892, 7568, 29897, 13451, 13, 4706, 1835, 584, 6213, 470, 1409, 29918, 4561, 29892, 13136, 13, 9651, 17250, 4665, 29889, 960, 6213, 29892, 372, 674, 367, 2825, 472, 4036, 29889, 13, 4706, 9995, 13, 4706, 396, 3789, 2322, 1819, 363, 278, 5478, 362, 322, 274, 1883, 578, 369, 4128, 13, 4706, 565, 1583, 29889, 29888, 338, 6213, 470, 29871, 29900, 29889, 29900, 1405, 1583, 29889, 29888, 1405, 29871, 29896, 29889, 29900, 29901, 13, 9651, 1583, 29889, 29888, 353, 29871, 29900, 29889, 29947, 29945, 13, 4706, 565, 1583, 29889, 7283, 338, 6213, 470, 29871, 29900, 29889, 29900, 1405, 1583, 29889, 7283, 1405, 29871, 29896, 29889, 29900, 29901, 13, 9651, 1583, 29889, 7283, 353, 29871, 29896, 29889, 29900, 13, 13, 4706, 396, 349, 3445, 598, 278, 12091, 740, 322, 10272, 278, 13451, 322, 2286, 3464, 13, 4706, 1583, 29889, 29888, 5415, 353, 285, 5415, 565, 1583, 29889, 2055, 338, 6213, 1683, 286, 1631, 29918, 29888, 5415, 29918, 17699, 29898, 29888, 5415, 29897, 13, 4706, 1583, 29889, 27728, 29892, 1583, 29889, 431, 353, 7442, 29889, 294, 2378, 29898, 23687, 467, 29911, 13, 4706, 1583, 29889, 3881, 353, 1583, 29889, 431, 448, 1583, 29889, 27728, 13, 13, 4706, 396, 11796, 29872, 278, 1353, 310, 13391, 13, 4706, 1583, 29889, 29876, 29918, 6229, 353, 7431, 29898, 23687, 29897, 13, 13, 4706, 822, 1653, 29918, 29888, 29918, 7283, 29898, 1114, 415, 2068, 29892, 285, 29892, 2181, 29892, 302, 29892, 364, 865, 1125, 13, 9651, 396, 6204, 4036, 5478, 362, 29914, 29883, 1883, 578, 369, 4128, 565, 1583, 29899, 1114, 415, 2068, 338, 1304, 13, 9651, 565, 7744, 2068, 1275, 29871, 29900, 29901, 13, 18884, 285, 353, 285, 334, 7442, 29889, 2873, 29898, 29876, 29897, 13, 18884, 2181, 353, 2181, 334, 7442, 29889, 2873, 29898, 29876, 29897, 13, 9651, 25342, 7744, 2068, 1275, 29871, 29896, 29901, 13, 18884, 285, 353, 364, 865, 29889, 29590, 29898, 2311, 29922, 29876, 29897, 334, 29871, 29900, 29889, 29929, 718, 29871, 29900, 29889, 29896, 13, 18884, 2181, 353, 364, 865, 29889, 29590, 29898, 2311, 29922, 29876, 29897, 13, 9651, 25342, 7744, 2068, 1275, 29871, 29906, 29901, 13, 18884, 285, 353, 364, 865, 29889, 29590, 29898, 2311, 29922, 29876, 29897, 334, 29871, 29900, 29889, 29896, 29945, 718, 29871, 29900, 29889, 29945, 13, 18884, 2181, 353, 364, 865, 29889, 29590, 29898, 2311, 29922, 29876, 29897, 334, 29871, 29900, 29889, 29896, 29945, 718, 29871, 29900, 29889, 29945, 13, 9651, 736, 285, 29892, 2181, 13, 13, 4706, 10365, 29918, 7323, 353, 7700, 13, 4706, 565, 1835, 338, 451, 6213, 29901, 13, 9651, 1583, 29889, 29876, 29918, 7323, 353, 1835, 29889, 12181, 29961, 29900, 29962, 13, 9651, 1583, 29889, 7323, 353, 1835, 13, 9651, 1583, 29889, 29888, 29892, 1583, 29889, 7283, 353, 1653, 29918, 29888, 29918, 7283, 29898, 13, 18884, 1583, 29889, 1114, 415, 2068, 29892, 1583, 29889, 29888, 29892, 1583, 29889, 7283, 29892, 1583, 29889, 29876, 29918, 7323, 29892, 1583, 29889, 29878, 865, 13, 9651, 1723, 13, 4706, 1683, 29901, 13, 9651, 565, 1583, 29889, 29876, 29918, 7323, 338, 6213, 470, 1583, 29889, 29876, 29918, 7323, 5277, 29871, 29900, 29901, 13, 18884, 1583, 29889, 7323, 353, 1583, 29889, 29878, 865, 29889, 29590, 29898, 1311, 29889, 27728, 29892, 1583, 29889, 431, 29892, 2159, 7607, 29896, 29892, 1583, 29889, 29876, 29918, 6229, 876, 13, 18884, 10365, 29918, 7323, 353, 5852, 13, 18884, 1583, 29889, 29876, 29918, 7323, 353, 29871, 29896, 13, 9651, 1683, 29901, 13, 18884, 1583, 29889, 7323, 353, 1583, 29889, 29878, 865, 29889, 29590, 29898, 13, 462, 1678, 1583, 29889, 27728, 29892, 1583, 29889, 431, 29892, 2159, 7607, 1311, 29889, 29876, 29918, 7323, 29892, 1583, 29889, 29876, 29918, 6229, 29897, 13, 18884, 1723, 13, 18884, 1583, 29889, 29888, 29892, 1583, 29889, 7283, 353, 1653, 29918, 29888, 29918, 7283, 29898, 13, 462, 1678, 1583, 29889, 1114, 415, 2068, 29892, 1583, 29889, 29888, 29892, 1583, 29889, 7283, 29892, 1583, 29889, 29876, 29918, 7323, 29892, 1583, 29889, 29878, 865, 13, 18884, 1723, 13, 13, 4706, 396, 22521, 545, 599, 1889, 943, 505, 278, 1021, 4665, 322, 5478, 362, 29914, 29883, 1883, 578, 369, 4128, 13, 4706, 565, 1583, 3032, 21094, 29918, 5062, 29918, 1526, 29875, 29901, 13, 9651, 1583, 29889, 7323, 29892, 1583, 29889, 29888, 29892, 1583, 29889, 7283, 353, 1583, 29889, 2055, 29889, 29890, 4384, 29898, 13, 18884, 313, 1311, 29889, 7323, 29892, 1583, 29889, 29888, 29892, 1583, 29889, 7283, 511, 3876, 29922, 29900, 13, 9651, 1723, 13, 13, 4706, 1583, 29889, 9202, 29892, 1583, 29889, 535, 353, 1583, 29898, 1311, 29889, 7323, 29897, 13, 13, 4706, 1583, 29889, 29876, 29918, 5415, 353, 1583, 29889, 9202, 29889, 12181, 29961, 29896, 29962, 13, 4706, 565, 1583, 29889, 535, 338, 451, 6213, 29901, 13, 9651, 1583, 29889, 29876, 29918, 535, 353, 1583, 29889, 535, 29889, 12181, 29961, 29896, 29962, 13, 13, 4706, 565, 10365, 29918, 7323, 29901, 13, 9651, 1583, 29889, 29876, 29918, 7323, 353, 29871, 29945, 334, 1583, 29889, 29876, 29918, 6229, 334, 1583, 29889, 29876, 29918, 5415, 13, 13, 9651, 396, 960, 591, 526, 2734, 1090, 341, 2227, 29892, 7985, 4665, 304, 8072, 16035, 277, 599, 1889, 943, 13, 9651, 565, 1583, 3032, 21094, 29918, 5062, 29918, 1526, 29875, 29901, 13, 18884, 1583, 29889, 29876, 29918, 7323, 353, 938, 29898, 9302, 29889, 27696, 29898, 1311, 29889, 29876, 29918, 7323, 847, 1583, 29889, 2055, 29889, 2311, 29897, 334, 1583, 29889, 2055, 29889, 2311, 29897, 13, 13, 9651, 1583, 29889, 7323, 353, 7442, 29889, 535, 29883, 2579, 403, 29898, 13, 18884, 313, 13, 462, 1678, 1583, 29889, 7323, 29892, 13, 462, 1678, 1583, 29889, 29878, 865, 29889, 29590, 29898, 13, 462, 4706, 1583, 29889, 27728, 29892, 1583, 29889, 431, 29892, 2159, 7607, 1311, 29889, 29876, 29918, 7323, 448, 29871, 29896, 29892, 1583, 29889, 29876, 29918, 6229, 29897, 13, 462, 1678, 10353, 13, 18884, 1723, 13, 9651, 1723, 13, 9651, 1583, 29889, 29888, 29892, 1583, 29889, 7283, 353, 1653, 29918, 29888, 29918, 7283, 29898, 13, 18884, 1583, 29889, 1114, 415, 2068, 29892, 1583, 29889, 29888, 29892, 1583, 29889, 7283, 29892, 1583, 29889, 29876, 29918, 7323, 29892, 1583, 29889, 29878, 865, 13, 9651, 1723, 13, 13, 9651, 565, 1583, 3032, 21094, 29918, 5062, 29918, 1526, 29875, 29901, 13, 18884, 1583, 29889, 7323, 29892, 1583, 29889, 29888, 29892, 1583, 29889, 7283, 353, 1583, 29889, 2055, 29889, 29890, 4384, 29898, 13, 462, 1678, 313, 1311, 29889, 7323, 29892, 1583, 29889, 29888, 29892, 1583, 29889, 7283, 511, 3876, 29922, 29900, 13, 18884, 1723, 13, 13, 9651, 1583, 29889, 9202, 29892, 1583, 29889, 535, 353, 1583, 29898, 1311, 29889, 7323, 29897, 13, 13, 4706, 1583, 29889, 5504, 580, 13, 13, 4706, 396, 3789, 12623, 6795, 304, 29871, 29900, 13, 4706, 1583, 29889, 4738, 362, 353, 29871, 29900, 13, 13, 4706, 396, 4485, 770, 408, 16601, 13, 4706, 1583, 3032, 275, 29918, 11228, 1891, 353, 5852, 13, 13, 1678, 732, 6799, 13, 1678, 822, 338, 29918, 11228, 1891, 29898, 1311, 1125, 13, 4706, 9995, 11227, 29901, 5852, 565, 278, 5687, 756, 1063, 16601, 29892, 7700, 565, 451, 1213, 15945, 13, 4706, 736, 1583, 3032, 275, 29918, 11228, 1891, 13, 13, 1678, 822, 4770, 1524, 12035, 1311, 1125, 13, 4706, 9995, 13, 4706, 910, 770, 338, 385, 20380, 3528, 29889, 13, 13, 4706, 390, 1759, 267, 13, 4706, 448, 23648, 13, 4706, 24875, 2392, 13, 9651, 960, 445, 770, 338, 1641, 1304, 408, 385, 20380, 1434, 372, 756, 1063, 16601, 29889, 13, 4706, 9995, 13, 4706, 565, 451, 1583, 3032, 275, 29918, 11228, 1891, 29901, 13, 9651, 12020, 24875, 2392, 703, 3059, 2287, 338, 451, 3447, 16601, 23157, 13, 4706, 736, 1583, 13, 13, 1678, 822, 4770, 4622, 12035, 1311, 1125, 13, 4706, 9995, 13, 4706, 4241, 12541, 29889, 13, 13, 4706, 16969, 13, 4706, 448, 22158, 13, 4706, 3865, 2287, 13, 9651, 450, 716, 2106, 472, 278, 2446, 12623, 29889, 13, 4706, 9995, 13, 4706, 565, 313, 13, 9651, 1583, 29889, 4738, 362, 529, 1583, 29889, 3317, 29918, 1885, 13, 9651, 322, 1583, 29889, 8235, 1405, 1583, 29889, 25027, 29916, 13, 9651, 322, 1583, 29889, 2176, 1405, 1583, 29889, 29873, 4369, 13, 308, 1125, 13, 9651, 396, 6204, 263, 716, 4665, 322, 5478, 362, 29914, 29883, 1883, 578, 369, 4128, 13, 9651, 1835, 29918, 1482, 29892, 285, 29918, 1482, 29892, 2181, 29918, 1482, 353, 1583, 29889, 771, 3258, 580, 13, 13, 9651, 396, 22521, 545, 599, 1889, 943, 505, 278, 1021, 4784, 4665, 322, 5478, 362, 29914, 29883, 1883, 578, 369, 4128, 13, 9651, 565, 1583, 3032, 21094, 29918, 5062, 29918, 1526, 29875, 29901, 13, 18884, 1835, 29918, 1482, 29892, 285, 29918, 1482, 29892, 2181, 29918, 1482, 353, 1583, 29889, 2055, 29889, 29890, 4384, 29898, 13, 462, 1678, 313, 7323, 29918, 1482, 29892, 285, 29918, 1482, 29892, 2181, 29918, 1482, 511, 3876, 29922, 29900, 13, 18884, 1723, 13, 13, 9651, 396, 382, 4387, 403, 278, 6216, 2264, 310, 278, 716, 4665, 13, 9651, 6216, 29918, 1482, 29892, 378, 29918, 1482, 353, 1583, 29898, 7323, 29918, 1482, 29897, 13, 13, 9651, 396, 10318, 278, 770, 411, 278, 716, 848, 13, 9651, 1583, 29889, 5504, 29898, 7323, 29918, 1482, 29892, 6216, 29918, 1482, 29892, 378, 29918, 1482, 29892, 285, 29918, 1482, 29892, 2181, 29918, 1482, 29897, 13, 13, 9651, 396, 11796, 29872, 9677, 29879, 322, 2767, 12623, 6795, 13, 9651, 565, 1583, 29889, 29876, 29918, 5415, 1275, 29871, 29896, 29901, 13, 18884, 1583, 29889, 8235, 353, 7442, 29889, 29880, 979, 29887, 29889, 12324, 29898, 1311, 29889, 7323, 29961, 29900, 29962, 448, 1583, 29889, 7323, 14352, 29896, 2314, 13, 18884, 1583, 29889, 2176, 353, 7442, 29889, 6897, 29898, 1311, 29889, 9202, 29961, 29900, 29962, 448, 1583, 29889, 9202, 14352, 29896, 2314, 13, 9651, 1683, 29901, 13, 18884, 9541, 517, 353, 1583, 29889, 9202, 29961, 1311, 29889, 8862, 29879, 29961, 29900, 5262, 13, 18884, 1583, 29889, 29886, 598, 517, 29918, 27728, 353, 7442, 29889, 1195, 12539, 29898, 1311, 29889, 29886, 598, 517, 29918, 27728, 29892, 7442, 29889, 1195, 29898, 29886, 598, 517, 29892, 9685, 29922, 29900, 29892, 3013, 6229, 29879, 29922, 5574, 876, 13, 18884, 1583, 29889, 29886, 598, 517, 29918, 431, 353, 7442, 29889, 27525, 398, 29898, 1311, 29889, 29886, 598, 517, 29918, 431, 29892, 7442, 29889, 3317, 29898, 29886, 598, 517, 29892, 9685, 29922, 29900, 29892, 3013, 6229, 29879, 29922, 5574, 876, 13, 18884, 9541, 517, 29918, 12324, 353, 29871, 29896, 718, 313, 29886, 598, 517, 448, 1583, 29889, 29886, 598, 517, 29918, 27728, 29897, 847, 313, 1311, 29889, 29886, 598, 517, 29918, 431, 448, 1583, 29889, 29886, 598, 517, 29918, 27728, 29897, 13, 18884, 1583, 29889, 29882, 29894, 353, 298, 29894, 29889, 29882, 29894, 29898, 29886, 598, 517, 29918, 12324, 29892, 29871, 29906, 29889, 29896, 334, 7442, 29889, 2873, 29898, 1311, 29889, 29876, 29918, 5415, 876, 13, 9651, 1583, 29889, 4738, 362, 4619, 29871, 29896, 13, 13, 9651, 396, 7106, 278, 716, 2106, 13, 9651, 736, 1583, 13, 4706, 1683, 29901, 13, 9651, 12020, 22303, 13463, 362, 13, 13, 1678, 822, 4770, 4804, 12035, 1311, 29892, 1835, 1125, 13, 4706, 9995, 13, 4706, 382, 4387, 403, 278, 6216, 2264, 310, 278, 2183, 4665, 29889, 13, 13, 4706, 12662, 2699, 13, 4706, 448, 1378, 29899, 13, 4706, 1835, 584, 1409, 29918, 4561, 13, 9651, 2391, 310, 25173, 359, 290, 267, 310, 278, 15724, 297, 278, 4665, 13, 13, 4706, 16969, 13, 4706, 448, 22158, 13, 4706, 6216, 584, 7442, 29889, 2378, 13, 9651, 383, 277, 2264, 310, 278, 15724, 297, 278, 2183, 4665, 13, 4706, 378, 584, 7442, 29889, 2378, 470, 6213, 13, 9651, 1281, 4151, 524, 5537, 800, 310, 278, 15724, 297, 278, 2183, 4665, 565, 2198, 29889, 6213, 6467, 29889, 13, 13, 4706, 8695, 13, 4706, 448, 807, 13, 4706, 960, 445, 770, 756, 385, 341, 2227, 7212, 1061, 278, 15724, 674, 367, 19030, 297, 8943, 29889, 13, 4706, 13466, 740, 17983, 674, 367, 7797, 29889, 13, 4706, 9995, 13, 4706, 565, 1583, 29889, 275, 29918, 11228, 1891, 29901, 13, 9651, 6216, 353, 7442, 29889, 6310, 3552, 1311, 29889, 29876, 29918, 7323, 29892, 1583, 29889, 29876, 29918, 5415, 876, 13, 9651, 378, 353, 6213, 565, 1583, 29889, 29876, 29918, 535, 338, 6213, 1683, 7442, 29889, 6310, 3552, 1311, 29889, 29876, 29918, 7323, 29892, 1583, 29889, 29876, 29918, 535, 876, 13, 4706, 1683, 29901, 13, 9651, 6216, 353, 1835, 29889, 12181, 29961, 29900, 29962, 334, 518, 8516, 29962, 13, 9651, 378, 353, 6213, 13, 13, 4706, 822, 4386, 29918, 2914, 7373, 29894, 29892, 903, 29875, 29892, 903, 9202, 29892, 903, 535, 1125, 13, 9651, 565, 338, 8758, 7373, 29894, 29892, 18761, 1125, 13, 18884, 903, 9202, 28513, 29875, 29962, 353, 7442, 29889, 294, 2378, 7373, 29894, 29961, 29900, 2314, 13, 18884, 274, 353, 7442, 29889, 294, 2378, 7373, 29894, 29961, 29896, 2314, 13, 18884, 565, 903, 535, 338, 6213, 29901, 13, 462, 1678, 903, 535, 353, 7442, 29889, 6310, 3552, 7323, 29889, 12181, 29961, 29900, 1402, 274, 29889, 2311, 876, 13, 18884, 903, 535, 28513, 29875, 29962, 353, 274, 13, 9651, 1683, 29901, 13, 18884, 903, 9202, 28513, 29875, 29962, 353, 903, 29894, 13, 9651, 736, 903, 9202, 29892, 903, 535, 13, 13, 4706, 396, 382, 4387, 403, 12623, 13, 4706, 565, 1583, 3032, 21094, 29918, 5062, 29918, 1526, 29875, 29901, 13, 9651, 396, 1281, 4984, 1065, 4251, 13, 9651, 4251, 353, 518, 3552, 667, 29892, 13607, 511, 6213, 29897, 363, 13607, 29892, 2944, 297, 26985, 29898, 7323, 4638, 13, 13, 9651, 396, 18011, 278, 4251, 411, 777, 20254, 4251, 304, 1207, 278, 4251, 8572, 1821, 22611, 278, 410, 2395, 29889, 13, 9651, 4805, 353, 7431, 29898, 11436, 29897, 1273, 1583, 29889, 2055, 29889, 2311, 13, 9651, 565, 4805, 1405, 29871, 29900, 29901, 13, 18884, 363, 432, 297, 3464, 29898, 1311, 29889, 2055, 29889, 2311, 448, 4805, 1125, 13, 462, 1678, 4251, 29889, 4397, 29898, 11436, 14352, 29896, 2314, 13, 13, 9651, 396, 11796, 29872, 278, 6216, 2264, 310, 599, 15724, 297, 8943, 773, 341, 2227, 13, 9651, 2582, 353, 21984, 29918, 14513, 29898, 13, 18884, 1583, 29889, 29888, 5415, 29892, 4251, 29892, 1583, 29889, 2055, 29892, 599, 29887, 1624, 29922, 5574, 29892, 1904, 29918, 1526, 29875, 29922, 1311, 29889, 4299, 29918, 1526, 29875, 13, 9651, 1723, 13, 13, 9651, 396, 402, 1624, 278, 2582, 13, 9651, 363, 1121, 297, 2582, 29901, 13, 18884, 3240, 791, 29892, 4589, 353, 1121, 13, 18884, 565, 4589, 338, 451, 6213, 470, 3240, 791, 338, 6213, 29901, 13, 462, 1678, 12020, 8960, 29898, 3127, 29897, 13, 18884, 1683, 29901, 13, 462, 1678, 6216, 29892, 378, 353, 4386, 29918, 2914, 10456, 2267, 791, 29892, 6216, 29892, 378, 29897, 13, 4706, 1683, 29901, 13, 9651, 396, 382, 4387, 403, 278, 4665, 297, 7797, 13, 9651, 363, 22645, 29892, 1399, 297, 26985, 29898, 7323, 1125, 13, 18884, 659, 353, 1583, 29889, 29888, 5415, 29898, 513, 29897, 13, 18884, 6216, 29892, 378, 353, 4386, 29918, 2914, 29898, 791, 29892, 22645, 29892, 6216, 29892, 378, 29897, 13, 13, 4706, 396, 9603, 599, 18780, 29879, 297, 278, 6216, 2264, 267, 964, 3041, 29879, 13, 4706, 6216, 353, 7442, 29889, 690, 14443, 29898, 9302, 29889, 3062, 29898, 9302, 29889, 275, 13707, 29898, 9202, 511, 7442, 29889, 7192, 29892, 6216, 511, 313, 7323, 29889, 12181, 29961, 29900, 1402, 448, 29896, 876, 13, 4706, 565, 378, 338, 451, 6213, 29901, 13, 9651, 378, 353, 7442, 29889, 690, 14443, 29898, 9302, 29889, 3062, 29898, 9302, 29889, 275, 13707, 29898, 535, 511, 7442, 29889, 7192, 29892, 378, 511, 313, 7323, 29889, 12181, 29961, 29900, 1402, 448, 29896, 876, 13, 4706, 736, 6216, 29892, 378, 13, 13, 1678, 822, 1065, 29898, 1311, 1125, 13, 4706, 363, 903, 297, 1583, 29901, 13, 9651, 1209, 13, 13, 1678, 822, 410, 3258, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 3251, 403, 263, 716, 4665, 773, 278, 4629, 14675, 13705, 29889, 13, 13, 4706, 16969, 13, 4706, 448, 22158, 13, 4706, 1835, 29918, 1482, 584, 7442, 29889, 2378, 13, 9651, 678, 456, 359, 290, 267, 310, 278, 15724, 297, 278, 2446, 12623, 13, 4706, 285, 29918, 1482, 584, 7442, 29889, 2378, 13, 9651, 1570, 731, 310, 5478, 362, 19257, 13, 4706, 2181, 29918, 1482, 584, 7442, 29889, 2378, 13, 9651, 1570, 731, 310, 274, 1883, 578, 369, 2070, 11614, 13, 4706, 9995, 13, 4706, 1835, 29918, 1025, 29918, 12324, 353, 313, 9302, 29889, 8552, 29898, 1311, 29889, 7323, 29897, 448, 1583, 29889, 27728, 29897, 847, 1583, 29889, 3881, 13, 4706, 1835, 29918, 1482, 29918, 12324, 353, 7442, 29889, 6310, 29918, 4561, 29898, 7323, 29918, 1025, 29918, 12324, 29897, 13, 13, 4706, 396, 960, 727, 526, 11938, 29892, 18765, 278, 6216, 2264, 304, 6584, 284, 675, 297, 1725, 294, 1821, 15724, 1550, 410, 1037, 1218, 29889, 13, 4706, 396, 910, 17726, 278, 1900, 322, 20088, 29899, 517, 29899, 13318, 16650, 583, 304, 3013, 278, 1900, 297, 1725, 294, 1821, 5375, 18758, 297, 1753, 18639, 29889, 13, 4706, 565, 1583, 29889, 29876, 29918, 535, 322, 7700, 29901, 13, 9651, 6216, 353, 7442, 29889, 3062, 29898, 13, 18884, 7442, 29889, 1384, 29898, 1311, 29889, 535, 6736, 29871, 29896, 29872, 29899, 29953, 29892, 9685, 29922, 29896, 29892, 3013, 6229, 29879, 29922, 5574, 511, 13, 18884, 7442, 29889, 29880, 979, 29887, 29889, 12324, 29898, 1311, 29889, 535, 29892, 9685, 29922, 29896, 29892, 3013, 6229, 29879, 29922, 5574, 29897, 718, 7442, 29889, 3317, 29898, 1311, 29889, 9202, 511, 13, 18884, 1583, 29889, 9202, 29892, 13, 9651, 1723, 13, 4706, 1683, 29901, 13, 9651, 6216, 353, 1583, 29889, 9202, 13, 13, 4706, 565, 1583, 29889, 1114, 415, 2068, 1275, 29871, 29900, 470, 1583, 29889, 1114, 415, 2068, 1275, 29871, 29896, 29901, 13, 9651, 565, 1583, 29889, 1114, 415, 2068, 1275, 29871, 29900, 29901, 13, 18884, 396, 1939, 7744, 2068, 29889, 4803, 2294, 285, 322, 2181, 29889, 13, 18884, 285, 29918, 1482, 353, 1583, 29889, 29888, 13, 18884, 2181, 29918, 1482, 353, 1583, 29889, 7283, 13, 9651, 1683, 29901, 13, 18884, 396, 12545, 7744, 2068, 29889, 4803, 716, 285, 322, 2181, 29889, 13, 18884, 285, 29918, 1482, 353, 7442, 29889, 3062, 29898, 13, 462, 1678, 1583, 29889, 29878, 865, 29889, 29590, 29898, 2311, 29922, 1311, 29889, 29876, 29918, 7323, 29897, 529, 29871, 29900, 29889, 29929, 29892, 13, 462, 1678, 1583, 29889, 29888, 29892, 13, 462, 1678, 1583, 29889, 29878, 865, 29889, 29590, 29898, 2311, 29922, 1311, 29889, 29876, 29918, 7323, 29897, 334, 29871, 29900, 29889, 29929, 718, 29871, 29900, 29889, 29896, 29892, 13, 18884, 1723, 13, 18884, 2181, 29918, 1482, 353, 7442, 29889, 3062, 29898, 13, 462, 1678, 1583, 29889, 29878, 865, 29889, 29590, 29898, 2311, 29922, 1311, 29889, 29876, 29918, 7323, 29897, 529, 29871, 29900, 29889, 29929, 29892, 13, 462, 1678, 1583, 29889, 7283, 29892, 13, 462, 1678, 1583, 29889, 29878, 865, 29889, 29590, 29898, 2311, 29922, 1311, 29889, 29876, 29918, 7323, 511, 13, 18884, 1723, 13, 13, 9651, 363, 22645, 297, 3464, 29898, 1311, 29889, 29876, 29918, 7323, 1125, 13, 18884, 1835, 29918, 1482, 29918, 12324, 29961, 13140, 1402, 17117, 903, 353, 1583, 29889, 710, 8963, 29898, 13, 462, 1678, 22645, 29892, 1835, 29918, 1025, 29918, 12324, 29892, 6216, 29892, 1583, 29889, 8862, 29879, 29892, 285, 29918, 1482, 29892, 2181, 29918, 1482, 29892, 1583, 29889, 29878, 865, 29892, 7700, 13, 18884, 1723, 13, 4706, 1683, 29901, 13, 9651, 396, 26596, 7744, 2068, 29889, 20749, 403, 285, 322, 2181, 29889, 13, 9651, 285, 29918, 1482, 353, 7442, 29889, 8552, 29898, 1311, 29889, 29888, 29897, 13, 9651, 2181, 29918, 1482, 353, 7442, 29889, 8552, 29898, 1311, 29889, 7283, 29897, 13, 13, 9651, 363, 22645, 297, 3464, 29898, 1311, 29889, 29876, 29918, 7323, 1125, 13, 18884, 1835, 29918, 1482, 29918, 12324, 29961, 13140, 1402, 285, 29918, 1482, 29961, 13140, 1402, 2181, 29918, 1482, 29961, 13140, 29962, 353, 1583, 29889, 710, 8963, 29898, 13, 462, 1678, 22645, 29892, 1835, 29918, 1025, 29918, 12324, 29892, 6216, 29892, 1583, 29889, 8862, 29879, 29892, 1583, 29889, 29888, 29892, 1583, 29889, 7283, 29892, 1583, 29889, 29878, 865, 29892, 5852, 13, 18884, 1723, 13, 13, 4706, 1835, 29918, 1482, 353, 1583, 29889, 27728, 718, 1583, 29889, 3881, 334, 7442, 29889, 294, 2378, 29898, 7323, 29918, 1482, 29918, 12324, 29897, 13, 4706, 736, 1835, 29918, 1482, 29892, 285, 29918, 1482, 29892, 2181, 29918, 1482, 13, 13, 1678, 822, 2767, 29898, 1311, 29892, 1835, 29918, 1482, 29922, 8516, 29892, 6216, 29918, 1482, 29922, 8516, 29892, 378, 29918, 1482, 29922, 8516, 29892, 285, 29918, 1482, 29922, 8516, 29892, 2181, 29918, 1482, 29922, 8516, 1125, 13, 4706, 9995, 13, 4706, 10318, 278, 4665, 313, 392, 285, 29914, 7283, 565, 1583, 29899, 1114, 415, 573, 467, 13, 13, 4706, 12662, 2699, 13, 4706, 448, 1378, 29899, 13, 4706, 1835, 29918, 1482, 584, 7442, 29889, 2378, 470, 6213, 29892, 13136, 13, 9651, 1019, 4752, 716, 4665, 9819, 515, 410, 1037, 362, 13, 4706, 6216, 29918, 1482, 584, 7442, 29889, 2378, 470, 6213, 29892, 13136, 13, 9651, 383, 277, 2264, 310, 278, 15724, 297, 278, 716, 4665, 13, 4706, 378, 29918, 1482, 584, 7442, 29889, 2378, 470, 6213, 29892, 13136, 13, 9651, 1281, 4151, 524, 5537, 800, 310, 278, 15724, 297, 278, 716, 4665, 13, 4706, 285, 29918, 1482, 584, 7442, 29889, 2378, 470, 6213, 29892, 13136, 13, 9651, 1570, 731, 310, 5478, 362, 19257, 13, 4706, 2181, 29918, 1482, 584, 7442, 29889, 2378, 470, 6213, 29892, 13136, 13, 9651, 1570, 731, 310, 274, 1883, 578, 369, 2070, 11614, 13, 13, 4706, 8695, 13, 4706, 448, 807, 13, 4706, 1894, 23352, 29879, 297, 278, 2030, 4665, 674, 871, 367, 8611, 491, 278, 716, 6743, 565, 896, 505, 16710, 6216, 2264, 29889, 13, 4706, 20749, 362, 6554, 322, 274, 1883, 578, 369, 2070, 11614, 674, 871, 367, 8611, 565, 1583, 29899, 1114, 415, 2068, 338, 6077, 373, 322, 565, 1009, 13, 4706, 6590, 15724, 505, 16710, 6216, 2264, 29889, 13, 4706, 9995, 13, 4706, 565, 1583, 29889, 29876, 29918, 5415, 1275, 29871, 29896, 29901, 13, 9651, 1583, 3032, 5504, 29918, 14369, 29898, 7323, 29918, 1482, 29892, 6216, 29918, 1482, 29892, 378, 29918, 1482, 29892, 285, 29918, 1482, 29892, 2181, 29918, 1482, 29897, 13, 4706, 1683, 29901, 13, 9651, 1583, 3032, 5504, 29918, 9910, 29898, 7323, 29918, 1482, 29892, 6216, 29918, 1482, 29892, 378, 29918, 1482, 29892, 285, 29918, 1482, 29892, 2181, 29918, 1482, 29897, 13, 13, 1678, 822, 903, 5504, 29918, 14369, 29898, 13, 4706, 1583, 29892, 1835, 29918, 1482, 29922, 8516, 29892, 6216, 29918, 1482, 29922, 8516, 29892, 378, 29918, 1482, 29922, 8516, 29892, 285, 29918, 1482, 29922, 8516, 29892, 2181, 29918, 1482, 29922, 8516, 13, 268, 1125, 13, 4706, 565, 1583, 29889, 29876, 29918, 535, 29901, 13, 9651, 5939, 353, 7442, 29889, 2083, 29898, 13, 18884, 7442, 29889, 3062, 29898, 9302, 29889, 7979, 1008, 29898, 1311, 29889, 535, 29892, 1583, 29889, 25027, 29883, 511, 1583, 29889, 535, 29892, 29871, 29900, 29889, 29900, 511, 13, 18884, 9685, 29922, 29896, 13, 9651, 1723, 13, 4706, 1683, 29901, 13, 9651, 5939, 353, 29871, 29900, 13, 13, 4706, 565, 313, 13, 9651, 1835, 29918, 1482, 338, 451, 6213, 13, 9651, 322, 6216, 29918, 1482, 338, 451, 6213, 13, 9651, 322, 285, 29918, 1482, 338, 451, 6213, 13, 9651, 322, 2181, 29918, 1482, 338, 451, 6213, 13, 308, 1125, 13, 9651, 565, 1583, 29889, 29876, 29918, 535, 29901, 13, 18884, 274, 29918, 1482, 353, 7442, 29889, 497, 29898, 535, 29918, 1482, 5277, 1583, 29889, 25027, 29883, 29892, 9685, 29922, 29896, 29897, 13, 18884, 274, 29918, 1025, 353, 7442, 29889, 497, 29898, 1311, 29889, 535, 5277, 1583, 29889, 25027, 29883, 29892, 9685, 29922, 29896, 29897, 13, 18884, 5939, 29918, 1482, 353, 7442, 29889, 2083, 29898, 13, 462, 1678, 7442, 29889, 3062, 29898, 9302, 29889, 7979, 1008, 29898, 535, 29918, 1482, 29892, 1583, 29889, 25027, 29883, 511, 378, 29918, 1482, 29892, 29871, 29900, 29889, 29900, 511, 9685, 29922, 29896, 13, 18884, 1723, 13, 13, 18884, 16710, 29918, 513, 1575, 353, 7442, 29889, 1191, 3062, 29898, 13, 462, 1678, 5135, 29883, 29918, 1482, 669, 274, 29918, 1025, 29897, 669, 313, 9202, 29918, 1482, 5277, 1583, 29889, 9202, 467, 1579, 8606, 3101, 13, 462, 1678, 718, 313, 29883, 29918, 1482, 669, 3695, 29883, 29918, 1025, 29897, 13, 462, 1678, 718, 5135, 30022, 29883, 29918, 1482, 669, 3695, 29883, 29918, 1025, 29897, 669, 313, 2395, 29918, 1482, 5277, 5939, 876, 13, 18884, 1723, 13, 13, 18884, 1583, 29889, 535, 29961, 326, 771, 1490, 29918, 513, 1575, 29962, 353, 378, 29918, 1482, 29961, 326, 771, 1490, 29918, 513, 1575, 29962, 13, 18884, 5939, 29961, 326, 771, 1490, 29918, 513, 1575, 29962, 353, 5939, 29918, 1482, 29961, 326, 771, 1490, 29918, 513, 1575, 29962, 13, 9651, 1683, 29901, 13, 18884, 16710, 29918, 513, 1575, 353, 7442, 29889, 1191, 3062, 3552, 9202, 29918, 1482, 5277, 1583, 29889, 9202, 467, 1579, 8606, 3101, 13, 13, 9651, 1583, 29889, 7323, 29961, 326, 771, 1490, 29918, 513, 1575, 29962, 353, 1835, 29918, 1482, 29961, 326, 771, 1490, 29918, 513, 1575, 29962, 13, 9651, 1583, 29889, 9202, 29961, 326, 771, 1490, 29918, 513, 1575, 29962, 353, 6216, 29918, 1482, 29961, 326, 771, 1490, 29918, 513, 1575, 29962, 13, 13, 9651, 565, 1583, 29889, 1114, 415, 2068, 2804, 29871, 29900, 29901, 13, 18884, 1583, 29889, 29888, 29961, 326, 771, 1490, 29918, 513, 1575, 29962, 353, 285, 29918, 1482, 29961, 326, 771, 1490, 29918, 513, 1575, 29962, 13, 18884, 1583, 29889, 7283, 29961, 326, 771, 1490, 29918, 513, 1575, 29962, 353, 2181, 29918, 1482, 29961, 326, 771, 1490, 29918, 513, 1575, 29962, 13, 13, 4706, 396, 20025, 4665, 577, 278, 1900, 5375, 338, 2337, 278, 937, 13, 4706, 22645, 29918, 6605, 353, 7442, 29889, 5085, 441, 29898, 13, 9651, 1583, 29889, 9202, 29889, 1579, 8606, 580, 718, 7442, 29889, 3062, 29898, 2395, 2804, 29871, 29900, 29889, 29900, 29892, 5939, 334, 7442, 29889, 3317, 29898, 1311, 29889, 9202, 511, 29871, 29900, 29889, 29900, 29897, 13, 4706, 1723, 13, 13, 4706, 1583, 29889, 7323, 353, 1583, 29889, 7323, 29961, 13140, 29918, 6605, 29962, 13, 4706, 1583, 29889, 9202, 353, 1583, 29889, 9202, 29961, 13140, 29918, 6605, 29962, 13, 4706, 565, 1583, 29889, 29876, 29918, 535, 29901, 13, 9651, 1583, 29889, 535, 353, 1583, 29889, 535, 29961, 13140, 29918, 6605, 29962, 13, 13, 4706, 565, 1583, 29889, 1114, 415, 2068, 2804, 29871, 29900, 29901, 13, 9651, 1583, 29889, 29888, 353, 1583, 29889, 29888, 29961, 13140, 29918, 6605, 29962, 13, 9651, 1583, 29889, 7283, 353, 1583, 29889, 7283, 29961, 13140, 29918, 6605, 29962, 13, 13, 1678, 822, 903, 5504, 29918, 9910, 29898, 13, 4706, 1583, 29892, 1835, 29918, 1482, 29922, 8516, 29892, 6216, 29918, 1482, 29922, 8516, 29892, 378, 29918, 1482, 29922, 8516, 29892, 285, 29918, 1482, 29922, 8516, 29892, 2181, 29918, 1482, 29922, 8516, 13, 268, 1125, 13, 4706, 565, 313, 13, 9651, 1835, 29918, 1482, 338, 451, 6213, 13, 9651, 322, 6216, 29918, 1482, 338, 451, 6213, 13, 9651, 322, 285, 29918, 1482, 338, 451, 6213, 13, 9651, 322, 2181, 29918, 1482, 338, 451, 6213, 13, 308, 1125, 13, 9651, 1583, 29889, 7323, 353, 7442, 29889, 535, 29883, 2579, 403, 3552, 1311, 29889, 7323, 29892, 1835, 29918, 1482, 876, 13, 9651, 1583, 29889, 9202, 353, 7442, 29889, 535, 29883, 2579, 403, 3552, 1311, 29889, 9202, 29892, 6216, 29918, 1482, 876, 13, 9651, 565, 1583, 29889, 29876, 29918, 535, 29901, 13, 18884, 1583, 29889, 535, 353, 7442, 29889, 535, 29883, 2579, 403, 3552, 1311, 29889, 535, 29892, 378, 29918, 1482, 876, 13, 13, 9651, 565, 1583, 29889, 1114, 415, 2068, 2804, 29871, 29900, 29901, 13, 18884, 1583, 29889, 29888, 353, 7442, 29889, 535, 29883, 2579, 403, 3552, 1311, 29889, 29888, 29892, 285, 29918, 1482, 876, 13, 18884, 1583, 29889, 7283, 353, 7442, 29889, 535, 29883, 2579, 403, 3552, 1311, 29889, 7283, 29892, 2181, 29918, 1482, 876, 13, 13, 4706, 565, 1583, 29889, 29876, 29918, 535, 29901, 13, 9651, 4565, 29879, 353, 16548, 29889, 5464, 29928, 5817, 630, 13685, 292, 29898, 1311, 29889, 9202, 29892, 1583, 29889, 535, 29892, 1583, 29889, 29876, 29918, 7323, 29897, 13, 4706, 1683, 29901, 13, 9651, 4565, 29879, 353, 16548, 29889, 5464, 29928, 5817, 630, 13685, 292, 29898, 1311, 29889, 9202, 29892, 1583, 29889, 29876, 29918, 7323, 29897, 13, 4706, 4565, 29879, 14352, 29896, 29962, 353, 7442, 29889, 294, 2378, 29898, 8862, 29879, 14352, 29896, 2314, 29961, 13, 9651, 16548, 29889, 29883, 798, 8497, 27469, 13685, 292, 29898, 1311, 29889, 9202, 29961, 8862, 29879, 14352, 29896, 24960, 29961, 13, 18884, 584, 313, 1311, 29889, 29876, 29918, 7323, 448, 2533, 29898, 2435, 29898, 29888, 29897, 363, 285, 297, 4565, 29879, 7503, 29899, 29896, 12622, 13, 9651, 4514, 13, 308, 1822, 25027, 391, 580, 13, 4706, 716, 29918, 333, 10351, 353, 5159, 13, 4706, 6795, 353, 29871, 29900, 13, 4706, 1583, 29889, 8862, 29879, 353, 5159, 13, 4706, 363, 4565, 297, 4565, 29879, 29901, 13, 9651, 716, 29918, 333, 10351, 4619, 4565, 13, 9651, 1583, 29889, 8862, 29879, 4619, 518, 1761, 29898, 3881, 29898, 11808, 29892, 6795, 718, 7431, 29898, 8862, 876, 4638, 13, 9651, 6795, 4619, 7431, 29898, 8862, 29897, 13, 13, 4706, 1583, 29889, 7323, 353, 1583, 29889, 7323, 29961, 1482, 29918, 333, 10351, 29962, 13, 4706, 1583, 29889, 9202, 353, 1583, 29889, 9202, 29961, 1482, 29918, 333, 10351, 29962, 13, 4706, 565, 1583, 29889, 29876, 29918, 535, 29901, 13, 9651, 1583, 29889, 535, 353, 1583, 29889, 535, 29961, 1482, 29918, 333, 10351, 29962, 13, 13, 4706, 565, 1583, 29889, 1114, 415, 2068, 2804, 29871, 29900, 29901, 13, 9651, 1583, 29889, 29888, 353, 1583, 29889, 29888, 29961, 1482, 29918, 333, 10351, 29962, 13, 9651, 1583, 29889, 7283, 353, 1583, 29889, 7283, 29961, 1482, 29918, 333, 10351, 29962, 13, 2 ]
jobs/migrations/0002_auto_20201219_0911.py
Platz-Work/platzi-work-backend
0
43278
<filename>jobs/migrations/0002_auto_20201219_0911.py # Generated by Django 3.1.4 on 2020-12-19 14:11 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('jobs', '0001_initial'), ] operations = [ migrations.AlterModelOptions( name='category', options={'ordering': ['-created_at'], 'verbose_name_plural': 'Categories'}, ), migrations.AlterField( model_name='profile', name='category', field=models.ForeignKey(blank=True, error_messages={'blank': "The category_id field can't be blank.", 'invalid': 'The category_id field is invalid.', 'null': "The category_id field can't be null."}, null=True, on_delete=django.db.models.deletion.PROTECT, to='jobs.category'), ), migrations.AlterField( model_name='profile', name='salary_end', field=models.PositiveIntegerField(blank=True, error_messages={'blank': "The salary_end field can't be blank.", 'invalid': 'The salary_end field is invalid.', 'null': "The salary_end field can't be null."}, null=True, verbose_name='Salary up'), ), migrations.AlterField( model_name='profile', name='salary_start', field=models.PositiveIntegerField(blank=True, error_messages={'blank': "The salary_start field can't be blank.", 'invalid': 'The salary_start field is invalid.', 'null': "The salary_start field can't be null."}, null=True, verbose_name='Salary from'), ), ]
[ 1, 529, 9507, 29958, 9057, 29879, 29914, 26983, 800, 29914, 29900, 29900, 29900, 29906, 29918, 6921, 29918, 29906, 29900, 29906, 29900, 29896, 29906, 29896, 29929, 29918, 29900, 29929, 29896, 29896, 29889, 2272, 13, 29937, 3251, 630, 491, 15337, 29871, 29941, 29889, 29896, 29889, 29946, 373, 29871, 29906, 29900, 29906, 29900, 29899, 29896, 29906, 29899, 29896, 29929, 29871, 29896, 29946, 29901, 29896, 29896, 13, 13, 3166, 9557, 29889, 2585, 1053, 9725, 800, 29892, 4733, 13, 5215, 9557, 29889, 2585, 29889, 9794, 29889, 311, 1026, 291, 13, 13, 13, 1990, 341, 16783, 29898, 26983, 800, 29889, 29924, 16783, 1125, 13, 13, 1678, 9962, 353, 518, 13, 4706, 6702, 9057, 29879, 742, 525, 29900, 29900, 29900, 29896, 29918, 11228, 5477, 13, 1678, 4514, 13, 13, 1678, 6931, 353, 518, 13, 4706, 9725, 800, 29889, 2499, 357, 3195, 5856, 29898, 13, 9651, 1024, 2433, 7320, 742, 13, 9651, 3987, 3790, 29915, 2098, 292, 2396, 6024, 29899, 11600, 29918, 271, 7464, 525, 369, 15828, 29918, 978, 29918, 572, 3631, 2396, 525, 29907, 14404, 16675, 13, 4706, 10353, 13, 4706, 9725, 800, 29889, 2499, 357, 3073, 29898, 13, 9651, 1904, 29918, 978, 2433, 10185, 742, 13, 9651, 1024, 2433, 7320, 742, 13, 9651, 1746, 29922, 9794, 29889, 27755, 2558, 29898, 19465, 29922, 5574, 29892, 1059, 29918, 19158, 3790, 29915, 19465, 2396, 376, 1576, 7663, 29918, 333, 1746, 508, 29915, 29873, 367, 9654, 19602, 525, 20965, 2396, 525, 1576, 7663, 29918, 333, 1746, 338, 8340, 29889, 742, 525, 4304, 2396, 376, 1576, 7663, 29918, 333, 1746, 508, 29915, 29873, 367, 1870, 1213, 1118, 1870, 29922, 5574, 29892, 373, 29918, 8143, 29922, 14095, 29889, 2585, 29889, 9794, 29889, 311, 1026, 291, 29889, 8618, 4330, 1783, 29892, 304, 2433, 9057, 29879, 29889, 7320, 5477, 13, 4706, 10353, 13, 4706, 9725, 800, 29889, 2499, 357, 3073, 29898, 13, 9651, 1904, 29918, 978, 2433, 10185, 742, 13, 9651, 1024, 2433, 19585, 653, 29918, 355, 742, 13, 9651, 1746, 29922, 9794, 29889, 9135, 3321, 7798, 3073, 29898, 19465, 29922, 5574, 29892, 1059, 29918, 19158, 3790, 29915, 19465, 2396, 376, 1576, 4497, 653, 29918, 355, 1746, 508, 29915, 29873, 367, 9654, 19602, 525, 20965, 2396, 525, 1576, 4497, 653, 29918, 355, 1746, 338, 8340, 29889, 742, 525, 4304, 2396, 376, 1576, 4497, 653, 29918, 355, 1746, 508, 29915, 29873, 367, 1870, 1213, 1118, 1870, 29922, 5574, 29892, 26952, 29918, 978, 2433, 20392, 653, 701, 5477, 13, 4706, 10353, 13, 4706, 9725, 800, 29889, 2499, 357, 3073, 29898, 13, 9651, 1904, 29918, 978, 2433, 10185, 742, 13, 9651, 1024, 2433, 19585, 653, 29918, 2962, 742, 13, 9651, 1746, 29922, 9794, 29889, 9135, 3321, 7798, 3073, 29898, 19465, 29922, 5574, 29892, 1059, 29918, 19158, 3790, 29915, 19465, 2396, 376, 1576, 4497, 653, 29918, 2962, 1746, 508, 29915, 29873, 367, 9654, 19602, 525, 20965, 2396, 525, 1576, 4497, 653, 29918, 2962, 1746, 338, 8340, 29889, 742, 525, 4304, 2396, 376, 1576, 4497, 653, 29918, 2962, 1746, 508, 29915, 29873, 367, 1870, 1213, 1118, 1870, 29922, 5574, 29892, 26952, 29918, 978, 2433, 20392, 653, 515, 5477, 13, 4706, 10353, 13, 1678, 4514, 13, 2 ]
teraserver/python/modules/FlaskModule/API/user/UserLogin.py
introlab/opentera
10
30410
<filename>teraserver/python/modules/FlaskModule/API/user/UserLogin.py from flask import session, request from flask_restx import Resource, reqparse from flask_babel import gettext from modules.LoginModule.LoginModule import user_http_auth from modules.FlaskModule.FlaskModule import user_api_ns as api from opentera.redis.RedisRPCClient import RedisRPCClient from opentera.modules.BaseModule import ModuleNames # model = api.model('Login', { # 'websocket_url': fields.String, # 'user_uuid': fields.String, # 'user_token': fields.String # }) # Parser definition(s) get_parser = api.parser() class UserLogin(Resource): def __init__(self, _api, *args, **kwargs): Resource.__init__(self, _api, *args, **kwargs) self.module = kwargs.get('flaskModule', None) self.parser = reqparse.RequestParser() @user_http_auth.login_required @api.expect(get_parser) @api.doc(description='Login to the server using HTTP Basic Authentification (HTTPAuth)') def get(self): session.permanent = True # Redis key is handled in LoginModule servername = self.module.config.server_config['hostname'] port = self.module.config.server_config['port'] if 'X_EXTERNALHOST' in request.headers: if ':' in request.headers['X_EXTERNALHOST']: servername, port = request.headers['X_EXTERNALHOST'].split(':', 1) else: servername = request.headers['X_EXTERNALHOST'] if 'X_EXTERNALPORT' in request.headers: port = request.headers['X_EXTERNALPORT'] # Get user token key from redis from opentera.redis.RedisVars import RedisVars token_key = self.module.redisGet(RedisVars.RedisVar_UserTokenAPIKey) # Get token for user from opentera.db.models.TeraUser import TeraUser current_user = TeraUser.get_user_by_uuid(session['_user_id']) # Verify if user already logged in rpc = RedisRPCClient(self.module.config.redis_config) online_users = rpc.call(ModuleNames.USER_MANAGER_MODULE_NAME.value, 'online_users') if current_user.user_uuid in online_users: self.module.logger.log_warning(self.module.module_name, UserLogin.__name__, 'get', 403, 'User already logged in', current_user.to_json(minimal=True)) return gettext('User already logged in.'), 403 current_user.update_last_online() user_token = current_user.get_token(token_key) print('Login - setting key with expiration in 60s', session['_id'], session['_user_id']) self.module.redisSet(session['_id'], session['_user_id'], ex=60) # Return reply as json object reply = {"websocket_url": "wss://" + servername + ":" + str(port) + "/wss/user?id=" + session['_id'], "user_uuid": session['_user_id'], "user_token": user_token} # Verify client version (optional for now) # And add info to reply if 'X-Client-Name' in request.headers and 'X-Client-Version' in request.headers: try: # Extract information client_name = request.headers['X-Client-Name'] client_version = request.headers['X-Client-Version'] client_version_parts = client_version.split('.') # Load known version from database. from opentera.utils.TeraVersions import TeraVersions versions = TeraVersions() versions.load_from_db() # Verify if we have client information in DB client_info = versions.get_client_version_with_name(client_name) if client_info: # We have something stored for this client, let's verify version numbers # For now, we still allow login even when version mismatch # Reply full version information reply['version_latest'] = client_info.to_dict() if client_info.version != client_version: reply['version_error'] = gettext('Client version mismatch') # If major version mismatch, kill client, first part of the version stored_client_version_parts = client_info.version.split('.') if len(stored_client_version_parts) and len(client_version_parts): if stored_client_version_parts[0] != client_version_parts[0]: # return 426 = upgrade required self.module.logger.log_warning(self.module.module_name, UserLogin.__name__, 'get', 426, 'Client major version too old, not accepting login', stored_client_version_parts[0], client_version_parts[0]) return gettext('Client major version too old, not accepting login'), 426 else: return gettext('Invalid client name :') + client_name, 403 except BaseException as e: self.module.logger.log_error(self.module.module_name, UserLogin.__name__, 'get', 500, 'Invalid client version handler', str(e)) return gettext('Invalid client version handler') + str(e), 500 return reply
[ 1, 529, 9507, 29958, 357, 29440, 369, 29914, 4691, 29914, 7576, 29914, 8754, 1278, 7355, 29914, 8787, 29914, 1792, 29914, 2659, 11049, 29889, 2272, 13, 3166, 29784, 1053, 4867, 29892, 2009, 13, 3166, 29784, 29918, 5060, 29916, 1053, 18981, 29892, 12428, 5510, 13, 3166, 29784, 29918, 28727, 1053, 679, 726, 13, 3166, 10585, 29889, 11049, 7355, 29889, 11049, 7355, 1053, 1404, 29918, 1124, 29918, 5150, 13, 3166, 10585, 29889, 8754, 1278, 7355, 29889, 8754, 1278, 7355, 1053, 1404, 29918, 2754, 29918, 1983, 408, 7882, 13, 3166, 1015, 296, 1572, 29889, 1127, 275, 29889, 9039, 275, 29934, 9026, 4032, 1053, 4367, 275, 29934, 9026, 4032, 13, 3166, 1015, 296, 1572, 29889, 7576, 29889, 5160, 7355, 1053, 15591, 8659, 13, 13, 29937, 1904, 353, 7882, 29889, 4299, 877, 11049, 742, 426, 13, 29937, 268, 525, 2676, 11514, 29918, 2271, 2396, 4235, 29889, 1231, 29892, 13, 29937, 268, 525, 1792, 29918, 25118, 2396, 4235, 29889, 1231, 29892, 13, 29937, 268, 525, 1792, 29918, 6979, 2396, 4235, 29889, 1231, 13, 29937, 5615, 13, 29937, 1459, 643, 5023, 29898, 29879, 29897, 13, 13, 657, 29918, 16680, 353, 7882, 29889, 16680, 580, 13, 13, 13, 1990, 4911, 11049, 29898, 6848, 1125, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 903, 2754, 29892, 334, 5085, 29892, 3579, 19290, 1125, 13, 4706, 18981, 17255, 2344, 12035, 1311, 29892, 903, 2754, 29892, 334, 5085, 29892, 3579, 19290, 29897, 13, 4706, 1583, 29889, 5453, 353, 9049, 5085, 29889, 657, 877, 1579, 1278, 7355, 742, 6213, 29897, 13, 4706, 1583, 29889, 16680, 353, 12428, 5510, 29889, 3089, 11726, 580, 13, 13, 1678, 732, 1792, 29918, 1124, 29918, 5150, 29889, 7507, 29918, 12403, 13, 1678, 732, 2754, 29889, 17854, 29898, 657, 29918, 16680, 29897, 13, 1678, 732, 2754, 29889, 1514, 29898, 8216, 2433, 11049, 304, 278, 1923, 773, 7331, 19219, 13189, 296, 2450, 313, 10493, 6444, 29897, 1495, 13, 1678, 822, 679, 29898, 1311, 1125, 13, 13, 4706, 4867, 29889, 546, 1171, 296, 353, 5852, 13, 13, 4706, 396, 4367, 275, 1820, 338, 16459, 297, 19130, 7355, 13, 4706, 1923, 978, 353, 1583, 29889, 5453, 29889, 2917, 29889, 2974, 29918, 2917, 1839, 28988, 2033, 13, 4706, 2011, 353, 1583, 29889, 5453, 29889, 2917, 29889, 2974, 29918, 2917, 1839, 637, 2033, 13, 4706, 565, 525, 29990, 29918, 5746, 4945, 29940, 1964, 20832, 29915, 297, 2009, 29889, 13662, 29901, 13, 9651, 565, 525, 11283, 297, 2009, 29889, 13662, 1839, 29990, 29918, 5746, 4945, 29940, 1964, 20832, 2033, 29901, 13, 18884, 1923, 978, 29892, 2011, 353, 2009, 29889, 13662, 1839, 29990, 29918, 5746, 4945, 29940, 1964, 20832, 13359, 5451, 877, 29901, 742, 29871, 29896, 29897, 13, 9651, 1683, 29901, 13, 18884, 1923, 978, 353, 2009, 29889, 13662, 1839, 29990, 29918, 5746, 4945, 29940, 1964, 20832, 2033, 13, 13, 4706, 565, 525, 29990, 29918, 5746, 4945, 29940, 1964, 15082, 29915, 297, 2009, 29889, 13662, 29901, 13, 9651, 2011, 353, 2009, 29889, 13662, 1839, 29990, 29918, 5746, 4945, 29940, 1964, 15082, 2033, 13, 13, 4706, 396, 3617, 1404, 5993, 1820, 515, 29825, 13, 4706, 515, 1015, 296, 1572, 29889, 1127, 275, 29889, 9039, 275, 29963, 1503, 1053, 4367, 275, 29963, 1503, 13, 4706, 5993, 29918, 1989, 353, 1583, 29889, 5453, 29889, 1127, 275, 2577, 29898, 9039, 275, 29963, 1503, 29889, 9039, 275, 9037, 29918, 2659, 6066, 8787, 2558, 29897, 13, 13, 4706, 396, 3617, 5993, 363, 1404, 13, 4706, 515, 1015, 296, 1572, 29889, 2585, 29889, 9794, 29889, 29911, 1572, 2659, 1053, 323, 1572, 2659, 13, 4706, 1857, 29918, 1792, 353, 323, 1572, 2659, 29889, 657, 29918, 1792, 29918, 1609, 29918, 25118, 29898, 7924, 1839, 29918, 1792, 29918, 333, 11287, 13, 13, 4706, 396, 1798, 1598, 565, 1404, 2307, 13817, 297, 13, 4706, 364, 6739, 353, 4367, 275, 29934, 9026, 4032, 29898, 1311, 29889, 5453, 29889, 2917, 29889, 1127, 275, 29918, 2917, 29897, 13, 4706, 7395, 29918, 7193, 353, 364, 6739, 29889, 4804, 29898, 7355, 8659, 29889, 11889, 29918, 1529, 3521, 17070, 29918, 6720, 14849, 1307, 29918, 5813, 29889, 1767, 29892, 525, 14627, 29918, 7193, 1495, 13, 4706, 565, 1857, 29918, 1792, 29889, 1792, 29918, 25118, 297, 7395, 29918, 7193, 29901, 13, 9651, 1583, 29889, 5453, 29889, 21707, 29889, 1188, 29918, 27392, 29898, 1311, 29889, 5453, 29889, 5453, 29918, 978, 29892, 13, 462, 462, 965, 4911, 11049, 17255, 978, 1649, 29892, 13, 462, 462, 965, 525, 657, 742, 29871, 29946, 29900, 29941, 29892, 13, 462, 462, 965, 525, 2659, 2307, 13817, 297, 742, 1857, 29918, 1792, 29889, 517, 29918, 3126, 29898, 1195, 3039, 29922, 5574, 876, 13, 9651, 736, 679, 726, 877, 2659, 2307, 13817, 297, 29889, 5477, 29871, 29946, 29900, 29941, 13, 13, 4706, 1857, 29918, 1792, 29889, 5504, 29918, 4230, 29918, 14627, 580, 13, 4706, 1404, 29918, 6979, 353, 1857, 29918, 1792, 29889, 657, 29918, 6979, 29898, 6979, 29918, 1989, 29897, 13, 13, 4706, 1596, 877, 11049, 448, 4444, 1820, 411, 1518, 12232, 297, 29871, 29953, 29900, 29879, 742, 4867, 1839, 29918, 333, 7464, 4867, 1839, 29918, 1792, 29918, 333, 11287, 13, 4706, 1583, 29889, 5453, 29889, 1127, 275, 2697, 29898, 7924, 1839, 29918, 333, 7464, 4867, 1839, 29918, 1792, 29918, 333, 7464, 429, 29922, 29953, 29900, 29897, 13, 13, 4706, 396, 7106, 8908, 408, 4390, 1203, 13, 4706, 8908, 353, 8853, 2676, 11514, 29918, 2271, 1115, 376, 29893, 893, 597, 29908, 718, 1923, 978, 718, 376, 6160, 718, 851, 29898, 637, 29897, 718, 5591, 29893, 893, 29914, 1792, 29973, 333, 543, 718, 4867, 1839, 29918, 333, 7464, 13, 462, 376, 1792, 29918, 25118, 1115, 4867, 1839, 29918, 1792, 29918, 333, 7464, 13, 462, 376, 1792, 29918, 6979, 1115, 1404, 29918, 6979, 29913, 13, 13, 4706, 396, 1798, 1598, 3132, 1873, 313, 25253, 363, 1286, 29897, 13, 4706, 396, 1126, 788, 5235, 304, 8908, 13, 4706, 565, 525, 29990, 29899, 4032, 29899, 1170, 29915, 297, 2009, 29889, 13662, 322, 525, 29990, 29899, 4032, 29899, 6594, 29915, 297, 2009, 29889, 13662, 29901, 13, 9651, 1018, 29901, 13, 18884, 396, 7338, 1461, 2472, 13, 18884, 3132, 29918, 978, 353, 2009, 29889, 13662, 1839, 29990, 29899, 4032, 29899, 1170, 2033, 13, 18884, 3132, 29918, 3259, 353, 2009, 29889, 13662, 1839, 29990, 29899, 4032, 29899, 6594, 2033, 13, 13, 18884, 3132, 29918, 3259, 29918, 20895, 353, 3132, 29918, 3259, 29889, 5451, 12839, 1495, 13, 13, 18884, 396, 16012, 2998, 1873, 515, 2566, 29889, 13, 18884, 515, 1015, 296, 1572, 29889, 13239, 29889, 29911, 1572, 29963, 414, 1080, 1053, 323, 1572, 29963, 414, 1080, 13, 18884, 6910, 353, 323, 1572, 29963, 414, 1080, 580, 13, 18884, 6910, 29889, 1359, 29918, 3166, 29918, 2585, 580, 13, 13, 18884, 396, 1798, 1598, 565, 591, 505, 3132, 2472, 297, 6535, 13, 18884, 3132, 29918, 3888, 353, 6910, 29889, 657, 29918, 4645, 29918, 3259, 29918, 2541, 29918, 978, 29898, 4645, 29918, 978, 29897, 13, 18884, 565, 3132, 29918, 3888, 29901, 13, 462, 1678, 396, 1334, 505, 1554, 6087, 363, 445, 3132, 29892, 1235, 29915, 29879, 11539, 1873, 3694, 13, 462, 1678, 396, 1152, 1286, 29892, 591, 1603, 2758, 6464, 1584, 746, 1873, 29635, 13, 462, 1678, 396, 10088, 368, 2989, 1873, 2472, 13, 462, 1678, 8908, 1839, 3259, 29918, 12333, 2033, 353, 3132, 29918, 3888, 29889, 517, 29918, 8977, 580, 13, 462, 1678, 565, 3132, 29918, 3888, 29889, 3259, 2804, 3132, 29918, 3259, 29901, 13, 462, 4706, 8908, 1839, 3259, 29918, 2704, 2033, 353, 679, 726, 877, 4032, 1873, 29635, 1495, 13, 462, 4706, 396, 960, 4655, 1873, 29635, 29892, 12088, 3132, 29892, 937, 760, 310, 278, 1873, 13, 462, 4706, 6087, 29918, 4645, 29918, 3259, 29918, 20895, 353, 3132, 29918, 3888, 29889, 3259, 29889, 5451, 12839, 1495, 13, 462, 4706, 565, 7431, 29898, 303, 4395, 29918, 4645, 29918, 3259, 29918, 20895, 29897, 322, 7431, 29898, 4645, 29918, 3259, 29918, 20895, 1125, 13, 462, 9651, 565, 6087, 29918, 4645, 29918, 3259, 29918, 20895, 29961, 29900, 29962, 2804, 3132, 29918, 3259, 29918, 20895, 29961, 29900, 5387, 13, 462, 18884, 396, 736, 29871, 29946, 29906, 29953, 353, 14955, 3734, 13, 462, 18884, 1583, 29889, 5453, 29889, 21707, 29889, 1188, 29918, 27392, 29898, 1311, 29889, 5453, 29889, 5453, 29918, 978, 29892, 13, 462, 462, 462, 1669, 4911, 11049, 17255, 978, 1649, 29892, 13, 462, 462, 462, 1669, 525, 657, 742, 29871, 29946, 29906, 29953, 29892, 13, 462, 462, 462, 1669, 525, 4032, 4655, 1873, 2086, 2030, 29892, 451, 25967, 6464, 742, 13, 462, 462, 462, 1669, 6087, 29918, 4645, 29918, 3259, 29918, 20895, 29961, 29900, 1402, 13, 462, 462, 462, 1669, 3132, 29918, 3259, 29918, 20895, 29961, 29900, 2314, 13, 462, 18884, 736, 679, 726, 877, 4032, 4655, 1873, 2086, 2030, 29892, 451, 25967, 6464, 5477, 29871, 29946, 29906, 29953, 13, 18884, 1683, 29901, 13, 462, 1678, 736, 679, 726, 877, 13919, 3132, 1024, 584, 1495, 718, 3132, 29918, 978, 29892, 29871, 29946, 29900, 29941, 13, 9651, 5174, 7399, 2451, 408, 321, 29901, 13, 18884, 1583, 29889, 5453, 29889, 21707, 29889, 1188, 29918, 2704, 29898, 1311, 29889, 5453, 29889, 5453, 29918, 978, 29892, 13, 462, 462, 632, 4911, 11049, 17255, 978, 1649, 29892, 13, 462, 462, 632, 525, 657, 742, 29871, 29945, 29900, 29900, 29892, 525, 13919, 3132, 1873, 7834, 742, 851, 29898, 29872, 876, 13, 18884, 736, 679, 726, 877, 13919, 3132, 1873, 7834, 1495, 718, 851, 29898, 29872, 511, 29871, 29945, 29900, 29900, 13, 13, 4706, 736, 8908, 13, 2 ]
users.py
ArVID220u/SnallisBot
0
139966
# import twythonaccess to be able to make twitter requests from . import twythonaccess # import apikeys from . import apikeys # import twythonstreamer for the SwedishMiner down below from twython import TwythonStreamer # import threading from threading import Thread # import time import time # this class provides Swedish usernames # all unique, and as long as there are users left in Swedish Twitter, this class will keep churning them out class Users: # the added users is a set of the user ids of all that have been added added_users = set() # the next users is a queue for the users to be returned next_users = [] # the mine followers is also a queue for the users whose follower list hasn't yet been mined mine_followers = [] # initializer def __init__(self): # initialize added_users from the data file self.init_added_users() # create a swedish_miner self.swedish_miner = SwedishMiner(apikeys.MINE_CONSUMER_KEY, apikeys.MINE_CONSUMER_SECRET, apikeys.MINE_ACCESS_TOKEN, apikeys.MINE_ACCESS_TOKEN_SECRET) # set its users property to self # warning: this will create a memory leak, as both references are strong self.swedish_miner.users = self # start a thread for mining the swedish users swedish_miner_thread = Thread(target = self.swedish_miner_streamer) swedish_miner_thread.start() print("has initialized users by starting miner thread") # initialize added users from the file added_users.data def init_added_users(self): with open("/home/arvid220u/twitterbots/nicebot/added_users.data", 'r') as datafile: # at every line, there is exactly one user id, that has already beeen processed for line in datafile: userid = int(line.strip()) self.added_users.add(userid) # add a user to the lists, checking first if it's unique def add_user(self, userid): if userid in self.added_users: # already added this user, abort return print("adding user with id: " + str(userid)) # if there already are too many users in the mine_followers array, disconnect the swedish_miner if len(self.mine_followers) > 100: if self.swedish_miner.alive: print("disconnect swedish miner due to many already in queue") self.swedish_miner.disconnect() self.swedish_miner.alive = False # add user to added_users self.added_users.add(userid) # also add to the data file called added_users.data # append user to both the minefollowers queue and the nextusers queue self.next_users.append(userid) self.mine_followers.append(userid) # return a screen name of a user def get_user(self): # if the number of users in next_users is less than 10, mine some followers if len(self.next_users) < 10 and len(self.mine_followers) > 0: # do it in a separate thread print("need to mine some users since next_users is of length: " + str(len(self.next_users))) mine_followers_thread = Thread(target = self.mine_some_followers) mine_followers_thread.start() # if next users length is zero, which just should never happen, wait while len(self.next_users) == 0: print("next users is 0, will sleep for 6 minutes") time.sleep(6*60) # do not respond to protected users screenname = "" userid = 0 while True: # get the frontmost user in the next_users queue firstid = self.next_users.pop(0) # get the screen name of this particular user twythonaccess.sleep_if_requests_are_maximum(170, main=False) user = twythonaccess.authorize(main=False).show_user(user_id=firstid) if not user["protected"]: screenname = user["screen_name"] userid = user["id"] break elif len(self.next_users) == 0: return self.get_user() print("found user with screenname: " + screenname) # add this user to the added users data file, so as to not tweet to the same person twice with open("/home/arvid220u/twitterbots/nicebot/added_users.data", 'a') as datafile: datafile.write(str(userid) + '\n') # return it return screenname # mine some followers def mine_some_followers(self): # if the mine_followers queue contains less than 200 items, start the swedish streamer if len(self.mine_followers) < 20 and not self.swedish_miner.alive: print("starting swedish miner anew since mine followers length is " + str(len(self.mine_followers))) swedish_miner_thread = Thread(target = self.swedish_miner_streamer) swedish_miner_thread.start() while len(self.mine_followers) == 0: print("mine followers is 0, will sleep for 6 minutes") time.sleep(6*60) counter = 0 while True: # get the first user userid = self.mine_followers.pop(0) # get user twythonaccess.sleep_if_requests_are_maximum(170, main=False) user = twythonaccess.authorize(main=False).show_user(user_id=userid) # if user is protected, continue if user["protected"]: if len(self.mine_followers) == 0: break continue # get a list of the followers twythonaccess.sleep_if_requests_are_maximum(13, main=False) followers = twythonaccess.authorize(main=False).get_followers_list(user_id=userid, count=100)["users"] for follower in followers: if follower["lang"] == "sv": self.add_user(follower["id"]) count += 1 if count > 100 or len(mine_followers) == 0: break print("finished mining followers") # start the swedish miner streamer def swedish_miner_streamer(self): # get most of all swedish tweets # it performs an or search, with language sv print("starting swedish miner streamer") self.swedish_miner.alive = True self.swedish_miner.statuses.filter(track="i,och,att,det,som,en,på,är,av,för", language="sv") # this class finds users based on them sending tweets marked as swedish class SwedishMiner(TwythonStreamer): # check if alive alive = False # this function is called when a tweet is received def on_success(self, tweet): # add the user #print("found new user from swedish streamer miner") self.users.add_user(tweet["user"]["id"]) def on_error(self, status_code, data): print("STREAMING API ERROR in SwedishStreamer") print("Status code:") print(status_code) print("other data:") print(data) print("END OF ERROR MESSAGE")
[ 1, 396, 1053, 3252, 1656, 5943, 304, 367, 2221, 304, 1207, 23394, 7274, 13, 3166, 869, 1053, 3252, 1656, 5943, 13, 29937, 1053, 7882, 8149, 13, 3166, 869, 1053, 7882, 8149, 13, 29937, 1053, 3252, 1656, 5461, 261, 363, 278, 21892, 29924, 4983, 1623, 2400, 13, 3166, 3252, 1656, 1053, 8168, 1656, 3835, 261, 13, 29937, 1053, 3244, 292, 13, 3166, 3244, 292, 1053, 10480, 13, 29937, 1053, 931, 13, 5215, 931, 13, 13, 29937, 445, 770, 8128, 21892, 502, 824, 1280, 13, 29937, 599, 5412, 29892, 322, 408, 1472, 408, 727, 526, 4160, 2175, 297, 21892, 20147, 29892, 445, 770, 674, 3013, 521, 595, 292, 963, 714, 13, 1990, 23861, 29901, 13, 1678, 396, 278, 2715, 4160, 338, 263, 731, 310, 278, 1404, 18999, 310, 599, 393, 505, 1063, 2715, 13, 1678, 2715, 29918, 7193, 353, 731, 580, 13, 1678, 396, 278, 2446, 4160, 338, 263, 9521, 363, 278, 4160, 304, 367, 4133, 13, 1678, 2446, 29918, 7193, 353, 5159, 13, 1678, 396, 278, 7903, 1101, 414, 338, 884, 263, 9521, 363, 278, 4160, 5069, 1101, 261, 1051, 22602, 29915, 29873, 3447, 1063, 286, 1312, 13, 1678, 7903, 29918, 23031, 414, 353, 5159, 13, 13, 1678, 396, 2847, 3950, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 396, 11905, 2715, 29918, 7193, 515, 278, 848, 934, 13, 4706, 1583, 29889, 2344, 29918, 23959, 29918, 7193, 580, 13, 4706, 396, 1653, 263, 2381, 21207, 29918, 1195, 261, 13, 4706, 1583, 29889, 2774, 21207, 29918, 1195, 261, 353, 21892, 29924, 4983, 29898, 2754, 8149, 29889, 29924, 8895, 29918, 6007, 25021, 1001, 29918, 10818, 29892, 7882, 8149, 29889, 29924, 8895, 29918, 6007, 25021, 1001, 29918, 1660, 22245, 29911, 29892, 7882, 8149, 29889, 29924, 8895, 29918, 2477, 23524, 29918, 4986, 29968, 1430, 29892, 7882, 8149, 29889, 29924, 8895, 29918, 2477, 23524, 29918, 4986, 29968, 1430, 29918, 1660, 22245, 29911, 29897, 13, 4706, 396, 731, 967, 4160, 2875, 304, 1583, 13, 4706, 396, 9177, 29901, 445, 674, 1653, 263, 3370, 24993, 29892, 408, 1716, 9282, 526, 4549, 13, 4706, 1583, 29889, 2774, 21207, 29918, 1195, 261, 29889, 7193, 353, 1583, 13, 4706, 396, 1369, 263, 3244, 363, 1375, 292, 278, 2381, 21207, 4160, 13, 4706, 2381, 21207, 29918, 1195, 261, 29918, 7097, 353, 10480, 29898, 5182, 353, 1583, 29889, 2774, 21207, 29918, 1195, 261, 29918, 5461, 261, 29897, 13, 4706, 2381, 21207, 29918, 1195, 261, 29918, 7097, 29889, 2962, 580, 13, 4706, 1596, 703, 5349, 16601, 4160, 491, 6257, 1375, 261, 3244, 1159, 13, 13, 13, 1678, 396, 11905, 2715, 4160, 515, 278, 934, 2715, 29918, 7193, 29889, 1272, 13, 1678, 822, 2069, 29918, 23959, 29918, 7193, 29898, 1311, 1125, 13, 4706, 411, 1722, 11974, 5184, 29914, 279, 8590, 29906, 29906, 29900, 29884, 29914, 24946, 29890, 1862, 29914, 16533, 7451, 29914, 23959, 29918, 7193, 29889, 1272, 613, 525, 29878, 1495, 408, 848, 1445, 29901, 13, 9651, 396, 472, 1432, 1196, 29892, 727, 338, 3721, 697, 1404, 1178, 29892, 393, 756, 2307, 367, 27294, 19356, 13, 9651, 363, 1196, 297, 848, 1445, 29901, 13, 18884, 1404, 333, 353, 938, 29898, 1220, 29889, 17010, 3101, 13, 18884, 1583, 29889, 23959, 29918, 7193, 29889, 1202, 29898, 1792, 333, 29897, 13, 13, 13, 13, 13, 1678, 396, 788, 263, 1404, 304, 278, 8857, 29892, 8454, 937, 565, 372, 29915, 29879, 5412, 13, 1678, 822, 788, 29918, 1792, 29898, 1311, 29892, 1404, 333, 1125, 13, 4706, 565, 1404, 333, 297, 1583, 29889, 23959, 29918, 7193, 29901, 13, 9651, 396, 2307, 2715, 445, 1404, 29892, 27450, 13, 9651, 736, 13, 4706, 1596, 703, 4676, 1404, 411, 1178, 29901, 376, 718, 851, 29898, 1792, 333, 876, 13, 4706, 396, 565, 727, 2307, 526, 2086, 1784, 4160, 297, 278, 7903, 29918, 23031, 414, 1409, 29892, 766, 6915, 278, 2381, 21207, 29918, 1195, 261, 13, 4706, 565, 7431, 29898, 1311, 29889, 24669, 29918, 23031, 414, 29897, 1405, 29871, 29896, 29900, 29900, 29901, 13, 9651, 565, 1583, 29889, 2774, 21207, 29918, 1195, 261, 29889, 284, 573, 29901, 13, 18884, 1596, 703, 2218, 6915, 2381, 21207, 1375, 261, 2861, 304, 1784, 2307, 297, 9521, 1159, 13, 18884, 1583, 29889, 2774, 21207, 29918, 1195, 261, 29889, 2218, 6915, 580, 13, 18884, 1583, 29889, 2774, 21207, 29918, 1195, 261, 29889, 284, 573, 353, 7700, 13, 4706, 396, 788, 1404, 304, 2715, 29918, 7193, 13, 4706, 1583, 29889, 23959, 29918, 7193, 29889, 1202, 29898, 1792, 333, 29897, 13, 4706, 396, 884, 788, 304, 278, 848, 934, 2000, 2715, 29918, 7193, 29889, 1272, 13, 308, 13, 4706, 396, 9773, 1404, 304, 1716, 278, 7903, 23031, 414, 9521, 322, 278, 2446, 7193, 9521, 13, 4706, 1583, 29889, 4622, 29918, 7193, 29889, 4397, 29898, 1792, 333, 29897, 13, 4706, 1583, 29889, 24669, 29918, 23031, 414, 29889, 4397, 29898, 1792, 333, 29897, 13, 13, 13, 1678, 396, 736, 263, 4315, 1024, 310, 263, 1404, 13, 1678, 822, 679, 29918, 1792, 29898, 1311, 1125, 13, 4706, 396, 565, 278, 1353, 310, 4160, 297, 2446, 29918, 7193, 338, 3109, 1135, 29871, 29896, 29900, 29892, 7903, 777, 1101, 414, 13, 4706, 565, 7431, 29898, 1311, 29889, 4622, 29918, 7193, 29897, 529, 29871, 29896, 29900, 322, 7431, 29898, 1311, 29889, 24669, 29918, 23031, 414, 29897, 1405, 29871, 29900, 29901, 13, 9651, 396, 437, 372, 297, 263, 5004, 3244, 13, 9651, 1596, 703, 26180, 304, 7903, 777, 4160, 1951, 2446, 29918, 7193, 338, 310, 3309, 29901, 376, 718, 851, 29898, 2435, 29898, 1311, 29889, 4622, 29918, 7193, 4961, 13, 9651, 7903, 29918, 23031, 414, 29918, 7097, 353, 10480, 29898, 5182, 353, 1583, 29889, 24669, 29918, 5372, 29918, 23031, 414, 29897, 13, 9651, 7903, 29918, 23031, 414, 29918, 7097, 29889, 2962, 580, 13, 4706, 396, 565, 2446, 4160, 3309, 338, 5225, 29892, 607, 925, 881, 2360, 3799, 29892, 4480, 13, 4706, 1550, 7431, 29898, 1311, 29889, 4622, 29918, 7193, 29897, 1275, 29871, 29900, 29901, 13, 9651, 1596, 703, 4622, 4160, 338, 29871, 29900, 29892, 674, 8709, 363, 29871, 29953, 6233, 1159, 13, 9651, 931, 29889, 17059, 29898, 29953, 29930, 29953, 29900, 29897, 13, 4706, 396, 437, 451, 10049, 304, 6364, 4160, 13, 4706, 4315, 978, 353, 5124, 13, 4706, 1404, 333, 353, 29871, 29900, 13, 4706, 1550, 5852, 29901, 13, 9651, 396, 679, 278, 4565, 3242, 1404, 297, 278, 2446, 29918, 7193, 9521, 13, 9651, 937, 333, 353, 1583, 29889, 4622, 29918, 7193, 29889, 7323, 29898, 29900, 29897, 13, 9651, 396, 679, 278, 4315, 1024, 310, 445, 3153, 1404, 13, 9651, 3252, 1656, 5943, 29889, 17059, 29918, 361, 29918, 24830, 29918, 598, 29918, 27525, 398, 29898, 29896, 29955, 29900, 29892, 1667, 29922, 8824, 29897, 13, 9651, 1404, 353, 3252, 1656, 5943, 29889, 8921, 675, 29898, 3396, 29922, 8824, 467, 4294, 29918, 1792, 29898, 1792, 29918, 333, 29922, 4102, 333, 29897, 13, 9651, 565, 451, 1404, 3366, 24681, 3108, 29901, 13, 18884, 4315, 978, 353, 1404, 3366, 10525, 29918, 978, 3108, 13, 18884, 1404, 333, 353, 1404, 3366, 333, 3108, 13, 18884, 2867, 13, 9651, 25342, 7431, 29898, 1311, 29889, 4622, 29918, 7193, 29897, 1275, 29871, 29900, 29901, 13, 18884, 736, 1583, 29889, 657, 29918, 1792, 580, 13, 4706, 1596, 703, 11940, 1404, 411, 4315, 978, 29901, 376, 718, 4315, 978, 29897, 13, 4706, 396, 788, 445, 1404, 304, 278, 2715, 4160, 848, 934, 29892, 577, 408, 304, 451, 7780, 300, 304, 278, 1021, 2022, 8951, 13, 4706, 411, 1722, 11974, 5184, 29914, 279, 8590, 29906, 29906, 29900, 29884, 29914, 24946, 29890, 1862, 29914, 16533, 7451, 29914, 23959, 29918, 7193, 29889, 1272, 613, 525, 29874, 1495, 408, 848, 1445, 29901, 13, 9651, 848, 1445, 29889, 3539, 29898, 710, 29898, 1792, 333, 29897, 718, 11297, 29876, 1495, 13, 4706, 396, 736, 372, 13, 4706, 736, 4315, 978, 13, 308, 13, 13, 13, 1678, 396, 7903, 777, 1101, 414, 13, 1678, 822, 7903, 29918, 5372, 29918, 23031, 414, 29898, 1311, 1125, 13, 4706, 396, 565, 278, 7903, 29918, 23031, 414, 9521, 3743, 3109, 1135, 29871, 29906, 29900, 29900, 4452, 29892, 1369, 278, 2381, 21207, 4840, 261, 13, 4706, 565, 7431, 29898, 1311, 29889, 24669, 29918, 23031, 414, 29897, 529, 29871, 29906, 29900, 322, 451, 1583, 29889, 2774, 21207, 29918, 1195, 261, 29889, 284, 573, 29901, 13, 9651, 1596, 703, 2962, 292, 2381, 21207, 1375, 261, 385, 809, 1951, 7903, 1101, 414, 3309, 338, 376, 718, 851, 29898, 2435, 29898, 1311, 29889, 24669, 29918, 23031, 414, 4961, 13, 9651, 2381, 21207, 29918, 1195, 261, 29918, 7097, 353, 10480, 29898, 5182, 353, 1583, 29889, 2774, 21207, 29918, 1195, 261, 29918, 5461, 261, 29897, 13, 9651, 2381, 21207, 29918, 1195, 261, 29918, 7097, 29889, 2962, 580, 13, 4706, 1550, 7431, 29898, 1311, 29889, 24669, 29918, 23031, 414, 29897, 1275, 29871, 29900, 29901, 13, 9651, 1596, 703, 24669, 1101, 414, 338, 29871, 29900, 29892, 674, 8709, 363, 29871, 29953, 6233, 1159, 13, 9651, 931, 29889, 17059, 29898, 29953, 29930, 29953, 29900, 29897, 13, 4706, 6795, 353, 29871, 29900, 13, 4706, 1550, 5852, 29901, 13, 9651, 396, 679, 278, 937, 1404, 13, 9651, 1404, 333, 353, 1583, 29889, 24669, 29918, 23031, 414, 29889, 7323, 29898, 29900, 29897, 13, 9651, 396, 679, 1404, 13, 9651, 3252, 1656, 5943, 29889, 17059, 29918, 361, 29918, 24830, 29918, 598, 29918, 27525, 398, 29898, 29896, 29955, 29900, 29892, 1667, 29922, 8824, 29897, 13, 9651, 1404, 353, 3252, 1656, 5943, 29889, 8921, 675, 29898, 3396, 29922, 8824, 467, 4294, 29918, 1792, 29898, 1792, 29918, 333, 29922, 1792, 333, 29897, 13, 9651, 396, 565, 1404, 338, 6364, 29892, 6773, 13, 9651, 565, 1404, 3366, 24681, 3108, 29901, 13, 18884, 565, 7431, 29898, 1311, 29889, 24669, 29918, 23031, 414, 29897, 1275, 29871, 29900, 29901, 13, 462, 1678, 2867, 13, 18884, 6773, 13, 9651, 396, 679, 263, 1051, 310, 278, 1101, 414, 13, 9651, 3252, 1656, 5943, 29889, 17059, 29918, 361, 29918, 24830, 29918, 598, 29918, 27525, 398, 29898, 29896, 29941, 29892, 1667, 29922, 8824, 29897, 13, 9651, 1101, 414, 353, 3252, 1656, 5943, 29889, 8921, 675, 29898, 3396, 29922, 8824, 467, 657, 29918, 23031, 414, 29918, 1761, 29898, 1792, 29918, 333, 29922, 1792, 333, 29892, 2302, 29922, 29896, 29900, 29900, 29897, 3366, 7193, 3108, 13, 9651, 363, 1101, 261, 297, 1101, 414, 29901, 13, 18884, 565, 1101, 261, 3366, 3893, 3108, 1275, 376, 4501, 1115, 13, 462, 1678, 1583, 29889, 1202, 29918, 1792, 29898, 23031, 261, 3366, 333, 20068, 13, 462, 1678, 2302, 4619, 29871, 29896, 13, 9651, 565, 2302, 1405, 29871, 29896, 29900, 29900, 470, 7431, 29898, 24669, 29918, 23031, 414, 29897, 1275, 29871, 29900, 29901, 13, 18884, 2867, 13, 4706, 1596, 703, 4951, 3276, 1375, 292, 1101, 414, 1159, 13, 13, 13, 1678, 396, 1369, 278, 2381, 21207, 1375, 261, 4840, 261, 13, 1678, 822, 2381, 21207, 29918, 1195, 261, 29918, 5461, 261, 29898, 1311, 1125, 13, 4706, 396, 679, 1556, 310, 599, 2381, 21207, 7780, 1691, 13, 4706, 396, 372, 23233, 385, 470, 2740, 29892, 411, 4086, 3731, 13, 4706, 1596, 703, 2962, 292, 2381, 21207, 1375, 261, 4840, 261, 1159, 13, 4706, 1583, 29889, 2774, 21207, 29918, 1195, 261, 29889, 284, 573, 353, 5852, 13, 4706, 1583, 29889, 2774, 21207, 29918, 1195, 261, 29889, 4882, 267, 29889, 4572, 29898, 11294, 543, 29875, 29892, 2878, 29892, 1131, 29892, 4801, 29892, 22708, 29892, 264, 29892, 29886, 30020, 29892, 1215, 29892, 485, 29892, 9255, 613, 4086, 543, 4501, 1159, 13, 13, 13, 13, 29937, 445, 770, 14061, 4160, 2729, 373, 963, 9348, 7780, 1691, 10902, 408, 2381, 21207, 13, 1990, 21892, 29924, 4983, 29898, 27418, 1656, 3835, 261, 1125, 13, 1678, 396, 1423, 565, 18758, 13, 1678, 18758, 353, 7700, 13, 1678, 396, 445, 740, 338, 2000, 746, 263, 7780, 300, 338, 4520, 13, 1678, 822, 373, 29918, 8698, 29898, 1311, 29892, 7780, 300, 1125, 13, 4706, 396, 788, 278, 1404, 13, 4706, 396, 2158, 703, 11940, 716, 1404, 515, 2381, 21207, 4840, 261, 1375, 261, 1159, 13, 4706, 1583, 29889, 7193, 29889, 1202, 29918, 1792, 29898, 29873, 16668, 3366, 1792, 3108, 3366, 333, 20068, 13, 13, 1678, 822, 373, 29918, 2704, 29898, 1311, 29892, 4660, 29918, 401, 29892, 848, 1125, 13, 4706, 1596, 703, 1254, 1525, 5194, 4214, 3450, 14431, 297, 21892, 3835, 261, 1159, 13, 4706, 1596, 703, 5709, 775, 29901, 1159, 13, 4706, 1596, 29898, 4882, 29918, 401, 29897, 13, 4706, 1596, 703, 1228, 848, 29901, 1159, 13, 4706, 1596, 29898, 1272, 29897, 13, 4706, 1596, 703, 11794, 8079, 14431, 22986, 1799, 10461, 1159, 13, 2 ]
venv/Lib/site-packages/comet_ml/loggers/shap_logger.py
jinga-lala/stupidNMT
0
107579
<filename>venv/Lib/site-packages/comet_ml/loggers/shap_logger.py # -*- coding: utf-8 -*- # ******************************************************* # ____ _ _ # / ___|___ _ __ ___ ___| |_ _ __ ___ | | # | | / _ \| '_ ` _ \ / _ \ __| | '_ ` _ \| | # | |__| (_) | | | | | | __/ |_ _| | | | | | | # \____\___/|_| |_| |_|\___|\__(_)_| |_| |_|_| # # Sign up for free at http://www.comet.ml # Copyright (C) 2015-2020 Comet ML INC # This file can not be copied and/or distributed without # the express permission of Comet ML Inc. # ******************************************************* import logging from .._logging import check_module from .._typing import Any from ..experiment import BaseExperiment LOGGER = logging.getLogger(__name__) class SHAPLogger(object): def __init__(self, title): self.show = True self.title = title def before(self, experiment, original, *args, **kwargs): """ Little wrapper to make sure show is False """ self.show = kwargs.get("show", True) kwargs["show"] = False return (args, kwargs) def after(self, experiment, original, results, *args, **kwargs): # type: (BaseExperiment, Any, Any, Any, Any) -> None """ Little wrapper to log figure, and show, if needed. """ # The post callback shouldn't execute in case of exception in original, so we should have # matplotlib except if some shap analysis do not need matplotlib in the future try: import matplotlib.pyplot as plt except ImportError: LOGGER.warning("matplotlib not installed; shap logging disabled") return if experiment.config["comet.auto_log.figures"]: experiment._storage["shap"]["counter"] += 1 experiment._log_figure( figure_name="shap-%s-%s" % (self.title, experiment._storage["shap"]["counter"]), figure_type="shap", framework="shap", ) if self.show: plt.show() def patch(module_finder): check_module("shap") modules = [ ("shap.plots._bar", "bar", "bar"), ("shap.plots._bar", "bar_legacy", "bar_plot"), ("shap.plots._image", "image", "image_plot"), ("shap.plots._beeswarm", "beeswarm", "beeswarm"), ("shap.plots._beeswarm", "summary_legacy", "summary_plot"), ("shap.plots._decision", "decision", "decision_plot"), ("shap.plots._decision", "multioutput_decision", "multioutput_decision_plot"), ("shap.plots._embedding", "embedding", "embedding_plot"), ("shap.plots._force", "force", "force_plot"), ("shap.plots._group_difference", "group_difference", "group_difference_plot"), ("shap.plots._heatmap", "heatmap", "heatmap"), ("shap.plots._scatter", "scatter", "scatter"), ("shap.plots._scatter", "dependence_legacy", "dependence_plot"), ("shap.plots._monitoring", "monitoring", "monitoring_plot"), ( "shap.plots._partial_dependence", "partial_dependence", "partial_dependence_plot", ), ("shap.plots._violin", "violin", "violin"), ("shap.plots._waterfall", "waterfall", "waterfall_plot"), ] for module, function, title in modules: shap_logger = SHAPLogger(title) module_finder.register_before(module, function, shap_logger.before) module_finder.register_after(module, function, shap_logger.after) check_module("shap")
[ 1, 529, 9507, 29958, 854, 29894, 29914, 14868, 29914, 2746, 29899, 8318, 29914, 510, 300, 29918, 828, 29914, 1188, 5743, 29914, 845, 481, 29918, 21707, 29889, 2272, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 29937, 334, 7775, 7775, 7775, 2328, 1068, 13, 29937, 259, 903, 22359, 462, 268, 903, 1669, 903, 13, 29937, 29871, 847, 903, 1649, 29989, 22359, 29871, 903, 4770, 903, 1649, 259, 903, 1649, 29989, 891, 29918, 259, 903, 4770, 903, 1649, 891, 891, 13, 29937, 891, 891, 259, 847, 903, 12926, 22868, 421, 903, 320, 847, 903, 320, 4770, 29989, 891, 22868, 421, 903, 12926, 891, 13, 29937, 891, 891, 1649, 29989, 9423, 29897, 891, 891, 891, 891, 891, 891, 29871, 4770, 29914, 891, 29918, 903, 29989, 891, 891, 891, 891, 891, 891, 13, 29937, 29871, 320, 7652, 29905, 22359, 29914, 29989, 29918, 29989, 891, 29918, 29989, 891, 29918, 4295, 22359, 4295, 1649, 7373, 20344, 29989, 891, 29918, 29989, 891, 29918, 29989, 29918, 29989, 13, 29937, 13, 29937, 29871, 9954, 701, 363, 3889, 472, 1732, 597, 1636, 29889, 510, 300, 29889, 828, 13, 29937, 29871, 14187, 1266, 313, 29907, 29897, 29871, 29906, 29900, 29896, 29945, 29899, 29906, 29900, 29906, 29900, 422, 300, 23158, 2672, 29907, 13, 29937, 29871, 910, 934, 508, 451, 367, 13746, 322, 29914, 272, 13235, 1728, 13, 29937, 29871, 278, 4653, 10751, 310, 422, 300, 23158, 9266, 29889, 13, 29937, 334, 7775, 7775, 7775, 2328, 1068, 13, 13, 5215, 12183, 13, 13, 3166, 6317, 29918, 21027, 1053, 1423, 29918, 5453, 13, 3166, 6317, 29918, 1017, 15702, 1053, 3139, 13, 3166, 6317, 735, 15362, 1053, 7399, 1252, 15362, 13, 13, 14480, 17070, 353, 12183, 29889, 657, 16363, 22168, 978, 1649, 29897, 13, 13, 13, 1990, 24972, 3301, 16363, 29898, 3318, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 3611, 1125, 13, 4706, 1583, 29889, 4294, 353, 5852, 13, 4706, 1583, 29889, 3257, 353, 3611, 13, 13, 1678, 822, 1434, 29898, 1311, 29892, 7639, 29892, 2441, 29892, 334, 5085, 29892, 3579, 19290, 1125, 13, 4706, 9995, 13, 4706, 11143, 14476, 304, 1207, 1854, 1510, 338, 7700, 13, 4706, 9995, 13, 4706, 1583, 29889, 4294, 353, 9049, 5085, 29889, 657, 703, 4294, 613, 5852, 29897, 13, 13, 4706, 9049, 5085, 3366, 4294, 3108, 353, 7700, 13, 4706, 736, 313, 5085, 29892, 9049, 5085, 29897, 13, 13, 1678, 822, 1156, 29898, 1311, 29892, 7639, 29892, 2441, 29892, 2582, 29892, 334, 5085, 29892, 3579, 19290, 1125, 13, 4706, 396, 1134, 29901, 313, 5160, 1252, 15362, 29892, 3139, 29892, 3139, 29892, 3139, 29892, 3139, 29897, 1599, 6213, 13, 4706, 9995, 13, 4706, 11143, 14476, 304, 1480, 4377, 29892, 322, 1510, 29892, 565, 4312, 29889, 13, 4706, 9995, 13, 13, 4706, 396, 450, 1400, 6939, 9273, 29915, 29873, 6222, 297, 1206, 310, 3682, 297, 2441, 29892, 577, 591, 881, 505, 13, 4706, 396, 22889, 5174, 565, 777, 528, 481, 7418, 437, 451, 817, 22889, 297, 278, 5434, 13, 4706, 1018, 29901, 13, 9651, 1053, 22889, 29889, 2272, 5317, 408, 14770, 13, 4706, 5174, 16032, 2392, 29901, 13, 9651, 25401, 17070, 29889, 27392, 703, 2922, 17357, 451, 5130, 29936, 528, 481, 12183, 12708, 1159, 13, 9651, 736, 13, 13, 4706, 565, 7639, 29889, 2917, 3366, 510, 300, 29889, 6921, 29918, 1188, 29889, 1003, 1973, 3108, 29901, 13, 9651, 7639, 3032, 12925, 3366, 845, 481, 3108, 3366, 11808, 3108, 4619, 29871, 29896, 13, 9651, 7639, 3032, 1188, 29918, 4532, 29898, 13, 18884, 4377, 29918, 978, 543, 845, 481, 19222, 29879, 19222, 29879, 29908, 13, 18884, 1273, 313, 1311, 29889, 3257, 29892, 7639, 3032, 12925, 3366, 845, 481, 3108, 3366, 11808, 3108, 511, 13, 18884, 4377, 29918, 1853, 543, 845, 481, 613, 13, 18884, 6890, 543, 845, 481, 613, 13, 9651, 1723, 13, 4706, 565, 1583, 29889, 4294, 29901, 13, 9651, 14770, 29889, 4294, 580, 13, 13, 13, 1753, 13261, 29898, 5453, 29918, 2886, 261, 1125, 13, 1678, 1423, 29918, 5453, 703, 845, 481, 1159, 13, 13, 1678, 10585, 353, 518, 13, 4706, 4852, 845, 481, 29889, 26762, 3032, 1646, 613, 376, 1646, 613, 376, 1646, 4968, 13, 4706, 4852, 845, 481, 29889, 26762, 3032, 1646, 613, 376, 1646, 29918, 1397, 4135, 613, 376, 1646, 29918, 5317, 4968, 13, 4706, 4852, 845, 481, 29889, 26762, 3032, 3027, 613, 376, 3027, 613, 376, 3027, 29918, 5317, 4968, 13, 4706, 4852, 845, 481, 29889, 26762, 3032, 915, 267, 29893, 2817, 613, 376, 915, 267, 29893, 2817, 613, 376, 915, 267, 29893, 2817, 4968, 13, 4706, 4852, 845, 481, 29889, 26762, 3032, 915, 267, 29893, 2817, 613, 376, 7727, 29918, 1397, 4135, 613, 376, 7727, 29918, 5317, 4968, 13, 4706, 4852, 845, 481, 29889, 26762, 3032, 7099, 2459, 613, 376, 7099, 2459, 613, 376, 7099, 2459, 29918, 5317, 4968, 13, 4706, 4852, 845, 481, 29889, 26762, 3032, 7099, 2459, 613, 376, 9910, 4905, 29918, 7099, 2459, 613, 376, 9910, 4905, 29918, 7099, 2459, 29918, 5317, 4968, 13, 4706, 4852, 845, 481, 29889, 26762, 3032, 17987, 8497, 613, 376, 17987, 8497, 613, 376, 17987, 8497, 29918, 5317, 4968, 13, 4706, 4852, 845, 481, 29889, 26762, 3032, 10118, 613, 376, 10118, 613, 376, 10118, 29918, 5317, 4968, 13, 4706, 4852, 845, 481, 29889, 26762, 3032, 2972, 29918, 29881, 17678, 613, 376, 2972, 29918, 29881, 17678, 613, 376, 2972, 29918, 29881, 17678, 29918, 5317, 4968, 13, 4706, 4852, 845, 481, 29889, 26762, 3032, 354, 271, 1958, 613, 376, 354, 271, 1958, 613, 376, 354, 271, 1958, 4968, 13, 4706, 4852, 845, 481, 29889, 26762, 3032, 1557, 2620, 613, 376, 1557, 2620, 613, 376, 1557, 2620, 4968, 13, 4706, 4852, 845, 481, 29889, 26762, 3032, 1557, 2620, 613, 376, 2716, 355, 663, 29918, 1397, 4135, 613, 376, 2716, 355, 663, 29918, 5317, 4968, 13, 4706, 4852, 845, 481, 29889, 26762, 3032, 3712, 2105, 292, 613, 376, 3712, 2105, 292, 613, 376, 3712, 2105, 292, 29918, 5317, 4968, 13, 4706, 313, 13, 9651, 376, 845, 481, 29889, 26762, 3032, 3846, 29918, 2716, 355, 663, 613, 13, 9651, 376, 3846, 29918, 2716, 355, 663, 613, 13, 9651, 376, 3846, 29918, 2716, 355, 663, 29918, 5317, 613, 13, 4706, 10353, 13, 4706, 4852, 845, 481, 29889, 26762, 3032, 1403, 22878, 613, 376, 1403, 22878, 613, 376, 1403, 22878, 4968, 13, 4706, 4852, 845, 481, 29889, 26762, 3032, 13405, 11950, 613, 376, 13405, 11950, 613, 376, 13405, 11950, 29918, 5317, 4968, 13, 1678, 4514, 13, 1678, 363, 3883, 29892, 740, 29892, 3611, 297, 10585, 29901, 13, 4706, 528, 481, 29918, 21707, 353, 24972, 3301, 16363, 29898, 3257, 29897, 13, 4706, 3883, 29918, 2886, 261, 29889, 9573, 29918, 11083, 29898, 5453, 29892, 740, 29892, 528, 481, 29918, 21707, 29889, 11083, 29897, 13, 4706, 3883, 29918, 2886, 261, 29889, 9573, 29918, 7045, 29898, 5453, 29892, 740, 29892, 528, 481, 29918, 21707, 29889, 7045, 29897, 13, 13, 13, 3198, 29918, 5453, 703, 845, 481, 1159, 13, 2 ]
tests/integration/integration_fixture_builders.py
dendisuhubdy/trinity
3
163879
<reponame>dendisuhubdy/trinity from eth_keys import keys from eth_utils import decode_hex from tests.core.integration_test_helpers import FUNDED_ACCT, load_mining_chain from .churn_state.builder import ( delete_churn, deploy_storage_churn_contract, update_churn, ) RECEIVER = keys.PrivateKey( decode_hex("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")) def build_pow_fixture(write_db, num_blocks=20): chain = load_mining_chain(write_db) recipient_address = RECEIVER.public_key.to_canonical_address() for i in range(num_blocks): tx = chain.create_unsigned_transaction( nonce=i, gas_price=1234, gas=123400, to=recipient_address, value=i, data=b'', ) chain.apply_transaction(tx.as_signed_transaction(FUNDED_ACCT)) chain.mine_block() return chain.chaindb def build_pow_churning_fixture(write_db, num_blocks=40): chain = load_mining_chain(write_db) contract_addr = deploy_storage_churn_contract(chain) half_blocks = num_blocks // 2 nymph_contracts, nonce = update_churn(chain, contract_addr, num_blocks=half_blocks) delete_churn(chain, nymph_contracts, contract_addr, start_nonce=nonce, num_blocks=half_blocks) return chain, contract_addr
[ 1, 529, 276, 1112, 420, 29958, 29881, 355, 275, 16099, 431, 4518, 29914, 509, 13593, 13, 3166, 11314, 29918, 8149, 1053, 6611, 13, 3166, 11314, 29918, 13239, 1053, 21822, 29918, 20970, 13, 13, 3166, 6987, 29889, 3221, 29889, 27925, 29918, 1688, 29918, 3952, 6774, 1053, 383, 3904, 2287, 29928, 29918, 2477, 1783, 29892, 2254, 29918, 1195, 292, 29918, 14153, 13, 13, 3166, 869, 305, 595, 29918, 3859, 29889, 16409, 1053, 313, 13, 1678, 5217, 29918, 305, 595, 29892, 13, 1678, 7246, 29918, 12925, 29918, 305, 595, 29918, 1285, 1461, 29892, 13, 1678, 2767, 29918, 305, 595, 29892, 13, 29897, 13, 13, 1525, 4741, 29902, 5348, 353, 6611, 29889, 25207, 2558, 29898, 13, 1678, 21822, 29918, 20970, 703, 29890, 29955, 29896, 29883, 29955, 29896, 29874, 29953, 29955, 29872, 29896, 29896, 29955, 29955, 328, 29946, 29872, 29929, 29900, 29896, 29953, 29929, 29945, 29872, 29896, 29890, 29946, 29890, 29929, 3905, 29896, 29955, 3660, 29896, 29953, 29883, 29953, 29953, 29953, 29947, 29881, 29941, 29896, 29941, 29872, 562, 29906, 29888, 29929, 29953, 11140, 1388, 29941, 29888, 29906, 29929, 29896, 5783, 13, 13, 13, 1753, 2048, 29918, 12248, 29918, 7241, 15546, 29898, 3539, 29918, 2585, 29892, 954, 29918, 1271, 29879, 29922, 29906, 29900, 1125, 13, 1678, 9704, 353, 2254, 29918, 1195, 292, 29918, 14153, 29898, 3539, 29918, 2585, 29897, 13, 1678, 23957, 993, 29918, 7328, 353, 5195, 4741, 29902, 5348, 29889, 3597, 29918, 1989, 29889, 517, 29918, 3068, 265, 936, 29918, 7328, 580, 13, 1678, 363, 474, 297, 3464, 29898, 1949, 29918, 1271, 29879, 1125, 13, 4706, 25568, 353, 9704, 29889, 3258, 29918, 15395, 29918, 20736, 29898, 13, 9651, 1661, 346, 29922, 29875, 29892, 13, 9651, 10489, 29918, 9175, 29922, 29896, 29906, 29941, 29946, 29892, 13, 9651, 10489, 29922, 29896, 29906, 29941, 29946, 29900, 29900, 29892, 13, 9651, 304, 29922, 4361, 29886, 993, 29918, 7328, 29892, 13, 9651, 995, 29922, 29875, 29892, 13, 9651, 848, 29922, 29890, 29915, 742, 13, 4706, 1723, 13, 4706, 9704, 29889, 7302, 29918, 20736, 29898, 7508, 29889, 294, 29918, 7433, 29918, 20736, 29898, 29943, 3904, 2287, 29928, 29918, 2477, 1783, 876, 13, 4706, 9704, 29889, 24669, 29918, 1271, 580, 13, 1678, 736, 9704, 29889, 14153, 2585, 13, 13, 13, 1753, 2048, 29918, 12248, 29918, 305, 595, 292, 29918, 7241, 15546, 29898, 3539, 29918, 2585, 29892, 954, 29918, 1271, 29879, 29922, 29946, 29900, 1125, 13, 1678, 9704, 353, 2254, 29918, 1195, 292, 29918, 14153, 29898, 3539, 29918, 2585, 29897, 13, 1678, 8078, 29918, 10030, 353, 7246, 29918, 12925, 29918, 305, 595, 29918, 1285, 1461, 29898, 14153, 29897, 13, 1678, 4203, 29918, 1271, 29879, 353, 954, 29918, 1271, 29879, 849, 29871, 29906, 13, 1678, 302, 962, 561, 29918, 1285, 1461, 29879, 29892, 1661, 346, 353, 2767, 29918, 305, 595, 29898, 14153, 29892, 8078, 29918, 10030, 29892, 954, 29918, 1271, 29879, 29922, 24498, 29918, 1271, 29879, 29897, 13, 1678, 5217, 29918, 305, 595, 29898, 14153, 29892, 302, 962, 561, 29918, 1285, 1461, 29879, 29892, 8078, 29918, 10030, 29892, 1369, 29918, 5464, 346, 29922, 5464, 346, 29892, 954, 29918, 1271, 29879, 29922, 24498, 29918, 1271, 29879, 29897, 13, 1678, 736, 9704, 29892, 8078, 29918, 10030, 13, 2 ]
backend/db/entities/mixin/pengaturan.py
R-N/sistem_gaji_vue_thrift
0
39729
from sqlalchemy import Column, Integer, Numeric from sqlalchemy.ext.declarative import declared_attr from .pengaturan_base import MxPengaturanBase class MxPengaturan(MxPengaturanBase): # TODO: Set precision & scale for Numerics @declared_attr def bpjs_ketenagakerjaan_perusahaan(cls): return Column(Numeric, nullable=False) @declared_attr def bpjs_ketenagakerjaan_karyawan(cls): return Column(Numeric, nullable=False) @declared_attr def bpjs_kesehatan_perusahaan(cls): return Column(Numeric, nullable=False) @declared_attr def bpjs_kesehatan_karyawan(cls): return Column(Numeric, nullable=False) @declared_attr def upah_minimum(cls): return Column(Integer, nullable=False) @declared_attr def iuran_rumah(cls): return Column(Integer, nullable=False) @declared_attr def iuran_koperasi(cls): return Column(Integer, nullable=False) @declared_attr def pendaftaran_koperasi(cls): return Column(Integer, nullable=False) @declared_attr def uang_makan(cls): return Column(Integer, nullable=False) @declared_attr def uang_transport(cls): return Column(Integer, nullable=False) @declared_attr def koef_absen(cls): return Column(Numeric, nullable=False) ''' def mx_init( self, *args, bpjs_ketenagakerjaan_perusahaan, bpjs_ketenagakerjaan_karyawan, bpjs_kesehatan_perusahaan, bpjs_kesehatan_karyawan, upah_minimum, iuran_rumah, iuran_koperasi, pendaftaran_koperasi, uang_makan, uang_transport, koef_absen, **kwargs ): MxPengaturanBase.mx_init(*args, **kwargs) self.bpjs_ketenagakerjaan_perusahaan = bpjs_ketenagakerjaan_perusahaan self.bpjs_ketenagakerjaan_karyawan = bpjs_ketenagakerjaan_karyawan self.bpjs_kesehatan_perusahaan = bpjs_kesehatan_perusahaan self.bpjs_ketenagakerjaan_karyawan = bpjs_ketenagakerjaan_karyawan self.upah_minimum = upah_minimum self.iuran_rumah = iuran_rumah self.iuran_koperasi = iuran_koperasi self.pendaftaran_koperasi = pendaftaran_koperasi self.uang_makan = uang_makan self.uang_transport = uang_transport self.koef_absen = koef_absen ''' def mx_reconstruct(self): MxPengaturanBase.mx_reconstruct(self) def mx_repr(self): return '%s' % (MxPengaturanBase.mx_repr(self),) ''' def mx_repr(self): return "TODO" % ( self.id, self.nama, ) ''' def mx_init_repr(self): ret = MxPengaturanBase.mx_init_repr(self) ret.update({ 'bpjs_ketenagakerjaan_perusahaan': self.bpjs_ketenagakerjaan_perusahaan, 'bpjs_ketenagakerjaan_karyawan': self.bpjs_ketenagakerjaan_karyawan, 'bpjs_kesehatan_perusahaan': self.bpjs_kesehatan_perusahaan, 'bpjs_kesehatan_karyawan': self.bpjs_kesehatan_karyawan, 'upah_minimum': self.upah_minimum, 'iuran_rumah': self.iuran_rumah, 'iuran_koperasi': self.iuran_koperasi, 'pendaftaran_koperasi': self.pendaftaran_koperasi, 'uang_makan': self.uang_makan, 'uang_transport': self.uang_transport, 'koef_absen': self.koef_absen }) return ret
[ 1, 515, 4576, 284, 305, 6764, 1053, 12481, 29892, 8102, 29892, 405, 25099, 13, 3166, 4576, 284, 305, 6764, 29889, 1062, 29889, 311, 16544, 1230, 1053, 8052, 29918, 5552, 13, 3166, 869, 29886, 996, 1337, 273, 29918, 3188, 1053, 341, 29916, 29925, 996, 1337, 273, 5160, 13, 13, 13, 1990, 341, 29916, 29925, 996, 1337, 273, 29898, 29924, 29916, 29925, 996, 1337, 273, 5160, 1125, 13, 1678, 396, 14402, 29901, 3789, 16716, 669, 6287, 363, 405, 4680, 1199, 13, 1678, 732, 7099, 433, 1127, 29918, 5552, 13, 1678, 822, 289, 29886, 1315, 29918, 29895, 6302, 351, 5790, 1764, 273, 29918, 546, 375, 25613, 273, 29898, 25932, 1125, 13, 4706, 736, 12481, 29898, 29940, 25099, 29892, 1870, 519, 29922, 8824, 29897, 13, 13, 1678, 732, 7099, 433, 1127, 29918, 5552, 13, 1678, 822, 289, 29886, 1315, 29918, 29895, 6302, 351, 5790, 1764, 273, 29918, 29895, 653, 1450, 273, 29898, 25932, 1125, 13, 4706, 736, 12481, 29898, 29940, 25099, 29892, 1870, 519, 29922, 8824, 29897, 13, 13, 1678, 732, 7099, 433, 1127, 29918, 5552, 13, 1678, 822, 289, 29886, 1315, 29918, 29895, 968, 2455, 273, 29918, 546, 375, 25613, 273, 29898, 25932, 1125, 13, 4706, 736, 12481, 29898, 29940, 25099, 29892, 1870, 519, 29922, 8824, 29897, 13, 13, 1678, 732, 7099, 433, 1127, 29918, 5552, 13, 1678, 822, 289, 29886, 1315, 29918, 29895, 968, 2455, 273, 29918, 29895, 653, 1450, 273, 29898, 25932, 1125, 13, 4706, 736, 12481, 29898, 29940, 25099, 29892, 1870, 519, 29922, 8824, 29897, 13, 13, 1678, 732, 7099, 433, 1127, 29918, 5552, 13, 1678, 822, 701, 801, 29918, 1195, 12539, 29898, 25932, 1125, 13, 4706, 736, 12481, 29898, 7798, 29892, 1870, 519, 29922, 8824, 29897, 13, 13, 1678, 732, 7099, 433, 1127, 29918, 5552, 13, 1678, 822, 474, 332, 273, 29918, 5848, 801, 29898, 25932, 1125, 13, 4706, 736, 12481, 29898, 7798, 29892, 1870, 519, 29922, 8824, 29897, 13, 13, 1678, 732, 7099, 433, 1127, 29918, 5552, 13, 1678, 822, 474, 332, 273, 29918, 29895, 3372, 6840, 29898, 25932, 1125, 13, 4706, 736, 12481, 29898, 7798, 29892, 1870, 519, 29922, 8824, 29897, 13, 13, 1678, 732, 7099, 433, 1127, 29918, 5552, 13, 1678, 822, 282, 355, 2051, 23029, 29918, 29895, 3372, 6840, 29898, 25932, 1125, 13, 4706, 736, 12481, 29898, 7798, 29892, 1870, 519, 29922, 8824, 29897, 13, 13, 1678, 732, 7099, 433, 1127, 29918, 5552, 13, 1678, 822, 318, 574, 29918, 29885, 557, 273, 29898, 25932, 1125, 13, 4706, 736, 12481, 29898, 7798, 29892, 1870, 519, 29922, 8824, 29897, 13, 13, 1678, 732, 7099, 433, 1127, 29918, 5552, 13, 1678, 822, 318, 574, 29918, 27882, 29898, 25932, 1125, 13, 4706, 736, 12481, 29898, 7798, 29892, 1870, 519, 29922, 8824, 29897, 13, 13, 1678, 732, 7099, 433, 1127, 29918, 5552, 13, 1678, 822, 5812, 1389, 29918, 370, 4881, 29898, 25932, 1125, 13, 4706, 736, 12481, 29898, 29940, 25099, 29892, 1870, 519, 29922, 8824, 29897, 13, 13, 1678, 14550, 13, 1678, 822, 286, 29916, 29918, 2344, 29898, 13, 4706, 1583, 29892, 13, 4706, 334, 5085, 29892, 13, 4706, 289, 29886, 1315, 29918, 29895, 6302, 351, 5790, 1764, 273, 29918, 546, 375, 25613, 273, 29892, 13, 4706, 289, 29886, 1315, 29918, 29895, 6302, 351, 5790, 1764, 273, 29918, 29895, 653, 1450, 273, 29892, 13, 4706, 289, 29886, 1315, 29918, 29895, 968, 2455, 273, 29918, 546, 375, 25613, 273, 29892, 13, 4706, 289, 29886, 1315, 29918, 29895, 968, 2455, 273, 29918, 29895, 653, 1450, 273, 29892, 13, 4706, 701, 801, 29918, 1195, 12539, 29892, 13, 4706, 474, 332, 273, 29918, 5848, 801, 29892, 13, 4706, 474, 332, 273, 29918, 29895, 3372, 6840, 29892, 13, 4706, 282, 355, 2051, 23029, 29918, 29895, 3372, 6840, 29892, 13, 4706, 318, 574, 29918, 29885, 557, 273, 29892, 13, 4706, 318, 574, 29918, 27882, 29892, 13, 4706, 5812, 1389, 29918, 370, 4881, 29892, 13, 4706, 3579, 19290, 13, 268, 1125, 13, 4706, 341, 29916, 29925, 996, 1337, 273, 5160, 29889, 16838, 29918, 2344, 10456, 5085, 29892, 3579, 19290, 29897, 13, 4706, 1583, 29889, 25288, 1315, 29918, 29895, 6302, 351, 5790, 1764, 273, 29918, 546, 375, 25613, 273, 353, 289, 29886, 1315, 29918, 29895, 6302, 351, 5790, 1764, 273, 29918, 546, 375, 25613, 273, 13, 4706, 1583, 29889, 25288, 1315, 29918, 29895, 6302, 351, 5790, 1764, 273, 29918, 29895, 653, 1450, 273, 353, 289, 29886, 1315, 29918, 29895, 6302, 351, 5790, 1764, 273, 29918, 29895, 653, 1450, 273, 13, 4706, 1583, 29889, 25288, 1315, 29918, 29895, 968, 2455, 273, 29918, 546, 375, 25613, 273, 353, 289, 29886, 1315, 29918, 29895, 968, 2455, 273, 29918, 546, 375, 25613, 273, 13, 4706, 1583, 29889, 25288, 1315, 29918, 29895, 6302, 351, 5790, 1764, 273, 29918, 29895, 653, 1450, 273, 353, 289, 29886, 1315, 29918, 29895, 6302, 351, 5790, 1764, 273, 29918, 29895, 653, 1450, 273, 13, 4706, 1583, 29889, 786, 801, 29918, 1195, 12539, 353, 701, 801, 29918, 1195, 12539, 13, 4706, 1583, 29889, 29875, 332, 273, 29918, 5848, 801, 353, 474, 332, 273, 29918, 5848, 801, 13, 4706, 1583, 29889, 29875, 332, 273, 29918, 29895, 3372, 6840, 353, 474, 332, 273, 29918, 29895, 3372, 6840, 13, 4706, 1583, 29889, 14081, 2051, 23029, 29918, 29895, 3372, 6840, 353, 282, 355, 2051, 23029, 29918, 29895, 3372, 6840, 13, 4706, 1583, 29889, 29884, 574, 29918, 29885, 557, 273, 353, 318, 574, 29918, 29885, 557, 273, 13, 4706, 1583, 29889, 29884, 574, 29918, 27882, 353, 318, 574, 29918, 27882, 13, 4706, 1583, 29889, 2901, 1389, 29918, 370, 4881, 353, 5812, 1389, 29918, 370, 4881, 13, 1678, 14550, 13, 13, 1678, 822, 286, 29916, 29918, 276, 11433, 29898, 1311, 1125, 13, 4706, 341, 29916, 29925, 996, 1337, 273, 5160, 29889, 16838, 29918, 276, 11433, 29898, 1311, 29897, 13, 13, 1678, 822, 286, 29916, 29918, 276, 558, 29898, 1311, 1125, 13, 4706, 736, 14210, 29879, 29915, 1273, 313, 29924, 29916, 29925, 996, 1337, 273, 5160, 29889, 16838, 29918, 276, 558, 29898, 1311, 511, 29897, 13, 13, 1678, 14550, 13, 1678, 822, 286, 29916, 29918, 276, 558, 29898, 1311, 1125, 13, 4706, 736, 376, 4986, 3970, 29908, 1273, 313, 13, 9651, 1583, 29889, 333, 29892, 1583, 29889, 29876, 3304, 29892, 13, 4706, 1723, 13, 1678, 14550, 13, 13, 1678, 822, 286, 29916, 29918, 2344, 29918, 276, 558, 29898, 1311, 1125, 13, 4706, 3240, 353, 341, 29916, 29925, 996, 1337, 273, 5160, 29889, 16838, 29918, 2344, 29918, 276, 558, 29898, 1311, 29897, 13, 4706, 3240, 29889, 5504, 3319, 13, 9651, 525, 25288, 1315, 29918, 29895, 6302, 351, 5790, 1764, 273, 29918, 546, 375, 25613, 273, 2396, 1583, 29889, 25288, 1315, 29918, 29895, 6302, 351, 5790, 1764, 273, 29918, 546, 375, 25613, 273, 29892, 13, 9651, 525, 25288, 1315, 29918, 29895, 6302, 351, 5790, 1764, 273, 29918, 29895, 653, 1450, 273, 2396, 1583, 29889, 25288, 1315, 29918, 29895, 6302, 351, 5790, 1764, 273, 29918, 29895, 653, 1450, 273, 29892, 13, 9651, 525, 25288, 1315, 29918, 29895, 968, 2455, 273, 29918, 546, 375, 25613, 273, 2396, 1583, 29889, 25288, 1315, 29918, 29895, 968, 2455, 273, 29918, 546, 375, 25613, 273, 29892, 13, 9651, 525, 25288, 1315, 29918, 29895, 968, 2455, 273, 29918, 29895, 653, 1450, 273, 2396, 1583, 29889, 25288, 1315, 29918, 29895, 968, 2455, 273, 29918, 29895, 653, 1450, 273, 29892, 13, 9651, 525, 786, 801, 29918, 1195, 12539, 2396, 1583, 29889, 786, 801, 29918, 1195, 12539, 29892, 13, 9651, 525, 29875, 332, 273, 29918, 5848, 801, 2396, 1583, 29889, 29875, 332, 273, 29918, 5848, 801, 29892, 13, 9651, 525, 29875, 332, 273, 29918, 29895, 3372, 6840, 2396, 1583, 29889, 29875, 332, 273, 29918, 29895, 3372, 6840, 29892, 13, 9651, 525, 14081, 2051, 23029, 29918, 29895, 3372, 6840, 2396, 1583, 29889, 14081, 2051, 23029, 29918, 29895, 3372, 6840, 29892, 13, 9651, 525, 29884, 574, 29918, 29885, 557, 273, 2396, 1583, 29889, 29884, 574, 29918, 29885, 557, 273, 29892, 13, 9651, 525, 29884, 574, 29918, 27882, 2396, 1583, 29889, 29884, 574, 29918, 27882, 29892, 13, 9651, 525, 2901, 1389, 29918, 370, 4881, 2396, 1583, 29889, 2901, 1389, 29918, 370, 4881, 13, 4706, 5615, 13, 4706, 736, 3240, 13, 2 ]
algorithm/codility.com/20160330/longest_0_binary_gap.py
leonard-sxy/algorithm-practice
1
40346
def solution(N): str = '{0:b}'.format(N) counter = prev_counter = 0 for c in str: if c is '0': counter += 1 else: if prev_counter == 0 or counter > prev_counter: prev_counter = counter counter = 0 return prev_counter if prev_counter > counter else counter
[ 1, 822, 1650, 29898, 29940, 1125, 13, 29871, 851, 353, 22372, 29900, 29901, 29890, 29913, 4286, 4830, 29898, 29940, 29897, 13, 259, 13, 29871, 6795, 353, 12379, 29918, 11808, 353, 29871, 29900, 13, 29871, 363, 274, 297, 851, 29901, 13, 1678, 565, 274, 338, 525, 29900, 2396, 13, 418, 6795, 4619, 29871, 29896, 13, 1678, 1683, 29901, 13, 418, 565, 12379, 29918, 11808, 1275, 29871, 29900, 470, 6795, 1405, 12379, 29918, 11808, 29901, 13, 4706, 12379, 29918, 11808, 353, 6795, 13, 418, 6795, 353, 29871, 29900, 13, 13, 29871, 736, 12379, 29918, 11808, 565, 12379, 29918, 11808, 1405, 6795, 1683, 6795, 13, 13, 13, 2 ]
tools/migrate_chart/migrate_chart.py
kschu91/harbor
12,706
63034
#!/usr/local/bin/python3 import subprocess import signal import sys from pathlib import Path import click import requests MIGRATE_CHART_SCRIPT = '/migrate_chart.sh' HELM_CMD = '/linux-amd64/helm' CA_UPDATE_CMD = 'update-ca-certificates' CHART_URL_PATTERN = "https://{host}/api/v2.0/projects/{project}/repositories/{name}/artifacts/{version}" CHART_SOURCE_DIR = Path('/chart_storage') errs = [] def print_exist_errs(): if errs: click.echo("Following errors exist", err=True) for e in errs: click.echo(e, err=True) def graceful_exit(signum, frame): print_exist_errs() sys.exit() signal.signal(signal.SIGINT, graceful_exit) signal.signal(signal.SIGTERM, graceful_exit) class ChartV2: def __init__(self, filepath:Path): self.filepath = filepath self.project = self.filepath.parts[-2] parts = self.filepath.stem.split('-') flag = False for i in range(len(parts)-1, -1, -1): if parts[i][0].isnumeric(): self.name, self.version = '-'.join(parts[:i]), '-'.join(parts[i:]) flag = True break if not flag: raise Exception('chart name: {} is illegal'.format('-'.join(parts))) def __check_exist(self, hostname, username, password): return requests.get(CHART_URL_PATTERN.format( host=hostname, project=self.project, name=self.name, version=self.version), auth=requests.auth.HTTPBasicAuth(username, password)) def migrate(self, hostname, username, password): res = self.__check_exist(hostname, username, password) if res.status_code == 200: raise Exception("Artifact already exist in harbor") if res.status_code == 401: raise Exception(res.reason) oci_ref = "{host}/{project}/{name}:{version}".format( host=hostname, project=self.project, name=self.name, version=self.version) return subprocess.run([MIGRATE_CHART_SCRIPT, HELM_CMD, self.filepath, oci_ref], text=True, stdout=subprocess.DEVNULL, stderr=subprocess.PIPE) @click.command() @click.option('--hostname', default='127.0.0.1', help='the password to login harbor') @click.option('--username', default='admin', help='The username to login harbor') @click.option('--password', default='<PASSWORD>', help='the password to login harbor') def migrate(hostname, username, password): """ Migrate chart v2 to harbor oci registry """ if username != 'admin': raise Exception('This operation only allowed for admin') subprocess.run([CA_UPDATE_CMD]) subprocess.run([HELM_CMD, 'registry', 'login', hostname, '--username', username, '--password', password]) charts = [ChartV2(c) for p in CHART_SOURCE_DIR.iterdir() if p.is_dir() for c in p.iterdir() if c.is_file() and c.name != "index-cache.yaml"] with click.progressbar(charts, label="Migrating chart ...", length=len(charts), item_show_func=lambda x: "{}/{}:{} total errors: {}".format(x.project, x.name, x.version, len(errs)) if x else '') as bar: for chart in bar: try: result = chart.migrate(hostname, username, password) if result.stderr: errs.append("chart: {name}:{version} in {project} has err: {err}".format( name=chart.name, version=chart.version, project=chart.project, err=result.stderr )) except Exception as e: errs.append("chart: {name}:{version} in {project} has err: {err}".format( name=chart.name, version=chart.version, project=chart.project, err=e)) click.echo("Migration is Done.") print_exist_errs() if __name__ == '__main__': migrate()
[ 1, 18787, 4855, 29914, 2997, 29914, 2109, 29914, 4691, 29941, 13, 13, 5215, 1014, 5014, 13, 5215, 7182, 13, 5215, 10876, 13, 3166, 2224, 1982, 1053, 10802, 13, 13, 5215, 2828, 13, 5215, 7274, 13, 13, 29924, 6259, 29934, 3040, 29918, 3210, 8322, 29918, 7187, 24290, 353, 8207, 26983, 403, 29918, 15425, 29889, 845, 29915, 13, 29950, 6670, 29924, 29918, 29907, 5773, 353, 8207, 9389, 29899, 22490, 29953, 29946, 29914, 9421, 29915, 13, 5454, 29918, 14474, 29918, 29907, 5773, 353, 525, 5504, 29899, 1113, 29899, 6327, 928, 1078, 29915, 13, 3210, 8322, 29918, 4219, 29918, 29925, 1299, 4945, 29940, 353, 376, 991, 597, 29912, 3069, 6822, 2754, 29914, 29894, 29906, 29889, 29900, 29914, 16418, 19248, 4836, 6822, 276, 1066, 20106, 19248, 978, 6822, 8813, 29879, 19248, 3259, 5038, 13, 3210, 8322, 29918, 27839, 4741, 29918, 9464, 353, 10802, 11219, 15425, 29918, 12925, 1495, 13, 13, 261, 2288, 353, 5159, 13, 13, 1753, 1596, 29918, 28997, 29918, 261, 2288, 7295, 13, 1678, 565, 604, 2288, 29901, 13, 4706, 2828, 29889, 8057, 703, 29943, 2952, 292, 4436, 1863, 613, 4589, 29922, 5574, 29897, 13, 4706, 363, 321, 297, 604, 2288, 29901, 13, 9651, 2828, 29889, 8057, 29898, 29872, 29892, 4589, 29922, 5574, 29897, 13, 13, 1753, 17659, 1319, 29918, 13322, 29898, 4530, 398, 29892, 3515, 1125, 13, 1678, 1596, 29918, 28997, 29918, 261, 2288, 580, 13, 1678, 10876, 29889, 13322, 580, 13, 13, 25436, 29889, 25436, 29898, 25436, 29889, 5425, 29954, 10192, 29892, 17659, 1319, 29918, 13322, 29897, 13, 25436, 29889, 25436, 29898, 25436, 29889, 5425, 29954, 4945, 29924, 29892, 17659, 1319, 29918, 13322, 29897, 13, 13, 1990, 14477, 29963, 29906, 29901, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 934, 2084, 29901, 2605, 1125, 13, 4706, 1583, 29889, 1445, 2084, 353, 934, 2084, 13, 4706, 1583, 29889, 4836, 353, 1583, 29889, 1445, 2084, 29889, 20895, 14352, 29906, 29962, 13, 4706, 5633, 353, 1583, 29889, 1445, 2084, 29889, 303, 331, 29889, 5451, 877, 29899, 1495, 13, 4706, 7353, 353, 7700, 13, 4706, 363, 474, 297, 3464, 29898, 2435, 29898, 20895, 6817, 29896, 29892, 448, 29896, 29892, 448, 29896, 1125, 13, 9651, 565, 5633, 29961, 29875, 3816, 29900, 1822, 275, 21574, 7295, 13, 18884, 1583, 29889, 978, 29892, 1583, 29889, 3259, 353, 17411, 4286, 7122, 29898, 20895, 7503, 29875, 11724, 17411, 4286, 7122, 29898, 20895, 29961, 29875, 29901, 2314, 13, 18884, 7353, 353, 5852, 13, 18884, 2867, 13, 4706, 565, 451, 7353, 29901, 13, 9651, 12020, 8960, 877, 15425, 1024, 29901, 6571, 338, 27302, 4286, 4830, 877, 29899, 4286, 7122, 29898, 20895, 4961, 13, 13, 1678, 822, 4770, 3198, 29918, 28997, 29898, 1311, 29892, 3495, 978, 29892, 8952, 29892, 4800, 1125, 13, 4706, 736, 7274, 29889, 657, 29898, 3210, 8322, 29918, 4219, 29918, 29925, 1299, 4945, 29940, 29889, 4830, 29898, 13, 18884, 3495, 29922, 28988, 29892, 13, 18884, 2060, 29922, 1311, 29889, 4836, 29892, 13, 18884, 1024, 29922, 1311, 29889, 978, 29892, 13, 18884, 1873, 29922, 1311, 29889, 3259, 511, 13, 18884, 4817, 29922, 24830, 29889, 5150, 29889, 10493, 16616, 6444, 29898, 6786, 29892, 4800, 876, 13, 13, 1678, 822, 9725, 403, 29898, 1311, 29892, 3495, 978, 29892, 8952, 29892, 4800, 1125, 13, 4706, 620, 353, 1583, 17255, 3198, 29918, 28997, 29898, 28988, 29892, 8952, 29892, 4800, 29897, 13, 4706, 565, 620, 29889, 4882, 29918, 401, 1275, 29871, 29906, 29900, 29900, 29901, 13, 9651, 12020, 8960, 703, 9986, 7060, 2307, 1863, 297, 4023, 4089, 1159, 13, 4706, 565, 620, 29889, 4882, 29918, 401, 1275, 29871, 29946, 29900, 29896, 29901, 13, 9651, 12020, 8960, 29898, 690, 29889, 23147, 29897, 13, 13, 4706, 288, 455, 29918, 999, 353, 29850, 3069, 6822, 29912, 4836, 6822, 29912, 978, 6177, 29912, 3259, 29913, 1642, 4830, 29898, 13, 9651, 3495, 29922, 28988, 29892, 13, 9651, 2060, 29922, 1311, 29889, 4836, 29892, 13, 9651, 1024, 29922, 1311, 29889, 978, 29892, 13, 9651, 1873, 29922, 1311, 29889, 3259, 29897, 13, 13, 4706, 736, 1014, 5014, 29889, 3389, 4197, 29924, 6259, 29934, 3040, 29918, 3210, 8322, 29918, 7187, 24290, 29892, 379, 6670, 29924, 29918, 29907, 5773, 29892, 1583, 29889, 1445, 2084, 29892, 288, 455, 29918, 999, 1402, 13, 4706, 1426, 29922, 5574, 29892, 27591, 29922, 1491, 5014, 29889, 2287, 29963, 10074, 29892, 380, 20405, 29922, 1491, 5014, 29889, 2227, 4162, 29897, 13, 13, 13, 29992, 3808, 29889, 6519, 580, 13, 29992, 3808, 29889, 3385, 877, 489, 28988, 742, 2322, 2433, 29896, 29906, 29955, 29889, 29900, 29889, 29900, 29889, 29896, 742, 1371, 2433, 1552, 4800, 304, 6464, 4023, 4089, 1495, 13, 29992, 3808, 29889, 3385, 877, 489, 6786, 742, 2322, 2433, 6406, 742, 1371, 2433, 1576, 8952, 304, 6464, 4023, 4089, 1495, 13, 29992, 3808, 29889, 3385, 877, 489, 5630, 742, 2322, 2433, 29966, 25711, 17013, 29958, 742, 1371, 2433, 1552, 4800, 304, 6464, 4023, 4089, 1495, 13, 1753, 9725, 403, 29898, 28988, 29892, 8952, 29892, 4800, 1125, 13, 1678, 9995, 13, 1678, 341, 4481, 403, 8727, 325, 29906, 304, 4023, 4089, 288, 455, 21235, 13, 1678, 9995, 13, 1678, 565, 8952, 2804, 525, 6406, 2396, 13, 4706, 12020, 8960, 877, 4013, 5858, 871, 6068, 363, 4113, 1495, 13, 1678, 1014, 5014, 29889, 3389, 4197, 5454, 29918, 14474, 29918, 29907, 5773, 2314, 13, 1678, 1014, 5014, 29889, 3389, 4197, 29950, 6670, 29924, 29918, 29907, 5773, 29892, 525, 1727, 6020, 742, 525, 7507, 742, 3495, 978, 29892, 525, 489, 6786, 742, 8952, 29892, 525, 489, 5630, 742, 4800, 2314, 13, 1678, 24469, 353, 518, 14732, 29963, 29906, 29898, 29883, 29897, 363, 282, 297, 5868, 8322, 29918, 27839, 4741, 29918, 9464, 29889, 1524, 3972, 580, 565, 282, 29889, 275, 29918, 3972, 580, 363, 274, 297, 282, 29889, 1524, 3972, 580, 565, 274, 29889, 275, 29918, 1445, 580, 322, 274, 29889, 978, 2804, 376, 2248, 29899, 8173, 29889, 25162, 3108, 13, 1678, 411, 2828, 29889, 18035, 1646, 29898, 18366, 29892, 3858, 543, 29924, 4481, 1218, 8727, 2023, 613, 3309, 29922, 2435, 29898, 18366, 511, 13, 1678, 2944, 29918, 4294, 29918, 9891, 29922, 2892, 921, 29901, 29850, 6822, 29912, 6177, 8875, 3001, 4436, 29901, 6571, 1642, 4830, 29898, 29916, 29889, 4836, 29892, 921, 29889, 978, 29892, 921, 29889, 3259, 29892, 7431, 29898, 261, 2288, 876, 565, 921, 1683, 27255, 408, 2594, 29901, 13, 4706, 363, 8727, 297, 2594, 29901, 13, 9651, 1018, 29901, 13, 18884, 1121, 353, 8727, 29889, 26983, 403, 29898, 28988, 29892, 8952, 29892, 4800, 29897, 13, 18884, 565, 1121, 29889, 303, 20405, 29901, 13, 462, 1678, 604, 2288, 29889, 4397, 703, 15425, 29901, 426, 978, 6177, 29912, 3259, 29913, 297, 426, 4836, 29913, 756, 4589, 29901, 426, 3127, 29913, 1642, 4830, 29898, 13, 462, 4706, 1024, 29922, 15425, 29889, 978, 29892, 13, 462, 4706, 1873, 29922, 15425, 29889, 3259, 29892, 13, 462, 4706, 2060, 29922, 15425, 29889, 4836, 29892, 13, 462, 4706, 4589, 29922, 2914, 29889, 303, 20405, 13, 462, 268, 876, 13, 9651, 5174, 8960, 408, 321, 29901, 13, 18884, 604, 2288, 29889, 4397, 703, 15425, 29901, 426, 978, 6177, 29912, 3259, 29913, 297, 426, 4836, 29913, 756, 4589, 29901, 426, 3127, 29913, 1642, 4830, 29898, 13, 462, 1678, 1024, 29922, 15425, 29889, 978, 29892, 13, 462, 1678, 1873, 29922, 15425, 29889, 3259, 29892, 13, 462, 1678, 2060, 29922, 15425, 29889, 4836, 29892, 13, 462, 1678, 4589, 29922, 29872, 876, 13, 1678, 2828, 29889, 8057, 703, 29924, 16783, 338, 25679, 23157, 13, 1678, 1596, 29918, 28997, 29918, 261, 2288, 580, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 9725, 403, 580, 13, 2 ]
src/survivor_scraping/reddit/reddit_transform.py
SeanAmmirati/survivor_processing
0
160683
<gh_stars>0 from ..helpers.db_funcs import create_season_times, create_episode_times from ..helpers.transform_helpers import add_to_df, coerce_col, sync_with_remote import pandas as pd from collections import OrderedDict def process_utc(df, *args, **kwargs): return pd.DataFrame(pd.to_datetime(df['created_utc'], unit='s')) def process_nearest_event(df, event_times, match_time_col, event_time_col, subset_cols=None, direction='forward'): event_times = event_times[event_times[event_time_col].notnull()] sorted_times = event_times.sort_values(by=event_time_col) merged_asof = pd.merge_asof(df[df[match_time_col].notnull()], sorted_times, left_on=[match_time_col], right_on=[event_time_col]) if not subset_cols: subset_cols = merged_asof.columns return merged_asof[subset_cols] def process_within_season(df, season_times, *args, **kwargs): merged = df.merge(season_times, left_on='most_recent_season', right_on='season_id') within = merged['most_recent_season'] within.loc[merged['created_dt'] > merged['showing_ended']] = None return pd.DataFrame(within) def process_nearest_season_started(df, season_times, *args, **kwargs): return process_nearest_event(df, season_times, 'created_dt', 'showing_started', ['season_id']) def process_nearest_episode_aired(df, episode_times, *args, **kwargs): return process_nearest_event(df, episode_times, 'created_dt', 'firstbroadcast', ['episode_id']) # def stringize_dict_and_list_cols(df): def transform_reddit(reddit_dfs, eng): season_times = create_season_times(eng) episode_times = create_episode_times(eng) ret_list = [] table_names = ['submissions', 'comments'] table_names = ['reddit_' + t for t in table_names] for i, df in enumerate(reddit_dfs): if df.empty or ('created_utc' not in df): ret_list.append(df) continue df[['created_dt']] = process_utc(df) processing_columns = OrderedDict() processing_columns[('created_dt',)] = process_utc processing_columns[('most_recent_season', ) ] = process_nearest_season_started processing_columns[('most_recent_episode',) ] = process_nearest_episode_aired processing_columns[('within_season', )] = process_within_season added = add_to_df(df, processing_columns, inplace=False, season_times=season_times, episode_times=episode_times) dict_cols = added.columns[added.applymap( lambda x: isinstance(x, dict) or isinstance(x, list)).any()] for col in dict_cols: added.loc[df[col].notnull(), col] = \ added.loc[df[col].notnull(), col].astype(str) added = sync_with_remote(added, eng, table_names[i]) ret_list.append(added) # TODO: IT would be cool to transform the flairs, or mentions, to the contestant IDs return ret_list
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 3166, 6317, 3952, 6774, 29889, 2585, 29918, 7692, 2395, 1053, 1653, 29918, 25682, 29918, 3706, 29892, 1653, 29918, 1022, 275, 356, 29918, 3706, 13, 3166, 6317, 3952, 6774, 29889, 9067, 29918, 3952, 6774, 1053, 788, 29918, 517, 29918, 2176, 29892, 1302, 261, 346, 29918, 1054, 29892, 16523, 29918, 2541, 29918, 16674, 13, 13, 5215, 11701, 408, 10518, 13, 3166, 16250, 1053, 8170, 287, 21533, 13, 13, 13, 1753, 1889, 29918, 329, 29883, 29898, 2176, 29892, 334, 5085, 29892, 3579, 19290, 1125, 13, 1678, 736, 10518, 29889, 17271, 29898, 15926, 29889, 517, 29918, 12673, 29898, 2176, 1839, 11600, 29918, 329, 29883, 7464, 5190, 2433, 29879, 8785, 13, 13, 13, 1753, 1889, 29918, 28502, 342, 29918, 3696, 29898, 2176, 29892, 1741, 29918, 3706, 29892, 1993, 29918, 2230, 29918, 1054, 29892, 13, 462, 3986, 1741, 29918, 2230, 29918, 1054, 29892, 11306, 29918, 22724, 29922, 8516, 29892, 13, 462, 3986, 5305, 2433, 11333, 29374, 13, 1678, 1741, 29918, 3706, 353, 1741, 29918, 3706, 29961, 3696, 29918, 3706, 29961, 3696, 29918, 2230, 29918, 1054, 1822, 1333, 4304, 580, 29962, 13, 1678, 12705, 29918, 3706, 353, 1741, 29918, 3706, 29889, 6605, 29918, 5975, 29898, 1609, 29922, 3696, 29918, 2230, 29918, 1054, 29897, 13, 1678, 19412, 29918, 294, 974, 353, 10518, 29889, 14634, 29918, 294, 974, 29898, 2176, 29961, 2176, 29961, 4352, 29918, 2230, 29918, 1054, 1822, 1333, 4304, 580, 1402, 13, 462, 18884, 12705, 29918, 3706, 29892, 13, 462, 18884, 2175, 29918, 265, 11759, 4352, 29918, 2230, 29918, 1054, 1402, 13, 462, 18884, 1492, 29918, 265, 11759, 3696, 29918, 2230, 29918, 1054, 2314, 13, 13, 1678, 565, 451, 11306, 29918, 22724, 29901, 13, 4706, 11306, 29918, 22724, 353, 19412, 29918, 294, 974, 29889, 13099, 13, 13, 1678, 736, 19412, 29918, 294, 974, 29961, 6484, 29918, 22724, 29962, 13, 13, 13, 1753, 1889, 29918, 2541, 262, 29918, 25682, 29898, 2176, 29892, 4259, 29918, 3706, 29892, 334, 5085, 29892, 3579, 19290, 1125, 13, 1678, 19412, 353, 4489, 29889, 14634, 29898, 25682, 29918, 3706, 29892, 2175, 29918, 265, 2433, 3242, 29918, 276, 1760, 29918, 25682, 742, 13, 462, 418, 1492, 29918, 265, 2433, 25682, 29918, 333, 1495, 13, 13, 1678, 2629, 353, 19412, 1839, 3242, 29918, 276, 1760, 29918, 25682, 2033, 13, 1678, 2629, 29889, 2029, 29961, 1050, 3192, 1839, 11600, 29918, 6008, 2033, 1405, 19412, 1839, 4294, 292, 29918, 2760, 2033, 29962, 353, 6213, 13, 1678, 736, 10518, 29889, 17271, 29898, 2541, 262, 29897, 13, 13, 13, 1753, 1889, 29918, 28502, 342, 29918, 25682, 29918, 2962, 287, 29898, 2176, 29892, 4259, 29918, 3706, 29892, 334, 5085, 29892, 3579, 19290, 1125, 13, 1678, 736, 1889, 29918, 28502, 342, 29918, 3696, 29898, 2176, 29892, 4259, 29918, 3706, 29892, 525, 11600, 29918, 6008, 742, 13, 462, 462, 525, 4294, 292, 29918, 2962, 287, 742, 6024, 25682, 29918, 333, 11287, 13, 13, 13, 1753, 1889, 29918, 28502, 342, 29918, 1022, 275, 356, 29918, 29874, 2859, 29898, 2176, 29892, 12720, 29918, 3706, 29892, 334, 5085, 29892, 3579, 19290, 1125, 13, 1678, 736, 1889, 29918, 28502, 342, 29918, 3696, 29898, 2176, 29892, 12720, 29918, 3706, 29892, 525, 11600, 29918, 6008, 742, 13, 462, 462, 525, 4102, 6729, 328, 4384, 742, 6024, 1022, 275, 356, 29918, 333, 11287, 13, 13, 29937, 822, 1347, 675, 29918, 8977, 29918, 392, 29918, 1761, 29918, 22724, 29898, 2176, 1125, 13, 13, 13, 1753, 4327, 29918, 1127, 27423, 29898, 1127, 27423, 29918, 29069, 29892, 3033, 1125, 13, 1678, 4259, 29918, 3706, 353, 1653, 29918, 25682, 29918, 3706, 29898, 996, 29897, 13, 1678, 12720, 29918, 3706, 353, 1653, 29918, 1022, 275, 356, 29918, 3706, 29898, 996, 29897, 13, 1678, 3240, 29918, 1761, 353, 5159, 13, 13, 1678, 1591, 29918, 7039, 353, 6024, 1491, 29885, 6847, 742, 525, 21032, 2033, 13, 1678, 1591, 29918, 7039, 353, 6024, 1127, 27423, 29918, 29915, 718, 260, 363, 260, 297, 1591, 29918, 7039, 29962, 13, 13, 1678, 363, 474, 29892, 4489, 297, 26985, 29898, 1127, 27423, 29918, 29069, 1125, 13, 4706, 565, 4489, 29889, 6310, 470, 6702, 11600, 29918, 329, 29883, 29915, 451, 297, 4489, 1125, 13, 9651, 3240, 29918, 1761, 29889, 4397, 29898, 2176, 29897, 13, 9651, 6773, 13, 4706, 4489, 29961, 1839, 11600, 29918, 6008, 2033, 29962, 353, 1889, 29918, 329, 29883, 29898, 2176, 29897, 13, 13, 4706, 9068, 29918, 13099, 353, 8170, 287, 21533, 580, 13, 13, 4706, 9068, 29918, 13099, 29961, 877, 11600, 29918, 6008, 742, 4638, 353, 1889, 29918, 329, 29883, 13, 4706, 9068, 29918, 13099, 29961, 877, 3242, 29918, 276, 1760, 29918, 25682, 742, 1723, 13, 462, 965, 4514, 353, 1889, 29918, 28502, 342, 29918, 25682, 29918, 2962, 287, 13, 4706, 9068, 29918, 13099, 29961, 877, 3242, 29918, 276, 1760, 29918, 1022, 275, 356, 742, 29897, 13, 462, 965, 4514, 353, 1889, 29918, 28502, 342, 29918, 1022, 275, 356, 29918, 29874, 2859, 13, 4706, 9068, 29918, 13099, 29961, 877, 2541, 262, 29918, 25682, 742, 1723, 29962, 353, 1889, 29918, 2541, 262, 29918, 25682, 13, 13, 4706, 2715, 353, 788, 29918, 517, 29918, 2176, 29898, 2176, 29892, 9068, 29918, 13099, 29892, 13, 462, 3986, 297, 6689, 29922, 8824, 29892, 4259, 29918, 3706, 29922, 25682, 29918, 3706, 29892, 13, 462, 3986, 12720, 29918, 3706, 29922, 1022, 275, 356, 29918, 3706, 29897, 13, 13, 4706, 9657, 29918, 22724, 353, 2715, 29889, 13099, 29961, 23959, 29889, 7302, 1958, 29898, 13, 9651, 14013, 921, 29901, 338, 8758, 29898, 29916, 29892, 9657, 29897, 470, 338, 8758, 29898, 29916, 29892, 1051, 8106, 1384, 580, 29962, 13, 13, 4706, 363, 784, 297, 9657, 29918, 22724, 29901, 13, 9651, 2715, 29889, 2029, 29961, 2176, 29961, 1054, 1822, 1333, 4304, 3285, 784, 29962, 353, 320, 13, 18884, 2715, 29889, 2029, 29961, 2176, 29961, 1054, 1822, 1333, 4304, 3285, 784, 1822, 579, 668, 29898, 710, 29897, 13, 13, 4706, 2715, 353, 16523, 29918, 2541, 29918, 16674, 29898, 23959, 29892, 3033, 29892, 1591, 29918, 7039, 29961, 29875, 2314, 13, 13, 4706, 3240, 29918, 1761, 29889, 4397, 29898, 23959, 29897, 13, 13, 1678, 396, 14402, 29901, 13315, 723, 367, 12528, 304, 4327, 278, 17422, 12935, 29892, 470, 26649, 29892, 304, 278, 17793, 424, 23481, 13, 13, 1678, 736, 3240, 29918, 1761, 13, 2 ]
memorytestgame/example.config.py
bradcornford/Memory-Test-Game
0
102151
game = { 'leds': ( # GPIO05 - Pin 29 5, # GPIO12 - Pin 32 12, # GPIO17 - Pin 11 17, # GPIO22 - Pin 15 22, # GPIO25 - Pin 22 25 ), 'switches': ( # GPIO06 - Pin 31 6, # GPIO13 - Pin 33 13, # GPIO19 - Pin 35 19, # GPIO23 - Pin 16 23, # GPIO24 - Pin 18 24 ), 'countdown': 5, 'game_time': 60, 'score_increment': 1 }
[ 1, 3748, 353, 426, 13, 1678, 525, 839, 29879, 2396, 313, 13, 4706, 396, 402, 2227, 29949, 29900, 29945, 448, 17434, 29871, 29906, 29929, 13, 308, 29945, 29892, 13, 4706, 396, 402, 2227, 29949, 29896, 29906, 448, 17434, 29871, 29941, 29906, 13, 308, 29896, 29906, 29892, 13, 4706, 396, 402, 2227, 29949, 29896, 29955, 448, 17434, 29871, 29896, 29896, 13, 308, 29896, 29955, 29892, 13, 4706, 396, 402, 2227, 29949, 29906, 29906, 448, 17434, 29871, 29896, 29945, 13, 308, 29906, 29906, 29892, 13, 4706, 396, 402, 2227, 29949, 29906, 29945, 448, 17434, 29871, 29906, 29906, 13, 308, 29906, 29945, 13, 1678, 10353, 13, 1678, 525, 15123, 267, 2396, 313, 13, 4706, 396, 402, 2227, 29949, 29900, 29953, 448, 17434, 29871, 29941, 29896, 13, 308, 29953, 29892, 13, 4706, 396, 402, 2227, 29949, 29896, 29941, 448, 17434, 29871, 29941, 29941, 13, 308, 29896, 29941, 29892, 13, 4706, 396, 402, 2227, 29949, 29896, 29929, 448, 17434, 29871, 29941, 29945, 13, 308, 29896, 29929, 29892, 13, 4706, 396, 402, 2227, 29949, 29906, 29941, 448, 17434, 29871, 29896, 29953, 13, 308, 29906, 29941, 29892, 13, 4706, 396, 402, 2227, 29949, 29906, 29946, 448, 17434, 29871, 29896, 29947, 13, 308, 29906, 29946, 13, 1678, 10353, 13, 1678, 525, 2798, 3204, 2396, 29871, 29945, 29892, 13, 1678, 525, 11802, 29918, 2230, 2396, 29871, 29953, 29900, 29892, 13, 1678, 525, 13628, 29918, 25629, 2396, 29871, 29896, 13, 29913, 13, 2 ]
custom/icds_reports/dashboard_utils.py
tstalka/commcare-hq
0
12765
<filename>custom/icds_reports/dashboard_utils.py<gh_stars>0 from corehq.apps.locations.util import location_hierarchy_config from custom.icds_reports.utils import icds_pre_release_features def get_dashboard_template_context(domain, couch_user): context = {} context['location_hierarchy'] = location_hierarchy_config(domain) context['user_location_id'] = couch_user.get_location_id(domain) context['all_user_location_id'] = list(couch_user.get_sql_locations( domain ).location_ids()) context['state_level_access'] = 'state' in set( [loc.location_type.code for loc in couch_user.get_sql_locations( domain )] ) context['have_access_to_features'] = icds_pre_release_features(couch_user) context['have_access_to_all_locations'] = couch_user.has_permission( domain, 'access_all_locations' ) if context['have_access_to_all_locations']: context['user_location_id'] = None if couch_user.is_web_user(): context['is_web_user'] = True return context
[ 1, 529, 9507, 29958, 6341, 29914, 293, 6289, 29918, 276, 4011, 29914, 14592, 3377, 29918, 13239, 29889, 2272, 29966, 12443, 29918, 303, 1503, 29958, 29900, 13, 3166, 7136, 29882, 29939, 29889, 13371, 29889, 2029, 800, 29889, 4422, 1053, 4423, 29918, 29882, 631, 12040, 29918, 2917, 13, 3166, 2888, 29889, 293, 6289, 29918, 276, 4011, 29889, 13239, 1053, 16077, 6289, 29918, 1457, 29918, 14096, 29918, 22100, 13, 13, 13, 1753, 679, 29918, 14592, 3377, 29918, 6886, 29918, 4703, 29898, 7247, 29892, 274, 3222, 29918, 1792, 1125, 13, 1678, 3030, 353, 6571, 13, 1678, 3030, 1839, 5479, 29918, 29882, 631, 12040, 2033, 353, 4423, 29918, 29882, 631, 12040, 29918, 2917, 29898, 7247, 29897, 13, 1678, 3030, 1839, 1792, 29918, 5479, 29918, 333, 2033, 353, 274, 3222, 29918, 1792, 29889, 657, 29918, 5479, 29918, 333, 29898, 7247, 29897, 13, 1678, 3030, 1839, 497, 29918, 1792, 29918, 5479, 29918, 333, 2033, 353, 1051, 29898, 29883, 3222, 29918, 1792, 29889, 657, 29918, 2850, 29918, 2029, 800, 29898, 13, 4706, 5354, 13, 1678, 13742, 5479, 29918, 4841, 3101, 13, 1678, 3030, 1839, 3859, 29918, 5563, 29918, 5943, 2033, 353, 525, 3859, 29915, 297, 731, 29898, 13, 4706, 518, 2029, 29889, 5479, 29918, 1853, 29889, 401, 363, 1180, 297, 274, 3222, 29918, 1792, 29889, 657, 29918, 2850, 29918, 2029, 800, 29898, 13, 9651, 5354, 13, 4706, 1723, 29962, 13, 1678, 1723, 13, 1678, 3030, 1839, 17532, 29918, 5943, 29918, 517, 29918, 22100, 2033, 353, 16077, 6289, 29918, 1457, 29918, 14096, 29918, 22100, 29898, 29883, 3222, 29918, 1792, 29897, 13, 1678, 3030, 1839, 17532, 29918, 5943, 29918, 517, 29918, 497, 29918, 2029, 800, 2033, 353, 274, 3222, 29918, 1792, 29889, 5349, 29918, 16074, 29898, 13, 4706, 5354, 29892, 525, 5943, 29918, 497, 29918, 2029, 800, 29915, 13, 1678, 1723, 13, 13, 1678, 565, 3030, 1839, 17532, 29918, 5943, 29918, 517, 29918, 497, 29918, 2029, 800, 2033, 29901, 13, 4706, 3030, 1839, 1792, 29918, 5479, 29918, 333, 2033, 353, 6213, 13, 13, 1678, 565, 274, 3222, 29918, 1792, 29889, 275, 29918, 2676, 29918, 1792, 7295, 13, 4706, 3030, 1839, 275, 29918, 2676, 29918, 1792, 2033, 353, 5852, 13, 13, 1678, 736, 3030, 13, 2 ]
slbo/policies/__init__.py
LinZichuan/AdMRL
27
119978
import abc from typing import Union import lunzi.nn as nn class BasePolicy(abc.ABC): @abc.abstractmethod def get_actions(self, states): pass BaseNNPolicy = Union[BasePolicy, nn.Module] # should be Intersection, see PEP544
[ 1, 1053, 25638, 13, 3166, 19229, 1053, 7761, 13, 5215, 25081, 2526, 29889, 15755, 408, 302, 29876, 13, 13, 13, 1990, 7399, 15644, 29898, 10736, 29889, 19658, 1125, 13, 1678, 732, 10736, 29889, 16595, 5696, 13, 1678, 822, 679, 29918, 7387, 29898, 1311, 29892, 5922, 1125, 13, 4706, 1209, 13, 13, 13, 5160, 10262, 15644, 353, 7761, 29961, 5160, 15644, 29892, 302, 29876, 29889, 7355, 29962, 29871, 396, 881, 367, 4124, 2042, 29892, 1074, 349, 15488, 29945, 29946, 29946, 13, 2 ]
codestepbystep/convert_to_alt_caps.py
aleeper/python_sandbox
0
79272
def convert_to_alt_caps(message): lower = message.lower() upper = message.upper() data = [] space_offset = 0 for i in range(len(lower)): if not lower[i].isalpha(): space_offset += 1 if (i + space_offset) % 2 == 0: data.append(lower[i]) else: data.append(upper[i]) return ''.join(data) def main(): input_str = "Pikachu" print(input_str) print(convert_to_alt_caps(input_str)) input_str = "section is AWESOME" print(input_str) print(convert_to_alt_caps(input_str)) if __name__ == '__main__': main()
[ 1, 29871, 13, 13, 1753, 3588, 29918, 517, 29918, 1997, 29918, 29883, 2547, 29898, 4906, 1125, 13, 1678, 5224, 353, 2643, 29889, 13609, 580, 13, 1678, 7568, 353, 2643, 29889, 21064, 580, 13, 1678, 848, 353, 5159, 13, 1678, 2913, 29918, 10289, 353, 29871, 29900, 13, 1678, 363, 474, 297, 3464, 29898, 2435, 29898, 13609, 22164, 13, 4706, 565, 451, 5224, 29961, 29875, 1822, 275, 2312, 7295, 13, 9651, 2913, 29918, 10289, 4619, 29871, 29896, 13, 13, 4706, 565, 313, 29875, 718, 2913, 29918, 10289, 29897, 1273, 29871, 29906, 1275, 29871, 29900, 29901, 13, 9651, 848, 29889, 4397, 29898, 13609, 29961, 29875, 2314, 13, 4706, 1683, 29901, 13, 9651, 848, 29889, 4397, 29898, 21064, 29961, 29875, 2314, 13, 1678, 736, 525, 4286, 7122, 29898, 1272, 29897, 13, 13, 1753, 1667, 7295, 13, 1678, 1881, 29918, 710, 353, 376, 29925, 638, 496, 29884, 29908, 13, 1678, 1596, 29898, 2080, 29918, 710, 29897, 13, 1678, 1596, 29898, 13441, 29918, 517, 29918, 1997, 29918, 29883, 2547, 29898, 2080, 29918, 710, 876, 13, 1678, 1881, 29918, 710, 353, 376, 2042, 338, 319, 29956, 2890, 29949, 2303, 29908, 13, 1678, 1596, 29898, 2080, 29918, 710, 29897, 13, 1678, 1596, 29898, 13441, 29918, 517, 29918, 1997, 29918, 29883, 2547, 29898, 2080, 29918, 710, 876, 13, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 1667, 580, 2 ]
toy_gradlogp/utils.py
Ending2015a/toy_gradlogp
13
141644
# --- built in --- import os # --- 3rd party --- import numpy as np import torch from torch import nn # --- my module --- __all__ = [ 'langevin_dynamics', 'anneal_langevin_dynamics', 'sample_score_field', 'sample_energy_field' ] # --- dynamics --- def langevin_dynamics( score_fn, x, eps=0.1, n_steps=1000 ): """Langevin dynamics Args: score_fn (callable): a score function with the following sign func(x: torch.Tensor) -> torch.Tensor x (torch.Tensor): input samples eps (float, optional): noise scale. Defaults to 0.1. n_steps (int, optional): number of steps. Defaults to 1000. """ for i in range(n_steps): x = x + eps/2. * score_fn(x).detach() x = x + torch.randn_like(x) * np.sqrt(eps) return x def anneal_langevin_dynamics( score_fn, x, sigmas=None, eps=0.1, n_steps_each=100 ): """Annealed Langevin dynamics Args: score_fn (callable): a score function with the following sign func(x: torch.Tensor, sigma: float) -> torch.Tensor x (torch.Tensor): input samples sigmas (torch.Tensor, optional): noise schedule. Defualts to None. eps (float, optional): noise scale. Defaults to 0.1. n_steps (int, optional): number of steps. Defaults to 1000. """ # default sigma schedule if sigmas is None: sigmas = np.exp(np.linspace(np.log(20), 0., 10)) for sigma in sigmas: for i in range(n_steps_each): cur_eps = eps * (sigma / sigmas[-1]) ** 2 x = x + cur_eps/2. * score_fn(x, sigma).detach() x = x + torch.randn_like(x) * np.sqrt(eps) return x # --- sampling utils --- def sample_score_field( score_fn, range_lim=4, grid_size=50, device='cpu' ): """Sampling score field from an energy model Args: score_fn (callable): a score function with the following sign func(x: torch.Tensor) -> torch.Tensor range_lim (int, optional): Range of x, y coordimates. Defaults to 4. grid_size (int, optional): Grid size. Defaults to 50. device (str, optional): torch device. Defaults to 'cpu'. """ mesh = [] x = np.linspace(-range_lim, range_lim, grid_size) y = np.linspace(-range_lim, range_lim, grid_size) for i in x: for j in y: mesh.append(np.asarray([i, j])) mesh = np.stack(mesh, axis=0) x = torch.from_numpy(mesh).float() x = x.to(device=device) scores = score_fn(x.detach()).detach() scores = scores.cpu().numpy() return mesh, scores def sample_energy_field( energy_fn, range_lim=4, grid_size=1000, device='cpu' ): """Sampling energy field from an energy model Args: energy_fn (callable): an energy function with the following sign func(x: torch.Tensor) -> torch.Tensor range_lim (int, optional): range of x, y coordinates. Defaults to 4. grid_size (int, optional): grid size. Defaults to 1000. device (str, optional): torch device. Defaults to 'cpu'. """ energy = [] x = np.linspace(-range_lim, range_lim, grid_size) y = np.linspace(-range_lim, range_lim, grid_size) for i in y: mesh = [] for j in x: mesh.append(np.asarray([j, i])) mesh = np.stack(mesh, axis=0) inputs = torch.from_numpy(mesh).float() inputs = inputs.to(device=device) e = energy_fn(inputs.detach()).detach() e = e.view(grid_size).cpu().numpy() energy.append(e) energy = np.stack(energy, axis=0) # (grid_size, grid_size) return energy
[ 1, 396, 11474, 4240, 297, 11474, 13, 5215, 2897, 13, 13, 29937, 11474, 29871, 29941, 5499, 6263, 11474, 13, 5215, 12655, 408, 7442, 13, 5215, 4842, 305, 13, 3166, 4842, 305, 1053, 302, 29876, 13, 13, 29937, 11474, 590, 3883, 11474, 13, 13, 1649, 497, 1649, 353, 518, 13, 1678, 525, 29880, 927, 3845, 29918, 29881, 2926, 1199, 742, 13, 1678, 525, 11276, 284, 29918, 29880, 927, 3845, 29918, 29881, 2926, 1199, 742, 13, 1678, 525, 11249, 29918, 13628, 29918, 2671, 742, 13, 1678, 525, 11249, 29918, 27548, 29918, 2671, 29915, 13, 29962, 13, 13, 13, 29937, 11474, 19753, 11474, 13, 1753, 20516, 3845, 29918, 29881, 2926, 1199, 29898, 13, 1678, 8158, 29918, 9144, 29892, 13, 1678, 921, 29892, 13, 1678, 321, 567, 29922, 29900, 29889, 29896, 29892, 13, 1678, 302, 29918, 24530, 29922, 29896, 29900, 29900, 29900, 13, 1125, 13, 1678, 9995, 29931, 927, 3845, 19753, 13, 13, 1678, 826, 3174, 29901, 13, 4706, 8158, 29918, 9144, 313, 4804, 519, 1125, 263, 8158, 740, 411, 278, 1494, 1804, 13, 9651, 3653, 29898, 29916, 29901, 4842, 305, 29889, 29911, 6073, 29897, 1599, 4842, 305, 29889, 29911, 6073, 13, 4706, 921, 313, 7345, 305, 29889, 29911, 6073, 1125, 1881, 11916, 13, 4706, 321, 567, 313, 7411, 29892, 13136, 1125, 11462, 6287, 29889, 13109, 29879, 304, 29871, 29900, 29889, 29896, 29889, 13, 4706, 302, 29918, 24530, 313, 524, 29892, 13136, 1125, 1353, 310, 6576, 29889, 13109, 29879, 304, 29871, 29896, 29900, 29900, 29900, 29889, 13, 1678, 9995, 13, 1678, 363, 474, 297, 3464, 29898, 29876, 29918, 24530, 1125, 13, 4706, 921, 353, 921, 718, 321, 567, 29914, 29906, 29889, 334, 8158, 29918, 9144, 29898, 29916, 467, 4801, 496, 580, 13, 4706, 921, 353, 921, 718, 4842, 305, 29889, 9502, 29876, 29918, 4561, 29898, 29916, 29897, 334, 7442, 29889, 3676, 29898, 8961, 29897, 13, 1678, 736, 921, 13, 13, 1753, 385, 484, 284, 29918, 29880, 927, 3845, 29918, 29881, 2926, 1199, 29898, 13, 1678, 8158, 29918, 9144, 29892, 13, 1678, 921, 29892, 13, 1678, 4365, 8247, 29922, 8516, 29892, 13, 1678, 321, 567, 29922, 29900, 29889, 29896, 29892, 13, 1678, 302, 29918, 24530, 29918, 4204, 29922, 29896, 29900, 29900, 13, 1125, 13, 1678, 9995, 2744, 484, 7943, 365, 927, 3845, 19753, 13, 13, 1678, 826, 3174, 29901, 13, 4706, 8158, 29918, 9144, 313, 4804, 519, 1125, 263, 8158, 740, 411, 278, 1494, 1804, 13, 9651, 3653, 29898, 29916, 29901, 4842, 305, 29889, 29911, 6073, 29892, 269, 2934, 29901, 5785, 29897, 1599, 4842, 305, 29889, 29911, 6073, 13, 4706, 921, 313, 7345, 305, 29889, 29911, 6073, 1125, 1881, 11916, 13, 4706, 4365, 8247, 313, 7345, 305, 29889, 29911, 6073, 29892, 13136, 1125, 11462, 20410, 29889, 5282, 950, 1372, 304, 6213, 29889, 13, 4706, 321, 567, 313, 7411, 29892, 13136, 1125, 11462, 6287, 29889, 13109, 29879, 304, 29871, 29900, 29889, 29896, 29889, 13, 4706, 302, 29918, 24530, 313, 524, 29892, 13136, 1125, 1353, 310, 6576, 29889, 13109, 29879, 304, 29871, 29896, 29900, 29900, 29900, 29889, 13, 1678, 9995, 13, 1678, 396, 2322, 269, 2934, 20410, 13, 1678, 565, 4365, 8247, 338, 6213, 29901, 13, 4706, 4365, 8247, 353, 7442, 29889, 4548, 29898, 9302, 29889, 1915, 3493, 29898, 9302, 29889, 1188, 29898, 29906, 29900, 511, 29871, 29900, 1696, 29871, 29896, 29900, 876, 13, 13, 1678, 363, 269, 2934, 297, 4365, 8247, 29901, 13, 4706, 363, 474, 297, 3464, 29898, 29876, 29918, 24530, 29918, 4204, 1125, 13, 9651, 3151, 29918, 8961, 353, 321, 567, 334, 313, 3754, 847, 4365, 8247, 14352, 29896, 2314, 3579, 29871, 29906, 13, 9651, 921, 353, 921, 718, 3151, 29918, 8961, 29914, 29906, 29889, 334, 8158, 29918, 9144, 29898, 29916, 29892, 269, 2934, 467, 4801, 496, 580, 13, 9651, 921, 353, 921, 718, 4842, 305, 29889, 9502, 29876, 29918, 4561, 29898, 29916, 29897, 334, 7442, 29889, 3676, 29898, 8961, 29897, 13, 1678, 736, 921, 13, 13, 13, 29937, 11474, 23460, 3667, 29879, 11474, 13, 1753, 4559, 29918, 13628, 29918, 2671, 29898, 13, 1678, 8158, 29918, 9144, 29892, 13, 1678, 3464, 29918, 2576, 29922, 29946, 29892, 13, 1678, 6856, 29918, 2311, 29922, 29945, 29900, 29892, 13, 1678, 4742, 2433, 21970, 29915, 13, 1125, 13, 1678, 9995, 22966, 10335, 8158, 1746, 515, 385, 5864, 1904, 13, 13, 1678, 826, 3174, 29901, 13, 4706, 8158, 29918, 9144, 313, 4804, 519, 1125, 263, 8158, 740, 411, 278, 1494, 1804, 13, 9651, 3653, 29898, 29916, 29901, 4842, 305, 29889, 29911, 6073, 29897, 1599, 4842, 305, 29889, 29911, 6073, 13, 4706, 3464, 29918, 2576, 313, 524, 29892, 13136, 1125, 12146, 310, 921, 29892, 343, 29311, 326, 1078, 29889, 13109, 29879, 304, 29871, 29946, 29889, 13, 4706, 6856, 29918, 2311, 313, 524, 29892, 13136, 1125, 11657, 2159, 29889, 13109, 29879, 304, 29871, 29945, 29900, 29889, 13, 4706, 4742, 313, 710, 29892, 13136, 1125, 4842, 305, 4742, 29889, 13109, 29879, 304, 525, 21970, 4286, 13, 1678, 9995, 13, 1678, 27716, 353, 5159, 13, 1678, 921, 353, 7442, 29889, 1915, 3493, 6278, 3881, 29918, 2576, 29892, 3464, 29918, 2576, 29892, 6856, 29918, 2311, 29897, 13, 1678, 343, 353, 7442, 29889, 1915, 3493, 6278, 3881, 29918, 2576, 29892, 3464, 29918, 2576, 29892, 6856, 29918, 2311, 29897, 13, 1678, 363, 474, 297, 921, 29901, 13, 4706, 363, 432, 297, 343, 29901, 13, 9651, 27716, 29889, 4397, 29898, 9302, 29889, 294, 2378, 4197, 29875, 29892, 432, 12622, 13, 1678, 27716, 353, 7442, 29889, 1429, 29898, 4467, 29882, 29892, 9685, 29922, 29900, 29897, 13, 1678, 921, 353, 4842, 305, 29889, 3166, 29918, 23749, 29898, 4467, 29882, 467, 7411, 580, 13, 1678, 921, 353, 921, 29889, 517, 29898, 10141, 29922, 10141, 29897, 13, 1678, 19435, 353, 8158, 29918, 9144, 29898, 29916, 29889, 4801, 496, 16655, 4801, 496, 580, 13, 1678, 19435, 353, 19435, 29889, 21970, 2141, 23749, 580, 13, 1678, 736, 27716, 29892, 19435, 13, 13, 1753, 4559, 29918, 27548, 29918, 2671, 29898, 13, 1678, 5864, 29918, 9144, 29892, 13, 1678, 3464, 29918, 2576, 29922, 29946, 29892, 13, 1678, 6856, 29918, 2311, 29922, 29896, 29900, 29900, 29900, 29892, 13, 1678, 4742, 2433, 21970, 29915, 13, 1125, 13, 1678, 9995, 22966, 10335, 5864, 1746, 515, 385, 5864, 1904, 13, 13, 1678, 826, 3174, 29901, 13, 4706, 5864, 29918, 9144, 313, 4804, 519, 1125, 385, 5864, 740, 411, 278, 1494, 1804, 13, 9651, 3653, 29898, 29916, 29901, 4842, 305, 29889, 29911, 6073, 29897, 1599, 4842, 305, 29889, 29911, 6073, 13, 4706, 3464, 29918, 2576, 313, 524, 29892, 13136, 1125, 3464, 310, 921, 29892, 343, 10350, 29889, 13109, 29879, 304, 29871, 29946, 29889, 13, 4706, 6856, 29918, 2311, 313, 524, 29892, 13136, 1125, 6856, 2159, 29889, 13109, 29879, 304, 29871, 29896, 29900, 29900, 29900, 29889, 13, 4706, 4742, 313, 710, 29892, 13136, 1125, 4842, 305, 4742, 29889, 13109, 29879, 304, 525, 21970, 4286, 13, 1678, 9995, 13, 1678, 5864, 353, 5159, 13, 1678, 921, 353, 7442, 29889, 1915, 3493, 6278, 3881, 29918, 2576, 29892, 3464, 29918, 2576, 29892, 6856, 29918, 2311, 29897, 13, 1678, 343, 353, 7442, 29889, 1915, 3493, 6278, 3881, 29918, 2576, 29892, 3464, 29918, 2576, 29892, 6856, 29918, 2311, 29897, 13, 1678, 363, 474, 297, 343, 29901, 13, 4706, 27716, 353, 5159, 13, 4706, 363, 432, 297, 921, 29901, 13, 9651, 27716, 29889, 4397, 29898, 9302, 29889, 294, 2378, 4197, 29926, 29892, 474, 12622, 13, 4706, 27716, 353, 7442, 29889, 1429, 29898, 4467, 29882, 29892, 9685, 29922, 29900, 29897, 13, 4706, 10970, 353, 4842, 305, 29889, 3166, 29918, 23749, 29898, 4467, 29882, 467, 7411, 580, 13, 4706, 10970, 353, 10970, 29889, 517, 29898, 10141, 29922, 10141, 29897, 13, 4706, 321, 353, 5864, 29918, 9144, 29898, 2080, 29879, 29889, 4801, 496, 16655, 4801, 496, 580, 13, 4706, 321, 353, 321, 29889, 1493, 29898, 7720, 29918, 2311, 467, 21970, 2141, 23749, 580, 13, 4706, 5864, 29889, 4397, 29898, 29872, 29897, 13, 1678, 5864, 353, 7442, 29889, 1429, 29898, 27548, 29892, 9685, 29922, 29900, 29897, 396, 313, 7720, 29918, 2311, 29892, 6856, 29918, 2311, 29897, 13, 1678, 736, 5864, 2 ]
standards/tests/test_jurisdiction.py
GROCCAD/groccad
1
170802
<reponame>GROCCAD/groccad import django import pytest from standards.models import Jurisdiction, UserProfile @pytest.mark.django_db def test_juri(): juri = Jurisdiction( name="Ghana", display_name="Ghana NaCCA", country='GH' ) juri.save() assert juri.id # print(juri.__dict__) @pytest.mark.django_db def test_no_duplicate_names(): juri = Jurisdiction(name="Ghana", display_name="Ghana NaCCA", country='GH') juri.save() assert juri.id juri2 = Jurisdiction(name="Ghana", display_name="Ghana NaCCA", country='GH') with pytest.raises(django.db.utils.IntegrityError): juri2.save()
[ 1, 529, 276, 1112, 420, 29958, 29954, 1672, 4174, 3035, 29914, 17170, 617, 328, 13, 5215, 9557, 13, 5215, 11451, 1688, 13, 13, 3166, 20801, 29889, 9794, 1053, 16081, 275, 29467, 29892, 4911, 13909, 13, 13, 13, 29992, 2272, 1688, 29889, 3502, 29889, 14095, 29918, 2585, 13, 1753, 1243, 29918, 29926, 5338, 7295, 13, 1678, 432, 5338, 353, 16081, 275, 29467, 29898, 13, 4706, 1024, 543, 29954, 29882, 1648, 613, 13, 4706, 2479, 29918, 978, 543, 29954, 29882, 1648, 4465, 4174, 29909, 613, 13, 4706, 4234, 2433, 29954, 29950, 29915, 13, 1678, 1723, 13, 1678, 432, 5338, 29889, 7620, 580, 13, 1678, 4974, 432, 5338, 29889, 333, 13, 1678, 396, 1596, 29898, 29926, 5338, 17255, 8977, 1649, 29897, 13, 13, 13, 29992, 2272, 1688, 29889, 3502, 29889, 14095, 29918, 2585, 13, 1753, 1243, 29918, 1217, 29918, 20908, 5926, 29918, 7039, 7295, 13, 1678, 432, 5338, 353, 16081, 275, 29467, 29898, 978, 543, 29954, 29882, 1648, 613, 2479, 29918, 978, 543, 29954, 29882, 1648, 4465, 4174, 29909, 613, 4234, 2433, 29954, 29950, 1495, 13, 1678, 432, 5338, 29889, 7620, 580, 13, 1678, 4974, 432, 5338, 29889, 333, 13, 1678, 432, 5338, 29906, 353, 16081, 275, 29467, 29898, 978, 543, 29954, 29882, 1648, 613, 2479, 29918, 978, 543, 29954, 29882, 1648, 4465, 4174, 29909, 613, 4234, 2433, 29954, 29950, 1495, 13, 1678, 411, 11451, 1688, 29889, 336, 4637, 29898, 14095, 29889, 2585, 29889, 13239, 29889, 23573, 537, 2392, 1125, 13, 4706, 432, 5338, 29906, 29889, 7620, 580, 13, 13, 2 ]
rlpyt/ul/algos/ul_for_rl/stc.py
Slienteagle-wyb/rlpyt
0
126359
import torch from collections import namedtuple import copy from rlpyt.utils.tensor import valid_mean from rlpyt.ul.algos.ul_for_rl.base import BaseUlAlgorithm from rlpyt.utils.quick_args import save__init__args from rlpyt.utils.logging import logger from rlpyt.ul.replays.offline_ul_replay import OfflineUlReplayBuffer from rlpyt.utils.buffer import buffer_to from rlpyt.models.utils import update_state_dict from rlpyt.ul.models.ul.encoders import DmlabEncoderModel from rlpyt.ul.algos.utils.data_augs import random_shift from rlpyt.ul.replays.offline_dataset import OfflineDatasets IGNORE_INDEX = -100 # Mask TC samples across episode boundary. OptInfo = namedtuple("OptInfo", ["stcLoss", "sprLoss", "contrastLoss", "cpcAccuracy1", "cpcAccuracy2", "cpcAccuracyTm1", "cpcAccuracyTm2", 'contrast_accuracy', "gradNorm", 'current_lr']) ValInfo = namedtuple("ValInfo", ["atcLoss", "accuracy", "convActivation"]) class DroneSTC(BaseUlAlgorithm): """ Spatial and Temporal Contrastive Pretraining with ConvGru features """ opt_info_fields = tuple(f for f in OptInfo._fields) # copy def __init__( self, batch_T=32, # the default length of extracted batch batch_B=16, # batch B is the sampled batch size for extraction warmup_T=0, clip_grad_norm=10., target_update_tau=0.01, # 1 for hard update target_update_interval=1, latent_size=256, hidden_sizes=512, rnn_size=256, random_shift_prob=1., random_shift_pad=4, spr_loss_coefficient=1.0, contrast_loss_coefficient=1.0, validation_split=0.0, n_validation_batches=0, ReplayCls=OfflineUlReplayBuffer, EncoderCls=DmlabEncoderModel, initial_state_dict=None, optim_kwargs=None, sched_kwargs=None, encoder_kwargs=None, replay_kwargs=None, ): encoder_kwargs = dict() if encoder_kwargs is None else encoder_kwargs save__init__args(locals()) self.c_e_loss = torch.nn.CrossEntropyLoss(ignore_index=IGNORE_INDEX) self.batch_size = batch_B * batch_T # batch_size for calculating update params self._replay_T = warmup_T + batch_T # self.replay_T == self._replay_T is the len of every sampled trajectory def initialize(self, epochs, cuda_idx=None): self.device = torch.device("cpu") if cuda_idx is None else torch.device("cuda", index=cuda_idx) examples = self.load_replay() self.itrs_per_epoch = self.replay_buffer.size // self.batch_size self.n_updates = epochs * self.itrs_per_epoch self.image_shape = image_shape = examples.observation.shape # [c, h, w] self.encoder = self.EncoderCls( image_shape=image_shape, latent_size=self.latent_size, hidden_sizes=self.hidden_sizes, **self.encoder_kwargs ) self.target_encoder = copy.deepcopy(self.encoder) # the target encoder is not tied with online encoder trans_dim = self.replay_buffer.translation_dim rotate_dim = self.replay_buffer.rotation_dim ar_input_size = rotate_dim + trans_dim # no reward self.aggregator_rnn = torch.nn.LSTM( input_size=int(self.latent_size+ar_input_size), hidden_size=self.rnn_size, ) # linear transforms from one step prediction to T-1 forward steps transforms = [None] for _ in range(self.batch_T - 1): transforms.append( torch.nn.Linear(in_features=self.latent_size, out_features=self.latent_size, bias=False) ) self.transforms = torch.nn.ModuleList(transforms) self.byol_linear_trans = torch.nn.Linear(self.latent_size, self.latent_size, bias=False) self.encoder.to(self.device) self.target_encoder.to(self.device) self.aggregator_rnn.to(self.device) self.transforms.to(self.device) self.byol_linear_trans.to(self.device) self.optim_initialize(epochs) # load the pretrained models if self.initial_state_dict is not None: self.load_state_dict(self.initial_state_dict) def optimize(self, itr): opt_info = OptInfo(*([] for _ in range(len(OptInfo._fields)))) samples = self.replay_buffer.sample_batch(self.batch_B) # batch b is the batch_size of every single trajectory current_epoch = itr // self.itrs_per_epoch if self.lr_scheduler is not None and itr % self.itrs_per_epoch == 0: self.lr_scheduler.step(current_epoch) current_lr = self.lr_scheduler.get_epoch_values(current_epoch)[0] self.optimizer.zero_grad() # calculate the loss func loss, spr_loss, contrast_loss, pred_accuracies, contrast_accuracy = self.stc_loss(samples) optimize_loss = spr_loss * self.spr_loss_coefficient + contrast_loss * self.contrast_loss_coefficient optimize_loss.backward() if self.clip_grad_norm is None: grad_norm = 0. else: grad_norm = torch.nn.utils.clip_grad_norm_( self.parameters(), self.clip_grad_norm) self.optimizer.step() # log the optimize info/result opt_info.stcLoss.append(loss.item()) opt_info.sprLoss.append(spr_loss.item()) opt_info.contrastLoss.append(contrast_loss.item()) opt_info.cpcAccuracy1.append(pred_accuracies[0].item()) opt_info.cpcAccuracy2.append(pred_accuracies[1].item()) opt_info.cpcAccuracyTm1.append(pred_accuracies[2].item()) opt_info.cpcAccuracyTm2.append(pred_accuracies[3].item()) opt_info.contrast_accuracy.append(contrast_accuracy.item()) opt_info.current_lr.append(current_lr) opt_info.gradNorm.append(grad_norm.item()) # opt_info.convActivation.append( # conv_output[0].detach().cpu().view(-1).numpy()) # Keep 1 full one. # the update interval for the momentun encoder if itr % self.target_update_interval == 0: update_state_dict(self.target_encoder, self.encoder.state_dict(), self.target_update_tau) return opt_info def stc_loss(self, samples): # the dim of T for samples.observation is 1+delta_T anchor = samples.observations length, b, f, c, h, w = anchor.shape anchor = anchor.view(length, b * f, c, h, w) # Treat all T,B as separate.(reshape the sample) positive = copy.deepcopy(anchor) translation = samples.translations rotation = samples.rotations action = torch.cat((translation, rotation), dim=-1) if self.random_shift_prob > 0.: anchor = random_shift( imgs=anchor, pad=self.random_shift_pad, prob=self.random_shift_prob, ) positive = random_shift( imgs=positive, pad=self.random_shift_pad, prob=self.random_shift_prob, ) # sned a tuple of tensor (anchor, postive) to device and return a tuple anchor, positive, action = buffer_to((anchor, positive, action), device=self.device) with torch.no_grad(): z_positive, z_conv_positive = self.target_encoder(positive) z_anchor, z_conv_anchor = self.encoder(anchor) spr_loss, pred_accuracies = self.spr_loss(z_anchor, z_positive, action) contrast_loss, contrast_accuracy = self.contrast_loss(z_anchor, z_positive) loss = spr_loss + contrast_loss return loss, spr_loss, contrast_loss, pred_accuracies, contrast_accuracy def spr_loss(self, z_anchor, z_positive, action): rnn_input = torch.cat((z_anchor, action), dim=-1) c_anchor, _ = self.aggregator_rnn(rnn_input) # Extract only the ones to train (all were needed to compute). c_anchor = c_anchor[self.warmup_T:] z_positive = z_positive.detach()[self.warmup_T:] T, B, Z = z_positive.shape target_trans = z_positive.view(-1, Z).transpose(1, 0) base_labels = torch.arange(T * B, dtype=torch.long, device=self.device).view(T, B) prediction_list = list() label_list = list() # from 1 forward step to T-1 forward step for delta_t in range(1, T): prediction_list.append(self.transforms[delta_t](c_anchor[:-delta_t].view(-1, Z))) label_list.append(base_labels[delta_t:].view(-1)) forward_steps = [0] + [len(label) for label in label_list] cumulative_forward_steps = torch.cumsum(torch.tensor(forward_steps), dim=0) # total predictions pairs: P=T*(T-1)/2*B prdictions = torch.cat(prediction_list) # [P, z_dim] labels = torch.cat(label_list) # [P] logits = torch.matmul(prdictions, target_trans) # [P, z_dim] * [z_dim, T*B] logits = logits - torch.max(logits, dim=1, keepdim=True)[0] spr_loss = self.c_e_loss(logits, labels) ################################################ # calculate the prediction metrix logits_d = logits.detach() # begin, end, step (downsample==sample from one step forward predictions every 4 steps): b, e, s = cumulative_forward_steps[0], cumulative_forward_steps[1], 4 # delta_t = 1 logits1, labels1 = logits_d[b:e:s], labels[b:e:s] correct1 = torch.argmax(logits1, dim=1) == labels1 accuracy1 = valid_mean(correct1.float(), valid=labels1 >= 0) # IGNORE=-100 b, e, s = cumulative_forward_steps[1], cumulative_forward_steps[2], 4 # delta_t = 2 logits2, labels2 = logits_d[b:e:s], labels[b:e:s] correct2 = torch.argmax(logits2, dim=1) == labels2 accuracy2 = valid_mean(correct2.float(), valid=labels2 >= 0) b, e, s = cumulative_forward_steps[-2], cumulative_forward_steps[-1], 1 # delta_t = T - 1 logitsT1, labelsT1 = logits_d[b:e:s], labels[b:e:s] correctT1 = torch.argmax(logitsT1, dim=1) == labelsT1 accuracyT1 = valid_mean(correctT1.float(), valid=labelsT1 >= 0) b, e, s = cumulative_forward_steps[-3], cumulative_forward_steps[-2], 1 # delta_t = T - 2 logitsT2, labelsT2 = logits_d[b:e:s], labels[b:e:s] correctT2 = torch.argmax(logitsT2, dim=1) == labelsT2 accuracyT2 = valid_mean(correctT2.float(), valid=labelsT2 >= 0) accuracies = (accuracy1, accuracy2, accuracyT1, accuracyT2) return spr_loss, accuracies def contrast_loss(self, z_anchor, z_positive): T, B, latent_dim = z_anchor.shape z_positive_trans = z_positive.detach().view(-1, latent_dim).transpose(1, 0) # [latent_dim, T*B] labels = torch.arange(T * B, dtype=torch.long, device=self.device) pred = self.byol_linear_trans(z_anchor).view(-1, latent_dim) logits = torch.matmul(pred, z_positive_trans) # [T*B, T*B] logits = logits - torch.max(logits, dim=1, keepdim=True)[0] contrast_loss = self.c_e_loss(logits, labels) correct = torch.argmax(logits.detach(), dim=1) == labels contrast_accuracy = torch.mean(correct.float()) return contrast_loss, contrast_accuracy def validation(self, itr): pass def state_dict(self): return dict( encoder=self.encoder.state_dict(), target_encoder=self.target_encoder.state_dict(), aggregator_rnn=self.aggregator_rnn.state_dict(), optimizer=self.optimizer.state_dict(), ) def load_state_dict(self, state_dict): self.encoder.load_state_dict(state_dict["encoder"]) self.target_encoder.load_state_dict(state_dict["target_encoder"]) self.aggregator_rnn.load_state_dict(state_dict['aggregator_rnn']) self.optimizer.load_state_dict(state_dict["optimizer"]) def parameters(self): yield from self.encoder.parameters() yield from self.aggregator_rnn.parameters() yield from self.transforms.parameters() yield from self.byol_linear_trans.parameters() def named_parameters(self): """To allow filtering by name in weight decay.""" yield from self.encoder.named_parameters() yield from self.aggregator_rnn.named_parameters() yield from self.transforms.named_parameters() yield from self.byol_linear_trans.named_parameters() def eval(self): self.encoder.eval() # in case of batch norm self.aggregator_rnn.eval() self.transforms.eval() self.byol_linear_trans.eval() def train(self): self.encoder.train() self.aggregator_rnn.train() self.transforms.train() self.byol_linear_trans.train() def load_replay(self, pixel_control_buffer=None): logger.log('Loading replay buffer ...') self.replay_buffer = self.ReplayCls(OfflineDatasets, **self.replay_kwargs) logger.log("Replay buffer loaded") example = self.replay_buffer.get_example() return example
[ 1, 1053, 4842, 305, 13, 3166, 16250, 1053, 4257, 23583, 13, 5215, 3509, 13, 3166, 364, 29880, 2272, 29873, 29889, 13239, 29889, 20158, 1053, 2854, 29918, 12676, 13, 3166, 364, 29880, 2272, 29873, 29889, 352, 29889, 9564, 359, 29889, 352, 29918, 1454, 29918, 2096, 29889, 3188, 1053, 7399, 29965, 29880, 22461, 4540, 13, 3166, 364, 29880, 2272, 29873, 29889, 13239, 29889, 24561, 29918, 5085, 1053, 4078, 1649, 2344, 1649, 5085, 13, 3166, 364, 29880, 2272, 29873, 29889, 13239, 29889, 21027, 1053, 17927, 13, 3166, 364, 29880, 2272, 29873, 29889, 352, 29889, 276, 12922, 29889, 2696, 1220, 29918, 352, 29918, 276, 1456, 1053, 5947, 1220, 29965, 29880, 1123, 1456, 7701, 13, 3166, 364, 29880, 2272, 29873, 29889, 13239, 29889, 9040, 1053, 6835, 29918, 517, 13, 3166, 364, 29880, 2272, 29873, 29889, 9794, 29889, 13239, 1053, 2767, 29918, 3859, 29918, 8977, 13, 3166, 364, 29880, 2272, 29873, 29889, 352, 29889, 9794, 29889, 352, 29889, 3977, 397, 414, 1053, 360, 828, 370, 8566, 6119, 3195, 13, 3166, 364, 29880, 2272, 29873, 29889, 352, 29889, 9564, 359, 29889, 13239, 29889, 1272, 29918, 2987, 29879, 1053, 4036, 29918, 10889, 13, 3166, 364, 29880, 2272, 29873, 29889, 352, 29889, 276, 12922, 29889, 2696, 1220, 29918, 24713, 1053, 5947, 1220, 16390, 294, 1691, 13, 13, 6259, 6632, 1525, 29918, 27992, 353, 448, 29896, 29900, 29900, 29871, 396, 341, 1278, 323, 29907, 11916, 4822, 12720, 10452, 29889, 13, 20624, 3401, 353, 4257, 23583, 703, 20624, 3401, 613, 6796, 303, 29883, 29931, 2209, 613, 376, 15099, 29931, 2209, 613, 376, 9996, 579, 29931, 2209, 613, 13, 462, 462, 376, 29883, 6739, 7504, 332, 4135, 29896, 613, 376, 29883, 6739, 7504, 332, 4135, 29906, 613, 376, 29883, 6739, 7504, 332, 4135, 29911, 29885, 29896, 613, 376, 29883, 6739, 7504, 332, 4135, 29911, 29885, 29906, 613, 13, 462, 462, 525, 9996, 579, 29918, 562, 2764, 4135, 742, 376, 5105, 29940, 555, 613, 525, 3784, 29918, 29212, 11287, 13, 1440, 3401, 353, 4257, 23583, 703, 1440, 3401, 613, 6796, 271, 29883, 29931, 2209, 613, 376, 562, 2764, 4135, 613, 376, 20580, 21786, 362, 20068, 13, 13, 13, 1990, 4942, 650, 1254, 29907, 29898, 5160, 29965, 29880, 22461, 4540, 1125, 13, 1678, 9995, 13, 1678, 1706, 15238, 322, 6789, 1971, 284, 1281, 509, 579, 573, 349, 2267, 336, 2827, 411, 29871, 1281, 29894, 29954, 582, 5680, 13, 1678, 9995, 13, 1678, 3523, 29918, 3888, 29918, 9621, 353, 18761, 29898, 29888, 363, 285, 297, 20693, 3401, 3032, 9621, 29897, 29871, 396, 3509, 13, 13, 1678, 822, 4770, 2344, 12035, 13, 9651, 1583, 29892, 13, 9651, 9853, 29918, 29911, 29922, 29941, 29906, 29892, 29871, 396, 278, 2322, 3309, 310, 23892, 9853, 13, 9651, 9853, 29918, 29933, 29922, 29896, 29953, 29892, 29871, 396, 9853, 350, 338, 278, 4559, 29881, 9853, 2159, 363, 4805, 428, 13, 9651, 14294, 786, 29918, 29911, 29922, 29900, 29892, 13, 9651, 20102, 29918, 5105, 29918, 12324, 29922, 29896, 29900, 1696, 13, 9651, 3646, 29918, 5504, 29918, 4722, 29922, 29900, 29889, 29900, 29896, 29892, 29871, 396, 29871, 29896, 363, 2898, 2767, 13, 9651, 3646, 29918, 5504, 29918, 19207, 29922, 29896, 29892, 13, 9651, 3405, 296, 29918, 2311, 29922, 29906, 29945, 29953, 29892, 13, 9651, 7934, 29918, 29879, 7093, 29922, 29945, 29896, 29906, 29892, 13, 9651, 364, 15755, 29918, 2311, 29922, 29906, 29945, 29953, 29892, 13, 9651, 4036, 29918, 10889, 29918, 22795, 29922, 29896, 1696, 13, 9651, 4036, 29918, 10889, 29918, 8305, 29922, 29946, 29892, 13, 9651, 7689, 29918, 6758, 29918, 1111, 8462, 29922, 29896, 29889, 29900, 29892, 13, 9651, 12814, 29918, 6758, 29918, 1111, 8462, 29922, 29896, 29889, 29900, 29892, 13, 9651, 8845, 29918, 5451, 29922, 29900, 29889, 29900, 29892, 13, 9651, 302, 29918, 18157, 29918, 16175, 267, 29922, 29900, 29892, 13, 9651, 830, 1456, 29907, 3137, 29922, 6880, 1220, 29965, 29880, 1123, 1456, 7701, 29892, 13, 9651, 11346, 6119, 29907, 3137, 29922, 29928, 828, 370, 8566, 6119, 3195, 29892, 13, 9651, 2847, 29918, 3859, 29918, 8977, 29922, 8516, 29892, 13, 9651, 5994, 29918, 19290, 29922, 8516, 29892, 13, 9651, 28598, 29918, 19290, 29922, 8516, 29892, 13, 9651, 2094, 6119, 29918, 19290, 29922, 8516, 29892, 13, 9651, 337, 1456, 29918, 19290, 29922, 8516, 29892, 13, 268, 1125, 13, 4706, 2094, 6119, 29918, 19290, 353, 9657, 580, 565, 2094, 6119, 29918, 19290, 338, 6213, 1683, 2094, 6119, 29918, 19290, 13, 4706, 4078, 1649, 2344, 1649, 5085, 29898, 2997, 29879, 3101, 13, 4706, 1583, 29889, 29883, 29918, 29872, 29918, 6758, 353, 4842, 305, 29889, 15755, 29889, 29907, 2124, 5292, 14441, 29931, 2209, 29898, 17281, 29918, 2248, 29922, 6259, 6632, 1525, 29918, 27992, 29897, 13, 13, 4706, 1583, 29889, 16175, 29918, 2311, 353, 9853, 29918, 29933, 334, 9853, 29918, 29911, 29871, 396, 9853, 29918, 2311, 363, 25202, 2767, 8636, 13, 4706, 1583, 3032, 276, 1456, 29918, 29911, 353, 14294, 786, 29918, 29911, 718, 9853, 29918, 29911, 29871, 396, 1583, 29889, 276, 1456, 29918, 29911, 1275, 1583, 3032, 276, 1456, 29918, 29911, 338, 278, 7431, 310, 1432, 4559, 29881, 23324, 706, 13, 13, 1678, 822, 11905, 29898, 1311, 29892, 21502, 12168, 29892, 274, 6191, 29918, 13140, 29922, 8516, 1125, 13, 4706, 1583, 29889, 10141, 353, 4842, 305, 29889, 10141, 703, 21970, 1159, 565, 274, 6191, 29918, 13140, 338, 6213, 1683, 4842, 305, 29889, 10141, 703, 29883, 6191, 613, 2380, 29922, 29883, 6191, 29918, 13140, 29897, 13, 13, 4706, 6455, 353, 1583, 29889, 1359, 29918, 276, 1456, 580, 13, 4706, 1583, 29889, 277, 2288, 29918, 546, 29918, 1022, 2878, 353, 1583, 29889, 276, 1456, 29918, 9040, 29889, 2311, 849, 1583, 29889, 16175, 29918, 2311, 13, 4706, 1583, 29889, 29876, 29918, 786, 15190, 353, 21502, 12168, 334, 1583, 29889, 277, 2288, 29918, 546, 29918, 1022, 2878, 13, 4706, 1583, 29889, 3027, 29918, 12181, 353, 1967, 29918, 12181, 353, 6455, 29889, 26739, 362, 29889, 12181, 29871, 396, 518, 29883, 29892, 298, 29892, 281, 29962, 13, 13, 4706, 1583, 29889, 3977, 6119, 353, 1583, 29889, 8566, 6119, 29907, 3137, 29898, 13, 9651, 1967, 29918, 12181, 29922, 3027, 29918, 12181, 29892, 13, 9651, 3405, 296, 29918, 2311, 29922, 1311, 29889, 5066, 296, 29918, 2311, 29892, 13, 9651, 7934, 29918, 29879, 7093, 29922, 1311, 29889, 10892, 29918, 29879, 7093, 29892, 13, 9651, 3579, 1311, 29889, 3977, 6119, 29918, 19290, 13, 4706, 1723, 13, 4706, 1583, 29889, 5182, 29918, 3977, 6119, 353, 3509, 29889, 24535, 8552, 29898, 1311, 29889, 3977, 6119, 29897, 29871, 396, 278, 3646, 2094, 6119, 338, 451, 21351, 411, 7395, 2094, 6119, 13, 13, 4706, 1301, 29918, 6229, 353, 1583, 29889, 276, 1456, 29918, 9040, 29889, 3286, 18411, 29918, 6229, 13, 4706, 16734, 29918, 6229, 353, 1583, 29889, 276, 1456, 29918, 9040, 29889, 5450, 362, 29918, 6229, 13, 4706, 564, 29918, 2080, 29918, 2311, 353, 16734, 29918, 6229, 718, 1301, 29918, 6229, 29871, 396, 694, 20751, 13, 13, 4706, 1583, 29889, 26193, 1061, 29918, 29878, 15755, 353, 4842, 305, 29889, 15755, 29889, 29931, 1254, 29924, 29898, 13, 9651, 1881, 29918, 2311, 29922, 524, 29898, 1311, 29889, 5066, 296, 29918, 2311, 29974, 279, 29918, 2080, 29918, 2311, 511, 13, 9651, 7934, 29918, 2311, 29922, 1311, 29889, 29878, 15755, 29918, 2311, 29892, 13, 4706, 1723, 13, 13, 4706, 396, 5608, 4327, 29879, 515, 697, 4331, 18988, 304, 323, 29899, 29896, 6375, 6576, 13, 4706, 4327, 29879, 353, 518, 8516, 29962, 13, 4706, 363, 903, 297, 3464, 29898, 1311, 29889, 16175, 29918, 29911, 448, 29871, 29896, 1125, 13, 9651, 4327, 29879, 29889, 4397, 29898, 13, 18884, 4842, 305, 29889, 15755, 29889, 12697, 29898, 262, 29918, 22100, 29922, 1311, 29889, 5066, 296, 29918, 2311, 29892, 714, 29918, 22100, 29922, 1311, 29889, 5066, 296, 29918, 2311, 29892, 24003, 29922, 8824, 29897, 13, 9651, 1723, 13, 4706, 1583, 29889, 9067, 29879, 353, 4842, 305, 29889, 15755, 29889, 7355, 1293, 29898, 9067, 29879, 29897, 13, 4706, 1583, 29889, 1609, 324, 29918, 10660, 29918, 3286, 353, 4842, 305, 29889, 15755, 29889, 12697, 29898, 1311, 29889, 5066, 296, 29918, 2311, 29892, 1583, 29889, 5066, 296, 29918, 2311, 29892, 24003, 29922, 8824, 29897, 13, 13, 13, 4706, 1583, 29889, 3977, 6119, 29889, 517, 29898, 1311, 29889, 10141, 29897, 13, 4706, 1583, 29889, 5182, 29918, 3977, 6119, 29889, 517, 29898, 1311, 29889, 10141, 29897, 13, 4706, 1583, 29889, 26193, 1061, 29918, 29878, 15755, 29889, 517, 29898, 1311, 29889, 10141, 29897, 13, 4706, 1583, 29889, 9067, 29879, 29889, 517, 29898, 1311, 29889, 10141, 29897, 13, 4706, 1583, 29889, 1609, 324, 29918, 10660, 29918, 3286, 29889, 517, 29898, 1311, 29889, 10141, 29897, 13, 13, 4706, 1583, 29889, 20640, 29918, 24926, 29898, 1022, 2878, 29879, 29897, 13, 4706, 396, 2254, 278, 758, 3018, 1312, 4733, 13, 4706, 565, 1583, 29889, 11228, 29918, 3859, 29918, 8977, 338, 451, 6213, 29901, 13, 9651, 1583, 29889, 1359, 29918, 3859, 29918, 8977, 29898, 1311, 29889, 11228, 29918, 3859, 29918, 8977, 29897, 13, 13, 1678, 822, 24656, 29898, 1311, 29892, 372, 29878, 1125, 13, 4706, 3523, 29918, 3888, 353, 20693, 3401, 10456, 29898, 2636, 363, 903, 297, 3464, 29898, 2435, 29898, 20624, 3401, 3032, 9621, 13697, 13, 4706, 11916, 353, 1583, 29889, 276, 1456, 29918, 9040, 29889, 11249, 29918, 16175, 29898, 1311, 29889, 16175, 29918, 29933, 29897, 29871, 396, 9853, 289, 338, 278, 9853, 29918, 2311, 310, 1432, 2323, 23324, 706, 13, 4706, 1857, 29918, 1022, 2878, 353, 372, 29878, 849, 1583, 29889, 277, 2288, 29918, 546, 29918, 1022, 2878, 13, 4706, 565, 1583, 29889, 29212, 29918, 816, 14952, 338, 451, 6213, 322, 372, 29878, 1273, 1583, 29889, 277, 2288, 29918, 546, 29918, 1022, 2878, 1275, 29871, 29900, 29901, 13, 9651, 1583, 29889, 29212, 29918, 816, 14952, 29889, 10568, 29898, 3784, 29918, 1022, 2878, 29897, 13, 4706, 1857, 29918, 29212, 353, 1583, 29889, 29212, 29918, 816, 14952, 29889, 657, 29918, 1022, 2878, 29918, 5975, 29898, 3784, 29918, 1022, 2878, 9601, 29900, 29962, 13, 13, 4706, 1583, 29889, 20640, 3950, 29889, 9171, 29918, 5105, 580, 13, 4706, 396, 8147, 278, 6410, 3653, 13, 4706, 6410, 29892, 7689, 29918, 6758, 29892, 12814, 29918, 6758, 29892, 4450, 29918, 5753, 2002, 2478, 29892, 12814, 29918, 562, 2764, 4135, 353, 1583, 29889, 303, 29883, 29918, 6758, 29898, 27736, 29897, 13, 4706, 24656, 29918, 6758, 353, 7689, 29918, 6758, 334, 1583, 29889, 15099, 29918, 6758, 29918, 1111, 8462, 718, 12814, 29918, 6758, 334, 1583, 29889, 9996, 579, 29918, 6758, 29918, 1111, 8462, 13, 4706, 24656, 29918, 6758, 29889, 1627, 1328, 580, 13, 4706, 565, 1583, 29889, 24049, 29918, 5105, 29918, 12324, 338, 6213, 29901, 13, 9651, 4656, 29918, 12324, 353, 29871, 29900, 29889, 13, 4706, 1683, 29901, 13, 9651, 4656, 29918, 12324, 353, 4842, 305, 29889, 15755, 29889, 13239, 29889, 24049, 29918, 5105, 29918, 12324, 23538, 13, 18884, 1583, 29889, 16744, 3285, 1583, 29889, 24049, 29918, 5105, 29918, 12324, 29897, 13, 4706, 1583, 29889, 20640, 3950, 29889, 10568, 580, 13, 13, 4706, 396, 1480, 278, 24656, 5235, 29914, 2914, 13, 4706, 3523, 29918, 3888, 29889, 303, 29883, 29931, 2209, 29889, 4397, 29898, 6758, 29889, 667, 3101, 13, 4706, 3523, 29918, 3888, 29889, 15099, 29931, 2209, 29889, 4397, 29898, 15099, 29918, 6758, 29889, 667, 3101, 13, 4706, 3523, 29918, 3888, 29889, 9996, 579, 29931, 2209, 29889, 4397, 29898, 9996, 579, 29918, 6758, 29889, 667, 3101, 13, 4706, 3523, 29918, 3888, 29889, 29883, 6739, 7504, 332, 4135, 29896, 29889, 4397, 29898, 11965, 29918, 5753, 2002, 2478, 29961, 29900, 1822, 667, 3101, 13, 4706, 3523, 29918, 3888, 29889, 29883, 6739, 7504, 332, 4135, 29906, 29889, 4397, 29898, 11965, 29918, 5753, 2002, 2478, 29961, 29896, 1822, 667, 3101, 13, 4706, 3523, 29918, 3888, 29889, 29883, 6739, 7504, 332, 4135, 29911, 29885, 29896, 29889, 4397, 29898, 11965, 29918, 5753, 2002, 2478, 29961, 29906, 1822, 667, 3101, 13, 4706, 3523, 29918, 3888, 29889, 29883, 6739, 7504, 332, 4135, 29911, 29885, 29906, 29889, 4397, 29898, 11965, 29918, 5753, 2002, 2478, 29961, 29941, 1822, 667, 3101, 13, 4706, 3523, 29918, 3888, 29889, 9996, 579, 29918, 562, 2764, 4135, 29889, 4397, 29898, 9996, 579, 29918, 562, 2764, 4135, 29889, 667, 3101, 13, 4706, 3523, 29918, 3888, 29889, 3784, 29918, 29212, 29889, 4397, 29898, 3784, 29918, 29212, 29897, 13, 4706, 3523, 29918, 3888, 29889, 5105, 29940, 555, 29889, 4397, 29898, 5105, 29918, 12324, 29889, 667, 3101, 13, 4706, 396, 3523, 29918, 3888, 29889, 20580, 21786, 362, 29889, 4397, 29898, 13, 4706, 396, 268, 7602, 29918, 4905, 29961, 29900, 1822, 4801, 496, 2141, 21970, 2141, 1493, 6278, 29896, 467, 23749, 3101, 29871, 396, 19152, 29871, 29896, 2989, 697, 29889, 13, 4706, 396, 278, 2767, 7292, 363, 278, 3256, 348, 2094, 6119, 13, 4706, 565, 372, 29878, 1273, 1583, 29889, 5182, 29918, 5504, 29918, 19207, 1275, 29871, 29900, 29901, 13, 9651, 2767, 29918, 3859, 29918, 8977, 29898, 1311, 29889, 5182, 29918, 3977, 6119, 29892, 13, 462, 795, 1583, 29889, 3977, 6119, 29889, 3859, 29918, 8977, 3285, 13, 462, 795, 1583, 29889, 5182, 29918, 5504, 29918, 4722, 29897, 13, 4706, 736, 3523, 29918, 3888, 13, 13, 1678, 822, 380, 29883, 29918, 6758, 29898, 1311, 29892, 11916, 1125, 13, 4706, 396, 278, 3964, 310, 323, 363, 11916, 29889, 26739, 362, 338, 29871, 29896, 29974, 4181, 29918, 29911, 13, 4706, 17360, 353, 11916, 29889, 26739, 800, 13, 4706, 3309, 29892, 289, 29892, 285, 29892, 274, 29892, 298, 29892, 281, 353, 17360, 29889, 12181, 13, 4706, 17360, 353, 17360, 29889, 1493, 29898, 2848, 29892, 289, 334, 285, 29892, 274, 29892, 298, 29892, 281, 29897, 29871, 396, 6479, 271, 599, 323, 29892, 29933, 408, 5004, 14030, 690, 14443, 278, 4559, 29897, 13, 4706, 6374, 353, 3509, 29889, 24535, 8552, 29898, 25367, 29897, 13, 4706, 13962, 353, 11916, 29889, 3286, 29880, 800, 13, 4706, 13733, 353, 11916, 29889, 5450, 800, 13, 4706, 3158, 353, 4842, 305, 29889, 4117, 3552, 3286, 18411, 29892, 13733, 511, 3964, 10457, 29896, 29897, 13, 13, 4706, 565, 1583, 29889, 8172, 29918, 10889, 29918, 22795, 1405, 29871, 29900, 4898, 13, 9651, 17360, 353, 4036, 29918, 10889, 29898, 13, 18884, 527, 3174, 29922, 25367, 29892, 13, 18884, 17132, 29922, 1311, 29889, 8172, 29918, 10889, 29918, 8305, 29892, 13, 18884, 2070, 29922, 1311, 29889, 8172, 29918, 10889, 29918, 22795, 29892, 13, 9651, 1723, 13, 9651, 6374, 353, 4036, 29918, 10889, 29898, 13, 18884, 527, 3174, 29922, 1066, 3321, 29892, 13, 18884, 17132, 29922, 1311, 29889, 8172, 29918, 10889, 29918, 8305, 29892, 13, 18884, 2070, 29922, 1311, 29889, 8172, 29918, 10889, 29918, 22795, 29892, 13, 9651, 1723, 13, 13, 4706, 396, 5807, 287, 263, 18761, 310, 12489, 313, 25367, 29892, 1400, 573, 29897, 304, 4742, 322, 736, 263, 18761, 13, 4706, 17360, 29892, 6374, 29892, 3158, 353, 6835, 29918, 517, 3552, 25367, 29892, 6374, 29892, 3158, 511, 4742, 29922, 1311, 29889, 10141, 29897, 13, 13, 4706, 411, 4842, 305, 29889, 1217, 29918, 5105, 7295, 13, 9651, 503, 29918, 1066, 3321, 29892, 503, 29918, 20580, 29918, 1066, 3321, 353, 1583, 29889, 5182, 29918, 3977, 6119, 29898, 1066, 3321, 29897, 13, 13, 4706, 503, 29918, 25367, 29892, 503, 29918, 20580, 29918, 25367, 353, 1583, 29889, 3977, 6119, 29898, 25367, 29897, 13, 13, 4706, 7689, 29918, 6758, 29892, 4450, 29918, 5753, 2002, 2478, 353, 1583, 29889, 15099, 29918, 6758, 29898, 29920, 29918, 25367, 29892, 503, 29918, 1066, 3321, 29892, 3158, 29897, 13, 4706, 12814, 29918, 6758, 29892, 12814, 29918, 562, 2764, 4135, 353, 1583, 29889, 9996, 579, 29918, 6758, 29898, 29920, 29918, 25367, 29892, 503, 29918, 1066, 3321, 29897, 13, 4706, 6410, 353, 7689, 29918, 6758, 718, 12814, 29918, 6758, 13, 13, 4706, 736, 6410, 29892, 7689, 29918, 6758, 29892, 12814, 29918, 6758, 29892, 4450, 29918, 5753, 2002, 2478, 29892, 12814, 29918, 562, 2764, 4135, 13, 13, 1678, 822, 7689, 29918, 6758, 29898, 1311, 29892, 503, 29918, 25367, 29892, 503, 29918, 1066, 3321, 29892, 3158, 1125, 13, 4706, 364, 15755, 29918, 2080, 353, 4842, 305, 29889, 4117, 3552, 29920, 29918, 25367, 29892, 3158, 511, 3964, 10457, 29896, 29897, 13, 4706, 274, 29918, 25367, 29892, 903, 353, 1583, 29889, 26193, 1061, 29918, 29878, 15755, 29898, 29878, 15755, 29918, 2080, 29897, 13, 4706, 396, 7338, 1461, 871, 278, 6743, 304, 7945, 313, 497, 892, 4312, 304, 10272, 467, 13, 4706, 274, 29918, 25367, 353, 274, 29918, 25367, 29961, 1311, 29889, 29893, 2817, 786, 29918, 29911, 17531, 13, 4706, 503, 29918, 1066, 3321, 353, 503, 29918, 1066, 3321, 29889, 4801, 496, 580, 29961, 1311, 29889, 29893, 2817, 786, 29918, 29911, 17531, 13, 13, 4706, 323, 29892, 350, 29892, 796, 353, 503, 29918, 1066, 3321, 29889, 12181, 13, 4706, 3646, 29918, 3286, 353, 503, 29918, 1066, 3321, 29889, 1493, 6278, 29896, 29892, 796, 467, 3286, 4220, 29898, 29896, 29892, 29871, 29900, 29897, 13, 4706, 2967, 29918, 21134, 353, 4842, 305, 29889, 279, 927, 29898, 29911, 334, 350, 29892, 26688, 29922, 7345, 305, 29889, 5426, 29892, 4742, 29922, 1311, 29889, 10141, 467, 1493, 29898, 29911, 29892, 350, 29897, 13, 4706, 18988, 29918, 1761, 353, 1051, 580, 13, 4706, 3858, 29918, 1761, 353, 1051, 580, 13, 4706, 396, 515, 29871, 29896, 6375, 4331, 304, 323, 29899, 29896, 6375, 4331, 13, 4706, 363, 19471, 29918, 29873, 297, 3464, 29898, 29896, 29892, 323, 1125, 13, 9651, 18988, 29918, 1761, 29889, 4397, 29898, 1311, 29889, 9067, 29879, 29961, 4181, 29918, 29873, 850, 29883, 29918, 25367, 7503, 29899, 4181, 29918, 29873, 1822, 1493, 6278, 29896, 29892, 796, 4961, 13, 9651, 3858, 29918, 1761, 29889, 4397, 29898, 3188, 29918, 21134, 29961, 4181, 29918, 29873, 29901, 1822, 1493, 6278, 29896, 876, 13, 13, 4706, 6375, 29918, 24530, 353, 518, 29900, 29962, 718, 518, 2435, 29898, 1643, 29897, 363, 3858, 297, 3858, 29918, 1761, 29962, 13, 4706, 13299, 28524, 29918, 11333, 29918, 24530, 353, 4842, 305, 29889, 29883, 398, 2083, 29898, 7345, 305, 29889, 20158, 29898, 11333, 29918, 24530, 511, 3964, 29922, 29900, 29897, 13, 13, 4706, 396, 3001, 27303, 11000, 29901, 349, 29922, 29911, 16395, 29911, 29899, 29896, 6802, 29906, 29930, 29933, 13, 4706, 544, 8977, 1080, 353, 4842, 305, 29889, 4117, 29898, 11965, 2463, 29918, 1761, 29897, 29871, 396, 518, 29925, 29892, 503, 29918, 6229, 29962, 13, 4706, 11073, 353, 4842, 305, 29889, 4117, 29898, 1643, 29918, 1761, 29897, 29871, 396, 518, 29925, 29962, 13, 13, 4706, 1480, 1169, 353, 4842, 305, 29889, 2922, 16109, 29898, 558, 8977, 1080, 29892, 3646, 29918, 3286, 29897, 29871, 396, 518, 29925, 29892, 503, 29918, 6229, 29962, 334, 518, 29920, 29918, 6229, 29892, 323, 29930, 29933, 29962, 13, 4706, 1480, 1169, 353, 1480, 1169, 448, 4842, 305, 29889, 3317, 29898, 1188, 1169, 29892, 3964, 29922, 29896, 29892, 3013, 6229, 29922, 5574, 9601, 29900, 29962, 13, 4706, 7689, 29918, 6758, 353, 1583, 29889, 29883, 29918, 29872, 29918, 6758, 29898, 1188, 1169, 29892, 11073, 29897, 13, 13, 4706, 835, 13383, 13383, 7346, 4136, 29937, 13, 4706, 396, 8147, 278, 18988, 1539, 2126, 13, 4706, 1480, 1169, 29918, 29881, 353, 1480, 1169, 29889, 4801, 496, 580, 13, 4706, 396, 3380, 29892, 1095, 29892, 4331, 313, 3204, 11249, 1360, 11249, 515, 697, 4331, 6375, 27303, 1432, 29871, 29946, 6576, 1125, 13, 4706, 289, 29892, 321, 29892, 269, 353, 13299, 28524, 29918, 11333, 29918, 24530, 29961, 29900, 1402, 13299, 28524, 29918, 11333, 29918, 24530, 29961, 29896, 1402, 29871, 29946, 29871, 396, 19471, 29918, 29873, 353, 29871, 29896, 13, 4706, 1480, 1169, 29896, 29892, 11073, 29896, 353, 1480, 1169, 29918, 29881, 29961, 29890, 29901, 29872, 29901, 29879, 1402, 11073, 29961, 29890, 29901, 29872, 29901, 29879, 29962, 13, 4706, 1959, 29896, 353, 4842, 305, 29889, 1191, 3317, 29898, 1188, 1169, 29896, 29892, 3964, 29922, 29896, 29897, 1275, 11073, 29896, 13, 4706, 13600, 29896, 353, 2854, 29918, 12676, 29898, 15728, 29896, 29889, 7411, 3285, 2854, 29922, 21134, 29896, 6736, 29871, 29900, 29897, 29871, 396, 306, 29954, 6632, 1525, 10457, 29896, 29900, 29900, 13, 13, 4706, 289, 29892, 321, 29892, 269, 353, 13299, 28524, 29918, 11333, 29918, 24530, 29961, 29896, 1402, 13299, 28524, 29918, 11333, 29918, 24530, 29961, 29906, 1402, 29871, 29946, 29871, 396, 19471, 29918, 29873, 353, 29871, 29906, 13, 4706, 1480, 1169, 29906, 29892, 11073, 29906, 353, 1480, 1169, 29918, 29881, 29961, 29890, 29901, 29872, 29901, 29879, 1402, 11073, 29961, 29890, 29901, 29872, 29901, 29879, 29962, 13, 4706, 1959, 29906, 353, 4842, 305, 29889, 1191, 3317, 29898, 1188, 1169, 29906, 29892, 3964, 29922, 29896, 29897, 1275, 11073, 29906, 13, 4706, 13600, 29906, 353, 2854, 29918, 12676, 29898, 15728, 29906, 29889, 7411, 3285, 2854, 29922, 21134, 29906, 6736, 29871, 29900, 29897, 13, 13, 4706, 289, 29892, 321, 29892, 269, 353, 13299, 28524, 29918, 11333, 29918, 24530, 14352, 29906, 1402, 13299, 28524, 29918, 11333, 29918, 24530, 14352, 29896, 1402, 29871, 29896, 29871, 396, 19471, 29918, 29873, 353, 323, 448, 29871, 29896, 13, 4706, 1480, 1169, 29911, 29896, 29892, 11073, 29911, 29896, 353, 1480, 1169, 29918, 29881, 29961, 29890, 29901, 29872, 29901, 29879, 1402, 11073, 29961, 29890, 29901, 29872, 29901, 29879, 29962, 13, 4706, 1959, 29911, 29896, 353, 4842, 305, 29889, 1191, 3317, 29898, 1188, 1169, 29911, 29896, 29892, 3964, 29922, 29896, 29897, 1275, 11073, 29911, 29896, 13, 4706, 13600, 29911, 29896, 353, 2854, 29918, 12676, 29898, 15728, 29911, 29896, 29889, 7411, 3285, 2854, 29922, 21134, 29911, 29896, 6736, 29871, 29900, 29897, 13, 13, 4706, 289, 29892, 321, 29892, 269, 353, 13299, 28524, 29918, 11333, 29918, 24530, 14352, 29941, 1402, 13299, 28524, 29918, 11333, 29918, 24530, 14352, 29906, 1402, 29871, 29896, 29871, 396, 19471, 29918, 29873, 353, 323, 448, 29871, 29906, 13, 4706, 1480, 1169, 29911, 29906, 29892, 11073, 29911, 29906, 353, 1480, 1169, 29918, 29881, 29961, 29890, 29901, 29872, 29901, 29879, 1402, 11073, 29961, 29890, 29901, 29872, 29901, 29879, 29962, 13, 4706, 1959, 29911, 29906, 353, 4842, 305, 29889, 1191, 3317, 29898, 1188, 1169, 29911, 29906, 29892, 3964, 29922, 29896, 29897, 1275, 11073, 29911, 29906, 13, 4706, 13600, 29911, 29906, 353, 2854, 29918, 12676, 29898, 15728, 29911, 29906, 29889, 7411, 3285, 2854, 29922, 21134, 29911, 29906, 6736, 29871, 29900, 29897, 13, 4706, 1035, 2002, 2478, 353, 313, 562, 2764, 4135, 29896, 29892, 13600, 29906, 29892, 13600, 29911, 29896, 29892, 13600, 29911, 29906, 29897, 13, 4706, 736, 7689, 29918, 6758, 29892, 1035, 2002, 2478, 13, 13, 1678, 822, 12814, 29918, 6758, 29898, 1311, 29892, 503, 29918, 25367, 29892, 503, 29918, 1066, 3321, 1125, 13, 4706, 323, 29892, 350, 29892, 3405, 296, 29918, 6229, 353, 503, 29918, 25367, 29889, 12181, 13, 4706, 503, 29918, 1066, 3321, 29918, 3286, 353, 503, 29918, 1066, 3321, 29889, 4801, 496, 2141, 1493, 6278, 29896, 29892, 3405, 296, 29918, 6229, 467, 3286, 4220, 29898, 29896, 29892, 29871, 29900, 29897, 29871, 396, 518, 5066, 296, 29918, 6229, 29892, 323, 29930, 29933, 29962, 13, 4706, 11073, 353, 4842, 305, 29889, 279, 927, 29898, 29911, 334, 350, 29892, 26688, 29922, 7345, 305, 29889, 5426, 29892, 4742, 29922, 1311, 29889, 10141, 29897, 13, 4706, 4450, 353, 1583, 29889, 1609, 324, 29918, 10660, 29918, 3286, 29898, 29920, 29918, 25367, 467, 1493, 6278, 29896, 29892, 3405, 296, 29918, 6229, 29897, 13, 4706, 1480, 1169, 353, 4842, 305, 29889, 2922, 16109, 29898, 11965, 29892, 503, 29918, 1066, 3321, 29918, 3286, 29897, 29871, 396, 518, 29911, 29930, 29933, 29892, 323, 29930, 29933, 29962, 13, 4706, 1480, 1169, 353, 1480, 1169, 448, 4842, 305, 29889, 3317, 29898, 1188, 1169, 29892, 3964, 29922, 29896, 29892, 3013, 6229, 29922, 5574, 9601, 29900, 29962, 13, 4706, 12814, 29918, 6758, 353, 1583, 29889, 29883, 29918, 29872, 29918, 6758, 29898, 1188, 1169, 29892, 11073, 29897, 13, 13, 4706, 1959, 353, 4842, 305, 29889, 1191, 3317, 29898, 1188, 1169, 29889, 4801, 496, 3285, 3964, 29922, 29896, 29897, 1275, 11073, 13, 4706, 12814, 29918, 562, 2764, 4135, 353, 4842, 305, 29889, 12676, 29898, 15728, 29889, 7411, 3101, 13, 13, 4706, 736, 12814, 29918, 6758, 29892, 12814, 29918, 562, 2764, 4135, 13, 13, 1678, 822, 8845, 29898, 1311, 29892, 372, 29878, 1125, 13, 4706, 1209, 13, 13, 1678, 822, 2106, 29918, 8977, 29898, 1311, 1125, 13, 4706, 736, 9657, 29898, 13, 9651, 2094, 6119, 29922, 1311, 29889, 3977, 6119, 29889, 3859, 29918, 8977, 3285, 13, 9651, 3646, 29918, 3977, 6119, 29922, 1311, 29889, 5182, 29918, 3977, 6119, 29889, 3859, 29918, 8977, 3285, 13, 9651, 11404, 1061, 29918, 29878, 15755, 29922, 1311, 29889, 26193, 1061, 29918, 29878, 15755, 29889, 3859, 29918, 8977, 3285, 13, 9651, 5994, 3950, 29922, 1311, 29889, 20640, 3950, 29889, 3859, 29918, 8977, 3285, 13, 4706, 1723, 13, 13, 1678, 822, 2254, 29918, 3859, 29918, 8977, 29898, 1311, 29892, 2106, 29918, 8977, 1125, 13, 4706, 1583, 29889, 3977, 6119, 29889, 1359, 29918, 3859, 29918, 8977, 29898, 3859, 29918, 8977, 3366, 3977, 6119, 20068, 13, 4706, 1583, 29889, 5182, 29918, 3977, 6119, 29889, 1359, 29918, 3859, 29918, 8977, 29898, 3859, 29918, 8977, 3366, 5182, 29918, 3977, 6119, 20068, 13, 4706, 1583, 29889, 26193, 1061, 29918, 29878, 15755, 29889, 1359, 29918, 3859, 29918, 8977, 29898, 3859, 29918, 8977, 1839, 26193, 1061, 29918, 29878, 15755, 11287, 13, 4706, 1583, 29889, 20640, 3950, 29889, 1359, 29918, 3859, 29918, 8977, 29898, 3859, 29918, 8977, 3366, 20640, 3950, 20068, 13, 13, 1678, 822, 4128, 29898, 1311, 1125, 13, 4706, 7709, 515, 1583, 29889, 3977, 6119, 29889, 16744, 580, 13, 4706, 7709, 515, 1583, 29889, 26193, 1061, 29918, 29878, 15755, 29889, 16744, 580, 13, 4706, 7709, 515, 1583, 29889, 9067, 29879, 29889, 16744, 580, 13, 4706, 7709, 515, 1583, 29889, 1609, 324, 29918, 10660, 29918, 3286, 29889, 16744, 580, 13, 13, 1678, 822, 4257, 29918, 16744, 29898, 1311, 1125, 13, 4706, 9995, 1762, 2758, 21166, 491, 1024, 297, 7688, 20228, 1213, 15945, 13, 4706, 7709, 515, 1583, 29889, 3977, 6119, 29889, 17514, 29918, 16744, 580, 13, 4706, 7709, 515, 1583, 29889, 26193, 1061, 29918, 29878, 15755, 29889, 17514, 29918, 16744, 580, 13, 4706, 7709, 515, 1583, 29889, 9067, 29879, 29889, 17514, 29918, 16744, 580, 13, 4706, 7709, 515, 1583, 29889, 1609, 324, 29918, 10660, 29918, 3286, 29889, 17514, 29918, 16744, 580, 13, 13, 1678, 822, 19745, 29898, 1311, 1125, 13, 4706, 1583, 29889, 3977, 6119, 29889, 14513, 580, 29871, 396, 297, 1206, 310, 9853, 6056, 13, 4706, 1583, 29889, 26193, 1061, 29918, 29878, 15755, 29889, 14513, 580, 13, 4706, 1583, 29889, 9067, 29879, 29889, 14513, 580, 13, 4706, 1583, 29889, 1609, 324, 29918, 10660, 29918, 3286, 29889, 14513, 580, 13, 13, 1678, 822, 7945, 29898, 1311, 1125, 13, 4706, 1583, 29889, 3977, 6119, 29889, 14968, 580, 13, 4706, 1583, 29889, 26193, 1061, 29918, 29878, 15755, 29889, 14968, 580, 13, 4706, 1583, 29889, 9067, 29879, 29889, 14968, 580, 13, 4706, 1583, 29889, 1609, 324, 29918, 10660, 29918, 3286, 29889, 14968, 580, 13, 13, 1678, 822, 2254, 29918, 276, 1456, 29898, 1311, 29892, 15526, 29918, 6451, 29918, 9040, 29922, 8516, 1125, 13, 4706, 17927, 29889, 1188, 877, 23456, 337, 1456, 6835, 2023, 1495, 13, 4706, 1583, 29889, 276, 1456, 29918, 9040, 353, 1583, 29889, 1123, 1456, 29907, 3137, 29898, 6880, 1220, 16390, 294, 1691, 29892, 3579, 1311, 29889, 276, 1456, 29918, 19290, 29897, 13, 4706, 17927, 29889, 1188, 703, 1123, 1456, 6835, 7500, 1159, 13, 4706, 1342, 353, 1583, 29889, 276, 1456, 29918, 9040, 29889, 657, 29918, 4773, 580, 13, 4706, 736, 1342, 13, 2 ]
train-xception.py
jGsch/kaggle-dfdc
124
38679
<filename>train-xception.py<gh_stars>100-1000 import os import csv import shutil import random from PIL import Image import numpy as np import torch from torch import nn, optim from torch.utils.data import Dataset, DataLoader import xception_conf as config from model_def import xception from augmentation_utils import train_transform, val_transform def save_checkpoint(path, state_dict, epoch=0, arch="", acc1=0): new_state_dict = {} for k, v in state_dict.items(): if k.startswith("module."): k = k[7:] if torch.is_tensor(v): v = v.cpu() new_state_dict[k] = v torch.save({ "epoch": epoch, "arch": arch, "acc1": acc1, "state_dict": new_state_dict, }, path) class DFDCDataset(Dataset): def __init__(self, data_csv, required_set, data_root="", ratio=(0.25, 0.05), stable=False, transform=None): video_info = [] data_list = [] with open(data_csv) as fin: reader = csv.DictReader(fin) for row in reader: if row["set_name"] == required_set: label = int(row["is_fake"]) n_frame = int(row["n_frame"]) select_frame = round(n_frame * ratio[label]) for sample_idx in range(select_frame): data_list.append((len(video_info), sample_idx)) video_info.append({ "name": row["name"], "label": label, "n_frame": n_frame, "select_frame": select_frame, }) self.stable = stable self.data_root = data_root self.video_info = video_info self.data_list = data_list self.transform = transform def __getitem__(self, index): video_idx, sample_idx = self.data_list[index] info = self.video_info[video_idx] if self.stable: frame_idx = info["n_frame"] * sample_idx // info["select_frame"] else: frame_idx = random.randint(0, info["n_frame"] - 1) image_path = os.path.join(self.data_root, info["name"], "%03d.png" % frame_idx) try: img = Image.open(image_path).convert("RGB") except OSError: img = np.random.randint(0, 255, (320, 320, 3), dtype=np.uint8) if self.transform is not None: # img = self.transform(img) result = self.transform(image=np.array(img)) img = result["image"] return img, info["label"] def __len__(self): return len(self.data_list) def main(): torch.backends.cudnn.benchmark = True train_dataset = DFDCDataset(config.data_list, "train", config.data_root, transform=train_transform) val_dataset = DFDCDataset(config.data_list, "val", config.data_root, transform=val_transform, stable=True) kwargs = dict(batch_size=config.batch_size, num_workers=config.num_workers, shuffle=True, pin_memory=True) train_loader = DataLoader(train_dataset, **kwargs) val_loader = DataLoader(val_dataset, **kwargs) # Model initialization model = xception(num_classes=2, pretrained=None) if hasattr(config, "resume") and os.path.isfile(config.resume): ckpt = torch.load(config.resume, map_location="cpu") start_epoch = ckpt.get("epoch", 0) best_acc = ckpt.get("acc1", 0.0) model.load_state_dict(ckpt["state_dict"]) else: start_epoch = 0 best_acc = 0.0 model = model.cuda() model = nn.DataParallel(model) criterion = nn.CrossEntropyLoss() optimizer = optim.SGD(model.parameters(), 0.01, momentum=0.9, weight_decay=1e-4) scheduler = optim.lr_scheduler.StepLR(optimizer, step_size=2, gamma=0.2) os.makedirs(config.save_dir, exist_ok=True) for epoch in range(config.n_epoches): if epoch < start_epoch: scheduler.step() continue print("Epoch {}".format(epoch + 1)) model.train() loss_record = [] acc_record = [] for count, (inputs, labels) in enumerate(train_loader): inputs = inputs.cuda(non_blocking=True) labels = labels.cuda(non_blocking=True) outputs = model(inputs) loss = criterion(outputs, labels) optimizer.zero_grad() loss.backward() optimizer.step() iter_loss = loss.item() loss_record.append(iter_loss) preds = torch.argmax(outputs.data, 1) iter_acc = torch.sum(preds == labels).item() / len(preds) acc_record.append(iter_acc) if count and count % 100 == 0: print("T-Iter %d: loss=%.4f, acc=%.4f" % (count, iter_loss, iter_acc)) epoch_loss = np.mean(loss_record) epoch_acc = np.mean(acc_record) print("Training: loss=%.4f, acc=%.4f" % (epoch_loss, epoch_acc)) model.eval() loss_record = [] acc_record = [] with torch.no_grad(): for count, (inputs, labels) in enumerate(val_loader): inputs = inputs.cuda(non_blocking=True) labels = labels.cuda(non_blocking=True) outputs = model(inputs) preds = torch.argmax(outputs, 1) loss = criterion(outputs, labels) iter_loss = loss.item() loss_record.append(iter_loss) preds = torch.argmax(outputs.data, 1) iter_acc = torch.sum(preds == labels).item() / len(preds) acc_record.append(iter_acc) if count and count % 100 == 0: print("V-Iter %d: loss=%.4f, acc=%.4f" % (count, iter_loss, iter_acc)) epoch_loss = np.mean(loss_record) epoch_acc = np.mean(acc_record) print("Validation: loss=%.4f, acc=%.4f" % (epoch_loss, epoch_acc)) scheduler.step() ckpt_path = os.path.join(config.save_dir, "ckpt-%d.pth" % epoch) save_checkpoint( ckpt_path, model.state_dict(), epoch=epoch + 1, acc1=epoch_acc) if epoch_acc > best_acc: print("Best accuracy!") shutil.copy(ckpt_path, os.path.join(config.save_dir, "best.pth")) best_acc = epoch_acc print() if __name__ == "__main__": main()
[ 1, 529, 9507, 29958, 14968, 29899, 29916, 1441, 29889, 2272, 29966, 12443, 29918, 303, 1503, 29958, 29896, 29900, 29900, 29899, 29896, 29900, 29900, 29900, 13, 5215, 2897, 30004, 13, 5215, 11799, 30004, 13, 5215, 528, 4422, 30004, 13, 5215, 4036, 30004, 13, 30004, 13, 3166, 349, 6227, 1053, 7084, 30004, 13, 5215, 12655, 408, 7442, 30004, 13, 5215, 4842, 305, 30004, 13, 3166, 4842, 305, 1053, 302, 29876, 29892, 5994, 30004, 13, 3166, 4842, 305, 29889, 13239, 29889, 1272, 1053, 13373, 24541, 29892, 3630, 10036, 30004, 13, 30004, 13, 5215, 921, 1441, 29918, 5527, 408, 2295, 30004, 13, 3166, 1904, 29918, 1753, 1053, 921, 1441, 30004, 13, 3166, 18765, 362, 29918, 13239, 1053, 7945, 29918, 9067, 29892, 659, 29918, 9067, 30004, 13, 30004, 13, 30004, 13, 1753, 4078, 29918, 3198, 3149, 29898, 2084, 29892, 2106, 29918, 8977, 29892, 21502, 305, 29922, 29900, 29892, 3190, 543, 613, 1035, 29896, 29922, 29900, 1125, 30004, 13, 1678, 716, 29918, 3859, 29918, 8977, 353, 6571, 30004, 13, 1678, 363, 413, 29892, 325, 297, 2106, 29918, 8977, 29889, 7076, 7295, 30004, 13, 4706, 565, 413, 29889, 27382, 2541, 703, 5453, 1213, 1125, 30004, 13, 9651, 413, 353, 413, 29961, 29955, 17531, 30004, 13, 4706, 565, 4842, 305, 29889, 275, 29918, 20158, 29898, 29894, 1125, 30004, 13, 9651, 325, 353, 325, 29889, 21970, 26471, 13, 4706, 716, 29918, 3859, 29918, 8977, 29961, 29895, 29962, 353, 325, 30004, 13, 30004, 13, 1678, 4842, 305, 29889, 7620, 3319, 30004, 13, 4706, 376, 1022, 2878, 1115, 21502, 305, 11167, 13, 4706, 376, 1279, 1115, 3190, 11167, 13, 4706, 376, 5753, 29896, 1115, 1035, 29896, 11167, 13, 4706, 376, 3859, 29918, 8977, 1115, 716, 29918, 3859, 29918, 8977, 11167, 13, 1678, 2981, 2224, 8443, 13, 30004, 13, 30004, 13, 1990, 360, 26453, 6530, 271, 24541, 29898, 16390, 24541, 1125, 30004, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 848, 29918, 7638, 29892, 3734, 29918, 842, 29892, 848, 29918, 4632, 543, 15231, 13, 462, 11959, 7607, 29900, 29889, 29906, 29945, 29892, 29871, 29900, 29889, 29900, 29945, 511, 13714, 29922, 8824, 29892, 4327, 29922, 8516, 1125, 30004, 13, 4706, 4863, 29918, 3888, 353, 5159, 30004, 13, 4706, 848, 29918, 1761, 353, 5159, 30004, 13, 30004, 13, 4706, 411, 1722, 29898, 1272, 29918, 7638, 29897, 408, 1436, 29901, 30004, 13, 9651, 9591, 353, 11799, 29889, 21533, 6982, 29898, 4951, 8443, 13, 30004, 13, 9651, 363, 1948, 297, 9591, 29901, 30004, 13, 18884, 565, 1948, 3366, 842, 29918, 978, 3108, 1275, 3734, 29918, 842, 29901, 30004, 13, 462, 1678, 3858, 353, 938, 29898, 798, 3366, 275, 29918, 29888, 1296, 20068, 30004, 13, 462, 1678, 302, 29918, 2557, 353, 938, 29898, 798, 3366, 29876, 29918, 2557, 20068, 30004, 13, 462, 1678, 1831, 29918, 2557, 353, 4513, 29898, 29876, 29918, 2557, 334, 11959, 29961, 1643, 2314, 30004, 13, 30004, 13, 462, 1678, 363, 4559, 29918, 13140, 297, 3464, 29898, 2622, 29918, 2557, 1125, 30004, 13, 462, 4706, 848, 29918, 1761, 29889, 4397, 3552, 2435, 29898, 9641, 29918, 3888, 511, 4559, 29918, 13140, 876, 30004, 13, 30004, 13, 462, 1678, 4863, 29918, 3888, 29889, 4397, 3319, 30004, 13, 462, 4706, 376, 978, 1115, 1948, 3366, 978, 12436, 30004, 13, 462, 4706, 376, 1643, 1115, 3858, 11167, 13, 462, 4706, 376, 29876, 29918, 2557, 1115, 302, 29918, 2557, 11167, 13, 462, 4706, 376, 2622, 29918, 2557, 1115, 1831, 29918, 2557, 11167, 13, 462, 1678, 5615, 30004, 13, 30004, 13, 4706, 1583, 29889, 13844, 353, 13714, 30004, 13, 4706, 1583, 29889, 1272, 29918, 4632, 353, 848, 29918, 4632, 30004, 13, 4706, 1583, 29889, 9641, 29918, 3888, 353, 4863, 29918, 3888, 30004, 13, 4706, 1583, 29889, 1272, 29918, 1761, 353, 848, 29918, 1761, 30004, 13, 4706, 1583, 29889, 9067, 353, 4327, 30004, 13, 30004, 13, 1678, 822, 4770, 657, 667, 12035, 1311, 29892, 2380, 1125, 30004, 13, 4706, 4863, 29918, 13140, 29892, 4559, 29918, 13140, 353, 1583, 29889, 1272, 29918, 1761, 29961, 2248, 29962, 30004, 13, 4706, 5235, 353, 1583, 29889, 9641, 29918, 3888, 29961, 9641, 29918, 13140, 29962, 30004, 13, 30004, 13, 4706, 565, 1583, 29889, 13844, 29901, 30004, 13, 9651, 3515, 29918, 13140, 353, 5235, 3366, 29876, 29918, 2557, 3108, 334, 4559, 29918, 13140, 849, 5235, 3366, 2622, 29918, 2557, 3108, 30004, 13, 4706, 1683, 29901, 30004, 13, 9651, 3515, 29918, 13140, 353, 4036, 29889, 9502, 524, 29898, 29900, 29892, 5235, 3366, 29876, 29918, 2557, 3108, 448, 29871, 29896, 8443, 13, 30004, 13, 4706, 1967, 29918, 2084, 353, 2897, 29889, 2084, 29889, 7122, 29898, 1311, 29889, 1272, 29918, 4632, 29892, 5235, 3366, 978, 12436, 30004, 13, 462, 462, 29871, 11860, 29900, 29941, 29881, 29889, 2732, 29908, 1273, 3515, 29918, 13140, 8443, 13, 4706, 1018, 29901, 30004, 13, 9651, 10153, 353, 7084, 29889, 3150, 29898, 3027, 29918, 2084, 467, 13441, 703, 28212, 1159, 30004, 13, 4706, 5174, 438, 29173, 29901, 30004, 13, 9651, 10153, 353, 7442, 29889, 8172, 29889, 9502, 524, 29898, 29900, 29892, 29871, 29906, 29945, 29945, 29892, 313, 29941, 29906, 29900, 29892, 29871, 29941, 29906, 29900, 29892, 29871, 29941, 511, 26688, 29922, 9302, 29889, 13470, 29947, 8443, 13, 30004, 13, 4706, 565, 1583, 29889, 9067, 338, 451, 6213, 29901, 30004, 13, 9651, 396, 10153, 353, 1583, 29889, 9067, 29898, 2492, 8443, 13, 9651, 1121, 353, 1583, 29889, 9067, 29898, 3027, 29922, 9302, 29889, 2378, 29898, 2492, 876, 30004, 13, 9651, 10153, 353, 1121, 3366, 3027, 3108, 30004, 13, 30004, 13, 4706, 736, 10153, 29892, 5235, 3366, 1643, 3108, 30004, 13, 30004, 13, 1678, 822, 4770, 2435, 12035, 1311, 1125, 30004, 13, 4706, 736, 7431, 29898, 1311, 29889, 1272, 29918, 1761, 8443, 13, 30004, 13, 30004, 13, 1753, 1667, 7295, 30004, 13, 1678, 4842, 305, 29889, 1627, 1975, 29889, 29883, 566, 15755, 29889, 1785, 16580, 353, 5852, 30004, 13, 30004, 13, 1678, 7945, 29918, 24713, 353, 360, 26453, 6530, 271, 24541, 29898, 2917, 29889, 1272, 29918, 1761, 29892, 376, 14968, 613, 2295, 29889, 1272, 29918, 4632, 11167, 13, 462, 18884, 4327, 29922, 14968, 29918, 9067, 8443, 13, 1678, 659, 29918, 24713, 353, 360, 26453, 6530, 271, 24541, 29898, 2917, 29889, 1272, 29918, 1761, 29892, 376, 791, 613, 2295, 29889, 1272, 29918, 4632, 11167, 13, 462, 795, 4327, 29922, 791, 29918, 9067, 29892, 13714, 29922, 5574, 8443, 13, 30004, 13, 1678, 9049, 5085, 353, 9657, 29898, 16175, 29918, 2311, 29922, 2917, 29889, 16175, 29918, 2311, 29892, 954, 29918, 1287, 414, 29922, 2917, 29889, 1949, 29918, 1287, 414, 11167, 13, 462, 29871, 528, 21897, 29922, 5574, 29892, 12534, 29918, 14834, 29922, 5574, 8443, 13, 1678, 7945, 29918, 12657, 353, 3630, 10036, 29898, 14968, 29918, 24713, 29892, 3579, 19290, 8443, 13, 1678, 659, 29918, 12657, 353, 3630, 10036, 29898, 791, 29918, 24713, 29892, 3579, 19290, 8443, 13, 30004, 13, 1678, 396, 8125, 17865, 30004, 13, 1678, 1904, 353, 921, 1441, 29898, 1949, 29918, 13203, 29922, 29906, 29892, 758, 3018, 1312, 29922, 8516, 8443, 13, 30004, 13, 1678, 565, 756, 5552, 29898, 2917, 29892, 376, 690, 2017, 1159, 322, 2897, 29889, 2084, 29889, 275, 1445, 29898, 2917, 29889, 690, 2017, 1125, 30004, 13, 4706, 274, 29895, 415, 353, 4842, 305, 29889, 1359, 29898, 2917, 29889, 690, 2017, 29892, 2910, 29918, 5479, 543, 21970, 1159, 30004, 13, 4706, 1369, 29918, 1022, 2878, 353, 274, 29895, 415, 29889, 657, 703, 1022, 2878, 613, 29871, 29900, 8443, 13, 4706, 1900, 29918, 5753, 353, 274, 29895, 415, 29889, 657, 703, 5753, 29896, 613, 29871, 29900, 29889, 29900, 8443, 13, 4706, 1904, 29889, 1359, 29918, 3859, 29918, 8977, 29898, 384, 415, 3366, 3859, 29918, 8977, 20068, 30004, 13, 1678, 1683, 29901, 30004, 13, 4706, 1369, 29918, 1022, 2878, 353, 29871, 29900, 30004, 13, 4706, 1900, 29918, 5753, 353, 29871, 29900, 29889, 29900, 30004, 13, 30004, 13, 1678, 1904, 353, 1904, 29889, 29883, 6191, 26471, 13, 1678, 1904, 353, 302, 29876, 29889, 1469, 2177, 6553, 29898, 4299, 8443, 13, 30004, 13, 1678, 28770, 291, 353, 302, 29876, 29889, 29907, 2124, 5292, 14441, 29931, 2209, 26471, 13, 1678, 5994, 3950, 353, 5994, 29889, 26016, 29928, 29898, 4299, 29889, 16744, 3285, 30004, 13, 462, 965, 29900, 29889, 29900, 29896, 29892, 19399, 29922, 29900, 29889, 29929, 29892, 7688, 29918, 7099, 388, 29922, 29896, 29872, 29899, 29946, 8443, 13, 1678, 1364, 14952, 353, 5994, 29889, 29212, 29918, 816, 14952, 29889, 14448, 29519, 29898, 20640, 3950, 29892, 4331, 29918, 2311, 29922, 29906, 29892, 330, 2735, 29922, 29900, 29889, 29906, 8443, 13, 30004, 13, 1678, 2897, 29889, 29885, 12535, 12935, 29898, 2917, 29889, 7620, 29918, 3972, 29892, 1863, 29918, 554, 29922, 5574, 8443, 13, 30004, 13, 1678, 363, 21502, 305, 297, 3464, 29898, 2917, 29889, 29876, 29918, 1022, 2878, 267, 1125, 30004, 13, 4706, 565, 21502, 305, 529, 1369, 29918, 1022, 2878, 29901, 30004, 13, 9651, 1364, 14952, 29889, 10568, 26471, 13, 9651, 6773, 30004, 13, 30004, 13, 4706, 1596, 703, 29923, 1129, 305, 6571, 1642, 4830, 29898, 1022, 2878, 718, 29871, 29896, 876, 30004, 13, 30004, 13, 4706, 1904, 29889, 14968, 26471, 13, 30004, 13, 4706, 6410, 29918, 11651, 353, 5159, 30004, 13, 4706, 1035, 29918, 11651, 353, 5159, 30004, 13, 30004, 13, 4706, 363, 2302, 29892, 313, 2080, 29879, 29892, 11073, 29897, 297, 26985, 29898, 14968, 29918, 12657, 1125, 30004, 13, 9651, 10970, 353, 10970, 29889, 29883, 6191, 29898, 5464, 29918, 1271, 292, 29922, 5574, 8443, 13, 9651, 11073, 353, 11073, 29889, 29883, 6191, 29898, 5464, 29918, 1271, 292, 29922, 5574, 8443, 13, 30004, 13, 9651, 14391, 353, 1904, 29898, 2080, 29879, 8443, 13, 9651, 6410, 353, 28770, 291, 29898, 4905, 29879, 29892, 11073, 8443, 13, 30004, 13, 9651, 5994, 3950, 29889, 9171, 29918, 5105, 26471, 13, 9651, 6410, 29889, 1627, 1328, 26471, 13, 9651, 5994, 3950, 29889, 10568, 26471, 13, 30004, 13, 9651, 4256, 29918, 6758, 353, 6410, 29889, 667, 26471, 13, 9651, 6410, 29918, 11651, 29889, 4397, 29898, 1524, 29918, 6758, 8443, 13, 30004, 13, 9651, 4450, 29879, 353, 4842, 305, 29889, 1191, 3317, 29898, 4905, 29879, 29889, 1272, 29892, 29871, 29896, 8443, 13, 9651, 4256, 29918, 5753, 353, 4842, 305, 29889, 2083, 29898, 11965, 29879, 1275, 11073, 467, 667, 580, 847, 7431, 29898, 11965, 29879, 8443, 13, 9651, 1035, 29918, 11651, 29889, 4397, 29898, 1524, 29918, 5753, 8443, 13, 30004, 13, 9651, 565, 2302, 322, 2302, 1273, 29871, 29896, 29900, 29900, 1275, 29871, 29900, 29901, 30004, 13, 18884, 1596, 703, 29911, 29899, 13463, 1273, 29881, 29901, 6410, 29922, 15543, 29946, 29888, 29892, 1035, 29922, 15543, 29946, 29888, 19451, 13, 462, 418, 1273, 313, 2798, 29892, 4256, 29918, 6758, 29892, 4256, 29918, 5753, 876, 30004, 13, 30004, 13, 4706, 21502, 305, 29918, 6758, 353, 7442, 29889, 12676, 29898, 6758, 29918, 11651, 8443, 13, 4706, 21502, 305, 29918, 5753, 353, 7442, 29889, 12676, 29898, 5753, 29918, 11651, 8443, 13, 4706, 1596, 703, 5323, 2827, 29901, 6410, 29922, 15543, 29946, 29888, 29892, 1035, 29922, 15543, 29946, 29888, 29908, 1273, 313, 1022, 2878, 29918, 6758, 29892, 21502, 305, 29918, 5753, 876, 30004, 13, 30004, 13, 4706, 1904, 29889, 14513, 26471, 13, 4706, 6410, 29918, 11651, 353, 5159, 30004, 13, 4706, 1035, 29918, 11651, 353, 5159, 30004, 13, 30004, 13, 4706, 411, 4842, 305, 29889, 1217, 29918, 5105, 7295, 30004, 13, 9651, 363, 2302, 29892, 313, 2080, 29879, 29892, 11073, 29897, 297, 26985, 29898, 791, 29918, 12657, 1125, 30004, 13, 18884, 10970, 353, 10970, 29889, 29883, 6191, 29898, 5464, 29918, 1271, 292, 29922, 5574, 8443, 13, 18884, 11073, 353, 11073, 29889, 29883, 6191, 29898, 5464, 29918, 1271, 292, 29922, 5574, 8443, 13, 30004, 13, 18884, 14391, 353, 1904, 29898, 2080, 29879, 8443, 13, 18884, 4450, 29879, 353, 4842, 305, 29889, 1191, 3317, 29898, 4905, 29879, 29892, 29871, 29896, 8443, 13, 30004, 13, 18884, 6410, 353, 28770, 291, 29898, 4905, 29879, 29892, 11073, 8443, 13, 30004, 13, 18884, 4256, 29918, 6758, 353, 6410, 29889, 667, 26471, 13, 18884, 6410, 29918, 11651, 29889, 4397, 29898, 1524, 29918, 6758, 8443, 13, 30004, 13, 18884, 4450, 29879, 353, 4842, 305, 29889, 1191, 3317, 29898, 4905, 29879, 29889, 1272, 29892, 29871, 29896, 8443, 13, 18884, 4256, 29918, 5753, 353, 4842, 305, 29889, 2083, 29898, 11965, 29879, 1275, 11073, 467, 667, 580, 847, 7431, 29898, 11965, 29879, 8443, 13, 18884, 1035, 29918, 11651, 29889, 4397, 29898, 1524, 29918, 5753, 8443, 13, 30004, 13, 18884, 565, 2302, 322, 2302, 1273, 29871, 29896, 29900, 29900, 1275, 29871, 29900, 29901, 30004, 13, 462, 1678, 1596, 703, 29963, 29899, 13463, 1273, 29881, 29901, 6410, 29922, 15543, 29946, 29888, 29892, 1035, 29922, 15543, 29946, 29888, 19451, 13, 462, 3986, 1273, 313, 2798, 29892, 4256, 29918, 6758, 29892, 4256, 29918, 5753, 876, 30004, 13, 30004, 13, 9651, 21502, 305, 29918, 6758, 353, 7442, 29889, 12676, 29898, 6758, 29918, 11651, 8443, 13, 9651, 21502, 305, 29918, 5753, 353, 7442, 29889, 12676, 29898, 5753, 29918, 11651, 8443, 13, 9651, 1596, 703, 19448, 29901, 6410, 29922, 15543, 29946, 29888, 29892, 1035, 29922, 15543, 29946, 29888, 29908, 1273, 313, 1022, 2878, 29918, 6758, 29892, 21502, 305, 29918, 5753, 876, 30004, 13, 30004, 13, 9651, 1364, 14952, 29889, 10568, 26471, 13, 9651, 274, 29895, 415, 29918, 2084, 353, 2897, 29889, 2084, 29889, 7122, 29898, 2917, 29889, 7620, 29918, 3972, 29892, 376, 384, 415, 19222, 29881, 29889, 29886, 386, 29908, 1273, 21502, 305, 8443, 13, 9651, 4078, 29918, 3198, 3149, 29898, 30004, 13, 18884, 274, 29895, 415, 29918, 2084, 11167, 13, 18884, 1904, 29889, 3859, 29918, 8977, 3285, 30004, 13, 18884, 21502, 305, 29922, 1022, 2878, 718, 29871, 29896, 11167, 13, 18884, 1035, 29896, 29922, 1022, 2878, 29918, 5753, 8443, 13, 30004, 13, 9651, 565, 21502, 305, 29918, 5753, 1405, 1900, 29918, 5753, 29901, 30004, 13, 18884, 1596, 703, 25353, 13600, 29991, 1159, 30004, 13, 18884, 528, 4422, 29889, 8552, 29898, 384, 415, 29918, 2084, 11167, 13, 462, 9651, 2897, 29889, 2084, 29889, 7122, 29898, 2917, 29889, 7620, 29918, 3972, 29892, 376, 13318, 29889, 29886, 386, 5783, 30004, 13, 18884, 1900, 29918, 5753, 353, 21502, 305, 29918, 5753, 30004, 13, 30004, 13, 9651, 1596, 26471, 13, 30004, 13, 30004, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 30004, 13, 1678, 1667, 26471, 13, 2 ]
tests/test_jq_fetcher.py
zillionare/z-quotes
0
141264
#!/usr/bin/env python # -*- coding: utf-8 -*- import logging import os import unittest from unittest import mock import numpy as np import datetime import arrow import jqadaptor from jqadaptor.fetcher import FetcherQuotaError, AccountExpiredError logger = logging.getLogger(__file__) logging.basicConfig(level=logging.INFO) class TestJQ(unittest.IsolatedAsyncioTestCase): fetcher: "QuotesFetcher" # type: ignore # noqa async def asyncSetUp(self) -> None: # pylint: disable=invalid-overridden-method try: account = os.environ["JQ_ACCOUNT"] password = os.environ["JQ_PASSWORD"] blablah = "blahblah" self.fetcher = await jqadaptor.create_instance( account=account, password=password, blablah=<PASSWORD> ) except Exception as e: logger.exception(e) async def test_failed_login(self): fetcher = await jqadaptor.create_instance(account="wrong", password="<PASSWORD>") log = logging.getLogger("jqadaptor.fetcher") with mock.patch.object(log, "warning") as m: self.assertIsNone(await fetcher.get_security_list()) self.assertTupleEqual(("not connected",), m.call_args.args) async def test_get_security_list(self): sec_list = await self.fetcher.get_security_list() print(sec_list[0]) self.assertTrue(len(sec_list) > 0) async def test_get_bars(self): sec = "000001.XSHE" end = arrow.get("2020-04-04").date() frame_type = "1d" bars = await self.fetcher.get_bars(sec, end, 10, frame_type) self.assertEqual(bars[0]["frame"], arrow.get("2020-03-23").date()) self.assertEqual(bars[-1]["frame"], arrow.get("2020-04-03").date()) end = arrow.get("2020-04-03").date() frame_type = "1d" bars = await self.fetcher.get_bars(sec, end, 3, frame_type) self.assertEqual(bars[0]["frame"], arrow.get("2020-4-1").date()) self.assertEqual(bars[-1]["frame"], end) end = arrow.get("2020-04-03 10:30:00").naive frame_type = "30m" bars = await self.fetcher.get_bars(sec, end, 3, frame_type) self.assertEqual( bars[0]["frame"], arrow.get("2020-04-02 15:00:00").naive, ) self.assertEqual(bars[-1]["frame"], end) # 测试include_unclosed为False的情况 import datetime end = datetime.date(2021, 2, 8) bars = await self.fetcher.get_bars(sec, end, 1, "1w", False) self.assertEqual(datetime.date(2021, 2, 5), bars["frame"][0]) # 测试include_unclosed为True的情况 sec = "000001.XSHE" end = datetime.date(2021, 2, 8) frame_type = "1w" bars = await self.fetcher.get_bars(sec, end, 1, frame_type, True) self.assertEqual(datetime.date(2021, 2, 8), bars["frame"][0]) async def test_get_bars_with_exceptions(self): sec = "000001.XSHE" end = arrow.get("2020-04-04").date() frame_type = "1d" with mock.patch("jqdatasdk.get_bars", side_effect=Exception("最大查询限制")): with self.assertRaises(FetcherQuotaError): await self.fetcher.get_bars(sec, end, 3, frame_type) with mock.patch("jqdatasdk.get_bars", side_effect=Exception("账号过期")): with self.assertRaises(AccountExpiredError): await self.fetcher.get_bars(sec, end, 3, frame_type) async def test_get_bars_not_in_trade(self): sec = "600891.XSHG" end = arrow.get("2020-03-05").date() bars = await self.fetcher.get_bars(sec, end, 7, "1d") print(bars) self.assertEqual(arrow.get("2020-2-21").date(), bars["frame"][0]) self.assertAlmostEqual(1.25, bars[0]["open"], places=2) self.assertEqual(arrow.get("2020-02-26").date(), bars["frame"][3]) self.assertAlmostEqual(1.18, bars["open"][3], places=2) self.assertEqual(arrow.get("2020-03-02").date(), bars["frame"][-1]) self.assertAlmostEqual(1.13, bars["open"][-1], places=2) # 600721, ST百花, 2020-4-29停牌一天 sec = "600721.XSHG" end = arrow.get("2020-04-30 10:30").naive frame_type = "60m" bars = await self.fetcher.get_bars(sec, end, 6, frame_type) print(bars) self.assertEqual(6, len(bars)) self.assertEqual( arrow.get("2020-04-27 15:00").naive, bars["frame"][0], ) # 检查是否停牌日被跳过 self.assertEqual(arrow.get("2020-4-28 15:00").naive, bars["frame"][-2]) self.assertEqual(arrow.get("2020-04-30 10:30").naive, bars["frame"][-1]) self.assertAlmostEqual(5.47, bars["open"][0], places=2) self.assertAlmostEqual(5.26, bars["open"][-1], places=2) # 测试分钟级别未结束的frame能否获取 end = arrow.get("2020-04-30 10:32").naive bars = await self.fetcher.get_bars(sec, end, 7, "60m") print(bars) self.assertEqual(7, len(bars)) self.assertEqual(arrow.get("2020-04-27 15:00").naive, bars["frame"][0]) self.assertEqual(arrow.get("2020-4-30 10:32").naive, bars["frame"][-1]) self.assertEqual(arrow.get("2020-04-30 10:30").naive, bars["frame"][-2]) self.assertAlmostEqual(5.47, bars["open"][0], places=2) self.assertAlmostEqual(5.26, bars["open"][-2], places=2) self.assertAlmostEqual(5.33, bars["open"][-1], places=2) async def test_get_valuation(self): sec = "000001.XSHE" day = arrow.get("2020-10-20").date() valuation = await self.fetcher.get_valuation(sec, day) self.assertSetEqual(set(valuation["code"].tolist()), set([sec])) sec = ["600000.XSHG", "000001.XSHE"] valuation = await self.fetcher.get_valuation(sec, day) self.assertSetEqual(set(valuation["code"].tolist()), set(sec)) day = arrow.get("2020-11-2").date() vals = await self.fetcher.get_valuation(sec, day, 3) self.assertEqual(vals["frame"][0], arrow.get("2020-10-29").date()) self.assertEqual(vals["frame"][-1], day) vals = await self.fetcher.get_valuation(None, day, 1) self.assertTrue(len(vals) > 1000) async def test_get_bars_batch(self): secs = ["000001.XSHE", "600000.XSHG"] end_at = arrow.get("2020-10-23").date() n_bars = 5 frame_type = "1d" bars = await self.fetcher.get_bars_batch(secs, end_at, n_bars, frame_type) self.assertEqual( bars["000001.XSHE"]["frame"][0], arrow.get("2020-10-19").date() ) self.assertEqual( bars["600000.XSHG"]["frame"][0], arrow.get("2020-10-19").date() ) async def test_get_trade_price_limits(self): secs = ["000001.XSHE"] end_at = arrow.get("2020-10-23").date() bars = await self.fetcher.get_trade_price_limits( secs, dt=end_at, ) self.assertIsNotNone(bars) self.assertEqual(datetime.date(2020, 10, 23), bars["frame"][0]) self.assertAlmostEqual(19.32, bars["high_limit"][0], places=2) self.assertAlmostEqual(15.8, bars["low_limit"][0], places=2) try: await self.fetcher.get_trade_price_limits(123, dt=end_at) except Exception as e: self.assertIsInstance(e, TypeError) try: await self.fetcher.get_trade_price_limits(secs, dt=123) except Exception as e: self.assertIsInstance(e, TypeError) try: await self.fetcher.get_trade_price_limits(secs, dt=end_at) except Exception as e: self.assertIsInstance(e, TypeError) try: await self.fetcher.get_trade_price_limits(secs, dt=end_at) except Exception as e: self.assertIsInstance(e, ValueError) try: await self.fetcher.get_trade_price_limits(secs, dt=end_at) except Exception as e: self.assertIsInstance(e, TypeError) async def test_get_fund_list(self): fund_list = await self.fetcher.get_fund_list() self.assertTrue(len(fund_list) > 0) code = ["233333"] vals = await self.fetcher.get_fund_list(codes=code) self.assertFalse(len(vals)) async def test_get_fund_portfolio_stock(self): await self.fetcher.get_fund_portfolio_stock(None, pub_date="2021-12-21") codes = ["000001"] portfolio_stocks = await self.fetcher.get_fund_portfolio_stock(codes) self.assertTrue(len(portfolio_stocks)) async def test_get_fund_share_daily(self): code = ["512690"] day = arrow.get("2021-10-26").date() fund_share_daily = await self.fetcher.get_fund_share_daily(code, day=day) self.assertTrue(len(fund_share_daily)) code = None day = arrow.get("2021-10-26").date() fund_share_daily = await self.fetcher.get_fund_share_daily(code, day=day) self.assertTrue(len(fund_share_daily)) async def test_get_fund_net_value(self): codes = ["000029"] day = arrow.get("2021-10-26").date() fund_net_value = await self.fetcher.get_fund_net_value(codes, day=day) self.assertTrue(len(fund_net_value)) async def test_get_quota(self): quota = await self.fetcher.get_quota() self.assertIsInstance(quota, dict) self.assertIn("total", quota) self.assertIn("spare", quota) def test_result_size_limit(self): self.assertEqual(self.fetcher.result_size_limit("bars"), 3000) async def test_get_price(self): price_bars = await self.fetcher.get_price( ["605366.XSHG"], end_date=datetime.datetime(2022, 3, 1, 13, 16), n_bars=2, frame_type="1m", ) bars = await self.fetcher.get_bars_batch( ["605366.XSHG"], end_at=datetime.datetime(2022, 3, 1, 13, 16), n_bars=2, frame_type="1m", ) for i in bars: if not len(bars[i]): print(f"code:{i}为空") print(bars) for code in price_bars: bar1 = price_bars[code] bar2 = bars[code] self.assertEqual(len(bar1), len(bar2)) if len(bar1) != len(bar2): print("长度不相等,错误") break for item1, item2 in zip(bar1, bar2): # 判断字段是否相等 for field in [ "frame", "open", "high", "low", "close", "volume", "amount", ]: self.assertEqual(item1[field], item2[field]) if field == "frame": if item1[field].strftime("%Y-%m-%d") != item2[field].strftime( "%Y-%m-%d" ): print(f"不相等 item1:{item1}, item2:{item2}, field:{field}") break elif item1[field] != item2[field]: print(f"不相等 item1:{item1}, item2:{item2}, field:{field}") break else: continue break else: continue break # fixme: 这里应该是判断结果是否符合预期,不能用打印来替代。如果actual != expected,需要让测试失败 print(bars) print(price_bars)
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 5215, 12183, 13, 5215, 2897, 13, 5215, 443, 27958, 13, 3166, 443, 27958, 1053, 11187, 13, 5215, 12655, 408, 7442, 13, 5215, 12865, 13, 13, 5215, 16578, 13, 13, 5215, 432, 29939, 1114, 415, 272, 13, 3166, 432, 29939, 1114, 415, 272, 29889, 9155, 261, 1053, 383, 3486, 261, 2182, 4616, 2392, 29892, 16535, 9544, 2859, 2392, 13, 13, 21707, 353, 12183, 29889, 657, 16363, 22168, 1445, 1649, 29897, 13, 21027, 29889, 16121, 3991, 29898, 5563, 29922, 21027, 29889, 11690, 29897, 13, 13, 13, 1990, 4321, 29967, 29984, 29898, 348, 27958, 29889, 29902, 2929, 630, 2887, 948, 3934, 3057, 8259, 1125, 13, 1678, 6699, 261, 29901, 376, 2182, 4769, 20927, 261, 29908, 29871, 396, 1134, 29901, 11455, 396, 694, 25621, 13, 13, 1678, 7465, 822, 7465, 2697, 3373, 29898, 1311, 29897, 1599, 6213, 29901, 29871, 396, 282, 2904, 524, 29901, 11262, 29922, 20965, 29899, 957, 2429, 1145, 29899, 5696, 13, 4706, 1018, 29901, 13, 9651, 3633, 353, 2897, 29889, 21813, 3366, 29967, 29984, 29918, 2477, 18736, 3108, 13, 9651, 4800, 353, 2897, 29889, 21813, 3366, 29967, 29984, 29918, 25711, 17013, 3108, 13, 9651, 1999, 370, 8083, 353, 376, 29844, 29844, 29908, 13, 13, 9651, 1583, 29889, 9155, 261, 353, 7272, 432, 29939, 1114, 415, 272, 29889, 3258, 29918, 8758, 29898, 13, 18884, 3633, 29922, 10149, 29892, 4800, 29922, 5630, 29892, 1999, 370, 8083, 29922, 29966, 25711, 17013, 29958, 13, 9651, 1723, 13, 13, 4706, 5174, 8960, 408, 321, 29901, 13, 9651, 17927, 29889, 11739, 29898, 29872, 29897, 13, 13, 1678, 7465, 822, 1243, 29918, 26061, 29918, 7507, 29898, 1311, 1125, 13, 4706, 6699, 261, 353, 7272, 432, 29939, 1114, 415, 272, 29889, 3258, 29918, 8758, 29898, 10149, 543, 15866, 549, 613, 4800, 543, 29966, 25711, 17013, 29958, 1159, 13, 13, 4706, 1480, 353, 12183, 29889, 657, 16363, 703, 28695, 1114, 415, 272, 29889, 9155, 261, 1159, 13, 4706, 411, 11187, 29889, 5041, 29889, 3318, 29898, 1188, 29892, 376, 27392, 1159, 408, 286, 29901, 13, 9651, 1583, 29889, 9294, 3624, 8516, 29898, 20675, 6699, 261, 29889, 657, 29918, 8926, 29918, 1761, 3101, 13, 9651, 1583, 29889, 9294, 23215, 552, 9843, 29898, 703, 1333, 6631, 613, 511, 286, 29889, 4804, 29918, 5085, 29889, 5085, 29897, 13, 13, 1678, 7465, 822, 1243, 29918, 657, 29918, 8926, 29918, 1761, 29898, 1311, 1125, 13, 4706, 5226, 29918, 1761, 353, 7272, 1583, 29889, 9155, 261, 29889, 657, 29918, 8926, 29918, 1761, 580, 13, 4706, 1596, 29898, 3471, 29918, 1761, 29961, 29900, 2314, 13, 4706, 1583, 29889, 9294, 5574, 29898, 2435, 29898, 3471, 29918, 1761, 29897, 1405, 29871, 29900, 29897, 13, 13, 1678, 7465, 822, 1243, 29918, 657, 29918, 28408, 29898, 1311, 1125, 13, 4706, 5226, 353, 376, 29900, 29900, 29900, 29900, 29900, 29896, 29889, 29990, 7068, 29923, 29908, 13, 4706, 1095, 353, 16578, 29889, 657, 703, 29906, 29900, 29906, 29900, 29899, 29900, 29946, 29899, 29900, 29946, 2564, 1256, 580, 13, 4706, 3515, 29918, 1853, 353, 376, 29896, 29881, 29908, 13, 4706, 22306, 353, 7272, 1583, 29889, 9155, 261, 29889, 657, 29918, 28408, 29898, 3471, 29892, 1095, 29892, 29871, 29896, 29900, 29892, 3515, 29918, 1853, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 28408, 29961, 29900, 29962, 3366, 2557, 12436, 16578, 29889, 657, 703, 29906, 29900, 29906, 29900, 29899, 29900, 29941, 29899, 29906, 29941, 2564, 1256, 3101, 13, 4706, 1583, 29889, 9294, 9843, 29898, 28408, 14352, 29896, 29962, 3366, 2557, 12436, 16578, 29889, 657, 703, 29906, 29900, 29906, 29900, 29899, 29900, 29946, 29899, 29900, 29941, 2564, 1256, 3101, 13, 13, 4706, 1095, 353, 16578, 29889, 657, 703, 29906, 29900, 29906, 29900, 29899, 29900, 29946, 29899, 29900, 29941, 2564, 1256, 580, 13, 4706, 3515, 29918, 1853, 353, 376, 29896, 29881, 29908, 13, 4706, 22306, 353, 7272, 1583, 29889, 9155, 261, 29889, 657, 29918, 28408, 29898, 3471, 29892, 1095, 29892, 29871, 29941, 29892, 3515, 29918, 1853, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 28408, 29961, 29900, 29962, 3366, 2557, 12436, 16578, 29889, 657, 703, 29906, 29900, 29906, 29900, 29899, 29946, 29899, 29896, 2564, 1256, 3101, 13, 4706, 1583, 29889, 9294, 9843, 29898, 28408, 14352, 29896, 29962, 3366, 2557, 12436, 1095, 29897, 13, 13, 4706, 1095, 353, 16578, 29889, 657, 703, 29906, 29900, 29906, 29900, 29899, 29900, 29946, 29899, 29900, 29941, 29871, 29896, 29900, 29901, 29941, 29900, 29901, 29900, 29900, 2564, 1056, 573, 13, 4706, 3515, 29918, 1853, 353, 376, 29941, 29900, 29885, 29908, 13, 4706, 22306, 353, 7272, 1583, 29889, 9155, 261, 29889, 657, 29918, 28408, 29898, 3471, 29892, 1095, 29892, 29871, 29941, 29892, 3515, 29918, 1853, 29897, 13, 13, 4706, 1583, 29889, 9294, 9843, 29898, 13, 9651, 22306, 29961, 29900, 29962, 3366, 2557, 12436, 13, 9651, 16578, 29889, 657, 703, 29906, 29900, 29906, 29900, 29899, 29900, 29946, 29899, 29900, 29906, 29871, 29896, 29945, 29901, 29900, 29900, 29901, 29900, 29900, 2564, 1056, 573, 29892, 13, 4706, 1723, 13, 4706, 1583, 29889, 9294, 9843, 29898, 28408, 14352, 29896, 29962, 3366, 2557, 12436, 1095, 29897, 13, 13, 4706, 396, 29871, 31851, 31787, 2856, 29918, 348, 15603, 30573, 8824, 30210, 30993, 232, 137, 184, 13, 4706, 1053, 12865, 13, 13, 4706, 1095, 353, 12865, 29889, 1256, 29898, 29906, 29900, 29906, 29896, 29892, 29871, 29906, 29892, 29871, 29947, 29897, 13, 4706, 22306, 353, 7272, 1583, 29889, 9155, 261, 29889, 657, 29918, 28408, 29898, 3471, 29892, 1095, 29892, 29871, 29896, 29892, 376, 29896, 29893, 613, 7700, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 12673, 29889, 1256, 29898, 29906, 29900, 29906, 29896, 29892, 29871, 29906, 29892, 29871, 29945, 511, 22306, 3366, 2557, 3108, 29961, 29900, 2314, 13, 13, 4706, 396, 29871, 31851, 31787, 2856, 29918, 348, 15603, 30573, 5574, 30210, 30993, 232, 137, 184, 13, 4706, 5226, 353, 376, 29900, 29900, 29900, 29900, 29900, 29896, 29889, 29990, 7068, 29923, 29908, 13, 4706, 1095, 353, 12865, 29889, 1256, 29898, 29906, 29900, 29906, 29896, 29892, 29871, 29906, 29892, 29871, 29947, 29897, 13, 4706, 3515, 29918, 1853, 353, 376, 29896, 29893, 29908, 13, 4706, 22306, 353, 7272, 1583, 29889, 9155, 261, 29889, 657, 29918, 28408, 29898, 3471, 29892, 1095, 29892, 29871, 29896, 29892, 3515, 29918, 1853, 29892, 5852, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 12673, 29889, 1256, 29898, 29906, 29900, 29906, 29896, 29892, 29871, 29906, 29892, 29871, 29947, 511, 22306, 3366, 2557, 3108, 29961, 29900, 2314, 13, 13, 1678, 7465, 822, 1243, 29918, 657, 29918, 28408, 29918, 2541, 29918, 11739, 29879, 29898, 1311, 1125, 13, 4706, 5226, 353, 376, 29900, 29900, 29900, 29900, 29900, 29896, 29889, 29990, 7068, 29923, 29908, 13, 4706, 1095, 353, 16578, 29889, 657, 703, 29906, 29900, 29906, 29900, 29899, 29900, 29946, 29899, 29900, 29946, 2564, 1256, 580, 13, 4706, 3515, 29918, 1853, 353, 376, 29896, 29881, 29908, 13, 13, 4706, 411, 11187, 29889, 5041, 703, 28695, 14538, 8181, 29889, 657, 29918, 28408, 613, 2625, 29918, 15987, 29922, 2451, 703, 30878, 30257, 31213, 235, 178, 165, 31175, 31072, 5783, 29901, 13, 9651, 411, 1583, 29889, 9294, 29934, 1759, 267, 29898, 20927, 261, 2182, 4616, 2392, 1125, 13, 18884, 7272, 1583, 29889, 9155, 261, 29889, 657, 29918, 28408, 29898, 3471, 29892, 1095, 29892, 29871, 29941, 29892, 3515, 29918, 1853, 29897, 13, 13, 4706, 411, 11187, 29889, 5041, 703, 28695, 14538, 8181, 29889, 657, 29918, 28408, 613, 2625, 29918, 15987, 29922, 2451, 703, 235, 183, 169, 30850, 31138, 31117, 5783, 29901, 13, 9651, 411, 1583, 29889, 9294, 29934, 1759, 267, 29898, 10601, 9544, 2859, 2392, 1125, 13, 18884, 7272, 1583, 29889, 9155, 261, 29889, 657, 29918, 28408, 29898, 3471, 29892, 1095, 29892, 29871, 29941, 29892, 3515, 29918, 1853, 29897, 13, 13, 1678, 7465, 822, 1243, 29918, 657, 29918, 28408, 29918, 1333, 29918, 262, 29918, 3018, 311, 29898, 1311, 1125, 13, 4706, 5226, 353, 376, 29953, 29900, 29900, 29947, 29929, 29896, 29889, 29990, 7068, 29954, 29908, 13, 4706, 1095, 353, 16578, 29889, 657, 703, 29906, 29900, 29906, 29900, 29899, 29900, 29941, 29899, 29900, 29945, 2564, 1256, 580, 13, 4706, 22306, 353, 7272, 1583, 29889, 9155, 261, 29889, 657, 29918, 28408, 29898, 3471, 29892, 1095, 29892, 29871, 29955, 29892, 376, 29896, 29881, 1159, 13, 4706, 1596, 29898, 28408, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 2936, 29889, 657, 703, 29906, 29900, 29906, 29900, 29899, 29906, 29899, 29906, 29896, 2564, 1256, 3285, 22306, 3366, 2557, 3108, 29961, 29900, 2314, 13, 4706, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 29896, 29889, 29906, 29945, 29892, 22306, 29961, 29900, 29962, 3366, 3150, 12436, 7600, 29922, 29906, 29897, 13, 13, 4706, 1583, 29889, 9294, 9843, 29898, 2936, 29889, 657, 703, 29906, 29900, 29906, 29900, 29899, 29900, 29906, 29899, 29906, 29953, 2564, 1256, 3285, 22306, 3366, 2557, 3108, 29961, 29941, 2314, 13, 4706, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 29896, 29889, 29896, 29947, 29892, 22306, 3366, 3150, 3108, 29961, 29941, 1402, 7600, 29922, 29906, 29897, 13, 13, 4706, 1583, 29889, 9294, 9843, 29898, 2936, 29889, 657, 703, 29906, 29900, 29906, 29900, 29899, 29900, 29941, 29899, 29900, 29906, 2564, 1256, 3285, 22306, 3366, 2557, 3108, 14352, 29896, 2314, 13, 4706, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 29896, 29889, 29896, 29941, 29892, 22306, 3366, 3150, 3108, 14352, 29896, 1402, 7600, 29922, 29906, 29897, 13, 13, 4706, 396, 29871, 29953, 29900, 29900, 29955, 29906, 29896, 29892, 6850, 31047, 30830, 30214, 29871, 29906, 29900, 29906, 29900, 29899, 29946, 29899, 29906, 29929, 232, 132, 159, 234, 140, 143, 30287, 30408, 13, 4706, 5226, 353, 376, 29953, 29900, 29900, 29955, 29906, 29896, 29889, 29990, 7068, 29954, 29908, 13, 4706, 1095, 353, 16578, 29889, 657, 703, 29906, 29900, 29906, 29900, 29899, 29900, 29946, 29899, 29941, 29900, 29871, 29896, 29900, 29901, 29941, 29900, 2564, 1056, 573, 13, 4706, 3515, 29918, 1853, 353, 376, 29953, 29900, 29885, 29908, 13, 13, 4706, 22306, 353, 7272, 1583, 29889, 9155, 261, 29889, 657, 29918, 28408, 29898, 3471, 29892, 1095, 29892, 29871, 29953, 29892, 3515, 29918, 1853, 29897, 13, 4706, 1596, 29898, 28408, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 29953, 29892, 7431, 29898, 28408, 876, 13, 4706, 1583, 29889, 9294, 9843, 29898, 13, 9651, 16578, 29889, 657, 703, 29906, 29900, 29906, 29900, 29899, 29900, 29946, 29899, 29906, 29955, 29871, 29896, 29945, 29901, 29900, 29900, 2564, 1056, 573, 29892, 13, 9651, 22306, 3366, 2557, 3108, 29961, 29900, 1402, 13, 4706, 1723, 13, 4706, 396, 29871, 233, 166, 131, 31213, 30392, 31191, 232, 132, 159, 234, 140, 143, 30325, 31407, 235, 186, 182, 31138, 13, 4706, 1583, 29889, 9294, 9843, 29898, 2936, 29889, 657, 703, 29906, 29900, 29906, 29900, 29899, 29946, 29899, 29906, 29947, 29871, 29896, 29945, 29901, 29900, 29900, 2564, 1056, 573, 29892, 22306, 3366, 2557, 3108, 14352, 29906, 2314, 13, 4706, 1583, 29889, 9294, 9843, 29898, 2936, 29889, 657, 703, 29906, 29900, 29906, 29900, 29899, 29900, 29946, 29899, 29941, 29900, 29871, 29896, 29900, 29901, 29941, 29900, 2564, 1056, 573, 29892, 22306, 3366, 2557, 3108, 14352, 29896, 2314, 13, 4706, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 29945, 29889, 29946, 29955, 29892, 22306, 3366, 3150, 3108, 29961, 29900, 1402, 7600, 29922, 29906, 29897, 13, 4706, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 29945, 29889, 29906, 29953, 29892, 22306, 3366, 3150, 3108, 14352, 29896, 1402, 7600, 29922, 29906, 29897, 13, 13, 4706, 396, 29871, 31851, 31787, 30748, 236, 149, 162, 234, 189, 170, 232, 139, 174, 31295, 31320, 233, 160, 162, 30210, 2557, 30815, 31191, 31024, 30683, 13, 4706, 1095, 353, 16578, 29889, 657, 703, 29906, 29900, 29906, 29900, 29899, 29900, 29946, 29899, 29941, 29900, 29871, 29896, 29900, 29901, 29941, 29906, 2564, 1056, 573, 13, 4706, 22306, 353, 7272, 1583, 29889, 9155, 261, 29889, 657, 29918, 28408, 29898, 3471, 29892, 1095, 29892, 29871, 29955, 29892, 376, 29953, 29900, 29885, 1159, 13, 4706, 1596, 29898, 28408, 29897, 13, 13, 4706, 1583, 29889, 9294, 9843, 29898, 29955, 29892, 7431, 29898, 28408, 876, 13, 4706, 1583, 29889, 9294, 9843, 29898, 2936, 29889, 657, 703, 29906, 29900, 29906, 29900, 29899, 29900, 29946, 29899, 29906, 29955, 29871, 29896, 29945, 29901, 29900, 29900, 2564, 1056, 573, 29892, 22306, 3366, 2557, 3108, 29961, 29900, 2314, 13, 4706, 1583, 29889, 9294, 9843, 29898, 2936, 29889, 657, 703, 29906, 29900, 29906, 29900, 29899, 29946, 29899, 29941, 29900, 29871, 29896, 29900, 29901, 29941, 29906, 2564, 1056, 573, 29892, 22306, 3366, 2557, 3108, 14352, 29896, 2314, 13, 4706, 1583, 29889, 9294, 9843, 29898, 2936, 29889, 657, 703, 29906, 29900, 29906, 29900, 29899, 29900, 29946, 29899, 29941, 29900, 29871, 29896, 29900, 29901, 29941, 29900, 2564, 1056, 573, 29892, 22306, 3366, 2557, 3108, 14352, 29906, 2314, 13, 13, 4706, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 29945, 29889, 29946, 29955, 29892, 22306, 3366, 3150, 3108, 29961, 29900, 1402, 7600, 29922, 29906, 29897, 13, 4706, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 29945, 29889, 29906, 29953, 29892, 22306, 3366, 3150, 3108, 14352, 29906, 1402, 7600, 29922, 29906, 29897, 13, 4706, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 29945, 29889, 29941, 29941, 29892, 22306, 3366, 3150, 3108, 14352, 29896, 1402, 7600, 29922, 29906, 29897, 13, 13, 1678, 7465, 822, 1243, 29918, 657, 29918, 4387, 362, 29898, 1311, 1125, 13, 4706, 5226, 353, 376, 29900, 29900, 29900, 29900, 29900, 29896, 29889, 29990, 7068, 29923, 29908, 13, 4706, 2462, 353, 16578, 29889, 657, 703, 29906, 29900, 29906, 29900, 29899, 29896, 29900, 29899, 29906, 29900, 2564, 1256, 580, 13, 4706, 17134, 362, 353, 7272, 1583, 29889, 9155, 261, 29889, 657, 29918, 4387, 362, 29898, 3471, 29892, 2462, 29897, 13, 4706, 1583, 29889, 9294, 2697, 9843, 29898, 842, 29898, 4387, 362, 3366, 401, 16862, 25027, 391, 25739, 731, 4197, 3471, 12622, 13, 13, 4706, 5226, 353, 6796, 29953, 29900, 29900, 29900, 29900, 29900, 29889, 29990, 7068, 29954, 613, 376, 29900, 29900, 29900, 29900, 29900, 29896, 29889, 29990, 7068, 29923, 3108, 13, 4706, 17134, 362, 353, 7272, 1583, 29889, 9155, 261, 29889, 657, 29918, 4387, 362, 29898, 3471, 29892, 2462, 29897, 13, 4706, 1583, 29889, 9294, 2697, 9843, 29898, 842, 29898, 4387, 362, 3366, 401, 16862, 25027, 391, 25739, 731, 29898, 3471, 876, 13, 13, 4706, 2462, 353, 16578, 29889, 657, 703, 29906, 29900, 29906, 29900, 29899, 29896, 29896, 29899, 29906, 2564, 1256, 580, 13, 4706, 659, 29879, 353, 7272, 1583, 29889, 9155, 261, 29889, 657, 29918, 4387, 362, 29898, 3471, 29892, 2462, 29892, 29871, 29941, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 791, 29879, 3366, 2557, 3108, 29961, 29900, 1402, 16578, 29889, 657, 703, 29906, 29900, 29906, 29900, 29899, 29896, 29900, 29899, 29906, 29929, 2564, 1256, 3101, 13, 4706, 1583, 29889, 9294, 9843, 29898, 791, 29879, 3366, 2557, 3108, 14352, 29896, 1402, 2462, 29897, 13, 13, 4706, 659, 29879, 353, 7272, 1583, 29889, 9155, 261, 29889, 657, 29918, 4387, 362, 29898, 8516, 29892, 2462, 29892, 29871, 29896, 29897, 13, 4706, 1583, 29889, 9294, 5574, 29898, 2435, 29898, 791, 29879, 29897, 1405, 29871, 29896, 29900, 29900, 29900, 29897, 13, 13, 1678, 7465, 822, 1243, 29918, 657, 29918, 28408, 29918, 16175, 29898, 1311, 1125, 13, 4706, 409, 2395, 353, 6796, 29900, 29900, 29900, 29900, 29900, 29896, 29889, 29990, 7068, 29923, 613, 376, 29953, 29900, 29900, 29900, 29900, 29900, 29889, 29990, 7068, 29954, 3108, 13, 4706, 1095, 29918, 271, 353, 16578, 29889, 657, 703, 29906, 29900, 29906, 29900, 29899, 29896, 29900, 29899, 29906, 29941, 2564, 1256, 580, 13, 4706, 302, 29918, 28408, 353, 29871, 29945, 13, 4706, 3515, 29918, 1853, 353, 376, 29896, 29881, 29908, 13, 13, 4706, 22306, 353, 7272, 1583, 29889, 9155, 261, 29889, 657, 29918, 28408, 29918, 16175, 29898, 344, 2395, 29892, 1095, 29918, 271, 29892, 302, 29918, 28408, 29892, 3515, 29918, 1853, 29897, 13, 13, 4706, 1583, 29889, 9294, 9843, 29898, 13, 9651, 22306, 3366, 29900, 29900, 29900, 29900, 29900, 29896, 29889, 29990, 7068, 29923, 3108, 3366, 2557, 3108, 29961, 29900, 1402, 16578, 29889, 657, 703, 29906, 29900, 29906, 29900, 29899, 29896, 29900, 29899, 29896, 29929, 2564, 1256, 580, 13, 4706, 1723, 13, 4706, 1583, 29889, 9294, 9843, 29898, 13, 9651, 22306, 3366, 29953, 29900, 29900, 29900, 29900, 29900, 29889, 29990, 7068, 29954, 3108, 3366, 2557, 3108, 29961, 29900, 1402, 16578, 29889, 657, 703, 29906, 29900, 29906, 29900, 29899, 29896, 29900, 29899, 29896, 29929, 2564, 1256, 580, 13, 4706, 1723, 13, 13, 1678, 7465, 822, 1243, 29918, 657, 29918, 3018, 311, 29918, 9175, 29918, 12514, 29898, 1311, 1125, 13, 4706, 409, 2395, 353, 6796, 29900, 29900, 29900, 29900, 29900, 29896, 29889, 29990, 7068, 29923, 3108, 13, 4706, 1095, 29918, 271, 353, 16578, 29889, 657, 703, 29906, 29900, 29906, 29900, 29899, 29896, 29900, 29899, 29906, 29941, 2564, 1256, 580, 13, 4706, 22306, 353, 7272, 1583, 29889, 9155, 261, 29889, 657, 29918, 3018, 311, 29918, 9175, 29918, 12514, 29898, 13, 9651, 409, 2395, 29892, 13, 9651, 11636, 29922, 355, 29918, 271, 29892, 13, 4706, 1723, 13, 4706, 1583, 29889, 9294, 3624, 3664, 8516, 29898, 28408, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 12673, 29889, 1256, 29898, 29906, 29900, 29906, 29900, 29892, 29871, 29896, 29900, 29892, 29871, 29906, 29941, 511, 22306, 3366, 2557, 3108, 29961, 29900, 2314, 13, 4706, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 29896, 29929, 29889, 29941, 29906, 29892, 22306, 3366, 9812, 29918, 13400, 3108, 29961, 29900, 1402, 7600, 29922, 29906, 29897, 13, 4706, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 29896, 29945, 29889, 29947, 29892, 22306, 3366, 677, 29918, 13400, 3108, 29961, 29900, 1402, 7600, 29922, 29906, 29897, 13, 4706, 1018, 29901, 13, 9651, 7272, 1583, 29889, 9155, 261, 29889, 657, 29918, 3018, 311, 29918, 9175, 29918, 12514, 29898, 29896, 29906, 29941, 29892, 11636, 29922, 355, 29918, 271, 29897, 13, 4706, 5174, 8960, 408, 321, 29901, 13, 9651, 1583, 29889, 9294, 3624, 4998, 29898, 29872, 29892, 20948, 29897, 13, 13, 4706, 1018, 29901, 13, 9651, 7272, 1583, 29889, 9155, 261, 29889, 657, 29918, 3018, 311, 29918, 9175, 29918, 12514, 29898, 344, 2395, 29892, 11636, 29922, 29896, 29906, 29941, 29897, 13, 4706, 5174, 8960, 408, 321, 29901, 13, 9651, 1583, 29889, 9294, 3624, 4998, 29898, 29872, 29892, 20948, 29897, 13, 13, 4706, 1018, 29901, 13, 9651, 7272, 1583, 29889, 9155, 261, 29889, 657, 29918, 3018, 311, 29918, 9175, 29918, 12514, 29898, 344, 2395, 29892, 11636, 29922, 355, 29918, 271, 29897, 13, 4706, 5174, 8960, 408, 321, 29901, 13, 9651, 1583, 29889, 9294, 3624, 4998, 29898, 29872, 29892, 20948, 29897, 13, 13, 4706, 1018, 29901, 13, 9651, 7272, 1583, 29889, 9155, 261, 29889, 657, 29918, 3018, 311, 29918, 9175, 29918, 12514, 29898, 344, 2395, 29892, 11636, 29922, 355, 29918, 271, 29897, 13, 4706, 5174, 8960, 408, 321, 29901, 13, 9651, 1583, 29889, 9294, 3624, 4998, 29898, 29872, 29892, 7865, 2392, 29897, 13, 13, 4706, 1018, 29901, 13, 9651, 7272, 1583, 29889, 9155, 261, 29889, 657, 29918, 3018, 311, 29918, 9175, 29918, 12514, 29898, 344, 2395, 29892, 11636, 29922, 355, 29918, 271, 29897, 13, 4706, 5174, 8960, 408, 321, 29901, 13, 9651, 1583, 29889, 9294, 3624, 4998, 29898, 29872, 29892, 20948, 29897, 13, 13, 1678, 7465, 822, 1243, 29918, 657, 29918, 27159, 29918, 1761, 29898, 1311, 1125, 13, 4706, 5220, 29918, 1761, 353, 7272, 1583, 29889, 9155, 261, 29889, 657, 29918, 27159, 29918, 1761, 580, 13, 4706, 1583, 29889, 9294, 5574, 29898, 2435, 29898, 27159, 29918, 1761, 29897, 1405, 29871, 29900, 29897, 13, 13, 4706, 775, 353, 6796, 29906, 29941, 29941, 29941, 29941, 29941, 3108, 13, 4706, 659, 29879, 353, 7272, 1583, 29889, 9155, 261, 29889, 657, 29918, 27159, 29918, 1761, 29898, 18137, 29922, 401, 29897, 13, 4706, 1583, 29889, 9294, 8824, 29898, 2435, 29898, 791, 29879, 876, 13, 13, 1678, 7465, 822, 1243, 29918, 657, 29918, 27159, 29918, 637, 25648, 29918, 17712, 29898, 1311, 1125, 13, 13, 4706, 7272, 1583, 29889, 9155, 261, 29889, 657, 29918, 27159, 29918, 637, 25648, 29918, 17712, 29898, 8516, 29892, 2529, 29918, 1256, 543, 29906, 29900, 29906, 29896, 29899, 29896, 29906, 29899, 29906, 29896, 1159, 13, 13, 4706, 11561, 353, 6796, 29900, 29900, 29900, 29900, 29900, 29896, 3108, 13, 4706, 2011, 25648, 29918, 17712, 29879, 353, 7272, 1583, 29889, 9155, 261, 29889, 657, 29918, 27159, 29918, 637, 25648, 29918, 17712, 29898, 18137, 29897, 13, 4706, 1583, 29889, 9294, 5574, 29898, 2435, 29898, 637, 25648, 29918, 17712, 29879, 876, 13, 13, 1678, 7465, 822, 1243, 29918, 657, 29918, 27159, 29918, 13653, 29918, 29881, 8683, 29898, 1311, 1125, 13, 4706, 775, 353, 6796, 29945, 29896, 29906, 29953, 29929, 29900, 3108, 13, 4706, 2462, 353, 16578, 29889, 657, 703, 29906, 29900, 29906, 29896, 29899, 29896, 29900, 29899, 29906, 29953, 2564, 1256, 580, 13, 4706, 5220, 29918, 13653, 29918, 29881, 8683, 353, 7272, 1583, 29889, 9155, 261, 29889, 657, 29918, 27159, 29918, 13653, 29918, 29881, 8683, 29898, 401, 29892, 2462, 29922, 3250, 29897, 13, 4706, 1583, 29889, 9294, 5574, 29898, 2435, 29898, 27159, 29918, 13653, 29918, 29881, 8683, 876, 13, 13, 4706, 775, 353, 6213, 13, 4706, 2462, 353, 16578, 29889, 657, 703, 29906, 29900, 29906, 29896, 29899, 29896, 29900, 29899, 29906, 29953, 2564, 1256, 580, 13, 4706, 5220, 29918, 13653, 29918, 29881, 8683, 353, 7272, 1583, 29889, 9155, 261, 29889, 657, 29918, 27159, 29918, 13653, 29918, 29881, 8683, 29898, 401, 29892, 2462, 29922, 3250, 29897, 13, 4706, 1583, 29889, 9294, 5574, 29898, 2435, 29898, 27159, 29918, 13653, 29918, 29881, 8683, 876, 13, 13, 1678, 7465, 822, 1243, 29918, 657, 29918, 27159, 29918, 1212, 29918, 1767, 29898, 1311, 1125, 13, 4706, 11561, 353, 6796, 29900, 29900, 29900, 29900, 29906, 29929, 3108, 13, 4706, 2462, 353, 16578, 29889, 657, 703, 29906, 29900, 29906, 29896, 29899, 29896, 29900, 29899, 29906, 29953, 2564, 1256, 580, 13, 4706, 5220, 29918, 1212, 29918, 1767, 353, 7272, 1583, 29889, 9155, 261, 29889, 657, 29918, 27159, 29918, 1212, 29918, 1767, 29898, 18137, 29892, 2462, 29922, 3250, 29897, 13, 4706, 1583, 29889, 9294, 5574, 29898, 2435, 29898, 27159, 29918, 1212, 29918, 1767, 876, 13, 13, 1678, 7465, 822, 1243, 29918, 657, 29918, 339, 4616, 29898, 1311, 1125, 13, 4706, 439, 4616, 353, 7272, 1583, 29889, 9155, 261, 29889, 657, 29918, 339, 4616, 580, 13, 4706, 1583, 29889, 9294, 3624, 4998, 29898, 339, 4616, 29892, 9657, 29897, 13, 4706, 1583, 29889, 9294, 797, 703, 7827, 613, 439, 4616, 29897, 13, 4706, 1583, 29889, 9294, 797, 703, 1028, 598, 613, 439, 4616, 29897, 13, 13, 1678, 822, 1243, 29918, 2914, 29918, 2311, 29918, 13400, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 29898, 1311, 29889, 9155, 261, 29889, 2914, 29918, 2311, 29918, 13400, 703, 28408, 4968, 29871, 29941, 29900, 29900, 29900, 29897, 13, 13, 1678, 7465, 822, 1243, 29918, 657, 29918, 9175, 29898, 1311, 1125, 13, 4706, 8666, 29918, 28408, 353, 7272, 1583, 29889, 9155, 261, 29889, 657, 29918, 9175, 29898, 13, 9651, 6796, 29953, 29900, 29945, 29941, 29953, 29953, 29889, 29990, 7068, 29954, 12436, 13, 9651, 1095, 29918, 1256, 29922, 12673, 29889, 12673, 29898, 29906, 29900, 29906, 29906, 29892, 29871, 29941, 29892, 29871, 29896, 29892, 29871, 29896, 29941, 29892, 29871, 29896, 29953, 511, 13, 9651, 302, 29918, 28408, 29922, 29906, 29892, 13, 9651, 3515, 29918, 1853, 543, 29896, 29885, 613, 13, 4706, 1723, 13, 4706, 22306, 353, 7272, 1583, 29889, 9155, 261, 29889, 657, 29918, 28408, 29918, 16175, 29898, 13, 9651, 6796, 29953, 29900, 29945, 29941, 29953, 29953, 29889, 29990, 7068, 29954, 12436, 13, 9651, 1095, 29918, 271, 29922, 12673, 29889, 12673, 29898, 29906, 29900, 29906, 29906, 29892, 29871, 29941, 29892, 29871, 29896, 29892, 29871, 29896, 29941, 29892, 29871, 29896, 29953, 511, 13, 9651, 302, 29918, 28408, 29922, 29906, 29892, 13, 9651, 3515, 29918, 1853, 543, 29896, 29885, 613, 13, 4706, 1723, 13, 4706, 363, 474, 297, 22306, 29901, 13, 9651, 565, 451, 7431, 29898, 28408, 29961, 29875, 29962, 1125, 13, 18884, 1596, 29898, 29888, 29908, 401, 26254, 29875, 29913, 30573, 30816, 1159, 13, 4706, 1596, 29898, 28408, 29897, 13, 4706, 363, 775, 297, 8666, 29918, 28408, 29901, 13, 9651, 2594, 29896, 353, 8666, 29918, 28408, 29961, 401, 29962, 13, 9651, 2594, 29906, 353, 22306, 29961, 401, 29962, 13, 9651, 1583, 29889, 9294, 9843, 29898, 2435, 29898, 1646, 29896, 511, 7431, 29898, 1646, 29906, 876, 13, 9651, 565, 7431, 29898, 1646, 29896, 29897, 2804, 7431, 29898, 1646, 29906, 1125, 13, 18884, 1596, 703, 31143, 30898, 30413, 30990, 31184, 30214, 31745, 235, 178, 178, 1159, 13, 18884, 2867, 13, 9651, 363, 2944, 29896, 29892, 2944, 29906, 297, 14319, 29898, 1646, 29896, 29892, 2594, 29906, 1125, 13, 18884, 396, 29871, 31791, 31683, 30578, 31559, 30392, 31191, 30990, 31184, 13, 18884, 363, 1746, 297, 518, 13, 462, 1678, 376, 2557, 613, 13, 462, 1678, 376, 3150, 613, 13, 462, 1678, 376, 9812, 613, 13, 462, 1678, 376, 677, 613, 13, 462, 1678, 376, 5358, 613, 13, 462, 1678, 376, 24623, 613, 13, 462, 1678, 376, 14506, 613, 13, 18884, 4514, 29901, 13, 462, 1678, 1583, 29889, 9294, 9843, 29898, 667, 29896, 29961, 2671, 1402, 2944, 29906, 29961, 2671, 2314, 13, 462, 1678, 565, 1746, 1275, 376, 2557, 1115, 13, 462, 4706, 565, 2944, 29896, 29961, 2671, 1822, 710, 615, 603, 11702, 29979, 19222, 29885, 19222, 29881, 1159, 2804, 2944, 29906, 29961, 2671, 1822, 710, 615, 603, 29898, 13, 462, 9651, 11860, 29979, 19222, 29885, 19222, 29881, 29908, 13, 462, 308, 1125, 13, 462, 9651, 1596, 29898, 29888, 29908, 30413, 30990, 31184, 2944, 29896, 26254, 667, 29896, 1118, 2944, 29906, 26254, 667, 29906, 1118, 1746, 26254, 2671, 27195, 13, 462, 9651, 2867, 13, 462, 1678, 25342, 2944, 29896, 29961, 2671, 29962, 2804, 2944, 29906, 29961, 2671, 5387, 13, 462, 4706, 1596, 29898, 29888, 29908, 30413, 30990, 31184, 2944, 29896, 26254, 667, 29896, 1118, 2944, 29906, 26254, 667, 29906, 1118, 1746, 26254, 2671, 27195, 13, 462, 4706, 2867, 13, 18884, 1683, 29901, 13, 462, 1678, 6773, 13, 18884, 2867, 13, 9651, 1683, 29901, 13, 18884, 6773, 13, 9651, 2867, 13, 13, 4706, 396, 2329, 1004, 29901, 29871, 30810, 30755, 31370, 31751, 30392, 31791, 31683, 31320, 30801, 30392, 31191, 31277, 30733, 236, 165, 135, 31117, 30214, 30413, 30815, 30406, 31656, 232, 144, 179, 30805, 233, 158, 194, 30690, 30267, 30847, 30801, 19304, 2804, 3806, 30214, 31383, 30698, 235, 177, 172, 31851, 31787, 31369, 31955, 13, 4706, 1596, 29898, 28408, 29897, 13, 4706, 1596, 29898, 9175, 29918, 28408, 29897, 13, 2 ]
tests/cases/run/match2.py
3e45/minpiler
0
120979
<reponame>3e45/minpiler from minpiler.std import M, emulator match None: case 0: M.print(0) case None: M.print("None") case 1: M.print(10) case 2: M.print(20) # > None emulator.kill()
[ 1, 529, 276, 1112, 420, 29958, 29941, 29872, 29946, 29945, 29914, 1195, 29886, 3955, 13, 3166, 1375, 29886, 3955, 29889, 4172, 1053, 341, 29892, 26364, 13, 13, 4352, 6213, 29901, 13, 1678, 1206, 29871, 29900, 29901, 13, 4706, 341, 29889, 2158, 29898, 29900, 29897, 13, 1678, 1206, 6213, 29901, 13, 4706, 341, 29889, 2158, 703, 8516, 1159, 13, 1678, 1206, 29871, 29896, 29901, 13, 4706, 341, 29889, 2158, 29898, 29896, 29900, 29897, 13, 1678, 1206, 29871, 29906, 29901, 13, 4706, 341, 29889, 2158, 29898, 29906, 29900, 29897, 13, 13, 29937, 1405, 6213, 13, 13, 331, 9183, 29889, 21174, 580, 13, 2 ]
scripts/python/merge_read_counts.py
BradhamLab/scPipe
0
1609458
<reponame>BradhamLab/scPipe """ Merge sample count files into a count matrix with genes as rows and samples as columns. Author: <NAME> Date: August 16, 2018 """ import os import pandas as pd import numpy as np def simple_merge(count_dir): data_frames = [] for x in os.listdir(count_dir): sample = os.path.basename(os.path.splitext(x)[0]) sample_df = pd.read_csv(os.path.join(count_dir, x), index_col=0, sep='\t', header=0, names=['Gene', sample], skiprows=[0]) data_frames.append(sample_df) return pd.concat(data_frames, axis=1) def merge_counts(count_dir): """ Merge featureCounts output from several sample files into a single dataframe. Merge featureCounts quantification across samples. Returns raw feature counts across datasets, as well as transcripts per million (TPM) counts. Args: count_dir (string): path to directory containing HTSeq output. Files are expected to follow a {sample.name}.txt naming scheme. Returns: (dict, pd.DataFrame): dictionary of pandas dataframes containing raw read counts and TPM normalized values. Keyed by 'count' and 'tpm'. """ data_frames = [] for x in os.listdir(count_dir): sample = os.path.basename(os.path.splitext(x)[0]) sample_df = pd.read_csv(os.path.join(count_dir, x), index_col=0, sep='\t', header=0, names=['Length', sample], skiprows=[0]) # calculate count to feature length ratio counts_per_base = sample_df.apply(lambda x: x[1] / x[0], axis=1) # calculate sum of ratios / rates for normalization total_cpb = counts_per_base.sum() if total_cpb != 0: tpm = counts_per_base.apply(lambda x: x * 1 / total_cpb * 10**6) tpm.rename(sample, inplace=True) # total rates is zero -> no transcriptcs, tpm = 0 for all else: tpm = sample_df[sample] data_frames.append({'count': sample_df[sample], 'tpm': tpm}) count_matrix = pd.concat([each['count'] for each in data_frames], axis=1) tpm_matrix = pd.concat([each['tpm'] for each in data_frames], axis=1) return {'count':count_matrix, 'tpm': tpm_matrix} def remove_zero_genes(count_df): """ Remove genes with no reads mapping to them across samples. """ count_df[count_df == 0] = np.NaN filtered = count_df.dropna(how='all') return filtered.fillna(value=0) if __name__ == "__main__": snakemake_exists = True try: snakemake except NameError: snakemake_exists = False if snakemake_exists: dataframes = merge_counts(snakemake.params['dir']) filtered_counts = remove_zero_genes(dataframes['count']) filtered_tpm = dataframes['tpm'].loc[filtered_counts.index, filtered_counts.columns] filtered_counts.to_csv(snakemake.output['count']) filtered_tpm.to_csv(snakemake.output['tpm'])
[ 1, 529, 276, 1112, 420, 29958, 29933, 3665, 3391, 28632, 29914, 1557, 12197, 412, 13, 15945, 29908, 13, 15836, 479, 4559, 2302, 2066, 964, 263, 2302, 4636, 411, 2531, 267, 408, 4206, 322, 11916, 408, 13, 13099, 29889, 13, 13, 13720, 29901, 529, 5813, 29958, 13, 2539, 29901, 3111, 29871, 29896, 29953, 29892, 29871, 29906, 29900, 29896, 29947, 13, 15945, 29908, 13, 13, 5215, 2897, 13, 13, 5215, 11701, 408, 10518, 13, 5215, 12655, 408, 7442, 13, 13, 13, 13, 1753, 2560, 29918, 14634, 29898, 2798, 29918, 3972, 1125, 13, 1678, 848, 29918, 19935, 353, 5159, 13, 1678, 363, 921, 297, 2897, 29889, 1761, 3972, 29898, 2798, 29918, 3972, 1125, 13, 4706, 4559, 353, 2897, 29889, 2084, 29889, 6500, 3871, 29898, 359, 29889, 2084, 29889, 23579, 568, 486, 29898, 29916, 9601, 29900, 2314, 13, 4706, 4559, 29918, 2176, 353, 10518, 29889, 949, 29918, 7638, 29898, 359, 29889, 2084, 29889, 7122, 29898, 2798, 29918, 3972, 29892, 921, 511, 13, 462, 18884, 2380, 29918, 1054, 29922, 29900, 29892, 16345, 2433, 29905, 29873, 742, 13, 462, 18884, 4839, 29922, 29900, 29892, 13, 462, 18884, 2983, 29922, 1839, 29954, 1600, 742, 4559, 1402, 13, 462, 18884, 14383, 5727, 11759, 29900, 2314, 13, 4706, 848, 29918, 19935, 29889, 4397, 29898, 11249, 29918, 2176, 29897, 13, 1678, 736, 10518, 29889, 17685, 29898, 1272, 29918, 19935, 29892, 9685, 29922, 29896, 29897, 13, 268, 13, 13, 1753, 10366, 29918, 2798, 29879, 29898, 2798, 29918, 3972, 1125, 13, 1678, 9995, 13, 1678, 4702, 479, 4682, 3981, 29879, 1962, 515, 3196, 4559, 2066, 964, 263, 13, 1678, 2323, 12205, 29889, 13, 13, 1678, 4702, 479, 4682, 3981, 29879, 4323, 2450, 4822, 11916, 29889, 16969, 10650, 4682, 13, 1678, 18139, 4822, 20035, 29892, 408, 1532, 408, 1301, 924, 29879, 639, 7284, 313, 3557, 29924, 29897, 18139, 29889, 13, 13, 1678, 826, 3174, 29901, 13, 4706, 2302, 29918, 3972, 313, 1807, 1125, 2224, 304, 3884, 6943, 3154, 23718, 1962, 29889, 12745, 13, 4706, 526, 3806, 304, 1101, 263, 426, 11249, 29889, 978, 1836, 3945, 22006, 11380, 29889, 13, 13, 1678, 16969, 29901, 13, 268, 313, 8977, 29892, 10518, 29889, 17271, 1125, 8600, 310, 11701, 848, 19935, 6943, 10650, 1303, 13, 4706, 18139, 322, 323, 13427, 4226, 1891, 1819, 29889, 7670, 287, 491, 525, 2798, 29915, 322, 525, 29873, 3358, 4286, 29871, 13, 1678, 9995, 13, 1678, 848, 29918, 19935, 353, 5159, 13, 1678, 363, 921, 297, 2897, 29889, 1761, 3972, 29898, 2798, 29918, 3972, 1125, 13, 4706, 4559, 353, 2897, 29889, 2084, 29889, 6500, 3871, 29898, 359, 29889, 2084, 29889, 23579, 568, 486, 29898, 29916, 9601, 29900, 2314, 13, 4706, 4559, 29918, 2176, 353, 10518, 29889, 949, 29918, 7638, 29898, 359, 29889, 2084, 29889, 7122, 29898, 2798, 29918, 3972, 29892, 921, 511, 13, 462, 18884, 2380, 29918, 1054, 29922, 29900, 29892, 16345, 2433, 29905, 29873, 742, 13, 462, 18884, 4839, 29922, 29900, 29892, 13, 462, 18884, 2983, 29922, 1839, 6513, 742, 4559, 1402, 13, 462, 18884, 14383, 5727, 11759, 29900, 2314, 13, 4706, 396, 8147, 2302, 304, 4682, 3309, 11959, 13, 4706, 18139, 29918, 546, 29918, 3188, 353, 4559, 29918, 2176, 29889, 7302, 29898, 2892, 921, 29901, 921, 29961, 29896, 29962, 847, 921, 29961, 29900, 1402, 9685, 29922, 29896, 29897, 13, 13, 4706, 396, 8147, 2533, 310, 364, 2219, 359, 847, 19257, 363, 4226, 2133, 13, 4706, 3001, 29918, 6814, 29890, 353, 18139, 29918, 546, 29918, 3188, 29889, 2083, 580, 13, 4706, 565, 3001, 29918, 6814, 29890, 2804, 29871, 29900, 29901, 13, 9651, 260, 3358, 353, 18139, 29918, 546, 29918, 3188, 29889, 7302, 29898, 2892, 921, 29901, 921, 334, 29871, 29896, 847, 3001, 29918, 6814, 29890, 334, 29871, 29896, 29900, 1068, 29953, 29897, 13, 9651, 260, 3358, 29889, 1267, 420, 29898, 11249, 29892, 297, 6689, 29922, 5574, 29897, 13, 4706, 396, 3001, 19257, 338, 5225, 1599, 694, 1301, 924, 2395, 29892, 260, 3358, 353, 29871, 29900, 363, 599, 29871, 13, 4706, 1683, 29901, 13, 9651, 260, 3358, 353, 4559, 29918, 2176, 29961, 11249, 29962, 13, 13, 4706, 848, 29918, 19935, 29889, 4397, 3319, 29915, 2798, 2396, 4559, 29918, 2176, 29961, 11249, 1402, 525, 29873, 3358, 2396, 260, 3358, 1800, 13, 13, 1678, 2302, 29918, 5344, 353, 10518, 29889, 17685, 4197, 4204, 1839, 2798, 2033, 363, 1269, 297, 848, 29918, 19935, 1402, 9685, 29922, 29896, 29897, 13, 1678, 260, 3358, 29918, 5344, 353, 10518, 29889, 17685, 4197, 4204, 1839, 29873, 3358, 2033, 363, 1269, 297, 848, 29918, 19935, 1402, 9685, 29922, 29896, 29897, 13, 1678, 736, 11117, 2798, 2396, 2798, 29918, 5344, 29892, 525, 29873, 3358, 2396, 260, 3358, 29918, 5344, 29913, 13, 13, 13, 1753, 3349, 29918, 9171, 29918, 1885, 267, 29898, 2798, 29918, 2176, 1125, 13, 1678, 9995, 13, 1678, 15154, 2531, 267, 411, 694, 13623, 10417, 304, 963, 4822, 11916, 29889, 13, 1678, 9995, 13, 1678, 2302, 29918, 2176, 29961, 2798, 29918, 2176, 1275, 29871, 29900, 29962, 353, 7442, 29889, 19377, 13, 1678, 22289, 353, 2302, 29918, 2176, 29889, 8865, 1056, 29898, 3525, 2433, 497, 1495, 13, 1678, 736, 22289, 29889, 5589, 1056, 29898, 1767, 29922, 29900, 29897, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 5807, 557, 331, 1296, 29918, 9933, 353, 5852, 13, 1678, 1018, 29901, 13, 4706, 5807, 557, 331, 1296, 13, 1678, 5174, 4408, 2392, 29901, 13, 4706, 5807, 557, 331, 1296, 29918, 9933, 353, 7700, 13, 13, 1678, 565, 5807, 557, 331, 1296, 29918, 9933, 29901, 13, 4706, 848, 19935, 353, 10366, 29918, 2798, 29879, 29898, 29879, 8546, 331, 1296, 29889, 7529, 1839, 3972, 11287, 13, 4706, 22289, 29918, 2798, 29879, 353, 3349, 29918, 9171, 29918, 1885, 267, 29898, 1272, 19935, 1839, 2798, 11287, 13, 4706, 22289, 29918, 29873, 3358, 353, 848, 19935, 1839, 29873, 3358, 13359, 2029, 29961, 4572, 287, 29918, 2798, 29879, 29889, 2248, 29892, 13, 462, 462, 632, 22289, 29918, 2798, 29879, 29889, 13099, 29962, 13, 4706, 22289, 29918, 2798, 29879, 29889, 517, 29918, 7638, 29898, 29879, 8546, 331, 1296, 29889, 4905, 1839, 2798, 11287, 13, 4706, 22289, 29918, 29873, 3358, 29889, 517, 29918, 7638, 29898, 29879, 8546, 331, 1296, 29889, 4905, 1839, 29873, 3358, 11287, 13, 2 ]
genestack_client/scripts/genestack_user_setup.py
genestack/python-client
2
45187
<reponame>genestack/python-client #!python # -*- coding: utf-8 -*- from __future__ import print_function from __future__ import absolute_import from __future__ import division from __future__ import unicode_literals from future import standard_library standard_library.install_aliases() from builtins import input from builtins import * import os import re import sys from argparse import ArgumentParser from getpass import getpass from operator import attrgetter from genestack_client import GenestackAuthenticationException from genestack_client.genestack_shell import Command, GenestackShell from genestack_client.settings import DEFAULT_HOST, User, config from genestack_client.utils import interactive_select def input_host(): host = input('host [%s]: ' % DEFAULT_HOST).strip() return host or DEFAULT_HOST def validate_alias(alias): expression = re.compile('[a-zA-Z0-9_@\-]+$') return bool(alias and expression.match(alias)) def input_alias(existing): print('Please input alias. (Alias can contain: letters (a-z, A-Z), ' 'digits (0-9), at-sign (@), underscore (_), hyphen (-))') while True: alias = input('alias: ').strip() if not alias: print('Alias cannot be empty') continue if not validate_alias(alias): print('Restricted symbols message') continue if alias in existing: print('Alias must be unique') continue return alias def create_user_from_input(host, alias): """ Ask credentials interactively and return user that can login to platform. :param host: server host :type host: basestring :param alias: user alias :type alias: basestring :return: user :rtype: User """ by_token = 'by token' items = [by_token, 'by email and password'] use_token = interactive_select(items, 'Select authentication') == by_token if use_token: return create_user_from_token(host, alias=alias) else: return create_user_from_input_email_and_password(host, alias=alias) def create_user_from_input_email_and_password(host, alias=None): """ Ask email and password, check that it is possible to login with this credentials and return user. :param host: server host :type host: basestring :param alias: user alias :type alias: basestring :return: user :rtype: User """ print('Specify email and password for host: "%s"' % host, end=' ') if alias: print('and alias: "%s"' % alias) else: print() user_login = None while True: if user_login: res = input('Please specify your user login (email) [%s]: ' % user_login).strip() if res: user_login = res else: user_login = input('Please specify your user login (email): ').strip() if not user_login: print('Login cannot be empty') continue user_password = getpass('Please specify your password for %s: ' % user_login) if not user_password: print('Password cannot be empty') continue if not user_login or not user_password: print() continue user = User(user_login, host=host, password=<PASSWORD>, alias=alias) try: user.get_connection() break except GenestackAuthenticationException: print('Your username or password was incorrect, please try again') return user def create_user_from_token(host, alias=None): print('Host: %s' % host) msg = 'Please specify Genestack API token%s: ' with_alias = '' if not alias else ' for "%s"' % alias msg = msg % with_alias while True: token = getpass(msg) if not token: print('Token cannot be empty') continue user = User(email=None, host=host, password=None, alias=alias, token=token) try: user.get_connection() break except GenestackAuthenticationException: print('Could not login with given token, please try again') return user def check_config(): config_path = config.get_settings_file() if not os.path.exists(config_path): print('You do not seem to have a config file yet. ' 'Please run `genestack-user-setup init`. Exiting') exit(1) class AddUser(Command): COMMAND = 'add' DESCRIPTION = 'Add new user.' OFFLINE = True def run(self): alias = input_alias(config.users.keys()) host = input_host() user = create_user_from_input(host, alias) config.add_user(user) print('User "%s" has been created' % user.alias) def select_user(users, selected=None): """ Choose user from users stored in config. :param users: :param selected: :return: :rtype: User """ user_list = sorted(users.values(), key=lambda x: x.alias) return interactive_select(user_list, 'Select user', to_string=attrgetter('alias'), selected=selected) class ChangePassword(Command): COMMAND = 'change-password' DESCRIPTION = 'Change password for user.' OFFLINE = True def update_parser(self, parent): parent.add_argument('alias', metavar='<alias>', help='Alias for user to change password', nargs='?') def run(self): check_config() users = config.users user = users.get(self.args.alias) if not user: user = select_user(users) if not user.email: print('User without email could be authorized only by token') return while True: user.password = getpass('Input password for %s: ' % user.alias.encode('utf-8')) try: user.get_connection() break except GenestackAuthenticationException: continue config.change_password(user.alias, user.password) print('Password has been changed successfully') class ChangeToken(Command): COMMAND = 'change-token' DESCRIPTION = 'Change token for user.' OFFLINE = True def update_parser(self, parent): parent.add_argument('alias', metavar='<alias>', help='Alias for user to change token for', nargs='?') def run(self): check_config() users = config.users user = users.get(self.args.alias) if not user: user = select_user(users) new_user = create_user_from_token(user.host, alias=user.alias) user.token = new_user.token config.change_token(user.alias, user.token) print('Token has been changed successfully') class SetDefault(Command): COMMAND = 'default' DESCRIPTION = 'Set default user.' OFFLINE = True def update_parser(self, parent): parent.add_argument('alias', metavar='<alias>', help='Alias for user to change password', nargs='?') def run(self): check_config() users = config.users user = users.get(self.args.alias) if not user: user = select_user(users, selected=config.default_user) if user.alias != config.default_user.alias: config.set_default_user(user) print('Default user has been set to "%s"' % user.alias) else: print('Default user has not been changed') class Remove(Command): COMMAND = 'remove' DESCRIPTION = 'Remove user.' OFFLINE = True def update_parser(self, parent): parent.add_argument('alias', metavar='<alias>', help='Alias for user to change password', nargs='?') def run(self): check_config() users = config.users user = users.get(self.args.alias) if not user: user = select_user(users) if user.alias == config.default_user.alias: print('Cannot delete default user') return config.remove_user(user) print('"%s" has been removed from config' % user.alias) class RenameUser(Command): COMMAND = 'rename' DESCRIPTION = 'Rename user.' OFFLINE = True def update_parser(self, parent): parent.add_argument('alias', metavar='<alias>', help='Alias to be renamed', nargs='?') parent.add_argument('new_alias', metavar='<new_alias>', help='New alias', nargs='?') def run(self): check_config() users = config.users user = users.get(self.args.alias) if not user: print('Select user to rename') user = select_user(users) if not self.args.new_alias or not validate_alias(self.args.new_alias): print('Enter new alias') new_alias = input_alias(users.keys()) else: new_alias = self.args.new_alias new_user = User(email=user.email, alias=new_alias, host=user.host, password=<PASSWORD>, token=user.token) config.add_user(new_user, save=False) if user.alias == config.default_user.alias: config.set_default_user(new_user, save=False) config.remove_user(user) print('"%s" alias changed to "%s"' % (user.alias, new_user.alias)) class List(Command): COMMAND = 'list' DESCRIPTION = 'List all users.' OFFLINE = True def run(self): check_config() users = sorted(config.users.items()) default_user_alias = config.default_user and config.default_user.alias for key, user in users: print() print('%s%s:' % (key, ' (default)' if default_user_alias == key else '')) print(' %-10s%s' % ('email', user.email)) print(' %-10s%s' % ('host', user.host)) class Path(Command): COMMAND = 'path' DESCRIPTION = 'Show path to configuration file.' OFFLINE = True def run(self): print(config.get_settings_file()) class Init(Command): COMMAND = 'init' DESCRIPTION = 'Create default settings.' OFFLINE = True def get_command_parser(self, parser=None): parser = parser or ArgumentParser(description=self.DESCRIPTION) parser.description = self.DESCRIPTION group = parser.add_argument_group('command arguments') self.update_parser(group) group.add_argument('-H', '--host', default=DEFAULT_HOST, help='Genestack host, ' 'change it to connect somewhere else than %s' % DEFAULT_HOST, metavar='<host>') return parser def run(self): """ Create config file if it is not present. Catch ``KeyboardInterrupt`` and ``EOFError`` is required here for case when this command is run for first time and in shell mode. If we don't quit here, shell will continue execution and ask credentials once more. """ # Hardcoded alias that created for the first user only. # Normal usecase is when user have single account and don't care about alias name. # Advanced users can rename alias. default_alias = 'Default' try: config_path = config.get_settings_file() if os.path.exists(config_path): print('A config file already exists at %s' % config_path) return print('If you do not have a Genestack account, you need to create one first') user = create_user_from_input(self.args.host, default_alias) config.add_user(user) # adding first user make him default. print('Config file at "%s" has been created successfully' % config_path) except (KeyboardInterrupt, EOFError): sys.stdout.flush() sys.stderr.write('\nError: Init is not finished\n') exit(1) class UserManagement(GenestackShell): DESCRIPTION = 'Genestack user management application.' COMMAND_LIST = [ Init, List, AddUser, SetDefault, ChangePassword, ChangeToken, Path, Remove, RenameUser ] intro = "User setup shell.\nType 'help' for list of available commands.\n\n" prompt = 'user_setup> ' def set_shell_user(self, args): config_path = config.get_settings_file() if not os.path.exists(config_path): print('No config file was found, creating one interactively') self.process_command(Init(), ['--host', args.host or DEFAULT_HOST], False) args.host = None # do not provide host for future use of arguments def main(): shell = UserManagement() shell.cmdloop() if __name__ == '__main__': main()
[ 1, 529, 276, 1112, 420, 29958, 1885, 342, 547, 29914, 4691, 29899, 4645, 13, 29937, 29991, 4691, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 13, 3166, 4770, 29888, 9130, 1649, 1053, 1596, 29918, 2220, 13, 3166, 4770, 29888, 9130, 1649, 1053, 8380, 29918, 5215, 13, 3166, 4770, 29888, 9130, 1649, 1053, 8542, 13, 3166, 4770, 29888, 9130, 1649, 1053, 29104, 29918, 20889, 1338, 13, 13, 3166, 5434, 1053, 3918, 29918, 5258, 13, 15770, 29918, 5258, 29889, 6252, 29918, 2606, 2129, 580, 13, 3166, 4240, 1144, 1053, 1881, 13, 3166, 4240, 1144, 1053, 334, 13, 5215, 2897, 13, 5215, 337, 13, 5215, 10876, 13, 3166, 1852, 5510, 1053, 23125, 11726, 13, 3166, 679, 3364, 1053, 679, 3364, 13, 3166, 5455, 1053, 12421, 657, 357, 13, 13, 3166, 2531, 342, 547, 29918, 4645, 1053, 5739, 342, 547, 16746, 2451, 13, 3166, 2531, 342, 547, 29918, 4645, 29889, 1885, 342, 547, 29918, 15903, 1053, 10516, 29892, 5739, 342, 547, 16037, 13, 3166, 2531, 342, 547, 29918, 4645, 29889, 11027, 1053, 22236, 29918, 20832, 29892, 4911, 29892, 2295, 13, 3166, 2531, 342, 547, 29918, 4645, 29889, 13239, 1053, 28923, 29918, 2622, 13, 13, 13, 1753, 1881, 29918, 3069, 7295, 13, 1678, 3495, 353, 1881, 877, 3069, 518, 29995, 29879, 5387, 525, 1273, 22236, 29918, 20832, 467, 17010, 580, 13, 1678, 736, 3495, 470, 22236, 29918, 20832, 13, 13, 13, 1753, 12725, 29918, 19973, 29898, 19973, 1125, 13, 1678, 4603, 353, 337, 29889, 12198, 877, 29961, 29874, 29899, 25265, 29899, 29999, 29900, 29899, 29929, 29918, 29992, 29905, 29899, 10062, 29938, 1495, 13, 1678, 736, 6120, 29898, 19973, 322, 4603, 29889, 4352, 29898, 19973, 876, 13, 13, 13, 1753, 1881, 29918, 19973, 29898, 735, 15423, 1125, 13, 1678, 1596, 877, 12148, 1881, 13995, 29889, 313, 29909, 18849, 508, 1712, 29901, 8721, 313, 29874, 29899, 29920, 29892, 319, 29899, 29999, 511, 525, 13, 3986, 525, 7501, 1169, 313, 29900, 29899, 29929, 511, 472, 29899, 4530, 20164, 511, 23400, 3221, 9423, 511, 7498, 9789, 8521, 876, 1495, 13, 1678, 1550, 5852, 29901, 13, 4706, 13995, 353, 1881, 877, 19973, 29901, 525, 467, 17010, 580, 13, 4706, 565, 451, 13995, 29901, 13, 9651, 1596, 877, 29909, 18849, 2609, 367, 4069, 1495, 13, 9651, 6773, 13, 4706, 565, 451, 12725, 29918, 19973, 29898, 19973, 1125, 13, 9651, 1596, 877, 15078, 4146, 287, 15072, 2643, 1495, 13, 9651, 6773, 13, 4706, 565, 13995, 297, 5923, 29901, 13, 9651, 1596, 877, 29909, 18849, 1818, 367, 5412, 1495, 13, 9651, 6773, 13, 4706, 736, 13995, 13, 13, 13, 1753, 1653, 29918, 1792, 29918, 3166, 29918, 2080, 29898, 3069, 29892, 13995, 1125, 13, 1678, 9995, 13, 1678, 26579, 16140, 16254, 3598, 322, 736, 1404, 393, 508, 6464, 304, 7481, 29889, 13, 13, 1678, 584, 3207, 3495, 29901, 29871, 1923, 3495, 13, 1678, 584, 1853, 3495, 29901, 29871, 2362, 342, 5393, 13, 1678, 584, 3207, 13995, 29901, 1404, 13995, 13, 1678, 584, 1853, 13995, 29901, 2362, 342, 5393, 13, 1678, 584, 2457, 29901, 1404, 13, 1678, 584, 29878, 1853, 29901, 4911, 13, 1678, 9995, 13, 1678, 491, 29918, 6979, 353, 525, 1609, 5993, 29915, 13, 1678, 4452, 353, 518, 1609, 29918, 6979, 29892, 525, 1609, 4876, 322, 4800, 2033, 13, 1678, 671, 29918, 6979, 353, 28923, 29918, 2622, 29898, 7076, 29892, 525, 3549, 10760, 1495, 1275, 491, 29918, 6979, 13, 13, 1678, 565, 671, 29918, 6979, 29901, 13, 4706, 736, 1653, 29918, 1792, 29918, 3166, 29918, 6979, 29898, 3069, 29892, 13995, 29922, 19973, 29897, 13, 1678, 1683, 29901, 13, 4706, 736, 1653, 29918, 1792, 29918, 3166, 29918, 2080, 29918, 5269, 29918, 392, 29918, 5630, 29898, 3069, 29892, 13995, 29922, 19973, 29897, 13, 13, 13, 1753, 1653, 29918, 1792, 29918, 3166, 29918, 2080, 29918, 5269, 29918, 392, 29918, 5630, 29898, 3069, 29892, 13995, 29922, 8516, 1125, 13, 1678, 9995, 13, 1678, 26579, 4876, 322, 4800, 29892, 1423, 393, 372, 338, 1950, 304, 6464, 411, 445, 16140, 13, 1678, 322, 736, 1404, 29889, 13, 13, 1678, 584, 3207, 3495, 29901, 29871, 1923, 3495, 13, 1678, 584, 1853, 3495, 29901, 29871, 2362, 342, 5393, 13, 1678, 584, 3207, 13995, 29901, 1404, 13995, 13, 1678, 584, 1853, 13995, 29901, 2362, 342, 5393, 13, 1678, 584, 2457, 29901, 1404, 13, 1678, 584, 29878, 1853, 29901, 4911, 13, 1678, 9995, 13, 1678, 1596, 877, 10299, 1598, 4876, 322, 4800, 363, 3495, 29901, 11860, 29879, 29908, 29915, 1273, 3495, 29892, 1095, 2433, 25710, 13, 1678, 565, 13995, 29901, 13, 4706, 1596, 877, 392, 13995, 29901, 11860, 29879, 29908, 29915, 1273, 13995, 29897, 13, 1678, 1683, 29901, 13, 4706, 1596, 580, 13, 1678, 1404, 29918, 7507, 353, 6213, 13, 1678, 1550, 5852, 29901, 13, 4706, 565, 1404, 29918, 7507, 29901, 13, 9651, 620, 353, 1881, 877, 12148, 6084, 596, 1404, 6464, 313, 5269, 29897, 518, 29995, 29879, 5387, 525, 1273, 1404, 29918, 7507, 467, 17010, 580, 13, 9651, 565, 620, 29901, 13, 18884, 1404, 29918, 7507, 353, 620, 13, 4706, 1683, 29901, 13, 9651, 1404, 29918, 7507, 353, 1881, 877, 12148, 6084, 596, 1404, 6464, 313, 5269, 1125, 525, 467, 17010, 580, 13, 9651, 565, 451, 1404, 29918, 7507, 29901, 13, 18884, 1596, 877, 11049, 2609, 367, 4069, 1495, 13, 18884, 6773, 13, 4706, 1404, 29918, 5630, 353, 679, 3364, 877, 12148, 6084, 596, 4800, 363, 1273, 29879, 29901, 525, 1273, 1404, 29918, 7507, 29897, 13, 4706, 565, 451, 1404, 29918, 5630, 29901, 13, 9651, 1596, 877, 10048, 2609, 367, 4069, 1495, 13, 9651, 6773, 13, 13, 4706, 565, 451, 1404, 29918, 7507, 470, 451, 1404, 29918, 5630, 29901, 13, 9651, 1596, 580, 13, 9651, 6773, 13, 4706, 1404, 353, 4911, 29898, 1792, 29918, 7507, 29892, 3495, 29922, 3069, 29892, 4800, 29922, 29966, 25711, 17013, 10202, 13995, 29922, 19973, 29897, 13, 4706, 1018, 29901, 13, 9651, 1404, 29889, 657, 29918, 9965, 580, 13, 9651, 2867, 13, 4706, 5174, 5739, 342, 547, 16746, 2451, 29901, 13, 9651, 1596, 877, 10858, 8952, 470, 4800, 471, 10240, 29892, 3113, 1018, 1449, 1495, 13, 1678, 736, 1404, 13, 13, 13, 1753, 1653, 29918, 1792, 29918, 3166, 29918, 6979, 29898, 3069, 29892, 13995, 29922, 8516, 1125, 13, 1678, 1596, 877, 8514, 29901, 1273, 29879, 29915, 1273, 3495, 29897, 13, 1678, 10191, 353, 525, 12148, 6084, 5739, 342, 547, 3450, 5993, 29995, 29879, 29901, 525, 13, 1678, 411, 29918, 19973, 353, 6629, 565, 451, 13995, 1683, 525, 363, 11860, 29879, 29908, 29915, 1273, 13995, 13, 1678, 10191, 353, 10191, 1273, 411, 29918, 19973, 13, 1678, 1550, 5852, 29901, 13, 4706, 5993, 353, 679, 3364, 29898, 7645, 29897, 13, 4706, 565, 451, 5993, 29901, 13, 9651, 1596, 877, 6066, 2609, 367, 4069, 1495, 13, 9651, 6773, 13, 4706, 1404, 353, 4911, 29898, 5269, 29922, 8516, 29892, 3495, 29922, 3069, 29892, 4800, 29922, 8516, 29892, 13995, 29922, 19973, 29892, 5993, 29922, 6979, 29897, 13, 4706, 1018, 29901, 13, 9651, 1404, 29889, 657, 29918, 9965, 580, 13, 9651, 2867, 13, 4706, 5174, 5739, 342, 547, 16746, 2451, 29901, 13, 9651, 1596, 877, 23323, 451, 6464, 411, 2183, 5993, 29892, 3113, 1018, 1449, 1495, 13, 1678, 736, 1404, 13, 13, 13, 1753, 1423, 29918, 2917, 7295, 13, 1678, 2295, 29918, 2084, 353, 2295, 29889, 657, 29918, 11027, 29918, 1445, 580, 13, 1678, 565, 451, 2897, 29889, 2084, 29889, 9933, 29898, 2917, 29918, 2084, 1125, 13, 4706, 1596, 877, 3492, 437, 451, 2833, 304, 505, 263, 2295, 934, 3447, 29889, 525, 13, 795, 525, 12148, 1065, 421, 1885, 342, 547, 29899, 1792, 29899, 14669, 2069, 1412, 1222, 11407, 1495, 13, 4706, 6876, 29898, 29896, 29897, 13, 13, 13, 1990, 3462, 2659, 29898, 6255, 1125, 13, 1678, 23353, 1529, 2797, 353, 525, 1202, 29915, 13, 1678, 23050, 24290, 2725, 353, 525, 2528, 716, 1404, 6169, 13, 1678, 438, 4198, 18521, 353, 5852, 13, 13, 1678, 822, 1065, 29898, 1311, 1125, 13, 4706, 13995, 353, 1881, 29918, 19973, 29898, 2917, 29889, 7193, 29889, 8149, 3101, 13, 4706, 3495, 353, 1881, 29918, 3069, 580, 13, 4706, 1404, 353, 1653, 29918, 1792, 29918, 3166, 29918, 2080, 29898, 3069, 29892, 13995, 29897, 13, 4706, 2295, 29889, 1202, 29918, 1792, 29898, 1792, 29897, 13, 4706, 1596, 877, 2659, 11860, 29879, 29908, 756, 1063, 2825, 29915, 1273, 1404, 29889, 19973, 29897, 13, 13, 13, 1753, 1831, 29918, 1792, 29898, 7193, 29892, 4629, 29922, 8516, 1125, 13, 1678, 9995, 13, 1678, 14542, 852, 1404, 515, 4160, 6087, 297, 2295, 29889, 13, 13, 1678, 584, 3207, 4160, 29901, 13, 1678, 584, 3207, 4629, 29901, 13, 1678, 584, 2457, 29901, 13, 1678, 584, 29878, 1853, 29901, 4911, 13, 1678, 9995, 13, 1678, 1404, 29918, 1761, 353, 12705, 29898, 7193, 29889, 5975, 3285, 1820, 29922, 2892, 921, 29901, 921, 29889, 19973, 29897, 13, 1678, 736, 28923, 29918, 2622, 29898, 1792, 29918, 1761, 29892, 525, 3549, 1404, 742, 304, 29918, 1807, 29922, 5552, 657, 357, 877, 19973, 5477, 4629, 29922, 8391, 29897, 13, 13, 13, 1990, 10726, 10048, 29898, 6255, 1125, 13, 1678, 23353, 1529, 2797, 353, 525, 3167, 29899, 5630, 29915, 13, 1678, 23050, 24290, 2725, 353, 525, 7277, 4800, 363, 1404, 6169, 13, 1678, 438, 4198, 18521, 353, 5852, 13, 13, 1678, 822, 2767, 29918, 16680, 29898, 1311, 29892, 3847, 1125, 13, 4706, 3847, 29889, 1202, 29918, 23516, 877, 19973, 742, 1539, 485, 279, 2433, 29966, 19973, 29958, 742, 1371, 2433, 29909, 18849, 363, 1404, 304, 1735, 4800, 742, 302, 5085, 2433, 29973, 1495, 13, 13, 1678, 822, 1065, 29898, 1311, 1125, 13, 4706, 1423, 29918, 2917, 580, 13, 4706, 4160, 353, 2295, 29889, 7193, 13, 4706, 1404, 353, 4160, 29889, 657, 29898, 1311, 29889, 5085, 29889, 19973, 29897, 13, 4706, 565, 451, 1404, 29901, 13, 9651, 1404, 353, 1831, 29918, 1792, 29898, 7193, 29897, 13, 13, 4706, 565, 451, 1404, 29889, 5269, 29901, 13, 9651, 1596, 877, 2659, 1728, 4876, 1033, 367, 4148, 1891, 871, 491, 5993, 1495, 13, 9651, 736, 13, 13, 4706, 1550, 5852, 29901, 13, 9651, 1404, 29889, 5630, 353, 679, 3364, 877, 4290, 4800, 363, 1273, 29879, 29901, 525, 1273, 1404, 29889, 19973, 29889, 12508, 877, 9420, 29899, 29947, 8785, 13, 9651, 1018, 29901, 13, 18884, 1404, 29889, 657, 29918, 9965, 580, 13, 18884, 2867, 13, 9651, 5174, 5739, 342, 547, 16746, 2451, 29901, 13, 18884, 6773, 13, 4706, 2295, 29889, 3167, 29918, 5630, 29898, 1792, 29889, 19973, 29892, 1404, 29889, 5630, 29897, 13, 4706, 1596, 877, 10048, 756, 1063, 3939, 8472, 1495, 13, 13, 13, 1990, 10726, 6066, 29898, 6255, 1125, 13, 1678, 23353, 1529, 2797, 353, 525, 3167, 29899, 6979, 29915, 13, 1678, 23050, 24290, 2725, 353, 525, 7277, 5993, 363, 1404, 6169, 13, 1678, 438, 4198, 18521, 353, 5852, 13, 13, 1678, 822, 2767, 29918, 16680, 29898, 1311, 29892, 3847, 1125, 13, 4706, 3847, 29889, 1202, 29918, 23516, 877, 19973, 742, 1539, 485, 279, 2433, 29966, 19973, 29958, 742, 13, 462, 9651, 1371, 2433, 29909, 18849, 363, 1404, 304, 1735, 5993, 363, 742, 302, 5085, 2433, 29973, 1495, 13, 13, 1678, 822, 1065, 29898, 1311, 1125, 13, 4706, 1423, 29918, 2917, 580, 13, 4706, 4160, 353, 2295, 29889, 7193, 13, 4706, 1404, 353, 4160, 29889, 657, 29898, 1311, 29889, 5085, 29889, 19973, 29897, 13, 4706, 565, 451, 1404, 29901, 13, 9651, 1404, 353, 1831, 29918, 1792, 29898, 7193, 29897, 13, 4706, 716, 29918, 1792, 353, 1653, 29918, 1792, 29918, 3166, 29918, 6979, 29898, 1792, 29889, 3069, 29892, 13995, 29922, 1792, 29889, 19973, 29897, 13, 4706, 1404, 29889, 6979, 353, 716, 29918, 1792, 29889, 6979, 13, 4706, 2295, 29889, 3167, 29918, 6979, 29898, 1792, 29889, 19973, 29892, 1404, 29889, 6979, 29897, 13, 4706, 1596, 877, 6066, 756, 1063, 3939, 8472, 1495, 13, 13, 13, 1990, 3789, 4592, 29898, 6255, 1125, 13, 1678, 23353, 1529, 2797, 353, 525, 4381, 29915, 13, 1678, 23050, 24290, 2725, 353, 525, 2697, 2322, 1404, 6169, 13, 1678, 438, 4198, 18521, 353, 5852, 13, 13, 1678, 822, 2767, 29918, 16680, 29898, 1311, 29892, 3847, 1125, 13, 4706, 3847, 29889, 1202, 29918, 23516, 877, 19973, 742, 1539, 485, 279, 2433, 29966, 19973, 29958, 742, 1371, 2433, 29909, 18849, 363, 1404, 304, 1735, 4800, 742, 302, 5085, 2433, 29973, 1495, 13, 13, 1678, 822, 1065, 29898, 1311, 1125, 13, 4706, 1423, 29918, 2917, 580, 13, 4706, 4160, 353, 2295, 29889, 7193, 13, 4706, 1404, 353, 4160, 29889, 657, 29898, 1311, 29889, 5085, 29889, 19973, 29897, 13, 4706, 565, 451, 1404, 29901, 13, 9651, 1404, 353, 1831, 29918, 1792, 29898, 7193, 29892, 4629, 29922, 2917, 29889, 4381, 29918, 1792, 29897, 13, 4706, 565, 1404, 29889, 19973, 2804, 2295, 29889, 4381, 29918, 1792, 29889, 19973, 29901, 13, 9651, 2295, 29889, 842, 29918, 4381, 29918, 1792, 29898, 1792, 29897, 13, 9651, 1596, 877, 4592, 1404, 756, 1063, 731, 304, 11860, 29879, 29908, 29915, 1273, 1404, 29889, 19973, 29897, 13, 4706, 1683, 29901, 13, 9651, 1596, 877, 4592, 1404, 756, 451, 1063, 3939, 1495, 13, 13, 13, 1990, 15154, 29898, 6255, 1125, 13, 1678, 23353, 1529, 2797, 353, 525, 5992, 29915, 13, 1678, 23050, 24290, 2725, 353, 525, 15941, 1404, 6169, 13, 1678, 438, 4198, 18521, 353, 5852, 13, 13, 1678, 822, 2767, 29918, 16680, 29898, 1311, 29892, 3847, 1125, 13, 4706, 3847, 29889, 1202, 29918, 23516, 877, 19973, 742, 1539, 485, 279, 2433, 29966, 19973, 29958, 742, 1371, 2433, 29909, 18849, 363, 1404, 304, 1735, 4800, 742, 302, 5085, 2433, 29973, 1495, 13, 13, 1678, 822, 1065, 29898, 1311, 1125, 13, 4706, 1423, 29918, 2917, 580, 13, 4706, 4160, 353, 2295, 29889, 7193, 13, 13, 4706, 1404, 353, 4160, 29889, 657, 29898, 1311, 29889, 5085, 29889, 19973, 29897, 13, 4706, 565, 451, 1404, 29901, 13, 9651, 1404, 353, 1831, 29918, 1792, 29898, 7193, 29897, 13, 4706, 565, 1404, 29889, 19973, 1275, 2295, 29889, 4381, 29918, 1792, 29889, 19973, 29901, 13, 9651, 1596, 877, 29089, 5217, 2322, 1404, 1495, 13, 9651, 736, 13, 4706, 2295, 29889, 5992, 29918, 1792, 29898, 1792, 29897, 13, 4706, 1596, 877, 29908, 29995, 29879, 29908, 756, 1063, 6206, 515, 2295, 29915, 1273, 1404, 29889, 19973, 29897, 13, 13, 13, 1990, 390, 3871, 2659, 29898, 6255, 1125, 13, 1678, 23353, 1529, 2797, 353, 525, 1267, 420, 29915, 13, 1678, 23050, 24290, 2725, 353, 525, 29934, 3871, 1404, 6169, 13, 1678, 438, 4198, 18521, 353, 5852, 13, 13, 1678, 822, 2767, 29918, 16680, 29898, 1311, 29892, 3847, 1125, 13, 4706, 3847, 29889, 1202, 29918, 23516, 877, 19973, 742, 1539, 485, 279, 2433, 29966, 19973, 29958, 742, 1371, 2433, 29909, 18849, 304, 367, 19533, 742, 302, 5085, 2433, 29973, 1495, 13, 4706, 3847, 29889, 1202, 29918, 23516, 877, 1482, 29918, 19973, 742, 1539, 485, 279, 2433, 29966, 1482, 29918, 19973, 29958, 742, 1371, 2433, 4373, 13995, 742, 302, 5085, 2433, 29973, 1495, 13, 13, 1678, 822, 1065, 29898, 1311, 1125, 13, 4706, 1423, 29918, 2917, 580, 13, 4706, 4160, 353, 2295, 29889, 7193, 13, 13, 4706, 1404, 353, 4160, 29889, 657, 29898, 1311, 29889, 5085, 29889, 19973, 29897, 13, 13, 4706, 565, 451, 1404, 29901, 13, 9651, 1596, 877, 3549, 1404, 304, 19508, 1495, 13, 9651, 1404, 353, 1831, 29918, 1792, 29898, 7193, 29897, 13, 4706, 565, 451, 1583, 29889, 5085, 29889, 1482, 29918, 19973, 470, 451, 12725, 29918, 19973, 29898, 1311, 29889, 5085, 29889, 1482, 29918, 19973, 1125, 13, 9651, 1596, 877, 10399, 716, 13995, 1495, 13, 9651, 716, 29918, 19973, 353, 1881, 29918, 19973, 29898, 7193, 29889, 8149, 3101, 13, 4706, 1683, 29901, 13, 9651, 716, 29918, 19973, 353, 1583, 29889, 5085, 29889, 1482, 29918, 19973, 13, 13, 4706, 716, 29918, 1792, 353, 4911, 29898, 5269, 29922, 1792, 29889, 5269, 29892, 13995, 29922, 1482, 29918, 19973, 29892, 3495, 29922, 1792, 29889, 3069, 29892, 4800, 29922, 29966, 25711, 17013, 10202, 13, 462, 4706, 5993, 29922, 1792, 29889, 6979, 29897, 13, 13, 4706, 2295, 29889, 1202, 29918, 1792, 29898, 1482, 29918, 1792, 29892, 4078, 29922, 8824, 29897, 13, 4706, 565, 1404, 29889, 19973, 1275, 2295, 29889, 4381, 29918, 1792, 29889, 19973, 29901, 13, 9651, 2295, 29889, 842, 29918, 4381, 29918, 1792, 29898, 1482, 29918, 1792, 29892, 4078, 29922, 8824, 29897, 13, 13, 4706, 2295, 29889, 5992, 29918, 1792, 29898, 1792, 29897, 13, 4706, 1596, 877, 29908, 29995, 29879, 29908, 13995, 3939, 304, 11860, 29879, 29908, 29915, 1273, 313, 1792, 29889, 19973, 29892, 716, 29918, 1792, 29889, 19973, 876, 13, 13, 13, 1990, 2391, 29898, 6255, 1125, 13, 1678, 23353, 1529, 2797, 353, 525, 1761, 29915, 13, 1678, 23050, 24290, 2725, 353, 525, 1293, 599, 4160, 6169, 13, 1678, 438, 4198, 18521, 353, 5852, 13, 13, 1678, 822, 1065, 29898, 1311, 1125, 13, 4706, 1423, 29918, 2917, 580, 13, 4706, 4160, 353, 12705, 29898, 2917, 29889, 7193, 29889, 7076, 3101, 13, 13, 4706, 2322, 29918, 1792, 29918, 19973, 353, 2295, 29889, 4381, 29918, 1792, 322, 2295, 29889, 4381, 29918, 1792, 29889, 19973, 13, 13, 4706, 363, 1820, 29892, 1404, 297, 4160, 29901, 13, 9651, 1596, 580, 13, 9651, 1596, 877, 29995, 29879, 29995, 29879, 11283, 1273, 313, 1989, 29892, 525, 313, 4381, 16029, 565, 2322, 29918, 1792, 29918, 19973, 1275, 1820, 1683, 6629, 876, 13, 9651, 1596, 877, 29871, 1273, 29899, 29896, 29900, 29879, 29995, 29879, 29915, 1273, 6702, 5269, 742, 1404, 29889, 5269, 876, 13, 9651, 1596, 877, 29871, 1273, 29899, 29896, 29900, 29879, 29995, 29879, 29915, 1273, 6702, 3069, 742, 1404, 29889, 3069, 876, 13, 13, 13, 1990, 10802, 29898, 6255, 1125, 13, 1678, 23353, 1529, 2797, 353, 525, 2084, 29915, 13, 1678, 23050, 24290, 2725, 353, 525, 8964, 2224, 304, 5285, 934, 6169, 13, 1678, 438, 4198, 18521, 353, 5852, 13, 13, 1678, 822, 1065, 29898, 1311, 1125, 13, 4706, 1596, 29898, 2917, 29889, 657, 29918, 11027, 29918, 1445, 3101, 13, 13, 13, 1990, 10886, 29898, 6255, 1125, 13, 1678, 23353, 1529, 2797, 353, 525, 2344, 29915, 13, 1678, 23050, 24290, 2725, 353, 525, 4391, 2322, 6055, 6169, 13, 1678, 438, 4198, 18521, 353, 5852, 13, 13, 1678, 822, 679, 29918, 6519, 29918, 16680, 29898, 1311, 29892, 13812, 29922, 8516, 1125, 13, 4706, 13812, 353, 13812, 470, 23125, 11726, 29898, 8216, 29922, 1311, 29889, 2287, 7187, 24290, 2725, 29897, 13, 4706, 13812, 29889, 8216, 353, 1583, 29889, 2287, 7187, 24290, 2725, 13, 4706, 2318, 353, 13812, 29889, 1202, 29918, 23516, 29918, 2972, 877, 6519, 6273, 1495, 13, 4706, 1583, 29889, 5504, 29918, 16680, 29898, 2972, 29897, 13, 4706, 2318, 29889, 1202, 29918, 23516, 877, 29899, 29950, 742, 525, 489, 3069, 742, 2322, 29922, 23397, 29918, 20832, 29892, 13, 462, 965, 1371, 2433, 15462, 342, 547, 3495, 29892, 525, 13, 462, 18884, 525, 3167, 372, 304, 4511, 9051, 1683, 1135, 1273, 29879, 29915, 1273, 22236, 29918, 20832, 29892, 13, 462, 965, 1539, 485, 279, 2433, 29966, 3069, 29958, 1495, 13, 4706, 736, 13812, 13, 13, 1678, 822, 1065, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 6204, 2295, 934, 565, 372, 338, 451, 2198, 29889, 13, 13, 4706, 315, 905, 4954, 2558, 3377, 4074, 6685, 16159, 322, 4954, 29923, 9800, 2392, 16159, 338, 3734, 1244, 363, 1206, 13, 4706, 746, 445, 1899, 338, 1065, 363, 937, 931, 322, 297, 6473, 4464, 29889, 13, 4706, 960, 591, 1016, 29915, 29873, 23283, 1244, 29892, 6473, 674, 6773, 8225, 322, 2244, 16140, 2748, 901, 29889, 13, 4706, 9995, 13, 13, 4706, 396, 10999, 29659, 13995, 393, 2825, 363, 278, 937, 1404, 871, 29889, 13, 4706, 396, 21981, 671, 4878, 338, 746, 1404, 505, 2323, 3633, 322, 1016, 29915, 29873, 2562, 1048, 13995, 1024, 29889, 13, 4706, 396, 29287, 4160, 508, 19508, 13995, 29889, 13, 4706, 2322, 29918, 19973, 353, 525, 4592, 29915, 13, 13, 4706, 1018, 29901, 13, 9651, 2295, 29918, 2084, 353, 2295, 29889, 657, 29918, 11027, 29918, 1445, 580, 13, 9651, 565, 2897, 29889, 2084, 29889, 9933, 29898, 2917, 29918, 2084, 1125, 13, 18884, 1596, 877, 29909, 2295, 934, 2307, 4864, 472, 1273, 29879, 29915, 1273, 2295, 29918, 2084, 29897, 13, 18884, 736, 13, 9651, 1596, 877, 3644, 366, 437, 451, 505, 263, 5739, 342, 547, 3633, 29892, 366, 817, 304, 1653, 697, 937, 1495, 13, 13, 9651, 1404, 353, 1653, 29918, 1792, 29918, 3166, 29918, 2080, 29898, 1311, 29889, 5085, 29889, 3069, 29892, 2322, 29918, 19973, 29897, 13, 9651, 2295, 29889, 1202, 29918, 1792, 29898, 1792, 29897, 29871, 396, 4417, 937, 1404, 1207, 1075, 2322, 29889, 13, 9651, 1596, 877, 3991, 934, 472, 11860, 29879, 29908, 756, 1063, 2825, 8472, 29915, 1273, 2295, 29918, 2084, 29897, 13, 4706, 5174, 313, 2558, 3377, 4074, 6685, 29892, 382, 9800, 2392, 1125, 13, 9651, 10876, 29889, 25393, 29889, 23126, 580, 13, 9651, 10876, 29889, 303, 20405, 29889, 3539, 28909, 29876, 2392, 29901, 10886, 338, 451, 7743, 29905, 29876, 1495, 13, 9651, 6876, 29898, 29896, 29897, 13, 13, 13, 1990, 4911, 27107, 29898, 15462, 342, 547, 16037, 1125, 13, 1678, 23050, 24290, 2725, 353, 525, 15462, 342, 547, 1404, 10643, 2280, 6169, 13, 1678, 23353, 1529, 2797, 29918, 24360, 353, 518, 13, 4706, 10886, 29892, 13, 4706, 2391, 29892, 13, 4706, 3462, 2659, 29892, 13, 4706, 3789, 4592, 29892, 13, 4706, 10726, 10048, 29892, 13, 4706, 10726, 6066, 29892, 13, 4706, 10802, 29892, 13, 4706, 15154, 29892, 13, 4706, 390, 3871, 2659, 13, 1678, 4514, 13, 1678, 22909, 353, 376, 2659, 6230, 6473, 7790, 29876, 1542, 525, 8477, 29915, 363, 1051, 310, 3625, 8260, 7790, 29876, 29905, 29876, 29908, 13, 1678, 9508, 353, 525, 1792, 29918, 14669, 29958, 525, 13, 13, 1678, 822, 731, 29918, 15903, 29918, 1792, 29898, 1311, 29892, 6389, 1125, 13, 4706, 2295, 29918, 2084, 353, 2295, 29889, 657, 29918, 11027, 29918, 1445, 580, 13, 4706, 565, 451, 2897, 29889, 2084, 29889, 9933, 29898, 2917, 29918, 2084, 1125, 13, 9651, 1596, 877, 3782, 2295, 934, 471, 1476, 29892, 4969, 697, 16254, 3598, 1495, 13, 9651, 1583, 29889, 5014, 29918, 6519, 29898, 6644, 3285, 6024, 489, 3069, 742, 6389, 29889, 3069, 470, 22236, 29918, 20832, 1402, 7700, 29897, 13, 9651, 6389, 29889, 3069, 353, 6213, 29871, 396, 437, 451, 3867, 3495, 363, 5434, 671, 310, 6273, 13, 13, 13, 1753, 1667, 7295, 13, 1678, 6473, 353, 4911, 27107, 580, 13, 1678, 6473, 29889, 9006, 7888, 580, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 1667, 580, 13, 2 ]
froide_crowdfunding/migrations/0005_crowdfunding_public_interest.py
okfde/froide-crowdfunding
1
183047
# Generated by Django 2.1.8 on 2019-04-15 09:32 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('froide_crowdfunding', '0004_contribution_public'), ] operations = [ migrations.AddField( model_name='crowdfunding', name='public_interest', field=models.TextField(blank=True), ), ]
[ 1, 396, 3251, 630, 491, 15337, 29871, 29906, 29889, 29896, 29889, 29947, 373, 29871, 29906, 29900, 29896, 29929, 29899, 29900, 29946, 29899, 29896, 29945, 29871, 29900, 29929, 29901, 29941, 29906, 13, 13, 3166, 9557, 29889, 2585, 1053, 9725, 800, 29892, 4733, 13, 13, 13, 1990, 341, 16783, 29898, 26983, 800, 29889, 29924, 16783, 1125, 13, 13, 1678, 9962, 353, 518, 13, 4706, 6702, 29888, 307, 680, 29918, 29883, 798, 2176, 870, 292, 742, 525, 29900, 29900, 29900, 29946, 29918, 1285, 3224, 29918, 3597, 5477, 13, 1678, 4514, 13, 13, 1678, 6931, 353, 518, 13, 4706, 9725, 800, 29889, 2528, 3073, 29898, 13, 9651, 1904, 29918, 978, 2433, 29883, 798, 2176, 870, 292, 742, 13, 9651, 1024, 2433, 3597, 29918, 1639, 342, 742, 13, 9651, 1746, 29922, 9794, 29889, 15778, 29898, 19465, 29922, 5574, 511, 13, 4706, 10353, 13, 1678, 4514, 13, 2 ]
.github/Translator-Bot-V2/main.py
DarkSkull777/Translator-Bot-V2
1
1608706
# Made with python3 # (C) @FayasNoushad # Copyright permission under MIT License # All rights reserved by FayasNoushad # License -> https://github.com/FayasNoushad/Translator-Bot-V2/blob/main/LICENSE import os from pyrogram import Client, filters from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton from googletrans import Translator FayasNoushad = Client( "Translator Bot", bot_token = os.environ["BOT_TOKEN"], api_id = int(os.environ["API_ID"]), api_hash = os.environ["API_HASH"] ) START_TEXT = """ Hello {}, I am a google translator telegram bot. Made by @xskull7 """ HELP_TEXT = """ - Just send a text with language code - And select a language for translating Made by @xskull7 """ ABOUT_TEXT = """ - **Bot :** `Translator Bot V2` - **Creator :** [Dimassrmdani](https://telegram.me/xskull7) - **Channel :** [Dimassrmdani](https://telegram.me/xskull7) - **Source :** [Click here](https://github.com/xskull7/Translator-Bot-V2) - **Language :** [Python3](https://python.org) - **Library :** [Pyrogram](https://pyrogram.org) - **Server :** [Heroku](https://heroku.com) """ START_BUTTONS = InlineKeyboardMarkup( [[ InlineKeyboardButton('Help', callback_data='help'), InlineKeyboardButton('About', callback_data='about'), InlineKeyboardButton('Close', callback_data='close') ]] ) HELP_BUTTONS = InlineKeyboardMarkup( [[ InlineKeyboardButton('Home', callback_data='home'), InlineKeyboardButton('About', callback_data='about'), InlineKeyboardButton('Close', callback_data='close') ]] ) ABOUT_BUTTONS = InlineKeyboardMarkup( [[ InlineKeyboardButton('Channel', url='https://telegram.me/xskull7'), InlineKeyboardButton('Feedback', url='https://telegram.me/xskull7') ],[ InlineKeyboardButton('Home', callback_data='home'), InlineKeyboardButton('Help', callback_data='help'), InlineKeyboardButton('Close', callback_data='close') ]] ) CLOSE_BUTTON = InlineKeyboardMarkup( [[ InlineKeyboardButton('Close', callback_data='close') ]] ) TRANSLATE_BUTTON = InlineKeyboardMarkup( [[ InlineKeyboardButton('⚙ Join Updates Channel ⚙', url='https://telegram.me/xskull7') ]] ) LANGUAGE_BUTTONS = InlineKeyboardMarkup( [[ InlineKeyboardButton("മലയാളം", callback_data="Malayalam"), InlineKeyboardButton("தமிழ்", callback_data="Tamil"), InlineKeyboardButton("हिन्दी", callback_data="Hindi") ],[ InlineKeyboardButton("ಕನ್ನಡ", callback_data="Kannada"), InlineKeyboardButton("తెలుగు", callback_data="Telugu"), InlineKeyboardButton("मराठी", callback_data="Marathi") ],[ InlineKeyboardButton("ગુજરાતી", callback_data="Gujarati"), InlineKeyboardButton("ଓଡ଼ିଆ", callback_data="Odia"), InlineKeyboardButton("বাংলা", callback_data="bn") ],[ InlineKeyboardButton("ਪੰਜਾਬੀ", callback_data="Punjabi"), InlineKeyboardButton("فارسی", callback_data="Persian"), InlineKeyboardButton("English", callback_data="English") ],[ InlineKeyboardButton("español", callback_data="Spanish"), InlineKeyboardButton("français", callback_data="French"), InlineKeyboardButton("русский", callback_data="Russian") ],[ InlineKeyboardButton("עִברִית", callback_data="hebrew"), InlineKeyboardButton("العربية", callback_data="arabic") ]] ) @FayasNoushad.on_callback_query() async def cb_data(bot, update): if update.data == "home": await update.message.edit_text( text=START_TEXT.format(update.from_user.mention), disable_web_page_preview=True, reply_markup=START_BUTTONS ) elif update.data == "help": await update.message.edit_text( text=HELP_TEXT, disable_web_page_preview=True, reply_markup=HELP_BUTTONS ) elif update.data == "about": await update.message.edit_text( text=ABOUT_TEXT, disable_web_page_preview=True, reply_markup=ABOUT_BUTTONS ) elif update.data == "close": await update.message.delete() else: message = await update.message.edit_text("`Translating...`") text = update.message.reply_to_message.text language = update.data translator = Translator() try: translate = translator.translate(text, dest=language) translate_text = f"**Translated to {language}**" translate_text += f"\n\n{translate.text}" if len(translate_text) < 4096: translate_text += "\n\nMade by @xskull7" await message.edit_text( text=translate_text, disable_web_page_preview=True, reply_markup=TRANSLATE_BUTTON ) else: with BytesIO(str.encode(str(translate_text))) as translate_file: translate_file.name = language + ".txt" await update.reply_document( document=translate_file, caption="Made by @xskull7", reply_markup=TRANSLATE_BUTTON ) await message.delete() except Exception as error: print(error) await message.edit_text("Something wrong. Contact @xskull7.") @FayasNoushad.on_message(filters.command(["start"])) async def start(bot, update): text = START_TEXT.format(update.from_user.mention) reply_markup = START_BUTTONS await update.reply_text( text=text, disable_web_page_preview=True, reply_markup=reply_markup ) @FayasNoushad.on_message(filters.private & filters.text) async def translate(bot, update): await update.reply_text( text="Select a language below for translating", disable_web_page_preview=True, reply_markup=LANGUAGE_BUTTONS, quote=True ) FayasNoushad.run()
[ 1, 396, 18266, 411, 3017, 29941, 13, 29937, 313, 29907, 29897, 732, 29943, 388, 294, 29940, 681, 21312, 13, 29937, 14187, 1266, 10751, 1090, 341, 1806, 19245, 13, 29937, 2178, 10462, 21676, 491, 383, 388, 294, 29940, 681, 21312, 13, 29937, 19245, 1599, 2045, 597, 3292, 29889, 510, 29914, 29943, 388, 294, 29940, 681, 21312, 29914, 4300, 29880, 1061, 29899, 29933, 327, 29899, 29963, 29906, 29914, 10054, 29914, 3396, 29914, 27888, 1430, 1660, 13, 13, 5215, 2897, 13, 3166, 11451, 307, 1393, 1053, 12477, 29892, 18094, 13, 3166, 11451, 307, 1393, 29889, 8768, 1053, 512, 1220, 2558, 3377, 9802, 786, 29892, 512, 1220, 2558, 3377, 3125, 13, 3166, 5386, 3286, 1053, 4103, 29880, 1061, 13, 13, 29943, 388, 294, 29940, 681, 21312, 353, 12477, 29898, 13, 1678, 376, 4300, 29880, 1061, 11273, 613, 13, 1678, 9225, 29918, 6979, 353, 2897, 29889, 21813, 3366, 29933, 2891, 29918, 4986, 29968, 1430, 12436, 13, 1678, 7882, 29918, 333, 353, 938, 29898, 359, 29889, 21813, 3366, 8787, 29918, 1367, 3108, 511, 13, 1678, 7882, 29918, 8568, 353, 2897, 29889, 21813, 3366, 8787, 29918, 29950, 24943, 3108, 13, 29897, 13, 13, 25826, 29918, 16975, 353, 9995, 13, 10994, 24335, 306, 626, 263, 5386, 5578, 1061, 4382, 1393, 9225, 29889, 13, 13, 29924, 1943, 491, 732, 29916, 808, 913, 29955, 13, 15945, 29908, 13, 29950, 6670, 29925, 29918, 16975, 353, 9995, 13, 29899, 3387, 3638, 263, 1426, 411, 4086, 775, 13, 29899, 1126, 1831, 263, 4086, 363, 5578, 1218, 13, 13, 29924, 1943, 491, 732, 29916, 808, 913, 29955, 13, 15945, 29908, 13, 2882, 12015, 29918, 16975, 353, 9995, 13, 29899, 3579, 29933, 327, 584, 1068, 421, 4300, 29880, 1061, 11273, 478, 29906, 29952, 13, 29899, 3579, 9832, 1061, 584, 1068, 518, 16142, 465, 1758, 29881, 3270, 850, 991, 597, 15494, 1393, 29889, 1004, 29914, 29916, 808, 913, 29955, 29897, 13, 29899, 3579, 13599, 584, 1068, 518, 16142, 465, 1758, 29881, 3270, 850, 991, 597, 15494, 1393, 29889, 1004, 29914, 29916, 808, 913, 29955, 29897, 13, 29899, 3579, 4435, 584, 1068, 518, 4164, 1244, 850, 991, 597, 3292, 29889, 510, 29914, 29916, 808, 913, 29955, 29914, 4300, 29880, 1061, 29899, 29933, 327, 29899, 29963, 29906, 29897, 13, 29899, 3579, 21233, 584, 1068, 518, 11980, 29941, 850, 991, 597, 4691, 29889, 990, 29897, 13, 29899, 3579, 12284, 584, 1068, 518, 19737, 307, 1393, 850, 991, 597, 2272, 307, 1393, 29889, 990, 29897, 13, 29899, 3579, 6004, 584, 1068, 518, 18650, 9154, 850, 991, 597, 2276, 9154, 29889, 510, 29897, 13, 15945, 29908, 13, 25826, 29918, 29933, 2692, 29911, 1164, 29903, 353, 512, 1220, 2558, 3377, 9802, 786, 29898, 13, 4706, 5519, 13, 4706, 512, 1220, 2558, 3377, 3125, 877, 29648, 742, 6939, 29918, 1272, 2433, 8477, 5477, 13, 4706, 512, 1220, 2558, 3377, 3125, 877, 28173, 742, 6939, 29918, 1272, 2433, 12717, 5477, 13, 4706, 512, 1220, 2558, 3377, 3125, 877, 11123, 742, 6939, 29918, 1272, 2433, 5358, 1495, 13, 4706, 29588, 13, 1678, 1723, 13, 29950, 6670, 29925, 29918, 29933, 2692, 29911, 1164, 29903, 353, 512, 1220, 2558, 3377, 9802, 786, 29898, 13, 4706, 5519, 13, 4706, 512, 1220, 2558, 3377, 3125, 877, 11184, 742, 6939, 29918, 1272, 2433, 5184, 5477, 13, 4706, 512, 1220, 2558, 3377, 3125, 877, 28173, 742, 6939, 29918, 1272, 2433, 12717, 5477, 13, 4706, 512, 1220, 2558, 3377, 3125, 877, 11123, 742, 6939, 29918, 1272, 2433, 5358, 1495, 13, 4706, 29588, 13, 1678, 1723, 13, 2882, 12015, 29918, 29933, 2692, 29911, 1164, 29903, 353, 512, 1220, 2558, 3377, 9802, 786, 29898, 13, 4706, 5519, 13, 4706, 512, 1220, 2558, 3377, 3125, 877, 13599, 742, 3142, 2433, 991, 597, 15494, 1393, 29889, 1004, 29914, 29916, 808, 913, 29955, 5477, 13, 4706, 512, 1220, 2558, 3377, 3125, 877, 29737, 1627, 742, 3142, 2433, 991, 597, 15494, 1393, 29889, 1004, 29914, 29916, 808, 913, 29955, 1495, 13, 308, 16272, 13, 4706, 512, 1220, 2558, 3377, 3125, 877, 11184, 742, 6939, 29918, 1272, 2433, 5184, 5477, 13, 4706, 512, 1220, 2558, 3377, 3125, 877, 29648, 742, 6939, 29918, 1272, 2433, 8477, 5477, 13, 4706, 512, 1220, 2558, 3377, 3125, 877, 11123, 742, 6939, 29918, 1272, 2433, 5358, 1495, 13, 4706, 29588, 13, 1678, 1723, 13, 29907, 3927, 1660, 29918, 29933, 2692, 29911, 1164, 353, 512, 1220, 2558, 3377, 9802, 786, 29898, 13, 4706, 5519, 13, 4706, 512, 1220, 2558, 3377, 3125, 877, 11123, 742, 6939, 29918, 1272, 2433, 5358, 1495, 13, 4706, 29588, 13, 1678, 1723, 13, 26813, 12750, 3040, 29918, 29933, 2692, 29911, 1164, 353, 512, 1220, 2558, 3377, 9802, 786, 29898, 13, 4706, 5519, 13, 4706, 512, 1220, 2558, 3377, 3125, 877, 229, 157, 156, 3650, 262, 5020, 15190, 17368, 29871, 229, 157, 156, 742, 3142, 2433, 991, 597, 15494, 1393, 29889, 1004, 29914, 29916, 808, 913, 29955, 1495, 13, 4706, 29588, 13, 1678, 1723, 13, 29931, 19453, 29965, 10461, 29918, 29933, 2692, 29911, 1164, 29903, 353, 512, 1220, 2558, 3377, 9802, 786, 29898, 13, 1678, 5519, 13, 1678, 512, 1220, 2558, 3377, 3125, 703, 30859, 30865, 30674, 30468, 31284, 30812, 613, 6939, 29918, 1272, 543, 22995, 388, 284, 314, 4968, 13, 1678, 512, 1220, 2558, 3377, 3125, 703, 30870, 30930, 30781, 227, 177, 183, 30380, 613, 6939, 29918, 1272, 543, 29911, 1344, 4968, 13, 1678, 512, 1220, 2558, 3377, 3125, 703, 30714, 30436, 30424, 30296, 30694, 30580, 613, 6939, 29918, 1272, 543, 29950, 14108, 1159, 13, 268, 16272, 13, 1678, 512, 1220, 2558, 3377, 3125, 703, 227, 181, 152, 227, 181, 171, 31623, 227, 181, 171, 227, 181, 164, 613, 6939, 29918, 1272, 543, 29968, 812, 1114, 4968, 13, 1678, 512, 1220, 2558, 3377, 3125, 703, 227, 179, 167, 227, 180, 137, 227, 179, 181, 227, 180, 132, 227, 179, 154, 227, 180, 132, 613, 6939, 29918, 1272, 543, 29911, 295, 688, 29884, 4968, 13, 1678, 512, 1220, 2558, 3377, 3125, 703, 30485, 30316, 30269, 227, 167, 163, 30580, 613, 6939, 29918, 1272, 543, 7083, 493, 29875, 1159, 13, 268, 16272, 13, 1678, 512, 1220, 2558, 3377, 3125, 703, 227, 173, 154, 227, 174, 132, 227, 173, 159, 227, 173, 179, 31662, 227, 173, 167, 227, 174, 131, 613, 6939, 29918, 1272, 543, 9485, 4758, 2219, 4968, 13, 1678, 512, 1220, 2558, 3377, 3125, 703, 227, 175, 150, 227, 175, 164, 227, 175, 191, 227, 175, 194, 227, 175, 137, 613, 6939, 29918, 1272, 543, 29949, 15321, 4968, 13, 1678, 512, 1220, 2558, 3377, 3125, 703, 30962, 30445, 227, 169, 133, 31055, 30445, 613, 6939, 29918, 1272, 543, 11197, 1159, 13, 268, 16272, 13, 1678, 512, 1220, 2558, 3377, 3125, 703, 227, 171, 173, 227, 172, 179, 227, 171, 159, 31248, 227, 171, 175, 227, 172, 131, 613, 6939, 29918, 1272, 543, 29925, 348, 29926, 19266, 4968, 13, 1678, 512, 1220, 2558, 3377, 3125, 703, 30241, 30112, 30156, 30198, 30202, 613, 6939, 29918, 1272, 543, 15136, 713, 4968, 13, 1678, 512, 1220, 2558, 3377, 3125, 703, 24636, 613, 6939, 29918, 1272, 543, 24636, 1159, 13, 268, 16272, 13, 1678, 512, 1220, 2558, 3377, 3125, 703, 267, 3274, 30046, 324, 613, 6939, 29918, 1272, 543, 15495, 728, 4968, 13, 1678, 512, 1220, 2558, 3377, 3125, 703, 16799, 6899, 613, 6939, 29918, 1272, 543, 29943, 4615, 4968, 13, 1678, 512, 1220, 2558, 3377, 3125, 703, 16007, 2542, 613, 6939, 29918, 1272, 543, 23002, 713, 1159, 13, 268, 16272, 13, 1678, 512, 1220, 2558, 3377, 3125, 703, 30324, 30681, 30276, 30236, 30681, 30196, 30286, 613, 6939, 29918, 1272, 543, 354, 1030, 29893, 4968, 13, 1678, 512, 1220, 2558, 3377, 3125, 703, 19233, 30218, 30156, 30177, 30163, 30242, 613, 6939, 29918, 1272, 543, 25822, 293, 1159, 13, 1678, 29588, 13, 29897, 13, 13, 29992, 29943, 388, 294, 29940, 681, 21312, 29889, 265, 29918, 14035, 29918, 1972, 580, 13, 12674, 822, 26324, 29918, 1272, 29898, 7451, 29892, 2767, 1125, 13, 1678, 565, 2767, 29889, 1272, 1275, 376, 5184, 1115, 13, 4706, 7272, 2767, 29889, 4906, 29889, 5628, 29918, 726, 29898, 13, 9651, 1426, 29922, 25826, 29918, 16975, 29889, 4830, 29898, 5504, 29889, 3166, 29918, 1792, 29889, 358, 291, 511, 13, 9651, 11262, 29918, 2676, 29918, 3488, 29918, 25347, 29922, 5574, 29892, 13, 9651, 8908, 29918, 3502, 786, 29922, 25826, 29918, 29933, 2692, 29911, 1164, 29903, 13, 4706, 1723, 13, 1678, 25342, 2767, 29889, 1272, 1275, 376, 8477, 1115, 13, 4706, 7272, 2767, 29889, 4906, 29889, 5628, 29918, 726, 29898, 13, 9651, 1426, 29922, 29950, 6670, 29925, 29918, 16975, 29892, 13, 9651, 11262, 29918, 2676, 29918, 3488, 29918, 25347, 29922, 5574, 29892, 13, 9651, 8908, 29918, 3502, 786, 29922, 29950, 6670, 29925, 29918, 29933, 2692, 29911, 1164, 29903, 13, 4706, 1723, 13, 1678, 25342, 2767, 29889, 1272, 1275, 376, 12717, 1115, 13, 4706, 7272, 2767, 29889, 4906, 29889, 5628, 29918, 726, 29898, 13, 9651, 1426, 29922, 2882, 12015, 29918, 16975, 29892, 13, 9651, 11262, 29918, 2676, 29918, 3488, 29918, 25347, 29922, 5574, 29892, 13, 9651, 8908, 29918, 3502, 786, 29922, 2882, 12015, 29918, 29933, 2692, 29911, 1164, 29903, 13, 4706, 1723, 13, 1678, 25342, 2767, 29889, 1272, 1275, 376, 5358, 1115, 13, 4706, 7272, 2767, 29889, 4906, 29889, 8143, 580, 13, 1678, 1683, 29901, 13, 4706, 2643, 353, 7272, 2767, 29889, 4906, 29889, 5628, 29918, 726, 703, 29952, 4300, 29880, 1218, 856, 29952, 1159, 13, 4706, 1426, 353, 2767, 29889, 4906, 29889, 3445, 368, 29918, 517, 29918, 4906, 29889, 726, 13, 4706, 4086, 353, 2767, 29889, 1272, 13, 4706, 5578, 1061, 353, 4103, 29880, 1061, 580, 13, 4706, 1018, 29901, 13, 9651, 14240, 353, 5578, 1061, 29889, 21652, 29898, 726, 29892, 2731, 29922, 11675, 29897, 13, 9651, 14240, 29918, 726, 353, 285, 29908, 1068, 4300, 29880, 630, 304, 426, 11675, 29913, 1068, 29908, 13, 9651, 14240, 29918, 726, 4619, 285, 26732, 29876, 29905, 29876, 29912, 21652, 29889, 726, 5038, 13, 9651, 565, 7431, 29898, 21652, 29918, 726, 29897, 529, 29871, 29946, 29900, 29929, 29953, 29901, 13, 18884, 14240, 29918, 726, 4619, 6634, 29876, 29905, 29876, 29924, 1943, 491, 732, 29916, 808, 913, 29955, 29908, 13, 18884, 7272, 2643, 29889, 5628, 29918, 726, 29898, 13, 462, 1678, 1426, 29922, 21652, 29918, 726, 29892, 13, 462, 1678, 11262, 29918, 2676, 29918, 3488, 29918, 25347, 29922, 5574, 29892, 13, 462, 1678, 8908, 29918, 3502, 786, 29922, 26813, 12750, 3040, 29918, 29933, 2692, 29911, 1164, 13, 18884, 1723, 13, 9651, 1683, 29901, 13, 18884, 411, 2648, 2167, 5971, 29898, 710, 29889, 12508, 29898, 710, 29898, 21652, 29918, 726, 4961, 408, 14240, 29918, 1445, 29901, 13, 462, 1678, 14240, 29918, 1445, 29889, 978, 353, 4086, 718, 11393, 3945, 29908, 13, 462, 1678, 7272, 2767, 29889, 3445, 368, 29918, 3225, 29898, 13, 462, 4706, 1842, 29922, 21652, 29918, 1445, 29892, 13, 462, 4706, 5777, 683, 543, 29924, 1943, 491, 732, 29916, 808, 913, 29955, 613, 13, 462, 4706, 8908, 29918, 3502, 786, 29922, 26813, 12750, 3040, 29918, 29933, 2692, 29911, 1164, 13, 462, 1678, 1723, 13, 18884, 7272, 2643, 29889, 8143, 580, 13, 4706, 5174, 8960, 408, 1059, 29901, 13, 9651, 1596, 29898, 2704, 29897, 13, 9651, 7272, 2643, 29889, 5628, 29918, 726, 703, 16804, 2743, 29889, 22387, 732, 29916, 808, 913, 29955, 23157, 13, 13, 29992, 29943, 388, 294, 29940, 681, 21312, 29889, 265, 29918, 4906, 29898, 26705, 29889, 6519, 29898, 3366, 2962, 3108, 876, 13, 12674, 822, 1369, 29898, 7451, 29892, 2767, 1125, 13, 1678, 1426, 353, 6850, 8322, 29918, 16975, 29889, 4830, 29898, 5504, 29889, 3166, 29918, 1792, 29889, 358, 291, 29897, 13, 1678, 8908, 29918, 3502, 786, 353, 6850, 8322, 29918, 29933, 2692, 29911, 1164, 29903, 13, 1678, 7272, 2767, 29889, 3445, 368, 29918, 726, 29898, 13, 4706, 1426, 29922, 726, 29892, 13, 4706, 11262, 29918, 2676, 29918, 3488, 29918, 25347, 29922, 5574, 29892, 13, 4706, 8908, 29918, 3502, 786, 29922, 3445, 368, 29918, 3502, 786, 13, 1678, 1723, 13, 13, 29992, 29943, 388, 294, 29940, 681, 21312, 29889, 265, 29918, 4906, 29898, 26705, 29889, 9053, 669, 18094, 29889, 726, 29897, 13, 12674, 822, 14240, 29898, 7451, 29892, 2767, 1125, 13, 1678, 7272, 2767, 29889, 3445, 368, 29918, 726, 29898, 13, 4706, 1426, 543, 3549, 263, 4086, 2400, 363, 5578, 1218, 613, 13, 4706, 11262, 29918, 2676, 29918, 3488, 29918, 25347, 29922, 5574, 29892, 13, 4706, 8908, 29918, 3502, 786, 29922, 29931, 19453, 29965, 10461, 29918, 29933, 2692, 29911, 1164, 29903, 29892, 13, 4706, 14978, 29922, 5574, 13, 1678, 1723, 13, 268, 13, 29943, 388, 294, 29940, 681, 21312, 29889, 3389, 580, 2 ]
tests/BaseCase.py
YaroslavChyhryn/SchoolAPI
0
28706
<gh_stars>0 import unittest from school_api.app import create_app from school_api.db import create_tables, drop_tables from school_api.data_generator import test_db class BaseCase(unittest.TestCase): @classmethod def setUpClass(cls): cls.app = create_app('test') def setUp(self): drop_tables(self.app) create_tables(self.app) test_db(self.app) with self.app.app_context(): self.client = self.app.test_client() def tearDown(self): drop_tables(self.app)
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 5215, 443, 27958, 13, 3166, 3762, 29918, 2754, 29889, 932, 1053, 1653, 29918, 932, 13, 3166, 3762, 29918, 2754, 29889, 2585, 1053, 1653, 29918, 24051, 29892, 5768, 29918, 24051, 13, 3166, 3762, 29918, 2754, 29889, 1272, 29918, 27959, 1053, 1243, 29918, 2585, 13, 13, 13, 1990, 7399, 8259, 29898, 348, 27958, 29889, 3057, 8259, 1125, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 731, 3373, 2385, 29898, 25932, 1125, 13, 4706, 1067, 29879, 29889, 932, 353, 1653, 29918, 932, 877, 1688, 1495, 13, 13, 1678, 822, 731, 3373, 29898, 1311, 1125, 13, 4706, 5768, 29918, 24051, 29898, 1311, 29889, 932, 29897, 13, 4706, 1653, 29918, 24051, 29898, 1311, 29889, 932, 29897, 13, 4706, 1243, 29918, 2585, 29898, 1311, 29889, 932, 29897, 13, 13, 4706, 411, 1583, 29889, 932, 29889, 932, 29918, 4703, 7295, 13, 9651, 1583, 29889, 4645, 353, 1583, 29889, 932, 29889, 1688, 29918, 4645, 580, 13, 13, 1678, 822, 734, 279, 6767, 29898, 1311, 1125, 13, 4706, 5768, 29918, 24051, 29898, 1311, 29889, 932, 29897, 13, 2 ]
mkdocs/relative_path_ext.py
davidhrbac/mkdocs
57
89925
""" # Relative Path Markdown Extension During the MkDocs build we rewrite URLs that link to local Markdown or media files. Using the following pages configuration we can look at how the output is changed. pages: - ['index.md'] - ['tutorial/install.md'] - ['tutorial/intro.md'] ## Markdown URLs When linking from `install.md` to `intro.md` the link would simply be `[intro](intro.md)`. However, when we build `install.md` we place it in a directory to create nicer URLs. This means that the path to `intro.md` becomes `../intro/` ## Media URLs To make it easier to work with media files and store them all under one directory we re-write those to all be based on the root. So, with the following markdown to add an image. ![The initial MkDocs layout](img/initial-layout.png) The output would depend on the location of the Markdown file it was added too. Source file | Generated Path | Image Path | ------------------- | ----------------- | ---------------------------- | index.md | / | ./img/initial-layout.png | tutorial/install.md | tutorial/install/ | ../img/initial-layout.png | tutorial/intro.md | tutorial/intro/ | ../../img/initial-layout.png | """ from __future__ import unicode_literals import logging import os from markdown.extensions import Extension from markdown.treeprocessors import Treeprocessor from markdown.util import AMP_SUBSTITUTE from mkdocs import utils from mkdocs.exceptions import MarkdownNotFound log = logging.getLogger(__name__) def _iter(node): # TODO: Remove when dropping Python 2.6. Replace this # function call with note.iter() return [node] + node.findall('.//*') def path_to_url(url, nav, strict): scheme, netloc, path, params, query, fragment = ( utils.urlparse(url)) if scheme or netloc or not path or AMP_SUBSTITUTE in url: # Ignore URLs unless they are a relative link to a markdown file. # AMP_SUBSTITUTE is used internally by Markdown only for email,which is # not a relative link. As urlparse errors on them, skip explicitly return url if nav and not utils.is_markdown_file(path): path = utils.create_relative_media_url(nav, path) elif nav: # If the site navigation has been provided, then validate # the internal hyperlink, making sure the target actually exists. target_file = nav.file_context.make_absolute(path) if target_file.startswith(os.path.sep): target_file = target_file[1:] if target_file not in nav.source_files: source_file = nav.file_context.current_file msg = ( 'The page "%s" contained a hyperlink to "%s" which ' 'is not listed in the "pages" configuration.' ) % (source_file, target_file) # In strict mode raise an error at this point. if strict: raise MarkdownNotFound(msg) # Otherwise, when strict mode isn't enabled, log a warning # to the user and leave the URL as it is. log.warning(msg) return url path = utils.get_url_path(target_file, nav.use_directory_urls) path = nav.url_context.make_relative(path) else: path = utils.get_url_path(path).lstrip('/') # Convert the .md hyperlink to a relative hyperlink to the HTML page. fragments = (scheme, netloc, path, params, query, fragment) url = utils.urlunparse(fragments) return url class RelativePathTreeprocessor(Treeprocessor): def __init__(self, site_navigation, strict): self.site_navigation = site_navigation self.strict = strict def run(self, root): """Update urls on anchors and images to make them relative Iterates through the full document tree looking for specific tags and then makes them relative based on the site navigation """ for element in _iter(root): if element.tag == 'a': key = 'href' elif element.tag == 'img': key = 'src' else: continue url = element.get(key) new_url = path_to_url(url, self.site_navigation, self.strict) element.set(key, new_url) return root class RelativePathExtension(Extension): """ The Extension class is what we pass to markdown, it then registers the Treeprocessor. """ def __init__(self, site_navigation, strict): self.site_navigation = site_navigation self.strict = strict def extendMarkdown(self, md, md_globals): relpath = RelativePathTreeprocessor(self.site_navigation, self.strict) md.treeprocessors.add("relpath", relpath, "_end")
[ 1, 9995, 13, 29937, 6376, 1230, 10802, 4485, 3204, 7338, 2673, 13, 13, 29928, 3864, 278, 341, 29895, 29928, 12332, 2048, 591, 10683, 24295, 393, 1544, 304, 1887, 13, 9802, 3204, 470, 5745, 2066, 29889, 5293, 278, 1494, 6515, 5285, 13, 705, 508, 1106, 472, 920, 278, 1962, 338, 3939, 29889, 13, 13, 1678, 6515, 29901, 13, 1678, 448, 6024, 2248, 29889, 3487, 2033, 13, 1678, 448, 6024, 12631, 29914, 6252, 29889, 3487, 2033, 13, 1678, 448, 6024, 12631, 29914, 23333, 29889, 3487, 2033, 13, 13, 2277, 4485, 3204, 24295, 13, 13, 10401, 25236, 515, 421, 6252, 29889, 3487, 29952, 304, 421, 23333, 29889, 3487, 29952, 278, 1544, 723, 13, 14739, 368, 367, 10338, 23333, 850, 23333, 29889, 3487, 14466, 2398, 29892, 746, 591, 2048, 13, 29952, 6252, 29889, 3487, 29952, 591, 2058, 372, 297, 263, 3884, 304, 1653, 16588, 261, 24295, 29889, 13, 4013, 2794, 393, 278, 2224, 304, 421, 23333, 29889, 3487, 29952, 7415, 421, 6995, 23333, 16527, 13, 13, 2277, 8213, 24295, 13, 13, 1762, 1207, 372, 6775, 304, 664, 411, 5745, 2066, 322, 3787, 963, 599, 13, 5062, 697, 3884, 591, 337, 29899, 3539, 1906, 304, 599, 367, 2729, 373, 278, 13, 4632, 29889, 1105, 29892, 411, 278, 1494, 2791, 3204, 304, 788, 385, 1967, 29889, 13, 13, 1678, 1738, 29961, 1576, 2847, 341, 29895, 29928, 12332, 5912, 850, 2492, 29914, 11228, 29899, 2680, 29889, 2732, 29897, 13, 13, 1576, 1962, 723, 8839, 373, 278, 4423, 310, 278, 4485, 3204, 934, 372, 13, 11102, 2715, 2086, 29889, 13, 13, 4435, 934, 308, 891, 3251, 630, 10802, 1678, 891, 7084, 10802, 462, 259, 891, 13, 2683, 5634, 891, 448, 2683, 891, 448, 2683, 1378, 5634, 891, 13, 2248, 29889, 3487, 9651, 891, 847, 462, 891, 11431, 2492, 29914, 11228, 29899, 2680, 29889, 2732, 268, 891, 13, 12631, 29914, 6252, 29889, 3487, 891, 9673, 29914, 6252, 29914, 891, 29772, 2492, 29914, 11228, 29899, 2680, 29889, 2732, 1678, 891, 13, 12631, 29914, 23333, 29889, 3487, 259, 891, 9673, 29914, 23333, 29914, 259, 891, 29772, 6995, 2492, 29914, 11228, 29899, 2680, 29889, 2732, 891, 13, 13, 15945, 29908, 13, 13, 3166, 4770, 29888, 9130, 1649, 1053, 29104, 29918, 20889, 1338, 13, 13, 5215, 12183, 13, 5215, 2897, 13, 13, 3166, 2791, 3204, 29889, 24299, 1053, 7338, 2673, 13, 3166, 2791, 3204, 29889, 8336, 5014, 943, 1053, 15472, 26482, 13, 3166, 2791, 3204, 29889, 4422, 1053, 319, 3580, 29918, 20633, 1254, 1806, 26027, 13, 13, 3166, 14690, 2640, 1053, 3667, 29879, 13, 3166, 14690, 2640, 29889, 11739, 29879, 1053, 4485, 3204, 17413, 13, 13, 1188, 353, 12183, 29889, 657, 16363, 22168, 978, 1649, 29897, 13, 13, 13, 1753, 903, 1524, 29898, 3177, 1125, 13, 1678, 396, 14402, 29901, 15154, 746, 4441, 3262, 5132, 29871, 29906, 29889, 29953, 29889, 22108, 445, 13, 1678, 396, 740, 1246, 411, 4443, 29889, 1524, 580, 13, 1678, 736, 518, 3177, 29962, 718, 2943, 29889, 2886, 497, 12839, 458, 29930, 1495, 13, 13, 13, 1753, 2224, 29918, 517, 29918, 2271, 29898, 2271, 29892, 6283, 29892, 9406, 1125, 13, 13, 1678, 11380, 29892, 7787, 2029, 29892, 2224, 29892, 8636, 29892, 2346, 29892, 9376, 353, 313, 13, 4706, 3667, 29879, 29889, 2271, 5510, 29898, 2271, 876, 13, 13, 1678, 565, 11380, 470, 7787, 2029, 470, 451, 2224, 470, 319, 3580, 29918, 20633, 1254, 1806, 26027, 297, 3142, 29901, 13, 4706, 396, 18076, 487, 24295, 6521, 896, 526, 263, 6198, 1544, 304, 263, 2791, 3204, 934, 29889, 13, 4706, 396, 319, 3580, 29918, 20633, 1254, 1806, 26027, 338, 1304, 25106, 491, 4485, 3204, 871, 363, 4876, 29892, 4716, 338, 13, 4706, 396, 451, 263, 6198, 1544, 29889, 1094, 3142, 5510, 4436, 373, 963, 29892, 14383, 9479, 13, 4706, 736, 3142, 13, 13, 1678, 565, 6283, 322, 451, 3667, 29879, 29889, 275, 29918, 3502, 3204, 29918, 1445, 29898, 2084, 1125, 13, 4706, 2224, 353, 3667, 29879, 29889, 3258, 29918, 22925, 29918, 9799, 29918, 2271, 29898, 6654, 29892, 2224, 29897, 13, 1678, 25342, 6283, 29901, 13, 4706, 396, 960, 278, 3268, 11322, 756, 1063, 4944, 29892, 769, 12725, 13, 4706, 396, 278, 7463, 11266, 2324, 29892, 3907, 1854, 278, 3646, 2869, 4864, 29889, 13, 4706, 3646, 29918, 1445, 353, 6283, 29889, 1445, 29918, 4703, 29889, 5675, 29918, 23552, 29898, 2084, 29897, 13, 13, 4706, 565, 3646, 29918, 1445, 29889, 27382, 2541, 29898, 359, 29889, 2084, 29889, 19570, 1125, 13, 9651, 3646, 29918, 1445, 353, 3646, 29918, 1445, 29961, 29896, 17531, 13, 13, 4706, 565, 3646, 29918, 1445, 451, 297, 6283, 29889, 4993, 29918, 5325, 29901, 13, 9651, 2752, 29918, 1445, 353, 6283, 29889, 1445, 29918, 4703, 29889, 3784, 29918, 1445, 13, 9651, 10191, 353, 313, 13, 18884, 525, 1576, 1813, 11860, 29879, 29908, 11122, 263, 11266, 2324, 304, 11860, 29879, 29908, 607, 525, 13, 18884, 525, 275, 451, 9904, 297, 278, 376, 12292, 29908, 5285, 6169, 13, 9651, 1723, 1273, 313, 4993, 29918, 1445, 29892, 3646, 29918, 1445, 29897, 13, 13, 9651, 396, 512, 9406, 4464, 12020, 385, 1059, 472, 445, 1298, 29889, 13, 9651, 565, 9406, 29901, 13, 18884, 12020, 4485, 3204, 17413, 29898, 7645, 29897, 13, 9651, 396, 13466, 29892, 746, 9406, 4464, 3508, 29915, 29873, 9615, 29892, 1480, 263, 9177, 13, 9651, 396, 304, 278, 1404, 322, 5967, 278, 3988, 408, 372, 338, 29889, 13, 9651, 1480, 29889, 27392, 29898, 7645, 29897, 13, 9651, 736, 3142, 13, 4706, 2224, 353, 3667, 29879, 29889, 657, 29918, 2271, 29918, 2084, 29898, 5182, 29918, 1445, 29892, 6283, 29889, 1509, 29918, 12322, 29918, 26045, 29897, 13, 4706, 2224, 353, 6283, 29889, 2271, 29918, 4703, 29889, 5675, 29918, 22925, 29898, 2084, 29897, 13, 1678, 1683, 29901, 13, 4706, 2224, 353, 3667, 29879, 29889, 657, 29918, 2271, 29918, 2084, 29898, 2084, 467, 29880, 17010, 11219, 1495, 13, 13, 1678, 396, 14806, 278, 869, 3487, 11266, 2324, 304, 263, 6198, 11266, 2324, 304, 278, 4544, 1813, 29889, 13, 1678, 22370, 353, 313, 816, 2004, 29892, 7787, 2029, 29892, 2224, 29892, 8636, 29892, 2346, 29892, 9376, 29897, 13, 1678, 3142, 353, 3667, 29879, 29889, 2271, 348, 5510, 29898, 29888, 1431, 1860, 29897, 13, 1678, 736, 3142, 13, 13, 13, 1990, 6376, 1230, 2605, 9643, 26482, 29898, 9643, 26482, 1125, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 3268, 29918, 15466, 29892, 9406, 1125, 13, 4706, 1583, 29889, 2746, 29918, 15466, 353, 3268, 29918, 15466, 13, 4706, 1583, 29889, 710, 919, 353, 9406, 13, 13, 1678, 822, 1065, 29898, 1311, 29892, 3876, 1125, 13, 4706, 9995, 6422, 23942, 373, 23791, 943, 322, 4558, 304, 1207, 963, 6198, 13, 13, 4706, 20504, 1078, 1549, 278, 2989, 1842, 5447, 3063, 363, 2702, 13, 4706, 8282, 322, 769, 3732, 963, 6198, 2729, 373, 278, 3268, 11322, 13, 4706, 9995, 13, 13, 4706, 363, 1543, 297, 903, 1524, 29898, 4632, 1125, 13, 13, 9651, 565, 1543, 29889, 4039, 1275, 525, 29874, 2396, 13, 18884, 1820, 353, 525, 12653, 29915, 13, 9651, 25342, 1543, 29889, 4039, 1275, 525, 2492, 2396, 13, 18884, 1820, 353, 525, 4351, 29915, 13, 9651, 1683, 29901, 13, 18884, 6773, 13, 13, 9651, 3142, 353, 1543, 29889, 657, 29898, 1989, 29897, 13, 9651, 716, 29918, 2271, 353, 2224, 29918, 517, 29918, 2271, 29898, 2271, 29892, 1583, 29889, 2746, 29918, 15466, 29892, 1583, 29889, 710, 919, 29897, 13, 9651, 1543, 29889, 842, 29898, 1989, 29892, 716, 29918, 2271, 29897, 13, 13, 4706, 736, 3876, 13, 13, 13, 1990, 6376, 1230, 2605, 17657, 29898, 17657, 1125, 13, 1678, 9995, 13, 1678, 450, 7338, 2673, 770, 338, 825, 591, 1209, 304, 2791, 3204, 29892, 372, 769, 13, 1678, 28975, 278, 15472, 26482, 29889, 13, 1678, 9995, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 3268, 29918, 15466, 29892, 9406, 1125, 13, 4706, 1583, 29889, 2746, 29918, 15466, 353, 3268, 29918, 15466, 13, 4706, 1583, 29889, 710, 919, 353, 9406, 13, 13, 1678, 822, 10985, 9802, 3204, 29898, 1311, 29892, 22821, 29892, 22821, 29918, 23705, 1338, 1125, 13, 4706, 1104, 2084, 353, 6376, 1230, 2605, 9643, 26482, 29898, 1311, 29889, 2746, 29918, 15466, 29892, 1583, 29889, 710, 919, 29897, 13, 4706, 22821, 29889, 8336, 5014, 943, 29889, 1202, 703, 2674, 2084, 613, 1104, 2084, 29892, 11119, 355, 1159, 13, 2 ]
services/worker/main.py
mrgrassho/geo-diff-2
0
25404
<reponame>mrgrassho/geo-diff-2 #!/usr/bin/env python3 # -*- coding: utf-8 -*- from geodiff_worker import GeoDiffWorker from os import environ from os.path import join, dirname from dotenv import load_dotenv dotenv_path = join(dirname(__file__), '.env') load_dotenv(dotenv_path) def main(): """Main entry point to the program.""" # Get the location of the AMQP broker (RabbitMQ server) from # an environment variable amqp_url = environ['AMQP_URL'] task_queue = environ['TASK_QUEUE'] result_xchg = environ['RES_XCHG'] keep_alive_queue = environ['KEEP_ALIVE_QUEUE'] worker = GeoDiffWorker(amqp_url, task_queue, result_xchg, keep_alive_queue, debug=True) worker.start() if __name__ == '__main__': main()
[ 1, 529, 276, 1112, 420, 29958, 29885, 29878, 629, 465, 1251, 29914, 24756, 29899, 12765, 29899, 29906, 13, 29937, 14708, 4855, 29914, 2109, 29914, 6272, 3017, 29941, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 13, 3166, 1737, 397, 2593, 29918, 24602, 1053, 1879, 29877, 26023, 16164, 13, 3166, 2897, 1053, 12471, 13, 3166, 2897, 29889, 2084, 1053, 5988, 29892, 4516, 978, 13, 3166, 8329, 6272, 1053, 2254, 29918, 6333, 6272, 13, 13, 6333, 6272, 29918, 2084, 353, 5988, 29898, 25721, 22168, 1445, 1649, 511, 15300, 6272, 1495, 13, 1359, 29918, 6333, 6272, 29898, 6333, 6272, 29918, 2084, 29897, 13, 13, 1753, 1667, 7295, 13, 1678, 9995, 6330, 6251, 1298, 304, 278, 1824, 1213, 15945, 13, 13, 1678, 396, 3617, 278, 4423, 310, 278, 13862, 29984, 29925, 2545, 3946, 313, 29934, 370, 2966, 25566, 1923, 29897, 515, 13, 1678, 396, 385, 5177, 2286, 13, 1678, 626, 29939, 29886, 29918, 2271, 353, 12471, 1839, 5194, 29984, 29925, 29918, 4219, 2033, 13, 1678, 3414, 29918, 9990, 353, 12471, 1839, 29911, 3289, 29968, 29918, 11144, 4462, 2033, 13, 1678, 1121, 29918, 29916, 305, 29887, 353, 12471, 1839, 15989, 29918, 29990, 3210, 29954, 2033, 13, 1678, 3013, 29918, 284, 573, 29918, 9990, 353, 12471, 1839, 6059, 15488, 29918, 1964, 18474, 29918, 11144, 4462, 2033, 13, 1678, 15645, 353, 1879, 29877, 26023, 16164, 29898, 314, 29939, 29886, 29918, 2271, 29892, 3414, 29918, 9990, 29892, 1121, 29918, 29916, 305, 29887, 29892, 3013, 29918, 284, 573, 29918, 9990, 29892, 4744, 29922, 5574, 29897, 13, 1678, 15645, 29889, 2962, 580, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 1667, 580, 13, 2 ]
usuarios/views.py
alvarocneto/alura_django
1
8818
<filename>usuarios/views.py from django.shortcuts import redirect from django.shortcuts import render from django.contrib.auth.models import User from django.views.generic.base import View from perfis.models import Perfil from usuarios.forms import RegistrarUsuarioForm class RegistrarUsuarioView(View): template_name = 'registrar.html' def get(self, request): return render(request, self.template_name) def post(self, request): # preenche o from form = RegistrarUsuarioForm(request.POST) # verifica se eh valido if form.is_valid(): dados_form = form.data # cria o usuario usuario = User.objects.create_user(dados_form['nome'], dados_form['email'], dados_form['senha']) # cria o perfil perfil = Perfil(nome=dados_form['nome'], telefone=dados_form['telefone'], nome_empresa=dados_form['nome_empresa'], usuario=usuario) # grava no banco perfil.save() # redireciona para index return redirect('index') # so chega aqui se nao for valido # vamos devolver o form para mostrar o formulario preenchido return render(request, self.template_name, {'form': form})
[ 1, 529, 9507, 29958, 375, 29884, 8596, 29914, 7406, 29889, 2272, 13, 3166, 9557, 29889, 12759, 7582, 29879, 1053, 6684, 13, 3166, 9557, 29889, 12759, 7582, 29879, 1053, 4050, 13, 3166, 9557, 29889, 21570, 29889, 5150, 29889, 9794, 1053, 4911, 13, 3166, 9557, 29889, 7406, 29889, 19206, 29889, 3188, 1053, 4533, 13, 3166, 23895, 275, 29889, 9794, 1053, 2431, 1777, 13, 3166, 502, 29884, 8596, 29889, 9514, 1053, 2169, 2132, 279, 29965, 2146, 2628, 2500, 13, 13, 13, 1990, 2169, 2132, 279, 29965, 2146, 2628, 1043, 29898, 1043, 1125, 13, 13, 1678, 4472, 29918, 978, 353, 525, 29238, 279, 29889, 1420, 29915, 13, 13, 1678, 822, 679, 29898, 1311, 29892, 2009, 1125, 13, 4706, 736, 4050, 29898, 3827, 29892, 1583, 29889, 6886, 29918, 978, 29897, 13, 13, 1678, 822, 1400, 29898, 1311, 29892, 2009, 1125, 13, 13, 9651, 396, 758, 264, 1173, 288, 515, 13, 9651, 883, 353, 2169, 2132, 279, 29965, 2146, 2628, 2500, 29898, 3827, 29889, 5438, 29897, 13, 13, 9651, 396, 1147, 15039, 409, 321, 29882, 659, 1941, 13, 9651, 565, 883, 29889, 275, 29918, 3084, 7295, 13, 13, 18884, 270, 2255, 29918, 689, 353, 883, 29889, 1272, 13, 13, 18884, 396, 274, 2849, 288, 502, 22223, 13, 18884, 502, 22223, 353, 4911, 29889, 12650, 29889, 3258, 29918, 1792, 29898, 29881, 2255, 29918, 689, 1839, 25155, 7464, 13, 462, 462, 462, 259, 270, 2255, 29918, 689, 1839, 5269, 7464, 13, 462, 462, 462, 259, 270, 2255, 29918, 689, 1839, 4881, 2350, 11287, 13, 13, 18884, 396, 274, 2849, 288, 639, 1777, 13, 18884, 639, 1777, 353, 2431, 1777, 29898, 25155, 29922, 29881, 2255, 29918, 689, 1839, 25155, 7464, 13, 462, 18884, 4382, 29888, 650, 29922, 29881, 2255, 29918, 689, 1839, 15494, 29888, 650, 7464, 13, 462, 18884, 9235, 29918, 331, 13039, 29922, 29881, 2255, 29918, 689, 1839, 25155, 29918, 331, 13039, 7464, 13, 462, 18884, 502, 22223, 29922, 375, 22223, 29897, 13, 13, 18884, 396, 2646, 1564, 694, 9892, 1111, 13, 18884, 639, 1777, 29889, 7620, 580, 13, 13, 18884, 396, 2654, 533, 12401, 29874, 1702, 2380, 13, 18884, 736, 6684, 877, 2248, 1495, 13, 13, 9651, 396, 577, 923, 3249, 263, 6578, 409, 1055, 29877, 363, 659, 1941, 13, 9651, 396, 325, 14054, 316, 1555, 369, 288, 883, 1702, 1556, 13678, 288, 883, 1070, 601, 758, 264, 305, 1941, 13, 9651, 736, 4050, 29898, 3827, 29892, 1583, 29889, 6886, 29918, 978, 29892, 11117, 689, 2396, 883, 1800, 13, 13, 2 ]
python/tests/test_stats.py
winni2k/tskit
0
130817
<filename>python/tests/test_stats.py # MIT License # # Copyright (c) 2018-2019 Tskit Developers # Copyright (C) 2016 University of Oxford # # 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. """ Test cases for stats calculations in tskit. """ import unittest import io import numpy as np import msprime import tskit import _tskit import tests.tsutil as tsutil import tests.test_wright_fisher as wf def get_r2_matrix(ts): """ Returns the matrix for the specified tree sequence. This is computed via a straightforward Python algorithm. """ n = ts.get_sample_size() m = ts.get_num_mutations() A = np.zeros((m, m), dtype=float) for t1 in ts.trees(): for sA in t1.sites(): assert len(sA.mutations) == 1 mA = sA.mutations[0] A[sA.id, sA.id] = 1 fA = t1.get_num_samples(mA.node) / n samples = list(t1.samples(mA.node)) for t2 in ts.trees(tracked_samples=samples): for sB in t2.sites(): assert len(sB.mutations) == 1 mB = sB.mutations[0] if sB.position > sA.position: fB = t2.get_num_samples(mB.node) / n fAB = t2.get_num_tracked_samples(mB.node) / n D = fAB - fA * fB r2 = D * D / (fA * fB * (1 - fA) * (1 - fB)) A[sA.id, sB.id] = r2 A[sB.id, sA.id] = r2 return A class TestLdCalculator(unittest.TestCase): """ Tests for the LdCalculator class. """ num_test_sites = 50 def verify_matrix(self, ts): m = ts.get_num_sites() ldc = tskit.LdCalculator(ts) A = ldc.get_r2_matrix() self.assertEqual(A.shape, (m, m)) B = get_r2_matrix(ts) self.assertTrue(np.allclose(A, B)) # Now look at each row in turn, and verify it's the same # when we use get_r2 directly. for j in range(m): a = ldc.get_r2_array(j, direction=tskit.FORWARD) b = A[j, j + 1:] self.assertEqual(a.shape[0], m - j - 1) self.assertEqual(b.shape[0], m - j - 1) self.assertTrue(np.allclose(a, b)) a = ldc.get_r2_array(j, direction=tskit.REVERSE) b = A[j, :j] self.assertEqual(a.shape[0], j) self.assertEqual(b.shape[0], j) self.assertTrue(np.allclose(a[::-1], b)) # Now check every cell in the matrix in turn. for j in range(m): for k in range(m): self.assertAlmostEqual(ldc.get_r2(j, k), A[j, k]) def verify_max_distance(self, ts): """ Verifies that the max_distance parameter works as expected. """ mutations = list(ts.mutations()) ldc = tskit.LdCalculator(ts) A = ldc.get_r2_matrix() j = len(mutations) // 2 for k in range(j): x = mutations[j + k].position - mutations[j].position a = ldc.get_r2_array(j, max_distance=x) self.assertEqual(a.shape[0], k) self.assertTrue(np.allclose(A[j, j + 1: j + 1 + k], a)) x = mutations[j].position - mutations[j - k].position a = ldc.get_r2_array(j, max_distance=x, direction=tskit.REVERSE) self.assertEqual(a.shape[0], k) self.assertTrue(np.allclose(A[j, j - k: j], a[::-1])) L = ts.get_sequence_length() m = len(mutations) a = ldc.get_r2_array(0, max_distance=L) self.assertEqual(a.shape[0], m - 1) self.assertTrue(np.allclose(A[0, 1:], a)) a = ldc.get_r2_array(m - 1, max_distance=L, direction=tskit.REVERSE) self.assertEqual(a.shape[0], m - 1) self.assertTrue(np.allclose(A[m - 1, :-1], a[::-1])) def verify_max_mutations(self, ts): """ Verifies that the max mutations parameter works as expected. """ mutations = list(ts.mutations()) ldc = tskit.LdCalculator(ts) A = ldc.get_r2_matrix() j = len(mutations) // 2 for k in range(j): a = ldc.get_r2_array(j, max_mutations=k) self.assertEqual(a.shape[0], k) self.assertTrue(np.allclose(A[j, j + 1: j + 1 + k], a)) a = ldc.get_r2_array(j, max_mutations=k, direction=tskit.REVERSE) self.assertEqual(a.shape[0], k) self.assertTrue(np.allclose(A[j, j - k: j], a[::-1])) def test_single_tree_simulated_mutations(self): ts = msprime.simulate(20, mutation_rate=10, random_seed=15) ts = tsutil.subsample_sites(ts, self.num_test_sites) self.verify_matrix(ts) self.verify_max_distance(ts) def test_deprecated_aliases(self): ts = msprime.simulate(20, mutation_rate=10, random_seed=15) ts = tsutil.subsample_sites(ts, self.num_test_sites) ldc = tskit.LdCalculator(ts) A = ldc.get_r2_matrix() B = ldc.r2_matrix() self.assertTrue(np.array_equal(A, B)) a = ldc.get_r2_array(0) b = ldc.r2_array(0) self.assertTrue(np.array_equal(a, b)) self.assertEqual(ldc.get_r2(0, 1), ldc.r2(0, 1)) def test_single_tree_regular_mutations(self): ts = msprime.simulate(self.num_test_sites, length=self.num_test_sites) ts = tsutil.insert_branch_mutations(ts) # We don't support back mutations, so this should fail. self.assertRaises(_tskit.LibraryError, self.verify_matrix, ts) self.assertRaises(_tskit.LibraryError, self.verify_max_distance, ts) def test_tree_sequence_regular_mutations(self): ts = msprime.simulate( self.num_test_sites, recombination_rate=1, length=self.num_test_sites) self.assertGreater(ts.get_num_trees(), 10) t = ts.dump_tables() t.sites.reset() t.mutations.reset() for j in range(self.num_test_sites): site_id = len(t.sites) t.sites.add_row(position=j, ancestral_state="0") t.mutations.add_row(site=site_id, derived_state="1", node=j) ts = t.tree_sequence() self.verify_matrix(ts) self.verify_max_distance(ts) def test_tree_sequence_simulated_mutations(self): ts = msprime.simulate(20, mutation_rate=10, recombination_rate=10) self.assertGreater(ts.get_num_trees(), 10) ts = tsutil.subsample_sites(ts, self.num_test_sites) self.verify_matrix(ts) self.verify_max_distance(ts) self.verify_max_mutations(ts) def set_partitions(collection): """ Returns an ierator over all partitions of the specified set. From https://stackoverflow.com/questions/19368375/set-partitions-in-python """ if len(collection) == 1: yield [collection] else: first = collection[0] for smaller in set_partitions(collection[1:]): for n, subset in enumerate(smaller): yield smaller[:n] + [[first] + subset] + smaller[n + 1:] yield [[first]] + smaller def naive_mean_descendants(ts, reference_sets): """ Straightforward implementation of mean sample ancestry by iterating over the trees and nodes in each tree. """ # TODO generalise this to allow arbitrary nodes, not just samples. C = np.zeros((ts.num_nodes, len(reference_sets))) T = np.zeros(ts.num_nodes) tree_iters = [ts.trees(tracked_samples=sample_set) for sample_set in reference_sets] for _ in range(ts.num_trees): trees = [next(tree_iter) for tree_iter in tree_iters] span = trees[0].span for node in trees[0].nodes(): num_samples = trees[0].num_samples(node) if num_samples > 0: for j, tree in enumerate(trees): C[node, j] += span * tree.num_tracked_samples(node) T[node] += span for node in range(ts.num_nodes): if T[node] > 0: C[node] /= T[node] return C class TestMeanDescendants(unittest.TestCase): """ Tests the TreeSequence.mean_descendants method. """ def verify(self, ts, reference_sets): C1 = naive_mean_descendants(ts, reference_sets) C2 = tsutil.mean_descendants(ts, reference_sets) C3 = ts.mean_descendants(reference_sets) self.assertEqual(C1.shape, C2.shape) self.assertTrue(np.allclose(C1, C2)) self.assertTrue(np.allclose(C1, C3)) return C1 def test_two_populations_high_migration(self): ts = msprime.simulate( population_configurations=[ msprime.PopulationConfiguration(8), msprime.PopulationConfiguration(8)], migration_matrix=[[0, 1], [1, 0]], recombination_rate=3, random_seed=5) self.assertGreater(ts.num_trees, 1) self.verify(ts, [ts.samples(0), ts.samples(1)]) def test_single_tree(self): ts = msprime.simulate(6, random_seed=1) S = [range(3), range(3, 6)] C = self.verify(ts, S) for j, samples in enumerate(S): tree = next(ts.trees(tracked_samples=samples)) for u in tree.nodes(): self.assertEqual(tree.num_tracked_samples(u), C[u, j]) def test_single_tree_partial_samples(self): ts = msprime.simulate(6, random_seed=1) S = [range(3), range(3, 4)] C = self.verify(ts, S) for j, samples in enumerate(S): tree = next(ts.trees(tracked_samples=samples)) for u in tree.nodes(): self.assertEqual(tree.num_tracked_samples(u), C[u, j]) def test_single_tree_all_sample_sets(self): ts = msprime.simulate(6, random_seed=1) for S in set_partitions(list(range(ts.num_samples))): C = self.verify(ts, S) for j, samples in enumerate(S): tree = next(ts.trees(tracked_samples=samples)) for u in tree.nodes(): self.assertEqual(tree.num_tracked_samples(u), C[u, j]) def test_many_trees_all_sample_sets(self): ts = msprime.simulate(6, recombination_rate=2, random_seed=1) self.assertGreater(ts.num_trees, 2) for S in set_partitions(list(range(ts.num_samples))): self.verify(ts, S) def test_wright_fisher_unsimplified_all_sample_sets(self): tables = wf.wf_sim( 4, 5, seed=1, deep_history=False, initial_generation_samples=False, num_loci=10) tables.sort() ts = tables.tree_sequence() for S in set_partitions(list(ts.samples())): self.verify(ts, S) def test_wright_fisher_unsimplified(self): tables = wf.wf_sim( 20, 15, seed=1, deep_history=False, initial_generation_samples=False, num_loci=20) tables.sort() ts = tables.tree_sequence() samples = ts.samples() self.verify(ts, [samples[:10], samples[10:]]) def test_wright_fisher_simplified(self): tables = wf.wf_sim( 30, 10, seed=1, deep_history=False, initial_generation_samples=False, num_loci=5) tables.sort() ts = tables.tree_sequence() samples = ts.samples() self.verify(ts, [samples[:10], samples[10:]]) def naive_genealogical_nearest_neighbours(ts, focal, reference_sets): # Make sure everything is a sample so we can use the tracked_samples option. # This is a limitation of the current API. tables = ts.dump_tables() tables.nodes.set_columns( flags=np.ones_like(tables.nodes.flags), time=tables.nodes.time) ts = tables.tree_sequence() A = np.zeros((len(focal), len(reference_sets))) L = np.zeros(len(focal)) reference_set_map = np.zeros(ts.num_nodes, dtype=int) - 1 for k, ref_set in enumerate(reference_sets): for u in ref_set: reference_set_map[u] = k tree_iters = [ ts.trees(tracked_samples=reference_nodes) for reference_nodes in reference_sets] for _ in range(ts.num_trees): trees = list(map(next, tree_iters)) length = trees[0].interval[1] - trees[0].interval[0] for j, u in enumerate(focal): focal_node_set = reference_set_map[u] # delta(u) = 1 if u exists in any of the reference sets; 0 otherwise delta = int(focal_node_set != -1) v = u while v != tskit.NULL: total = sum(tree.num_tracked_samples(v) for tree in trees) if total > delta: break v = trees[0].parent(v) if v != tskit.NULL: for k, tree in enumerate(trees): # If the focal node is in the current set, we subtract its # contribution from the numerator n = tree.num_tracked_samples(v) - (k == focal_node_set) # If the focal node is in *any* reference set, we subtract its # contribution from the demoninator. A[j, k] += length * n / (total - delta) L[j] += length # Normalise by the accumulated value for each focal node. index = L > 0 L = L[index] L = L.reshape((L.shape[0], 1)) A[index, :] /= L return A class TestGenealogicalNearestNeighbours(unittest.TestCase): """ Tests the TreeSequence.genealogical_nearest_neighbours method. """ # # 8 # / \ # / \ # / \ # 7 \ # / \ 6 # / 5 / \ # / / \ / \ # 4 0 1 2 3 small_tree_ex_nodes = """\ id is_sample population time 0 1 0 0.00000000000000 1 1 0 0.00000000000000 2 1 0 0.00000000000000 3 1 0 0.00000000000000 4 1 0 0.00000000000000 5 0 0 0.14567111023387 6 0 0 0.21385545626353 7 0 0 0.43508024345063 8 0 0 1.60156352971203 """ small_tree_ex_edges = """\ id left right parent child 0 0.00000000 1.00000000 5 0,1 1 0.00000000 1.00000000 6 2,3 2 0.00000000 1.00000000 7 4,5 3 0.00000000 1.00000000 8 6,7 """ def verify(self, ts, reference_sets, focal=None): if focal is None: focal = [u for refset in reference_sets for u in refset] A1 = naive_genealogical_nearest_neighbours(ts, focal, reference_sets) A2 = tsutil.genealogical_nearest_neighbours(ts, focal, reference_sets) A3 = ts.genealogical_nearest_neighbours(focal, reference_sets) A4 = ts.genealogical_nearest_neighbours(focal, reference_sets, num_threads=3) self.assertTrue(np.array_equal(A3, A4)) self.assertEqual(A1.shape, A2.shape) self.assertEqual(A1.shape, A3.shape) self.assertTrue(np.allclose(A1, A2)) self.assertTrue(np.allclose(A1, A3)) if ts.num_edges > 0 and all(ts.node(u).is_sample() for u in focal): # When the focal nodes are samples, we can assert some stronger properties. self.assertTrue(np.allclose(np.sum(A1, axis=1), 1)) return A1 def test_simple_example_all_samples(self): ts = tskit.load_text( nodes=io.StringIO(self.small_tree_ex_nodes), edges=io.StringIO(self.small_tree_ex_edges), strict=False) A = self.verify(ts, [[0, 1], [2, 3, 4]], [0]) self.assertEqual(list(A[0]), [1, 0]) A = self.verify(ts, [[0, 1], [2, 3, 4]], [4]) self.assertEqual(list(A[0]), [1, 0]) A = self.verify(ts, [[0, 1], [2, 3, 4]], [2]) self.assertEqual(list(A[0]), [0, 1]) A = self.verify(ts, [[0, 2], [1, 3, 4]], [0]) self.assertEqual(list(A[0]), [0, 1]) A = self.verify(ts, [[0, 2], [1, 3, 4]], [4]) self.assertEqual(list(A[0]), [0.5, 0.5]) def test_simple_example_missing_samples(self): ts = tskit.load_text( nodes=io.StringIO(self.small_tree_ex_nodes), edges=io.StringIO(self.small_tree_ex_edges), strict=False) A = self.verify(ts, [[0, 1], [2, 4]], [3]) self.assertEqual(list(A[0]), [0, 1]) A = self.verify(ts, [[0, 1], [2, 4]], [2]) self.assertTrue(np.allclose(A[0], [2 / 3, 1 / 3])) def test_simple_example_internal_focal_node(self): ts = tskit.load_text( nodes=io.StringIO(self.small_tree_ex_nodes), edges=io.StringIO(self.small_tree_ex_edges), strict=False) focal = [7] # An internal node reference_sets = [[4, 0, 1], [2, 3]] GNN = naive_genealogical_nearest_neighbours(ts, focal, reference_sets) self.assertTrue(np.allclose(GNN[0], np.array([1.0, 0.0]))) GNN = tsutil.genealogical_nearest_neighbours(ts, focal, reference_sets) self.assertTrue(np.allclose(GNN[0], np.array([1.0, 0.0]))) GNN = ts.genealogical_nearest_neighbours(focal, reference_sets) self.assertTrue(np.allclose(GNN[0], np.array([1.0, 0.0]))) focal = [8] # The root GNN = naive_genealogical_nearest_neighbours(ts, focal, reference_sets) self.assertTrue(np.allclose(GNN[0], np.array([0.6, 0.4]))) GNN = tsutil.genealogical_nearest_neighbours(ts, focal, reference_sets) self.assertTrue(np.allclose(GNN[0], np.array([0.6, 0.4]))) GNN = ts.genealogical_nearest_neighbours(focal, reference_sets) self.assertTrue(np.allclose(GNN[0], np.array([0.6, 0.4]))) def test_two_populations_high_migration(self): ts = msprime.simulate( population_configurations=[ msprime.PopulationConfiguration(18), msprime.PopulationConfiguration(18)], migration_matrix=[[0, 1], [1, 0]], recombination_rate=8, random_seed=5) self.assertGreater(ts.num_trees, 1) self.verify(ts, [ts.samples(0), ts.samples(1)]) def test_single_tree(self): ts = msprime.simulate(6, random_seed=1) S = [range(3), range(3, 6)] self.verify(ts, S) def test_single_tree_internal_reference_sets(self): ts = msprime.simulate(10, random_seed=1) tree = ts.first() S = [[u] for u in tree.children(tree.root)] self.verify(ts, S, ts.samples()) def test_single_tree_all_nodes(self): ts = msprime.simulate(10, random_seed=1) S = [np.arange(ts.num_nodes, dtype=np.int32)] self.verify(ts, S, np.arange(ts.num_nodes, dtype=np.int32)) def test_single_tree_partial_samples(self): ts = msprime.simulate(6, random_seed=1) S = [range(3), range(3, 4)] self.verify(ts, S) def test_single_tree_all_sample_sets(self): ts = msprime.simulate(6, random_seed=1) for S in set_partitions(list(range(ts.num_samples))): self.verify(ts, S) def test_many_trees_all_sample_sets(self): ts = msprime.simulate(6, recombination_rate=2, random_seed=1) self.assertGreater(ts.num_trees, 2) for S in set_partitions(list(range(ts.num_samples))): self.verify(ts, S) def test_many_trees_sequence_length(self): for L in [0.5, 1.5, 3.3333]: ts = msprime.simulate(6, length=L, recombination_rate=2, random_seed=1) self.verify(ts, [range(3), range(3, 6)]) def test_many_trees_all_nodes(self): ts = msprime.simulate(6, length=4, recombination_rate=2, random_seed=1) S = [np.arange(ts.num_nodes, dtype=np.int32)] self.verify(ts, S, np.arange(ts.num_nodes, dtype=np.int32)) def test_wright_fisher_unsimplified_all_sample_sets(self): tables = wf.wf_sim( 4, 5, seed=1, deep_history=True, initial_generation_samples=False, num_loci=10) tables.sort() ts = tables.tree_sequence() for S in set_partitions(list(ts.samples())): self.verify(ts, S) def test_wright_fisher_unsimplified(self): tables = wf.wf_sim( 20, 15, seed=1, deep_history=True, initial_generation_samples=False, num_loci=20) tables.sort() ts = tables.tree_sequence() samples = ts.samples() self.verify(ts, [samples[:10], samples[10:]]) def test_wright_fisher_initial_generation(self): tables = wf.wf_sim( 20, 15, seed=1, deep_history=True, initial_generation_samples=True, num_loci=20) tables.sort() tables.simplify() ts = tables.tree_sequence() samples = ts.samples() founders = [u for u in samples if ts.node(u).time > 0] samples = [u for u in samples if ts.node(u).time == 0] self.verify(ts, [founders[:10], founders[10:]], samples) def test_wright_fisher_initial_generation_no_deep_history(self): tables = wf.wf_sim( 20, 15, seed=2, deep_history=False, initial_generation_samples=True, num_loci=20) tables.sort() tables.simplify() ts = tables.tree_sequence() samples = ts.samples() founders = [u for u in samples if ts.node(u).time > 0] samples = [u for u in samples if ts.node(u).time == 0] self.verify(ts, [founders[:10], founders[10:]], samples) def test_wright_fisher_unsimplified_multiple_roots(self): tables = wf.wf_sim( 20, 15, seed=1, deep_history=False, initial_generation_samples=False, num_loci=20) tables.sort() ts = tables.tree_sequence() samples = ts.samples() self.verify(ts, [samples[:10], samples[10:]]) def test_wright_fisher_simplified(self): tables = wf.wf_sim( 31, 10, seed=1, deep_history=True, initial_generation_samples=False, num_loci=5) tables.sort() ts = tables.tree_sequence().simplify() samples = ts.samples() self.verify(ts, [samples[:10], samples[10:]]) def test_wright_fisher_simplified_multiple_roots(self): tables = wf.wf_sim( 31, 10, seed=1, deep_history=False, initial_generation_samples=False, num_loci=5) tables.sort() ts = tables.tree_sequence() samples = ts.samples() self.verify(ts, [samples[:10], samples[10:]]) def test_empty_ts(self): tables = tskit.TableCollection(1.0) tables.nodes.add_row(1, 0) tables.nodes.add_row(1, 0) ts = tables.tree_sequence() self.verify(ts, [[0], [1]]) def exact_genealogical_nearest_neighbours(ts, focal, reference_sets): # Same as above, except we return the per-tree value for a single node. # Make sure everyhing is a sample so we can use the tracked_samples option. # This is a limitation of the current API. tables = ts.dump_tables() tables.nodes.set_columns( flags=np.ones_like(tables.nodes.flags), time=tables.nodes.time) ts = tables.tree_sequence() A = np.zeros((len(reference_sets), ts.num_trees)) L = np.zeros(ts.num_trees) reference_set_map = np.zeros(ts.num_nodes, dtype=int) - 1 for k, ref_set in enumerate(reference_sets): for u in ref_set: reference_set_map[u] = k tree_iters = [ ts.trees(tracked_samples=reference_nodes) for reference_nodes in reference_sets] u = focal focal_node_set = reference_set_map[u] # delta(u) = 1 if u exists in any of the reference sets; 0 otherwise delta = int(focal_node_set != -1) for _ in range(ts.num_trees): trees = list(map(next, tree_iters)) v = trees[0].parent(u) while v != tskit.NULL: total = sum(tree.num_tracked_samples(v) for tree in trees) if total > delta: break v = trees[0].parent(v) if v != tskit.NULL: # The length is only reported where the statistic is defined. L[trees[0].index] = trees[0].interval[1] - trees[0].interval[0] for k, tree in enumerate(trees): # If the focal node is in the current set, we subtract its # contribution from the numerator n = tree.num_tracked_samples(v) - (k == focal_node_set) # If the focal node is in *any* reference set, we subtract its # contribution from the demoninator. A[k, tree.index] = n / (total - delta) return A, L def local_gnn(ts, focal, reference_sets): # Temporary implementation of the treewise GNN. reference_set_map = np.zeros(ts.num_nodes, dtype=int) - 1 for k, reference_set in enumerate(reference_sets): for u in reference_set: if reference_set_map[u] != -1: raise ValueError("Duplicate value in reference sets") reference_set_map[u] = k K = len(reference_sets) A = np.zeros((len(focal), ts.num_trees, K)) lefts = np.zeros(ts.num_trees, dtype=float) rights = np.zeros(ts.num_trees, dtype=float) parent = np.zeros(ts.num_nodes, dtype=int) - 1 sample_count = np.zeros((ts.num_nodes, K), dtype=int) # Set the intitial conditions. for j in range(K): sample_count[reference_sets[j], j] = 1 for t, ((left, right), edges_out, edges_in) in enumerate(ts.edge_diffs()): for edge in edges_out: parent[edge.child] = -1 v = edge.parent while v != -1: sample_count[v] -= sample_count[edge.child] v = parent[v] for edge in edges_in: parent[edge.child] = edge.parent v = edge.parent while v != -1: sample_count[v] += sample_count[edge.child] v = parent[v] # Process this tree. for j, u in enumerate(focal): focal_reference_set = reference_set_map[u] delta = int(focal_reference_set != -1) p = parent[u] lefts[t] = left rights[t] = right while p != tskit.NULL: total = np.sum(sample_count[p]) if total > delta: break p = parent[p] if p != tskit.NULL: scale = 1 / (total - delta) for k, reference_set in enumerate(reference_sets): n = sample_count[p, k] - int(focal_reference_set == k) A[j, t, k] = n * scale return (A, lefts, rights) class TestExactGenealogicalNearestNeighbours(TestGenealogicalNearestNeighbours): # This is a work in progress - these tests will be adapted to use the # treewise GNN when it's implemented. def verify(self, ts, reference_sets, focal=None): if focal is None: focal = [u for refset in reference_sets for u in refset] A = ts.genealogical_nearest_neighbours(focal, reference_sets) G, lefts, rights = local_gnn(ts, focal, reference_sets) for tree in ts.trees(): self.assertEqual(lefts[tree.index], tree.interval[0]) self.assertEqual(rights[tree.index], tree.interval[1]) for j, u in enumerate(focal): T, L = exact_genealogical_nearest_neighbours(ts, u, reference_sets) self.assertTrue(np.allclose(G[j], T.T)) # Ignore the cases where the node has no GNNs if np.sum(L) > 0: mean = np.sum(T * L, axis=1) / np.sum(L) self.assertTrue(np.allclose(mean, A[j])) return A
[ 1, 529, 9507, 29958, 4691, 29914, 21150, 29914, 1688, 29918, 16202, 29889, 2272, 13, 29937, 341, 1806, 19245, 13, 29937, 13, 29937, 14187, 1266, 313, 29883, 29897, 29871, 29906, 29900, 29896, 29947, 29899, 29906, 29900, 29896, 29929, 323, 808, 277, 10682, 414, 13, 29937, 14187, 1266, 313, 29907, 29897, 29871, 29906, 29900, 29896, 29953, 3014, 310, 11045, 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, 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, 15945, 29908, 13, 3057, 4251, 363, 22663, 17203, 297, 260, 808, 277, 29889, 13, 15945, 29908, 13, 5215, 443, 27958, 13, 5215, 12013, 13, 13, 5215, 12655, 408, 7442, 13, 5215, 10887, 10080, 13, 13, 5215, 260, 808, 277, 13, 5215, 903, 29873, 808, 277, 13, 5215, 6987, 29889, 1372, 4422, 408, 18696, 4422, 13, 5215, 6987, 29889, 1688, 29918, 29893, 1266, 29918, 15161, 261, 408, 281, 29888, 13, 13, 13, 1753, 679, 29918, 29878, 29906, 29918, 5344, 29898, 1372, 1125, 13, 1678, 9995, 13, 1678, 16969, 278, 4636, 363, 278, 6790, 5447, 5665, 29889, 910, 338, 15712, 13, 1678, 3025, 263, 20837, 5132, 5687, 29889, 13, 1678, 9995, 13, 1678, 302, 353, 18696, 29889, 657, 29918, 11249, 29918, 2311, 580, 13, 1678, 286, 353, 18696, 29889, 657, 29918, 1949, 29918, 6149, 800, 580, 13, 1678, 319, 353, 7442, 29889, 3298, 359, 3552, 29885, 29892, 286, 511, 26688, 29922, 7411, 29897, 13, 1678, 363, 260, 29896, 297, 18696, 29889, 28737, 7295, 13, 4706, 363, 269, 29909, 297, 260, 29896, 29889, 16315, 7295, 13, 9651, 4974, 7431, 29898, 29879, 29909, 29889, 6149, 800, 29897, 1275, 29871, 29896, 13, 9651, 286, 29909, 353, 269, 29909, 29889, 6149, 800, 29961, 29900, 29962, 13, 9651, 319, 29961, 29879, 29909, 29889, 333, 29892, 269, 29909, 29889, 333, 29962, 353, 29871, 29896, 13, 9651, 285, 29909, 353, 260, 29896, 29889, 657, 29918, 1949, 29918, 27736, 29898, 29885, 29909, 29889, 3177, 29897, 847, 302, 13, 9651, 11916, 353, 1051, 29898, 29873, 29896, 29889, 27736, 29898, 29885, 29909, 29889, 3177, 876, 13, 9651, 363, 260, 29906, 297, 18696, 29889, 28737, 29898, 11294, 287, 29918, 27736, 29922, 27736, 1125, 13, 18884, 363, 269, 29933, 297, 260, 29906, 29889, 16315, 7295, 13, 462, 1678, 4974, 7431, 29898, 29879, 29933, 29889, 6149, 800, 29897, 1275, 29871, 29896, 13, 462, 1678, 286, 29933, 353, 269, 29933, 29889, 6149, 800, 29961, 29900, 29962, 13, 462, 1678, 565, 269, 29933, 29889, 3283, 1405, 269, 29909, 29889, 3283, 29901, 13, 462, 4706, 285, 29933, 353, 260, 29906, 29889, 657, 29918, 1949, 29918, 27736, 29898, 29885, 29933, 29889, 3177, 29897, 847, 302, 13, 462, 4706, 285, 2882, 353, 260, 29906, 29889, 657, 29918, 1949, 29918, 11294, 287, 29918, 27736, 29898, 29885, 29933, 29889, 3177, 29897, 847, 302, 13, 462, 4706, 360, 353, 285, 2882, 448, 285, 29909, 334, 285, 29933, 13, 462, 4706, 364, 29906, 353, 360, 334, 360, 847, 313, 29888, 29909, 334, 285, 29933, 334, 313, 29896, 448, 285, 29909, 29897, 334, 313, 29896, 448, 285, 29933, 876, 13, 462, 4706, 319, 29961, 29879, 29909, 29889, 333, 29892, 269, 29933, 29889, 333, 29962, 353, 364, 29906, 13, 462, 4706, 319, 29961, 29879, 29933, 29889, 333, 29892, 269, 29909, 29889, 333, 29962, 353, 364, 29906, 13, 1678, 736, 319, 13, 13, 13, 1990, 4321, 29931, 29881, 27065, 1061, 29898, 348, 27958, 29889, 3057, 8259, 1125, 13, 1678, 9995, 13, 1678, 4321, 29879, 363, 278, 365, 29881, 27065, 1061, 770, 29889, 13, 1678, 9995, 13, 13, 1678, 954, 29918, 1688, 29918, 16315, 353, 29871, 29945, 29900, 13, 13, 1678, 822, 11539, 29918, 5344, 29898, 1311, 29892, 18696, 1125, 13, 4706, 286, 353, 18696, 29889, 657, 29918, 1949, 29918, 16315, 580, 13, 4706, 301, 13891, 353, 260, 808, 277, 29889, 29931, 29881, 27065, 1061, 29898, 1372, 29897, 13, 4706, 319, 353, 301, 13891, 29889, 657, 29918, 29878, 29906, 29918, 5344, 580, 13, 4706, 1583, 29889, 9294, 9843, 29898, 29909, 29889, 12181, 29892, 313, 29885, 29892, 286, 876, 13, 4706, 350, 353, 679, 29918, 29878, 29906, 29918, 5344, 29898, 1372, 29897, 13, 4706, 1583, 29889, 9294, 5574, 29898, 9302, 29889, 497, 5358, 29898, 29909, 29892, 350, 876, 13, 13, 4706, 396, 2567, 1106, 472, 1269, 1948, 297, 2507, 29892, 322, 11539, 372, 29915, 29879, 278, 1021, 13, 4706, 396, 746, 591, 671, 679, 29918, 29878, 29906, 4153, 29889, 13, 4706, 363, 432, 297, 3464, 29898, 29885, 1125, 13, 9651, 263, 353, 301, 13891, 29889, 657, 29918, 29878, 29906, 29918, 2378, 29898, 29926, 29892, 5305, 29922, 29873, 808, 277, 29889, 22051, 29956, 17011, 29897, 13, 9651, 289, 353, 319, 29961, 29926, 29892, 432, 718, 29871, 29896, 17531, 13, 9651, 1583, 29889, 9294, 9843, 29898, 29874, 29889, 12181, 29961, 29900, 1402, 286, 448, 432, 448, 29871, 29896, 29897, 13, 9651, 1583, 29889, 9294, 9843, 29898, 29890, 29889, 12181, 29961, 29900, 1402, 286, 448, 432, 448, 29871, 29896, 29897, 13, 9651, 1583, 29889, 9294, 5574, 29898, 9302, 29889, 497, 5358, 29898, 29874, 29892, 289, 876, 13, 9651, 263, 353, 301, 13891, 29889, 657, 29918, 29878, 29906, 29918, 2378, 29898, 29926, 29892, 5305, 29922, 29873, 808, 277, 29889, 1525, 5348, 1660, 29897, 13, 9651, 289, 353, 319, 29961, 29926, 29892, 584, 29926, 29962, 13, 9651, 1583, 29889, 9294, 9843, 29898, 29874, 29889, 12181, 29961, 29900, 1402, 432, 29897, 13, 9651, 1583, 29889, 9294, 9843, 29898, 29890, 29889, 12181, 29961, 29900, 1402, 432, 29897, 13, 9651, 1583, 29889, 9294, 5574, 29898, 9302, 29889, 497, 5358, 29898, 29874, 29961, 1057, 29899, 29896, 1402, 289, 876, 13, 13, 4706, 396, 2567, 1423, 1432, 3038, 297, 278, 4636, 297, 2507, 29889, 13, 4706, 363, 432, 297, 3464, 29898, 29885, 1125, 13, 9651, 363, 413, 297, 3464, 29898, 29885, 1125, 13, 18884, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 430, 29883, 29889, 657, 29918, 29878, 29906, 29898, 29926, 29892, 413, 511, 319, 29961, 29926, 29892, 413, 2314, 13, 13, 1678, 822, 11539, 29918, 3317, 29918, 19244, 29898, 1311, 29892, 18696, 1125, 13, 4706, 9995, 13, 4706, 1798, 11057, 393, 278, 4236, 29918, 19244, 3443, 1736, 408, 3806, 29889, 13, 4706, 9995, 13, 4706, 5478, 800, 353, 1051, 29898, 1372, 29889, 6149, 800, 3101, 13, 4706, 301, 13891, 353, 260, 808, 277, 29889, 29931, 29881, 27065, 1061, 29898, 1372, 29897, 13, 4706, 319, 353, 301, 13891, 29889, 657, 29918, 29878, 29906, 29918, 5344, 580, 13, 4706, 432, 353, 7431, 29898, 6149, 800, 29897, 849, 29871, 29906, 13, 4706, 363, 413, 297, 3464, 29898, 29926, 1125, 13, 9651, 921, 353, 5478, 800, 29961, 29926, 718, 413, 1822, 3283, 448, 5478, 800, 29961, 29926, 1822, 3283, 13, 9651, 263, 353, 301, 13891, 29889, 657, 29918, 29878, 29906, 29918, 2378, 29898, 29926, 29892, 4236, 29918, 19244, 29922, 29916, 29897, 13, 9651, 1583, 29889, 9294, 9843, 29898, 29874, 29889, 12181, 29961, 29900, 1402, 413, 29897, 13, 9651, 1583, 29889, 9294, 5574, 29898, 9302, 29889, 497, 5358, 29898, 29909, 29961, 29926, 29892, 432, 718, 29871, 29896, 29901, 432, 718, 29871, 29896, 718, 413, 1402, 263, 876, 13, 9651, 921, 353, 5478, 800, 29961, 29926, 1822, 3283, 448, 5478, 800, 29961, 29926, 448, 413, 1822, 3283, 13, 9651, 263, 353, 301, 13891, 29889, 657, 29918, 29878, 29906, 29918, 2378, 29898, 29926, 29892, 4236, 29918, 19244, 29922, 29916, 29892, 5305, 29922, 29873, 808, 277, 29889, 1525, 5348, 1660, 29897, 13, 9651, 1583, 29889, 9294, 9843, 29898, 29874, 29889, 12181, 29961, 29900, 1402, 413, 29897, 13, 9651, 1583, 29889, 9294, 5574, 29898, 9302, 29889, 497, 5358, 29898, 29909, 29961, 29926, 29892, 432, 448, 413, 29901, 432, 1402, 263, 29961, 1057, 29899, 29896, 12622, 13, 4706, 365, 353, 18696, 29889, 657, 29918, 16506, 29918, 2848, 580, 13, 4706, 286, 353, 7431, 29898, 6149, 800, 29897, 13, 4706, 263, 353, 301, 13891, 29889, 657, 29918, 29878, 29906, 29918, 2378, 29898, 29900, 29892, 4236, 29918, 19244, 29922, 29931, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 29874, 29889, 12181, 29961, 29900, 1402, 286, 448, 29871, 29896, 29897, 13, 4706, 1583, 29889, 9294, 5574, 29898, 9302, 29889, 497, 5358, 29898, 29909, 29961, 29900, 29892, 29871, 29896, 29901, 1402, 263, 876, 13, 4706, 263, 353, 301, 13891, 29889, 657, 29918, 29878, 29906, 29918, 2378, 29898, 29885, 448, 29871, 29896, 29892, 4236, 29918, 19244, 29922, 29931, 29892, 5305, 29922, 29873, 808, 277, 29889, 1525, 5348, 1660, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 29874, 29889, 12181, 29961, 29900, 1402, 286, 448, 29871, 29896, 29897, 13, 4706, 1583, 29889, 9294, 5574, 29898, 9302, 29889, 497, 5358, 29898, 29909, 29961, 29885, 448, 29871, 29896, 29892, 8956, 29896, 1402, 263, 29961, 1057, 29899, 29896, 12622, 13, 13, 1678, 822, 11539, 29918, 3317, 29918, 6149, 800, 29898, 1311, 29892, 18696, 1125, 13, 4706, 9995, 13, 4706, 1798, 11057, 393, 278, 4236, 5478, 800, 3443, 1736, 408, 3806, 29889, 13, 4706, 9995, 13, 4706, 5478, 800, 353, 1051, 29898, 1372, 29889, 6149, 800, 3101, 13, 4706, 301, 13891, 353, 260, 808, 277, 29889, 29931, 29881, 27065, 1061, 29898, 1372, 29897, 13, 4706, 319, 353, 301, 13891, 29889, 657, 29918, 29878, 29906, 29918, 5344, 580, 13, 4706, 432, 353, 7431, 29898, 6149, 800, 29897, 849, 29871, 29906, 13, 4706, 363, 413, 297, 3464, 29898, 29926, 1125, 13, 9651, 263, 353, 301, 13891, 29889, 657, 29918, 29878, 29906, 29918, 2378, 29898, 29926, 29892, 4236, 29918, 6149, 800, 29922, 29895, 29897, 13, 9651, 1583, 29889, 9294, 9843, 29898, 29874, 29889, 12181, 29961, 29900, 1402, 413, 29897, 13, 9651, 1583, 29889, 9294, 5574, 29898, 9302, 29889, 497, 5358, 29898, 29909, 29961, 29926, 29892, 432, 718, 29871, 29896, 29901, 432, 718, 29871, 29896, 718, 413, 1402, 263, 876, 13, 9651, 263, 353, 301, 13891, 29889, 657, 29918, 29878, 29906, 29918, 2378, 29898, 29926, 29892, 4236, 29918, 6149, 800, 29922, 29895, 29892, 5305, 29922, 29873, 808, 277, 29889, 1525, 5348, 1660, 29897, 13, 9651, 1583, 29889, 9294, 9843, 29898, 29874, 29889, 12181, 29961, 29900, 1402, 413, 29897, 13, 9651, 1583, 29889, 9294, 5574, 29898, 9302, 29889, 497, 5358, 29898, 29909, 29961, 29926, 29892, 432, 448, 413, 29901, 432, 1402, 263, 29961, 1057, 29899, 29896, 12622, 13, 13, 1678, 822, 1243, 29918, 14369, 29918, 8336, 29918, 3601, 7964, 29918, 6149, 800, 29898, 1311, 1125, 13, 4706, 18696, 353, 10887, 10080, 29889, 3601, 5987, 29898, 29906, 29900, 29892, 5478, 362, 29918, 10492, 29922, 29896, 29900, 29892, 4036, 29918, 26776, 29922, 29896, 29945, 29897, 13, 4706, 18696, 353, 18696, 4422, 29889, 1491, 11249, 29918, 16315, 29898, 1372, 29892, 1583, 29889, 1949, 29918, 1688, 29918, 16315, 29897, 13, 4706, 1583, 29889, 27902, 29918, 5344, 29898, 1372, 29897, 13, 4706, 1583, 29889, 27902, 29918, 3317, 29918, 19244, 29898, 1372, 29897, 13, 13, 1678, 822, 1243, 29918, 311, 17990, 630, 29918, 2606, 2129, 29898, 1311, 1125, 13, 4706, 18696, 353, 10887, 10080, 29889, 3601, 5987, 29898, 29906, 29900, 29892, 5478, 362, 29918, 10492, 29922, 29896, 29900, 29892, 4036, 29918, 26776, 29922, 29896, 29945, 29897, 13, 4706, 18696, 353, 18696, 4422, 29889, 1491, 11249, 29918, 16315, 29898, 1372, 29892, 1583, 29889, 1949, 29918, 1688, 29918, 16315, 29897, 13, 4706, 301, 13891, 353, 260, 808, 277, 29889, 29931, 29881, 27065, 1061, 29898, 1372, 29897, 13, 4706, 319, 353, 301, 13891, 29889, 657, 29918, 29878, 29906, 29918, 5344, 580, 13, 4706, 350, 353, 301, 13891, 29889, 29878, 29906, 29918, 5344, 580, 13, 4706, 1583, 29889, 9294, 5574, 29898, 9302, 29889, 2378, 29918, 11745, 29898, 29909, 29892, 350, 876, 13, 4706, 263, 353, 301, 13891, 29889, 657, 29918, 29878, 29906, 29918, 2378, 29898, 29900, 29897, 13, 4706, 289, 353, 301, 13891, 29889, 29878, 29906, 29918, 2378, 29898, 29900, 29897, 13, 4706, 1583, 29889, 9294, 5574, 29898, 9302, 29889, 2378, 29918, 11745, 29898, 29874, 29892, 289, 876, 13, 4706, 1583, 29889, 9294, 9843, 29898, 430, 29883, 29889, 657, 29918, 29878, 29906, 29898, 29900, 29892, 29871, 29896, 511, 301, 13891, 29889, 29878, 29906, 29898, 29900, 29892, 29871, 29896, 876, 13, 13, 1678, 822, 1243, 29918, 14369, 29918, 8336, 29918, 15227, 29918, 6149, 800, 29898, 1311, 1125, 13, 4706, 18696, 353, 10887, 10080, 29889, 3601, 5987, 29898, 1311, 29889, 1949, 29918, 1688, 29918, 16315, 29892, 3309, 29922, 1311, 29889, 1949, 29918, 1688, 29918, 16315, 29897, 13, 4706, 18696, 353, 18696, 4422, 29889, 7851, 29918, 17519, 29918, 6149, 800, 29898, 1372, 29897, 13, 4706, 396, 1334, 1016, 29915, 29873, 2304, 1250, 5478, 800, 29892, 577, 445, 881, 4418, 29889, 13, 4706, 1583, 29889, 9294, 29934, 1759, 267, 7373, 29873, 808, 277, 29889, 12284, 2392, 29892, 1583, 29889, 27902, 29918, 5344, 29892, 18696, 29897, 13, 4706, 1583, 29889, 9294, 29934, 1759, 267, 7373, 29873, 808, 277, 29889, 12284, 2392, 29892, 1583, 29889, 27902, 29918, 3317, 29918, 19244, 29892, 18696, 29897, 13, 13, 1678, 822, 1243, 29918, 8336, 29918, 16506, 29918, 15227, 29918, 6149, 800, 29898, 1311, 1125, 13, 4706, 18696, 353, 10887, 10080, 29889, 3601, 5987, 29898, 13, 9651, 1583, 29889, 1949, 29918, 1688, 29918, 16315, 29892, 27878, 2109, 362, 29918, 10492, 29922, 29896, 29892, 13, 9651, 3309, 29922, 1311, 29889, 1949, 29918, 1688, 29918, 16315, 29897, 13, 4706, 1583, 29889, 9294, 25120, 1008, 29898, 1372, 29889, 657, 29918, 1949, 29918, 28737, 3285, 29871, 29896, 29900, 29897, 13, 4706, 260, 353, 18696, 29889, 15070, 29918, 24051, 580, 13, 4706, 260, 29889, 16315, 29889, 12071, 580, 13, 4706, 260, 29889, 6149, 800, 29889, 12071, 580, 13, 4706, 363, 432, 297, 3464, 29898, 1311, 29889, 1949, 29918, 1688, 29918, 16315, 1125, 13, 9651, 3268, 29918, 333, 353, 7431, 29898, 29873, 29889, 16315, 29897, 13, 9651, 260, 29889, 16315, 29889, 1202, 29918, 798, 29898, 3283, 29922, 29926, 29892, 19525, 1705, 29918, 3859, 543, 29900, 1159, 13, 9651, 260, 29889, 6149, 800, 29889, 1202, 29918, 798, 29898, 2746, 29922, 2746, 29918, 333, 29892, 10723, 29918, 3859, 543, 29896, 613, 2943, 29922, 29926, 29897, 13, 4706, 18696, 353, 260, 29889, 8336, 29918, 16506, 580, 13, 4706, 1583, 29889, 27902, 29918, 5344, 29898, 1372, 29897, 13, 4706, 1583, 29889, 27902, 29918, 3317, 29918, 19244, 29898, 1372, 29897, 13, 13, 1678, 822, 1243, 29918, 8336, 29918, 16506, 29918, 3601, 7964, 29918, 6149, 800, 29898, 1311, 1125, 13, 4706, 18696, 353, 10887, 10080, 29889, 3601, 5987, 29898, 29906, 29900, 29892, 5478, 362, 29918, 10492, 29922, 29896, 29900, 29892, 27878, 2109, 362, 29918, 10492, 29922, 29896, 29900, 29897, 13, 4706, 1583, 29889, 9294, 25120, 1008, 29898, 1372, 29889, 657, 29918, 1949, 29918, 28737, 3285, 29871, 29896, 29900, 29897, 13, 4706, 18696, 353, 18696, 4422, 29889, 1491, 11249, 29918, 16315, 29898, 1372, 29892, 1583, 29889, 1949, 29918, 1688, 29918, 16315, 29897, 13, 4706, 1583, 29889, 27902, 29918, 5344, 29898, 1372, 29897, 13, 4706, 1583, 29889, 27902, 29918, 3317, 29918, 19244, 29898, 1372, 29897, 13, 4706, 1583, 29889, 27902, 29918, 3317, 29918, 6149, 800, 29898, 1372, 29897, 13, 13, 13, 1753, 731, 29918, 1595, 2187, 29898, 10855, 1125, 13, 1678, 9995, 13, 1678, 16969, 385, 474, 261, 1061, 975, 599, 23629, 310, 278, 6790, 731, 29889, 13, 13, 1678, 3645, 2045, 597, 2417, 29889, 510, 29914, 2619, 29914, 29896, 29929, 29941, 29953, 29947, 29941, 29955, 29945, 29914, 842, 29899, 1595, 2187, 29899, 262, 29899, 4691, 13, 1678, 9995, 13, 1678, 565, 7431, 29898, 10855, 29897, 1275, 29871, 29896, 29901, 13, 4706, 7709, 518, 10855, 29962, 13, 1678, 1683, 29901, 13, 4706, 937, 353, 4333, 29961, 29900, 29962, 13, 4706, 363, 7968, 297, 731, 29918, 1595, 2187, 29898, 10855, 29961, 29896, 17531, 1125, 13, 9651, 363, 302, 29892, 11306, 297, 26985, 29898, 9278, 261, 1125, 13, 18884, 7709, 7968, 7503, 29876, 29962, 718, 5519, 4102, 29962, 718, 11306, 29962, 718, 7968, 29961, 29876, 718, 29871, 29896, 17531, 13, 9651, 7709, 5519, 4102, 5262, 718, 7968, 13, 13, 13, 1753, 1055, 573, 29918, 12676, 29918, 14273, 355, 1934, 29898, 1372, 29892, 3407, 29918, 7224, 1125, 13, 1678, 9995, 13, 1678, 7357, 523, 11333, 5314, 310, 2099, 4559, 19525, 719, 491, 4256, 1218, 13, 1678, 975, 278, 10697, 322, 7573, 297, 1269, 5447, 29889, 13, 1678, 9995, 13, 1678, 396, 14402, 2498, 895, 445, 304, 2758, 11472, 7573, 29892, 451, 925, 11916, 29889, 13, 1678, 315, 353, 7442, 29889, 3298, 359, 3552, 1372, 29889, 1949, 29918, 18010, 29892, 7431, 29898, 5679, 29918, 7224, 4961, 13, 1678, 323, 353, 7442, 29889, 3298, 359, 29898, 1372, 29889, 1949, 29918, 18010, 29897, 13, 1678, 5447, 29918, 277, 414, 353, 518, 1372, 29889, 28737, 29898, 11294, 287, 29918, 27736, 29922, 11249, 29918, 842, 29897, 363, 4559, 29918, 842, 297, 3407, 29918, 7224, 29962, 13, 1678, 363, 903, 297, 3464, 29898, 1372, 29889, 1949, 29918, 28737, 1125, 13, 4706, 10697, 353, 518, 4622, 29898, 8336, 29918, 1524, 29897, 363, 5447, 29918, 1524, 297, 5447, 29918, 277, 414, 29962, 13, 4706, 10638, 353, 10697, 29961, 29900, 1822, 9653, 13, 4706, 363, 2943, 297, 10697, 29961, 29900, 1822, 18010, 7295, 13, 9651, 954, 29918, 27736, 353, 10697, 29961, 29900, 1822, 1949, 29918, 27736, 29898, 3177, 29897, 13, 9651, 565, 954, 29918, 27736, 1405, 29871, 29900, 29901, 13, 18884, 363, 432, 29892, 5447, 297, 26985, 29898, 28737, 1125, 13, 462, 1678, 315, 29961, 3177, 29892, 432, 29962, 4619, 10638, 334, 5447, 29889, 1949, 29918, 11294, 287, 29918, 27736, 29898, 3177, 29897, 13, 18884, 323, 29961, 3177, 29962, 4619, 10638, 13, 1678, 363, 2943, 297, 3464, 29898, 1372, 29889, 1949, 29918, 18010, 1125, 13, 4706, 565, 323, 29961, 3177, 29962, 1405, 29871, 29900, 29901, 13, 9651, 315, 29961, 3177, 29962, 847, 29922, 323, 29961, 3177, 29962, 13, 1678, 736, 315, 13, 13, 13, 1990, 4321, 6816, 273, 19617, 355, 1934, 29898, 348, 27958, 29889, 3057, 8259, 1125, 13, 1678, 9995, 13, 1678, 4321, 29879, 278, 15472, 20529, 29889, 12676, 29918, 14273, 355, 1934, 1158, 29889, 13, 1678, 9995, 13, 1678, 822, 11539, 29898, 1311, 29892, 18696, 29892, 3407, 29918, 7224, 1125, 13, 4706, 315, 29896, 353, 1055, 573, 29918, 12676, 29918, 14273, 355, 1934, 29898, 1372, 29892, 3407, 29918, 7224, 29897, 13, 4706, 315, 29906, 353, 18696, 4422, 29889, 12676, 29918, 14273, 355, 1934, 29898, 1372, 29892, 3407, 29918, 7224, 29897, 13, 4706, 315, 29941, 353, 18696, 29889, 12676, 29918, 14273, 355, 1934, 29898, 5679, 29918, 7224, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 29907, 29896, 29889, 12181, 29892, 315, 29906, 29889, 12181, 29897, 13, 4706, 1583, 29889, 9294, 5574, 29898, 9302, 29889, 497, 5358, 29898, 29907, 29896, 29892, 315, 29906, 876, 13, 4706, 1583, 29889, 9294, 5574, 29898, 9302, 29889, 497, 5358, 29898, 29907, 29896, 29892, 315, 29941, 876, 13, 4706, 736, 315, 29896, 13, 13, 1678, 822, 1243, 29918, 10184, 29918, 7323, 8250, 29918, 9812, 29918, 29885, 16783, 29898, 1311, 1125, 13, 4706, 18696, 353, 10887, 10080, 29889, 3601, 5987, 29898, 13, 9651, 4665, 29918, 2917, 332, 800, 11759, 13, 18884, 10887, 10080, 29889, 12310, 2785, 8614, 29898, 29947, 511, 13, 18884, 10887, 10080, 29889, 12310, 2785, 8614, 29898, 29947, 29897, 1402, 13, 9651, 20332, 29918, 5344, 29922, 8999, 29900, 29892, 29871, 29896, 1402, 518, 29896, 29892, 29871, 29900, 20526, 13, 9651, 27878, 2109, 362, 29918, 10492, 29922, 29941, 29892, 13, 9651, 4036, 29918, 26776, 29922, 29945, 29897, 13, 4706, 1583, 29889, 9294, 25120, 1008, 29898, 1372, 29889, 1949, 29918, 28737, 29892, 29871, 29896, 29897, 13, 4706, 1583, 29889, 27902, 29898, 1372, 29892, 518, 1372, 29889, 27736, 29898, 29900, 511, 18696, 29889, 27736, 29898, 29896, 29897, 2314, 13, 13, 1678, 822, 1243, 29918, 14369, 29918, 8336, 29898, 1311, 1125, 13, 4706, 18696, 353, 10887, 10080, 29889, 3601, 5987, 29898, 29953, 29892, 4036, 29918, 26776, 29922, 29896, 29897, 13, 4706, 317, 353, 518, 3881, 29898, 29941, 511, 3464, 29898, 29941, 29892, 29871, 29953, 4638, 13, 4706, 315, 353, 1583, 29889, 27902, 29898, 1372, 29892, 317, 29897, 13, 4706, 363, 432, 29892, 11916, 297, 26985, 29898, 29903, 1125, 13, 9651, 5447, 353, 2446, 29898, 1372, 29889, 28737, 29898, 11294, 287, 29918, 27736, 29922, 27736, 876, 13, 9651, 363, 318, 297, 5447, 29889, 18010, 7295, 13, 18884, 1583, 29889, 9294, 9843, 29898, 8336, 29889, 1949, 29918, 11294, 287, 29918, 27736, 29898, 29884, 511, 315, 29961, 29884, 29892, 432, 2314, 13, 13, 1678, 822, 1243, 29918, 14369, 29918, 8336, 29918, 3846, 29918, 27736, 29898, 1311, 1125, 13, 4706, 18696, 353, 10887, 10080, 29889, 3601, 5987, 29898, 29953, 29892, 4036, 29918, 26776, 29922, 29896, 29897, 13, 4706, 317, 353, 518, 3881, 29898, 29941, 511, 3464, 29898, 29941, 29892, 29871, 29946, 4638, 13, 4706, 315, 353, 1583, 29889, 27902, 29898, 1372, 29892, 317, 29897, 13, 4706, 363, 432, 29892, 11916, 297, 26985, 29898, 29903, 1125, 13, 9651, 5447, 353, 2446, 29898, 1372, 29889, 28737, 29898, 11294, 287, 29918, 27736, 29922, 27736, 876, 13, 9651, 363, 318, 297, 5447, 29889, 18010, 7295, 13, 18884, 1583, 29889, 9294, 9843, 29898, 8336, 29889, 1949, 29918, 11294, 287, 29918, 27736, 29898, 29884, 511, 315, 29961, 29884, 29892, 432, 2314, 13, 13, 1678, 822, 1243, 29918, 14369, 29918, 8336, 29918, 497, 29918, 11249, 29918, 7224, 29898, 1311, 1125, 13, 4706, 18696, 353, 10887, 10080, 29889, 3601, 5987, 29898, 29953, 29892, 4036, 29918, 26776, 29922, 29896, 29897, 13, 4706, 363, 317, 297, 731, 29918, 1595, 2187, 29898, 1761, 29898, 3881, 29898, 1372, 29889, 1949, 29918, 27736, 876, 1125, 13, 9651, 315, 353, 1583, 29889, 27902, 29898, 1372, 29892, 317, 29897, 13, 9651, 363, 432, 29892, 11916, 297, 26985, 29898, 29903, 1125, 13, 18884, 5447, 353, 2446, 29898, 1372, 29889, 28737, 29898, 11294, 287, 29918, 27736, 29922, 27736, 876, 13, 18884, 363, 318, 297, 5447, 29889, 18010, 7295, 13, 462, 1678, 1583, 29889, 9294, 9843, 29898, 8336, 29889, 1949, 29918, 11294, 287, 29918, 27736, 29898, 29884, 511, 315, 29961, 29884, 29892, 432, 2314, 13, 13, 1678, 822, 1243, 29918, 13011, 29918, 28737, 29918, 497, 29918, 11249, 29918, 7224, 29898, 1311, 1125, 13, 4706, 18696, 353, 10887, 10080, 29889, 3601, 5987, 29898, 29953, 29892, 27878, 2109, 362, 29918, 10492, 29922, 29906, 29892, 4036, 29918, 26776, 29922, 29896, 29897, 13, 4706, 1583, 29889, 9294, 25120, 1008, 29898, 1372, 29889, 1949, 29918, 28737, 29892, 29871, 29906, 29897, 13, 4706, 363, 317, 297, 731, 29918, 1595, 2187, 29898, 1761, 29898, 3881, 29898, 1372, 29889, 1949, 29918, 27736, 876, 1125, 13, 9651, 1583, 29889, 27902, 29898, 1372, 29892, 317, 29897, 13, 13, 1678, 822, 1243, 29918, 29893, 1266, 29918, 15161, 261, 29918, 348, 3601, 572, 2164, 29918, 497, 29918, 11249, 29918, 7224, 29898, 1311, 1125, 13, 4706, 6131, 353, 281, 29888, 29889, 29893, 29888, 29918, 3601, 29898, 13, 632, 29946, 29892, 29871, 29945, 29892, 16717, 29922, 29896, 29892, 6483, 29918, 18434, 29922, 8824, 29892, 2847, 29918, 4738, 362, 29918, 27736, 29922, 8824, 29892, 13, 9651, 954, 29918, 417, 455, 29922, 29896, 29900, 29897, 13, 4706, 6131, 29889, 6605, 580, 13, 4706, 18696, 353, 6131, 29889, 8336, 29918, 16506, 580, 13, 4706, 363, 317, 297, 731, 29918, 1595, 2187, 29898, 1761, 29898, 1372, 29889, 27736, 22130, 29901, 13, 9651, 1583, 29889, 27902, 29898, 1372, 29892, 317, 29897, 13, 13, 1678, 822, 1243, 29918, 29893, 1266, 29918, 15161, 261, 29918, 348, 3601, 572, 2164, 29898, 1311, 1125, 13, 4706, 6131, 353, 281, 29888, 29889, 29893, 29888, 29918, 3601, 29898, 13, 632, 29906, 29900, 29892, 29871, 29896, 29945, 29892, 16717, 29922, 29896, 29892, 6483, 29918, 18434, 29922, 8824, 29892, 2847, 29918, 4738, 362, 29918, 27736, 29922, 8824, 29892, 13, 9651, 954, 29918, 417, 455, 29922, 29906, 29900, 29897, 13, 4706, 6131, 29889, 6605, 580, 13, 4706, 18696, 353, 6131, 29889, 8336, 29918, 16506, 580, 13, 4706, 11916, 353, 18696, 29889, 27736, 580, 13, 4706, 1583, 29889, 27902, 29898, 1372, 29892, 518, 27736, 7503, 29896, 29900, 1402, 11916, 29961, 29896, 29900, 17531, 2314, 13, 13, 1678, 822, 1243, 29918, 29893, 1266, 29918, 15161, 261, 29918, 3601, 572, 2164, 29898, 1311, 1125, 13, 4706, 6131, 353, 281, 29888, 29889, 29893, 29888, 29918, 3601, 29898, 13, 632, 29941, 29900, 29892, 29871, 29896, 29900, 29892, 16717, 29922, 29896, 29892, 6483, 29918, 18434, 29922, 8824, 29892, 2847, 29918, 4738, 362, 29918, 27736, 29922, 8824, 29892, 13, 9651, 954, 29918, 417, 455, 29922, 29945, 29897, 13, 4706, 6131, 29889, 6605, 580, 13, 4706, 18696, 353, 6131, 29889, 8336, 29918, 16506, 580, 13, 4706, 11916, 353, 18696, 29889, 27736, 580, 13, 4706, 1583, 29889, 27902, 29898, 1372, 29892, 518, 27736, 7503, 29896, 29900, 1402, 11916, 29961, 29896, 29900, 17531, 2314, 13, 13, 13, 1753, 1055, 573, 29918, 29887, 1600, 27330, 936, 29918, 28502, 342, 29918, 484, 1141, 29890, 2470, 29898, 1372, 29892, 12789, 284, 29892, 3407, 29918, 7224, 1125, 13, 1678, 396, 8561, 1854, 4129, 338, 263, 4559, 577, 591, 508, 671, 278, 5702, 287, 29918, 27736, 2984, 29889, 13, 1678, 396, 910, 338, 263, 29485, 310, 278, 1857, 3450, 29889, 13, 1678, 6131, 353, 18696, 29889, 15070, 29918, 24051, 580, 13, 1678, 6131, 29889, 18010, 29889, 842, 29918, 13099, 29898, 13, 4706, 13449, 29922, 9302, 29889, 2873, 29918, 4561, 29898, 24051, 29889, 18010, 29889, 15764, 511, 13, 4706, 931, 29922, 24051, 29889, 18010, 29889, 2230, 29897, 13, 1678, 18696, 353, 6131, 29889, 8336, 29918, 16506, 580, 13, 13, 1678, 319, 353, 7442, 29889, 3298, 359, 3552, 2435, 29898, 29888, 18642, 511, 7431, 29898, 5679, 29918, 7224, 4961, 13, 1678, 365, 353, 7442, 29889, 3298, 359, 29898, 2435, 29898, 29888, 18642, 876, 13, 1678, 3407, 29918, 842, 29918, 1958, 353, 7442, 29889, 3298, 359, 29898, 1372, 29889, 1949, 29918, 18010, 29892, 26688, 29922, 524, 29897, 448, 29871, 29896, 13, 1678, 363, 413, 29892, 2143, 29918, 842, 297, 26985, 29898, 5679, 29918, 7224, 1125, 13, 4706, 363, 318, 297, 2143, 29918, 842, 29901, 13, 9651, 3407, 29918, 842, 29918, 1958, 29961, 29884, 29962, 353, 413, 13, 1678, 5447, 29918, 277, 414, 353, 518, 13, 4706, 18696, 29889, 28737, 29898, 11294, 287, 29918, 27736, 29922, 5679, 29918, 18010, 29897, 363, 3407, 29918, 18010, 297, 3407, 29918, 7224, 29962, 13, 1678, 363, 903, 297, 3464, 29898, 1372, 29889, 1949, 29918, 28737, 1125, 13, 4706, 10697, 353, 1051, 29898, 1958, 29898, 4622, 29892, 5447, 29918, 277, 414, 876, 13, 4706, 3309, 353, 10697, 29961, 29900, 1822, 19207, 29961, 29896, 29962, 448, 10697, 29961, 29900, 1822, 19207, 29961, 29900, 29962, 13, 4706, 363, 432, 29892, 318, 297, 26985, 29898, 29888, 18642, 1125, 13, 9651, 12789, 284, 29918, 3177, 29918, 842, 353, 3407, 29918, 842, 29918, 1958, 29961, 29884, 29962, 13, 9651, 396, 19471, 29898, 29884, 29897, 353, 29871, 29896, 565, 318, 4864, 297, 738, 310, 278, 3407, 6166, 29936, 29871, 29900, 6467, 13, 9651, 19471, 353, 938, 29898, 29888, 18642, 29918, 3177, 29918, 842, 2804, 448, 29896, 29897, 13, 9651, 325, 353, 318, 13, 9651, 1550, 325, 2804, 260, 808, 277, 29889, 10074, 29901, 13, 18884, 3001, 353, 2533, 29898, 8336, 29889, 1949, 29918, 11294, 287, 29918, 27736, 29898, 29894, 29897, 363, 5447, 297, 10697, 29897, 13, 18884, 565, 3001, 1405, 19471, 29901, 13, 462, 1678, 2867, 13, 18884, 325, 353, 10697, 29961, 29900, 1822, 3560, 29898, 29894, 29897, 13, 9651, 565, 325, 2804, 260, 808, 277, 29889, 10074, 29901, 13, 18884, 363, 413, 29892, 5447, 297, 26985, 29898, 28737, 1125, 13, 462, 1678, 396, 960, 278, 12789, 284, 2943, 338, 297, 278, 1857, 731, 29892, 591, 23197, 967, 13, 462, 1678, 396, 11896, 515, 278, 4825, 1061, 13, 462, 1678, 302, 353, 5447, 29889, 1949, 29918, 11294, 287, 29918, 27736, 29898, 29894, 29897, 448, 313, 29895, 1275, 12789, 284, 29918, 3177, 29918, 842, 29897, 13, 462, 1678, 396, 960, 278, 12789, 284, 2943, 338, 297, 334, 1384, 29930, 3407, 731, 29892, 591, 23197, 967, 13, 462, 1678, 396, 11896, 515, 278, 8033, 262, 1061, 29889, 13, 462, 1678, 319, 29961, 29926, 29892, 413, 29962, 4619, 3309, 334, 302, 847, 313, 7827, 448, 19471, 29897, 13, 18884, 365, 29961, 29926, 29962, 4619, 3309, 13, 1678, 396, 21981, 895, 491, 278, 18414, 7964, 995, 363, 1269, 12789, 284, 2943, 29889, 13, 1678, 2380, 353, 365, 1405, 29871, 29900, 13, 1678, 365, 353, 365, 29961, 2248, 29962, 13, 1678, 365, 353, 365, 29889, 690, 14443, 3552, 29931, 29889, 12181, 29961, 29900, 1402, 29871, 29896, 876, 13, 1678, 319, 29961, 2248, 29892, 584, 29962, 847, 29922, 365, 13, 1678, 736, 319, 13, 13, 13, 1990, 4321, 29954, 1600, 27330, 936, 29940, 799, 342, 8139, 1141, 29890, 2470, 29898, 348, 27958, 29889, 3057, 8259, 1125, 13, 1678, 9995, 13, 1678, 4321, 29879, 278, 15472, 20529, 29889, 29887, 1600, 27330, 936, 29918, 28502, 342, 29918, 484, 1141, 29890, 2470, 1158, 29889, 13, 1678, 9995, 13, 1678, 396, 13, 1678, 396, 965, 29947, 13, 1678, 396, 308, 847, 320, 13, 1678, 396, 4706, 847, 259, 320, 13, 1678, 396, 539, 847, 268, 320, 13, 1678, 396, 539, 29955, 539, 320, 13, 1678, 396, 268, 847, 320, 4706, 29953, 13, 1678, 396, 1678, 847, 1678, 29945, 268, 847, 320, 13, 1678, 396, 259, 847, 259, 847, 320, 259, 847, 259, 320, 13, 1678, 396, 259, 29946, 1678, 29900, 1678, 29896, 29871, 29906, 418, 29941, 13, 1678, 2319, 29918, 8336, 29918, 735, 29918, 18010, 353, 9995, 29905, 13, 1678, 1178, 418, 338, 29918, 11249, 259, 4665, 418, 931, 13, 268, 29900, 4706, 29896, 4706, 29900, 18884, 29900, 29889, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 13, 268, 29896, 4706, 29896, 4706, 29900, 18884, 29900, 29889, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 13, 268, 29906, 4706, 29896, 4706, 29900, 18884, 29900, 29889, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 13, 268, 29941, 4706, 29896, 4706, 29900, 18884, 29900, 29889, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 13, 268, 29946, 4706, 29896, 4706, 29900, 18884, 29900, 29889, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 13, 268, 29945, 4706, 29900, 4706, 29900, 18884, 29900, 29889, 29896, 29946, 29945, 29953, 29955, 29896, 29896, 29896, 29900, 29906, 29941, 29941, 29947, 29955, 13, 268, 29953, 4706, 29900, 4706, 29900, 18884, 29900, 29889, 29906, 29896, 29941, 29947, 29945, 29945, 29946, 29945, 29953, 29906, 29953, 29941, 29945, 29941, 13, 268, 29955, 4706, 29900, 4706, 29900, 18884, 29900, 29889, 29946, 29941, 29945, 29900, 29947, 29900, 29906, 29946, 29941, 29946, 29945, 29900, 29953, 29941, 13, 268, 29947, 4706, 29900, 4706, 29900, 18884, 29896, 29889, 29953, 29900, 29896, 29945, 29953, 29941, 29945, 29906, 29929, 29955, 29896, 29906, 29900, 29941, 13, 1678, 9995, 13, 1678, 2319, 29918, 8336, 29918, 735, 29918, 287, 2710, 353, 9995, 29905, 13, 1678, 1178, 418, 2175, 9651, 1492, 965, 3847, 29871, 2278, 13, 268, 29900, 4706, 29900, 29889, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 539, 29896, 29889, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 539, 29945, 4706, 29900, 29892, 29896, 13, 268, 29896, 4706, 29900, 29889, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 539, 29896, 29889, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 539, 29953, 4706, 29906, 29892, 29941, 13, 268, 29906, 4706, 29900, 29889, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 539, 29896, 29889, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 539, 29955, 4706, 29946, 29892, 29945, 13, 268, 29941, 4706, 29900, 29889, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 539, 29896, 29889, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 539, 29947, 4706, 29953, 29892, 29955, 13, 1678, 9995, 13, 13, 1678, 822, 11539, 29898, 1311, 29892, 18696, 29892, 3407, 29918, 7224, 29892, 12789, 284, 29922, 8516, 1125, 13, 4706, 565, 12789, 284, 338, 6213, 29901, 13, 9651, 12789, 284, 353, 518, 29884, 363, 2143, 842, 297, 3407, 29918, 7224, 363, 318, 297, 2143, 842, 29962, 13, 4706, 319, 29896, 353, 1055, 573, 29918, 29887, 1600, 27330, 936, 29918, 28502, 342, 29918, 484, 1141, 29890, 2470, 29898, 1372, 29892, 12789, 284, 29892, 3407, 29918, 7224, 29897, 13, 4706, 319, 29906, 353, 18696, 4422, 29889, 29887, 1600, 27330, 936, 29918, 28502, 342, 29918, 484, 1141, 29890, 2470, 29898, 1372, 29892, 12789, 284, 29892, 3407, 29918, 7224, 29897, 13, 4706, 319, 29941, 353, 18696, 29889, 29887, 1600, 27330, 936, 29918, 28502, 342, 29918, 484, 1141, 29890, 2470, 29898, 29888, 18642, 29892, 3407, 29918, 7224, 29897, 13, 4706, 319, 29946, 353, 18696, 29889, 29887, 1600, 27330, 936, 29918, 28502, 342, 29918, 484, 1141, 29890, 2470, 29898, 29888, 18642, 29892, 3407, 29918, 7224, 29892, 954, 29918, 28993, 29922, 29941, 29897, 13, 4706, 1583, 29889, 9294, 5574, 29898, 9302, 29889, 2378, 29918, 11745, 29898, 29909, 29941, 29892, 319, 29946, 876, 13, 4706, 1583, 29889, 9294, 9843, 29898, 29909, 29896, 29889, 12181, 29892, 319, 29906, 29889, 12181, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 29909, 29896, 29889, 12181, 29892, 319, 29941, 29889, 12181, 29897, 13, 4706, 1583, 29889, 9294, 5574, 29898, 9302, 29889, 497, 5358, 29898, 29909, 29896, 29892, 319, 29906, 876, 13, 4706, 1583, 29889, 9294, 5574, 29898, 9302, 29889, 497, 5358, 29898, 29909, 29896, 29892, 319, 29941, 876, 13, 4706, 565, 18696, 29889, 1949, 29918, 287, 2710, 1405, 29871, 29900, 322, 599, 29898, 1372, 29889, 3177, 29898, 29884, 467, 275, 29918, 11249, 580, 363, 318, 297, 12789, 284, 1125, 13, 9651, 396, 1932, 278, 12789, 284, 7573, 526, 11916, 29892, 591, 508, 4974, 777, 23505, 4426, 29889, 13, 9651, 1583, 29889, 9294, 5574, 29898, 9302, 29889, 497, 5358, 29898, 9302, 29889, 2083, 29898, 29909, 29896, 29892, 9685, 29922, 29896, 511, 29871, 29896, 876, 13, 4706, 736, 319, 29896, 13, 13, 1678, 822, 1243, 29918, 12857, 29918, 4773, 29918, 497, 29918, 27736, 29898, 1311, 1125, 13, 4706, 18696, 353, 260, 808, 277, 29889, 1359, 29918, 726, 29898, 13, 9651, 7573, 29922, 601, 29889, 1231, 5971, 29898, 1311, 29889, 9278, 29918, 8336, 29918, 735, 29918, 18010, 511, 13, 9651, 12770, 29922, 601, 29889, 1231, 5971, 29898, 1311, 29889, 9278, 29918, 8336, 29918, 735, 29918, 287, 2710, 511, 9406, 29922, 8824, 29897, 13, 4706, 319, 353, 1583, 29889, 27902, 29898, 1372, 29892, 5519, 29900, 29892, 29871, 29896, 1402, 518, 29906, 29892, 29871, 29941, 29892, 29871, 29946, 20526, 518, 29900, 2314, 13, 4706, 1583, 29889, 9294, 9843, 29898, 1761, 29898, 29909, 29961, 29900, 11724, 518, 29896, 29892, 29871, 29900, 2314, 13, 4706, 319, 353, 1583, 29889, 27902, 29898, 1372, 29892, 5519, 29900, 29892, 29871, 29896, 1402, 518, 29906, 29892, 29871, 29941, 29892, 29871, 29946, 20526, 518, 29946, 2314, 13, 4706, 1583, 29889, 9294, 9843, 29898, 1761, 29898, 29909, 29961, 29900, 11724, 518, 29896, 29892, 29871, 29900, 2314, 13, 4706, 319, 353, 1583, 29889, 27902, 29898, 1372, 29892, 5519, 29900, 29892, 29871, 29896, 1402, 518, 29906, 29892, 29871, 29941, 29892, 29871, 29946, 20526, 518, 29906, 2314, 13, 4706, 1583, 29889, 9294, 9843, 29898, 1761, 29898, 29909, 29961, 29900, 11724, 518, 29900, 29892, 29871, 29896, 2314, 13, 4706, 319, 353, 1583, 29889, 27902, 29898, 1372, 29892, 5519, 29900, 29892, 29871, 29906, 1402, 518, 29896, 29892, 29871, 29941, 29892, 29871, 29946, 20526, 518, 29900, 2314, 13, 4706, 1583, 29889, 9294, 9843, 29898, 1761, 29898, 29909, 29961, 29900, 11724, 518, 29900, 29892, 29871, 29896, 2314, 13, 4706, 319, 353, 1583, 29889, 27902, 29898, 1372, 29892, 5519, 29900, 29892, 29871, 29906, 1402, 518, 29896, 29892, 29871, 29941, 29892, 29871, 29946, 20526, 518, 29946, 2314, 13, 4706, 1583, 29889, 9294, 9843, 29898, 1761, 29898, 29909, 29961, 29900, 11724, 518, 29900, 29889, 29945, 29892, 29871, 29900, 29889, 29945, 2314, 13, 13, 1678, 822, 1243, 29918, 12857, 29918, 4773, 29918, 27259, 29918, 27736, 29898, 1311, 1125, 13, 4706, 18696, 353, 260, 808, 277, 29889, 1359, 29918, 726, 29898, 13, 9651, 7573, 29922, 601, 29889, 1231, 5971, 29898, 1311, 29889, 9278, 29918, 8336, 29918, 735, 29918, 18010, 511, 13, 9651, 12770, 29922, 601, 29889, 1231, 5971, 29898, 1311, 29889, 9278, 29918, 8336, 29918, 735, 29918, 287, 2710, 511, 9406, 29922, 8824, 29897, 13, 4706, 319, 353, 1583, 29889, 27902, 29898, 1372, 29892, 5519, 29900, 29892, 29871, 29896, 1402, 518, 29906, 29892, 29871, 29946, 20526, 518, 29941, 2314, 13, 4706, 1583, 29889, 9294, 9843, 29898, 1761, 29898, 29909, 29961, 29900, 11724, 518, 29900, 29892, 29871, 29896, 2314, 13, 4706, 319, 353, 1583, 29889, 27902, 29898, 1372, 29892, 5519, 29900, 29892, 29871, 29896, 1402, 518, 29906, 29892, 29871, 29946, 20526, 518, 29906, 2314, 13, 4706, 1583, 29889, 9294, 5574, 29898, 9302, 29889, 497, 5358, 29898, 29909, 29961, 29900, 1402, 518, 29906, 847, 29871, 29941, 29892, 29871, 29896, 847, 29871, 29941, 12622, 13, 13, 1678, 822, 1243, 29918, 12857, 29918, 4773, 29918, 7564, 29918, 29888, 18642, 29918, 3177, 29898, 1311, 1125, 13, 4706, 18696, 353, 260, 808, 277, 29889, 1359, 29918, 726, 29898, 13, 9651, 7573, 29922, 601, 29889, 1231, 5971, 29898, 1311, 29889, 9278, 29918, 8336, 29918, 735, 29918, 18010, 511, 13, 9651, 12770, 29922, 601, 29889, 1231, 5971, 29898, 1311, 29889, 9278, 29918, 8336, 29918, 735, 29918, 287, 2710, 511, 9406, 29922, 8824, 29897, 13, 4706, 12789, 284, 353, 518, 29955, 29962, 29871, 396, 530, 7463, 2943, 13, 4706, 3407, 29918, 7224, 353, 5519, 29946, 29892, 29871, 29900, 29892, 29871, 29896, 1402, 518, 29906, 29892, 29871, 29941, 5262, 13, 4706, 402, 10262, 353, 1055, 573, 29918, 29887, 1600, 27330, 936, 29918, 28502, 342, 29918, 484, 1141, 29890, 2470, 29898, 1372, 29892, 12789, 284, 29892, 3407, 29918, 7224, 29897, 13, 4706, 1583, 29889, 9294, 5574, 29898, 9302, 29889, 497, 5358, 29898, 29954, 10262, 29961, 29900, 1402, 7442, 29889, 2378, 4197, 29896, 29889, 29900, 29892, 29871, 29900, 29889, 29900, 29962, 4961, 13, 4706, 402, 10262, 353, 18696, 4422, 29889, 29887, 1600, 27330, 936, 29918, 28502, 342, 29918, 484, 1141, 29890, 2470, 29898, 1372, 29892, 12789, 284, 29892, 3407, 29918, 7224, 29897, 13, 4706, 1583, 29889, 9294, 5574, 29898, 9302, 29889, 497, 5358, 29898, 29954, 10262, 29961, 29900, 1402, 7442, 29889, 2378, 4197, 29896, 29889, 29900, 29892, 29871, 29900, 29889, 29900, 29962, 4961, 13, 4706, 402, 10262, 353, 18696, 29889, 29887, 1600, 27330, 936, 29918, 28502, 342, 29918, 484, 1141, 29890, 2470, 29898, 29888, 18642, 29892, 3407, 29918, 7224, 29897, 13, 4706, 1583, 29889, 9294, 5574, 29898, 9302, 29889, 497, 5358, 29898, 29954, 10262, 29961, 29900, 1402, 7442, 29889, 2378, 4197, 29896, 29889, 29900, 29892, 29871, 29900, 29889, 29900, 29962, 4961, 13, 4706, 12789, 284, 353, 518, 29947, 29962, 29871, 396, 450, 3876, 13, 4706, 402, 10262, 353, 1055, 573, 29918, 29887, 1600, 27330, 936, 29918, 28502, 342, 29918, 484, 1141, 29890, 2470, 29898, 1372, 29892, 12789, 284, 29892, 3407, 29918, 7224, 29897, 13, 4706, 1583, 29889, 9294, 5574, 29898, 9302, 29889, 497, 5358, 29898, 29954, 10262, 29961, 29900, 1402, 7442, 29889, 2378, 4197, 29900, 29889, 29953, 29892, 29871, 29900, 29889, 29946, 29962, 4961, 13, 4706, 402, 10262, 353, 18696, 4422, 29889, 29887, 1600, 27330, 936, 29918, 28502, 342, 29918, 484, 1141, 29890, 2470, 29898, 1372, 29892, 12789, 284, 29892, 3407, 29918, 7224, 29897, 13, 4706, 1583, 29889, 9294, 5574, 29898, 9302, 29889, 497, 5358, 29898, 29954, 10262, 29961, 29900, 1402, 7442, 29889, 2378, 4197, 29900, 29889, 29953, 29892, 29871, 29900, 29889, 29946, 29962, 4961, 13, 4706, 402, 10262, 353, 18696, 29889, 29887, 1600, 27330, 936, 29918, 28502, 342, 29918, 484, 1141, 29890, 2470, 29898, 29888, 18642, 29892, 3407, 29918, 7224, 29897, 13, 4706, 1583, 29889, 9294, 5574, 29898, 9302, 29889, 497, 5358, 29898, 29954, 10262, 29961, 29900, 1402, 7442, 29889, 2378, 4197, 29900, 29889, 29953, 29892, 29871, 29900, 29889, 29946, 29962, 4961, 13, 13, 1678, 822, 1243, 29918, 10184, 29918, 7323, 8250, 29918, 9812, 29918, 29885, 16783, 29898, 1311, 1125, 13, 4706, 18696, 353, 10887, 10080, 29889, 3601, 5987, 29898, 13, 9651, 4665, 29918, 2917, 332, 800, 11759, 13, 18884, 10887, 10080, 29889, 12310, 2785, 8614, 29898, 29896, 29947, 511, 13, 18884, 10887, 10080, 29889, 12310, 2785, 8614, 29898, 29896, 29947, 29897, 1402, 13, 9651, 20332, 29918, 5344, 29922, 8999, 29900, 29892, 29871, 29896, 1402, 518, 29896, 29892, 29871, 29900, 20526, 13, 9651, 27878, 2109, 362, 29918, 10492, 29922, 29947, 29892, 13, 9651, 4036, 29918, 26776, 29922, 29945, 29897, 13, 4706, 1583, 29889, 9294, 25120, 1008, 29898, 1372, 29889, 1949, 29918, 28737, 29892, 29871, 29896, 29897, 13, 4706, 1583, 29889, 27902, 29898, 1372, 29892, 518, 1372, 29889, 27736, 29898, 29900, 511, 18696, 29889, 27736, 29898, 29896, 29897, 2314, 13, 13, 1678, 822, 1243, 29918, 14369, 29918, 8336, 29898, 1311, 1125, 13, 4706, 18696, 353, 10887, 10080, 29889, 3601, 5987, 29898, 29953, 29892, 4036, 29918, 26776, 29922, 29896, 29897, 13, 4706, 317, 353, 518, 3881, 29898, 29941, 511, 3464, 29898, 29941, 29892, 29871, 29953, 4638, 13, 4706, 1583, 29889, 27902, 29898, 1372, 29892, 317, 29897, 13, 13, 1678, 822, 1243, 29918, 14369, 29918, 8336, 29918, 7564, 29918, 5679, 29918, 7224, 29898, 1311, 1125, 13, 4706, 18696, 353, 10887, 10080, 29889, 3601, 5987, 29898, 29896, 29900, 29892, 4036, 29918, 26776, 29922, 29896, 29897, 13, 4706, 5447, 353, 18696, 29889, 4102, 580, 13, 4706, 317, 353, 5519, 29884, 29962, 363, 318, 297, 5447, 29889, 11991, 29898, 8336, 29889, 4632, 4638, 13, 4706, 1583, 29889, 27902, 29898, 1372, 29892, 317, 29892, 18696, 29889, 27736, 3101, 13, 13, 1678, 822, 1243, 29918, 14369, 29918, 8336, 29918, 497, 29918, 18010, 29898, 1311, 1125, 13, 4706, 18696, 353, 10887, 10080, 29889, 3601, 5987, 29898, 29896, 29900, 29892, 4036, 29918, 26776, 29922, 29896, 29897, 13, 4706, 317, 353, 518, 9302, 29889, 279, 927, 29898, 1372, 29889, 1949, 29918, 18010, 29892, 26688, 29922, 9302, 29889, 524, 29941, 29906, 4638, 13, 4706, 1583, 29889, 27902, 29898, 1372, 29892, 317, 29892, 7442, 29889, 279, 927, 29898, 1372, 29889, 1949, 29918, 18010, 29892, 26688, 29922, 9302, 29889, 524, 29941, 29906, 876, 13, 13, 1678, 822, 1243, 29918, 14369, 29918, 8336, 29918, 3846, 29918, 27736, 29898, 1311, 1125, 13, 4706, 18696, 353, 10887, 10080, 29889, 3601, 5987, 29898, 29953, 29892, 4036, 29918, 26776, 29922, 29896, 29897, 13, 4706, 317, 353, 518, 3881, 29898, 29941, 511, 3464, 29898, 29941, 29892, 29871, 29946, 4638, 13, 4706, 1583, 29889, 27902, 29898, 1372, 29892, 317, 29897, 13, 13, 1678, 822, 1243, 29918, 14369, 29918, 8336, 29918, 497, 29918, 11249, 29918, 7224, 29898, 1311, 1125, 13, 4706, 18696, 353, 10887, 10080, 29889, 3601, 5987, 29898, 29953, 29892, 4036, 29918, 26776, 29922, 29896, 29897, 13, 4706, 363, 317, 297, 731, 29918, 1595, 2187, 29898, 1761, 29898, 3881, 29898, 1372, 29889, 1949, 29918, 27736, 876, 1125, 13, 9651, 1583, 29889, 27902, 29898, 1372, 29892, 317, 29897, 13, 13, 1678, 822, 1243, 29918, 13011, 29918, 28737, 29918, 497, 29918, 11249, 29918, 7224, 29898, 1311, 1125, 13, 4706, 18696, 353, 10887, 10080, 29889, 3601, 5987, 29898, 29953, 29892, 27878, 2109, 362, 29918, 10492, 29922, 29906, 29892, 4036, 29918, 26776, 29922, 29896, 29897, 13, 4706, 1583, 29889, 9294, 25120, 1008, 29898, 1372, 29889, 1949, 29918, 28737, 29892, 29871, 29906, 29897, 13, 4706, 363, 317, 297, 731, 29918, 1595, 2187, 29898, 1761, 29898, 3881, 29898, 1372, 29889, 1949, 29918, 27736, 876, 1125, 13, 9651, 1583, 29889, 27902, 29898, 1372, 29892, 317, 29897, 13, 13, 1678, 822, 1243, 29918, 13011, 29918, 28737, 29918, 16506, 29918, 2848, 29898, 1311, 1125, 13, 4706, 363, 365, 297, 518, 29900, 29889, 29945, 29892, 29871, 29896, 29889, 29945, 29892, 29871, 29941, 29889, 29941, 29941, 29941, 29941, 5387, 13, 9651, 18696, 353, 10887, 10080, 29889, 3601, 5987, 29898, 29953, 29892, 3309, 29922, 29931, 29892, 27878, 2109, 362, 29918, 10492, 29922, 29906, 29892, 4036, 29918, 26776, 29922, 29896, 29897, 13, 9651, 1583, 29889, 27902, 29898, 1372, 29892, 518, 3881, 29898, 29941, 511, 3464, 29898, 29941, 29892, 29871, 29953, 29897, 2314, 13, 13, 1678, 822, 1243, 29918, 13011, 29918, 28737, 29918, 497, 29918, 18010, 29898, 1311, 1125, 13, 4706, 18696, 353, 10887, 10080, 29889, 3601, 5987, 29898, 29953, 29892, 3309, 29922, 29946, 29892, 27878, 2109, 362, 29918, 10492, 29922, 29906, 29892, 4036, 29918, 26776, 29922, 29896, 29897, 13, 4706, 317, 353, 518, 9302, 29889, 279, 927, 29898, 1372, 29889, 1949, 29918, 18010, 29892, 26688, 29922, 9302, 29889, 524, 29941, 29906, 4638, 13, 4706, 1583, 29889, 27902, 29898, 1372, 29892, 317, 29892, 7442, 29889, 279, 927, 29898, 1372, 29889, 1949, 29918, 18010, 29892, 26688, 29922, 9302, 29889, 524, 29941, 29906, 876, 13, 13, 1678, 822, 1243, 29918, 29893, 1266, 29918, 15161, 261, 29918, 348, 3601, 572, 2164, 29918, 497, 29918, 11249, 29918, 7224, 29898, 1311, 1125, 13, 4706, 6131, 353, 281, 29888, 29889, 29893, 29888, 29918, 3601, 29898, 13, 632, 29946, 29892, 29871, 29945, 29892, 16717, 29922, 29896, 29892, 6483, 29918, 18434, 29922, 5574, 29892, 2847, 29918, 4738, 362, 29918, 27736, 29922, 8824, 29892, 13, 9651, 954, 29918, 417, 455, 29922, 29896, 29900, 29897, 13, 4706, 6131, 29889, 6605, 580, 13, 4706, 18696, 353, 6131, 29889, 8336, 29918, 16506, 580, 13, 4706, 363, 317, 297, 731, 29918, 1595, 2187, 29898, 1761, 29898, 1372, 29889, 27736, 22130, 29901, 13, 9651, 1583, 29889, 27902, 29898, 1372, 29892, 317, 29897, 13, 13, 1678, 822, 1243, 29918, 29893, 1266, 29918, 15161, 261, 29918, 348, 3601, 572, 2164, 29898, 1311, 1125, 13, 4706, 6131, 353, 281, 29888, 29889, 29893, 29888, 29918, 3601, 29898, 13, 632, 29906, 29900, 29892, 29871, 29896, 29945, 29892, 16717, 29922, 29896, 29892, 6483, 29918, 18434, 29922, 5574, 29892, 2847, 29918, 4738, 362, 29918, 27736, 29922, 8824, 29892, 13, 9651, 954, 29918, 417, 455, 29922, 29906, 29900, 29897, 13, 4706, 6131, 29889, 6605, 580, 13, 4706, 18696, 353, 6131, 29889, 8336, 29918, 16506, 580, 13, 4706, 11916, 353, 18696, 29889, 27736, 580, 13, 4706, 1583, 29889, 27902, 29898, 1372, 29892, 518, 27736, 7503, 29896, 29900, 1402, 11916, 29961, 29896, 29900, 17531, 2314, 13, 13, 1678, 822, 1243, 29918, 29893, 1266, 29918, 15161, 261, 29918, 11228, 29918, 4738, 362, 29898, 1311, 1125, 13, 4706, 6131, 353, 281, 29888, 29889, 29893, 29888, 29918, 3601, 29898, 13, 632, 29906, 29900, 29892, 29871, 29896, 29945, 29892, 16717, 29922, 29896, 29892, 6483, 29918, 18434, 29922, 5574, 29892, 2847, 29918, 4738, 362, 29918, 27736, 29922, 5574, 29892, 13, 9651, 954, 29918, 417, 455, 29922, 29906, 29900, 29897, 13, 4706, 6131, 29889, 6605, 580, 13, 4706, 6131, 29889, 3601, 572, 1598, 580, 13, 4706, 18696, 353, 6131, 29889, 8336, 29918, 16506, 580, 13, 4706, 11916, 353, 18696, 29889, 27736, 580, 13, 4706, 1476, 414, 353, 518, 29884, 363, 318, 297, 11916, 565, 18696, 29889, 3177, 29898, 29884, 467, 2230, 1405, 29871, 29900, 29962, 13, 4706, 11916, 353, 518, 29884, 363, 318, 297, 11916, 565, 18696, 29889, 3177, 29898, 29884, 467, 2230, 1275, 29871, 29900, 29962, 13, 4706, 1583, 29889, 27902, 29898, 1372, 29892, 518, 11940, 414, 7503, 29896, 29900, 1402, 1476, 414, 29961, 29896, 29900, 17531, 1402, 11916, 29897, 13, 13, 1678, 822, 1243, 29918, 29893, 1266, 29918, 15161, 261, 29918, 11228, 29918, 4738, 362, 29918, 1217, 29918, 24535, 29918, 18434, 29898, 1311, 1125, 13, 4706, 6131, 353, 281, 29888, 29889, 29893, 29888, 29918, 3601, 29898, 13, 632, 29906, 29900, 29892, 29871, 29896, 29945, 29892, 16717, 29922, 29906, 29892, 6483, 29918, 18434, 29922, 8824, 29892, 2847, 29918, 4738, 362, 29918, 27736, 29922, 5574, 29892, 13, 9651, 954, 29918, 417, 455, 29922, 29906, 29900, 29897, 13, 4706, 6131, 29889, 6605, 580, 13, 4706, 6131, 29889, 3601, 572, 1598, 580, 13, 4706, 18696, 353, 6131, 29889, 8336, 29918, 16506, 580, 13, 4706, 11916, 353, 18696, 29889, 27736, 580, 13, 4706, 1476, 414, 353, 518, 29884, 363, 318, 297, 11916, 565, 18696, 29889, 3177, 29898, 29884, 467, 2230, 1405, 29871, 29900, 29962, 13, 4706, 11916, 353, 518, 29884, 363, 318, 297, 11916, 565, 18696, 29889, 3177, 29898, 29884, 467, 2230, 1275, 29871, 29900, 29962, 13, 4706, 1583, 29889, 27902, 29898, 1372, 29892, 518, 11940, 414, 7503, 29896, 29900, 1402, 1476, 414, 29961, 29896, 29900, 17531, 1402, 11916, 29897, 13, 13, 1678, 822, 1243, 29918, 29893, 1266, 29918, 15161, 261, 29918, 348, 3601, 572, 2164, 29918, 20787, 29918, 307, 1862, 29898, 1311, 1125, 13, 4706, 6131, 353, 281, 29888, 29889, 29893, 29888, 29918, 3601, 29898, 13, 632, 29906, 29900, 29892, 29871, 29896, 29945, 29892, 16717, 29922, 29896, 29892, 6483, 29918, 18434, 29922, 8824, 29892, 2847, 29918, 4738, 362, 29918, 27736, 29922, 8824, 29892, 13, 9651, 954, 29918, 417, 455, 29922, 29906, 29900, 29897, 13, 4706, 6131, 29889, 6605, 580, 13, 4706, 18696, 353, 6131, 29889, 8336, 29918, 16506, 580, 13, 4706, 11916, 353, 18696, 29889, 27736, 580, 13, 4706, 1583, 29889, 27902, 29898, 1372, 29892, 518, 27736, 7503, 29896, 29900, 1402, 11916, 29961, 29896, 29900, 17531, 2314, 13, 13, 1678, 822, 1243, 29918, 29893, 1266, 29918, 15161, 261, 29918, 3601, 572, 2164, 29898, 1311, 1125, 13, 4706, 6131, 353, 281, 29888, 29889, 29893, 29888, 29918, 3601, 29898, 13, 632, 29941, 29896, 29892, 29871, 29896, 29900, 29892, 16717, 29922, 29896, 29892, 6483, 29918, 18434, 29922, 5574, 29892, 2847, 29918, 4738, 362, 29918, 27736, 29922, 8824, 29892, 13, 9651, 954, 29918, 417, 455, 29922, 29945, 29897, 13, 4706, 6131, 29889, 6605, 580, 13, 4706, 18696, 353, 6131, 29889, 8336, 29918, 16506, 2141, 3601, 572, 1598, 580, 13, 4706, 11916, 353, 18696, 29889, 27736, 580, 13, 4706, 1583, 29889, 27902, 29898, 1372, 29892, 518, 27736, 7503, 29896, 29900, 1402, 11916, 29961, 29896, 29900, 17531, 2314, 13, 13, 1678, 822, 1243, 29918, 29893, 1266, 29918, 15161, 261, 29918, 3601, 572, 2164, 29918, 20787, 29918, 307, 1862, 29898, 1311, 1125, 13, 4706, 6131, 353, 281, 29888, 29889, 29893, 29888, 29918, 3601, 29898, 13, 632, 29941, 29896, 29892, 29871, 29896, 29900, 29892, 16717, 29922, 29896, 29892, 6483, 29918, 18434, 29922, 8824, 29892, 2847, 29918, 4738, 362, 29918, 27736, 29922, 8824, 29892, 13, 9651, 954, 29918, 417, 455, 29922, 29945, 29897, 13, 4706, 6131, 29889, 6605, 580, 13, 4706, 18696, 353, 6131, 29889, 8336, 29918, 16506, 580, 13, 4706, 11916, 353, 18696, 29889, 27736, 580, 13, 4706, 1583, 29889, 27902, 29898, 1372, 29892, 518, 27736, 7503, 29896, 29900, 1402, 11916, 29961, 29896, 29900, 17531, 2314, 13, 13, 1678, 822, 1243, 29918, 6310, 29918, 1372, 29898, 1311, 1125, 13, 4706, 6131, 353, 260, 808, 277, 29889, 3562, 7196, 29898, 29896, 29889, 29900, 29897, 13, 4706, 6131, 29889, 18010, 29889, 1202, 29918, 798, 29898, 29896, 29892, 29871, 29900, 29897, 13, 4706, 6131, 29889, 18010, 29889, 1202, 29918, 798, 29898, 29896, 29892, 29871, 29900, 29897, 13, 4706, 18696, 353, 6131, 29889, 8336, 29918, 16506, 580, 13, 4706, 1583, 29889, 27902, 29898, 1372, 29892, 5519, 29900, 1402, 518, 29896, 24960, 13, 13, 13, 1753, 2684, 29918, 29887, 1600, 27330, 936, 29918, 28502, 342, 29918, 484, 1141, 29890, 2470, 29898, 1372, 29892, 12789, 284, 29892, 3407, 29918, 7224, 1125, 13, 1678, 396, 19491, 408, 2038, 29892, 5174, 591, 736, 278, 639, 29899, 8336, 995, 363, 263, 2323, 2943, 29889, 13, 13, 1678, 396, 8561, 1854, 1432, 2790, 338, 263, 4559, 577, 591, 508, 671, 278, 5702, 287, 29918, 27736, 2984, 29889, 13, 1678, 396, 910, 338, 263, 29485, 310, 278, 1857, 3450, 29889, 13, 1678, 6131, 353, 18696, 29889, 15070, 29918, 24051, 580, 13, 1678, 6131, 29889, 18010, 29889, 842, 29918, 13099, 29898, 13, 4706, 13449, 29922, 9302, 29889, 2873, 29918, 4561, 29898, 24051, 29889, 18010, 29889, 15764, 511, 13, 4706, 931, 29922, 24051, 29889, 18010, 29889, 2230, 29897, 13, 1678, 18696, 353, 6131, 29889, 8336, 29918, 16506, 580, 13, 13, 1678, 319, 353, 7442, 29889, 3298, 359, 3552, 2435, 29898, 5679, 29918, 7224, 511, 18696, 29889, 1949, 29918, 28737, 876, 13, 1678, 365, 353, 7442, 29889, 3298, 359, 29898, 1372, 29889, 1949, 29918, 28737, 29897, 13, 1678, 3407, 29918, 842, 29918, 1958, 353, 7442, 29889, 3298, 359, 29898, 1372, 29889, 1949, 29918, 18010, 29892, 26688, 29922, 524, 29897, 448, 29871, 29896, 13, 1678, 363, 413, 29892, 2143, 29918, 842, 297, 26985, 29898, 5679, 29918, 7224, 1125, 13, 4706, 363, 318, 297, 2143, 29918, 842, 29901, 13, 9651, 3407, 29918, 842, 29918, 1958, 29961, 29884, 29962, 353, 413, 13, 1678, 5447, 29918, 277, 414, 353, 518, 13, 4706, 18696, 29889, 28737, 29898, 11294, 287, 29918, 27736, 29922, 5679, 29918, 18010, 29897, 363, 3407, 29918, 18010, 297, 3407, 29918, 7224, 29962, 13, 1678, 318, 353, 12789, 284, 13, 1678, 12789, 284, 29918, 3177, 29918, 842, 353, 3407, 29918, 842, 29918, 1958, 29961, 29884, 29962, 13, 1678, 396, 19471, 29898, 29884, 29897, 353, 29871, 29896, 565, 318, 4864, 297, 738, 310, 278, 3407, 6166, 29936, 29871, 29900, 6467, 13, 1678, 19471, 353, 938, 29898, 29888, 18642, 29918, 3177, 29918, 842, 2804, 448, 29896, 29897, 13, 1678, 363, 903, 297, 3464, 29898, 1372, 29889, 1949, 29918, 28737, 1125, 13, 4706, 10697, 353, 1051, 29898, 1958, 29898, 4622, 29892, 5447, 29918, 277, 414, 876, 13, 4706, 325, 353, 10697, 29961, 29900, 1822, 3560, 29898, 29884, 29897, 13, 4706, 1550, 325, 2804, 260, 808, 277, 29889, 10074, 29901, 13, 9651, 3001, 353, 2533, 29898, 8336, 29889, 1949, 29918, 11294, 287, 29918, 27736, 29898, 29894, 29897, 363, 5447, 297, 10697, 29897, 13, 9651, 565, 3001, 1405, 19471, 29901, 13, 18884, 2867, 13, 9651, 325, 353, 10697, 29961, 29900, 1822, 3560, 29898, 29894, 29897, 13, 4706, 565, 325, 2804, 260, 808, 277, 29889, 10074, 29901, 13, 9651, 396, 450, 3309, 338, 871, 8967, 988, 278, 1002, 4695, 338, 3342, 29889, 13, 9651, 365, 29961, 28737, 29961, 29900, 1822, 2248, 29962, 353, 10697, 29961, 29900, 1822, 19207, 29961, 29896, 29962, 448, 10697, 29961, 29900, 1822, 19207, 29961, 29900, 29962, 13, 9651, 363, 413, 29892, 5447, 297, 26985, 29898, 28737, 1125, 13, 18884, 396, 960, 278, 12789, 284, 2943, 338, 297, 278, 1857, 731, 29892, 591, 23197, 967, 13, 18884, 396, 11896, 515, 278, 4825, 1061, 13, 18884, 302, 353, 5447, 29889, 1949, 29918, 11294, 287, 29918, 27736, 29898, 29894, 29897, 448, 313, 29895, 1275, 12789, 284, 29918, 3177, 29918, 842, 29897, 13, 18884, 396, 960, 278, 12789, 284, 2943, 338, 297, 334, 1384, 29930, 3407, 731, 29892, 591, 23197, 967, 13, 18884, 396, 11896, 515, 278, 8033, 262, 1061, 29889, 13, 18884, 319, 29961, 29895, 29892, 5447, 29889, 2248, 29962, 353, 302, 847, 313, 7827, 448, 19471, 29897, 13, 1678, 736, 319, 29892, 365, 13, 13, 13, 1753, 1887, 29918, 5138, 29876, 29898, 1372, 29892, 12789, 284, 29892, 3407, 29918, 7224, 1125, 13, 1678, 396, 6789, 1971, 653, 5314, 310, 278, 2578, 809, 895, 402, 10262, 29889, 13, 1678, 3407, 29918, 842, 29918, 1958, 353, 7442, 29889, 3298, 359, 29898, 1372, 29889, 1949, 29918, 18010, 29892, 26688, 29922, 524, 29897, 448, 29871, 29896, 13, 1678, 363, 413, 29892, 3407, 29918, 842, 297, 26985, 29898, 5679, 29918, 7224, 1125, 13, 4706, 363, 318, 297, 3407, 29918, 842, 29901, 13, 9651, 565, 3407, 29918, 842, 29918, 1958, 29961, 29884, 29962, 2804, 448, 29896, 29901, 13, 18884, 12020, 7865, 2392, 703, 29928, 786, 5926, 995, 297, 3407, 6166, 1159, 13, 9651, 3407, 29918, 842, 29918, 1958, 29961, 29884, 29962, 353, 413, 13, 13, 1678, 476, 353, 7431, 29898, 5679, 29918, 7224, 29897, 13, 1678, 319, 353, 7442, 29889, 3298, 359, 3552, 2435, 29898, 29888, 18642, 511, 18696, 29889, 1949, 29918, 28737, 29892, 476, 876, 13, 1678, 2175, 29879, 353, 7442, 29889, 3298, 359, 29898, 1372, 29889, 1949, 29918, 28737, 29892, 26688, 29922, 7411, 29897, 13, 1678, 10462, 353, 7442, 29889, 3298, 359, 29898, 1372, 29889, 1949, 29918, 28737, 29892, 26688, 29922, 7411, 29897, 13, 1678, 3847, 353, 7442, 29889, 3298, 359, 29898, 1372, 29889, 1949, 29918, 18010, 29892, 26688, 29922, 524, 29897, 448, 29871, 29896, 13, 1678, 4559, 29918, 2798, 353, 7442, 29889, 3298, 359, 3552, 1372, 29889, 1949, 29918, 18010, 29892, 476, 511, 26688, 29922, 524, 29897, 13, 13, 1678, 396, 3789, 278, 938, 277, 616, 5855, 29889, 13, 1678, 363, 432, 297, 3464, 29898, 29968, 1125, 13, 4706, 4559, 29918, 2798, 29961, 5679, 29918, 7224, 29961, 29926, 1402, 432, 29962, 353, 29871, 29896, 13, 13, 1678, 363, 260, 29892, 5135, 1563, 29892, 1492, 511, 12770, 29918, 449, 29892, 12770, 29918, 262, 29897, 297, 26985, 29898, 1372, 29889, 12864, 29918, 12765, 29879, 580, 1125, 13, 4706, 363, 7636, 297, 12770, 29918, 449, 29901, 13, 9651, 3847, 29961, 12864, 29889, 5145, 29962, 353, 448, 29896, 13, 9651, 325, 353, 7636, 29889, 3560, 13, 9651, 1550, 325, 2804, 448, 29896, 29901, 13, 18884, 4559, 29918, 2798, 29961, 29894, 29962, 22361, 4559, 29918, 2798, 29961, 12864, 29889, 5145, 29962, 13, 18884, 325, 353, 3847, 29961, 29894, 29962, 13, 4706, 363, 7636, 297, 12770, 29918, 262, 29901, 13, 9651, 3847, 29961, 12864, 29889, 5145, 29962, 353, 7636, 29889, 3560, 13, 9651, 325, 353, 7636, 29889, 3560, 13, 9651, 1550, 325, 2804, 448, 29896, 29901, 13, 18884, 4559, 29918, 2798, 29961, 29894, 29962, 4619, 4559, 29918, 2798, 29961, 12864, 29889, 5145, 29962, 13, 18884, 325, 353, 3847, 29961, 29894, 29962, 13, 13, 4706, 396, 10554, 445, 5447, 29889, 13, 4706, 363, 432, 29892, 318, 297, 26985, 29898, 29888, 18642, 1125, 13, 9651, 12789, 284, 29918, 5679, 29918, 842, 353, 3407, 29918, 842, 29918, 1958, 29961, 29884, 29962, 13, 9651, 19471, 353, 938, 29898, 29888, 18642, 29918, 5679, 29918, 842, 2804, 448, 29896, 29897, 13, 9651, 282, 353, 3847, 29961, 29884, 29962, 13, 9651, 2175, 29879, 29961, 29873, 29962, 353, 2175, 13, 9651, 10462, 29961, 29873, 29962, 353, 1492, 13, 9651, 1550, 282, 2804, 260, 808, 277, 29889, 10074, 29901, 13, 18884, 3001, 353, 7442, 29889, 2083, 29898, 11249, 29918, 2798, 29961, 29886, 2314, 13, 18884, 565, 3001, 1405, 19471, 29901, 13, 462, 1678, 2867, 13, 18884, 282, 353, 3847, 29961, 29886, 29962, 13, 9651, 565, 282, 2804, 260, 808, 277, 29889, 10074, 29901, 13, 18884, 6287, 353, 29871, 29896, 847, 313, 7827, 448, 19471, 29897, 13, 18884, 363, 413, 29892, 3407, 29918, 842, 297, 26985, 29898, 5679, 29918, 7224, 1125, 13, 462, 1678, 302, 353, 4559, 29918, 2798, 29961, 29886, 29892, 413, 29962, 448, 938, 29898, 29888, 18642, 29918, 5679, 29918, 842, 1275, 413, 29897, 13, 462, 1678, 319, 29961, 29926, 29892, 260, 29892, 413, 29962, 353, 302, 334, 6287, 13, 1678, 736, 313, 29909, 29892, 2175, 29879, 29892, 10462, 29897, 13, 13, 13, 1990, 4321, 1252, 627, 29954, 1600, 27330, 936, 29940, 799, 342, 8139, 1141, 29890, 2470, 29898, 3057, 29954, 1600, 27330, 936, 29940, 799, 342, 8139, 1141, 29890, 2470, 1125, 13, 1678, 396, 910, 338, 263, 664, 297, 6728, 448, 1438, 6987, 674, 367, 23430, 304, 671, 278, 13, 1678, 396, 2578, 809, 895, 402, 10262, 746, 372, 29915, 29879, 8762, 29889, 13, 13, 1678, 822, 11539, 29898, 1311, 29892, 18696, 29892, 3407, 29918, 7224, 29892, 12789, 284, 29922, 8516, 1125, 13, 4706, 565, 12789, 284, 338, 6213, 29901, 13, 9651, 12789, 284, 353, 518, 29884, 363, 2143, 842, 297, 3407, 29918, 7224, 363, 318, 297, 2143, 842, 29962, 13, 4706, 319, 353, 18696, 29889, 29887, 1600, 27330, 936, 29918, 28502, 342, 29918, 484, 1141, 29890, 2470, 29898, 29888, 18642, 29892, 3407, 29918, 7224, 29897, 13, 13, 4706, 402, 29892, 2175, 29879, 29892, 10462, 353, 1887, 29918, 5138, 29876, 29898, 1372, 29892, 12789, 284, 29892, 3407, 29918, 7224, 29897, 13, 4706, 363, 5447, 297, 18696, 29889, 28737, 7295, 13, 9651, 1583, 29889, 9294, 9843, 29898, 1563, 29879, 29961, 8336, 29889, 2248, 1402, 5447, 29889, 19207, 29961, 29900, 2314, 13, 9651, 1583, 29889, 9294, 9843, 29898, 1266, 29879, 29961, 8336, 29889, 2248, 1402, 5447, 29889, 19207, 29961, 29896, 2314, 13, 13, 4706, 363, 432, 29892, 318, 297, 26985, 29898, 29888, 18642, 1125, 13, 9651, 323, 29892, 365, 353, 2684, 29918, 29887, 1600, 27330, 936, 29918, 28502, 342, 29918, 484, 1141, 29890, 2470, 29898, 1372, 29892, 318, 29892, 3407, 29918, 7224, 29897, 13, 9651, 1583, 29889, 9294, 5574, 29898, 9302, 29889, 497, 5358, 29898, 29954, 29961, 29926, 1402, 323, 29889, 29911, 876, 13, 9651, 396, 18076, 487, 278, 4251, 988, 278, 2943, 756, 694, 402, 10262, 29879, 13, 9651, 565, 7442, 29889, 2083, 29898, 29931, 29897, 1405, 29871, 29900, 29901, 13, 18884, 2099, 353, 7442, 29889, 2083, 29898, 29911, 334, 365, 29892, 9685, 29922, 29896, 29897, 847, 7442, 29889, 2083, 29898, 29931, 29897, 13, 18884, 1583, 29889, 9294, 5574, 29898, 9302, 29889, 497, 5358, 29898, 12676, 29892, 319, 29961, 29926, 12622, 13, 4706, 736, 319, 13, 2 ]
typogrify/templatetags/typogrify_tags.py
tylerbutler/typogrify
0
2494
from typogrify.filters import amp, caps, initial_quotes, smartypants, titlecase, typogrify, widont, TypogrifyError from functools import wraps from django.conf import settings from django import template from django.utils.safestring import mark_safe from django.utils.encoding import force_unicode register = template.Library() def make_safe(f): """ A function wrapper to make typogrify play nice with django's unicode support. """ @wraps(f) def wrapper(text): text = force_unicode(text) f.is_safe = True out = text try: out = f(text) except TypogrifyError, e: if settings.DEBUG: raise e return text return mark_safe(out) wrapper.is_safe = True return wrapper register.filter('amp', make_safe(amp)) register.filter('caps', make_safe(caps)) register.filter('initial_quotes', make_safe(initial_quotes)) register.filter('smartypants', make_safe(smartypants)) register.filter('titlecase', make_safe(titlecase)) register.filter('typogrify', make_safe(typogrify)) register.filter('widont', make_safe(widont))
[ 1, 515, 2393, 468, 29878, 1598, 29889, 26705, 1053, 21332, 29892, 26091, 29892, 2847, 29918, 339, 4769, 29892, 15040, 1478, 1934, 29892, 3611, 4878, 29892, 2393, 468, 29878, 1598, 29892, 9449, 609, 29892, 14213, 468, 29878, 1598, 2392, 13, 3166, 2090, 312, 8789, 1053, 11463, 567, 13, 3166, 9557, 29889, 5527, 1053, 6055, 13, 3166, 9557, 1053, 4472, 13, 3166, 9557, 29889, 13239, 29889, 29879, 2142, 342, 5393, 1053, 2791, 29918, 11177, 13, 3166, 9557, 29889, 13239, 29889, 22331, 1053, 4889, 29918, 2523, 356, 13, 13, 13, 9573, 353, 4472, 29889, 12284, 580, 13, 13, 13, 1753, 1207, 29918, 11177, 29898, 29888, 1125, 13, 1678, 9995, 13, 1678, 319, 740, 14476, 304, 1207, 2393, 468, 29878, 1598, 1708, 7575, 411, 9557, 29915, 29879, 13, 1678, 29104, 2304, 29889, 13, 13, 1678, 9995, 13, 1678, 732, 29893, 336, 567, 29898, 29888, 29897, 13, 1678, 822, 14476, 29898, 726, 1125, 13, 4706, 1426, 353, 4889, 29918, 2523, 356, 29898, 726, 29897, 13, 4706, 285, 29889, 275, 29918, 11177, 353, 5852, 13, 4706, 714, 353, 1426, 13, 4706, 1018, 29901, 13, 9651, 714, 353, 285, 29898, 726, 29897, 13, 4706, 5174, 14213, 468, 29878, 1598, 2392, 29892, 321, 29901, 13, 9651, 565, 6055, 29889, 18525, 29901, 13, 18884, 12020, 321, 13, 9651, 736, 1426, 13, 4706, 736, 2791, 29918, 11177, 29898, 449, 29897, 13, 1678, 14476, 29889, 275, 29918, 11177, 353, 5852, 13, 1678, 736, 14476, 13, 13, 13, 9573, 29889, 4572, 877, 1160, 742, 1207, 29918, 11177, 29898, 1160, 876, 13, 9573, 29889, 4572, 877, 29883, 2547, 742, 1207, 29918, 11177, 29898, 29883, 2547, 876, 13, 9573, 29889, 4572, 877, 11228, 29918, 339, 4769, 742, 1207, 29918, 11177, 29898, 11228, 29918, 339, 4769, 876, 13, 9573, 29889, 4572, 877, 3844, 442, 1478, 1934, 742, 1207, 29918, 11177, 29898, 3844, 442, 1478, 1934, 876, 13, 9573, 29889, 4572, 877, 3257, 4878, 742, 1207, 29918, 11177, 29898, 3257, 4878, 876, 13, 9573, 29889, 4572, 877, 22449, 468, 29878, 1598, 742, 1207, 29918, 11177, 29898, 22449, 468, 29878, 1598, 876, 13, 9573, 29889, 4572, 877, 9163, 609, 742, 1207, 29918, 11177, 29898, 9163, 609, 876, 13, 2 ]
Data/GalZoo2_TFrecords.py
AshleySpindler/AstroSense
0
137071
<filename>Data/GalZoo2_TFrecords.py import numpy as np import tensorflow as tf from astropy.io import fits import matplotlib.image as mpimg from skimage.transform import rescale from skimage.color import rgb2gray from numpy.random import choice from skimage.exposure import rescale_intensity import sys from multiprocessing import Pool import tqdm import warnings warnings.filterwarnings("ignore") #TODO tidy this shit up def load_image(ID): img = mpimg.imread('/data/astroml/aspindler/GalaxyZoo/GalaxyZooImages/galaxy_'+str(ID)+'.png') img_crop = img[84:340,84:340] img_grey = rgb2gray(img_crop) img_64 = rescale(img_grey, scale=0.25, preserve_range=True) img_uint = rescale_intensity(img_64, out_range=(0,255)).astype('uint8') return img_uint def _bytes_feature(value): return tf.train.Feature(bytes_list=tf.train.BytesList(value=[value])) def grab_data(i): ID = IDs[0][i] condition = (IDs[1][i]).astype('uint8') img = load_image(ID) feature = {'image': _bytes_feature(tf.compat.as_bytes(img.tostring())), 'condition': _bytes_feature(tf.compat.as_bytes(condition.tostring())) } example = tf.train.Example(features=tf.train.Features(feature=feature)) return example#writer.write(example.SerializeToString()) #load IDs from fits data = fits.open('Data/Scratch/GalZoo2/gz2_hart16.fits.gz')[1].data spiral = (data['t02_edgeon_a05_no_flag'] & (data['t02_edgeon_a05_no_count'] > 20)).astype(bool) data = data[spiral] global IDs IDs = [data['dr7objid'], np.array([data['t03_bar_a06_bar_flag'], data['t03_bar_a07_no_bar_flag'], data['t04_spiral_a08_spiral_flag'], data['t04_spiral_a09_no_spiral_flag'], data['t05_bulge_prominence_a10_no_bulge_flag'], data['t05_bulge_prominence_a11_just_noticeable_flag'], data['t05_bulge_prominence_a12_obvious_flag'], data['t05_bulge_prominence_a13_dominant_flag'] ])] IDs[1] = np.swapaxes(IDs[1],0,1) train, valid, test = 10000, 10000, 25000 gals = choice(len(IDs[0]), train+valid+test) global gals_train, gals_valid, gals_test gals_train = gals[0:train] gals_valid = gals[train:train+valid] gals_test = gals[train+valid:train+valid+test] train_filename = 'Data/Scratch/GalZoo2/galzoo_spiral_flags_train.tfrecords' # address to save the TFRecords file # open the TFRecords file writer = tf.python_io.TFRecordWriter(train_filename) pool = Pool(processes=20) #Set pool of processors for result in tqdm.tqdm(pool.imap_unordered(grab_data, gals_train), total=len(gals_train)): writer.write(result.SerializeToString()) writer.close() sys.stdout.flush() valid_filename = 'Data/Scratch/GalZoo2/galzoo_spiral_flags_valid.tfrecords' # address to save the TFRecords file # open the TFRecords file writer = tf.python_io.TFRecordWriter(valid_filename) pool = Pool(processes=20) #Set pool of processors for result in tqdm.tqdm(pool.imap_unordered(grab_data, gals_valid), total=len(gals_valid)): writer.write(result.SerializeToString()) writer.close() sys.stdout.flush() test_filename = 'Data/Scratch/GalZoo2/galzoo_spiral_flags_test.tfrecords' # address to save the TFRecords file # open the TFRecords file writer = tf.python_io.TFRecordWriter(test_filename) pool = Pool(processes=20) #Set pool of processors for result in tqdm.tqdm(pool.imap_unordered(grab_data, gals_test), total=len(gals_test)): writer.write(result.SerializeToString()) writer.close() sys.stdout.flush()
[ 1, 529, 9507, 29958, 1469, 29914, 29954, 284, 29999, 3634, 29906, 29918, 8969, 3757, 4339, 29889, 2272, 13, 5215, 12655, 408, 7442, 13, 5215, 26110, 408, 15886, 13, 3166, 8717, 14441, 29889, 601, 1053, 23994, 13, 5215, 22889, 29889, 3027, 408, 22326, 2492, 13, 3166, 2071, 3027, 29889, 9067, 1053, 620, 29883, 744, 13, 3166, 2071, 3027, 29889, 2780, 1053, 15552, 29890, 29906, 21012, 13, 3166, 12655, 29889, 8172, 1053, 7348, 13, 3166, 2071, 3027, 29889, 735, 1066, 545, 1053, 620, 29883, 744, 29918, 524, 575, 537, 13, 5215, 10876, 13, 3166, 6674, 307, 985, 292, 1053, 28625, 13, 5215, 260, 29939, 18933, 13, 13, 5215, 18116, 13, 25442, 886, 29889, 4572, 25442, 886, 703, 17281, 1159, 13, 13, 29937, 4986, 3970, 10668, 29891, 445, 528, 277, 701, 13, 13, 1753, 2254, 29918, 3027, 29898, 1367, 1125, 13, 1678, 10153, 353, 22326, 2492, 29889, 326, 949, 11219, 1272, 29914, 579, 456, 29880, 29914, 4692, 513, 1358, 29914, 29954, 284, 26825, 29999, 3634, 29914, 29954, 284, 26825, 29999, 3634, 20163, 29914, 23014, 26825, 29918, 18717, 710, 29898, 1367, 7240, 4286, 2732, 1495, 13, 1678, 10153, 29918, 29883, 1336, 353, 10153, 29961, 29947, 29946, 29901, 29941, 29946, 29900, 29892, 29947, 29946, 29901, 29941, 29946, 29900, 29962, 13, 1678, 10153, 29918, 7979, 29891, 353, 15552, 29890, 29906, 21012, 29898, 2492, 29918, 29883, 1336, 29897, 13, 1678, 10153, 29918, 29953, 29946, 353, 620, 29883, 744, 29898, 2492, 29918, 7979, 29891, 29892, 6287, 29922, 29900, 29889, 29906, 29945, 29892, 19905, 29918, 3881, 29922, 5574, 29897, 13, 1678, 10153, 29918, 13470, 353, 620, 29883, 744, 29918, 524, 575, 537, 29898, 2492, 29918, 29953, 29946, 29892, 714, 29918, 3881, 7607, 29900, 29892, 29906, 29945, 29945, 8106, 579, 668, 877, 13470, 29947, 1495, 13, 1678, 736, 10153, 29918, 13470, 13, 13, 1753, 903, 13193, 29918, 14394, 29898, 1767, 1125, 13, 1678, 736, 15886, 29889, 14968, 29889, 19132, 29898, 13193, 29918, 1761, 29922, 13264, 29889, 14968, 29889, 11207, 1293, 29898, 1767, 11759, 1767, 12622, 13, 13, 1753, 17229, 29918, 1272, 29898, 29875, 1125, 13, 1678, 3553, 353, 23481, 29961, 29900, 3816, 29875, 29962, 13, 1678, 4195, 353, 313, 1367, 29879, 29961, 29896, 3816, 29875, 14664, 579, 668, 877, 13470, 29947, 1495, 13, 1678, 10153, 353, 2254, 29918, 3027, 29898, 1367, 29897, 13, 13, 1678, 4682, 353, 11117, 3027, 2396, 903, 13193, 29918, 14394, 29898, 13264, 29889, 12667, 29889, 294, 29918, 13193, 29898, 2492, 29889, 517, 1807, 3101, 511, 13, 1669, 525, 16122, 2396, 903, 13193, 29918, 14394, 29898, 13264, 29889, 12667, 29889, 294, 29918, 13193, 29898, 16122, 29889, 517, 1807, 22130, 13, 795, 500, 13, 13, 1678, 1342, 353, 15886, 29889, 14968, 29889, 14023, 29898, 22100, 29922, 13264, 29889, 14968, 29889, 8263, 3698, 29898, 14394, 29922, 14394, 876, 13, 13, 1678, 736, 1342, 29937, 13236, 29889, 3539, 29898, 4773, 29889, 1748, 6646, 8246, 3101, 13, 13, 29937, 1359, 23481, 515, 23994, 13, 1272, 353, 23994, 29889, 3150, 877, 1469, 29914, 4421, 29878, 905, 29914, 29954, 284, 29999, 3634, 29906, 29914, 18828, 29906, 29918, 26243, 29896, 29953, 29889, 29888, 1169, 29889, 18828, 29861, 29896, 1822, 1272, 13, 13, 1028, 19647, 353, 313, 1272, 1839, 29873, 29900, 29906, 29918, 12864, 265, 29918, 29874, 29900, 29945, 29918, 1217, 29918, 15581, 2033, 669, 313, 1272, 1839, 29873, 29900, 29906, 29918, 12864, 265, 29918, 29874, 29900, 29945, 29918, 1217, 29918, 2798, 2033, 1405, 29871, 29906, 29900, 8106, 579, 668, 29898, 11227, 29897, 13, 1272, 353, 848, 29961, 1028, 19647, 29962, 13, 13, 10945, 23481, 13, 13, 1367, 29879, 353, 518, 1272, 1839, 7707, 29955, 5415, 333, 7464, 13, 418, 7442, 29889, 2378, 4197, 1272, 1839, 29873, 29900, 29941, 29918, 1646, 29918, 29874, 29900, 29953, 29918, 1646, 29918, 15581, 7464, 13, 18884, 848, 1839, 29873, 29900, 29941, 29918, 1646, 29918, 29874, 29900, 29955, 29918, 1217, 29918, 1646, 29918, 15581, 7464, 13, 18884, 848, 1839, 29873, 29900, 29946, 29918, 1028, 19647, 29918, 29874, 29900, 29947, 29918, 1028, 19647, 29918, 15581, 7464, 13, 18884, 848, 1839, 29873, 29900, 29946, 29918, 1028, 19647, 29918, 29874, 29900, 29929, 29918, 1217, 29918, 1028, 19647, 29918, 15581, 7464, 13, 18884, 848, 1839, 29873, 29900, 29945, 29918, 8645, 479, 29918, 14032, 262, 663, 29918, 29874, 29896, 29900, 29918, 1217, 29918, 8645, 479, 29918, 15581, 7464, 13, 18884, 848, 1839, 29873, 29900, 29945, 29918, 8645, 479, 29918, 14032, 262, 663, 29918, 29874, 29896, 29896, 29918, 5143, 29918, 1333, 625, 519, 29918, 15581, 7464, 13, 18884, 848, 1839, 29873, 29900, 29945, 29918, 8645, 479, 29918, 14032, 262, 663, 29918, 29874, 29896, 29906, 29918, 711, 2366, 29918, 15581, 7464, 13, 18884, 848, 1839, 29873, 29900, 29945, 29918, 8645, 479, 29918, 14032, 262, 663, 29918, 29874, 29896, 29941, 29918, 24130, 424, 29918, 15581, 2033, 13, 18884, 2314, 29962, 13, 1367, 29879, 29961, 29896, 29962, 353, 7442, 29889, 26276, 1165, 267, 29898, 1367, 29879, 29961, 29896, 1402, 29900, 29892, 29896, 29897, 13, 13, 14968, 29892, 2854, 29892, 1243, 353, 29871, 29896, 29900, 29900, 29900, 29900, 29892, 29871, 29896, 29900, 29900, 29900, 29900, 29892, 29871, 29906, 29945, 29900, 29900, 29900, 13, 13, 29887, 1338, 353, 7348, 29898, 2435, 29898, 1367, 29879, 29961, 29900, 11724, 7945, 29974, 3084, 29974, 1688, 29897, 13, 13, 10945, 330, 1338, 29918, 14968, 29892, 330, 1338, 29918, 3084, 29892, 330, 1338, 29918, 1688, 13, 29887, 1338, 29918, 14968, 353, 330, 1338, 29961, 29900, 29901, 14968, 29962, 13, 29887, 1338, 29918, 3084, 353, 330, 1338, 29961, 14968, 29901, 14968, 29974, 3084, 29962, 13, 29887, 1338, 29918, 1688, 353, 330, 1338, 29961, 14968, 29974, 3084, 29901, 14968, 29974, 3084, 29974, 1688, 29962, 13, 13, 14968, 29918, 9507, 353, 525, 1469, 29914, 4421, 29878, 905, 29914, 29954, 284, 29999, 3634, 29906, 29914, 23014, 2502, 29877, 29918, 1028, 19647, 29918, 15764, 29918, 14968, 29889, 13264, 3757, 4339, 29915, 29871, 396, 3211, 304, 4078, 278, 323, 29943, 4789, 4339, 934, 13, 13, 29937, 1722, 278, 323, 29943, 4789, 4339, 934, 13, 13236, 353, 15886, 29889, 4691, 29918, 601, 29889, 8969, 9182, 10507, 29898, 14968, 29918, 9507, 29897, 13, 13, 10109, 353, 28625, 29898, 5014, 267, 29922, 29906, 29900, 29897, 539, 396, 2697, 11565, 310, 1889, 943, 13, 1454, 1121, 297, 260, 29939, 18933, 29889, 29873, 29939, 18933, 29898, 10109, 29889, 326, 481, 29918, 348, 21693, 29898, 3874, 29890, 29918, 1272, 29892, 330, 1338, 29918, 14968, 511, 3001, 29922, 2435, 29898, 29887, 1338, 29918, 14968, 22164, 13, 1678, 9227, 29889, 3539, 29898, 2914, 29889, 1748, 6646, 8246, 3101, 13, 13, 13236, 29889, 5358, 580, 13, 9675, 29889, 25393, 29889, 23126, 580, 13, 13, 3084, 29918, 9507, 353, 525, 1469, 29914, 4421, 29878, 905, 29914, 29954, 284, 29999, 3634, 29906, 29914, 23014, 2502, 29877, 29918, 1028, 19647, 29918, 15764, 29918, 3084, 29889, 13264, 3757, 4339, 29915, 29871, 396, 3211, 304, 4078, 278, 323, 29943, 4789, 4339, 934, 13, 13, 29937, 1722, 278, 323, 29943, 4789, 4339, 934, 13, 13236, 353, 15886, 29889, 4691, 29918, 601, 29889, 8969, 9182, 10507, 29898, 3084, 29918, 9507, 29897, 13, 13, 10109, 353, 28625, 29898, 5014, 267, 29922, 29906, 29900, 29897, 539, 396, 2697, 11565, 310, 1889, 943, 13, 1454, 1121, 297, 260, 29939, 18933, 29889, 29873, 29939, 18933, 29898, 10109, 29889, 326, 481, 29918, 348, 21693, 29898, 3874, 29890, 29918, 1272, 29892, 330, 1338, 29918, 3084, 511, 3001, 29922, 2435, 29898, 29887, 1338, 29918, 3084, 22164, 13, 1678, 9227, 29889, 3539, 29898, 2914, 29889, 1748, 6646, 8246, 3101, 13, 13, 13236, 29889, 5358, 580, 13, 9675, 29889, 25393, 29889, 23126, 580, 13, 13, 1688, 29918, 9507, 353, 525, 1469, 29914, 4421, 29878, 905, 29914, 29954, 284, 29999, 3634, 29906, 29914, 23014, 2502, 29877, 29918, 1028, 19647, 29918, 15764, 29918, 1688, 29889, 13264, 3757, 4339, 29915, 29871, 396, 3211, 304, 4078, 278, 323, 29943, 4789, 4339, 934, 13, 13, 29937, 1722, 278, 323, 29943, 4789, 4339, 934, 13, 13236, 353, 15886, 29889, 4691, 29918, 601, 29889, 8969, 9182, 10507, 29898, 1688, 29918, 9507, 29897, 13, 13, 10109, 353, 28625, 29898, 5014, 267, 29922, 29906, 29900, 29897, 539, 396, 2697, 11565, 310, 1889, 943, 13, 1454, 1121, 297, 260, 29939, 18933, 29889, 29873, 29939, 18933, 29898, 10109, 29889, 326, 481, 29918, 348, 21693, 29898, 3874, 29890, 29918, 1272, 29892, 330, 1338, 29918, 1688, 511, 3001, 29922, 2435, 29898, 29887, 1338, 29918, 1688, 22164, 13, 1678, 9227, 29889, 3539, 29898, 2914, 29889, 1748, 6646, 8246, 3101, 13, 13, 13236, 29889, 5358, 580, 13, 9675, 29889, 25393, 29889, 23126, 580, 13, 13, 2 ]
Interview-Preparation/Facebook/BinarySearch-find-smallest-divisor-given-a-threshold.py
shoaibur/SWE
1
91002
class Solution: def smallestDivisor(self, nums: List[int], threshold: int) -> int: def condition(divisor) -> bool: return sum((num - 1) // divisor + 1 for num in nums) <= threshold lo, hi = 1, max(nums) while lo < hi: mid = lo + (hi - lo) // 2 if condition(mid): hi = mid else: lo = mid + 1 return lo
[ 1, 770, 24380, 29901, 13, 1678, 822, 19087, 12596, 275, 272, 29898, 1311, 29892, 954, 29879, 29901, 2391, 29961, 524, 1402, 16897, 29901, 938, 29897, 1599, 938, 29901, 13, 308, 13, 4706, 822, 4195, 29898, 4563, 275, 272, 29897, 1599, 6120, 29901, 13, 9651, 736, 2533, 3552, 1949, 448, 29871, 29896, 29897, 849, 8572, 272, 718, 29871, 29896, 363, 954, 297, 954, 29879, 29897, 5277, 16897, 13, 13, 4706, 658, 29892, 7251, 353, 29871, 29896, 29892, 4236, 29898, 1949, 29879, 29897, 13, 4706, 1550, 658, 529, 7251, 29901, 13, 9651, 7145, 353, 658, 718, 313, 2918, 448, 658, 29897, 849, 29871, 29906, 13, 9651, 565, 4195, 29898, 6563, 1125, 13, 18884, 7251, 353, 7145, 13, 9651, 1683, 29901, 13, 18884, 658, 353, 7145, 718, 29871, 29896, 13, 4706, 736, 658, 13, 2 ]
pipeline/reach-es-extractor/refparse/utils/__init__.py
wellcometrust/reach
11
36198
<filename>pipeline/reach-es-extractor/refparse/utils/__init__.py from .parse import structure_reference from .fuzzy_match import FuzzyMatcher from .file_manager import FileManager from .serialiser import serialise_matched_reference, serialise_reference from .exact_match import ExactMatcher __all__ = [ structure_reference, FuzzyMatcher, FileManager, serialise_matched_reference, serialise_reference, ExactMatcher ]
[ 1, 529, 9507, 29958, 13096, 5570, 29914, 276, 496, 29899, 267, 29899, 21111, 272, 29914, 999, 5510, 29914, 13239, 29914, 1649, 2344, 26914, 2272, 13, 3166, 869, 5510, 1053, 3829, 29918, 5679, 13, 3166, 869, 29888, 3365, 1537, 29918, 4352, 1053, 383, 3365, 1537, 9652, 261, 13, 3166, 869, 1445, 29918, 12847, 1053, 3497, 3260, 13, 3166, 869, 15550, 7608, 1053, 7797, 895, 29918, 4352, 287, 29918, 5679, 29892, 7797, 895, 29918, 5679, 13, 3166, 869, 735, 627, 29918, 4352, 1053, 1222, 627, 9652, 261, 13, 13, 1649, 497, 1649, 353, 518, 13, 1678, 3829, 29918, 5679, 29892, 13, 1678, 383, 3365, 1537, 9652, 261, 29892, 13, 1678, 3497, 3260, 29892, 13, 1678, 7797, 895, 29918, 4352, 287, 29918, 5679, 29892, 13, 1678, 7797, 895, 29918, 5679, 29892, 13, 1678, 1222, 627, 9652, 261, 13, 29962, 13, 2 ]
tests/src/Diksha_Reports/usage_by_textbook/download_all_collection_records.py
JalajaTR/cQube
0
267
<gh_stars>0 import os import time from selenium.webdriver.support.select import Select from Data.parameters import Data from get_dir import pwd from reuse_func import GetData class All_records_download(): def __init__(self,driver): self.driver = driver self.filename ='' def test_download_csv(self): self.data = GetData() self.p = pwd() self.driver.find_element_by_xpath(Data.hyper_link).click() self.data.page_loading(self.driver) colltype = Select(self.driver.find_element_by_name('collection_type')) colltype.select_by_visible_text(' Overall ') self.data.page_loading(self.driver) self.driver.find_element_by_id(Data.Download).click() time.sleep(4) self.filename = self.p.get_download_dir() + '/collectionType_all_data.csv' time.sleep(2) file = os.path.isfile(self.filename) os.remove(self.filename) return file
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 5215, 2897, 13, 5215, 931, 13, 13, 3166, 18866, 29889, 29813, 29889, 5924, 29889, 2622, 1053, 7605, 13, 13, 3166, 3630, 29889, 16744, 1053, 3630, 13, 3166, 679, 29918, 3972, 1053, 282, 9970, 13, 3166, 24270, 29918, 9891, 1053, 3617, 1469, 13, 13, 13, 1990, 2178, 29918, 3757, 4339, 29918, 10382, 7295, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 9465, 1125, 13, 4706, 1583, 29889, 9465, 353, 7156, 13, 4706, 1583, 29889, 9507, 353, 4907, 13, 1678, 822, 1243, 29918, 10382, 29918, 7638, 29898, 1311, 1125, 13, 4706, 1583, 29889, 1272, 353, 3617, 1469, 580, 13, 4706, 1583, 29889, 29886, 353, 282, 9970, 580, 13, 4706, 1583, 29889, 9465, 29889, 2886, 29918, 5029, 29918, 1609, 29918, 23635, 29898, 1469, 29889, 24947, 29918, 2324, 467, 3808, 580, 13, 4706, 1583, 29889, 1272, 29889, 3488, 29918, 13234, 29898, 1311, 29889, 9465, 29897, 13, 4706, 5321, 1853, 353, 7605, 29898, 1311, 29889, 9465, 29889, 2886, 29918, 5029, 29918, 1609, 29918, 978, 877, 10855, 29918, 1853, 8785, 13, 4706, 5321, 1853, 29889, 2622, 29918, 1609, 29918, 12872, 29918, 726, 877, 6811, 497, 25710, 13, 4706, 1583, 29889, 1272, 29889, 3488, 29918, 13234, 29898, 1311, 29889, 9465, 29897, 13, 4706, 1583, 29889, 9465, 29889, 2886, 29918, 5029, 29918, 1609, 29918, 333, 29898, 1469, 29889, 22954, 467, 3808, 580, 13, 4706, 931, 29889, 17059, 29898, 29946, 29897, 13, 4706, 1583, 29889, 9507, 353, 1583, 29889, 29886, 29889, 657, 29918, 10382, 29918, 3972, 580, 718, 8207, 10855, 1542, 29918, 497, 29918, 1272, 29889, 7638, 29915, 13, 4706, 931, 29889, 17059, 29898, 29906, 29897, 13, 4706, 934, 353, 2897, 29889, 2084, 29889, 275, 1445, 29898, 1311, 29889, 9507, 29897, 13, 4706, 2897, 29889, 5992, 29898, 1311, 29889, 9507, 29897, 13, 4706, 736, 934, 13, 13, 13, 2 ]
pyrsa/io/meadows.py
PeerHerholz/pyrsa
4
28506
"""Covers import of data downloaded from the `Meadows online behavior platform <https://meadows-research.com/>`_. For information on available file types see the meadows `documentation on downloads <https://meadows-research.com/documentation\ /researcher/downloads/>`_. """ from os.path import basename import numpy from scipy.io import loadmat from pyrsa.rdm.rdms import RDMs def load_rdms(fpath, sort=True): """Read a Meadows results file and return any RDMs as a pyrsa object Args: fpath (str): path to .mat Meadows results file sort (bool): whether to sort the RDM based on the stimulus names Raises: ValueError: Will raise an error if the file is missing an expected variable. This can happen if the file does not contain MA task data. Returns: RDMs: All rdms found in the data file as an RDMs object """ info = extract_filename_segments(fpath) data = loadmat(fpath) if info['participant_scope'] == 'single': for var in ('stimuli', 'rdmutv'): if var not in data: raise ValueError(f'File missing variable: {var}') utvs = data['rdmutv'] stimuli_fnames = data['stimuli'] pnames = [info['participant']] else: stim_vars = [v for v in data.keys() if v[:7] == 'stimuli'] stimuli_fnames = data[stim_vars[0]] pnames = ['-'.join(v.split('_')[1:]) for v in stim_vars] utv_vars = ['rdmutv_' + p.replace('-', '_') for p in pnames] utvs = numpy.squeeze(numpy.stack([data[v] for v in utv_vars])) desc_info_keys = ( 'participant', 'task_index', 'task_name', 'experiment_name' ) conds = [f.split('.')[0] for f in stimuli_fnames] rdms = RDMs( utvs, dissimilarity_measure='euclidean', descriptors={k: info[k] for k in desc_info_keys if k in info}, rdm_descriptors=dict(participants=pnames), pattern_descriptors=dict(conds=conds), ) if sort: rdms.sort_by(conds='alpha') return rdms def extract_filename_segments(fpath): """Get information from the name of a downloaded results file Will determine: * participant_scope: 'single' or 'multiple', how many participant sessions this file covers. * task_scope: 'single' or 'multiple', how many experiment tasks this file covers. * participant: the Meadows nickname of the participant, if this is a single participation file. * task_index: the 1-based index of the task in the experiment, if this is a single participant file. * task_name: the name of the task in the experiment, if this is not a single participant file. * version: the experiment version as a string. * experiment_name: name of the experiment on Meadows. * structure: the structure of the data contained, one of 'tree', 'events', '1D', '2D', etc. * filetype: the file extension and file format used to serialize the data. Args: fpath (str): File system path to downloaded file Returns: dict: Dictionary with the fields described above. """ fname, ext = basename(fpath).split('.') segments = fname.split('_') info = dict( task_scope='single', version=segments[3].replace('v', ''), experiment_name=segments[1], structure=segments[-1], filetype=ext ) if segments[-2].isdigit(): info['participant_scope'] = 'single' info['participant'] = segments[-3] info['task_index'] = int(segments[-2]) else: info['participant_scope'] = 'multiple' info['task_name'] = segments[-2] return info
[ 1, 9995, 7967, 874, 1053, 310, 848, 16532, 515, 278, 13, 29952, 29924, 1479, 1242, 7395, 6030, 7481, 529, 991, 597, 1004, 23626, 29899, 690, 2842, 29889, 510, 3779, 29952, 5396, 13, 13, 13, 2831, 2472, 373, 3625, 934, 4072, 1074, 278, 592, 23626, 13, 29952, 12663, 373, 5142, 29879, 529, 991, 597, 1004, 23626, 29899, 690, 2842, 29889, 510, 29914, 12663, 29905, 13, 29914, 690, 2842, 261, 29914, 10382, 29879, 3779, 29952, 5396, 13, 15945, 29908, 13, 3166, 2897, 29889, 2084, 1053, 2362, 3871, 13, 5215, 12655, 13, 3166, 4560, 2272, 29889, 601, 1053, 2254, 2922, 13, 3166, 11451, 2288, 29874, 29889, 5499, 29885, 29889, 5499, 1516, 1053, 390, 23560, 29879, 13, 13, 13, 1753, 2254, 29918, 5499, 1516, 29898, 29888, 2084, 29892, 2656, 29922, 5574, 1125, 13, 1678, 9995, 6359, 263, 341, 1479, 1242, 2582, 934, 322, 736, 738, 390, 23560, 29879, 408, 263, 11451, 2288, 29874, 1203, 13, 13, 1678, 826, 3174, 29901, 13, 4706, 285, 2084, 313, 710, 1125, 2224, 304, 869, 2922, 341, 1479, 1242, 2582, 934, 13, 4706, 2656, 313, 11227, 1125, 3692, 304, 2656, 278, 390, 23560, 2729, 373, 278, 20436, 14999, 2983, 13, 13, 1678, 390, 1759, 267, 29901, 13, 4706, 7865, 2392, 29901, 2811, 12020, 385, 1059, 565, 278, 934, 338, 4567, 385, 3806, 13, 9651, 2286, 29889, 910, 508, 3799, 565, 278, 934, 947, 451, 1712, 14861, 3414, 13, 9651, 848, 29889, 13, 13, 1678, 16969, 29901, 13, 4706, 390, 23560, 29879, 29901, 2178, 364, 29881, 1516, 1476, 297, 278, 848, 934, 408, 385, 390, 23560, 29879, 1203, 13, 1678, 9995, 13, 1678, 5235, 353, 6597, 29918, 9507, 29918, 10199, 1860, 29898, 29888, 2084, 29897, 13, 1678, 848, 353, 2254, 2922, 29898, 29888, 2084, 29897, 13, 1678, 565, 5235, 1839, 1595, 12654, 424, 29918, 6078, 2033, 1275, 525, 14369, 2396, 13, 4706, 363, 722, 297, 6702, 303, 326, 14549, 742, 525, 5499, 6149, 29894, 29374, 13, 9651, 565, 722, 451, 297, 848, 29901, 13, 18884, 12020, 7865, 2392, 29898, 29888, 29915, 2283, 4567, 2286, 29901, 426, 1707, 29913, 1495, 13, 4706, 3477, 4270, 353, 848, 1839, 5499, 6149, 29894, 2033, 13, 4706, 20436, 14549, 29918, 29888, 7039, 353, 848, 1839, 303, 326, 14549, 2033, 13, 4706, 282, 7039, 353, 518, 3888, 1839, 1595, 12654, 424, 2033, 29962, 13, 1678, 1683, 29901, 13, 4706, 20436, 29918, 16908, 353, 518, 29894, 363, 325, 297, 848, 29889, 8149, 580, 565, 325, 7503, 29955, 29962, 1275, 525, 303, 326, 14549, 2033, 13, 4706, 20436, 14549, 29918, 29888, 7039, 353, 848, 29961, 303, 326, 29918, 16908, 29961, 29900, 5262, 13, 4706, 282, 7039, 353, 6024, 29899, 4286, 7122, 29898, 29894, 29889, 5451, 877, 29918, 29861, 29896, 29901, 2314, 363, 325, 297, 20436, 29918, 16908, 29962, 13, 4706, 3477, 29894, 29918, 16908, 353, 6024, 5499, 6149, 29894, 29918, 29915, 718, 282, 29889, 6506, 877, 29899, 742, 22868, 1495, 363, 282, 297, 282, 7039, 29962, 13, 4706, 3477, 4270, 353, 12655, 29889, 29879, 802, 29872, 911, 29898, 23749, 29889, 1429, 4197, 1272, 29961, 29894, 29962, 363, 325, 297, 3477, 29894, 29918, 16908, 12622, 13, 13, 1678, 5153, 29918, 3888, 29918, 8149, 353, 313, 13, 4706, 525, 1595, 12654, 424, 742, 13, 4706, 525, 7662, 29918, 2248, 742, 13, 4706, 525, 7662, 29918, 978, 742, 13, 4706, 525, 735, 15362, 29918, 978, 29915, 13, 1678, 1723, 13, 1678, 2148, 29879, 353, 518, 29888, 29889, 5451, 12839, 29861, 29900, 29962, 363, 285, 297, 20436, 14549, 29918, 29888, 7039, 29962, 13, 1678, 364, 29881, 1516, 353, 390, 23560, 29879, 29898, 13, 4706, 3477, 4270, 29892, 13, 4706, 766, 29764, 537, 29918, 26658, 2433, 29872, 27511, 742, 13, 4706, 29037, 943, 3790, 29895, 29901, 5235, 29961, 29895, 29962, 363, 413, 297, 5153, 29918, 3888, 29918, 8149, 565, 413, 297, 5235, 1118, 13, 4706, 364, 18933, 29918, 2783, 924, 943, 29922, 8977, 29898, 1595, 12654, 1934, 29922, 29886, 7039, 511, 13, 4706, 4766, 29918, 2783, 924, 943, 29922, 8977, 29898, 1116, 29879, 29922, 1116, 29879, 511, 13, 1678, 1723, 13, 1678, 565, 2656, 29901, 13, 4706, 364, 29881, 1516, 29889, 6605, 29918, 1609, 29898, 1116, 29879, 2433, 2312, 1495, 13, 1678, 736, 364, 29881, 1516, 13, 13, 13, 1753, 6597, 29918, 9507, 29918, 10199, 1860, 29898, 29888, 2084, 1125, 13, 1678, 9995, 2577, 2472, 515, 278, 1024, 310, 263, 16532, 2582, 934, 13, 13, 1678, 2811, 8161, 29901, 13, 4706, 334, 5221, 424, 29918, 6078, 29901, 525, 14369, 29915, 470, 525, 20787, 742, 920, 1784, 5221, 424, 13, 9651, 21396, 445, 934, 18469, 29889, 13, 4706, 334, 3414, 29918, 6078, 29901, 525, 14369, 29915, 470, 525, 20787, 742, 920, 1784, 7639, 9595, 445, 13, 9651, 934, 18469, 29889, 13, 4706, 334, 5221, 424, 29901, 278, 341, 1479, 1242, 25985, 978, 310, 278, 5221, 424, 29892, 565, 445, 338, 263, 13, 9651, 2323, 27577, 934, 29889, 13, 4706, 334, 3414, 29918, 2248, 29901, 278, 29871, 29896, 29899, 6707, 2380, 310, 278, 3414, 297, 278, 7639, 29892, 565, 13, 9651, 445, 338, 263, 2323, 5221, 424, 934, 29889, 13, 4706, 334, 3414, 29918, 978, 29901, 278, 1024, 310, 278, 3414, 297, 278, 7639, 29892, 565, 13, 9651, 445, 338, 451, 263, 2323, 5221, 424, 934, 29889, 13, 4706, 334, 1873, 29901, 278, 7639, 1873, 408, 263, 1347, 29889, 13, 4706, 334, 7639, 29918, 978, 29901, 1024, 310, 278, 7639, 373, 341, 1479, 1242, 29889, 13, 4706, 334, 3829, 29901, 278, 3829, 310, 278, 848, 11122, 29892, 697, 310, 525, 8336, 742, 13, 9651, 525, 13604, 742, 525, 29896, 29928, 742, 525, 29906, 29928, 742, 2992, 29889, 13, 4706, 334, 934, 1853, 29901, 278, 934, 6081, 322, 934, 3402, 1304, 304, 28755, 278, 13, 9651, 848, 29889, 13, 13, 1678, 826, 3174, 29901, 13, 4706, 285, 2084, 313, 710, 1125, 3497, 1788, 2224, 304, 16532, 934, 13, 13, 1678, 16969, 29901, 13, 4706, 9657, 29901, 13343, 411, 278, 4235, 5439, 2038, 29889, 13, 1678, 9995, 13, 1678, 285, 978, 29892, 1294, 353, 2362, 3871, 29898, 29888, 2084, 467, 5451, 12839, 1495, 13, 1678, 24611, 353, 285, 978, 29889, 5451, 877, 29918, 1495, 13, 1678, 5235, 353, 9657, 29898, 13, 4706, 3414, 29918, 6078, 2433, 14369, 742, 13, 4706, 1873, 29922, 10199, 1860, 29961, 29941, 1822, 6506, 877, 29894, 742, 525, 5477, 13, 4706, 7639, 29918, 978, 29922, 10199, 1860, 29961, 29896, 1402, 13, 4706, 3829, 29922, 10199, 1860, 14352, 29896, 1402, 13, 4706, 934, 1853, 29922, 1062, 13, 1678, 1723, 13, 1678, 565, 24611, 14352, 29906, 1822, 275, 26204, 7295, 13, 4706, 5235, 1839, 1595, 12654, 424, 29918, 6078, 2033, 353, 525, 14369, 29915, 13, 4706, 5235, 1839, 1595, 12654, 424, 2033, 353, 24611, 14352, 29941, 29962, 13, 4706, 5235, 1839, 7662, 29918, 2248, 2033, 353, 938, 29898, 10199, 1860, 14352, 29906, 2314, 13, 1678, 1683, 29901, 13, 4706, 5235, 1839, 1595, 12654, 424, 29918, 6078, 2033, 353, 525, 20787, 29915, 13, 4706, 5235, 1839, 7662, 29918, 978, 2033, 353, 24611, 14352, 29906, 29962, 13, 1678, 736, 5235, 13, 2 ]
src/skiptracer/plugins/who_call_id/__init__.py
EdwardDantes/skiptracer
912
50278
"""Whocallid.com search module""" from __future__ import print_function from __future__ import absolute_import from ..base import PageGrabber from ...colors.default_colors import DefaultBodyColors as bc import re import logging try: import __builtin__ as bi except BaseException: import builtins as bi class WhoCallIdGrabber(PageGrabber): """ WhoCallID sales scraper for reverse telephone lookups """ def get_name(self): """ Grab the users name """ name = "Unknown" try: name = self.soup.find('h2', attrs={'class': 'name'}) if name: name = name.text.strip() print(" [" + bc.CGRN + "+" + bc.CEND + "] " + bc.CRED + "Name: " + bc.CEND + str(name)) except BaseException: pass finally: return name def get_location(self): """ Get the location """ location = "Unknown" try: location = self.soup.find('h3', attrs={'class': 'location'}) if location: location = location.text.strip() print(" [" + bc.CGRN + "+" + bc.CEND + "] " + bc.CRED + "Location: " + bc.CEND + str(location)) except BaseException: pass finally: return location def get_phone_type(self): """ Get the phone type """ phone_type = "Unknown" try: phone_type = self.soup.find("img").attrs['alt'] if phone_type: phone_type = phone_type.strip() print(" [" + bc.CGRN + "+" + bc.CEND + "] " + bc.CRED + "Phone Type: " + bc.CEND + str(phone_type)) except BaseException: pass finally: return phone_type def get_carrier(self, phone_number): """ Get the phone carrier info """ carrier = "" try: self.url = "https://whocalld.com/+1{}?carrier".format(phone_number) self.source = self.get_source(self.url) self.soup = self.get_dom(self.source) carrier = soup.find('span', attrs={'class': 'carrier'}) except BaseException: pass finally: return carrier def process_carrier(self, carrier): """ Take the carrier info and process it """ try: if carrier: carrier = carrier.text print(" [" + bc.CGRN + "+" + bc.CEND + "] " + bc.CRED + "Carrier: " + bc.CEND + str(carrier)) else: carrier = "" except BaseException: carrier = "" finally: return carrier def get_city(self): """ Grab the city info """ city = "" try: city = self.soup.find('span', attrs={'class': 'city'}) if city: city = city.text print(" [" + bc.CGRN + "+" + bc.CEND + "] " + bc.CRED + "City: " + bc.CEND + str(city)) except BaseException: pass finally: return city def get_state(self): """ Grab the state info """ state = "" try: state = self.soup.find('span', attrs={'class': 'state'}) if state: state = state.text print(" [" + bc.CGRN + "+" + bc.CEND + "] " + bc.CRED + "State: " + bc.CEND + str(state)) except BaseException: pass finally: return state def get_time(self): """ Grab time info """ time = "" try: time = self.soup.find('span', attrs={'class': 'time'}) if time: time = time.text print(" [" + bc.CGRN + "+" + bc.CEND + "] " + bc.CRED + "Time: " + bc.CEND + str(time)) except BaseException: pass finally: return time def get_info(self, phone_number, lookup): """ Request, scrape and return values found """ print("[" + bc.CPRP + "?" + bc.CEND + "] " + bc.CCYN + "WhoCalld" + bc.CEND) # Get phone info self.url = 'https://whocalld.com/+1{}'.format(phone_number) self.source = self.get_source(self.url) self.soup = self.get_dom(self.source) try: if self.soup.body.find_all(string=re.compile( '.*{0}.*'.format('country')), recursive=True): print(" [" + bc.CRED + "X" + bc.CEND + "] " + bc.CYLW + "No WhoCallID data returned\n" + bc.CEND) return except: print(" [" + bc.CRED + "X" + bc.CEND + "] " + bc.CYLW + "Unable to extract data. Is the site online?\n" + bc.CEND) name = self.get_name() location = self.get_location() phone_type = self.get_phone_type() carrier = self.get_carrier(phone_number) carrier = self.process_carrier(carrier) city = self.get_city() state = self.get_state() time = self.get_time() self.info_dict.update({ "carrier": carrier, "city": city, "location": location, "name": name, "phone_type": phone_type, "state": state, "time": time }) print() return self.info_dict
[ 1, 9995, 8809, 542, 497, 333, 29889, 510, 2740, 3883, 15945, 29908, 13, 3166, 4770, 29888, 9130, 1649, 1053, 1596, 29918, 2220, 13, 3166, 4770, 29888, 9130, 1649, 1053, 8380, 29918, 5215, 13, 3166, 6317, 3188, 1053, 9305, 29954, 4201, 495, 13, 3166, 2023, 27703, 29889, 4381, 29918, 27703, 1053, 13109, 8434, 1625, 943, 408, 289, 29883, 13, 5215, 337, 13, 5215, 12183, 13, 2202, 29901, 13, 1678, 1053, 4770, 16145, 262, 1649, 408, 4768, 13, 19499, 7399, 2451, 29901, 13, 1678, 1053, 4240, 1144, 408, 4768, 13, 13, 13, 1990, 11644, 5594, 1204, 29954, 4201, 495, 29898, 5074, 29954, 4201, 495, 1125, 13, 1678, 9995, 13, 1678, 11644, 5594, 1367, 16538, 24559, 546, 363, 11837, 4382, 6710, 1106, 14340, 13, 1678, 9995, 13, 13, 1678, 822, 679, 29918, 978, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 22351, 278, 4160, 1024, 13, 4706, 9995, 13, 4706, 1024, 353, 376, 14148, 29908, 13, 4706, 1018, 29901, 13, 9651, 1024, 353, 1583, 29889, 29879, 1132, 29889, 2886, 877, 29882, 29906, 742, 12421, 29879, 3790, 29915, 1990, 2396, 525, 978, 29915, 1800, 13, 9651, 565, 1024, 29901, 13, 18884, 1024, 353, 1024, 29889, 726, 29889, 17010, 580, 13, 18884, 1596, 703, 29871, 6796, 718, 289, 29883, 29889, 11135, 29934, 29940, 718, 376, 13578, 718, 289, 29883, 29889, 29907, 11794, 718, 376, 29962, 376, 718, 13, 462, 418, 289, 29883, 29889, 29907, 19386, 718, 376, 1170, 29901, 376, 718, 289, 29883, 29889, 29907, 11794, 718, 851, 29898, 978, 876, 13, 4706, 5174, 7399, 2451, 29901, 13, 9651, 1209, 13, 4706, 7146, 29901, 13, 9651, 736, 1024, 13, 13, 1678, 822, 679, 29918, 5479, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 3617, 278, 4423, 13, 4706, 9995, 13, 4706, 4423, 353, 376, 14148, 29908, 13, 4706, 1018, 29901, 13, 9651, 4423, 353, 1583, 29889, 29879, 1132, 29889, 2886, 877, 29882, 29941, 742, 12421, 29879, 3790, 29915, 1990, 2396, 525, 5479, 29915, 1800, 13, 9651, 565, 4423, 29901, 13, 18884, 4423, 353, 4423, 29889, 726, 29889, 17010, 580, 13, 18884, 1596, 703, 29871, 6796, 718, 289, 29883, 29889, 11135, 29934, 29940, 718, 376, 13578, 718, 289, 29883, 29889, 29907, 11794, 718, 376, 29962, 376, 718, 13, 462, 418, 289, 29883, 29889, 29907, 19386, 718, 376, 6508, 29901, 376, 718, 289, 29883, 29889, 29907, 11794, 718, 851, 29898, 5479, 876, 13, 4706, 5174, 7399, 2451, 29901, 13, 9651, 1209, 13, 4706, 7146, 29901, 13, 9651, 736, 4423, 13, 13, 1678, 822, 679, 29918, 6710, 29918, 1853, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 3617, 278, 9008, 1134, 13, 4706, 9995, 13, 4706, 9008, 29918, 1853, 353, 376, 14148, 29908, 13, 4706, 1018, 29901, 13, 9651, 9008, 29918, 1853, 353, 1583, 29889, 29879, 1132, 29889, 2886, 703, 2492, 2564, 5552, 29879, 1839, 1997, 2033, 13, 9651, 565, 9008, 29918, 1853, 29901, 13, 18884, 9008, 29918, 1853, 353, 9008, 29918, 1853, 29889, 17010, 580, 13, 18884, 1596, 703, 29871, 6796, 718, 289, 29883, 29889, 11135, 29934, 29940, 718, 376, 13578, 718, 289, 29883, 29889, 29907, 11794, 718, 376, 29962, 376, 718, 13, 462, 418, 289, 29883, 29889, 29907, 19386, 718, 376, 9861, 5167, 29901, 376, 718, 289, 29883, 29889, 29907, 11794, 718, 851, 29898, 6710, 29918, 1853, 876, 13, 4706, 5174, 7399, 2451, 29901, 13, 9651, 1209, 13, 4706, 7146, 29901, 13, 9651, 736, 9008, 29918, 1853, 13, 13, 1678, 822, 679, 29918, 4287, 4336, 29898, 1311, 29892, 9008, 29918, 4537, 1125, 13, 4706, 9995, 13, 4706, 3617, 278, 9008, 1559, 4336, 5235, 13, 4706, 9995, 13, 4706, 1559, 4336, 353, 5124, 13, 4706, 1018, 29901, 13, 9651, 1583, 29889, 2271, 353, 376, 991, 597, 1332, 18642, 430, 29889, 510, 29914, 29974, 29896, 8875, 29973, 4287, 4336, 1642, 4830, 29898, 6710, 29918, 4537, 29897, 13, 9651, 1583, 29889, 4993, 353, 1583, 29889, 657, 29918, 4993, 29898, 1311, 29889, 2271, 29897, 13, 9651, 1583, 29889, 29879, 1132, 353, 1583, 29889, 657, 29918, 3129, 29898, 1311, 29889, 4993, 29897, 13, 9651, 1559, 4336, 353, 22300, 29889, 2886, 877, 9653, 742, 12421, 29879, 3790, 29915, 1990, 2396, 525, 4287, 4336, 29915, 1800, 13, 4706, 5174, 7399, 2451, 29901, 13, 9651, 1209, 13, 4706, 7146, 29901, 13, 9651, 736, 1559, 4336, 13, 13, 1678, 822, 1889, 29918, 4287, 4336, 29898, 1311, 29892, 1559, 4336, 1125, 13, 4706, 9995, 13, 4706, 11190, 278, 1559, 4336, 5235, 322, 1889, 372, 13, 4706, 9995, 13, 4706, 1018, 29901, 13, 9651, 565, 1559, 4336, 29901, 13, 18884, 1559, 4336, 353, 1559, 4336, 29889, 726, 13, 18884, 1596, 703, 29871, 6796, 718, 289, 29883, 29889, 11135, 29934, 29940, 718, 376, 13578, 718, 289, 29883, 29889, 29907, 11794, 718, 376, 29962, 376, 718, 13, 462, 418, 289, 29883, 29889, 29907, 19386, 718, 376, 8179, 4336, 29901, 376, 718, 289, 29883, 29889, 29907, 11794, 718, 851, 29898, 4287, 4336, 876, 13, 9651, 1683, 29901, 13, 18884, 1559, 4336, 353, 5124, 13, 4706, 5174, 7399, 2451, 29901, 13, 9651, 1559, 4336, 353, 5124, 13, 4706, 7146, 29901, 13, 9651, 736, 1559, 4336, 13, 13, 1678, 822, 679, 29918, 12690, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 22351, 278, 4272, 5235, 13, 4706, 9995, 13, 4706, 4272, 353, 5124, 13, 4706, 1018, 29901, 13, 9651, 4272, 353, 1583, 29889, 29879, 1132, 29889, 2886, 877, 9653, 742, 12421, 29879, 3790, 29915, 1990, 2396, 525, 12690, 29915, 1800, 13, 9651, 565, 4272, 29901, 13, 18884, 4272, 353, 4272, 29889, 726, 13, 18884, 1596, 703, 29871, 6796, 718, 289, 29883, 29889, 11135, 29934, 29940, 718, 376, 13578, 718, 289, 29883, 29889, 29907, 11794, 718, 376, 29962, 376, 718, 13, 462, 418, 289, 29883, 29889, 29907, 19386, 718, 376, 16885, 29901, 376, 718, 289, 29883, 29889, 29907, 11794, 718, 851, 29898, 12690, 876, 13, 4706, 5174, 7399, 2451, 29901, 13, 9651, 1209, 13, 4706, 7146, 29901, 13, 9651, 736, 4272, 13, 13, 1678, 822, 679, 29918, 3859, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 22351, 278, 2106, 5235, 13, 4706, 9995, 13, 4706, 2106, 353, 5124, 13, 4706, 1018, 29901, 13, 9651, 2106, 353, 1583, 29889, 29879, 1132, 29889, 2886, 877, 9653, 742, 12421, 29879, 3790, 29915, 1990, 2396, 525, 3859, 29915, 1800, 13, 9651, 565, 2106, 29901, 13, 18884, 2106, 353, 2106, 29889, 726, 13, 18884, 1596, 703, 29871, 6796, 718, 289, 29883, 29889, 11135, 29934, 29940, 718, 376, 13578, 718, 289, 29883, 29889, 29907, 11794, 718, 376, 29962, 376, 718, 13, 462, 418, 289, 29883, 29889, 29907, 19386, 718, 376, 2792, 29901, 376, 718, 289, 29883, 29889, 29907, 11794, 718, 851, 29898, 3859, 876, 13, 4706, 5174, 7399, 2451, 29901, 13, 9651, 1209, 13, 4706, 7146, 29901, 13, 9651, 736, 2106, 13, 13, 1678, 822, 679, 29918, 2230, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 22351, 931, 5235, 13, 4706, 9995, 13, 4706, 931, 353, 5124, 13, 4706, 1018, 29901, 13, 9651, 931, 353, 1583, 29889, 29879, 1132, 29889, 2886, 877, 9653, 742, 12421, 29879, 3790, 29915, 1990, 2396, 525, 2230, 29915, 1800, 13, 9651, 565, 931, 29901, 13, 18884, 931, 353, 931, 29889, 726, 13, 18884, 1596, 703, 29871, 6796, 718, 289, 29883, 29889, 11135, 29934, 29940, 718, 376, 13578, 718, 289, 29883, 29889, 29907, 11794, 718, 376, 29962, 376, 718, 13, 462, 418, 289, 29883, 29889, 29907, 19386, 718, 376, 2481, 29901, 376, 718, 289, 29883, 29889, 29907, 11794, 718, 851, 29898, 2230, 876, 13, 4706, 5174, 7399, 2451, 29901, 13, 9651, 1209, 13, 4706, 7146, 29901, 13, 9651, 736, 931, 13, 13, 1678, 822, 679, 29918, 3888, 29898, 1311, 29892, 9008, 29918, 4537, 29892, 16280, 1125, 13, 4706, 9995, 13, 4706, 10729, 29892, 24559, 412, 322, 736, 1819, 1476, 13, 4706, 9995, 13, 4706, 1596, 703, 3366, 718, 289, 29883, 29889, 6271, 29934, 29925, 718, 376, 3026, 718, 289, 29883, 29889, 29907, 11794, 718, 376, 29962, 376, 718, 13, 795, 289, 29883, 29889, 4174, 29979, 29940, 718, 376, 22110, 7856, 430, 29908, 718, 289, 29883, 29889, 29907, 11794, 29897, 13, 4706, 396, 3617, 9008, 5235, 13, 4706, 1583, 29889, 2271, 353, 525, 991, 597, 1332, 18642, 430, 29889, 510, 29914, 29974, 29896, 8875, 4286, 4830, 29898, 6710, 29918, 4537, 29897, 13, 4706, 1583, 29889, 4993, 353, 1583, 29889, 657, 29918, 4993, 29898, 1311, 29889, 2271, 29897, 13, 4706, 1583, 29889, 29879, 1132, 353, 1583, 29889, 657, 29918, 3129, 29898, 1311, 29889, 4993, 29897, 13, 308, 13, 4706, 1018, 29901, 13, 9651, 565, 1583, 29889, 29879, 1132, 29889, 2587, 29889, 2886, 29918, 497, 29898, 1807, 29922, 276, 29889, 12198, 29898, 13, 462, 1678, 525, 5575, 29912, 29900, 1836, 29930, 4286, 4830, 877, 13509, 1495, 511, 16732, 29922, 5574, 1125, 13, 18884, 1596, 703, 29871, 6796, 718, 289, 29883, 29889, 29907, 19386, 718, 376, 29990, 29908, 718, 289, 29883, 29889, 29907, 11794, 718, 376, 29962, 376, 718, 13, 462, 418, 289, 29883, 29889, 29907, 29979, 29931, 29956, 718, 376, 3782, 11644, 5594, 1367, 848, 4133, 29905, 29876, 29908, 718, 289, 29883, 29889, 29907, 11794, 29897, 13, 18884, 736, 13, 4706, 5174, 29901, 13, 9651, 1596, 703, 29871, 6796, 718, 289, 29883, 29889, 29907, 19386, 718, 376, 29990, 29908, 718, 289, 29883, 29889, 29907, 11794, 718, 376, 29962, 376, 718, 13, 462, 29871, 289, 29883, 29889, 29907, 29979, 29931, 29956, 718, 376, 2525, 519, 304, 6597, 848, 29889, 1317, 278, 3268, 7395, 29973, 29905, 29876, 29908, 718, 289, 29883, 29889, 29907, 11794, 29897, 13, 13, 4706, 1024, 353, 1583, 29889, 657, 29918, 978, 580, 13, 4706, 4423, 353, 1583, 29889, 657, 29918, 5479, 580, 13, 4706, 9008, 29918, 1853, 353, 1583, 29889, 657, 29918, 6710, 29918, 1853, 580, 13, 4706, 1559, 4336, 353, 1583, 29889, 657, 29918, 4287, 4336, 29898, 6710, 29918, 4537, 29897, 13, 4706, 1559, 4336, 353, 1583, 29889, 5014, 29918, 4287, 4336, 29898, 4287, 4336, 29897, 13, 4706, 4272, 353, 1583, 29889, 657, 29918, 12690, 580, 13, 4706, 2106, 353, 1583, 29889, 657, 29918, 3859, 580, 13, 4706, 931, 353, 1583, 29889, 657, 29918, 2230, 580, 13, 13, 4706, 1583, 29889, 3888, 29918, 8977, 29889, 5504, 3319, 13, 9651, 376, 4287, 4336, 1115, 1559, 4336, 29892, 13, 9651, 376, 12690, 1115, 4272, 29892, 13, 9651, 376, 5479, 1115, 4423, 29892, 13, 9651, 376, 978, 1115, 1024, 29892, 13, 9651, 376, 6710, 29918, 1853, 1115, 9008, 29918, 1853, 29892, 13, 9651, 376, 3859, 1115, 2106, 29892, 13, 9651, 376, 2230, 1115, 931, 13, 4706, 5615, 13, 13, 4706, 1596, 580, 13, 4706, 736, 1583, 29889, 3888, 29918, 8977, 13, 2 ]
ooobuild/lo/sheet/dde_item_info.py
Amourspirit/ooo_uno_tmpl
0
1613870
<gh_stars>0 # coding: utf-8 # # Copyright 2022 :Barry-Thomas-Paul: Moss # # 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. # # Struct Class # this is a auto generated file generated by Cheetah # Namespace: com.sun.star.sheet # Libre Office Version: 7.3 from ooo.oenv.env_const import UNO_NONE import typing class DDEItemInfo(object): """ Struct Class describes an item of a DDE connection. A DDE connection consists of the DDE service name, the DDE topic and a list of DDE items which may contain cached result sets. **since** OOo 3.1 See Also: `API DDEItemInfo <https://api.libreoffice.org/docs/idl/ref/structcom_1_1sun_1_1star_1_1sheet_1_1DDEItemInfo.html>`_ """ __ooo_ns__: str = 'com.sun.star.sheet' __ooo_full_ns__: str = 'com.sun.star.sheet.DDEItemInfo' __ooo_type_name__: str = 'struct' typeName: str = 'com.sun.star.sheet.DDEItemInfo' """Literal Constant ``com.sun.star.sheet.DDEItemInfo``""" def __init__(self, Results: typing.Optional[typing.Tuple[typing.Tuple[object, ...], ...]] = UNO_NONE, Item: typing.Optional[str] = '') -> None: """ Constructor Arguments: Results (typing.Tuple[typing.Tuple[object, ...], ...], optional): Results value. Item (str, optional): Item value. """ super().__init__() if isinstance(Results, DDEItemInfo): oth: DDEItemInfo = Results self.Results = oth.Results self.Item = oth.Item return kargs = { "Results": Results, "Item": Item, } if kargs["Results"] is UNO_NONE: kargs["Results"] = None self._init(**kargs) def _init(self, **kwargs) -> None: self._results = kwargs["Results"] self._item = kwargs["Item"] @property def Results(self) -> typing.Tuple[typing.Tuple[object, ...], ...]: """ The results of the item cached from the last update of the DDE link if available. This sequence may be empty. """ return self._results @Results.setter def Results(self, value: typing.Tuple[typing.Tuple[object, ...], ...]) -> None: self._results = value @property def Item(self) -> str: """ The name of the DDE item. """ return self._item @Item.setter def Item(self, value: str) -> None: self._item = value __all__ = ['DDEItemInfo']
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 29937, 14137, 29901, 23616, 29899, 29947, 13, 29937, 13, 29937, 14187, 1266, 29871, 29906, 29900, 29906, 29906, 584, 4297, 719, 29899, 1349, 18902, 29899, 18275, 29901, 341, 2209, 13, 29937, 13, 29937, 10413, 21144, 1090, 278, 13380, 19245, 29892, 10079, 29871, 29906, 29889, 29900, 313, 1552, 376, 29931, 293, 1947, 1159, 13, 29937, 366, 1122, 451, 671, 445, 934, 5174, 297, 752, 13036, 411, 278, 19245, 29889, 13, 29937, 887, 1122, 4017, 263, 3509, 310, 278, 19245, 472, 13, 29937, 13, 29937, 268, 1732, 29901, 849, 7821, 29889, 4288, 29889, 990, 29914, 506, 11259, 29914, 27888, 1430, 1660, 29899, 29906, 29889, 29900, 13, 29937, 13, 29937, 25870, 3734, 491, 22903, 4307, 470, 15502, 304, 297, 5007, 29892, 7047, 13, 29937, 13235, 1090, 278, 19245, 338, 13235, 373, 385, 376, 3289, 8519, 29908, 350, 3289, 3235, 29892, 13, 29937, 399, 1806, 8187, 2692, 399, 1718, 29934, 13566, 29059, 6323, 8707, 29928, 22122, 29903, 8079, 13764, 29979, 476, 22255, 29892, 2845, 4653, 470, 2411, 2957, 29889, 13, 29937, 2823, 278, 19245, 363, 278, 2702, 4086, 14765, 1076, 11239, 322, 13, 29937, 27028, 1090, 278, 19245, 29889, 13, 29937, 13, 29937, 28771, 4134, 13, 29937, 445, 338, 263, 4469, 5759, 934, 5759, 491, 315, 4155, 801, 13, 29937, 14706, 3535, 29901, 419, 29889, 11445, 29889, 8508, 29889, 9855, 13, 29937, 8153, 276, 11367, 10079, 29901, 29871, 29955, 29889, 29941, 13, 3166, 288, 3634, 29889, 29877, 6272, 29889, 6272, 29918, 3075, 1053, 501, 6632, 29918, 29940, 12413, 13, 5215, 19229, 13, 13, 13, 1990, 360, 2287, 2001, 3401, 29898, 3318, 1125, 13, 1678, 9995, 13, 1678, 28771, 4134, 13, 13, 1678, 16612, 385, 2944, 310, 263, 360, 2287, 3957, 29889, 13, 268, 13, 1678, 319, 360, 2287, 3957, 11624, 310, 278, 360, 2287, 2669, 1024, 29892, 278, 360, 2287, 11261, 322, 263, 1051, 310, 360, 2287, 4452, 607, 1122, 1712, 22152, 1121, 6166, 29889, 13, 268, 13, 1678, 3579, 16076, 1068, 13, 268, 13, 4706, 438, 29949, 29877, 29871, 29941, 29889, 29896, 13, 13, 1678, 2823, 3115, 29901, 13, 4706, 421, 8787, 360, 2287, 2001, 3401, 529, 991, 597, 2754, 29889, 492, 1030, 20205, 29889, 990, 29914, 2640, 29914, 333, 29880, 29914, 999, 29914, 4984, 510, 29918, 29896, 29918, 29896, 11445, 29918, 29896, 29918, 29896, 8508, 29918, 29896, 29918, 29896, 9855, 29918, 29896, 29918, 29896, 29928, 2287, 2001, 3401, 29889, 1420, 13885, 29918, 13, 1678, 9995, 13, 1678, 4770, 3634, 29877, 29918, 1983, 1649, 29901, 851, 353, 525, 510, 29889, 11445, 29889, 8508, 29889, 9855, 29915, 13, 1678, 4770, 3634, 29877, 29918, 8159, 29918, 1983, 1649, 29901, 851, 353, 525, 510, 29889, 11445, 29889, 8508, 29889, 9855, 29889, 29928, 2287, 2001, 3401, 29915, 13, 1678, 4770, 3634, 29877, 29918, 1853, 29918, 978, 1649, 29901, 851, 353, 525, 4984, 29915, 13, 1678, 1134, 1170, 29901, 851, 353, 525, 510, 29889, 11445, 29889, 8508, 29889, 9855, 29889, 29928, 2287, 2001, 3401, 29915, 13, 1678, 9995, 24938, 284, 28601, 4954, 510, 29889, 11445, 29889, 8508, 29889, 9855, 29889, 29928, 2287, 2001, 3401, 16159, 15945, 29908, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 17212, 29901, 19229, 29889, 27636, 29961, 1017, 15702, 29889, 23215, 552, 29961, 1017, 15702, 29889, 23215, 552, 29961, 3318, 29892, 2023, 1402, 2023, 5262, 353, 501, 6632, 29918, 29940, 12413, 29892, 10976, 29901, 19229, 29889, 27636, 29961, 710, 29962, 353, 27255, 1599, 6213, 29901, 13, 4706, 9995, 13, 4706, 1281, 18769, 13, 13, 4706, 11842, 9331, 29901, 13, 9651, 17212, 313, 1017, 15702, 29889, 23215, 552, 29961, 1017, 15702, 29889, 23215, 552, 29961, 3318, 29892, 2023, 1402, 2023, 1402, 13136, 1125, 17212, 995, 29889, 13, 9651, 10976, 313, 710, 29892, 13136, 1125, 10976, 995, 29889, 13, 4706, 9995, 13, 4706, 2428, 2141, 1649, 2344, 1649, 580, 13, 13, 4706, 565, 338, 8758, 29898, 12191, 29892, 360, 2287, 2001, 3401, 1125, 13, 9651, 288, 386, 29901, 360, 2287, 2001, 3401, 353, 17212, 13, 9651, 1583, 29889, 12191, 353, 288, 386, 29889, 12191, 13, 9651, 1583, 29889, 2001, 353, 288, 386, 29889, 2001, 13, 9651, 736, 13, 13, 4706, 413, 5085, 353, 426, 13, 9651, 376, 12191, 1115, 17212, 29892, 13, 9651, 376, 2001, 1115, 10976, 29892, 13, 4706, 500, 13, 4706, 565, 413, 5085, 3366, 12191, 3108, 338, 501, 6632, 29918, 29940, 12413, 29901, 13, 9651, 413, 5085, 3366, 12191, 3108, 353, 6213, 13, 4706, 1583, 3032, 2344, 29898, 1068, 29895, 5085, 29897, 13, 13, 1678, 822, 903, 2344, 29898, 1311, 29892, 3579, 19290, 29897, 1599, 6213, 29901, 13, 4706, 1583, 3032, 9902, 353, 9049, 5085, 3366, 12191, 3108, 13, 4706, 1583, 3032, 667, 353, 9049, 5085, 3366, 2001, 3108, 13, 13, 13, 1678, 732, 6799, 13, 1678, 822, 17212, 29898, 1311, 29897, 1599, 19229, 29889, 23215, 552, 29961, 1017, 15702, 29889, 23215, 552, 29961, 3318, 29892, 2023, 1402, 2023, 5387, 13, 4706, 9995, 13, 4706, 450, 2582, 310, 278, 2944, 22152, 515, 278, 1833, 2767, 310, 278, 360, 2287, 1544, 565, 3625, 29889, 13, 308, 13, 4706, 910, 5665, 1122, 367, 4069, 29889, 13, 4706, 9995, 13, 4706, 736, 1583, 3032, 9902, 13, 268, 13, 1678, 732, 12191, 29889, 842, 357, 13, 1678, 822, 17212, 29898, 1311, 29892, 995, 29901, 19229, 29889, 23215, 552, 29961, 1017, 15702, 29889, 23215, 552, 29961, 3318, 29892, 2023, 1402, 2023, 2314, 1599, 6213, 29901, 13, 4706, 1583, 3032, 9902, 353, 995, 13, 13, 1678, 732, 6799, 13, 1678, 822, 10976, 29898, 1311, 29897, 1599, 851, 29901, 13, 4706, 9995, 13, 4706, 450, 1024, 310, 278, 360, 2287, 2944, 29889, 13, 4706, 9995, 13, 4706, 736, 1583, 3032, 667, 13, 268, 13, 1678, 732, 2001, 29889, 842, 357, 13, 1678, 822, 10976, 29898, 1311, 29892, 995, 29901, 851, 29897, 1599, 6213, 29901, 13, 4706, 1583, 3032, 667, 353, 995, 13, 13, 13, 1649, 497, 1649, 353, 6024, 29928, 2287, 2001, 3401, 2033, 13, 2 ]
minato_namikaze/bot_files/lib/functions/user.py
ooliver1/yondaime-hokage
1
109646
from typing import Optional, Union import discord async def get_dm(user: Optional[Union[int, discord.Member]], ctx=None): if isinstance(user, int): user = ctx.bot.get_user(user) return user.dm_channel if user.dm_channel else await user.create_dm() def get_user(user: Union[int, discord.Member], ctx=None): if isinstance(user, int): user = ctx.bot.get_user(user) return user def get_roles(role: Union[int, discord.Role], ctx=None): if isinstance(role, int): role = discord.utils.get(ctx.guild.roles, id=role) return role async def get_bot_inviter(guild: discord.Guild, bot: discord.Client): try: async for i in guild.audit_logs(limit=1): return i.user except: return guild.owner async def get_or_fetch_member(guild, member_id): """Looks up a member in cache or fetches if not found. Parameters ----------- guild: Guild The guild to look in. member_id: int The member ID to search for. Returns --------- Optional[Member] The member or None if not found. """ member = guild.get_member(member_id) if member is not None: return member shard = self.get_shard(guild.shard_id) if shard.is_ws_ratelimited(): try: member = await guild.fetch_member(member_id) except discord.HTTPException: return None else: return member members = await guild.query_members(limit=1, user_ids=[member_id], cache=True) if not members: return None return members[0] async def resolve_member_ids(guild, member_ids): """Bulk resolves member IDs to member instances, if possible. Members that can't be resolved are discarded from the list. This is done lazily using an asynchronous iterator. Note that the order of the resolved members is not the same as the input. Parameters ----------- guild: Guild The guild to resolve from. member_ids: Iterable[int] An iterable of member IDs. Yields -------- Member The resolved members. """ needs_resolution = [] for member_id in member_ids: member = guild.get_member(member_id) if member is not None: yield member else: needs_resolution.append(member_id) total_need_resolution = len(needs_resolution) if total_need_resolution == 1: shard = self.get_shard(guild.shard_id) if shard.is_ws_ratelimited(): try: member = await guild.fetch_member(needs_resolution[0]) except discord.HTTPException: pass else: yield member else: members = await guild.query_members(limit=1, user_ids=needs_resolution, cache=True) if members: yield members[0] elif total_need_resolution <= 100: # Only a single resolution call needed here resolved = await guild.query_members(limit=100, user_ids=needs_resolution, cache=True) for member in resolved: yield member else: # We need to chunk these in bits of 100... for index in range(0, total_need_resolution, 100): to_resolve = needs_resolution[index : index + 100] members = await guild.query_members(limit=100, user_ids=to_resolve, cache=True) for member in members: yield member
[ 1, 515, 19229, 1053, 28379, 29892, 7761, 13, 13, 5215, 2313, 536, 13, 13, 13, 12674, 822, 679, 29918, 18933, 29898, 1792, 29901, 28379, 29961, 19986, 29961, 524, 29892, 2313, 536, 29889, 13404, 20526, 12893, 29922, 8516, 1125, 13, 1678, 565, 338, 8758, 29898, 1792, 29892, 938, 1125, 13, 4706, 1404, 353, 12893, 29889, 7451, 29889, 657, 29918, 1792, 29898, 1792, 29897, 13, 1678, 736, 1404, 29889, 18933, 29918, 12719, 565, 1404, 29889, 18933, 29918, 12719, 1683, 7272, 1404, 29889, 3258, 29918, 18933, 580, 13, 13, 13, 1753, 679, 29918, 1792, 29898, 1792, 29901, 7761, 29961, 524, 29892, 2313, 536, 29889, 13404, 1402, 12893, 29922, 8516, 1125, 13, 1678, 565, 338, 8758, 29898, 1792, 29892, 938, 1125, 13, 4706, 1404, 353, 12893, 29889, 7451, 29889, 657, 29918, 1792, 29898, 1792, 29897, 13, 1678, 736, 1404, 13, 13, 13, 1753, 679, 29918, 307, 793, 29898, 12154, 29901, 7761, 29961, 524, 29892, 2313, 536, 29889, 16727, 1402, 12893, 29922, 8516, 1125, 13, 1678, 565, 338, 8758, 29898, 12154, 29892, 938, 1125, 13, 4706, 6297, 353, 2313, 536, 29889, 13239, 29889, 657, 29898, 13073, 29889, 2543, 789, 29889, 307, 793, 29892, 1178, 29922, 12154, 29897, 13, 1678, 736, 6297, 13, 13, 13, 12674, 822, 679, 29918, 7451, 29918, 11569, 1524, 29898, 2543, 789, 29901, 2313, 536, 29889, 9485, 789, 29892, 9225, 29901, 2313, 536, 29889, 4032, 1125, 13, 1678, 1018, 29901, 13, 4706, 7465, 363, 474, 297, 1410, 789, 29889, 15052, 277, 29918, 20756, 29898, 13400, 29922, 29896, 1125, 13, 9651, 736, 474, 29889, 1792, 13, 1678, 5174, 29901, 13, 4706, 736, 1410, 789, 29889, 20348, 13, 13, 13, 13, 12674, 822, 679, 29918, 272, 29918, 9155, 29918, 14242, 29898, 2543, 789, 29892, 4509, 29918, 333, 1125, 13, 1678, 9995, 14959, 29879, 701, 263, 4509, 297, 7090, 470, 6699, 267, 565, 451, 1476, 29889, 13, 1678, 12662, 2699, 13, 1678, 448, 28400, 13, 1678, 1410, 789, 29901, 2088, 789, 13, 4706, 450, 1410, 789, 304, 1106, 297, 29889, 13, 1678, 4509, 29918, 333, 29901, 938, 13, 4706, 450, 4509, 3553, 304, 2740, 363, 29889, 13, 1678, 16969, 13, 1678, 448, 1378, 13, 1678, 28379, 29961, 13404, 29962, 13, 4706, 450, 4509, 470, 6213, 565, 451, 1476, 29889, 13, 1678, 9995, 13, 1678, 4509, 353, 1410, 789, 29889, 657, 29918, 14242, 29898, 14242, 29918, 333, 29897, 13, 1678, 565, 4509, 338, 451, 6213, 29901, 13, 4706, 736, 4509, 13, 268, 13, 1678, 528, 538, 353, 1583, 29889, 657, 29918, 845, 538, 29898, 2543, 789, 29889, 845, 538, 29918, 333, 29897, 13, 1678, 565, 528, 538, 29889, 275, 29918, 5652, 29918, 3605, 295, 326, 1573, 7295, 13, 4706, 1018, 29901, 13, 9651, 4509, 353, 7272, 1410, 789, 29889, 9155, 29918, 14242, 29898, 14242, 29918, 333, 29897, 13, 4706, 5174, 2313, 536, 29889, 10493, 2451, 29901, 13, 9651, 736, 6213, 13, 4706, 1683, 29901, 13, 9651, 736, 4509, 13, 13, 1678, 5144, 353, 7272, 1410, 789, 29889, 1972, 29918, 28109, 29898, 13400, 29922, 29896, 29892, 1404, 29918, 4841, 11759, 14242, 29918, 333, 1402, 7090, 29922, 5574, 29897, 13, 1678, 565, 451, 5144, 29901, 13, 4706, 736, 6213, 13, 1678, 736, 5144, 29961, 29900, 29962, 13, 13, 12674, 822, 8814, 29918, 14242, 29918, 4841, 29898, 2543, 789, 29892, 4509, 29918, 4841, 1125, 13, 1678, 9995, 29933, 24456, 3770, 1960, 4509, 23481, 304, 4509, 8871, 29892, 565, 1950, 29889, 13, 1678, 341, 13415, 393, 508, 29915, 29873, 367, 11527, 526, 2313, 25600, 515, 278, 1051, 29889, 13, 1678, 910, 338, 2309, 425, 29920, 2354, 773, 385, 20489, 20380, 29889, 13, 1678, 3940, 393, 278, 1797, 310, 278, 11527, 5144, 338, 451, 278, 1021, 408, 278, 1881, 29889, 13, 1678, 12662, 2699, 13, 1678, 448, 28400, 13, 1678, 1410, 789, 29901, 2088, 789, 13, 4706, 450, 1410, 789, 304, 8814, 515, 29889, 13, 1678, 4509, 29918, 4841, 29901, 20504, 519, 29961, 524, 29962, 13, 4706, 530, 4256, 519, 310, 4509, 23481, 29889, 13, 1678, 612, 969, 29879, 13, 1678, 448, 26589, 13, 1678, 19495, 13, 4706, 450, 11527, 5144, 29889, 13, 1678, 9995, 13, 1678, 4225, 29918, 9778, 918, 353, 5159, 13, 1678, 363, 4509, 29918, 333, 297, 4509, 29918, 4841, 29901, 13, 4706, 4509, 353, 1410, 789, 29889, 657, 29918, 14242, 29898, 14242, 29918, 333, 29897, 13, 4706, 565, 4509, 338, 451, 6213, 29901, 13, 9651, 7709, 4509, 13, 4706, 1683, 29901, 13, 9651, 4225, 29918, 9778, 918, 29889, 4397, 29898, 14242, 29918, 333, 29897, 13, 13, 1678, 3001, 29918, 26180, 29918, 9778, 918, 353, 7431, 29898, 484, 5779, 29918, 9778, 918, 29897, 13, 1678, 565, 3001, 29918, 26180, 29918, 9778, 918, 1275, 29871, 29896, 29901, 13, 4706, 528, 538, 353, 1583, 29889, 657, 29918, 845, 538, 29898, 2543, 789, 29889, 845, 538, 29918, 333, 29897, 13, 4706, 565, 528, 538, 29889, 275, 29918, 5652, 29918, 3605, 295, 326, 1573, 7295, 13, 9651, 1018, 29901, 13, 18884, 4509, 353, 7272, 1410, 789, 29889, 9155, 29918, 14242, 29898, 484, 5779, 29918, 9778, 918, 29961, 29900, 2314, 13, 9651, 5174, 2313, 536, 29889, 10493, 2451, 29901, 13, 18884, 1209, 13, 9651, 1683, 29901, 13, 18884, 7709, 4509, 13, 4706, 1683, 29901, 13, 9651, 5144, 353, 7272, 1410, 789, 29889, 1972, 29918, 28109, 29898, 13400, 29922, 29896, 29892, 1404, 29918, 4841, 29922, 484, 5779, 29918, 9778, 918, 29892, 7090, 29922, 5574, 29897, 13, 9651, 565, 5144, 29901, 13, 18884, 7709, 5144, 29961, 29900, 29962, 13, 1678, 25342, 3001, 29918, 26180, 29918, 9778, 918, 5277, 29871, 29896, 29900, 29900, 29901, 13, 4706, 396, 9333, 263, 2323, 10104, 1246, 4312, 1244, 13, 4706, 11527, 353, 7272, 1410, 789, 29889, 1972, 29918, 28109, 29898, 13400, 29922, 29896, 29900, 29900, 29892, 1404, 29918, 4841, 29922, 484, 5779, 29918, 9778, 918, 29892, 7090, 29922, 5574, 29897, 13, 4706, 363, 4509, 297, 11527, 29901, 13, 9651, 7709, 4509, 13, 1678, 1683, 29901, 13, 4706, 396, 1334, 817, 304, 19875, 1438, 297, 9978, 310, 29871, 29896, 29900, 29900, 856, 13, 4706, 363, 2380, 297, 3464, 29898, 29900, 29892, 3001, 29918, 26180, 29918, 9778, 918, 29892, 29871, 29896, 29900, 29900, 1125, 13, 9651, 304, 29918, 17863, 353, 4225, 29918, 9778, 918, 29961, 2248, 584, 2380, 718, 29871, 29896, 29900, 29900, 29962, 13, 9651, 5144, 353, 7272, 1410, 789, 29889, 1972, 29918, 28109, 29898, 13400, 29922, 29896, 29900, 29900, 29892, 1404, 29918, 4841, 29922, 517, 29918, 17863, 29892, 7090, 29922, 5574, 29897, 13, 9651, 363, 4509, 297, 5144, 29901, 13, 18884, 7709, 4509, 13, 2 ]
shinrl/__init__.py
qqhann/ShinRL
0
1608296
from gym.envs.registration import register # Common mathmetical (jitted) functions & classes. from ._calc.backup_dp import ( calc_optimal_q, calc_q, calc_return, calc_visit, double_backup_dp, expected_backup_dp, munchausen_backup_dp, optimal_backup_dp, soft_expected_backup_dp, ) from ._calc.backup_rl import ( double_backup_rl, expected_backup_rl, munchausen_backup_rl, optimal_backup_rl, soft_expected_backup_rl, ) from ._calc.build_net import build_forward_conv, build_forward_fc, build_net_act from ._calc.collect_samples import ACT_FN, Sample, collect_samples, make_replay_buffer from ._calc.draw import draw_circle, line_aa from ._calc.epsilon_greedy import calc_eps from ._calc.loss import cross_entropy_loss, huber_loss, kl_loss, l2_loss from ._calc.mdp import MDP from ._calc.moving_average import calc_ma from ._calc.sparse import SparseMat, sp_mul, sp_mul_t # Common useful functions & classes. from ._utils.config import Config from ._utils.jittable import DictJittable from ._utils.log import add_logfile_handler, initialize_log_style from ._utils.minatar import make_minatar from ._utils.params import ParamsDict from ._utils.prepare_history_dir import prepare_history_dir from ._utils.scalars import Scalars from ._utils.tables import TbDict # Implemented environments with access to the *oracle* quantities. from .envs.base.config import EnvConfig from .envs.base.env import OBS_FN, REW_FN, TRAN_FN, ShinEnv from .envs.cartpole.env import CartPole from .envs.maze.env import Maze from .envs.mountaincar.env import MountainCar from .envs.pendulum.env import Pendulum # Implemented environments with access to the *oracle* quantities. from .solvers.base.core.config import SolverConfig from .solvers.base.core.history import History from .solvers.base.core.mixin import ( GymEvalMixIn, GymExploreMixIn, ShinEvalMixIn, ShinExploreMixIn, ) from .solvers.base.solver import Solver from .solvers.pi.discrete.solver import DiscretePiSolver from .solvers.vi.discrete.solver import DiscreteViSolver initialize_log_style() # ----- register envs ----- register( id="ShinMaze-v0", entry_point="shinrl:Maze", kwargs={"config": Maze.DefaultConfig()}, ) register( id="ShinPendulum-v0", entry_point="shinrl:Pendulum", kwargs={"config": Pendulum.DefaultConfig()}, ) register( id="ShinPendulumContinuous-v0", entry_point="shinrl:Pendulum", kwargs={"config": Pendulum.DefaultConfig(act_mode="continuous", dA=50)}, ) register( id="ShinPendulumImage-v0", entry_point="shinrl:Pendulum", kwargs={"config": Pendulum.DefaultConfig(obs_mode="image")}, ) register( id="ShinPendulumImageContinuous-v0", entry_point="shinrl:Pendulum", kwargs={ "config": Pendulum.DefaultConfig(act_mode="continuous", dA=50, obs_mode="image") }, ) register( id="ShinMountainCar-v0", entry_point="shinrl:MountainCar", kwargs={"config": MountainCar.DefaultConfig()}, ) register( id="ShinMountainCarContinuous-v0", entry_point="shinrl:MountainCar", kwargs={"config": MountainCar.DefaultConfig(act_mode="continuous", dA=50)}, ) register( id="ShinMountainCarImage-v0", entry_point="shinrl:MountainCar", kwargs={"config": MountainCar.DefaultConfig(obs_mode="image")}, ) register( id="ShinMountainCarImageContinuous-v0", entry_point="shinrl:MountainCar", kwargs={ "config": MountainCar.DefaultConfig( act_mode="continuous", dA=50, obs_mode="image" ) }, ) register( id="ShinCartPole-v0", entry_point="shinrl:CartPole", kwargs={"config": CartPole.DefaultConfig()}, ) register( id="ShinCartPoleContinuous-v0", entry_point="shinrl:CartPole", kwargs={"config": CartPole.DefaultConfig(act_mode="continuous", dA=50)}, )
[ 1, 515, 330, 962, 29889, 264, 4270, 29889, 1727, 8306, 1053, 6036, 13, 13, 29937, 13103, 5844, 2527, 936, 313, 29926, 4430, 29897, 3168, 669, 4413, 29889, 13, 3166, 869, 29918, 28667, 29889, 1627, 786, 29918, 6099, 1053, 313, 13, 1678, 22235, 29918, 3670, 3039, 29918, 29939, 29892, 13, 1678, 22235, 29918, 29939, 29892, 13, 1678, 22235, 29918, 2457, 29892, 13, 1678, 22235, 29918, 1730, 277, 29892, 13, 1678, 3765, 29918, 1627, 786, 29918, 6099, 29892, 13, 1678, 3806, 29918, 1627, 786, 29918, 6099, 29892, 13, 1678, 286, 3322, 1485, 264, 29918, 1627, 786, 29918, 6099, 29892, 13, 1678, 14413, 29918, 1627, 786, 29918, 6099, 29892, 13, 1678, 4964, 29918, 9684, 29918, 1627, 786, 29918, 6099, 29892, 13, 29897, 13, 3166, 869, 29918, 28667, 29889, 1627, 786, 29918, 2096, 1053, 313, 13, 1678, 3765, 29918, 1627, 786, 29918, 2096, 29892, 13, 1678, 3806, 29918, 1627, 786, 29918, 2096, 29892, 13, 1678, 286, 3322, 1485, 264, 29918, 1627, 786, 29918, 2096, 29892, 13, 1678, 14413, 29918, 1627, 786, 29918, 2096, 29892, 13, 1678, 4964, 29918, 9684, 29918, 1627, 786, 29918, 2096, 29892, 13, 29897, 13, 3166, 869, 29918, 28667, 29889, 4282, 29918, 1212, 1053, 2048, 29918, 11333, 29918, 20580, 29892, 2048, 29918, 11333, 29918, 13801, 29892, 2048, 29918, 1212, 29918, 627, 13, 3166, 869, 29918, 28667, 29889, 15914, 29918, 27736, 1053, 319, 1783, 29918, 29943, 29940, 29892, 21029, 29892, 6314, 29918, 27736, 29892, 1207, 29918, 276, 1456, 29918, 9040, 13, 3166, 869, 29918, 28667, 29889, 4012, 1053, 4216, 29918, 16622, 29892, 1196, 29918, 7340, 13, 3166, 869, 29918, 28667, 29889, 5463, 29918, 7979, 7584, 1053, 22235, 29918, 8961, 13, 3166, 869, 29918, 28667, 29889, 6758, 1053, 4891, 29918, 296, 14441, 29918, 6758, 29892, 298, 11234, 29918, 6758, 29892, 9489, 29918, 6758, 29892, 301, 29906, 29918, 6758, 13, 3166, 869, 29918, 28667, 29889, 3487, 29886, 1053, 341, 11191, 13, 3166, 869, 29918, 28667, 29889, 13529, 292, 29918, 12483, 482, 1053, 22235, 29918, 655, 13, 3166, 869, 29918, 28667, 29889, 29879, 5510, 1053, 317, 5510, 9782, 29892, 805, 29918, 16109, 29892, 805, 29918, 16109, 29918, 29873, 13, 13, 29937, 13103, 5407, 3168, 669, 4413, 29889, 13, 3166, 869, 29918, 13239, 29889, 2917, 1053, 12782, 13, 3166, 869, 29918, 13239, 29889, 29926, 986, 519, 1053, 360, 919, 29967, 986, 519, 13, 3166, 869, 29918, 13239, 29889, 1188, 1053, 788, 29918, 1188, 1445, 29918, 13789, 29892, 11905, 29918, 1188, 29918, 3293, 13, 3166, 869, 29918, 13239, 29889, 1195, 14873, 1053, 1207, 29918, 1195, 14873, 13, 3166, 869, 29918, 13239, 29889, 7529, 1053, 1459, 2232, 21533, 13, 3166, 869, 29918, 13239, 29889, 19125, 29918, 18434, 29918, 3972, 1053, 19012, 29918, 18434, 29918, 3972, 13, 3166, 869, 29918, 13239, 29889, 19529, 1503, 1053, 317, 1052, 1503, 13, 3166, 869, 29918, 13239, 29889, 24051, 1053, 323, 29890, 21533, 13, 13, 29937, 1954, 2037, 287, 23136, 411, 2130, 304, 278, 334, 11347, 29930, 26855, 29889, 13, 3166, 869, 264, 4270, 29889, 3188, 29889, 2917, 1053, 1174, 29894, 3991, 13, 3166, 869, 264, 4270, 29889, 3188, 29889, 6272, 1053, 438, 9851, 29918, 29943, 29940, 29892, 5195, 29956, 29918, 29943, 29940, 29892, 10014, 2190, 29918, 29943, 29940, 29892, 27948, 21745, 13, 3166, 869, 264, 4270, 29889, 13823, 15831, 29889, 6272, 1053, 12370, 29925, 1772, 13, 3166, 869, 264, 4270, 29889, 655, 911, 29889, 6272, 1053, 17326, 29872, 13, 3166, 869, 264, 4270, 29889, 16476, 475, 4287, 29889, 6272, 1053, 18204, 8179, 13, 3166, 869, 264, 4270, 29889, 14081, 352, 398, 29889, 6272, 1053, 349, 355, 352, 398, 13, 13, 29937, 1954, 2037, 287, 23136, 411, 2130, 304, 278, 334, 11347, 29930, 26855, 29889, 13, 3166, 869, 2929, 874, 29889, 3188, 29889, 3221, 29889, 2917, 1053, 4956, 369, 3991, 13, 3166, 869, 2929, 874, 29889, 3188, 29889, 3221, 29889, 18434, 1053, 5298, 13, 3166, 869, 2929, 874, 29889, 3188, 29889, 3221, 29889, 28084, 262, 1053, 313, 13, 1678, 402, 962, 29923, 791, 29924, 861, 797, 29892, 13, 1678, 402, 962, 1252, 572, 487, 29924, 861, 797, 29892, 13, 1678, 27948, 29923, 791, 29924, 861, 797, 29892, 13, 1678, 27948, 1252, 572, 487, 29924, 861, 797, 29892, 13, 29897, 13, 3166, 869, 2929, 874, 29889, 3188, 29889, 2929, 369, 1053, 4956, 369, 13, 3166, 869, 2929, 874, 29889, 1631, 29889, 2218, 9084, 29889, 2929, 369, 1053, 3295, 9084, 12197, 13296, 369, 13, 3166, 869, 2929, 874, 29889, 1403, 29889, 2218, 9084, 29889, 2929, 369, 1053, 3295, 9084, 29963, 29875, 13296, 369, 13, 13, 24926, 29918, 1188, 29918, 3293, 580, 13, 13, 13, 29937, 448, 807, 6036, 427, 4270, 448, 807, 13, 13, 13, 9573, 29898, 13, 1678, 1178, 543, 2713, 262, 29924, 28334, 29899, 29894, 29900, 613, 13, 1678, 6251, 29918, 3149, 543, 845, 262, 2096, 29901, 29924, 28334, 613, 13, 1678, 9049, 5085, 3790, 29908, 2917, 1115, 17326, 29872, 29889, 4592, 3991, 580, 1118, 13, 29897, 13, 13, 9573, 29898, 13, 1678, 1178, 543, 2713, 262, 29925, 355, 352, 398, 29899, 29894, 29900, 613, 13, 1678, 6251, 29918, 3149, 543, 845, 262, 2096, 29901, 29925, 355, 352, 398, 613, 13, 1678, 9049, 5085, 3790, 29908, 2917, 1115, 349, 355, 352, 398, 29889, 4592, 3991, 580, 1118, 13, 29897, 13, 13, 9573, 29898, 13, 1678, 1178, 543, 2713, 262, 29925, 355, 352, 398, 1323, 8675, 681, 29899, 29894, 29900, 613, 13, 1678, 6251, 29918, 3149, 543, 845, 262, 2096, 29901, 29925, 355, 352, 398, 613, 13, 1678, 9049, 5085, 3790, 29908, 2917, 1115, 349, 355, 352, 398, 29889, 4592, 3991, 29898, 627, 29918, 8513, 543, 20621, 681, 613, 270, 29909, 29922, 29945, 29900, 19230, 13, 29897, 13, 13, 9573, 29898, 13, 1678, 1178, 543, 2713, 262, 29925, 355, 352, 398, 2940, 29899, 29894, 29900, 613, 13, 1678, 6251, 29918, 3149, 543, 845, 262, 2096, 29901, 29925, 355, 352, 398, 613, 13, 1678, 9049, 5085, 3790, 29908, 2917, 1115, 349, 355, 352, 398, 29889, 4592, 3991, 29898, 26290, 29918, 8513, 543, 3027, 1159, 1118, 13, 29897, 13, 13, 9573, 29898, 13, 1678, 1178, 543, 2713, 262, 29925, 355, 352, 398, 2940, 1323, 8675, 681, 29899, 29894, 29900, 613, 13, 1678, 6251, 29918, 3149, 543, 845, 262, 2096, 29901, 29925, 355, 352, 398, 613, 13, 1678, 9049, 5085, 3790, 13, 4706, 376, 2917, 1115, 349, 355, 352, 398, 29889, 4592, 3991, 29898, 627, 29918, 8513, 543, 20621, 681, 613, 270, 29909, 29922, 29945, 29900, 29892, 20881, 29918, 8513, 543, 3027, 1159, 13, 1678, 2981, 13, 29897, 13, 13, 9573, 29898, 13, 1678, 1178, 543, 2713, 262, 27648, 475, 8179, 29899, 29894, 29900, 613, 13, 1678, 6251, 29918, 3149, 543, 845, 262, 2096, 29901, 27648, 475, 8179, 613, 13, 1678, 9049, 5085, 3790, 29908, 2917, 1115, 18204, 8179, 29889, 4592, 3991, 580, 1118, 13, 29897, 13, 13, 9573, 29898, 13, 1678, 1178, 543, 2713, 262, 27648, 475, 8179, 1323, 8675, 681, 29899, 29894, 29900, 613, 13, 1678, 6251, 29918, 3149, 543, 845, 262, 2096, 29901, 27648, 475, 8179, 613, 13, 1678, 9049, 5085, 3790, 29908, 2917, 1115, 18204, 8179, 29889, 4592, 3991, 29898, 627, 29918, 8513, 543, 20621, 681, 613, 270, 29909, 29922, 29945, 29900, 19230, 13, 29897, 13, 13, 9573, 29898, 13, 1678, 1178, 543, 2713, 262, 27648, 475, 8179, 2940, 29899, 29894, 29900, 613, 13, 1678, 6251, 29918, 3149, 543, 845, 262, 2096, 29901, 27648, 475, 8179, 613, 13, 1678, 9049, 5085, 3790, 29908, 2917, 1115, 18204, 8179, 29889, 4592, 3991, 29898, 26290, 29918, 8513, 543, 3027, 1159, 1118, 13, 29897, 13, 13, 9573, 29898, 13, 1678, 1178, 543, 2713, 262, 27648, 475, 8179, 2940, 1323, 8675, 681, 29899, 29894, 29900, 613, 13, 1678, 6251, 29918, 3149, 543, 845, 262, 2096, 29901, 27648, 475, 8179, 613, 13, 1678, 9049, 5085, 3790, 13, 4706, 376, 2917, 1115, 18204, 8179, 29889, 4592, 3991, 29898, 13, 9651, 1044, 29918, 8513, 543, 20621, 681, 613, 270, 29909, 29922, 29945, 29900, 29892, 20881, 29918, 8513, 543, 3027, 29908, 13, 4706, 1723, 13, 1678, 2981, 13, 29897, 13, 13, 9573, 29898, 13, 1678, 1178, 543, 2713, 262, 25233, 29925, 1772, 29899, 29894, 29900, 613, 13, 1678, 6251, 29918, 3149, 543, 845, 262, 2096, 29901, 25233, 29925, 1772, 613, 13, 1678, 9049, 5085, 3790, 29908, 2917, 1115, 12370, 29925, 1772, 29889, 4592, 3991, 580, 1118, 13, 29897, 13, 13, 13, 9573, 29898, 13, 1678, 1178, 543, 2713, 262, 25233, 29925, 1772, 1323, 8675, 681, 29899, 29894, 29900, 613, 13, 1678, 6251, 29918, 3149, 543, 845, 262, 2096, 29901, 25233, 29925, 1772, 613, 13, 1678, 9049, 5085, 3790, 29908, 2917, 1115, 12370, 29925, 1772, 29889, 4592, 3991, 29898, 627, 29918, 8513, 543, 20621, 681, 613, 270, 29909, 29922, 29945, 29900, 19230, 13, 29897, 13, 2 ]
fhirclient/models/goal.py
carolinarsm/client-py
418
1616039
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Goal) on 2019-05-07. # 2019, SMART Health IT. from . import domainresource class Goal(domainresource.DomainResource): """ Describes the intended objective(s) for a patient, group or organization. Describes the intended objective(s) for a patient, group or organization care, for example, weight loss, restoring an activity of daily living, obtaining herd immunity via immunization, meeting a process improvement objective, etc. """ resource_type = "Goal" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. :raises: FHIRValidationError on validation errors, unless strict is False :param dict jsondict: A JSON dictionary to use for initialization :param bool strict: If True (the default), invalid variables will raise a TypeError """ self.achievementStatus = None """ in-progress | improving | worsening | no-change | achieved | sustaining | not-achieved | no-progress | not-attainable. Type `CodeableConcept` (represented as `dict` in JSON). """ self.addresses = None """ Issues addressed by this goal. List of `FHIRReference` items (represented as `dict` in JSON). """ self.category = None """ E.g. Treatment, dietary, behavioral, etc.. List of `CodeableConcept` items (represented as `dict` in JSON). """ self.description = None """ Code or text describing goal. Type `CodeableConcept` (represented as `dict` in JSON). """ self.expressedBy = None """ Who's responsible for creating Goal?. Type `FHIRReference` (represented as `dict` in JSON). """ self.identifier = None """ External Ids for this goal. List of `Identifier` items (represented as `dict` in JSON). """ self.lifecycleStatus = None """ proposed | planned | accepted | active | on-hold | completed | cancelled | entered-in-error | rejected. Type `str`. """ self.note = None """ Comments about the goal. List of `Annotation` items (represented as `dict` in JSON). """ self.outcomeCode = None """ What result was achieved regarding the goal?. List of `CodeableConcept` items (represented as `dict` in JSON). """ self.outcomeReference = None """ Observation that resulted from goal. List of `FHIRReference` items (represented as `dict` in JSON). """ self.priority = None """ high-priority | medium-priority | low-priority. Type `CodeableConcept` (represented as `dict` in JSON). """ self.startCodeableConcept = None """ When goal pursuit begins. Type `CodeableConcept` (represented as `dict` in JSON). """ self.startDate = None """ When goal pursuit begins. Type `FHIRDate` (represented as `str` in JSON). """ self.statusDate = None """ When goal status took effect. Type `FHIRDate` (represented as `str` in JSON). """ self.statusReason = None """ Reason for current status. Type `str`. """ self.subject = None """ Who this goal is intended for. Type `FHIRReference` (represented as `dict` in JSON). """ self.target = None """ Target outcome for the goal. List of `GoalTarget` items (represented as `dict` in JSON). """ super(Goal, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): js = super(Goal, self).elementProperties() js.extend([ ("achievementStatus", "achievementStatus", codeableconcept.CodeableConcept, False, None, False), ("addresses", "addresses", fhirreference.FHIRReference, True, None, False), ("category", "category", codeableconcept.CodeableConcept, True, None, False), ("description", "description", codeableconcept.CodeableConcept, False, None, True), ("expressedBy", "expressedBy", fhirreference.FHIRReference, False, None, False), ("identifier", "identifier", identifier.Identifier, True, None, False), ("lifecycleStatus", "lifecycleStatus", str, False, None, True), ("note", "note", annotation.Annotation, True, None, False), ("outcomeCode", "outcomeCode", codeableconcept.CodeableConcept, True, None, False), ("outcomeReference", "outcomeReference", fhirreference.FHIRReference, True, None, False), ("priority", "priority", codeableconcept.CodeableConcept, False, None, False), ("startCodeableConcept", "startCodeableConcept", codeableconcept.CodeableConcept, False, "start", False), ("startDate", "startDate", fhirdate.FHIRDate, False, "start", False), ("statusDate", "statusDate", fhirdate.FHIRDate, False, None, False), ("statusReason", "statusReason", str, False, None, False), ("subject", "subject", fhirreference.FHIRReference, False, None, True), ("target", "target", GoalTarget, True, None, False), ]) return js from . import backboneelement class GoalTarget(backboneelement.BackboneElement): """ Target outcome for the goal. Indicates what should be done by when. """ resource_type = "GoalTarget" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. :raises: FHIRValidationError on validation errors, unless strict is False :param dict jsondict: A JSON dictionary to use for initialization :param bool strict: If True (the default), invalid variables will raise a TypeError """ self.detailBoolean = None """ The target value to be achieved. Type `bool`. """ self.detailCodeableConcept = None """ The target value to be achieved. Type `CodeableConcept` (represented as `dict` in JSON). """ self.detailInteger = None """ The target value to be achieved. Type `int`. """ self.detailQuantity = None """ The target value to be achieved. Type `Quantity` (represented as `dict` in JSON). """ self.detailRange = None """ The target value to be achieved. Type `Range` (represented as `dict` in JSON). """ self.detailRatio = None """ The target value to be achieved. Type `Ratio` (represented as `dict` in JSON). """ self.detailString = None """ The target value to be achieved. Type `str`. """ self.dueDate = None """ Reach goal on or before. Type `FHIRDate` (represented as `str` in JSON). """ self.dueDuration = None """ Reach goal on or before. Type `Duration` (represented as `dict` in JSON). """ self.measure = None """ The parameter whose value is being tracked. Type `CodeableConcept` (represented as `dict` in JSON). """ super(GoalTarget, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): js = super(GoalTarget, self).elementProperties() js.extend([ ("detailBoolean", "detailBoolean", bool, False, "detail", False), ("detailCodeableConcept", "detailCodeableConcept", codeableconcept.CodeableConcept, False, "detail", False), ("detailInteger", "detailInteger", int, False, "detail", False), ("detailQuantity", "detailQuantity", quantity.Quantity, False, "detail", False), ("detailRange", "detailRange", range.Range, False, "detail", False), ("detailRatio", "detailRatio", ratio.Ratio, False, "detail", False), ("detailString", "detailString", str, False, "detail", False), ("dueDate", "dueDate", fhirdate.FHIRDate, False, "due", False), ("dueDuration", "dueDuration", duration.Duration, False, "due", False), ("measure", "measure", codeableconcept.CodeableConcept, False, None, False), ]) return js import sys try: from . import annotation except ImportError: annotation = sys.modules[__package__ + '.annotation'] try: from . import codeableconcept except ImportError: codeableconcept = sys.modules[__package__ + '.codeableconcept'] try: from . import duration except ImportError: duration = sys.modules[__package__ + '.duration'] try: from . import fhirdate except ImportError: fhirdate = sys.modules[__package__ + '.fhirdate'] try: from . import fhirreference except ImportError: fhirreference = sys.modules[__package__ + '.fhirreference'] try: from . import identifier except ImportError: identifier = sys.modules[__package__ + '.identifier'] try: from . import quantity except ImportError: quantity = sys.modules[__package__ + '.quantity'] try: from . import range except ImportError: range = sys.modules[__package__ + '.range'] try: from . import ratio except ImportError: ratio = sys.modules[__package__ + '.ratio']
[ 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, 29871, 3251, 630, 515, 383, 29950, 8193, 29871, 29946, 29889, 29900, 29889, 29900, 29899, 29874, 29945, 29941, 687, 29953, 3905, 29896, 29890, 313, 1124, 597, 4415, 29955, 29889, 990, 29914, 29888, 29882, 381, 29914, 5015, 12425, 14683, 29914, 8120, 284, 29897, 373, 29871, 29906, 29900, 29896, 29929, 29899, 29900, 29945, 29899, 29900, 29955, 29889, 13, 29937, 259, 29906, 29900, 29896, 29929, 29892, 317, 1529, 13079, 15202, 13315, 29889, 13, 13, 13, 3166, 869, 1053, 5354, 10314, 13, 13, 1990, 2921, 284, 29898, 7247, 10314, 29889, 15951, 6848, 1125, 13, 1678, 9995, 20355, 5707, 278, 9146, 12091, 29898, 29879, 29897, 363, 263, 16500, 29892, 2318, 470, 13013, 29889, 13, 268, 13, 1678, 20355, 5707, 278, 9146, 12091, 29898, 29879, 29897, 363, 263, 16500, 29892, 2318, 470, 13013, 13, 1678, 2562, 29892, 363, 1342, 29892, 7688, 6410, 29892, 1791, 8253, 385, 6354, 310, 14218, 8471, 29892, 13, 1678, 4017, 292, 902, 29881, 5198, 6997, 3025, 5198, 348, 2133, 29892, 11781, 263, 1889, 20414, 13, 1678, 12091, 29892, 2992, 29889, 13, 1678, 9995, 13, 268, 13, 1678, 6503, 29918, 1853, 353, 376, 8120, 284, 29908, 13, 268, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 6965, 898, 919, 29922, 8516, 29892, 9406, 29922, 5574, 1125, 13, 4706, 9995, 25455, 599, 2854, 4426, 29889, 13, 308, 13, 4706, 584, 336, 4637, 29901, 383, 29950, 8193, 19448, 2392, 373, 8845, 4436, 29892, 6521, 9406, 338, 7700, 13, 4706, 584, 3207, 9657, 6965, 898, 919, 29901, 319, 4663, 8600, 304, 671, 363, 17865, 13, 4706, 584, 3207, 6120, 9406, 29901, 960, 5852, 313, 1552, 2322, 511, 8340, 3651, 674, 12020, 263, 20948, 13, 4706, 9995, 13, 308, 13, 4706, 1583, 29889, 496, 10384, 882, 5709, 353, 6213, 13, 4706, 9995, 297, 29899, 18035, 891, 4857, 1747, 891, 281, 943, 8333, 891, 694, 29899, 3167, 891, 14363, 891, 13, 4706, 15075, 17225, 891, 451, 29899, 496, 6402, 891, 694, 29899, 18035, 891, 451, 29899, 1131, 475, 519, 29889, 13, 4706, 5167, 421, 3399, 519, 1168, 1547, 29952, 313, 276, 6338, 287, 408, 421, 8977, 29952, 297, 4663, 467, 9995, 13, 308, 13, 4706, 1583, 29889, 7328, 267, 353, 6213, 13, 4706, 9995, 16982, 1041, 20976, 491, 445, 7306, 29889, 13, 4706, 2391, 310, 421, 29943, 29950, 8193, 7422, 29952, 4452, 313, 276, 6338, 287, 408, 421, 8977, 29952, 297, 4663, 467, 9995, 13, 308, 13, 4706, 1583, 29889, 7320, 353, 6213, 13, 4706, 9995, 382, 29889, 29887, 29889, 6479, 271, 358, 29892, 652, 300, 653, 29892, 6030, 284, 29892, 2992, 636, 13, 4706, 2391, 310, 421, 3399, 519, 1168, 1547, 29952, 4452, 313, 276, 6338, 287, 408, 421, 8977, 29952, 297, 4663, 467, 9995, 13, 308, 13, 4706, 1583, 29889, 8216, 353, 6213, 13, 4706, 9995, 5920, 470, 1426, 20766, 7306, 29889, 13, 4706, 5167, 421, 3399, 519, 1168, 1547, 29952, 313, 276, 6338, 287, 408, 421, 8977, 29952, 297, 4663, 467, 9995, 13, 308, 13, 4706, 1583, 29889, 735, 13120, 2059, 353, 6213, 13, 4706, 9995, 11644, 29915, 29879, 14040, 363, 4969, 2921, 284, 9808, 13, 4706, 5167, 421, 29943, 29950, 8193, 7422, 29952, 313, 276, 6338, 287, 408, 421, 8977, 29952, 297, 4663, 467, 9995, 13, 308, 13, 4706, 1583, 29889, 25378, 353, 6213, 13, 4706, 9995, 3985, 5163, 29879, 363, 445, 7306, 29889, 13, 4706, 2391, 310, 421, 12889, 29952, 4452, 313, 276, 6338, 287, 408, 421, 8977, 29952, 297, 4663, 467, 9995, 13, 308, 13, 4706, 1583, 29889, 29880, 22532, 5709, 353, 6213, 13, 4706, 9995, 7972, 891, 20458, 891, 9259, 891, 6136, 891, 373, 29899, 8948, 891, 8676, 891, 13, 4706, 12611, 839, 891, 7802, 29899, 262, 29899, 2704, 891, 22225, 29889, 13, 4706, 5167, 421, 710, 1412, 9995, 13, 308, 13, 4706, 1583, 29889, 6812, 353, 6213, 13, 4706, 9995, 461, 29879, 1048, 278, 7306, 29889, 13, 4706, 2391, 310, 421, 21978, 29952, 4452, 313, 276, 6338, 287, 408, 421, 8977, 29952, 297, 4663, 467, 9995, 13, 308, 13, 4706, 1583, 29889, 449, 2763, 3399, 353, 6213, 13, 4706, 9995, 1724, 1121, 471, 14363, 11211, 278, 7306, 9808, 13, 4706, 2391, 310, 421, 3399, 519, 1168, 1547, 29952, 4452, 313, 276, 6338, 287, 408, 421, 8977, 29952, 297, 4663, 467, 9995, 13, 308, 13, 4706, 1583, 29889, 449, 2763, 7422, 353, 6213, 13, 4706, 9995, 21651, 362, 393, 20601, 515, 7306, 29889, 13, 4706, 2391, 310, 421, 29943, 29950, 8193, 7422, 29952, 4452, 313, 276, 6338, 287, 408, 421, 8977, 29952, 297, 4663, 467, 9995, 13, 308, 13, 4706, 1583, 29889, 29886, 21766, 353, 6213, 13, 4706, 9995, 1880, 29899, 29886, 21766, 891, 18350, 29899, 29886, 21766, 891, 4482, 29899, 29886, 21766, 29889, 13, 4706, 5167, 421, 3399, 519, 1168, 1547, 29952, 313, 276, 6338, 287, 408, 421, 8977, 29952, 297, 4663, 467, 9995, 13, 308, 13, 4706, 1583, 29889, 2962, 3399, 519, 1168, 1547, 353, 6213, 13, 4706, 9995, 1932, 7306, 12359, 3121, 16410, 29889, 13, 4706, 5167, 421, 3399, 519, 1168, 1547, 29952, 313, 276, 6338, 287, 408, 421, 8977, 29952, 297, 4663, 467, 9995, 13, 308, 13, 4706, 1583, 29889, 2962, 2539, 353, 6213, 13, 4706, 9995, 1932, 7306, 12359, 3121, 16410, 29889, 13, 4706, 5167, 421, 29943, 29950, 8193, 2539, 29952, 313, 276, 6338, 287, 408, 421, 710, 29952, 297, 4663, 467, 9995, 13, 308, 13, 4706, 1583, 29889, 4882, 2539, 353, 6213, 13, 4706, 9995, 1932, 7306, 4660, 3614, 2779, 29889, 13, 4706, 5167, 421, 29943, 29950, 8193, 2539, 29952, 313, 276, 6338, 287, 408, 421, 710, 29952, 297, 4663, 467, 9995, 13, 308, 13, 4706, 1583, 29889, 4882, 1123, 1658, 353, 6213, 13, 4706, 9995, 830, 1658, 363, 1857, 4660, 29889, 13, 4706, 5167, 421, 710, 1412, 9995, 13, 308, 13, 4706, 1583, 29889, 16009, 353, 6213, 13, 4706, 9995, 11644, 445, 7306, 338, 9146, 363, 29889, 13, 4706, 5167, 421, 29943, 29950, 8193, 7422, 29952, 313, 276, 6338, 287, 408, 421, 8977, 29952, 297, 4663, 467, 9995, 13, 308, 13, 4706, 1583, 29889, 5182, 353, 6213, 13, 4706, 9995, 17157, 21957, 363, 278, 7306, 29889, 13, 4706, 2391, 310, 421, 8120, 284, 8667, 29952, 4452, 313, 276, 6338, 287, 408, 421, 8977, 29952, 297, 4663, 467, 9995, 13, 308, 13, 4706, 2428, 29898, 8120, 284, 29892, 1583, 467, 1649, 2344, 12035, 1315, 898, 919, 29922, 1315, 898, 919, 29892, 9406, 29922, 710, 919, 29897, 13, 268, 13, 1678, 822, 1543, 11857, 29898, 1311, 1125, 13, 4706, 6965, 353, 2428, 29898, 8120, 284, 29892, 1583, 467, 5029, 11857, 580, 13, 4706, 6965, 29889, 21843, 4197, 13, 9651, 4852, 496, 10384, 882, 5709, 613, 376, 496, 10384, 882, 5709, 613, 775, 519, 535, 1547, 29889, 3399, 519, 1168, 1547, 29892, 7700, 29892, 6213, 29892, 7700, 511, 13, 9651, 4852, 7328, 267, 613, 376, 7328, 267, 613, 285, 29882, 381, 5679, 29889, 29943, 29950, 8193, 7422, 29892, 5852, 29892, 6213, 29892, 7700, 511, 13, 9651, 4852, 7320, 613, 376, 7320, 613, 775, 519, 535, 1547, 29889, 3399, 519, 1168, 1547, 29892, 5852, 29892, 6213, 29892, 7700, 511, 13, 9651, 4852, 8216, 613, 376, 8216, 613, 775, 519, 535, 1547, 29889, 3399, 519, 1168, 1547, 29892, 7700, 29892, 6213, 29892, 5852, 511, 13, 9651, 4852, 735, 13120, 2059, 613, 376, 735, 13120, 2059, 613, 285, 29882, 381, 5679, 29889, 29943, 29950, 8193, 7422, 29892, 7700, 29892, 6213, 29892, 7700, 511, 13, 9651, 4852, 25378, 613, 376, 25378, 613, 15882, 29889, 12889, 29892, 5852, 29892, 6213, 29892, 7700, 511, 13, 9651, 4852, 29880, 22532, 5709, 613, 376, 29880, 22532, 5709, 613, 851, 29892, 7700, 29892, 6213, 29892, 5852, 511, 13, 9651, 4852, 6812, 613, 376, 6812, 613, 17195, 29889, 21978, 29892, 5852, 29892, 6213, 29892, 7700, 511, 13, 9651, 4852, 449, 2763, 3399, 613, 376, 449, 2763, 3399, 613, 775, 519, 535, 1547, 29889, 3399, 519, 1168, 1547, 29892, 5852, 29892, 6213, 29892, 7700, 511, 13, 9651, 4852, 449, 2763, 7422, 613, 376, 449, 2763, 7422, 613, 285, 29882, 381, 5679, 29889, 29943, 29950, 8193, 7422, 29892, 5852, 29892, 6213, 29892, 7700, 511, 13, 9651, 4852, 29886, 21766, 613, 376, 29886, 21766, 613, 775, 519, 535, 1547, 29889, 3399, 519, 1168, 1547, 29892, 7700, 29892, 6213, 29892, 7700, 511, 13, 9651, 4852, 2962, 3399, 519, 1168, 1547, 613, 376, 2962, 3399, 519, 1168, 1547, 613, 775, 519, 535, 1547, 29889, 3399, 519, 1168, 1547, 29892, 7700, 29892, 376, 2962, 613, 7700, 511, 13, 9651, 4852, 2962, 2539, 613, 376, 2962, 2539, 613, 285, 29882, 381, 1256, 29889, 29943, 29950, 8193, 2539, 29892, 7700, 29892, 376, 2962, 613, 7700, 511, 13, 9651, 4852, 4882, 2539, 613, 376, 4882, 2539, 613, 285, 29882, 381, 1256, 29889, 29943, 29950, 8193, 2539, 29892, 7700, 29892, 6213, 29892, 7700, 511, 13, 9651, 4852, 4882, 1123, 1658, 613, 376, 4882, 1123, 1658, 613, 851, 29892, 7700, 29892, 6213, 29892, 7700, 511, 13, 9651, 4852, 16009, 613, 376, 16009, 613, 285, 29882, 381, 5679, 29889, 29943, 29950, 8193, 7422, 29892, 7700, 29892, 6213, 29892, 5852, 511, 13, 9651, 4852, 5182, 613, 376, 5182, 613, 2921, 284, 8667, 29892, 5852, 29892, 6213, 29892, 7700, 511, 13, 308, 2314, 13, 4706, 736, 6965, 13, 13, 13, 3166, 869, 1053, 1250, 15933, 5029, 13, 13, 1990, 2921, 284, 8667, 29898, 1627, 15933, 5029, 29889, 5841, 15933, 2642, 1125, 13, 1678, 9995, 17157, 21957, 363, 278, 7306, 29889, 13, 268, 13, 1678, 1894, 293, 1078, 825, 881, 367, 2309, 491, 746, 29889, 13, 1678, 9995, 13, 268, 13, 1678, 6503, 29918, 1853, 353, 376, 8120, 284, 8667, 29908, 13, 268, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 6965, 898, 919, 29922, 8516, 29892, 9406, 29922, 5574, 1125, 13, 4706, 9995, 25455, 599, 2854, 4426, 29889, 13, 308, 13, 4706, 584, 336, 4637, 29901, 383, 29950, 8193, 19448, 2392, 373, 8845, 4436, 29892, 6521, 9406, 338, 7700, 13, 4706, 584, 3207, 9657, 6965, 898, 919, 29901, 319, 4663, 8600, 304, 671, 363, 17865, 13, 4706, 584, 3207, 6120, 9406, 29901, 960, 5852, 313, 1552, 2322, 511, 8340, 3651, 674, 12020, 263, 20948, 13, 4706, 9995, 13, 308, 13, 4706, 1583, 29889, 16432, 18146, 353, 6213, 13, 4706, 9995, 450, 3646, 995, 304, 367, 14363, 29889, 13, 4706, 5167, 421, 11227, 1412, 9995, 13, 308, 13, 4706, 1583, 29889, 16432, 3399, 519, 1168, 1547, 353, 6213, 13, 4706, 9995, 450, 3646, 995, 304, 367, 14363, 29889, 13, 4706, 5167, 421, 3399, 519, 1168, 1547, 29952, 313, 276, 6338, 287, 408, 421, 8977, 29952, 297, 4663, 467, 9995, 13, 308, 13, 4706, 1583, 29889, 16432, 7798, 353, 6213, 13, 4706, 9995, 450, 3646, 995, 304, 367, 14363, 29889, 13, 4706, 5167, 421, 524, 1412, 9995, 13, 308, 13, 4706, 1583, 29889, 16432, 22930, 537, 353, 6213, 13, 4706, 9995, 450, 3646, 995, 304, 367, 14363, 29889, 13, 4706, 5167, 421, 22930, 537, 29952, 313, 276, 6338, 287, 408, 421, 8977, 29952, 297, 4663, 467, 9995, 13, 308, 13, 4706, 1583, 29889, 16432, 6069, 353, 6213, 13, 4706, 9995, 450, 3646, 995, 304, 367, 14363, 29889, 13, 4706, 5167, 421, 6069, 29952, 313, 276, 6338, 287, 408, 421, 8977, 29952, 297, 4663, 467, 9995, 13, 308, 13, 4706, 1583, 29889, 16432, 29934, 20819, 353, 6213, 13, 4706, 9995, 450, 3646, 995, 304, 367, 14363, 29889, 13, 4706, 5167, 421, 29934, 20819, 29952, 313, 276, 6338, 287, 408, 421, 8977, 29952, 297, 4663, 467, 9995, 13, 308, 13, 4706, 1583, 29889, 16432, 1231, 353, 6213, 13, 4706, 9995, 450, 3646, 995, 304, 367, 14363, 29889, 13, 4706, 5167, 421, 710, 1412, 9995, 13, 308, 13, 4706, 1583, 29889, 29123, 2539, 353, 6213, 13, 4706, 9995, 830, 496, 7306, 373, 470, 1434, 29889, 13, 4706, 5167, 421, 29943, 29950, 8193, 2539, 29952, 313, 276, 6338, 287, 408, 421, 710, 29952, 297, 4663, 467, 9995, 13, 308, 13, 4706, 1583, 29889, 29123, 18984, 353, 6213, 13, 4706, 9995, 830, 496, 7306, 373, 470, 1434, 29889, 13, 4706, 5167, 421, 18984, 29952, 313, 276, 6338, 287, 408, 421, 8977, 29952, 297, 4663, 467, 9995, 13, 308, 13, 4706, 1583, 29889, 26658, 353, 6213, 13, 4706, 9995, 450, 3443, 5069, 995, 338, 1641, 5702, 287, 29889, 13, 4706, 5167, 421, 3399, 519, 1168, 1547, 29952, 313, 276, 6338, 287, 408, 421, 8977, 29952, 297, 4663, 467, 9995, 13, 308, 13, 4706, 2428, 29898, 8120, 284, 8667, 29892, 1583, 467, 1649, 2344, 12035, 1315, 898, 919, 29922, 1315, 898, 919, 29892, 9406, 29922, 710, 919, 29897, 13, 268, 13, 1678, 822, 1543, 11857, 29898, 1311, 1125, 13, 4706, 6965, 353, 2428, 29898, 8120, 284, 8667, 29892, 1583, 467, 5029, 11857, 580, 13, 4706, 6965, 29889, 21843, 4197, 13, 9651, 4852, 16432, 18146, 613, 376, 16432, 18146, 613, 6120, 29892, 7700, 29892, 376, 16432, 613, 7700, 511, 13, 9651, 4852, 16432, 3399, 519, 1168, 1547, 613, 376, 16432, 3399, 519, 1168, 1547, 613, 775, 519, 535, 1547, 29889, 3399, 519, 1168, 1547, 29892, 7700, 29892, 376, 16432, 613, 7700, 511, 13, 9651, 4852, 16432, 7798, 613, 376, 16432, 7798, 613, 938, 29892, 7700, 29892, 376, 16432, 613, 7700, 511, 13, 9651, 4852, 16432, 22930, 537, 613, 376, 16432, 22930, 537, 613, 14728, 29889, 22930, 537, 29892, 7700, 29892, 376, 16432, 613, 7700, 511, 13, 9651, 4852, 16432, 6069, 613, 376, 16432, 6069, 613, 3464, 29889, 6069, 29892, 7700, 29892, 376, 16432, 613, 7700, 511, 13, 9651, 4852, 16432, 29934, 20819, 613, 376, 16432, 29934, 20819, 613, 11959, 29889, 29934, 20819, 29892, 7700, 29892, 376, 16432, 613, 7700, 511, 13, 9651, 4852, 16432, 1231, 613, 376, 16432, 1231, 613, 851, 29892, 7700, 29892, 376, 16432, 613, 7700, 511, 13, 9651, 4852, 29123, 2539, 613, 376, 29123, 2539, 613, 285, 29882, 381, 1256, 29889, 29943, 29950, 8193, 2539, 29892, 7700, 29892, 376, 29123, 613, 7700, 511, 13, 9651, 4852, 29123, 18984, 613, 376, 29123, 18984, 613, 14385, 29889, 18984, 29892, 7700, 29892, 376, 29123, 613, 7700, 511, 13, 9651, 4852, 26658, 613, 376, 26658, 613, 775, 519, 535, 1547, 29889, 3399, 519, 1168, 1547, 29892, 7700, 29892, 6213, 29892, 7700, 511, 13, 308, 2314, 13, 4706, 736, 6965, 13, 13, 13, 5215, 10876, 13, 2202, 29901, 13, 1678, 515, 869, 1053, 17195, 13, 19499, 16032, 2392, 29901, 13, 1678, 17195, 353, 10876, 29889, 7576, 29961, 1649, 5113, 1649, 718, 15300, 18317, 2033, 13, 2202, 29901, 13, 1678, 515, 869, 1053, 775, 519, 535, 1547, 13, 19499, 16032, 2392, 29901, 13, 1678, 775, 519, 535, 1547, 353, 10876, 29889, 7576, 29961, 1649, 5113, 1649, 718, 15300, 401, 519, 535, 1547, 2033, 13, 2202, 29901, 13, 1678, 515, 869, 1053, 14385, 13, 19499, 16032, 2392, 29901, 13, 1678, 14385, 353, 10876, 29889, 7576, 29961, 1649, 5113, 1649, 718, 15300, 19708, 2033, 13, 2202, 29901, 13, 1678, 515, 869, 1053, 285, 29882, 381, 1256, 13, 19499, 16032, 2392, 29901, 13, 1678, 285, 29882, 381, 1256, 353, 10876, 29889, 7576, 29961, 1649, 5113, 1649, 718, 15300, 29888, 29882, 381, 1256, 2033, 13, 2202, 29901, 13, 1678, 515, 869, 1053, 285, 29882, 381, 5679, 13, 19499, 16032, 2392, 29901, 13, 1678, 285, 29882, 381, 5679, 353, 10876, 29889, 7576, 29961, 1649, 5113, 1649, 718, 15300, 29888, 29882, 381, 5679, 2033, 13, 2202, 29901, 13, 1678, 515, 869, 1053, 15882, 13, 19499, 16032, 2392, 29901, 13, 1678, 15882, 353, 10876, 29889, 7576, 29961, 1649, 5113, 1649, 718, 15300, 25378, 2033, 13, 2202, 29901, 13, 1678, 515, 869, 1053, 14728, 13, 19499, 16032, 2392, 29901, 13, 1678, 14728, 353, 10876, 29889, 7576, 29961, 1649, 5113, 1649, 718, 15300, 22640, 2033, 13, 2202, 29901, 13, 1678, 515, 869, 1053, 3464, 13, 19499, 16032, 2392, 29901, 13, 1678, 3464, 353, 10876, 29889, 7576, 29961, 1649, 5113, 1649, 718, 15300, 3881, 2033, 13, 2202, 29901, 13, 1678, 515, 869, 1053, 11959, 13, 19499, 16032, 2392, 29901, 13, 1678, 11959, 353, 10876, 29889, 7576, 29961, 1649, 5113, 1649, 718, 15300, 3605, 601, 2033, 13, 2 ]
pyplots/numpy_intro_3.py
junghun73/Learning
419
1615113
import numpy as np import matplotlib.pyplot as plt img = plt.imread('../data/elephant.png') print img.shape, img.dtype # (200, 300, 3) dtype('float32') plt.imshow(img) plt.savefig('plot.png') plt.show() plt.imsave('red_elephant', img[:,:,0], cmap=plt.cm.gray) # This saved only one channel (of RGB) plt.imshow(plt.imread('red_elephant.png')) plt.show() # Other libraries: from scipy.misc import imsave imsave('tiny_elephant.png', img[::6,::6]) plt.imshow(plt.imread('tiny_elephant.png'), interpolation='nearest') plt.show()
[ 1, 1053, 12655, 408, 7442, 13, 5215, 22889, 29889, 2272, 5317, 408, 14770, 13, 13, 2492, 353, 14770, 29889, 326, 949, 877, 6995, 1272, 29914, 6146, 561, 424, 29889, 2732, 1495, 13, 2158, 10153, 29889, 12181, 29892, 10153, 29889, 29881, 1853, 13, 29937, 313, 29906, 29900, 29900, 29892, 29871, 29941, 29900, 29900, 29892, 29871, 29941, 29897, 29871, 26688, 877, 7411, 29941, 29906, 1495, 13, 13, 572, 29873, 29889, 326, 4294, 29898, 2492, 29897, 13, 572, 29873, 29889, 7620, 1003, 877, 5317, 29889, 2732, 1495, 13, 572, 29873, 29889, 4294, 580, 13, 13, 572, 29873, 29889, 326, 7620, 877, 1127, 29918, 6146, 561, 424, 742, 10153, 7503, 29892, 29901, 29892, 29900, 1402, 274, 1958, 29922, 572, 29873, 29889, 4912, 29889, 21012, 29897, 13, 13, 29937, 910, 7160, 871, 697, 8242, 313, 974, 390, 7210, 29897, 13, 13, 572, 29873, 29889, 326, 4294, 29898, 572, 29873, 29889, 326, 949, 877, 1127, 29918, 6146, 561, 424, 29889, 2732, 8785, 13, 572, 29873, 29889, 4294, 580, 13, 13, 29937, 5901, 9562, 29901, 13, 13, 3166, 4560, 2272, 29889, 29885, 10669, 1053, 527, 7620, 13, 326, 7620, 877, 25649, 29918, 6146, 561, 424, 29889, 2732, 742, 10153, 29961, 1057, 29953, 29892, 1057, 29953, 2314, 13, 572, 29873, 29889, 326, 4294, 29898, 572, 29873, 29889, 326, 949, 877, 25649, 29918, 6146, 561, 424, 29889, 2732, 5477, 29694, 2433, 28502, 342, 1495, 13, 572, 29873, 29889, 4294, 580, 13, 2 ]
trading_alert/crypto/tasks.py
Mohammadrezafah/trading-alert
1
124587
import logging import cryptocompare from django.conf import settings from django.contrib.auth import get_user_model from django.core.exceptions import ImproperlyConfigured from django.core.mail import EmailMessage from config import celery_app from trading_alert.crypto.models import CriptoAlert User = get_user_model() # Get an instance of a logger logger = logging.getLogger(__name__) def send_email_crypto(cripto_alert): subject = f"Segera check {cripto_alert.code}" body = f"{cripto_alert.code} sudah mencapai target {cripto_alert.operator} {cripto_alert.price}" email = EmailMessage( subject, body, settings.DEFAULT_FROM_EMAIL, [user.email for user in cripto_alert.notif_to.all()], [], ) email.send() def get_current_price(cripto_alert): price = 0 try: price = float( cryptocompare.get_price( cripto_alert.code, currency=cripto_alert.currency )[cripto_alert.code][cripto_alert.currency]) except Exception as e: logger.error(str(e)) logger.info(f"Price is : {price}") return price @celery_app.task() def send_alert_crypto(crpyto_id): cripto_alert = CriptoAlert.objects.filter(pk=crpyto_id).first() if not cripto_alert: logger.error("CriptoAlert objects not found") return "CriptoAlert objects not found" if cripto_alert.limit_notif >= cripto_alert.success_notif: cripto_alert.currency_price = get_current_price(cripto_alert) is_email = False if cripto_alert.currency_price != 0 and eval( f"{cripto_alert.currency_price} {cripto_alert.operator} {cripto_alert.price}" ): send_email_crypto(cripto_alert) cripto_alert.success_notif = cripto_alert.success_notif + 1 cripto_alert.save() return True
[ 1, 1053, 12183, 13, 13, 5215, 274, 17929, 18307, 13, 3166, 9557, 29889, 5527, 1053, 6055, 13, 3166, 9557, 29889, 21570, 29889, 5150, 1053, 679, 29918, 1792, 29918, 4299, 13, 3166, 9557, 29889, 3221, 29889, 11739, 29879, 1053, 1954, 771, 546, 368, 3991, 2955, 13, 3166, 9557, 29889, 3221, 29889, 2549, 1053, 22608, 3728, 13, 13, 3166, 2295, 1053, 6432, 708, 29918, 932, 13, 3166, 3534, 292, 29918, 12888, 29889, 29883, 17929, 29889, 9794, 1053, 315, 374, 24070, 16649, 13, 13, 2659, 353, 679, 29918, 1792, 29918, 4299, 580, 13, 29937, 3617, 385, 2777, 310, 263, 17927, 13, 21707, 353, 12183, 29889, 657, 16363, 22168, 978, 1649, 29897, 13, 13, 1753, 3638, 29918, 5269, 29918, 29883, 17929, 29898, 924, 29877, 29918, 12888, 1125, 13, 1678, 4967, 353, 285, 29908, 17669, 1572, 1423, 426, 924, 29877, 29918, 12888, 29889, 401, 5038, 13, 1678, 3573, 353, 285, 29908, 29912, 924, 29877, 29918, 12888, 29889, 401, 29913, 5053, 801, 1757, 5030, 1794, 3646, 426, 924, 29877, 29918, 12888, 29889, 6891, 29913, 426, 924, 29877, 29918, 12888, 29889, 9175, 5038, 13, 13, 1678, 4876, 353, 22608, 3728, 29898, 13, 4706, 4967, 29892, 3573, 29892, 6055, 29889, 23397, 29918, 21482, 29918, 26862, 6227, 29892, 518, 1792, 29889, 5269, 363, 1404, 297, 14783, 24070, 29918, 12888, 29889, 1333, 361, 29918, 517, 29889, 497, 580, 1402, 19997, 13, 1678, 1723, 13, 1678, 4876, 29889, 6717, 580, 13, 13, 1753, 679, 29918, 3784, 29918, 9175, 29898, 924, 29877, 29918, 12888, 1125, 13, 1678, 8666, 353, 29871, 29900, 13, 1678, 1018, 29901, 13, 4706, 8666, 353, 5785, 29898, 13, 9651, 274, 17929, 18307, 29889, 657, 29918, 9175, 29898, 13, 18884, 14783, 24070, 29918, 12888, 29889, 401, 29892, 29871, 13, 18884, 27550, 29922, 924, 29877, 29918, 12888, 29889, 26095, 13, 9651, 1723, 29961, 924, 29877, 29918, 12888, 29889, 401, 3816, 924, 29877, 29918, 12888, 29889, 26095, 2314, 13, 1678, 5174, 8960, 408, 321, 29901, 13, 4706, 17927, 29889, 2704, 29898, 710, 29898, 29872, 876, 13, 1678, 17927, 29889, 3888, 29898, 29888, 29908, 13026, 338, 259, 584, 426, 9175, 27195, 13, 1678, 736, 8666, 13, 29992, 2242, 708, 29918, 932, 29889, 7662, 580, 13, 1753, 3638, 29918, 12888, 29918, 29883, 17929, 29898, 7283, 2272, 517, 29918, 333, 1125, 13, 1678, 14783, 24070, 29918, 12888, 353, 315, 374, 24070, 16649, 29889, 12650, 29889, 4572, 29898, 20571, 29922, 7283, 2272, 517, 29918, 333, 467, 4102, 580, 13, 1678, 565, 451, 14783, 24070, 29918, 12888, 29901, 13, 4706, 17927, 29889, 2704, 703, 29907, 374, 24070, 16649, 3618, 451, 1476, 1159, 13, 4706, 736, 376, 29907, 374, 24070, 16649, 3618, 451, 1476, 29908, 13, 1678, 565, 14783, 24070, 29918, 12888, 29889, 13400, 29918, 1333, 361, 6736, 14783, 24070, 29918, 12888, 29889, 8698, 29918, 1333, 361, 29901, 13, 4706, 14783, 24070, 29918, 12888, 29889, 26095, 29918, 9175, 353, 679, 29918, 3784, 29918, 9175, 29898, 924, 29877, 29918, 12888, 29897, 13, 4706, 338, 29918, 5269, 353, 7700, 13, 4706, 565, 14783, 24070, 29918, 12888, 29889, 26095, 29918, 9175, 2804, 29871, 29900, 322, 19745, 29898, 13, 18884, 285, 29908, 29912, 924, 29877, 29918, 12888, 29889, 26095, 29918, 9175, 29913, 426, 924, 29877, 29918, 12888, 29889, 6891, 29913, 426, 924, 29877, 29918, 12888, 29889, 9175, 5038, 13, 632, 1125, 13, 9651, 3638, 29918, 5269, 29918, 29883, 17929, 29898, 924, 29877, 29918, 12888, 29897, 13, 9651, 14783, 24070, 29918, 12888, 29889, 8698, 29918, 1333, 361, 353, 29871, 14783, 24070, 29918, 12888, 29889, 8698, 29918, 1333, 361, 29871, 718, 29871, 29896, 13, 4706, 14783, 24070, 29918, 12888, 29889, 7620, 580, 13, 1678, 736, 5852, 13, 2 ]
quantitative_finance/L3/python/hjm_test.py
Aperture-Electronic/Vitis_Libraries
1
82479
#!/usr/bin/env python3 # Ensure environmental variable i.e. paths are set to used the modules from xf_fintech_python import DeviceManager, HJM import numpy as np import argparse def zcbAnalytical(rawData, maturity, tau = 0.5): # Take last row fc = np.copy(rawData[rawData.shape[0] - 1]) fc *= 0.01 accum = 0.0 for i in range(int(maturity / tau)): accum += fc[i] return np.exp(-tau * accum) def zcbExample(hjm, hist_data, maturity, paths): seeds = (np.random.rand(N_FACTORS * MC_UN) * 1000).astype(int) print("Using seeds " + str(seeds)) outPrice = [] hjm.run(list(hist_data.flat), list(seeds.flat), outPrice, tenors, curves, paths, maturity, maturity) runtime = hjm.lastruntime() analyticalPrice = zcbAnalytical(hist_data, maturity) print("[CPU] ZCB calculated analytically: %10.6f" % analyticalPrice) print("[FPGA] ZCB calculated with HJM framework: %10.6f" % outPrice[0]) print("[FPGA] Runtime = %d" %runtime, "us") diff = (outPrice[0] - analyticalPrice) / analyticalPrice * 100 print(" Diff = %.4f" % diff, "%") parser = argparse.ArgumentParser(description='Example of Heath-Jarrow-Morton framework running on a FPGA') parser.add_argument('data_in', type=str, help='Path to csv with historical rates data') parser.add_argument('load', type=str, help='filename of xlcbin load, e.g. hjm.xclbin') args = parser.parse_args() N_FACTORS = 3 MC_UN = 4 hist_data = np.loadtxt(args.data_in, delimiter=',') tenors = hist_data.shape[1] curves = hist_data.shape[0] xclbin_load = (args.load) print("\nThe Heath-Jarrow-Morton model\n=================================\n") # Program variables deviceList = DeviceManager.getDeviceList("u200") lastruntime = 0 runtime = 0 # Identify which cards installed and choose the first available U200 card print("Found these {0} device(s):".format(len(deviceList))) for x in deviceList: print(x.getName()) chosenDevice = deviceList[0] print("Choosing the first, ", str(chosenDevice), "\n") # Selecting and loadings into FPGA of chosen card the financial model to be used hjm = HJM(xclbin_load) hjm.claimDevice(chosenDevice) # Examples of possible operations, showing MC convergence of prices print("Example 1) Pricing ZCB of maturity 10Y with 50 MonteCarlo paths") zcbExample(hjm, hist_data, 10.0, 50) print("Example 2) Pricing ZCB of maturity 10Y with 100 MonteCarlo paths") zcbExample(hjm, hist_data, 10.0, 100) print("Example 3) Pricing ZCB of maturity 10Y with 200 MonteCarlo paths") zcbExample(hjm, hist_data, 10.0, 200) print("Example 4) Pricing ZCB of maturity 10Y with 400 MonteCarlo paths") zcbExample(hjm, hist_data, 10.0, 400) hjm.releaseDevice() print("End of example/test.\n")
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 29941, 30004, 13, 30004, 13, 29937, 22521, 545, 29380, 2286, 474, 29889, 29872, 29889, 10898, 526, 731, 304, 1304, 278, 10585, 30004, 13, 3166, 921, 29888, 29918, 4951, 11345, 29918, 4691, 1053, 21830, 3260, 29892, 379, 29967, 29924, 30004, 13, 5215, 12655, 408, 7442, 30004, 13, 5215, 1852, 5510, 30004, 13, 30004, 13, 1753, 503, 10702, 21067, 3637, 936, 29898, 1610, 1469, 29892, 286, 1337, 537, 29892, 260, 585, 353, 29871, 29900, 29889, 29945, 1125, 30004, 13, 1678, 396, 11190, 1833, 1948, 6756, 13, 1678, 285, 29883, 353, 7442, 29889, 8552, 29898, 1610, 1469, 29961, 1610, 1469, 29889, 12181, 29961, 29900, 29962, 448, 29871, 29896, 2314, 30004, 13, 1678, 285, 29883, 334, 29922, 29871, 29900, 29889, 29900, 29896, 30004, 13, 1678, 18414, 353, 29871, 29900, 29889, 29900, 30004, 13, 1678, 363, 474, 297, 3464, 29898, 524, 29898, 29885, 1337, 537, 847, 260, 585, 22164, 30004, 13, 4706, 18414, 4619, 285, 29883, 29961, 29875, 29962, 30004, 13, 1678, 736, 7442, 29889, 4548, 6278, 4722, 334, 18414, 8443, 13, 30004, 13, 30004, 13, 1753, 503, 10702, 14023, 29898, 29882, 21231, 29892, 9825, 29918, 1272, 29892, 286, 1337, 537, 29892, 10898, 1125, 30004, 13, 1678, 409, 5779, 353, 313, 9302, 29889, 8172, 29889, 9502, 29898, 29940, 29918, 4519, 1783, 24125, 334, 21271, 29918, 3904, 29897, 334, 29871, 29896, 29900, 29900, 29900, 467, 579, 668, 29898, 524, 8443, 13, 1678, 1596, 703, 15156, 409, 5779, 376, 718, 851, 29898, 344, 5779, 876, 30004, 13, 30004, 13, 1678, 714, 13026, 353, 5159, 30004, 13, 30004, 13, 1678, 298, 21231, 29889, 3389, 29898, 1761, 29898, 29882, 391, 29918, 1272, 29889, 20620, 511, 1051, 29898, 344, 5779, 29889, 20620, 511, 714, 13026, 29892, 3006, 943, 29892, 19684, 29892, 10898, 29892, 286, 1337, 537, 29892, 286, 1337, 537, 8443, 13, 1678, 10073, 353, 298, 21231, 29889, 3333, 509, 5572, 26471, 13, 1678, 16114, 936, 13026, 353, 503, 10702, 21067, 3637, 936, 29898, 29882, 391, 29918, 1272, 29892, 286, 1337, 537, 8443, 13, 1678, 1596, 703, 29961, 6271, 29965, 29962, 29871, 796, 21685, 12833, 16114, 1711, 29901, 539, 1273, 29896, 29900, 29889, 29953, 29888, 29908, 1273, 16114, 936, 13026, 8443, 13, 1678, 1596, 703, 29961, 26353, 12739, 29962, 796, 21685, 12833, 411, 379, 29967, 29924, 6890, 29901, 1273, 29896, 29900, 29889, 29953, 29888, 29908, 1273, 714, 13026, 29961, 29900, 2314, 30004, 13, 1678, 1596, 703, 29961, 26353, 12739, 29962, 24875, 353, 1273, 29881, 29908, 1273, 15634, 29892, 376, 375, 1159, 30004, 13, 1678, 2923, 353, 313, 449, 13026, 29961, 29900, 29962, 448, 16114, 936, 13026, 29897, 847, 16114, 936, 13026, 334, 29871, 29896, 29900, 29900, 30004, 13, 1678, 1596, 703, 1678, 360, 2593, 353, 18695, 29946, 29888, 29908, 1273, 2923, 29892, 11860, 1159, 30004, 13, 30004, 13, 30004, 13, 16680, 353, 1852, 5510, 29889, 15730, 11726, 29898, 8216, 2433, 14023, 310, 940, 493, 29899, 29967, 2936, 29899, 29924, 26342, 6890, 2734, 373, 263, 383, 29925, 12739, 1495, 30004, 13, 16680, 29889, 1202, 29918, 23516, 877, 1272, 29918, 262, 742, 1134, 29922, 710, 29892, 1371, 2433, 2605, 304, 11799, 411, 15839, 19257, 848, 1495, 30004, 13, 16680, 29889, 1202, 29918, 23516, 877, 1359, 742, 1134, 29922, 710, 29892, 1371, 2433, 9507, 310, 921, 29880, 29883, 2109, 2254, 29892, 321, 29889, 29887, 29889, 298, 21231, 29889, 29916, 695, 2109, 1495, 30004, 13, 30004, 13, 5085, 353, 13812, 29889, 5510, 29918, 5085, 26471, 13, 30004, 13, 29940, 29918, 4519, 1783, 24125, 353, 29871, 29941, 30004, 13, 12513, 29918, 3904, 353, 29871, 29946, 30004, 13, 30004, 13, 29882, 391, 29918, 1272, 353, 7442, 29889, 1359, 3945, 29898, 5085, 29889, 1272, 29918, 262, 29892, 28552, 29922, 742, 1495, 30004, 13, 841, 943, 353, 9825, 29918, 1272, 29889, 12181, 29961, 29896, 29962, 30004, 13, 2764, 1960, 353, 9825, 29918, 1272, 29889, 12181, 29961, 29900, 29962, 30004, 13, 30004, 13, 29916, 695, 2109, 29918, 1359, 353, 313, 5085, 29889, 1359, 8443, 13, 30004, 13, 2158, 14182, 29876, 1576, 940, 493, 29899, 29967, 2936, 29899, 29924, 26342, 1904, 29905, 29876, 9166, 9166, 2013, 29876, 1159, 30004, 13, 30004, 13, 29937, 7835, 3651, 30004, 13, 10141, 1293, 353, 21830, 3260, 29889, 657, 11501, 1293, 703, 29884, 29906, 29900, 29900, 1159, 30004, 13, 3333, 509, 5572, 353, 29871, 29900, 30004, 13, 15634, 353, 29871, 29900, 30004, 13, 30004, 13, 29937, 13355, 1598, 607, 15889, 5130, 322, 6755, 278, 937, 3625, 501, 29906, 29900, 29900, 5881, 30004, 13, 2158, 703, 9692, 1438, 426, 29900, 29913, 4742, 29898, 29879, 1125, 1642, 4830, 29898, 2435, 29898, 10141, 1293, 4961, 30004, 13, 1454, 921, 297, 4742, 1293, 29901, 30004, 13, 1678, 1596, 29898, 29916, 29889, 19629, 3101, 30004, 13, 305, 7749, 11501, 353, 4742, 1293, 29961, 29900, 29962, 30004, 13, 2158, 703, 15954, 14556, 278, 937, 29892, 9162, 851, 29898, 305, 7749, 11501, 511, 6634, 29876, 1159, 30004, 13, 30004, 13, 30004, 13, 29937, 7605, 292, 322, 2254, 886, 964, 383, 29925, 12739, 310, 10434, 5881, 278, 18161, 1904, 304, 367, 1304, 30004, 13, 29882, 21231, 353, 379, 29967, 29924, 29898, 29916, 695, 2109, 29918, 1359, 8443, 13, 29882, 21231, 29889, 29883, 8342, 11501, 29898, 305, 7749, 11501, 8443, 13, 30004, 13, 29937, 1222, 9422, 310, 1950, 6931, 29892, 6445, 21271, 17221, 310, 26094, 30004, 13, 2158, 703, 14023, 29871, 29896, 29897, 1588, 18499, 796, 21685, 310, 286, 1337, 537, 29871, 29896, 29900, 29979, 411, 29871, 29945, 29900, 11240, 8179, 417, 10898, 1159, 30004, 13, 29920, 10702, 14023, 29898, 29882, 21231, 29892, 9825, 29918, 1272, 29892, 29871, 29896, 29900, 29889, 29900, 29892, 29871, 29945, 29900, 8443, 13, 2158, 703, 14023, 29871, 29906, 29897, 1588, 18499, 796, 21685, 310, 286, 1337, 537, 29871, 29896, 29900, 29979, 411, 29871, 29896, 29900, 29900, 11240, 8179, 417, 10898, 1159, 30004, 13, 29920, 10702, 14023, 29898, 29882, 21231, 29892, 9825, 29918, 1272, 29892, 29871, 29896, 29900, 29889, 29900, 29892, 29871, 29896, 29900, 29900, 8443, 13, 2158, 703, 14023, 29871, 29941, 29897, 1588, 18499, 796, 21685, 310, 286, 1337, 537, 29871, 29896, 29900, 29979, 411, 29871, 29906, 29900, 29900, 11240, 8179, 417, 10898, 1159, 30004, 13, 29920, 10702, 14023, 29898, 29882, 21231, 29892, 9825, 29918, 1272, 29892, 29871, 29896, 29900, 29889, 29900, 29892, 29871, 29906, 29900, 29900, 8443, 13, 2158, 703, 14023, 29871, 29946, 29897, 1588, 18499, 796, 21685, 310, 286, 1337, 537, 29871, 29896, 29900, 29979, 411, 29871, 29946, 29900, 29900, 11240, 8179, 417, 10898, 1159, 30004, 13, 29920, 10702, 14023, 29898, 29882, 21231, 29892, 9825, 29918, 1272, 29892, 29871, 29896, 29900, 29889, 29900, 29892, 29871, 29946, 29900, 29900, 8443, 13, 30004, 13, 29882, 21231, 29889, 14096, 11501, 26471, 13, 2158, 703, 5044, 310, 1342, 29914, 1688, 7790, 29876, 1159, 30004, 13, 2 ]
ramda/memoize_with_test.py
jakobkolb/ramda.py
56
22619
<gh_stars>10-100 from ramda.memoize_with import memoize_with from ramda.product import product from ramda.private.asserts import assert_equal as e count = 0 def memoize_with_test(): @memoize_with(lambda x: -x) def factorial(n): global count count += 1 return product(range(1, n + 1)) e(factorial(5), 120) e(factorial(5), 120) e(factorial(5), 120) e(factorial(4), 24) e(factorial(4), 24) e(factorial(4), 24) e(factorial(4), 24) e(count, 2)
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29900, 29899, 29896, 29900, 29900, 13, 3166, 13472, 1388, 29889, 6954, 29877, 675, 29918, 2541, 1053, 2626, 29877, 675, 29918, 2541, 13, 3166, 13472, 1388, 29889, 4704, 1053, 3234, 13, 3166, 13472, 1388, 29889, 9053, 29889, 9294, 29879, 1053, 4974, 29918, 11745, 408, 321, 13, 13, 13, 2798, 353, 29871, 29900, 13, 13, 13, 1753, 2626, 29877, 675, 29918, 2541, 29918, 1688, 7295, 13, 1678, 732, 6954, 29877, 675, 29918, 2541, 29898, 2892, 921, 29901, 448, 29916, 29897, 13, 1678, 822, 7329, 616, 29898, 29876, 1125, 13, 4706, 5534, 2302, 13, 4706, 2302, 4619, 29871, 29896, 13, 4706, 736, 3234, 29898, 3881, 29898, 29896, 29892, 302, 718, 29871, 29896, 876, 13, 13, 1678, 321, 29898, 19790, 616, 29898, 29945, 511, 29871, 29896, 29906, 29900, 29897, 13, 1678, 321, 29898, 19790, 616, 29898, 29945, 511, 29871, 29896, 29906, 29900, 29897, 13, 1678, 321, 29898, 19790, 616, 29898, 29945, 511, 29871, 29896, 29906, 29900, 29897, 13, 1678, 321, 29898, 19790, 616, 29898, 29946, 511, 29871, 29906, 29946, 29897, 13, 1678, 321, 29898, 19790, 616, 29898, 29946, 511, 29871, 29906, 29946, 29897, 13, 1678, 321, 29898, 19790, 616, 29898, 29946, 511, 29871, 29906, 29946, 29897, 13, 1678, 321, 29898, 19790, 616, 29898, 29946, 511, 29871, 29906, 29946, 29897, 13, 1678, 321, 29898, 2798, 29892, 29871, 29906, 29897, 13, 2 ]
instagram/views.py
Julia-Agasaro/Insta-clone
0
107940
from django.http import Http404 from django.http import HttpResponseRedirect from django.shortcuts import render,redirect from django.contrib.auth.decorators import login_required from django.contrib import messages from django.contrib.auth.models import User from .models import Image, Profile,Comment,Likes,Follow from .forms import ProfileForm,ImageForm,CommentForm,ProfileEditForm # Create your views here. @login_required(login_url='/accounts/login/') def home(request): current_user = request.user all_images = Image.objects.all() print(all_images) profile = Profile.objects.all() print(profile) comments = Comment.objects.all() likes = Likes.objects.all() return render(request,'home.html',{'all_images':all_images,'profile':profile}) @login_required(login_url='/accounts/login/') def profile(request,prof_id): ''' Method that fetches a users profile page ''' user=User.objects.get(pk=prof_id) images = Image.objects.filter(profile = prof_id) title = User.objects.get(pk = prof_id).username profile = Profile.objects.filter(user = prof_id) if Follow.objects.filter(followings=request.user,followers = user).exists(): is_follow = True else: is_follow = False followers = Follow.objects.filter( followers = user).count() followings = Follow.objects.filter(followings = user).count() return render(request,'profile/profile.html',{"images":images,"profile":profile,"title":title,"is_follow":is_follow,"followers":followers,"followings":followings}) @login_required(login_url='accounts/login/') def edit(request): current_user = request.user if request.method == 'POST': if Profile.objects.filter(user_id= current_user): profile_form = ProfileEditForm(request.POST,request.FILES,instance = Profile.objects.get(user_id=current_user)) else: profile_form = ProfileEditForm(request.POST,request.FILES) if profile_form.is_valid(): userProfile=profile_form.save(commit = False) userProfile.user = current_user userProfile.save() return redirect('home') else: profile_form = ProfileEditForm() return render(request, 'profile/profileForm.html', locals()) @login_required(login_url='accounts/login/') def add_image(request): current_user = request.user if request.method == 'POST': form = ImageForm(request.POST, request.FILES) if form.is_valid(): add=form.save(commit=False) add.profile = current_user # add.profile_details= current_user.profile add.save() return redirect('home') else: form = ImageForm() return render(request,'upload.html',locals()) @login_required(login_url='/accounts/login/') def like(request, image_id): current_user = request.user image=Image.objects.get(id=image_id) new_like,created= Likes.objects.get_or_create(liker=current_user, image=image) new_like.save() print(new_like) return redirect('home') def comment(request,image_id): current_user=request.user image = Image.objects.get(id=image_id) profile_owner = User.objects.get(username=current_user) comments = Comment.objects.all() print(comments) if request.method == 'POST': form = CommentForm(request.POST) if form.is_valid(): comment = form.save(commit=False) comment.image = image comment.comment_owner = current_user comment.save() print(comments) return redirect(home) else: form = CommentForm() return render(request, 'comment.html', locals()) @login_required(login_url='/accounts/login/') def search(request): if 'user' in request.GET and request.GET["user"]: search_term = request.GET.get("user") searched_user = Profile.search_username(search_term) message = f"{search_term}" print(searched_user) return render(request, 'search.html',{"message":message,"users":searched_user}) else: message = "You haven't searched for any term" return render(request, 'search.html',{"message":message}) @login_required(login_url='/accounts/login/') def follow(request,followers): ''' Method that enables a user to follow another user. ''' user=User.objects.get(id=followers ) is_follow=False if Follow.objects.filter( followings =request.user,followers = user).exists(): Follow.objects.filter( followings =request.user,followers = user).delete() is_follow=False else: Follow( followings =request.user,followers = user).save() is_follow=True return HttpResponseRedirect(request.META.get('HTTP_REFERER'))
[ 1, 515, 9557, 29889, 1124, 1053, 9056, 29946, 29900, 29946, 13, 3166, 9557, 29889, 1124, 1053, 9056, 5103, 24735, 13, 3166, 9557, 29889, 12759, 7582, 29879, 1053, 4050, 29892, 17886, 13, 3166, 9557, 29889, 21570, 29889, 5150, 29889, 19557, 4097, 1053, 6464, 29918, 12403, 13, 3166, 9557, 29889, 21570, 1053, 7191, 13, 3166, 9557, 29889, 21570, 29889, 5150, 29889, 9794, 1053, 4911, 13, 3166, 869, 9794, 1053, 7084, 29892, 20802, 29892, 20001, 29892, 29931, 29379, 29892, 29943, 2952, 13, 3166, 869, 9514, 1053, 20802, 2500, 29892, 2940, 2500, 29892, 20001, 2500, 29892, 13909, 6103, 2500, 13, 29937, 6204, 596, 8386, 1244, 29889, 13, 29992, 7507, 29918, 12403, 29898, 7507, 29918, 2271, 2433, 29914, 10149, 29879, 29914, 7507, 29914, 1495, 13, 1753, 3271, 29898, 3827, 1125, 13, 1678, 1857, 29918, 1792, 353, 2009, 29889, 1792, 13, 1678, 599, 29918, 8346, 353, 7084, 29889, 12650, 29889, 497, 580, 13, 1678, 1596, 29898, 497, 29918, 8346, 29897, 13, 1678, 8722, 353, 20802, 29889, 12650, 29889, 497, 580, 13, 1678, 1596, 29898, 10185, 29897, 13, 1678, 6589, 353, 461, 29889, 12650, 29889, 497, 580, 13, 1678, 4188, 267, 353, 365, 29379, 29889, 12650, 29889, 497, 580, 13, 1678, 736, 4050, 29898, 3827, 5501, 5184, 29889, 1420, 742, 10998, 497, 29918, 8346, 2396, 497, 29918, 8346, 5501, 10185, 2396, 10185, 1800, 13, 13, 268, 13, 29992, 7507, 29918, 12403, 29898, 7507, 29918, 2271, 2433, 29914, 10149, 29879, 29914, 7507, 29914, 1495, 13, 1753, 8722, 29898, 3827, 29892, 23221, 29918, 333, 1125, 13, 12, 12008, 13, 12, 4062, 393, 6699, 267, 263, 4160, 8722, 1813, 13, 12, 12008, 13, 12, 1792, 29922, 2659, 29889, 12650, 29889, 657, 29898, 20571, 29922, 23221, 29918, 333, 29897, 13, 12, 8346, 353, 7084, 29889, 12650, 29889, 4572, 29898, 10185, 353, 2600, 29918, 333, 29897, 13, 12, 3257, 353, 4911, 29889, 12650, 29889, 657, 29898, 20571, 353, 2600, 29918, 333, 467, 6786, 13, 12, 10185, 353, 20802, 29889, 12650, 29889, 4572, 29898, 1792, 353, 2600, 29918, 333, 29897, 13, 13, 12, 361, 10306, 29889, 12650, 29889, 4572, 29898, 23031, 886, 29922, 3827, 29889, 1792, 29892, 23031, 414, 353, 1404, 467, 9933, 7295, 13, 12, 12, 275, 29918, 23031, 353, 5852, 13, 12, 2870, 29901, 13, 12, 12, 275, 29918, 23031, 353, 7700, 13, 13, 12, 23031, 414, 353, 10306, 29889, 12650, 29889, 4572, 29898, 1101, 414, 353, 1404, 467, 2798, 580, 13, 12, 23031, 886, 353, 10306, 29889, 12650, 29889, 4572, 29898, 23031, 886, 353, 1404, 467, 2798, 580, 13, 12, 13, 13, 12, 2457, 4050, 29898, 3827, 5501, 10185, 29914, 10185, 29889, 1420, 742, 6377, 8346, 1115, 8346, 1699, 10185, 1115, 10185, 1699, 3257, 1115, 3257, 1699, 275, 29918, 23031, 1115, 275, 29918, 23031, 1699, 23031, 414, 1115, 23031, 414, 1699, 23031, 886, 1115, 23031, 886, 1800, 13, 29992, 7507, 29918, 12403, 29898, 7507, 29918, 2271, 2433, 10149, 29879, 29914, 7507, 29914, 1495, 13, 1753, 3863, 29898, 3827, 1125, 13, 1678, 1857, 29918, 1792, 353, 2009, 29889, 1792, 13, 13, 1678, 565, 2009, 29889, 5696, 1275, 525, 5438, 2396, 13, 4706, 565, 20802, 29889, 12650, 29889, 4572, 29898, 1792, 29918, 333, 29922, 1857, 29918, 1792, 1125, 13, 13, 9651, 8722, 29918, 689, 353, 20802, 6103, 2500, 29898, 3827, 29889, 5438, 29892, 3827, 29889, 24483, 29892, 8758, 353, 20802, 29889, 12650, 29889, 657, 29898, 1792, 29918, 333, 29922, 3784, 29918, 1792, 876, 13, 4706, 1683, 29901, 13, 9651, 8722, 29918, 689, 353, 20802, 6103, 2500, 29898, 3827, 29889, 5438, 29892, 3827, 29889, 24483, 29897, 13, 13, 4706, 565, 8722, 29918, 689, 29889, 275, 29918, 3084, 7295, 13, 9651, 1404, 13909, 29922, 10185, 29918, 689, 29889, 7620, 29898, 15060, 353, 7700, 29897, 13, 9651, 1404, 13909, 29889, 1792, 353, 1857, 29918, 1792, 13, 9651, 1404, 13909, 29889, 7620, 580, 13, 632, 13, 4706, 736, 6684, 877, 5184, 1495, 13, 308, 13, 1678, 1683, 29901, 13, 13, 4706, 8722, 29918, 689, 353, 20802, 6103, 2500, 580, 13, 1678, 736, 4050, 29898, 3827, 29892, 525, 10185, 29914, 10185, 2500, 29889, 1420, 742, 1180, 1338, 3101, 13, 13, 13, 29992, 7507, 29918, 12403, 29898, 7507, 29918, 2271, 2433, 10149, 29879, 29914, 7507, 29914, 1495, 13, 1753, 788, 29918, 3027, 29898, 3827, 1125, 13, 1678, 1857, 29918, 1792, 353, 2009, 29889, 1792, 13, 1678, 565, 2009, 29889, 5696, 1275, 525, 5438, 2396, 13, 4706, 883, 353, 7084, 2500, 29898, 3827, 29889, 5438, 29892, 2009, 29889, 24483, 29897, 13, 4706, 565, 883, 29889, 275, 29918, 3084, 7295, 13, 9651, 788, 29922, 689, 29889, 7620, 29898, 15060, 29922, 8824, 29897, 13, 9651, 788, 29889, 10185, 353, 1857, 29918, 1792, 13, 9651, 396, 788, 29889, 10185, 29918, 14144, 29922, 1857, 29918, 1792, 29889, 10185, 13, 9651, 788, 29889, 7620, 580, 13, 9651, 736, 6684, 877, 5184, 1495, 13, 1678, 1683, 29901, 13, 4706, 883, 353, 7084, 2500, 580, 13, 13, 13, 1678, 736, 4050, 29898, 3827, 5501, 9009, 29889, 1420, 742, 2997, 29879, 3101, 13, 13, 29992, 7507, 29918, 12403, 29898, 7507, 29918, 2271, 2433, 29914, 10149, 29879, 29914, 7507, 29914, 1495, 13, 1753, 763, 29898, 3827, 29892, 1967, 29918, 333, 1125, 13, 1678, 1857, 29918, 1792, 353, 2009, 29889, 1792, 13, 1678, 1967, 29922, 2940, 29889, 12650, 29889, 657, 29898, 333, 29922, 3027, 29918, 333, 29897, 13, 1678, 716, 29918, 4561, 29892, 11600, 29922, 365, 29379, 29889, 12650, 29889, 657, 29918, 272, 29918, 3258, 29898, 492, 3946, 29922, 3784, 29918, 1792, 29892, 1967, 29922, 3027, 29897, 13, 1678, 716, 29918, 4561, 29889, 7620, 580, 13, 1678, 1596, 29898, 1482, 29918, 4561, 29897, 13, 1678, 736, 6684, 877, 5184, 1495, 13, 13, 1753, 3440, 29898, 3827, 29892, 3027, 29918, 333, 1125, 13, 1678, 1857, 29918, 1792, 29922, 3827, 29889, 1792, 13, 1678, 1967, 353, 7084, 29889, 12650, 29889, 657, 29898, 333, 29922, 3027, 29918, 333, 29897, 13, 1678, 8722, 29918, 20348, 353, 4911, 29889, 12650, 29889, 657, 29898, 6786, 29922, 3784, 29918, 1792, 29897, 13, 1678, 6589, 353, 461, 29889, 12650, 29889, 497, 580, 13, 1678, 1596, 29898, 21032, 29897, 13, 1678, 565, 2009, 29889, 5696, 1275, 525, 5438, 2396, 13, 4706, 883, 353, 461, 2500, 29898, 3827, 29889, 5438, 29897, 13, 4706, 565, 883, 29889, 275, 29918, 3084, 7295, 13, 9651, 3440, 353, 883, 29889, 7620, 29898, 15060, 29922, 8824, 29897, 13, 9651, 3440, 29889, 3027, 353, 1967, 13, 9651, 3440, 29889, 9342, 29918, 20348, 353, 1857, 29918, 1792, 13, 9651, 3440, 29889, 7620, 580, 13, 13, 9651, 1596, 29898, 21032, 29897, 13, 13, 13, 4706, 736, 6684, 29898, 5184, 29897, 13, 13, 1678, 1683, 29901, 13, 4706, 883, 353, 461, 2500, 580, 13, 13, 1678, 736, 4050, 29898, 3827, 29892, 525, 9342, 29889, 1420, 742, 1180, 1338, 3101, 13, 13, 13, 29992, 7507, 29918, 12403, 29898, 7507, 29918, 2271, 2433, 29914, 10149, 29879, 29914, 7507, 29914, 1495, 13, 1753, 2740, 29898, 3827, 1125, 259, 13, 1678, 565, 525, 1792, 29915, 297, 2009, 29889, 7194, 322, 2009, 29889, 7194, 3366, 1792, 3108, 29901, 13, 4706, 2740, 29918, 8489, 353, 2009, 29889, 7194, 29889, 657, 703, 1792, 1159, 13, 4706, 17371, 29918, 1792, 353, 20802, 29889, 4478, 29918, 6786, 29898, 4478, 29918, 8489, 29897, 13, 4706, 2643, 353, 285, 29908, 29912, 4478, 29918, 8489, 5038, 13, 4706, 1596, 29898, 4478, 287, 29918, 1792, 29897, 259, 13, 4706, 736, 4050, 29898, 3827, 29892, 525, 4478, 29889, 1420, 742, 6377, 4906, 1115, 4906, 1699, 7193, 1115, 4478, 287, 29918, 1792, 1800, 13, 13, 1678, 1683, 29901, 13, 4706, 2643, 353, 376, 3492, 7359, 29915, 29873, 17371, 363, 738, 1840, 29908, 13, 4706, 736, 4050, 29898, 3827, 29892, 525, 4478, 29889, 1420, 742, 6377, 4906, 1115, 4906, 1800, 13, 13, 29992, 7507, 29918, 12403, 29898, 7507, 29918, 2271, 2433, 29914, 10149, 29879, 29914, 7507, 29914, 1495, 13, 1753, 1101, 29898, 3827, 29892, 23031, 414, 1125, 13, 13, 259, 14550, 13, 12, 4062, 393, 28936, 263, 1404, 304, 1101, 1790, 1404, 29889, 13, 12, 12008, 13, 259, 1404, 29922, 2659, 29889, 12650, 29889, 657, 29898, 333, 29922, 23031, 414, 1723, 13, 1678, 13, 259, 338, 29918, 23031, 29922, 8824, 13, 259, 565, 10306, 29889, 12650, 29889, 4572, 29898, 1101, 886, 353, 3827, 29889, 1792, 29892, 23031, 414, 29871, 353, 1404, 467, 9933, 7295, 13, 539, 10306, 29889, 12650, 29889, 4572, 29898, 1101, 886, 353, 3827, 29889, 1792, 29892, 23031, 414, 29871, 353, 1404, 467, 8143, 580, 13, 539, 338, 29918, 23031, 29922, 8824, 13, 259, 1683, 29901, 13, 539, 10306, 29898, 1101, 886, 353, 3827, 29889, 1792, 29892, 23031, 414, 29871, 353, 1404, 467, 7620, 580, 13, 539, 338, 29918, 23031, 29922, 5574, 13, 259, 13, 13, 259, 736, 9056, 5103, 24735, 29898, 3827, 29889, 2303, 6040, 29889, 657, 877, 10493, 29918, 25866, 1001, 1001, 8785, 2 ]
graphene/graphene_core/relation_extraction/model/extraction.py
kkatsamaktsis/PyGraphene
0
131259
<gh_stars>0 class Extraction: pass
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 1990, 7338, 13857, 29901, 13, 1678, 1209, 13, 2 ]
tests/unit/test_nest.py
hkak03key/python-lib-sample
0
112029
<gh_stars>0 import sys def test_good_bye_nest(capfd): import lib_sample.nest as nest nest.good_bye() out, err = capfd.readouterr() assert out == "good_bye, this is nest/nest.py.\n" assert err is "" def test_good_bye_lib_sample(capfd): import lib_sample lib_sample.good_bye() out, err = capfd.readouterr() assert out == "good_bye, this is nest/nest.py.\n" assert err is ""
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 5215, 10876, 13, 13, 13, 13, 1753, 1243, 29918, 16773, 29918, 26966, 29918, 17510, 29898, 5030, 11512, 1125, 13, 1678, 1053, 4303, 29918, 11249, 29889, 17510, 408, 17763, 13, 1678, 17763, 29889, 16773, 29918, 26966, 580, 13, 13, 1678, 714, 29892, 4589, 353, 2117, 11512, 29889, 949, 5561, 29878, 580, 13, 1678, 4974, 714, 1275, 376, 16773, 29918, 26966, 29892, 445, 338, 17763, 29914, 17510, 29889, 2272, 7790, 29876, 29908, 13, 1678, 4974, 4589, 338, 5124, 13, 13, 1753, 1243, 29918, 16773, 29918, 26966, 29918, 1982, 29918, 11249, 29898, 5030, 11512, 1125, 13, 1678, 1053, 4303, 29918, 11249, 13, 1678, 4303, 29918, 11249, 29889, 16773, 29918, 26966, 580, 13, 13, 1678, 714, 29892, 4589, 353, 2117, 11512, 29889, 949, 5561, 29878, 580, 13, 1678, 4974, 714, 1275, 376, 16773, 29918, 26966, 29892, 445, 338, 17763, 29914, 17510, 29889, 2272, 7790, 29876, 29908, 13, 1678, 4974, 4589, 338, 5124, 13, 2 ]
pythonql/Executor.py
hi117/pythonql
0
43097
<reponame>hi117/pythonql from pythonql.algebra.operator import plan_from_list from pythonql.algebra.operators import * from pythonql.PQTuple import PQTuple from pythonql.helpers import flatten from pythonql.Rewriter import rewrite from pythonql.debug import Debug import json import types def make_pql_tuple(vals,lcs): t = [] als = [] for v in vals: t.append(eval(v[0],lcs,globals())) alias = v[1] if v[1] else v[0] als.append(alias) schema = {n:i for (i,n) in enumerate(als)} return PQTuple(t,schema) def str_dec(string): res = "" prev_slash = False for ch in string: if ch == chr(92): if not prev_slash: prev_slash = True else: res += ch prev_slash = False else: prev_slash = False res += ch return res # isList predicate for path expressions def isList(x): return (hasattr(x,'__iter__') and not hasattr(x,'keys') and not isinstance(x,str)) # isMap predicate for path expression def isMap(x): return hasattr(x,'keys') # Implement a child step on some collection or map def PQChildPath (coll,f,lcs): f = eval(str_dec(f), globals(), lcs) if f!='_' else None if isList(coll): for i in flatten(coll): if isMap(i): for j in i.keys(): if f is None: yield i[j] elif f and j==f: yield i[j] if isMap(coll): for i in coll.keys(): if f is None: yield coll[i] elif f and i==f: yield coll[i] class map_tuple: def __init__(self,key,value): self.key = key self.value = value def __repr__(self): return ("<" + repr(self.key) + ":" + repr(self.value) + ">") # Implement a descendents path on some collection or map def PQDescPath(coll,f,lcs): f = eval(f,globals(),lcs) if f!='_' else None stack = [] if isList(coll): stack = [i for i in flatten(coll)] elif isMap(coll): stack = [map_tuple(k,v) for (k,v) in coll.items()] while stack: i = stack.pop() if isinstance(i,map_tuple): if f is None: yield i.value elif f and i.key==f: yield i.value i = i.value if isList(i): it = iter(i) frst = next(it) [stack.append(j) for j in it] if isList(frst): stack.extend([ci for ci in frst]) elif isMap(frst): stack.extend([map_tuple(k,v) for (k,v) in frst.items()]) elif isMap(i): keys = list(i.keys()) [stack.append(map_tuple(j,i[j])) for j in keys] def PQTry( try_expr, except_expr, lcs): try_expr = str_dec(try_expr) except_expr = str_dec(except_expr) try: return eval(try_expr,lcs,globals()) except: return eval(except_expr,lcs,globals()) # create a table with an empty tuple def emptyTuple(schema): return PQTuple([None] * len(schema), schema) # Execute the query def PyQuery( clauses, prior_locs, prior_globs, returnType ): data = [] data.append( emptyTuple([]) ) clauses = list(clauses) clauses.reverse() plan = plan_from_list(clauses) plan = rewrite(plan, prior_locs) if Debug().print_optimized: print("Rewritten query:",plan) data = plan.execute(data, prior_locs, prior_globs) if returnType == "gen": return data elif returnType == "list": return list(data) elif returnType == "set": return set(data) else: return dict(data) # Process Select clause # We still keep that feature of generating tuples for now def processSelectClause(c, table, prior_lcs, prior_globs): # If this is a list/set comprehension: if c.expr: # Compile the expression: e = compile(c.expr.lstrip(), '<string>','eval') for t in table: lcs = dict(prior_lcs) lcs.update(t.getDict()) yield eval(e,prior_globs,lcs) else: k_expr = compile(c.key_expr.lstrip(),'<string>','eval') v_expr = compile(c.value_expr.lstrip(),'<string>','eval') for t in table: lcs = prior_lcs lcs.update(t.getDict()) k = eval(k_expr,prior_globs,lcs) v = eval(v_expr,prior_globs,lcs) yield (k,v) # Process the for clause. This clause creates a cartesian # product of the input table with new sequence def processForClause(c, table, prior_lcs, prior_globs): new_schema = None print(c.expr) comp_expr = compile(c.expr.lstrip(), "<string>", "eval") for t in table: if not new_schema: new_schema = dict(t.schema) for (i,v) in enumerate(c.vars): new_schema[v] = len(t.schema) + i lcs = dict(prior_lcs) lcs.update(t.getDict()) vals = eval(comp_expr, prior_globs, lcs) if len(c.vars) == 1: for v in vals: new_t_data = list(t.tuple) new_t_data.append(v) new_t = PQTuple(new_t_data, new_schema) yield new_t else: for v in vals: unpack_expr = "[ %s for %s in [ __v ]]" % ( '(' + ",".join(c.vars) + ')', c.unpack) unpacked_vals = eval(unpack_expr, prior_globs, {'__v':v}) new_t_data = list(t.tuple) for tv in unpacked_vals[0]: new_t_data.append(tv) new_t = PQTuple(new_t_data, new_schema) yield new_t # Process the let clause. Here we just add a variable to each # input tuple def processLetClause(c, table, prior_lcs, prior_globs): comp_expr = compile(c.expr.lstrip(), "<string>", "eval") new_schema = None for t in table: if not new_schema: new_schema = dict(t.schema) for (i,v) in enumerate(c.vars): new_schema[v] = len(t.schema) + i lcs = dict(prior_lcs) lcs.update(t.getDict()) v = eval(comp_expr, prior_globs, lcs) if len(c.vars) == 1: t.tuple.append(v) new_t = PQTuple( t.tuple, new_schema ) yield new_t else: unpack_expr = "[ %s for %s in [ __v ]]" % ( '(' + ",".join(c.vars) + ')', c.unpack) unpacked_vals = eval(unpack_expr, prior_globs, {'__v':v}) new_t_data = list(t.tuple) for tv in unpacked_vals[0]: new_t_data.append(tv) new_t = PQTuple(new_t_data, new_schema) yield new_t # Process a join def processJoin(c, table, prior_lcs, prior_globs, left_arg, right_arg): new_schema = None left_conds = c.left_conds right_conds = c.right_conds join_type = 'nl' dir = 'right' if c.hint: join_type = c.hint['join_type'] dir = c.hint['dir'] if dir == 'left': left_arg,right_arg = right_arg,left_arg r_init_data = [] r_init_data.append( emptyTuple([]) ) # Build an index on the right relation, if we're doing # an index join. index = None if join_type == 'index': index = {} r_data = r_init_data r_data = right_arg.execute(r_data, prior_lcs) for t in r_data: index_tuple = [] for rcond in right_conds: lcs = dict(prior_lcs) lcs.update(t.getDict()) rcond_val = eval(rcond, prior_globs, lcs) index_tuple.append( rcond_val ) index_tuple = tuple(index_tuple) if not index_tuple in index: index[ index_tuple ] = [] index[ index_tuple ].append( t ) # Iterate over the tuples of the left relation and # compute the tuple of condition vars table = left_arg.execute(table, prior_lcs, prior_globs) for t in table: cond_tuple = [] for lcond in left_conds: lcs = dict(prior_lcs) lcs.update(t.getDict()) lcond_val = eval(lcond, prior_globs, lcs) cond_tuple.append( lcond_val ) cond_tuple = tuple(cond_tuple) if index: if cond_tuple in index: for t2 in index[cond_tuple]: if not new_schema: new_schema = dict(t.schema) for i,_ in enumerate(t2): v = [x for x in t2.schema.items() if x[1]==i][0][0] new_schema[v] = len(new_schema) + i new_t_data = list(t.tuple) new_t_data += list(t2.tuple) new_t = PQTuple(new_t_data, new_schema) yield new_t else: continue else: r_data = r_init_data r_data = right_arg.execute(r_data, prior_lcs, prior_globs) for t2 in r_data: rcond_tuple = [] for rcond in right_conds: lcs = dict(prior_lcs) lcs.update(t2.getDict()) rcond_val = eval(rcond, prior_globs, lcs) rcond_tuple.append( rcond_val ) rcond_tuple = tuple(rcond_tuple) if cond_tuple == rcond_tuple: if not new_schema: new_schema = dict(t.schema) for i,_ in enumerate(t2): v = [x for x in t2.schema.items() if x[1]==i][0][0] new_schema[v] = len(new_schema) + i new_t_data = list(t.tuple) new_t_data += list(t2.tuple) new_t = PQTuple(new_t_data, new_schema) yield new_t # Process the match claise def processMatchClause(c, table, prior_lcs, prior_globs): clause_expr = compile(c.expr, "<string>", "eval") # Fetch and compile all expressions in the # pattern match clause e_patterns = [] patterns = list(c.pattern) while patterns: p = patterns.pop() if 'expr_cond' in p: e_patterns.append(p) if 'pattern' in p: patterns.append(p['pattern']) for ep in e_patterns: ep['expr_cond'] = compile(ep["expr_cond"], "<string>", "eval") new_schema = None for t in table: if not new_schema: new_schema = dict(t.schema) for (i,v) in enumerate(c.vars): new_schema[v] = len(t.schema) + i lcs = dict(prior_lcs) lcs.update(t.getDict()) vals = eval(clause_expr, prior_globs, lcs) for v in vals: if not hasattr(v, '__contains__'): continue new_t_data = list(t.tuple) + [None]*len(c.vars) new_t = PQTuple(new_t_data, new_schema) if match_pattern(c.pattern, c.exact, v, new_t, lcs, prior_globs): yield new_t def match_pattern(ps, isExact, v, new_t, lcs, prior_globs): all_heads = [] for p in [x for x in ps if 'match' in x]: match = p['match'][1:-1] all_heads.append(match) if match not in v: return False if 'const_cond' in p: if v[match] != p['const_cond'][1:-1]: return False if 'bind_to' in p: new_t[p['bind_to']] = v[match] lcs.update({p['bind_to']:v[match]}) if 'expr_cond' in p: val = eval(p['expr_cond'], prior_globs, lcs) if not val: return False if 'pattern' in p: if not match_pattern(p['pattern'], isExact, v[match], new_t, lcs, prior_globs): return False if isExact and any([x for x in v if x not in all_heads]): return False bind_parent = next((x for x in ps if 'bind_parent_to' in x), None) if bind_parent: new_t[bind_parent['bind_parent_to']] = v lcs.update({bind_parent['bind_parent_to']:v}) return True # Process the count clause. Similar to let, but simpler def processCountClause(c, table, prior_lcs, prior_globs): new_schema = None for (i,t) in enumerate(table): if not new_schema: new_schema = dict(t.schema) new_schema[c.var] = len(t.schema) new_t = PQTuple( t.tuple + [i], new_schema ) yield new_t # Process the group-by def processGroupByClause(c, table, prior_lcs, prior_globs): gby_aliases = [g if isinstance(g,str) else g[1] for g in c.groupby_list] gby_exprs = [g if isinstance(g,str) else g[0] for g in c.groupby_list] comp_exprs = [compile(e,'<string>','eval') for e in gby_exprs] grp_table = {} schema = None # Group tuples in a hashtable for t in table: if not schema: schema = t.schema lcs = dict(prior_lcs) lcs.update(t.getDict()) # Compute the key k = tuple( [eval(e,prior_globs,lcs) for e in comp_exprs] ) if not k in grp_table: grp_table[k] = [] grp_table[k].append(t) if not grp_table: return yield # Construct the new table # Non-key variables non_key_vars = [v for v in schema if not v in gby_aliases ] new_schema = {v:i for (i,v) in enumerate( gby_aliases + non_key_vars )} for k in grp_table: t = PQTuple([None]*len(new_schema), new_schema) #Copy over the key for (i,v) in enumerate(gby_aliases): t[v] = k[i] #Every other variable (not in group by list) is turned into a lists #First create empty lists for v in non_key_vars: t[v] = [] # Now fill in the lists: for part_t in grp_table[k]: for v in non_key_vars: t[v].append( part_t[v] ) yield t # Process where clause def processWhereClause(c, table, prior_lcs, prior_globs): comp_expr = compile(c.expr.lstrip(),"<string>","eval") for t in table: lcs = dict(prior_lcs) lcs.update(t.getDict()) val = eval(comp_expr, prior_globs, lcs) if val: yield t # Process the orderby clause def processOrderByClause(c, table, prior_lcs, prior_globs): # Here we do n sorts, n is the number of sort specifications # For each sort we first need to compute a sort value (could # be some expression) sort_exprs = [ compile(os[0].lstrip(),"<string>","eval") for os in c.orderby_list] sort_rev = [ o[1]=='desc' for o in c.orderby_list] def computeSortSpec(tup,sort_spec): lcs = dict(prior_lcs) lcs.update(tup.getDict()) return eval(sort_spec, prior_globs, lcs) sort_exprs.reverse() sort_rev.reverse() if isinstance(table,types.GeneratorType): table = list(table) for (i,e) in enumerate(sort_exprs): table.sort( key = lambda x: computeSortSpec(x,e), reverse= sort_rev[i]) for t in table: yield t # Create the set of variables for a new window # This is the full set just for convienience, the # query might not use all of these vars. # The names of the variables coincide with the # names in the specification of window clause def make_window_vars(): return {"s_curr":None, "s_at":None, "s_prev":None, "s_next":None, "e_curr":None, "e_at":None, "e_prev":None, "e_next":None} # Start variables from a list of variables all_start_vars = ["s_curr","s_at","s_prev","s_next"] # Fill in the start vars of the window, given the value list and current index def fill_in_start_vars(vars, binding_seq, i ): vars["s_curr"] = binding_seq[i] vars["s_at"] = i vars["s_prev"] = binding_seq[i-1] if i>0 else None vars["s_next"] = binding_seq[i+1] if i+1<len(binding_seq) else None # Fill in the end vars of the window, given the values list and current index def fill_in_end_vars(vars, binding_seq, i ): vars["e_curr"] = binding_seq[i] vars["e_at"] = i vars["e_prev"] = binding_seq[i-1] if i>0 else None vars["e_next"] = binding_seq[i+1] if i+1<len(binding_seq) else None # Check the start condition of the window, i.e. whether we should # start a new window at this location (without considering tumbling # windows, that check is done elsewhere). def check_start_condition(all_vars,clause,locals,prior_globs,var_mapping): # we just need to evaluate the when expression # but we need to set up the vars correctly, respecting the visibility # conditions start_vars = set(all_start_vars).intersection( set(var_mapping.keys()) ) start_bindings = { var_mapping[v] : all_vars[v] for v in start_vars } # add the binding to the locals locals.update( start_bindings ) #evaluate the when condition return eval( clause.s_when, prior_globs, locals ) # Check the end condition of the window. def check_end_condition(vars,clause,locals,prior_globs,var_mapping): # If there is no 'when' clause, return False if not clause.e_when: return False end_vars = set(vars.keys()).intersection( set(var_mapping.keys())) end_binding = { var_mapping[v] : vars[v] for v in end_vars } locals.update( end_binding ) res = eval( clause.e_when, prior_globs, locals) return res # Process window clause def processWindowClause(c, table, prior_lcs, prior_globs): schema = None new_schema = None # Create window variable name mapping var_mapping = {} for v in c.vars: var_mapping[v] = c.vars[v] for t in table: if not schema: schema = t.schema # Create a new schema with window variables added new_schema = dict(t.schema) for v in c.vars: new_schema[c.vars[v]] = len(new_schema) lcs = dict(prior_lcs) lcs.update(t.getDict()) # Evaluate the binding sequence binding_seq = list(eval(c.binding_seq, prior_globs, lcs)) # Create initial window variables # Initialize the windows open_windows = [] closed_windows = [] # Iterate over the binding sequence for (i,v) in enumerate(binding_seq): # Try to open a new window # in case of tumbling windows, only open a # window if there are no open windows if not c.tumbling or (c.tumbling and not open_windows): vars = make_window_vars() fill_in_start_vars(vars,binding_seq,i) if check_start_condition(vars,c,dict(lcs),prior_globs,var_mapping): open_windows.append( {"window":[], "vars":vars} ) new_open_windows = [] #update all open windows, close those that are finished for w in open_windows: # Add currnt value to the window w["window"].append(v) fill_in_end_vars(w["vars"],binding_seq,i) if check_end_condition(w["vars"],c,dict(lcs),prior_globs,var_mapping): closed_windows.append(w) else: new_open_windows.append(w) open_windows = new_open_windows #close or remove all remaining open windows #if only is specified, we ignore non-closed windows if not c.only: closed_windows.extend(open_windows) # create a new tuple by extending the tuple from previous clauses # with the window variables, for each closed window for w in closed_windows: new_t = PQTuple( t.tuple + [None]*(len(new_schema)-len(schema)), new_schema) new_t[ var_mapping["var"] ] = w["window"] for v in [v for v in w["vars"].keys() if v in var_mapping]: new_t[ var_mapping[v] ] = w["vars"][v] yield new_t
[ 1, 529, 276, 1112, 420, 29958, 2918, 29896, 29896, 29955, 29914, 4691, 1519, 13, 3166, 3017, 1519, 29889, 15742, 29889, 6891, 1053, 3814, 29918, 3166, 29918, 1761, 13, 3166, 3017, 1519, 29889, 15742, 29889, 3372, 4097, 1053, 334, 13, 3166, 3017, 1519, 29889, 29925, 29984, 23215, 552, 1053, 349, 29984, 23215, 552, 13, 3166, 3017, 1519, 29889, 3952, 6774, 1053, 1652, 8606, 13, 3166, 3017, 1519, 29889, 29934, 809, 5385, 1053, 10683, 13, 3166, 3017, 1519, 29889, 8382, 1053, 16171, 13, 5215, 4390, 13, 5215, 4072, 13, 13, 1753, 1207, 29918, 29886, 1519, 29918, 23583, 29898, 791, 29879, 29892, 29880, 2395, 1125, 13, 29871, 260, 353, 5159, 13, 29871, 1620, 353, 5159, 13, 29871, 363, 325, 297, 659, 29879, 29901, 13, 1678, 260, 29889, 4397, 29898, 14513, 29898, 29894, 29961, 29900, 1402, 29880, 2395, 29892, 23705, 1338, 22130, 13, 1678, 13995, 353, 325, 29961, 29896, 29962, 565, 325, 29961, 29896, 29962, 1683, 325, 29961, 29900, 29962, 13, 1678, 1620, 29889, 4397, 29898, 19973, 29897, 13, 13, 29871, 10938, 353, 426, 29876, 29901, 29875, 363, 313, 29875, 29892, 29876, 29897, 297, 26985, 29898, 1338, 2915, 13, 29871, 736, 349, 29984, 23215, 552, 29898, 29873, 29892, 11010, 29897, 13, 13, 1753, 851, 29918, 7099, 29898, 1807, 1125, 13, 1678, 620, 353, 5124, 13, 1678, 12379, 29918, 17057, 353, 7700, 13, 1678, 363, 521, 297, 1347, 29901, 13, 4706, 565, 521, 1275, 18460, 29898, 29929, 29906, 1125, 13, 9651, 565, 451, 12379, 29918, 17057, 29901, 13, 18884, 12379, 29918, 17057, 353, 5852, 13, 9651, 1683, 29901, 13, 18884, 620, 4619, 521, 13, 18884, 12379, 29918, 17057, 353, 7700, 13, 4706, 1683, 29901, 13, 9651, 12379, 29918, 17057, 353, 7700, 13, 9651, 620, 4619, 521, 13, 1678, 736, 620, 13, 13, 29937, 338, 1293, 24384, 363, 2224, 12241, 13, 1753, 338, 1293, 29898, 29916, 1125, 13, 29871, 736, 313, 5349, 5552, 29898, 29916, 5501, 1649, 1524, 1649, 1495, 322, 451, 29871, 13, 3986, 756, 5552, 29898, 29916, 5501, 8149, 1495, 322, 451, 13, 3986, 338, 8758, 29898, 29916, 29892, 710, 876, 13, 13, 29937, 338, 3388, 24384, 363, 2224, 4603, 13, 1753, 338, 3388, 29898, 29916, 1125, 13, 29871, 736, 756, 5552, 29898, 29916, 5501, 8149, 1495, 13, 13, 29937, 1954, 2037, 263, 2278, 4331, 373, 777, 4333, 470, 2910, 13, 1753, 349, 29984, 5938, 2605, 313, 22017, 29892, 29888, 29892, 29880, 2395, 1125, 13, 29871, 285, 353, 19745, 29898, 710, 29918, 7099, 29898, 29888, 511, 13149, 1338, 3285, 301, 2395, 29897, 565, 285, 29991, 2433, 29918, 29915, 1683, 6213, 13, 29871, 565, 338, 1293, 29898, 22017, 1125, 13, 1678, 363, 474, 297, 1652, 8606, 29898, 22017, 1125, 13, 418, 565, 338, 3388, 29898, 29875, 1125, 13, 4706, 363, 432, 297, 474, 29889, 8149, 7295, 13, 3986, 565, 285, 338, 6213, 29901, 13, 9651, 7709, 474, 29961, 29926, 29962, 13, 3986, 25342, 285, 322, 432, 1360, 29888, 29901, 13, 9651, 7709, 474, 29961, 29926, 29962, 13, 13, 29871, 565, 338, 3388, 29898, 22017, 1125, 13, 1678, 363, 474, 297, 5321, 29889, 8149, 7295, 13, 418, 565, 285, 338, 6213, 29901, 13, 4706, 7709, 5321, 29961, 29875, 29962, 13, 418, 25342, 285, 322, 474, 1360, 29888, 29901, 13, 4706, 7709, 5321, 29961, 29875, 29962, 13, 13, 1990, 2910, 29918, 23583, 29901, 13, 29871, 822, 4770, 2344, 12035, 1311, 29892, 1989, 29892, 1767, 1125, 13, 1678, 1583, 29889, 1989, 353, 1820, 13, 1678, 1583, 29889, 1767, 353, 995, 13, 13, 29871, 822, 4770, 276, 558, 12035, 1311, 1125, 13, 1678, 736, 4852, 29966, 29908, 718, 2062, 29898, 1311, 29889, 1989, 29897, 718, 376, 6160, 718, 2062, 29898, 1311, 29889, 1767, 29897, 718, 376, 29958, 1159, 13, 13, 29937, 1954, 2037, 263, 17086, 1237, 2224, 373, 777, 4333, 470, 2910, 13, 1753, 349, 29984, 19617, 2605, 29898, 22017, 29892, 29888, 29892, 29880, 2395, 1125, 13, 29871, 285, 353, 19745, 29898, 29888, 29892, 23705, 1338, 3285, 29880, 2395, 29897, 565, 285, 29991, 2433, 29918, 29915, 1683, 6213, 13, 29871, 5096, 353, 5159, 13, 29871, 565, 338, 1293, 29898, 22017, 1125, 13, 1678, 5096, 353, 518, 29875, 363, 474, 297, 1652, 8606, 29898, 22017, 4638, 13, 29871, 25342, 338, 3388, 29898, 22017, 1125, 13, 1678, 5096, 353, 518, 1958, 29918, 23583, 29898, 29895, 29892, 29894, 29897, 363, 313, 29895, 29892, 29894, 29897, 297, 5321, 29889, 7076, 580, 29962, 13, 13, 29871, 1550, 5096, 29901, 13, 1678, 474, 353, 5096, 29889, 7323, 580, 13, 13, 1678, 565, 338, 8758, 29898, 29875, 29892, 1958, 29918, 23583, 1125, 13, 418, 565, 285, 338, 6213, 29901, 13, 4706, 7709, 474, 29889, 1767, 13, 418, 25342, 285, 322, 474, 29889, 1989, 1360, 29888, 29901, 13, 4706, 7709, 474, 29889, 1767, 13, 13, 418, 474, 353, 474, 29889, 1767, 13, 13, 1678, 565, 338, 1293, 29898, 29875, 1125, 13, 418, 372, 353, 4256, 29898, 29875, 29897, 13, 418, 1424, 303, 353, 2446, 29898, 277, 29897, 13, 418, 518, 1429, 29889, 4397, 29898, 29926, 29897, 363, 432, 297, 372, 29962, 13, 418, 565, 338, 1293, 29898, 1341, 303, 1125, 13, 4706, 5096, 29889, 21843, 4197, 455, 363, 4583, 297, 1424, 303, 2314, 13, 418, 25342, 338, 3388, 29898, 1341, 303, 1125, 13, 4706, 5096, 29889, 21843, 4197, 1958, 29918, 23583, 29898, 29895, 29892, 29894, 29897, 363, 313, 29895, 29892, 29894, 29897, 297, 1424, 303, 29889, 7076, 580, 2314, 13, 13, 1678, 25342, 338, 3388, 29898, 29875, 1125, 13, 418, 6611, 353, 1051, 29898, 29875, 29889, 8149, 3101, 13, 418, 518, 1429, 29889, 4397, 29898, 1958, 29918, 23583, 29898, 29926, 29892, 29875, 29961, 29926, 12622, 363, 432, 297, 6611, 29962, 13, 13, 1753, 349, 29984, 15870, 29898, 1018, 29918, 13338, 29892, 5174, 29918, 13338, 29892, 301, 2395, 1125, 13, 29871, 1018, 29918, 13338, 353, 851, 29918, 7099, 29898, 2202, 29918, 13338, 29897, 13, 29871, 5174, 29918, 13338, 353, 851, 29918, 7099, 29898, 19499, 29918, 13338, 29897, 13, 29871, 1018, 29901, 13, 1678, 736, 19745, 29898, 2202, 29918, 13338, 29892, 29880, 2395, 29892, 23705, 1338, 3101, 13, 29871, 5174, 29901, 13, 1678, 736, 19745, 29898, 19499, 29918, 13338, 29892, 29880, 2395, 29892, 23705, 1338, 3101, 13, 13, 29937, 1653, 263, 1591, 411, 385, 4069, 18761, 13, 1753, 4069, 23215, 552, 29898, 11010, 1125, 13, 29871, 736, 349, 29984, 23215, 552, 4197, 8516, 29962, 334, 7431, 29898, 11010, 511, 10938, 29897, 13, 13, 29937, 11080, 1082, 278, 2346, 13, 1753, 10772, 3010, 29898, 3711, 6394, 29892, 7536, 29918, 2029, 29879, 29892, 7536, 29918, 23705, 29879, 29892, 736, 1542, 29871, 1125, 13, 29871, 848, 353, 5159, 13, 29871, 848, 29889, 4397, 29898, 4069, 23215, 552, 4197, 2314, 1723, 13, 13, 29871, 3711, 6394, 353, 1051, 29898, 16398, 6394, 29897, 13, 29871, 3711, 6394, 29889, 24244, 580, 13, 13, 29871, 3814, 353, 3814, 29918, 3166, 29918, 1761, 29898, 16398, 6394, 29897, 13, 29871, 3814, 353, 10683, 29898, 9018, 29892, 7536, 29918, 2029, 29879, 29897, 13, 13, 29871, 565, 16171, 2141, 2158, 29918, 20640, 1891, 29901, 13, 418, 1596, 703, 29934, 809, 20833, 2346, 29901, 613, 9018, 29897, 13, 29871, 848, 353, 3814, 29889, 7978, 29898, 1272, 29892, 7536, 29918, 2029, 29879, 29892, 7536, 29918, 23705, 29879, 29897, 13, 29871, 565, 736, 1542, 1275, 376, 1885, 1115, 13, 1678, 736, 848, 13, 29871, 25342, 736, 1542, 1275, 376, 1761, 1115, 13, 1678, 736, 1051, 29898, 1272, 29897, 13, 29871, 25342, 736, 1542, 1275, 376, 842, 1115, 13, 1678, 736, 731, 29898, 1272, 29897, 13, 29871, 1683, 29901, 13, 1678, 736, 9657, 29898, 1272, 29897, 13, 13, 29937, 10554, 7605, 11845, 13, 29937, 1334, 1603, 3013, 393, 4682, 310, 14655, 5291, 2701, 363, 1286, 13, 1753, 1889, 3549, 20216, 1509, 29898, 29883, 29892, 1591, 29892, 7536, 29918, 29880, 2395, 29892, 7536, 29918, 23705, 29879, 1125, 13, 29871, 396, 960, 445, 338, 263, 1051, 29914, 842, 15171, 2673, 29901, 13, 29871, 565, 274, 29889, 13338, 29901, 13, 1678, 396, 3831, 488, 278, 4603, 29901, 13, 1678, 321, 353, 6633, 29898, 29883, 29889, 13338, 29889, 29880, 17010, 3285, 12801, 1807, 29958, 3788, 14513, 1495, 13, 1678, 363, 260, 297, 1591, 29901, 13, 418, 301, 2395, 353, 9657, 29898, 29886, 13479, 29918, 29880, 2395, 29897, 13, 418, 301, 2395, 29889, 5504, 29898, 29873, 29889, 657, 21533, 3101, 13, 418, 7709, 19745, 29898, 29872, 29892, 29886, 13479, 29918, 23705, 29879, 29892, 29880, 2395, 29897, 13, 13, 29871, 1683, 29901, 13, 1678, 413, 29918, 13338, 353, 6633, 29898, 29883, 29889, 1989, 29918, 13338, 29889, 29880, 17010, 3285, 29915, 29966, 1807, 29958, 3788, 14513, 1495, 13, 1678, 325, 29918, 13338, 353, 6633, 29898, 29883, 29889, 1767, 29918, 13338, 29889, 29880, 17010, 3285, 29915, 29966, 1807, 29958, 3788, 14513, 1495, 13, 1678, 363, 260, 297, 1591, 29901, 13, 418, 301, 2395, 353, 7536, 29918, 29880, 2395, 13, 418, 301, 2395, 29889, 5504, 29898, 29873, 29889, 657, 21533, 3101, 13, 418, 413, 353, 19745, 29898, 29895, 29918, 13338, 29892, 29886, 13479, 29918, 23705, 29879, 29892, 29880, 2395, 29897, 13, 418, 325, 353, 19745, 29898, 29894, 29918, 13338, 29892, 29886, 13479, 29918, 23705, 29879, 29892, 29880, 2395, 29897, 13, 418, 7709, 313, 29895, 29892, 29894, 29897, 13, 13, 29937, 10554, 278, 363, 11845, 29889, 910, 11845, 10017, 263, 7774, 18970, 13, 29937, 3234, 310, 278, 1881, 1591, 411, 716, 5665, 13, 1753, 1889, 2831, 20216, 1509, 29898, 29883, 29892, 1591, 29892, 7536, 29918, 29880, 2395, 29892, 7536, 29918, 23705, 29879, 1125, 13, 29871, 716, 29918, 11010, 353, 6213, 13, 29871, 1596, 29898, 29883, 29889, 13338, 29897, 13, 29871, 752, 29918, 13338, 353, 6633, 29898, 29883, 29889, 13338, 29889, 29880, 17010, 3285, 9872, 1807, 28341, 376, 14513, 1159, 13, 13, 29871, 363, 260, 297, 1591, 29901, 13, 1678, 565, 451, 716, 29918, 11010, 29901, 13, 418, 716, 29918, 11010, 353, 9657, 29898, 29873, 29889, 11010, 29897, 13, 418, 363, 313, 29875, 29892, 29894, 29897, 297, 26985, 29898, 29883, 29889, 16908, 1125, 13, 4706, 716, 29918, 11010, 29961, 29894, 29962, 353, 7431, 29898, 29873, 29889, 11010, 29897, 718, 474, 13, 13, 1678, 301, 2395, 353, 9657, 29898, 29886, 13479, 29918, 29880, 2395, 29897, 13, 1678, 301, 2395, 29889, 5504, 29898, 29873, 29889, 657, 21533, 3101, 13, 1678, 659, 29879, 353, 19745, 29898, 2388, 29918, 13338, 29892, 7536, 29918, 23705, 29879, 29892, 301, 2395, 29897, 13, 1678, 565, 7431, 29898, 29883, 29889, 16908, 29897, 1275, 29871, 29896, 29901, 13, 418, 363, 325, 297, 659, 29879, 29901, 13, 4706, 716, 29918, 29873, 29918, 1272, 353, 1051, 29898, 29873, 29889, 23583, 29897, 13, 4706, 716, 29918, 29873, 29918, 1272, 29889, 4397, 29898, 29894, 29897, 13, 4706, 716, 29918, 29873, 353, 349, 29984, 23215, 552, 29898, 1482, 29918, 29873, 29918, 1272, 29892, 716, 29918, 11010, 29897, 13, 4706, 7709, 716, 29918, 29873, 13, 268, 13, 1678, 1683, 29901, 13, 418, 363, 325, 297, 659, 29879, 29901, 13, 4706, 443, 4058, 29918, 13338, 353, 14704, 1273, 29879, 363, 1273, 29879, 297, 518, 4770, 29894, 4514, 18017, 1273, 313, 13, 462, 418, 525, 877, 718, 9162, 1642, 7122, 29898, 29883, 29889, 16908, 29897, 718, 25710, 742, 274, 29889, 348, 4058, 29897, 13, 4706, 443, 4058, 287, 29918, 791, 29879, 353, 19745, 29898, 348, 4058, 29918, 13338, 29892, 7536, 29918, 23705, 29879, 29892, 11117, 1649, 29894, 2396, 29894, 1800, 13, 4706, 716, 29918, 29873, 29918, 1272, 353, 1051, 29898, 29873, 29889, 23583, 29897, 13, 4706, 363, 9631, 297, 443, 4058, 287, 29918, 791, 29879, 29961, 29900, 5387, 13, 3986, 716, 29918, 29873, 29918, 1272, 29889, 4397, 29898, 12427, 29897, 13, 4706, 716, 29918, 29873, 353, 349, 29984, 23215, 552, 29898, 1482, 29918, 29873, 29918, 1272, 29892, 716, 29918, 11010, 29897, 13, 4706, 7709, 716, 29918, 29873, 13, 13, 29937, 10554, 278, 1235, 11845, 29889, 2266, 591, 925, 788, 263, 2286, 304, 1269, 13, 29937, 1881, 18761, 13, 1753, 1889, 12024, 20216, 1509, 29898, 29883, 29892, 1591, 29892, 7536, 29918, 29880, 2395, 29892, 7536, 29918, 23705, 29879, 1125, 13, 29871, 752, 29918, 13338, 353, 6633, 29898, 29883, 29889, 13338, 29889, 29880, 17010, 3285, 9872, 1807, 28341, 376, 14513, 1159, 13, 29871, 716, 29918, 11010, 353, 6213, 13, 29871, 363, 260, 297, 1591, 29901, 13, 13, 1678, 565, 451, 716, 29918, 11010, 29901, 13, 418, 716, 29918, 11010, 353, 9657, 29898, 29873, 29889, 11010, 29897, 13, 418, 363, 313, 29875, 29892, 29894, 29897, 297, 26985, 29898, 29883, 29889, 16908, 1125, 13, 4706, 716, 29918, 11010, 29961, 29894, 29962, 353, 7431, 29898, 29873, 29889, 11010, 29897, 718, 474, 13, 13, 1678, 301, 2395, 353, 9657, 29898, 29886, 13479, 29918, 29880, 2395, 29897, 13, 1678, 301, 2395, 29889, 5504, 29898, 29873, 29889, 657, 21533, 3101, 13, 1678, 325, 353, 19745, 29898, 2388, 29918, 13338, 29892, 7536, 29918, 23705, 29879, 29892, 301, 2395, 29897, 13, 1678, 565, 7431, 29898, 29883, 29889, 16908, 29897, 1275, 29871, 29896, 29901, 13, 418, 260, 29889, 23583, 29889, 4397, 29898, 29894, 29897, 13, 418, 716, 29918, 29873, 353, 349, 29984, 23215, 552, 29898, 260, 29889, 23583, 29892, 716, 29918, 11010, 1723, 13, 418, 7709, 716, 29918, 29873, 13, 13, 1678, 1683, 29901, 13, 418, 443, 4058, 29918, 13338, 353, 14704, 1273, 29879, 363, 1273, 29879, 297, 518, 4770, 29894, 4514, 18017, 1273, 313, 13, 462, 418, 525, 877, 718, 9162, 1642, 7122, 29898, 29883, 29889, 16908, 29897, 718, 25710, 742, 274, 29889, 348, 4058, 29897, 29871, 13, 418, 443, 4058, 287, 29918, 791, 29879, 353, 19745, 29898, 348, 4058, 29918, 13338, 29892, 7536, 29918, 23705, 29879, 29892, 11117, 1649, 29894, 2396, 29894, 1800, 13, 418, 716, 29918, 29873, 29918, 1272, 353, 1051, 29898, 29873, 29889, 23583, 29897, 13, 418, 363, 9631, 297, 443, 4058, 287, 29918, 791, 29879, 29961, 29900, 5387, 13, 4706, 716, 29918, 29873, 29918, 1272, 29889, 4397, 29898, 12427, 29897, 13, 418, 716, 29918, 29873, 353, 349, 29984, 23215, 552, 29898, 1482, 29918, 29873, 29918, 1272, 29892, 716, 29918, 11010, 29897, 13, 418, 7709, 716, 29918, 29873, 13, 13, 29937, 10554, 263, 5988, 13, 1753, 1889, 17242, 29898, 29883, 29892, 1591, 29892, 7536, 29918, 29880, 2395, 29892, 7536, 29918, 23705, 29879, 29892, 2175, 29918, 1191, 29892, 1492, 29918, 1191, 1125, 13, 29871, 716, 29918, 11010, 353, 6213, 13, 29871, 2175, 29918, 1116, 29879, 353, 274, 29889, 1563, 29918, 1116, 29879, 13, 29871, 1492, 29918, 1116, 29879, 353, 274, 29889, 1266, 29918, 1116, 29879, 13, 29871, 13, 29871, 5988, 29918, 1853, 353, 525, 12938, 29915, 13, 29871, 4516, 353, 525, 1266, 29915, 13, 29871, 565, 274, 29889, 29882, 524, 29901, 13, 1678, 5988, 29918, 1853, 353, 274, 29889, 29882, 524, 1839, 7122, 29918, 1853, 2033, 13, 1678, 4516, 353, 274, 29889, 29882, 524, 1839, 3972, 2033, 13, 13, 29871, 565, 4516, 1275, 525, 1563, 2396, 13, 1678, 2175, 29918, 1191, 29892, 1266, 29918, 1191, 353, 1492, 29918, 1191, 29892, 1563, 29918, 1191, 13, 13, 29871, 364, 29918, 2344, 29918, 1272, 353, 5159, 13, 29871, 364, 29918, 2344, 29918, 1272, 29889, 4397, 29898, 4069, 23215, 552, 4197, 2314, 1723, 13, 13, 29871, 396, 8878, 385, 2380, 373, 278, 1492, 8220, 29892, 565, 591, 29915, 276, 2599, 13, 29871, 396, 385, 2380, 5988, 29889, 29871, 13, 29871, 2380, 353, 6213, 13, 29871, 565, 5988, 29918, 1853, 1275, 525, 2248, 2396, 13, 1678, 2380, 353, 6571, 13, 1678, 364, 29918, 1272, 353, 364, 29918, 2344, 29918, 1272, 13, 1678, 364, 29918, 1272, 353, 1492, 29918, 1191, 29889, 7978, 29898, 29878, 29918, 1272, 29892, 7536, 29918, 29880, 2395, 29897, 13, 13, 1678, 363, 260, 297, 364, 29918, 1272, 29901, 13, 4706, 2380, 29918, 23583, 353, 5159, 29871, 13, 4706, 363, 364, 1116, 297, 1492, 29918, 1116, 29879, 29901, 13, 9651, 301, 2395, 353, 9657, 29898, 29886, 13479, 29918, 29880, 2395, 29897, 13, 9651, 301, 2395, 29889, 5504, 29898, 29873, 29889, 657, 21533, 3101, 13, 9651, 364, 1116, 29918, 791, 353, 19745, 29898, 29878, 1116, 29892, 7536, 29918, 23705, 29879, 29892, 301, 2395, 29897, 13, 9651, 2380, 29918, 23583, 29889, 4397, 29898, 364, 1116, 29918, 791, 1723, 13, 4706, 2380, 29918, 23583, 353, 18761, 29898, 2248, 29918, 23583, 29897, 13, 4706, 565, 451, 2380, 29918, 23583, 297, 2380, 29901, 13, 9651, 2380, 29961, 2380, 29918, 23583, 4514, 353, 5159, 13, 4706, 2380, 29961, 2380, 29918, 23583, 29871, 1822, 4397, 29898, 260, 1723, 13, 13, 29871, 396, 20504, 403, 975, 278, 5291, 2701, 310, 278, 2175, 8220, 322, 13, 29871, 396, 10272, 278, 18761, 310, 4195, 24987, 13, 13, 29871, 1591, 353, 2175, 29918, 1191, 29889, 7978, 29898, 2371, 29892, 7536, 29918, 29880, 2395, 29892, 7536, 29918, 23705, 29879, 29897, 13, 29871, 363, 260, 297, 1591, 29901, 13, 268, 2148, 29918, 23583, 353, 5159, 13, 268, 363, 301, 1116, 297, 2175, 29918, 1116, 29879, 29901, 13, 308, 301, 2395, 353, 9657, 29898, 29886, 13479, 29918, 29880, 2395, 29897, 13, 308, 301, 2395, 29889, 5504, 29898, 29873, 29889, 657, 21533, 3101, 13, 308, 301, 1116, 29918, 791, 353, 19745, 29898, 29880, 1116, 29892, 7536, 29918, 23705, 29879, 29892, 301, 2395, 29897, 13, 308, 2148, 29918, 23583, 29889, 4397, 29898, 301, 1116, 29918, 791, 1723, 13, 268, 2148, 29918, 23583, 353, 18761, 29898, 1116, 29918, 23583, 29897, 13, 13, 268, 565, 2380, 29901, 13, 308, 565, 2148, 29918, 23583, 297, 2380, 29901, 13, 632, 363, 260, 29906, 297, 2380, 29961, 1116, 29918, 23583, 5387, 13, 462, 565, 451, 716, 29918, 11010, 29901, 13, 462, 268, 716, 29918, 11010, 353, 9657, 29898, 29873, 29889, 11010, 29897, 13, 462, 268, 363, 474, 29892, 29918, 297, 26985, 29898, 29873, 29906, 1125, 13, 462, 308, 325, 353, 518, 29916, 363, 921, 297, 260, 29906, 29889, 11010, 29889, 7076, 580, 565, 921, 29961, 29896, 29962, 1360, 29875, 3816, 29900, 3816, 29900, 29962, 13, 462, 308, 716, 29918, 11010, 29961, 29894, 29962, 353, 7431, 29898, 1482, 29918, 11010, 29897, 718, 474, 13, 462, 716, 29918, 29873, 29918, 1272, 353, 1051, 29898, 29873, 29889, 23583, 29897, 13, 462, 716, 29918, 29873, 29918, 1272, 4619, 1051, 29898, 29873, 29906, 29889, 23583, 29897, 13, 462, 716, 29918, 29873, 353, 349, 29984, 23215, 552, 29898, 1482, 29918, 29873, 29918, 1272, 29892, 716, 29918, 11010, 29897, 13, 462, 7709, 716, 29918, 29873, 13, 308, 1683, 29901, 13, 632, 6773, 13, 268, 1683, 29901, 13, 3986, 364, 29918, 1272, 353, 364, 29918, 2344, 29918, 1272, 13, 3986, 364, 29918, 1272, 353, 1492, 29918, 1191, 29889, 7978, 29898, 29878, 29918, 1272, 29892, 7536, 29918, 29880, 2395, 29892, 7536, 29918, 23705, 29879, 29897, 13, 13, 3986, 363, 260, 29906, 297, 364, 29918, 1272, 29901, 13, 795, 364, 1116, 29918, 23583, 353, 5159, 13, 795, 363, 364, 1116, 297, 1492, 29918, 1116, 29879, 29901, 13, 462, 29871, 301, 2395, 353, 9657, 29898, 29886, 13479, 29918, 29880, 2395, 29897, 13, 462, 29871, 301, 2395, 29889, 5504, 29898, 29873, 29906, 29889, 657, 21533, 3101, 13, 462, 29871, 364, 1116, 29918, 791, 353, 19745, 29898, 29878, 1116, 29892, 7536, 29918, 23705, 29879, 29892, 301, 2395, 29897, 13, 462, 29871, 364, 1116, 29918, 23583, 29889, 4397, 29898, 364, 1116, 29918, 791, 1723, 13, 13, 795, 364, 1116, 29918, 23583, 353, 18761, 29898, 29878, 1116, 29918, 23583, 29897, 13, 795, 565, 2148, 29918, 23583, 1275, 364, 1116, 29918, 23583, 29901, 13, 462, 565, 451, 716, 29918, 11010, 29901, 13, 462, 268, 716, 29918, 11010, 353, 9657, 29898, 29873, 29889, 11010, 29897, 13, 462, 268, 363, 474, 29892, 29918, 297, 26985, 29898, 29873, 29906, 1125, 13, 462, 308, 325, 353, 518, 29916, 363, 921, 297, 260, 29906, 29889, 11010, 29889, 7076, 580, 565, 921, 29961, 29896, 29962, 1360, 29875, 3816, 29900, 3816, 29900, 29962, 13, 462, 308, 716, 29918, 11010, 29961, 29894, 29962, 353, 7431, 29898, 1482, 29918, 11010, 29897, 718, 474, 13, 462, 716, 29918, 29873, 29918, 1272, 353, 1051, 29898, 29873, 29889, 23583, 29897, 13, 462, 716, 29918, 29873, 29918, 1272, 4619, 1051, 29898, 29873, 29906, 29889, 23583, 29897, 13, 462, 716, 29918, 29873, 353, 349, 29984, 23215, 552, 29898, 1482, 29918, 29873, 29918, 1272, 29892, 716, 29918, 11010, 29897, 13, 462, 7709, 716, 29918, 29873, 13, 13, 29937, 10554, 278, 1993, 3711, 895, 13, 1753, 1889, 9652, 20216, 1509, 29898, 29883, 29892, 1591, 29892, 7536, 29918, 29880, 2395, 29892, 7536, 29918, 23705, 29879, 1125, 13, 29871, 11845, 29918, 13338, 353, 6633, 29898, 29883, 29889, 13338, 29892, 9872, 1807, 28341, 376, 14513, 1159, 13, 13, 29871, 396, 383, 3486, 322, 6633, 599, 12241, 297, 278, 13, 29871, 396, 4766, 1993, 11845, 13, 29871, 321, 29918, 11037, 29879, 353, 5159, 13, 29871, 15038, 353, 1051, 29898, 29883, 29889, 11037, 29897, 13, 29871, 1550, 15038, 29901, 13, 1678, 282, 353, 15038, 29889, 7323, 580, 29871, 13, 1678, 565, 525, 13338, 29918, 1116, 29915, 297, 282, 29901, 13, 418, 321, 29918, 11037, 29879, 29889, 4397, 29898, 29886, 29897, 13, 1678, 565, 525, 11037, 29915, 297, 282, 29901, 13, 418, 15038, 29889, 4397, 29898, 29886, 1839, 11037, 11287, 13, 259, 13, 29871, 363, 9358, 297, 321, 29918, 11037, 29879, 29901, 13, 1678, 9358, 1839, 13338, 29918, 1116, 2033, 353, 6633, 29898, 1022, 3366, 13338, 29918, 1116, 12436, 9872, 1807, 28341, 376, 14513, 1159, 13, 13, 29871, 716, 29918, 11010, 353, 6213, 13, 29871, 363, 260, 297, 1591, 29901, 13, 1678, 565, 451, 716, 29918, 11010, 29901, 13, 418, 716, 29918, 11010, 353, 9657, 29898, 29873, 29889, 11010, 29897, 13, 418, 363, 313, 29875, 29892, 29894, 29897, 297, 26985, 29898, 29883, 29889, 16908, 1125, 13, 4706, 716, 29918, 11010, 29961, 29894, 29962, 353, 7431, 29898, 29873, 29889, 11010, 29897, 718, 474, 13, 13, 1678, 301, 2395, 353, 9657, 29898, 29886, 13479, 29918, 29880, 2395, 29897, 13, 1678, 301, 2395, 29889, 5504, 29898, 29873, 29889, 657, 21533, 3101, 13, 1678, 659, 29879, 353, 19745, 29898, 16398, 1509, 29918, 13338, 29892, 7536, 29918, 23705, 29879, 29892, 301, 2395, 29897, 13, 13, 1678, 363, 325, 297, 659, 29879, 29901, 13, 418, 565, 451, 756, 5552, 29898, 29894, 29892, 525, 1649, 11516, 1649, 29374, 13, 4706, 6773, 13, 539, 13, 418, 716, 29918, 29873, 29918, 1272, 353, 1051, 29898, 29873, 29889, 23583, 29897, 718, 518, 8516, 14178, 2435, 29898, 29883, 29889, 16908, 29897, 13, 418, 716, 29918, 29873, 353, 349, 29984, 23215, 552, 29898, 1482, 29918, 29873, 29918, 1272, 29892, 716, 29918, 11010, 29897, 13, 13, 418, 565, 1993, 29918, 11037, 29898, 29883, 29889, 11037, 29892, 274, 29889, 735, 627, 29892, 325, 29892, 716, 29918, 29873, 29892, 301, 2395, 29892, 7536, 29918, 23705, 29879, 1125, 13, 4706, 7709, 716, 29918, 29873, 13, 13, 1753, 1993, 29918, 11037, 29898, 567, 29892, 338, 1252, 627, 29892, 325, 29892, 716, 29918, 29873, 29892, 301, 2395, 29892, 7536, 29918, 23705, 29879, 1125, 13, 29871, 599, 29918, 2813, 29879, 353, 5159, 13, 29871, 363, 282, 297, 518, 29916, 363, 921, 297, 6529, 565, 525, 4352, 29915, 297, 921, 5387, 13, 1678, 1993, 353, 282, 1839, 4352, 2033, 29961, 29896, 13018, 29896, 29962, 13, 1678, 599, 29918, 2813, 29879, 29889, 4397, 29898, 4352, 29897, 13, 13, 1678, 565, 1993, 451, 297, 325, 29901, 13, 418, 736, 7700, 13, 13, 1678, 565, 525, 3075, 29918, 1116, 29915, 297, 282, 29901, 13, 418, 565, 325, 29961, 4352, 29962, 2804, 282, 1839, 3075, 29918, 1116, 2033, 29961, 29896, 13018, 29896, 5387, 13, 4706, 736, 7700, 13, 13, 1678, 565, 525, 5355, 29918, 517, 29915, 297, 282, 29901, 13, 418, 716, 29918, 29873, 29961, 29886, 1839, 5355, 29918, 517, 2033, 29962, 353, 325, 29961, 4352, 29962, 13, 418, 301, 2395, 29889, 5504, 3319, 29886, 1839, 5355, 29918, 517, 2033, 29901, 29894, 29961, 4352, 29962, 1800, 13, 13, 1678, 565, 525, 13338, 29918, 1116, 29915, 297, 282, 29901, 13, 418, 659, 353, 19745, 29898, 29886, 1839, 13338, 29918, 1116, 7464, 7536, 29918, 23705, 29879, 29892, 301, 2395, 29897, 13, 418, 565, 451, 659, 29901, 13, 4706, 736, 7700, 13, 539, 13, 1678, 565, 525, 11037, 29915, 297, 282, 29901, 13, 418, 565, 451, 1993, 29918, 11037, 29898, 29886, 1839, 11037, 7464, 338, 1252, 627, 29892, 325, 29961, 4352, 1402, 716, 29918, 29873, 29892, 301, 2395, 29892, 7536, 29918, 23705, 29879, 1125, 13, 4706, 736, 7700, 13, 13, 29871, 565, 338, 1252, 627, 322, 738, 4197, 29916, 363, 921, 297, 325, 565, 921, 451, 297, 599, 29918, 2813, 29879, 29962, 1125, 13, 1678, 736, 7700, 13, 13, 29871, 7868, 29918, 3560, 353, 2446, 3552, 29916, 363, 921, 297, 6529, 565, 525, 5355, 29918, 3560, 29918, 517, 29915, 297, 921, 511, 6213, 29897, 13, 29871, 565, 7868, 29918, 3560, 29901, 13, 1678, 716, 29918, 29873, 29961, 5355, 29918, 3560, 1839, 5355, 29918, 3560, 29918, 517, 2033, 29962, 353, 325, 13, 1678, 301, 2395, 29889, 5504, 3319, 5355, 29918, 3560, 1839, 5355, 29918, 3560, 29918, 517, 2033, 29901, 29894, 1800, 13, 13, 29871, 736, 5852, 13, 259, 13, 29937, 10554, 278, 2302, 11845, 29889, 13999, 304, 1235, 29892, 541, 13682, 13, 1753, 1889, 3981, 20216, 1509, 29898, 29883, 29892, 1591, 29892, 7536, 29918, 29880, 2395, 29892, 7536, 29918, 23705, 29879, 1125, 13, 29871, 716, 29918, 11010, 353, 6213, 13, 29871, 363, 313, 29875, 29892, 29873, 29897, 297, 26985, 29898, 2371, 1125, 13, 13, 1678, 565, 451, 716, 29918, 11010, 29901, 13, 418, 716, 29918, 11010, 353, 9657, 29898, 29873, 29889, 11010, 29897, 13, 418, 716, 29918, 11010, 29961, 29883, 29889, 1707, 29962, 353, 7431, 29898, 29873, 29889, 11010, 29897, 13, 13, 1678, 716, 29918, 29873, 353, 349, 29984, 23215, 552, 29898, 260, 29889, 23583, 718, 518, 29875, 1402, 716, 29918, 11010, 1723, 13, 1678, 7709, 716, 29918, 29873, 13, 13, 29937, 10554, 278, 2318, 29899, 1609, 13, 1753, 1889, 4782, 2059, 20216, 1509, 29898, 29883, 29892, 1591, 29892, 7536, 29918, 29880, 2395, 29892, 7536, 29918, 23705, 29879, 1125, 13, 29871, 330, 1609, 29918, 2606, 2129, 353, 518, 29887, 565, 338, 8758, 29898, 29887, 29892, 710, 29897, 1683, 330, 29961, 29896, 29962, 13, 462, 18884, 363, 330, 297, 274, 29889, 27789, 29918, 1761, 29962, 13, 29871, 330, 1609, 29918, 13338, 29879, 353, 518, 29887, 565, 338, 8758, 29898, 29887, 29892, 710, 29897, 1683, 330, 29961, 29900, 29962, 13, 462, 18884, 363, 330, 297, 274, 29889, 27789, 29918, 1761, 29962, 13, 29871, 752, 29918, 13338, 29879, 353, 518, 12198, 29898, 29872, 5501, 29966, 1807, 29958, 3788, 14513, 1495, 363, 321, 297, 330, 1609, 29918, 13338, 29879, 29962, 13, 29871, 867, 29886, 29918, 2371, 353, 6571, 13, 13, 29871, 10938, 353, 6213, 13, 29871, 396, 6431, 5291, 2701, 297, 263, 756, 400, 519, 13, 29871, 363, 260, 297, 1591, 29901, 13, 259, 13, 1678, 565, 451, 10938, 29901, 13, 418, 10938, 353, 260, 29889, 11010, 13, 13, 1678, 301, 2395, 353, 9657, 29898, 29886, 13479, 29918, 29880, 2395, 29897, 13, 1678, 301, 2395, 29889, 5504, 29898, 29873, 29889, 657, 21533, 3101, 13, 1678, 396, 11796, 29872, 278, 1820, 13, 1678, 413, 353, 18761, 29898, 518, 14513, 29898, 29872, 29892, 29886, 13479, 29918, 23705, 29879, 29892, 29880, 2395, 29897, 363, 321, 297, 752, 29918, 13338, 29879, 29962, 1723, 13, 1678, 565, 451, 413, 297, 867, 29886, 29918, 2371, 29901, 13, 418, 867, 29886, 29918, 2371, 29961, 29895, 29962, 353, 5159, 13, 1678, 867, 29886, 29918, 2371, 29961, 29895, 1822, 4397, 29898, 29873, 29897, 13, 13, 29871, 565, 451, 867, 29886, 29918, 2371, 29901, 13, 1678, 736, 13, 1678, 7709, 13, 13, 29871, 396, 1281, 4984, 278, 716, 1591, 13, 29871, 396, 10050, 29899, 1989, 3651, 13, 29871, 1661, 29918, 1989, 29918, 16908, 353, 518, 29894, 363, 325, 297, 10938, 565, 451, 325, 297, 330, 1609, 29918, 2606, 2129, 4514, 13, 29871, 716, 29918, 11010, 353, 426, 29894, 29901, 29875, 363, 313, 29875, 29892, 29894, 29897, 297, 26985, 29898, 330, 1609, 29918, 2606, 2129, 718, 1661, 29918, 1989, 29918, 16908, 1723, 29913, 13, 29871, 363, 413, 297, 867, 29886, 29918, 2371, 29901, 13, 1678, 260, 353, 349, 29984, 23215, 552, 4197, 8516, 14178, 2435, 29898, 1482, 29918, 11010, 511, 716, 29918, 11010, 29897, 13, 1678, 396, 11882, 975, 278, 1820, 13, 1678, 363, 313, 29875, 29892, 29894, 29897, 297, 26985, 29898, 29887, 1609, 29918, 2606, 2129, 1125, 13, 418, 260, 29961, 29894, 29962, 353, 413, 29961, 29875, 29962, 13, 13, 1678, 396, 26526, 916, 2286, 313, 1333, 297, 2318, 491, 1051, 29897, 338, 6077, 964, 263, 8857, 13, 1678, 396, 6730, 1653, 4069, 8857, 13, 1678, 363, 325, 297, 1661, 29918, 1989, 29918, 16908, 29901, 13, 418, 260, 29961, 29894, 29962, 353, 5159, 13, 13, 1678, 396, 2567, 5445, 297, 278, 8857, 29901, 13, 1678, 363, 760, 29918, 29873, 297, 867, 29886, 29918, 2371, 29961, 29895, 5387, 13, 418, 363, 325, 297, 1661, 29918, 1989, 29918, 16908, 29901, 13, 4706, 260, 29961, 29894, 1822, 4397, 29898, 760, 29918, 29873, 29961, 29894, 29962, 1723, 13, 13, 1678, 7709, 260, 13, 13, 13, 29937, 10554, 988, 11845, 13, 1753, 1889, 11921, 20216, 1509, 29898, 29883, 29892, 1591, 29892, 7536, 29918, 29880, 2395, 29892, 7536, 29918, 23705, 29879, 1125, 13, 29871, 752, 29918, 13338, 353, 6633, 29898, 29883, 29889, 13338, 29889, 29880, 17010, 3285, 29908, 29966, 1807, 29958, 3284, 14513, 1159, 13, 29871, 363, 260, 297, 1591, 29901, 13, 1678, 301, 2395, 353, 9657, 29898, 29886, 13479, 29918, 29880, 2395, 29897, 13, 1678, 301, 2395, 29889, 5504, 29898, 29873, 29889, 657, 21533, 3101, 13, 1678, 659, 353, 19745, 29898, 2388, 29918, 13338, 29892, 7536, 29918, 23705, 29879, 29892, 301, 2395, 29897, 13, 1678, 565, 659, 29901, 13, 418, 7709, 260, 13, 13, 29937, 10554, 278, 1797, 1609, 11845, 13, 1753, 1889, 7514, 2059, 20216, 1509, 29898, 29883, 29892, 1591, 29892, 7536, 29918, 29880, 2395, 29892, 7536, 29918, 23705, 29879, 1125, 13, 29871, 396, 2266, 591, 437, 302, 23551, 29892, 302, 338, 278, 1353, 310, 2656, 2702, 800, 13, 29871, 396, 1152, 1269, 2656, 591, 937, 817, 304, 10272, 263, 2656, 995, 313, 26680, 13, 29871, 396, 367, 777, 4603, 29897, 13, 13, 29871, 2656, 29918, 13338, 29879, 353, 518, 6633, 29898, 359, 29961, 29900, 1822, 29880, 17010, 3285, 29908, 29966, 1807, 29958, 3284, 14513, 1159, 363, 2897, 297, 274, 29889, 2098, 1609, 29918, 1761, 29962, 13, 29871, 2656, 29918, 13478, 353, 518, 288, 29961, 29896, 29962, 1360, 29915, 14273, 29915, 363, 288, 297, 274, 29889, 2098, 1609, 29918, 1761, 29962, 13, 13, 29871, 822, 10272, 13685, 10299, 29898, 29873, 786, 29892, 6605, 29918, 6550, 1125, 13, 1678, 301, 2395, 353, 9657, 29898, 29886, 13479, 29918, 29880, 2395, 29897, 13, 1678, 301, 2395, 29889, 5504, 29898, 29873, 786, 29889, 657, 21533, 3101, 13, 1678, 736, 19745, 29898, 6605, 29918, 6550, 29892, 7536, 29918, 23705, 29879, 29892, 301, 2395, 29897, 13, 13, 29871, 2656, 29918, 13338, 29879, 29889, 24244, 580, 13, 29871, 2656, 29918, 13478, 29889, 24244, 580, 13, 13, 29871, 565, 338, 8758, 29898, 2371, 29892, 8768, 29889, 21575, 1542, 1125, 13, 1678, 1591, 353, 1051, 29898, 2371, 29897, 13, 13, 29871, 363, 313, 29875, 29892, 29872, 29897, 297, 26985, 29898, 6605, 29918, 13338, 29879, 1125, 13, 1678, 1591, 29889, 6605, 29898, 1820, 353, 14013, 921, 29901, 10272, 13685, 10299, 29898, 29916, 29892, 29872, 511, 13, 308, 11837, 29922, 2656, 29918, 13478, 29961, 29875, 2314, 13, 13, 29871, 363, 260, 297, 1591, 29901, 13, 1678, 7709, 260, 13, 259, 13, 29937, 6204, 278, 731, 310, 3651, 363, 263, 716, 3474, 13, 29937, 910, 338, 278, 2989, 731, 925, 363, 7602, 819, 5597, 29892, 278, 13, 29937, 2346, 1795, 451, 671, 599, 310, 1438, 24987, 29889, 13, 29937, 450, 2983, 310, 278, 3651, 1302, 2173, 311, 411, 278, 13, 29937, 2983, 297, 278, 21992, 310, 3474, 11845, 13, 13, 1753, 1207, 29918, 7165, 29918, 16908, 7295, 13, 29871, 736, 8853, 29879, 29918, 21962, 1115, 8516, 29892, 376, 29879, 29918, 271, 1115, 8516, 29892, 376, 29879, 29918, 16304, 1115, 8516, 29892, 376, 29879, 29918, 4622, 1115, 8516, 29892, 13, 3986, 376, 29872, 29918, 21962, 1115, 8516, 29892, 376, 29872, 29918, 271, 1115, 8516, 29892, 376, 29872, 29918, 16304, 1115, 8516, 29892, 376, 29872, 29918, 4622, 1115, 8516, 29913, 13, 13, 29937, 7370, 3651, 515, 263, 1051, 310, 3651, 13, 497, 29918, 2962, 29918, 16908, 353, 6796, 29879, 29918, 21962, 3284, 29879, 29918, 271, 3284, 29879, 29918, 16304, 3284, 29879, 29918, 4622, 3108, 13, 13, 29937, 383, 453, 297, 278, 1369, 24987, 310, 278, 3474, 29892, 2183, 278, 995, 1051, 322, 1857, 2380, 13, 1753, 5445, 29918, 262, 29918, 2962, 29918, 16908, 29898, 16908, 29892, 9956, 29918, 11762, 29892, 474, 29871, 1125, 13, 29871, 24987, 3366, 29879, 29918, 21962, 3108, 353, 9956, 29918, 11762, 29961, 29875, 29962, 13, 29871, 24987, 3366, 29879, 29918, 271, 3108, 353, 474, 13, 29871, 24987, 3366, 29879, 29918, 16304, 3108, 353, 9956, 29918, 11762, 29961, 29875, 29899, 29896, 29962, 565, 474, 29958, 29900, 1683, 6213, 13, 29871, 24987, 3366, 29879, 29918, 4622, 3108, 353, 9956, 29918, 11762, 29961, 29875, 29974, 29896, 29962, 565, 474, 29974, 29896, 29966, 2435, 29898, 19672, 29918, 11762, 29897, 1683, 6213, 13, 13, 29937, 383, 453, 297, 278, 1095, 24987, 310, 278, 3474, 29892, 2183, 278, 1819, 1051, 322, 1857, 2380, 13, 1753, 5445, 29918, 262, 29918, 355, 29918, 16908, 29898, 16908, 29892, 9956, 29918, 11762, 29892, 474, 29871, 1125, 13, 29871, 24987, 3366, 29872, 29918, 21962, 3108, 353, 9956, 29918, 11762, 29961, 29875, 29962, 13, 29871, 24987, 3366, 29872, 29918, 271, 3108, 353, 474, 13, 29871, 24987, 3366, 29872, 29918, 16304, 3108, 353, 9956, 29918, 11762, 29961, 29875, 29899, 29896, 29962, 565, 474, 29958, 29900, 1683, 6213, 13, 29871, 24987, 3366, 29872, 29918, 4622, 3108, 353, 9956, 29918, 11762, 29961, 29875, 29974, 29896, 29962, 565, 474, 29974, 29896, 29966, 2435, 29898, 19672, 29918, 11762, 29897, 1683, 6213, 13, 13, 29937, 5399, 278, 1369, 4195, 310, 278, 3474, 29892, 474, 29889, 29872, 29889, 3692, 591, 881, 13, 29937, 1369, 263, 716, 3474, 472, 445, 4423, 313, 14037, 13858, 260, 3774, 1847, 13, 29937, 5417, 29892, 393, 1423, 338, 2309, 17551, 467, 13, 13, 1753, 1423, 29918, 2962, 29918, 16122, 29898, 497, 29918, 16908, 29892, 16398, 1509, 29892, 2997, 29879, 29892, 29886, 13479, 29918, 23705, 29879, 29892, 1707, 29918, 20698, 1125, 13, 29871, 396, 591, 925, 817, 304, 14707, 278, 746, 4603, 29871, 13, 29871, 396, 541, 591, 817, 304, 731, 701, 278, 24987, 5149, 29892, 3390, 292, 278, 26401, 13, 29871, 396, 5855, 13, 29871, 1369, 29918, 16908, 353, 731, 29898, 497, 29918, 2962, 29918, 16908, 467, 1639, 2042, 29898, 13, 12, 12, 842, 29898, 1707, 29918, 20698, 29889, 8149, 3101, 1723, 13, 29871, 1369, 29918, 5355, 886, 353, 426, 722, 29918, 20698, 29961, 29894, 29962, 584, 599, 29918, 16908, 29961, 29894, 29962, 363, 325, 297, 1369, 29918, 16908, 500, 13, 13, 29871, 396, 788, 278, 9956, 304, 278, 1180, 1338, 13, 29871, 1180, 1338, 29889, 5504, 29898, 1369, 29918, 5355, 886, 1723, 13, 13, 29871, 396, 24219, 403, 278, 746, 4195, 13, 29871, 736, 19745, 29898, 11845, 29889, 29879, 29918, 8256, 29892, 7536, 29918, 23705, 29879, 29892, 1180, 1338, 1723, 13, 259, 13, 29937, 5399, 278, 1095, 4195, 310, 278, 3474, 29889, 13, 13, 1753, 1423, 29918, 355, 29918, 16122, 29898, 16908, 29892, 16398, 1509, 29892, 2997, 29879, 29892, 29886, 13479, 29918, 23705, 29879, 29892, 1707, 29918, 20698, 1125, 13, 29871, 396, 960, 727, 338, 694, 525, 8256, 29915, 11845, 29892, 736, 7700, 13, 29871, 565, 451, 11845, 29889, 29872, 29918, 8256, 29901, 13, 1678, 736, 7700, 13, 13, 29871, 1095, 29918, 16908, 353, 731, 29898, 16908, 29889, 8149, 16655, 1639, 2042, 29898, 731, 29898, 1707, 29918, 20698, 29889, 8149, 22130, 13, 29871, 1095, 29918, 19672, 353, 426, 722, 29918, 20698, 29961, 29894, 29962, 584, 24987, 29961, 29894, 29962, 363, 325, 297, 1095, 29918, 16908, 500, 13, 13, 29871, 1180, 1338, 29889, 5504, 29898, 1095, 29918, 19672, 1723, 13, 29871, 620, 353, 19745, 29898, 11845, 29889, 29872, 29918, 8256, 29892, 7536, 29918, 23705, 29879, 29892, 1180, 1338, 29897, 13, 13, 29871, 736, 620, 13, 13, 29937, 10554, 3474, 11845, 13, 1753, 1889, 5907, 20216, 1509, 29898, 29883, 29892, 1591, 29892, 7536, 29918, 29880, 2395, 29892, 7536, 29918, 23705, 29879, 1125, 13, 29871, 10938, 353, 6213, 13, 29871, 716, 29918, 11010, 353, 6213, 13, 13, 29871, 396, 6204, 3474, 2286, 1024, 10417, 13, 29871, 722, 29918, 20698, 353, 6571, 13, 29871, 363, 325, 297, 274, 29889, 16908, 29901, 13, 1678, 722, 29918, 20698, 29961, 29894, 29962, 353, 274, 29889, 16908, 29961, 29894, 29962, 13, 12, 12, 13, 29871, 363, 260, 297, 1591, 29901, 13, 1678, 565, 451, 10938, 29901, 13, 418, 10938, 353, 260, 29889, 11010, 13, 418, 396, 6204, 263, 716, 10938, 411, 3474, 3651, 2715, 13, 418, 716, 29918, 11010, 353, 9657, 29898, 29873, 29889, 11010, 29897, 13, 418, 363, 325, 297, 274, 29889, 16908, 29901, 13, 4706, 716, 29918, 11010, 29961, 29883, 29889, 16908, 29961, 29894, 5262, 353, 7431, 29898, 1482, 29918, 11010, 29897, 13, 13, 1678, 301, 2395, 353, 9657, 29898, 29886, 13479, 29918, 29880, 2395, 29897, 13, 1678, 301, 2395, 29889, 5504, 29898, 29873, 29889, 657, 21533, 3101, 13, 1678, 396, 382, 4387, 403, 278, 9956, 5665, 13, 1678, 9956, 29918, 11762, 353, 1051, 29898, 14513, 29898, 29883, 29889, 19672, 29918, 11762, 29892, 7536, 29918, 23705, 29879, 29892, 301, 2395, 876, 13, 13, 1678, 396, 6204, 2847, 3474, 3651, 13, 13, 1678, 396, 25455, 278, 5417, 13, 1678, 1722, 29918, 10499, 353, 5159, 13, 1678, 5764, 29918, 10499, 353, 5159, 13, 13, 1678, 396, 20504, 403, 975, 278, 9956, 5665, 13, 1678, 363, 313, 29875, 29892, 29894, 29897, 297, 26985, 29898, 19672, 29918, 11762, 1125, 13, 418, 396, 3967, 304, 1722, 263, 716, 3474, 13, 418, 396, 297, 1206, 310, 260, 3774, 1847, 5417, 29892, 871, 1722, 263, 13, 418, 396, 3474, 565, 727, 526, 694, 1722, 5417, 13, 418, 565, 451, 274, 29889, 29873, 3774, 1847, 470, 313, 29883, 29889, 29873, 3774, 1847, 322, 451, 1722, 29918, 10499, 1125, 13, 4706, 24987, 353, 1207, 29918, 7165, 29918, 16908, 580, 13, 4706, 5445, 29918, 262, 29918, 2962, 29918, 16908, 29898, 16908, 29892, 19672, 29918, 11762, 29892, 29875, 29897, 13, 4706, 565, 1423, 29918, 2962, 29918, 16122, 29898, 16908, 29892, 29883, 29892, 8977, 29898, 29880, 2395, 511, 29886, 13479, 29918, 23705, 29879, 29892, 1707, 29918, 20698, 1125, 13, 3986, 1722, 29918, 10499, 29889, 4397, 29898, 8853, 7165, 1115, 29961, 1402, 376, 16908, 1115, 16908, 29913, 1723, 13, 539, 13, 418, 716, 29918, 3150, 29918, 10499, 353, 5159, 13, 418, 396, 5504, 599, 1722, 5417, 29892, 3802, 1906, 393, 526, 7743, 13, 418, 363, 281, 297, 1722, 29918, 10499, 29901, 13, 4706, 396, 3462, 16256, 593, 995, 304, 278, 3474, 13, 4706, 281, 3366, 7165, 16862, 4397, 29898, 29894, 29897, 13, 13, 4706, 5445, 29918, 262, 29918, 355, 29918, 16908, 29898, 29893, 3366, 16908, 12436, 19672, 29918, 11762, 29892, 29875, 29897, 13, 13, 4706, 565, 1423, 29918, 355, 29918, 16122, 29898, 29893, 3366, 16908, 12436, 29883, 29892, 8977, 29898, 29880, 2395, 511, 29886, 13479, 29918, 23705, 29879, 29892, 1707, 29918, 20698, 1125, 13, 3986, 5764, 29918, 10499, 29889, 4397, 29898, 29893, 29897, 13, 4706, 1683, 29901, 13, 3986, 716, 29918, 3150, 29918, 10499, 29889, 4397, 29898, 29893, 29897, 13, 418, 1722, 29918, 10499, 353, 716, 29918, 3150, 29918, 10499, 13, 965, 13, 1678, 396, 5358, 470, 3349, 599, 9886, 1722, 5417, 13, 1678, 396, 361, 871, 338, 6790, 29892, 591, 11455, 1661, 29899, 15603, 5417, 13, 1678, 565, 451, 274, 29889, 6194, 29901, 13, 418, 5764, 29918, 10499, 29889, 21843, 29898, 3150, 29918, 10499, 29897, 13, 268, 13, 1678, 396, 1653, 263, 716, 18761, 491, 23771, 278, 18761, 515, 3517, 3711, 6394, 13, 1678, 396, 411, 278, 3474, 3651, 29892, 363, 1269, 5764, 3474, 13, 1678, 363, 281, 297, 5764, 29918, 10499, 29901, 13, 418, 716, 29918, 29873, 353, 349, 29984, 23215, 552, 29898, 260, 29889, 23583, 718, 518, 8516, 14178, 29898, 2435, 29898, 1482, 29918, 11010, 6817, 2435, 29898, 11010, 8243, 716, 29918, 11010, 29897, 13, 418, 716, 29918, 29873, 29961, 722, 29918, 20698, 3366, 1707, 3108, 4514, 353, 281, 3366, 7165, 3108, 13, 418, 363, 325, 297, 518, 29894, 363, 325, 297, 281, 3366, 16908, 16862, 8149, 580, 565, 325, 297, 722, 29918, 20698, 5387, 13, 4706, 716, 29918, 29873, 29961, 722, 29918, 20698, 29961, 29894, 29962, 4514, 353, 281, 3366, 16908, 3108, 29961, 29894, 29962, 13, 418, 7709, 716, 29918, 29873, 13, 2 ]
cputils/dependencyManager.py
computePods/pythonUtils
0
112814
<gh_stars>0 import yaml from cputils.settlingTimerMixin import mixinSettlingTimer class DependencyManager : """ The ComputePods Dependency Manager component """ def __init__(self, natsClient) : self.nc = natsClient mixinSettlingTimer(self) async def listenForDependencyMessages(self) : async def registeredTypesCallback(aSubject, theSubject, theMessage) : self.unSettle() for aType in theMessage : await self.nc.sendMessage('build.howTo.{}'.format(aType)) await self.nc.listenToSubject( 'artefact.registered.types', registeredTypesCallback ) async def canBuildFromCallback(aSubject, theSubject, theMessage) : self.unSettle() await self.nc.listenToSubject( "build.from.>", canBuildFromCallback )
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 5215, 343, 8807, 13, 13, 3166, 274, 649, 2719, 29889, 9915, 1847, 14745, 29924, 861, 262, 1053, 6837, 262, 29903, 1803, 1847, 14745, 13, 13, 1990, 10034, 5197, 3260, 584, 13, 29871, 9995, 450, 11796, 29872, 29925, 19653, 10034, 5197, 15629, 4163, 9995, 13, 13, 29871, 822, 4770, 2344, 12035, 1311, 29892, 302, 1446, 4032, 29897, 584, 13, 1678, 1583, 29889, 17608, 1678, 353, 302, 1446, 4032, 13, 13, 1678, 6837, 262, 29903, 1803, 1847, 14745, 29898, 1311, 29897, 13, 13, 29871, 7465, 822, 11621, 2831, 8498, 5197, 25510, 29898, 1311, 29897, 584, 13, 13, 1678, 7465, 822, 15443, 10562, 10717, 29898, 29874, 20622, 29892, 278, 20622, 29892, 278, 3728, 29897, 584, 13, 418, 1583, 29889, 348, 29903, 1803, 280, 580, 13, 13, 418, 363, 263, 1542, 297, 278, 3728, 584, 13, 4706, 7272, 1583, 29889, 17608, 29889, 6717, 3728, 877, 4282, 29889, 3525, 1762, 29889, 8875, 4286, 4830, 29898, 29874, 1542, 876, 13, 13, 1678, 7272, 1583, 29889, 17608, 29889, 20631, 1762, 20622, 29898, 13, 418, 525, 11908, 17028, 29889, 9573, 287, 29889, 8768, 742, 13, 418, 15443, 10562, 10717, 13, 1678, 1723, 13, 13, 1678, 7465, 822, 508, 8893, 4591, 10717, 29898, 29874, 20622, 29892, 278, 20622, 29892, 278, 3728, 29897, 584, 13, 418, 1583, 29889, 348, 29903, 1803, 280, 580, 13, 13, 13, 1678, 7272, 1583, 29889, 17608, 29889, 20631, 1762, 20622, 29898, 13, 418, 376, 4282, 29889, 3166, 29889, 28341, 13, 418, 508, 8893, 4591, 10717, 13, 1678, 1723, 2 ]
venv/Lib/site-packages/coincurve/utils.py
CompeteLeak/crankycoin
0
84293
<filename>venv/Lib/site-packages/coincurve/utils.py<gh_stars>0 from base64 import b64decode, b64encode from binascii import hexlify, unhexlify from hashlib import sha256 as _sha256 from os import urandom from coincurve.context import GLOBAL_CONTEXT from ._libsecp256k1 import ffi, lib GROUP_ORDER = (b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff' b'\xfe\xba\xae\xdc\xe6\xafH\xa0;\xbf\xd2^\x8c\xd06AA') GROUP_ORDER_INT = 0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141 KEY_SIZE = 32 ZERO = b'\x00' PEM_HEADER = b'-----BEGIN PRIVATE KEY-----\n' PEM_FOOTER = b'-----END PRIVATE KEY-----\n' def ensure_unicode(s): if isinstance(s, bytes): s = s.decode('utf-8') return s def pad_hex(hexed): # Pad odd-length hex strings. return hexed if not len(hexed) & 1 else '0' + hexed if hasattr(int, "from_bytes"): def bytes_to_int(bytestr): return int.from_bytes(bytestr, 'big') else: def bytes_to_int(bytestr): return int(bytestr.encode('hex'), 16) if hasattr(int, "to_bytes"): def int_to_bytes(num): return num.to_bytes((num.bit_length() + 7) // 8 or 1, 'big') def int_to_bytes_padded(num): return pad_scalar( num.to_bytes((num.bit_length() + 7) // 8 or 1, 'big') ) else: def int_to_bytes(num): return unhexlify(pad_hex('%x' % num)) def int_to_bytes_padded(num): return pad_scalar(unhexlify(pad_hex('%x' % num))) if hasattr(bytes, "hex"): def bytes_to_hex(bytestr): return bytestr.hex() else: def bytes_to_hex(bytestr): return ensure_unicode(hexlify(bytestr)) if hasattr(bytes, "fromhex"): def hex_to_bytes(hexed): return pad_scalar(bytes.fromhex(pad_hex(hexed))) else: def hex_to_bytes(hexed): print(hexed) return pad_scalar(unhexlify(pad_hex(hexed))) def sha256(bytestr): return _sha256(bytestr).digest() def chunk_data(data, size): return (data[i:i + size] for i in range(0, len(data), size)) def der_to_pem(der): return b''.join([ PEM_HEADER, b'\n'.join(chunk_data(b64encode(der), 64)), b'\n', PEM_FOOTER ]) def pem_to_der(pem): return b64decode( pem.strip()[28:-25].replace(b'\n', b'') ) def get_valid_secret(): while True: secret = urandom(KEY_SIZE) if 0 < bytes_to_int(secret) < GROUP_ORDER_INT: print bytes_to_int(secret) return secret def pad_scalar(scalar): return (int_to_bytes(1) * (KEY_SIZE - len(scalar))) + scalar def validate_secret(secret): print("Validation") print(format(bytes_to_int(secret))) if not 0 < bytes_to_int(secret) < GROUP_ORDER_INT: raise ValueError('Secret scalar must be greater than 0 and less than ' '{}.'.format(GROUP_ORDER_INT)) return pad_scalar(secret) def verify_signature(signature, message, public_key, hasher=sha256, context=GLOBAL_CONTEXT): pubkey = ffi.new('secp256k1_pubkey *') pubkey_parsed = lib.secp256k1_ec_pubkey_parse( context.ctx, pubkey, public_key, len(public_key) ) if not pubkey_parsed: raise ValueError('The public key could not be parsed or is invalid.') msg_hash = hasher(message) if hasher is not None else message if len(msg_hash) != 32: raise ValueError('Message hash must be 32 bytes long.') sig = ffi.new('secp256k1_ecdsa_signature *') sig_parsed = lib.secp256k1_ecdsa_signature_parse_der( context.ctx, sig, signature, len(signature) ) if not sig_parsed: raise ValueError('The DER-encoded signature could not be parsed.') verified = lib.secp256k1_ecdsa_verify( context.ctx, sig, msg_hash, pubkey ) # A performance hack to avoid global bool() lookup. return not not verified
[ 1, 529, 9507, 29958, 854, 29894, 29914, 14868, 29914, 2746, 29899, 8318, 29914, 1111, 262, 2764, 345, 29914, 13239, 29889, 2272, 29966, 12443, 29918, 303, 1503, 29958, 29900, 13, 3166, 2967, 29953, 29946, 1053, 289, 29953, 29946, 13808, 29892, 289, 29953, 29946, 12508, 13, 3166, 9016, 294, 18869, 1053, 15090, 29880, 1598, 29892, 443, 354, 15524, 1598, 13, 3166, 6608, 1982, 1053, 528, 29874, 29906, 29945, 29953, 408, 903, 17051, 29906, 29945, 29953, 13, 3166, 2897, 1053, 5065, 2685, 13, 13, 3166, 19480, 2764, 345, 29889, 4703, 1053, 402, 28902, 1964, 29918, 6007, 16975, 13, 3166, 869, 29918, 1982, 3471, 29886, 29906, 29945, 29953, 29895, 29896, 1053, 285, 7241, 29892, 4303, 13, 13, 26284, 29918, 22364, 353, 313, 29890, 12764, 29916, 600, 29905, 29916, 600, 29905, 29916, 600, 29905, 29916, 600, 29905, 29916, 600, 29905, 29916, 600, 29905, 29916, 600, 29905, 29916, 600, 29905, 29916, 600, 29905, 29916, 600, 29905, 29916, 600, 29905, 29916, 600, 29905, 29916, 600, 29905, 29916, 600, 29905, 29916, 600, 29915, 13, 1669, 289, 12764, 29916, 1725, 29905, 29916, 2291, 29905, 29916, 3660, 29905, 29916, 13891, 29905, 17115, 29953, 29905, 29916, 2142, 29950, 29905, 17367, 29900, 10436, 29916, 1635, 29905, 29916, 29881, 29906, 3823, 29916, 29947, 29883, 29905, 29916, 29881, 29900, 29953, 6344, 1495, 13, 26284, 29918, 22364, 29918, 10192, 353, 29871, 29900, 29916, 17156, 17156, 17156, 17156, 17156, 17156, 17156, 18725, 774, 7340, 287, 346, 29953, 2142, 29946, 29947, 29874, 29900, 29941, 1327, 11512, 29906, 29945, 29872, 29947, 2252, 29900, 29941, 29953, 29946, 29896, 29946, 29896, 13, 10818, 29918, 14226, 353, 29871, 29941, 29906, 13, 29999, 1001, 29949, 353, 289, 12764, 29916, 29900, 29900, 29915, 13, 4162, 29924, 29918, 23252, 1001, 353, 289, 29915, 23648, 29933, 17958, 349, 3960, 29963, 3040, 14636, 807, 2612, 29876, 29915, 13, 4162, 29924, 29918, 5800, 2891, 1001, 353, 289, 29915, 23648, 11794, 349, 3960, 29963, 3040, 14636, 807, 2612, 29876, 29915, 13, 13, 13, 1753, 9801, 29918, 2523, 356, 29898, 29879, 1125, 13, 1678, 565, 338, 8758, 29898, 29879, 29892, 6262, 1125, 13, 4706, 269, 353, 269, 29889, 13808, 877, 9420, 29899, 29947, 1495, 13, 1678, 736, 269, 13, 13, 13, 1753, 17132, 29918, 20970, 29898, 20970, 287, 1125, 13, 1678, 396, 18011, 7736, 29899, 2848, 15090, 6031, 29889, 13, 1678, 736, 15090, 287, 565, 451, 7431, 29898, 20970, 287, 29897, 669, 29871, 29896, 1683, 525, 29900, 29915, 718, 15090, 287, 13, 13, 13, 361, 756, 5552, 29898, 524, 29892, 376, 3166, 29918, 13193, 29908, 1125, 13, 1678, 822, 6262, 29918, 517, 29918, 524, 29898, 1609, 1688, 29878, 1125, 13, 4706, 736, 938, 29889, 3166, 29918, 13193, 29898, 1609, 1688, 29878, 29892, 525, 3752, 1495, 13, 2870, 29901, 13, 1678, 822, 6262, 29918, 517, 29918, 524, 29898, 1609, 1688, 29878, 1125, 13, 4706, 736, 938, 29898, 1609, 1688, 29878, 29889, 12508, 877, 20970, 5477, 29871, 29896, 29953, 29897, 13, 13, 13, 361, 756, 5552, 29898, 524, 29892, 376, 517, 29918, 13193, 29908, 1125, 13, 1678, 822, 938, 29918, 517, 29918, 13193, 29898, 1949, 1125, 13, 4706, 736, 954, 29889, 517, 29918, 13193, 3552, 1949, 29889, 2966, 29918, 2848, 580, 718, 29871, 29955, 29897, 849, 29871, 29947, 470, 29871, 29896, 29892, 525, 3752, 1495, 13, 13, 13, 1678, 822, 938, 29918, 517, 29918, 13193, 29918, 29886, 23959, 29898, 1949, 1125, 13, 4706, 736, 17132, 29918, 19529, 279, 29898, 13, 9651, 954, 29889, 517, 29918, 13193, 3552, 1949, 29889, 2966, 29918, 2848, 580, 718, 29871, 29955, 29897, 849, 29871, 29947, 470, 29871, 29896, 29892, 525, 3752, 1495, 13, 4706, 1723, 13, 2870, 29901, 13, 1678, 822, 938, 29918, 517, 29918, 13193, 29898, 1949, 1125, 13, 4706, 736, 443, 354, 15524, 1598, 29898, 8305, 29918, 20970, 877, 29995, 29916, 29915, 1273, 954, 876, 13, 13, 13, 1678, 822, 938, 29918, 517, 29918, 13193, 29918, 29886, 23959, 29898, 1949, 1125, 13, 4706, 736, 17132, 29918, 19529, 279, 29898, 348, 354, 15524, 1598, 29898, 8305, 29918, 20970, 877, 29995, 29916, 29915, 1273, 954, 4961, 13, 13, 13, 361, 756, 5552, 29898, 13193, 29892, 376, 20970, 29908, 1125, 13, 1678, 822, 6262, 29918, 517, 29918, 20970, 29898, 1609, 1688, 29878, 1125, 13, 4706, 736, 491, 1688, 29878, 29889, 20970, 580, 13, 2870, 29901, 13, 1678, 822, 6262, 29918, 517, 29918, 20970, 29898, 1609, 1688, 29878, 1125, 13, 4706, 736, 9801, 29918, 2523, 356, 29898, 354, 15524, 1598, 29898, 1609, 1688, 29878, 876, 13, 13, 13, 361, 756, 5552, 29898, 13193, 29892, 376, 3166, 20970, 29908, 1125, 13, 1678, 822, 15090, 29918, 517, 29918, 13193, 29898, 20970, 287, 1125, 13, 4706, 736, 17132, 29918, 19529, 279, 29898, 13193, 29889, 3166, 20970, 29898, 8305, 29918, 20970, 29898, 20970, 287, 4961, 13, 2870, 29901, 13, 1678, 822, 15090, 29918, 517, 29918, 13193, 29898, 20970, 287, 1125, 13, 4706, 1596, 29898, 20970, 287, 29897, 13, 4706, 736, 17132, 29918, 19529, 279, 29898, 348, 354, 15524, 1598, 29898, 8305, 29918, 20970, 29898, 20970, 287, 4961, 13, 13, 13, 1753, 528, 29874, 29906, 29945, 29953, 29898, 1609, 1688, 29878, 1125, 13, 1678, 736, 903, 17051, 29906, 29945, 29953, 29898, 1609, 1688, 29878, 467, 7501, 342, 580, 13, 13, 13, 1753, 19875, 29918, 1272, 29898, 1272, 29892, 2159, 1125, 13, 1678, 736, 313, 1272, 29961, 29875, 29901, 29875, 718, 2159, 29962, 363, 474, 297, 3464, 29898, 29900, 29892, 7431, 29898, 1272, 511, 2159, 876, 13, 13, 13, 1753, 589, 29918, 517, 29918, 29886, 331, 29898, 672, 1125, 13, 1678, 736, 289, 29915, 4286, 7122, 4197, 13, 4706, 349, 12665, 29918, 23252, 1001, 29892, 13, 4706, 289, 12764, 29876, 4286, 7122, 29898, 29812, 29918, 1272, 29898, 29890, 29953, 29946, 12508, 29898, 672, 511, 29871, 29953, 29946, 8243, 289, 12764, 29876, 742, 13, 4706, 349, 12665, 29918, 5800, 2891, 1001, 13, 268, 2314, 13, 13, 13, 1753, 282, 331, 29918, 517, 29918, 672, 29898, 29886, 331, 1125, 13, 1678, 736, 289, 29953, 29946, 13808, 29898, 13, 4706, 282, 331, 29889, 17010, 580, 29961, 29906, 29947, 13018, 29906, 29945, 1822, 6506, 29898, 29890, 12764, 29876, 742, 289, 29915, 1495, 13, 1678, 1723, 13, 13, 13, 1753, 679, 29918, 3084, 29918, 19024, 7295, 13, 1678, 1550, 5852, 29901, 13, 4706, 7035, 353, 5065, 2685, 29898, 10818, 29918, 14226, 29897, 13, 4706, 565, 29871, 29900, 529, 6262, 29918, 517, 29918, 524, 29898, 19024, 29897, 529, 15345, 29918, 22364, 29918, 10192, 29901, 13, 9651, 1596, 6262, 29918, 517, 29918, 524, 29898, 19024, 29897, 13, 9651, 736, 7035, 13, 13, 13, 1753, 17132, 29918, 19529, 279, 29898, 19529, 279, 1125, 13, 1678, 736, 313, 524, 29918, 517, 29918, 13193, 29898, 29896, 29897, 334, 313, 10818, 29918, 14226, 448, 7431, 29898, 19529, 279, 4961, 718, 17336, 13, 13, 13, 1753, 12725, 29918, 19024, 29898, 19024, 1125, 13, 1678, 1596, 703, 19448, 1159, 13, 1678, 1596, 29898, 4830, 29898, 13193, 29918, 517, 29918, 524, 29898, 19024, 4961, 13, 1678, 565, 451, 29871, 29900, 529, 6262, 29918, 517, 29918, 524, 29898, 19024, 29897, 529, 15345, 29918, 22364, 29918, 10192, 29901, 13, 4706, 12020, 7865, 2392, 877, 28459, 17336, 1818, 367, 7621, 1135, 29871, 29900, 322, 3109, 1135, 525, 13, 462, 308, 22372, 1836, 4286, 4830, 29898, 26284, 29918, 22364, 29918, 10192, 876, 13, 1678, 736, 17132, 29918, 19529, 279, 29898, 19024, 29897, 13, 13, 13, 1753, 11539, 29918, 4530, 1535, 29898, 4530, 1535, 29892, 2643, 29892, 970, 29918, 1989, 29892, 756, 2276, 29922, 17051, 29906, 29945, 29953, 29892, 3030, 29922, 29954, 28902, 1964, 29918, 6007, 16975, 1125, 13, 1678, 2529, 1989, 353, 285, 7241, 29889, 1482, 877, 3471, 29886, 29906, 29945, 29953, 29895, 29896, 29918, 5467, 1989, 334, 1495, 13, 13, 1678, 2529, 1989, 29918, 862, 8485, 353, 4303, 29889, 3471, 29886, 29906, 29945, 29953, 29895, 29896, 29918, 687, 29918, 5467, 1989, 29918, 5510, 29898, 13, 4706, 3030, 29889, 13073, 29892, 2529, 1989, 29892, 970, 29918, 1989, 29892, 7431, 29898, 3597, 29918, 1989, 29897, 13, 1678, 1723, 13, 13, 1678, 565, 451, 2529, 1989, 29918, 862, 8485, 29901, 13, 4706, 12020, 7865, 2392, 877, 1576, 970, 1820, 1033, 451, 367, 21213, 470, 338, 8340, 29889, 1495, 13, 13, 1678, 10191, 29918, 8568, 353, 756, 2276, 29898, 4906, 29897, 565, 756, 2276, 338, 451, 6213, 1683, 2643, 13, 1678, 565, 7431, 29898, 7645, 29918, 8568, 29897, 2804, 29871, 29941, 29906, 29901, 13, 4706, 12020, 7865, 2392, 877, 3728, 6608, 1818, 367, 29871, 29941, 29906, 6262, 1472, 29889, 1495, 13, 13, 1678, 4365, 353, 285, 7241, 29889, 1482, 877, 3471, 29886, 29906, 29945, 29953, 29895, 29896, 29918, 687, 29881, 4977, 29918, 4530, 1535, 334, 1495, 13, 13, 1678, 4365, 29918, 862, 8485, 353, 4303, 29889, 3471, 29886, 29906, 29945, 29953, 29895, 29896, 29918, 687, 29881, 4977, 29918, 4530, 1535, 29918, 5510, 29918, 672, 29898, 13, 4706, 3030, 29889, 13073, 29892, 4365, 29892, 12608, 29892, 7431, 29898, 4530, 1535, 29897, 13, 1678, 1723, 13, 13, 1678, 565, 451, 4365, 29918, 862, 8485, 29901, 13, 4706, 12020, 7865, 2392, 877, 1576, 360, 1001, 29899, 26716, 12608, 1033, 451, 367, 21213, 29889, 1495, 13, 13, 1678, 26834, 353, 4303, 29889, 3471, 29886, 29906, 29945, 29953, 29895, 29896, 29918, 687, 29881, 4977, 29918, 27902, 29898, 13, 4706, 3030, 29889, 13073, 29892, 4365, 29892, 10191, 29918, 8568, 29892, 2529, 1989, 13, 1678, 1723, 13, 13, 1678, 396, 319, 4180, 15833, 304, 4772, 5534, 6120, 580, 16280, 29889, 13, 1678, 736, 451, 451, 26834, 13, 2 ]
invenio-rdm/setup/provstore-push.py
ludwig-burtscher/invenio-with-provenance
0
155442
<gh_stars>0 #!/usr/bin/env python3 # Provstore credentials over ENV variables: # Provstore username: PROVSTORE_USERNAME # Provstore apikey: PROVSTORE_APIKEY # exit codes: # 0: All good - provstore document created successfully # 1: No provstore credentials # 2: Provstore document upload failed # 3: Invalid command line arguments import requests import uuid import json import os import sys import time import uuid import datetime from prov.model import ProvDocument def push_json(prov_dict, username, apikey): url = "https://openprovenance.org/store/api/v0/documents/" authorization = "ApiKey {}:{}".format(username, apikey) body = {"rec_id": str(uuid.uuid4()), "public": False, "content": prov_dict} r = requests.post(url, headers={"Authorization": authorization}, json=body) if r.status_code is not 201: eprint("Statuscode: {}".format(r.status_code)) eprint("Response:{}".format(r.text)) exit(2) def build_prov_json(s_user, s_activity, o_record_before, o_record_after, args, kwargs): #returns single dict representing the prov_json activity = parse_activity(s_activity) activity_id = str(uuid.uuid4()) timestamp = datetime.datetime.now() if not activity: return {} d = get_base_prov_document() u = d.agent("invenio:user_{}".format(s_user), {"invenio:email": s_user}) a = d.activity("invenio:activity_{}_{}".format(activity, activity_id), timestamp, None, {"invenio:activityType": activity}) if activity == "read": record_id = parse_record_id_before(o_record_before) revision = parse_revision_after(o_record_after) e = d.entity("invenio:record_{}_{}".format(record_id, revision), {"invenio:recordId": record_id, "invenio:revision": revision}) d.wasAssociatedWith(a, u) d.used(a, e) elif activity == "create": record_id = parse_record_id_after(o_record_after) revision = "0" e = d.entity("invenio:record_{}_{}".format(record_id, revision), {"invenio:recordId": record_id, "invenio:revision": revision}) d.wasAssociatedWith(a, u) d.wasGeneratedBy(e, a) elif activity == "update": new_record_id = parse_record_id_after(o_record_after) old_record_id = parse_record_id_before(o_record_before) new_revision = parse_revision_after(o_record_after) old_revision = str(int(new_revision) - 1) new_e = d.entity("invenio:record_{}_{}".format(new_record_id, new_revision), {"invenio:recordId": new_record_id, "invenio:revision": new_revision}) old_e = d.entity("invenio:record_{}_{}".format(old_record_id, old_revision), {"invenio:recordId": old_record_id, "invenio:revision": old_revision}) d.wasAssociatedWith(a, u) d.used(a, old_e) d.used(a, new_e) d.wasDerivedFrom(new_e, old_e) elif activity == "list": hits = json.loads(o_record_after["response"][0].replace("'", "").replace("\\", "")[1:])["hits"]["hits"] for hit in hits: record_id = hit["id"] revision = hit["revision"] e = d.entity("invenio:record_{}_{}".format(record_id, revision), {"invenio:recordId": record_id, "invenio:revision": revision}) d.used(a, e) d.wasAssociatedWith(a, u) elif activity == "delete": record_id = kwargs["pid"].split("recid:")[1].split(" ")[0] e = d.entity("invenio:record_{}".format(record_id), {"invenio:recordId": record_id}) d.wasAssociatedWith(a, u) d.used(a, e) else: return {} return d.serialize(indent=2) def parse_activity(activity): no_activity = "noop" if not activity: return no_activity return activity[:-19] #trim _permission_factory def parse_record_id_before(o_record_before): no_record_id = "unidentified-record" if not o_record_before: return no_record_id return o_record_before.get("recid", no_record_id) def parse_record_id_after(o_record_after): no_record_id = "unidentified-record" if not o_record_after: return no_record_id return o_record_after["response"][0].split("recid")[1][3:].split("\",\"")[0] def parse_revision_after(o_record_after): # only takes first occurence of "revision" into account no_revision = get_timestamp_now() if not o_record_after: return no_revision return o_record_after["response"][0].split("revision")[1][2:].split(",")[0] def get_timestamp_now(): return str(int(time.time())) def get_base_prov_document(): d = ProvDocument() d.add_namespace("invenio", "http://example.org/invenio/") return d def eprint(*args, **kwargs): print(*args, file=open("/tmp/error.txt", "a+"), **kwargs) if __name__ == "__main__": arglen = len(sys.argv) if arglen is not 7: eprint("Exactly 7 command line arguments are required") exit(3) try: s_user = sys.argv[1] s_activity = sys.argv[2] o_record_after = json.loads(sys.argv[3]) if sys.argv[3] != "null" else None o_record_before = json.loads(sys.argv[4]) if sys.argv[4] != "null" else None args = json.loads(sys.argv[5]) kwargs = json.loads(sys.argv[6]) except: eprint("Command line arguments are not valid") exit(3) provstore_username = os.getenv("PROVSTORE_USERNAME") provstore_apikey = os.getenv("PROVSTORE_APIKEY") if not provstore_username or not provstore_apikey: eprint("No PROVSTORE credentials found in env variables") exit(1) push_json(build_prov_json(s_user, s_activity, o_record_before, o_record_after, args, kwargs), provstore_username, provstore_apikey)
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 29937, 14708, 4855, 29914, 2109, 29914, 6272, 3017, 29941, 13, 13, 29937, 9133, 8899, 16140, 975, 12524, 29963, 3651, 29901, 13, 29937, 9133, 8899, 8952, 29901, 13756, 29963, 1254, 29949, 1525, 29918, 11889, 5813, 13, 29937, 9133, 8899, 7882, 1989, 29901, 13756, 29963, 1254, 29949, 1525, 29918, 8787, 10818, 13, 13, 29937, 6876, 11561, 29901, 13, 29937, 29871, 29900, 29901, 2178, 1781, 448, 1326, 8899, 1842, 2825, 8472, 13, 29937, 29871, 29896, 29901, 1939, 1326, 8899, 16140, 13, 29937, 29871, 29906, 29901, 9133, 8899, 1842, 6441, 5229, 13, 29937, 29871, 29941, 29901, 21403, 1899, 1196, 6273, 13, 13, 5215, 7274, 13, 5215, 318, 5416, 13, 5215, 4390, 13, 5215, 2897, 13, 5215, 10876, 13, 5215, 931, 13, 5215, 318, 5416, 13, 5215, 12865, 13, 3166, 1326, 29889, 4299, 1053, 9133, 6268, 13, 13, 13, 1753, 5503, 29918, 3126, 29898, 16123, 29918, 8977, 29892, 8952, 29892, 7882, 1989, 1125, 13, 1678, 3142, 353, 376, 991, 597, 3150, 771, 854, 749, 29889, 990, 29914, 8899, 29914, 2754, 29914, 29894, 29900, 29914, 3225, 29879, 12975, 13, 1678, 28733, 353, 376, 11713, 2558, 426, 6177, 8875, 1642, 4830, 29898, 6786, 29892, 7882, 1989, 29897, 13, 1678, 3573, 353, 8853, 3757, 29918, 333, 1115, 851, 29898, 25118, 29889, 25118, 29946, 25739, 376, 3597, 1115, 7700, 29892, 376, 3051, 1115, 1326, 29918, 8977, 29913, 13, 13, 1678, 364, 353, 7274, 29889, 2490, 29898, 2271, 29892, 9066, 3790, 29908, 25471, 1115, 28733, 1118, 4390, 29922, 2587, 29897, 13, 1678, 565, 364, 29889, 4882, 29918, 401, 338, 451, 29871, 29906, 29900, 29896, 29901, 13, 4706, 321, 2158, 703, 5709, 401, 29901, 6571, 1642, 4830, 29898, 29878, 29889, 4882, 29918, 401, 876, 13, 4706, 321, 2158, 703, 5103, 29901, 8875, 1642, 4830, 29898, 29878, 29889, 726, 876, 13, 4706, 6876, 29898, 29906, 29897, 13, 13, 13, 1753, 2048, 29918, 16123, 29918, 3126, 29898, 29879, 29918, 1792, 29892, 269, 29918, 10072, 29892, 288, 29918, 11651, 29918, 11083, 29892, 288, 29918, 11651, 29918, 7045, 29892, 6389, 29892, 9049, 5085, 1125, 13, 1678, 396, 18280, 2323, 9657, 15783, 278, 1326, 29918, 3126, 13, 268, 13, 1678, 6354, 353, 6088, 29918, 10072, 29898, 29879, 29918, 10072, 29897, 13, 1678, 6354, 29918, 333, 353, 851, 29898, 25118, 29889, 25118, 29946, 3101, 13, 1678, 14334, 353, 12865, 29889, 12673, 29889, 3707, 580, 13, 268, 13, 1678, 565, 451, 6354, 29901, 13, 4706, 736, 6571, 13, 268, 13, 1678, 270, 353, 679, 29918, 3188, 29918, 16123, 29918, 3225, 580, 13, 268, 13, 1678, 318, 353, 270, 29889, 14748, 703, 262, 854, 601, 29901, 1792, 648, 29913, 1642, 4830, 29898, 29879, 29918, 1792, 511, 8853, 262, 854, 601, 29901, 5269, 1115, 269, 29918, 1792, 1800, 13, 1678, 263, 353, 270, 29889, 10072, 703, 262, 854, 601, 29901, 10072, 648, 3227, 29913, 1642, 4830, 29898, 10072, 29892, 6354, 29918, 333, 511, 14334, 29892, 6213, 29892, 8853, 262, 854, 601, 29901, 10072, 1542, 1115, 6354, 1800, 13, 268, 13, 268, 13, 1678, 565, 6354, 1275, 376, 949, 1115, 13, 4706, 2407, 29918, 333, 353, 6088, 29918, 11651, 29918, 333, 29918, 11083, 29898, 29877, 29918, 11651, 29918, 11083, 29897, 13, 4706, 26554, 353, 6088, 29918, 276, 4924, 29918, 7045, 29898, 29877, 29918, 11651, 29918, 7045, 29897, 13, 4706, 321, 353, 270, 29889, 10041, 703, 262, 854, 601, 29901, 11651, 648, 3227, 29913, 1642, 4830, 29898, 11651, 29918, 333, 29892, 26554, 511, 8853, 262, 854, 601, 29901, 11651, 1204, 1115, 2407, 29918, 333, 29892, 376, 262, 854, 601, 29901, 276, 4924, 1115, 26554, 1800, 13, 4706, 270, 29889, 11102, 29254, 630, 3047, 29898, 29874, 29892, 318, 29897, 13, 4706, 270, 29889, 3880, 29898, 29874, 29892, 321, 29897, 13, 1678, 25342, 6354, 1275, 376, 3258, 1115, 13, 4706, 2407, 29918, 333, 353, 6088, 29918, 11651, 29918, 333, 29918, 7045, 29898, 29877, 29918, 11651, 29918, 7045, 29897, 13, 4706, 26554, 353, 376, 29900, 29908, 13, 4706, 321, 353, 270, 29889, 10041, 703, 262, 854, 601, 29901, 11651, 648, 3227, 29913, 1642, 4830, 29898, 11651, 29918, 333, 29892, 26554, 511, 8853, 262, 854, 601, 29901, 11651, 1204, 1115, 2407, 29918, 333, 29892, 376, 262, 854, 601, 29901, 276, 4924, 1115, 26554, 1800, 13, 4706, 270, 29889, 11102, 29254, 630, 3047, 29898, 29874, 29892, 318, 29897, 13, 4706, 270, 29889, 11102, 24565, 2059, 29898, 29872, 29892, 263, 29897, 13, 1678, 25342, 6354, 1275, 376, 5504, 1115, 13, 4706, 716, 29918, 11651, 29918, 333, 353, 6088, 29918, 11651, 29918, 333, 29918, 7045, 29898, 29877, 29918, 11651, 29918, 7045, 29897, 13, 4706, 2030, 29918, 11651, 29918, 333, 353, 6088, 29918, 11651, 29918, 333, 29918, 11083, 29898, 29877, 29918, 11651, 29918, 11083, 29897, 13, 4706, 716, 29918, 276, 4924, 353, 6088, 29918, 276, 4924, 29918, 7045, 29898, 29877, 29918, 11651, 29918, 7045, 29897, 13, 4706, 2030, 29918, 276, 4924, 353, 851, 29898, 524, 29898, 1482, 29918, 276, 4924, 29897, 448, 29871, 29896, 29897, 13, 4706, 716, 29918, 29872, 353, 270, 29889, 10041, 703, 262, 854, 601, 29901, 11651, 648, 3227, 29913, 1642, 4830, 29898, 1482, 29918, 11651, 29918, 333, 29892, 716, 29918, 276, 4924, 511, 8853, 262, 854, 601, 29901, 11651, 1204, 1115, 716, 29918, 11651, 29918, 333, 29892, 376, 262, 854, 601, 29901, 276, 4924, 1115, 716, 29918, 276, 4924, 1800, 13, 4706, 2030, 29918, 29872, 353, 270, 29889, 10041, 703, 262, 854, 601, 29901, 11651, 648, 3227, 29913, 1642, 4830, 29898, 1025, 29918, 11651, 29918, 333, 29892, 2030, 29918, 276, 4924, 511, 8853, 262, 854, 601, 29901, 11651, 1204, 1115, 2030, 29918, 11651, 29918, 333, 29892, 376, 262, 854, 601, 29901, 276, 4924, 1115, 2030, 29918, 276, 4924, 1800, 13, 4706, 270, 29889, 11102, 29254, 630, 3047, 29898, 29874, 29892, 318, 29897, 13, 4706, 270, 29889, 3880, 29898, 29874, 29892, 2030, 29918, 29872, 29897, 13, 4706, 270, 29889, 3880, 29898, 29874, 29892, 716, 29918, 29872, 29897, 13, 4706, 270, 29889, 11102, 15383, 2347, 4591, 29898, 1482, 29918, 29872, 29892, 2030, 29918, 29872, 29897, 13, 1678, 25342, 6354, 1275, 376, 1761, 1115, 13, 4706, 19572, 353, 4390, 29889, 18132, 29898, 29877, 29918, 11651, 29918, 7045, 3366, 5327, 3108, 29961, 29900, 1822, 6506, 703, 29915, 613, 376, 2564, 6506, 703, 1966, 613, 20569, 29961, 29896, 29901, 2314, 3366, 29882, 1169, 3108, 3366, 29882, 1169, 3108, 13, 4706, 363, 7124, 297, 19572, 29901, 13, 9651, 2407, 29918, 333, 353, 7124, 3366, 333, 3108, 13, 9651, 26554, 353, 7124, 3366, 276, 4924, 3108, 13, 9651, 321, 353, 270, 29889, 10041, 703, 262, 854, 601, 29901, 11651, 648, 3227, 29913, 1642, 4830, 29898, 11651, 29918, 333, 29892, 26554, 511, 8853, 262, 854, 601, 29901, 11651, 1204, 1115, 2407, 29918, 333, 29892, 376, 262, 854, 601, 29901, 276, 4924, 1115, 26554, 1800, 13, 9651, 270, 29889, 3880, 29898, 29874, 29892, 321, 29897, 13, 4706, 270, 29889, 11102, 29254, 630, 3047, 29898, 29874, 29892, 318, 29897, 13, 1678, 25342, 6354, 1275, 376, 8143, 1115, 13, 4706, 2407, 29918, 333, 353, 9049, 5085, 3366, 5935, 16862, 5451, 703, 3757, 333, 29901, 1159, 29961, 29896, 1822, 5451, 703, 376, 9601, 29900, 29962, 13, 4706, 321, 353, 270, 29889, 10041, 703, 262, 854, 601, 29901, 11651, 648, 29913, 1642, 4830, 29898, 11651, 29918, 333, 511, 8853, 262, 854, 601, 29901, 11651, 1204, 1115, 2407, 29918, 333, 1800, 13, 4706, 270, 29889, 11102, 29254, 630, 3047, 29898, 29874, 29892, 318, 29897, 13, 4706, 270, 29889, 3880, 29898, 29874, 29892, 321, 29897, 13, 1678, 1683, 29901, 13, 4706, 736, 6571, 13, 268, 13, 1678, 736, 270, 29889, 643, 6646, 29898, 12860, 29922, 29906, 29897, 13, 13, 418, 13, 1753, 6088, 29918, 10072, 29898, 10072, 1125, 13, 1678, 694, 29918, 10072, 353, 376, 1217, 459, 29908, 13, 1678, 565, 451, 6354, 29901, 13, 4706, 736, 694, 29918, 10072, 13, 1678, 736, 6354, 7503, 29899, 29896, 29929, 29962, 396, 15450, 903, 16074, 29918, 14399, 13, 268, 13, 1753, 6088, 29918, 11651, 29918, 333, 29918, 11083, 29898, 29877, 29918, 11651, 29918, 11083, 1125, 13, 1678, 694, 29918, 11651, 29918, 333, 353, 376, 348, 1693, 2164, 29899, 11651, 29908, 13, 1678, 565, 451, 288, 29918, 11651, 29918, 11083, 29901, 13, 4706, 736, 694, 29918, 11651, 29918, 333, 13, 1678, 736, 288, 29918, 11651, 29918, 11083, 29889, 657, 703, 3757, 333, 613, 694, 29918, 11651, 29918, 333, 29897, 13, 268, 13, 1753, 6088, 29918, 11651, 29918, 333, 29918, 7045, 29898, 29877, 29918, 11651, 29918, 7045, 1125, 13, 1678, 694, 29918, 11651, 29918, 333, 353, 376, 348, 1693, 2164, 29899, 11651, 29908, 13, 1678, 565, 451, 288, 29918, 11651, 29918, 7045, 29901, 13, 4706, 736, 694, 29918, 11651, 29918, 333, 13, 1678, 736, 288, 29918, 11651, 29918, 7045, 3366, 5327, 3108, 29961, 29900, 1822, 5451, 703, 3757, 333, 1159, 29961, 29896, 3816, 29941, 29901, 1822, 5451, 14182, 613, 5931, 1159, 29961, 29900, 29962, 13, 268, 13, 1753, 6088, 29918, 276, 4924, 29918, 7045, 29898, 29877, 29918, 11651, 29918, 7045, 1125, 13, 1678, 396, 871, 4893, 937, 6403, 663, 310, 376, 276, 4924, 29908, 964, 3633, 13, 1678, 694, 29918, 276, 4924, 353, 679, 29918, 16394, 29918, 3707, 580, 13, 1678, 565, 451, 288, 29918, 11651, 29918, 7045, 29901, 13, 4706, 736, 694, 29918, 276, 4924, 13, 1678, 736, 288, 29918, 11651, 29918, 7045, 3366, 5327, 3108, 29961, 29900, 1822, 5451, 703, 276, 4924, 1159, 29961, 29896, 3816, 29906, 29901, 1822, 5451, 28165, 1159, 29961, 29900, 29962, 13, 268, 13, 1753, 679, 29918, 16394, 29918, 3707, 7295, 13, 1678, 736, 851, 29898, 524, 29898, 2230, 29889, 2230, 22130, 13, 268, 13, 1753, 679, 29918, 3188, 29918, 16123, 29918, 3225, 7295, 13, 1678, 270, 353, 9133, 6268, 580, 13, 1678, 270, 29889, 1202, 29918, 22377, 703, 262, 854, 601, 613, 376, 1124, 597, 4773, 29889, 990, 29914, 262, 854, 601, 29914, 1159, 13, 1678, 736, 270, 13, 4706, 13, 13, 1753, 321, 2158, 10456, 5085, 29892, 3579, 19290, 1125, 13, 1678, 1596, 10456, 5085, 29892, 934, 29922, 3150, 11974, 7050, 29914, 2704, 29889, 3945, 613, 376, 29874, 29974, 4968, 3579, 19290, 29897, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 1852, 2435, 353, 7431, 29898, 9675, 29889, 19218, 29897, 13, 1678, 565, 1852, 2435, 338, 451, 29871, 29955, 29901, 13, 4706, 321, 2158, 703, 1252, 23617, 29871, 29955, 1899, 1196, 6273, 526, 3734, 1159, 13, 4706, 6876, 29898, 29941, 29897, 13, 13, 1678, 1018, 29901, 13, 4706, 269, 29918, 1792, 353, 10876, 29889, 19218, 29961, 29896, 29962, 13, 4706, 269, 29918, 10072, 353, 10876, 29889, 19218, 29961, 29906, 29962, 13, 4706, 288, 29918, 11651, 29918, 7045, 353, 4390, 29889, 18132, 29898, 9675, 29889, 19218, 29961, 29941, 2314, 565, 10876, 29889, 19218, 29961, 29941, 29962, 2804, 376, 4304, 29908, 1683, 6213, 13, 4706, 288, 29918, 11651, 29918, 11083, 353, 4390, 29889, 18132, 29898, 9675, 29889, 19218, 29961, 29946, 2314, 565, 10876, 29889, 19218, 29961, 29946, 29962, 2804, 376, 4304, 29908, 1683, 6213, 13, 4706, 6389, 353, 4390, 29889, 18132, 29898, 9675, 29889, 19218, 29961, 29945, 2314, 13, 4706, 9049, 5085, 353, 4390, 29889, 18132, 29898, 9675, 29889, 19218, 29961, 29953, 2314, 13, 1678, 5174, 29901, 13, 4706, 321, 2158, 703, 6255, 1196, 6273, 526, 451, 2854, 1159, 13, 4706, 6876, 29898, 29941, 29897, 13, 13, 1678, 1326, 8899, 29918, 6786, 353, 2897, 29889, 657, 6272, 703, 8618, 29963, 1254, 29949, 1525, 29918, 11889, 5813, 1159, 13, 1678, 1326, 8899, 29918, 2754, 1989, 353, 2897, 29889, 657, 6272, 703, 8618, 29963, 1254, 29949, 1525, 29918, 8787, 10818, 1159, 13, 1678, 565, 451, 1326, 8899, 29918, 6786, 470, 451, 1326, 8899, 29918, 2754, 1989, 29901, 13, 4706, 321, 2158, 703, 3782, 13756, 29963, 1254, 29949, 1525, 16140, 1476, 297, 8829, 3651, 1159, 13, 4706, 6876, 29898, 29896, 29897, 13, 13, 1678, 5503, 29918, 3126, 29898, 4282, 29918, 16123, 29918, 3126, 29898, 29879, 29918, 1792, 29892, 269, 29918, 10072, 29892, 288, 29918, 11651, 29918, 11083, 29892, 288, 29918, 11651, 29918, 7045, 29892, 6389, 29892, 9049, 5085, 511, 1326, 8899, 29918, 6786, 29892, 1326, 8899, 29918, 2754, 1989, 29897, 13, 2 ]
main.py
mywrong/walabot_heatmap_camera
1
1609055
<reponame>mywrong/walabot_heatmap_camera from walabot import Walabot import time import json import collections from multiprocessing import Process,Value import cv2 class Getmap: def __init__(self): self.w=Walabot() self.w.ARENA=[(100, 500, 10), (-45, 45, 3), (-45, 45, 3)] self.RF_array=collections.OrderedDict() self.cap = cv2.VideoCapture(1) def work(self,map_num,mapfile,photofile): self.w.isConnectedAny() self.w.simpleInit() for i in range(map_num): rawImage=self.w.triggerAndGetRawImage() self.RF_array['{:.2f}'.format(time.time())]=rawImage ret, frame = self.cap.read() cv2.imshow('frame', frame) cv2.imwrite(photofile+'/{:.2f}.jpg'.format(time.time()), frame) cv2.waitKey(1) self.w.disConnected() self.cap.release() cv2.destroyAllWindows() with open(mapfile+'\rawImage.txt', 'w') as f: json.dump(self.RF_array, f) if __name__=='__main__': w=Getmap() w.work()
[ 1, 529, 276, 1112, 420, 29958, 1357, 15866, 549, 29914, 14625, 370, 327, 29918, 354, 271, 1958, 29918, 26065, 13, 3166, 17042, 370, 327, 1053, 5260, 370, 327, 6756, 13, 5215, 931, 30004, 13, 5215, 4390, 30004, 13, 5215, 16250, 30004, 13, 3166, 6674, 307, 985, 292, 1053, 10554, 29892, 1917, 30004, 13, 5215, 13850, 29906, 30004, 13, 1990, 3617, 1958, 29901, 30004, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 30004, 13, 4706, 1583, 29889, 29893, 29922, 29956, 284, 370, 327, 26471, 13, 4706, 1583, 29889, 29893, 29889, 1718, 1430, 29909, 11759, 29898, 29896, 29900, 29900, 29892, 29871, 29945, 29900, 29900, 29892, 29871, 29896, 29900, 511, 8521, 29946, 29945, 29892, 29871, 29946, 29945, 29892, 29871, 29941, 511, 8521, 29946, 29945, 29892, 29871, 29946, 29945, 29892, 29871, 29941, 4638, 30004, 13, 4706, 1583, 29889, 29934, 29943, 29918, 2378, 29922, 29027, 29889, 7514, 287, 21533, 26471, 13, 4706, 1583, 29889, 5030, 353, 13850, 29906, 29889, 15167, 21133, 545, 29898, 29896, 8443, 13, 1678, 822, 664, 29898, 1311, 29892, 1958, 29918, 1949, 29892, 1958, 1445, 29892, 561, 327, 974, 488, 1125, 30004, 13, 4706, 1583, 29889, 29893, 29889, 275, 20971, 2954, 10773, 26471, 13, 4706, 1583, 29889, 29893, 29889, 12857, 6644, 580, 29871, 6756, 13, 4706, 363, 474, 297, 3464, 29898, 1958, 29918, 1949, 1125, 30004, 13, 9651, 10650, 2940, 29922, 1311, 29889, 29893, 29889, 21001, 2855, 2577, 22131, 2940, 580, 1669, 6756, 13, 9651, 1583, 29889, 29934, 29943, 29918, 2378, 1839, 25641, 29889, 29906, 29888, 29913, 4286, 4830, 29898, 2230, 29889, 2230, 3101, 13192, 1610, 2940, 30004, 13, 9651, 3240, 29892, 3515, 353, 1583, 29889, 5030, 29889, 949, 26471, 13, 9651, 13850, 29906, 29889, 326, 4294, 877, 2557, 742, 3515, 8443, 13, 9651, 13850, 29906, 29889, 326, 3539, 29898, 561, 327, 974, 488, 23097, 19248, 29901, 29889, 29906, 29888, 1836, 6173, 4286, 4830, 29898, 2230, 29889, 2230, 25739, 3515, 8443, 13, 9651, 13850, 29906, 29889, 10685, 2558, 29898, 29896, 8443, 13, 4706, 1583, 29889, 29893, 29889, 2218, 20971, 2954, 26471, 13, 4706, 1583, 29889, 5030, 29889, 14096, 26471, 13, 4706, 13850, 29906, 29889, 20524, 3596, 7685, 26471, 13, 4706, 411, 1722, 29898, 1958, 1445, 29974, 12764, 1610, 2940, 29889, 3945, 742, 525, 29893, 1495, 408, 285, 29901, 30004, 13, 9651, 4390, 29889, 15070, 29898, 1311, 29889, 29934, 29943, 29918, 2378, 29892, 285, 8443, 13, 30004, 13, 30004, 13, 361, 4770, 978, 1649, 1360, 29915, 1649, 3396, 1649, 2396, 30004, 13, 1678, 281, 29922, 2577, 1958, 26471, 13, 1678, 281, 29889, 1287, 26471, 13, 308, 2 ]
bokeh/plot_object.py
csaid/bokeh
1
79321
from __future__ import absolute_import, print_function import os.path from uuid import uuid4 from functools import wraps import warnings import logging logger = logging.getLogger(__file__) from six import add_metaclass, iteritems from six.moves.urllib.parse import urlsplit from .embed import autoload_static, autoload_server from .properties import HasProps, MetaHasProps, Instance, String from .protocol import serialize_json from .utils import get_ref, convert_references, dump class Viewable(MetaHasProps): """ Any plot object (Data Model) which has its own View Model in the persistence layer. Adds handling of a __view_model__ attribute to the class (which is provided by default) which tells the View layer what View class to create. One thing to keep in mind is that a Viewable should have a single unique representation in the persistence layer, but it might have multiple concurrent client-side Views looking at it. Those may be from different machines altogether. """ # Stores a mapping from subclass __view_model__ names to classes model_class_reverse_map = {} # Mmmm.. metaclass inheritance. On the one hand, it seems a little # overkill. On the other hand, this is exactly the sort of thing # it's meant for. def __new__(cls, class_name, bases, class_dict): if "__view_model__" not in class_dict: class_dict["__view_model__"] = class_name class_dict["get_class"] = Viewable.get_class # Create the new class newcls = super(Viewable,cls).__new__(cls, class_name, bases, class_dict) entry = class_dict["__view_model__"] # Add it to the reverse map, but check for duplicates first if entry in Viewable.model_class_reverse_map: raise Warning("Duplicate __view_model__ declaration of '%s' for " \ "class %s. Previous definition: %s" % \ (entry, class_name, Viewable.model_class_reverse_map[entry])) Viewable.model_class_reverse_map[entry] = newcls return newcls @classmethod def _preload_models(cls): from . import objects, widgetobjects from .crossfilter import objects @classmethod def get_class(cls, view_model_name): """ Given a __view_model__ name, returns the corresponding class object """ cls._preload_models() d = Viewable.model_class_reverse_map if view_model_name in d: return d[view_model_name] else: raise KeyError("View model name '%s' not found" % view_model_name) def usesession(meth): """ Checks for 'session' in kwargs and in **self**, and guarantees that **kw** always has a valid 'session' parameter. Wrapped methods should define 'session' as an optional argument, and in the body of the method, should expect an """ @wraps(meth) def wrapper(self, *args, **kw): session = kw.get("session", None) if session is None: session = getattr(self, "session") if session is None: raise RuntimeError("Call to %s needs a session" % meth.__name__) kw["session"] = session return meth(self, *args, **kw) return wrapper def is_ref(frag): return isinstance(frag, dict) and \ frag.get('type') and \ frag.get('id') def json_apply(fragment, check_func, func): """recursively searches through a nested dict/lists if check_func(fragment) is True, then we return func(fragment) """ if check_func(fragment): return func(fragment) elif isinstance(fragment, list): output = [] for val in fragment: output.append(json_apply(val, check_func, func)) return output elif isinstance(fragment, dict): output = {} for k, val in fragment.items(): output[k] = json_apply(val, check_func, func) return output else: return fragment def resolve_json(fragment, models): check_func = is_ref def func(fragment): if fragment['id'] in models: return models[fragment['id']] else: logging.error("model not found for %s", fragment) return None return json_apply(fragment, check_func, func) @add_metaclass(Viewable) class PlotObject(HasProps): """ Base class for all plot-related objects """ session = Instance(".session.Session") name = String() def __init__(self, **kwargs): # Eventually should use our own memo instead of storing # an attribute on the class if "id" in kwargs: self._id = kwargs.pop("id") else: self._id = str(uuid4()) self._dirty = True self._callbacks_dirty = False self._callbacks = {} self._callback_queue = [] self._block_callbacks = False block_events = kwargs.pop('_block_events', False) if not block_events: super(PlotObject, self).__init__(**kwargs) self.setup_events() else: self._block_callbacks = True super(PlotObject, self).__init__(**kwargs) def get_ref(self): return { 'type': self.__view_model__, 'id': self._id, } def setup_events(self): pass @classmethod def load_json(cls, attrs, instance=None): """Loads all json into a instance of cls, EXCEPT any references which are handled in finalize """ if 'id' not in attrs: raise RuntimeError("Unable to find 'id' attribute in JSON: %r" % attrs) _id = attrs.pop('id') if not instance: instance = cls(id=_id, _block_events=True) _doc = attrs.pop("doc", None) ref_props = {} for p in instance.properties_with_refs(): if p in attrs: ref_props[p] = attrs.pop(p) special_props = {} for p in dict(attrs): if p not in instance.properties(): special_props[p] = attrs.pop(p) instance._ref_props = ref_props instance._special_props = special_props instance.update(**attrs) return instance def finalize(self, models): """Convert any references into instances models is a dict of id->model mappings """ if hasattr(self, "_ref_props"): return resolve_json(self._ref_props, models) else: return {} @classmethod def collect_plot_objects(cls, *input_objs): """ Iterate over ``input_objs`` and descend through their structure collecting all nested ``PlotObjects`` on the go. The resulting list is duplicate-free based on objects' identifiers. """ ids = set([]) objs = [] def descend_props(obj): for attr in obj.properties_with_refs(): descend(getattr(obj, attr)) def descend(obj): if isinstance(obj, PlotObject): if obj._id not in ids: ids.add(obj._id) descend_props(obj) objs.append(obj) elif isinstance(obj, HasProps): descend_props(obj) elif isinstance(obj, (list, tuple)): for item in obj: descend(item) elif isinstance(obj, dict): for key, value in iteritems(obj): descend(key); descend(value) descend(input_objs) return objs def references(self): """Returns all ``PlotObjects`` that this object has references to. """ return set(self.collect_plot_objects(self)) #--------------------------------------------------------------------- # View Model connection methods # # Whereas a rich client rendering framework can maintain view state # alongside model state, we need an explicit send/receive protocol for # communicating with a set of view models that reside on the front end. # Many of the calls one would expect in a rich client map instead to # batched updates on the M-VM-V approach. #--------------------------------------------------------------------- def vm_props(self): """ Returns the ViewModel-related properties of this object. """ props = self.changed_properties_with_values() props.pop("session", None) return props def vm_serialize(self): """ Returns a dictionary of the attributes of this object, in a layout corresponding to what BokehJS expects at unmarshalling time. """ attrs = self.vm_props() attrs['id'] = self._id return attrs def dump(self, docid=None): """convert all references to json """ models = self.references() return dump(models, docid=docid) def update(self, **kwargs): for k,v in kwargs.items(): setattr(self, k, v) def __str__(self): return "%s, ViewModel:%s, ref _id: %s" % (self.__class__.__name__, self.__view_model__, getattr(self, "_id", None)) def on_change(self, attrname, obj, callbackname=None): """when attrname of self changes, call callbackname on obj """ callbacks = self._callbacks.setdefault(attrname, []) callback = dict(obj=obj, callbackname=callbackname) if callback not in callbacks: callbacks.append(callback) self._callbacks_dirty = True def _trigger(self, attrname, old, new): """attrname of self changed. So call all callbacks """ callbacks = self._callbacks.get(attrname) if callbacks: for callback in callbacks: obj = callback.get('obj') callbackname = callback.get('callbackname') fn = obj if callbackname is None else getattr(obj, callbackname) fn(self, attrname, old, new) # TODO: deprecation warnign about args change (static_path) def create_html_snippet( self, server=False, embed_base_url="", embed_save_loc=".", static_path="http://localhost:5006/bokehjs/static"): """create_html_snippet is used to embed a plot in an html page. create_html_snippet returns the embed string to be put in html. This will be a <script> tag. To embed a plot dependent on the Bokeh Plot Server, set server=True, otherwise a file with the data for the plot will be built. embed_base_url is used for non-server embedding. This is used as the root of the url where the embed.js file will be saved. embed_save_loc controls where the embed.js will be actually written to. static_path controls where the embed snippet looks to find bokeh.js and the other resources it needs for bokeh. """ if server: from .session import Session if embed_base_url: session = Session(root_url=server_url) else: session = Session() return autoload_server(self, session) from .templates import AUTOLOAD, AUTOLOAD_STATIC import uuid js_filename = "%s.embed.js" % self._id script_path = embed_base_url + js_filename elementid = str(uuid.uuid4()) js = AUTOLOAD.render( all_models = serialize_json(self.dump()), js_url = static_path + "js/bokeh.min.js", css_files = [static_path + "css/bokeh.min.css"], elementid = elementid, ) tag = AUTOLOAD_STATIC.render( src_path = script_path, elementid = elementid, modelid = self._id, modeltype = self.__view_model__, ) save_path = os.path.join(embed_save_loc, js_filename) with open(save_path,"w") as f: f.write(js) return tag def inject_snippet( self, server=False, embed_base_url="", embed_save_loc=".", static_path="http://localhost:5006/bokeh/static/"): warnings.warn("inject_snippet is deprecated, please use create_html_snippet") return self.create_html_snippet( server, embed_base_url, embed_save_loc, static_path) def _build_server_snippet(self, base_url=False): sess = self._session modelid = self._id typename = self.__view_model__ if not base_url: base_url = sess.root_url split = urlsplit(base_url) if split.scheme == 'http': ws_conn_string = "ws://%s/bokeh/sub" % split.netloc else: ws_conn_string = "wss://%s/bokeh/sub" % split.netloc f_dict = dict( docid = sess.docid, ws_conn_string = ws_conn_string, docapikey = sess.apikey, root_url = base_url, modelid = modelid, modeltype = typename, script_url = base_url + "bokeh/embed.js") e_str = '''<script src="%(script_url)s" bokeh_plottype="serverconn" bokeh_docid="%(docid)s" bokeh_ws_conn_string="%(ws_conn_string)s" bokeh_docapikey="%(docapikey)s" bokeh_root_url="%(root_url)s" bokeh_modelid="%(modelid)s" bokeh_modeltype="%(modeltype)s" async="true"></script> ''' return "", e_str % f_dict def _build_static_embed_snippet(self, static_path, embed_base_url): embed_filename = "%s.embed.js" % self._id full_embed_path = embed_base_url + embed_filename js_str = self._session.embed_js(self._id, static_path) sess = self._session modelid = self._id typename = self.__view_model__ embed_filename = full_embed_path f_dict = dict(modelid = modelid, modeltype = typename, embed_filename=embed_filename) e_str = '''<script src="%(embed_filename)s" bokeh_plottype="embeddata" bokeh_modelid="%(modelid)s" bokeh_modeltype="%(modeltype)s" async="true"></script> ''' return js_str, e_str % f_dict
[ 1, 515, 4770, 29888, 9130, 1649, 1053, 8380, 29918, 5215, 29892, 1596, 29918, 2220, 13, 13, 5215, 2897, 29889, 2084, 13, 3166, 318, 5416, 1053, 318, 5416, 29946, 13, 3166, 2090, 312, 8789, 1053, 11463, 567, 13, 13, 5215, 18116, 13, 5215, 12183, 13, 21707, 353, 12183, 29889, 657, 16363, 22168, 1445, 1649, 29897, 13, 13, 3166, 4832, 1053, 788, 29918, 2527, 562, 605, 29892, 4256, 7076, 13, 3166, 4832, 29889, 13529, 267, 29889, 2271, 1982, 29889, 5510, 1053, 3142, 5451, 13, 13, 3166, 869, 17987, 1053, 1120, 3543, 328, 29918, 7959, 29892, 1120, 3543, 328, 29918, 2974, 13, 3166, 869, 11330, 1053, 11699, 20457, 29892, 20553, 14510, 20457, 29892, 2799, 749, 29892, 1714, 13, 3166, 869, 20464, 1053, 28755, 29918, 3126, 13, 3166, 869, 13239, 1053, 679, 29918, 999, 29892, 3588, 29918, 276, 10662, 29892, 16766, 13, 13, 1990, 4533, 519, 29898, 19346, 14510, 20457, 1125, 13, 1678, 9995, 3139, 6492, 1203, 313, 1469, 8125, 29897, 607, 756, 967, 1914, 4533, 8125, 297, 278, 13, 1678, 3736, 11416, 7546, 29889, 13, 13, 1678, 3462, 29879, 11415, 310, 263, 4770, 1493, 29918, 4299, 1649, 5352, 304, 278, 770, 313, 4716, 338, 13, 1678, 4944, 491, 2322, 29897, 607, 10603, 278, 4533, 7546, 825, 4533, 770, 304, 13, 1678, 1653, 29889, 13, 13, 1678, 3118, 2655, 304, 3013, 297, 3458, 338, 393, 263, 4533, 519, 881, 505, 263, 2323, 13, 1678, 5412, 8954, 297, 278, 3736, 11416, 7546, 29892, 541, 372, 1795, 505, 13, 1678, 2999, 21984, 3132, 29899, 2975, 4533, 29879, 3063, 472, 372, 29889, 29871, 16025, 1122, 13, 1678, 367, 515, 1422, 14884, 19148, 29889, 13, 1678, 9995, 13, 13, 1678, 396, 624, 2361, 263, 10417, 515, 19481, 4770, 1493, 29918, 4299, 1649, 2983, 304, 4413, 13, 1678, 1904, 29918, 1990, 29918, 24244, 29918, 1958, 353, 6571, 13, 13, 1678, 396, 341, 4317, 29885, 636, 1539, 562, 605, 20328, 29889, 29871, 1551, 278, 697, 1361, 29892, 372, 2444, 263, 2217, 13, 1678, 396, 975, 21174, 29889, 1551, 278, 916, 1361, 29892, 445, 338, 3721, 278, 2656, 310, 2655, 13, 1678, 396, 372, 29915, 29879, 6839, 363, 29889, 13, 1678, 822, 4770, 1482, 12035, 25932, 29892, 770, 29918, 978, 29892, 22561, 29892, 770, 29918, 8977, 1125, 13, 4706, 565, 376, 1649, 1493, 29918, 4299, 1649, 29908, 451, 297, 770, 29918, 8977, 29901, 13, 9651, 770, 29918, 8977, 3366, 1649, 1493, 29918, 4299, 1649, 3108, 353, 770, 29918, 978, 13, 4706, 770, 29918, 8977, 3366, 657, 29918, 1990, 3108, 353, 4533, 519, 29889, 657, 29918, 1990, 13, 13, 4706, 396, 6204, 278, 716, 770, 13, 4706, 716, 25932, 353, 2428, 29898, 1043, 519, 29892, 25932, 467, 1649, 1482, 12035, 25932, 29892, 770, 29918, 978, 29892, 22561, 29892, 770, 29918, 8977, 29897, 13, 4706, 6251, 353, 770, 29918, 8977, 3366, 1649, 1493, 29918, 4299, 1649, 3108, 13, 4706, 396, 3462, 372, 304, 278, 11837, 2910, 29892, 541, 1423, 363, 20955, 937, 13, 4706, 565, 6251, 297, 4533, 519, 29889, 4299, 29918, 1990, 29918, 24244, 29918, 1958, 29901, 13, 9651, 12020, 24412, 703, 29928, 786, 5926, 4770, 1493, 29918, 4299, 1649, 12029, 310, 14210, 29879, 29915, 363, 376, 320, 13, 462, 3986, 376, 1990, 1273, 29879, 29889, 29871, 4721, 2366, 5023, 29901, 1273, 29879, 29908, 1273, 320, 13, 462, 3986, 313, 8269, 29892, 770, 29918, 978, 29892, 13, 462, 965, 4533, 519, 29889, 4299, 29918, 1990, 29918, 24244, 29918, 1958, 29961, 8269, 12622, 13, 4706, 4533, 519, 29889, 4299, 29918, 1990, 29918, 24244, 29918, 1958, 29961, 8269, 29962, 353, 716, 25932, 13, 4706, 736, 716, 25932, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 903, 1457, 1359, 29918, 9794, 29898, 25932, 1125, 13, 4706, 515, 869, 1053, 3618, 29892, 11109, 12650, 13, 4706, 515, 869, 19128, 4572, 1053, 3618, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 679, 29918, 1990, 29898, 25932, 29892, 1776, 29918, 4299, 29918, 978, 1125, 13, 4706, 9995, 11221, 263, 4770, 1493, 29918, 4299, 1649, 1024, 29892, 3639, 278, 6590, 770, 13, 4706, 1203, 13, 4706, 9995, 13, 4706, 1067, 29879, 3032, 1457, 1359, 29918, 9794, 580, 13, 4706, 270, 353, 4533, 519, 29889, 4299, 29918, 1990, 29918, 24244, 29918, 1958, 13, 4706, 565, 1776, 29918, 4299, 29918, 978, 297, 270, 29901, 13, 9651, 736, 270, 29961, 1493, 29918, 4299, 29918, 978, 29962, 13, 4706, 1683, 29901, 13, 9651, 12020, 7670, 2392, 703, 1043, 1904, 1024, 14210, 29879, 29915, 451, 1476, 29908, 1273, 1776, 29918, 4299, 29918, 978, 29897, 13, 13, 1753, 3913, 1211, 29898, 29885, 621, 1125, 13, 1678, 9995, 5399, 29879, 363, 525, 7924, 29915, 297, 9049, 5085, 322, 297, 3579, 1311, 1068, 29892, 322, 10509, 267, 13, 1678, 393, 3579, 11022, 1068, 2337, 756, 263, 2854, 525, 7924, 29915, 3443, 29889, 29871, 399, 336, 2986, 3519, 13, 1678, 881, 4529, 525, 7924, 29915, 408, 385, 13136, 2980, 29892, 322, 297, 278, 3573, 310, 13, 1678, 278, 1158, 29892, 881, 2149, 385, 13, 1678, 9995, 13, 1678, 732, 29893, 336, 567, 29898, 29885, 621, 29897, 13, 1678, 822, 14476, 29898, 1311, 29892, 334, 5085, 29892, 3579, 11022, 1125, 13, 4706, 4867, 353, 9049, 29889, 657, 703, 7924, 613, 6213, 29897, 13, 4706, 565, 4867, 338, 6213, 29901, 13, 9651, 4867, 353, 679, 5552, 29898, 1311, 29892, 376, 7924, 1159, 13, 4706, 565, 4867, 338, 6213, 29901, 13, 9651, 12020, 24875, 2392, 703, 5594, 304, 1273, 29879, 4225, 263, 4867, 29908, 1273, 286, 621, 17255, 978, 1649, 29897, 13, 4706, 9049, 3366, 7924, 3108, 353, 4867, 13, 4706, 736, 286, 621, 29898, 1311, 29892, 334, 5085, 29892, 3579, 11022, 29897, 13, 1678, 736, 14476, 13, 13, 1753, 338, 29918, 999, 29898, 29888, 1431, 1125, 13, 1678, 736, 338, 8758, 29898, 29888, 1431, 29892, 9657, 29897, 322, 320, 13, 965, 13855, 29889, 657, 877, 1853, 1495, 322, 320, 13, 965, 13855, 29889, 657, 877, 333, 1495, 13, 13, 1753, 4390, 29918, 7302, 29898, 20777, 29892, 1423, 29918, 9891, 29892, 3653, 1125, 13, 1678, 9995, 3757, 1295, 3598, 29645, 1549, 263, 9322, 9657, 29914, 21513, 13, 1678, 565, 1423, 29918, 9891, 29898, 20777, 29897, 338, 5852, 29892, 769, 591, 736, 13, 1678, 3653, 29898, 20777, 29897, 13, 1678, 9995, 13, 1678, 565, 1423, 29918, 9891, 29898, 20777, 1125, 13, 4706, 736, 3653, 29898, 20777, 29897, 13, 1678, 25342, 338, 8758, 29898, 20777, 29892, 1051, 1125, 13, 4706, 1962, 353, 5159, 13, 4706, 363, 659, 297, 9376, 29901, 13, 9651, 1962, 29889, 4397, 29898, 3126, 29918, 7302, 29898, 791, 29892, 1423, 29918, 9891, 29892, 3653, 876, 13, 4706, 736, 1962, 13, 1678, 25342, 338, 8758, 29898, 20777, 29892, 9657, 1125, 13, 4706, 1962, 353, 6571, 13, 4706, 363, 413, 29892, 659, 297, 9376, 29889, 7076, 7295, 13, 9651, 1962, 29961, 29895, 29962, 353, 4390, 29918, 7302, 29898, 791, 29892, 1423, 29918, 9891, 29892, 3653, 29897, 13, 4706, 736, 1962, 13, 1678, 1683, 29901, 13, 4706, 736, 9376, 13, 13, 1753, 8814, 29918, 3126, 29898, 20777, 29892, 4733, 1125, 13, 1678, 1423, 29918, 9891, 353, 338, 29918, 999, 13, 1678, 822, 3653, 29898, 20777, 1125, 13, 4706, 565, 9376, 1839, 333, 2033, 297, 4733, 29901, 13, 9651, 736, 4733, 29961, 20777, 1839, 333, 2033, 29962, 13, 4706, 1683, 29901, 13, 9651, 12183, 29889, 2704, 703, 4299, 451, 1476, 363, 1273, 29879, 613, 9376, 29897, 13, 9651, 736, 6213, 13, 1678, 736, 4390, 29918, 7302, 29898, 20777, 29892, 1423, 29918, 9891, 29892, 3653, 29897, 13, 13, 29992, 1202, 29918, 2527, 562, 605, 29898, 1043, 519, 29897, 13, 1990, 18399, 2061, 29898, 14510, 20457, 1125, 13, 1678, 9995, 7399, 770, 363, 599, 6492, 29899, 12817, 3618, 9995, 13, 13, 1678, 4867, 353, 2799, 749, 17350, 7924, 29889, 7317, 1159, 13, 1678, 1024, 353, 1714, 580, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 3579, 19290, 1125, 13, 4706, 396, 6864, 1474, 881, 671, 1749, 1914, 2626, 29877, 2012, 310, 15446, 13, 4706, 396, 385, 5352, 373, 278, 770, 13, 4706, 565, 376, 333, 29908, 297, 9049, 5085, 29901, 13, 9651, 1583, 3032, 333, 353, 9049, 5085, 29889, 7323, 703, 333, 1159, 13, 4706, 1683, 29901, 13, 9651, 1583, 3032, 333, 353, 851, 29898, 25118, 29946, 3101, 13, 13, 4706, 1583, 3032, 3972, 1017, 353, 5852, 13, 4706, 1583, 3032, 14035, 29879, 29918, 3972, 1017, 353, 7700, 13, 4706, 1583, 3032, 14035, 29879, 353, 6571, 13, 4706, 1583, 3032, 14035, 29918, 9990, 353, 5159, 13, 4706, 1583, 3032, 1271, 29918, 14035, 29879, 353, 7700, 13, 13, 4706, 2908, 29918, 13604, 353, 9049, 5085, 29889, 7323, 877, 29918, 1271, 29918, 13604, 742, 7700, 29897, 13, 13, 4706, 565, 451, 2908, 29918, 13604, 29901, 13, 9651, 2428, 29898, 20867, 2061, 29892, 1583, 467, 1649, 2344, 12035, 1068, 19290, 29897, 13, 9651, 1583, 29889, 14669, 29918, 13604, 580, 13, 4706, 1683, 29901, 13, 9651, 1583, 3032, 1271, 29918, 14035, 29879, 353, 5852, 13, 9651, 2428, 29898, 20867, 2061, 29892, 1583, 467, 1649, 2344, 12035, 1068, 19290, 29897, 13, 13, 1678, 822, 679, 29918, 999, 29898, 1311, 1125, 13, 4706, 736, 426, 13, 9651, 525, 1853, 2396, 1583, 17255, 1493, 29918, 4299, 1649, 29892, 13, 9651, 525, 333, 2396, 1583, 3032, 333, 29892, 13, 4706, 500, 13, 13, 1678, 822, 6230, 29918, 13604, 29898, 1311, 1125, 13, 4706, 1209, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 2254, 29918, 3126, 29898, 25932, 29892, 12421, 29879, 29892, 2777, 29922, 8516, 1125, 13, 4706, 9995, 5896, 29879, 599, 4390, 964, 263, 2777, 310, 1067, 29879, 29892, 8528, 4741, 7982, 738, 9282, 13, 4706, 607, 526, 16459, 297, 2186, 675, 13, 4706, 9995, 13, 4706, 565, 525, 333, 29915, 451, 297, 12421, 29879, 29901, 13, 9651, 12020, 24875, 2392, 703, 2525, 519, 304, 1284, 525, 333, 29915, 5352, 297, 4663, 29901, 1273, 29878, 29908, 1273, 12421, 29879, 29897, 13, 4706, 903, 333, 353, 12421, 29879, 29889, 7323, 877, 333, 1495, 13, 13, 4706, 565, 451, 2777, 29901, 13, 9651, 2777, 353, 1067, 29879, 29898, 333, 29922, 29918, 333, 29892, 903, 1271, 29918, 13604, 29922, 5574, 29897, 13, 13, 4706, 903, 1514, 353, 12421, 29879, 29889, 7323, 703, 1514, 613, 6213, 29897, 13, 13, 4706, 2143, 29918, 11030, 353, 6571, 13, 4706, 363, 282, 297, 2777, 29889, 11330, 29918, 2541, 29918, 24539, 7295, 13, 9651, 565, 282, 297, 12421, 29879, 29901, 13, 18884, 2143, 29918, 11030, 29961, 29886, 29962, 353, 12421, 29879, 29889, 7323, 29898, 29886, 29897, 13, 13, 4706, 4266, 29918, 11030, 353, 6571, 13, 4706, 363, 282, 297, 9657, 29898, 5552, 29879, 1125, 13, 9651, 565, 282, 451, 297, 2777, 29889, 11330, 7295, 13, 18884, 4266, 29918, 11030, 29961, 29886, 29962, 353, 12421, 29879, 29889, 7323, 29898, 29886, 29897, 13, 13, 4706, 2777, 3032, 999, 29918, 11030, 353, 2143, 29918, 11030, 13, 4706, 2777, 3032, 18732, 29918, 11030, 353, 4266, 29918, 11030, 13, 13, 4706, 2777, 29889, 5504, 29898, 1068, 5552, 29879, 29897, 13, 4706, 736, 2777, 13, 13, 1678, 822, 2186, 675, 29898, 1311, 29892, 4733, 1125, 13, 4706, 9995, 18455, 738, 9282, 964, 8871, 13, 4706, 4733, 338, 263, 9657, 310, 1178, 976, 4299, 611, 27775, 13, 4706, 9995, 13, 4706, 565, 756, 5552, 29898, 1311, 29892, 11119, 999, 29918, 11030, 29908, 1125, 13, 9651, 736, 8814, 29918, 3126, 29898, 1311, 3032, 999, 29918, 11030, 29892, 4733, 29897, 13, 4706, 1683, 29901, 13, 9651, 736, 6571, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 6314, 29918, 5317, 29918, 12650, 29898, 25932, 29892, 334, 2080, 29918, 711, 1315, 1125, 13, 4706, 9995, 20504, 403, 975, 4954, 2080, 29918, 711, 1315, 16159, 322, 17086, 1549, 1009, 3829, 13, 4706, 6314, 292, 599, 9322, 4954, 20867, 12724, 16159, 373, 278, 748, 29889, 450, 9819, 1051, 13, 4706, 338, 7929, 29899, 9021, 2729, 373, 3618, 29915, 2893, 14903, 29889, 13, 4706, 9995, 13, 4706, 18999, 353, 731, 4197, 2314, 13, 4706, 704, 1315, 353, 5159, 13, 13, 4706, 822, 17086, 29918, 11030, 29898, 5415, 1125, 13, 9651, 363, 12421, 297, 5446, 29889, 11330, 29918, 2541, 29918, 24539, 7295, 13, 18884, 17086, 29898, 657, 5552, 29898, 5415, 29892, 12421, 876, 13, 13, 4706, 822, 17086, 29898, 5415, 1125, 13, 9651, 565, 338, 8758, 29898, 5415, 29892, 18399, 2061, 1125, 13, 18884, 565, 5446, 3032, 333, 451, 297, 18999, 29901, 13, 462, 1678, 18999, 29889, 1202, 29898, 5415, 3032, 333, 29897, 13, 462, 1678, 17086, 29918, 11030, 29898, 5415, 29897, 13, 462, 1678, 704, 1315, 29889, 4397, 29898, 5415, 29897, 13, 9651, 25342, 338, 8758, 29898, 5415, 29892, 11699, 20457, 1125, 13, 18884, 17086, 29918, 11030, 29898, 5415, 29897, 13, 9651, 25342, 338, 8758, 29898, 5415, 29892, 313, 1761, 29892, 18761, 22164, 13, 18884, 363, 2944, 297, 5446, 29901, 13, 462, 1678, 17086, 29898, 667, 29897, 13, 9651, 25342, 338, 8758, 29898, 5415, 29892, 9657, 1125, 13, 18884, 363, 1820, 29892, 995, 297, 4256, 7076, 29898, 5415, 1125, 13, 462, 1678, 17086, 29898, 1989, 416, 17086, 29898, 1767, 29897, 13, 13, 4706, 17086, 29898, 2080, 29918, 711, 1315, 29897, 13, 4706, 736, 704, 1315, 13, 13, 1678, 822, 9282, 29898, 1311, 1125, 13, 4706, 9995, 11609, 29879, 599, 4954, 20867, 12724, 16159, 393, 445, 1203, 756, 9282, 304, 29889, 9995, 13, 4706, 736, 731, 29898, 1311, 29889, 15914, 29918, 5317, 29918, 12650, 29898, 1311, 876, 13, 13, 1678, 396, 2683, 2683, 2683, 2683, 23648, 13, 1678, 396, 4533, 8125, 3957, 3519, 13, 1678, 396, 13, 1678, 396, 6804, 294, 263, 8261, 3132, 15061, 6890, 508, 7344, 1776, 2106, 13, 1678, 396, 19963, 1904, 2106, 29892, 591, 817, 385, 6261, 3638, 29914, 13556, 573, 9608, 363, 13, 1678, 396, 7212, 1218, 411, 263, 731, 310, 1776, 4733, 393, 620, 680, 373, 278, 4565, 1095, 29889, 13, 1678, 396, 9267, 310, 278, 5717, 697, 723, 2149, 297, 263, 8261, 3132, 2910, 2012, 304, 13, 1678, 396, 9853, 287, 11217, 373, 278, 341, 29899, 9219, 29899, 29963, 2948, 29889, 13, 1678, 396, 2683, 2683, 2683, 2683, 23648, 13, 1678, 822, 22419, 29918, 11030, 29898, 1311, 1125, 13, 4706, 9995, 16969, 278, 4533, 3195, 29899, 12817, 4426, 310, 445, 1203, 29889, 9995, 13, 4706, 17761, 353, 1583, 29889, 15033, 29918, 11330, 29918, 2541, 29918, 5975, 580, 13, 4706, 17761, 29889, 7323, 703, 7924, 613, 6213, 29897, 13, 4706, 736, 17761, 13, 13, 1678, 822, 22419, 29918, 643, 6646, 29898, 1311, 1125, 13, 4706, 9995, 16969, 263, 8600, 310, 278, 8393, 310, 445, 1203, 29892, 297, 13, 4706, 263, 5912, 6590, 304, 825, 1952, 446, 29882, 8700, 23347, 472, 443, 3034, 845, 27855, 931, 29889, 13, 4706, 9995, 13, 4706, 12421, 29879, 353, 1583, 29889, 6925, 29918, 11030, 580, 13, 4706, 12421, 29879, 1839, 333, 2033, 353, 1583, 3032, 333, 13, 4706, 736, 12421, 29879, 13, 13, 1678, 822, 16766, 29898, 1311, 29892, 1574, 333, 29922, 8516, 1125, 13, 4706, 9995, 13441, 599, 9282, 304, 4390, 13, 4706, 9995, 13, 4706, 4733, 353, 1583, 29889, 276, 10662, 580, 13, 4706, 736, 16766, 29898, 9794, 29892, 1574, 333, 29922, 1514, 333, 29897, 13, 13, 1678, 822, 2767, 29898, 1311, 29892, 3579, 19290, 1125, 13, 4706, 363, 413, 29892, 29894, 297, 9049, 5085, 29889, 7076, 7295, 13, 9651, 731, 5552, 29898, 1311, 29892, 413, 29892, 325, 29897, 13, 13, 1678, 822, 4770, 710, 12035, 1311, 1125, 13, 4706, 736, 11860, 29879, 29892, 4533, 3195, 16664, 29879, 29892, 2143, 903, 333, 29901, 1273, 29879, 29908, 1273, 313, 1311, 17255, 1990, 1649, 17255, 978, 1649, 29892, 13, 18884, 1583, 17255, 1493, 29918, 4299, 1649, 29892, 679, 5552, 29898, 1311, 29892, 11119, 333, 613, 6213, 876, 13, 13, 1678, 822, 373, 29918, 3167, 29898, 1311, 29892, 12421, 978, 29892, 5446, 29892, 6939, 978, 29922, 8516, 1125, 13, 4706, 9995, 8256, 12421, 978, 310, 1583, 3620, 29892, 1246, 6939, 978, 13, 4706, 373, 5446, 13, 4706, 9995, 13, 4706, 6939, 29879, 353, 1583, 3032, 14035, 29879, 29889, 842, 4381, 29898, 5552, 978, 29892, 518, 2314, 13, 4706, 6939, 353, 9657, 29898, 5415, 29922, 5415, 29892, 6939, 978, 29922, 14035, 978, 29897, 13, 4706, 565, 6939, 451, 297, 6939, 29879, 29901, 13, 9651, 6939, 29879, 29889, 4397, 29898, 14035, 29897, 13, 4706, 1583, 3032, 14035, 29879, 29918, 3972, 1017, 353, 5852, 13, 13, 1678, 822, 903, 21001, 29898, 1311, 29892, 12421, 978, 29892, 2030, 29892, 716, 1125, 13, 4706, 9995, 5552, 978, 310, 1583, 3939, 29889, 29871, 1105, 1246, 599, 6939, 29879, 13, 4706, 9995, 13, 4706, 6939, 29879, 353, 1583, 3032, 14035, 29879, 29889, 657, 29898, 5552, 978, 29897, 13, 4706, 565, 6939, 29879, 29901, 13, 9651, 363, 6939, 297, 6939, 29879, 29901, 13, 18884, 5446, 353, 6939, 29889, 657, 877, 5415, 1495, 13, 18884, 6939, 978, 353, 6939, 29889, 657, 877, 14035, 978, 1495, 13, 18884, 7876, 353, 5446, 565, 6939, 978, 338, 6213, 1683, 679, 5552, 29898, 5415, 29892, 6939, 978, 29897, 13, 18884, 7876, 29898, 1311, 29892, 12421, 978, 29892, 2030, 29892, 716, 29897, 13, 13, 13, 1678, 396, 14402, 29901, 16460, 362, 29383, 647, 1048, 6389, 1735, 313, 7959, 29918, 2084, 29897, 13, 1678, 822, 1653, 29918, 1420, 29918, 29879, 1240, 7988, 29898, 13, 9651, 1583, 29892, 1923, 29922, 8824, 29892, 8297, 29918, 3188, 29918, 2271, 543, 613, 8297, 29918, 7620, 29918, 2029, 543, 19602, 13, 9651, 2294, 29918, 2084, 543, 1124, 597, 7640, 29901, 29945, 29900, 29900, 29953, 29914, 833, 446, 29882, 1315, 29914, 7959, 29908, 1125, 13, 4706, 9995, 3258, 29918, 1420, 29918, 29879, 1240, 7988, 338, 1304, 304, 8297, 263, 6492, 297, 385, 3472, 1813, 29889, 13, 13, 4706, 1653, 29918, 1420, 29918, 29879, 1240, 7988, 3639, 278, 8297, 1347, 304, 367, 1925, 297, 3472, 29889, 13, 4706, 910, 674, 367, 263, 529, 2154, 29958, 4055, 29889, 13, 13, 4706, 1763, 8297, 263, 6492, 14278, 373, 278, 1952, 446, 29882, 18399, 5656, 29892, 731, 1923, 29922, 5574, 29892, 13, 4706, 6467, 263, 934, 411, 278, 848, 363, 278, 6492, 674, 367, 4240, 29889, 13, 13, 4706, 8297, 29918, 3188, 29918, 2271, 338, 1304, 363, 1661, 29899, 2974, 23655, 29889, 29871, 910, 338, 1304, 13, 4706, 408, 278, 3876, 310, 278, 3142, 988, 278, 8297, 29889, 1315, 934, 674, 367, 7160, 29889, 13, 13, 4706, 8297, 29918, 7620, 29918, 2029, 11761, 988, 278, 8297, 29889, 1315, 674, 367, 2869, 3971, 304, 29889, 13, 13, 4706, 2294, 29918, 2084, 11761, 988, 278, 8297, 11534, 3430, 304, 1284, 13, 4706, 1045, 446, 29882, 29889, 1315, 322, 278, 916, 7788, 372, 4225, 363, 1045, 446, 29882, 29889, 13, 4706, 9995, 13, 4706, 565, 1923, 29901, 13, 9651, 515, 869, 7924, 1053, 16441, 13, 9651, 565, 8297, 29918, 3188, 29918, 2271, 29901, 13, 18884, 4867, 353, 16441, 29898, 4632, 29918, 2271, 29922, 2974, 29918, 2271, 29897, 13, 9651, 1683, 29901, 13, 18884, 4867, 353, 16441, 580, 13, 9651, 736, 1120, 3543, 328, 29918, 2974, 29898, 1311, 29892, 4867, 29897, 13, 13, 4706, 515, 869, 20943, 1053, 26524, 29949, 29428, 29892, 26524, 29949, 29428, 29918, 17816, 2965, 13, 4706, 1053, 318, 5416, 13, 13, 4706, 6965, 29918, 9507, 353, 11860, 29879, 29889, 17987, 29889, 1315, 29908, 1273, 1583, 3032, 333, 13, 4706, 2471, 29918, 2084, 353, 8297, 29918, 3188, 29918, 2271, 718, 6965, 29918, 9507, 13, 13, 4706, 1543, 333, 353, 851, 29898, 25118, 29889, 25118, 29946, 3101, 13, 13, 4706, 6965, 353, 26524, 29949, 29428, 29889, 9482, 29898, 13, 9651, 599, 29918, 9794, 353, 28755, 29918, 3126, 29898, 1311, 29889, 15070, 25739, 13, 9651, 6965, 29918, 2271, 353, 2294, 29918, 2084, 718, 376, 1315, 29914, 833, 446, 29882, 29889, 1195, 29889, 1315, 613, 13, 9651, 5997, 29918, 5325, 353, 518, 7959, 29918, 2084, 718, 376, 4268, 29914, 833, 446, 29882, 29889, 1195, 29889, 4268, 12436, 13, 9651, 1543, 333, 353, 1543, 333, 29892, 13, 4706, 1723, 13, 13, 4706, 4055, 353, 26524, 29949, 29428, 29918, 17816, 2965, 29889, 9482, 29898, 13, 9651, 4765, 29918, 2084, 353, 2471, 29918, 2084, 29892, 13, 9651, 1543, 333, 353, 1543, 333, 29892, 13, 9651, 1904, 333, 353, 1583, 3032, 333, 29892, 13, 9651, 1904, 1853, 353, 1583, 17255, 1493, 29918, 4299, 1649, 29892, 13, 4706, 1723, 13, 13, 4706, 4078, 29918, 2084, 353, 2897, 29889, 2084, 29889, 7122, 29898, 17987, 29918, 7620, 29918, 2029, 29892, 6965, 29918, 9507, 29897, 13, 4706, 411, 1722, 29898, 7620, 29918, 2084, 1699, 29893, 1159, 408, 285, 29901, 13, 9651, 285, 29889, 3539, 29898, 1315, 29897, 13, 13, 4706, 736, 4055, 13, 13, 1678, 822, 11658, 29918, 29879, 1240, 7988, 29898, 13, 9651, 1583, 29892, 1923, 29922, 8824, 29892, 8297, 29918, 3188, 29918, 2271, 543, 613, 8297, 29918, 7620, 29918, 2029, 543, 19602, 13, 9651, 2294, 29918, 2084, 543, 1124, 597, 7640, 29901, 29945, 29900, 29900, 29953, 29914, 833, 446, 29882, 29914, 7959, 12975, 1125, 13, 4706, 18116, 29889, 25442, 703, 21920, 29918, 29879, 1240, 7988, 338, 18164, 29892, 3113, 671, 1653, 29918, 1420, 29918, 29879, 1240, 7988, 1159, 13, 4706, 736, 1583, 29889, 3258, 29918, 1420, 29918, 29879, 1240, 7988, 29898, 13, 9651, 1923, 29892, 8297, 29918, 3188, 29918, 2271, 29892, 8297, 29918, 7620, 29918, 2029, 29892, 2294, 29918, 2084, 29897, 13, 13, 1678, 822, 903, 4282, 29918, 2974, 29918, 29879, 1240, 7988, 29898, 1311, 29892, 2967, 29918, 2271, 29922, 8824, 1125, 13, 4706, 27937, 353, 1583, 3032, 7924, 13, 4706, 1904, 333, 353, 1583, 3032, 333, 13, 4706, 2393, 3871, 353, 1583, 17255, 1493, 29918, 4299, 1649, 13, 4706, 565, 451, 2967, 29918, 2271, 29901, 13, 9651, 2967, 29918, 2271, 353, 27937, 29889, 4632, 29918, 2271, 13, 4706, 6219, 353, 3142, 5451, 29898, 3188, 29918, 2271, 29897, 13, 4706, 565, 6219, 29889, 816, 2004, 1275, 525, 1124, 2396, 13, 9651, 16904, 29918, 13082, 29918, 1807, 353, 376, 5652, 597, 29995, 29879, 29914, 833, 446, 29882, 29914, 1491, 29908, 1273, 6219, 29889, 1212, 2029, 13, 4706, 1683, 29901, 13, 9651, 16904, 29918, 13082, 29918, 1807, 353, 376, 29893, 893, 597, 29995, 29879, 29914, 833, 446, 29882, 29914, 1491, 29908, 1273, 6219, 29889, 1212, 2029, 13, 13, 4706, 285, 29918, 8977, 353, 9657, 29898, 13, 9651, 1574, 333, 353, 27937, 29889, 1514, 333, 29892, 13, 9651, 16904, 29918, 13082, 29918, 1807, 353, 16904, 29918, 13082, 29918, 1807, 29892, 13, 9651, 1574, 2754, 1989, 353, 27937, 29889, 2754, 1989, 29892, 13, 9651, 3876, 29918, 2271, 353, 2967, 29918, 2271, 29892, 13, 9651, 1904, 333, 353, 1904, 333, 29892, 13, 9651, 1904, 1853, 353, 2393, 3871, 29892, 13, 9651, 2471, 29918, 2271, 353, 2967, 29918, 2271, 718, 376, 833, 446, 29882, 29914, 17987, 29889, 1315, 1159, 13, 4706, 321, 29918, 710, 353, 14550, 29966, 2154, 4765, 543, 29995, 29898, 2154, 29918, 2271, 29897, 29879, 29908, 1045, 446, 29882, 29918, 572, 1501, 668, 543, 2974, 13082, 29908, 13, 4706, 1045, 446, 29882, 29918, 1514, 333, 543, 29995, 29898, 1514, 333, 29897, 29879, 29908, 1045, 446, 29882, 29918, 5652, 29918, 13082, 29918, 1807, 543, 29995, 29898, 5652, 29918, 13082, 29918, 1807, 29897, 29879, 29908, 13, 4706, 1045, 446, 29882, 29918, 1514, 2754, 1989, 543, 29995, 29898, 1514, 2754, 1989, 29897, 29879, 29908, 1045, 446, 29882, 29918, 4632, 29918, 2271, 543, 29995, 29898, 4632, 29918, 2271, 29897, 29879, 29908, 13, 4706, 1045, 446, 29882, 29918, 4299, 333, 543, 29995, 29898, 4299, 333, 29897, 29879, 29908, 1045, 446, 29882, 29918, 4299, 1853, 543, 29995, 29898, 4299, 1853, 29897, 29879, 29908, 7465, 543, 3009, 5319, 2154, 29958, 13, 4706, 14550, 13, 4706, 736, 12633, 321, 29918, 710, 1273, 285, 29918, 8977, 13, 13, 1678, 822, 903, 4282, 29918, 7959, 29918, 17987, 29918, 29879, 1240, 7988, 29898, 1311, 29892, 2294, 29918, 2084, 29892, 8297, 29918, 3188, 29918, 2271, 1125, 13, 13, 13, 4706, 8297, 29918, 9507, 353, 11860, 29879, 29889, 17987, 29889, 1315, 29908, 1273, 1583, 3032, 333, 13, 4706, 2989, 29918, 17987, 29918, 2084, 353, 8297, 29918, 3188, 29918, 2271, 718, 8297, 29918, 9507, 13, 13, 4706, 6965, 29918, 710, 353, 1583, 3032, 7924, 29889, 17987, 29918, 1315, 29898, 1311, 3032, 333, 29892, 2294, 29918, 2084, 29897, 13, 13, 13, 4706, 27937, 353, 1583, 3032, 7924, 13, 4706, 1904, 333, 353, 1583, 3032, 333, 13, 4706, 2393, 3871, 353, 1583, 17255, 1493, 29918, 4299, 1649, 13, 4706, 8297, 29918, 9507, 353, 2989, 29918, 17987, 29918, 2084, 13, 4706, 285, 29918, 8977, 353, 9657, 29898, 4299, 333, 353, 1904, 333, 29892, 1904, 1853, 353, 2393, 3871, 29892, 13, 462, 418, 8297, 29918, 9507, 29922, 17987, 29918, 9507, 29897, 13, 4706, 321, 29918, 710, 353, 14550, 29966, 2154, 4765, 543, 29995, 29898, 17987, 29918, 9507, 29897, 29879, 29908, 1045, 446, 29882, 29918, 572, 1501, 668, 543, 17987, 1272, 29908, 13, 4706, 1045, 446, 29882, 29918, 4299, 333, 543, 29995, 29898, 4299, 333, 29897, 29879, 29908, 1045, 446, 29882, 29918, 4299, 1853, 543, 29995, 29898, 4299, 1853, 29897, 29879, 29908, 7465, 543, 3009, 5319, 2154, 29958, 13, 4706, 14550, 13, 4706, 736, 6965, 29918, 710, 29892, 321, 29918, 710, 1273, 285, 29918, 8977, 13, 2 ]
data_preprocess/drone_images/rgb_downsampling.py
Shanci-Li/TOPO-DataGen
5
175935
<reponame>Shanci-Li/TOPO-DataGen<gh_stars>1-10 import os import glob import numpy as np from skimage import io, transform import argparse import multiprocessing as mp def _func_downsampling(in_img, out_img, ttl_iter, mp_progress, mp_lock): img = io.imread(in_img) out = transform.resize(img, [480, 720], preserve_range=True, anti_aliasing=True) out = out.astype(np.uint8) io.imsave(out_img, out) # release memory img = None out = None with mp_lock: print("\rDownsampling {:s} ---> {:s}, progress: {:d}/{:d}".format(os.path.basename(in_img), os.path.basename(out_img), mp_progress.value, ttl_iter), end="", flush=True) mp_progress.value += 1 def main(): parser = argparse.ArgumentParser() parser.add_argument("path", nargs='+', type=str, help="Path of the dataset to correct images.") args = parser.parse_args() dataset_dir_ls = args.path save_dir_ls = [os.path.abspath(os.path.join(data_dir, '../downsampled')) for data_dir in dataset_dir_ls] for dataset_dir, save_dir in zip(dataset_dir_ls, save_dir_ls): dataset_dir = os.path.abspath(dataset_dir) save_dir = os.path.abspath(save_dir) os.makedirs(save_dir, exist_ok=True) files = list(filter(os.path.isfile, glob.glob(dataset_dir + "/*"))) files.sort(key=lambda x: os.path.getmtime(x)) # multiprocessing preparation mp_args_ls = [] mp_manager = mp.Manager() mp_lock = mp_manager.Lock() mp_progress = mp_manager.Value('i', 1) for idx, file in enumerate(files): old_name = os.path.abspath(file) new_name = os.path.join(save_dir, os.path.basename(old_name)) mp_args_ls.append((old_name, new_name, len(files), mp_progress, mp_lock)) # mp pools with mp.Pool(processes=os.cpu_count()) as p: p.starmap(_func_downsampling, mp_args_ls, chunksize=1) print("\nTask is finished! {:s} ---> {:s}".format(dataset_dir, save_dir)) if __name__ == '__main__': main()
[ 1, 529, 276, 1112, 420, 29958, 2713, 8463, 29899, 23410, 29914, 29911, 4590, 29949, 29899, 1469, 15462, 29966, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 5215, 2897, 13, 5215, 13149, 13, 5215, 12655, 408, 7442, 13, 3166, 2071, 3027, 1053, 12013, 29892, 4327, 13, 5215, 1852, 5510, 13, 5215, 6674, 307, 985, 292, 408, 22326, 13, 13, 13, 1753, 903, 9891, 29918, 3204, 13445, 10335, 29898, 262, 29918, 2492, 29892, 714, 29918, 2492, 29892, 260, 15206, 29918, 1524, 29892, 22326, 29918, 18035, 29892, 22326, 29918, 908, 1125, 13, 1678, 10153, 353, 12013, 29889, 326, 949, 29898, 262, 29918, 2492, 29897, 13, 1678, 714, 353, 4327, 29889, 21476, 29898, 2492, 29892, 518, 29946, 29947, 29900, 29892, 29871, 29955, 29906, 29900, 1402, 19905, 29918, 3881, 29922, 5574, 29892, 9418, 29918, 2606, 5832, 29922, 5574, 29897, 13, 1678, 714, 353, 714, 29889, 579, 668, 29898, 9302, 29889, 13470, 29947, 29897, 13, 1678, 12013, 29889, 326, 7620, 29898, 449, 29918, 2492, 29892, 714, 29897, 13, 1678, 396, 6507, 3370, 13, 1678, 10153, 353, 6213, 13, 1678, 714, 353, 6213, 13, 1678, 411, 22326, 29918, 908, 29901, 13, 4706, 1596, 14182, 29878, 6767, 13445, 10335, 12365, 29879, 29913, 11474, 29958, 12365, 29879, 1118, 6728, 29901, 12365, 29881, 6822, 25641, 29881, 29913, 1642, 4830, 29898, 359, 29889, 2084, 29889, 6500, 3871, 29898, 262, 29918, 2492, 511, 13, 462, 462, 462, 462, 3986, 2897, 29889, 2084, 29889, 6500, 3871, 29898, 449, 29918, 2492, 511, 13, 462, 462, 462, 462, 3986, 22326, 29918, 18035, 29889, 1767, 29892, 260, 15206, 29918, 1524, 511, 13, 795, 1095, 543, 613, 28371, 29922, 5574, 29897, 13, 4706, 22326, 29918, 18035, 29889, 1767, 4619, 29871, 29896, 13, 13, 13, 1753, 1667, 7295, 13, 1678, 13812, 353, 1852, 5510, 29889, 15730, 11726, 580, 13, 1678, 13812, 29889, 1202, 29918, 23516, 703, 2084, 613, 302, 5085, 2433, 29974, 742, 1134, 29922, 710, 29892, 1371, 543, 2605, 310, 278, 8783, 304, 1959, 4558, 23157, 13, 1678, 6389, 353, 13812, 29889, 5510, 29918, 5085, 580, 13, 13, 1678, 8783, 29918, 3972, 29918, 3137, 353, 6389, 29889, 2084, 13, 1678, 4078, 29918, 3972, 29918, 3137, 353, 518, 359, 29889, 2084, 29889, 370, 1028, 493, 29898, 359, 29889, 2084, 29889, 7122, 29898, 1272, 29918, 3972, 29892, 525, 6995, 3204, 11249, 29881, 8785, 363, 848, 29918, 3972, 297, 8783, 29918, 3972, 29918, 3137, 29962, 13, 13, 1678, 363, 8783, 29918, 3972, 29892, 4078, 29918, 3972, 297, 14319, 29898, 24713, 29918, 3972, 29918, 3137, 29892, 4078, 29918, 3972, 29918, 3137, 1125, 13, 4706, 8783, 29918, 3972, 353, 2897, 29889, 2084, 29889, 370, 1028, 493, 29898, 24713, 29918, 3972, 29897, 13, 4706, 4078, 29918, 3972, 353, 2897, 29889, 2084, 29889, 370, 1028, 493, 29898, 7620, 29918, 3972, 29897, 13, 4706, 2897, 29889, 29885, 12535, 12935, 29898, 7620, 29918, 3972, 29892, 1863, 29918, 554, 29922, 5574, 29897, 13, 13, 4706, 2066, 353, 1051, 29898, 4572, 29898, 359, 29889, 2084, 29889, 275, 1445, 29892, 13149, 29889, 23705, 29898, 24713, 29918, 3972, 718, 376, 5515, 29908, 4961, 13, 4706, 2066, 29889, 6605, 29898, 1989, 29922, 2892, 921, 29901, 2897, 29889, 2084, 29889, 657, 29885, 2230, 29898, 29916, 876, 13, 13, 4706, 396, 6674, 307, 985, 292, 10223, 362, 13, 4706, 22326, 29918, 5085, 29918, 3137, 353, 5159, 13, 4706, 22326, 29918, 12847, 353, 22326, 29889, 3260, 580, 13, 4706, 22326, 29918, 908, 353, 22326, 29918, 12847, 29889, 16542, 580, 13, 4706, 22326, 29918, 18035, 353, 22326, 29918, 12847, 29889, 1917, 877, 29875, 742, 29871, 29896, 29897, 13, 4706, 363, 22645, 29892, 934, 297, 26985, 29898, 5325, 1125, 13, 9651, 2030, 29918, 978, 353, 2897, 29889, 2084, 29889, 370, 1028, 493, 29898, 1445, 29897, 13, 9651, 716, 29918, 978, 353, 2897, 29889, 2084, 29889, 7122, 29898, 7620, 29918, 3972, 29892, 2897, 29889, 2084, 29889, 6500, 3871, 29898, 1025, 29918, 978, 876, 13, 9651, 22326, 29918, 5085, 29918, 3137, 29889, 4397, 3552, 1025, 29918, 978, 29892, 716, 29918, 978, 29892, 7431, 29898, 5325, 511, 22326, 29918, 18035, 29892, 22326, 29918, 908, 876, 13, 13, 4706, 396, 22326, 772, 3775, 13, 4706, 411, 22326, 29889, 11426, 29898, 5014, 267, 29922, 359, 29889, 21970, 29918, 2798, 3101, 408, 282, 29901, 13, 9651, 282, 29889, 8508, 1958, 7373, 9891, 29918, 3204, 13445, 10335, 29892, 22326, 29918, 5085, 29918, 3137, 29892, 521, 18801, 675, 29922, 29896, 29897, 13, 13, 4706, 1596, 14182, 29876, 5398, 338, 7743, 29991, 12365, 29879, 29913, 11474, 29958, 12365, 29879, 29913, 1642, 4830, 29898, 24713, 29918, 3972, 29892, 4078, 29918, 3972, 876, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 1667, 580, 13, 2 ]
src/Honeybee_EnergyPlus NoMass Opaque Material.py
rdzeldenrust/Honeybee
1
1612284
<reponame>rdzeldenrust/Honeybee<filename>src/Honeybee_EnergyPlus NoMass Opaque Material.py # By <NAME> # <EMAIL> # Honeybee started by <NAME> is licensed # under a Creative Commons Attribution-ShareAlike 3.0 Unported License. """ Use this component to create a custom opaque material that has no mass, which can be plugged into the "Honeybee_EnergyPlus Construction" component. _ It is important to note that this component creates a material with no mass and, because of this, the accuracy of the component is not as great as a material that has mass. However, this component is very useful if you only have an R-value for a material (or a construction) and you know that the mass is relatively small. _ If you want to create a material that accounts for mass, you should use the "Honeybee_EnergyPlus Window Material" component. - Provided by Honeybee 0.0.55 Args: _name: A text name for your NoMass Opaque Material. _roughness_: A text value that indicated the roughness of your material. This can be either "VeryRough", "Rough", "MediumRough", "MediumSmooth", "Smooth", and "VerySmooth". The default is set to "Rough". _R-Value: A number representing the R-Value of the material in m2-K/W. _thermAbsp_: An number between 0 and 1 that represents the thermal abstorptance of the material. The default is set to 0.9, which is common for most non-metallic materials. _solAbsp_: An number between 0 and 1 that represents the abstorptance of solar radiation by the material. The default is set to 0.7, which is common for most non-metallic materials. _visAbsp_: An number between 0 and 1 that represents the abstorptance of visible light by the material. The default is set to 0.7, which is common for most non-metallic materials. Returns: EPMaterial: A no-mass opaque material that can be plugged into the "Honeybee_EnergyPlus Construction" component. """ ghenv.Component.Name = "Honeybee_EnergyPlus NoMass Opaque Material" ghenv.Component.NickName = 'EPNoMassMat' ghenv.Component.Message = 'VER 0.0.55\nOCT_24_2014' ghenv.Component.Category = "Honeybee" ghenv.Component.SubCategory = "06 | Energy | Material | Construction" #compatibleHBVersion = VER 0.0.55\nAUG_25_2014 #compatibleLBVersion = VER 0.0.58\nAUG_20_2014 try: ghenv.Component.AdditionalHelpFromDocStrings = "1" except: pass import Grasshopper.Kernel as gh w = gh.GH_RuntimeMessageLevel.Warning def checkInputs(): #Check to be sure that SHGC and VT are between 0 and 1. checkData = True def checkBtwZeroAndOne(variable, default, variableName): if variable == None: newVariable = default else: if variable <= 1 and variable >= 0: newVariable = variable else: newVariable = 0 checkData = False warning = variableName + " must be between 0 and 1." print warning ghenv.Component.AddRuntimeMessage(w, warning) return newVariable thermAbs = checkBtwZeroAndOne(_thermAbsp_, None, "_thermAbsp_") solAbsp = checkBtwZeroAndOne(_solAbsp_, None, "_solAbsp_") visAbsp = checkBtwZeroAndOne(_visAbsp_, None, "_visAbsp_") #Check the Roughness value. if _roughness_ != None: _roughness = _roughness_.upper() else: _roughness = None if _roughness == None or _roughness == "VERYROUGH" or _roughness == "ROUGH" or _roughness == "MEDIUMROUGH" or _roughness == "MEDIUMSMOOTH" or _roughness == "SMOOTH" or _roughness == "VERYSMOOTH": pass else: checkData = False warning = "_roughness_ is not valid." print warning ghenv.Component.AddRuntimeMessage(w, warning) return checkData def main(name, roughness, R_Value, thermAbsp, solAbsp, visAbsp): if roughness == None: roughness = "Rough" if thermAbsp == None: thermAbsp = 0.9 if solAbsp == None: solAbsp = 0.7 if visAbsp == None: visAbsp = 0.7 values = [name.upper(), roughness, R_Value, thermAbsp, solAbsp, visAbsp] comments = ["Name", "Roughness", "Thermal Resistance {m2-K/W}", "Thermal Absorptance", "Solar Absorptance", "Visible Absorptance"] materialStr = "Material:NoMass,\n" for count, (value, comment) in enumerate(zip(values, comments)): if count!= len(values) - 1: materialStr += str(value) + ", !" + str(comment) + "\n" else: materialStr += str(value) + "; !" + str(comment) return materialStr if _name and _R_Value: checkData = checkInputs() if checkData == True: EPMaterial = main(_name, _roughness_, _R_Value, _thermAbsp_, _solAbsp_, _visAbsp_)
[ 1, 529, 276, 1112, 420, 29958, 5499, 10533, 1145, 23575, 29914, 29950, 4992, 915, 29872, 29966, 9507, 29958, 4351, 29914, 29950, 4992, 915, 29872, 29918, 29923, 1089, 1927, 29575, 1939, 29924, 465, 438, 3274, 802, 17582, 29889, 2272, 13, 29937, 2648, 529, 5813, 29958, 13, 29937, 529, 26862, 6227, 29958, 13, 29937, 379, 4992, 915, 29872, 4687, 491, 529, 5813, 29958, 338, 7794, 21144, 13, 29937, 1090, 263, 26635, 3468, 6212, 3224, 29899, 2713, 598, 29909, 4561, 29871, 29941, 29889, 29900, 853, 637, 287, 19245, 29889, 13, 13, 15945, 29908, 13, 11403, 445, 4163, 304, 1653, 263, 2888, 1015, 19772, 5518, 393, 756, 694, 4158, 29892, 607, 508, 367, 18665, 3192, 964, 278, 376, 29950, 4992, 915, 29872, 29918, 29923, 1089, 1927, 29575, 5798, 4080, 29908, 4163, 29889, 13, 29918, 13, 3112, 338, 4100, 304, 4443, 393, 445, 4163, 10017, 263, 5518, 411, 694, 4158, 322, 29892, 1363, 310, 445, 29892, 278, 13600, 310, 278, 4163, 338, 451, 408, 2107, 408, 263, 5518, 393, 756, 4158, 29889, 29871, 2398, 29892, 445, 4163, 338, 1407, 5407, 565, 366, 871, 505, 385, 390, 29899, 1767, 363, 263, 5518, 313, 272, 263, 7632, 29897, 322, 366, 1073, 393, 278, 4158, 338, 13774, 2319, 29889, 13, 29918, 13, 3644, 366, 864, 304, 1653, 263, 5518, 393, 15303, 363, 4158, 29892, 366, 881, 671, 278, 376, 29950, 4992, 915, 29872, 29918, 29923, 1089, 1927, 29575, 18379, 17582, 29908, 4163, 29889, 13, 13, 29899, 13, 1184, 29894, 2618, 491, 379, 4992, 915, 29872, 29871, 29900, 29889, 29900, 29889, 29945, 29945, 13, 268, 13, 1678, 826, 3174, 29901, 13, 4706, 903, 978, 29901, 319, 1426, 1024, 363, 596, 1939, 29924, 465, 438, 3274, 802, 17582, 29889, 13, 4706, 903, 10573, 2264, 29918, 29901, 319, 1426, 995, 393, 18694, 278, 12164, 2264, 310, 596, 5518, 29889, 29871, 910, 508, 367, 2845, 376, 29963, 708, 29934, 820, 613, 376, 29934, 820, 613, 376, 19302, 1974, 29934, 820, 613, 376, 19302, 1974, 29903, 4346, 720, 613, 376, 29903, 4346, 720, 613, 322, 376, 29963, 708, 29903, 4346, 720, 1642, 29871, 450, 2322, 338, 731, 304, 376, 29934, 820, 1642, 13, 4706, 903, 29934, 29899, 1917, 29901, 319, 1353, 15783, 278, 390, 29899, 1917, 310, 278, 5518, 297, 286, 29906, 29899, 29968, 29914, 29956, 29889, 13, 4706, 903, 721, 29885, 4920, 1028, 29918, 29901, 530, 1353, 1546, 29871, 29900, 322, 29871, 29896, 393, 11524, 278, 26963, 633, 28957, 415, 749, 310, 278, 5518, 29889, 29871, 450, 2322, 338, 731, 304, 29871, 29900, 29889, 29929, 29892, 607, 338, 3619, 363, 1556, 1661, 29899, 2527, 497, 293, 17279, 29889, 13, 4706, 903, 2929, 4920, 1028, 29918, 29901, 530, 1353, 1546, 29871, 29900, 322, 29871, 29896, 393, 11524, 278, 633, 28957, 415, 749, 310, 21635, 27310, 491, 278, 5518, 29889, 29871, 450, 2322, 338, 731, 304, 29871, 29900, 29889, 29955, 29892, 607, 338, 3619, 363, 1556, 1661, 29899, 2527, 497, 293, 17279, 29889, 13, 4706, 903, 1730, 4920, 1028, 29918, 29901, 530, 1353, 1546, 29871, 29900, 322, 29871, 29896, 393, 11524, 278, 633, 28957, 415, 749, 310, 7962, 3578, 491, 278, 5518, 29889, 29871, 450, 2322, 338, 731, 304, 29871, 29900, 29889, 29955, 29892, 607, 338, 3619, 363, 1556, 1661, 29899, 2527, 497, 293, 17279, 29889, 13, 1678, 16969, 29901, 13, 4706, 382, 13427, 3795, 29901, 319, 694, 29899, 25379, 1015, 19772, 5518, 393, 508, 367, 18665, 3192, 964, 278, 376, 29950, 4992, 915, 29872, 29918, 29923, 1089, 1927, 29575, 5798, 4080, 29908, 4163, 29889, 13, 13, 15945, 29908, 13, 13, 29887, 3169, 29894, 29889, 5308, 29889, 1170, 353, 376, 29950, 4992, 915, 29872, 29918, 29923, 1089, 1927, 29575, 1939, 29924, 465, 438, 3274, 802, 17582, 29908, 13, 29887, 3169, 29894, 29889, 5308, 29889, 29940, 860, 1170, 353, 525, 15488, 3782, 29924, 465, 9782, 29915, 13, 29887, 3169, 29894, 29889, 5308, 29889, 3728, 353, 525, 5348, 29871, 29900, 29889, 29900, 29889, 29945, 29945, 29905, 29876, 29949, 1783, 29918, 29906, 29946, 29918, 29906, 29900, 29896, 29946, 29915, 13, 29887, 3169, 29894, 29889, 5308, 29889, 10900, 353, 376, 29950, 4992, 915, 29872, 29908, 13, 29887, 3169, 29894, 29889, 5308, 29889, 4035, 10900, 353, 376, 29900, 29953, 891, 24836, 891, 17582, 891, 5798, 4080, 29908, 13, 29937, 23712, 29950, 29933, 6594, 353, 478, 1001, 29871, 29900, 29889, 29900, 29889, 29945, 29945, 29905, 29876, 29909, 23338, 29918, 29906, 29945, 29918, 29906, 29900, 29896, 29946, 13, 29937, 23712, 29931, 29933, 6594, 353, 478, 1001, 29871, 29900, 29889, 29900, 29889, 29945, 29947, 29905, 29876, 29909, 23338, 29918, 29906, 29900, 29918, 29906, 29900, 29896, 29946, 13, 2202, 29901, 330, 3169, 29894, 29889, 5308, 29889, 2528, 3245, 29648, 4591, 14526, 26545, 353, 376, 29896, 29908, 13, 19499, 29901, 1209, 13, 13, 13, 5215, 1632, 465, 1251, 2496, 29889, 29968, 5851, 408, 24170, 13, 29893, 353, 24170, 29889, 29954, 29950, 29918, 7944, 3728, 10108, 29889, 22709, 13, 13, 13, 1753, 1423, 4290, 29879, 7295, 13, 1678, 396, 5596, 304, 367, 1854, 393, 24972, 8766, 322, 478, 29911, 526, 1546, 29871, 29900, 322, 29871, 29896, 29889, 13, 1678, 1423, 1469, 353, 5852, 13, 268, 13, 1678, 822, 1423, 29933, 7516, 24214, 2855, 6716, 29898, 11918, 29892, 2322, 29892, 2286, 1170, 1125, 13, 4706, 565, 2286, 1275, 6213, 29901, 716, 16174, 353, 2322, 13, 4706, 1683, 29901, 13, 9651, 565, 2286, 5277, 29871, 29896, 322, 2286, 6736, 29871, 29900, 29901, 716, 16174, 353, 2286, 13, 9651, 1683, 29901, 13, 18884, 716, 16174, 353, 29871, 29900, 13, 18884, 1423, 1469, 353, 7700, 13, 18884, 9177, 353, 2286, 1170, 718, 376, 1818, 367, 1546, 29871, 29900, 322, 29871, 29896, 1213, 13, 18884, 1596, 9177, 13, 18884, 330, 3169, 29894, 29889, 5308, 29889, 2528, 7944, 3728, 29898, 29893, 29892, 9177, 29897, 13, 308, 13, 4706, 736, 716, 16174, 13, 268, 13, 1678, 14563, 4920, 29879, 353, 1423, 29933, 7516, 24214, 2855, 6716, 7373, 721, 29885, 4920, 1028, 3383, 6213, 29892, 11119, 721, 29885, 4920, 1028, 29918, 1159, 13, 1678, 899, 4920, 1028, 353, 1423, 29933, 7516, 24214, 2855, 6716, 7373, 2929, 4920, 1028, 3383, 6213, 29892, 11119, 2929, 4920, 1028, 29918, 1159, 13, 1678, 1998, 4920, 1028, 353, 1423, 29933, 7516, 24214, 2855, 6716, 7373, 1730, 4920, 1028, 3383, 6213, 29892, 11119, 1730, 4920, 1028, 29918, 1159, 13, 268, 13, 1678, 396, 5596, 278, 390, 820, 2264, 995, 29889, 13, 1678, 565, 903, 10573, 2264, 29918, 2804, 6213, 29901, 903, 10573, 2264, 353, 903, 10573, 2264, 5396, 21064, 580, 13, 1678, 1683, 29901, 903, 10573, 2264, 353, 6213, 13, 1678, 565, 903, 10573, 2264, 1275, 6213, 470, 903, 10573, 2264, 1275, 376, 5348, 29979, 1672, 23338, 29950, 29908, 470, 903, 10573, 2264, 1275, 376, 1672, 23338, 29950, 29908, 470, 903, 10573, 2264, 1275, 376, 2303, 4571, 5005, 1672, 23338, 29950, 29908, 470, 903, 10573, 2264, 1275, 376, 2303, 4571, 29965, 4345, 6720, 2891, 29950, 29908, 470, 903, 10573, 2264, 1275, 376, 29903, 6720, 2891, 29950, 29908, 470, 903, 10573, 2264, 1275, 376, 5348, 21554, 6720, 2891, 29950, 1115, 1209, 13, 1678, 1683, 29901, 13, 4706, 1423, 1469, 353, 7700, 13, 4706, 9177, 353, 11119, 10573, 2264, 29918, 338, 451, 2854, 1213, 13, 4706, 1596, 9177, 13, 4706, 330, 3169, 29894, 29889, 5308, 29889, 2528, 7944, 3728, 29898, 29893, 29892, 9177, 29897, 13, 268, 13, 1678, 736, 1423, 1469, 13, 13, 13, 1753, 1667, 29898, 978, 29892, 12164, 2264, 29892, 390, 29918, 1917, 29892, 14563, 4920, 1028, 29892, 899, 4920, 1028, 29892, 1998, 4920, 1028, 1125, 13, 268, 13, 1678, 565, 12164, 2264, 1275, 6213, 29901, 12164, 2264, 353, 376, 29934, 820, 29908, 13, 1678, 565, 14563, 4920, 1028, 1275, 6213, 29901, 14563, 4920, 1028, 353, 29871, 29900, 29889, 29929, 13, 1678, 565, 899, 4920, 1028, 1275, 6213, 29901, 899, 4920, 1028, 353, 29871, 29900, 29889, 29955, 13, 1678, 565, 1998, 4920, 1028, 1275, 6213, 29901, 1998, 4920, 1028, 353, 29871, 29900, 29889, 29955, 13, 268, 13, 1678, 1819, 353, 518, 978, 29889, 21064, 3285, 12164, 2264, 29892, 390, 29918, 1917, 29892, 14563, 4920, 1028, 29892, 899, 4920, 1028, 29892, 1998, 4920, 1028, 29962, 13, 1678, 6589, 353, 6796, 1170, 613, 376, 29934, 820, 2264, 613, 376, 1349, 837, 284, 2538, 21558, 426, 29885, 29906, 29899, 29968, 29914, 29956, 17671, 376, 1349, 837, 284, 24650, 272, 415, 749, 613, 376, 29903, 10170, 24650, 272, 415, 749, 613, 376, 12911, 24650, 272, 415, 749, 3108, 13, 268, 13, 1678, 5518, 5015, 353, 376, 24095, 29901, 3782, 29924, 465, 2053, 29876, 29908, 13, 268, 13, 1678, 363, 2302, 29892, 313, 1767, 29892, 3440, 29897, 297, 26985, 29898, 7554, 29898, 5975, 29892, 6589, 22164, 13, 4706, 565, 2302, 19216, 7431, 29898, 5975, 29897, 448, 29871, 29896, 29901, 13, 9651, 5518, 5015, 4619, 851, 29898, 1767, 29897, 718, 9162, 1678, 1738, 29908, 718, 851, 29898, 9342, 29897, 718, 6634, 29876, 29908, 13, 4706, 1683, 29901, 13, 9651, 5518, 5015, 4619, 851, 29898, 1767, 29897, 718, 12159, 1678, 1738, 29908, 718, 851, 29898, 9342, 29897, 13, 632, 13, 1678, 736, 5518, 5015, 13, 268, 13, 13, 361, 903, 978, 322, 903, 29934, 29918, 1917, 29901, 13, 1678, 1423, 1469, 353, 1423, 4290, 29879, 580, 13, 1678, 565, 1423, 1469, 1275, 5852, 29901, 13, 4706, 382, 13427, 3795, 353, 1667, 7373, 978, 29892, 903, 10573, 2264, 3383, 903, 29934, 29918, 1917, 29892, 903, 721, 29885, 4920, 1028, 3383, 903, 2929, 4920, 1028, 3383, 903, 1730, 4920, 1028, 19925, 2 ]
igraph-test/local_graph.py
firetto/JanusGraphTest
0
180205
<gh_stars>0 """ local_graph.py Contains the LocalGraph class, which contains an igraph.Graph instance and some methods to access and modify it. Used for subgraphs in a GraphInterface. <NAME>, 2021 """ from log_to_file import log_to_file from datetime import datetime import igraph class LocalGraph(): """ A wrapper class for an igraph.Graph instance. :ivar graph: Contains the igraph Graph. """ graph: igraph.Graph def __init__(self) -> None: """ Instantiate an empty igraph.Graph instance. """ self.graph = igraph.Graph() def create_from_connections_undirected(self, vertex_connections: list) -> None: """ Instantiate a simple undirected igraph.Graph given pairs of vertices to connect. :param vertex_connections: A list of the format [(name1, name2), (name3, name4), ...] where name# represents the names of the vertices. :type vertex_connections: list[tuple[str, str]] """ # See https://igraph.org/python/doc/tutorial/tutorial.html#setting-and-retrieving-attributes for help regarding igraph vertex/edge attributes. now = datetime.now() # vertex_names[i] denotes the name of the i'th vertex in the local graph. vertex_name_arr = [] # Dictionary of style {..., vertex_names[i]: i, ...}. vertex_name_to_ind = {} # List of 2-tuples containing the indices of the pairs of vertices to be added (instead of the names). vertex_index_connections = [] for pair in vertex_connections: indices = [] for i in range(len(pair)): if pair[i] not in vertex_name_to_ind: vertex_name_to_ind[pair[i]] = len(vertex_name_arr) vertex_name_arr.append(pair[i]) indices.append(vertex_name_to_ind[pair[i]]) vertex_index_connections.append(tuple(indices)) log_to_file(message="Making local graph.") self.graph = igraph.Graph(vertex_index_connections) self.graph.vs['name'] = vertex_name_arr self.graph.vs['label'] = self.graph.vs['name'] log_to_file(message=f"Done making local graph, that took {(datetime.now() - now).total_seconds()} seconds.") def find_shortest_paths(self, name1: str, name2: str): """ Given two vertices labelled with <name1> and <name2>, return the SHORTEST paths between the vertices. See https://igraph.org/python/doc/api/igraph._igraph.GraphBase.html#get_all_shortest_paths for documentation. :param name1: name property of the vertex to start the traversal at :type name1: str :param name2: name property of the vertex to end the traversal at :type name2: str """ # TODO: maybe perform a check to see if the vertices exist? return self.graph.get_all_shortest_paths(name1, to=name2, weights=None, mode='all') def visualize_graph(self, target: str) -> None: """ Export the graph as an image to :param target:. :param target: File location to export the file to. Should be in PNG, PDF, SVG or PostScript format. :type target: str """ igraph.plot(self.graph, target=target)
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 15945, 29908, 13, 2997, 29918, 4262, 29889, 2272, 13, 13, 21409, 278, 9959, 9527, 770, 29892, 607, 3743, 385, 8919, 1140, 29889, 9527, 2777, 322, 777, 3519, 304, 2130, 322, 6623, 372, 29889, 13, 29965, 8485, 363, 1014, 4262, 29879, 297, 263, 12367, 10448, 29889, 13, 13, 29966, 5813, 10202, 29871, 29906, 29900, 29906, 29896, 13, 15945, 29908, 13, 13, 3166, 1480, 29918, 517, 29918, 1445, 1053, 1480, 29918, 517, 29918, 1445, 13, 3166, 12865, 1053, 12865, 13, 13, 5215, 8919, 1140, 13, 13, 1990, 9959, 9527, 7295, 13, 1678, 9995, 13, 13, 1678, 319, 14476, 770, 363, 385, 8919, 1140, 29889, 9527, 2777, 29889, 13, 13, 1678, 584, 440, 279, 3983, 29901, 2866, 2708, 278, 8919, 1140, 12367, 29889, 13, 1678, 9995, 13, 13, 1678, 3983, 29901, 8919, 1140, 29889, 9527, 13, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29897, 1599, 6213, 29901, 13, 4706, 9995, 13, 4706, 2799, 3656, 403, 385, 4069, 8919, 1140, 29889, 9527, 2777, 29889, 308, 13, 4706, 9995, 13, 13, 4706, 1583, 29889, 4262, 353, 8919, 1140, 29889, 9527, 580, 13, 13, 13, 1678, 822, 1653, 29918, 3166, 29918, 11958, 1953, 29918, 870, 1088, 287, 29898, 1311, 29892, 12688, 29918, 11958, 1953, 29901, 1051, 29897, 1599, 6213, 29901, 13, 4706, 9995, 13, 4706, 2799, 3656, 403, 263, 2560, 563, 1088, 287, 8919, 1140, 29889, 9527, 2183, 11000, 310, 13791, 304, 4511, 29889, 13, 13, 4706, 584, 3207, 12688, 29918, 11958, 1953, 29901, 319, 1051, 310, 278, 3402, 17288, 978, 29896, 29892, 1024, 29906, 511, 313, 978, 29941, 29892, 1024, 29946, 511, 2023, 29962, 988, 1024, 29937, 11524, 278, 2983, 310, 278, 13791, 29889, 13, 4706, 584, 1853, 12688, 29918, 11958, 1953, 29901, 1051, 29961, 23583, 29961, 710, 29892, 851, 5262, 13, 4706, 9995, 13, 13, 4706, 396, 2823, 2045, 597, 335, 1140, 29889, 990, 29914, 4691, 29914, 1514, 29914, 12631, 29914, 12631, 29889, 1420, 29937, 26740, 29899, 392, 29899, 276, 509, 15387, 29899, 15697, 363, 1371, 11211, 8919, 1140, 12688, 29914, 12864, 8393, 29889, 13, 13, 4706, 1286, 353, 12865, 29889, 3707, 580, 13, 13, 13, 4706, 396, 12688, 29918, 7039, 29961, 29875, 29962, 20169, 278, 1024, 310, 278, 474, 29915, 386, 12688, 297, 278, 1887, 3983, 29889, 13, 4706, 12688, 29918, 978, 29918, 2749, 353, 5159, 13, 13, 4706, 396, 13343, 310, 3114, 426, 16361, 12688, 29918, 7039, 29961, 29875, 5387, 474, 29892, 2023, 1836, 1678, 13, 4706, 12688, 29918, 978, 29918, 517, 29918, 513, 353, 6571, 13, 13, 4706, 396, 2391, 310, 29871, 29906, 29899, 9161, 2701, 6943, 278, 16285, 310, 278, 11000, 310, 13791, 304, 367, 2715, 313, 2611, 1479, 310, 278, 2983, 467, 13, 4706, 12688, 29918, 2248, 29918, 11958, 1953, 353, 5159, 13, 13, 4706, 363, 5101, 297, 12688, 29918, 11958, 1953, 29901, 13, 13, 9651, 16285, 353, 5159, 13, 13, 9651, 363, 474, 297, 3464, 29898, 2435, 29898, 18784, 22164, 13, 13, 18884, 565, 5101, 29961, 29875, 29962, 451, 297, 12688, 29918, 978, 29918, 517, 29918, 513, 29901, 13, 462, 1678, 12688, 29918, 978, 29918, 517, 29918, 513, 29961, 18784, 29961, 29875, 5262, 353, 7431, 29898, 369, 4776, 29918, 978, 29918, 2749, 29897, 13, 462, 1678, 12688, 29918, 978, 29918, 2749, 29889, 4397, 29898, 18784, 29961, 29875, 2314, 13, 13, 18884, 16285, 29889, 4397, 29898, 369, 4776, 29918, 978, 29918, 517, 29918, 513, 29961, 18784, 29961, 29875, 24960, 13, 13, 9651, 12688, 29918, 2248, 29918, 11958, 1953, 29889, 4397, 29898, 23583, 29898, 513, 1575, 876, 13, 13, 4706, 1480, 29918, 517, 29918, 1445, 29898, 4906, 543, 29924, 5086, 1887, 3983, 23157, 13, 13, 4706, 1583, 29889, 4262, 353, 8919, 1140, 29889, 9527, 29898, 369, 4776, 29918, 2248, 29918, 11958, 1953, 29897, 13, 13, 4706, 1583, 29889, 4262, 29889, 4270, 1839, 978, 2033, 353, 12688, 29918, 978, 29918, 2749, 13, 13, 4706, 1583, 29889, 4262, 29889, 4270, 1839, 1643, 2033, 353, 1583, 29889, 4262, 29889, 4270, 1839, 978, 2033, 13, 13, 4706, 1480, 29918, 517, 29918, 1445, 29898, 4906, 29922, 29888, 29908, 25632, 3907, 1887, 3983, 29892, 393, 3614, 426, 29898, 12673, 29889, 3707, 580, 448, 1286, 467, 7827, 29918, 23128, 28296, 6923, 23157, 13, 308, 13, 13, 1678, 822, 1284, 29918, 12759, 342, 29918, 24772, 29898, 1311, 29892, 1024, 29896, 29901, 851, 29892, 1024, 29906, 29901, 851, 1125, 13, 4706, 9995, 13, 4706, 11221, 1023, 13791, 3858, 839, 411, 529, 978, 29896, 29958, 322, 529, 978, 29906, 10202, 736, 278, 24972, 1955, 18267, 10898, 1546, 278, 13791, 29889, 13, 13, 4706, 2823, 2045, 597, 335, 1140, 29889, 990, 29914, 4691, 29914, 1514, 29914, 2754, 29914, 335, 1140, 3032, 335, 1140, 29889, 9527, 5160, 29889, 1420, 29937, 657, 29918, 497, 29918, 12759, 342, 29918, 24772, 363, 5106, 29889, 13, 13, 4706, 584, 3207, 1024, 29896, 29901, 1024, 2875, 310, 278, 12688, 304, 1369, 278, 13310, 284, 472, 13, 4706, 584, 1853, 1024, 29896, 29901, 851, 13, 4706, 584, 3207, 1024, 29906, 29901, 1024, 2875, 310, 278, 12688, 304, 1095, 278, 13310, 284, 472, 13, 4706, 584, 1853, 1024, 29906, 29901, 851, 13, 4706, 9995, 13, 13, 4706, 396, 14402, 29901, 5505, 2189, 263, 1423, 304, 1074, 565, 278, 13791, 1863, 29973, 13, 13, 4706, 736, 1583, 29889, 4262, 29889, 657, 29918, 497, 29918, 12759, 342, 29918, 24772, 29898, 978, 29896, 29892, 304, 29922, 978, 29906, 29892, 18177, 29922, 8516, 29892, 4464, 2433, 497, 1495, 13, 308, 13, 13, 1678, 822, 7604, 675, 29918, 4262, 29898, 1311, 29892, 3646, 29901, 851, 29897, 1599, 6213, 29901, 13, 4706, 9995, 13, 4706, 1222, 637, 278, 3983, 408, 385, 1967, 304, 584, 3207, 3646, 29901, 29889, 13, 13, 4706, 584, 3207, 3646, 29901, 3497, 4423, 304, 5609, 278, 934, 304, 29889, 10575, 367, 297, 349, 9312, 29892, 11328, 29892, 13955, 29954, 470, 4918, 4081, 3402, 29889, 13, 4706, 584, 1853, 3646, 29901, 851, 13, 4706, 9995, 13, 13, 4706, 8919, 1140, 29889, 5317, 29898, 1311, 29889, 4262, 29892, 3646, 29922, 5182, 29897, 13, 268, 2 ]
AtCoder/ABC/000-159/ABC147_D.py
sireline/PyCode
0
101577
<reponame>sireline/PyCode N = int(input()) A = [int(n) for n in input().split()] Aset = set(A) m = (10**9+7) o = {} ans = [] for a in A: o.setdefault(a, 0) o[a] += 1 for i in range(len(Aset)-1): for j in range(i+1, len(Aset)): ans.append((A[i]^A[j])*o[A[i]]*o[A[j]]) print(sum(ans)/m)
[ 1, 529, 276, 1112, 420, 29958, 29879, 533, 1220, 29914, 19737, 3399, 13, 29940, 353, 938, 29898, 2080, 3101, 13, 29909, 353, 518, 524, 29898, 29876, 29897, 363, 302, 297, 1881, 2141, 5451, 580, 29962, 13, 29909, 842, 353, 731, 29898, 29909, 29897, 13, 29885, 353, 313, 29896, 29900, 1068, 29929, 29974, 29955, 29897, 13, 29877, 353, 6571, 13, 550, 353, 5159, 13, 1454, 263, 297, 319, 29901, 13, 1678, 288, 29889, 842, 4381, 29898, 29874, 29892, 29871, 29900, 29897, 13, 1678, 288, 29961, 29874, 29962, 4619, 29871, 29896, 13, 1454, 474, 297, 3464, 29898, 2435, 29898, 29909, 842, 6817, 29896, 1125, 13, 1678, 363, 432, 297, 3464, 29898, 29875, 29974, 29896, 29892, 7431, 29898, 29909, 842, 22164, 13, 4706, 6063, 29889, 4397, 3552, 29909, 29961, 29875, 29962, 29985, 29909, 29961, 29926, 2314, 29930, 29877, 29961, 29909, 29961, 29875, 5262, 29930, 29877, 29961, 29909, 29961, 29926, 24960, 13, 2158, 29898, 2083, 29898, 550, 6802, 29885, 29897, 13, 2 ]
transformers/median/median.py
affresco/demo_features
0
95531
<filename>transformers/median/median.py import numpy as np import logging # Scientific import pandas as pd # Base class for all features from transformers.abstract.mixin import AbstractFeature # ################################################################## # AVERAGE TRUE RANGE # ################################################################## class MedianFeature(AbstractFeature): # # Columns created will be prefixed with this keyword PREFIX = "median" # ################################################################## # INIT # ################################################################## def __init__(self, columns: list = None, prefix: str = None): """ Feature a computation of the median of provided columns. :param columns: columns on which computation will be performed :param prefix: Corresponding to the name of the column output """ # Init super feature class if prefix is None: prefix = self.PREFIX super(MedianFeature, self).__init__(prefix=prefix) # Target columns on which we operate self.columns = self._sanitize_columns(columns=columns) # Initial span of data to be discarded self.warmup = 0 # ################################################################## # SKLEARN TRANSFORMER MIXIN IMPLEMENTATION # ################################################################## def fit(self, *args, **kwargs): return self # nothing to do here def transform(self, X, y=None, **fit_params): assert isinstance(X, pd.DataFrame), "Transform must be a DataFrame" if y is not None: logging.warning(f"Argument 'y' of median transformation will be ignored.") return self(df=X) def fit_transform(self, X, y=None, **fit_params): return self.transform(X, y, **fit_params) def get_params(self, *args, **kwargs): params = { "prefix": self.prefix, "columns": self.columns, } return params # ################################################################## # CORE METHODS # ################################################################## def __call__(self, df: pd.DataFrame): return self.apply(df=df, prefix=self.PREFIX, columns=self.columns) @classmethod def apply(cls, df: pd.DataFrame, prefix: str = None, columns: list = None): # Ensure that parameters are present prefix = prefix or cls.PREFIX # Make some assertions cls._assert_before_applying(df=df, columns=columns, spans=None) return cls.__compute_median(df=df, prefix=prefix, columns=columns) @classmethod def __compute_median(cls, df: pd.DataFrame, columns: list, prefix: str): df[prefix] = np.median(df.loc[:, columns], axis=1) return df
[ 1, 529, 9507, 29958, 9067, 414, 29914, 2168, 713, 29914, 2168, 713, 29889, 2272, 13, 5215, 12655, 408, 7442, 13, 5215, 12183, 13, 13, 29937, 23753, 928, 13, 5215, 11701, 408, 10518, 13, 13, 29937, 7399, 770, 363, 599, 5680, 13, 3166, 4327, 414, 29889, 16595, 29889, 28084, 262, 1053, 25513, 19132, 13, 13, 13, 29937, 835, 13383, 13383, 13383, 7346, 4136, 2277, 29937, 13, 29937, 319, 5348, 10461, 15676, 390, 24336, 13, 29937, 835, 13383, 13383, 13383, 7346, 4136, 2277, 29937, 13, 13, 1990, 3436, 713, 19132, 29898, 9118, 19132, 1125, 13, 1678, 396, 13, 1678, 396, 12481, 29879, 2825, 674, 367, 10944, 287, 411, 445, 13553, 13, 1678, 349, 1525, 25634, 353, 376, 2168, 713, 29908, 13, 13, 1678, 396, 835, 13383, 13383, 13383, 7346, 4136, 2277, 29937, 13, 1678, 396, 2672, 1806, 13, 1678, 396, 835, 13383, 13383, 13383, 7346, 4136, 2277, 29937, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 13, 462, 4341, 29901, 1051, 353, 6213, 29892, 13, 462, 10944, 29901, 851, 353, 6213, 1125, 13, 4706, 9995, 13, 4706, 5169, 1535, 263, 16287, 310, 278, 19194, 310, 4944, 4341, 29889, 13, 13, 4706, 584, 3207, 4341, 29901, 4341, 373, 607, 16287, 674, 367, 8560, 13, 4706, 584, 3207, 10944, 29901, 2994, 3636, 292, 304, 278, 1024, 310, 278, 1897, 1962, 13, 4706, 9995, 13, 13, 4706, 396, 10886, 2428, 4682, 770, 13, 4706, 565, 10944, 338, 6213, 29901, 13, 9651, 10944, 353, 1583, 29889, 15094, 25634, 13, 4706, 2428, 29898, 19302, 713, 19132, 29892, 1583, 467, 1649, 2344, 12035, 13506, 29922, 13506, 29897, 13, 13, 4706, 396, 17157, 4341, 373, 607, 591, 21994, 13, 4706, 1583, 29889, 13099, 353, 1583, 3032, 28455, 277, 675, 29918, 13099, 29898, 13099, 29922, 13099, 29897, 13, 13, 4706, 396, 17250, 10638, 310, 848, 304, 367, 2313, 25600, 13, 4706, 1583, 29889, 29893, 2817, 786, 353, 29871, 29900, 13, 13, 1678, 396, 835, 13383, 13383, 13383, 7346, 4136, 2277, 29937, 13, 1678, 396, 18581, 1307, 15249, 10014, 2190, 29903, 19094, 1001, 341, 6415, 1177, 306, 3580, 1307, 13780, 8098, 13, 1678, 396, 835, 13383, 13383, 13383, 7346, 4136, 2277, 29937, 13, 13, 1678, 822, 6216, 29898, 1311, 29892, 334, 5085, 29892, 3579, 19290, 1125, 13, 4706, 736, 1583, 29871, 396, 3078, 304, 437, 1244, 13, 13, 1678, 822, 4327, 29898, 1311, 29892, 1060, 29892, 343, 29922, 8516, 29892, 3579, 9202, 29918, 7529, 1125, 13, 4706, 4974, 338, 8758, 29898, 29990, 29892, 10518, 29889, 17271, 511, 376, 13372, 1818, 367, 263, 3630, 4308, 29908, 13, 4706, 565, 343, 338, 451, 6213, 29901, 13, 9651, 12183, 29889, 27392, 29898, 29888, 29908, 15730, 525, 29891, 29915, 310, 19194, 13852, 674, 367, 17262, 23157, 13, 4706, 736, 1583, 29898, 2176, 29922, 29990, 29897, 13, 13, 1678, 822, 6216, 29918, 9067, 29898, 1311, 29892, 1060, 29892, 343, 29922, 8516, 29892, 3579, 9202, 29918, 7529, 1125, 13, 4706, 736, 1583, 29889, 9067, 29898, 29990, 29892, 343, 29892, 3579, 9202, 29918, 7529, 29897, 13, 13, 1678, 822, 679, 29918, 7529, 29898, 1311, 29892, 334, 5085, 29892, 3579, 19290, 1125, 13, 4706, 8636, 353, 426, 13, 9651, 376, 13506, 1115, 1583, 29889, 13506, 29892, 13, 9651, 376, 13099, 1115, 1583, 29889, 13099, 29892, 13, 4706, 500, 13, 4706, 736, 8636, 13, 13, 1678, 396, 835, 13383, 13383, 13383, 7346, 4136, 2277, 29937, 13, 1678, 396, 4810, 1525, 341, 2544, 8187, 8452, 13, 1678, 396, 835, 13383, 13383, 13383, 7346, 4136, 2277, 29937, 13, 13, 1678, 822, 4770, 4804, 12035, 1311, 29892, 4489, 29901, 10518, 29889, 17271, 1125, 13, 4706, 736, 1583, 29889, 7302, 29898, 2176, 29922, 2176, 29892, 10944, 29922, 1311, 29889, 15094, 25634, 29892, 4341, 29922, 1311, 29889, 13099, 29897, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 3394, 29898, 25932, 29892, 4489, 29901, 10518, 29889, 17271, 29892, 10944, 29901, 851, 353, 6213, 29892, 4341, 29901, 1051, 353, 6213, 1125, 13, 13, 4706, 396, 22521, 545, 393, 4128, 526, 2198, 13, 4706, 10944, 353, 10944, 470, 1067, 29879, 29889, 15094, 25634, 13, 13, 4706, 396, 8561, 777, 4974, 1080, 13, 4706, 1067, 29879, 3032, 9294, 29918, 11083, 29918, 932, 5890, 29898, 2176, 29922, 2176, 29892, 4341, 29922, 13099, 29892, 805, 550, 29922, 8516, 29897, 13, 13, 4706, 736, 1067, 29879, 17255, 26017, 29918, 2168, 713, 29898, 2176, 29922, 2176, 29892, 13, 462, 462, 1678, 10944, 29922, 13506, 29892, 13, 462, 462, 1678, 4341, 29922, 13099, 29897, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 4770, 26017, 29918, 2168, 713, 29898, 25932, 29892, 4489, 29901, 10518, 29889, 17271, 29892, 4341, 29901, 1051, 29892, 10944, 29901, 851, 1125, 13, 4706, 4489, 29961, 13506, 29962, 353, 7442, 29889, 2168, 713, 29898, 2176, 29889, 2029, 7503, 29892, 4341, 1402, 9685, 29922, 29896, 29897, 13, 4706, 736, 4489, 13, 2 ]
controler/userManage.py
sanxiadaba/pythonBlog
2
155352
""" File description. Background management page for regular users and editors to view their articles, comments, favorites and other functions encoding: utf-8 @author: <NAME> @contact: <EMAIL> @software: Pycharm @time: 2022/1/12 @gituhb: sanxiadaba/pythonBlog """ import base64 import os import time import traceback from math import ceil from flask import Blueprint, session, jsonify, render_template, request from common.myLog import logDanger, dirInDir, avatarPath, listLogger, allLogger from common.utility import compress_image from constant import everyPageInHou, emailAccount from database.article import Article from database.comment import Comment from database.credit import Credit from database.favorite import Favorite from database.logs import Log from database.users import Users instanceArticle = Article() instanceComment = Comment() instanceCredit = Credit() instanceFavorite = Favorite() instanceLog = Log() instanceUser = Users() userManage = Blueprint("userManage", __name__) @userManage.route("/userManage", methods=["GET"]) @logDanger def baseUserManage(): userid = session.get("userid") # My Collection myFavo, lenMyFavo = instanceFavorite.myFavoriteArticle(userid) # Number of my published articles numOfAllMyArticle = len(instanceArticle.searchAllMyArticle()) # Number of visits to published articles allNumOfAllArticleRead = instanceArticle.allNumOfAllArticleRead() # Number of my favorite articles numOfMyFavoriteArticle = lenMyFavo # Number of my comments numOfALLMyComment = instanceComment.numOfALLMyComment() # My nickname myNickname = instanceUser.searchNicknameByUserid(userid) # My registered email myEmail = instanceUser.searchMyEmail(userid) # User Roles myRole = session.get("role") # My qq myQQ = instanceUser.searchMyQQ(userid) # Total remaining points restOfMyCredit = instanceUser.findRestCredit() # My avatar myAvatar = instanceUser.searchMyAvatar(userid) # Whether to apply to become an editor whetherApplyForEditor = instanceUser.whetherApplyForEditor(userid) # Information for managing articles in the user background articleInfo = instanceArticle.articleInfo(userid) # Check the number of all my posts (except deleted) myArticleNum = instanceArticle.exceptDeleteNum() # The article page of the administration page is divided into several pages howManyPage = ceil(myArticleNum / everyPageInHou) howManyPage_1 = howManyPage howManyPage = list(range(2, howManyPage + 1)) # Determine which page to jump to controlBiaoNum = session.get("controlBiaoNum") controlBiaoNum = 0 if controlBiaoNum is None else int(controlBiaoNum) MyInfo = {} MyInfo["numOfAllMyArticle"] = numOfAllMyArticle MyInfo["allNumOfAllArticleRead"] = allNumOfAllArticleRead MyInfo["numOfMyFavoriteArticle"] = numOfMyFavoriteArticle MyInfo["numOfALLMyComment"] = numOfALLMyComment MyInfo["myNickname"] = myNickname MyInfo["myEmail"] = myEmail MyInfo["myRole"] = myRole MyInfo["myQQ"] = myQQ MyInfo["restOfMyCredit"] = restOfMyCredit MyInfo["myAvatar"] = myAvatar MyInfo["whetherApplyForEditor"] = whetherApplyForEditor # My comments, number of comment likes, number of comment approvals, target posts, hidden comments myComment, allMyCommentNum = instanceComment.searchMyComment(userid) # with snoop: guo = [] for i in myComment: lin = [] for j in i: lin.append(j) lin.append(instanceArticle.searchHeadlineByArticleid(i[3])) guo.append(lin) myComment = guo myLoginLog = instanceLog.searchLoginLog(userid) # Data of point changes allCreditChangeLog = instanceCredit.creditChangeLog(userid) return render_template("userManage.html", myInfo=MyInfo, articleInfo=articleInfo, everyPageInHou=everyPageInHou, myArticleNum=myArticleNum, howManyPage=howManyPage, howManyPage_1=howManyPage_1, controlBiaoNum=controlBiaoNum, myComment=myComment, allMyCommentNum=allMyCommentNum, myFavo=myFavo, lenMyFavo=lenMyFavo, myLoginLog=myLoginLog, allCreditChangeLog=allCreditChangeLog, emailAccount=emailAccount) # Back to my profile # Number of articles, number of comments, total number of views, total points, my nickname, my avatar, my qq number, my role @userManage.route("/userInfo", methods=["GET"]) @logDanger def userInfo(): last, most, recommended = instanceArticle.searchLastMostRecommended() return jsonify(last, most, recommended) # 修改昵称 @userManage.route("/modifyNickname", methods=["POST"]) @logDanger def modifyNickname(): userid = session.get('userid') newNickname = request.form.get("newNickname") try: instanceUser.modifyUserNickname(newNickname) info = f"The user with userid {userid} modifies the nickname to {newNickname}" listLogger(userid, info, [0]) instanceLog.insertDetail(type="Change nickname", target=userid, credit=0, info=info) return "1" except: e = traceback.format_exc() allLogger(0, e) return "0" # Modify qq number @userManage.route("/modifyQQ", methods=["POST"]) @logDanger def modifyQQ(): newQQ = request.form.get("newQQ") userid = session.get("userid") try: instanceUser.modifyUserQQnum(newQQ) info = f"The userid of {userid} modifies the qq number to {newQQ}" listLogger(userid, info, [0]) instanceLog.insertDetail(type="Modify QQ", target=userid, credit=0, info=info) return "1" except: e = traceback.format_exc() allLogger(0, e) return "0" # Apply for a role @userManage.route("/applyEditor", methods=["POST"]) @logDanger def applyEditor(): userid = session.get('userid') try: instanceUser.applyForBecomeEditor() info = f"Users with userid {userid} apply to become editors" listLogger(userid, info, [0]) instanceLog.insertDetail(type="Apply to become an editor", target=userid, credit=0, info=info) return "1" except: e = traceback.format_exc() allLogger(0, e) return "0" # cancle the Apply for a role @userManage.route("/cancleApplyEditor", methods=["POST"]) @logDanger def cancleApplyEditor(): userid = session.get('userid') try: instanceUser.cancleApplyForBecomeEditor() info = f"Users with userid {userid} cancle the apply to become editors" listLogger(userid, info, [0]) instanceLog.insertDetail(type="cancle Apply to become an editor", target=userid, credit=0, info=info) return "1" except: e = traceback.format_exc() allLogger(0, e) return "0" # Delete comments (note that the number of comments on the article will be set to subtract 1 when the time comes) # Note that all comments under the article will also be set to hidden @userManage.route("/deleteArticle", methods=["POST"]) @logDanger def deleteArticle(): userid = session.get("userid") articleid = request.form.get('articleid') try: instanceArticle.deleteArticle(articleid) info = f"The user with userid {userid} has deleted the article with articleid {articleid}" listLogger(userid, info, [0]) instanceLog.insertDetail(type="Delete article", target=userid, credit=0, info=info) # Set the comments under the corresponding article to be hidden when deleting the article instanceComment.hideCommnetWhenHideArticle(articleid) # Set the favorite articles to un-favorite as well instanceFavorite.hideFavoByArticleid(articleid) return "1" except: e = traceback.format_exc() allLogger(0, e) return "0" # Modify avatar @userManage.route("/uploadUserAvatar", methods=["POST", "GET"]) @logDanger def uploadUserAvatar(): if request.method == "GET": return render_template("uploadUserAvatar.html") # 对头像图片上传进行响应 @userManage.route('/uploadImg', methods=['POST', 'OPTIONS']) @logDanger def upload(): userid = session.get("userid") myAvatarPath = avatarPath + "\\" + f"myPic_{userid}" dirInDir(f"myPic_{userid}", avatarPath) if request.form.get("action") == "add": data = request.form.get("picStr") imgdata = base64.b64decode(data) thumbname = time.strftime("%Y%m%d_%H%M%S." + "jpg") now = thumbname.split(".") imgfile = os.path.join(myAvatarPath, "test.jpg") file = open(imgfile, 'wb') file.write(imgdata) file.close() oldpicPath = myAvatarPath + "\\" + "test.jpg" newPicPath = myAvatarPath + "\\" + thumbname compress_image(oldpicPath, newPicPath, 400) newPicPath = f"myPic_{userid}" + "/" + thumbname instanceUser.modifyUserThumbnail(newPicPath) os.remove(oldpicPath) allPathPic = [lists for lists in os.listdir(myAvatarPath) if os.path.isfile(os.path.join(myAvatarPath, lists))] for i in allPathPic: biJiao = i.split(".") if biJiao < now: os.remove(myAvatarPath + "\\" + i) info = f"Users whose userid is {userid} change their avatar to {newPicPath}" listLogger(userid, info, [0]) instanceLog.insertDetail(type="Change avatar", target=userid, credit=0, info=info) return "1" # Control which tab appears when the page is refreshed again @userManage.route("/controlBiaoNum", methods=["POST", "GET"]) @logDanger def controlBiaoNum(): if request.method == 'GET': controlBiaoNum = session.get("controlBiaoNum") session["controlBiaoNum"] = 0 if controlBiaoNum is not None and controlBiaoNum != "0": return str(controlBiaoNum) else: return "0" elif request.method == 'POST': session["controlBiaoNum"] = str(request.form.get("controlBiaoNum")) return "1"
[ 1, 9995, 13, 2283, 6139, 29889, 13, 13, 10581, 10643, 1813, 363, 4943, 4160, 322, 3863, 943, 304, 1776, 1009, 7456, 29892, 6589, 29892, 7853, 3246, 322, 916, 3168, 13, 13, 22331, 29901, 23616, 29899, 29947, 13, 29992, 8921, 29901, 529, 5813, 29958, 13, 29992, 12346, 29901, 529, 26862, 6227, 29958, 13, 29992, 20415, 29901, 349, 3376, 2817, 13, 29992, 2230, 29901, 29871, 29906, 29900, 29906, 29906, 29914, 29896, 29914, 29896, 29906, 13, 29992, 29887, 1981, 29882, 29890, 29901, 9753, 5389, 328, 5363, 29914, 4691, 29933, 1188, 13, 15945, 29908, 13, 5215, 2967, 29953, 29946, 13, 5215, 2897, 13, 5215, 931, 13, 5215, 9637, 1627, 13, 3166, 5844, 1053, 2257, 309, 13, 13, 3166, 29784, 1053, 10924, 2158, 29892, 4867, 29892, 4390, 1598, 29892, 4050, 29918, 6886, 29892, 2009, 13, 13, 3166, 3619, 29889, 1357, 3403, 1053, 1480, 29928, 4600, 29892, 4516, 797, 9170, 29892, 1029, 14873, 2605, 29892, 1051, 16363, 29892, 599, 16363, 13, 3166, 3619, 29889, 329, 1793, 1053, 27122, 29918, 3027, 13, 3166, 4868, 1053, 1432, 5074, 797, 29950, 283, 29892, 4876, 10601, 13, 3166, 2566, 29889, 7914, 1053, 21746, 13, 3166, 2566, 29889, 9342, 1053, 461, 13, 3166, 2566, 29889, 11944, 277, 1053, 24596, 277, 13, 3166, 2566, 29889, 29888, 17118, 568, 1053, 383, 17118, 568, 13, 3166, 2566, 29889, 20756, 1053, 4522, 13, 3166, 2566, 29889, 7193, 1053, 23861, 13, 13, 8758, 9986, 2512, 353, 21746, 580, 13, 8758, 20001, 353, 461, 580, 13, 8758, 15507, 277, 353, 24596, 277, 580, 13, 8758, 29943, 17118, 568, 353, 383, 17118, 568, 580, 13, 8758, 3403, 353, 4522, 580, 13, 8758, 2659, 353, 23861, 580, 13, 13, 1792, 2517, 482, 353, 10924, 2158, 703, 1792, 2517, 482, 613, 4770, 978, 1649, 29897, 13, 13, 13, 29992, 1792, 2517, 482, 29889, 13134, 11974, 1792, 2517, 482, 613, 3519, 29922, 3366, 7194, 20068, 13, 29992, 1188, 29928, 4600, 13, 1753, 2967, 2659, 2517, 482, 7295, 13, 1678, 1404, 333, 353, 4867, 29889, 657, 703, 1792, 333, 1159, 13, 13, 1678, 396, 29871, 1619, 14348, 13, 1678, 590, 29943, 27082, 29892, 7431, 3421, 29943, 27082, 353, 2777, 29943, 17118, 568, 29889, 1357, 29943, 17118, 568, 9986, 2512, 29898, 1792, 333, 29897, 13, 1678, 396, 9681, 310, 590, 6369, 7456, 13, 1678, 954, 2776, 3596, 3421, 9986, 2512, 353, 7431, 29898, 8758, 9986, 2512, 29889, 4478, 3596, 3421, 9986, 2512, 3101, 13, 1678, 396, 9681, 310, 1998, 1169, 304, 6369, 7456, 13, 1678, 599, 8009, 2776, 3596, 9986, 2512, 6359, 353, 2777, 9986, 2512, 29889, 497, 8009, 2776, 3596, 9986, 2512, 6359, 580, 13, 1678, 396, 9681, 310, 590, 25448, 7456, 13, 1678, 954, 2776, 3421, 29943, 17118, 568, 9986, 2512, 353, 7431, 3421, 29943, 27082, 13, 1678, 396, 9681, 310, 590, 6589, 13, 1678, 954, 2776, 9818, 3421, 20001, 353, 2777, 20001, 29889, 1949, 2776, 9818, 3421, 20001, 580, 13, 1678, 396, 1619, 25985, 978, 13, 1678, 590, 29940, 860, 978, 353, 2777, 2659, 29889, 4478, 29940, 860, 978, 2059, 2659, 333, 29898, 1792, 333, 29897, 13, 1678, 396, 1619, 15443, 4876, 13, 1678, 590, 9823, 353, 2777, 2659, 29889, 4478, 3421, 9823, 29898, 1792, 333, 29897, 13, 1678, 396, 4911, 390, 6544, 13, 1678, 590, 16727, 353, 4867, 29889, 657, 703, 12154, 1159, 13, 1678, 396, 1619, 3855, 29939, 13, 1678, 590, 29984, 29984, 353, 2777, 2659, 29889, 4478, 3421, 29984, 29984, 29898, 1792, 333, 29897, 13, 1678, 396, 14990, 9886, 3291, 13, 1678, 1791, 2776, 3421, 15507, 277, 353, 2777, 2659, 29889, 2886, 15078, 15507, 277, 580, 13, 1678, 396, 1619, 1029, 14873, 13, 1678, 590, 29909, 9046, 279, 353, 2777, 2659, 29889, 4478, 3421, 29909, 9046, 279, 29898, 1792, 333, 29897, 13, 1678, 396, 26460, 304, 3394, 304, 4953, 385, 6920, 13, 1678, 3692, 2052, 368, 2831, 15280, 353, 2777, 2659, 29889, 1332, 1979, 2052, 368, 2831, 15280, 29898, 1792, 333, 29897, 13, 13, 1678, 396, 10343, 363, 767, 6751, 7456, 297, 278, 1404, 3239, 13, 1678, 4274, 3401, 353, 2777, 9986, 2512, 29889, 7914, 3401, 29898, 1792, 333, 29897, 13, 13, 1678, 396, 29871, 5399, 278, 1353, 310, 599, 590, 11803, 313, 19499, 11132, 29897, 13, 1678, 590, 9986, 2512, 8009, 353, 2777, 9986, 2512, 29889, 19499, 12498, 8009, 580, 13, 13, 1678, 396, 29871, 450, 4274, 1813, 310, 278, 17517, 1813, 338, 13931, 964, 3196, 6515, 13, 1678, 920, 14804, 5074, 353, 2257, 309, 29898, 1357, 9986, 2512, 8009, 847, 1432, 5074, 797, 29950, 283, 29897, 13, 1678, 920, 14804, 5074, 29918, 29896, 353, 920, 14804, 5074, 13, 1678, 920, 14804, 5074, 353, 1051, 29898, 3881, 29898, 29906, 29892, 920, 14804, 5074, 718, 29871, 29896, 876, 13, 13, 1678, 396, 5953, 837, 457, 607, 1813, 304, 12500, 304, 13, 1678, 2761, 29933, 29653, 8009, 353, 4867, 29889, 657, 703, 6451, 29933, 29653, 8009, 1159, 13, 1678, 2761, 29933, 29653, 8009, 353, 29871, 29900, 565, 2761, 29933, 29653, 8009, 338, 6213, 1683, 938, 29898, 6451, 29933, 29653, 8009, 29897, 13, 13, 1678, 1619, 3401, 353, 6571, 13, 1678, 1619, 3401, 3366, 1949, 2776, 3596, 3421, 9986, 2512, 3108, 353, 954, 2776, 3596, 3421, 9986, 2512, 13, 1678, 1619, 3401, 3366, 497, 8009, 2776, 3596, 9986, 2512, 6359, 3108, 353, 599, 8009, 2776, 3596, 9986, 2512, 6359, 13, 1678, 1619, 3401, 3366, 1949, 2776, 3421, 29943, 17118, 568, 9986, 2512, 3108, 353, 954, 2776, 3421, 29943, 17118, 568, 9986, 2512, 13, 1678, 1619, 3401, 3366, 1949, 2776, 9818, 3421, 20001, 3108, 353, 954, 2776, 9818, 3421, 20001, 13, 1678, 1619, 3401, 3366, 1357, 29940, 860, 978, 3108, 353, 590, 29940, 860, 978, 13, 1678, 1619, 3401, 3366, 1357, 9823, 3108, 353, 590, 9823, 13, 1678, 1619, 3401, 3366, 1357, 16727, 3108, 353, 590, 16727, 13, 1678, 1619, 3401, 3366, 1357, 29984, 29984, 3108, 353, 590, 29984, 29984, 13, 1678, 1619, 3401, 3366, 5060, 2776, 3421, 15507, 277, 3108, 353, 1791, 2776, 3421, 15507, 277, 13, 1678, 1619, 3401, 3366, 1357, 29909, 9046, 279, 3108, 353, 590, 29909, 9046, 279, 13, 1678, 1619, 3401, 3366, 1332, 1979, 2052, 368, 2831, 15280, 3108, 353, 3692, 2052, 368, 2831, 15280, 13, 13, 1678, 396, 1619, 6589, 29892, 1353, 310, 3440, 4188, 267, 29892, 1353, 310, 3440, 2134, 791, 29879, 29892, 3646, 11803, 29892, 7934, 6589, 13, 1678, 590, 20001, 29892, 599, 3421, 20001, 8009, 353, 2777, 20001, 29889, 4478, 3421, 20001, 29898, 1792, 333, 29897, 13, 1678, 396, 411, 269, 1217, 459, 29901, 13, 1678, 1410, 29877, 353, 5159, 13, 1678, 363, 474, 297, 590, 20001, 29901, 13, 4706, 6276, 353, 5159, 13, 4706, 363, 432, 297, 474, 29901, 13, 9651, 6276, 29889, 4397, 29898, 29926, 29897, 13, 4706, 6276, 29889, 4397, 29898, 8758, 9986, 2512, 29889, 4478, 5494, 1220, 2059, 9986, 2512, 333, 29898, 29875, 29961, 29941, 12622, 13, 4706, 1410, 29877, 29889, 4397, 29898, 1915, 29897, 13, 1678, 590, 20001, 353, 1410, 29877, 13, 1678, 590, 11049, 3403, 353, 2777, 3403, 29889, 4478, 11049, 3403, 29898, 1792, 333, 29897, 13, 1678, 396, 29871, 3630, 310, 1298, 3620, 13, 1678, 599, 15507, 277, 7277, 3403, 353, 2777, 15507, 277, 29889, 11944, 277, 7277, 3403, 29898, 1792, 333, 29897, 13, 1678, 736, 4050, 29918, 6886, 703, 1792, 2517, 482, 29889, 1420, 613, 590, 3401, 29922, 3421, 3401, 29892, 4274, 3401, 29922, 7914, 3401, 29892, 1432, 5074, 797, 29950, 283, 29922, 17991, 5074, 797, 29950, 283, 29892, 13, 462, 965, 590, 9986, 2512, 8009, 29922, 1357, 9986, 2512, 8009, 29892, 920, 14804, 5074, 29922, 3525, 14804, 5074, 29892, 920, 14804, 5074, 29918, 29896, 29922, 3525, 14804, 5074, 29918, 29896, 29892, 13, 462, 965, 2761, 29933, 29653, 8009, 29922, 6451, 29933, 29653, 8009, 29892, 590, 20001, 29922, 1357, 20001, 29892, 599, 3421, 20001, 8009, 29922, 497, 3421, 20001, 8009, 29892, 13, 462, 965, 590, 29943, 27082, 29922, 1357, 29943, 27082, 29892, 7431, 3421, 29943, 27082, 29922, 2435, 3421, 29943, 27082, 29892, 590, 11049, 3403, 29922, 1357, 11049, 3403, 29892, 13, 462, 965, 599, 15507, 277, 7277, 3403, 29922, 497, 15507, 277, 7277, 3403, 29892, 4876, 10601, 29922, 5269, 10601, 29897, 13, 13, 13, 29937, 29871, 7437, 304, 590, 8722, 13, 29937, 9681, 310, 7456, 29892, 1353, 310, 6589, 29892, 3001, 1353, 310, 8386, 29892, 3001, 3291, 29892, 590, 25985, 978, 29892, 590, 1029, 14873, 29892, 590, 3855, 29939, 1353, 29892, 590, 6297, 13, 29992, 1792, 2517, 482, 29889, 13134, 11974, 1792, 3401, 613, 3519, 29922, 3366, 7194, 20068, 13, 29992, 1188, 29928, 4600, 13, 1753, 1404, 3401, 7295, 13, 1678, 1833, 29892, 1556, 29892, 13622, 353, 2777, 9986, 2512, 29889, 4478, 8897, 29924, 520, 1123, 2055, 2760, 580, 13, 1678, 736, 4390, 1598, 29898, 4230, 29892, 1556, 29892, 13622, 29897, 13, 13, 13, 29937, 29871, 31273, 31264, 233, 155, 184, 31685, 13, 29992, 1792, 2517, 482, 29889, 13134, 11974, 1545, 1598, 29940, 860, 978, 613, 3519, 29922, 3366, 5438, 20068, 13, 29992, 1188, 29928, 4600, 13, 1753, 6623, 29940, 860, 978, 7295, 13, 1678, 1404, 333, 353, 4867, 29889, 657, 877, 1792, 333, 1495, 13, 1678, 716, 29940, 860, 978, 353, 2009, 29889, 689, 29889, 657, 703, 1482, 29940, 860, 978, 1159, 13, 1678, 1018, 29901, 13, 4706, 2777, 2659, 29889, 1545, 1598, 2659, 29940, 860, 978, 29898, 1482, 29940, 860, 978, 29897, 13, 4706, 5235, 353, 285, 29908, 1576, 1404, 411, 1404, 333, 426, 1792, 333, 29913, 878, 11057, 278, 25985, 978, 304, 426, 1482, 29940, 860, 978, 5038, 13, 4706, 1051, 16363, 29898, 1792, 333, 29892, 5235, 29892, 518, 29900, 2314, 13, 4706, 2777, 3403, 29889, 7851, 16570, 29898, 1853, 543, 7277, 25985, 978, 613, 3646, 29922, 1792, 333, 29892, 16200, 29922, 29900, 29892, 5235, 29922, 3888, 29897, 13, 4706, 736, 376, 29896, 29908, 13, 1678, 5174, 29901, 13, 4706, 321, 353, 9637, 1627, 29889, 4830, 29918, 735, 29883, 580, 13, 4706, 599, 16363, 29898, 29900, 29892, 321, 29897, 13, 4706, 736, 376, 29900, 29908, 13, 13, 13, 29937, 3382, 1598, 3855, 29939, 1353, 13, 29992, 1792, 2517, 482, 29889, 13134, 11974, 1545, 1598, 29984, 29984, 613, 3519, 29922, 3366, 5438, 20068, 13, 29992, 1188, 29928, 4600, 13, 1753, 6623, 29984, 29984, 7295, 13, 1678, 716, 29984, 29984, 353, 2009, 29889, 689, 29889, 657, 703, 1482, 29984, 29984, 1159, 13, 1678, 1404, 333, 353, 4867, 29889, 657, 703, 1792, 333, 1159, 13, 1678, 1018, 29901, 13, 4706, 2777, 2659, 29889, 1545, 1598, 2659, 29984, 29984, 1949, 29898, 1482, 29984, 29984, 29897, 13, 4706, 5235, 353, 285, 29908, 1576, 1404, 333, 310, 426, 1792, 333, 29913, 878, 11057, 278, 3855, 29939, 1353, 304, 426, 1482, 29984, 29984, 5038, 13, 4706, 1051, 16363, 29898, 1792, 333, 29892, 5235, 29892, 518, 29900, 2314, 13, 4706, 2777, 3403, 29889, 7851, 16570, 29898, 1853, 543, 2111, 1598, 660, 29984, 613, 3646, 29922, 1792, 333, 29892, 16200, 29922, 29900, 29892, 5235, 29922, 3888, 29897, 13, 4706, 736, 376, 29896, 29908, 13, 1678, 5174, 29901, 13, 4706, 321, 353, 9637, 1627, 29889, 4830, 29918, 735, 29883, 580, 13, 4706, 599, 16363, 29898, 29900, 29892, 321, 29897, 13, 4706, 736, 376, 29900, 29908, 13, 13, 13, 29937, 2401, 368, 363, 263, 6297, 13, 29992, 1792, 2517, 482, 29889, 13134, 11974, 7302, 15280, 613, 3519, 29922, 3366, 5438, 20068, 13, 29992, 1188, 29928, 4600, 13, 1753, 3394, 15280, 7295, 13, 1678, 1404, 333, 353, 4867, 29889, 657, 877, 1792, 333, 1495, 13, 1678, 1018, 29901, 13, 4706, 2777, 2659, 29889, 7302, 2831, 3629, 2763, 15280, 580, 13, 4706, 5235, 353, 285, 29908, 5959, 411, 1404, 333, 426, 1792, 333, 29913, 3394, 304, 4953, 3863, 943, 29908, 13, 4706, 1051, 16363, 29898, 1792, 333, 29892, 5235, 29892, 518, 29900, 2314, 13, 4706, 2777, 3403, 29889, 7851, 16570, 29898, 1853, 543, 2052, 368, 304, 4953, 385, 6920, 613, 3646, 29922, 1792, 333, 29892, 16200, 29922, 29900, 29892, 5235, 29922, 3888, 29897, 13, 4706, 736, 376, 29896, 29908, 13, 1678, 5174, 29901, 13, 4706, 321, 353, 9637, 1627, 29889, 4830, 29918, 735, 29883, 580, 13, 4706, 599, 16363, 29898, 29900, 29892, 321, 29897, 13, 4706, 736, 376, 29900, 29908, 13, 13, 13, 29937, 508, 2841, 278, 2401, 368, 363, 263, 6297, 13, 29992, 1792, 2517, 482, 29889, 13134, 11974, 3068, 2841, 2052, 368, 15280, 613, 3519, 29922, 3366, 5438, 20068, 13, 29992, 1188, 29928, 4600, 13, 1753, 508, 2841, 2052, 368, 15280, 7295, 13, 1678, 1404, 333, 353, 4867, 29889, 657, 877, 1792, 333, 1495, 13, 1678, 1018, 29901, 13, 4706, 2777, 2659, 29889, 3068, 2841, 2052, 368, 2831, 3629, 2763, 15280, 580, 13, 4706, 5235, 353, 285, 29908, 5959, 411, 1404, 333, 426, 1792, 333, 29913, 508, 2841, 278, 3394, 304, 4953, 3863, 943, 29908, 13, 4706, 1051, 16363, 29898, 1792, 333, 29892, 5235, 29892, 518, 29900, 2314, 13, 4706, 2777, 3403, 29889, 7851, 16570, 29898, 1853, 543, 3068, 2841, 2401, 368, 304, 4953, 385, 6920, 613, 3646, 29922, 1792, 333, 29892, 16200, 29922, 29900, 29892, 5235, 29922, 3888, 29897, 13, 4706, 736, 376, 29896, 29908, 13, 1678, 5174, 29901, 13, 4706, 321, 353, 9637, 1627, 29889, 4830, 29918, 735, 29883, 580, 13, 4706, 599, 16363, 29898, 29900, 29892, 321, 29897, 13, 4706, 736, 376, 29900, 29908, 13, 13, 13, 29937, 21267, 6589, 313, 6812, 393, 278, 1353, 310, 6589, 373, 278, 4274, 674, 367, 731, 304, 23197, 29871, 29896, 746, 278, 931, 5304, 29897, 13, 29937, 3940, 393, 599, 6589, 1090, 278, 4274, 674, 884, 367, 731, 304, 7934, 13, 29992, 1792, 2517, 482, 29889, 13134, 11974, 8143, 9986, 2512, 613, 3519, 29922, 3366, 5438, 20068, 13, 29992, 1188, 29928, 4600, 13, 1753, 5217, 9986, 2512, 7295, 13, 1678, 1404, 333, 353, 4867, 29889, 657, 703, 1792, 333, 1159, 13, 1678, 4274, 333, 353, 2009, 29889, 689, 29889, 657, 877, 7914, 333, 1495, 13, 1678, 1018, 29901, 13, 4706, 2777, 9986, 2512, 29889, 8143, 9986, 2512, 29898, 7914, 333, 29897, 13, 4706, 5235, 353, 285, 29908, 1576, 1404, 411, 1404, 333, 426, 1792, 333, 29913, 756, 11132, 278, 4274, 411, 4274, 333, 426, 7914, 333, 5038, 13, 4706, 1051, 16363, 29898, 1792, 333, 29892, 5235, 29892, 518, 29900, 2314, 13, 4706, 2777, 3403, 29889, 7851, 16570, 29898, 1853, 543, 12498, 4274, 613, 3646, 29922, 1792, 333, 29892, 16200, 29922, 29900, 29892, 5235, 29922, 3888, 29897, 13, 4706, 396, 29871, 3789, 278, 6589, 1090, 278, 6590, 4274, 304, 367, 7934, 746, 21228, 278, 4274, 13, 4706, 2777, 20001, 29889, 11458, 5261, 1212, 10401, 29950, 680, 9986, 2512, 29898, 7914, 333, 29897, 13, 4706, 396, 3789, 278, 25448, 7456, 304, 443, 29899, 29888, 17118, 568, 408, 1532, 13, 4706, 2777, 29943, 17118, 568, 29889, 11458, 29943, 27082, 2059, 9986, 2512, 333, 29898, 7914, 333, 29897, 13, 4706, 736, 376, 29896, 29908, 13, 1678, 5174, 29901, 13, 4706, 321, 353, 9637, 1627, 29889, 4830, 29918, 735, 29883, 580, 13, 4706, 599, 16363, 29898, 29900, 29892, 321, 29897, 13, 4706, 736, 376, 29900, 29908, 13, 13, 13, 29937, 3382, 1598, 1029, 14873, 13, 29992, 1792, 2517, 482, 29889, 13134, 11974, 9009, 2659, 29909, 9046, 279, 613, 3519, 29922, 3366, 5438, 613, 376, 7194, 20068, 13, 29992, 1188, 29928, 4600, 13, 1753, 6441, 2659, 29909, 9046, 279, 7295, 13, 1678, 565, 2009, 29889, 5696, 1275, 376, 7194, 1115, 13, 4706, 736, 4050, 29918, 6886, 703, 9009, 2659, 29909, 9046, 279, 29889, 1420, 1159, 13, 13, 13, 29937, 29871, 30783, 31584, 31551, 30861, 31122, 30429, 31471, 31174, 30448, 232, 150, 144, 31370, 13, 29992, 1792, 2517, 482, 29889, 13134, 11219, 9009, 25518, 742, 3519, 29922, 1839, 5438, 742, 525, 14094, 27946, 11287, 13, 29992, 1188, 29928, 4600, 13, 1753, 6441, 7295, 13, 1678, 1404, 333, 353, 4867, 29889, 657, 703, 1792, 333, 1159, 13, 1678, 590, 29909, 9046, 279, 2605, 353, 1029, 14873, 2605, 718, 376, 1966, 29908, 718, 285, 29908, 1357, 29925, 293, 648, 1792, 333, 5038, 13, 1678, 4516, 797, 9170, 29898, 29888, 29908, 1357, 29925, 293, 648, 1792, 333, 17671, 1029, 14873, 2605, 29897, 13, 1678, 565, 2009, 29889, 689, 29889, 657, 703, 2467, 1159, 1275, 376, 1202, 1115, 13, 4706, 848, 353, 2009, 29889, 689, 29889, 657, 703, 16447, 5015, 1159, 13, 4706, 10153, 1272, 353, 2967, 29953, 29946, 29889, 29890, 29953, 29946, 13808, 29898, 1272, 29897, 13, 4706, 28968, 978, 353, 931, 29889, 710, 615, 603, 11702, 29979, 29995, 29885, 29995, 29881, 29918, 29995, 29950, 29995, 29924, 29995, 29903, 1213, 718, 376, 6173, 1159, 13, 4706, 1286, 353, 28968, 978, 29889, 5451, 17350, 1159, 13, 4706, 10153, 1445, 353, 2897, 29889, 2084, 29889, 7122, 29898, 1357, 29909, 9046, 279, 2605, 29892, 376, 1688, 29889, 6173, 1159, 13, 4706, 934, 353, 1722, 29898, 2492, 1445, 29892, 525, 29893, 29890, 1495, 13, 4706, 934, 29889, 3539, 29898, 2492, 1272, 29897, 13, 4706, 934, 29889, 5358, 580, 13, 4706, 2030, 16447, 2605, 353, 590, 29909, 9046, 279, 2605, 718, 376, 1966, 29908, 718, 376, 1688, 29889, 6173, 29908, 13, 4706, 716, 29925, 293, 2605, 353, 590, 29909, 9046, 279, 2605, 718, 376, 1966, 29908, 718, 28968, 978, 13, 4706, 27122, 29918, 3027, 29898, 1025, 16447, 2605, 29892, 716, 29925, 293, 2605, 29892, 29871, 29946, 29900, 29900, 29897, 13, 4706, 716, 29925, 293, 2605, 353, 285, 29908, 1357, 29925, 293, 648, 1792, 333, 5038, 718, 5591, 29908, 718, 28968, 978, 13, 4706, 2777, 2659, 29889, 1545, 1598, 2659, 1349, 21145, 29898, 1482, 29925, 293, 2605, 29897, 13, 4706, 2897, 29889, 5992, 29898, 1025, 16447, 2605, 29897, 13, 4706, 599, 2605, 29925, 293, 353, 518, 21513, 363, 8857, 297, 2897, 29889, 1761, 3972, 29898, 1357, 29909, 9046, 279, 2605, 29897, 565, 2897, 29889, 2084, 29889, 275, 1445, 29898, 359, 29889, 2084, 29889, 7122, 29898, 1357, 29909, 9046, 279, 2605, 29892, 8857, 28166, 13, 4706, 363, 474, 297, 599, 2605, 29925, 293, 29901, 13, 9651, 4768, 29967, 29653, 353, 474, 29889, 5451, 17350, 1159, 13, 9651, 565, 4768, 29967, 29653, 529, 1286, 29901, 13, 18884, 2897, 29889, 5992, 29898, 1357, 29909, 9046, 279, 2605, 718, 376, 1966, 29908, 718, 474, 29897, 13, 4706, 5235, 353, 285, 29908, 5959, 5069, 1404, 333, 338, 426, 1792, 333, 29913, 1735, 1009, 1029, 14873, 304, 426, 1482, 29925, 293, 2605, 5038, 13, 4706, 1051, 16363, 29898, 1792, 333, 29892, 5235, 29892, 518, 29900, 2314, 13, 4706, 2777, 3403, 29889, 7851, 16570, 29898, 1853, 543, 7277, 1029, 14873, 613, 3646, 29922, 1792, 333, 29892, 16200, 29922, 29900, 29892, 5235, 29922, 3888, 29897, 13, 4706, 736, 376, 29896, 29908, 13, 13, 13, 29937, 11264, 607, 4434, 5692, 746, 278, 1813, 338, 11086, 287, 1449, 13, 29992, 1792, 2517, 482, 29889, 13134, 11974, 6451, 29933, 29653, 8009, 613, 3519, 29922, 3366, 5438, 613, 376, 7194, 20068, 13, 29992, 1188, 29928, 4600, 13, 1753, 2761, 29933, 29653, 8009, 7295, 13, 1678, 565, 2009, 29889, 5696, 1275, 525, 7194, 2396, 13, 4706, 2761, 29933, 29653, 8009, 353, 4867, 29889, 657, 703, 6451, 29933, 29653, 8009, 1159, 13, 4706, 4867, 3366, 6451, 29933, 29653, 8009, 3108, 353, 29871, 29900, 13, 4706, 565, 2761, 29933, 29653, 8009, 338, 451, 6213, 322, 2761, 29933, 29653, 8009, 2804, 376, 29900, 1115, 13, 9651, 736, 851, 29898, 6451, 29933, 29653, 8009, 29897, 13, 4706, 1683, 29901, 13, 9651, 736, 376, 29900, 29908, 13, 1678, 25342, 2009, 29889, 5696, 1275, 525, 5438, 2396, 13, 4706, 4867, 3366, 6451, 29933, 29653, 8009, 3108, 353, 851, 29898, 3827, 29889, 689, 29889, 657, 703, 6451, 29933, 29653, 8009, 5783, 13, 4706, 736, 376, 29896, 29908, 13, 2 ]
Day_19/etch_A_scketch.py
ecanro/100DaysOfCode_Python
0
56405
<reponame>ecanro/100DaysOfCode_Python from turtle import Turtle, Screen tim = Turtle() #->separete instance of tommy and any other turtle screen = Screen() tim.shape("turtle")#->states of tim tim.color("red") # tommy = Turtle()#->separate instance of tim and any other turtle # tommy.color("blue")#->states of tommy # tommy.goto(-400,0) def tim_forwards(): tim.forward(10) def tim_right(): new_heading = tim.heading() -10 tim.setheading(new_heading) def tim_left(): new_heading = tim.heading() + 10 tim.setheading(new_heading) def tim_backwards(): tim.back(10) def tim_clear_screen(): tim.clear() tim.penup() #tim.goto(0,0) tim.home() tim.pendown() #tim will move every time a key is push screen.onkey(fun=tim_forwards, key="w") screen.onkey(fun=tim_backwards, key="s") screen.onkey(fun=tim_right, key="d") screen.onkey(fun=tim_left, key="a") screen.onkey(fun=tim_clear_screen, key="c") screen.listen() screen.exitonclick()
[ 1, 529, 276, 1112, 420, 29958, 687, 273, 307, 29914, 29896, 29900, 29900, 25991, 2776, 3399, 29918, 11980, 13, 3166, 260, 4227, 280, 1053, 323, 4227, 280, 29892, 22666, 13, 13, 9346, 353, 323, 4227, 280, 580, 396, 976, 19570, 598, 371, 2777, 310, 6454, 1357, 322, 738, 916, 260, 4227, 280, 13, 10525, 353, 22666, 580, 13, 13, 9346, 29889, 12181, 703, 29873, 4227, 280, 1159, 29937, 976, 28631, 310, 5335, 13, 9346, 29889, 2780, 703, 1127, 1159, 13, 13, 29937, 6454, 1357, 353, 323, 4227, 280, 580, 29937, 976, 25048, 403, 2777, 310, 5335, 322, 738, 916, 260, 4227, 280, 13, 29937, 6454, 1357, 29889, 2780, 703, 9539, 1159, 29937, 976, 28631, 310, 6454, 1357, 13, 29937, 6454, 1357, 29889, 27102, 6278, 29946, 29900, 29900, 29892, 29900, 29897, 13, 13, 1753, 5335, 29918, 1454, 2935, 7295, 13, 1678, 5335, 29889, 11333, 29898, 29896, 29900, 29897, 13, 13, 1753, 5335, 29918, 1266, 7295, 13, 1678, 716, 29918, 2813, 292, 353, 5335, 29889, 2813, 292, 580, 448, 29896, 29900, 13, 1678, 5335, 29889, 842, 2813, 292, 29898, 1482, 29918, 2813, 292, 29897, 13, 13, 1753, 5335, 29918, 1563, 7295, 13, 1678, 716, 29918, 2813, 292, 353, 5335, 29889, 2813, 292, 580, 718, 29871, 29896, 29900, 13, 1678, 5335, 29889, 842, 2813, 292, 29898, 1482, 29918, 2813, 292, 29897, 13, 13, 1753, 5335, 29918, 1627, 2935, 7295, 13, 1678, 5335, 29889, 1627, 29898, 29896, 29900, 29897, 13, 13, 1753, 5335, 29918, 8551, 29918, 10525, 7295, 13, 1678, 5335, 29889, 8551, 580, 13, 1678, 5335, 29889, 2238, 786, 580, 13, 1678, 396, 9346, 29889, 27102, 29898, 29900, 29892, 29900, 29897, 13, 1678, 5335, 29889, 5184, 580, 13, 1678, 5335, 29889, 14081, 776, 580, 13, 13, 29937, 9346, 674, 4337, 1432, 931, 263, 1820, 338, 5503, 13, 10525, 29889, 265, 1989, 29898, 7692, 29922, 9346, 29918, 1454, 2935, 29892, 1820, 543, 29893, 1159, 13, 10525, 29889, 265, 1989, 29898, 7692, 29922, 9346, 29918, 1627, 2935, 29892, 1820, 543, 29879, 1159, 13, 10525, 29889, 265, 1989, 29898, 7692, 29922, 9346, 29918, 1266, 29892, 1820, 543, 29881, 1159, 13, 10525, 29889, 265, 1989, 29898, 7692, 29922, 9346, 29918, 1563, 29892, 1820, 543, 29874, 1159, 13, 13, 10525, 29889, 265, 1989, 29898, 7692, 29922, 9346, 29918, 8551, 29918, 10525, 29892, 1820, 543, 29883, 1159, 13, 13, 10525, 29889, 20631, 580, 13, 10525, 29889, 13322, 265, 3808, 580, 2 ]
rolldecayestimators/tests/test_polynom_estimator.py
martinlarsalbert/rolldecay-estimators
1
27717
<reponame>martinlarsalbert/rolldecay-estimators<filename>rolldecayestimators/tests/test_polynom_estimator.py<gh_stars>1-10 import pytest import pandas as pd import os.path from sklearn.datasets import make_regression from sklearn.pipeline import Pipeline from sklearn.feature_selection import SelectKBest from sklearn.linear_model import LinearRegression from sklearn.preprocessing import PolynomialFeatures from sklearn.feature_selection import f_regression from sklearn.feature_selection import VarianceThreshold import sympy as sp from rolldecayestimators.polynom_estimator import Polynom import matplotlib.pyplot as plt @pytest.fixture def data(): # Generate some random regression data: X, y = make_regression(n_samples=1000, n_features=1, n_informative=10, noise=10, random_state=1) yield X, y @pytest.fixture def model(data): X=data[0] y=data[1] polynomial_features = PolynomialFeatures(degree=1) variance_treshold = VarianceThreshold() linear_regression = LinearRegression() select_k_best = SelectKBest(k=1, score_func=f_regression) steps = [ ('polynomial_feature', polynomial_features), # ('standard_scaler', standard_scaler), ('variance_treshold', variance_treshold), ('select_k_best', select_k_best), ('linear_regression', linear_regression) ] model = Pipeline(steps=steps) model.fit(X=X, y=y) yield model def test_fit(data, model): X=data[0] x=X[:,0] y=data[1] y_symbol = sp.symbols('y') polynom = Polynom(model=model, columns=['B_e_hat'], y_symbol=y_symbol) polynom.fit(X=X, y=y) fig,ax=plt.subplots() ax.plot(x,y, '.') ax.plot(x, model.predict(X=X), label='model') ax.plot(x, polynom.predict(X=X), '--', label='polynom') ax.legend() plt.show() @pytest.fixture def polynom(data, model): X = data[0] y = data[1] y_symbol = sp.symbols('y') polynom = Polynom(model=model, columns=['B_e_hat'], y_symbol=y_symbol) polynom.fit(X=X, y=y) yield polynom def test_predict_dict(polynom): data = { 'B_e_hat':1, } polynom.predict(X=data) def test_predict_series(polynom): data = { 'B_e_hat':1, } data = pd.Series(data) polynom.predict(X=data) def test_save_load(tmpdir, polynom): file_path=os.path.join(str(tmpdir), 'test.sym') polynom.save(file_path=file_path) polynom2 = Polynom.load(file_path=file_path) data = { 'B_e_hat': 1, } polynom2.predict(X=data)
[ 1, 529, 276, 1112, 420, 29958, 28402, 262, 29880, 1503, 284, 2151, 29914, 1245, 7099, 388, 29899, 342, 326, 4097, 29966, 9507, 29958, 1245, 7099, 388, 342, 326, 4097, 29914, 21150, 29914, 1688, 29918, 3733, 948, 290, 29918, 342, 326, 1061, 29889, 2272, 29966, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 5215, 11451, 1688, 13, 5215, 11701, 408, 10518, 13, 5215, 2897, 29889, 2084, 13, 3166, 2071, 19668, 29889, 14538, 1691, 1053, 1207, 29918, 276, 11476, 13, 3166, 2071, 19668, 29889, 13096, 5570, 1053, 349, 23828, 13, 3166, 2071, 19668, 29889, 14394, 29918, 21731, 1053, 7605, 29968, 25353, 13, 3166, 2071, 19668, 29889, 10660, 29918, 4299, 1053, 22985, 4597, 23881, 13, 3166, 2071, 19668, 29889, 1457, 19170, 1053, 2043, 9222, 8263, 3698, 13, 3166, 2071, 19668, 29889, 14394, 29918, 21731, 1053, 285, 29918, 276, 11476, 13, 3166, 2071, 19668, 29889, 14394, 29918, 21731, 1053, 11681, 8837, 1349, 12268, 13, 5215, 5016, 2272, 408, 805, 13, 13, 3166, 9679, 7099, 388, 342, 326, 4097, 29889, 3733, 948, 290, 29918, 342, 326, 1061, 1053, 2043, 948, 290, 13, 5215, 22889, 29889, 2272, 5317, 408, 14770, 13, 13, 29992, 2272, 1688, 29889, 7241, 15546, 13, 1753, 848, 7295, 13, 1678, 396, 3251, 403, 777, 4036, 17855, 848, 29901, 13, 1678, 1060, 29892, 343, 353, 1207, 29918, 276, 11476, 29898, 29876, 29918, 27736, 29922, 29896, 29900, 29900, 29900, 29892, 302, 29918, 22100, 29922, 29896, 29892, 302, 29918, 262, 689, 1230, 29922, 29896, 29900, 29892, 11462, 29922, 29896, 29900, 29892, 4036, 29918, 3859, 29922, 29896, 29897, 13, 1678, 7709, 1060, 29892, 343, 13, 13, 13, 29992, 2272, 1688, 29889, 7241, 15546, 13, 1753, 1904, 29898, 1272, 1125, 13, 13, 1678, 1060, 29922, 1272, 29961, 29900, 29962, 13, 1678, 343, 29922, 1272, 29961, 29896, 29962, 13, 13, 1678, 10159, 29918, 22100, 353, 2043, 9222, 8263, 3698, 29898, 12163, 929, 29922, 29896, 29897, 13, 1678, 20162, 29918, 5888, 8948, 353, 11681, 8837, 1349, 12268, 580, 13, 1678, 5608, 29918, 276, 11476, 353, 22985, 4597, 23881, 580, 13, 13, 1678, 1831, 29918, 29895, 29918, 13318, 353, 7605, 29968, 25353, 29898, 29895, 29922, 29896, 29892, 8158, 29918, 9891, 29922, 29888, 29918, 276, 11476, 29897, 13, 1678, 6576, 353, 518, 13, 4706, 6702, 3733, 9222, 29918, 14394, 742, 10159, 29918, 22100, 511, 13, 4706, 396, 6702, 15770, 29918, 19529, 261, 742, 3918, 29918, 19529, 261, 511, 13, 4706, 6702, 1707, 8837, 29918, 5888, 8948, 742, 20162, 29918, 5888, 8948, 511, 13, 4706, 6702, 2622, 29918, 29895, 29918, 13318, 742, 1831, 29918, 29895, 29918, 13318, 511, 13, 4706, 6702, 10660, 29918, 276, 11476, 742, 5608, 29918, 276, 11476, 29897, 13, 1678, 4514, 13, 13, 1678, 1904, 353, 349, 23828, 29898, 24530, 29922, 24530, 29897, 13, 1678, 1904, 29889, 9202, 29898, 29990, 29922, 29990, 29892, 343, 29922, 29891, 29897, 13, 13, 1678, 7709, 1904, 13, 13, 13, 1753, 1243, 29918, 9202, 29898, 1272, 29892, 1904, 1125, 13, 13, 1678, 1060, 29922, 1272, 29961, 29900, 29962, 13, 1678, 921, 29922, 29990, 7503, 29892, 29900, 29962, 13, 1678, 343, 29922, 1272, 29961, 29896, 29962, 13, 13, 1678, 343, 29918, 18098, 353, 805, 29889, 18098, 29879, 877, 29891, 1495, 13, 1678, 1248, 948, 290, 353, 2043, 948, 290, 29898, 4299, 29922, 4299, 29892, 4341, 29922, 1839, 29933, 29918, 29872, 29918, 2455, 7464, 343, 29918, 18098, 29922, 29891, 29918, 18098, 29897, 13, 1678, 1248, 948, 290, 29889, 9202, 29898, 29990, 29922, 29990, 29892, 343, 29922, 29891, 29897, 13, 13, 1678, 2537, 29892, 1165, 29922, 572, 29873, 29889, 1491, 26762, 580, 13, 1678, 4853, 29889, 5317, 29898, 29916, 29892, 29891, 29892, 15300, 1495, 13, 1678, 4853, 29889, 5317, 29898, 29916, 29892, 1904, 29889, 27711, 29898, 29990, 29922, 29990, 511, 3858, 2433, 4299, 1495, 13, 1678, 4853, 29889, 5317, 29898, 29916, 29892, 1248, 948, 290, 29889, 27711, 29898, 29990, 29922, 29990, 511, 525, 489, 742, 3858, 2433, 3733, 948, 290, 1495, 13, 13, 1678, 4853, 29889, 26172, 580, 13, 1678, 14770, 29889, 4294, 580, 13, 13, 29992, 2272, 1688, 29889, 7241, 15546, 13, 1753, 1248, 948, 290, 29898, 1272, 29892, 1904, 1125, 13, 13, 1678, 1060, 353, 848, 29961, 29900, 29962, 13, 1678, 343, 353, 848, 29961, 29896, 29962, 13, 1678, 343, 29918, 18098, 353, 805, 29889, 18098, 29879, 877, 29891, 1495, 13, 1678, 1248, 948, 290, 353, 2043, 948, 290, 29898, 4299, 29922, 4299, 29892, 4341, 29922, 1839, 29933, 29918, 29872, 29918, 2455, 7464, 343, 29918, 18098, 29922, 29891, 29918, 18098, 29897, 13, 1678, 1248, 948, 290, 29889, 9202, 29898, 29990, 29922, 29990, 29892, 343, 29922, 29891, 29897, 13, 1678, 7709, 1248, 948, 290, 13, 13, 1753, 1243, 29918, 27711, 29918, 8977, 29898, 3733, 948, 290, 1125, 13, 13, 1678, 848, 353, 426, 13, 4706, 525, 29933, 29918, 29872, 29918, 2455, 2396, 29896, 29892, 13, 1678, 500, 13, 13, 1678, 1248, 948, 290, 29889, 27711, 29898, 29990, 29922, 1272, 29897, 13, 13, 1753, 1243, 29918, 27711, 29918, 13757, 29898, 3733, 948, 290, 1125, 13, 13, 1678, 848, 353, 426, 13, 4706, 525, 29933, 29918, 29872, 29918, 2455, 2396, 29896, 29892, 13, 1678, 500, 13, 1678, 848, 353, 10518, 29889, 19204, 29898, 1272, 29897, 13, 13, 1678, 1248, 948, 290, 29889, 27711, 29898, 29990, 29922, 1272, 29897, 13, 13, 1753, 1243, 29918, 7620, 29918, 1359, 29898, 7050, 3972, 29892, 1248, 948, 290, 1125, 13, 13, 1678, 934, 29918, 2084, 29922, 359, 29889, 2084, 29889, 7122, 29898, 710, 29898, 7050, 3972, 511, 525, 1688, 29889, 11967, 1495, 13, 1678, 1248, 948, 290, 29889, 7620, 29898, 1445, 29918, 2084, 29922, 1445, 29918, 2084, 29897, 13, 1678, 1248, 948, 290, 29906, 353, 2043, 948, 290, 29889, 1359, 29898, 1445, 29918, 2084, 29922, 1445, 29918, 2084, 29897, 13, 1678, 848, 353, 426, 13, 4706, 525, 29933, 29918, 29872, 29918, 2455, 2396, 29871, 29896, 29892, 13, 1678, 500, 13, 13, 1678, 1248, 948, 290, 29906, 29889, 27711, 29898, 29990, 29922, 1272, 29897, 13, 13, 2 ]
cnswd/scripts/wy_fhpg.py
NeoBert/liudengfeng-cnswd
7
150496
import re import time from multiprocessing import Pool import pandas as pd from cnswd.mongodb import get_db from cnswd.websource.wy import fetch_fhpg from ..setting.constants import MARKET_START, MAX_WORKER from ..utils import make_logger from .base import get_stock_status logger = make_logger('网易分红配股') NAMES = ['分红配股', '配股一览', '增发一览', '历年融资计划'] D_PAT = re.compile('日期$|日$') START = MARKET_START.tz_localize(None) def create_index_for(collection): # 不存在索性信息时,创建索引 if not collection.index_information(): collection.create_index([("公告日期", 1)]) collection.create_index([("股票代码", 1)]) collection.create_index([("公告日期", 1), ("股票代码", 1)]) def get_max_dt(collection, code): """最后日期""" pipe = [ { '$match': {'股票代码': code} }, { '$sort': { '公告日期': -1 } }, { '$project': { '_id': 0, '公告日期': 1 } }, { '$limit': 1 }, ] try: res = list(collection.aggregate(pipe))[0] dt = pd.Timestamp(res['公告日期']) return dt except (IndexError, ): return START def _fix_data(df): if df.empty: return df for col in df.columns: if D_PAT.findall(col): df[col] = pd.to_datetime(df[col], errors='ignore') return df def _droped_null(doc): res = {} for k, v in doc.items(): if not pd.isnull(doc[k]): res[k] = v return res def _refresh(code): db = get_db('wy') try: dfs = fetch_fhpg(code) except ValueError: return for name, df in zip(NAMES, dfs): if df.empty: continue df['股票代码'] = code df = _fix_data(df) collection = db[name] create_index_for(collection) last_dt = get_max_dt(collection, code) df = df[df['公告日期'] > last_dt] if not df.empty: for doc in df.to_dict('records'): collection.insert_one(_droped_null(doc)) def refresh(): t = time.time() codes = get_stock_status().keys() with Pool(MAX_WORKER) as pool: list(pool.imap_unordered(_refresh, codes)) logger.info(f"股票数量 {len(codes)}, 用时 {time.time() - t:.2f}秒")
[ 1, 1053, 337, 13, 5215, 931, 13, 3166, 6674, 307, 985, 292, 1053, 28625, 13, 13, 5215, 11701, 408, 10518, 13, 13, 3166, 274, 1983, 9970, 29889, 23264, 1053, 679, 29918, 2585, 13, 3166, 274, 1983, 9970, 29889, 2676, 4993, 29889, 12822, 1053, 6699, 29918, 29888, 29882, 4061, 13, 13, 3166, 6317, 26740, 29889, 3075, 1934, 1053, 23851, 29968, 2544, 29918, 25826, 29892, 18134, 29918, 11686, 29968, 1001, 13, 3166, 6317, 13239, 1053, 1207, 29918, 21707, 13, 3166, 869, 3188, 1053, 679, 29918, 17712, 29918, 4882, 13, 13, 21707, 353, 1207, 29918, 21707, 877, 31222, 233, 155, 150, 30748, 31869, 31361, 235, 133, 164, 1495, 13, 5813, 29903, 353, 6024, 30748, 31869, 31361, 235, 133, 164, 742, 525, 31361, 235, 133, 164, 30287, 235, 170, 139, 742, 525, 232, 165, 161, 30910, 30287, 235, 170, 139, 742, 525, 232, 145, 137, 30470, 235, 161, 144, 235, 184, 135, 31466, 232, 139, 149, 2033, 13, 29928, 29918, 29925, 1299, 353, 337, 29889, 12198, 877, 30325, 31117, 29938, 29989, 30325, 29938, 1495, 13, 25826, 353, 23851, 29968, 2544, 29918, 25826, 29889, 17559, 29918, 2997, 675, 29898, 8516, 29897, 13, 13, 13, 1753, 1653, 29918, 2248, 29918, 1454, 29898, 10855, 1125, 13, 1678, 396, 29871, 30413, 30946, 30505, 31836, 30952, 30689, 31021, 30594, 30214, 31441, 30886, 31836, 31674, 13, 1678, 565, 451, 4333, 29889, 2248, 29918, 19678, 7295, 13, 4706, 4333, 29889, 3258, 29918, 2248, 4197, 703, 30539, 31785, 30325, 31117, 613, 29871, 29896, 29897, 2314, 13, 4706, 4333, 29889, 3258, 29918, 2248, 4197, 703, 235, 133, 164, 234, 168, 171, 30690, 31183, 613, 29871, 29896, 29897, 2314, 13, 4706, 4333, 29889, 3258, 29918, 2248, 4197, 703, 30539, 31785, 30325, 31117, 613, 29871, 29896, 511, 4852, 235, 133, 164, 234, 168, 171, 30690, 31183, 613, 29871, 29896, 29897, 2314, 13, 13, 13, 1753, 679, 29918, 3317, 29918, 6008, 29898, 10855, 29892, 775, 1125, 13, 1678, 9995, 30878, 30822, 30325, 31117, 15945, 29908, 13, 1678, 14282, 353, 518, 13, 4706, 426, 13, 9651, 14180, 4352, 2396, 11117, 235, 133, 164, 234, 168, 171, 30690, 31183, 2396, 775, 29913, 13, 4706, 2981, 13, 4706, 426, 13, 9651, 14180, 6605, 2396, 426, 13, 18884, 525, 30539, 31785, 30325, 31117, 2396, 448, 29896, 13, 9651, 500, 13, 4706, 2981, 13, 4706, 426, 13, 9651, 14180, 4836, 2396, 426, 13, 18884, 22868, 333, 2396, 29871, 29900, 29892, 13, 18884, 525, 30539, 31785, 30325, 31117, 2396, 29871, 29896, 13, 9651, 500, 13, 4706, 2981, 13, 4706, 426, 13, 9651, 14180, 13400, 2396, 29871, 29896, 13, 4706, 2981, 13, 1678, 4514, 13, 1678, 1018, 29901, 13, 4706, 620, 353, 1051, 29898, 10855, 29889, 26193, 403, 29898, 17760, 876, 29961, 29900, 29962, 13, 4706, 11636, 353, 10518, 29889, 27939, 29898, 690, 1839, 30539, 31785, 30325, 31117, 11287, 13, 4706, 736, 11636, 13, 1678, 5174, 313, 3220, 2392, 29892, 29871, 1125, 13, 4706, 736, 6850, 8322, 13, 13, 13, 1753, 903, 5878, 29918, 1272, 29898, 2176, 1125, 13, 1678, 565, 4489, 29889, 6310, 29901, 13, 4706, 736, 4489, 13, 1678, 363, 784, 297, 4489, 29889, 13099, 29901, 13, 4706, 565, 360, 29918, 29925, 1299, 29889, 2886, 497, 29898, 1054, 1125, 13, 9651, 4489, 29961, 1054, 29962, 353, 10518, 29889, 517, 29918, 12673, 29898, 2176, 29961, 1054, 1402, 4436, 2433, 17281, 1495, 13, 1678, 736, 4489, 13, 13, 13, 1753, 903, 8865, 287, 29918, 4304, 29898, 1514, 1125, 13, 1678, 620, 353, 6571, 13, 1678, 363, 413, 29892, 325, 297, 1574, 29889, 7076, 7295, 13, 4706, 565, 451, 10518, 29889, 275, 4304, 29898, 1514, 29961, 29895, 29962, 1125, 13, 9651, 620, 29961, 29895, 29962, 353, 325, 13, 1678, 736, 620, 13, 13, 13, 1753, 903, 22379, 29898, 401, 1125, 13, 1678, 4833, 353, 679, 29918, 2585, 877, 12822, 1495, 13, 1678, 1018, 29901, 13, 4706, 4489, 29879, 353, 6699, 29918, 29888, 29882, 4061, 29898, 401, 29897, 13, 1678, 5174, 7865, 2392, 29901, 13, 4706, 736, 13, 1678, 363, 1024, 29892, 4489, 297, 14319, 29898, 5813, 29903, 29892, 4489, 29879, 1125, 13, 4706, 565, 4489, 29889, 6310, 29901, 13, 9651, 6773, 13, 4706, 4489, 1839, 235, 133, 164, 234, 168, 171, 30690, 31183, 2033, 353, 775, 13, 4706, 4489, 353, 903, 5878, 29918, 1272, 29898, 2176, 29897, 13, 4706, 4333, 353, 4833, 29961, 978, 29962, 13, 4706, 1653, 29918, 2248, 29918, 1454, 29898, 10855, 29897, 13, 4706, 1833, 29918, 6008, 353, 679, 29918, 3317, 29918, 6008, 29898, 10855, 29892, 775, 29897, 13, 4706, 4489, 353, 4489, 29961, 2176, 1839, 30539, 31785, 30325, 31117, 2033, 1405, 1833, 29918, 6008, 29962, 13, 4706, 565, 451, 4489, 29889, 6310, 29901, 13, 9651, 363, 1574, 297, 4489, 29889, 517, 29918, 8977, 877, 3757, 4339, 29374, 13, 18884, 4333, 29889, 7851, 29918, 650, 7373, 8865, 287, 29918, 4304, 29898, 1514, 876, 13, 13, 13, 1753, 11086, 7295, 13, 1678, 260, 353, 931, 29889, 2230, 580, 13, 1678, 11561, 353, 679, 29918, 17712, 29918, 4882, 2141, 8149, 580, 13, 1678, 411, 28625, 29898, 12648, 29918, 11686, 29968, 1001, 29897, 408, 11565, 29901, 13, 4706, 1051, 29898, 10109, 29889, 326, 481, 29918, 348, 21693, 7373, 22379, 29892, 11561, 876, 13, 1678, 17927, 29889, 3888, 29898, 29888, 29908, 235, 133, 164, 234, 168, 171, 30354, 31180, 426, 2435, 29898, 18137, 19230, 29871, 30406, 30594, 426, 2230, 29889, 2230, 580, 448, 260, 29901, 29889, 29906, 29888, 29913, 234, 170, 149, 1159, 13, 2 ]
redata/settings.py
mociarain/redata
0
133395
import os GF_SECURITY_ADMIN_USER = os.environ["GF_SECURITY_ADMIN_USER"] GF_SECURITY_ADMIN_PASSWORD = os.environ["GF_SECURITY_ADMIN_PASSWORD"] METRICS_DB_URL = os.environ["REDATA_METRICS_DB_URL"] REDATA_METRICS_DATABASE_HOST = os.environ["REDATA_METRICS_DATABASE_HOST"] REDATA_METRICS_DATABASE_USER = os.environ["REDATA_METRICS_DATABASE_USER"] REDATA_METRICS_DATABASE_PASSWORD = os.environ["REDATA_METRICS_DATABASE_PASSWORD"] REDATA_METRICS_DATABASE_NAME = os.environ["REDATA_METRICS_DATABASE_NAME"] GRAFANA_WEB_HOST = os.environ["GRAFANA_WEB_HOST"] GRAFANA_WEB_PORT = os.environ["GRAFANA_WEB_PORT"] REDATA_GRAFANA_SOURCE = "redata_metrics_db" TEMPLATES_DIR_LOCATION = "redata/grafana/templates/" HOME_DASHBOARD_LOCATION = TEMPLATES_DIR_LOCATION + "home.json" HOME_OVERRIDES_LOCATION = TEMPLATES_DIR_LOCATION + "overrides.json" TABLE_DASHBOARD_LOCATION = TEMPLATES_DIR_LOCATION + "table.json" TARGETS_DASHBOARD_LOCATION = TEMPLATES_DIR_LOCATION + "targets.json" ALERT_DASHBOARD_LOCATION = TEMPLATES_DIR_LOCATION + "alert.json" CUSTOM_PANEL_LOCATION = TEMPLATES_DIR_LOCATION + "panel.json" CUSTOM_ROW_LOCATION = TEMPLATES_DIR_LOCATION + "row.json" REDATA_SOURCE_DBS = [ { "name": el.replace("REDATA_SOURCE_DB_URL_", ""), "db_url": os.environ[el], "schema": os.environ.get(el.replace("_URL_", "_SCHEMA_", 1), None), } for el in os.environ if el.startswith("REDATA_SOURCE_DB_URL_") ] REDATA_AIRFLOW_SCHEDULE_INTERVAL = os.environ["REDATA_AIRFLOW_SCHEDULE_INTERVAL"] REDATA_TIME_COL_BLACKLIST_REGEX = os.environ["REDATA_TIME_COL_BLACKLIST_REGEX"] REDATA_BIGQUERY_DOCKER_CREDS_FILE_PATH = ( os.environ["REDATA_DEFAULT_BIGQUERY_DOCKER_CREDS_FILE_PATH"] if os.environ.get("REDATA_BIGQUERY_KEY_FILE") else None ) ACCEPTABLE_Z_SCORE_DIFF = float(os.environ.get("REDATA_ACCEPTABLE_Z_SCORE_DIFF")) SKIP_COLUMNS = ["id"] REDATA_SLACK_NOTIFICATION_URL = os.environ.get("REDATA_SLACK_NOTIFICATION_URL") FLASK_UI_SECRET_KEY = os.environ.get("REDATA_FLASK_SECRET_KEY") GRAFNA_URL = ( os.environ.get("GRAFANA_REACHABLE_HOST") + ":" + os.environ.get("GRAFANA_WEB_PORT") )
[ 1, 1053, 2897, 13, 13, 29954, 29943, 29918, 1660, 22484, 11937, 29918, 3035, 16173, 29918, 11889, 353, 2897, 29889, 21813, 3366, 29954, 29943, 29918, 1660, 22484, 11937, 29918, 3035, 16173, 29918, 11889, 3108, 13, 29954, 29943, 29918, 1660, 22484, 11937, 29918, 3035, 16173, 29918, 25711, 17013, 353, 2897, 29889, 21813, 3366, 29954, 29943, 29918, 1660, 22484, 11937, 29918, 3035, 16173, 29918, 25711, 17013, 3108, 13, 13, 2303, 5659, 2965, 29903, 29918, 4051, 29918, 4219, 353, 2897, 29889, 21813, 3366, 1525, 14573, 29918, 2303, 5659, 2965, 29903, 29918, 4051, 29918, 4219, 3108, 13, 13, 1525, 14573, 29918, 2303, 5659, 2965, 29903, 29918, 25832, 27982, 29918, 20832, 353, 2897, 29889, 21813, 3366, 1525, 14573, 29918, 2303, 5659, 2965, 29903, 29918, 25832, 27982, 29918, 20832, 3108, 13, 1525, 14573, 29918, 2303, 5659, 2965, 29903, 29918, 25832, 27982, 29918, 11889, 353, 2897, 29889, 21813, 3366, 1525, 14573, 29918, 2303, 5659, 2965, 29903, 29918, 25832, 27982, 29918, 11889, 3108, 13, 1525, 14573, 29918, 2303, 5659, 2965, 29903, 29918, 25832, 27982, 29918, 25711, 17013, 353, 2897, 29889, 21813, 3366, 1525, 14573, 29918, 2303, 5659, 2965, 29903, 29918, 25832, 27982, 29918, 25711, 17013, 3108, 13, 1525, 14573, 29918, 2303, 5659, 2965, 29903, 29918, 25832, 27982, 29918, 5813, 353, 2897, 29889, 21813, 3366, 1525, 14573, 29918, 2303, 5659, 2965, 29903, 29918, 25832, 27982, 29918, 5813, 3108, 13, 13, 29954, 4717, 29943, 2190, 29909, 29918, 8851, 29933, 29918, 20832, 353, 2897, 29889, 21813, 3366, 29954, 4717, 29943, 2190, 29909, 29918, 8851, 29933, 29918, 20832, 3108, 13, 29954, 4717, 29943, 2190, 29909, 29918, 8851, 29933, 29918, 15082, 353, 2897, 29889, 21813, 3366, 29954, 4717, 29943, 2190, 29909, 29918, 8851, 29933, 29918, 15082, 3108, 13, 13, 1525, 14573, 29918, 29954, 4717, 29943, 2190, 29909, 29918, 27839, 4741, 353, 376, 1127, 532, 29918, 2527, 10817, 29918, 2585, 29908, 13, 13, 4330, 3580, 29931, 1299, 2890, 29918, 9464, 29918, 16652, 8098, 353, 376, 1127, 532, 29914, 29887, 1929, 1648, 29914, 20943, 12975, 13, 17353, 29918, 29928, 24943, 8456, 17011, 29918, 16652, 8098, 353, 17067, 3580, 29931, 1299, 2890, 29918, 9464, 29918, 16652, 8098, 718, 376, 5184, 29889, 3126, 29908, 13, 17353, 29918, 29949, 5348, 29934, 1367, 2890, 29918, 16652, 8098, 353, 17067, 3580, 29931, 1299, 2890, 29918, 9464, 29918, 16652, 8098, 718, 376, 957, 24040, 29889, 3126, 29908, 13, 21009, 29918, 29928, 24943, 8456, 17011, 29918, 16652, 8098, 353, 17067, 3580, 29931, 1299, 2890, 29918, 9464, 29918, 16652, 8098, 718, 376, 2371, 29889, 3126, 29908, 13, 29911, 1718, 7194, 29903, 29918, 29928, 24943, 8456, 17011, 29918, 16652, 8098, 353, 17067, 3580, 29931, 1299, 2890, 29918, 9464, 29918, 16652, 8098, 718, 376, 5182, 29879, 29889, 3126, 29908, 13, 1964, 20161, 29918, 29928, 24943, 8456, 17011, 29918, 16652, 8098, 353, 17067, 3580, 29931, 1299, 2890, 29918, 9464, 29918, 16652, 8098, 718, 376, 12888, 29889, 3126, 29908, 13, 13, 29907, 17321, 6488, 29918, 29925, 2190, 6670, 29918, 16652, 8098, 353, 17067, 3580, 29931, 1299, 2890, 29918, 9464, 29918, 16652, 8098, 718, 376, 15119, 29889, 3126, 29908, 13, 29907, 17321, 6488, 29918, 25180, 29918, 16652, 8098, 353, 17067, 3580, 29931, 1299, 2890, 29918, 9464, 29918, 16652, 8098, 718, 376, 798, 29889, 3126, 29908, 13, 13, 1525, 14573, 29918, 27839, 4741, 29918, 4051, 29903, 353, 518, 13, 1678, 426, 13, 4706, 376, 978, 1115, 560, 29889, 6506, 703, 1525, 14573, 29918, 27839, 4741, 29918, 4051, 29918, 4219, 29918, 613, 376, 4968, 13, 4706, 376, 2585, 29918, 2271, 1115, 2897, 29889, 21813, 29961, 295, 1402, 13, 4706, 376, 11010, 1115, 2897, 29889, 21813, 29889, 657, 29898, 295, 29889, 6506, 703, 29918, 4219, 29918, 613, 11119, 29903, 3210, 26862, 29918, 613, 29871, 29896, 511, 6213, 511, 13, 1678, 500, 13, 1678, 363, 560, 297, 2897, 29889, 21813, 13, 1678, 565, 560, 29889, 27382, 2541, 703, 1525, 14573, 29918, 27839, 4741, 29918, 4051, 29918, 4219, 29918, 1159, 13, 29962, 13, 13, 1525, 14573, 29918, 29909, 8193, 29943, 27998, 29918, 29903, 3210, 3352, 29965, 1307, 29918, 23845, 8932, 353, 2897, 29889, 21813, 3366, 1525, 14573, 29918, 29909, 8193, 29943, 27998, 29918, 29903, 3210, 3352, 29965, 1307, 29918, 23845, 8932, 3108, 13, 1525, 14573, 29918, 15307, 29918, 15032, 29918, 13367, 11375, 24360, 29918, 1525, 1692, 29990, 353, 2897, 29889, 21813, 3366, 1525, 14573, 29918, 15307, 29918, 15032, 29918, 13367, 11375, 24360, 29918, 1525, 1692, 29990, 3108, 13, 13, 1525, 14573, 29918, 29933, 6259, 13356, 24422, 29918, 3970, 7077, 1001, 29918, 22245, 8452, 29918, 7724, 29918, 10145, 353, 313, 13, 1678, 2897, 29889, 21813, 3366, 1525, 14573, 29918, 23397, 29918, 29933, 6259, 13356, 24422, 29918, 3970, 7077, 1001, 29918, 22245, 8452, 29918, 7724, 29918, 10145, 3108, 13, 1678, 565, 2897, 29889, 21813, 29889, 657, 703, 1525, 14573, 29918, 29933, 6259, 13356, 24422, 29918, 10818, 29918, 7724, 1159, 13, 1678, 1683, 6213, 13, 29897, 13, 13, 2477, 4741, 7982, 6181, 29918, 29999, 29918, 29903, 3217, 1525, 29918, 4571, 4198, 353, 5785, 29898, 359, 29889, 21813, 29889, 657, 703, 1525, 14573, 29918, 2477, 4741, 7982, 6181, 29918, 29999, 29918, 29903, 3217, 1525, 29918, 4571, 4198, 5783, 13, 13, 16033, 5690, 29918, 15032, 5005, 3059, 353, 6796, 333, 3108, 13, 13, 1525, 14573, 29918, 12750, 11375, 29918, 12256, 6545, 28541, 29918, 4219, 353, 2897, 29889, 21813, 29889, 657, 703, 1525, 14573, 29918, 12750, 11375, 29918, 12256, 6545, 28541, 29918, 4219, 1159, 13, 13, 10536, 3289, 29968, 29918, 3120, 29918, 1660, 22245, 29911, 29918, 10818, 353, 2897, 29889, 21813, 29889, 657, 703, 1525, 14573, 29918, 10536, 3289, 29968, 29918, 1660, 22245, 29911, 29918, 10818, 1159, 13, 13, 29954, 4717, 29943, 3521, 29918, 4219, 353, 313, 13, 1678, 2897, 29889, 21813, 29889, 657, 703, 29954, 4717, 29943, 2190, 29909, 29918, 1525, 2477, 29950, 6181, 29918, 20832, 1159, 718, 376, 6160, 718, 2897, 29889, 21813, 29889, 657, 703, 29954, 4717, 29943, 2190, 29909, 29918, 8851, 29933, 29918, 15082, 1159, 13, 29897, 13, 2 ]
server/app/tests/test_views.py
atom-space/atomspace.od.ua
3
145326
<filename>server/app/tests/test_views.py from django.test import TestCase, Client from django.urls import reverse from app.models import Resident, Mentor, Order, News, Merch import json class TestViews(TestCase): def setUp(self): self.client = Client() self.mentors_url = reverse('mentors') self.residents_url = reverse('residents') self.api_orders_url = reverse('api_orders') self.get_merches_url = reverse('get_merches') self.get_news_url = reverse('get_news') self.merch_url = reverse('merch') self.news_url = reverse('news') self.orders_url = reverse('orders') self.people_url = reverse('people') def test_mentors_GET(self): res = self.client.get(self.mentors_url) self.assertEquals(res.status_code, 200) def test_residents_GET(self): res = self.client.get(self.residents_url) self.assertEquals(res.status_code, 200) def test_api_orders_GET(self): res = self.client.get(self.api_orders_url) self.assertEquals(res.status_code, 200) def test_get_merches_GET(self): res = self.client.get(self.get_merches_url) self.assertEquals(res.status_code, 200) def test_get_news_GET(self): res = self.client.get(self.get_news_url) self.assertEquals(res.status_code, 200) # Next views will return 302 status code because we are not logged in def test_merch_GET(self): res = self.client.get(self.merch_url) self.assertEquals(res.status_code, 302) def test_news_GET(self): res = self.client.get(self.news_url) self.assertEquals(res.status_code, 302) def test_orders_GET(self): res = self.client.get(self.orders_url) self.assertEquals(res.status_code, 302) def test_people_GET(self): res = self.client.get(self.people_url) self.assertEquals(res.status_code, 302)
[ 1, 529, 9507, 29958, 2974, 29914, 932, 29914, 21150, 29914, 1688, 29918, 7406, 29889, 2272, 13, 3166, 9557, 29889, 1688, 1053, 4321, 8259, 29892, 12477, 13, 3166, 9557, 29889, 26045, 1053, 11837, 13, 3166, 623, 29889, 9794, 1053, 2538, 1693, 29892, 341, 296, 272, 29892, 8170, 29892, 10130, 29892, 4702, 305, 13, 5215, 4390, 13, 13, 13, 1990, 4321, 23825, 29898, 3057, 8259, 1125, 13, 12, 1753, 731, 3373, 29898, 1311, 1125, 13, 12, 12, 1311, 29889, 4645, 353, 12477, 580, 13, 12, 12, 1311, 29889, 358, 943, 29918, 2271, 353, 11837, 877, 358, 943, 1495, 13, 12, 12, 1311, 29889, 690, 16719, 29918, 2271, 353, 11837, 877, 690, 16719, 1495, 13, 12, 12, 1311, 29889, 2754, 29918, 20488, 29918, 2271, 353, 11837, 877, 2754, 29918, 20488, 1495, 13, 12, 12, 1311, 29889, 657, 29918, 1050, 6609, 29918, 2271, 353, 11837, 877, 657, 29918, 1050, 6609, 1495, 13, 12, 12, 1311, 29889, 657, 29918, 15753, 29918, 2271, 353, 11837, 877, 657, 29918, 15753, 1495, 13, 12, 12, 1311, 29889, 1050, 305, 29918, 2271, 353, 11837, 877, 1050, 305, 1495, 13, 12, 12, 1311, 29889, 15753, 29918, 2271, 353, 11837, 877, 15753, 1495, 13, 12, 12, 1311, 29889, 20488, 29918, 2271, 353, 11837, 877, 20488, 1495, 13, 12, 12, 1311, 29889, 25719, 29918, 2271, 353, 11837, 877, 25719, 1495, 13, 13, 12, 1753, 1243, 29918, 358, 943, 29918, 7194, 29898, 1311, 1125, 13, 12, 12, 690, 353, 1583, 29889, 4645, 29889, 657, 29898, 1311, 29889, 358, 943, 29918, 2271, 29897, 13, 12, 12, 1311, 29889, 9294, 14776, 29898, 690, 29889, 4882, 29918, 401, 29892, 29871, 29906, 29900, 29900, 29897, 13, 12, 13, 12, 1753, 1243, 29918, 690, 16719, 29918, 7194, 29898, 1311, 1125, 13, 12, 12, 690, 353, 1583, 29889, 4645, 29889, 657, 29898, 1311, 29889, 690, 16719, 29918, 2271, 29897, 13, 12, 12, 1311, 29889, 9294, 14776, 29898, 690, 29889, 4882, 29918, 401, 29892, 29871, 29906, 29900, 29900, 29897, 13, 12, 13, 12, 1753, 1243, 29918, 2754, 29918, 20488, 29918, 7194, 29898, 1311, 1125, 13, 12, 12, 690, 353, 1583, 29889, 4645, 29889, 657, 29898, 1311, 29889, 2754, 29918, 20488, 29918, 2271, 29897, 13, 12, 12, 1311, 29889, 9294, 14776, 29898, 690, 29889, 4882, 29918, 401, 29892, 29871, 29906, 29900, 29900, 29897, 13, 12, 13, 12, 1753, 1243, 29918, 657, 29918, 1050, 6609, 29918, 7194, 29898, 1311, 1125, 13, 12, 12, 690, 353, 1583, 29889, 4645, 29889, 657, 29898, 1311, 29889, 657, 29918, 1050, 6609, 29918, 2271, 29897, 13, 12, 12, 1311, 29889, 9294, 14776, 29898, 690, 29889, 4882, 29918, 401, 29892, 29871, 29906, 29900, 29900, 29897, 13, 12, 13, 12, 1753, 1243, 29918, 657, 29918, 15753, 29918, 7194, 29898, 1311, 1125, 13, 12, 12, 690, 353, 1583, 29889, 4645, 29889, 657, 29898, 1311, 29889, 657, 29918, 15753, 29918, 2271, 29897, 13, 12, 12, 1311, 29889, 9294, 14776, 29898, 690, 29889, 4882, 29918, 401, 29892, 29871, 29906, 29900, 29900, 29897, 13, 12, 13, 12, 29937, 8084, 8386, 674, 736, 29871, 29941, 29900, 29906, 4660, 775, 1363, 591, 526, 451, 13817, 297, 13, 12, 1753, 1243, 29918, 1050, 305, 29918, 7194, 29898, 1311, 1125, 13, 12, 12, 690, 353, 1583, 29889, 4645, 29889, 657, 29898, 1311, 29889, 1050, 305, 29918, 2271, 29897, 13, 12, 12, 1311, 29889, 9294, 14776, 29898, 690, 29889, 4882, 29918, 401, 29892, 29871, 29941, 29900, 29906, 29897, 13, 13, 12, 1753, 1243, 29918, 15753, 29918, 7194, 29898, 1311, 1125, 13, 12, 12, 690, 353, 1583, 29889, 4645, 29889, 657, 29898, 1311, 29889, 15753, 29918, 2271, 29897, 13, 12, 12, 1311, 29889, 9294, 14776, 29898, 690, 29889, 4882, 29918, 401, 29892, 29871, 29941, 29900, 29906, 29897, 13, 13, 12, 1753, 1243, 29918, 20488, 29918, 7194, 29898, 1311, 1125, 13, 12, 12, 690, 353, 1583, 29889, 4645, 29889, 657, 29898, 1311, 29889, 20488, 29918, 2271, 29897, 13, 12, 12, 1311, 29889, 9294, 14776, 29898, 690, 29889, 4882, 29918, 401, 29892, 29871, 29941, 29900, 29906, 29897, 13, 13, 12, 1753, 1243, 29918, 25719, 29918, 7194, 29898, 1311, 1125, 13, 12, 12, 690, 353, 1583, 29889, 4645, 29889, 657, 29898, 1311, 29889, 25719, 29918, 2271, 29897, 13, 12, 12, 1311, 29889, 9294, 14776, 29898, 690, 29889, 4882, 29918, 401, 29892, 29871, 29941, 29900, 29906, 29897, 2 ]
pancake_problem.py
thyrdmc/Pancake-Problem-with-Artificial-Intelligence
0
150816
<gh_stars>0 # coding=utf-8 from __future__ import print_function from simpleai.search import SearchProblem, breadth_first, depth_first, limited_depth_first, iterative_limited_depth_first, uniform_cost, greedy, astar from simpleai.search.viewers import WebViewer, ConsoleViewer, BaseViewer import random import time GOAL = (0,1,2,3,4) my_viewer = WebViewer() InitialState = [ ] GOAL = [] ActionList = [ ] class PancakeProblem(SearchProblem): def actions(self, state): ListOfNode = [] ListOfState = [] for x in state: ListOfState.append(x) for x in range (len(ListOfState)-1): List = [] for y in range(len(ListOfState)): List.append(ListOfState[y]) reversedList = [] for y in range (x, len(List)): reversedList.append(List[y]) reversedList.reverse() for y in range(x, len(List)): List.pop() for y in range(0, len(reversedList)): List.append(reversedList[y]) ListOfNode.append(''.join(str(e) for e in List)) return ListOfNode def result(self, state, action): ListOfNode = action.split(", ") randomSelection = random.randint(0, len(ListOfNode)-1) return ListOfNode[randomSelection] def is_goal(self, state): return state == GOAL def heuristic(self,node): heuristicDefault = 0 status = [] for x in state: status.append(x) for x in range(len(status)-1): List = [] for y in range(len(status)): List.append(status[y]) List.sort() bigNode = List[len(List)-1] if(status[0] == bigNode): status.reverse() status.pop() status.reverse() else: heuristicDefault = status.index(bigNode) break return heuristicDefault def PancakeMixer(number_of_pancakes): pancakes = [ ] for x in range (number_of_pancakes): randomPancake =random.randint(0,9) pancakes.append(randomPancake) return pancakes number_of_pancakes =int(input ("Please, enter number of pancakes :")) ordering_status = input("Do you want to enter ordering? :") while True: if ordering_status == "no" or ordering_status == "No": InitialState = PancakeMixer(number_of_pancakes) print("Initial state:"+ str(InitialState)) break elif ordering_status == "yes" or ordering_status == "Yes": while True: InitialState = [] pancakesOrderState = input("Enter top to bottom ordering between [0 - n],seperated by spaces (Ex: 0,2,1..n):") for x in range(0,len(pancakesOrderState),2): InitialState.append(int(pancakesOrderState[x])) if(len(InitialState) > number_of_pancakes): print() print("The number of pancakes we will list should be equal to the" + str(number_of_pancakes)) print() elif (len(InitialState) == number_of_pancakes): print("Search Algorithm is starting..\n") break else: print("!! Incorrect Entry !!\n"+ str(InitialState)) break break else: print("Incorrect Entry, Please try again") ordering_status = input("Do you want to enter ordering? :") problem = PancakeProblem(initial_state = ''.join(str(e) for e in InitialState)) for x in range(0,len(InitialState)): GOAL.append(str(InitialState[x])) GOAL.sort(reverse = True) GOAL = ''.join(str(e) for e in GOAL) print("\n1) Breadth First Search\n2) Depth First Search") print("3) Depth Limited Search\n4) Iterative Deepening Search") print("5) Uniform Cost Search\n6) Greedy Best First Search") print("7) A* Search") while True: ordering_status = input("Please, enter the number of the algorithm you want to use: ") if ordering_status == "1": startTime = time.time() result = breadth_first(problem,graph_search =True,viewer = my_viewer) print("\n-----------\n") print("Result: "+str(result.state)) print("Steps: "+str(result.path())) break elif ordering_status == "2": startTime = time.time() result = depth_first(problem,graph_search =True,viewer = my_viewer) print("\n-----------\n") print("Result: "+str(result.state)) print("Steps: "+str(result.path())) break elif ordering_status == "3": startTime = time.time() print() depth_first = int(input("Please enter the maximum depth alloved: ")) startTime = time.time() result = limited_depth_first(problem,depth_limit,graph_search =True,viewer = my_viewer) print("\n-----------\n") print("Result: "+str(result.state)) print("Steps: "+str(result.path())) break elif ordering_status == "4": startTime = time.time() result = iterative_limited_depth_first(problem,graph_search =True,viewer = my_viewer) print("\n-----------\n") print("Result: "+str(result.state)) print("Steps: "+str(result.path())) break elif ordering_status == "5": startTime = time.time() result = uniform_cost(problem,graph_search =True,viewer = my_viewer) print("\n-----------\n") print("Result: "+str(result.state)) print("Steps: "+str(result.path())) break elif ordering_status == "6": startTime = time.time() result = greedy(problem,graph_search =True,viewer = my_viewer) print("\n-----------\n") print("Result: "+str(result.state)) print("Steps: "+str(result.path())) break elif ordering_status == "7": startTime = time.time() result = astar(problem,graph_search =True,viewer = my_viewer) print("\n-----------\n") print("Result: "+str(result.state)) print("Steps: "+str(result.path())) break else: print("Please, enter a correct number")
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 29937, 14137, 29922, 9420, 29899, 29947, 13, 3166, 4770, 29888, 9130, 1649, 1053, 1596, 29918, 2220, 13, 3166, 2560, 1794, 29889, 4478, 1053, 11856, 26604, 29892, 18423, 386, 29918, 4102, 29892, 10809, 29918, 4102, 29892, 9078, 29918, 19488, 29918, 4102, 29892, 4256, 1230, 29918, 29044, 29918, 19488, 29918, 4102, 29892, 9090, 29918, 18253, 29892, 1395, 7584, 29892, 263, 8508, 13, 3166, 2560, 1794, 29889, 4478, 29889, 1493, 414, 1053, 2563, 29963, 15580, 29892, 9405, 29963, 15580, 29892, 7399, 29963, 15580, 13, 5215, 4036, 13, 5215, 931, 29871, 13, 13, 17080, 1964, 353, 313, 29900, 29892, 29896, 29892, 29906, 29892, 29941, 29892, 29946, 29897, 13, 13, 1357, 29918, 29894, 15580, 353, 2563, 29963, 15580, 580, 13, 13, 15514, 2792, 353, 518, 4514, 13, 17080, 1964, 353, 5159, 13, 4276, 1293, 353, 518, 4514, 13, 13, 1990, 6518, 1113, 446, 26604, 29898, 7974, 26604, 1125, 13, 1678, 822, 8820, 29898, 1311, 29892, 2106, 1125, 13, 4706, 2391, 2776, 4247, 353, 5159, 13, 4706, 2391, 2776, 2792, 353, 5159, 13, 13, 4706, 363, 921, 297, 2106, 29901, 13, 9651, 2391, 2776, 2792, 29889, 4397, 29898, 29916, 29897, 13, 13, 4706, 363, 921, 297, 3464, 313, 2435, 29898, 1293, 2776, 2792, 6817, 29896, 1125, 632, 13, 9651, 2391, 353, 5159, 13, 13, 9651, 363, 343, 297, 3464, 29898, 2435, 29898, 1293, 2776, 2792, 22164, 13, 18884, 2391, 29889, 4397, 29898, 1293, 2776, 2792, 29961, 29891, 2314, 13, 9651, 18764, 287, 1293, 353, 5159, 13, 13, 9651, 363, 343, 297, 3464, 313, 29916, 29892, 7431, 29898, 1293, 22164, 13, 18884, 18764, 287, 1293, 29889, 4397, 29898, 1293, 29961, 29891, 2314, 13, 9651, 18764, 287, 1293, 29889, 24244, 580, 13, 13, 9651, 363, 343, 297, 3464, 29898, 29916, 29892, 7431, 29898, 1293, 22164, 13, 18884, 2391, 29889, 7323, 580, 13, 13, 9651, 363, 343, 297, 3464, 29898, 29900, 29892, 7431, 29898, 276, 874, 287, 1293, 22164, 13, 18884, 2391, 29889, 4397, 29898, 276, 874, 287, 1293, 29961, 29891, 2314, 13, 13, 9651, 2391, 2776, 4247, 29889, 4397, 877, 4286, 7122, 29898, 710, 29898, 29872, 29897, 363, 321, 297, 2391, 876, 13, 308, 13, 4706, 736, 2391, 2776, 4247, 13, 13, 1678, 822, 1121, 29898, 1311, 29892, 2106, 29892, 3158, 1125, 13, 4706, 2391, 2776, 4247, 353, 3158, 29889, 5451, 28165, 16521, 13, 4706, 4036, 15097, 353, 4036, 29889, 9502, 524, 29898, 29900, 29892, 7431, 29898, 1293, 2776, 4247, 6817, 29896, 29897, 13, 13, 4706, 736, 2391, 2776, 4247, 29961, 8172, 15097, 29962, 13, 29871, 13, 1678, 822, 338, 29918, 28111, 29898, 1311, 29892, 2106, 1125, 13, 4706, 736, 2106, 1275, 21947, 1964, 13, 13, 1678, 822, 540, 332, 4695, 29898, 1311, 29892, 3177, 1125, 13, 4706, 540, 332, 4695, 4592, 353, 29871, 29900, 13, 4706, 4660, 353, 5159, 13, 4706, 363, 921, 297, 2106, 29901, 13, 9651, 4660, 29889, 4397, 29898, 29916, 29897, 13, 13, 4706, 363, 921, 297, 3464, 29898, 2435, 29898, 4882, 6817, 29896, 1125, 13, 9651, 2391, 353, 5159, 13, 13, 9651, 363, 343, 297, 3464, 29898, 2435, 29898, 4882, 22164, 13, 18884, 2391, 29889, 4397, 29898, 4882, 29961, 29891, 2314, 13, 632, 13, 9651, 2391, 29889, 6605, 580, 13, 9651, 4802, 4247, 353, 2391, 29961, 2435, 29898, 1293, 6817, 29896, 29962, 13, 13, 9651, 565, 29898, 4882, 29961, 29900, 29962, 1275, 4802, 4247, 1125, 13, 18884, 4660, 29889, 24244, 580, 13, 18884, 4660, 29889, 7323, 580, 13, 18884, 4660, 29889, 24244, 580, 13, 9651, 1683, 29901, 13, 18884, 540, 332, 4695, 4592, 353, 4660, 29889, 2248, 29898, 3752, 4247, 29897, 13, 18884, 2867, 13, 4706, 736, 540, 332, 4695, 4592, 13, 13, 1753, 6518, 1113, 446, 29924, 861, 261, 29898, 4537, 29918, 974, 29918, 29886, 4564, 6926, 1125, 13, 1678, 282, 4564, 6926, 353, 518, 4514, 13, 13, 1678, 363, 921, 297, 3464, 313, 4537, 29918, 974, 29918, 29886, 4564, 6926, 1125, 13, 4706, 4036, 23684, 1113, 446, 353, 8172, 29889, 9502, 524, 29898, 29900, 29892, 29929, 29897, 13, 4706, 282, 4564, 6926, 29889, 4397, 29898, 8172, 23684, 1113, 446, 29897, 13, 1678, 736, 282, 4564, 6926, 13, 13, 4537, 29918, 974, 29918, 29886, 4564, 6926, 353, 524, 29898, 2080, 4852, 12148, 29892, 3896, 1353, 310, 282, 4564, 6926, 584, 5783, 29871, 13, 2098, 292, 29918, 4882, 353, 1881, 703, 6132, 366, 864, 304, 3896, 20520, 29973, 584, 1159, 29871, 13, 13, 8000, 5852, 29901, 13, 1678, 565, 20520, 29918, 4882, 1275, 376, 1217, 29908, 470, 20520, 29918, 4882, 1275, 376, 3782, 1115, 308, 13, 4706, 17250, 2792, 353, 6518, 1113, 446, 29924, 861, 261, 29898, 4537, 29918, 974, 29918, 29886, 4564, 6926, 29897, 13, 4706, 1596, 703, 15514, 2106, 6160, 29974, 851, 29898, 15514, 2792, 876, 13, 4706, 2867, 13, 13, 1678, 25342, 20520, 29918, 4882, 1275, 376, 3582, 29908, 470, 20520, 29918, 4882, 1275, 376, 8241, 1115, 308, 13, 4706, 1550, 5852, 29901, 13, 9651, 17250, 2792, 353, 5159, 13, 9651, 282, 4564, 6926, 7514, 2792, 353, 1881, 703, 10399, 2246, 304, 5970, 20520, 1546, 518, 29900, 448, 302, 1402, 344, 546, 630, 491, 8162, 313, 1252, 29901, 29871, 29900, 29892, 29906, 29892, 29896, 636, 29876, 1125, 1159, 13, 9651, 363, 921, 297, 3464, 29898, 29900, 29892, 2435, 29898, 29886, 4564, 6926, 7514, 2792, 511, 29906, 1125, 13, 18884, 17250, 2792, 29889, 4397, 29898, 524, 29898, 29886, 4564, 6926, 7514, 2792, 29961, 29916, 12622, 13, 13, 9651, 565, 29898, 2435, 29898, 15514, 2792, 29897, 1405, 1353, 29918, 974, 29918, 29886, 4564, 6926, 1125, 13, 18884, 1596, 580, 13, 18884, 1596, 703, 1576, 1353, 310, 282, 4564, 6926, 591, 674, 1051, 881, 367, 5186, 304, 278, 29908, 718, 851, 29898, 4537, 29918, 974, 29918, 29886, 4564, 6926, 876, 13, 18884, 1596, 580, 13, 13, 9651, 25342, 313, 2435, 29898, 15514, 2792, 29897, 1275, 1353, 29918, 974, 29918, 29886, 4564, 6926, 1125, 13, 18884, 1596, 703, 7974, 29068, 338, 6257, 636, 29905, 29876, 1159, 13, 18884, 2867, 13, 462, 13, 9651, 1683, 29901, 13, 18884, 1596, 703, 6824, 512, 15728, 28236, 1738, 9903, 29876, 17969, 851, 29898, 15514, 2792, 876, 13, 18884, 2867, 13, 4706, 2867, 13, 268, 13, 1678, 1683, 29901, 13, 4706, 1596, 703, 797, 15728, 28236, 29892, 3529, 1018, 1449, 1159, 13, 4706, 20520, 29918, 4882, 353, 1881, 703, 6132, 366, 864, 304, 3896, 20520, 29973, 584, 1159, 13, 13, 17199, 353, 6518, 1113, 446, 26604, 29898, 11228, 29918, 3859, 353, 525, 4286, 7122, 29898, 710, 29898, 29872, 29897, 363, 321, 297, 17250, 2792, 876, 13, 13, 1454, 921, 297, 3464, 29898, 29900, 29892, 2435, 29898, 15514, 2792, 22164, 13, 1678, 21947, 1964, 29889, 4397, 29898, 710, 29898, 15514, 2792, 29961, 29916, 12622, 13, 13, 17080, 1964, 29889, 6605, 29898, 24244, 353, 5852, 29897, 13, 17080, 1964, 353, 525, 4286, 7122, 29898, 710, 29898, 29872, 29897, 363, 321, 297, 21947, 1964, 29897, 13, 13, 2158, 14182, 29876, 29896, 29897, 350, 949, 386, 3824, 11856, 29905, 29876, 29906, 29897, 10034, 386, 3824, 11856, 1159, 13, 2158, 703, 29941, 29897, 10034, 386, 28873, 11856, 29905, 29876, 29946, 29897, 20504, 1230, 21784, 8333, 11856, 1159, 13, 2158, 703, 29945, 29897, 853, 5560, 9839, 11856, 29905, 29876, 29953, 29897, 4122, 7584, 6407, 3824, 11856, 1159, 13, 2158, 703, 29955, 29897, 319, 29930, 11856, 1159, 13, 13, 8000, 5852, 29901, 268, 13, 1678, 20520, 29918, 4882, 353, 1881, 703, 12148, 29892, 3896, 278, 1353, 310, 278, 5687, 366, 864, 304, 671, 29901, 16521, 13, 1678, 565, 20520, 29918, 4882, 1275, 376, 29896, 1115, 13, 4706, 1369, 2481, 353, 931, 29889, 2230, 580, 13, 4706, 1121, 353, 18423, 386, 29918, 4102, 29898, 17199, 29892, 4262, 29918, 4478, 353, 5574, 29892, 29894, 15580, 353, 590, 29918, 29894, 15580, 29897, 13, 4706, 1596, 14182, 29876, 28400, 2612, 29876, 1159, 13, 4706, 1596, 703, 3591, 29901, 15691, 710, 29898, 2914, 29889, 3859, 876, 13, 4706, 1596, 703, 7789, 567, 29901, 15691, 710, 29898, 2914, 29889, 2084, 22130, 13, 4706, 2867, 268, 13, 13, 1678, 25342, 20520, 29918, 4882, 1275, 376, 29906, 1115, 13, 4706, 1369, 2481, 353, 931, 29889, 2230, 580, 13, 4706, 1121, 353, 10809, 29918, 4102, 29898, 17199, 29892, 4262, 29918, 4478, 353, 5574, 29892, 29894, 15580, 353, 590, 29918, 29894, 15580, 29897, 13, 4706, 1596, 14182, 29876, 28400, 2612, 29876, 1159, 13, 4706, 1596, 703, 3591, 29901, 15691, 710, 29898, 2914, 29889, 3859, 876, 13, 4706, 1596, 703, 7789, 567, 29901, 15691, 710, 29898, 2914, 29889, 2084, 22130, 13, 4706, 2867, 268, 13, 13, 1678, 25342, 20520, 29918, 4882, 1275, 376, 29941, 1115, 13, 4706, 1369, 2481, 353, 931, 29889, 2230, 580, 13, 4706, 1596, 580, 13, 4706, 10809, 29918, 4102, 353, 938, 29898, 2080, 703, 12148, 3896, 278, 7472, 10809, 25169, 1490, 29901, 376, 876, 13, 4706, 1369, 2481, 353, 931, 29889, 2230, 580, 13, 4706, 1121, 353, 9078, 29918, 19488, 29918, 4102, 29898, 17199, 29892, 19488, 29918, 13400, 29892, 4262, 29918, 4478, 353, 5574, 29892, 29894, 15580, 353, 590, 29918, 29894, 15580, 29897, 13, 4706, 1596, 14182, 29876, 28400, 2612, 29876, 1159, 13, 4706, 1596, 703, 3591, 29901, 15691, 710, 29898, 2914, 29889, 3859, 876, 13, 4706, 1596, 703, 7789, 567, 29901, 15691, 710, 29898, 2914, 29889, 2084, 22130, 13, 4706, 2867, 268, 13, 13, 1678, 25342, 20520, 29918, 4882, 1275, 376, 29946, 1115, 13, 4706, 1369, 2481, 353, 931, 29889, 2230, 580, 13, 4706, 1121, 353, 4256, 1230, 29918, 29044, 29918, 19488, 29918, 4102, 29898, 17199, 29892, 4262, 29918, 4478, 353, 5574, 29892, 29894, 15580, 353, 590, 29918, 29894, 15580, 29897, 13, 4706, 1596, 14182, 29876, 28400, 2612, 29876, 1159, 13, 4706, 1596, 703, 3591, 29901, 15691, 710, 29898, 2914, 29889, 3859, 876, 13, 4706, 1596, 703, 7789, 567, 29901, 15691, 710, 29898, 2914, 29889, 2084, 22130, 13, 4706, 2867, 268, 13, 13, 1678, 25342, 20520, 29918, 4882, 1275, 376, 29945, 1115, 13, 4706, 1369, 2481, 353, 931, 29889, 2230, 580, 13, 4706, 1121, 353, 9090, 29918, 18253, 29898, 17199, 29892, 4262, 29918, 4478, 353, 5574, 29892, 29894, 15580, 353, 590, 29918, 29894, 15580, 29897, 13, 4706, 1596, 14182, 29876, 28400, 2612, 29876, 1159, 13, 4706, 1596, 703, 3591, 29901, 15691, 710, 29898, 2914, 29889, 3859, 876, 13, 4706, 1596, 703, 7789, 567, 29901, 15691, 710, 29898, 2914, 29889, 2084, 22130, 13, 4706, 2867, 268, 13, 13, 1678, 25342, 20520, 29918, 4882, 1275, 376, 29953, 1115, 13, 4706, 1369, 2481, 353, 931, 29889, 2230, 580, 13, 4706, 1121, 353, 1395, 7584, 29898, 17199, 29892, 4262, 29918, 4478, 353, 5574, 29892, 29894, 15580, 353, 590, 29918, 29894, 15580, 29897, 13, 4706, 1596, 14182, 29876, 28400, 2612, 29876, 1159, 13, 4706, 1596, 703, 3591, 29901, 15691, 710, 29898, 2914, 29889, 3859, 876, 13, 4706, 1596, 703, 7789, 567, 29901, 15691, 710, 29898, 2914, 29889, 2084, 22130, 13, 4706, 2867, 268, 13, 13, 1678, 25342, 20520, 29918, 4882, 1275, 376, 29955, 1115, 13, 4706, 1369, 2481, 353, 931, 29889, 2230, 580, 13, 4706, 1121, 353, 263, 8508, 29898, 17199, 29892, 4262, 29918, 4478, 353, 5574, 29892, 29894, 15580, 353, 590, 29918, 29894, 15580, 29897, 13, 4706, 1596, 14182, 29876, 28400, 2612, 29876, 1159, 13, 4706, 1596, 703, 3591, 29901, 15691, 710, 29898, 2914, 29889, 3859, 876, 13, 4706, 1596, 703, 7789, 567, 29901, 15691, 710, 29898, 2914, 29889, 2084, 22130, 13, 4706, 2867, 268, 13, 1678, 1683, 29901, 13, 4706, 1596, 703, 12148, 29892, 3896, 263, 1959, 1353, 1159, 13, 2 ]
assign_2.3.py
tramontana-software/Python_Coding_Carlos
0
93316
# My Script: hrs=input('Enter Hours: ') hrs=float(hrs) rph=input('Enter your rate per hour: ') rph=float(rph) pay=hrs*rph print('Pay:', pay)
[ 1, 396, 1619, 14415, 29901, 30004, 13, 30004, 13, 1092, 29879, 29922, 2080, 877, 10399, 379, 2470, 29901, 525, 8443, 13, 1092, 29879, 29922, 7411, 29898, 1092, 29879, 8443, 13, 29878, 561, 29922, 2080, 877, 10399, 596, 6554, 639, 7234, 29901, 525, 8443, 13, 29878, 561, 29922, 7411, 29898, 29878, 561, 8443, 13, 10472, 29922, 1092, 29879, 29930, 29878, 561, 30004, 13, 2158, 877, 15467, 29901, 742, 5146, 8443, 13, 2 ]
learn-kana/__main__.py
Ewpratten/learn-kana
0
150617
from luts import kana_to_romaji, romaji_to_kana, simple_kana_to_romaji import random import os import time ## Term info ## term = os.popen('stty size', 'r').read().split() term_height, term_width = int(term[0]), int(term[1]) - 5 # term_width = 30 # i have issues gap = 3 count = 50 max_count = 50 kana_set = simple_kana_to_romaji ## Functions ## def acceptchar(chars): """Convert romaji to hiragana""" # If this is a kana, just return it if ord(chars[0]) > 122: return chars # Deal with conversion if chars in kana_set: return kana_set[chars] else: return "" def setTicker(line): """Sets the ticker line with data. Truncates if screen width < data len""" # Move to saved position print("\u001b[u", end="", flush=True) # Move up 1 line print("\u001b[1A", end="", flush=True) # Truncate the line to the terminal width trunc_line = "".join(line)[: int(min(term_width, max_count) / 2)][1:] first_char = line[0] # Clear line print(">" + " " * (term_width - 1), end="\r", flush=True) # Display the first char in green print("\u001b[37m\u001b[42;1m" + first_char, end="", flush=True) # Display the rest of the ticker normally print("\u001b[0m" + trunc_line + "\r", end="", flush=True) # Move down 1 print("\u001b[1B", end="", flush=True) def handleInput(): """ Accept input, and clean up terminal on \\n """ # Clear line print(">" + " " * (term_width - 1), end="\r", flush=True) # Read from user data = input(">").strip() if len(data) == 0: data = " " # Move up 1 line print("\u001b[1A", end="", flush=True) return data def pickKana(n): """Select n random kana""" keys = list(kana_set.keys()) return [random.choice(keys) for _ in range(n)] ## App ## if __name__ == "__main__": successes = 0 # Pick {count} random hiragana challenge_set = pickKana(count) # newlines for ticker and input print("\n" * (3 + gap), end="") # Move up print(f"\u001b[{gap + 1}A", end="", flush=True) # Print cheat line print("AKS TNH MYR W\r", end="", flush=True) # Move up 1 print(f"\u001b[1A", end="", flush=True) # Save the cursor position print("\u001b[s", end="", flush=True) start_time = time.time() problems = [] completed = [] # Run until we are out of kana while len(challenge_set) > 0: # Display the ticker setTicker(challenge_set) # read input data = handleInput() current_kana = challenge_set[0] if data == " ": continue # Check if we should skip if data == "ー": challenge_set = challenge_set[1:] completed.append((current_kana, False)) continue # Check if we should stop the game if data == "=": break # Check if we should explain if data == "+": # Move to saved position print("\u001b[u", end="", flush=True) # Move down 1 print("\u001b[1B", end="", flush=True) # Print the options print(" \r", end="", flush=True) print(kana_set[current_kana], end="", flush=True) successes -= 1 problems.append(current_kana) continue # Get input as hiragana kana = acceptchar(data) # Check if we should moce on if kana == current_kana: successes += 1 completed.append((current_kana, True)) else: problems.append(current_kana) completed.append((current_kana, False)) challenge_set = challenge_set[1:] # Game end # Move to saved position print("\u001b[u", end="", flush=True) # Move up 1 lines print("\u001b[1A", end="", flush=True) if successes != 0: kps = round(round(time.time() - start_time) / successes) else: kps = 0 # Print kana list with problems highlighted print(" "* max_count + "\r", end="", flush=True) for kana in completed: # Should this be Red BG? if not kana[1]: print("\u001b[37m\u001b[41;1m" + kana[0], end="", flush=True) else: print("\u001b[0m" + kana[0], end="", flush=True) print("\u001b[0m") print( f"Completed {successes}/{count} in ~{round(time.time() - start_time)} seconds ({kps} seconds per kana)") # print(f"You had issues with:\n{problems}")
[ 1, 515, 301, 8842, 1053, 413, 1648, 29918, 517, 29918, 456, 1175, 29875, 29892, 6017, 1175, 29875, 29918, 517, 29918, 29895, 1648, 29892, 2560, 29918, 29895, 1648, 29918, 517, 29918, 456, 1175, 29875, 13, 5215, 4036, 13, 5215, 2897, 13, 13, 5215, 931, 13, 13, 2277, 11814, 5235, 444, 13, 8489, 353, 2897, 29889, 29886, 3150, 877, 303, 1017, 2159, 742, 525, 29878, 2824, 949, 2141, 5451, 580, 13, 8489, 29918, 3545, 29892, 1840, 29918, 2103, 353, 938, 29898, 8489, 29961, 29900, 11724, 938, 29898, 8489, 29961, 29896, 2314, 448, 29871, 29945, 13, 29937, 1840, 29918, 2103, 353, 29871, 29941, 29900, 396, 474, 505, 5626, 13, 13, 29887, 481, 353, 29871, 29941, 13, 2798, 353, 29871, 29945, 29900, 13, 3317, 29918, 2798, 353, 29871, 29945, 29900, 13, 13, 29895, 1648, 29918, 842, 353, 2560, 29918, 29895, 1648, 29918, 517, 29918, 456, 1175, 29875, 13, 13, 2277, 6680, 29879, 444, 13, 13, 13, 1753, 3544, 3090, 29898, 305, 1503, 1125, 13, 1678, 9995, 18455, 6017, 1175, 29875, 304, 7251, 1431, 1648, 15945, 29908, 13, 13, 1678, 396, 960, 445, 338, 263, 413, 1648, 29892, 925, 736, 372, 13, 1678, 565, 4356, 29898, 305, 1503, 29961, 29900, 2314, 1405, 29871, 29896, 29906, 29906, 29901, 13, 4706, 736, 22524, 13, 13, 1678, 396, 897, 284, 411, 11301, 13, 1678, 565, 22524, 297, 413, 1648, 29918, 842, 29901, 13, 4706, 736, 413, 1648, 29918, 842, 29961, 305, 1503, 29962, 13, 1678, 1683, 29901, 13, 4706, 736, 5124, 13, 13, 13, 1753, 731, 29911, 6541, 29898, 1220, 1125, 13, 1678, 9995, 29903, 1691, 278, 260, 6541, 1196, 411, 848, 29889, 1605, 4661, 1078, 565, 4315, 2920, 529, 848, 7431, 15945, 29908, 13, 13, 1678, 396, 25249, 304, 7160, 2602, 13, 1678, 1596, 14182, 29884, 29900, 29900, 29896, 29890, 29961, 29884, 613, 1095, 543, 613, 28371, 29922, 5574, 29897, 13, 13, 1678, 396, 25249, 701, 29871, 29896, 1196, 13, 1678, 1596, 14182, 29884, 29900, 29900, 29896, 29890, 29961, 29896, 29909, 613, 1095, 543, 613, 28371, 29922, 5574, 29897, 13, 13, 1678, 396, 1605, 4661, 403, 278, 1196, 304, 278, 8638, 2920, 13, 1678, 21022, 29918, 1220, 353, 376, 1642, 7122, 29898, 1220, 29897, 7503, 938, 29898, 1195, 29898, 8489, 29918, 2103, 29892, 4236, 29918, 2798, 29897, 847, 29871, 29906, 29897, 3816, 29896, 17531, 13, 1678, 937, 29918, 3090, 353, 1196, 29961, 29900, 29962, 13, 13, 1678, 396, 17732, 1196, 13, 1678, 1596, 703, 11903, 718, 376, 376, 334, 313, 8489, 29918, 2103, 448, 29871, 29896, 511, 1095, 543, 29905, 29878, 613, 28371, 29922, 5574, 29897, 13, 13, 1678, 396, 17440, 278, 937, 1373, 297, 7933, 13, 1678, 1596, 14182, 29884, 29900, 29900, 29896, 29890, 29961, 29941, 29955, 29885, 29905, 29884, 29900, 29900, 29896, 29890, 29961, 29946, 29906, 29936, 29896, 29885, 29908, 718, 937, 29918, 3090, 29892, 1095, 543, 613, 28371, 29922, 5574, 29897, 13, 13, 1678, 396, 17440, 278, 1791, 310, 278, 260, 6541, 12891, 13, 1678, 1596, 14182, 29884, 29900, 29900, 29896, 29890, 29961, 29900, 29885, 29908, 718, 21022, 29918, 1220, 718, 6634, 29878, 613, 1095, 543, 613, 28371, 29922, 5574, 29897, 13, 13, 1678, 396, 25249, 1623, 29871, 29896, 13, 1678, 1596, 14182, 29884, 29900, 29900, 29896, 29890, 29961, 29896, 29933, 613, 1095, 543, 613, 28371, 29922, 5574, 29897, 13, 13, 13, 1753, 4386, 4290, 7295, 13, 1678, 9995, 13, 1678, 29848, 1881, 29892, 13, 1678, 322, 5941, 701, 8638, 373, 2474, 29876, 13, 1678, 9995, 13, 1678, 396, 17732, 1196, 13, 1678, 1596, 703, 11903, 718, 376, 376, 334, 313, 8489, 29918, 2103, 448, 29871, 29896, 511, 1095, 543, 29905, 29878, 613, 28371, 29922, 5574, 29897, 13, 13, 1678, 396, 7523, 515, 1404, 13, 1678, 848, 353, 1881, 703, 29958, 2564, 17010, 580, 13, 13, 1678, 565, 7431, 29898, 1272, 29897, 1275, 29871, 29900, 29901, 13, 4706, 848, 353, 376, 376, 13, 13, 1678, 396, 25249, 701, 29871, 29896, 1196, 13, 1678, 1596, 14182, 29884, 29900, 29900, 29896, 29890, 29961, 29896, 29909, 613, 1095, 543, 613, 28371, 29922, 5574, 29897, 13, 13, 1678, 736, 848, 13, 13, 13, 1753, 5839, 29968, 1648, 29898, 29876, 1125, 13, 1678, 9995, 3549, 302, 4036, 413, 1648, 15945, 29908, 13, 1678, 6611, 353, 1051, 29898, 29895, 1648, 29918, 842, 29889, 8149, 3101, 13, 1678, 736, 518, 8172, 29889, 16957, 29898, 8149, 29897, 363, 903, 297, 3464, 29898, 29876, 4638, 13, 13, 2277, 2401, 444, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 2551, 267, 353, 29871, 29900, 13, 13, 1678, 396, 23868, 426, 2798, 29913, 4036, 7251, 1431, 1648, 13, 1678, 18766, 29918, 842, 353, 5839, 29968, 1648, 29898, 2798, 29897, 13, 13, 1678, 396, 716, 9012, 363, 260, 6541, 322, 1881, 13, 1678, 1596, 14182, 29876, 29908, 334, 313, 29941, 718, 17261, 511, 1095, 543, 1159, 13, 13, 1678, 396, 25249, 701, 13, 1678, 1596, 29898, 29888, 26732, 29884, 29900, 29900, 29896, 29890, 19660, 29887, 481, 718, 29871, 29896, 29913, 29909, 613, 1095, 543, 613, 28371, 29922, 5574, 29897, 13, 13, 1678, 396, 13905, 923, 271, 1196, 13, 1678, 1596, 703, 29909, 17557, 323, 29940, 29950, 19519, 29934, 399, 29905, 29878, 613, 1095, 543, 613, 28371, 29922, 5574, 29897, 13, 13, 1678, 396, 25249, 701, 29871, 29896, 13, 1678, 1596, 29898, 29888, 26732, 29884, 29900, 29900, 29896, 29890, 29961, 29896, 29909, 613, 1095, 543, 613, 28371, 29922, 5574, 29897, 13, 13, 1678, 396, 16913, 278, 10677, 2602, 13, 1678, 1596, 14182, 29884, 29900, 29900, 29896, 29890, 29961, 29879, 613, 1095, 543, 613, 28371, 29922, 5574, 29897, 13, 13, 1678, 1369, 29918, 2230, 353, 931, 29889, 2230, 580, 13, 1678, 4828, 353, 5159, 13, 1678, 8676, 353, 5159, 13, 13, 1678, 396, 7525, 2745, 591, 526, 714, 310, 413, 1648, 13, 1678, 1550, 7431, 29898, 305, 11768, 29918, 842, 29897, 1405, 29871, 29900, 29901, 13, 13, 4706, 396, 17440, 278, 260, 6541, 13, 4706, 731, 29911, 6541, 29898, 305, 11768, 29918, 842, 29897, 13, 13, 4706, 396, 1303, 1881, 13, 4706, 848, 353, 4386, 4290, 580, 13, 13, 4706, 1857, 29918, 29895, 1648, 353, 18766, 29918, 842, 29961, 29900, 29962, 13, 13, 4706, 565, 848, 1275, 376, 29242, 13, 9651, 6773, 13, 13, 4706, 396, 5399, 565, 591, 881, 14383, 13, 4706, 565, 848, 1275, 376, 30185, 1115, 13, 9651, 18766, 29918, 842, 353, 18766, 29918, 842, 29961, 29896, 17531, 13, 9651, 8676, 29889, 4397, 3552, 3784, 29918, 29895, 1648, 29892, 7700, 876, 13, 9651, 6773, 13, 13, 4706, 396, 5399, 565, 591, 881, 5040, 278, 3748, 13, 4706, 565, 848, 1275, 376, 242, 191, 160, 1115, 13, 9651, 2867, 13, 13, 4706, 396, 5399, 565, 591, 881, 5649, 13, 4706, 565, 848, 1275, 376, 242, 191, 142, 1115, 13, 9651, 396, 25249, 304, 7160, 2602, 13, 9651, 1596, 14182, 29884, 29900, 29900, 29896, 29890, 29961, 29884, 613, 1095, 543, 613, 28371, 29922, 5574, 29897, 13, 13, 9651, 396, 25249, 1623, 29871, 29896, 13, 9651, 1596, 14182, 29884, 29900, 29900, 29896, 29890, 29961, 29896, 29933, 613, 1095, 543, 613, 28371, 29922, 5574, 29897, 13, 13, 9651, 396, 13905, 278, 3987, 13, 9651, 1596, 703, 462, 1678, 320, 29878, 613, 1095, 543, 613, 28371, 29922, 5574, 29897, 13, 9651, 1596, 29898, 29895, 1648, 29918, 842, 29961, 3784, 29918, 29895, 1648, 1402, 1095, 543, 613, 28371, 29922, 5574, 29897, 13, 13, 9651, 2551, 267, 22361, 29871, 29896, 13, 9651, 4828, 29889, 4397, 29898, 3784, 29918, 29895, 1648, 29897, 13, 9651, 6773, 13, 13, 4706, 396, 3617, 1881, 408, 7251, 1431, 1648, 13, 4706, 413, 1648, 353, 3544, 3090, 29898, 1272, 29897, 13, 13, 4706, 396, 5399, 565, 591, 881, 2730, 346, 373, 13, 4706, 565, 413, 1648, 1275, 1857, 29918, 29895, 1648, 29901, 13, 9651, 2551, 267, 4619, 29871, 29896, 13, 9651, 8676, 29889, 4397, 3552, 3784, 29918, 29895, 1648, 29892, 5852, 876, 13, 4706, 1683, 29901, 13, 9651, 4828, 29889, 4397, 29898, 3784, 29918, 29895, 1648, 29897, 13, 9651, 8676, 29889, 4397, 3552, 3784, 29918, 29895, 1648, 29892, 7700, 876, 13, 13, 4706, 18766, 29918, 842, 353, 18766, 29918, 842, 29961, 29896, 17531, 13, 13, 1678, 396, 8448, 1095, 13, 13, 1678, 396, 25249, 304, 7160, 2602, 13, 1678, 1596, 14182, 29884, 29900, 29900, 29896, 29890, 29961, 29884, 613, 1095, 543, 613, 28371, 29922, 5574, 29897, 13, 13, 1678, 396, 25249, 701, 29871, 29896, 3454, 13, 1678, 1596, 14182, 29884, 29900, 29900, 29896, 29890, 29961, 29896, 29909, 613, 1095, 543, 613, 28371, 29922, 5574, 29897, 13, 13, 1678, 565, 2551, 267, 2804, 29871, 29900, 29901, 13, 4706, 413, 567, 353, 4513, 29898, 14486, 29898, 2230, 29889, 2230, 580, 448, 1369, 29918, 2230, 29897, 847, 2551, 267, 29897, 13, 1678, 1683, 29901, 13, 4706, 413, 567, 353, 29871, 29900, 13, 13, 1678, 396, 13905, 413, 1648, 1051, 411, 4828, 12141, 287, 13, 1678, 1596, 703, 26345, 4236, 29918, 2798, 718, 6634, 29878, 613, 1095, 543, 613, 28371, 29922, 5574, 29897, 13, 1678, 363, 413, 1648, 297, 8676, 29901, 13, 13, 4706, 396, 10575, 445, 367, 4367, 350, 29954, 29973, 13, 4706, 565, 451, 413, 1648, 29961, 29896, 5387, 13, 9651, 1596, 14182, 29884, 29900, 29900, 29896, 29890, 29961, 29941, 29955, 29885, 29905, 29884, 29900, 29900, 29896, 29890, 29961, 29946, 29896, 29936, 29896, 29885, 29908, 718, 413, 1648, 29961, 29900, 1402, 1095, 543, 613, 28371, 29922, 5574, 29897, 13, 4706, 1683, 29901, 13, 9651, 1596, 14182, 29884, 29900, 29900, 29896, 29890, 29961, 29900, 29885, 29908, 718, 413, 1648, 29961, 29900, 1402, 1095, 543, 613, 28371, 29922, 5574, 29897, 13, 13, 1678, 1596, 14182, 29884, 29900, 29900, 29896, 29890, 29961, 29900, 29885, 1159, 13, 13, 1678, 1596, 29898, 13, 4706, 285, 29908, 26010, 426, 8698, 267, 6822, 29912, 2798, 29913, 297, 3695, 29912, 14486, 29898, 2230, 29889, 2230, 580, 448, 1369, 29918, 2230, 2915, 6923, 30358, 3319, 29895, 567, 29913, 6923, 639, 413, 1648, 25760, 13, 1678, 396, 1596, 29898, 29888, 29908, 3492, 750, 5626, 411, 3583, 29876, 29912, 17199, 29879, 27195, 13, 13, 2 ]
helloworld.py
justintdavis99/hello_UTC
0
138042
print{"Hello World! Written by Justin"} print{"This is my first python code"} x=int(input('Enter an integer: ')) if x%2 ==0; print('') print('Even') else: print('') print('Odd') print('Done with conditional')
[ 1, 1596, 6377, 10994, 2787, 29991, 29871, 16849, 841, 491, 26408, 9092, 13, 2158, 6377, 4013, 338, 590, 937, 3017, 775, 9092, 13, 13, 29916, 29922, 524, 29898, 2080, 877, 10399, 385, 6043, 29901, 525, 876, 13, 361, 921, 29995, 29906, 1275, 29900, 29936, 13, 29871, 1596, 877, 1495, 13, 29871, 1596, 877, 29923, 854, 1495, 13, 2870, 29901, 13, 29871, 1596, 877, 1495, 13, 29871, 1596, 877, 29949, 1289, 1495, 13, 2158, 877, 25632, 411, 15047, 1495, 13, 2 ]
transition_amr_parser/action_pointer/amr_parser.py
IBM/transition-amr-parser
76
118568
# Standalone AMR parser import os import json import torch from transition_amr_parser.model import AMRModel import transition_amr_parser.utils as utils from fairseq.models.roberta import RobertaModel from transition_amr_parser.roberta_utils import extract_features_aligned_to_words class AMRParser(): def __init__(self, model_path, roberta_cache_path=None, oracle_stats_path=None, config_path=None, model_use_gpu=False, roberta_use_gpu=False, verbose=False, logger=None): if not oracle_stats_path: model_folder = os.path.dirname(model_path) oracle_stats_path = os.path.join(model_folder, "train.rules.json") assert os.path.isfile(oracle_stats_path), \ f'Expected train.rules.json in {model_folder}' if not config_path: model_folder = os.path.dirname(model_path) config_path = os.path.join(model_folder, "config.json") assert os.path.isfile(config_path), \ f'Expected config.json in {model_folder}' self.model = self.load_model(model_path, oracle_stats_path, config_path, model_use_gpu) self.roberta = self.load_roberta(roberta_use_gpu, roberta_cache_path) self.logger = logger def load_roberta(self, roberta_use_gpu, roberta_cache_path=None): if not roberta_cache_path: # Load the Roberta Model from torch hub roberta = torch.hub.load('pytorch/fairseq', 'roberta.large') else: roberta = RobertaModel.from_pretrained(roberta_cache_path, checkpoint_file='model.pt') roberta.eval() if roberta_use_gpu: roberta.cuda() return roberta def load_model(self, model_path, oracle_stats_path, config_path, model_use_gpu): oracle_stats = json.load(open(oracle_stats_path)) config = json.load(open(config_path)) model = AMRModel( oracle_stats=oracle_stats, embedding_dim=config["embedding_dim"], action_embedding_dim=config["action_embedding_dim"], char_embedding_dim=config["char_embedding_dim"], hidden_dim=config["hidden_dim"], char_hidden_dim=config["char_hidden_dim"], rnn_layers=config["rnn_layers"], dropout_ratio=config["dropout_ratio"], pretrained_dim=config["pretrained_dim"], use_bert=config["use_bert"], use_gpu=model_use_gpu, use_chars=config["use_chars"], use_attention=config["use_attention"], use_function_words=config["use_function_words"], use_function_words_rels=config["use_function_words_rels"], parse_unaligned=config["parse_unaligned"], weight_inputs=config["weight_inputs"], attend_inputs=config["attend_inputs"] ) model.load_state_dict(torch.load(model_path)) model.eval() return model def get_embeddings(self, tokens): features = extract_features_aligned_to_words(self.roberta, tokens=tokens, use_all_layers=True, return_all_hiddens=True) embeddings = [] for tok in features: if str(tok) not in ['<s>', '</s>']: embeddings.append(tok.vector) embeddings = torch.stack(embeddings).detach().cpu().numpy() return embeddings def parse_sentence(self, tokens): # The model expects <ROOT> token at the end of the input sentence if tokens[-1] != "<ROOT>": tokens.append("<ROOT>") sent_rep = utils.vectorize_words(self.model, tokens, training=False, gpu=self.model.use_gpu) bert_emb = self.get_embeddings(tokens) amr = self.model.parse_sentence(tokens, sent_rep, bert_emb) return amr
[ 1, 396, 6679, 18785, 13862, 29934, 13812, 13, 13, 5215, 2897, 13, 5215, 4390, 13, 5215, 4842, 305, 13, 3166, 9558, 29918, 314, 29878, 29918, 16680, 29889, 4299, 1053, 13862, 29934, 3195, 13, 5215, 9558, 29918, 314, 29878, 29918, 16680, 29889, 13239, 408, 3667, 29879, 13, 3166, 6534, 11762, 29889, 9794, 29889, 307, 19954, 1053, 1528, 19954, 3195, 13, 3166, 9558, 29918, 314, 29878, 29918, 16680, 29889, 307, 19954, 29918, 13239, 1053, 6597, 29918, 22100, 29918, 13671, 29918, 517, 29918, 9303, 13, 13, 13, 1990, 13862, 29934, 11726, 7295, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1904, 29918, 2084, 29892, 696, 19954, 29918, 8173, 29918, 2084, 29922, 8516, 29892, 17919, 29918, 16202, 29918, 2084, 29922, 8516, 29892, 2295, 29918, 2084, 29922, 8516, 29892, 1904, 29918, 1509, 29918, 29887, 3746, 29922, 8824, 29892, 696, 19954, 29918, 1509, 29918, 29887, 3746, 29922, 8824, 29892, 26952, 29922, 8824, 29892, 17927, 29922, 8516, 1125, 13, 4706, 565, 451, 17919, 29918, 16202, 29918, 2084, 29901, 13, 9651, 1904, 29918, 12083, 353, 2897, 29889, 2084, 29889, 25721, 29898, 4299, 29918, 2084, 29897, 13, 9651, 17919, 29918, 16202, 29918, 2084, 353, 2897, 29889, 2084, 29889, 7122, 29898, 4299, 29918, 12083, 29892, 376, 14968, 29889, 19238, 29889, 3126, 1159, 13, 9651, 4974, 2897, 29889, 2084, 29889, 275, 1445, 29898, 11347, 29918, 16202, 29918, 2084, 511, 320, 13, 18884, 285, 29915, 1252, 6021, 7945, 29889, 19238, 29889, 3126, 297, 426, 4299, 29918, 12083, 10162, 13, 4706, 565, 451, 2295, 29918, 2084, 29901, 13, 9651, 1904, 29918, 12083, 353, 2897, 29889, 2084, 29889, 25721, 29898, 4299, 29918, 2084, 29897, 13, 9651, 2295, 29918, 2084, 353, 2897, 29889, 2084, 29889, 7122, 29898, 4299, 29918, 12083, 29892, 376, 2917, 29889, 3126, 1159, 13, 9651, 4974, 2897, 29889, 2084, 29889, 275, 1445, 29898, 2917, 29918, 2084, 511, 320, 13, 18884, 285, 29915, 1252, 6021, 2295, 29889, 3126, 297, 426, 4299, 29918, 12083, 10162, 13, 4706, 1583, 29889, 4299, 353, 1583, 29889, 1359, 29918, 4299, 29898, 4299, 29918, 2084, 29892, 17919, 29918, 16202, 29918, 2084, 29892, 2295, 29918, 2084, 29892, 1904, 29918, 1509, 29918, 29887, 3746, 29897, 13, 4706, 1583, 29889, 307, 19954, 353, 1583, 29889, 1359, 29918, 307, 19954, 29898, 307, 19954, 29918, 1509, 29918, 29887, 3746, 29892, 696, 19954, 29918, 8173, 29918, 2084, 29897, 13, 4706, 1583, 29889, 21707, 353, 17927, 13, 13, 1678, 822, 2254, 29918, 307, 19954, 29898, 1311, 29892, 696, 19954, 29918, 1509, 29918, 29887, 3746, 29892, 696, 19954, 29918, 8173, 29918, 2084, 29922, 8516, 1125, 13, 13, 4706, 565, 451, 696, 19954, 29918, 8173, 29918, 2084, 29901, 13, 9651, 396, 16012, 278, 1528, 19954, 8125, 515, 4842, 305, 19766, 13, 9651, 696, 19954, 353, 4842, 305, 29889, 29882, 431, 29889, 1359, 877, 2272, 7345, 305, 29914, 29888, 1466, 11762, 742, 525, 307, 19954, 29889, 16961, 1495, 13, 4706, 1683, 29901, 13, 9651, 696, 19954, 353, 1528, 19954, 3195, 29889, 3166, 29918, 1457, 3018, 1312, 29898, 307, 19954, 29918, 8173, 29918, 2084, 29892, 1423, 3149, 29918, 1445, 2433, 4299, 29889, 415, 1495, 13, 4706, 696, 19954, 29889, 14513, 580, 13, 4706, 565, 696, 19954, 29918, 1509, 29918, 29887, 3746, 29901, 13, 9651, 696, 19954, 29889, 29883, 6191, 580, 13, 4706, 736, 696, 19954, 13, 13, 1678, 822, 2254, 29918, 4299, 29898, 1311, 29892, 1904, 29918, 2084, 29892, 17919, 29918, 16202, 29918, 2084, 29892, 2295, 29918, 2084, 29892, 1904, 29918, 1509, 29918, 29887, 3746, 1125, 13, 13, 4706, 17919, 29918, 16202, 353, 4390, 29889, 1359, 29898, 3150, 29898, 11347, 29918, 16202, 29918, 2084, 876, 13, 4706, 2295, 353, 4390, 29889, 1359, 29898, 3150, 29898, 2917, 29918, 2084, 876, 13, 4706, 1904, 353, 13862, 29934, 3195, 29898, 13, 9651, 17919, 29918, 16202, 29922, 11347, 29918, 16202, 29892, 13, 9651, 23655, 29918, 6229, 29922, 2917, 3366, 17987, 8497, 29918, 6229, 12436, 13, 9651, 3158, 29918, 17987, 8497, 29918, 6229, 29922, 2917, 3366, 2467, 29918, 17987, 8497, 29918, 6229, 12436, 13, 9651, 1373, 29918, 17987, 8497, 29918, 6229, 29922, 2917, 3366, 3090, 29918, 17987, 8497, 29918, 6229, 12436, 13, 9651, 7934, 29918, 6229, 29922, 2917, 3366, 10892, 29918, 6229, 12436, 13, 9651, 1373, 29918, 10892, 29918, 6229, 29922, 2917, 3366, 3090, 29918, 10892, 29918, 6229, 12436, 13, 9651, 364, 15755, 29918, 29277, 29922, 2917, 3366, 29878, 15755, 29918, 29277, 12436, 13, 9651, 5768, 449, 29918, 3605, 601, 29922, 2917, 3366, 8865, 449, 29918, 3605, 601, 12436, 13, 9651, 758, 3018, 1312, 29918, 6229, 29922, 2917, 3366, 1457, 3018, 1312, 29918, 6229, 12436, 13, 9651, 671, 29918, 2151, 29922, 2917, 3366, 1509, 29918, 2151, 12436, 13, 9651, 671, 29918, 29887, 3746, 29922, 4299, 29918, 1509, 29918, 29887, 3746, 29892, 13, 9651, 671, 29918, 305, 1503, 29922, 2917, 3366, 1509, 29918, 305, 1503, 12436, 13, 9651, 671, 29918, 1131, 2509, 29922, 2917, 3366, 1509, 29918, 1131, 2509, 12436, 13, 9651, 671, 29918, 2220, 29918, 9303, 29922, 2917, 3366, 1509, 29918, 2220, 29918, 9303, 12436, 13, 9651, 671, 29918, 2220, 29918, 9303, 29918, 2674, 29879, 29922, 2917, 3366, 1509, 29918, 2220, 29918, 9303, 29918, 2674, 29879, 12436, 13, 9651, 6088, 29918, 348, 13671, 29922, 2917, 3366, 5510, 29918, 348, 13671, 12436, 13, 9651, 7688, 29918, 2080, 29879, 29922, 2917, 3366, 7915, 29918, 2080, 29879, 12436, 13, 9651, 14333, 29918, 2080, 29879, 29922, 2917, 3366, 27601, 29918, 2080, 29879, 3108, 13, 4706, 1723, 13, 13, 4706, 1904, 29889, 1359, 29918, 3859, 29918, 8977, 29898, 7345, 305, 29889, 1359, 29898, 4299, 29918, 2084, 876, 13, 4706, 1904, 29889, 14513, 580, 13, 4706, 736, 1904, 13, 13, 1678, 822, 679, 29918, 17987, 29881, 886, 29898, 1311, 29892, 18897, 1125, 13, 4706, 5680, 353, 6597, 29918, 22100, 29918, 13671, 29918, 517, 29918, 9303, 29898, 1311, 29889, 307, 19954, 29892, 18897, 29922, 517, 12360, 29892, 671, 29918, 497, 29918, 29277, 29922, 5574, 29892, 736, 29918, 497, 29918, 29882, 2205, 575, 29922, 5574, 29897, 13, 4706, 8297, 29881, 886, 353, 5159, 13, 4706, 363, 304, 29895, 297, 5680, 29901, 13, 9651, 565, 851, 29898, 17082, 29897, 451, 297, 6024, 1, 13420, 525, 2, 525, 5387, 13, 18884, 8297, 29881, 886, 29889, 4397, 29898, 17082, 29889, 8111, 29897, 13, 4706, 8297, 29881, 886, 353, 4842, 305, 29889, 1429, 29898, 17987, 29881, 886, 467, 4801, 496, 2141, 21970, 2141, 23749, 580, 13, 4706, 736, 8297, 29881, 886, 13, 13, 1678, 822, 6088, 29918, 18616, 663, 29898, 1311, 29892, 18897, 1125, 13, 4706, 396, 450, 1904, 23347, 529, 21289, 29958, 5993, 472, 278, 1095, 310, 278, 1881, 10541, 13, 4706, 565, 18897, 14352, 29896, 29962, 2804, 9872, 21289, 29958, 1115, 13, 9651, 18897, 29889, 4397, 28945, 21289, 29958, 1159, 13, 4706, 2665, 29918, 3445, 353, 3667, 29879, 29889, 8111, 675, 29918, 9303, 29898, 1311, 29889, 4299, 29892, 18897, 29892, 6694, 29922, 8824, 29892, 330, 3746, 29922, 1311, 29889, 4299, 29889, 1509, 29918, 29887, 3746, 29897, 13, 4706, 289, 814, 29918, 1590, 353, 1583, 29889, 657, 29918, 17987, 29881, 886, 29898, 517, 12360, 29897, 13, 4706, 626, 29878, 353, 1583, 29889, 4299, 29889, 5510, 29918, 18616, 663, 29898, 517, 12360, 29892, 2665, 29918, 3445, 29892, 289, 814, 29918, 1590, 29897, 13, 4706, 736, 626, 29878, 13, 2 ]
tests/test_draw.py
mrtrkmn/yellowbrick
3,662
196841
<gh_stars>1000+ # tests.test_draw # Tests for the high-level drawing utility functions # # Author: <NAME> <<EMAIL>> # Created: Sun Aug 19 11:21:04 2018 -0400 # # ID: test_draw.py [dd915ad] <EMAIL> $ """ Tests for the high-level drawing utility functions """ ########################################################################## ## Imports ########################################################################## import pytest import numpy as np import matplotlib.pyplot as plt from yellowbrick.draw import * from .base import VisualTestCase ########################################################################## ## Simple tests for high-level drawing utilities ########################################################################## def test_manual_legend_uneven_colors(): """ Raise exception when colors and labels are mismatched in manual_legend """ with pytest.raises(YellowbrickValueError, match="same number of colors as labels"): manual_legend(None, ("a", "b", "c"), ("r", "g")) @pytest.fixture(scope="class") def data(request): data = np.array( [ [4, 8, 7, 6, 5, 2, 1], [6, 7, 9, 6, 9, 3, 6], [5, 1, 6, 8, 4, 7, 8], [6, 8, 1, 5, 6, 7, 4], ] ) request.cls.data = data ########################################################################## ## Visual test cases for high-level drawing utilities ########################################################################## @pytest.mark.usefixtures("data") class TestDraw(VisualTestCase): """ Visual tests for the high-level drawing utilities """ def test_manual_legend(self): """ Check that the manual legend is drawn without axes artists """ # Draw a random scatter plot random = np.random.RandomState(42) Ax, Ay = random.normal(50, 2, 100), random.normal(50, 3, 100) Bx, By = random.normal(42, 3, 100), random.normal(44, 1, 100) Cx, Cy = random.normal(20, 10, 100), random.normal(30, 1, 100) _, ax = plt.subplots() ax.scatter(Ax, Ay, c="r", alpha=0.35, label="a") ax.scatter(Bx, By, c="g", alpha=0.35, label="b") ax.scatter(Cx, Cy, c="b", alpha=0.35, label="c") # Add the manual legend manual_legend( ax, ("a", "b", "c"), ("r", "g", "b"), frameon=True, loc="upper left" ) # Assert image similarity self.assert_images_similar(ax=ax, tol=0.5) def test_vertical_bar_stack(self): """ Test bar_stack for vertical orientation """ _, ax = plt.subplots() # Plots stacked bar charts bar_stack(self.data, ax=ax, orientation="v") # Assert image similarity self.assert_images_similar(ax=ax, tol=0.1) def test_horizontal_bar_stack(self): """ Test bar_stack for horizontal orientation """ _, ax = plt.subplots() # Plots stacked bar charts bar_stack(self.data, ax=ax, orientation="h") # Assert image similarity self.assert_images_similar(ax=ax, tol=0.1) def test_single_row_bar_stack(self): """ Test bar_stack for single row """ data = np.array([[4, 8, 7, 6, 5, 2, 1]]) _, ax = plt.subplots() # Plots stacked bar charts bar_stack(data, ax=ax) # Assert image similarity self.assert_images_similar(ax=ax, tol=0.1) def test_labels_vertical(self): """ Test labels and ticks for vertical barcharts """ labels = ["books", "cinema", "cooking", "gaming"] ticks = ["noun", "verb", "adverb", "pronoun", "preposition", "digit", "other"] _, ax = plt.subplots() # Plots stacked bar charts bar_stack(self.data, labels=labels, ticks=ticks, colors=["r", "b", "g", "y"]) # Extract tick labels from the plot ticks_ax = [tick.get_text() for tick in ax.xaxis.get_ticklabels()] # Assert that ticks are set properly assert ticks_ax == ticks # Assert image similarity self.assert_images_similar(ax=ax, tol=0.05) def test_labels_horizontal(self): """ Test labels and ticks with horizontal barcharts """ labels = ["books", "cinema", "cooking", "gaming"] ticks = ["noun", "verb", "adverb", "pronoun", "preposition", "digit", "other"] _, ax = plt.subplots() # Plots stacked bar charts bar_stack( self.data, labels=labels, ticks=ticks, orientation="h", colormap="cool" ) # Extract tick labels from the plot ticks_ax = [tick.get_text() for tick in ax.yaxis.get_ticklabels()] # Assert that ticks are set properly assert ticks_ax == ticks # Assert image similarity self.assert_images_similar(ax=ax, tol=0.05)
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29900, 29900, 29900, 29974, 13, 29937, 6987, 29889, 1688, 29918, 4012, 13, 29937, 4321, 29879, 363, 278, 1880, 29899, 5563, 11580, 19725, 3168, 13, 29937, 13, 29937, 13361, 29901, 29871, 529, 5813, 29958, 3532, 26862, 6227, 6778, 13, 29937, 6760, 630, 29901, 8991, 22333, 29871, 29896, 29929, 29871, 29896, 29896, 29901, 29906, 29896, 29901, 29900, 29946, 29871, 29906, 29900, 29896, 29947, 448, 29900, 29946, 29900, 29900, 13, 29937, 13, 29937, 3553, 29901, 1243, 29918, 4012, 29889, 2272, 518, 1289, 29929, 29896, 29945, 328, 29962, 529, 26862, 6227, 29958, 395, 13, 13, 15945, 29908, 13, 24376, 363, 278, 1880, 29899, 5563, 11580, 19725, 3168, 13, 15945, 29908, 13, 13, 13383, 13383, 13383, 13383, 7346, 2277, 13, 2277, 1954, 4011, 13, 13383, 13383, 13383, 13383, 7346, 2277, 13, 13, 5215, 11451, 1688, 13, 5215, 12655, 408, 7442, 13, 5215, 22889, 29889, 2272, 5317, 408, 14770, 13, 13, 3166, 13328, 1182, 860, 29889, 4012, 1053, 334, 13, 3166, 869, 3188, 1053, 9249, 3057, 8259, 13, 13, 13, 13383, 13383, 13383, 13383, 7346, 2277, 13, 2277, 12545, 6987, 363, 1880, 29899, 5563, 11580, 3667, 1907, 13, 13383, 13383, 13383, 13383, 7346, 2277, 13, 13, 13, 1753, 1243, 29918, 11288, 29918, 26172, 29918, 1540, 854, 29918, 27703, 7295, 13, 1678, 9995, 13, 1678, 6981, 895, 3682, 746, 11955, 322, 11073, 526, 29635, 287, 297, 12219, 29918, 26172, 13, 1678, 9995, 13, 1678, 411, 11451, 1688, 29889, 336, 4637, 29898, 29979, 4743, 1182, 860, 1917, 2392, 29892, 1993, 543, 17642, 1353, 310, 11955, 408, 11073, 29908, 1125, 13, 4706, 12219, 29918, 26172, 29898, 8516, 29892, 4852, 29874, 613, 376, 29890, 613, 376, 29883, 4968, 4852, 29878, 613, 376, 29887, 5783, 13, 13, 13, 29992, 2272, 1688, 29889, 7241, 15546, 29898, 6078, 543, 1990, 1159, 13, 1753, 848, 29898, 3827, 1125, 13, 13, 1678, 848, 353, 7442, 29889, 2378, 29898, 13, 4706, 518, 13, 9651, 518, 29946, 29892, 29871, 29947, 29892, 29871, 29955, 29892, 29871, 29953, 29892, 29871, 29945, 29892, 29871, 29906, 29892, 29871, 29896, 1402, 13, 9651, 518, 29953, 29892, 29871, 29955, 29892, 29871, 29929, 29892, 29871, 29953, 29892, 29871, 29929, 29892, 29871, 29941, 29892, 29871, 29953, 1402, 13, 9651, 518, 29945, 29892, 29871, 29896, 29892, 29871, 29953, 29892, 29871, 29947, 29892, 29871, 29946, 29892, 29871, 29955, 29892, 29871, 29947, 1402, 13, 9651, 518, 29953, 29892, 29871, 29947, 29892, 29871, 29896, 29892, 29871, 29945, 29892, 29871, 29953, 29892, 29871, 29955, 29892, 29871, 29946, 1402, 13, 4706, 4514, 13, 1678, 1723, 13, 13, 1678, 2009, 29889, 25932, 29889, 1272, 353, 848, 13, 13, 13, 13383, 13383, 13383, 13383, 7346, 2277, 13, 2277, 9249, 1243, 4251, 363, 1880, 29899, 5563, 11580, 3667, 1907, 13, 13383, 13383, 13383, 13383, 7346, 2277, 13, 13, 13, 29992, 2272, 1688, 29889, 3502, 29889, 1509, 7241, 486, 1973, 703, 1272, 1159, 13, 1990, 4321, 8537, 29898, 16227, 3057, 8259, 1125, 13, 1678, 9995, 13, 1678, 9249, 6987, 363, 278, 1880, 29899, 5563, 11580, 3667, 1907, 13, 1678, 9995, 13, 13, 1678, 822, 1243, 29918, 11288, 29918, 26172, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 5399, 393, 278, 12219, 15983, 338, 12061, 1728, 27815, 17906, 13, 4706, 9995, 13, 4706, 396, 18492, 263, 4036, 14801, 6492, 13, 4706, 4036, 353, 7442, 29889, 8172, 29889, 17875, 2792, 29898, 29946, 29906, 29897, 13, 13, 4706, 22523, 29892, 15846, 353, 4036, 29889, 8945, 29898, 29945, 29900, 29892, 29871, 29906, 29892, 29871, 29896, 29900, 29900, 511, 4036, 29889, 8945, 29898, 29945, 29900, 29892, 29871, 29941, 29892, 29871, 29896, 29900, 29900, 29897, 13, 4706, 350, 29916, 29892, 2648, 353, 4036, 29889, 8945, 29898, 29946, 29906, 29892, 29871, 29941, 29892, 29871, 29896, 29900, 29900, 511, 4036, 29889, 8945, 29898, 29946, 29946, 29892, 29871, 29896, 29892, 29871, 29896, 29900, 29900, 29897, 13, 4706, 315, 29916, 29892, 8045, 353, 4036, 29889, 8945, 29898, 29906, 29900, 29892, 29871, 29896, 29900, 29892, 29871, 29896, 29900, 29900, 511, 4036, 29889, 8945, 29898, 29941, 29900, 29892, 29871, 29896, 29892, 29871, 29896, 29900, 29900, 29897, 13, 13, 4706, 17117, 4853, 353, 14770, 29889, 1491, 26762, 580, 13, 4706, 4853, 29889, 1557, 2620, 29898, 29909, 29916, 29892, 15846, 29892, 274, 543, 29878, 613, 15595, 29922, 29900, 29889, 29941, 29945, 29892, 3858, 543, 29874, 1159, 13, 4706, 4853, 29889, 1557, 2620, 29898, 29933, 29916, 29892, 2648, 29892, 274, 543, 29887, 613, 15595, 29922, 29900, 29889, 29941, 29945, 29892, 3858, 543, 29890, 1159, 13, 4706, 4853, 29889, 1557, 2620, 29898, 29907, 29916, 29892, 8045, 29892, 274, 543, 29890, 613, 15595, 29922, 29900, 29889, 29941, 29945, 29892, 3858, 543, 29883, 1159, 13, 13, 4706, 396, 3462, 278, 12219, 15983, 13, 4706, 12219, 29918, 26172, 29898, 13, 9651, 4853, 29892, 4852, 29874, 613, 376, 29890, 613, 376, 29883, 4968, 4852, 29878, 613, 376, 29887, 613, 376, 29890, 4968, 3515, 265, 29922, 5574, 29892, 1180, 543, 21064, 2175, 29908, 13, 4706, 1723, 13, 13, 4706, 396, 16499, 1967, 29501, 13, 4706, 1583, 29889, 9294, 29918, 8346, 29918, 29764, 29898, 1165, 29922, 1165, 29892, 304, 29880, 29922, 29900, 29889, 29945, 29897, 13, 13, 1678, 822, 1243, 29918, 18575, 29918, 1646, 29918, 1429, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 4321, 2594, 29918, 1429, 363, 11408, 19843, 13, 4706, 9995, 13, 4706, 17117, 4853, 353, 14770, 29889, 1491, 26762, 580, 13, 13, 4706, 396, 1858, 1862, 5096, 287, 2594, 24469, 13, 4706, 2594, 29918, 1429, 29898, 1311, 29889, 1272, 29892, 4853, 29922, 1165, 29892, 19843, 543, 29894, 1159, 13, 13, 4706, 396, 16499, 1967, 29501, 13, 4706, 1583, 29889, 9294, 29918, 8346, 29918, 29764, 29898, 1165, 29922, 1165, 29892, 304, 29880, 29922, 29900, 29889, 29896, 29897, 13, 13, 1678, 822, 1243, 29918, 22672, 29918, 1646, 29918, 1429, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 4321, 2594, 29918, 1429, 363, 14698, 19843, 13, 4706, 9995, 13, 4706, 17117, 4853, 353, 14770, 29889, 1491, 26762, 580, 13, 4706, 396, 1858, 1862, 5096, 287, 2594, 24469, 13, 4706, 2594, 29918, 1429, 29898, 1311, 29889, 1272, 29892, 4853, 29922, 1165, 29892, 19843, 543, 29882, 1159, 13, 13, 4706, 396, 16499, 1967, 29501, 13, 4706, 1583, 29889, 9294, 29918, 8346, 29918, 29764, 29898, 1165, 29922, 1165, 29892, 304, 29880, 29922, 29900, 29889, 29896, 29897, 13, 13, 1678, 822, 1243, 29918, 14369, 29918, 798, 29918, 1646, 29918, 1429, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 4321, 2594, 29918, 1429, 363, 2323, 1948, 13, 4706, 9995, 13, 4706, 848, 353, 7442, 29889, 2378, 4197, 29961, 29946, 29892, 29871, 29947, 29892, 29871, 29955, 29892, 29871, 29953, 29892, 29871, 29945, 29892, 29871, 29906, 29892, 29871, 29896, 24960, 13, 13, 4706, 17117, 4853, 353, 14770, 29889, 1491, 26762, 580, 13, 13, 4706, 396, 1858, 1862, 5096, 287, 2594, 24469, 13, 4706, 2594, 29918, 1429, 29898, 1272, 29892, 4853, 29922, 1165, 29897, 13, 13, 4706, 396, 16499, 1967, 29501, 13, 4706, 1583, 29889, 9294, 29918, 8346, 29918, 29764, 29898, 1165, 29922, 1165, 29892, 304, 29880, 29922, 29900, 29889, 29896, 29897, 13, 13, 1678, 822, 1243, 29918, 21134, 29918, 18575, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 4321, 11073, 322, 260, 7358, 363, 11408, 289, 1279, 5708, 13, 4706, 9995, 13, 4706, 11073, 353, 6796, 12733, 613, 376, 16381, 2603, 613, 376, 15108, 292, 613, 376, 29887, 11500, 3108, 13, 4706, 260, 7358, 353, 6796, 29876, 1309, 613, 376, 18248, 613, 376, 328, 18248, 613, 376, 558, 265, 1309, 613, 376, 1457, 3283, 613, 376, 26204, 613, 376, 1228, 3108, 13, 4706, 17117, 4853, 353, 14770, 29889, 1491, 26762, 580, 13, 13, 4706, 396, 1858, 1862, 5096, 287, 2594, 24469, 13, 4706, 2594, 29918, 1429, 29898, 1311, 29889, 1272, 29892, 11073, 29922, 21134, 29892, 260, 7358, 29922, 29873, 7358, 29892, 11955, 29922, 3366, 29878, 613, 376, 29890, 613, 376, 29887, 613, 376, 29891, 20068, 13, 13, 4706, 396, 7338, 1461, 16892, 11073, 515, 278, 6492, 13, 4706, 260, 7358, 29918, 1165, 353, 518, 24667, 29889, 657, 29918, 726, 580, 363, 16892, 297, 4853, 29889, 29916, 8990, 29889, 657, 29918, 24667, 21134, 580, 29962, 13, 4706, 396, 16499, 393, 260, 7358, 526, 731, 6284, 13, 4706, 4974, 260, 7358, 29918, 1165, 1275, 260, 7358, 13, 13, 4706, 396, 16499, 1967, 29501, 13, 4706, 1583, 29889, 9294, 29918, 8346, 29918, 29764, 29898, 1165, 29922, 1165, 29892, 304, 29880, 29922, 29900, 29889, 29900, 29945, 29897, 13, 13, 1678, 822, 1243, 29918, 21134, 29918, 22672, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 4321, 11073, 322, 260, 7358, 411, 14698, 289, 1279, 5708, 13, 4706, 9995, 13, 4706, 11073, 353, 6796, 12733, 613, 376, 16381, 2603, 613, 376, 15108, 292, 613, 376, 29887, 11500, 3108, 13, 4706, 260, 7358, 353, 6796, 29876, 1309, 613, 376, 18248, 613, 376, 328, 18248, 613, 376, 558, 265, 1309, 613, 376, 1457, 3283, 613, 376, 26204, 613, 376, 1228, 3108, 13, 4706, 17117, 4853, 353, 14770, 29889, 1491, 26762, 580, 13, 13, 4706, 396, 1858, 1862, 5096, 287, 2594, 24469, 13, 4706, 2594, 29918, 1429, 29898, 13, 9651, 1583, 29889, 1272, 29892, 11073, 29922, 21134, 29892, 260, 7358, 29922, 29873, 7358, 29892, 19843, 543, 29882, 613, 784, 555, 481, 543, 1111, 324, 29908, 13, 4706, 1723, 13, 13, 4706, 396, 7338, 1461, 16892, 11073, 515, 278, 6492, 13, 4706, 260, 7358, 29918, 1165, 353, 518, 24667, 29889, 657, 29918, 726, 580, 363, 16892, 297, 4853, 29889, 29891, 8990, 29889, 657, 29918, 24667, 21134, 580, 29962, 13, 4706, 396, 16499, 393, 260, 7358, 526, 731, 6284, 13, 4706, 4974, 260, 7358, 29918, 1165, 1275, 260, 7358, 13, 13, 4706, 396, 16499, 1967, 29501, 13, 4706, 1583, 29889, 9294, 29918, 8346, 29918, 29764, 29898, 1165, 29922, 1165, 29892, 304, 29880, 29922, 29900, 29889, 29900, 29945, 29897, 13, 2 ]
code/test_trend.py
baolintian/Timeseries_feature_test
0
62872
import pytest from feature_judge import * from util import * def test_monotone_increase(): timeseries_name = "root.CNNP.QF.1#.QF1RCP604MP" config_path = "../config/" + timeseries_name image_path = "../images/" + timeseries_name timeseries_path = "../data/" + timeseries_name + ".csv" trend_config, threshold_config, resample_frequency = read_config(config_path) timeseries = read_timeseries(timeseries_path, str(resample_frequency) + "min") Dplot = 'yes' s_tf = trend_features(timeseries, timeseries_name + ".numvalue", trend_config, image_path, Dplot) assert s_tf == [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0] def test_wave(): timeseries_name = "wave_test" config_path = "../config/" + timeseries_name image_path = "../images/" + timeseries_name timeseries_path = "../data/" + timeseries_name + ".csv" trend_config, threshold_config, resample_frequency = read_config(config_path) timeseries = read_timeseries(timeseries_path, str(resample_frequency) + "min") Dplot = 'yes' s_tf = trend_features(timeseries, timeseries_name, trend_config, image_path, Dplot) assert s_tf == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]
[ 1, 1053, 11451, 1688, 13, 3166, 4682, 29918, 17675, 479, 1053, 334, 13, 3166, 3667, 1053, 334, 13, 13, 1753, 1243, 29918, 3712, 327, 650, 29918, 262, 1037, 559, 7295, 13, 1678, 3064, 6358, 29918, 978, 353, 376, 4632, 29889, 29907, 10262, 29925, 29889, 29984, 29943, 29889, 29896, 29937, 29889, 29984, 29943, 29896, 29934, 6271, 29953, 29900, 29946, 3580, 29908, 13, 1678, 2295, 29918, 2084, 353, 376, 6995, 2917, 12975, 718, 3064, 6358, 29918, 978, 13, 1678, 1967, 29918, 2084, 353, 376, 6995, 8346, 12975, 718, 3064, 6358, 29918, 978, 13, 1678, 3064, 6358, 29918, 2084, 353, 376, 6995, 1272, 12975, 718, 3064, 6358, 29918, 978, 718, 11393, 7638, 29908, 13, 1678, 534, 355, 29918, 2917, 29892, 16897, 29918, 2917, 29892, 620, 981, 29918, 10745, 23860, 353, 1303, 29918, 2917, 29898, 2917, 29918, 2084, 29897, 13, 1678, 3064, 6358, 353, 1303, 29918, 3706, 6358, 29898, 3706, 6358, 29918, 2084, 29892, 851, 29898, 690, 981, 29918, 10745, 23860, 29897, 718, 376, 1195, 1159, 13, 1678, 360, 5317, 353, 525, 3582, 29915, 13, 1678, 269, 29918, 13264, 353, 534, 355, 29918, 22100, 29898, 3706, 6358, 29892, 3064, 6358, 29918, 978, 718, 11393, 1949, 1767, 613, 534, 355, 29918, 2917, 29892, 1967, 29918, 2084, 29892, 360, 5317, 29897, 13, 1678, 4974, 269, 29918, 13264, 1275, 518, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29896, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29962, 13, 13, 13, 1753, 1243, 29918, 27766, 7295, 13, 1678, 3064, 6358, 29918, 978, 353, 376, 27766, 29918, 1688, 29908, 13, 1678, 2295, 29918, 2084, 353, 376, 6995, 2917, 12975, 718, 3064, 6358, 29918, 978, 13, 1678, 1967, 29918, 2084, 353, 376, 6995, 8346, 12975, 718, 3064, 6358, 29918, 978, 13, 1678, 3064, 6358, 29918, 2084, 353, 376, 6995, 1272, 12975, 718, 3064, 6358, 29918, 978, 718, 11393, 7638, 29908, 13, 1678, 534, 355, 29918, 2917, 29892, 16897, 29918, 2917, 29892, 620, 981, 29918, 10745, 23860, 353, 1303, 29918, 2917, 29898, 2917, 29918, 2084, 29897, 13, 1678, 3064, 6358, 353, 1303, 29918, 3706, 6358, 29898, 3706, 6358, 29918, 2084, 29892, 851, 29898, 690, 981, 29918, 10745, 23860, 29897, 718, 376, 1195, 1159, 13, 1678, 360, 5317, 353, 525, 3582, 29915, 13, 1678, 269, 29918, 13264, 353, 534, 355, 29918, 22100, 29898, 3706, 6358, 29892, 3064, 6358, 29918, 978, 29892, 534, 355, 29918, 2917, 29892, 1967, 29918, 2084, 29892, 360, 5317, 29897, 13, 1678, 4974, 269, 29918, 13264, 1275, 518, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29896, 29962, 13, 2 ]
ros2_batch_job/vendor/osrf_pycommon/tests/unit/test_process_utils/impl_aep_trollius.py
taewoong0627/ci
31
187293
from osrf_pycommon.process_utils import asyncio from osrf_pycommon.process_utils.async_execute_process import async_execute_process from osrf_pycommon.process_utils import get_loop # allow module to be importable for --cover-inclusive try: from osrf_pycommon.process_utils.async_execute_process_trollius import From except ImportError: TROLLIUS_FOUND = False else: TROLLIUS_FOUND = True from osrf_pycommon.process_utils.async_execute_process_trollius import Return from .impl_aep_protocol import create_protocol loop = get_loop() @asyncio.coroutine def run(cmd, **kwargs): transport, protocol = yield From(async_execute_process( create_protocol(), cmd, **kwargs)) retcode = yield asyncio.From(protocol.complete) raise Return(protocol.stdout_buffer, protocol.stderr_buffer, retcode)
[ 1, 515, 2897, 9600, 29918, 2272, 9435, 29889, 5014, 29918, 13239, 1053, 408, 948, 3934, 13, 3166, 2897, 9600, 29918, 2272, 9435, 29889, 5014, 29918, 13239, 29889, 12674, 29918, 7978, 29918, 5014, 1053, 7465, 29918, 7978, 29918, 5014, 13, 3166, 2897, 9600, 29918, 2272, 9435, 29889, 5014, 29918, 13239, 1053, 679, 29918, 7888, 13, 13, 29937, 2758, 3883, 304, 367, 1053, 519, 363, 1192, 11911, 29899, 262, 7009, 573, 13, 2202, 29901, 13, 1678, 515, 2897, 9600, 29918, 2272, 9435, 29889, 5014, 29918, 13239, 29889, 12674, 29918, 7978, 29918, 5014, 29918, 29873, 1467, 19646, 1053, 3645, 13, 19499, 16032, 2392, 29901, 13, 1678, 323, 1672, 2208, 29902, 3308, 29918, 5800, 18783, 353, 7700, 13, 2870, 29901, 13, 1678, 323, 1672, 2208, 29902, 3308, 29918, 5800, 18783, 353, 5852, 13, 13, 1678, 515, 2897, 9600, 29918, 2272, 9435, 29889, 5014, 29918, 13239, 29889, 12674, 29918, 7978, 29918, 5014, 29918, 29873, 1467, 19646, 1053, 7106, 13, 13, 1678, 515, 869, 13699, 29918, 29874, 1022, 29918, 20464, 1053, 1653, 29918, 20464, 13, 13, 1678, 2425, 353, 679, 29918, 7888, 580, 13, 13, 1678, 732, 294, 948, 3934, 29889, 2616, 449, 457, 13, 1678, 822, 1065, 29898, 9006, 29892, 3579, 19290, 1125, 13, 4706, 8608, 29892, 9608, 353, 7709, 3645, 29898, 12674, 29918, 7978, 29918, 5014, 29898, 13, 9651, 1653, 29918, 20464, 3285, 9920, 29892, 3579, 19290, 876, 13, 4706, 3240, 401, 353, 7709, 408, 948, 3934, 29889, 4591, 29898, 20464, 29889, 8835, 29897, 13, 4706, 12020, 7106, 29898, 20464, 29889, 25393, 29918, 9040, 29892, 9608, 29889, 303, 20405, 29918, 9040, 29892, 13, 462, 268, 3240, 401, 29897, 13, 2 ]