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
|
---|---|---|---|---|---|
revasbot/revas_calculations.py | iwo-strzebonski/SeleBot | 0 | 176568 | class RevasCalculations:
'''Functions related to calculations go there
'''
pass
| [
1,
770,
830,
4428,
27065,
800,
29901,
13,
1678,
14550,
6678,
29879,
4475,
304,
17203,
748,
727,
13,
1678,
14550,
13,
1678,
1209,
13,
2
] |
biosimulators_test_suite/results/data_model.py | Ryannjordan/Biosimulators_test_suite | 0 | 17389 | """ Data model for results of test cases
:Author: <NAME> <<EMAIL>>
:Date: 2021-01-01
:Copyright: 2021, Center for Reproducible Biomedical Modeling
:License: MIT
"""
from .._version import __version__
from ..warnings import TestCaseWarning # noqa: F401
import enum
__all__ = [
'TestCaseResultType',
'TestCaseResult',
'TestResultsReport',
]
class TestCaseResultType(str, enum.Enum):
""" Type of test case result """
passed = 'passed'
failed = 'failed'
skipped = 'skipped'
class TestCaseResult(object):
""" A result of executing a test case
Attributes:
case (:obj:`TestCase`): test case
type (:obj:`obj:`TestCaseResultType`): type
duration (:obj:`float`): execution duration in seconds
exception (:obj:`Exception`): exception
warnings (:obj:`list` of :obj:`TestCaseWarning`): warnings
skip_reason (:obj:`Exception`): Exception which explains reason for skip
log (:obj:`str`): log of execution
"""
def __init__(self, case=None, type=None, duration=None, exception=None, warnings=None, skip_reason=None, log=None):
"""
Args:
case (:obj:`TestCase`, optional): test case
type (:obj:`obj:`TestCaseResultType`, optional): type
duration (:obj:`float`, optional): execution duration in seconds
exception (:obj:`Exception`, optional): exception
warnings (:obj:`list` of :obj:`TestCaseWarning`, optional): warnings
skip_reason (:obj:`Exception`, optional): Exception which explains reason for skip
log (:obj:`str`, optional): log of execution
"""
self.case = case
self.type = type
self.duration = duration
self.exception = exception
self.warnings = warnings or []
self.skip_reason = skip_reason
self.log = log
def to_dict(self):
""" Generate a dictionary representation e.g., for export to JSON
Returns:
:obj:`dict`: dictionary representation
"""
return {
'case': {
'id': self.case.id,
'description': self.case.description,
},
'resultType': self.type.value,
'duration': self.duration,
'exception': {
'category': self.exception.__class__.__name__,
'message': str(self.exception),
} if self.exception else None,
'warnings': [{'category': warning.category.__name__, 'message': str(warning.message)}
for warning in self.warnings],
'skipReason': {
'category': self.skip_reason.__class__.__name__,
'message': str(self.skip_reason),
} if self.skip_reason else None,
'log': self.log,
}
class TestResultsReport(object):
""" A report of the results of executing the test suite with a simulation tool
Attributes:
test_suite_version (:obj:`str`): version of the test suite which was executed
results (:obj:`list` of :obj:`TestCaseResult`): results of the test cases of the test suite
gh_issue (:obj:`int`): GitHub issue for which the test suite was executed
gh_action_run (:obj:`int`): GitHub action run in which the test suite was executed
"""
def __init__(self, test_suite_version=__version__, results=None, gh_issue=None, gh_action_run=None):
"""
Args:
test_suite_version (:obj:`str`, optional): version of the test suite which was executed
results (:obj:`list` of :obj:`TestCaseResult`, optional): results of the test cases of the test suite
gh_issue (:obj:`int`, optional): GitHub issue for which the test suite was executed
gh_action_run (:obj:`int`, optional): GitHub action run in which the test suite was executed
"""
self.test_suite_version = test_suite_version
self.results = results or []
self.gh_issue = gh_issue
self.gh_action_run = gh_action_run
def to_dict(self):
""" Generate a dictionary representation e.g., for export to JSON
Returns:
:obj:`dict`: dictionary representation
"""
return {
'testSuiteVersion': self.test_suite_version,
'results': [result.to_dict() for result in self.results],
'ghIssue': self.gh_issue,
'ghActionRun': self.gh_action_run,
}
| [
1,
9995,
3630,
1904,
363,
2582,
310,
1243,
4251,
13,
13,
29901,
13720,
29901,
529,
5813,
29958,
3532,
26862,
6227,
6778,
13,
29901,
2539,
29901,
29871,
29906,
29900,
29906,
29896,
29899,
29900,
29896,
29899,
29900,
29896,
13,
29901,
11882,
1266,
29901,
29871,
29906,
29900,
29906,
29896,
29892,
7817,
363,
830,
5498,
15520,
3457,
27067,
936,
8125,
292,
13,
29901,
29931,
293,
1947,
29901,
341,
1806,
13,
15945,
29908,
13,
13,
3166,
6317,
29918,
3259,
1053,
4770,
3259,
1649,
13,
3166,
6317,
25442,
886,
1053,
4321,
8259,
22709,
29871,
396,
694,
25621,
29901,
383,
29946,
29900,
29896,
13,
5215,
14115,
13,
13,
1649,
497,
1649,
353,
518,
13,
1678,
525,
3057,
8259,
3591,
1542,
742,
13,
1678,
525,
3057,
8259,
3591,
742,
13,
1678,
525,
3057,
12191,
13020,
742,
13,
29962,
13,
13,
13,
1990,
4321,
8259,
3591,
1542,
29898,
710,
29892,
14115,
29889,
16854,
1125,
13,
1678,
9995,
5167,
310,
1243,
1206,
1121,
9995,
13,
1678,
4502,
353,
525,
3364,
287,
29915,
13,
1678,
5229,
353,
525,
26061,
29915,
13,
1678,
14993,
2986,
353,
525,
2574,
2986,
29915,
13,
13,
13,
1990,
4321,
8259,
3591,
29898,
3318,
1125,
13,
1678,
9995,
319,
1121,
310,
14012,
263,
1243,
1206,
13,
13,
1678,
6212,
5026,
29901,
13,
4706,
1206,
13940,
5415,
18078,
3057,
8259,
29952,
1125,
1243,
1206,
13,
4706,
1134,
13940,
5415,
18078,
5415,
18078,
3057,
8259,
3591,
1542,
29952,
1125,
1134,
13,
4706,
14385,
13940,
5415,
18078,
7411,
29952,
1125,
8225,
14385,
297,
6923,
13,
4706,
3682,
13940,
5415,
18078,
2451,
29952,
1125,
3682,
13,
4706,
18116,
13940,
5415,
18078,
1761,
29952,
310,
584,
5415,
18078,
3057,
8259,
22709,
29952,
1125,
18116,
13,
4706,
14383,
29918,
23147,
13940,
5415,
18078,
2451,
29952,
1125,
8960,
607,
18568,
2769,
363,
14383,
13,
4706,
1480,
13940,
5415,
18078,
710,
29952,
1125,
1480,
310,
8225,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1206,
29922,
8516,
29892,
1134,
29922,
8516,
29892,
14385,
29922,
8516,
29892,
3682,
29922,
8516,
29892,
18116,
29922,
8516,
29892,
14383,
29918,
23147,
29922,
8516,
29892,
1480,
29922,
8516,
1125,
13,
4706,
9995,
13,
4706,
826,
3174,
29901,
13,
9651,
1206,
13940,
5415,
18078,
3057,
8259,
1673,
13136,
1125,
1243,
1206,
13,
9651,
1134,
13940,
5415,
18078,
5415,
18078,
3057,
8259,
3591,
1542,
1673,
13136,
1125,
1134,
13,
9651,
14385,
13940,
5415,
18078,
7411,
1673,
13136,
1125,
8225,
14385,
297,
6923,
13,
9651,
3682,
13940,
5415,
18078,
2451,
1673,
13136,
1125,
3682,
13,
9651,
18116,
13940,
5415,
18078,
1761,
29952,
310,
584,
5415,
18078,
3057,
8259,
22709,
1673,
13136,
1125,
18116,
13,
9651,
14383,
29918,
23147,
13940,
5415,
18078,
2451,
1673,
13136,
1125,
8960,
607,
18568,
2769,
363,
14383,
13,
9651,
1480,
13940,
5415,
18078,
710,
1673,
13136,
1125,
1480,
310,
8225,
13,
4706,
9995,
13,
4706,
1583,
29889,
4878,
353,
1206,
13,
4706,
1583,
29889,
1853,
353,
1134,
13,
4706,
1583,
29889,
19708,
353,
14385,
13,
4706,
1583,
29889,
11739,
353,
3682,
13,
4706,
1583,
29889,
25442,
886,
353,
18116,
470,
5159,
13,
4706,
1583,
29889,
11014,
29918,
23147,
353,
14383,
29918,
23147,
13,
4706,
1583,
29889,
1188,
353,
1480,
13,
13,
1678,
822,
304,
29918,
8977,
29898,
1311,
1125,
13,
4706,
9995,
3251,
403,
263,
8600,
8954,
321,
29889,
29887,
1696,
363,
5609,
304,
4663,
13,
13,
4706,
16969,
29901,
13,
9651,
584,
5415,
18078,
8977,
6998,
8600,
8954,
13,
4706,
9995,
13,
4706,
736,
426,
13,
9651,
525,
4878,
2396,
426,
13,
18884,
525,
333,
2396,
1583,
29889,
4878,
29889,
333,
29892,
13,
18884,
525,
8216,
2396,
1583,
29889,
4878,
29889,
8216,
29892,
13,
9651,
2981,
13,
9651,
525,
2914,
1542,
2396,
1583,
29889,
1853,
29889,
1767,
29892,
13,
9651,
525,
19708,
2396,
1583,
29889,
19708,
29892,
13,
9651,
525,
11739,
2396,
426,
13,
18884,
525,
7320,
2396,
1583,
29889,
11739,
17255,
1990,
1649,
17255,
978,
1649,
29892,
13,
18884,
525,
4906,
2396,
851,
29898,
1311,
29889,
11739,
511,
13,
9651,
500,
565,
1583,
29889,
11739,
1683,
6213,
29892,
13,
9651,
525,
25442,
886,
2396,
518,
10998,
7320,
2396,
9177,
29889,
7320,
17255,
978,
1649,
29892,
525,
4906,
2396,
851,
29898,
27392,
29889,
4906,
2915,
13,
462,
308,
363,
9177,
297,
1583,
29889,
25442,
886,
1402,
13,
9651,
525,
11014,
1123,
1658,
2396,
426,
13,
18884,
525,
7320,
2396,
1583,
29889,
11014,
29918,
23147,
17255,
1990,
1649,
17255,
978,
1649,
29892,
13,
18884,
525,
4906,
2396,
851,
29898,
1311,
29889,
11014,
29918,
23147,
511,
13,
9651,
500,
565,
1583,
29889,
11014,
29918,
23147,
1683,
6213,
29892,
13,
9651,
525,
1188,
2396,
1583,
29889,
1188,
29892,
13,
4706,
500,
13,
13,
13,
1990,
4321,
12191,
13020,
29898,
3318,
1125,
13,
1678,
9995,
319,
3461,
310,
278,
2582,
310,
14012,
278,
1243,
9460,
411,
263,
17402,
5780,
13,
13,
1678,
6212,
5026,
29901,
13,
4706,
1243,
29918,
13495,
29918,
3259,
13940,
5415,
18078,
710,
29952,
1125,
1873,
310,
278,
1243,
9460,
607,
471,
8283,
13,
4706,
2582,
13940,
5415,
18078,
1761,
29952,
310,
584,
5415,
18078,
3057,
8259,
3591,
29952,
1125,
2582,
310,
278,
1243,
4251,
310,
278,
1243,
9460,
13,
4706,
24170,
29918,
15118,
13940,
5415,
18078,
524,
29952,
1125,
25492,
2228,
363,
607,
278,
1243,
9460,
471,
8283,
13,
4706,
24170,
29918,
2467,
29918,
3389,
13940,
5415,
18078,
524,
29952,
1125,
25492,
3158,
1065,
297,
607,
278,
1243,
9460,
471,
8283,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1243,
29918,
13495,
29918,
3259,
29922,
1649,
3259,
1649,
29892,
2582,
29922,
8516,
29892,
24170,
29918,
15118,
29922,
8516,
29892,
24170,
29918,
2467,
29918,
3389,
29922,
8516,
1125,
13,
4706,
9995,
13,
4706,
826,
3174,
29901,
13,
9651,
1243,
29918,
13495,
29918,
3259,
13940,
5415,
18078,
710,
1673,
13136,
1125,
1873,
310,
278,
1243,
9460,
607,
471,
8283,
13,
9651,
2582,
13940,
5415,
18078,
1761,
29952,
310,
584,
5415,
18078,
3057,
8259,
3591,
1673,
13136,
1125,
2582,
310,
278,
1243,
4251,
310,
278,
1243,
9460,
13,
9651,
24170,
29918,
15118,
13940,
5415,
18078,
524,
1673,
13136,
1125,
25492,
2228,
363,
607,
278,
1243,
9460,
471,
8283,
13,
9651,
24170,
29918,
2467,
29918,
3389,
13940,
5415,
18078,
524,
1673,
13136,
1125,
25492,
3158,
1065,
297,
607,
278,
1243,
9460,
471,
8283,
13,
4706,
9995,
13,
4706,
1583,
29889,
1688,
29918,
13495,
29918,
3259,
353,
1243,
29918,
13495,
29918,
3259,
13,
4706,
1583,
29889,
9902,
353,
2582,
470,
5159,
13,
4706,
1583,
29889,
12443,
29918,
15118,
353,
24170,
29918,
15118,
13,
4706,
1583,
29889,
12443,
29918,
2467,
29918,
3389,
353,
24170,
29918,
2467,
29918,
3389,
13,
13,
1678,
822,
304,
29918,
8977,
29898,
1311,
1125,
13,
4706,
9995,
3251,
403,
263,
8600,
8954,
321,
29889,
29887,
1696,
363,
5609,
304,
4663,
13,
13,
4706,
16969,
29901,
13,
9651,
584,
5415,
18078,
8977,
6998,
8600,
8954,
13,
4706,
9995,
13,
4706,
736,
426,
13,
9651,
525,
1688,
5091,
568,
6594,
2396,
1583,
29889,
1688,
29918,
13495,
29918,
3259,
29892,
13,
9651,
525,
9902,
2396,
518,
2914,
29889,
517,
29918,
8977,
580,
363,
1121,
297,
1583,
29889,
9902,
1402,
13,
9651,
525,
12443,
29902,
893,
434,
2396,
1583,
29889,
12443,
29918,
15118,
29892,
13,
9651,
525,
12443,
4276,
6558,
2396,
1583,
29889,
12443,
29918,
2467,
29918,
3389,
29892,
13,
4706,
500,
13,
2
] |
django_sqlprint_middleware/__init__.py | thebjorn/django-sqlprint-middleware | 1 | 1616599 | <gh_stars>1-10
# -*- coding: utf-8 -*-
"""
==========================
django-sqlprint-middleware
==========================
Middleware that pretty prints Django's sql statements.
Installation
------------
Install from PyPI::
pip install django-sqlprint-middleware
then add it to the `MIDDLEWARE_CLASSES` settings in your `settings.py` file::
MIDDLEWARE_CLASSES = (
...
'django_sqlprint_middleware.SqlPrintMiddleware',
...
)
This middleware is not order sensitive so you can put it at any position in
the list of classes.
Settings
--------
The following settings control the behavior (all of these have defaults).
DEBUG or TESTING
Either of these need to be True for the middleware to run.
SQLPRINT_MIDDLEWARE
Set to False to skip middleware without removing it.
X_DB_HITS
Set to false to prevent db hits being sent in the response header 'X-DB-hits'
SQLPRINT_MAX_QUERIES
Raise an exception if the number of queries for a view is greater than this.
Default is 1200 (zero means no check).
SQLPRINT_MIN_QUERIES
For less output you can set this to the number of queries a view can make before
querires are printed (default is zero).
"""
__version__ = '0.1.3'
from .django_sqlprint_middleware import SqlPrintMiddleware
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
15945,
29908,
13,
9166,
4936,
1360,
13,
14095,
29899,
2850,
2158,
29899,
17662,
2519,
13,
9166,
4936,
1360,
13,
13,
25411,
2519,
393,
5051,
14677,
15337,
29915,
29879,
4576,
9506,
29889,
13,
13,
23271,
362,
13,
9072,
13,
23271,
515,
10772,
2227,
1057,
13,
13,
1678,
8450,
2601,
9557,
29899,
2850,
2158,
29899,
17662,
2519,
13,
13,
6098,
788,
372,
304,
278,
421,
29924,
1367,
29928,
1307,
12982,
1525,
29918,
6154,
3289,
1660,
29903,
29952,
6055,
297,
596,
421,
11027,
29889,
2272,
29952,
934,
1057,
13,
13,
1678,
341,
1367,
29928,
1307,
12982,
1525,
29918,
6154,
3289,
1660,
29903,
353,
313,
13,
4706,
2023,
13,
4706,
525,
14095,
29918,
2850,
2158,
29918,
17662,
2519,
29889,
10520,
11816,
25411,
2519,
742,
13,
4706,
2023,
13,
1678,
1723,
13,
13,
4013,
7256,
2519,
338,
451,
1797,
20502,
577,
366,
508,
1925,
372,
472,
738,
2602,
297,
13,
1552,
1051,
310,
4413,
29889,
13,
13,
13,
9585,
13,
1378,
13,
1576,
1494,
6055,
2761,
278,
6030,
313,
497,
310,
1438,
505,
21274,
467,
13,
13,
18525,
470,
17067,
1254,
4214,
13,
1678,
20370,
310,
1438,
817,
304,
367,
5852,
363,
278,
7256,
2519,
304,
1065,
29889,
13,
13,
4176,
10593,
10192,
29918,
29924,
1367,
29928,
1307,
12982,
1525,
13,
1678,
3789,
304,
7700,
304,
14383,
7256,
2519,
1728,
11077,
372,
29889,
13,
13,
29990,
29918,
4051,
29918,
29950,
1806,
29903,
13,
1678,
3789,
304,
2089,
304,
5557,
4833,
19572,
1641,
2665,
297,
278,
2933,
4839,
525,
29990,
29899,
4051,
29899,
29882,
1169,
29915,
13,
13,
4176,
10593,
10192,
29918,
12648,
29918,
13356,
1001,
29059,
13,
1678,
6981,
895,
385,
3682,
565,
278,
1353,
310,
9365,
363,
263,
1776,
338,
7621,
1135,
445,
29889,
13,
1678,
13109,
338,
29871,
29896,
29906,
29900,
29900,
313,
9171,
2794,
694,
1423,
467,
13,
13,
4176,
10593,
10192,
29918,
16173,
29918,
13356,
1001,
29059,
13,
1678,
1152,
3109,
1962,
366,
508,
731,
445,
304,
278,
1353,
310,
9365,
263,
1776,
508,
1207,
1434,
13,
1678,
22320,
2658,
526,
13350,
313,
4381,
338,
5225,
467,
13,
13,
15945,
29908,
13,
1649,
3259,
1649,
353,
525,
29900,
29889,
29896,
29889,
29941,
29915,
13,
13,
3166,
869,
14095,
29918,
2850,
2158,
29918,
17662,
2519,
1053,
13093,
11816,
25411,
2519,
13,
2
] |
cursor/device.py | brendanhowell/cursor | 3 | 74391 | <gh_stars>1-10
from cursor import data
from cursor import renderer
from enum import Enum
import wasabi
import inspect
import hashlib
log = wasabi.Printer()
class MinMax:
def __init__(self, minx: int, maxx: int, miny: int, maxy: int):
self.minx = minx
self.maxx = maxx
self.miny = miny
self.maxy = maxy
def center(self):
return (self.minx + self.maxx) / 2, (self.miny + self.maxy) / 2
def tuple(self):
return self.minx, self.maxx, self.miny, self.maxy
class PlotterType(Enum):
ROLAND_DPX3300 = 0
DIY_PLOTTER = 1
AXIDRAW = 2
HP_7475A_A4 = 3
HP_7475A_A3 = 4
ROLAND_DXY1200 = 5
ROLAND_DXY980 = 6
HP_7595A = 7
ROLAND_PNC1000 = 8
ROLAND_DPX3300_A2 = 9
ROLAND_DPX3300_A3 = 10
HP_7595A_A3 = 11
class ExportFormat(Enum):
JPG = 0
SVG = 1
GCODE = 2
HPGL = 3
class ExportFormatMappings:
maps = {
PlotterType.ROLAND_DPX3300: ExportFormat.HPGL,
PlotterType.ROLAND_DPX3300_A2: ExportFormat.HPGL,
PlotterType.ROLAND_DPX3300_A3: ExportFormat.HPGL,
PlotterType.DIY_PLOTTER: ExportFormat.GCODE,
PlotterType.AXIDRAW: ExportFormat.SVG,
PlotterType.HP_7475A_A3: ExportFormat.HPGL,
PlotterType.HP_7475A_A4: ExportFormat.HPGL,
PlotterType.ROLAND_DXY1200: ExportFormat.HPGL,
PlotterType.ROLAND_DXY980: ExportFormat.HPGL,
PlotterType.HP_7595A: ExportFormat.HPGL,
PlotterType.ROLAND_PNC1000: ExportFormat.HPGL,
PlotterType.HP_7595A_A3: ExportFormat.HPGL,
}
class MinmaxMapping:
maps = {
PlotterType.ROLAND_DPX3300: MinMax(-16920, 16340, -11180, 11180),
PlotterType.ROLAND_DPX3300_A2: MinMax(-16920, 5440, -11180, 4629),
PlotterType.ROLAND_DPX3300_A3: MinMax(-16920, -1112, -11180, -3276),
PlotterType.DIY_PLOTTER: MinMax(0, 3350, 0, -1715),
PlotterType.AXIDRAW: MinMax(0, 0, 0, -0), # todo: missing real bounds
PlotterType.HP_7475A_A4: MinMax(0, 11040, 0, 7721),
PlotterType.HP_7475A_A3: MinMax(0, 16158, 0, 11040),
PlotterType.ROLAND_DXY1200: MinMax(0, 0, 0, 0), # todo: missing real bounds
PlotterType.ROLAND_DXY980: MinMax(0, 16158, 0, 11040),
PlotterType.HP_7595A: MinMax(-23160, 23160, -17602, 17602),
PlotterType.ROLAND_PNC1000: MinMax(0, 0, 17200, 40000), # actually unlimited y
PlotterType.HP_7595A_A3: MinMax(-7728, 7728 + 960, -5752, 5752),
}
class PaperSize(Enum):
PORTRAIT_36_48 = 0
LANDSCAPE_48_36 = 1
PORTRAIT_42_56 = 2
LANDSCAPE_56_42 = 3
PORTRAIT_50_70 = 4
LANDSCAPE_70_50 = 5
SQUARE_70_70 = 6
PORTRAIT_70_100 = 7
LANDSCAPE_100_70 = 8
LANDSCAPE_A4 = 9
PORTRAIT_A4 = 10
LANDSCAPE_A1 = 11
LANDSCAPE_A0 = 12
PORTRAIT_A3 = 13
LANDSCAPE_A3 = 14
LANDSCAPE_80_50 = 15
PORTRAIT_50_80 = 16
LANDSCAPE_A2 = 17
SQUARE_59_59 = 18
class PlotterName:
names = {
PlotterType.ROLAND_DPX3300: "dpx3300",
PlotterType.ROLAND_DPX3300_A2: "dpx3300_a2",
PlotterType.ROLAND_DPX3300_A3: "dpx3300_a3",
PlotterType.AXIDRAW: "axidraw",
PlotterType.DIY_PLOTTER: "custom",
PlotterType.HP_7475A_A3: "hp7475a_a3",
PlotterType.HP_7475A_A4: "hp7475a_a4",
PlotterType.ROLAND_DXY1200: "dxy1200",
PlotterType.ROLAND_DXY980: "dxy980",
PlotterType.HP_7595A: "hp7595a_draftmaster_sx",
PlotterType.ROLAND_PNC1000: "roland_camm1",
PlotterType.HP_7595A_A3: "hp7595a_draftmaster_sx_a3",
}
class PaperSizeName:
names = {
PaperSize.PORTRAIT_36_48: "portrait_36_48",
PaperSize.LANDSCAPE_48_36: "landscape_48_36",
PaperSize.PORTRAIT_42_56: "portrait_42_56",
PaperSize.LANDSCAPE_56_42: "landscape_56_42",
PaperSize.PORTRAIT_50_70: "portrait_50_70",
PaperSize.LANDSCAPE_70_50: "landscape_70_50",
PaperSize.SQUARE_70_70: "square_70_70",
PaperSize.PORTRAIT_70_100: "portrait_70_100",
PaperSize.LANDSCAPE_100_70: "landscape_100_70",
PaperSize.LANDSCAPE_A4: "landscape_a4",
PaperSize.PORTRAIT_A4: "portrait_a4",
PaperSize.LANDSCAPE_A1: "landscape_a1",
PaperSize.LANDSCAPE_A0: "landscape_a0",
PaperSize.PORTRAIT_A3: "portrait_a3",
PaperSize.LANDSCAPE_A3: "landscape_a3",
PaperSize.LANDSCAPE_80_50: "landscape_80x50",
PaperSize.PORTRAIT_50_80: "portrait_50_80",
PaperSize.LANDSCAPE_A2: "landscape_a2",
PaperSize.SQUARE_59_59: "square_59_59",
}
class Paper:
sizes = {
PaperSize.PORTRAIT_36_48: (360, 480),
PaperSize.LANDSCAPE_48_36: (480, 360),
PaperSize.PORTRAIT_42_56: (420, 560),
PaperSize.LANDSCAPE_56_42: (560, 420),
PaperSize.PORTRAIT_50_70: (500, 700),
PaperSize.LANDSCAPE_70_50: (700, 500),
PaperSize.SQUARE_70_70: (700, 700),
PaperSize.PORTRAIT_70_100: (700, 1000),
PaperSize.LANDSCAPE_100_70: (1000, 700),
PaperSize.LANDSCAPE_A4: (297, 210),
PaperSize.PORTRAIT_A4: (210, 297),
PaperSize.LANDSCAPE_A1: (841, 594),
PaperSize.LANDSCAPE_A0: (1189, 841),
PaperSize.PORTRAIT_A3: (297, 420),
PaperSize.LANDSCAPE_A3: (420, 297),
PaperSize.LANDSCAPE_80_50: (800, 500),
PaperSize.PORTRAIT_50_80: (500, 800),
PaperSize.LANDSCAPE_A2: (594, 420),
PaperSize.SQUARE_59_59: (590, 590),
}
class XYFactors:
fac = {
PlotterType.ROLAND_DPX3300: (40, 40),
PlotterType.ROLAND_DPX3300_A2: (40, 40),
PlotterType.ROLAND_DPX3300_A3: (40, 40),
PlotterType.DIY_PLOTTER: (2.85714, 2.90572),
PlotterType.AXIDRAW: (3.704, 3.704),
PlotterType.HP_7475A_A3: (40, 40),
PlotterType.HP_7475A_A4: (40, 40),
PlotterType.ROLAND_DXY1200: (40, 40),
PlotterType.ROLAND_DXY980: (40, 40),
PlotterType.HP_7595A: (40, 40),
PlotterType.ROLAND_PNC1000: (40, 40),
PlotterType.HP_7595A_A3: (37, 37),
}
class Cfg:
def __init__(self):
self.__type = None
self.__dimensions = None
self.__margin = None
self.__cutoff = None
@property
def type(self) -> PlotterType:
return self.__type
@type.setter
def type(self, t: PlotterType) -> None:
self.__type = t
@property
def dimension(self) -> PaperSize:
return self.__dimensions
@dimension.setter
def dimension(self, t: PaperSize):
self.__dimensions = t
@property
def margin(self) -> int:
return self.__margin
@margin.setter
def margin(self, t: int):
self.__margin = t
@property
def cutoff(self) -> int:
return self.__cutoff
@cutoff.setter
def cutoff(self, t: int):
self.__cutoff = t
class Exporter:
from cursor import path
def __init__(self):
self.__paths = None
self.__cfg = None
self.__name = None
self.__suffix = None
self.__gcode_speed = None
self.__layer_pen_mapping = None
self.__linetype_mapping = None
@property
def paths(self) -> path.PathCollection:
return self.__paths
@paths.setter
def paths(self, t: path.PathCollection) -> None:
self.__paths = t
@property
def cfg(self) -> Cfg:
return self.__cfg
@cfg.setter
def cfg(self, t: Cfg) -> None:
self.__cfg = t
@property
def name(self) -> str:
return self.__name
@name.setter
def name(self, t: str) -> None:
self.__name = t
@property
def suffix(self) -> str:
return self.__suffix
@suffix.setter
def suffix(self, t: str) -> None:
self.__suffix = t
@property
def gcode_speed(self) -> int:
return self.__gcode_speed
@gcode_speed.setter
def gcode_speed(self, t: int) -> None:
self.__gcode_speed = t
@property
def layer_pen_mapping(self) -> dict:
return self.__layer_pen_mapping
@layer_pen_mapping.setter
def layer_pen_mapping(self, m: dict) -> None:
self.__layer_pen_mapping = m
@property
def linetype_mapping(self) -> dict:
return self.__linetype_mapping
@linetype_mapping.setter
def linetype_mapping(self, m: dict) -> None:
self.__linetype_mapping = m
def run(self, jpg: bool = False, source: bool = False) -> None:
if self.cfg is None or self.paths is None or self.name is None:
log.fail("Config, Name or Paths is None. Not exporting anything")
return
# jpeg fitting roughly
self.paths.fit(
Paper.sizes[self.cfg.dimension],
padding_mm=self.cfg.margin,
cutoff_mm=self.cfg.cutoff,
)
stack = inspect.stack()
frame = stack[2]
module = inspect.getmodule(frame[0])
ms = inspect.getsource(module)
if jpg:
separate_layers = self.paths.get_layers()
for layer, pc in separate_layers.items():
sizename = PaperSizeName.names[self.cfg.dimension]
machinename = PlotterName.names[self.cfg.type]
fname = (
f"{self.name}_{self.suffix}_{sizename}_{machinename}_{layer}_"
f"{hashlib.sha256(ms.encode('utf-8')).hexdigest()}"
)
jpeg_folder = data.DataDirHandler().jpg(self.name)
jpeg_renderer = renderer.JpegRenderer(jpeg_folder)
jpeg_renderer.render(pc, scale=4.0)
jpeg_renderer.save(f"{fname}")
if source:
source_folder = data.DataDirHandler().source(self.name)
sizename = PaperSizeName.names[self.cfg.dimension]
machinename = PlotterName.names[self.cfg.type]
fname = (
f"{self.name}_{self.suffix}_{sizename}_{machinename}_"
f"{hashlib.sha256(ms.encode('utf-8')).hexdigest()}.py"
)
import pathlib
pathlib.Path(source_folder).mkdir(parents=True, exist_ok=True)
log.good(f"Saved source to {source_folder / fname}")
with open(source_folder / fname, "w") as file:
file.write(ms)
self.paths.fit(
Paper.sizes[self.cfg.dimension],
xy_factor=XYFactors.fac[self.cfg.type],
padding_mm=self.cfg.margin,
output_bounds=MinmaxMapping.maps[self.cfg.type].tuple(),
cutoff_mm=self.cfg.cutoff,
)
sizename = PaperSizeName.names[self.cfg.dimension]
machinename = PlotterName.names[self.cfg.type]
fname = f"{self.name}_{self.suffix}_{sizename}_{machinename}_{hashlib.sha256(ms.encode('utf-8')).hexdigest()}"
format = ExportFormatMappings.maps[self.cfg.type]
if self.linetype_mapping and format is ExportFormat.HPGL:
hpgl_folder = data.DataDirHandler().hpgl(self.name)
hpgl_renderer = renderer.HPGLRenderer(
hpgl_folder, line_type_mapping=self.linetype_mapping
)
hpgl_renderer.render(self.paths)
hpgl_renderer.save(f"{fname}")
if self.layer_pen_mapping is not None:
if format is ExportFormat.HPGL:
hpgl_folder = data.DataDirHandler().hpgl(self.name)
hpgl_renderer = renderer.HPGLRenderer(
hpgl_folder, layer_pen_mapping=self.layer_pen_mapping
)
hpgl_renderer.render(self.paths)
hpgl_renderer.save(f"{fname}")
else:
separate_layers = self.paths.get_layers()
for layer, pc in separate_layers.items():
if format is ExportFormat.HPGL:
hpgl_folder = data.DataDirHandler().hpgl(self.name)
hpgl_renderer = renderer.HPGLRenderer(hpgl_folder)
hpgl_renderer.render(pc)
hpgl_renderer.save(f"{fname}_{layer}")
if format is ExportFormat.SVG:
svg_dir = data.DataDirHandler().svg(self.name)
svg_renderer = renderer.SvgRenderer(svg_dir)
svg_renderer.render(pc)
svg_renderer.save(f"{fname}_{layer}")
if format is ExportFormat.GCODE:
gcode_folder = data.DataDirHandler().gcode(self.name)
if self.gcode_speed:
gcode_renderer = renderer.GCodeRenderer(
gcode_folder, z_down=4.5
)
else:
gcode_renderer = renderer.GCodeRenderer(
gcode_folder, feedrate_xy=self.gcode_speed, z_down=4.5
)
gcode_renderer.render(pc)
gcode_renderer.save(f"{layer}_{fname}")
class SimpleExportWrapper:
from cursor import path
def ex(
self,
paths: path.PathCollection,
ptype: PlotterType,
psize: PaperSize,
margin: int,
name: str = "output_name",
suffix: str = "",
cutoff: int = None,
gcode_speed: int = None,
hpgl_pen_layer_mapping=None,
hpgl_linetype_mapping=None,
):
cfg = Cfg()
cfg.type = ptype
cfg.dimension = psize
cfg.margin = margin
cfg.cutoff = cutoff
# paths.clean()
exp = Exporter()
exp.cfg = cfg
exp.paths = paths
exp.name = name
exp.suffix = str(suffix)
exp.gcode_speed = gcode_speed
exp.layer_pen_mapping = hpgl_pen_layer_mapping
exp.linetype_mapping = hpgl_linetype_mapping
exp.run(True, True)
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
3166,
10677,
1053,
848,
13,
3166,
10677,
1053,
4050,
261,
13,
13,
3166,
14115,
1053,
1174,
398,
13,
5215,
471,
19266,
13,
5215,
16096,
13,
5215,
6608,
1982,
13,
13,
1188,
353,
471,
19266,
29889,
4040,
1639,
580,
13,
13,
13,
1990,
3080,
7976,
29901,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1375,
29916,
29901,
938,
29892,
4236,
29916,
29901,
938,
29892,
1375,
29891,
29901,
938,
29892,
611,
3594,
29901,
938,
1125,
13,
4706,
1583,
29889,
1195,
29916,
353,
1375,
29916,
13,
4706,
1583,
29889,
3317,
29916,
353,
4236,
29916,
13,
4706,
1583,
29889,
1195,
29891,
353,
1375,
29891,
13,
4706,
1583,
29889,
3317,
29891,
353,
611,
3594,
13,
13,
1678,
822,
4818,
29898,
1311,
1125,
13,
4706,
736,
313,
1311,
29889,
1195,
29916,
718,
1583,
29889,
3317,
29916,
29897,
847,
29871,
29906,
29892,
313,
1311,
29889,
1195,
29891,
718,
1583,
29889,
3317,
29891,
29897,
847,
29871,
29906,
13,
13,
1678,
822,
18761,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
1195,
29916,
29892,
1583,
29889,
3317,
29916,
29892,
1583,
29889,
1195,
29891,
29892,
1583,
29889,
3317,
29891,
13,
13,
13,
1990,
18399,
357,
1542,
29898,
16854,
1125,
13,
1678,
390,
5607,
9468,
29918,
11191,
29990,
29941,
29941,
29900,
29900,
353,
29871,
29900,
13,
1678,
22471,
29979,
29918,
7390,
2891,
4945,
353,
29871,
29896,
13,
1678,
319,
29990,
1367,
4717,
29956,
353,
29871,
29906,
13,
1678,
379,
29925,
29918,
29955,
29946,
29955,
29945,
29909,
29918,
29909,
29946,
353,
29871,
29941,
13,
1678,
379,
29925,
29918,
29955,
29946,
29955,
29945,
29909,
29918,
29909,
29941,
353,
29871,
29946,
13,
1678,
390,
5607,
9468,
29918,
29928,
18454,
29896,
29906,
29900,
29900,
353,
29871,
29945,
13,
1678,
390,
5607,
9468,
29918,
29928,
18454,
29929,
29947,
29900,
353,
29871,
29953,
13,
1678,
379,
29925,
29918,
29955,
29945,
29929,
29945,
29909,
353,
29871,
29955,
13,
1678,
390,
5607,
9468,
29918,
15695,
29907,
29896,
29900,
29900,
29900,
353,
29871,
29947,
13,
1678,
390,
5607,
9468,
29918,
11191,
29990,
29941,
29941,
29900,
29900,
29918,
29909,
29906,
353,
29871,
29929,
13,
1678,
390,
5607,
9468,
29918,
11191,
29990,
29941,
29941,
29900,
29900,
29918,
29909,
29941,
353,
29871,
29896,
29900,
13,
1678,
379,
29925,
29918,
29955,
29945,
29929,
29945,
29909,
29918,
29909,
29941,
353,
29871,
29896,
29896,
13,
13,
13,
1990,
1222,
637,
5809,
29898,
16854,
1125,
13,
1678,
435,
16903,
353,
29871,
29900,
13,
1678,
13955,
29954,
353,
29871,
29896,
13,
1678,
402,
16524,
353,
29871,
29906,
13,
1678,
379,
29925,
7239,
353,
29871,
29941,
13,
13,
13,
1990,
1222,
637,
5809,
9689,
886,
29901,
13,
1678,
11053,
353,
426,
13,
4706,
18399,
357,
1542,
29889,
1672,
29931,
9468,
29918,
11191,
29990,
29941,
29941,
29900,
29900,
29901,
1222,
637,
5809,
29889,
3954,
7239,
29892,
13,
4706,
18399,
357,
1542,
29889,
1672,
29931,
9468,
29918,
11191,
29990,
29941,
29941,
29900,
29900,
29918,
29909,
29906,
29901,
1222,
637,
5809,
29889,
3954,
7239,
29892,
13,
4706,
18399,
357,
1542,
29889,
1672,
29931,
9468,
29918,
11191,
29990,
29941,
29941,
29900,
29900,
29918,
29909,
29941,
29901,
1222,
637,
5809,
29889,
3954,
7239,
29892,
13,
4706,
18399,
357,
1542,
29889,
4571,
29979,
29918,
7390,
2891,
4945,
29901,
1222,
637,
5809,
29889,
29954,
16524,
29892,
13,
4706,
18399,
357,
1542,
29889,
6604,
1367,
4717,
29956,
29901,
1222,
637,
5809,
29889,
7597,
29954,
29892,
13,
4706,
18399,
357,
1542,
29889,
3954,
29918,
29955,
29946,
29955,
29945,
29909,
29918,
29909,
29941,
29901,
1222,
637,
5809,
29889,
3954,
7239,
29892,
13,
4706,
18399,
357,
1542,
29889,
3954,
29918,
29955,
29946,
29955,
29945,
29909,
29918,
29909,
29946,
29901,
1222,
637,
5809,
29889,
3954,
7239,
29892,
13,
4706,
18399,
357,
1542,
29889,
1672,
29931,
9468,
29918,
29928,
18454,
29896,
29906,
29900,
29900,
29901,
1222,
637,
5809,
29889,
3954,
7239,
29892,
13,
4706,
18399,
357,
1542,
29889,
1672,
29931,
9468,
29918,
29928,
18454,
29929,
29947,
29900,
29901,
1222,
637,
5809,
29889,
3954,
7239,
29892,
13,
4706,
18399,
357,
1542,
29889,
3954,
29918,
29955,
29945,
29929,
29945,
29909,
29901,
1222,
637,
5809,
29889,
3954,
7239,
29892,
13,
4706,
18399,
357,
1542,
29889,
1672,
29931,
9468,
29918,
15695,
29907,
29896,
29900,
29900,
29900,
29901,
1222,
637,
5809,
29889,
3954,
7239,
29892,
13,
4706,
18399,
357,
1542,
29889,
3954,
29918,
29955,
29945,
29929,
29945,
29909,
29918,
29909,
29941,
29901,
1222,
637,
5809,
29889,
3954,
7239,
29892,
13,
1678,
500,
13,
13,
13,
1990,
3080,
3317,
15845,
29901,
13,
1678,
11053,
353,
426,
13,
4706,
18399,
357,
1542,
29889,
1672,
29931,
9468,
29918,
11191,
29990,
29941,
29941,
29900,
29900,
29901,
3080,
7976,
6278,
29896,
29953,
29929,
29906,
29900,
29892,
29871,
29896,
29953,
29941,
29946,
29900,
29892,
448,
29896,
29896,
29896,
29947,
29900,
29892,
29871,
29896,
29896,
29896,
29947,
29900,
511,
13,
4706,
18399,
357,
1542,
29889,
1672,
29931,
9468,
29918,
11191,
29990,
29941,
29941,
29900,
29900,
29918,
29909,
29906,
29901,
3080,
7976,
6278,
29896,
29953,
29929,
29906,
29900,
29892,
29871,
29945,
29946,
29946,
29900,
29892,
448,
29896,
29896,
29896,
29947,
29900,
29892,
29871,
29946,
29953,
29906,
29929,
511,
13,
4706,
18399,
357,
1542,
29889,
1672,
29931,
9468,
29918,
11191,
29990,
29941,
29941,
29900,
29900,
29918,
29909,
29941,
29901,
3080,
7976,
6278,
29896,
29953,
29929,
29906,
29900,
29892,
448,
29896,
29896,
29896,
29906,
29892,
448,
29896,
29896,
29896,
29947,
29900,
29892,
448,
29941,
29906,
29955,
29953,
511,
13,
4706,
18399,
357,
1542,
29889,
4571,
29979,
29918,
7390,
2891,
4945,
29901,
3080,
7976,
29898,
29900,
29892,
29871,
29941,
29941,
29945,
29900,
29892,
29871,
29900,
29892,
448,
29896,
29955,
29896,
29945,
511,
13,
4706,
18399,
357,
1542,
29889,
6604,
1367,
4717,
29956,
29901,
3080,
7976,
29898,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
448,
29900,
511,
29871,
396,
10481,
29901,
4567,
1855,
13451,
13,
4706,
18399,
357,
1542,
29889,
3954,
29918,
29955,
29946,
29955,
29945,
29909,
29918,
29909,
29946,
29901,
3080,
7976,
29898,
29900,
29892,
29871,
29896,
29896,
29900,
29946,
29900,
29892,
29871,
29900,
29892,
29871,
29955,
29955,
29906,
29896,
511,
13,
4706,
18399,
357,
1542,
29889,
3954,
29918,
29955,
29946,
29955,
29945,
29909,
29918,
29909,
29941,
29901,
3080,
7976,
29898,
29900,
29892,
29871,
29896,
29953,
29896,
29945,
29947,
29892,
29871,
29900,
29892,
29871,
29896,
29896,
29900,
29946,
29900,
511,
13,
4706,
18399,
357,
1542,
29889,
1672,
29931,
9468,
29918,
29928,
18454,
29896,
29906,
29900,
29900,
29901,
3080,
7976,
29898,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
511,
29871,
396,
10481,
29901,
4567,
1855,
13451,
13,
4706,
18399,
357,
1542,
29889,
1672,
29931,
9468,
29918,
29928,
18454,
29929,
29947,
29900,
29901,
3080,
7976,
29898,
29900,
29892,
29871,
29896,
29953,
29896,
29945,
29947,
29892,
29871,
29900,
29892,
29871,
29896,
29896,
29900,
29946,
29900,
511,
13,
4706,
18399,
357,
1542,
29889,
3954,
29918,
29955,
29945,
29929,
29945,
29909,
29901,
3080,
7976,
6278,
29906,
29941,
29896,
29953,
29900,
29892,
29871,
29906,
29941,
29896,
29953,
29900,
29892,
448,
29896,
29955,
29953,
29900,
29906,
29892,
29871,
29896,
29955,
29953,
29900,
29906,
511,
13,
4706,
18399,
357,
1542,
29889,
1672,
29931,
9468,
29918,
15695,
29907,
29896,
29900,
29900,
29900,
29901,
3080,
7976,
29898,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29955,
29906,
29900,
29900,
29892,
29871,
29946,
29900,
29900,
29900,
29900,
511,
29871,
396,
2869,
443,
29044,
343,
13,
4706,
18399,
357,
1542,
29889,
3954,
29918,
29955,
29945,
29929,
29945,
29909,
29918,
29909,
29941,
29901,
3080,
7976,
6278,
29955,
29955,
29906,
29947,
29892,
29871,
29955,
29955,
29906,
29947,
718,
29871,
29929,
29953,
29900,
29892,
448,
29945,
29955,
29945,
29906,
29892,
29871,
29945,
29955,
29945,
29906,
511,
13,
1678,
500,
13,
13,
13,
1990,
349,
7202,
3505,
29898,
16854,
1125,
13,
1678,
349,
8476,
4717,
1806,
29918,
29941,
29953,
29918,
29946,
29947,
353,
29871,
29900,
13,
1678,
365,
9468,
7187,
3301,
29923,
29918,
29946,
29947,
29918,
29941,
29953,
353,
29871,
29896,
13,
1678,
349,
8476,
4717,
1806,
29918,
29946,
29906,
29918,
29945,
29953,
353,
29871,
29906,
13,
1678,
365,
9468,
7187,
3301,
29923,
29918,
29945,
29953,
29918,
29946,
29906,
353,
29871,
29941,
13,
1678,
349,
8476,
4717,
1806,
29918,
29945,
29900,
29918,
29955,
29900,
353,
29871,
29946,
13,
1678,
365,
9468,
7187,
3301,
29923,
29918,
29955,
29900,
29918,
29945,
29900,
353,
29871,
29945,
13,
1678,
317,
13356,
29909,
1525,
29918,
29955,
29900,
29918,
29955,
29900,
353,
29871,
29953,
13,
1678,
349,
8476,
4717,
1806,
29918,
29955,
29900,
29918,
29896,
29900,
29900,
353,
29871,
29955,
13,
1678,
365,
9468,
7187,
3301,
29923,
29918,
29896,
29900,
29900,
29918,
29955,
29900,
353,
29871,
29947,
13,
1678,
365,
9468,
7187,
3301,
29923,
29918,
29909,
29946,
353,
29871,
29929,
13,
1678,
349,
8476,
4717,
1806,
29918,
29909,
29946,
353,
29871,
29896,
29900,
13,
1678,
365,
9468,
7187,
3301,
29923,
29918,
29909,
29896,
353,
29871,
29896,
29896,
13,
1678,
365,
9468,
7187,
3301,
29923,
29918,
29909,
29900,
353,
29871,
29896,
29906,
13,
1678,
349,
8476,
4717,
1806,
29918,
29909,
29941,
353,
29871,
29896,
29941,
13,
1678,
365,
9468,
7187,
3301,
29923,
29918,
29909,
29941,
353,
29871,
29896,
29946,
13,
1678,
365,
9468,
7187,
3301,
29923,
29918,
29947,
29900,
29918,
29945,
29900,
353,
29871,
29896,
29945,
13,
1678,
349,
8476,
4717,
1806,
29918,
29945,
29900,
29918,
29947,
29900,
353,
29871,
29896,
29953,
13,
1678,
365,
9468,
7187,
3301,
29923,
29918,
29909,
29906,
353,
29871,
29896,
29955,
13,
1678,
317,
13356,
29909,
1525,
29918,
29945,
29929,
29918,
29945,
29929,
353,
29871,
29896,
29947,
13,
13,
13,
1990,
18399,
357,
1170,
29901,
13,
1678,
2983,
353,
426,
13,
4706,
18399,
357,
1542,
29889,
1672,
29931,
9468,
29918,
11191,
29990,
29941,
29941,
29900,
29900,
29901,
376,
29881,
1756,
29941,
29941,
29900,
29900,
613,
13,
4706,
18399,
357,
1542,
29889,
1672,
29931,
9468,
29918,
11191,
29990,
29941,
29941,
29900,
29900,
29918,
29909,
29906,
29901,
376,
29881,
1756,
29941,
29941,
29900,
29900,
29918,
29874,
29906,
613,
13,
4706,
18399,
357,
1542,
29889,
1672,
29931,
9468,
29918,
11191,
29990,
29941,
29941,
29900,
29900,
29918,
29909,
29941,
29901,
376,
29881,
1756,
29941,
29941,
29900,
29900,
29918,
29874,
29941,
613,
13,
4706,
18399,
357,
1542,
29889,
6604,
1367,
4717,
29956,
29901,
376,
1165,
333,
1610,
613,
13,
4706,
18399,
357,
1542,
29889,
4571,
29979,
29918,
7390,
2891,
4945,
29901,
376,
6341,
613,
13,
4706,
18399,
357,
1542,
29889,
3954,
29918,
29955,
29946,
29955,
29945,
29909,
29918,
29909,
29941,
29901,
376,
28887,
29955,
29946,
29955,
29945,
29874,
29918,
29874,
29941,
613,
13,
4706,
18399,
357,
1542,
29889,
3954,
29918,
29955,
29946,
29955,
29945,
29909,
29918,
29909,
29946,
29901,
376,
28887,
29955,
29946,
29955,
29945,
29874,
29918,
29874,
29946,
613,
13,
4706,
18399,
357,
1542,
29889,
1672,
29931,
9468,
29918,
29928,
18454,
29896,
29906,
29900,
29900,
29901,
376,
29881,
3594,
29896,
29906,
29900,
29900,
613,
13,
4706,
18399,
357,
1542,
29889,
1672,
29931,
9468,
29918,
29928,
18454,
29929,
29947,
29900,
29901,
376,
29881,
3594,
29929,
29947,
29900,
613,
13,
4706,
18399,
357,
1542,
29889,
3954,
29918,
29955,
29945,
29929,
29945,
29909,
29901,
376,
28887,
29955,
29945,
29929,
29945,
29874,
29918,
29881,
4154,
6207,
29918,
29879,
29916,
613,
13,
4706,
18399,
357,
1542,
29889,
1672,
29931,
9468,
29918,
15695,
29907,
29896,
29900,
29900,
29900,
29901,
376,
307,
1049,
29918,
29883,
4850,
29896,
613,
13,
4706,
18399,
357,
1542,
29889,
3954,
29918,
29955,
29945,
29929,
29945,
29909,
29918,
29909,
29941,
29901,
376,
28887,
29955,
29945,
29929,
29945,
29874,
29918,
29881,
4154,
6207,
29918,
29879,
29916,
29918,
29874,
29941,
613,
13,
1678,
500,
13,
13,
13,
1990,
349,
7202,
3505,
1170,
29901,
13,
1678,
2983,
353,
426,
13,
4706,
349,
7202,
3505,
29889,
15082,
4717,
1806,
29918,
29941,
29953,
29918,
29946,
29947,
29901,
376,
637,
8356,
29918,
29941,
29953,
29918,
29946,
29947,
613,
13,
4706,
349,
7202,
3505,
29889,
29931,
9468,
7187,
3301,
29923,
29918,
29946,
29947,
29918,
29941,
29953,
29901,
376,
5252,
5738,
29918,
29946,
29947,
29918,
29941,
29953,
613,
13,
4706,
349,
7202,
3505,
29889,
15082,
4717,
1806,
29918,
29946,
29906,
29918,
29945,
29953,
29901,
376,
637,
8356,
29918,
29946,
29906,
29918,
29945,
29953,
613,
13,
4706,
349,
7202,
3505,
29889,
29931,
9468,
7187,
3301,
29923,
29918,
29945,
29953,
29918,
29946,
29906,
29901,
376,
5252,
5738,
29918,
29945,
29953,
29918,
29946,
29906,
613,
13,
4706,
349,
7202,
3505,
29889,
15082,
4717,
1806,
29918,
29945,
29900,
29918,
29955,
29900,
29901,
376,
637,
8356,
29918,
29945,
29900,
29918,
29955,
29900,
613,
13,
4706,
349,
7202,
3505,
29889,
29931,
9468,
7187,
3301,
29923,
29918,
29955,
29900,
29918,
29945,
29900,
29901,
376,
5252,
5738,
29918,
29955,
29900,
29918,
29945,
29900,
613,
13,
4706,
349,
7202,
3505,
29889,
29903,
13356,
29909,
1525,
29918,
29955,
29900,
29918,
29955,
29900,
29901,
376,
17619,
29918,
29955,
29900,
29918,
29955,
29900,
613,
13,
4706,
349,
7202,
3505,
29889,
15082,
4717,
1806,
29918,
29955,
29900,
29918,
29896,
29900,
29900,
29901,
376,
637,
8356,
29918,
29955,
29900,
29918,
29896,
29900,
29900,
613,
13,
4706,
349,
7202,
3505,
29889,
29931,
9468,
7187,
3301,
29923,
29918,
29896,
29900,
29900,
29918,
29955,
29900,
29901,
376,
5252,
5738,
29918,
29896,
29900,
29900,
29918,
29955,
29900,
613,
13,
4706,
349,
7202,
3505,
29889,
29931,
9468,
7187,
3301,
29923,
29918,
29909,
29946,
29901,
376,
5252,
5738,
29918,
29874,
29946,
613,
13,
4706,
349,
7202,
3505,
29889,
15082,
4717,
1806,
29918,
29909,
29946,
29901,
376,
637,
8356,
29918,
29874,
29946,
613,
13,
4706,
349,
7202,
3505,
29889,
29931,
9468,
7187,
3301,
29923,
29918,
29909,
29896,
29901,
376,
5252,
5738,
29918,
29874,
29896,
613,
13,
4706,
349,
7202,
3505,
29889,
29931,
9468,
7187,
3301,
29923,
29918,
29909,
29900,
29901,
376,
5252,
5738,
29918,
29874,
29900,
613,
13,
4706,
349,
7202,
3505,
29889,
15082,
4717,
1806,
29918,
29909,
29941,
29901,
376,
637,
8356,
29918,
29874,
29941,
613,
13,
4706,
349,
7202,
3505,
29889,
29931,
9468,
7187,
3301,
29923,
29918,
29909,
29941,
29901,
376,
5252,
5738,
29918,
29874,
29941,
613,
13,
4706,
349,
7202,
3505,
29889,
29931,
9468,
7187,
3301,
29923,
29918,
29947,
29900,
29918,
29945,
29900,
29901,
376,
5252,
5738,
29918,
29947,
29900,
29916,
29945,
29900,
613,
13,
4706,
349,
7202,
3505,
29889,
15082,
4717,
1806,
29918,
29945,
29900,
29918,
29947,
29900,
29901,
376,
637,
8356,
29918,
29945,
29900,
29918,
29947,
29900,
613,
13,
4706,
349,
7202,
3505,
29889,
29931,
9468,
7187,
3301,
29923,
29918,
29909,
29906,
29901,
376,
5252,
5738,
29918,
29874,
29906,
613,
13,
4706,
349,
7202,
3505,
29889,
29903,
13356,
29909,
1525,
29918,
29945,
29929,
29918,
29945,
29929,
29901,
376,
17619,
29918,
29945,
29929,
29918,
29945,
29929,
613,
13,
1678,
500,
13,
13,
13,
1990,
349,
7202,
29901,
13,
1678,
15786,
353,
426,
13,
4706,
349,
7202,
3505,
29889,
15082,
4717,
1806,
29918,
29941,
29953,
29918,
29946,
29947,
29901,
313,
29941,
29953,
29900,
29892,
29871,
29946,
29947,
29900,
511,
13,
4706,
349,
7202,
3505,
29889,
29931,
9468,
7187,
3301,
29923,
29918,
29946,
29947,
29918,
29941,
29953,
29901,
313,
29946,
29947,
29900,
29892,
29871,
29941,
29953,
29900,
511,
13,
4706,
349,
7202,
3505,
29889,
15082,
4717,
1806,
29918,
29946,
29906,
29918,
29945,
29953,
29901,
313,
29946,
29906,
29900,
29892,
29871,
29945,
29953,
29900,
511,
13,
4706,
349,
7202,
3505,
29889,
29931,
9468,
7187,
3301,
29923,
29918,
29945,
29953,
29918,
29946,
29906,
29901,
313,
29945,
29953,
29900,
29892,
29871,
29946,
29906,
29900,
511,
13,
4706,
349,
7202,
3505,
29889,
15082,
4717,
1806,
29918,
29945,
29900,
29918,
29955,
29900,
29901,
313,
29945,
29900,
29900,
29892,
29871,
29955,
29900,
29900,
511,
13,
4706,
349,
7202,
3505,
29889,
29931,
9468,
7187,
3301,
29923,
29918,
29955,
29900,
29918,
29945,
29900,
29901,
313,
29955,
29900,
29900,
29892,
29871,
29945,
29900,
29900,
511,
13,
4706,
349,
7202,
3505,
29889,
29903,
13356,
29909,
1525,
29918,
29955,
29900,
29918,
29955,
29900,
29901,
313,
29955,
29900,
29900,
29892,
29871,
29955,
29900,
29900,
511,
13,
4706,
349,
7202,
3505,
29889,
15082,
4717,
1806,
29918,
29955,
29900,
29918,
29896,
29900,
29900,
29901,
313,
29955,
29900,
29900,
29892,
29871,
29896,
29900,
29900,
29900,
511,
13,
4706,
349,
7202,
3505,
29889,
29931,
9468,
7187,
3301,
29923,
29918,
29896,
29900,
29900,
29918,
29955,
29900,
29901,
313,
29896,
29900,
29900,
29900,
29892,
29871,
29955,
29900,
29900,
511,
13,
4706,
349,
7202,
3505,
29889,
29931,
9468,
7187,
3301,
29923,
29918,
29909,
29946,
29901,
313,
29906,
29929,
29955,
29892,
29871,
29906,
29896,
29900,
511,
13,
4706,
349,
7202,
3505,
29889,
15082,
4717,
1806,
29918,
29909,
29946,
29901,
313,
29906,
29896,
29900,
29892,
29871,
29906,
29929,
29955,
511,
13,
4706,
349,
7202,
3505,
29889,
29931,
9468,
7187,
3301,
29923,
29918,
29909,
29896,
29901,
313,
29947,
29946,
29896,
29892,
29871,
29945,
29929,
29946,
511,
13,
4706,
349,
7202,
3505,
29889,
29931,
9468,
7187,
3301,
29923,
29918,
29909,
29900,
29901,
313,
29896,
29896,
29947,
29929,
29892,
29871,
29947,
29946,
29896,
511,
13,
4706,
349,
7202,
3505,
29889,
15082,
4717,
1806,
29918,
29909,
29941,
29901,
313,
29906,
29929,
29955,
29892,
29871,
29946,
29906,
29900,
511,
13,
4706,
349,
7202,
3505,
29889,
29931,
9468,
7187,
3301,
29923,
29918,
29909,
29941,
29901,
313,
29946,
29906,
29900,
29892,
29871,
29906,
29929,
29955,
511,
13,
4706,
349,
7202,
3505,
29889,
29931,
9468,
7187,
3301,
29923,
29918,
29947,
29900,
29918,
29945,
29900,
29901,
313,
29947,
29900,
29900,
29892,
29871,
29945,
29900,
29900,
511,
13,
4706,
349,
7202,
3505,
29889,
15082,
4717,
1806,
29918,
29945,
29900,
29918,
29947,
29900,
29901,
313,
29945,
29900,
29900,
29892,
29871,
29947,
29900,
29900,
511,
13,
4706,
349,
7202,
3505,
29889,
29931,
9468,
7187,
3301,
29923,
29918,
29909,
29906,
29901,
313,
29945,
29929,
29946,
29892,
29871,
29946,
29906,
29900,
511,
13,
4706,
349,
7202,
3505,
29889,
29903,
13356,
29909,
1525,
29918,
29945,
29929,
29918,
29945,
29929,
29901,
313,
29945,
29929,
29900,
29892,
29871,
29945,
29929,
29900,
511,
13,
1678,
500,
13,
13,
13,
1990,
1060,
29979,
20738,
943,
29901,
13,
1678,
4024,
353,
426,
13,
4706,
18399,
357,
1542,
29889,
1672,
29931,
9468,
29918,
11191,
29990,
29941,
29941,
29900,
29900,
29901,
313,
29946,
29900,
29892,
29871,
29946,
29900,
511,
13,
4706,
18399,
357,
1542,
29889,
1672,
29931,
9468,
29918,
11191,
29990,
29941,
29941,
29900,
29900,
29918,
29909,
29906,
29901,
313,
29946,
29900,
29892,
29871,
29946,
29900,
511,
13,
4706,
18399,
357,
1542,
29889,
1672,
29931,
9468,
29918,
11191,
29990,
29941,
29941,
29900,
29900,
29918,
29909,
29941,
29901,
313,
29946,
29900,
29892,
29871,
29946,
29900,
511,
13,
4706,
18399,
357,
1542,
29889,
4571,
29979,
29918,
7390,
2891,
4945,
29901,
313,
29906,
29889,
29947,
29945,
29955,
29896,
29946,
29892,
29871,
29906,
29889,
29929,
29900,
29945,
29955,
29906,
511,
13,
4706,
18399,
357,
1542,
29889,
6604,
1367,
4717,
29956,
29901,
313,
29941,
29889,
29955,
29900,
29946,
29892,
29871,
29941,
29889,
29955,
29900,
29946,
511,
13,
4706,
18399,
357,
1542,
29889,
3954,
29918,
29955,
29946,
29955,
29945,
29909,
29918,
29909,
29941,
29901,
313,
29946,
29900,
29892,
29871,
29946,
29900,
511,
13,
4706,
18399,
357,
1542,
29889,
3954,
29918,
29955,
29946,
29955,
29945,
29909,
29918,
29909,
29946,
29901,
313,
29946,
29900,
29892,
29871,
29946,
29900,
511,
13,
4706,
18399,
357,
1542,
29889,
1672,
29931,
9468,
29918,
29928,
18454,
29896,
29906,
29900,
29900,
29901,
313,
29946,
29900,
29892,
29871,
29946,
29900,
511,
13,
4706,
18399,
357,
1542,
29889,
1672,
29931,
9468,
29918,
29928,
18454,
29929,
29947,
29900,
29901,
313,
29946,
29900,
29892,
29871,
29946,
29900,
511,
13,
4706,
18399,
357,
1542,
29889,
3954,
29918,
29955,
29945,
29929,
29945,
29909,
29901,
313,
29946,
29900,
29892,
29871,
29946,
29900,
511,
13,
4706,
18399,
357,
1542,
29889,
1672,
29931,
9468,
29918,
15695,
29907,
29896,
29900,
29900,
29900,
29901,
313,
29946,
29900,
29892,
29871,
29946,
29900,
511,
13,
4706,
18399,
357,
1542,
29889,
3954,
29918,
29955,
29945,
29929,
29945,
29909,
29918,
29909,
29941,
29901,
313,
29941,
29955,
29892,
29871,
29941,
29955,
511,
13,
1678,
500,
13,
13,
13,
1990,
315,
16434,
29901,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
1583,
17255,
1853,
353,
6213,
13,
4706,
1583,
17255,
6229,
5580,
353,
6213,
13,
4706,
1583,
17255,
9264,
353,
6213,
13,
4706,
1583,
17255,
7582,
2696,
353,
6213,
13,
13,
1678,
732,
6799,
13,
1678,
822,
1134,
29898,
1311,
29897,
1599,
18399,
357,
1542,
29901,
13,
4706,
736,
1583,
17255,
1853,
13,
13,
1678,
732,
1853,
29889,
842,
357,
13,
1678,
822,
1134,
29898,
1311,
29892,
260,
29901,
18399,
357,
1542,
29897,
1599,
6213,
29901,
13,
4706,
1583,
17255,
1853,
353,
260,
13,
13,
1678,
732,
6799,
13,
1678,
822,
9927,
29898,
1311,
29897,
1599,
349,
7202,
3505,
29901,
13,
4706,
736,
1583,
17255,
6229,
5580,
13,
13,
1678,
732,
6229,
2673,
29889,
842,
357,
13,
1678,
822,
9927,
29898,
1311,
29892,
260,
29901,
349,
7202,
3505,
1125,
13,
4706,
1583,
17255,
6229,
5580,
353,
260,
13,
13,
1678,
732,
6799,
13,
1678,
822,
5906,
29898,
1311,
29897,
1599,
938,
29901,
13,
4706,
736,
1583,
17255,
9264,
13,
13,
1678,
732,
9264,
29889,
842,
357,
13,
1678,
822,
5906,
29898,
1311,
29892,
260,
29901,
938,
1125,
13,
4706,
1583,
17255,
9264,
353,
260,
13,
13,
1678,
732,
6799,
13,
1678,
822,
5700,
2696,
29898,
1311,
29897,
1599,
938,
29901,
13,
4706,
736,
1583,
17255,
7582,
2696,
13,
13,
1678,
732,
7582,
2696,
29889,
842,
357,
13,
1678,
822,
5700,
2696,
29898,
1311,
29892,
260,
29901,
938,
1125,
13,
4706,
1583,
17255,
7582,
2696,
353,
260,
13,
13,
13,
1990,
1222,
18505,
29901,
13,
1678,
515,
10677,
1053,
2224,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
1583,
17255,
24772,
353,
6213,
13,
4706,
1583,
17255,
16859,
353,
6213,
13,
4706,
1583,
17255,
978,
353,
6213,
13,
4706,
1583,
17255,
2146,
600,
861,
353,
6213,
13,
4706,
1583,
17255,
29887,
401,
29918,
19322,
353,
6213,
13,
4706,
1583,
17255,
13148,
29918,
2238,
29918,
20698,
353,
6213,
13,
4706,
1583,
17255,
1915,
300,
668,
29918,
20698,
353,
6213,
13,
13,
1678,
732,
6799,
13,
1678,
822,
10898,
29898,
1311,
29897,
1599,
2224,
29889,
2605,
7196,
29901,
13,
4706,
736,
1583,
17255,
24772,
13,
13,
1678,
732,
24772,
29889,
842,
357,
13,
1678,
822,
10898,
29898,
1311,
29892,
260,
29901,
2224,
29889,
2605,
7196,
29897,
1599,
6213,
29901,
13,
4706,
1583,
17255,
24772,
353,
260,
13,
13,
1678,
732,
6799,
13,
1678,
822,
274,
16434,
29898,
1311,
29897,
1599,
315,
16434,
29901,
13,
4706,
736,
1583,
17255,
16859,
13,
13,
1678,
732,
16859,
29889,
842,
357,
13,
1678,
822,
274,
16434,
29898,
1311,
29892,
260,
29901,
315,
16434,
29897,
1599,
6213,
29901,
13,
4706,
1583,
17255,
16859,
353,
260,
13,
13,
1678,
732,
6799,
13,
1678,
822,
1024,
29898,
1311,
29897,
1599,
851,
29901,
13,
4706,
736,
1583,
17255,
978,
13,
13,
1678,
732,
978,
29889,
842,
357,
13,
1678,
822,
1024,
29898,
1311,
29892,
260,
29901,
851,
29897,
1599,
6213,
29901,
13,
4706,
1583,
17255,
978,
353,
260,
13,
13,
1678,
732,
6799,
13,
1678,
822,
25557,
29898,
1311,
29897,
1599,
851,
29901,
13,
4706,
736,
1583,
17255,
2146,
600,
861,
13,
13,
1678,
732,
2146,
600,
861,
29889,
842,
357,
13,
1678,
822,
25557,
29898,
1311,
29892,
260,
29901,
851,
29897,
1599,
6213,
29901,
13,
4706,
1583,
17255,
2146,
600,
861,
353,
260,
13,
13,
1678,
732,
6799,
13,
1678,
822,
330,
401,
29918,
19322,
29898,
1311,
29897,
1599,
938,
29901,
13,
4706,
736,
1583,
17255,
29887,
401,
29918,
19322,
13,
13,
1678,
732,
29887,
401,
29918,
19322,
29889,
842,
357,
13,
1678,
822,
330,
401,
29918,
19322,
29898,
1311,
29892,
260,
29901,
938,
29897,
1599,
6213,
29901,
13,
4706,
1583,
17255,
29887,
401,
29918,
19322,
353,
260,
13,
13,
1678,
732,
6799,
13,
1678,
822,
7546,
29918,
2238,
29918,
20698,
29898,
1311,
29897,
1599,
9657,
29901,
13,
4706,
736,
1583,
17255,
13148,
29918,
2238,
29918,
20698,
13,
13,
1678,
732,
13148,
29918,
2238,
29918,
20698,
29889,
842,
357,
13,
1678,
822,
7546,
29918,
2238,
29918,
20698,
29898,
1311,
29892,
286,
29901,
9657,
29897,
1599,
6213,
29901,
13,
4706,
1583,
17255,
13148,
29918,
2238,
29918,
20698,
353,
286,
13,
13,
1678,
732,
6799,
13,
1678,
822,
6276,
300,
668,
29918,
20698,
29898,
1311,
29897,
1599,
9657,
29901,
13,
4706,
736,
1583,
17255,
1915,
300,
668,
29918,
20698,
13,
13,
1678,
732,
1915,
300,
668,
29918,
20698,
29889,
842,
357,
13,
1678,
822,
6276,
300,
668,
29918,
20698,
29898,
1311,
29892,
286,
29901,
9657,
29897,
1599,
6213,
29901,
13,
4706,
1583,
17255,
1915,
300,
668,
29918,
20698,
353,
286,
13,
13,
1678,
822,
1065,
29898,
1311,
29892,
432,
4061,
29901,
6120,
353,
7700,
29892,
2752,
29901,
6120,
353,
7700,
29897,
1599,
6213,
29901,
13,
4706,
565,
1583,
29889,
16859,
338,
6213,
470,
1583,
29889,
24772,
338,
6213,
470,
1583,
29889,
978,
338,
6213,
29901,
13,
9651,
1480,
29889,
14057,
703,
3991,
29892,
4408,
470,
10802,
29879,
338,
6213,
29889,
2216,
5609,
292,
3099,
1159,
13,
9651,
736,
13,
13,
4706,
396,
432,
29886,
387,
28221,
20928,
13,
4706,
1583,
29889,
24772,
29889,
9202,
29898,
13,
9651,
349,
7202,
29889,
29879,
7093,
29961,
1311,
29889,
16859,
29889,
6229,
2673,
1402,
13,
9651,
7164,
29918,
4317,
29922,
1311,
29889,
16859,
29889,
9264,
29892,
13,
9651,
5700,
2696,
29918,
4317,
29922,
1311,
29889,
16859,
29889,
7582,
2696,
29892,
13,
4706,
1723,
13,
13,
4706,
5096,
353,
16096,
29889,
1429,
580,
13,
4706,
3515,
353,
5096,
29961,
29906,
29962,
13,
4706,
3883,
353,
16096,
29889,
657,
5453,
29898,
2557,
29961,
29900,
2314,
13,
4706,
10887,
353,
16096,
29889,
657,
4993,
29898,
5453,
29897,
13,
13,
4706,
565,
432,
4061,
29901,
13,
9651,
5004,
29918,
29277,
353,
1583,
29889,
24772,
29889,
657,
29918,
29277,
580,
13,
9651,
363,
7546,
29892,
22844,
297,
5004,
29918,
29277,
29889,
7076,
7295,
13,
18884,
269,
466,
3871,
353,
349,
7202,
3505,
1170,
29889,
7039,
29961,
1311,
29889,
16859,
29889,
6229,
2673,
29962,
13,
18884,
7672,
262,
3871,
353,
18399,
357,
1170,
29889,
7039,
29961,
1311,
29889,
16859,
29889,
1853,
29962,
13,
18884,
285,
978,
353,
313,
13,
462,
1678,
285,
29908,
29912,
1311,
29889,
978,
3227,
1311,
29889,
2146,
600,
861,
3227,
29879,
466,
3871,
3227,
29885,
496,
262,
3871,
3227,
13148,
2403,
29908,
13,
462,
1678,
285,
29908,
29912,
8568,
1982,
29889,
17051,
29906,
29945,
29953,
29898,
1516,
29889,
12508,
877,
9420,
29899,
29947,
1495,
467,
20970,
7501,
342,
580,
5038,
13,
18884,
1723,
13,
13,
18884,
432,
29886,
387,
29918,
12083,
353,
848,
29889,
1469,
9170,
4598,
2141,
6173,
29898,
1311,
29889,
978,
29897,
13,
18884,
432,
29886,
387,
29918,
9482,
261,
353,
4050,
261,
29889,
29967,
29886,
387,
21323,
29898,
26568,
29918,
12083,
29897,
13,
18884,
432,
29886,
387,
29918,
9482,
261,
29889,
9482,
29898,
6739,
29892,
6287,
29922,
29946,
29889,
29900,
29897,
13,
18884,
432,
29886,
387,
29918,
9482,
261,
29889,
7620,
29898,
29888,
29908,
29912,
29888,
978,
27195,
13,
13,
4706,
565,
2752,
29901,
13,
9651,
2752,
29918,
12083,
353,
848,
29889,
1469,
9170,
4598,
2141,
4993,
29898,
1311,
29889,
978,
29897,
13,
9651,
269,
466,
3871,
353,
349,
7202,
3505,
1170,
29889,
7039,
29961,
1311,
29889,
16859,
29889,
6229,
2673,
29962,
13,
9651,
7672,
262,
3871,
353,
18399,
357,
1170,
29889,
7039,
29961,
1311,
29889,
16859,
29889,
1853,
29962,
13,
9651,
285,
978,
353,
313,
13,
18884,
285,
29908,
29912,
1311,
29889,
978,
3227,
1311,
29889,
2146,
600,
861,
3227,
29879,
466,
3871,
3227,
29885,
496,
262,
3871,
2403,
29908,
13,
18884,
285,
29908,
29912,
8568,
1982,
29889,
17051,
29906,
29945,
29953,
29898,
1516,
29889,
12508,
877,
9420,
29899,
29947,
1495,
467,
20970,
7501,
342,
580,
1836,
2272,
29908,
13,
9651,
1723,
13,
9651,
1053,
2224,
1982,
13,
13,
9651,
2224,
1982,
29889,
2605,
29898,
4993,
29918,
12083,
467,
11256,
3972,
29898,
862,
1237,
29922,
5574,
29892,
1863,
29918,
554,
29922,
5574,
29897,
13,
9651,
1480,
29889,
16773,
29898,
29888,
29908,
29903,
10511,
2752,
304,
426,
4993,
29918,
12083,
847,
285,
978,
27195,
13,
9651,
411,
1722,
29898,
4993,
29918,
12083,
847,
285,
978,
29892,
376,
29893,
1159,
408,
934,
29901,
13,
18884,
934,
29889,
3539,
29898,
1516,
29897,
13,
13,
4706,
1583,
29889,
24772,
29889,
9202,
29898,
13,
9651,
349,
7202,
29889,
29879,
7093,
29961,
1311,
29889,
16859,
29889,
6229,
2673,
1402,
13,
9651,
921,
29891,
29918,
19790,
29922,
18454,
20738,
943,
29889,
17470,
29961,
1311,
29889,
16859,
29889,
1853,
1402,
13,
9651,
7164,
29918,
4317,
29922,
1311,
29889,
16859,
29889,
9264,
29892,
13,
9651,
1962,
29918,
23687,
29922,
8140,
3317,
15845,
29889,
10339,
29961,
1311,
29889,
16859,
29889,
1853,
1822,
23583,
3285,
13,
9651,
5700,
2696,
29918,
4317,
29922,
1311,
29889,
16859,
29889,
7582,
2696,
29892,
13,
4706,
1723,
13,
13,
4706,
269,
466,
3871,
353,
349,
7202,
3505,
1170,
29889,
7039,
29961,
1311,
29889,
16859,
29889,
6229,
2673,
29962,
13,
4706,
7672,
262,
3871,
353,
18399,
357,
1170,
29889,
7039,
29961,
1311,
29889,
16859,
29889,
1853,
29962,
13,
4706,
285,
978,
353,
285,
29908,
29912,
1311,
29889,
978,
3227,
1311,
29889,
2146,
600,
861,
3227,
29879,
466,
3871,
3227,
29885,
496,
262,
3871,
3227,
8568,
1982,
29889,
17051,
29906,
29945,
29953,
29898,
1516,
29889,
12508,
877,
9420,
29899,
29947,
1495,
467,
20970,
7501,
342,
580,
5038,
13,
4706,
3402,
353,
1222,
637,
5809,
9689,
886,
29889,
10339,
29961,
1311,
29889,
16859,
29889,
1853,
29962,
13,
4706,
565,
1583,
29889,
1915,
300,
668,
29918,
20698,
322,
3402,
338,
1222,
637,
5809,
29889,
3954,
7239,
29901,
13,
9651,
298,
29886,
3820,
29918,
12083,
353,
848,
29889,
1469,
9170,
4598,
2141,
28887,
3820,
29898,
1311,
29889,
978,
29897,
13,
9651,
298,
29886,
3820,
29918,
9482,
261,
353,
4050,
261,
29889,
3954,
7239,
21323,
29898,
13,
18884,
298,
29886,
3820,
29918,
12083,
29892,
1196,
29918,
1853,
29918,
20698,
29922,
1311,
29889,
1915,
300,
668,
29918,
20698,
13,
9651,
1723,
13,
9651,
298,
29886,
3820,
29918,
9482,
261,
29889,
9482,
29898,
1311,
29889,
24772,
29897,
13,
9651,
298,
29886,
3820,
29918,
9482,
261,
29889,
7620,
29898,
29888,
29908,
29912,
29888,
978,
27195,
13,
4706,
565,
1583,
29889,
13148,
29918,
2238,
29918,
20698,
338,
451,
6213,
29901,
13,
9651,
565,
3402,
338,
1222,
637,
5809,
29889,
3954,
7239,
29901,
13,
18884,
298,
29886,
3820,
29918,
12083,
353,
848,
29889,
1469,
9170,
4598,
2141,
28887,
3820,
29898,
1311,
29889,
978,
29897,
13,
13,
18884,
298,
29886,
3820,
29918,
9482,
261,
353,
4050,
261,
29889,
3954,
7239,
21323,
29898,
13,
462,
1678,
298,
29886,
3820,
29918,
12083,
29892,
7546,
29918,
2238,
29918,
20698,
29922,
1311,
29889,
13148,
29918,
2238,
29918,
20698,
13,
18884,
1723,
13,
18884,
298,
29886,
3820,
29918,
9482,
261,
29889,
9482,
29898,
1311,
29889,
24772,
29897,
13,
18884,
298,
29886,
3820,
29918,
9482,
261,
29889,
7620,
29898,
29888,
29908,
29912,
29888,
978,
27195,
13,
4706,
1683,
29901,
13,
9651,
5004,
29918,
29277,
353,
1583,
29889,
24772,
29889,
657,
29918,
29277,
580,
13,
9651,
363,
7546,
29892,
22844,
297,
5004,
29918,
29277,
29889,
7076,
7295,
13,
18884,
565,
3402,
338,
1222,
637,
5809,
29889,
3954,
7239,
29901,
13,
462,
1678,
298,
29886,
3820,
29918,
12083,
353,
848,
29889,
1469,
9170,
4598,
2141,
28887,
3820,
29898,
1311,
29889,
978,
29897,
13,
462,
1678,
298,
29886,
3820,
29918,
9482,
261,
353,
4050,
261,
29889,
3954,
7239,
21323,
29898,
28887,
3820,
29918,
12083,
29897,
13,
462,
1678,
298,
29886,
3820,
29918,
9482,
261,
29889,
9482,
29898,
6739,
29897,
13,
462,
1678,
298,
29886,
3820,
29918,
9482,
261,
29889,
7620,
29898,
29888,
29908,
29912,
29888,
978,
3227,
13148,
27195,
13,
13,
18884,
565,
3402,
338,
1222,
637,
5809,
29889,
7597,
29954,
29901,
13,
462,
1678,
25773,
29918,
3972,
353,
848,
29889,
1469,
9170,
4598,
2141,
15120,
29898,
1311,
29889,
978,
29897,
13,
462,
1678,
25773,
29918,
9482,
261,
353,
4050,
261,
29889,
29903,
29894,
29887,
21323,
29898,
15120,
29918,
3972,
29897,
13,
462,
1678,
25773,
29918,
9482,
261,
29889,
9482,
29898,
6739,
29897,
13,
462,
1678,
25773,
29918,
9482,
261,
29889,
7620,
29898,
29888,
29908,
29912,
29888,
978,
3227,
13148,
27195,
13,
13,
18884,
565,
3402,
338,
1222,
637,
5809,
29889,
29954,
16524,
29901,
13,
462,
1678,
330,
401,
29918,
12083,
353,
848,
29889,
1469,
9170,
4598,
2141,
29887,
401,
29898,
1311,
29889,
978,
29897,
13,
462,
1678,
565,
1583,
29889,
29887,
401,
29918,
19322,
29901,
13,
462,
4706,
330,
401,
29918,
9482,
261,
353,
4050,
261,
29889,
29954,
3399,
21323,
29898,
13,
462,
9651,
330,
401,
29918,
12083,
29892,
503,
29918,
3204,
29922,
29946,
29889,
29945,
13,
462,
4706,
1723,
13,
462,
1678,
1683,
29901,
13,
462,
4706,
330,
401,
29918,
9482,
261,
353,
4050,
261,
29889,
29954,
3399,
21323,
29898,
13,
462,
9651,
330,
401,
29918,
12083,
29892,
8343,
10492,
29918,
3594,
29922,
1311,
29889,
29887,
401,
29918,
19322,
29892,
503,
29918,
3204,
29922,
29946,
29889,
29945,
13,
462,
4706,
1723,
13,
462,
1678,
330,
401,
29918,
9482,
261,
29889,
9482,
29898,
6739,
29897,
13,
462,
1678,
330,
401,
29918,
9482,
261,
29889,
7620,
29898,
29888,
29908,
29912,
13148,
3227,
29888,
978,
27195,
13,
13,
13,
1990,
12545,
26382,
15646,
29901,
13,
1678,
515,
10677,
1053,
2224,
13,
13,
1678,
822,
429,
29898,
13,
4706,
1583,
29892,
13,
4706,
10898,
29901,
2224,
29889,
2605,
7196,
29892,
13,
4706,
282,
1853,
29901,
18399,
357,
1542,
29892,
13,
4706,
282,
2311,
29901,
349,
7202,
3505,
29892,
13,
4706,
5906,
29901,
938,
29892,
13,
4706,
1024,
29901,
851,
353,
376,
4905,
29918,
978,
613,
13,
4706,
25557,
29901,
851,
353,
12633,
13,
4706,
5700,
2696,
29901,
938,
353,
6213,
29892,
13,
4706,
330,
401,
29918,
19322,
29901,
938,
353,
6213,
29892,
13,
4706,
298,
29886,
3820,
29918,
2238,
29918,
13148,
29918,
20698,
29922,
8516,
29892,
13,
4706,
298,
29886,
3820,
29918,
1915,
300,
668,
29918,
20698,
29922,
8516,
29892,
13,
268,
1125,
13,
4706,
274,
16434,
353,
315,
16434,
580,
13,
4706,
274,
16434,
29889,
1853,
353,
282,
1853,
13,
4706,
274,
16434,
29889,
6229,
2673,
353,
282,
2311,
13,
4706,
274,
16434,
29889,
9264,
353,
5906,
13,
4706,
274,
16434,
29889,
7582,
2696,
353,
5700,
2696,
13,
13,
4706,
396,
10898,
29889,
14941,
580,
13,
13,
4706,
1518,
353,
1222,
18505,
580,
13,
4706,
1518,
29889,
16859,
353,
274,
16434,
13,
4706,
1518,
29889,
24772,
353,
10898,
13,
4706,
1518,
29889,
978,
353,
1024,
13,
4706,
1518,
29889,
2146,
600,
861,
353,
851,
29898,
2146,
600,
861,
29897,
13,
4706,
1518,
29889,
29887,
401,
29918,
19322,
353,
330,
401,
29918,
19322,
13,
4706,
1518,
29889,
13148,
29918,
2238,
29918,
20698,
353,
298,
29886,
3820,
29918,
2238,
29918,
13148,
29918,
20698,
13,
4706,
1518,
29889,
1915,
300,
668,
29918,
20698,
353,
298,
29886,
3820,
29918,
1915,
300,
668,
29918,
20698,
13,
4706,
1518,
29889,
3389,
29898,
5574,
29892,
5852,
29897,
13,
2
] |
sms/backends/__init__.py | sms77io/django-sms | 29 | 1610806 | # SMS backends shipped with django-sms
| [
1,
396,
317,
4345,
1250,
1975,
528,
16242,
411,
9557,
29899,
29879,
1516,
13,
2
] |
Practice/Problem Solving/BirthdayChocolate.py | avantikasharma/HackerRank-Solutions | 1 | 190656 | #!/bin/python
import sys
def solve(n, s, d, m):
total=0
for i in range(n-m+1):
sum=0
for j in range(m):
sum=sum+s[i+j]
if sum==d:
total=total+1
return total
n = int(raw_input().strip())
s = map(int, raw_input().strip().split(' '))
d, m = raw_input().strip().split(' ')
d, m = [int(d), int(m)]
result = solve(n, s, d, m)
print(result)
| [
1,
18787,
2109,
29914,
4691,
13,
13,
5215,
10876,
13,
13,
1753,
4505,
29898,
29876,
29892,
269,
29892,
270,
29892,
286,
1125,
13,
1678,
3001,
29922,
29900,
13,
1678,
363,
474,
297,
3464,
29898,
29876,
29899,
29885,
29974,
29896,
1125,
13,
4706,
2533,
29922,
29900,
13,
4706,
363,
432,
297,
3464,
29898,
29885,
1125,
13,
9651,
2533,
29922,
2083,
29974,
29879,
29961,
29875,
29974,
29926,
29962,
13,
4706,
565,
2533,
1360,
29881,
29901,
13,
9651,
3001,
29922,
7827,
29974,
29896,
13,
1678,
736,
3001,
13,
9651,
13,
13,
29876,
353,
938,
29898,
1610,
29918,
2080,
2141,
17010,
3101,
13,
29879,
353,
2910,
29898,
524,
29892,
10650,
29918,
2080,
2141,
17010,
2141,
5451,
877,
525,
876,
13,
29881,
29892,
286,
353,
10650,
29918,
2080,
2141,
17010,
2141,
5451,
877,
25710,
13,
29881,
29892,
286,
353,
518,
524,
29898,
29881,
511,
938,
29898,
29885,
4638,
13,
2914,
353,
4505,
29898,
29876,
29892,
269,
29892,
270,
29892,
286,
29897,
13,
2158,
29898,
2914,
29897,
13,
2
] |
statuscheck/services/bases/_statusio.py | amureki/statuscheck | 35 | 102057 | import httpx
from statuscheck.services.bases._base import BaseServiceAPI
from statuscheck.services.models.generic import (
COMPONENT_TYPE_DEGRADED,
COMPONENT_TYPE_GOOD,
COMPONENT_TYPE_MAINTENANCE,
COMPONENT_TYPE_MAJOR_OUTAGE,
COMPONENT_TYPE_PARTIAL_OUTAGE,
COMPONENT_TYPE_SECURITY,
COMPONENT_TYPE_UNKNOWN,
TYPE_GOOD,
TYPE_INCIDENT,
TYPE_MAINTENANCE,
TYPE_OUTAGE,
TYPE_SECURITY,
Component,
Incident,
Status,
Summary,
)
STATUS_OK = 100
STATUS_PLANNED_MAINTENANCE = 200
STATUS_DEGRADED_PERFORMANCE = 300
STATUS_PARTIAL_SERVICE_DISRUPTION = 400
STATUS_MAJOR = 500
STATUS_SECURITY = 600
STATUS_TYPE_MAPPING = {
STATUS_OK: TYPE_GOOD,
STATUS_PLANNED_MAINTENANCE: TYPE_MAINTENANCE,
STATUS_DEGRADED_PERFORMANCE: TYPE_INCIDENT,
STATUS_PARTIAL_SERVICE_DISRUPTION: TYPE_INCIDENT,
STATUS_MAJOR: TYPE_OUTAGE,
STATUS_SECURITY: TYPE_SECURITY,
}
COMPONENT_STATUS_GOOD = 100
COMPONENT_STATUS_MAINTENANCE = 200
COMPONENT_STATUS_DEGRADED = 300
COMPONENT_STATUS_PARTIAL_OUTAGE = 400
COMPONENT_STATUS_MAJOR_OUTAGE = 500
COMPONENT_STATUS_SECURITY = 600
COMPONENT_STATUS_UNKNOWN = ""
COMPONENT_STATUS_MAPPING = {
COMPONENT_STATUS_GOOD: COMPONENT_TYPE_GOOD,
COMPONENT_STATUS_MAINTENANCE: COMPONENT_TYPE_MAINTENANCE,
COMPONENT_STATUS_DEGRADED: COMPONENT_TYPE_DEGRADED,
COMPONENT_STATUS_PARTIAL_OUTAGE: COMPONENT_TYPE_PARTIAL_OUTAGE,
COMPONENT_STATUS_MAJOR_OUTAGE: COMPONENT_TYPE_MAJOR_OUTAGE,
COMPONENT_STATUS_SECURITY: COMPONENT_TYPE_SECURITY,
COMPONENT_STATUS_UNKNOWN: COMPONENT_TYPE_UNKNOWN,
}
class BaseStatusIOAPI(BaseServiceAPI):
"""
Status.io pages API handler.
Documentation: https://statusio.docs.apiary.io
Public status API: https://kb.status.io/developers/public-status-api/
"""
domain_id: str = ""
def _get_base_url(self) -> str:
if not self.domain_id:
raise NotImplementedError("Please, add domain id")
return f"https://api.status.io/1.0/status/{self.domain_id}"
def get_summary(self) -> Summary:
url = self._get_base_url()
response_json = httpx.get(url).json()
status_dict = response_json["result"]["status_overall"]
status = Status(
code=str(status_dict["status_code"]),
name=STATUS_TYPE_MAPPING[status_dict["status_code"]],
description=status_dict["status"],
is_ok=status_dict["status_code"] == 100,
)
components = [
Component(
id=component["id"],
name=component["name"],
status=COMPONENT_STATUS_MAPPING[component["status_code"]],
extra_data=component,
)
for component in response_json["result"]["status"]
]
# incident payload contains trimmed component data, so we need to enrich it
components_dict = {component.id: component for component in components}
incidents = [
Incident(
id=incident["_id"],
name=incident["name"],
components=[
Component(
id=component["_id"],
name=component["name"],
status=components_dict[component["_id"]].status,
)
for component in incident.get("components_affected", [])
],
extra_data=incident,
)
for incident in response_json["result"]["incidents"]
]
self.summary = Summary(status, components, incidents)
return self.summary
| [
1,
1053,
1732,
29916,
13,
13,
3166,
4660,
3198,
29889,
9916,
29889,
29890,
2129,
3032,
3188,
1053,
7399,
3170,
8787,
13,
3166,
4660,
3198,
29889,
9916,
29889,
9794,
29889,
19206,
1053,
313,
13,
1678,
4810,
3580,
1164,
3919,
29918,
11116,
29918,
2287,
29954,
4717,
2287,
29928,
29892,
13,
1678,
4810,
3580,
1164,
3919,
29918,
11116,
29918,
17080,
13668,
29892,
13,
1678,
4810,
3580,
1164,
3919,
29918,
11116,
29918,
1529,
10192,
1430,
23219,
29892,
13,
1678,
4810,
3580,
1164,
3919,
29918,
11116,
29918,
1529,
29967,
1955,
29918,
12015,
10461,
29892,
13,
1678,
4810,
3580,
1164,
3919,
29918,
11116,
29918,
26092,
25758,
29918,
12015,
10461,
29892,
13,
1678,
4810,
3580,
1164,
3919,
29918,
11116,
29918,
1660,
22484,
11937,
29892,
13,
1678,
4810,
3580,
1164,
3919,
29918,
11116,
29918,
3904,
29968,
6632,
16048,
29892,
13,
1678,
323,
6959,
29918,
17080,
13668,
29892,
13,
1678,
323,
6959,
29918,
1177,
29907,
1367,
3919,
29892,
13,
1678,
323,
6959,
29918,
1529,
10192,
1430,
23219,
29892,
13,
1678,
323,
6959,
29918,
12015,
10461,
29892,
13,
1678,
323,
6959,
29918,
1660,
22484,
11937,
29892,
13,
1678,
15924,
29892,
13,
1678,
9266,
1693,
29892,
13,
1678,
16034,
29892,
13,
1678,
6991,
5219,
29892,
13,
29897,
13,
13,
27047,
29918,
8949,
353,
29871,
29896,
29900,
29900,
13,
27047,
29918,
7390,
2190,
29940,
3352,
29918,
1529,
10192,
1430,
23219,
353,
29871,
29906,
29900,
29900,
13,
27047,
29918,
2287,
29954,
4717,
2287,
29928,
29918,
13171,
22051,
27616,
4741,
353,
29871,
29941,
29900,
29900,
13,
27047,
29918,
26092,
25758,
29918,
6304,
19059,
29918,
23711,
29934,
4897,
29911,
2725,
353,
29871,
29946,
29900,
29900,
13,
27047,
29918,
1529,
29967,
1955,
353,
29871,
29945,
29900,
29900,
13,
27047,
29918,
1660,
22484,
11937,
353,
29871,
29953,
29900,
29900,
13,
13,
27047,
29918,
11116,
29918,
1529,
18009,
4214,
353,
426,
13,
1678,
6850,
1299,
3308,
29918,
8949,
29901,
323,
6959,
29918,
17080,
13668,
29892,
13,
1678,
6850,
1299,
3308,
29918,
7390,
2190,
29940,
3352,
29918,
1529,
10192,
1430,
23219,
29901,
323,
6959,
29918,
1529,
10192,
1430,
23219,
29892,
13,
1678,
6850,
1299,
3308,
29918,
2287,
29954,
4717,
2287,
29928,
29918,
13171,
22051,
27616,
4741,
29901,
323,
6959,
29918,
1177,
29907,
1367,
3919,
29892,
13,
1678,
6850,
1299,
3308,
29918,
26092,
25758,
29918,
6304,
19059,
29918,
23711,
29934,
4897,
29911,
2725,
29901,
323,
6959,
29918,
1177,
29907,
1367,
3919,
29892,
13,
1678,
6850,
1299,
3308,
29918,
1529,
29967,
1955,
29901,
323,
6959,
29918,
12015,
10461,
29892,
13,
1678,
6850,
1299,
3308,
29918,
1660,
22484,
11937,
29901,
323,
6959,
29918,
1660,
22484,
11937,
29892,
13,
29913,
13,
13,
21514,
1164,
3919,
29918,
27047,
29918,
17080,
13668,
353,
29871,
29896,
29900,
29900,
13,
21514,
1164,
3919,
29918,
27047,
29918,
1529,
10192,
1430,
23219,
353,
29871,
29906,
29900,
29900,
13,
21514,
1164,
3919,
29918,
27047,
29918,
2287,
29954,
4717,
2287,
29928,
353,
29871,
29941,
29900,
29900,
13,
21514,
1164,
3919,
29918,
27047,
29918,
26092,
25758,
29918,
12015,
10461,
353,
29871,
29946,
29900,
29900,
13,
21514,
1164,
3919,
29918,
27047,
29918,
1529,
29967,
1955,
29918,
12015,
10461,
353,
29871,
29945,
29900,
29900,
13,
21514,
1164,
3919,
29918,
27047,
29918,
1660,
22484,
11937,
353,
29871,
29953,
29900,
29900,
13,
21514,
1164,
3919,
29918,
27047,
29918,
3904,
29968,
6632,
16048,
353,
5124,
13,
13,
21514,
1164,
3919,
29918,
27047,
29918,
1529,
18009,
4214,
353,
426,
13,
1678,
4810,
3580,
1164,
3919,
29918,
27047,
29918,
17080,
13668,
29901,
4810,
3580,
1164,
3919,
29918,
11116,
29918,
17080,
13668,
29892,
13,
1678,
4810,
3580,
1164,
3919,
29918,
27047,
29918,
1529,
10192,
1430,
23219,
29901,
4810,
3580,
1164,
3919,
29918,
11116,
29918,
1529,
10192,
1430,
23219,
29892,
13,
1678,
4810,
3580,
1164,
3919,
29918,
27047,
29918,
2287,
29954,
4717,
2287,
29928,
29901,
4810,
3580,
1164,
3919,
29918,
11116,
29918,
2287,
29954,
4717,
2287,
29928,
29892,
13,
1678,
4810,
3580,
1164,
3919,
29918,
27047,
29918,
26092,
25758,
29918,
12015,
10461,
29901,
4810,
3580,
1164,
3919,
29918,
11116,
29918,
26092,
25758,
29918,
12015,
10461,
29892,
13,
1678,
4810,
3580,
1164,
3919,
29918,
27047,
29918,
1529,
29967,
1955,
29918,
12015,
10461,
29901,
4810,
3580,
1164,
3919,
29918,
11116,
29918,
1529,
29967,
1955,
29918,
12015,
10461,
29892,
13,
1678,
4810,
3580,
1164,
3919,
29918,
27047,
29918,
1660,
22484,
11937,
29901,
4810,
3580,
1164,
3919,
29918,
11116,
29918,
1660,
22484,
11937,
29892,
13,
1678,
4810,
3580,
1164,
3919,
29918,
27047,
29918,
3904,
29968,
6632,
16048,
29901,
4810,
3580,
1164,
3919,
29918,
11116,
29918,
3904,
29968,
6632,
16048,
29892,
13,
29913,
13,
13,
13,
1990,
7399,
5709,
5971,
8787,
29898,
5160,
3170,
8787,
1125,
13,
1678,
9995,
13,
1678,
16034,
29889,
601,
6515,
3450,
7834,
29889,
13,
13,
1678,
10854,
362,
29901,
2045,
597,
4882,
601,
29889,
2640,
29889,
2754,
653,
29889,
601,
13,
1678,
5236,
4660,
3450,
29901,
2045,
597,
21066,
29889,
4882,
29889,
601,
29914,
17426,
29914,
3597,
29899,
4882,
29899,
2754,
29914,
13,
1678,
9995,
13,
13,
1678,
5354,
29918,
333,
29901,
851,
353,
5124,
13,
13,
1678,
822,
903,
657,
29918,
3188,
29918,
2271,
29898,
1311,
29897,
1599,
851,
29901,
13,
4706,
565,
451,
1583,
29889,
7247,
29918,
333,
29901,
13,
9651,
12020,
2216,
1888,
2037,
287,
2392,
703,
12148,
29892,
788,
5354,
1178,
1159,
13,
4706,
736,
285,
29908,
991,
597,
2754,
29889,
4882,
29889,
601,
29914,
29896,
29889,
29900,
29914,
4882,
19248,
1311,
29889,
7247,
29918,
333,
5038,
13,
13,
1678,
822,
679,
29918,
7727,
29898,
1311,
29897,
1599,
6991,
5219,
29901,
13,
4706,
3142,
353,
1583,
3032,
657,
29918,
3188,
29918,
2271,
580,
13,
4706,
2933,
29918,
3126,
353,
1732,
29916,
29889,
657,
29898,
2271,
467,
3126,
580,
13,
4706,
4660,
29918,
8977,
353,
2933,
29918,
3126,
3366,
2914,
3108,
3366,
4882,
29918,
957,
497,
3108,
13,
4706,
4660,
353,
16034,
29898,
13,
9651,
775,
29922,
710,
29898,
4882,
29918,
8977,
3366,
4882,
29918,
401,
3108,
511,
13,
9651,
1024,
29922,
27047,
29918,
11116,
29918,
1529,
18009,
4214,
29961,
4882,
29918,
8977,
3366,
4882,
29918,
401,
3108,
1402,
13,
9651,
6139,
29922,
4882,
29918,
8977,
3366,
4882,
12436,
13,
9651,
338,
29918,
554,
29922,
4882,
29918,
8977,
3366,
4882,
29918,
401,
3108,
1275,
29871,
29896,
29900,
29900,
29892,
13,
4706,
1723,
13,
13,
4706,
7117,
353,
518,
13,
9651,
15924,
29898,
13,
18884,
1178,
29922,
9700,
3366,
333,
12436,
13,
18884,
1024,
29922,
9700,
3366,
978,
12436,
13,
18884,
4660,
29922,
21514,
1164,
3919,
29918,
27047,
29918,
1529,
18009,
4214,
29961,
9700,
3366,
4882,
29918,
401,
3108,
1402,
13,
18884,
4805,
29918,
1272,
29922,
9700,
29892,
13,
9651,
1723,
13,
9651,
363,
4163,
297,
2933,
29918,
3126,
3366,
2914,
3108,
3366,
4882,
3108,
13,
4706,
4514,
13,
13,
4706,
396,
15134,
20092,
3743,
17151,
2168,
4163,
848,
29892,
577,
591,
817,
304,
427,
4018,
372,
13,
4706,
7117,
29918,
8977,
353,
426,
9700,
29889,
333,
29901,
4163,
363,
4163,
297,
7117,
29913,
13,
4706,
5528,
16719,
353,
518,
13,
9651,
9266,
1693,
29898,
13,
18884,
1178,
29922,
3742,
1693,
3366,
29918,
333,
12436,
13,
18884,
1024,
29922,
3742,
1693,
3366,
978,
12436,
13,
18884,
7117,
11759,
13,
462,
1678,
15924,
29898,
13,
462,
4706,
1178,
29922,
9700,
3366,
29918,
333,
12436,
13,
462,
4706,
1024,
29922,
9700,
3366,
978,
12436,
13,
462,
4706,
4660,
29922,
14036,
29918,
8977,
29961,
9700,
3366,
29918,
333,
3108,
1822,
4882,
29892,
13,
462,
1678,
1723,
13,
462,
1678,
363,
4163,
297,
15134,
29889,
657,
703,
14036,
29918,
3470,
26458,
613,
518,
2314,
13,
18884,
21251,
13,
18884,
4805,
29918,
1272,
29922,
3742,
1693,
29892,
13,
9651,
1723,
13,
9651,
363,
15134,
297,
2933,
29918,
3126,
3366,
2914,
3108,
3366,
3742,
16719,
3108,
13,
4706,
4514,
13,
13,
4706,
1583,
29889,
7727,
353,
6991,
5219,
29898,
4882,
29892,
7117,
29892,
5528,
16719,
29897,
13,
4706,
736,
1583,
29889,
7727,
13,
2
] |
tests/test_util.py | rampage644/densecap-tensorflow | 10 | 1614766 | import densecap.util
def test_IoU_overlap():
box0 = (0, 0, 100, 100)
box1 = (50, 50, 100, 100)
box2 = (0, 50, 100, 100)
box3 = (50, 0, 100, 100)
assert densecap.util.iou(box0, box1) == 50 ** 2 / (2 * 100 ** 2 - 50 ** 2)
assert densecap.util.iou(box0, box2) == (50 * 100) / (2 * 100 ** 2 - 50 * 100)
assert densecap.util.iou(box0, box3) == (50 * 100) / (2 * 100 ** 2 - 50 * 100)
def test_IoU_no_overlap():
box1 = (0, 0, 100, 100)
box2 = (100, 100, 20, 20)
box3 = (0, 120, 40, 40)
assert densecap.util.iou(box1, box2) == 0.0
assert densecap.util.iou(box1, box3) == 0.0
def test_IoU_inside():
box1 = (0, 0, 100, 100)
box2 = (10, 10, 20, 20)
box3 = (0, 30, 40, 40)
assert densecap.util.iou(box1, box2) == 20 ** 2 / 100 ** 2
assert densecap.util.iou(box2, box1) == 20 ** 2 / 100 ** 2
assert densecap.util.iou(box3, box1) == 40 ** 2 / 100 ** 2
def test_IoU_with_self():
box1 = (0, 0, 10, 10)
assert densecap.util.iou(box1, box1) == 1.0
| [
1,
1053,
972,
3471,
481,
29889,
4422,
13,
13,
13,
1753,
1243,
29918,
29902,
29877,
29965,
29918,
957,
6984,
7295,
13,
1678,
3800,
29900,
353,
313,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29900,
29900,
29892,
29871,
29896,
29900,
29900,
29897,
13,
1678,
3800,
29896,
353,
313,
29945,
29900,
29892,
29871,
29945,
29900,
29892,
29871,
29896,
29900,
29900,
29892,
29871,
29896,
29900,
29900,
29897,
13,
1678,
3800,
29906,
353,
313,
29900,
29892,
29871,
29945,
29900,
29892,
29871,
29896,
29900,
29900,
29892,
29871,
29896,
29900,
29900,
29897,
13,
1678,
3800,
29941,
353,
313,
29945,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29900,
29900,
29892,
29871,
29896,
29900,
29900,
29897,
13,
13,
1678,
4974,
972,
3471,
481,
29889,
4422,
29889,
29875,
283,
29898,
1884,
29900,
29892,
3800,
29896,
29897,
1275,
29871,
29945,
29900,
3579,
29871,
29906,
847,
313,
29906,
334,
29871,
29896,
29900,
29900,
3579,
29871,
29906,
448,
29871,
29945,
29900,
3579,
29871,
29906,
29897,
13,
1678,
4974,
972,
3471,
481,
29889,
4422,
29889,
29875,
283,
29898,
1884,
29900,
29892,
3800,
29906,
29897,
1275,
313,
29945,
29900,
334,
29871,
29896,
29900,
29900,
29897,
847,
313,
29906,
334,
29871,
29896,
29900,
29900,
3579,
29871,
29906,
448,
29871,
29945,
29900,
334,
29871,
29896,
29900,
29900,
29897,
13,
1678,
4974,
972,
3471,
481,
29889,
4422,
29889,
29875,
283,
29898,
1884,
29900,
29892,
3800,
29941,
29897,
1275,
313,
29945,
29900,
334,
29871,
29896,
29900,
29900,
29897,
847,
313,
29906,
334,
29871,
29896,
29900,
29900,
3579,
29871,
29906,
448,
29871,
29945,
29900,
334,
29871,
29896,
29900,
29900,
29897,
13,
13,
13,
1753,
1243,
29918,
29902,
29877,
29965,
29918,
1217,
29918,
957,
6984,
7295,
13,
1678,
3800,
29896,
353,
313,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29900,
29900,
29892,
29871,
29896,
29900,
29900,
29897,
13,
1678,
3800,
29906,
353,
313,
29896,
29900,
29900,
29892,
29871,
29896,
29900,
29900,
29892,
29871,
29906,
29900,
29892,
29871,
29906,
29900,
29897,
13,
1678,
3800,
29941,
353,
313,
29900,
29892,
29871,
29896,
29906,
29900,
29892,
29871,
29946,
29900,
29892,
29871,
29946,
29900,
29897,
13,
1678,
4974,
972,
3471,
481,
29889,
4422,
29889,
29875,
283,
29898,
1884,
29896,
29892,
3800,
29906,
29897,
1275,
29871,
29900,
29889,
29900,
13,
1678,
4974,
972,
3471,
481,
29889,
4422,
29889,
29875,
283,
29898,
1884,
29896,
29892,
3800,
29941,
29897,
1275,
29871,
29900,
29889,
29900,
13,
13,
13,
1753,
1243,
29918,
29902,
29877,
29965,
29918,
26102,
7295,
13,
1678,
3800,
29896,
353,
313,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29900,
29900,
29892,
29871,
29896,
29900,
29900,
29897,
13,
1678,
3800,
29906,
353,
313,
29896,
29900,
29892,
29871,
29896,
29900,
29892,
29871,
29906,
29900,
29892,
29871,
29906,
29900,
29897,
13,
1678,
3800,
29941,
353,
313,
29900,
29892,
29871,
29941,
29900,
29892,
29871,
29946,
29900,
29892,
29871,
29946,
29900,
29897,
13,
1678,
4974,
972,
3471,
481,
29889,
4422,
29889,
29875,
283,
29898,
1884,
29896,
29892,
3800,
29906,
29897,
1275,
29871,
29906,
29900,
3579,
29871,
29906,
847,
29871,
29896,
29900,
29900,
3579,
29871,
29906,
13,
1678,
4974,
972,
3471,
481,
29889,
4422,
29889,
29875,
283,
29898,
1884,
29906,
29892,
3800,
29896,
29897,
1275,
29871,
29906,
29900,
3579,
29871,
29906,
847,
29871,
29896,
29900,
29900,
3579,
29871,
29906,
13,
1678,
4974,
972,
3471,
481,
29889,
4422,
29889,
29875,
283,
29898,
1884,
29941,
29892,
3800,
29896,
29897,
1275,
29871,
29946,
29900,
3579,
29871,
29906,
847,
29871,
29896,
29900,
29900,
3579,
29871,
29906,
13,
13,
13,
1753,
1243,
29918,
29902,
29877,
29965,
29918,
2541,
29918,
1311,
7295,
13,
1678,
3800,
29896,
353,
313,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29900,
29892,
29871,
29896,
29900,
29897,
13,
1678,
4974,
972,
3471,
481,
29889,
4422,
29889,
29875,
283,
29898,
1884,
29896,
29892,
3800,
29896,
29897,
1275,
29871,
29896,
29889,
29900,
13,
2
] |
Model/lookalike-model/lookalike_model/trainer/train_multi_gpu.py | rangaswamymr/incubator-bluemarlin | 21 | 138478 | <filename>Model/lookalike-model/lookalike_model/trainer/train_multi_gpu.py
import os
os.environ['CUDA_VISIBLE_DEVICES'] = "0,1,2,3"
import time
import pickle
import random
import numpy as np
import tensorflow as tf
import sys
from input import DataInput, DataInputTest
from model_multi_gpu import Model, DIN
from sklearn.metrics import roc_auc_score
random.seed(1234)
np.random.seed(1234)
tf.set_random_seed(1234)
train_batch_size = 2048 #1024
test_batch_size = 2048 #1024
predict_batch_size = 32
predict_users_num = 1000
# predict_ads_num = 6
predict_ads_num = 30
time_interval_num = 10
gpu_num = 3
with open('ad_dataset_lookalike_jimmy_' + str(time_interval_num) + '.pkl', 'rb') as f:
train_set = pickle.load(f)
test_set = pickle.load(f)
cate_list = pickle.load(f)
user_count, item_count, cate_count = pickle.load(f)
with open('label_lookalike_jimmy_' + str(time_interval_num) + '.pkl', 'rb') as f:
test_lb = pickle.load(f)
test_set_with_label = []
for i in range(len(test_lb)):
test_set_with_label.append(tuple([test_set[i][0], test_set[i][1], test_set[i][2][0], test_lb[i]]))
best_auc = 0.0
best_auc_train = 0.0
best_auc_test = 0.0
def calc_auc(raw_arr):
"""Summary
Args:
raw_arr (TYPE): Description
Returns:
TYPE: Description
"""
# sort by pred value, from small to big
arr = sorted(raw_arr, key=lambda d:d[2])
auc = 0.0
fp1, tp1, fp2, tp2 = 0.0, 0.0, 0.0, 0.0
for record in arr:
fp2 += record[0] # noclick
tp2 += record[1] # click
auc += (fp2 - fp1) * (tp2 + tp1)
fp1, tp1 = fp2, tp2
# if all nonclick or click, disgard
threshold = len(arr) - 1e-3
if tp2 > threshold or fp2 > threshold:
return -0.5
if tp2 * fp2 > 0.0: # normal auc
return (1.0 - auc / (2.0 * tp2 * fp2))
else:
return None
def _auc_arr(score):
score_p = score[:,0]
score_n = score[:,1]
#print "============== p ============="
#print score_p
#print "============== n ============="
#print score_n
score_arr = []
for s in score_p.tolist():
score_arr.append([0, 1, s])
for s in score_n.tolist():
score_arr.append([1, 0, s])
return score_arr
def _eval(sess, model):
auc_sum = 0.0
score_arr = []
for _, uij in DataInputTest(test_set, test_batch_size):
auc_, score_ = model.eval(sess, uij)
score_arr += _auc_arr(score_)
auc_sum += auc_ * len(uij[0])
test_gauc = auc_sum / len(test_set)
Auc = calc_auc(score_arr)
global best_auc
if best_auc < test_gauc:
best_auc = test_gauc
model.save(sess, 'save_path/ckpt')
return test_gauc, Auc
def _eval_logdata(sess, model, dataset, batch_size, type):
score_arr = []
y = []
for _, uij in DataInput(dataset, batch_size):
score_ = model.eval_logdata(sess, uij)
score_arr.append(np.squeeze(score_[0]))
y.append(np.asarray(uij[2]))
# score_arr = np.vstack(score_arr)
score_arr = np.hstack(score_arr)
y = np.hstack(np.asarray(y))
Auc = roc_auc_score(y, score_arr)
global best_auc_train
global best_auc_test
if type=='train' and best_auc_train<Auc:
best_auc_train = Auc
if type=='test' and best_auc_test<Auc:
best_auc_test = Auc
model.save(sess, 'save_path/ckpt')
return Auc
def _eval_logdata_improve(sess, dataset, batch_size, type):
score_arr = []
y = []
for _, uij in DataInput(dataset, batch_size):
score_ = sess.run([batch_logits_test], feed_dict={
i_batch: uij[1],
j_batch: uij[2],
y_batch: uij[2],
hist_i_batch: uij[3],
sl_batch: uij[4]
})
score_arr.append(np.squeeze(score_[0]))
y.append(np.asarray(uij[2]))
score_arr = np.hstack(score_arr)
y = np.hstack(np.asarray(y))
Auc = roc_auc_score(y[:len(score_arr)], score_arr)
global best_auc_train
global best_auc_test
if type=='train' and best_auc_train<Auc:
best_auc_train = Auc
if type=='test' and best_auc_test<Auc:
best_auc_test = Auc
saver = tf.train.Saver()
saver.save(sess, save_path='save_path/ckpt')
return Auc
def _test(sess, model):
auc_sum = 0.0
score_arr = []
predicted_users_num = 0
print("test sub items")
for _, uij in DataInputTest(test_set, predict_batch_size):
if predicted_users_num >= predict_users_num:
break
score_ = model.test(sess, uij)
score_arr.append(score_)
predicted_users_num += predict_batch_size
return score_[0]
PS_OPS = ['Variable', 'VariableV2', 'AutoReloadVariable']
def assign_to_device(device, ps_device='/cpu:0'):
def _assign(op):
node_def = op if isinstance(op, tf.NodeDef) else op.node_def
if node_def.op in PS_OPS:
return "/" + ps_device
else:
return device
return _assign
def average_gradients(tower_grads):
average_grads, cnt = [], 0
for grad_and_vars in zip(*tower_grads):
grads = []
for g, _ in grad_and_vars:
if g is not None:
expanded_g = tf.expand_dims(g, 0)
else:
expanded_g = None
grads.append(expanded_g)
if all(x is None for x in grads):
grad = None
else:
grad = tf.concat(grads, 0)
grad = tf.reduce_mean(grad, 0)
v = grad_and_vars[0][1]
grad_and_var = (grad, v)
average_grads.append(grad_and_var)
cnt += 1
rlt_grads = [v[0] for v in average_grads]
rlt_vars = [v[1] for v in average_grads]
return average_grads
# return rlt_grads, rlt_vars
if min(cate_list)>0:
item_count += 1
lr = 1.0 # 0.1
reuse_vars = False
tf.reset_default_graph()
with tf.device('/cpu:0'):
tower_grads, tower_logits_test = [], []
reuse_vars = False
# tf Graph input
i_batch = tf.placeholder(tf.int32, [None,]) # [B]
j_batch = tf.placeholder(tf.int32, [None,]) # [B]
y_batch = tf.placeholder(tf.int32, [None,]) # [B]
hist_i_batch = tf.placeholder(tf.int32, [None, None]) # [B, T]
sl_batch = tf.placeholder(tf.int32, [None,]) # [B]
for i in range(gpu_num):
with tf.device(assign_to_device('/gpu:{}'.format(i), ps_device='/cpu:0')):
delta = tf.shape(i_batch)[0] // gpu_num
start, end = i*delta, (i+1)*delta
i = i_batch[start:end]
j = j_batch[start:end]
y = y_batch[start:end]
hist_i = hist_i_batch[start:end,:]
sl = sl_batch[start:end]
logits_train = DIN(i, j, y, hist_i, sl,
item_count, cate_count, cate_list, reuse=reuse_vars, is_training=True)
logits_test = DIN(i, j, y, hist_i, sl,
item_count, cate_count, cate_list, reuse=True, is_training=False)
loss_op = tf.reduce_mean(tf.nn.sigmoid_cross_entropy_with_logits(
logits=logits_train, labels=tf.cast(y, tf.float32)))
trainable_params = tf.trainable_variables()
gradients = tf.gradients(loss_op, trainable_params)
clip_gradients, _ = tf.clip_by_global_norm(gradients, 5)
grads = [(v, trainable_params[ind]) for ind, v in enumerate(clip_gradients)]
reuse_vars = True
tower_grads.append(grads)
tower_logits_test.append(logits_test)
batch_logits_test = tf.concat(tower_logits_test, 0)
average_grads = average_gradients(tower_grads)
optimizer = tf.train.GradientDescentOptimizer(learning_rate=lr)
train_op = optimizer.apply_gradients(average_grads)
init = tf.global_variables_initializer()
gpu_options = tf.GPUOptions(allow_growth=True)
# with tf.Session(config=tf.ConfigProto(gpu_options=gpu_options, device_count={'GPU': 2})) as sess:
with tf.Session(config=tf.ConfigProto(allow_soft_placement=True, log_device_placement=True, gpu_options=gpu_options)) as sess:
sess.run(tf.global_variables_initializer())
sess.run(tf.local_variables_initializer())
sess.run(init)
epoch2display = 2
start_time = time.time()
for epoch in range(10):
random.shuffle(train_set)
epoch_total_loss, cnt = 0.0, 0
for _, uij in DataInput(train_set, train_batch_size*gpu_num):
loss_, _ = sess.run([loss_op, train_op], feed_dict={
i_batch: uij[1],
j_batch: uij[2],
y_batch: uij[2],
hist_i_batch: uij[3],
sl_batch: uij[4]
})
epoch_total_loss += loss_
cnt += 1
epoch_mean_loss = epoch_total_loss / float(cnt)
if (epoch>0) and ((epoch+1 % epoch2display==0) or (epoch==9)):
auc_train = _eval_logdata_improve(sess, train_set, train_batch_size*gpu_num, 'train')
auc_test = _eval_logdata_improve(sess, test_set_with_label, test_batch_size*gpu_num, 'test')
print(f'Epoch {epoch} DONE\tCost time: {time.time()-start_time}\ttrain epoch average loss: {epoch_mean_loss}\ttrain auc: {auc_train}\ttest auc: {auc_test}')
sys.stdout.flush()
print('best train_gauc %.4f\ttest_gauc: %.4f' % (best_auc_train, best_auc_test))
sys.stdout.flush()
| [
1,
529,
9507,
29958,
3195,
29914,
6914,
2606,
446,
29899,
4299,
29914,
6914,
2606,
446,
29918,
4299,
29914,
3018,
4983,
29914,
14968,
29918,
9910,
29918,
29887,
3746,
29889,
2272,
13,
5215,
2897,
13,
359,
29889,
21813,
1839,
29907,
29965,
7698,
29918,
28607,
8979,
1307,
29918,
2287,
29963,
2965,
2890,
2033,
353,
376,
29900,
29892,
29896,
29892,
29906,
29892,
29941,
29908,
13,
13,
5215,
931,
13,
5215,
5839,
280,
13,
5215,
4036,
13,
5215,
12655,
408,
7442,
13,
5215,
26110,
408,
15886,
13,
5215,
10876,
13,
3166,
1881,
1053,
3630,
4290,
29892,
3630,
4290,
3057,
13,
3166,
1904,
29918,
9910,
29918,
29887,
3746,
1053,
8125,
29892,
360,
1177,
13,
3166,
2071,
19668,
29889,
2527,
10817,
1053,
696,
29883,
29918,
14766,
29918,
13628,
13,
13,
8172,
29889,
26776,
29898,
29896,
29906,
29941,
29946,
29897,
13,
9302,
29889,
8172,
29889,
26776,
29898,
29896,
29906,
29941,
29946,
29897,
13,
13264,
29889,
842,
29918,
8172,
29918,
26776,
29898,
29896,
29906,
29941,
29946,
29897,
13,
13,
14968,
29918,
16175,
29918,
2311,
353,
29871,
29906,
29900,
29946,
29947,
396,
29896,
29900,
29906,
29946,
13,
1688,
29918,
16175,
29918,
2311,
353,
29871,
29906,
29900,
29946,
29947,
396,
29896,
29900,
29906,
29946,
13,
27711,
29918,
16175,
29918,
2311,
353,
29871,
29941,
29906,
13,
27711,
29918,
7193,
29918,
1949,
353,
29871,
29896,
29900,
29900,
29900,
13,
29937,
8500,
29918,
7925,
29918,
1949,
353,
29871,
29953,
13,
27711,
29918,
7925,
29918,
1949,
353,
29871,
29941,
29900,
13,
2230,
29918,
19207,
29918,
1949,
353,
29871,
29896,
29900,
13,
29887,
3746,
29918,
1949,
353,
29871,
29941,
13,
13,
2541,
1722,
877,
328,
29918,
24713,
29918,
6914,
2606,
446,
29918,
29926,
326,
1357,
29918,
29915,
718,
851,
29898,
2230,
29918,
19207,
29918,
1949,
29897,
718,
15300,
29886,
6321,
742,
525,
6050,
1495,
408,
285,
29901,
13,
29871,
7945,
29918,
842,
353,
5839,
280,
29889,
1359,
29898,
29888,
29897,
13,
29871,
1243,
29918,
842,
353,
5839,
280,
29889,
1359,
29898,
29888,
29897,
13,
29871,
274,
403,
29918,
1761,
353,
5839,
280,
29889,
1359,
29898,
29888,
29897,
13,
29871,
1404,
29918,
2798,
29892,
2944,
29918,
2798,
29892,
274,
403,
29918,
2798,
353,
5839,
280,
29889,
1359,
29898,
29888,
29897,
13,
13,
2541,
1722,
877,
1643,
29918,
6914,
2606,
446,
29918,
29926,
326,
1357,
29918,
29915,
718,
851,
29898,
2230,
29918,
19207,
29918,
1949,
29897,
718,
15300,
29886,
6321,
742,
525,
6050,
1495,
408,
285,
29901,
13,
1678,
1243,
29918,
27728,
353,
5839,
280,
29889,
1359,
29898,
29888,
29897,
13,
1688,
29918,
842,
29918,
2541,
29918,
1643,
353,
5159,
13,
1454,
474,
297,
3464,
29898,
2435,
29898,
1688,
29918,
27728,
22164,
13,
1678,
1243,
29918,
842,
29918,
2541,
29918,
1643,
29889,
4397,
29898,
23583,
4197,
1688,
29918,
842,
29961,
29875,
3816,
29900,
1402,
1243,
29918,
842,
29961,
29875,
3816,
29896,
1402,
1243,
29918,
842,
29961,
29875,
3816,
29906,
3816,
29900,
1402,
1243,
29918,
27728,
29961,
29875,
5262,
876,
13,
13,
13318,
29918,
14766,
353,
29871,
29900,
29889,
29900,
13,
13318,
29918,
14766,
29918,
14968,
353,
29871,
29900,
29889,
29900,
13,
13318,
29918,
14766,
29918,
1688,
353,
29871,
29900,
29889,
29900,
13,
1753,
22235,
29918,
14766,
29898,
1610,
29918,
2749,
1125,
13,
1678,
9995,
26289,
13,
13,
1678,
826,
3174,
29901,
13,
4706,
10650,
29918,
2749,
313,
11116,
1125,
12953,
13,
13,
1678,
16969,
29901,
13,
4706,
323,
6959,
29901,
12953,
13,
1678,
9995,
13,
1678,
396,
2656,
491,
4450,
995,
29892,
515,
2319,
304,
4802,
13,
1678,
3948,
353,
12705,
29898,
1610,
29918,
2749,
29892,
1820,
29922,
2892,
270,
29901,
29881,
29961,
29906,
2314,
13,
13,
1678,
20480,
353,
29871,
29900,
29889,
29900,
13,
1678,
285,
29886,
29896,
29892,
260,
29886,
29896,
29892,
285,
29886,
29906,
29892,
260,
29886,
29906,
353,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
13,
1678,
363,
2407,
297,
3948,
29901,
13,
4706,
285,
29886,
29906,
4619,
2407,
29961,
29900,
29962,
396,
302,
542,
1406,
13,
4706,
260,
29886,
29906,
4619,
2407,
29961,
29896,
29962,
396,
2828,
13,
4706,
20480,
4619,
313,
18091,
29906,
448,
285,
29886,
29896,
29897,
334,
313,
9392,
29906,
718,
260,
29886,
29896,
29897,
13,
4706,
285,
29886,
29896,
29892,
260,
29886,
29896,
353,
285,
29886,
29906,
29892,
260,
29886,
29906,
13,
13,
1678,
396,
565,
599,
1661,
3808,
470,
2828,
29892,
766,
29887,
538,
13,
1678,
16897,
353,
7431,
29898,
2749,
29897,
448,
29871,
29896,
29872,
29899,
29941,
13,
1678,
565,
260,
29886,
29906,
1405,
16897,
470,
285,
29886,
29906,
1405,
16897,
29901,
13,
4706,
736,
448,
29900,
29889,
29945,
13,
13,
1678,
565,
260,
29886,
29906,
334,
285,
29886,
29906,
1405,
29871,
29900,
29889,
29900,
29901,
29871,
396,
4226,
20480,
13,
4706,
736,
313,
29896,
29889,
29900,
448,
20480,
847,
313,
29906,
29889,
29900,
334,
260,
29886,
29906,
334,
285,
29886,
29906,
876,
13,
1678,
1683,
29901,
13,
4706,
736,
6213,
13,
13,
13,
1753,
903,
14766,
29918,
2749,
29898,
13628,
1125,
13,
29871,
8158,
29918,
29886,
353,
8158,
7503,
29892,
29900,
29962,
13,
29871,
8158,
29918,
29876,
353,
8158,
7503,
29892,
29896,
29962,
13,
29871,
396,
2158,
376,
4936,
2751,
1360,
282,
1275,
4936,
1360,
543,
13,
29871,
396,
2158,
8158,
29918,
29886,
13,
29871,
396,
2158,
376,
4936,
2751,
1360,
302,
1275,
4936,
1360,
543,
13,
29871,
396,
2158,
8158,
29918,
29876,
13,
29871,
8158,
29918,
2749,
353,
5159,
13,
29871,
363,
269,
297,
8158,
29918,
29886,
29889,
25027,
391,
7295,
13,
1678,
8158,
29918,
2749,
29889,
4397,
4197,
29900,
29892,
29871,
29896,
29892,
269,
2314,
13,
29871,
363,
269,
297,
8158,
29918,
29876,
29889,
25027,
391,
7295,
13,
1678,
8158,
29918,
2749,
29889,
4397,
4197,
29896,
29892,
29871,
29900,
29892,
269,
2314,
13,
29871,
736,
8158,
29918,
2749,
13,
13,
13,
1753,
903,
14513,
29898,
29879,
404,
29892,
1904,
1125,
13,
29871,
20480,
29918,
2083,
353,
29871,
29900,
29889,
29900,
13,
29871,
8158,
29918,
2749,
353,
5159,
13,
29871,
363,
17117,
318,
823,
297,
3630,
4290,
3057,
29898,
1688,
29918,
842,
29892,
1243,
29918,
16175,
29918,
2311,
1125,
13,
1678,
20480,
3383,
8158,
29918,
353,
1904,
29889,
14513,
29898,
29879,
404,
29892,
318,
823,
29897,
13,
1678,
8158,
29918,
2749,
4619,
903,
14766,
29918,
2749,
29898,
13628,
19925,
13,
1678,
20480,
29918,
2083,
4619,
20480,
29918,
334,
7431,
29898,
29884,
823,
29961,
29900,
2314,
13,
29871,
1243,
29918,
29887,
14766,
353,
20480,
29918,
2083,
847,
7431,
29898,
1688,
29918,
842,
29897,
13,
29871,
319,
1682,
353,
22235,
29918,
14766,
29898,
13628,
29918,
2749,
29897,
13,
29871,
5534,
1900,
29918,
14766,
13,
29871,
565,
1900,
29918,
14766,
529,
1243,
29918,
29887,
14766,
29901,
13,
1678,
1900,
29918,
14766,
353,
1243,
29918,
29887,
14766,
13,
1678,
1904,
29889,
7620,
29898,
29879,
404,
29892,
525,
7620,
29918,
2084,
29914,
384,
415,
1495,
13,
29871,
736,
1243,
29918,
29887,
14766,
29892,
319,
1682,
13,
13,
13,
1753,
903,
14513,
29918,
1188,
1272,
29898,
29879,
404,
29892,
1904,
29892,
8783,
29892,
9853,
29918,
2311,
29892,
1134,
1125,
13,
1678,
8158,
29918,
2749,
353,
5159,
13,
1678,
343,
353,
5159,
13,
1678,
363,
17117,
318,
823,
297,
3630,
4290,
29898,
24713,
29892,
9853,
29918,
2311,
1125,
13,
4706,
8158,
29918,
353,
1904,
29889,
14513,
29918,
1188,
1272,
29898,
29879,
404,
29892,
318,
823,
29897,
13,
4706,
8158,
29918,
2749,
29889,
4397,
29898,
9302,
29889,
29879,
802,
29872,
911,
29898,
13628,
29918,
29961,
29900,
12622,
13,
4706,
343,
29889,
4397,
29898,
9302,
29889,
294,
2378,
29898,
29884,
823,
29961,
29906,
12622,
13,
1678,
396,
8158,
29918,
2749,
353,
7442,
29889,
29894,
1429,
29898,
13628,
29918,
2749,
29897,
13,
1678,
8158,
29918,
2749,
353,
7442,
29889,
29882,
1429,
29898,
13628,
29918,
2749,
29897,
13,
1678,
343,
353,
7442,
29889,
29882,
1429,
29898,
9302,
29889,
294,
2378,
29898,
29891,
876,
13,
1678,
319,
1682,
353,
696,
29883,
29918,
14766,
29918,
13628,
29898,
29891,
29892,
8158,
29918,
2749,
29897,
13,
13,
1678,
5534,
1900,
29918,
14766,
29918,
14968,
13,
1678,
5534,
1900,
29918,
14766,
29918,
1688,
13,
13,
1678,
565,
1134,
1360,
29915,
14968,
29915,
322,
1900,
29918,
14766,
29918,
14968,
29966,
29909,
1682,
29901,
13,
4706,
1900,
29918,
14766,
29918,
14968,
353,
319,
1682,
13,
1678,
565,
1134,
1360,
29915,
1688,
29915,
322,
1900,
29918,
14766,
29918,
1688,
29966,
29909,
1682,
29901,
13,
4706,
1900,
29918,
14766,
29918,
1688,
353,
319,
1682,
13,
4706,
1904,
29889,
7620,
29898,
29879,
404,
29892,
525,
7620,
29918,
2084,
29914,
384,
415,
1495,
13,
1678,
736,
319,
1682,
13,
13,
1753,
903,
14513,
29918,
1188,
1272,
29918,
326,
771,
345,
29898,
29879,
404,
29892,
8783,
29892,
9853,
29918,
2311,
29892,
1134,
1125,
13,
1678,
8158,
29918,
2749,
353,
5159,
13,
1678,
343,
353,
5159,
13,
1678,
363,
17117,
318,
823,
297,
3630,
4290,
29898,
24713,
29892,
9853,
29918,
2311,
1125,
13,
4706,
8158,
29918,
353,
27937,
29889,
3389,
4197,
16175,
29918,
1188,
1169,
29918,
1688,
1402,
8343,
29918,
8977,
3790,
13,
9651,
474,
29918,
16175,
29901,
318,
823,
29961,
29896,
1402,
13,
9651,
432,
29918,
16175,
29901,
318,
823,
29961,
29906,
1402,
13,
9651,
343,
29918,
16175,
29901,
318,
823,
29961,
29906,
1402,
13,
9651,
9825,
29918,
29875,
29918,
16175,
29901,
318,
823,
29961,
29941,
1402,
13,
9651,
2243,
29918,
16175,
29901,
318,
823,
29961,
29946,
29962,
13,
4706,
5615,
13,
13,
4706,
8158,
29918,
2749,
29889,
4397,
29898,
9302,
29889,
29879,
802,
29872,
911,
29898,
13628,
29918,
29961,
29900,
12622,
13,
4706,
343,
29889,
4397,
29898,
9302,
29889,
294,
2378,
29898,
29884,
823,
29961,
29906,
12622,
13,
1678,
8158,
29918,
2749,
353,
7442,
29889,
29882,
1429,
29898,
13628,
29918,
2749,
29897,
13,
1678,
343,
353,
7442,
29889,
29882,
1429,
29898,
9302,
29889,
294,
2378,
29898,
29891,
876,
13,
1678,
319,
1682,
353,
696,
29883,
29918,
14766,
29918,
13628,
29898,
29891,
7503,
2435,
29898,
13628,
29918,
2749,
29897,
1402,
8158,
29918,
2749,
29897,
13,
13,
1678,
5534,
1900,
29918,
14766,
29918,
14968,
13,
1678,
5534,
1900,
29918,
14766,
29918,
1688,
13,
13,
1678,
565,
1134,
1360,
29915,
14968,
29915,
322,
1900,
29918,
14766,
29918,
14968,
29966,
29909,
1682,
29901,
13,
4706,
1900,
29918,
14766,
29918,
14968,
353,
319,
1682,
13,
1678,
565,
1134,
1360,
29915,
1688,
29915,
322,
1900,
29918,
14766,
29918,
1688,
29966,
29909,
1682,
29901,
13,
4706,
1900,
29918,
14766,
29918,
1688,
353,
319,
1682,
13,
4706,
872,
369,
353,
15886,
29889,
14968,
29889,
29903,
12483,
580,
13,
4706,
872,
369,
29889,
7620,
29898,
29879,
404,
29892,
4078,
29918,
2084,
2433,
7620,
29918,
2084,
29914,
384,
415,
1495,
13,
13,
1678,
736,
319,
1682,
13,
13,
1753,
903,
1688,
29898,
29879,
404,
29892,
1904,
1125,
13,
29871,
20480,
29918,
2083,
353,
29871,
29900,
29889,
29900,
13,
29871,
8158,
29918,
2749,
353,
5159,
13,
29871,
25383,
29918,
7193,
29918,
1949,
353,
29871,
29900,
13,
29871,
1596,
703,
1688,
1014,
4452,
1159,
13,
29871,
363,
17117,
318,
823,
297,
3630,
4290,
3057,
29898,
1688,
29918,
842,
29892,
8500,
29918,
16175,
29918,
2311,
1125,
13,
1678,
565,
25383,
29918,
7193,
29918,
1949,
6736,
8500,
29918,
7193,
29918,
1949,
29901,
13,
4706,
2867,
13,
1678,
8158,
29918,
353,
1904,
29889,
1688,
29898,
29879,
404,
29892,
318,
823,
29897,
13,
1678,
8158,
29918,
2749,
29889,
4397,
29898,
13628,
19925,
13,
1678,
25383,
29918,
7193,
29918,
1949,
4619,
8500,
29918,
16175,
29918,
2311,
13,
29871,
736,
8158,
29918,
29961,
29900,
29962,
13,
13,
13,
7024,
29918,
4590,
29903,
353,
6024,
16174,
742,
525,
16174,
29963,
29906,
742,
525,
12300,
29934,
7078,
328,
16174,
2033,
13,
1753,
3566,
29918,
517,
29918,
10141,
29898,
10141,
29892,
6529,
29918,
10141,
2433,
29914,
21970,
29901,
29900,
29374,
13,
1678,
822,
903,
16645,
29898,
459,
1125,
13,
4706,
2943,
29918,
1753,
353,
1015,
565,
338,
8758,
29898,
459,
29892,
15886,
29889,
4247,
3206,
29897,
1683,
1015,
29889,
3177,
29918,
1753,
13,
4706,
565,
2943,
29918,
1753,
29889,
459,
297,
11323,
29918,
4590,
29903,
29901,
13,
9651,
736,
5591,
29908,
718,
6529,
29918,
10141,
13,
4706,
1683,
29901,
13,
9651,
736,
4742,
13,
13,
1678,
736,
903,
16645,
13,
13,
13,
1753,
6588,
29918,
5105,
10070,
29898,
29873,
1680,
29918,
5105,
29879,
1125,
13,
1678,
6588,
29918,
5105,
29879,
29892,
274,
593,
353,
19997,
29871,
29900,
13,
1678,
363,
4656,
29918,
392,
29918,
16908,
297,
14319,
10456,
29873,
1680,
29918,
5105,
29879,
1125,
13,
4706,
4656,
29879,
353,
5159,
13,
4706,
363,
330,
29892,
903,
297,
4656,
29918,
392,
29918,
16908,
29901,
13,
9651,
565,
330,
338,
451,
6213,
29901,
13,
18884,
17832,
29918,
29887,
353,
15886,
29889,
18837,
29918,
6229,
29879,
29898,
29887,
29892,
29871,
29900,
29897,
13,
9651,
1683,
29901,
13,
18884,
17832,
29918,
29887,
353,
6213,
13,
13,
9651,
4656,
29879,
29889,
4397,
29898,
18837,
287,
29918,
29887,
29897,
13,
13,
4706,
565,
599,
29898,
29916,
338,
6213,
363,
921,
297,
4656,
29879,
1125,
13,
9651,
4656,
353,
6213,
13,
4706,
1683,
29901,
13,
9651,
4656,
353,
15886,
29889,
17685,
29898,
5105,
29879,
29892,
29871,
29900,
29897,
13,
9651,
4656,
353,
15886,
29889,
17469,
29918,
12676,
29898,
5105,
29892,
29871,
29900,
29897,
13,
13,
4706,
325,
353,
4656,
29918,
392,
29918,
16908,
29961,
29900,
3816,
29896,
29962,
13,
4706,
4656,
29918,
392,
29918,
1707,
353,
313,
5105,
29892,
325,
29897,
13,
4706,
6588,
29918,
5105,
29879,
29889,
4397,
29898,
5105,
29918,
392,
29918,
1707,
29897,
13,
4706,
274,
593,
4619,
29871,
29896,
13,
13,
4706,
364,
1896,
29918,
5105,
29879,
353,
518,
29894,
29961,
29900,
29962,
363,
325,
297,
6588,
29918,
5105,
29879,
29962,
13,
4706,
364,
1896,
29918,
16908,
353,
518,
29894,
29961,
29896,
29962,
363,
325,
297,
6588,
29918,
5105,
29879,
29962,
13,
1678,
736,
6588,
29918,
5105,
29879,
13,
1678,
396,
736,
364,
1896,
29918,
5105,
29879,
29892,
364,
1896,
29918,
16908,
13,
13,
361,
1375,
29898,
29883,
403,
29918,
1761,
15410,
29900,
29901,
13,
1678,
2944,
29918,
2798,
4619,
29871,
29896,
13,
13,
29212,
353,
29871,
29896,
29889,
29900,
29871,
396,
29871,
29900,
29889,
29896,
13,
276,
1509,
29918,
16908,
353,
7700,
13,
13,
13264,
29889,
12071,
29918,
4381,
29918,
4262,
580,
13,
13,
2541,
15886,
29889,
10141,
11219,
21970,
29901,
29900,
29374,
13,
1678,
19372,
29918,
5105,
29879,
29892,
19372,
29918,
1188,
1169,
29918,
1688,
353,
19997,
5159,
13,
1678,
24270,
29918,
16908,
353,
7700,
13,
13,
1678,
396,
15886,
12367,
1881,
13,
1678,
474,
29918,
16175,
353,
15886,
29889,
27074,
29898,
13264,
29889,
524,
29941,
29906,
29892,
518,
8516,
29892,
2314,
396,
518,
29933,
29962,
13,
1678,
432,
29918,
16175,
353,
15886,
29889,
27074,
29898,
13264,
29889,
524,
29941,
29906,
29892,
518,
8516,
29892,
2314,
396,
518,
29933,
29962,
13,
1678,
343,
29918,
16175,
353,
15886,
29889,
27074,
29898,
13264,
29889,
524,
29941,
29906,
29892,
518,
8516,
29892,
2314,
396,
518,
29933,
29962,
13,
1678,
9825,
29918,
29875,
29918,
16175,
353,
15886,
29889,
27074,
29898,
13264,
29889,
524,
29941,
29906,
29892,
518,
8516,
29892,
6213,
2314,
396,
518,
29933,
29892,
323,
29962,
13,
1678,
2243,
29918,
16175,
353,
15886,
29889,
27074,
29898,
13264,
29889,
524,
29941,
29906,
29892,
518,
8516,
29892,
2314,
396,
518,
29933,
29962,
13,
13,
1678,
363,
474,
297,
3464,
29898,
29887,
3746,
29918,
1949,
1125,
13,
4706,
411,
15886,
29889,
10141,
29898,
16645,
29918,
517,
29918,
10141,
11219,
29887,
3746,
29901,
8875,
4286,
4830,
29898,
29875,
511,
6529,
29918,
10141,
2433,
29914,
21970,
29901,
29900,
8785,
29901,
13,
9651,
19471,
353,
15886,
29889,
12181,
29898,
29875,
29918,
16175,
9601,
29900,
29962,
849,
330,
3746,
29918,
1949,
13,
9651,
1369,
29892,
1095,
353,
474,
29930,
4181,
29892,
313,
29875,
29974,
29896,
11877,
4181,
13,
9651,
474,
353,
474,
29918,
16175,
29961,
2962,
29901,
355,
29962,
13,
9651,
432,
353,
432,
29918,
16175,
29961,
2962,
29901,
355,
29962,
13,
9651,
343,
353,
343,
29918,
16175,
29961,
2962,
29901,
355,
29962,
13,
9651,
9825,
29918,
29875,
353,
9825,
29918,
29875,
29918,
16175,
29961,
2962,
29901,
355,
29892,
17531,
13,
9651,
2243,
353,
2243,
29918,
16175,
29961,
2962,
29901,
355,
29962,
13,
13,
9651,
1480,
1169,
29918,
14968,
353,
360,
1177,
29898,
29875,
29892,
432,
29892,
343,
29892,
9825,
29918,
29875,
29892,
2243,
29892,
13,
462,
1669,
2944,
29918,
2798,
29892,
274,
403,
29918,
2798,
29892,
274,
403,
29918,
1761,
29892,
24270,
29922,
276,
1509,
29918,
16908,
29892,
338,
29918,
26495,
29922,
5574,
29897,
13,
13,
9651,
1480,
1169,
29918,
1688,
353,
360,
1177,
29898,
29875,
29892,
432,
29892,
343,
29892,
9825,
29918,
29875,
29892,
2243,
29892,
13,
462,
795,
2944,
29918,
2798,
29892,
274,
403,
29918,
2798,
29892,
274,
403,
29918,
1761,
29892,
24270,
29922,
5574,
29892,
338,
29918,
26495,
29922,
8824,
29897,
13,
13,
9651,
6410,
29918,
459,
353,
15886,
29889,
17469,
29918,
12676,
29898,
13264,
29889,
15755,
29889,
18816,
29885,
3398,
29918,
19128,
29918,
296,
14441,
29918,
2541,
29918,
1188,
1169,
29898,
13,
18884,
1480,
1169,
29922,
1188,
1169,
29918,
14968,
29892,
11073,
29922,
13264,
29889,
4384,
29898,
29891,
29892,
15886,
29889,
7411,
29941,
29906,
4961,
13,
13,
9651,
7945,
519,
29918,
7529,
353,
15886,
29889,
14968,
519,
29918,
20897,
580,
13,
13,
9651,
4656,
10070,
353,
15886,
29889,
5105,
10070,
29898,
6758,
29918,
459,
29892,
7945,
519,
29918,
7529,
29897,
13,
9651,
20102,
29918,
5105,
10070,
29892,
903,
353,
15886,
29889,
24049,
29918,
1609,
29918,
10945,
29918,
12324,
29898,
5105,
10070,
29892,
29871,
29945,
29897,
13,
13,
9651,
4656,
29879,
353,
17288,
29894,
29892,
7945,
519,
29918,
7529,
29961,
513,
2314,
363,
1399,
29892,
325,
297,
26985,
29898,
24049,
29918,
5105,
10070,
4638,
13,
13,
9651,
24270,
29918,
16908,
353,
5852,
13,
9651,
19372,
29918,
5105,
29879,
29889,
4397,
29898,
5105,
29879,
29897,
13,
9651,
19372,
29918,
1188,
1169,
29918,
1688,
29889,
4397,
29898,
1188,
1169,
29918,
1688,
29897,
13,
13,
1678,
9853,
29918,
1188,
1169,
29918,
1688,
353,
15886,
29889,
17685,
29898,
29873,
1680,
29918,
1188,
1169,
29918,
1688,
29892,
29871,
29900,
29897,
13,
1678,
6588,
29918,
5105,
29879,
353,
6588,
29918,
5105,
10070,
29898,
29873,
1680,
29918,
5105,
29879,
29897,
13,
1678,
5994,
3950,
353,
15886,
29889,
14968,
29889,
25584,
993,
4002,
1760,
20624,
326,
3950,
29898,
21891,
29918,
10492,
29922,
29212,
29897,
13,
13,
1678,
7945,
29918,
459,
353,
5994,
3950,
29889,
7302,
29918,
5105,
10070,
29898,
12483,
482,
29918,
5105,
29879,
29897,
13,
13,
1678,
2069,
353,
15886,
29889,
10945,
29918,
20897,
29918,
11228,
3950,
580,
13,
13,
1678,
330,
3746,
29918,
6768,
353,
15886,
29889,
29954,
7056,
5856,
29898,
9536,
29918,
29887,
798,
386,
29922,
5574,
29897,
13,
1678,
396,
411,
15886,
29889,
7317,
29898,
2917,
29922,
13264,
29889,
3991,
1184,
517,
29898,
29887,
3746,
29918,
6768,
29922,
29887,
3746,
29918,
6768,
29892,
4742,
29918,
2798,
3790,
29915,
29954,
7056,
2396,
29871,
29906,
20073,
408,
27937,
29901,
13,
1678,
411,
15886,
29889,
7317,
29898,
2917,
29922,
13264,
29889,
3991,
1184,
517,
29898,
9536,
29918,
2695,
29918,
29886,
9552,
29922,
5574,
29892,
1480,
29918,
10141,
29918,
29886,
9552,
29922,
5574,
29892,
330,
3746,
29918,
6768,
29922,
29887,
3746,
29918,
6768,
876,
408,
27937,
29901,
13,
13,
418,
27937,
29889,
3389,
29898,
13264,
29889,
10945,
29918,
20897,
29918,
11228,
3950,
3101,
13,
418,
27937,
29889,
3389,
29898,
13264,
29889,
2997,
29918,
20897,
29918,
11228,
3950,
3101,
13,
418,
27937,
29889,
3389,
29898,
2344,
29897,
13,
13,
418,
21502,
305,
29906,
4990,
353,
29871,
29906,
13,
418,
1369,
29918,
2230,
353,
931,
29889,
2230,
580,
13,
418,
363,
21502,
305,
297,
3464,
29898,
29896,
29900,
1125,
13,
13,
4706,
4036,
29889,
845,
21897,
29898,
14968,
29918,
842,
29897,
13,
13,
4706,
21502,
305,
29918,
7827,
29918,
6758,
29892,
274,
593,
353,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
13,
4706,
363,
17117,
318,
823,
297,
3630,
4290,
29898,
14968,
29918,
842,
29892,
7945,
29918,
16175,
29918,
2311,
29930,
29887,
3746,
29918,
1949,
1125,
13,
13,
3986,
6410,
3383,
903,
353,
27937,
29889,
3389,
4197,
6758,
29918,
459,
29892,
7945,
29918,
459,
1402,
8343,
29918,
8977,
3790,
13,
462,
29871,
474,
29918,
16175,
29901,
318,
823,
29961,
29896,
1402,
13,
462,
29871,
432,
29918,
16175,
29901,
318,
823,
29961,
29906,
1402,
13,
462,
29871,
343,
29918,
16175,
29901,
318,
823,
29961,
29906,
1402,
13,
462,
29871,
9825,
29918,
29875,
29918,
16175,
29901,
318,
823,
29961,
29941,
1402,
13,
462,
29871,
2243,
29918,
16175,
29901,
318,
823,
29961,
29946,
29962,
13,
795,
5615,
13,
13,
3986,
21502,
305,
29918,
7827,
29918,
6758,
4619,
6410,
29918,
13,
3986,
274,
593,
4619,
29871,
29896,
13,
3986,
21502,
305,
29918,
12676,
29918,
6758,
353,
21502,
305,
29918,
7827,
29918,
6758,
847,
5785,
29898,
20047,
29897,
13,
13,
4706,
565,
313,
1022,
2878,
29958,
29900,
29897,
322,
5135,
1022,
2878,
29974,
29896,
1273,
21502,
305,
29906,
4990,
1360,
29900,
29897,
470,
313,
1022,
2878,
1360,
29929,
22164,
13,
9651,
20480,
29918,
14968,
353,
903,
14513,
29918,
1188,
1272,
29918,
326,
771,
345,
29898,
29879,
404,
29892,
7945,
29918,
842,
29892,
7945,
29918,
16175,
29918,
2311,
29930,
29887,
3746,
29918,
1949,
29892,
525,
14968,
1495,
13,
9651,
20480,
29918,
1688,
353,
903,
14513,
29918,
1188,
1272,
29918,
326,
771,
345,
29898,
29879,
404,
29892,
1243,
29918,
842,
29918,
2541,
29918,
1643,
29892,
1243,
29918,
16175,
29918,
2311,
29930,
29887,
3746,
29918,
1949,
29892,
525,
1688,
1495,
13,
9651,
1596,
29898,
29888,
29915,
29923,
1129,
305,
426,
1022,
2878,
29913,
360,
12413,
29905,
29873,
25733,
931,
29901,
426,
2230,
29889,
2230,
580,
29899,
2962,
29918,
2230,
1012,
698,
6038,
21502,
305,
6588,
6410,
29901,
426,
1022,
2878,
29918,
12676,
29918,
6758,
1012,
698,
6038,
20480,
29901,
426,
14766,
29918,
14968,
1012,
698,
342,
20480,
29901,
426,
14766,
29918,
1688,
29913,
1495,
13,
9651,
10876,
29889,
25393,
29889,
23126,
580,
13,
13,
418,
1596,
877,
13318,
7945,
29918,
29887,
14766,
18695,
29946,
29888,
29905,
698,
342,
29918,
29887,
14766,
29901,
18695,
29946,
29888,
29915,
1273,
313,
13318,
29918,
14766,
29918,
14968,
29892,
1900,
29918,
14766,
29918,
1688,
876,
13,
418,
10876,
29889,
25393,
29889,
23126,
580,
13,
2
] |
Codigos Python/String_to_int.py | BrunoHarlis/Solucoes_LeetCode | 0 | 32210 | <gh_stars>0
# Fonte: https://leetcode.com/problems/string-to-integer-atoi/
# Autor: <NAME>
# Data: 03/08/2021
"""
Implemente a função myAtoi(string s), que converte uma string em um
inteiro assinado de 32 bits (semelhante à função C / C ++ atoi).
O algoritmo para myAtoi(string s) é o seguinte:
Leia e ignore qualquer espaço em branco à esquerda.
Verifique se o próximo caractere (se ainda não estiver no final da string)
é '-' ou '+'. Leia este caractere se for algum. Isso determina se o resultado
final é negativo ou positivo, respectivamente. Suponha que o resultado seja
positivo se nenhum estiver presente.
Leia a seguir os caracteres até que o próximo caractere não digitado ou o
final da entrada seja alcançado. O resto da string é ignorado.
Converta esses dígitos em um número inteiro (ou seja "123" -> 123, "0032" -> 32).
Se nenhum dígito foi lido, o número inteiro é 0. Altere o sinal conforme
necessário (da etapa 2).
Se o inteiro estiver fora do intervalo de inteiros com sinal de 32 bits, fixe
o inteiro para que ele permaneça no intervalo. Especificamente, números inteiros
menores do que deveriam ser fixados e inteiros maiores do que deveriam ser fixados.
[-231, 231 - 1]-231-231231 - 1231 - 1
Retorne o inteiro como o resultado final.
Observação:
Apenas o caractere de espaço ' ' é considerado um caractere de espaço em branco.
Não ignore nenhum caractere além do espaço em branco inicial ou o resto da string após os dígitos.
Tempo de execução : 36 ms, mais rápido que 60,05 % dos envios.
Uso da memória : 14,5 MB, menos de 26,10 % dos envios.
"""
def myAtoi(s):
s = s.strip()
negativo = False
i = 0
r = 0
if len(s) == 0:
return 0
if s[i] == '-':
negativo = True
i += 1
elif s[i] == '+':
i += 1
while i < len(s):
if s[i].isnumeric():
temp = int(s[i:i+1])
r = r * 10 + temp
if negativo:
if r * -1 < -2**31:
return -2**31
elif r > 2**31 - 1:
return 2**31 - 1
i += 1
else:
break
return r * -1 if negativo else r
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
29937,
383,
9568,
29901,
2045,
597,
280,
300,
401,
29889,
510,
29914,
17199,
29879,
29914,
1807,
29899,
517,
29899,
16031,
29899,
1219,
29875,
29914,
13,
29937,
15811,
29901,
529,
5813,
29958,
13,
29937,
3630,
29901,
29871,
29900,
29941,
29914,
29900,
29947,
29914,
29906,
29900,
29906,
29896,
13,
13,
15945,
29908,
13,
1888,
2037,
29872,
263,
2090,
2340,
590,
29909,
517,
29875,
29898,
1807,
269,
511,
712,
5486,
371,
3672,
1347,
953,
1922,
13,
6693,
3350,
1223,
262,
912,
316,
29871,
29941,
29906,
9978,
313,
12846,
295,
29882,
1647,
818,
2090,
2340,
315,
847,
315,
8445,
472,
7768,
467,
13,
13,
29949,
3093,
272,
277,
4346,
1702,
590,
29909,
517,
29875,
29898,
1807,
269,
29897,
904,
288,
7025,
6693,
29901,
13,
13,
3226,
423,
321,
11455,
4021,
7808,
9015,
6102,
953,
20531,
1111,
818,
831,
7808,
1388,
29889,
13,
13,
6565,
22781,
409,
288,
14646,
29761,
1559,
627,
406,
313,
344,
23871,
8145,
707,
2147,
694,
2186,
1146,
1347,
29897,
29871,
13,
29948,
17411,
29915,
2123,
525,
29974,
4286,
951,
423,
4404,
1559,
627,
406,
409,
363,
3093,
398,
29889,
1317,
578,
3683,
1099,
409,
288,
24578,
29871,
13,
8394,
904,
3480,
11692,
2123,
13686,
4243,
29892,
3390,
11778,
29889,
13786,
265,
2350,
712,
288,
24578,
409,
1764,
29871,
13,
1066,
277,
4243,
409,
302,
264,
16063,
707,
2147,
20753,
29889,
13,
13,
3226,
423,
263,
7025,
381,
2897,
15215,
267,
16659,
712,
288,
14646,
29761,
1559,
627,
406,
8145,
13615,
912,
2123,
288,
29871,
13,
8394,
1146,
9953,
1114,
409,
1764,
21629,
30019,
912,
29889,
438,
25814,
1146,
1347,
904,
16245,
912,
29889,
13,
13,
1168,
369,
941,
3686,
267,
19559,
5559,
359,
953,
1922,
13831,
2293,
3350,
313,
283,
409,
1764,
376,
29896,
29906,
29941,
29908,
1599,
29871,
29896,
29906,
29941,
29892,
376,
29900,
29900,
29941,
29906,
29908,
1599,
29871,
29941,
29906,
467,
29871,
13,
13,
2008,
302,
264,
16063,
19559,
29887,
2049,
4732,
301,
1941,
29892,
288,
13831,
2293,
3350,
904,
29871,
29900,
29889,
838,
12358,
288,
269,
979,
14670,
29872,
29871,
13,
15107,
12288,
313,
1388,
29691,
29871,
29906,
467,
13,
13,
2008,
288,
2293,
3350,
707,
2147,
363,
29874,
437,
7292,
29877,
316,
2293,
17177,
419,
269,
979,
316,
29871,
29941,
29906,
9978,
29892,
2329,
29872,
29871,
13,
29877,
2293,
3350,
1702,
712,
4552,
9410,
29872,
4277,
694,
7292,
29877,
29889,
3423,
3135,
928,
2503,
29892,
12158,
359,
2293,
17177,
29871,
13,
1527,
2361,
437,
712,
316,
369,
2829,
724,
2329,
2255,
321,
2293,
17177,
17136,
267,
437,
712,
316,
369,
2829,
724,
2329,
2255,
29889,
13,
14352,
29906,
29941,
29896,
29892,
29871,
29906,
29941,
29896,
448,
29871,
29896,
29962,
29899,
29906,
29941,
29896,
29899,
29906,
29941,
29896,
29906,
29941,
29896,
448,
29871,
29896,
29906,
29941,
29896,
448,
29871,
29896,
13,
13,
8015,
272,
484,
288,
2293,
3350,
1986,
288,
24578,
2186,
29889,
13,
13,
6039,
643,
1564,
2340,
29901,
13,
29909,
21275,
288,
1559,
627,
406,
316,
9015,
6102,
525,
525,
904,
2050,
912,
1922,
1559,
627,
406,
316,
9015,
6102,
953,
20531,
1111,
29889,
13,
29940,
1368,
11455,
302,
264,
16063,
1559,
627,
406,
394,
2249,
437,
9015,
6102,
953,
20531,
1111,
24879,
2123,
288,
25814,
1146,
1347,
24292,
2897,
19559,
5559,
359,
29889,
13,
13,
5776,
1129,
316,
2279,
29884,
2340,
584,
29871,
29941,
29953,
10887,
29892,
3503,
23504,
29886,
1941,
712,
29871,
29953,
29900,
29892,
29900,
29945,
1273,
3248,
21061,
359,
29889,
13,
29965,
578,
1146,
2626,
14389,
584,
29871,
29896,
29946,
29892,
29945,
13232,
29892,
17275,
316,
29871,
29906,
29953,
29892,
29896,
29900,
1273,
3248,
21061,
359,
29889,
13,
15945,
29908,
13,
13,
13,
1753,
590,
29909,
517,
29875,
29898,
29879,
1125,
13,
1678,
269,
353,
269,
29889,
17010,
580,
13,
1678,
3480,
11692,
353,
7700,
13,
1678,
474,
353,
29871,
29900,
13,
1678,
364,
353,
29871,
29900,
13,
13,
1678,
565,
7431,
29898,
29879,
29897,
1275,
29871,
29900,
29901,
13,
4706,
736,
29871,
29900,
13,
13,
1678,
565,
269,
29961,
29875,
29962,
1275,
17411,
2396,
13,
4706,
3480,
11692,
353,
5852,
13,
4706,
474,
4619,
29871,
29896,
13,
1678,
25342,
269,
29961,
29875,
29962,
1275,
525,
29974,
2396,
13,
4706,
474,
4619,
29871,
29896,
13,
13,
1678,
1550,
474,
529,
7431,
29898,
29879,
1125,
13,
4706,
565,
269,
29961,
29875,
1822,
275,
21574,
7295,
13,
9651,
5694,
353,
938,
29898,
29879,
29961,
29875,
29901,
29875,
29974,
29896,
2314,
13,
9651,
364,
353,
364,
334,
29871,
29896,
29900,
718,
5694,
13,
9651,
565,
3480,
11692,
29901,
13,
18884,
565,
364,
334,
448,
29896,
529,
448,
29906,
1068,
29941,
29896,
29901,
13,
462,
1678,
736,
448,
29906,
1068,
29941,
29896,
13,
9651,
25342,
364,
1405,
29871,
29906,
1068,
29941,
29896,
448,
29871,
29896,
29901,
13,
18884,
736,
29871,
29906,
1068,
29941,
29896,
448,
29871,
29896,
13,
9651,
474,
4619,
29871,
29896,
13,
4706,
1683,
29901,
13,
9651,
2867,
13,
13,
1678,
736,
364,
334,
448,
29896,
565,
3480,
11692,
1683,
364,
13,
2
] |
dl.py | onoira/instawow-installer | 0 | 1604605 | <reponame>onoira/instawow-installer
from __future__ import annotations
import json
import os
import os.path as path
import re
import shutil
import zipfile
from configparser import ConfigParser
from glob import glob
import requests
_RE_NAME_GUI = re.compile(
r'\b\binstawow-desktop.+\.exe\b',
flags=re.IGNORECASE
)
_RE_NAME_CLI = re.compile(
r'\binstawow-(?:cli-)?windows.+\.zip\b',
flags=re.IGNORECASE
)
DOWNLOAD_DIRECTORY = './download'
REPO_PATH = "layday/instawow"
class GitHubClient():
def get_asset(self, url: str) -> bytes:
return self._get(url).content
def get_manifest(self, repo_path: str) -> dict:
owner, repo = repo_path.split('/')
resp = self._get(
f'https://api.github.com/repos/{owner}/{repo}/releases/latest'
)
jso = json.loads(resp.content)
return jso
def _get(self, url):
return requests.get(url, headers=self.headers)
def __init__(self, headers: dict = None):
self.headers = {
'Accept': "application/vnd.github.v3+json"} | (headers or dict())
def collect_assets(assets: list[dict]) -> dict[str, str]:
assets = {
'instawow-gui.exe': next(
i['browser_download_url'] for i in assets if _RE_NAME_GUI.match(i['name'])
),
'.instawow.zip': next(
i['browser_download_url'] for i in assets if _RE_NAME_CLI.match(i['name'])
)
}
return assets
def download_assets(
client: GitHubClient,
assets: list[dict[str, str]],
download_dir: str
) -> None:
for name, url in assets.items():
file = path.join(download_dir, name)
print(f"Downloading '{url}' (-> {file})...")
content = client.get_asset(url)
with open(path.join(download_dir, name), 'wb') as fp:
fp.write(content)
if name.endswith('.zip'):
print(f"Unzipping '{file}' (-> {download_dir})")
with zipfile.ZipFile(file, 'r') as zr:
zr.extractall(download_dir)
def copy_assets(
files: list[str],
download_dir: str,
install_dir: str
) -> None:
for src in files:
dst = path.join(install_dir, path.basename(src))
if path.exists(dst):
print(f"Backing up '{dst}'")
shutil.move(dst, dst + '.bak')
print(f"Copying '{src}' -> '{dst}'")
shutil.copy(src, dst)
def main():
config = ConfigParser()
config.read('dl.cfg')
install_dir = config['default']['install_dir']
print(f"Using install directory '{install_dir}'")
download_dir = path.abspath(DOWNLOAD_DIRECTORY)
if not path.exists(download_dir):
print(f"Creating directory '{download_dir}'")
os.makedirs(download_dir)
client = GitHubClient()
manifest = client.get_manifest(REPO_PATH)
version = manifest['tag_name']
print(f"Collecting instawow-{version}...")
assets = collect_assets(manifest['assets'])
download_assets(client, assets, download_dir)
files = [i for i in glob(path.join(download_dir, '*.exe'))]
copy_assets(files, download_dir, install_dir)
print("Done.")
if __name__ == '__main__':
try:
main()
except KeyboardInterrupt:
pass
| [
1,
529,
276,
1112,
420,
29958,
3231,
3055,
29914,
2611,
1450,
340,
29899,
6252,
261,
13,
3166,
4770,
29888,
9130,
1649,
1053,
25495,
30004,
13,
30004,
13,
5215,
4390,
30004,
13,
5215,
2897,
30004,
13,
5215,
2897,
29889,
2084,
408,
2224,
30004,
13,
5215,
337,
30004,
13,
5215,
528,
4422,
30004,
13,
5215,
14319,
1445,
30004,
13,
3166,
2295,
16680,
1053,
12782,
11726,
30004,
13,
3166,
13149,
1053,
13149,
30004,
13,
30004,
13,
5215,
7274,
30004,
13,
30004,
13,
29918,
1525,
29918,
5813,
29918,
29954,
3120,
353,
337,
29889,
12198,
29898,
30004,
13,
1678,
364,
12764,
29890,
29905,
2109,
14665,
340,
29899,
20858,
29889,
3124,
29889,
8097,
29905,
29890,
23592,
13,
1678,
13449,
29922,
276,
29889,
6259,
6632,
1525,
23487,
30004,
13,
8443,
13,
29918,
1525,
29918,
5813,
29918,
27205,
353,
337,
29889,
12198,
29898,
30004,
13,
1678,
364,
12764,
2109,
14665,
340,
29899,
10780,
29901,
11303,
29899,
6877,
10499,
29889,
3124,
29889,
7554,
29905,
29890,
23592,
13,
1678,
13449,
29922,
276,
29889,
6259,
6632,
1525,
23487,
30004,
13,
8443,
13,
30004,
13,
3970,
16048,
29428,
29918,
4571,
26282,
18929,
353,
19283,
10382,
29915,
30004,
13,
1525,
13152,
29918,
10145,
353,
376,
8387,
3250,
29914,
2611,
1450,
340,
19451,
13,
30004,
13,
30004,
13,
1990,
25492,
4032,
7295,
30004,
13,
30004,
13,
1678,
822,
679,
29918,
24129,
29898,
1311,
29892,
3142,
29901,
851,
29897,
1599,
6262,
29901,
30004,
13,
4706,
736,
1583,
3032,
657,
29898,
2271,
467,
3051,
30004,
13,
30004,
13,
1678,
822,
679,
29918,
29135,
29898,
1311,
29892,
13761,
29918,
2084,
29901,
851,
29897,
1599,
9657,
29901,
30004,
13,
4706,
12271,
29892,
13761,
353,
13761,
29918,
2084,
29889,
5451,
11219,
1495,
30004,
13,
4706,
4613,
353,
1583,
3032,
657,
29898,
30004,
13,
9651,
285,
29915,
991,
597,
2754,
29889,
3292,
29889,
510,
29914,
276,
1066,
19248,
20348,
6822,
29912,
20095,
6822,
276,
17836,
29914,
12333,
29915,
30004,
13,
4706,
1723,
30004,
13,
4706,
432,
578,
353,
4390,
29889,
18132,
29898,
13713,
29889,
3051,
8443,
13,
4706,
736,
432,
578,
30004,
13,
30004,
13,
1678,
822,
903,
657,
29898,
1311,
29892,
3142,
1125,
30004,
13,
4706,
736,
7274,
29889,
657,
29898,
2271,
29892,
9066,
29922,
1311,
29889,
13662,
8443,
13,
30004,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
9066,
29901,
9657,
353,
6213,
1125,
30004,
13,
4706,
1583,
29889,
13662,
353,
3336,
13,
9651,
525,
23965,
2396,
376,
6214,
29914,
29894,
299,
29889,
3292,
29889,
29894,
29941,
29974,
3126,
9092,
891,
313,
13662,
470,
9657,
3101,
30004,
13,
30004,
13,
30004,
13,
1753,
6314,
29918,
16596,
29898,
16596,
29901,
1051,
29961,
8977,
2314,
1599,
9657,
29961,
710,
29892,
851,
5387,
30004,
13,
1678,
21608,
353,
3336,
13,
4706,
525,
2611,
1450,
340,
29899,
23569,
29889,
8097,
2396,
2446,
29898,
30004,
13,
9651,
474,
1839,
15965,
29918,
10382,
29918,
2271,
2033,
363,
474,
297,
21608,
565,
903,
1525,
29918,
5813,
29918,
29954,
3120,
29889,
4352,
29898,
29875,
1839,
978,
2033,
8443,
13,
4706,
10353,
30004,
13,
4706,
15300,
2611,
1450,
340,
29889,
7554,
2396,
2446,
29898,
30004,
13,
9651,
474,
1839,
15965,
29918,
10382,
29918,
2271,
2033,
363,
474,
297,
21608,
565,
903,
1525,
29918,
5813,
29918,
27205,
29889,
4352,
29898,
29875,
1839,
978,
2033,
8443,
13,
4706,
1723,
30004,
13,
1678,
4970,
13,
1678,
736,
21608,
30004,
13,
30004,
13,
30004,
13,
1753,
5142,
29918,
16596,
29898,
30004,
13,
1678,
3132,
29901,
25492,
4032,
11167,
13,
1678,
21608,
29901,
1051,
29961,
8977,
29961,
710,
29892,
851,
20526,
30004,
13,
1678,
5142,
29918,
3972,
29901,
851,
30004,
13,
29897,
1599,
6213,
29901,
30004,
13,
1678,
363,
1024,
29892,
3142,
297,
21608,
29889,
7076,
7295,
30004,
13,
4706,
934,
353,
2224,
29889,
7122,
29898,
10382,
29918,
3972,
29892,
1024,
8443,
13,
30004,
13,
4706,
1596,
29898,
29888,
29908,
6767,
13234,
22372,
2271,
10162,
313,
976,
426,
1445,
7690,
636,
1159,
30004,
13,
30004,
13,
4706,
2793,
353,
3132,
29889,
657,
29918,
24129,
29898,
2271,
8443,
13,
4706,
411,
1722,
29898,
2084,
29889,
7122,
29898,
10382,
29918,
3972,
29892,
1024,
511,
525,
29893,
29890,
1495,
408,
285,
29886,
29901,
30004,
13,
9651,
285,
29886,
29889,
3539,
29898,
3051,
8443,
13,
30004,
13,
4706,
565,
1024,
29889,
1975,
2541,
12839,
7554,
29374,
30004,
13,
9651,
1596,
29898,
29888,
29908,
2525,
2526,
3262,
22372,
1445,
10162,
313,
976,
426,
10382,
29918,
3972,
1800,
1159,
30004,
13,
9651,
411,
14319,
1445,
29889,
26264,
2283,
29898,
1445,
29892,
525,
29878,
1495,
408,
503,
29878,
29901,
30004,
13,
18884,
503,
29878,
29889,
21111,
497,
29898,
10382,
29918,
3972,
8443,
13,
30004,
13,
30004,
13,
1753,
3509,
29918,
16596,
29898,
30004,
13,
1678,
2066,
29901,
1051,
29961,
710,
1402,
30004,
13,
1678,
5142,
29918,
3972,
29901,
851,
11167,
13,
1678,
2601,
29918,
3972,
29901,
851,
30004,
13,
29897,
1599,
6213,
29901,
30004,
13,
1678,
363,
4765,
297,
2066,
29901,
30004,
13,
4706,
29743,
353,
2224,
29889,
7122,
29898,
6252,
29918,
3972,
29892,
2224,
29889,
6500,
3871,
29898,
4351,
876,
30004,
13,
30004,
13,
4706,
565,
2224,
29889,
9933,
29898,
22992,
1125,
30004,
13,
9651,
1596,
29898,
29888,
29908,
5841,
292,
701,
22372,
22992,
10162,
1159,
30004,
13,
9651,
528,
4422,
29889,
11631,
29898,
22992,
29892,
29743,
718,
15300,
29890,
557,
1495,
30004,
13,
30004,
13,
4706,
1596,
29898,
29888,
29908,
11882,
292,
22372,
4351,
10162,
1599,
22372,
22992,
10162,
1159,
30004,
13,
4706,
528,
4422,
29889,
8552,
29898,
4351,
29892,
29743,
8443,
13,
30004,
13,
30004,
13,
1753,
1667,
7295,
30004,
13,
30004,
13,
1678,
2295,
353,
12782,
11726,
26471,
13,
1678,
2295,
29889,
949,
877,
11671,
29889,
16859,
1495,
30004,
13,
30004,
13,
1678,
2601,
29918,
3972,
353,
2295,
1839,
4381,
16215,
6252,
29918,
3972,
2033,
30004,
13,
1678,
1596,
29898,
29888,
29908,
15156,
2601,
3884,
22372,
6252,
29918,
3972,
10162,
1159,
30004,
13,
30004,
13,
1678,
5142,
29918,
3972,
353,
2224,
29889,
370,
1028,
493,
29898,
3970,
16048,
29428,
29918,
4571,
26282,
18929,
8443,
13,
1678,
565,
451,
2224,
29889,
9933,
29898,
10382,
29918,
3972,
1125,
30004,
13,
4706,
1596,
29898,
29888,
29908,
9832,
1218,
3884,
22372,
10382,
29918,
3972,
10162,
1159,
30004,
13,
4706,
2897,
29889,
29885,
12535,
12935,
29898,
10382,
29918,
3972,
8443,
13,
30004,
13,
1678,
3132,
353,
25492,
4032,
26471,
13,
30004,
13,
1678,
10419,
353,
3132,
29889,
657,
29918,
29135,
29898,
1525,
13152,
29918,
10145,
8443,
13,
30004,
13,
1678,
1873,
353,
10419,
1839,
4039,
29918,
978,
2033,
30004,
13,
1678,
1596,
29898,
29888,
29908,
28916,
292,
832,
1450,
340,
29899,
29912,
3259,
29913,
856,
1159,
30004,
13,
30004,
13,
1678,
21608,
353,
6314,
29918,
16596,
29898,
29135,
1839,
16596,
2033,
8443,
13,
1678,
5142,
29918,
16596,
29898,
4645,
29892,
21608,
29892,
5142,
29918,
3972,
8443,
13,
30004,
13,
1678,
2066,
353,
518,
29875,
363,
474,
297,
13149,
29898,
2084,
29889,
7122,
29898,
10382,
29918,
3972,
29892,
525,
10521,
8097,
8785,
29962,
30004,
13,
1678,
3509,
29918,
16596,
29898,
5325,
29892,
5142,
29918,
3972,
29892,
2601,
29918,
3972,
8443,
13,
30004,
13,
1678,
1596,
703,
25632,
23157,
30004,
13,
30004,
13,
30004,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
30004,
13,
1678,
1018,
29901,
30004,
13,
4706,
1667,
26471,
13,
1678,
5174,
7670,
3377,
4074,
6685,
29901,
30004,
13,
4706,
1209,
30004,
13,
2
] |
Scripts/mapOutline_AGP2.py | usgs/gems-tools-pro | 15 | 194849 | <filename>Scripts/mapOutline_AGP2.py
# MapOutline.py
# generates rectangular (in lat-long) map outline and
# appropriate tics in projection of user's choosing. Result is
# stored in an existing geodatabase
#
# For complex map outlines, try several runs and intersect the results.
#
# <NAME>, U.S. Geological Survey
# <EMAIL>
#
# July 23, 2019: updated to work with Python 3 in ArcGIS Pro 2
# Only had to make some syntax edits.
# Renamed from mapOutline_Arc10.py to mapOutline_AGP2.py
# <NAME>
import arcpy, sys, os
versionString = 'mapOutline_AGP2.py, version of 23 July 2019'
rawurl = 'https://raw.githubusercontent.com/usgs/gems-tools-pro/master/Scripts/mapOutline_AGP2.py'
checkVersion(versionString, rawurl, 'gems-tools-pro')
"""
INPUTS
maxLongStr # in D M S, separated by spaces. Decimals OK.
# Note that west values must be negative
# -122.625 = -122 37 30
# if value contains spaces it should be quoted
minLatStr # DITTO
dLong # in decimal degrees OR decimal minutes
# values <= 5 are assumed to be degrees
# values > 5 are assumed to be minutes
dLat # DITTO
# default values of dLong and dLat are 7.5
ticInterval # in decimal minutes! Default value is 2.5
isNAD27 # NAD27 or NAD83 for lat-long locations
outgdb # existing geodatabase to host output feature classes
outSpRef # output spatial reference system
scratch # scratch folder, must be writable
"""
c = ','
degreeSymbol = '°'
minuteSymbol = "'"
secondSymbol = '"'
def addMsgAndPrint(msg, severity=0):
# prints msg to screen and adds msg to the geoprocessor (in case this is run as a tool)
# print msg
try:
for string in msg.split('\n'):
# Add appropriate geoprocessing message
if severity == 0:
arcpy.AddMessage(string)
elif severity == 1:
arcpy.AddWarning(string)
elif severity == 2:
arcpy.AddError(string)
except:
pass
def dmsStringToDD(dmsString):
dms = dmsString.split()
dd = abs(float(dms[0]))
if len(dms) > 1:
dd = dd + float(dms[1])/60.0
if len(dms) > 2:
dd = dd + float(dms[2])/3600.0
if dms[0][0] == '-':
dd = 0 - dd
return(dd)
def ddToDmsString(dd):
dd = abs(dd)
degrees = int(dd)
minutes = int((dd-degrees)* 60)
seconds = int(round((dd-degrees-(minutes/60.0))* 3600))
if seconds == 60:
minutes = minutes+1
seconds = 0
dmsString = str(degrees)+degreeSymbol
dmsString = dmsString+str(minutes)+minuteSymbol
if seconds != 0:
dmsString = dmsString+str(seconds)+secondSymbol
return dmsString
addMsgAndPrint(versionString)
## MAP BOUNDARY
# get and check inputs
SELongStr = sys.argv[1]
SELatStr = sys.argv[2]
dLong = float(sys.argv[3])
dLat = float(sys.argv[4])
ticInterval = float(sys.argv[5])
if sys.argv[6] == 'true':
isNAD27 = True
else:
isNAD27 = False
if isNAD27:
xycs = 'GEOGCS["GCS_North_American_1927",DATUM["D_North_American_1927",SPHEROID["Clarke_1866",6378206.4,294.9786982]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433],AUTHORITY["EPSG",4267]]'
else:
xycs = 'GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433],AUTHORITY["EPSG",4269]]'
outgdb = sys.argv[7]
outSpRef = sys.argv[8]
scratch = sys.argv[9]
# set workspace
arcpy.env.workspace = outgdb
arcpy.env.scratchWorkspace = scratch
# calculate maxLong and minLat, dLat, dLong, minLong, maxLat
maxLong = dmsStringToDD(SELongStr)
minLat = dmsStringToDD(SELatStr)
if dLong > 5:
dLong = dLong/60.0
if dLat > 5:
dLat = dLat/60.0
minLong = maxLong - dLong
maxLat = minLat + dLat
# test for and delete any feature classes to be created
for xx in ['xxMapOutline','MapOutline','xxTics','Tics']:
if arcpy.Exists(xx):
arcpy.Delete_management(xx)
addMsgAndPrint(' deleted feature class {}'.format(xx))
## MAP OUTLINE
# make XY file for map outline
addMsgAndPrint(' writing map outline file')
genf = open(os.path.join(scratch, 'xxxbox.csv'), 'w')
genf.write('LONGITUDE,LATITUDE\n')
genf.write('{},{}\n'.format(str(minLong), str(maxLat)))
genf.write('{},{}\n'.format(str(maxLong), str(maxLat)))
genf.write('{},{}\n'.format(str(maxLong), str(minLat)))
genf.write('{},{}\n'.format(str(minLong), str(minLat)))
genf.write('{},{}\n'.format(str(minLong), str(maxLat)))
genf.close()
# convert XY file to .dbf table
boxdbf = arcpy.CreateScratchName('xxx','.dbf','',scratch)
boxdbf = os.path.basename(boxdbf)
arcpy.TableToTable_conversion(os.path.join(scratch,'xxxbox.csv'), scratch,boxdbf)
# make XY event layer from .dbf table
arcpy.MakeXYEventLayer_management(os.path.join(scratch, boxdbf),'LONGITUDE','LATITUDE','boxlayer',xycs)
# convert event layer to preliminary line feature class with PointsToLine_management
arcpy.PointsToLine_management('boxlayer', 'xxMapOutline')
# densify MapOutline
arcpy.Densify_edit('xxMapOutline', 'DISTANCE', 0.0001)
# project to correct spatial reference
### THIS ASSUMES THAT OUTPUT COORDINATE SYSTEM IS HARN AND WE ARE IN OREGON OR WASHINGTON!!
if isNAD27:
geotransformation = 'NAD_1927_To_NAD_1983_NADCON;NAD_1983_To_HARN_OR_WA'
else:
geotransformation = 'NAD_1983_To_HARN_OR_WA'
geotransformation = ''
arcpy.Project_management('xxMapOutline', 'MapOutline', outSpRef, geotransformation, xycs)
## TICS
# calculate minTicLong, minTicLat, maxTicLong, maxTiclat
ticInterval = ticInterval / 60.0 # convert minutes to degrees
minTicLong = int(round(0.1 + minLong // ticInterval))
maxTicLong = int(round(1.1 + maxLong // ticInterval))
minTicLat = int(round(0.1 + minLat // ticInterval))
maxTicLat = int(round(1.1 + maxLat // ticInterval))
if minTicLong < 0:
minTicLong = minTicLong + 1
if maxTicLong < 0:
maxTicLong = maxTicLong + 1
# make xy file for tics
addMsgAndPrint(' writing tic file')
genf = open(os.path.join(scratch, 'xxxtics.csv'),'w')
genf.write('ID,LONGITUDE,LATITUDE\n')
nTic = 1
for y in range(minTicLat, maxTicLat):
ticLat = y * ticInterval
for x in range(minTicLong, maxTicLong):
ticLong = x * ticInterval
genf.write(str(nTic) + c + str(ticLong) + c + str(ticLat) + '\n')
nTic = nTic+1
genf.close()
# convert to dbf
ticdbf = arcpy.CreateScratchName('xxx','.dbf','',scratch)
print(ticdbf)
ticdbf = os.path.basename(ticdbf)
print(ticdbf)
arcpy.TableToTable_conversion(os.path.join(scratch, 'xxxtics.csv'), scratch, ticdbf)
# make XY event layer from table
arcpy.MakeXYEventLayer_management(os.path.join(scratch, ticdbf), 'LONGITUDE', 'LATITUDE', 'ticlayer', xycs)
# copy to point featureclass
arcpy.FeatureToPoint_management('ticlayer', 'xxtics')
# project to correct coordinate system
arcpy.Project_management('xxtics', 'tics', outSpRef, geotransformation,xycs)
# add attributes
for fld in ['Easting','Northing']:
arcpy.AddField_management('tics',fld,'DOUBLE')
for fld in ['LatDMS','LongDMS']:
arcpy.AddField_management('tics',fld,'TEXT',"","",20)
arcpy.AddXY_management('tics')
# calc Easting = Point_X, Northing = Point_Y
arcpy.CalculateField_management('tics','Easting','!Point_X!','PYTHON')
arcpy.CalculateField_management('tics','Northing','!Point_Y!','PYTHON')
# create update cursor, cycle through tics, and add LatDMS and LongDMS
addMsgAndPrint(' adding lat-long text strings')
rows = arcpy.UpdateCursor('tics')
for row in rows:
row.LatDMS = ddToDmsString(row.LATITUDE)
row.LongDMS = ddToDmsString(row.LONGITUDE)
rows.updateRow(row)
del row
del rows
# delete csv files, dbf files, and preliminary featureclasses
addMsgAndPrint(' cleaning up scratch workspace')
for xx in [boxdbf,boxdbf+'.xml',ticdbf,ticdbf+'.xml']: #,'xxxbox.csv','xxxtics.csv']:
os.remove(os.path.join(scratch, xx))
addMsgAndPrint(' deleting temporary feature classes')
arcpy.Delete_management('xxtics')
arcpy.Delete_management('xxMapOutline')
#sys.exit() # force exit with failure
| [
1,
529,
9507,
29958,
4081,
29879,
29914,
1958,
3744,
1220,
29918,
10051,
29925,
29906,
29889,
2272,
13,
29937,
7315,
3744,
1220,
29889,
2272,
30004,
13,
29937,
259,
16785,
7705,
6825,
313,
262,
3405,
29899,
5426,
29897,
2910,
27887,
322,
30004,
13,
29937,
259,
8210,
260,
1199,
297,
18246,
310,
1404,
29915,
29879,
23906,
29889,
7867,
338,
30004,
13,
29937,
259,
6087,
297,
385,
5923,
1737,
397,
3223,
30004,
13,
29937,
30004,
13,
29937,
259,
1152,
4280,
2910,
714,
9012,
29892,
1018,
3196,
6057,
322,
25869,
278,
2582,
22993,
13,
29937,
30004,
13,
29937,
529,
5813,
10202,
501,
29889,
29903,
29889,
1879,
5996,
23218,
30004,
13,
29937,
259,
529,
26862,
6227,
3238,
13,
29937,
30004,
13,
29937,
5468,
29871,
29906,
29941,
29892,
29871,
29906,
29900,
29896,
29929,
29901,
4784,
304,
664,
411,
5132,
29871,
29941,
297,
22711,
29954,
3235,
1019,
29871,
29906,
30004,
13,
29937,
29871,
9333,
750,
304,
1207,
777,
5877,
1226,
1169,
22993,
13,
29937,
29871,
7493,
2795,
515,
2910,
3744,
1220,
29918,
1433,
29883,
29896,
29900,
29889,
2272,
304,
2910,
3744,
1220,
29918,
10051,
29925,
29906,
29889,
2272,
30004,
13,
29937,
29871,
529,
5813,
3238,
13,
30004,
13,
5215,
15232,
2272,
29892,
10876,
29892,
2897,
30004,
13,
30004,
13,
3259,
1231,
353,
525,
1958,
3744,
1220,
29918,
10051,
29925,
29906,
29889,
2272,
29892,
1873,
310,
29871,
29906,
29941,
5468,
29871,
29906,
29900,
29896,
29929,
29915,
30004,
13,
1610,
2271,
353,
525,
991,
597,
1610,
29889,
3292,
1792,
3051,
29889,
510,
29914,
375,
3174,
29914,
11900,
29899,
8504,
29899,
771,
29914,
6207,
29914,
4081,
29879,
29914,
1958,
3744,
1220,
29918,
10051,
29925,
29906,
29889,
2272,
29915,
30004,
13,
3198,
6594,
29898,
3259,
1231,
29892,
10650,
2271,
29892,
525,
11900,
29899,
8504,
29899,
771,
1495,
30004,
13,
30004,
13,
15945,
19451,
13,
1177,
12336,
29903,
30004,
13,
3317,
8208,
5015,
29871,
396,
297,
360,
341,
317,
29892,
13055,
491,
8162,
29889,
3826,
326,
1338,
9280,
22993,
13,
9651,
396,
259,
3940,
393,
5833,
1819,
1818,
367,
8178,
30004,
13,
9651,
396,
259,
448,
29896,
29906,
29906,
29889,
29953,
29906,
29945,
353,
448,
29896,
29906,
29906,
29871,
29941,
29955,
29871,
29941,
29900,
30004,
13,
9651,
396,
259,
565,
995,
3743,
8162,
372,
881,
367,
23153,
30004,
13,
1195,
13992,
5015,
259,
396,
360,
1806,
4986,
30004,
13,
29881,
8208,
539,
396,
297,
13677,
14496,
6323,
13677,
6233,
30004,
13,
9651,
396,
259,
1819,
5277,
29871,
29945,
526,
12023,
304,
367,
14496,
30004,
13,
9651,
396,
259,
1819,
29871,
1405,
29871,
29945,
526,
12023,
304,
367,
6233,
30004,
13,
29881,
13992,
4706,
396,
360,
1806,
4986,
30004,
13,
9651,
396,
2322,
1819,
310,
270,
8208,
322,
270,
13992,
526,
29871,
29955,
29889,
29945,
30004,
13,
29873,
293,
12506,
396,
297,
13677,
6233,
29991,
13109,
995,
338,
29871,
29906,
29889,
29945,
30004,
13,
275,
29940,
3035,
29906,
29955,
268,
396,
405,
3035,
29906,
29955,
470,
405,
3035,
29947,
29941,
363,
3405,
29899,
5426,
14354,
30004,
13,
449,
29887,
2585,
418,
396,
5923,
1737,
397,
3223,
304,
3495,
1962,
4682,
4413,
30004,
13,
449,
5592,
5620,
1678,
396,
1962,
18652,
3407,
1788,
30004,
13,
10526,
905,
268,
396,
22728,
4138,
29892,
1818,
367,
2044,
519,
30004,
13,
15945,
19451,
13,
30004,
13,
29883,
353,
525,
5501,
30004,
13,
12163,
929,
14730,
353,
525,
30073,
29915,
30004,
13,
1195,
1082,
14730,
353,
376,
11838,
30004,
13,
7496,
14730,
353,
18793,
29915,
30004,
13,
30004,
13,
1753,
788,
16190,
2855,
11816,
29898,
7645,
29892,
2775,
537,
29922,
29900,
1125,
6756,
13,
1678,
396,
14677,
10191,
304,
4315,
322,
12778,
10191,
304,
278,
1737,
26555,
985,
272,
313,
262,
1206,
445,
338,
1065,
408,
263,
5780,
29897,
6756,
13,
1678,
396,
1596,
10191,
6756,
13,
1678,
1018,
29901,
6756,
13,
418,
363,
1347,
297,
10191,
29889,
5451,
28909,
29876,
29374,
6756,
13,
4706,
396,
3462,
8210,
1737,
26555,
985,
292,
2643,
6756,
13,
4706,
565,
2775,
537,
1275,
29871,
29900,
29901,
6756,
13,
9651,
15232,
2272,
29889,
2528,
3728,
29898,
1807,
29897,
6756,
13,
4706,
25342,
2775,
537,
1275,
29871,
29896,
29901,
6756,
13,
9651,
15232,
2272,
29889,
2528,
22709,
29898,
1807,
29897,
6756,
13,
4706,
25342,
2775,
537,
1275,
29871,
29906,
29901,
6756,
13,
9651,
15232,
2272,
29889,
2528,
2392,
29898,
1807,
29897,
6756,
13,
1678,
5174,
29901,
6756,
13,
4706,
1209,
6756,
13,
30004,
13,
1753,
270,
1516,
1231,
1762,
7858,
29898,
29881,
1516,
1231,
1125,
30004,
13,
1678,
270,
1516,
353,
270,
1516,
1231,
29889,
5451,
26471,
13,
1678,
24488,
353,
6425,
29898,
7411,
29898,
29881,
1516,
29961,
29900,
12622,
30004,
13,
1678,
565,
7431,
29898,
29881,
1516,
29897,
1405,
29871,
29896,
29901,
30004,
13,
4706,
24488,
353,
24488,
718,
5785,
29898,
29881,
1516,
29961,
29896,
2314,
29914,
29953,
29900,
29889,
29900,
30004,
13,
1678,
565,
7431,
29898,
29881,
1516,
29897,
1405,
29871,
29906,
29901,
30004,
13,
4706,
24488,
353,
24488,
718,
5785,
29898,
29881,
1516,
29961,
29906,
2314,
29914,
29941,
29953,
29900,
29900,
29889,
29900,
30004,
13,
1678,
565,
270,
1516,
29961,
29900,
3816,
29900,
29962,
1275,
17411,
2396,
30004,
13,
4706,
24488,
353,
29871,
29900,
448,
24488,
30004,
13,
1678,
736,
29898,
1289,
8443,
13,
30004,
13,
1753,
24488,
1762,
29928,
1516,
1231,
29898,
1289,
1125,
30004,
13,
1678,
24488,
353,
6425,
29898,
1289,
8443,
13,
1678,
14496,
353,
938,
29898,
1289,
8443,
13,
1678,
6233,
353,
938,
3552,
1289,
29899,
311,
7979,
267,
11877,
29871,
29953,
29900,
8443,
13,
1678,
6923,
353,
938,
29898,
14486,
3552,
1289,
29899,
311,
7979,
267,
17722,
1195,
2667,
29914,
29953,
29900,
29889,
29900,
876,
29930,
29871,
29941,
29953,
29900,
29900,
876,
30004,
13,
1678,
565,
6923,
1275,
29871,
29953,
29900,
29901,
30004,
13,
4706,
6233,
353,
6233,
29974,
29896,
30004,
13,
4706,
6923,
353,
29871,
29900,
30004,
13,
1678,
270,
1516,
1231,
353,
851,
29898,
311,
7979,
267,
7240,
12163,
929,
14730,
30004,
13,
1678,
270,
1516,
1231,
353,
270,
1516,
1231,
29974,
710,
29898,
1195,
2667,
7240,
1195,
1082,
14730,
30004,
13,
1678,
565,
6923,
2804,
29871,
29900,
29901,
30004,
13,
4706,
270,
1516,
1231,
353,
270,
1516,
1231,
29974,
710,
29898,
23128,
7240,
7496,
14730,
30004,
13,
1678,
736,
270,
1516,
1231,
30004,
13,
30004,
13,
1202,
16190,
2855,
11816,
29898,
3259,
1231,
8443,
13,
30004,
13,
2277,
341,
3301,
16437,
18783,
19926,
30004,
13,
29937,
679,
322,
1423,
10970,
30004,
13,
1660,
8208,
5015,
353,
10876,
29889,
19218,
29961,
29896,
29962,
30004,
13,
1660,
13992,
5015,
353,
10876,
29889,
19218,
29961,
29906,
29962,
30004,
13,
29881,
8208,
353,
5785,
29898,
9675,
29889,
19218,
29961,
29941,
2314,
30004,
13,
29881,
13992,
353,
5785,
29898,
9675,
29889,
19218,
29961,
29946,
2314,
30004,
13,
29873,
293,
12506,
353,
5785,
29898,
9675,
29889,
19218,
29961,
29945,
2314,
30004,
13,
361,
10876,
29889,
19218,
29961,
29953,
29962,
1275,
525,
3009,
2396,
30004,
13,
1678,
338,
29940,
3035,
29906,
29955,
353,
5852,
30004,
13,
2870,
29901,
30004,
13,
1678,
338,
29940,
3035,
29906,
29955,
353,
7700,
30004,
13,
30004,
13,
361,
338,
29940,
3035,
29906,
29955,
29901,
30004,
13,
1678,
921,
29891,
2395,
353,
525,
1692,
29949,
8766,
29903,
3366,
8766,
29903,
29918,
29940,
2072,
29918,
14689,
29918,
29896,
29929,
29906,
29955,
613,
25832,
5005,
3366,
29928,
29918,
29940,
2072,
29918,
14689,
29918,
29896,
29929,
29906,
29955,
613,
5550,
4448,
29949,
1367,
3366,
29907,
4675,
446,
29918,
29896,
29947,
29953,
29953,
613,
29953,
29941,
29955,
29947,
29906,
29900,
29953,
29889,
29946,
29892,
29906,
29929,
29946,
29889,
29929,
29955,
29947,
29953,
29929,
29947,
29906,
20526,
29829,
2303,
29924,
3366,
24599,
16416,
613,
29900,
29889,
29900,
1402,
3904,
1806,
3366,
29928,
387,
929,
613,
29900,
29889,
29900,
29896,
29955,
29946,
29945,
29941,
29906,
29929,
29906,
29945,
29896,
29929,
29929,
29946,
29941,
29941,
1402,
20656,
29950,
1955,
11937,
3366,
29923,
7024,
29954,
613,
29946,
29906,
29953,
29955,
5262,
29915,
30004,
13,
2870,
29901,
30004,
13,
1678,
921,
29891,
2395,
353,
525,
1692,
29949,
8766,
29903,
3366,
8766,
29903,
29918,
29940,
2072,
29918,
14689,
29918,
29896,
29929,
29947,
29941,
613,
25832,
5005,
3366,
29928,
29918,
29940,
2072,
29918,
14689,
29918,
29896,
29929,
29947,
29941,
613,
5550,
4448,
29949,
1367,
3366,
29954,
12445,
29918,
29896,
29929,
29947,
29900,
613,
29953,
29941,
29955,
29947,
29896,
29941,
29955,
29889,
29900,
29892,
29906,
29929,
29947,
29889,
29906,
29945,
29955,
29906,
29906,
29906,
29896,
29900,
29896,
20526,
29829,
2303,
29924,
3366,
24599,
16416,
613,
29900,
29889,
29900,
1402,
3904,
1806,
3366,
29928,
387,
929,
613,
29900,
29889,
29900,
29896,
29955,
29946,
29945,
29941,
29906,
29929,
29906,
29945,
29896,
29929,
29929,
29946,
29941,
29941,
1402,
20656,
29950,
1955,
11937,
3366,
29923,
7024,
29954,
613,
29946,
29906,
29953,
29929,
5262,
29915,
30004,
13,
30004,
13,
449,
29887,
2585,
353,
10876,
29889,
19218,
29961,
29955,
29962,
30004,
13,
449,
5592,
5620,
353,
10876,
29889,
19218,
29961,
29947,
29962,
30004,
13,
10526,
905,
353,
10876,
29889,
19218,
29961,
29929,
29962,
30004,
13,
30004,
13,
29937,
731,
664,
3493,
30004,
13,
5666,
2272,
29889,
6272,
29889,
1287,
3493,
353,
714,
29887,
2585,
30004,
13,
5666,
2272,
29889,
6272,
29889,
10526,
905,
5531,
3493,
353,
22728,
30004,
13,
30004,
13,
29937,
8147,
4236,
8208,
322,
1375,
13992,
29892,
270,
13992,
29892,
270,
8208,
29892,
1375,
8208,
29892,
4236,
13992,
30004,
13,
3317,
8208,
353,
270,
1516,
1231,
1762,
7858,
29898,
1660,
8208,
5015,
8443,
13,
1195,
13992,
353,
270,
1516,
1231,
1762,
7858,
29898,
1660,
13992,
5015,
8443,
13,
361,
270,
8208,
1405,
29871,
29945,
29901,
30004,
13,
1678,
270,
8208,
353,
270,
8208,
29914,
29953,
29900,
29889,
29900,
30004,
13,
361,
270,
13992,
1405,
29871,
29945,
29901,
30004,
13,
1678,
270,
13992,
353,
270,
13992,
29914,
29953,
29900,
29889,
29900,
30004,
13,
1195,
8208,
353,
4236,
8208,
448,
270,
8208,
30004,
13,
3317,
13992,
353,
1375,
13992,
718,
270,
13992,
30004,
13,
30004,
13,
29937,
1243,
363,
322,
5217,
738,
4682,
4413,
304,
367,
2825,
30004,
13,
1454,
15473,
297,
6024,
4419,
3388,
3744,
1220,
3788,
3388,
3744,
1220,
3788,
4419,
29911,
1199,
3788,
29911,
1199,
2033,
29901,
30004,
13,
1678,
565,
15232,
2272,
29889,
24217,
29898,
4419,
1125,
30004,
13,
4706,
15232,
2272,
29889,
12498,
29918,
21895,
29898,
4419,
8443,
13,
4706,
788,
16190,
2855,
11816,
877,
29871,
11132,
4682,
770,
6571,
4286,
4830,
29898,
4419,
876,
30004,
13,
30004,
13,
2277,
341,
3301,
19474,
18521,
30004,
13,
29937,
1207,
1060,
29979,
934,
363,
2910,
27887,
30004,
13,
1202,
16190,
2855,
11816,
877,
29871,
5007,
2910,
27887,
934,
1495,
30004,
13,
1885,
29888,
353,
1722,
29898,
359,
29889,
2084,
29889,
7122,
29898,
10526,
905,
29892,
525,
12353,
1884,
29889,
7638,
5477,
525,
29893,
1495,
30004,
13,
1885,
29888,
29889,
3539,
877,
29931,
20614,
1806,
29965,
2287,
29892,
29931,
1299,
1806,
29965,
2287,
29905,
29876,
1495,
30004,
13,
1885,
29888,
29889,
3539,
877,
29912,
29087,
1012,
29876,
4286,
4830,
29898,
710,
29898,
1195,
8208,
511,
851,
29898,
3317,
13992,
4961,
30004,
13,
1885,
29888,
29889,
3539,
877,
29912,
29087,
1012,
29876,
4286,
4830,
29898,
710,
29898,
3317,
8208,
511,
851,
29898,
3317,
13992,
4961,
30004,
13,
1885,
29888,
29889,
3539,
877,
29912,
29087,
1012,
29876,
4286,
4830,
29898,
710,
29898,
3317,
8208,
511,
851,
29898,
1195,
13992,
4961,
30004,
13,
1885,
29888,
29889,
3539,
877,
29912,
29087,
1012,
29876,
4286,
4830,
29898,
710,
29898,
1195,
8208,
511,
851,
29898,
1195,
13992,
4961,
30004,
13,
1885,
29888,
29889,
3539,
877,
29912,
29087,
1012,
29876,
4286,
4830,
29898,
710,
29898,
1195,
8208,
511,
851,
29898,
3317,
13992,
4961,
30004,
13,
1885,
29888,
29889,
5358,
26471,
13,
30004,
13,
29937,
3588,
1060,
29979,
934,
304,
869,
29881,
1635,
1591,
30004,
13,
1884,
29881,
1635,
353,
15232,
2272,
29889,
4391,
4421,
29878,
905,
1170,
877,
12353,
3788,
29889,
29881,
1635,
3788,
742,
10526,
905,
8443,
13,
1884,
29881,
1635,
353,
2897,
29889,
2084,
29889,
6500,
3871,
29898,
1884,
29881,
1635,
8443,
13,
5666,
2272,
29889,
3562,
1762,
3562,
29918,
535,
3259,
29898,
359,
29889,
2084,
29889,
7122,
29898,
10526,
905,
5501,
12353,
1884,
29889,
7638,
5477,
22728,
29892,
1884,
29881,
1635,
8443,
13,
30004,
13,
29937,
1207,
1060,
29979,
1741,
7546,
515,
869,
29881,
1635,
1591,
30004,
13,
5666,
2272,
29889,
9984,
18454,
2624,
14420,
29918,
21895,
29898,
359,
29889,
2084,
29889,
7122,
29898,
10526,
905,
29892,
3800,
29881,
1635,
511,
29915,
29931,
20614,
1806,
29965,
2287,
3788,
29931,
1299,
1806,
29965,
2287,
3788,
1884,
13148,
742,
3594,
2395,
8443,
13,
30004,
13,
29937,
3588,
1741,
7546,
304,
758,
2576,
3821,
1196,
4682,
770,
411,
8984,
29879,
1762,
3542,
29918,
21895,
30004,
13,
5666,
2272,
29889,
20325,
1762,
3542,
29918,
21895,
877,
1884,
13148,
742,
525,
4419,
3388,
3744,
1220,
1495,
30004,
13,
30004,
13,
29937,
6245,
1598,
7315,
3744,
1220,
30004,
13,
5666,
2272,
29889,
29928,
575,
1598,
29918,
5628,
877,
4419,
3388,
3744,
1220,
742,
525,
4571,
1254,
23219,
742,
29871,
29900,
29889,
29900,
29900,
29900,
29896,
8443,
13,
30004,
13,
29937,
2060,
304,
1959,
18652,
3407,
30004,
13,
2277,
29937,
3446,
3235,
319,
1799,
29965,
2303,
29903,
3446,
1299,
19474,
12336,
4810,
25593,
1177,
3040,
28962,
1254,
12665,
8519,
379,
15249,
5300,
399,
29923,
319,
1525,
2672,
438,
18166,
1164,
6323,
399,
24943,
4214,
29911,
1164,
6824,
30004,
13,
361,
338,
29940,
3035,
29906,
29955,
29901,
30004,
13,
1678,
1737,
25730,
550,
5404,
353,
525,
29940,
3035,
29918,
29896,
29929,
29906,
29955,
29918,
1762,
29918,
29940,
3035,
29918,
29896,
29929,
29947,
29941,
29918,
29940,
3035,
6007,
29936,
29940,
3035,
29918,
29896,
29929,
29947,
29941,
29918,
1762,
29918,
29950,
15249,
29918,
1955,
29918,
12982,
29915,
30004,
13,
2870,
29901,
30004,
13,
1678,
1737,
25730,
550,
5404,
353,
525,
29940,
3035,
29918,
29896,
29929,
29947,
29941,
29918,
1762,
29918,
29950,
15249,
29918,
1955,
29918,
12982,
29915,
30004,
13,
30004,
13,
479,
25730,
550,
5404,
353,
6629,
30004,
13,
30004,
13,
5666,
2272,
29889,
7653,
29918,
21895,
877,
4419,
3388,
3744,
1220,
742,
525,
3388,
3744,
1220,
742,
714,
5592,
5620,
29892,
1737,
25730,
550,
5404,
29892,
921,
29891,
2395,
8443,
13,
30004,
13,
2277,
323,
2965,
29903,
30004,
13,
29937,
8147,
1375,
29911,
293,
8208,
29892,
1375,
29911,
293,
13992,
29892,
4236,
29911,
293,
8208,
29892,
4236,
29911,
293,
5066,
30004,
13,
29873,
293,
12506,
353,
260,
293,
12506,
847,
29871,
29953,
29900,
29889,
29900,
396,
3588,
6233,
304,
14496,
30004,
13,
1195,
29911,
293,
8208,
353,
938,
29898,
14486,
29898,
29900,
29889,
29896,
718,
1375,
8208,
849,
260,
293,
12506,
876,
6756,
13,
3317,
29911,
293,
8208,
353,
938,
29898,
14486,
29898,
29896,
29889,
29896,
718,
4236,
8208,
849,
260,
293,
12506,
876,
30004,
13,
1195,
29911,
293,
13992,
353,
938,
29898,
14486,
29898,
29900,
29889,
29896,
718,
1375,
13992,
849,
260,
293,
12506,
876,
6756,
13,
3317,
29911,
293,
13992,
353,
938,
29898,
14486,
29898,
29896,
29889,
29896,
718,
4236,
13992,
849,
260,
293,
12506,
876,
30004,
13,
361,
1375,
29911,
293,
8208,
529,
29871,
29900,
29901,
30004,
13,
1678,
1375,
29911,
293,
8208,
353,
1375,
29911,
293,
8208,
718,
29871,
29896,
30004,
13,
361,
4236,
29911,
293,
8208,
529,
29871,
29900,
29901,
30004,
13,
1678,
4236,
29911,
293,
8208,
353,
4236,
29911,
293,
8208,
718,
29871,
29896,
30004,
13,
1678,
6756,
13,
29937,
1207,
921,
29891,
934,
363,
260,
1199,
30004,
13,
1202,
16190,
2855,
11816,
877,
29871,
5007,
260,
293,
934,
1495,
30004,
13,
1885,
29888,
353,
1722,
29898,
359,
29889,
2084,
29889,
7122,
29898,
10526,
905,
29892,
525,
4419,
486,
1199,
29889,
7638,
5477,
29915,
29893,
1495,
30004,
13,
1885,
29888,
29889,
3539,
877,
1367,
29892,
29931,
20614,
1806,
29965,
2287,
29892,
29931,
1299,
1806,
29965,
2287,
29905,
29876,
1495,
30004,
13,
29876,
29911,
293,
353,
29871,
29896,
30004,
13,
1454,
343,
297,
3464,
29898,
1195,
29911,
293,
13992,
29892,
4236,
29911,
293,
13992,
1125,
30004,
13,
1678,
260,
293,
13992,
353,
343,
334,
260,
293,
12506,
30004,
13,
1678,
363,
921,
297,
3464,
29898,
1195,
29911,
293,
8208,
29892,
4236,
29911,
293,
8208,
1125,
30004,
13,
4706,
260,
293,
8208,
353,
921,
334,
260,
293,
12506,
30004,
13,
4706,
2531,
29888,
29889,
3539,
29898,
710,
29898,
29876,
29911,
293,
29897,
718,
274,
718,
851,
29898,
29873,
293,
8208,
29897,
718,
274,
718,
851,
29898,
29873,
293,
13992,
29897,
718,
11297,
29876,
1495,
30004,
13,
4706,
302,
29911,
293,
353,
302,
29911,
293,
29974,
29896,
30004,
13,
1885,
29888,
29889,
5358,
26471,
13,
30004,
13,
29937,
3588,
304,
270,
1635,
30004,
13,
29873,
293,
29881,
1635,
353,
15232,
2272,
29889,
4391,
4421,
29878,
905,
1170,
877,
12353,
3788,
29889,
29881,
1635,
3788,
742,
10526,
905,
8443,
13,
2158,
29898,
29873,
293,
29881,
1635,
8443,
13,
29873,
293,
29881,
1635,
353,
2897,
29889,
2084,
29889,
6500,
3871,
29898,
29873,
293,
29881,
1635,
8443,
13,
2158,
29898,
29873,
293,
29881,
1635,
8443,
13,
5666,
2272,
29889,
3562,
1762,
3562,
29918,
535,
3259,
29898,
359,
29889,
2084,
29889,
7122,
29898,
10526,
905,
29892,
525,
4419,
486,
1199,
29889,
7638,
5477,
22728,
29892,
260,
293,
29881,
1635,
8443,
13,
30004,
13,
29937,
1207,
1060,
29979,
1741,
7546,
515,
1591,
30004,
13,
5666,
2272,
29889,
9984,
18454,
2624,
14420,
29918,
21895,
29898,
359,
29889,
2084,
29889,
7122,
29898,
10526,
905,
29892,
260,
293,
29881,
1635,
511,
525,
29931,
20614,
1806,
29965,
2287,
742,
525,
29931,
1299,
1806,
29965,
2287,
742,
525,
29873,
293,
13148,
742,
921,
29891,
2395,
8443,
13,
30004,
13,
29937,
3509,
304,
1298,
4682,
1990,
30004,
13,
5666,
2272,
29889,
19132,
1762,
5228,
29918,
21895,
877,
29873,
293,
13148,
742,
525,
29916,
486,
1199,
1495,
30004,
13,
30004,
13,
29937,
2060,
304,
1959,
14821,
1788,
30004,
13,
5666,
2272,
29889,
7653,
29918,
21895,
877,
29916,
486,
1199,
742,
525,
29873,
1199,
742,
714,
5592,
5620,
29892,
1737,
25730,
550,
5404,
29892,
3594,
2395,
8443,
13,
30004,
13,
29937,
788,
8393,
6756,
13,
1454,
285,
430,
297,
6024,
29923,
579,
292,
3788,
29940,
272,
1918,
2033,
29901,
30004,
13,
1678,
15232,
2272,
29889,
2528,
3073,
29918,
21895,
877,
29873,
1199,
742,
29888,
430,
5501,
3970,
7466,
1307,
1495,
30004,
13,
1454,
285,
430,
297,
6024,
13992,
29928,
4345,
3788,
8208,
29928,
4345,
2033,
29901,
30004,
13,
1678,
15232,
2272,
29889,
2528,
3073,
29918,
21895,
877,
29873,
1199,
742,
29888,
430,
5501,
16975,
742,
29908,
3284,
613,
29906,
29900,
8443,
13,
5666,
2272,
29889,
2528,
18454,
29918,
21895,
877,
29873,
1199,
1495,
30004,
13,
30004,
13,
29937,
22235,
6932,
292,
353,
8984,
29918,
29990,
29892,
4186,
1918,
353,
8984,
29918,
29979,
30004,
13,
5666,
2272,
29889,
27065,
403,
3073,
29918,
21895,
877,
29873,
1199,
3788,
29923,
579,
292,
3788,
29991,
5228,
29918,
29990,
29991,
3788,
20055,
4690,
1164,
1495,
30004,
13,
5666,
2272,
29889,
27065,
403,
3073,
29918,
21895,
877,
29873,
1199,
3788,
29940,
272,
1918,
3788,
29991,
5228,
29918,
29979,
29991,
3788,
20055,
4690,
1164,
1495,
30004,
13,
30004,
13,
29937,
1653,
2767,
10677,
29892,
11412,
1549,
260,
1199,
29892,
322,
788,
7053,
29928,
4345,
322,
6242,
29928,
4345,
30004,
13,
1202,
16190,
2855,
11816,
877,
29871,
4417,
3405,
29899,
5426,
1426,
6031,
1495,
30004,
13,
5727,
353,
15232,
2272,
29889,
6422,
19890,
877,
29873,
1199,
1495,
30004,
13,
1454,
1948,
297,
4206,
29901,
30004,
13,
1678,
1948,
29889,
13992,
29928,
4345,
353,
24488,
1762,
29928,
1516,
1231,
29898,
798,
29889,
29931,
1299,
1806,
29965,
2287,
8443,
13,
1678,
1948,
29889,
8208,
29928,
4345,
353,
24488,
1762,
29928,
1516,
1231,
29898,
798,
29889,
29931,
20614,
1806,
29965,
2287,
8443,
13,
1678,
4206,
29889,
5504,
4301,
29898,
798,
8443,
13,
6144,
1948,
30004,
13,
6144,
4206,
30004,
13,
30004,
13,
29937,
5217,
11799,
2066,
29892,
270,
1635,
2066,
29892,
322,
758,
2576,
3821,
4682,
13203,
30004,
13,
1202,
16190,
2855,
11816,
877,
29871,
5941,
292,
701,
22728,
664,
3493,
1495,
30004,
13,
1454,
15473,
297,
518,
1884,
29881,
1635,
29892,
1884,
29881,
1635,
29974,
4286,
3134,
742,
29873,
293,
29881,
1635,
29892,
29873,
293,
29881,
1635,
29974,
4286,
3134,
2033,
29901,
29871,
396,
5501,
12353,
1884,
29889,
7638,
3788,
4419,
486,
1199,
29889,
7638,
2033,
29901,
30004,
13,
1678,
2897,
29889,
5992,
29898,
359,
29889,
2084,
29889,
7122,
29898,
10526,
905,
29892,
15473,
876,
30004,
13,
1202,
16190,
2855,
11816,
877,
29871,
21228,
13201,
4682,
4413,
1495,
30004,
13,
5666,
2272,
29889,
12498,
29918,
21895,
877,
29916,
486,
1199,
1495,
30004,
13,
5666,
2272,
29889,
12498,
29918,
21895,
877,
4419,
3388,
3744,
1220,
1495,
30004,
13,
30004,
13,
29937,
9675,
29889,
13322,
580,
259,
396,
4889,
6876,
411,
10672,
30004,
13,
2
] |
project1b.py | kaamila42/project1 | 0 | 92253 | <gh_stars>0
filename = input("Input the Filename: " ,"py = python", "txt = text", ...)
f_extns = filename.split(".")
print(f " The extension of the file is '{f_extns[]}'")
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
9507,
353,
1881,
703,
4290,
278,
2514,
3871,
29901,
29871,
376,
29871,
1699,
2272,
353,
3017,
613,
376,
3945,
353,
1426,
613,
2023,
8443,
13,
29888,
29918,
1062,
1983,
353,
10422,
29889,
5451,
17350,
1159,
30004,
13,
2158,
29898,
29888,
376,
450,
6081,
310,
278,
934,
338,
22372,
29888,
29918,
1062,
1983,
2636,
10162,
1159,
30004,
13,
2
] |
python/cursoemvideo/040.py | Gustavo-Martins/learning | 0 | 160305 | # Reads two grades and prints average
grade1 = float(input('Digite a primeira nota: '))
grade2 = float(input('Digite a segunda nota: '))
grade_average = (grade1 + grade2) / 2
print('Tirando {:.1f} e {:.1f}, a média é {:.1f}'.format(grade1, grade2, grade_average))
if grade_average < 5:
print('O aluno(a) está REPROVADO')
elif grade_average >= 7:
print('O aluno(a) está APROVADO')
else:
print('O aluno(a) está em RECUPERAÇÃO')
| [
1,
396,
7523,
29879,
1023,
867,
3076,
322,
14677,
6588,
13,
8228,
29896,
353,
5785,
29898,
2080,
877,
14991,
568,
263,
20997,
451,
29874,
29901,
525,
876,
13,
8228,
29906,
353,
5785,
29898,
2080,
877,
14991,
568,
263,
17329,
451,
29874,
29901,
525,
876,
13,
8228,
29918,
12483,
482,
353,
313,
8228,
29896,
718,
19468,
29906,
29897,
847,
29871,
29906,
13,
2158,
877,
29911,
381,
1743,
12365,
29889,
29896,
29888,
29913,
321,
12365,
29889,
29896,
29888,
1118,
263,
10283,
423,
904,
12365,
29889,
29896,
29888,
29913,
4286,
4830,
29898,
8228,
29896,
29892,
19468,
29906,
29892,
19468,
29918,
12483,
482,
876,
13,
13,
361,
19468,
29918,
12483,
482,
529,
29871,
29945,
29901,
13,
1678,
1596,
877,
29949,
394,
9447,
29898,
29874,
29897,
7919,
5195,
8618,
29963,
3035,
29949,
1495,
13,
23681,
19468,
29918,
12483,
482,
6736,
29871,
29955,
29901,
13,
1678,
1596,
877,
29949,
394,
9447,
29898,
29874,
29897,
7919,
319,
8618,
29963,
3035,
29949,
1495,
13,
2870,
29901,
13,
1678,
1596,
877,
29949,
394,
9447,
29898,
29874,
29897,
7919,
953,
5195,
29907,
4897,
1001,
29909,
30219,
30179,
29949,
1495,
13,
2
] |
piefuzz/__init__.py | timeyyy/piefuzz | 7 | 186810 | from piefuzz.piefuzz import *
| [
1,
515,
282,
2575,
18813,
29889,
29886,
2575,
18813,
1053,
334,
13,
2
] |
BlogSite-Flask/flaskblog/__init__.py | Mihir008/Web-Ideas | 10 | 167414 | from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_bcrypt import Bcrypt
from flask_login import LoginManager
app = Flask(__name__)
app.config['SECRET_KEY'] = '<KEY>'
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///site.db'
db = SQLAlchemy(app)
bcrypt = Bcrypt(app)
login_manager = LoginManager(app)
login_manager.login_view= 'login'
login_manager.login_message_category= 'info'
from flaskblog import routes
| [
1,
515,
29784,
1053,
2379,
1278,
29871,
13,
3166,
29784,
29918,
2850,
284,
305,
6764,
1053,
3758,
2499,
305,
6764,
259,
13,
3166,
29784,
29918,
12328,
4641,
1053,
350,
29883,
4641,
13,
3166,
29784,
29918,
7507,
1053,
19130,
3260,
13,
13,
932,
353,
2379,
1278,
22168,
978,
1649,
29897,
13,
932,
29889,
2917,
1839,
1660,
22245,
29911,
29918,
10818,
2033,
353,
12801,
10818,
16299,
13,
932,
29889,
2917,
1839,
4176,
1964,
3210,
12665,
29979,
29918,
25832,
27982,
29918,
15551,
2033,
353,
525,
22793,
597,
29914,
2746,
29889,
2585,
29915,
13,
2585,
353,
3758,
2499,
305,
6764,
29898,
932,
29897,
13,
12328,
4641,
353,
350,
29883,
4641,
29898,
932,
29897,
13,
7507,
29918,
12847,
353,
19130,
3260,
29898,
932,
29897,
13,
7507,
29918,
12847,
29889,
7507,
29918,
1493,
29922,
525,
7507,
29915,
13,
7507,
29918,
12847,
29889,
7507,
29918,
4906,
29918,
7320,
29922,
525,
3888,
29915,
13,
13,
3166,
29784,
7312,
1053,
12049,
13,
2
] |
person_detector.py | RocketMan112/STEM_Mentorship | 0 | 156800 | import logging
log = logging.getLogger(__name__)
class PersonDetectorBase:
def initialize(self):
pass
def name(self):
return "Error - Base PersonDetector class, not for direct use"
class FakeFixedPersonDetector(PersonDetectorBase):
def initialize(self):
pass
def name(self):
return "FakeFixedPersonDetector"
class ComputerVisionPersonDetector(PersonDetectorBase):
def initialize(self):
pass
def name(self):
return "ComputerVisionPersonDetector"
| [
1,
1053,
12183,
13,
1188,
353,
12183,
29889,
657,
16363,
22168,
978,
1649,
29897,
13,
13,
13,
1990,
5196,
6362,
3019,
5160,
29901,
13,
1678,
822,
11905,
29898,
1311,
1125,
13,
4706,
1209,
13,
13,
1678,
822,
1024,
29898,
1311,
1125,
13,
4706,
736,
376,
2392,
448,
7399,
5196,
6362,
3019,
770,
29892,
451,
363,
1513,
671,
29908,
13,
13,
13,
1990,
383,
1296,
26262,
7435,
6362,
3019,
29898,
7435,
6362,
3019,
5160,
1125,
13,
1678,
822,
11905,
29898,
1311,
1125,
13,
4706,
1209,
13,
13,
1678,
822,
1024,
29898,
1311,
1125,
13,
4706,
736,
376,
29943,
1296,
26262,
7435,
6362,
3019,
29908,
13,
13,
13,
1990,
20972,
29963,
2459,
7435,
6362,
3019,
29898,
7435,
6362,
3019,
5160,
1125,
13,
1678,
822,
11905,
29898,
1311,
1125,
13,
4706,
1209,
13,
13,
1678,
822,
1024,
29898,
1311,
1125,
13,
4706,
736,
376,
20606,
261,
29963,
2459,
7435,
6362,
3019,
29908,
13,
2
] |
bcs-ui/backend/tests/resources/test_resource.py | laodiu/bk-bcs | 1 | 1616915 | <reponame>laodiu/bk-bcs
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2021 TH<NAME>, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://opensource.org/licenses/MIT
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
"""
import pytest
from backend.container_service.clusters.base.models import CtxCluster
from backend.resources.resource import ResourceClient, ResourceList, ResourceObj
from backend.resources.utils.format import ResourceDefaultFormatter
from backend.tests.conftest import TEST_NAMESPACE
@pytest.fixture
def ctx_cluster(project_id, cluster_id):
return CtxCluster.create(cluster_id, project_id, token='token')
class PodResourceObj(ResourceObj):
@property
def image_name(self) -> str:
return self.data.spec.containers[0]['image']
class MyPod(ResourceClient):
kind = 'Pod'
formatter = ResourceDefaultFormatter()
result_type = PodResourceObj
@pytest.fixture(
params=[
# method kwargs, expected_type
# default `is_format` value is True
({}, dict),
({'is_format': True}, dict),
({'is_format': False}, PodResourceObj),
]
)
def type_assertion_pair(request):
return request.param
class TestResourceClient:
@pytest.fixture(autouse=True)
def init_resources(self, random_name, ctx_cluster):
MyPod(ctx_cluster).update_or_create(
namespace=TEST_NAMESPACE, name=random_name, body=make_pod_body(random_name)
)
yield
MyPod(ctx_cluster).delete(namespace=TEST_NAMESPACE, name=random_name)
def test_list_formatted(self, random_name, ctx_cluster):
pods = MyPod(ctx_cluster).list(namespace=TEST_NAMESPACE, is_format=True)
assert isinstance(pods, list)
assert isinstance(pods[0], dict)
def test_list_not_formatted(self, random_name, ctx_cluster):
pods = MyPod(ctx_cluster).list(namespace=TEST_NAMESPACE, is_format=False)
assert isinstance(pods, ResourceList)
assert isinstance(pods.metadata, dict)
assert random_name in [pod.name for pod in pods.items]
for pod in pods.items:
if pod.name == random_name:
assert pod.image_name == 'busybox'
def test_get_is_format(self, type_assertion_pair, random_name, ctx_cluster):
kwargs, expected_type = type_assertion_pair
pod = MyPod(ctx_cluster).get(namespace=TEST_NAMESPACE, name=random_name, **kwargs)
assert isinstance(pod, expected_type)
def test_get_none(self, random_name, ctx_cluster):
pod = MyPod(ctx_cluster).get(namespace=TEST_NAMESPACE, name=random_name + '-non-existent')
assert pod is None
def test_patch(self, type_assertion_pair, random_name, ctx_cluster):
body = make_pod_body(random_name)
body['metadata']['labels'] = {'foo': 'bar'}
kwargs, expected_type = type_assertion_pair
pod = MyPod(ctx_cluster).patch(namespace=TEST_NAMESPACE, name=random_name, body=body, **kwargs)
assert isinstance(pod, expected_type)
class TestResourceClientCreation:
def test_create(self, type_assertion_pair, random_name, ctx_cluster):
kwargs, expected_type = type_assertion_pair
pod = MyPod(ctx_cluster).create(
namespace=TEST_NAMESPACE, name=random_name, body=make_pod_body(random_name), **kwargs
)
assert isinstance(pod, expected_type)
def test_update_or_create(self, type_assertion_pair, random_name, ctx_cluster):
kwargs, expected_type = type_assertion_pair
pod, created = MyPod(ctx_cluster).update_or_create(
namespace=TEST_NAMESPACE, name=random_name, body=make_pod_body(random_name), **kwargs
)
assert isinstance(created, bool)
assert isinstance(pod, expected_type)
def make_pod_body(name: str):
"""Make simple Pod body for testing"""
return {
'apiVersion': 'v1',
'kind': 'Pod',
'metadata': {'name': name},
'spec': {'containers': [{'name': "main", 'image': "busybox"}]},
}
| [
1,
529,
276,
1112,
420,
29958,
433,
397,
5871,
29914,
29890,
29895,
29899,
29890,
2395,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
15945,
29908,
13,
29911,
264,
1760,
338,
22301,
304,
2304,
278,
1722,
2752,
7881,
491,
3907,
29871,
235,
150,
160,
236,
181,
187,
31676,
31784,
29925,
7340,
29903,
30606,
31037,
30564,
30467,
30845,
313,
21319,
29968,
292,
2621,
29874,
29903,
19184,
13,
3853,
654,
29897,
3625,
29889,
13,
11882,
1266,
313,
29907,
29897,
29871,
29906,
29900,
29896,
29955,
29899,
29906,
29900,
29906,
29896,
3446,
29966,
5813,
10202,
263,
12444,
1760,
5001,
29889,
2178,
10462,
21676,
29889,
13,
29931,
293,
21144,
1090,
278,
341,
1806,
19245,
313,
1552,
376,
29931,
293,
1947,
1496,
366,
1122,
451,
671,
445,
934,
5174,
297,
752,
13036,
411,
278,
19245,
29889,
13,
3492,
1122,
4017,
263,
3509,
310,
278,
19245,
472,
13,
13,
1678,
1732,
597,
22156,
1167,
29889,
990,
29914,
506,
11259,
29914,
26349,
13,
13,
2525,
2222,
3734,
491,
22903,
4307,
470,
15502,
304,
297,
5007,
29892,
7047,
13235,
1090,
278,
19245,
338,
13235,
373,
13,
273,
376,
3289,
8519,
29908,
350,
3289,
3235,
29892,
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,
2823,
278,
19245,
363,
278,
13,
14940,
4086,
14765,
1076,
11239,
322,
27028,
1090,
278,
19245,
29889,
13,
15945,
29908,
13,
5215,
11451,
1688,
13,
13,
3166,
14998,
29889,
7611,
29918,
5509,
29889,
695,
504,
414,
29889,
3188,
29889,
9794,
1053,
315,
7508,
6821,
5402,
13,
3166,
14998,
29889,
13237,
29889,
10314,
1053,
18981,
4032,
29892,
18981,
1293,
29892,
18981,
9930,
13,
3166,
14998,
29889,
13237,
29889,
13239,
29889,
4830,
1053,
18981,
4592,
18522,
13,
3166,
14998,
29889,
21150,
29889,
535,
615,
342,
1053,
17067,
1254,
29918,
5813,
5550,
11538,
13,
13,
13,
29992,
2272,
1688,
29889,
7241,
15546,
13,
1753,
12893,
29918,
19594,
29898,
4836,
29918,
333,
29892,
9867,
29918,
333,
1125,
13,
1678,
736,
315,
7508,
6821,
5402,
29889,
3258,
29898,
19594,
29918,
333,
29892,
2060,
29918,
333,
29892,
5993,
2433,
6979,
1495,
13,
13,
13,
1990,
8594,
6848,
9930,
29898,
6848,
9930,
1125,
13,
1678,
732,
6799,
13,
1678,
822,
1967,
29918,
978,
29898,
1311,
29897,
1599,
851,
29901,
13,
4706,
736,
1583,
29889,
1272,
29889,
6550,
29889,
1285,
475,
414,
29961,
29900,
22322,
3027,
2033,
13,
13,
13,
1990,
1619,
27345,
29898,
6848,
4032,
1125,
13,
1678,
2924,
353,
525,
27345,
29915,
13,
1678,
883,
2620,
353,
18981,
4592,
18522,
580,
13,
1678,
1121,
29918,
1853,
353,
8594,
6848,
9930,
13,
13,
13,
29992,
2272,
1688,
29889,
7241,
15546,
29898,
13,
1678,
8636,
11759,
13,
4706,
396,
1158,
9049,
5085,
29892,
3806,
29918,
1853,
13,
4706,
396,
2322,
421,
275,
29918,
4830,
29952,
995,
338,
5852,
13,
4706,
21313,
1118,
9657,
511,
13,
4706,
313,
10998,
275,
29918,
4830,
2396,
5852,
1118,
9657,
511,
13,
4706,
313,
10998,
275,
29918,
4830,
2396,
7700,
1118,
8594,
6848,
9930,
511,
13,
1678,
4514,
13,
29897,
13,
1753,
1134,
29918,
9294,
291,
29918,
18784,
29898,
3827,
1125,
13,
1678,
736,
2009,
29889,
3207,
13,
13,
13,
1990,
4321,
6848,
4032,
29901,
13,
1678,
732,
2272,
1688,
29889,
7241,
15546,
29898,
1300,
1709,
29922,
5574,
29897,
13,
1678,
822,
2069,
29918,
13237,
29898,
1311,
29892,
4036,
29918,
978,
29892,
12893,
29918,
19594,
1125,
13,
4706,
1619,
27345,
29898,
13073,
29918,
19594,
467,
5504,
29918,
272,
29918,
3258,
29898,
13,
9651,
7397,
29922,
18267,
29918,
5813,
5550,
11538,
29892,
1024,
29922,
8172,
29918,
978,
29892,
3573,
29922,
5675,
29918,
15334,
29918,
2587,
29898,
8172,
29918,
978,
29897,
13,
4706,
1723,
13,
4706,
7709,
13,
4706,
1619,
27345,
29898,
13073,
29918,
19594,
467,
8143,
29898,
22377,
29922,
18267,
29918,
5813,
5550,
11538,
29892,
1024,
29922,
8172,
29918,
978,
29897,
13,
13,
1678,
822,
1243,
29918,
1761,
29918,
689,
19667,
29898,
1311,
29892,
4036,
29918,
978,
29892,
12893,
29918,
19594,
1125,
13,
4706,
2532,
29879,
353,
1619,
27345,
29898,
13073,
29918,
19594,
467,
1761,
29898,
22377,
29922,
18267,
29918,
5813,
5550,
11538,
29892,
338,
29918,
4830,
29922,
5574,
29897,
13,
13,
4706,
4974,
338,
8758,
29898,
15334,
29879,
29892,
1051,
29897,
13,
4706,
4974,
338,
8758,
29898,
15334,
29879,
29961,
29900,
1402,
9657,
29897,
13,
13,
1678,
822,
1243,
29918,
1761,
29918,
1333,
29918,
689,
19667,
29898,
1311,
29892,
4036,
29918,
978,
29892,
12893,
29918,
19594,
1125,
13,
4706,
2532,
29879,
353,
1619,
27345,
29898,
13073,
29918,
19594,
467,
1761,
29898,
22377,
29922,
18267,
29918,
5813,
5550,
11538,
29892,
338,
29918,
4830,
29922,
8824,
29897,
13,
13,
4706,
4974,
338,
8758,
29898,
15334,
29879,
29892,
18981,
1293,
29897,
13,
4706,
4974,
338,
8758,
29898,
15334,
29879,
29889,
19635,
29892,
9657,
29897,
13,
4706,
4974,
4036,
29918,
978,
297,
518,
15334,
29889,
978,
363,
2532,
297,
2532,
29879,
29889,
7076,
29962,
13,
4706,
363,
2532,
297,
2532,
29879,
29889,
7076,
29901,
13,
9651,
565,
2532,
29889,
978,
1275,
4036,
29918,
978,
29901,
13,
18884,
4974,
2532,
29889,
3027,
29918,
978,
1275,
525,
8262,
29891,
1884,
29915,
13,
13,
1678,
822,
1243,
29918,
657,
29918,
275,
29918,
4830,
29898,
1311,
29892,
1134,
29918,
9294,
291,
29918,
18784,
29892,
4036,
29918,
978,
29892,
12893,
29918,
19594,
1125,
13,
4706,
9049,
5085,
29892,
3806,
29918,
1853,
353,
1134,
29918,
9294,
291,
29918,
18784,
13,
4706,
2532,
353,
1619,
27345,
29898,
13073,
29918,
19594,
467,
657,
29898,
22377,
29922,
18267,
29918,
5813,
5550,
11538,
29892,
1024,
29922,
8172,
29918,
978,
29892,
3579,
19290,
29897,
13,
4706,
4974,
338,
8758,
29898,
15334,
29892,
3806,
29918,
1853,
29897,
13,
13,
1678,
822,
1243,
29918,
657,
29918,
9290,
29898,
1311,
29892,
4036,
29918,
978,
29892,
12893,
29918,
19594,
1125,
13,
4706,
2532,
353,
1619,
27345,
29898,
13073,
29918,
19594,
467,
657,
29898,
22377,
29922,
18267,
29918,
5813,
5550,
11538,
29892,
1024,
29922,
8172,
29918,
978,
718,
17411,
5464,
29899,
735,
9696,
1495,
13,
4706,
4974,
2532,
338,
6213,
13,
13,
1678,
822,
1243,
29918,
5041,
29898,
1311,
29892,
1134,
29918,
9294,
291,
29918,
18784,
29892,
4036,
29918,
978,
29892,
12893,
29918,
19594,
1125,
13,
4706,
3573,
353,
1207,
29918,
15334,
29918,
2587,
29898,
8172,
29918,
978,
29897,
13,
4706,
3573,
1839,
19635,
16215,
21134,
2033,
353,
11117,
5431,
2396,
525,
1646,
10827,
13,
13,
4706,
9049,
5085,
29892,
3806,
29918,
1853,
353,
1134,
29918,
9294,
291,
29918,
18784,
13,
4706,
2532,
353,
1619,
27345,
29898,
13073,
29918,
19594,
467,
5041,
29898,
22377,
29922,
18267,
29918,
5813,
5550,
11538,
29892,
1024,
29922,
8172,
29918,
978,
29892,
3573,
29922,
2587,
29892,
3579,
19290,
29897,
13,
4706,
4974,
338,
8758,
29898,
15334,
29892,
3806,
29918,
1853,
29897,
13,
13,
13,
1990,
4321,
6848,
4032,
9832,
362,
29901,
13,
1678,
822,
1243,
29918,
3258,
29898,
1311,
29892,
1134,
29918,
9294,
291,
29918,
18784,
29892,
4036,
29918,
978,
29892,
12893,
29918,
19594,
1125,
13,
4706,
9049,
5085,
29892,
3806,
29918,
1853,
353,
1134,
29918,
9294,
291,
29918,
18784,
13,
4706,
2532,
353,
1619,
27345,
29898,
13073,
29918,
19594,
467,
3258,
29898,
13,
9651,
7397,
29922,
18267,
29918,
5813,
5550,
11538,
29892,
1024,
29922,
8172,
29918,
978,
29892,
3573,
29922,
5675,
29918,
15334,
29918,
2587,
29898,
8172,
29918,
978,
511,
3579,
19290,
13,
4706,
1723,
13,
4706,
4974,
338,
8758,
29898,
15334,
29892,
3806,
29918,
1853,
29897,
13,
13,
1678,
822,
1243,
29918,
5504,
29918,
272,
29918,
3258,
29898,
1311,
29892,
1134,
29918,
9294,
291,
29918,
18784,
29892,
4036,
29918,
978,
29892,
12893,
29918,
19594,
1125,
13,
4706,
9049,
5085,
29892,
3806,
29918,
1853,
353,
1134,
29918,
9294,
291,
29918,
18784,
13,
4706,
2532,
29892,
2825,
353,
1619,
27345,
29898,
13073,
29918,
19594,
467,
5504,
29918,
272,
29918,
3258,
29898,
13,
9651,
7397,
29922,
18267,
29918,
5813,
5550,
11538,
29892,
1024,
29922,
8172,
29918,
978,
29892,
3573,
29922,
5675,
29918,
15334,
29918,
2587,
29898,
8172,
29918,
978,
511,
3579,
19290,
13,
4706,
1723,
13,
4706,
4974,
338,
8758,
29898,
11600,
29892,
6120,
29897,
13,
4706,
4974,
338,
8758,
29898,
15334,
29892,
3806,
29918,
1853,
29897,
13,
13,
13,
1753,
1207,
29918,
15334,
29918,
2587,
29898,
978,
29901,
851,
1125,
13,
1678,
9995,
9984,
2560,
8594,
3573,
363,
6724,
15945,
29908,
13,
1678,
736,
426,
13,
4706,
525,
2754,
6594,
2396,
525,
29894,
29896,
742,
13,
4706,
525,
14380,
2396,
525,
27345,
742,
13,
4706,
525,
19635,
2396,
11117,
978,
2396,
1024,
1118,
13,
4706,
525,
6550,
2396,
11117,
1285,
475,
414,
2396,
518,
10998,
978,
2396,
376,
3396,
613,
525,
3027,
2396,
376,
8262,
29891,
1884,
29908,
6525,
1118,
13,
1678,
500,
13,
2
] |
MiScan/model.py | QuKunLab/MiScan | 3 | 1613529 | from keras import Model
from keras.layers import Dropout, Input
from keras.optimizers import adam
from .layers import dense, activation
def build_dense_model(input_dim=13885,
lr=1e-6,
dropout=0.25,
acti='leakyrelu'
):
input_x = Input(shape=(input_dim,), name="input", dtype='float32')
x = dense(256)(input_x)
x = activation(type=acti)(x)
x = Dropout(dropout)(x)
x = dense(128)(x)
x = activation(type=acti)(x)
x = Dropout(dropout)(x)
x = dense(64)(x)
x = activation(type=acti)(x)
x = Dropout(dropout)(x)
last = dense(2, activation='softmax')(x)
model = Model(inputs=input_x, outputs=last)
model.compile(loss='categorical_crossentropy', optimizer=adam(lr=lr), metrics=['accuracy'])
return model
| [
1,
515,
13023,
294,
1053,
8125,
13,
3166,
13023,
294,
29889,
29277,
1053,
20724,
449,
29892,
10567,
13,
3166,
13023,
294,
29889,
20640,
19427,
1053,
594,
314,
13,
13,
3166,
869,
29277,
1053,
20619,
29892,
26229,
13,
13,
13,
1753,
2048,
29918,
1145,
344,
29918,
4299,
29898,
2080,
29918,
6229,
29922,
29896,
29941,
29947,
29947,
29945,
29892,
13,
462,
418,
301,
29878,
29922,
29896,
29872,
29899,
29953,
29892,
13,
462,
418,
5768,
449,
29922,
29900,
29889,
29906,
29945,
29892,
13,
462,
418,
1044,
29875,
2433,
280,
557,
29891,
2674,
29884,
29915,
13,
462,
539,
1125,
13,
1678,
1881,
29918,
29916,
353,
10567,
29898,
12181,
7607,
2080,
29918,
6229,
29892,
511,
1024,
543,
2080,
613,
26688,
2433,
7411,
29941,
29906,
1495,
13,
1678,
921,
353,
20619,
29898,
29906,
29945,
29953,
5033,
2080,
29918,
29916,
29897,
13,
1678,
921,
353,
26229,
29898,
1853,
29922,
627,
29875,
5033,
29916,
29897,
13,
1678,
921,
353,
20724,
449,
29898,
8865,
449,
5033,
29916,
29897,
13,
13,
1678,
921,
353,
20619,
29898,
29896,
29906,
29947,
5033,
29916,
29897,
13,
1678,
921,
353,
26229,
29898,
1853,
29922,
627,
29875,
5033,
29916,
29897,
13,
1678,
921,
353,
20724,
449,
29898,
8865,
449,
5033,
29916,
29897,
13,
13,
1678,
921,
353,
20619,
29898,
29953,
29946,
5033,
29916,
29897,
13,
1678,
921,
353,
26229,
29898,
1853,
29922,
627,
29875,
5033,
29916,
29897,
13,
1678,
921,
353,
20724,
449,
29898,
8865,
449,
5033,
29916,
29897,
13,
13,
1678,
1833,
353,
20619,
29898,
29906,
29892,
26229,
2433,
2695,
3317,
1495,
29898,
29916,
29897,
13,
1678,
1904,
353,
8125,
29898,
2080,
29879,
29922,
2080,
29918,
29916,
29892,
14391,
29922,
4230,
29897,
13,
1678,
1904,
29889,
12198,
29898,
6758,
2433,
29883,
20440,
936,
29918,
19128,
296,
14441,
742,
5994,
3950,
29922,
328,
314,
29898,
29212,
29922,
29212,
511,
21556,
29922,
1839,
562,
2764,
4135,
11287,
13,
1678,
736,
1904,
13,
2
] |
Reader.py | noahwc/gtfs-pyparse | 0 | 115246 | # This class parses a gtfs text file
class Reader:
def __init__(self, file):
self.fields = []
self.fp = open(file, "r")
self.fields.extend(self.fp.readline().rstrip().split(","))
def get_line(self):
data = {}
line = self.fp.readline().rstrip().split(",")
for el, field in zip (line, self.fields):
data[field] = el
if len(data) == 1:
return None
else:
return data
def end(self):
self.fp.close() | [
1,
396,
910,
770,
610,
29879,
267,
263,
330,
29873,
5847,
1426,
934,
13,
13,
1990,
830,
1664,
29901,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
934,
1125,
13,
4706,
1583,
29889,
9621,
353,
5159,
13,
4706,
1583,
29889,
18091,
353,
1722,
29898,
1445,
29892,
376,
29878,
1159,
13,
4706,
1583,
29889,
9621,
29889,
21843,
29898,
1311,
29889,
18091,
29889,
949,
1220,
2141,
29878,
17010,
2141,
5451,
29898,
3284,
876,
13,
13,
1678,
822,
679,
29918,
1220,
29898,
1311,
1125,
13,
4706,
848,
353,
6571,
13,
4706,
1196,
29871,
353,
1583,
29889,
18091,
29889,
949,
1220,
2141,
29878,
17010,
2141,
5451,
28165,
1159,
13,
4706,
363,
560,
29892,
1746,
297,
14319,
313,
1220,
29892,
1583,
29889,
9621,
1125,
13,
9651,
848,
29961,
2671,
29962,
353,
560,
13,
4706,
565,
7431,
29898,
1272,
29897,
1275,
29871,
29896,
29901,
13,
9651,
736,
6213,
13,
4706,
1683,
29901,
13,
9651,
736,
848,
13,
13,
1678,
822,
1095,
29898,
1311,
1125,
13,
4706,
1583,
29889,
18091,
29889,
5358,
580,
2
] |
PyTorch/loader.py | avinashsai/Gated-CNN-for-ABSA | 0 | 81148 | <reponame>avinashsai/Gated-CNN-for-ABSA
import sys
import os
import re
import ast
from ast import literal_eval
label = {'negative':0,'positive':1,'neutral':2}
def preprocess(string):
string = re.sub(r"[^A-Za-z0-9(),!?\'\`]", " ", string)
string = re.sub(r"\'s", " \'s", string)
string = re.sub(r"\'ve", " \'ve", string)
string = re.sub(r"n\'t", " n\'t", string)
string = re.sub(r"\'re", " \'re", string)
string = re.sub(r"\'d", " \'d", string)
string = re.sub(r"\'ll", " \'ll", string)
string = re.sub(r",", " , ", string)
string = re.sub(r"!", " ! ", string)
string = re.sub(r"\(", " \( ", string)
string = re.sub(r"\)", " \) ", string)
string = re.sub(r"\?", " \? ", string)
string = re.sub(r"\s{2,}", " ", string)
return string.strip()
def load_data(dataset):
temp=open(dataset+"atsa_train.json","r",encoding="ISO-8859-1").read()
train=literal_eval(temp)
train_sentence=[]
train_aspect=[]
train_sentiment=[]
for i in train:
if(i['sentiment']!='conflict'):
train_sentence.append(preprocess(i["sentence"]))
train_aspect.append(preprocess(i["aspect"]))
train_sentiment.append(label[i["sentiment"]])
temp=open(dataset+"atsa_test.json","r",encoding="ISO-8859-1").read()
test=literal_eval(temp)
test_sentence=[]
test_aspect=[]
test_sentiment=[]
for i in test:
if(i['sentiment']!='conflict'):
test_sentence.append(preprocess(i["sentence"]))
test_aspect.append(preprocess(i["aspect"]))
test_sentiment.append(label[i["sentiment"]])
return train_sentence,test_sentence,train_aspect,test_aspect,train_sentiment,test_sentiment | [
1,
529,
276,
1112,
420,
29958,
485,
262,
1161,
29879,
1794,
29914,
29954,
630,
29899,
29907,
10262,
29899,
1454,
29899,
2882,
8132,
13,
5215,
10876,
13,
5215,
2897,
13,
5215,
337,
13,
5215,
8717,
13,
3166,
8717,
1053,
16333,
29918,
14513,
13,
13,
1643,
353,
11117,
22198,
2396,
29900,
5501,
1066,
3321,
2396,
29896,
5501,
17821,
1705,
2396,
29906,
29913,
13,
13,
1753,
758,
5014,
29898,
1807,
1125,
13,
12,
1807,
353,
337,
29889,
1491,
29898,
29878,
29908,
22896,
29909,
29899,
29999,
29874,
29899,
29920,
29900,
29899,
29929,
3285,
29991,
29973,
29905,
12764,
29952,
29962,
613,
376,
9162,
1347,
29897,
13,
12,
1807,
353,
337,
29889,
1491,
29898,
29878,
29908,
20333,
29879,
613,
376,
320,
29915,
29879,
613,
1347,
29897,
13,
12,
1807,
353,
337,
29889,
1491,
29898,
29878,
29908,
20333,
345,
613,
376,
320,
29915,
345,
613,
1347,
29897,
13,
12,
1807,
353,
337,
29889,
1491,
29898,
29878,
29908,
29876,
20333,
29873,
613,
376,
302,
20333,
29873,
613,
1347,
29897,
13,
12,
1807,
353,
337,
29889,
1491,
29898,
29878,
29908,
20333,
276,
613,
376,
320,
29915,
276,
613,
1347,
29897,
13,
12,
1807,
353,
337,
29889,
1491,
29898,
29878,
29908,
20333,
29881,
613,
376,
320,
29915,
29881,
613,
1347,
29897,
13,
12,
1807,
353,
337,
29889,
1491,
29898,
29878,
29908,
20333,
645,
613,
376,
320,
29915,
645,
613,
1347,
29897,
13,
12,
1807,
353,
337,
29889,
1491,
29898,
29878,
613,
613,
376,
1919,
9162,
1347,
29897,
13,
12,
1807,
353,
337,
29889,
1491,
29898,
29878,
29908,
29991,
613,
376,
1738,
9162,
1347,
29897,
13,
12,
1807,
353,
337,
29889,
1491,
29898,
29878,
26732,
28165,
376,
4269,
9162,
1347,
29897,
13,
12,
1807,
353,
337,
29889,
1491,
29898,
29878,
29908,
7244,
613,
376,
21811,
9162,
1347,
29897,
13,
12,
1807,
353,
337,
29889,
1491,
29898,
29878,
26732,
29973,
613,
376,
320,
29973,
9162,
1347,
29897,
13,
12,
1807,
353,
337,
29889,
1491,
29898,
29878,
26732,
29879,
29912,
29906,
29892,
17671,
376,
9162,
1347,
29897,
13,
12,
2457,
1347,
29889,
17010,
580,
13,
13,
1753,
2254,
29918,
1272,
29898,
24713,
1125,
13,
13,
12,
7382,
29922,
3150,
29898,
24713,
13578,
1446,
29874,
29918,
14968,
29889,
3126,
3284,
29878,
613,
22331,
543,
29096,
29899,
29947,
29947,
29945,
29929,
29899,
29896,
2564,
949,
580,
13,
12,
14968,
29922,
20889,
284,
29918,
14513,
29898,
7382,
29897,
13,
12,
14968,
29918,
18616,
663,
29922,
2636,
13,
12,
14968,
29918,
294,
1103,
29922,
2636,
13,
12,
14968,
29918,
18616,
2073,
29922,
2636,
13,
12,
1454,
474,
297,
7945,
29901,
13,
12,
12,
361,
29898,
29875,
1839,
18616,
2073,
2033,
29991,
2433,
5527,
29176,
29374,
13,
12,
12,
1678,
7945,
29918,
18616,
663,
29889,
4397,
29898,
1457,
5014,
29898,
29875,
3366,
18616,
663,
3108,
876,
13,
12,
12,
1678,
7945,
29918,
294,
1103,
29889,
4397,
29898,
1457,
5014,
29898,
29875,
3366,
294,
1103,
3108,
876,
13,
12,
12,
1678,
7945,
29918,
18616,
2073,
29889,
4397,
29898,
1643,
29961,
29875,
3366,
18616,
2073,
3108,
2314,
13,
13,
13,
13,
12,
7382,
29922,
3150,
29898,
24713,
13578,
1446,
29874,
29918,
1688,
29889,
3126,
3284,
29878,
613,
22331,
543,
29096,
29899,
29947,
29947,
29945,
29929,
29899,
29896,
2564,
949,
580,
13,
12,
1688,
29922,
20889,
284,
29918,
14513,
29898,
7382,
29897,
13,
12,
1688,
29918,
18616,
663,
29922,
2636,
13,
12,
1688,
29918,
294,
1103,
29922,
2636,
13,
12,
1688,
29918,
18616,
2073,
29922,
2636,
13,
12,
1454,
474,
297,
1243,
29901,
13,
12,
12,
361,
29898,
29875,
1839,
18616,
2073,
2033,
29991,
2433,
5527,
29176,
29374,
13,
12,
12,
1678,
1243,
29918,
18616,
663,
29889,
4397,
29898,
1457,
5014,
29898,
29875,
3366,
18616,
663,
3108,
876,
13,
12,
12,
1678,
1243,
29918,
294,
1103,
29889,
4397,
29898,
1457,
5014,
29898,
29875,
3366,
294,
1103,
3108,
876,
13,
12,
12,
1678,
1243,
29918,
18616,
2073,
29889,
4397,
29898,
1643,
29961,
29875,
3366,
18616,
2073,
3108,
2314,
13,
13,
13,
12,
2457,
7945,
29918,
18616,
663,
29892,
1688,
29918,
18616,
663,
29892,
14968,
29918,
294,
1103,
29892,
1688,
29918,
294,
1103,
29892,
14968,
29918,
18616,
2073,
29892,
1688,
29918,
18616,
2073,
2
] |
templogboss/myapp/models.py | Bossabossy/Templog | 0 | 57578 | <gh_stars>0
from __future__ import unicode_literals
from django.db import models
class Node(models.Model):
node_name=models.CharField(max_length=100)
description=models.CharField(max_length=100)
def __str__(self):
return "{}:{}:{}".format(self.id, self.node_name, self.description)
class Record(models.Model):
created=models.DateTimeField(auto_now_add=True)
updated=models.DateTimeField(auto_now=True)
node=models.ForeignKey(Node, on_delete=models.CASCADE)
value=models.FloatField(default=0.0)
class Attribute(models.Model):
attribute=models.CharField(max_length=100)
description=models.CharField(max_length=100)
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
3166,
4770,
29888,
9130,
1649,
1053,
29104,
29918,
20889,
1338,
13,
3166,
9557,
29889,
2585,
1053,
4733,
13,
13,
13,
1990,
9071,
29898,
9794,
29889,
3195,
1125,
13,
12,
3177,
29918,
978,
29922,
9794,
29889,
27890,
29898,
3317,
29918,
2848,
29922,
29896,
29900,
29900,
29897,
13,
12,
8216,
29922,
9794,
29889,
27890,
29898,
3317,
29918,
2848,
29922,
29896,
29900,
29900,
29897,
13,
12,
1753,
4770,
710,
12035,
1311,
1125,
13,
12,
12,
2457,
29850,
6177,
29912,
6177,
8875,
1642,
4830,
29898,
1311,
29889,
333,
29892,
1583,
29889,
3177,
29918,
978,
29892,
1583,
29889,
8216,
29897,
13,
13,
1990,
14164,
29898,
9794,
29889,
3195,
1125,
13,
12,
11600,
29922,
9794,
29889,
11384,
3073,
29898,
6921,
29918,
3707,
29918,
1202,
29922,
5574,
29897,
13,
12,
21402,
29922,
9794,
29889,
11384,
3073,
29898,
6921,
29918,
3707,
29922,
5574,
29897,
13,
12,
3177,
29922,
9794,
29889,
27755,
2558,
29898,
4247,
29892,
373,
29918,
8143,
29922,
9794,
29889,
29907,
3289,
5454,
2287,
29897,
13,
12,
1767,
29922,
9794,
29889,
11031,
3073,
29898,
4381,
29922,
29900,
29889,
29900,
29897,
13,
13,
13,
1990,
23833,
29898,
9794,
29889,
3195,
1125,
13,
12,
12715,
29922,
9794,
29889,
27890,
29898,
3317,
29918,
2848,
29922,
29896,
29900,
29900,
29897,
13,
12,
8216,
29922,
9794,
29889,
27890,
29898,
3317,
29918,
2848,
29922,
29896,
29900,
29900,
29897,
13,
13,
13,
13,
13,
13,
13,
2
] |
semisupervised/label_spreading.py | romanorac/ml | 4 | 109737 | # coding=utf8
import numpy as np
class LabelSpreading:
def __init__(self, alpha=0.2, max_iter=30, tol=1e-3):
"""
:param alpha: clamping factor between (0,1)
:param max_iter: maximum number of iterations
:param tol: convergence tolerance
"""
self.alpha = alpha
self.max_iter = max_iter
self.tol = tol
self.dist = None
def fit(self, w, y):
"""
fit label spreading algorithm
:param w: similarity matrix of n x n shape with n samples
:param y: labels of n x c shape with c labels, where 1
denotes label of x_i or 0 otherwise. Unlabeled samples
have labels set to 0.
"""
if type(w) != np.ndarray or type(y) != np.ndarray or len(w) != len(y):
raise Exception("w and y should be numpy array with equal length")
if 0 > self.alpha > 1 or self.max_iter < 0 or self.tol < 0:
raise Exception("Parameters are set incorrectly")
# construct the matrix S
d = np.sum(w, axis=1)
d[d == 0] = 1
np.power(d, -1 / 2., d)
d = np.diag(d)
s = np.dot(np.dot(d, w), d)
# Iterate F(t+1) until convergence
cur_iter = 0
err = self.tol
f0 = y
f1 = None
while cur_iter < self.max_iter and err >= self.tol:
f1 = self.alpha * np.dot(s, f0) + (1 - self.alpha) * y
err = np.max(np.abs(f1 - f0))
f0 = f1
cur_iter += 1
self.dist = f1 # set distributions
return self
def predict(self, y):
"""
use model to create predictions
:param y: labels of n x c shape with c labels, where 1
denotes label of x_i or 0 otherwise. Unlabeled samples
have labels set to 0.
:return: list with predictions
"""
if not np.any(y):
raise Exception("Please fit model first")
if type(y) != np.ndarray:
raise Exception("y should be numpy array")
predictions = []
for i, labels in enumerate(y):
index = np.where(labels == 1)[0]
if len(index) == 1:
# was labeled before
predictions.append(index[0])
else:
# use label with highest score
predictions.append(np.argmax(self.dist[i]))
return predictions
| [
1,
396,
14137,
29922,
9420,
29947,
13,
5215,
12655,
408,
7442,
13,
13,
13,
1990,
15796,
5592,
19715,
29901,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
15595,
29922,
29900,
29889,
29906,
29892,
4236,
29918,
1524,
29922,
29941,
29900,
29892,
304,
29880,
29922,
29896,
29872,
29899,
29941,
1125,
13,
4706,
9995,
13,
4706,
584,
3207,
15595,
29901,
1067,
1160,
292,
7329,
1546,
313,
29900,
29892,
29896,
29897,
13,
4706,
584,
3207,
4236,
29918,
1524,
29901,
7472,
1353,
310,
24372,
13,
4706,
584,
3207,
304,
29880,
29901,
17221,
20341,
749,
13,
4706,
9995,
13,
4706,
1583,
29889,
2312,
353,
15595,
13,
4706,
1583,
29889,
3317,
29918,
1524,
353,
4236,
29918,
1524,
13,
4706,
1583,
29889,
25027,
353,
304,
29880,
13,
4706,
1583,
29889,
5721,
353,
6213,
13,
13,
1678,
822,
6216,
29898,
1311,
29892,
281,
29892,
343,
1125,
13,
4706,
9995,
13,
4706,
6216,
3858,
9677,
292,
5687,
13,
13,
4706,
584,
3207,
281,
29901,
29501,
4636,
310,
302,
921,
302,
8267,
411,
302,
11916,
13,
4706,
584,
3207,
343,
29901,
11073,
310,
302,
921,
274,
8267,
411,
274,
11073,
29892,
988,
29871,
29896,
13,
308,
20169,
3858,
310,
921,
29918,
29875,
470,
29871,
29900,
6467,
29889,
853,
29880,
24025,
11916,
13,
308,
505,
11073,
731,
304,
29871,
29900,
29889,
13,
4706,
9995,
13,
4706,
565,
1134,
29898,
29893,
29897,
2804,
7442,
29889,
299,
2378,
470,
1134,
29898,
29891,
29897,
2804,
7442,
29889,
299,
2378,
470,
7431,
29898,
29893,
29897,
2804,
7431,
29898,
29891,
1125,
13,
9651,
12020,
8960,
703,
29893,
322,
343,
881,
367,
12655,
1409,
411,
5186,
3309,
1159,
13,
13,
4706,
565,
29871,
29900,
1405,
1583,
29889,
2312,
1405,
29871,
29896,
470,
1583,
29889,
3317,
29918,
1524,
529,
29871,
29900,
470,
1583,
29889,
25027,
529,
29871,
29900,
29901,
13,
9651,
12020,
8960,
703,
11507,
526,
731,
29676,
1159,
13,
13,
4706,
396,
3386,
278,
4636,
317,
13,
4706,
270,
353,
7442,
29889,
2083,
29898,
29893,
29892,
9685,
29922,
29896,
29897,
13,
4706,
270,
29961,
29881,
1275,
29871,
29900,
29962,
353,
29871,
29896,
13,
4706,
7442,
29889,
13519,
29898,
29881,
29892,
448,
29896,
847,
29871,
29906,
1696,
270,
29897,
13,
4706,
270,
353,
7442,
29889,
6051,
351,
29898,
29881,
29897,
13,
4706,
269,
353,
7442,
29889,
6333,
29898,
9302,
29889,
6333,
29898,
29881,
29892,
281,
511,
270,
29897,
13,
13,
4706,
396,
20504,
403,
383,
29898,
29873,
29974,
29896,
29897,
2745,
17221,
13,
4706,
3151,
29918,
1524,
353,
29871,
29900,
13,
4706,
4589,
353,
1583,
29889,
25027,
13,
4706,
285,
29900,
353,
343,
13,
4706,
285,
29896,
353,
6213,
13,
4706,
1550,
3151,
29918,
1524,
529,
1583,
29889,
3317,
29918,
1524,
322,
4589,
6736,
1583,
29889,
25027,
29901,
13,
9651,
285,
29896,
353,
1583,
29889,
2312,
334,
7442,
29889,
6333,
29898,
29879,
29892,
285,
29900,
29897,
718,
313,
29896,
448,
1583,
29889,
2312,
29897,
334,
343,
13,
9651,
4589,
353,
7442,
29889,
3317,
29898,
9302,
29889,
6897,
29898,
29888,
29896,
448,
285,
29900,
876,
13,
9651,
285,
29900,
353,
285,
29896,
13,
9651,
3151,
29918,
1524,
4619,
29871,
29896,
13,
4706,
1583,
29889,
5721,
353,
285,
29896,
29871,
396,
731,
18822,
13,
4706,
736,
1583,
13,
13,
1678,
822,
8500,
29898,
1311,
29892,
343,
1125,
13,
4706,
9995,
13,
4706,
671,
1904,
304,
1653,
27303,
13,
13,
4706,
584,
3207,
343,
29901,
11073,
310,
302,
921,
274,
8267,
411,
274,
11073,
29892,
988,
29871,
29896,
13,
308,
20169,
3858,
310,
921,
29918,
29875,
470,
29871,
29900,
6467,
29889,
853,
29880,
24025,
11916,
13,
308,
505,
11073,
731,
304,
29871,
29900,
29889,
13,
4706,
584,
2457,
29901,
1051,
411,
27303,
13,
4706,
9995,
13,
4706,
565,
451,
7442,
29889,
1384,
29898,
29891,
1125,
13,
9651,
12020,
8960,
703,
12148,
6216,
1904,
937,
1159,
13,
4706,
565,
1134,
29898,
29891,
29897,
2804,
7442,
29889,
299,
2378,
29901,
13,
9651,
12020,
8960,
703,
29891,
881,
367,
12655,
1409,
1159,
13,
4706,
27303,
353,
5159,
13,
4706,
363,
474,
29892,
11073,
297,
26985,
29898,
29891,
1125,
13,
9651,
2380,
353,
7442,
29889,
3062,
29898,
21134,
1275,
29871,
29896,
9601,
29900,
29962,
13,
9651,
565,
7431,
29898,
2248,
29897,
1275,
29871,
29896,
29901,
13,
18884,
396,
471,
301,
24025,
1434,
13,
18884,
27303,
29889,
4397,
29898,
2248,
29961,
29900,
2314,
13,
9651,
1683,
29901,
13,
18884,
396,
671,
3858,
411,
9939,
8158,
13,
18884,
27303,
29889,
4397,
29898,
9302,
29889,
1191,
3317,
29898,
1311,
29889,
5721,
29961,
29875,
12622,
13,
4706,
736,
27303,
13,
2
] |
build/lib/myrest/myparser.py | xiaoyexu/myrestengine | 0 | 1602638 | <filename>build/lib/myrest/myparser.py
# -*- coding: UTF-8 -*-
import re
class StringReader(object):
def __init__(self, text):
self.text = text
self.maxlength = len(text)
self.currentPosition = 0
def isOverLength(self, length):
return length >= self.maxlength or length < 0
def isCurrentPositionValid(self):
return self.isPositionValid(self.currentPosition)
def isPositionValid(self, p):
return p >= 0 and p < self.maxlength
def peek(self, length):
if not self.isCurrentPositionValid():
return None
m = self.currentPosition
n = m + length
if self.isOverLength(n):
return self.text[m:]
else:
return self.text[m:n]
def peekNext(self):
return self.peek(1)
def read(self, length):
if not self.isCurrentPositionValid():
return None
m = self.currentPosition
n = m + length
if self.isOverLength(n):
self.currentPosition = -1
return self.text[m:]
else:
self.currentPosition += length
return self.text[m:n]
def readNext(self):
return self.read(1)
def skipBlank(self):
if not self.isCurrentPositionValid():
return
while self.peekNext() == ' ':
self.readNext()
def readStringPatternWord(self, pattern):
if not self.isCurrentPositionValid():
return None
l = self.peekNext()
if not l:
return None
result = ''
while l and re.compile(pattern).match(l):
result += self.readNext()
l = self.peekNext()
return result
def readStringVariable(self):
if not self.isCurrentPositionValid():
return None
m = self.currentPosition
text = self.text[m:]
v = self.text[m]
if v == '"' or v == "'":
try:
idx = text.index(v, 1)
n = idx + 1
self.currentPosition += n
if not self.isCurrentPositionValid():
self.currentPosition = -1
return text[:n]
except ValueError as e:
return None
else:
return None
def isEnd(self):
return self.currentPosition == -1
class Parser(object):
def __init__(self, text):
self.text = text
self.textStack = []
self.parseStack = []
self.priorityStack = []
self.reader = StringReader(text)
self.pair = {
')': '('
}
self.syntax_definition = {
'condition': [
(1, '\('),
(1, '\)'),
(1, '\|'),
(1, ',')
],
'operator': [
(1, '='), # equal
(2, '!='), # not equal
(1, '@'), # between
(2, '!@'), # not between
(1, '%'), # contains(not case sensitive)
(2, '!%'), # not contains(not case sensitive)
(2, '%%'), # contains(case sensitive)
(3, '!%%'), # not contains(case sensitive)
(1, '>'), # great than
(1, '<'), # less than
(2, '>='), # great equal than
(2, '<=') # less equal than
]
}
self.string_definition = {
'string': [(1, """["']""")]
}
self.variable_definiation = {
'variable': [(1, """[A-Za-z0-9_]""")]
}
self.convertToStack()
def checkDefinition(self, table, char):
# result = None
for k, v in table.items():
for l, p in v:
if len(char) == l and re.compile(p).match(char):
return (k, p)
return (None, None)
def convertToStack(self):
self.reader.skipBlank()
while not self.reader.isEnd():
if self.reader.peekNext() == ' ':
self.reader.skipBlank()
else:
char3 = self.reader.peek(3)
(syntaxDef, pattern) = self.checkDefinition(self.syntax_definition, char3)
if syntaxDef:
self.reader.read(3)
self.textStack.insert(0, (syntaxDef, char3))
continue
char2 = self.reader.peek(2)
(syntaxDef, pattern) = self.checkDefinition(self.syntax_definition, char2)
if syntaxDef:
self.reader.read(2)
self.textStack.insert(0, (syntaxDef, char2))
continue
char = self.reader.peekNext()
(syntaxDef, pattern) = self.checkDefinition(self.syntax_definition, char)
if syntaxDef:
self.reader.readNext()
self.textStack.insert(0, (syntaxDef, char))
continue
(stringDef, pattern) = self.checkDefinition(self.string_definition, char)
if stringDef:
word = self.reader.readStringVariable()
self.textStack.insert(0, (stringDef, word))
continue
(varDef, pattern) = self.checkDefinition(self.variable_definiation, char)
if varDef:
word = self.reader.readStringPatternWord(pattern)
self.textStack.insert(0, (varDef, word))
continue
self.raiseError('Scan error, char not allow', (None, self.reader.currentPosition))
def raiseError(self, desc, node):
raise Exception('%s at %s' % (desc, node[1]))
def parsePush(self, node, status, parseFunc, parseEndStatus):
self.textStack.pop()
status.append(node[1])
result = parseFunc(status)
status[-1] = parseEndStatus
return result
def parsePop(self, node, status, parseEndStatus):
previousChar = self.pair.get(node[1], None)
if not previousChar:
return
if len(status) > 2 and status[-2] == previousChar:
self.textStack.pop()
status.pop()
status[-1] = parseEndStatus
else:
self.raiseError('Parse error, mismatch %s' % node[1], node)
def parseSingleCondition(self, status):
operator = None
fieldName = None
value = None
status.append('S')
while len(self.textStack) > 0 and status[-1] != 'E':
node = self.textStack[-1]
if status[-1] == 'S':
if node[0] == 'variable':
status[-1] = 'S1'
fieldName = node[1]
self.textStack.pop()
else:
self.raiseError('Parse error, should be name', node)
elif status[-1] == 'S1':
if node[0] == 'operator':
status[-1] = 'S2'
operator = node[1]
self.textStack.pop()
else:
self.raiseError('Parse error, should be operator', node)
elif status[-1] == 'S2':
if node[0] == 'string':
value = node[1]
status[-1] = 'E'
self.textStack.pop()
elif node[0] == 'variable' and node[1] == 'None':
value = None
status[-1] = 'E'
self.textStack.pop()
else:
self.raiseError('Parse error, should be value', node)
status.pop()
return ('condition', (operator, fieldName, value))
def parseCondition(self, status):
status.append('S')
left_result = None
right_result = None
operator = None
while len(self.textStack) > 0 and status[-1] != 'E':
node = self.textStack[-1]
if status[-1] == 'S':
if node[0] == 'condition' and node[1] == '(':
left_result = self.parsePush(node, status, self.parseCondition, 'S1')
elif node[0] == 'variable':
left_result = self.parseSingleCondition(status)
status[-1] = 'S1'
else:
self.raiseError('Parse error, should be nest condition or condition', node)
elif status[-1] == 'S1':
right_result = None
if node[0] == 'condition' and node[1] == '|':
status[-1] = 'S'
operator = 'or'
self.textStack.pop()
self.priorityStack.append(('or', left_result))
elif node[0] == 'condition' and node[1] == ',':
status[-1] = 'S2'
operator = 'and'
self.textStack.pop()
elif node[0] == 'condition' and node[1] == ')':
self.parsePop(node, status, 'E')
else:
self.raiseError('Parse error, should be and or bracket', node)
elif status[-1] == 'S2':
if node[0] == 'condition' and node[1] == '(':
right_result = self.parsePush(node, status, self.parseCondition, 'S3')
elif node[0] == 'variable':
right_result = self.parseSingleCondition(status)
status[-1] = 'S3'
else:
self.raiseError('Parse error, should be nest condition or condition', node)
elif status[-1] == 'S3':
if node[0] == 'condition' and node[1] == ')':
self.parsePop(node, status, 'E')
elif node[0] == 'condition':
if len(status) > 0:
status[-1] = 'S1'
left_result = (operator, left_result, right_result)
else:
self.raiseError('Parse error, not be any text here', node)
status.pop()
if operator and right_result:
finalResult = ('andor', (operator, left_result, right_result))
else:
finalResult = left_result
while len(self.priorityStack) > 0:
(left_operator, left_result_in_stack) = self.priorityStack.pop()
finalResult = (left_operator, left_result_in_stack, finalResult)
return finalResult
def parse(self):
status = []
return self.parseCondition(status)
def loop(self, result):
(type, node) = result[0], result[1]
if type == 'andor':
return self.loop(node)
elif type == 'condition':
return self.loop(node)
n, l, r = result[0], result[1], result[2]
if n == 'and' or n == 'or':
left = self.loop(l)
right = self.loop(r)
if n == 'and':
return '(%s %s %s)' % (left, ' && ', right)
else:
return '(%s %s %s)' % (left, ' || ', right)
else:
return '%s %s %s' % (l, n, r)
def toDict(self, result):
(type, node) = result[0], result[1]
if type == 'andor':
dict = self.toDict(node)
return dict
elif type == 'condition':
dict = self.toDict(node)
return dict
n, l, r = result[0], result[1], result[2]
if n == 'and' or n == 'or':
left = self.toDict(l)
right = self.toDict(r)
return {'opt': n, 'left': left, 'right': right}
else:
# Remove padding ' ", but allow special value None
r = r[1:-1] if r else None
return {'opt': n, 'field': l, 'value': r}
| [
1,
529,
9507,
29958,
4282,
29914,
1982,
29914,
1357,
5060,
29914,
1357,
16680,
29889,
2272,
13,
29937,
448,
29930,
29899,
14137,
29901,
18351,
29899,
29947,
448,
29930,
29899,
13,
5215,
337,
13,
13,
13,
1990,
1714,
6982,
29898,
3318,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1426,
1125,
13,
4706,
1583,
29889,
726,
353,
1426,
13,
4706,
1583,
29889,
3317,
2848,
353,
7431,
29898,
726,
29897,
13,
4706,
1583,
29889,
3784,
8003,
353,
29871,
29900,
13,
13,
1678,
822,
338,
3563,
6513,
29898,
1311,
29892,
3309,
1125,
13,
4706,
736,
3309,
6736,
1583,
29889,
3317,
2848,
470,
3309,
529,
29871,
29900,
13,
13,
1678,
822,
338,
7583,
8003,
7211,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
275,
8003,
7211,
29898,
1311,
29889,
3784,
8003,
29897,
13,
13,
1678,
822,
338,
8003,
7211,
29898,
1311,
29892,
282,
1125,
13,
4706,
736,
282,
6736,
29871,
29900,
322,
282,
529,
1583,
29889,
3317,
2848,
13,
13,
1678,
822,
1236,
1416,
29898,
1311,
29892,
3309,
1125,
13,
4706,
565,
451,
1583,
29889,
275,
7583,
8003,
7211,
7295,
13,
9651,
736,
6213,
13,
4706,
286,
353,
1583,
29889,
3784,
8003,
13,
4706,
302,
353,
286,
718,
3309,
13,
4706,
565,
1583,
29889,
275,
3563,
6513,
29898,
29876,
1125,
13,
9651,
736,
1583,
29889,
726,
29961,
29885,
17531,
13,
4706,
1683,
29901,
13,
9651,
736,
1583,
29889,
726,
29961,
29885,
29901,
29876,
29962,
13,
13,
1678,
822,
1236,
1416,
9190,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
412,
1416,
29898,
29896,
29897,
13,
13,
1678,
822,
1303,
29898,
1311,
29892,
3309,
1125,
13,
4706,
565,
451,
1583,
29889,
275,
7583,
8003,
7211,
7295,
13,
9651,
736,
6213,
13,
4706,
286,
353,
1583,
29889,
3784,
8003,
13,
4706,
302,
353,
286,
718,
3309,
13,
4706,
565,
1583,
29889,
275,
3563,
6513,
29898,
29876,
1125,
13,
9651,
1583,
29889,
3784,
8003,
353,
448,
29896,
13,
9651,
736,
1583,
29889,
726,
29961,
29885,
17531,
13,
4706,
1683,
29901,
13,
9651,
1583,
29889,
3784,
8003,
4619,
3309,
13,
9651,
736,
1583,
29889,
726,
29961,
29885,
29901,
29876,
29962,
13,
13,
1678,
822,
1303,
9190,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
949,
29898,
29896,
29897,
13,
13,
1678,
822,
14383,
10358,
804,
29898,
1311,
1125,
13,
4706,
565,
451,
1583,
29889,
275,
7583,
8003,
7211,
7295,
13,
9651,
736,
13,
4706,
1550,
1583,
29889,
412,
1416,
9190,
580,
1275,
525,
525,
29901,
13,
9651,
1583,
29889,
949,
9190,
580,
13,
13,
1678,
822,
1303,
1231,
17144,
14463,
29898,
1311,
29892,
4766,
1125,
13,
4706,
565,
451,
1583,
29889,
275,
7583,
8003,
7211,
7295,
13,
9651,
736,
6213,
13,
4706,
301,
353,
1583,
29889,
412,
1416,
9190,
580,
13,
4706,
565,
451,
301,
29901,
13,
9651,
736,
6213,
13,
4706,
1121,
353,
6629,
13,
4706,
1550,
301,
322,
337,
29889,
12198,
29898,
11037,
467,
4352,
29898,
29880,
1125,
13,
9651,
1121,
4619,
1583,
29889,
949,
9190,
580,
13,
9651,
301,
353,
1583,
29889,
412,
1416,
9190,
580,
13,
4706,
736,
1121,
13,
13,
1678,
822,
1303,
1231,
16174,
29898,
1311,
1125,
13,
4706,
565,
451,
1583,
29889,
275,
7583,
8003,
7211,
7295,
13,
9651,
736,
6213,
13,
4706,
286,
353,
1583,
29889,
3784,
8003,
13,
4706,
1426,
353,
1583,
29889,
726,
29961,
29885,
17531,
13,
4706,
325,
353,
1583,
29889,
726,
29961,
29885,
29962,
13,
4706,
565,
325,
1275,
18793,
29915,
470,
325,
1275,
13577,
1115,
13,
9651,
1018,
29901,
13,
18884,
22645,
353,
1426,
29889,
2248,
29898,
29894,
29892,
29871,
29896,
29897,
13,
18884,
302,
353,
22645,
718,
29871,
29896,
13,
18884,
1583,
29889,
3784,
8003,
4619,
302,
13,
18884,
565,
451,
1583,
29889,
275,
7583,
8003,
7211,
7295,
13,
462,
1678,
1583,
29889,
3784,
8003,
353,
448,
29896,
13,
18884,
736,
1426,
7503,
29876,
29962,
13,
9651,
5174,
7865,
2392,
408,
321,
29901,
13,
18884,
736,
6213,
13,
4706,
1683,
29901,
13,
9651,
736,
6213,
13,
13,
1678,
822,
338,
5044,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
3784,
8003,
1275,
448,
29896,
13,
13,
13,
1990,
1459,
643,
29898,
3318,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1426,
1125,
13,
4706,
1583,
29889,
726,
353,
1426,
13,
4706,
1583,
29889,
726,
7264,
353,
5159,
13,
4706,
1583,
29889,
5510,
7264,
353,
5159,
13,
4706,
1583,
29889,
29886,
21766,
7264,
353,
5159,
13,
4706,
1583,
29889,
16950,
353,
1714,
6982,
29898,
726,
29897,
13,
4706,
1583,
29889,
18784,
353,
426,
13,
9651,
25710,
2396,
525,
877,
13,
4706,
500,
13,
13,
4706,
1583,
29889,
29562,
29918,
16553,
353,
426,
13,
9651,
525,
16122,
2396,
518,
13,
18884,
313,
29896,
29892,
11297,
877,
511,
13,
18884,
313,
29896,
29892,
525,
7244,
5477,
13,
18884,
313,
29896,
29892,
525,
7893,
5477,
13,
18884,
313,
29896,
29892,
13420,
1495,
13,
9651,
21251,
13,
9651,
525,
6891,
2396,
518,
13,
18884,
313,
29896,
29892,
525,
2433,
511,
259,
396,
5186,
13,
18884,
313,
29906,
29892,
525,
29991,
2433,
511,
29871,
396,
451,
5186,
13,
18884,
313,
29896,
29892,
18803,
5477,
259,
396,
1546,
13,
18884,
313,
29906,
29892,
525,
29991,
29992,
5477,
29871,
396,
451,
1546,
13,
18884,
313,
29896,
29892,
14210,
5477,
259,
396,
3743,
29898,
1333,
1206,
20502,
29897,
13,
18884,
313,
29906,
29892,
525,
29991,
29995,
5477,
29871,
396,
451,
3743,
29898,
1333,
1206,
20502,
29897,
13,
18884,
313,
29906,
29892,
525,
7686,
5477,
29871,
396,
3743,
29898,
4878,
20502,
29897,
13,
18884,
313,
29941,
29892,
525,
29991,
7686,
5477,
396,
451,
3743,
29898,
4878,
20502,
29897,
13,
18884,
313,
29896,
29892,
525,
29958,
5477,
259,
396,
2107,
1135,
13,
18884,
313,
29896,
29892,
12801,
5477,
259,
396,
3109,
1135,
13,
18884,
313,
29906,
29892,
525,
29958,
2433,
511,
29871,
396,
2107,
5186,
1135,
13,
18884,
313,
29906,
29892,
12801,
29922,
1495,
259,
396,
3109,
5186,
1135,
13,
9651,
4514,
13,
4706,
500,
13,
4706,
1583,
29889,
1807,
29918,
16553,
353,
426,
13,
9651,
525,
1807,
2396,
17288,
29896,
29892,
9995,
3366,
2033,
15945,
13531,
13,
4706,
500,
13,
4706,
1583,
29889,
11918,
29918,
1753,
2172,
362,
353,
426,
13,
9651,
525,
11918,
2396,
17288,
29896,
29892,
9995,
29961,
29909,
29899,
29999,
29874,
29899,
29920,
29900,
29899,
29929,
29918,
29962,
15945,
13531,
13,
4706,
500,
13,
4706,
1583,
29889,
13441,
1762,
7264,
580,
13,
13,
1678,
822,
1423,
14683,
29898,
1311,
29892,
1591,
29892,
1373,
1125,
13,
4706,
396,
1121,
353,
6213,
13,
4706,
363,
413,
29892,
325,
297,
1591,
29889,
7076,
7295,
13,
9651,
363,
301,
29892,
282,
297,
325,
29901,
13,
18884,
565,
7431,
29898,
3090,
29897,
1275,
301,
322,
337,
29889,
12198,
29898,
29886,
467,
4352,
29898,
3090,
1125,
13,
462,
1678,
736,
313,
29895,
29892,
282,
29897,
13,
4706,
736,
313,
8516,
29892,
6213,
29897,
13,
13,
1678,
822,
3588,
1762,
7264,
29898,
1311,
1125,
13,
4706,
1583,
29889,
16950,
29889,
11014,
10358,
804,
580,
13,
4706,
1550,
451,
1583,
29889,
16950,
29889,
275,
5044,
7295,
13,
9651,
565,
1583,
29889,
16950,
29889,
412,
1416,
9190,
580,
1275,
525,
525,
29901,
13,
18884,
1583,
29889,
16950,
29889,
11014,
10358,
804,
580,
13,
9651,
1683,
29901,
13,
18884,
1373,
29941,
353,
1583,
29889,
16950,
29889,
412,
1416,
29898,
29941,
29897,
13,
18884,
313,
29562,
3206,
29892,
4766,
29897,
353,
1583,
29889,
3198,
14683,
29898,
1311,
29889,
29562,
29918,
16553,
29892,
1373,
29941,
29897,
13,
18884,
565,
5877,
3206,
29901,
13,
462,
1678,
1583,
29889,
16950,
29889,
949,
29898,
29941,
29897,
13,
462,
1678,
1583,
29889,
726,
7264,
29889,
7851,
29898,
29900,
29892,
313,
29562,
3206,
29892,
1373,
29941,
876,
13,
462,
1678,
6773,
13,
18884,
1373,
29906,
353,
1583,
29889,
16950,
29889,
412,
1416,
29898,
29906,
29897,
13,
18884,
313,
29562,
3206,
29892,
4766,
29897,
353,
1583,
29889,
3198,
14683,
29898,
1311,
29889,
29562,
29918,
16553,
29892,
1373,
29906,
29897,
13,
18884,
565,
5877,
3206,
29901,
13,
462,
1678,
1583,
29889,
16950,
29889,
949,
29898,
29906,
29897,
13,
462,
1678,
1583,
29889,
726,
7264,
29889,
7851,
29898,
29900,
29892,
313,
29562,
3206,
29892,
1373,
29906,
876,
13,
462,
1678,
6773,
13,
18884,
1373,
353,
1583,
29889,
16950,
29889,
412,
1416,
9190,
580,
13,
18884,
313,
29562,
3206,
29892,
4766,
29897,
353,
1583,
29889,
3198,
14683,
29898,
1311,
29889,
29562,
29918,
16553,
29892,
1373,
29897,
13,
18884,
565,
5877,
3206,
29901,
13,
462,
1678,
1583,
29889,
16950,
29889,
949,
9190,
580,
13,
462,
1678,
1583,
29889,
726,
7264,
29889,
7851,
29898,
29900,
29892,
313,
29562,
3206,
29892,
1373,
876,
13,
462,
1678,
6773,
13,
18884,
313,
1807,
3206,
29892,
4766,
29897,
353,
1583,
29889,
3198,
14683,
29898,
1311,
29889,
1807,
29918,
16553,
29892,
1373,
29897,
13,
18884,
565,
1347,
3206,
29901,
13,
462,
1678,
1734,
353,
1583,
29889,
16950,
29889,
949,
1231,
16174,
580,
13,
462,
1678,
1583,
29889,
726,
7264,
29889,
7851,
29898,
29900,
29892,
313,
1807,
3206,
29892,
1734,
876,
13,
462,
1678,
6773,
13,
18884,
313,
1707,
3206,
29892,
4766,
29897,
353,
1583,
29889,
3198,
14683,
29898,
1311,
29889,
11918,
29918,
1753,
2172,
362,
29892,
1373,
29897,
13,
18884,
565,
722,
3206,
29901,
13,
462,
1678,
1734,
353,
1583,
29889,
16950,
29889,
949,
1231,
17144,
14463,
29898,
11037,
29897,
13,
462,
1678,
1583,
29889,
726,
7264,
29889,
7851,
29898,
29900,
29892,
313,
1707,
3206,
29892,
1734,
876,
13,
462,
1678,
6773,
13,
18884,
1583,
29889,
22692,
2392,
877,
29083,
1059,
29892,
1373,
451,
2758,
742,
313,
8516,
29892,
1583,
29889,
16950,
29889,
3784,
8003,
876,
13,
13,
1678,
822,
12020,
2392,
29898,
1311,
29892,
5153,
29892,
2943,
1125,
13,
4706,
12020,
8960,
877,
29995,
29879,
472,
1273,
29879,
29915,
1273,
313,
14273,
29892,
2943,
29961,
29896,
12622,
13,
13,
1678,
822,
6088,
27031,
29898,
1311,
29892,
2943,
29892,
4660,
29892,
6088,
14400,
29892,
6088,
5044,
5709,
1125,
13,
4706,
1583,
29889,
726,
7264,
29889,
7323,
580,
13,
4706,
4660,
29889,
4397,
29898,
3177,
29961,
29896,
2314,
13,
4706,
1121,
353,
6088,
14400,
29898,
4882,
29897,
13,
4706,
4660,
14352,
29896,
29962,
353,
6088,
5044,
5709,
13,
4706,
736,
1121,
13,
13,
1678,
822,
6088,
12310,
29898,
1311,
29892,
2943,
29892,
4660,
29892,
6088,
5044,
5709,
1125,
13,
4706,
3517,
5914,
353,
1583,
29889,
18784,
29889,
657,
29898,
3177,
29961,
29896,
1402,
6213,
29897,
13,
4706,
565,
451,
3517,
5914,
29901,
13,
9651,
736,
13,
4706,
565,
7431,
29898,
4882,
29897,
1405,
29871,
29906,
322,
4660,
14352,
29906,
29962,
1275,
3517,
5914,
29901,
13,
9651,
1583,
29889,
726,
7264,
29889,
7323,
580,
13,
9651,
4660,
29889,
7323,
580,
13,
9651,
4660,
14352,
29896,
29962,
353,
6088,
5044,
5709,
13,
4706,
1683,
29901,
13,
9651,
1583,
29889,
22692,
2392,
877,
12914,
1059,
29892,
29635,
1273,
29879,
29915,
1273,
2943,
29961,
29896,
1402,
2943,
29897,
13,
13,
1678,
822,
6088,
15771,
25255,
29898,
1311,
29892,
4660,
1125,
13,
4706,
5455,
353,
6213,
13,
4706,
1746,
1170,
353,
6213,
13,
4706,
995,
353,
6213,
13,
4706,
4660,
29889,
4397,
877,
29903,
1495,
13,
4706,
1550,
7431,
29898,
1311,
29889,
726,
7264,
29897,
1405,
29871,
29900,
322,
4660,
14352,
29896,
29962,
2804,
525,
29923,
2396,
13,
9651,
2943,
353,
1583,
29889,
726,
7264,
14352,
29896,
29962,
13,
9651,
565,
4660,
14352,
29896,
29962,
1275,
525,
29903,
2396,
13,
18884,
565,
2943,
29961,
29900,
29962,
1275,
525,
11918,
2396,
13,
462,
1678,
4660,
14352,
29896,
29962,
353,
525,
29903,
29896,
29915,
13,
462,
1678,
1746,
1170,
353,
2943,
29961,
29896,
29962,
13,
462,
1678,
1583,
29889,
726,
7264,
29889,
7323,
580,
13,
18884,
1683,
29901,
13,
462,
1678,
1583,
29889,
22692,
2392,
877,
12914,
1059,
29892,
881,
367,
1024,
742,
2943,
29897,
13,
9651,
25342,
4660,
14352,
29896,
29962,
1275,
525,
29903,
29896,
2396,
13,
18884,
565,
2943,
29961,
29900,
29962,
1275,
525,
6891,
2396,
13,
462,
1678,
4660,
14352,
29896,
29962,
353,
525,
29903,
29906,
29915,
13,
462,
1678,
5455,
353,
2943,
29961,
29896,
29962,
13,
462,
1678,
1583,
29889,
726,
7264,
29889,
7323,
580,
13,
18884,
1683,
29901,
13,
462,
1678,
1583,
29889,
22692,
2392,
877,
12914,
1059,
29892,
881,
367,
5455,
742,
2943,
29897,
13,
9651,
25342,
4660,
14352,
29896,
29962,
1275,
525,
29903,
29906,
2396,
13,
18884,
565,
2943,
29961,
29900,
29962,
1275,
525,
1807,
2396,
13,
462,
1678,
995,
353,
2943,
29961,
29896,
29962,
13,
462,
1678,
4660,
14352,
29896,
29962,
353,
525,
29923,
29915,
13,
462,
1678,
1583,
29889,
726,
7264,
29889,
7323,
580,
13,
18884,
25342,
2943,
29961,
29900,
29962,
1275,
525,
11918,
29915,
322,
2943,
29961,
29896,
29962,
1275,
525,
8516,
2396,
13,
462,
1678,
995,
353,
6213,
13,
462,
1678,
4660,
14352,
29896,
29962,
353,
525,
29923,
29915,
13,
462,
1678,
1583,
29889,
726,
7264,
29889,
7323,
580,
13,
18884,
1683,
29901,
13,
462,
1678,
1583,
29889,
22692,
2392,
877,
12914,
1059,
29892,
881,
367,
995,
742,
2943,
29897,
13,
4706,
4660,
29889,
7323,
580,
13,
4706,
736,
6702,
16122,
742,
313,
6891,
29892,
1746,
1170,
29892,
995,
876,
13,
13,
1678,
822,
6088,
25255,
29898,
1311,
29892,
4660,
1125,
13,
4706,
4660,
29889,
4397,
877,
29903,
1495,
13,
4706,
2175,
29918,
2914,
353,
6213,
13,
4706,
1492,
29918,
2914,
353,
6213,
13,
4706,
5455,
353,
6213,
13,
4706,
1550,
7431,
29898,
1311,
29889,
726,
7264,
29897,
1405,
29871,
29900,
322,
4660,
14352,
29896,
29962,
2804,
525,
29923,
2396,
13,
9651,
2943,
353,
1583,
29889,
726,
7264,
14352,
29896,
29962,
13,
9651,
565,
4660,
14352,
29896,
29962,
1275,
525,
29903,
2396,
13,
18884,
565,
2943,
29961,
29900,
29962,
1275,
525,
16122,
29915,
322,
2943,
29961,
29896,
29962,
1275,
525,
877,
29901,
13,
462,
1678,
2175,
29918,
2914,
353,
1583,
29889,
5510,
27031,
29898,
3177,
29892,
4660,
29892,
1583,
29889,
5510,
25255,
29892,
525,
29903,
29896,
1495,
13,
18884,
25342,
2943,
29961,
29900,
29962,
1275,
525,
11918,
2396,
13,
462,
1678,
2175,
29918,
2914,
353,
1583,
29889,
5510,
15771,
25255,
29898,
4882,
29897,
13,
462,
1678,
4660,
14352,
29896,
29962,
353,
525,
29903,
29896,
29915,
13,
18884,
1683,
29901,
13,
462,
1678,
1583,
29889,
22692,
2392,
877,
12914,
1059,
29892,
881,
367,
17763,
4195,
470,
4195,
742,
2943,
29897,
13,
9651,
25342,
4660,
14352,
29896,
29962,
1275,
525,
29903,
29896,
2396,
13,
18884,
1492,
29918,
2914,
353,
6213,
13,
18884,
565,
2943,
29961,
29900,
29962,
1275,
525,
16122,
29915,
322,
2943,
29961,
29896,
29962,
1275,
525,
29989,
2396,
13,
462,
1678,
4660,
14352,
29896,
29962,
353,
525,
29903,
29915,
13,
462,
1678,
5455,
353,
525,
272,
29915,
13,
462,
1678,
1583,
29889,
726,
7264,
29889,
7323,
580,
13,
462,
1678,
1583,
29889,
29886,
21766,
7264,
29889,
4397,
29898,
877,
272,
742,
2175,
29918,
2914,
876,
13,
18884,
25342,
2943,
29961,
29900,
29962,
1275,
525,
16122,
29915,
322,
2943,
29961,
29896,
29962,
1275,
13420,
2396,
13,
462,
1678,
4660,
14352,
29896,
29962,
353,
525,
29903,
29906,
29915,
13,
462,
1678,
5455,
353,
525,
392,
29915,
13,
462,
1678,
1583,
29889,
726,
7264,
29889,
7323,
580,
13,
18884,
25342,
2943,
29961,
29900,
29962,
1275,
525,
16122,
29915,
322,
2943,
29961,
29896,
29962,
1275,
25710,
2396,
13,
462,
1678,
1583,
29889,
5510,
12310,
29898,
3177,
29892,
4660,
29892,
525,
29923,
1495,
13,
18884,
1683,
29901,
13,
462,
1678,
1583,
29889,
22692,
2392,
877,
12914,
1059,
29892,
881,
367,
322,
470,
4105,
3522,
742,
2943,
29897,
13,
9651,
25342,
4660,
14352,
29896,
29962,
1275,
525,
29903,
29906,
2396,
13,
18884,
565,
2943,
29961,
29900,
29962,
1275,
525,
16122,
29915,
322,
2943,
29961,
29896,
29962,
1275,
525,
877,
29901,
13,
462,
1678,
1492,
29918,
2914,
353,
1583,
29889,
5510,
27031,
29898,
3177,
29892,
4660,
29892,
1583,
29889,
5510,
25255,
29892,
525,
29903,
29941,
1495,
13,
18884,
25342,
2943,
29961,
29900,
29962,
1275,
525,
11918,
2396,
13,
462,
1678,
1492,
29918,
2914,
353,
1583,
29889,
5510,
15771,
25255,
29898,
4882,
29897,
13,
462,
1678,
4660,
14352,
29896,
29962,
353,
525,
29903,
29941,
29915,
13,
18884,
1683,
29901,
13,
462,
1678,
1583,
29889,
22692,
2392,
877,
12914,
1059,
29892,
881,
367,
17763,
4195,
470,
4195,
742,
2943,
29897,
13,
9651,
25342,
4660,
14352,
29896,
29962,
1275,
525,
29903,
29941,
2396,
13,
18884,
565,
2943,
29961,
29900,
29962,
1275,
525,
16122,
29915,
322,
2943,
29961,
29896,
29962,
1275,
25710,
2396,
13,
462,
1678,
1583,
29889,
5510,
12310,
29898,
3177,
29892,
4660,
29892,
525,
29923,
1495,
13,
18884,
25342,
2943,
29961,
29900,
29962,
1275,
525,
16122,
2396,
13,
462,
1678,
565,
7431,
29898,
4882,
29897,
1405,
29871,
29900,
29901,
13,
462,
4706,
4660,
14352,
29896,
29962,
353,
525,
29903,
29896,
29915,
13,
462,
4706,
2175,
29918,
2914,
353,
313,
6891,
29892,
2175,
29918,
2914,
29892,
1492,
29918,
2914,
29897,
13,
13,
18884,
1683,
29901,
13,
462,
1678,
1583,
29889,
22692,
2392,
877,
12914,
1059,
29892,
451,
367,
738,
1426,
1244,
742,
2943,
29897,
13,
4706,
4660,
29889,
7323,
580,
13,
4706,
565,
5455,
322,
1492,
29918,
2914,
29901,
13,
9651,
2186,
3591,
353,
6702,
392,
272,
742,
313,
6891,
29892,
2175,
29918,
2914,
29892,
1492,
29918,
2914,
876,
13,
4706,
1683,
29901,
13,
9651,
2186,
3591,
353,
2175,
29918,
2914,
13,
4706,
1550,
7431,
29898,
1311,
29889,
29886,
21766,
7264,
29897,
1405,
29871,
29900,
29901,
13,
9651,
313,
1563,
29918,
6891,
29892,
2175,
29918,
2914,
29918,
262,
29918,
1429,
29897,
353,
1583,
29889,
29886,
21766,
7264,
29889,
7323,
580,
13,
9651,
2186,
3591,
353,
313,
1563,
29918,
6891,
29892,
2175,
29918,
2914,
29918,
262,
29918,
1429,
29892,
2186,
3591,
29897,
13,
4706,
736,
2186,
3591,
13,
13,
1678,
822,
6088,
29898,
1311,
1125,
13,
4706,
4660,
353,
5159,
13,
4706,
736,
1583,
29889,
5510,
25255,
29898,
4882,
29897,
13,
13,
1678,
822,
2425,
29898,
1311,
29892,
1121,
1125,
13,
4706,
313,
1853,
29892,
2943,
29897,
353,
1121,
29961,
29900,
1402,
1121,
29961,
29896,
29962,
13,
4706,
565,
1134,
1275,
525,
392,
272,
2396,
13,
9651,
736,
1583,
29889,
7888,
29898,
3177,
29897,
13,
4706,
25342,
1134,
1275,
525,
16122,
2396,
13,
9651,
736,
1583,
29889,
7888,
29898,
3177,
29897,
13,
4706,
302,
29892,
301,
29892,
364,
353,
1121,
29961,
29900,
1402,
1121,
29961,
29896,
1402,
1121,
29961,
29906,
29962,
13,
4706,
565,
302,
1275,
525,
392,
29915,
470,
302,
1275,
525,
272,
2396,
13,
9651,
2175,
353,
1583,
29889,
7888,
29898,
29880,
29897,
13,
9651,
1492,
353,
1583,
29889,
7888,
29898,
29878,
29897,
13,
9651,
565,
302,
1275,
525,
392,
2396,
13,
18884,
736,
525,
29414,
29879,
1273,
29879,
1273,
29879,
16029,
1273,
313,
1563,
29892,
525,
2607,
13420,
1492,
29897,
13,
9651,
1683,
29901,
13,
18884,
736,
525,
29414,
29879,
1273,
29879,
1273,
29879,
16029,
1273,
313,
1563,
29892,
525,
3830,
13420,
1492,
29897,
13,
4706,
1683,
29901,
13,
9651,
736,
14210,
29879,
1273,
29879,
1273,
29879,
29915,
1273,
313,
29880,
29892,
302,
29892,
364,
29897,
13,
13,
1678,
822,
304,
21533,
29898,
1311,
29892,
1121,
1125,
13,
4706,
313,
1853,
29892,
2943,
29897,
353,
1121,
29961,
29900,
1402,
1121,
29961,
29896,
29962,
13,
4706,
565,
1134,
1275,
525,
392,
272,
2396,
13,
9651,
9657,
353,
1583,
29889,
517,
21533,
29898,
3177,
29897,
13,
9651,
736,
9657,
13,
4706,
25342,
1134,
1275,
525,
16122,
2396,
13,
9651,
9657,
353,
1583,
29889,
517,
21533,
29898,
3177,
29897,
13,
9651,
736,
9657,
13,
4706,
302,
29892,
301,
29892,
364,
353,
1121,
29961,
29900,
1402,
1121,
29961,
29896,
1402,
1121,
29961,
29906,
29962,
13,
4706,
565,
302,
1275,
525,
392,
29915,
470,
302,
1275,
525,
272,
2396,
13,
9651,
2175,
353,
1583,
29889,
517,
21533,
29898,
29880,
29897,
13,
9651,
1492,
353,
1583,
29889,
517,
21533,
29898,
29878,
29897,
13,
9651,
736,
11117,
3670,
2396,
302,
29892,
525,
1563,
2396,
2175,
29892,
525,
1266,
2396,
1492,
29913,
13,
4706,
1683,
29901,
13,
9651,
396,
15154,
7164,
525,
9162,
541,
2758,
4266,
995,
6213,
13,
9651,
364,
353,
364,
29961,
29896,
13018,
29896,
29962,
565,
364,
1683,
6213,
13,
9651,
736,
11117,
3670,
2396,
302,
29892,
525,
2671,
2396,
301,
29892,
525,
1767,
2396,
364,
29913,
13,
2
] |
conductor/conductor/tests/unit/common/models/test_order_lock_history.py | aalsudais/optf-has | 4 | 147055 | #
# -------------------------------------------------------------------------
# Copyright (C) 2019 IBM.
#
# 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.
#
# -------------------------------------------------------------------------
#
"""Test class for model order_lock_history"""
import unittest
from conductor.common.models.order_lock_history import OrderLockHistory
class TestOrderLockHistory(unittest.TestCase):
def setUp(self):
self.orderLockHistory = OrderLockHistory()
def test_OrderLockHistory(self):
self.assertEqual(True, self.orderLockHistory.atomic())
self.assertEqual("id", self.orderLockHistory.pk_name())
self.assertEqual(None, self.orderLockHistory.pk_value())
self.value = {'is_spinup_completed': False, 'conflict_id': None, 'spinup_completed_timestamp': None, 'plans': None}
self.assertEqual(self.value, self.orderLockHistory.values())
self.assertEqual("text", self.orderLockHistory.schema().get("conflict_id"))
self.assertEqual(None, self.orderLockHistory.__json__().get("plans"))
if __name__ == '__main__':
unittest.main()
| [
1,
396,
13,
29937,
448,
2683,
2683,
2683,
2683,
1378,
13,
29937,
259,
14187,
1266,
313,
29907,
29897,
29871,
29906,
29900,
29896,
29929,
27955,
29889,
13,
29937,
13,
29937,
259,
10413,
21144,
1090,
278,
13380,
19245,
29892,
10079,
29871,
29906,
29889,
29900,
313,
1552,
376,
29931,
293,
1947,
1496,
13,
29937,
259,
366,
1122,
451,
671,
445,
934,
5174,
297,
752,
13036,
411,
278,
19245,
29889,
13,
29937,
259,
887,
1122,
4017,
263,
3509,
310,
278,
19245,
472,
13,
29937,
13,
29937,
539,
1732,
597,
1636,
29889,
4288,
29889,
990,
29914,
506,
11259,
29914,
27888,
1430,
1660,
29899,
29906,
29889,
29900,
13,
29937,
13,
29937,
259,
25870,
3734,
491,
22903,
4307,
470,
15502,
304,
297,
5007,
29892,
7047,
13,
29937,
259,
13235,
1090,
278,
19245,
338,
13235,
373,
385,
376,
3289,
8519,
29908,
350,
3289,
3235,
29892,
13,
29937,
259,
399,
1806,
8187,
2692,
399,
1718,
29934,
13566,
29059,
6323,
8707,
29928,
22122,
29903,
8079,
13764,
29979,
476,
22255,
29892,
2845,
4653,
470,
2411,
2957,
29889,
13,
29937,
259,
2823,
278,
19245,
363,
278,
2702,
4086,
14765,
1076,
11239,
322,
13,
29937,
259,
27028,
1090,
278,
19245,
29889,
13,
29937,
13,
29937,
448,
2683,
2683,
2683,
2683,
1378,
13,
29937,
13,
13,
15945,
29908,
3057,
770,
363,
1904,
1797,
29918,
908,
29918,
18434,
15945,
29908,
13,
13,
5215,
443,
27958,
13,
3166,
7512,
272,
29889,
9435,
29889,
9794,
29889,
2098,
29918,
908,
29918,
18434,
1053,
8170,
16542,
20570,
13,
13,
13,
1990,
4321,
7514,
16542,
20570,
29898,
348,
27958,
29889,
3057,
8259,
1125,
13,
13,
1678,
822,
731,
3373,
29898,
1311,
1125,
13,
4706,
1583,
29889,
2098,
16542,
20570,
353,
8170,
16542,
20570,
580,
13,
13,
1678,
822,
1243,
29918,
7514,
16542,
20570,
29898,
1311,
1125,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5574,
29892,
1583,
29889,
2098,
16542,
20570,
29889,
21641,
3101,
13,
4706,
1583,
29889,
9294,
9843,
703,
333,
613,
1583,
29889,
2098,
16542,
20570,
29889,
20571,
29918,
978,
3101,
13,
4706,
1583,
29889,
9294,
9843,
29898,
8516,
29892,
1583,
29889,
2098,
16542,
20570,
29889,
20571,
29918,
1767,
3101,
13,
4706,
1583,
29889,
1767,
353,
11117,
275,
29918,
1028,
262,
786,
29918,
5729,
9446,
2396,
7700,
29892,
525,
5527,
29176,
29918,
333,
2396,
6213,
29892,
525,
1028,
262,
786,
29918,
5729,
9446,
29918,
16394,
2396,
6213,
29892,
525,
572,
550,
2396,
6213,
29913,
13,
4706,
1583,
29889,
9294,
9843,
29898,
1311,
29889,
1767,
29892,
1583,
29889,
2098,
16542,
20570,
29889,
5975,
3101,
13,
4706,
1583,
29889,
9294,
9843,
703,
726,
613,
1583,
29889,
2098,
16542,
20570,
29889,
11010,
2141,
657,
703,
5527,
29176,
29918,
333,
5783,
13,
4706,
1583,
29889,
9294,
9843,
29898,
8516,
29892,
1583,
29889,
2098,
16542,
20570,
17255,
3126,
1649,
2141,
657,
703,
572,
550,
5783,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
443,
27958,
29889,
3396,
580,
13,
2
] |
Bio/UniGene/UniGene.py | zachcp/biopython | 5 | 1611651 | # Copyright 2001 by <NAME>. All Rights Reserved.
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
from __future__ import print_function
import warnings
from Bio import BiopythonDeprecationWarning
warnings.warn("The module Bio.UniGene.UniGene is now deprecated, "
"and will be removed in a future release of Biopython."
"To parse UniGene flat files, please use the parser in "
"Bio.UniGene instead",
BiopythonDeprecationWarning)
import string
import sgmllib
import UserDict
import Bio.File
class UniGeneParser( sgmllib.SGMLParser ):
def reset( self ):
sgmllib.SGMLParser.reset( self )
self.text = ''
self.queue = UserDict.UserDict()
self.open_tag_stack = []
self.open_tag = 'open_html'
self.key_waiting = ''
self.master_key = ''
self.context = 'general_info'
def parse( self, handle ):
self.reset()
self.feed( handle )
for key in self.queue:
if( self.queue[ key ] == {} ):
if( key[ :15 ] == 'UniGene Cluster' ):
self.queue[ 'UniGene Cluster' ] = key[ 16: ]
del self.queue[ key ]
return self.queue
#
# Assumes an empty line between records
#
def feed( self, handle ):
if isinstance(handle, Bio.File.UndoHandle):
uhandle = handle
else:
uhandle = Bio.File.UndoHandle(handle)
text = ''
while True:
line = uhandle.readline()
line = string.strip( line )
if( line == '' ):
break
text = text + ' ' + line
sgmllib.SGMLParser.feed( self, text )
def handle_data(self, newtext ):
newtext = string.strip( newtext )
self.text = self.text + newtext
def start_a( self, attrs ):
if( self.context == 'seq_info' ):
if( self.open_tag != 'open_b' ):
self.text = ''
# self.queue.append( attrs )
def end_a( self ):
if( self.context == 'seq_info' ):
if( self.open_tag != 'open_b' ):
if( self.key_waiting == '' ):
self.key_waiting = self.text
self.text = ''
def start_b( self, attrs ):
self.open_tag_stack.append( self.open_tag )
self.open_tag = 'open_b'
if( self.key_waiting == '' ):
self.text = ''
def end_b( self ):
if( self.text[ :15 ] == 'UniGene Cluster' ):
self.queue[ 'UniGene Cluster' ] = self.text[ 16: ]
self.text = ''
elif( self.key_waiting == '' ):
self.extract_key()
def extract_key( self ):
text = string.strip( self.text )
key = string.join( string.split( text ) )
words = string.split( key )
key = string.join( words[ :2 ] )
self.text = ''
try:
self.open_tag = self.open_tag_stack.pop()
except:
self.open_tag = 'open_html'
if( self.open_tag == 'open_table_data' ):
if( self.context == 'general_info' ):
if( self.key_waiting == '' ):
self.key_waiting = key
self.text = ''
elif( self.context == 'seq_info' ):
if( text == 'Key to Symbols' ):
self.context = 'legend'
self.master_key = key
elif( self.context == 'general_info' ):
self.master_key = key
if 'SEQUENCE' in key:
self.context = 'seq_info'
self.queue[ key ] = UserDict.UserDict()
elif( self.context == 'seq_info' ):
self.queue[ key ] = UserDict.UserDict()
self.master_key = key
def start_table( self, attrs ):
self.open_tag_stack.append( self.open_tag )
self.open_tag = 'open_table'
def end_table( self ):
try:
self.open_tag = self.open_tag_stack.pop()
except:
self.open_tag = 'open_html'
self.key_waiting = ''
def start_tr( self, attrs ):
self.open_tag_stack.append( self.open_tag )
self.open_tag = 'open_table_row'
self.text = ''
def end_tr( self ):
try:
self.open_tag = self.open_tag_stack.pop()
except:
self.open_tag = 'open_html'
text = self.text
if text:
self.text = ''
if( text[ 0 ] == ':' ):
text = text[ 1: ]
text = string.join( string.split( text ) )
if self.context == 'general_info' or \
self.context == 'seq_info':
try:
contents = self.queue[ self.master_key ][ self.key_waiting ]
if isinstance(contents, list):
contents.append( text )
else:
self.queue[ self.master_key ][ self.key_waiting ] = \
[ contents, text ]
except:
self.queue[ self.master_key ][ self.key_waiting ] = text
self.key_waiting = ''
def start_td( self, attrs ):
self.open_tag_stack.append( self.open_tag )
self.open_tag = 'open_table_data'
def end_td( self ):
try:
self.open_tag = self.open_tag_stack.pop()
except:
self.open_tag = 'open_html'
if( self.context == 'seq_info' ):
self.text = self.text + ' '
def print_item( self, item, level = 1 ):
indent = ' '
for j in range( 0, level ):
indent = indent + ' '
if isinstance(item, str):
if( item != '' ):
print('%s%s' % ( indent, item ))
elif isinstance(item, list):
for subitem in item:
self.print_item( subitem, level + 1 )
elif( isinstance( item, UserDict.UserDict ) ):
for subitem in item:
print('%skey is %s' % ( indent, subitem ))
self.print_item( item[ subitem ], level + 1 )
else:
print(item)
def print_tags( self ):
for key in self.queue:
print('key %s' % key)
self.print_item( self.queue[ key ] )
if( __name__ == '__main__' ):
with open( 'Hs13225.htm') as handle:
undo_handle = Bio.File.UndoHandle( handle )
unigene_parser = UniGeneParser()
unigene_parser.parse( handle )
unigene_parser.print_tags()
| [
1,
396,
14187,
1266,
29871,
29906,
29900,
29900,
29896,
491,
529,
5813,
15513,
2178,
26863,
2538,
9841,
29889,
13,
29937,
910,
775,
338,
760,
310,
278,
3457,
459,
1656,
4978,
322,
4095,
287,
491,
967,
13,
29937,
19405,
29889,
29871,
3529,
1074,
278,
365,
2965,
1430,
1660,
934,
393,
881,
505,
1063,
5134,
13,
29937,
408,
760,
310,
445,
3577,
29889,
13,
13,
3166,
4770,
29888,
9130,
1649,
1053,
1596,
29918,
2220,
13,
13,
5215,
18116,
13,
3166,
21184,
1053,
3457,
459,
1656,
8498,
3757,
362,
22709,
13,
13,
25442,
886,
29889,
25442,
703,
1576,
3883,
21184,
29889,
8110,
29954,
1600,
29889,
8110,
29954,
1600,
338,
1286,
18164,
29892,
376,
13,
795,
376,
392,
674,
367,
6206,
297,
263,
5434,
6507,
310,
3457,
459,
1656,
1213,
13,
795,
376,
1762,
6088,
853,
29875,
29954,
1600,
12151,
2066,
29892,
3113,
671,
278,
13812,
297,
376,
13,
795,
376,
29933,
601,
29889,
8110,
29954,
1600,
2012,
613,
13,
795,
3457,
459,
1656,
8498,
3757,
362,
22709,
29897,
13,
13,
5215,
1347,
13,
5215,
269,
29887,
828,
1982,
13,
5215,
4911,
21533,
13,
5215,
21184,
29889,
2283,
13,
13,
13,
1990,
853,
29875,
29954,
1600,
11726,
29898,
269,
29887,
828,
1982,
29889,
26016,
1988,
11726,
29871,
1125,
13,
13,
1678,
822,
10092,
29898,
1583,
29871,
1125,
13,
4706,
269,
29887,
828,
1982,
29889,
26016,
1988,
11726,
29889,
12071,
29898,
1583,
1723,
13,
4706,
1583,
29889,
726,
353,
6629,
13,
4706,
1583,
29889,
9990,
353,
4911,
21533,
29889,
2659,
21533,
580,
13,
4706,
1583,
29889,
3150,
29918,
4039,
29918,
1429,
353,
5159,
13,
4706,
1583,
29889,
3150,
29918,
4039,
353,
525,
3150,
29918,
1420,
29915,
13,
4706,
1583,
29889,
1989,
29918,
10685,
292,
353,
6629,
13,
4706,
1583,
29889,
6207,
29918,
1989,
353,
6629,
13,
4706,
1583,
29889,
4703,
353,
525,
17492,
29918,
3888,
29915,
13,
13,
1678,
822,
6088,
29898,
1583,
29892,
4386,
29871,
1125,
13,
4706,
1583,
29889,
12071,
580,
13,
4706,
1583,
29889,
18798,
29898,
4386,
1723,
13,
4706,
363,
1820,
297,
1583,
29889,
9990,
29901,
13,
9651,
565,
29898,
1583,
29889,
9990,
29961,
1820,
4514,
1275,
6571,
29871,
1125,
13,
18884,
565,
29898,
1820,
29961,
584,
29896,
29945,
4514,
1275,
525,
8110,
29954,
1600,
2233,
5402,
29915,
29871,
1125,
13,
462,
1678,
1583,
29889,
9990,
29961,
525,
8110,
29954,
1600,
2233,
5402,
29915,
4514,
353,
1820,
29961,
29871,
29896,
29953,
29901,
4514,
13,
18884,
628,
1583,
29889,
9990,
29961,
1820,
4514,
13,
4706,
736,
1583,
29889,
9990,
13,
13,
29937,
13,
29937,
4007,
9351,
385,
4069,
1196,
1546,
6475,
13,
29937,
13,
1678,
822,
8343,
29898,
1583,
29892,
4386,
29871,
1125,
13,
4706,
565,
338,
8758,
29898,
8411,
29892,
21184,
29889,
2283,
29889,
25263,
29877,
13554,
1125,
13,
9651,
318,
8411,
353,
4386,
13,
4706,
1683,
29901,
13,
9651,
318,
8411,
353,
21184,
29889,
2283,
29889,
25263,
29877,
13554,
29898,
8411,
29897,
13,
4706,
1426,
353,
6629,
13,
4706,
1550,
5852,
29901,
13,
9651,
1196,
353,
318,
8411,
29889,
949,
1220,
580,
13,
9651,
1196,
353,
1347,
29889,
17010,
29898,
1196,
1723,
13,
9651,
565,
29898,
1196,
1275,
6629,
29871,
1125,
13,
18884,
2867,
13,
9651,
1426,
353,
1426,
718,
525,
525,
718,
1196,
13,
13,
4706,
269,
29887,
828,
1982,
29889,
26016,
1988,
11726,
29889,
18798,
29898,
1583,
29892,
1426,
1723,
13,
13,
1678,
822,
4386,
29918,
1272,
29898,
1311,
29892,
716,
726,
29871,
1125,
13,
4706,
716,
726,
353,
1347,
29889,
17010,
29898,
716,
726,
1723,
13,
4706,
1583,
29889,
726,
353,
1583,
29889,
726,
718,
716,
726,
13,
13,
1678,
822,
1369,
29918,
29874,
29898,
1583,
29892,
12421,
29879,
29871,
1125,
13,
4706,
565,
29898,
1583,
29889,
4703,
1275,
525,
11762,
29918,
3888,
29915,
29871,
1125,
13,
9651,
565,
29898,
1583,
29889,
3150,
29918,
4039,
2804,
525,
3150,
29918,
29890,
29915,
29871,
1125,
13,
18884,
1583,
29889,
726,
353,
6629,
13,
13,
29937,
4706,
1583,
29889,
9990,
29889,
4397,
29898,
12421,
29879,
1723,
13,
13,
1678,
822,
1095,
29918,
29874,
29898,
1583,
29871,
1125,
13,
4706,
565,
29898,
1583,
29889,
4703,
1275,
525,
11762,
29918,
3888,
29915,
29871,
1125,
13,
9651,
565,
29898,
1583,
29889,
3150,
29918,
4039,
2804,
525,
3150,
29918,
29890,
29915,
29871,
1125,
13,
18884,
565,
29898,
1583,
29889,
1989,
29918,
10685,
292,
1275,
6629,
29871,
1125,
13,
462,
1678,
1583,
29889,
1989,
29918,
10685,
292,
353,
1583,
29889,
726,
13,
462,
1678,
1583,
29889,
726,
353,
6629,
13,
13,
1678,
822,
1369,
29918,
29890,
29898,
1583,
29892,
12421,
29879,
29871,
1125,
13,
13,
4706,
1583,
29889,
3150,
29918,
4039,
29918,
1429,
29889,
4397,
29898,
1583,
29889,
3150,
29918,
4039,
1723,
13,
4706,
1583,
29889,
3150,
29918,
4039,
353,
525,
3150,
29918,
29890,
29915,
13,
4706,
565,
29898,
1583,
29889,
1989,
29918,
10685,
292,
1275,
6629,
29871,
1125,
13,
9651,
1583,
29889,
726,
353,
6629,
13,
13,
1678,
822,
1095,
29918,
29890,
29898,
1583,
29871,
1125,
13,
4706,
565,
29898,
1583,
29889,
726,
29961,
584,
29896,
29945,
4514,
1275,
525,
8110,
29954,
1600,
2233,
5402,
29915,
29871,
1125,
13,
9651,
1583,
29889,
9990,
29961,
525,
8110,
29954,
1600,
2233,
5402,
29915,
4514,
353,
1583,
29889,
726,
29961,
29871,
29896,
29953,
29901,
4514,
13,
9651,
1583,
29889,
726,
353,
6629,
13,
4706,
25342,
29898,
1583,
29889,
1989,
29918,
10685,
292,
1275,
6629,
29871,
1125,
13,
9651,
1583,
29889,
21111,
29918,
1989,
580,
13,
13,
1678,
822,
6597,
29918,
1989,
29898,
1583,
29871,
1125,
13,
4706,
1426,
353,
1347,
29889,
17010,
29898,
1583,
29889,
726,
1723,
13,
4706,
1820,
353,
1347,
29889,
7122,
29898,
1347,
29889,
5451,
29898,
1426,
1723,
1723,
13,
4706,
3838,
353,
1347,
29889,
5451,
29898,
1820,
1723,
13,
4706,
1820,
353,
1347,
29889,
7122,
29898,
3838,
29961,
584,
29906,
4514,
1723,
13,
4706,
1583,
29889,
726,
353,
6629,
13,
13,
4706,
1018,
29901,
13,
9651,
1583,
29889,
3150,
29918,
4039,
353,
1583,
29889,
3150,
29918,
4039,
29918,
1429,
29889,
7323,
580,
13,
4706,
5174,
29901,
13,
9651,
1583,
29889,
3150,
29918,
4039,
353,
525,
3150,
29918,
1420,
29915,
13,
4706,
565,
29898,
1583,
29889,
3150,
29918,
4039,
1275,
525,
3150,
29918,
2371,
29918,
1272,
29915,
29871,
1125,
13,
9651,
565,
29898,
1583,
29889,
4703,
1275,
525,
17492,
29918,
3888,
29915,
29871,
1125,
13,
18884,
565,
29898,
1583,
29889,
1989,
29918,
10685,
292,
1275,
6629,
29871,
1125,
13,
462,
1678,
1583,
29889,
1989,
29918,
10685,
292,
353,
1820,
13,
462,
1678,
1583,
29889,
726,
353,
6629,
13,
9651,
25342,
29898,
1583,
29889,
4703,
1275,
525,
11762,
29918,
3888,
29915,
29871,
1125,
13,
18884,
565,
29898,
1426,
1275,
525,
2558,
304,
23858,
29879,
29915,
29871,
1125,
13,
462,
1678,
1583,
29889,
4703,
353,
525,
26172,
29915,
13,
462,
1678,
1583,
29889,
6207,
29918,
1989,
353,
1820,
13,
4706,
25342,
29898,
1583,
29889,
4703,
1275,
525,
17492,
29918,
3888,
29915,
29871,
1125,
13,
9651,
1583,
29889,
6207,
29918,
1989,
353,
1820,
13,
9651,
565,
525,
1660,
13356,
1430,
4741,
29915,
297,
1820,
29901,
13,
18884,
1583,
29889,
4703,
353,
525,
11762,
29918,
3888,
29915,
13,
9651,
1583,
29889,
9990,
29961,
1820,
4514,
353,
4911,
21533,
29889,
2659,
21533,
580,
13,
4706,
25342,
29898,
1583,
29889,
4703,
1275,
525,
11762,
29918,
3888,
29915,
29871,
1125,
13,
9651,
1583,
29889,
9990,
29961,
1820,
4514,
353,
4911,
21533,
29889,
2659,
21533,
580,
13,
9651,
1583,
29889,
6207,
29918,
1989,
353,
1820,
13,
13,
1678,
822,
1369,
29918,
2371,
29898,
1583,
29892,
12421,
29879,
29871,
1125,
13,
4706,
1583,
29889,
3150,
29918,
4039,
29918,
1429,
29889,
4397,
29898,
1583,
29889,
3150,
29918,
4039,
1723,
13,
4706,
1583,
29889,
3150,
29918,
4039,
353,
525,
3150,
29918,
2371,
29915,
13,
13,
1678,
822,
1095,
29918,
2371,
29898,
1583,
29871,
1125,
13,
4706,
1018,
29901,
13,
9651,
1583,
29889,
3150,
29918,
4039,
353,
1583,
29889,
3150,
29918,
4039,
29918,
1429,
29889,
7323,
580,
13,
4706,
5174,
29901,
13,
9651,
1583,
29889,
3150,
29918,
4039,
353,
525,
3150,
29918,
1420,
29915,
13,
4706,
1583,
29889,
1989,
29918,
10685,
292,
353,
6629,
13,
13,
1678,
822,
1369,
29918,
509,
29898,
1583,
29892,
12421,
29879,
29871,
1125,
13,
4706,
1583,
29889,
3150,
29918,
4039,
29918,
1429,
29889,
4397,
29898,
1583,
29889,
3150,
29918,
4039,
1723,
13,
4706,
1583,
29889,
3150,
29918,
4039,
353,
525,
3150,
29918,
2371,
29918,
798,
29915,
13,
4706,
1583,
29889,
726,
353,
6629,
13,
13,
1678,
822,
1095,
29918,
509,
29898,
1583,
29871,
1125,
13,
4706,
1018,
29901,
13,
9651,
1583,
29889,
3150,
29918,
4039,
353,
1583,
29889,
3150,
29918,
4039,
29918,
1429,
29889,
7323,
580,
13,
4706,
5174,
29901,
13,
9651,
1583,
29889,
3150,
29918,
4039,
353,
525,
3150,
29918,
1420,
29915,
13,
4706,
1426,
353,
1583,
29889,
726,
13,
4706,
565,
1426,
29901,
13,
9651,
1583,
29889,
726,
353,
6629,
13,
9651,
565,
29898,
1426,
29961,
29871,
29900,
4514,
1275,
525,
11283,
29871,
1125,
13,
18884,
1426,
353,
1426,
29961,
29871,
29896,
29901,
4514,
13,
9651,
1426,
353,
1347,
29889,
7122,
29898,
1347,
29889,
5451,
29898,
1426,
1723,
1723,
13,
9651,
565,
1583,
29889,
4703,
1275,
525,
17492,
29918,
3888,
29915,
470,
320,
13,
1669,
1583,
29889,
4703,
1275,
525,
11762,
29918,
3888,
2396,
13,
18884,
1018,
29901,
13,
462,
1678,
8118,
353,
1583,
29889,
9990,
29961,
1583,
29889,
6207,
29918,
1989,
29871,
3816,
1583,
29889,
1989,
29918,
10685,
292,
4514,
13,
462,
1678,
565,
338,
8758,
29898,
10853,
29892,
1051,
1125,
13,
462,
4706,
8118,
29889,
4397,
29898,
1426,
1723,
13,
462,
1678,
1683,
29901,
13,
462,
4706,
1583,
29889,
9990,
29961,
1583,
29889,
6207,
29918,
1989,
29871,
3816,
1583,
29889,
1989,
29918,
10685,
292,
4514,
353,
320,
13,
462,
9651,
518,
8118,
29892,
1426,
4514,
13,
18884,
5174,
29901,
13,
462,
1678,
1583,
29889,
9990,
29961,
1583,
29889,
6207,
29918,
1989,
29871,
3816,
1583,
29889,
1989,
29918,
10685,
292,
4514,
353,
1426,
13,
13,
18884,
1583,
29889,
1989,
29918,
10685,
292,
353,
6629,
13,
13,
1678,
822,
1369,
29918,
1594,
29898,
1583,
29892,
12421,
29879,
29871,
1125,
13,
4706,
1583,
29889,
3150,
29918,
4039,
29918,
1429,
29889,
4397,
29898,
1583,
29889,
3150,
29918,
4039,
1723,
13,
4706,
1583,
29889,
3150,
29918,
4039,
353,
525,
3150,
29918,
2371,
29918,
1272,
29915,
13,
13,
1678,
822,
1095,
29918,
1594,
29898,
1583,
29871,
1125,
13,
4706,
1018,
29901,
13,
9651,
1583,
29889,
3150,
29918,
4039,
353,
1583,
29889,
3150,
29918,
4039,
29918,
1429,
29889,
7323,
580,
13,
4706,
5174,
29901,
13,
9651,
1583,
29889,
3150,
29918,
4039,
353,
525,
3150,
29918,
1420,
29915,
13,
4706,
565,
29898,
1583,
29889,
4703,
1275,
525,
11762,
29918,
3888,
29915,
29871,
1125,
13,
9651,
1583,
29889,
726,
353,
1583,
29889,
726,
718,
525,
525,
13,
13,
1678,
822,
1596,
29918,
667,
29898,
1583,
29892,
2944,
29892,
3233,
353,
29871,
29896,
29871,
1125,
13,
4706,
29536,
353,
525,
1678,
525,
13,
4706,
363,
432,
297,
3464,
29898,
29871,
29900,
29892,
3233,
29871,
1125,
13,
9651,
29536,
353,
29536,
718,
525,
1678,
525,
13,
4706,
565,
338,
8758,
29898,
667,
29892,
851,
1125,
13,
9651,
565,
29898,
2944,
2804,
6629,
29871,
1125,
13,
18884,
1596,
877,
29995,
29879,
29995,
29879,
29915,
1273,
313,
29536,
29892,
2944,
29871,
876,
13,
4706,
25342,
338,
8758,
29898,
667,
29892,
1051,
1125,
13,
9651,
363,
1014,
667,
297,
2944,
29901,
13,
18884,
1583,
29889,
2158,
29918,
667,
29898,
1014,
667,
29892,
3233,
718,
29871,
29896,
1723,
13,
4706,
25342,
29898,
338,
8758,
29898,
2944,
29892,
4911,
21533,
29889,
2659,
21533,
1723,
29871,
1125,
13,
9651,
363,
1014,
667,
297,
2944,
29901,
13,
18884,
1596,
877,
29995,
29879,
1989,
338,
1273,
29879,
29915,
1273,
313,
29536,
29892,
1014,
667,
29871,
876,
13,
18884,
1583,
29889,
2158,
29918,
667,
29898,
2944,
29961,
1014,
667,
21251,
3233,
718,
29871,
29896,
1723,
13,
4706,
1683,
29901,
13,
9651,
1596,
29898,
667,
29897,
13,
13,
1678,
822,
1596,
29918,
11338,
29898,
1583,
29871,
1125,
13,
4706,
363,
1820,
297,
1583,
29889,
9990,
29901,
13,
9651,
1596,
877,
1989,
1273,
29879,
29915,
1273,
1820,
29897,
13,
9651,
1583,
29889,
2158,
29918,
667,
29898,
1583,
29889,
9990,
29961,
1820,
4514,
1723,
13,
13,
13,
361,
29898,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
29915,
29871,
1125,
13,
1678,
411,
1722,
29898,
525,
29950,
29879,
29896,
29941,
29906,
29906,
29945,
29889,
13357,
1495,
408,
4386,
29901,
13,
4706,
563,
29877,
29918,
8411,
353,
21184,
29889,
2283,
29889,
25263,
29877,
13554,
29898,
4386,
1723,
13,
4706,
443,
335,
1600,
29918,
16680,
353,
853,
29875,
29954,
1600,
11726,
580,
13,
4706,
443,
335,
1600,
29918,
16680,
29889,
5510,
29898,
4386,
1723,
13,
4706,
443,
335,
1600,
29918,
16680,
29889,
2158,
29918,
11338,
580,
13,
2
] |
api/urls.py | alaasalman/aussieshopper | 0 | 146476 | <reponame>alaasalman/aussieshopper
from django.conf.urls import url, include
from rest_framework import routers
from api import views
app_name = 'api'
router = routers.SimpleRouter()
router.register(r'stats', views.StatsViewSet)
urlpatterns = [
url(r'bot/handle/',
views.HandleChatMessage.as_view(),
name='api-handle-message'),
url(r'^', include(router.urls))
]
| [
1,
529,
276,
1112,
420,
29958,
2883,
294,
284,
1171,
29914,
11214,
583,
1251,
2496,
13,
3166,
9557,
29889,
5527,
29889,
26045,
1053,
3142,
29892,
3160,
13,
13,
3166,
1791,
29918,
4468,
1053,
16053,
2153,
13,
13,
3166,
7882,
1053,
8386,
13,
13,
932,
29918,
978,
353,
525,
2754,
29915,
13,
13,
15140,
353,
16053,
2153,
29889,
15427,
23971,
580,
13,
15140,
29889,
9573,
29898,
29878,
29915,
16202,
742,
8386,
29889,
25060,
1043,
2697,
29897,
13,
13,
2271,
11037,
29879,
353,
518,
13,
1678,
3142,
29898,
29878,
29915,
7451,
29914,
8411,
29914,
742,
13,
4706,
8386,
29889,
13554,
1451,
271,
3728,
29889,
294,
29918,
1493,
3285,
13,
4706,
1024,
2433,
2754,
29899,
8411,
29899,
4906,
5477,
13,
1678,
3142,
29898,
29878,
29915,
29985,
742,
3160,
29898,
15140,
29889,
26045,
876,
13,
29962,
13,
2
] |
dolosse/hardware/xia/pixie16/list_mode_data_decoder.py | Tobias2023/dolosse | 0 | 88220 | """
file: list_mode_data_decoder.py
brief: Decodes binary data produced by an XIA Pixie16 module
author: <NAME>
date: January 17, 2019
"""
from enum import Enum
from functools import partial
from io import BytesIO
from struct import unpack
from dolosse.constants.data import WORD, HALF_WORD
class HeaderCodes(Enum):
"""
Defines the various header values that we expect. If we get something that's not one of these
then we have a problem.
"""
STATS_BLOCK = 1
HEADER = 4
HEADER_W_ETS = 6
HEADER_W_ESUM = 8
HEADER_W_ESUM_ETS = 10
HEADER_W_QDC = 12
HEADER_W_QDC_ETS = 14
HEADER_W_ESUM_QDC = 16
HEADER_W_ESUM_QDC_ETS = 18
def decode_word_zero(word, mask):
"""
Decodes the
* Channel
* Slot
* Crate
* Header Length (Base 4 words + options)
* Event Length (Header + Trace Length / 2)
* Finish Code
:param word: The word that we're going to decode
:param mask: The mask that we'll be using.
:return: A dictionary containing the decoded information.
"""
return {
'channel': (word & mask.channel()[0]) >> mask.channel()[1],
'slot': (word & mask.slot()[0]) >> mask.slot()[1],
'crate': (word & mask.crate()[0]) >> mask.crate()[1],
'header_length': (word & mask.header_length()[0]) >> mask.header_length()[1],
'event_length': (word & mask.event_length()[0]) >> mask.event_length()[1],
'finish_code': (word & mask.finish_code()[0]) >> mask.finish_code()[1]
}
def decode_word_two(word, mask):
"""
Decodes the second word in the standard 4 word header.
:param word: The word that we're going to decode.
:param mask: The mask we'll use to decode that word.
:return: A dictionary containing the decoded information
"""
return {
'event_time_high': (word & mask.event_time_high()[0]) >> mask.event_time_high()[1],
'cfd_fractional_time': (word & mask.cfd_fractional_time()[0]) >>
mask.cfd_fractional_time()[1],
'cfd_trigger_source_bit': (word & mask.cfd_trigger_source()[0]) >>
mask.cfd_trigger_source()[1],
'cfd_forced_trigger_bit': (word & mask.cfd_forced_trigger()[0]) >>
mask.cfd_forced_trigger()[1]
}
def decode_word_three(word, mask):
"""
The final word of the standard header.
:param word: The word that we're going to decode.
:param mask: The mask we'll use to decode that word.
:return: A dictionary containing the decoded information
"""
return {
'energy': (word & mask.energy()[0]) >> mask.energy()[1],
'trace_length': (word & mask.trace_length()[0]) >> mask.trace_length()[1],
'trace_out_of_range': (word & mask.trace_out_of_range()[0]) >> mask.trace_out_of_range()[1]
}
def decode_energy_sums(buf):
"""
The first three words are the leading edge, flattop, and falling edge of the trapezoidal filter.
The last word is the baseline encoded in IEEE 754 format. We need to decode this set of data
in a different way than the other header words.
https://en.wikipedia.org/wiki/IEEE_754#IEEE_754-2008
https://stackoverflow.com/questions/39593087/double-conversion-to-decimal-value-ieee-754-in-python
:param buf: The buffer containing the encoded information
:return: An array with the elements we decoded.
"""
return [unpack('I', buf.read(WORD))[0],
unpack('I', buf.read(WORD))[0],
unpack('I', buf.read(WORD))[0],
unpack(b'<f', buf.read(WORD))[0]]
def decode_external_timestamp(buf, mask):
"""
External time stamps come in from the front panel, we will need to be able to decode them so that
we can do cross system time correlations. This time works exactly like the channel event time
in the header.
:param buf: The buffer we'll be decoding
:param mask: The mask we need to decode the data.
:return:
"""
return [unpack('I', buf.read(WORD))[0],
(unpack('I', buf.read(WORD))[0] & mask.event_time_high()[0])
>> mask.event_time_high()[1]]
def decode_qdc(buf):
"""
The Pixie-16 modules collect QDC Sums of each signal they process. They're stored in 8 words.
:param buf: Buffer containing the QDC data
:return: An array containing the QDC data
"""
qdc = []
for chunk in iter(partial(buf.read, WORD), b''):
qdc.append(unpack('I', chunk)[0])
return qdc
def decode_trace(buf):
"""
Pixie-16 stores traces with two samples per word. This is about the only place we need to use
a half word to decode the data structure.
:param buf: The buffer containing the trace.
:return:
"""
trc = []
for chunk in iter(partial(buf.read, HALF_WORD), b''):
trc.append(unpack('H', chunk)[0])
return trc
def process_optional_header_data(buf, header_length, mask):
"""
Process additional header data if they exist. We need to execute the buffer reads in order due
to how the data structure works. The order is always ESUMS -> QDC -> EXTERNAL_TIMESTAMP (ETS).
If one of the three is missing everything else shifts up.
:param buf: The buffer that we'll be reading from
:param header_length: The header length so that we know what the buffer contains.
:param mask: The mask that we need to know how many words each component has.
:return: A dictionary containing the decoded data.
"""
data = {}
if HeaderCodes(header_length) in [code for code in HeaderCodes if "ESUM" in code.name]:
data['esums'] = \
decode_energy_sums(BytesIO(buf.read(WORD * mask.number_of_energy_sum_words())))
if HeaderCodes(header_length) in [code for code in HeaderCodes if "QDC" in code.name]:
data['qdc'] = decode_qdc(BytesIO(buf.read(WORD * mask.number_of_qdc_words())))
if HeaderCodes(header_length) in [code for code in HeaderCodes if "ETS" in code.name]:
data['external_timestamp'] = decode_external_timestamp(
BytesIO(buf.read(WORD * mask.number_of_external_timestamp_words())), mask)
return data
def decode_listmode_data(stream, mask):
"""
Decodes data from Pixie16 binary data stream. We'll have an unknown number of events in the
data buffer. Therefore, we'll need to loop over the buffer and decode the events as we go. We
store the decoded events as a dictionary, and put those dictionaries into an array.
:param stream: The data stream that we'll be decoding
:param mask: The binary data mask that we'll need to decode the data.
"""
decoded_data_list = []
for chunk in iter(partial(stream.read, WORD), b''):
decoded_data = decode_word_zero(unpack('I', chunk)[0], mask)
decoded_data.update({
'event_time_low': unpack('I', stream.read(WORD))[0]})
decoded_data.update(
decode_word_two(unpack('I', stream.read(WORD))[0], mask))
decoded_data.update(
decode_word_three(unpack('I', stream.read(WORD))[0], mask))
try:
decoded_data.update(
process_optional_header_data(stream, decoded_data['header_length'], mask))
except ValueError:
raise BufferError('Unexpected Header Length: %s\n\tCRATE:SLOT:CHAN = %s:%s:%s'
% (decoded_data['header_length'], decoded_data['crate'],
decoded_data['slot'], decoded_data['channel']))
if decoded_data['trace_length'] != 0:
if decoded_data['event_length'] - decoded_data['header_length'] \
== decoded_data['trace_length'] * 0.5:
decoded_data.update({'trace': decode_trace(BytesIO(stream.read(
WORD * int(decoded_data['trace_length'] * 0.5))))})
else:
raise ValueError(
'Event Length (%s) does not match with Header(%s) + Trace (%s) Length !' % (
decoded_data['event_length'], decoded_data['header_length'],
decoded_data['trace_length']))
decoded_data_list.append(decoded_data)
return decoded_data_list
| [
1,
9995,
13,
1445,
29901,
1051,
29918,
8513,
29918,
1272,
29918,
7099,
6119,
29889,
2272,
13,
1182,
2575,
29901,
3826,
2631,
7581,
848,
7371,
491,
385,
1060,
10764,
349,
861,
347,
29896,
29953,
3883,
13,
8921,
29901,
529,
5813,
29958,
13,
1256,
29901,
5490,
29871,
29896,
29955,
29892,
29871,
29906,
29900,
29896,
29929,
13,
15945,
29908,
13,
3166,
14115,
1053,
1174,
398,
13,
3166,
2090,
312,
8789,
1053,
7687,
13,
3166,
12013,
1053,
2648,
2167,
5971,
13,
3166,
2281,
1053,
443,
4058,
13,
13,
3166,
8828,
359,
344,
29889,
3075,
1934,
29889,
1272,
1053,
399,
25593,
29892,
379,
1964,
29943,
29918,
17013,
13,
13,
13,
1990,
19345,
29907,
2631,
29898,
16854,
1125,
13,
1678,
9995,
13,
1678,
5282,
1475,
278,
5164,
4839,
1819,
393,
591,
2149,
29889,
960,
591,
679,
1554,
393,
29915,
29879,
451,
697,
310,
1438,
13,
1678,
769,
591,
505,
263,
1108,
29889,
13,
1678,
9995,
13,
1678,
6850,
1299,
29903,
29918,
29933,
21339,
353,
29871,
29896,
13,
1678,
17714,
3035,
1001,
353,
29871,
29946,
13,
1678,
17714,
3035,
1001,
29918,
29956,
29918,
2544,
29903,
353,
29871,
29953,
13,
1678,
17714,
3035,
1001,
29918,
29956,
29918,
2890,
5005,
353,
29871,
29947,
13,
1678,
17714,
3035,
1001,
29918,
29956,
29918,
2890,
5005,
29918,
2544,
29903,
353,
29871,
29896,
29900,
13,
1678,
17714,
3035,
1001,
29918,
29956,
29918,
29984,
12696,
353,
29871,
29896,
29906,
13,
1678,
17714,
3035,
1001,
29918,
29956,
29918,
29984,
12696,
29918,
2544,
29903,
353,
29871,
29896,
29946,
13,
1678,
17714,
3035,
1001,
29918,
29956,
29918,
2890,
5005,
29918,
29984,
12696,
353,
29871,
29896,
29953,
13,
1678,
17714,
3035,
1001,
29918,
29956,
29918,
2890,
5005,
29918,
29984,
12696,
29918,
2544,
29903,
353,
29871,
29896,
29947,
13,
13,
13,
1753,
21822,
29918,
1742,
29918,
9171,
29898,
1742,
29892,
11105,
1125,
13,
1678,
9995,
13,
1678,
3826,
2631,
278,
13,
539,
334,
17368,
13,
539,
334,
317,
8276,
13,
539,
334,
6781,
403,
13,
539,
334,
19345,
365,
1477,
313,
5160,
29871,
29946,
3838,
718,
3987,
29897,
13,
539,
334,
6864,
365,
1477,
313,
7850,
718,
20597,
365,
1477,
847,
29871,
29906,
29897,
13,
539,
334,
4231,
728,
5920,
13,
1678,
584,
3207,
1734,
29901,
450,
1734,
393,
591,
29915,
276,
2675,
304,
21822,
13,
1678,
584,
3207,
11105,
29901,
450,
11105,
393,
591,
29915,
645,
367,
773,
29889,
13,
1678,
584,
2457,
29901,
319,
8600,
6943,
278,
1602,
6797,
2472,
29889,
13,
1678,
9995,
13,
1678,
736,
426,
13,
4706,
525,
12719,
2396,
313,
1742,
669,
11105,
29889,
12719,
580,
29961,
29900,
2314,
5099,
11105,
29889,
12719,
580,
29961,
29896,
1402,
13,
4706,
525,
2536,
327,
2396,
313,
1742,
669,
11105,
29889,
2536,
327,
580,
29961,
29900,
2314,
5099,
11105,
29889,
2536,
327,
580,
29961,
29896,
1402,
13,
4706,
525,
7283,
403,
2396,
313,
1742,
669,
11105,
29889,
7283,
403,
580,
29961,
29900,
2314,
5099,
11105,
29889,
7283,
403,
580,
29961,
29896,
1402,
13,
4706,
525,
6672,
29918,
2848,
2396,
313,
1742,
669,
11105,
29889,
6672,
29918,
2848,
580,
29961,
29900,
2314,
5099,
11105,
29889,
6672,
29918,
2848,
580,
29961,
29896,
1402,
13,
4706,
525,
3696,
29918,
2848,
2396,
313,
1742,
669,
11105,
29889,
3696,
29918,
2848,
580,
29961,
29900,
2314,
5099,
11105,
29889,
3696,
29918,
2848,
580,
29961,
29896,
1402,
13,
4706,
525,
4951,
728,
29918,
401,
2396,
313,
1742,
669,
11105,
29889,
4951,
728,
29918,
401,
580,
29961,
29900,
2314,
5099,
11105,
29889,
4951,
728,
29918,
401,
580,
29961,
29896,
29962,
13,
1678,
500,
13,
13,
13,
1753,
21822,
29918,
1742,
29918,
10184,
29898,
1742,
29892,
11105,
1125,
13,
1678,
9995,
13,
1678,
3826,
2631,
278,
1473,
1734,
297,
278,
3918,
29871,
29946,
1734,
4839,
29889,
13,
1678,
584,
3207,
1734,
29901,
450,
1734,
393,
591,
29915,
276,
2675,
304,
21822,
29889,
13,
1678,
584,
3207,
11105,
29901,
450,
11105,
591,
29915,
645,
671,
304,
21822,
393,
1734,
29889,
13,
1678,
584,
2457,
29901,
319,
8600,
6943,
278,
1602,
6797,
2472,
13,
1678,
9995,
13,
1678,
736,
426,
13,
4706,
525,
3696,
29918,
2230,
29918,
9812,
2396,
313,
1742,
669,
11105,
29889,
3696,
29918,
2230,
29918,
9812,
580,
29961,
29900,
2314,
5099,
11105,
29889,
3696,
29918,
2230,
29918,
9812,
580,
29961,
29896,
1402,
13,
4706,
525,
6854,
29881,
29918,
29888,
13857,
284,
29918,
2230,
2396,
313,
1742,
669,
11105,
29889,
6854,
29881,
29918,
29888,
13857,
284,
29918,
2230,
580,
29961,
29900,
2314,
5099,
13,
462,
1669,
11105,
29889,
6854,
29881,
29918,
29888,
13857,
284,
29918,
2230,
580,
29961,
29896,
1402,
13,
4706,
525,
6854,
29881,
29918,
21001,
29918,
4993,
29918,
2966,
2396,
313,
1742,
669,
11105,
29889,
6854,
29881,
29918,
21001,
29918,
4993,
580,
29961,
29900,
2314,
5099,
13,
462,
462,
29871,
11105,
29889,
6854,
29881,
29918,
21001,
29918,
4993,
580,
29961,
29896,
1402,
13,
4706,
525,
6854,
29881,
29918,
1454,
1133,
29918,
21001,
29918,
2966,
2396,
313,
1742,
669,
11105,
29889,
6854,
29881,
29918,
1454,
1133,
29918,
21001,
580,
29961,
29900,
2314,
5099,
13,
462,
462,
29871,
11105,
29889,
6854,
29881,
29918,
1454,
1133,
29918,
21001,
580,
29961,
29896,
29962,
13,
1678,
500,
13,
13,
13,
1753,
21822,
29918,
1742,
29918,
17536,
29898,
1742,
29892,
11105,
1125,
13,
1678,
9995,
13,
1678,
450,
2186,
1734,
310,
278,
3918,
4839,
29889,
13,
1678,
584,
3207,
1734,
29901,
450,
1734,
393,
591,
29915,
276,
2675,
304,
21822,
29889,
13,
1678,
584,
3207,
11105,
29901,
450,
11105,
591,
29915,
645,
671,
304,
21822,
393,
1734,
29889,
13,
1678,
584,
2457,
29901,
319,
8600,
6943,
278,
1602,
6797,
2472,
13,
1678,
9995,
13,
1678,
736,
426,
13,
4706,
525,
27548,
2396,
313,
1742,
669,
11105,
29889,
27548,
580,
29961,
29900,
2314,
5099,
11105,
29889,
27548,
580,
29961,
29896,
1402,
13,
4706,
525,
15003,
29918,
2848,
2396,
313,
1742,
669,
11105,
29889,
15003,
29918,
2848,
580,
29961,
29900,
2314,
5099,
11105,
29889,
15003,
29918,
2848,
580,
29961,
29896,
1402,
13,
4706,
525,
15003,
29918,
449,
29918,
974,
29918,
3881,
2396,
313,
1742,
669,
11105,
29889,
15003,
29918,
449,
29918,
974,
29918,
3881,
580,
29961,
29900,
2314,
5099,
11105,
29889,
15003,
29918,
449,
29918,
974,
29918,
3881,
580,
29961,
29896,
29962,
13,
1678,
500,
13,
13,
13,
1753,
21822,
29918,
27548,
29918,
2083,
29879,
29898,
9721,
1125,
13,
1678,
9995,
13,
1678,
450,
937,
2211,
3838,
526,
278,
8236,
7636,
29892,
1652,
1131,
459,
29892,
322,
20327,
7636,
310,
278,
1020,
412,
2502,
23670,
4175,
29889,
13,
1678,
450,
1833,
1734,
338,
278,
2362,
5570,
18511,
297,
7159,
17896,
29871,
29955,
29945,
29946,
3402,
29889,
1334,
817,
304,
21822,
445,
731,
310,
848,
13,
1678,
297,
263,
1422,
982,
1135,
278,
916,
4839,
3838,
29889,
13,
1678,
2045,
597,
264,
29889,
6011,
29889,
990,
29914,
4594,
29914,
8673,
17896,
29918,
29955,
29945,
29946,
29937,
8673,
17896,
29918,
29955,
29945,
29946,
29899,
29906,
29900,
29900,
29947,
13,
1678,
2045,
597,
2417,
29889,
510,
29914,
2619,
29914,
29941,
29929,
29945,
29929,
29941,
29900,
29947,
29955,
29914,
8896,
29899,
535,
3259,
29899,
517,
29899,
7099,
3039,
29899,
1767,
29899,
347,
3905,
29899,
29955,
29945,
29946,
29899,
262,
29899,
4691,
13,
1678,
584,
3207,
18392,
29901,
450,
6835,
6943,
278,
18511,
2472,
13,
1678,
584,
2457,
29901,
530,
1409,
411,
278,
3161,
591,
1602,
6797,
29889,
13,
1678,
9995,
13,
1678,
736,
518,
348,
4058,
877,
29902,
742,
18392,
29889,
949,
29898,
17013,
876,
29961,
29900,
1402,
13,
9651,
443,
4058,
877,
29902,
742,
18392,
29889,
949,
29898,
17013,
876,
29961,
29900,
1402,
13,
9651,
443,
4058,
877,
29902,
742,
18392,
29889,
949,
29898,
17013,
876,
29961,
29900,
1402,
13,
9651,
443,
4058,
29898,
29890,
29915,
29966,
29888,
742,
18392,
29889,
949,
29898,
17013,
876,
29961,
29900,
5262,
13,
13,
13,
1753,
21822,
29918,
23176,
29918,
16394,
29898,
9721,
29892,
11105,
1125,
13,
1678,
9995,
13,
1678,
3985,
931,
380,
15092,
2041,
297,
515,
278,
4565,
9451,
29892,
591,
674,
817,
304,
367,
2221,
304,
21822,
963,
577,
393,
13,
1678,
591,
508,
437,
4891,
1788,
931,
8855,
800,
29889,
910,
931,
1736,
3721,
763,
278,
8242,
1741,
931,
13,
1678,
297,
278,
4839,
29889,
13,
1678,
584,
3207,
18392,
29901,
450,
6835,
591,
29915,
645,
367,
1602,
3689,
13,
1678,
584,
3207,
11105,
29901,
450,
11105,
591,
817,
304,
21822,
278,
848,
29889,
13,
1678,
584,
2457,
29901,
13,
1678,
9995,
13,
1678,
736,
518,
348,
4058,
877,
29902,
742,
18392,
29889,
949,
29898,
17013,
876,
29961,
29900,
1402,
13,
9651,
313,
348,
4058,
877,
29902,
742,
18392,
29889,
949,
29898,
17013,
876,
29961,
29900,
29962,
669,
11105,
29889,
3696,
29918,
2230,
29918,
9812,
580,
29961,
29900,
2314,
13,
9651,
5099,
11105,
29889,
3696,
29918,
2230,
29918,
9812,
580,
29961,
29896,
5262,
13,
13,
13,
1753,
21822,
29918,
29939,
13891,
29898,
9721,
1125,
13,
1678,
9995,
13,
1678,
450,
349,
861,
347,
29899,
29896,
29953,
10585,
6314,
660,
12696,
317,
6762,
310,
1269,
7182,
896,
1889,
29889,
2688,
29915,
276,
6087,
297,
29871,
29947,
3838,
29889,
13,
1678,
584,
3207,
18392,
29901,
16534,
6943,
278,
660,
12696,
848,
13,
1678,
584,
2457,
29901,
530,
1409,
6943,
278,
660,
12696,
848,
13,
1678,
9995,
13,
1678,
3855,
13891,
353,
5159,
13,
1678,
363,
19875,
297,
4256,
29898,
3846,
29898,
9721,
29889,
949,
29892,
399,
25593,
511,
289,
4907,
1125,
13,
4706,
3855,
13891,
29889,
4397,
29898,
348,
4058,
877,
29902,
742,
19875,
9601,
29900,
2314,
13,
1678,
736,
3855,
13891,
13,
13,
13,
1753,
21822,
29918,
15003,
29898,
9721,
1125,
13,
1678,
9995,
13,
1678,
349,
861,
347,
29899,
29896,
29953,
14422,
26695,
411,
1023,
11916,
639,
1734,
29889,
910,
338,
1048,
278,
871,
2058,
591,
817,
304,
671,
13,
1678,
263,
4203,
1734,
304,
21822,
278,
848,
3829,
29889,
13,
1678,
584,
3207,
18392,
29901,
450,
6835,
6943,
278,
9637,
29889,
13,
1678,
584,
2457,
29901,
13,
1678,
9995,
13,
1678,
534,
29883,
353,
5159,
13,
1678,
363,
19875,
297,
4256,
29898,
3846,
29898,
9721,
29889,
949,
29892,
379,
1964,
29943,
29918,
17013,
511,
289,
4907,
1125,
13,
4706,
534,
29883,
29889,
4397,
29898,
348,
4058,
877,
29950,
742,
19875,
9601,
29900,
2314,
13,
1678,
736,
534,
29883,
13,
13,
13,
1753,
1889,
29918,
25253,
29918,
6672,
29918,
1272,
29898,
9721,
29892,
4839,
29918,
2848,
29892,
11105,
1125,
13,
1678,
9995,
13,
1678,
10554,
5684,
4839,
848,
565,
896,
1863,
29889,
1334,
817,
304,
6222,
278,
6835,
13623,
297,
1797,
2861,
13,
1678,
304,
920,
278,
848,
3829,
1736,
29889,
450,
1797,
338,
2337,
382,
14605,
4345,
1599,
660,
12696,
1599,
8528,
4945,
29940,
1964,
29918,
15307,
1254,
19297,
313,
2544,
29903,
467,
13,
1678,
960,
697,
310,
278,
2211,
338,
4567,
4129,
1683,
528,
17741,
701,
29889,
13,
1678,
584,
3207,
18392,
29901,
450,
6835,
393,
591,
29915,
645,
367,
5183,
515,
13,
1678,
584,
3207,
4839,
29918,
2848,
29901,
450,
4839,
3309,
577,
393,
591,
1073,
825,
278,
6835,
3743,
29889,
13,
1678,
584,
3207,
11105,
29901,
450,
11105,
393,
591,
817,
304,
1073,
920,
1784,
3838,
1269,
4163,
756,
29889,
13,
1678,
584,
2457,
29901,
319,
8600,
6943,
278,
1602,
6797,
848,
29889,
13,
1678,
9995,
13,
1678,
848,
353,
6571,
13,
1678,
565,
19345,
29907,
2631,
29898,
6672,
29918,
2848,
29897,
297,
518,
401,
363,
775,
297,
19345,
29907,
2631,
565,
376,
2890,
5005,
29908,
297,
775,
29889,
978,
5387,
13,
4706,
848,
1839,
267,
6762,
2033,
353,
320,
13,
9651,
21822,
29918,
27548,
29918,
2083,
29879,
29898,
11207,
5971,
29898,
9721,
29889,
949,
29898,
17013,
334,
11105,
29889,
4537,
29918,
974,
29918,
27548,
29918,
2083,
29918,
9303,
580,
4961,
13,
1678,
565,
19345,
29907,
2631,
29898,
6672,
29918,
2848,
29897,
297,
518,
401,
363,
775,
297,
19345,
29907,
2631,
565,
376,
29984,
12696,
29908,
297,
775,
29889,
978,
5387,
13,
4706,
848,
1839,
29939,
13891,
2033,
353,
21822,
29918,
29939,
13891,
29898,
11207,
5971,
29898,
9721,
29889,
949,
29898,
17013,
334,
11105,
29889,
4537,
29918,
974,
29918,
29939,
13891,
29918,
9303,
580,
4961,
13,
1678,
565,
19345,
29907,
2631,
29898,
6672,
29918,
2848,
29897,
297,
518,
401,
363,
775,
297,
19345,
29907,
2631,
565,
376,
2544,
29903,
29908,
297,
775,
29889,
978,
5387,
13,
4706,
848,
1839,
23176,
29918,
16394,
2033,
353,
21822,
29918,
23176,
29918,
16394,
29898,
13,
9651,
2648,
2167,
5971,
29898,
9721,
29889,
949,
29898,
17013,
334,
11105,
29889,
4537,
29918,
974,
29918,
23176,
29918,
16394,
29918,
9303,
3101,
511,
11105,
29897,
13,
1678,
736,
848,
13,
13,
13,
1753,
21822,
29918,
1761,
8513,
29918,
1272,
29898,
5461,
29892,
11105,
1125,
13,
1678,
9995,
13,
1678,
3826,
2631,
848,
515,
349,
861,
347,
29896,
29953,
7581,
848,
4840,
29889,
1334,
29915,
645,
505,
385,
9815,
1353,
310,
4959,
297,
278,
13,
1678,
848,
6835,
29889,
7857,
29892,
591,
29915,
645,
817,
304,
2425,
975,
278,
6835,
322,
21822,
278,
4959,
408,
591,
748,
29889,
1334,
13,
1678,
3787,
278,
1602,
6797,
4959,
408,
263,
8600,
29892,
322,
1925,
1906,
21503,
4314,
964,
385,
1409,
29889,
13,
1678,
584,
3207,
4840,
29901,
450,
848,
4840,
393,
591,
29915,
645,
367,
1602,
3689,
13,
1678,
584,
3207,
11105,
29901,
450,
7581,
848,
11105,
393,
591,
29915,
645,
817,
304,
21822,
278,
848,
29889,
13,
1678,
9995,
13,
1678,
1602,
6797,
29918,
1272,
29918,
1761,
353,
5159,
13,
1678,
363,
19875,
297,
4256,
29898,
3846,
29898,
5461,
29889,
949,
29892,
399,
25593,
511,
289,
4907,
1125,
13,
4706,
1602,
6797,
29918,
1272,
353,
21822,
29918,
1742,
29918,
9171,
29898,
348,
4058,
877,
29902,
742,
19875,
9601,
29900,
1402,
11105,
29897,
13,
4706,
1602,
6797,
29918,
1272,
29889,
5504,
3319,
13,
9651,
525,
3696,
29918,
2230,
29918,
677,
2396,
443,
4058,
877,
29902,
742,
4840,
29889,
949,
29898,
17013,
876,
29961,
29900,
29962,
1800,
13,
4706,
1602,
6797,
29918,
1272,
29889,
5504,
29898,
13,
9651,
21822,
29918,
1742,
29918,
10184,
29898,
348,
4058,
877,
29902,
742,
4840,
29889,
949,
29898,
17013,
876,
29961,
29900,
1402,
11105,
876,
13,
4706,
1602,
6797,
29918,
1272,
29889,
5504,
29898,
13,
9651,
21822,
29918,
1742,
29918,
17536,
29898,
348,
4058,
877,
29902,
742,
4840,
29889,
949,
29898,
17013,
876,
29961,
29900,
1402,
11105,
876,
13,
13,
4706,
1018,
29901,
13,
9651,
1602,
6797,
29918,
1272,
29889,
5504,
29898,
13,
18884,
1889,
29918,
25253,
29918,
6672,
29918,
1272,
29898,
5461,
29892,
1602,
6797,
29918,
1272,
1839,
6672,
29918,
2848,
7464,
11105,
876,
13,
4706,
5174,
7865,
2392,
29901,
13,
9651,
12020,
16534,
2392,
877,
29965,
13996,
6021,
19345,
365,
1477,
29901,
1273,
29879,
29905,
29876,
29905,
29873,
11341,
3040,
29901,
12750,
2891,
29901,
3210,
2190,
353,
1273,
29879,
16664,
29879,
16664,
29879,
29915,
13,
462,
795,
1273,
313,
7099,
6797,
29918,
1272,
1839,
6672,
29918,
2848,
7464,
1602,
6797,
29918,
1272,
1839,
7283,
403,
7464,
13,
462,
462,
1602,
6797,
29918,
1272,
1839,
2536,
327,
7464,
1602,
6797,
29918,
1272,
1839,
12719,
25901,
13,
13,
4706,
565,
1602,
6797,
29918,
1272,
1839,
15003,
29918,
2848,
2033,
2804,
29871,
29900,
29901,
13,
9651,
565,
1602,
6797,
29918,
1272,
1839,
3696,
29918,
2848,
2033,
448,
1602,
6797,
29918,
1272,
1839,
6672,
29918,
2848,
2033,
320,
13,
462,
1678,
1275,
1602,
6797,
29918,
1272,
1839,
15003,
29918,
2848,
2033,
334,
29871,
29900,
29889,
29945,
29901,
13,
18884,
1602,
6797,
29918,
1272,
29889,
5504,
3319,
29915,
15003,
2396,
21822,
29918,
15003,
29898,
11207,
5971,
29898,
5461,
29889,
949,
29898,
13,
462,
1678,
399,
25593,
334,
938,
29898,
7099,
6797,
29918,
1272,
1839,
15003,
29918,
2848,
2033,
334,
29871,
29900,
29889,
29945,
13697,
1800,
13,
9651,
1683,
29901,
13,
18884,
12020,
7865,
2392,
29898,
13,
462,
1678,
525,
2624,
365,
1477,
313,
29995,
29879,
29897,
947,
451,
1993,
411,
19345,
29414,
29879,
29897,
718,
20597,
313,
29995,
29879,
29897,
365,
1477,
1738,
29915,
1273,
313,
13,
462,
4706,
1602,
6797,
29918,
1272,
1839,
3696,
29918,
2848,
7464,
1602,
6797,
29918,
1272,
1839,
6672,
29918,
2848,
7464,
13,
462,
4706,
1602,
6797,
29918,
1272,
1839,
15003,
29918,
2848,
25901,
13,
13,
4706,
1602,
6797,
29918,
1272,
29918,
1761,
29889,
4397,
29898,
7099,
6797,
29918,
1272,
29897,
13,
1678,
736,
1602,
6797,
29918,
1272,
29918,
1761,
13,
2
] |
deepcompton/scripts/CreateDatasetWithUncertainties.py | vuillaut/DeepIntegralCompton | 1 | 27703 | <gh_stars>1-10
# Deep Learning applique a l'imagerie Compton avec les donnees du satellite INTEGRAL
# Hackatlon AstroInfo 2021
##___ Importations
import numpy as np
import matplotlib.pyplot as plt
import Utilitaires_Compton as compton
import pickle as pkl
from os import listdir
from sys import setrecursionlimit
# ___ Constantes
Ee = 511
z_isgri = 0 # position plan ISGRI -> 0
z_picsit = -8.68 # position plan PICSIT -> distance entre les deux plans
r = 100000000000000.
precision = 5000.
## ___ Fonctions
def angular_separation(colat1, long1, colat2, long2):
"""
Compute the angular separation in radians
between two pointing direction given with lat-long
Parameters
----------
lat1: 1d `numpy.ndarray` , latitude of the first pointing direction
long1: 1d `numpy.ndarray` longitude of the first pointing direction
lat2: 1d `numpy.ndarray`, latitude of the second pointing direction
long2: 1d `numpy.ndarray`, longitude of the second pointing direction
Returns
-------
1d `numpy.ndarray`, angular separation
"""
cosdelta = np.sin(colat1) * np.sin(colat2) * np.cos(
(long1 - long2)) + np.cos(colat1) * np.cos(colat2)
cosdelta[cosdelta > 1] = 1.
cosdelta[cosdelta < -1] = -1.
ang_sep = np.arccos(cosdelta)
return ang_sep
def AddFunction_DistCone(f1,f2):
"""Somme de deux fonctions produisant une distribution
pour un ou plusieurs cones.
"""
return lambda l,c : f1(l,c) + f2(l,c)
def Cone_param(pos1x,pos1y,energ1,pos2x,pos2y,energ2) :
""" Retourne les parametres theta, phi et cottheta d'un cone
a partir des observations pos1x,pos1y,energ1,pos2x,pos2y,energ2.
retourne None si l'energie limite est atteinte.
-----------
Attention :
indice 1 : ISGRI, indice 2 : PICsIT
"""
x1cur = z_isgri
y1cur = pos1y
z1cur = -pos1x
x2cur = z_picsit
y2cur = pos2y
z2cur = -pos2x
E0 = energ1 + energ2
Ec = E0/(1+2*E0/Ee)
if (energ2 >= Ec) and (energ1 <= E0 - Ec):
cotheta = compton.cottheta(energ1,E0 - energ1)
A = np.array([x1cur,y1cur,z1cur])
B = np.array([x2cur,y2cur,z2cur])
theta = compton.colatitudeaxe(B,A)
phi = compton.longitudeaxe(B,A)
return theta, phi, cotheta
else :
return None
def Normal(delta_x,sigma):
"""Loi normale
"""
return 1/(sigma * np.sqrt(np.pi)) * np.exp(-1/2*(delta_x /sigma)**2)
def DistriCone_v3_2D(theta, phi, cottheta, sigma ):
""" Retourne la distribution associee au cone de parametres theta, phi, cottheta.
c'est-a-dire le cone plus une incertitude gaussienne de parametre sigma.
"""
def f_2D(l,c) :
"""l et c 2D
output 2D
"""
theta_list = np.full_like(c, theta)
phi_list = np.full_like(l, phi)
e = angular_separation(theta_list, phi_list,
np.radians(c), np.radians(l))
delta = e - np.arctan(1/cottheta)
return Normal(delta,np.radians(sigma))
return f_2D
def Create_image(data, n_cones, sigma = 2, grid_longit = np.linspace(0, 359, 180), grid_colat = np.linspace(0, 89, 45) ):
""" A partir des data simulees ou observees, creation d'une image sur la grille (grid_longit, grid_colat).
Pour cela on applique sur cette grille la fonction cumulant n_cones distributions produites avec n_cones evenements
de data, tires aleatoirement. Ces distributions gaussiennes ont une incertitude sigma.
"""
# ___ Load data
s = data.shape[0]
# ISGRI -> 1
E1_list = data[:,0]
Y1_list = data[:,6]
Z1_list = data[:,7]
#PICsIT -> 2
E2_list = data[:,1]
Y2_list = data[:,8]
Z2_list = data[:,9]
# ___ Create distribution
f_v3 = lambda l,c : 0
for i in np.random.randint(0,s,size = n_cones) :
L = Cone_param(Y1_list[i],Z1_list[i],E1_list[i],Y2_list[i],Z2_list[i],E2_list[i])
if L!= None :
theta, phi, cottheta = L
f_new = DistriCone_v3_2D(theta, phi, cottheta, sigma = sigma)
f_v3 = AddFunction_DistCone(f_v3,f_new)
# ___ Application on image
l, c = np.meshgrid(grid_colat, grid_longit)
im = f_v3(c,l)
return im
def Create_dataset(name_file_list,path, name_pkl, n_file_max = -1, n_image_file = 50, n_cones_min = 100, n_cones_max = 2000, sigma = 2):
""" Creation d'un dataset a partir d'une liste de fichiers path+name_file_list.
A partir de n_file_max fichiers, on tire n_image_file images par fichier
avec un nombre de cones variant aleatoirement entre n_cones_min et n_cones_max.
Le dataset est enregistre dans un pkl nomme name_pkl.
"""
y,x=[],[]
i=0
for name_file in name_file_list[:n_file_max] :
i+=1
_,theta,_,phi=name_file.replace(".npy","").split("_")
j=0
for n_cones in np.random.randint(n_cones_min,n_cones_max+1,size = n_image_file) :
data = np.load(path+name_file).astype("float64")
if len(data)>0:
#print(f"\r file n°{i}/{n_file_max}, image n°{j}/{n_image_file} ", end='', flush=True)
data = Create_image(data, n_cones, sigma = sigma)
y.append([float(theta),float(phi),n_cones])
x.append(data)
j+=1
if len(y)%100 == 0:
nx,ny = pkl.load(open(name_pkl, "rb"))
nx+=x
ny+=y
pkl.dump((nx,ny), open(name_pkl, "wb"))
x.clear()
y.clear()
nx,ny = pkl.load(open(name_pkl, "rb"))
nx+=x
ny+=y
pkl.dump((nx,ny), open(name_pkl, "wb"))
return 0
## ___ Script
path = '/Users/lg265853/Documents/AstroInfo/save_Compton'
name_file_list = listdir(path)
n_file_max = -1
n_image_file = 100
n_cones_min = 100
n_cones_max = 2000
sigma = 2
name_pkl = f'dataset_{n_image_file}images_{n_file_max}files_sig{sigma}_ncones{n_cones_min}-{n_cones_max}.pkl'
setrecursionlimit(n_cones_max)
Create_dataset(name_file_list,path+'/',name_pkl,n_file_max, n_image_file, n_cones_min, n_cones_max, sigma)
## ___ Verification
#x,y = pkl.load(open(name_pkl, "rb"))
#print(len(x), len(y))
#
#plt.figure(figsize=(20,20))
#k = 1
#for i in np.random.randint(0,len(x),size = 30):
# plt.subplot(3,10,k)
# plt.imshow(x[i], origin='lower', cmap = 'CMRmap_r')
# plt.scatter(y[i][0]/2,y[i][1]/2)
# plt.title(str(y[i][2]) + ' cones')
# plt.xlabel('colatitude') ; plt.ylabel('longitude')
# k+=1
#
#plt.show()
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
29937,
21784,
29257,
623,
9854,
263,
301,
29915,
326,
1875,
347,
422,
12533,
2535,
966,
18332,
267,
868,
28421,
2672,
4330,
14345,
1964,
13,
29937,
379,
547,
271,
12957,
10186,
307,
3401,
29871,
29906,
29900,
29906,
29896,
13,
13,
13,
2277,
22359,
16032,
800,
13,
13,
5215,
12655,
408,
7442,
13,
5215,
22889,
29889,
2272,
5317,
408,
14770,
13,
13,
5215,
22310,
277,
7147,
29918,
1523,
12533,
408,
419,
12533,
13,
5215,
5839,
280,
408,
282,
6321,
13,
3166,
2897,
1053,
1051,
3972,
13,
3166,
10876,
1053,
731,
3757,
1295,
291,
13400,
13,
13,
13,
29937,
903,
1649,
5798,
3794,
13,
13,
29923,
29872,
353,
29871,
29945,
29896,
29896,
13,
29920,
29918,
275,
29887,
374,
353,
29871,
29900,
396,
2602,
3814,
8519,
29954,
3960,
1599,
29871,
29900,
13,
29920,
29918,
29886,
1199,
277,
353,
448,
29947,
29889,
29953,
29947,
29871,
396,
2602,
3814,
349,
2965,
29903,
1806,
1599,
5418,
2637,
966,
4239,
13900,
13,
29878,
353,
29871,
29896,
29900,
29900,
29900,
29900,
29900,
29900,
29900,
29900,
29900,
29900,
29900,
29900,
29900,
29900,
29889,
13,
17990,
2459,
353,
29871,
29945,
29900,
29900,
29900,
29889,
13,
13,
13,
13,
2277,
903,
1649,
28724,
1953,
13,
13,
1753,
6401,
29918,
25048,
362,
29898,
1054,
271,
29896,
29892,
1472,
29896,
29892,
784,
271,
29906,
29892,
1472,
29906,
1125,
13,
1678,
9995,
13,
1678,
11796,
29872,
278,
6401,
23683,
297,
2971,
5834,
13,
1678,
1546,
1023,
13330,
5305,
2183,
411,
3405,
29899,
5426,
13,
1678,
12662,
2699,
13,
1678,
448,
1378,
29899,
13,
1678,
3405,
29896,
29901,
29871,
29896,
29881,
421,
23749,
29889,
299,
2378,
29952,
1919,
26271,
310,
278,
937,
13330,
5305,
13,
1678,
1472,
29896,
29901,
29871,
29896,
29881,
421,
23749,
29889,
299,
2378,
29952,
28745,
310,
278,
937,
13330,
5305,
13,
1678,
3405,
29906,
29901,
29871,
29896,
29881,
421,
23749,
29889,
299,
2378,
1673,
26271,
310,
278,
1473,
13330,
5305,
13,
1678,
1472,
29906,
29901,
29871,
29896,
29881,
421,
23749,
29889,
299,
2378,
1673,
28745,
310,
278,
1473,
13330,
5305,
13,
1678,
16969,
13,
1678,
448,
22158,
13,
268,
29896,
29881,
421,
23749,
29889,
299,
2378,
1673,
6401,
23683,
13,
1678,
9995,
13,
13,
1678,
6776,
4181,
353,
7442,
29889,
5223,
29898,
1054,
271,
29896,
29897,
334,
7442,
29889,
5223,
29898,
1054,
271,
29906,
29897,
334,
7442,
29889,
3944,
29898,
13,
4706,
313,
5426,
29896,
448,
1472,
29906,
876,
718,
7442,
29889,
3944,
29898,
1054,
271,
29896,
29897,
334,
7442,
29889,
3944,
29898,
1054,
271,
29906,
29897,
13,
13,
1678,
6776,
4181,
29961,
3944,
4181,
1405,
29871,
29896,
29962,
353,
29871,
29896,
29889,
13,
1678,
6776,
4181,
29961,
3944,
4181,
529,
448,
29896,
29962,
353,
448,
29896,
29889,
13,
13,
1678,
2614,
29918,
19570,
353,
7442,
29889,
279,
617,
359,
29898,
3944,
4181,
29897,
13,
1678,
736,
2614,
29918,
19570,
13,
13,
13,
1753,
3462,
6678,
29918,
13398,
29907,
650,
29898,
29888,
29896,
29892,
29888,
29906,
1125,
13,
1678,
9995,
29903,
290,
1004,
316,
4239,
10866,
1953,
1391,
275,
424,
1597,
4978,
29871,
13,
1678,
1671,
443,
2123,
10741,
378,
267,
29889,
13,
1678,
9995,
13,
1678,
736,
14013,
301,
29892,
29883,
584,
285,
29896,
29898,
29880,
29892,
29883,
29897,
718,
285,
29906,
29898,
29880,
29892,
29883,
29897,
13,
13,
13,
1753,
315,
650,
29918,
3207,
29898,
1066,
29896,
29916,
29892,
1066,
29896,
29891,
29892,
759,
29887,
29896,
29892,
1066,
29906,
29916,
29892,
1066,
29906,
29891,
29892,
759,
29887,
29906,
29897,
584,
13,
1678,
9995,
4649,
473,
484,
966,
25011,
690,
278,
941,
29892,
1374,
29875,
634,
20118,
3416,
270,
29915,
348,
27843,
13,
1678,
263,
8019,
553,
13917,
926,
29896,
29916,
29892,
1066,
29896,
29891,
29892,
759,
29887,
29896,
29892,
1066,
29906,
29916,
29892,
1066,
29906,
29891,
29892,
759,
29887,
29906,
29889,
13,
1678,
18948,
484,
6213,
1354,
301,
29915,
759,
12053,
2485,
568,
707,
21609,
6693,
29889,
13,
1678,
448,
28400,
13,
1678,
6212,
2509,
584,
13,
1678,
1399,
625,
29871,
29896,
584,
8519,
29954,
3960,
29892,
1399,
625,
29871,
29906,
584,
349,
2965,
29879,
1806,
13,
1678,
9995,
13,
1678,
921,
29896,
2764,
353,
503,
29918,
275,
29887,
374,
13,
1678,
343,
29896,
2764,
353,
926,
29896,
29891,
13,
1678,
503,
29896,
2764,
353,
448,
1066,
29896,
29916,
13,
268,
13,
1678,
921,
29906,
2764,
353,
503,
29918,
29886,
1199,
277,
13,
1678,
343,
29906,
2764,
353,
926,
29906,
29891,
13,
1678,
503,
29906,
2764,
353,
448,
1066,
29906,
29916,
13,
268,
13,
1678,
382,
29900,
353,
18190,
29896,
718,
18190,
29906,
13,
268,
13,
1678,
382,
29883,
353,
382,
29900,
14571,
29896,
29974,
29906,
29930,
29923,
29900,
29914,
29923,
29872,
29897,
29871,
13,
268,
13,
1678,
565,
313,
759,
29887,
29906,
6736,
382,
29883,
29897,
322,
313,
759,
29887,
29896,
5277,
382,
29900,
448,
382,
29883,
1125,
13,
4706,
274,
720,
1187,
353,
419,
12533,
29889,
26235,
3416,
29898,
759,
29887,
29896,
29892,
29923,
29900,
448,
18190,
29896,
29897,
13,
4706,
319,
353,
7442,
29889,
2378,
4197,
29916,
29896,
2764,
29892,
29891,
29896,
2764,
29892,
29920,
29896,
2764,
2314,
13,
4706,
350,
353,
7442,
29889,
2378,
4197,
29916,
29906,
2764,
29892,
29891,
29906,
2764,
29892,
29920,
29906,
2764,
2314,
13,
13,
4706,
278,
941,
353,
419,
12533,
29889,
1054,
271,
4279,
1165,
29872,
29898,
29933,
29892,
29909,
29897,
13,
4706,
1374,
29875,
353,
419,
12533,
29889,
5426,
4279,
1165,
29872,
29898,
29933,
29892,
29909,
29897,
13,
308,
13,
4706,
736,
278,
941,
29892,
1374,
29875,
29892,
274,
720,
1187,
13,
268,
13,
1678,
1683,
584,
13,
4706,
736,
6213,
13,
13,
268,
13,
1753,
21981,
29898,
4181,
29918,
29916,
29892,
3754,
1125,
13,
1678,
9995,
3410,
29875,
6056,
744,
13,
1678,
9995,
13,
1678,
736,
29871,
29896,
14571,
3754,
334,
7442,
29889,
3676,
29898,
9302,
29889,
1631,
876,
334,
7442,
29889,
4548,
6278,
29896,
29914,
29906,
16395,
4181,
29918,
29916,
847,
3754,
29897,
1068,
29906,
29897,
13,
13,
13,
1753,
6652,
374,
29907,
650,
29918,
29894,
29941,
29918,
29906,
29928,
29898,
3416,
29892,
1374,
29875,
29892,
20118,
3416,
29892,
269,
2934,
29871,
1125,
13,
1678,
9995,
4649,
473,
484,
425,
4978,
1223,
542,
347,
29872,
782,
27843,
316,
25011,
690,
278,
941,
29892,
1374,
29875,
29892,
20118,
3416,
29889,
13,
1678,
274,
29915,
342,
29899,
29874,
29899,
20146,
454,
27843,
2298,
1597,
5528,
814,
4279,
330,
11214,
7081,
316,
25011,
276,
269,
2934,
29889,
13,
1678,
9995,
13,
268,
13,
1678,
822,
285,
29918,
29906,
29928,
29898,
29880,
29892,
29883,
29897,
584,
13,
4706,
9995,
29880,
634,
274,
29871,
29906,
29928,
13,
4706,
1962,
29871,
29906,
29928,
13,
4706,
9995,
13,
4706,
278,
941,
29918,
1761,
353,
7442,
29889,
8159,
29918,
4561,
29898,
29883,
29892,
278,
941,
29897,
13,
4706,
1374,
29875,
29918,
1761,
353,
7442,
29889,
8159,
29918,
4561,
29898,
29880,
29892,
1374,
29875,
29897,
13,
308,
13,
4706,
321,
353,
6401,
29918,
25048,
362,
29898,
3416,
29918,
1761,
29892,
1374,
29875,
29918,
1761,
29892,
29871,
13,
462,
1669,
7442,
29889,
3665,
5834,
29898,
29883,
511,
7442,
29889,
3665,
5834,
29898,
29880,
876,
13,
4706,
19471,
353,
321,
448,
7442,
29889,
27014,
273,
29898,
29896,
29914,
26235,
3416,
29897,
13,
4706,
736,
21981,
29898,
4181,
29892,
9302,
29889,
3665,
5834,
29898,
3754,
876,
13,
268,
13,
1678,
736,
285,
29918,
29906,
29928,
13,
13,
13,
13,
1753,
6204,
29918,
3027,
29898,
1272,
29892,
302,
29918,
535,
267,
29892,
269,
2934,
353,
29871,
29906,
29892,
6856,
29918,
5426,
277,
353,
7442,
29889,
1915,
3493,
29898,
29900,
29892,
29871,
29941,
29945,
29929,
29892,
29871,
29896,
29947,
29900,
511,
6856,
29918,
1054,
271,
353,
7442,
29889,
1915,
3493,
29898,
29900,
29892,
29871,
29947,
29929,
29892,
29871,
29946,
29945,
29897,
29871,
1125,
13,
1678,
9995,
319,
8019,
553,
848,
1027,
1297,
267,
2123,
14111,
267,
29892,
11265,
270,
29915,
1540,
1967,
1190,
425,
867,
1924,
313,
7720,
29918,
5426,
277,
29892,
6856,
29918,
1054,
271,
467,
13,
1678,
6803,
18729,
373,
623,
9854,
1190,
5278,
867,
1924,
425,
18165,
13299,
352,
424,
302,
29918,
535,
267,
18822,
1391,
3246,
2535,
302,
29918,
535,
267,
1584,
4110,
13,
1678,
316,
848,
29892,
260,
2658,
8080,
1219,
19211,
29889,
12390,
18822,
330,
11214,
27033,
4625,
1597,
5528,
814,
4279,
269,
2934,
29889,
13,
1678,
9995,
13,
268,
13,
1678,
396,
903,
1649,
16012,
848,
13,
1678,
269,
353,
848,
29889,
12181,
29961,
29900,
29962,
13,
1678,
396,
8519,
29954,
3960,
1599,
29871,
29896,
13,
1678,
382,
29896,
29918,
1761,
353,
848,
7503,
29892,
29900,
29962,
13,
1678,
612,
29896,
29918,
1761,
353,
848,
7503,
29892,
29953,
29962,
13,
1678,
796,
29896,
29918,
1761,
353,
848,
7503,
29892,
29955,
29962,
13,
1678,
396,
2227,
29907,
29879,
1806,
1599,
29871,
29906,
13,
1678,
382,
29906,
29918,
1761,
353,
848,
7503,
29892,
29896,
29962,
13,
1678,
612,
29906,
29918,
1761,
353,
848,
7503,
29892,
29947,
29962,
13,
1678,
796,
29906,
29918,
1761,
353,
848,
7503,
29892,
29929,
29962,
13,
268,
13,
1678,
396,
903,
1649,
6204,
4978,
13,
1678,
285,
29918,
29894,
29941,
353,
14013,
301,
29892,
29883,
584,
29871,
29900,
29871,
13,
13,
1678,
363,
474,
297,
7442,
29889,
8172,
29889,
9502,
524,
29898,
29900,
29892,
29879,
29892,
2311,
353,
302,
29918,
535,
267,
29897,
584,
13,
4706,
365,
353,
315,
650,
29918,
3207,
29898,
29979,
29896,
29918,
1761,
29961,
29875,
1402,
29999,
29896,
29918,
1761,
29961,
29875,
1402,
29923,
29896,
29918,
1761,
29961,
29875,
1402,
29979,
29906,
29918,
1761,
29961,
29875,
1402,
29999,
29906,
29918,
1761,
29961,
29875,
1402,
29923,
29906,
29918,
1761,
29961,
29875,
2314,
13,
4706,
565,
365,
19216,
6213,
584,
13,
9651,
278,
941,
29892,
1374,
29875,
29892,
20118,
3416,
353,
365,
13,
9651,
285,
29918,
1482,
353,
6652,
374,
29907,
650,
29918,
29894,
29941,
29918,
29906,
29928,
29898,
3416,
29892,
1374,
29875,
29892,
20118,
3416,
29892,
269,
2934,
353,
269,
2934,
29897,
13,
9651,
285,
29918,
29894,
29941,
353,
3462,
6678,
29918,
13398,
29907,
650,
29898,
29888,
29918,
29894,
29941,
29892,
29888,
29918,
1482,
29897,
13,
13,
1678,
396,
903,
1649,
8427,
373,
1967,
29871,
13,
1678,
301,
29892,
274,
353,
7442,
29889,
4467,
29882,
7720,
29898,
7720,
29918,
1054,
271,
29892,
6856,
29918,
5426,
277,
29897,
13,
1678,
527,
353,
285,
29918,
29894,
29941,
29898,
29883,
29892,
29880,
29897,
13,
268,
13,
1678,
736,
527,
13,
13,
13,
1753,
6204,
29918,
24713,
29898,
978,
29918,
1445,
29918,
1761,
29892,
2084,
29892,
1024,
29918,
29886,
6321,
29892,
302,
29918,
1445,
29918,
3317,
353,
448,
29896,
29892,
302,
29918,
3027,
29918,
1445,
353,
29871,
29945,
29900,
29892,
302,
29918,
535,
267,
29918,
1195,
353,
29871,
29896,
29900,
29900,
29892,
302,
29918,
535,
267,
29918,
3317,
353,
29871,
29906,
29900,
29900,
29900,
29892,
269,
2934,
353,
29871,
29906,
1125,
13,
1678,
9995,
6760,
362,
270,
29915,
348,
8783,
263,
8019,
270,
29915,
1540,
13773,
316,
285,
436,
4285,
2224,
29974,
978,
29918,
1445,
29918,
1761,
29889,
13,
1678,
319,
8019,
316,
302,
29918,
1445,
29918,
3317,
285,
436,
4285,
29892,
373,
260,
533,
302,
29918,
3027,
29918,
1445,
4558,
610,
285,
436,
631,
29871,
13,
1678,
2535,
443,
5419,
316,
378,
267,
17305,
8080,
1219,
19211,
2637,
302,
29918,
535,
267,
29918,
1195,
634,
302,
29918,
535,
267,
29918,
3317,
29889,
13,
1678,
951,
8783,
707,
427,
1727,
22715,
1465,
443,
282,
6321,
2245,
1004,
1024,
29918,
29886,
6321,
29889,
13,
1678,
9995,
13,
1678,
343,
29892,
29916,
11759,
1402,
2636,
13,
1678,
474,
29922,
29900,
13,
1678,
363,
1024,
29918,
1445,
297,
1024,
29918,
1445,
29918,
1761,
7503,
29876,
29918,
1445,
29918,
3317,
29962,
584,
13,
4706,
474,
23661,
29896,
13,
4706,
17117,
3416,
29892,
3383,
2876,
29922,
978,
29918,
1445,
29889,
6506,
17350,
29876,
2272,
3284,
2564,
5451,
703,
29918,
1159,
13,
4706,
432,
29922,
29900,
13,
4706,
363,
302,
29918,
535,
267,
297,
7442,
29889,
8172,
29889,
9502,
524,
29898,
29876,
29918,
535,
267,
29918,
1195,
29892,
29876,
29918,
535,
267,
29918,
3317,
29974,
29896,
29892,
2311,
353,
302,
29918,
3027,
29918,
1445,
29897,
584,
13,
9651,
848,
353,
7442,
29889,
1359,
29898,
2084,
29974,
978,
29918,
1445,
467,
579,
668,
703,
7411,
29953,
29946,
1159,
13,
9651,
565,
7431,
29898,
1272,
15410,
29900,
29901,
13,
18884,
396,
2158,
29898,
29888,
26732,
29878,
934,
302,
30073,
29912,
29875,
6822,
29912,
29876,
29918,
1445,
29918,
3317,
1118,
1967,
302,
30073,
29912,
29926,
6822,
29912,
29876,
29918,
3027,
29918,
1445,
29913,
9162,
1095,
2433,
742,
28371,
29922,
5574,
29897,
13,
18884,
848,
353,
29871,
6204,
29918,
3027,
29898,
1272,
29892,
302,
29918,
535,
267,
29892,
269,
2934,
353,
269,
2934,
29897,
13,
18884,
343,
29889,
4397,
4197,
7411,
29898,
3416,
511,
7411,
29898,
2876,
511,
29876,
29918,
535,
267,
2314,
13,
18884,
921,
29889,
4397,
29898,
1272,
29897,
13,
18884,
432,
23661,
29896,
13,
9651,
565,
7431,
29898,
29891,
29897,
29995,
29896,
29900,
29900,
1275,
29871,
29900,
29901,
13,
18884,
302,
29916,
29892,
1460,
353,
282,
6321,
29889,
1359,
29898,
3150,
29898,
978,
29918,
29886,
6321,
29892,
376,
6050,
5783,
13,
18884,
302,
29916,
23661,
29916,
13,
18884,
7098,
23661,
29891,
13,
18884,
282,
6321,
29889,
15070,
3552,
23818,
29892,
1460,
511,
1722,
29898,
978,
29918,
29886,
6321,
29892,
376,
29893,
29890,
5783,
13,
18884,
921,
29889,
8551,
580,
13,
18884,
343,
29889,
8551,
580,
13,
1678,
302,
29916,
29892,
1460,
353,
282,
6321,
29889,
1359,
29898,
3150,
29898,
978,
29918,
29886,
6321,
29892,
376,
6050,
5783,
13,
1678,
302,
29916,
23661,
29916,
13,
1678,
7098,
23661,
29891,
13,
1678,
282,
6321,
29889,
15070,
3552,
23818,
29892,
1460,
511,
1722,
29898,
978,
29918,
29886,
6321,
29892,
376,
29893,
29890,
5783,
13,
1678,
736,
29871,
29900,
13,
13,
13,
13,
13,
2277,
903,
1649,
14415,
13,
13,
2084,
353,
8207,
5959,
29914,
19920,
29906,
29953,
29945,
29947,
29945,
29941,
29914,
20128,
29914,
29909,
303,
307,
3401,
29914,
7620,
29918,
1523,
12533,
29915,
13,
978,
29918,
1445,
29918,
1761,
353,
1051,
3972,
29898,
2084,
29897,
13,
13,
29876,
29918,
1445,
29918,
3317,
353,
448,
29896,
13,
29876,
29918,
3027,
29918,
1445,
353,
29871,
29896,
29900,
29900,
13,
29876,
29918,
535,
267,
29918,
1195,
353,
29871,
29896,
29900,
29900,
13,
29876,
29918,
535,
267,
29918,
3317,
353,
29871,
29906,
29900,
29900,
29900,
13,
3754,
353,
29871,
29906,
13,
978,
29918,
29886,
6321,
353,
285,
29915,
24713,
648,
29876,
29918,
3027,
29918,
1445,
29913,
8346,
648,
29876,
29918,
1445,
29918,
3317,
29913,
5325,
29918,
18816,
29912,
3754,
2403,
29876,
535,
267,
29912,
29876,
29918,
535,
267,
29918,
1195,
7402,
29912,
29876,
29918,
535,
267,
29918,
3317,
1836,
29886,
6321,
29915,
13,
13,
13,
842,
3757,
1295,
291,
13400,
29898,
29876,
29918,
535,
267,
29918,
3317,
29897,
13,
13,
4391,
29918,
24713,
29898,
978,
29918,
1445,
29918,
1761,
29892,
2084,
23097,
29914,
742,
978,
29918,
29886,
6321,
29892,
29876,
29918,
1445,
29918,
3317,
29892,
302,
29918,
3027,
29918,
1445,
29892,
302,
29918,
535,
267,
29918,
1195,
29892,
302,
29918,
535,
267,
29918,
3317,
29892,
269,
2934,
29897,
13,
13,
13,
13,
13,
2277,
903,
1649,
1798,
2450,
13,
13,
29937,
29916,
29892,
29891,
353,
282,
6321,
29889,
1359,
29898,
3150,
29898,
978,
29918,
29886,
6321,
29892,
376,
6050,
5783,
29871,
13,
29937,
2158,
29898,
2435,
29898,
29916,
511,
7431,
29898,
29891,
876,
13,
29937,
13,
29937,
572,
29873,
29889,
4532,
29898,
1003,
2311,
7607,
29906,
29900,
29892,
29906,
29900,
876,
13,
29937,
29895,
353,
29871,
29896,
13,
29937,
1454,
474,
297,
7442,
29889,
8172,
29889,
9502,
524,
29898,
29900,
29892,
2435,
29898,
29916,
511,
2311,
353,
29871,
29941,
29900,
1125,
13,
29937,
1678,
14770,
29889,
1491,
5317,
29898,
29941,
29892,
29896,
29900,
29892,
29895,
29897,
13,
29937,
1678,
14770,
29889,
326,
4294,
29898,
29916,
29961,
29875,
1402,
3978,
2433,
13609,
742,
274,
1958,
353,
525,
29907,
21055,
1958,
29918,
29878,
1495,
13,
29937,
1678,
14770,
29889,
1557,
2620,
29898,
29891,
29961,
29875,
3816,
29900,
16261,
29906,
29892,
29891,
29961,
29875,
3816,
29896,
16261,
29906,
29897,
13,
29937,
1678,
14770,
29889,
3257,
29898,
710,
29898,
29891,
29961,
29875,
3816,
29906,
2314,
718,
525,
378,
267,
1495,
13,
29937,
1678,
14770,
29889,
29916,
1643,
877,
1054,
271,
4279,
1495,
2056,
14770,
29889,
29891,
1643,
877,
5426,
4279,
1495,
3986,
13,
29937,
1678,
413,
23661,
29896,
13,
29937,
13,
29937,
572,
29873,
29889,
4294,
580,
13,
2
] |
api/src/controller/feature/FeatureDataController.py | SamuelJansen/FeatureManager | 1 | 46706 | from python_framework import Controller, ControllerMethod, HttpStatus
from Role import *
from dto.FeatureDataDto import *
@Controller(url = '/feature-datas', tag='FeatureData', description='Single FeatureData controller')
class FeatureDataController:
@ControllerMethod(url='/<string:featureKey>/<string:sampleKey>',
responseClass=FeatureDataResponseDto,
roleRequired=[USER, ADMIN, API])
def get(self, featureKey, sampleKey):
return self.service.featureData.queryByFeatureKeyAndSampleKey(featureKey, sampleKey), HttpStatus.OK
@ControllerMethod(url='/<string:featureKey>/<string:sampleKey>',
roleRequired=[USER, ADMIN, API])
def delete(self, featureKey, sampleKey):
self.service.featureData.deleteByFeatureKeyAndSampleKey(featureKey, sampleKey), HttpStatus.NO_CONTENT
return {}, HttpStatus.NO_CONTENT
@Controller(url = '/feature-datas/batch', tag='FeatureData', description='Multiple FeatureData controller')
class FeatureDataBatchController:
@ControllerMethod(url='/<string:featureKey>',
responseClass=[[FeatureDataResponseDto]],
roleRequired=[ADMIN, API])
def get(self, featureKey):
return self.service.featureData.queryAllByFeatureKey(featureKey), HttpStatus.OK
| [
1,
515,
3017,
29918,
4468,
1053,
15830,
29892,
15830,
4062,
29892,
9056,
5709,
13,
3166,
1528,
280,
1053,
334,
13,
13,
3166,
270,
517,
29889,
19132,
1469,
29928,
517,
1053,
334,
13,
13,
29992,
2956,
29898,
2271,
353,
8207,
14394,
29899,
14538,
742,
4055,
2433,
19132,
1469,
742,
6139,
2433,
15771,
5169,
1535,
1469,
4701,
1495,
13,
1990,
5169,
1535,
1469,
2956,
29901,
13,
13,
1678,
732,
2956,
4062,
29898,
2271,
2433,
29914,
29966,
1807,
29901,
14394,
2558,
20690,
29966,
1807,
29901,
11249,
2558,
29958,
742,
13,
4706,
2933,
2385,
29922,
19132,
1469,
5103,
29928,
517,
29892,
13,
4706,
6297,
19347,
11759,
11889,
29892,
11033,
16173,
29892,
3450,
2314,
13,
1678,
822,
679,
29898,
1311,
29892,
4682,
2558,
29892,
4559,
2558,
1125,
13,
4706,
736,
1583,
29889,
5509,
29889,
14394,
1469,
29889,
1972,
2059,
19132,
2558,
2855,
17708,
2558,
29898,
14394,
2558,
29892,
4559,
2558,
511,
9056,
5709,
29889,
8949,
13,
13,
1678,
732,
2956,
4062,
29898,
2271,
2433,
29914,
29966,
1807,
29901,
14394,
2558,
20690,
29966,
1807,
29901,
11249,
2558,
29958,
742,
13,
4706,
6297,
19347,
11759,
11889,
29892,
11033,
16173,
29892,
3450,
2314,
13,
1678,
822,
5217,
29898,
1311,
29892,
4682,
2558,
29892,
4559,
2558,
1125,
13,
4706,
1583,
29889,
5509,
29889,
14394,
1469,
29889,
8143,
2059,
19132,
2558,
2855,
17708,
2558,
29898,
14394,
2558,
29892,
4559,
2558,
511,
9056,
5709,
29889,
6632,
29918,
22412,
3919,
13,
4706,
736,
24335,
9056,
5709,
29889,
6632,
29918,
22412,
3919,
13,
13,
13,
29992,
2956,
29898,
2271,
353,
8207,
14394,
29899,
14538,
29914,
16175,
742,
4055,
2433,
19132,
1469,
742,
6139,
2433,
15329,
552,
5169,
1535,
1469,
4701,
1495,
13,
1990,
5169,
1535,
1469,
23145,
2956,
29901,
13,
13,
1678,
732,
2956,
4062,
29898,
2271,
2433,
29914,
29966,
1807,
29901,
14394,
2558,
29958,
742,
13,
4706,
2933,
2385,
29922,
8999,
19132,
1469,
5103,
29928,
517,
20526,
13,
4706,
6297,
19347,
11759,
3035,
16173,
29892,
3450,
2314,
13,
1678,
822,
679,
29898,
1311,
29892,
4682,
2558,
1125,
13,
4706,
736,
1583,
29889,
5509,
29889,
14394,
1469,
29889,
1972,
3596,
2059,
19132,
2558,
29898,
14394,
2558,
511,
9056,
5709,
29889,
8949,
13,
2
] |
inlineedit/apps.py | VolkerGoeschl/django-inlineedit | 0 | 60419 | <reponame>VolkerGoeschl/django-inlineedit<filename>inlineedit/apps.py
from django.apps import AppConfig
class InlineeditConfig(AppConfig):
label = "inlineedit"
name = 'inlineedit'
| [
1,
529,
276,
1112,
420,
29958,
13072,
3946,
8120,
1968,
29880,
29914,
14095,
29899,
14764,
5628,
29966,
9507,
29958,
14764,
5628,
29914,
13371,
29889,
2272,
13,
3166,
9557,
29889,
13371,
1053,
2401,
3991,
13,
13,
13,
1990,
512,
1220,
5628,
3991,
29898,
2052,
3991,
1125,
13,
1678,
3858,
353,
376,
14764,
5628,
29908,
13,
1678,
1024,
353,
525,
14764,
5628,
29915,
13,
2
] |
pyvisdk/enums/file_system_interface_version.py | Infinidat/pyvisdk | 0 | 99683 |
########################################
# Automatically generated, do not edit.
########################################
from pyvisdk.thirdparty import Enum
FileSystemInterfaceVersion = Enum(
'NFSV3_0',
)
| [
1,
29871,
13,
13383,
13383,
7346,
13,
29937,
15854,
19574,
5759,
29892,
437,
451,
3863,
29889,
13,
13383,
13383,
7346,
13,
13,
13,
3166,
11451,
1730,
8181,
29889,
22585,
22633,
1053,
1174,
398,
13,
13,
2283,
3924,
10448,
6594,
353,
1174,
398,
29898,
13,
1678,
525,
22498,
7597,
29941,
29918,
29900,
742,
13,
13,
29897,
13,
2
] |
client/Agent/stare.py | zhanglei/Qalarm | 1 | 81087 | from os import stat
import json
import signal
import socket
import time
from module import conf
# Report
def report(error, module):
if report.fp is None:
report.fp = open(conf.qalarm_file, 'a')
# Level
if 'level' not in error:
error['level'] = 'default'
else:
error['level'] = error['level'].lower()
# Only mode
if ('only_levels' in conf.check_list[module] and
error['level'] not in conf.check_list[module]['only_levels']):
return
# Ignore mode
if ('ignore_levels' in conf.check_list[module] and
error['level'] in conf.check_list[module]['ignore_levels']):
return
data = {
'project': 'stare',
'module': module,
'code': None,
'env': 'prod',
'time': error['timestamp'],
'level': error['level'],
'server_ip': socket.gethostname(),
'client_ip': None,
'script': error['file'],
'message': '\t'.join(error['lines']),
}
report.fp.write(json.dumps(data, report.fp) + '\n')
report.fp.flush()
# init report file handler
report.fp = None
# Config & record
def load_records():
try:
data = json.load(open(conf.record_file, 'r'))
except (IOError, ValueError):
data = {}
for module, item in conf.check_list.items():
if item['path'] not in data:
data[item['path']] = {'inode': 0, 'offset': 0}
# Always update module name
data[item['path']]['module'] = module
return data
def save_records(data):
return json.dump(data, open(conf.record_file, 'w'), indent=2)
# Heartbeat
def heartbeat():
fp = open(conf.heartbeat_file, 'a')
data = {
'k': 'qalarm|heartbeat|201|prod',
'i': 'localhost',
't': int(time.time()),
'type': 'h'
}
fp.write(json.dumps(data) + '\n')
fp.close()
def main():
print 'begin staring...'
# Load records
records = load_records()
for path in records:
print path, records[path]
last_heartbeat_time = None
# Run as daemon
while not main.stop:
# Heartbeat per 5 minute
now = time.time()
if last_heartbeat_time is None or (now - last_heartbeat_time) > 300:
last_heartbeat_time = now
heartbeat()
for path, record in records.items():
# Check existence, inode
try:
res = stat(path)
except OSError:
continue
# New file, jump to the end
if record['inode'] == 0 and record['offset'] == 0:
print 'New file added, jump to the end %s@%d:%d' % (path, res.st_ino, res.st_size)
record['inode'] = res.st_ino
record['offset'] = res.st_size
continue
# No new data
elif res.st_ino == record['inode'] and res.st_size == record['offset']:
continue
# Another file
elif res.st_ino != record['inode'] or res.st_size < record['offset']:
print 'Open new file %s@%d:%d' % (path, res.st_ino, record['offset'])
record['inode'] = res.st_ino
record['offset'] = 0
# Open then set offset
print 'Log file processed %s@%d:%d' % (path, res.st_ino, record['offset'])
fp = open(path, 'r')
fp.seek(record['offset'])
# Process
module = record['module']
action = conf.check_list[module]['action']
action(fp, module, report)
# Save offset
record['offset'] = fp.tell()
fp.close()
save_records(records)
time.sleep(1)
print 'finish staring'
# set stop flag
main.stop = False
def sig_handler(signum, frame):
print 'Signal handler called with signal', signum
main.stop = True
if __name__ == '__main__':
signal.signal(signal.SIGTERM, sig_handler)
main()
| [
1,
515,
2897,
1053,
1002,
13,
5215,
4390,
13,
5215,
7182,
13,
5215,
9909,
13,
5215,
931,
13,
13,
3166,
3883,
1053,
1970,
13,
13,
13,
29937,
13969,
13,
1753,
3461,
29898,
2704,
29892,
3883,
1125,
13,
1678,
565,
3461,
29889,
18091,
338,
6213,
29901,
13,
4706,
3461,
29889,
18091,
353,
1722,
29898,
5527,
29889,
29939,
284,
2817,
29918,
1445,
29892,
525,
29874,
1495,
13,
13,
1678,
396,
21597,
13,
1678,
565,
525,
5563,
29915,
451,
297,
1059,
29901,
13,
4706,
1059,
1839,
5563,
2033,
353,
525,
4381,
29915,
13,
1678,
1683,
29901,
13,
4706,
1059,
1839,
5563,
2033,
353,
1059,
1839,
5563,
13359,
13609,
580,
13,
13,
1678,
396,
9333,
4464,
13,
1678,
565,
6702,
6194,
29918,
5563,
29879,
29915,
297,
1970,
29889,
3198,
29918,
1761,
29961,
5453,
29962,
322,
13,
9651,
1059,
1839,
5563,
2033,
451,
297,
1970,
29889,
3198,
29918,
1761,
29961,
5453,
22322,
6194,
29918,
5563,
29879,
2033,
1125,
13,
4706,
736,
13,
13,
1678,
396,
18076,
487,
4464,
13,
1678,
565,
6702,
17281,
29918,
5563,
29879,
29915,
297,
1970,
29889,
3198,
29918,
1761,
29961,
5453,
29962,
322,
13,
9651,
1059,
1839,
5563,
2033,
297,
1970,
29889,
3198,
29918,
1761,
29961,
5453,
22322,
17281,
29918,
5563,
29879,
2033,
1125,
13,
4706,
736,
13,
13,
1678,
848,
353,
426,
13,
4706,
525,
4836,
2396,
525,
303,
598,
742,
13,
4706,
525,
5453,
2396,
3883,
29892,
13,
4706,
525,
401,
2396,
6213,
29892,
13,
4706,
525,
6272,
2396,
525,
10633,
742,
13,
4706,
525,
2230,
2396,
1059,
1839,
16394,
7464,
13,
4706,
525,
5563,
2396,
1059,
1839,
5563,
7464,
13,
4706,
525,
2974,
29918,
666,
2396,
9909,
29889,
29887,
621,
520,
978,
3285,
13,
4706,
525,
4645,
29918,
666,
2396,
6213,
29892,
13,
4706,
525,
2154,
2396,
1059,
1839,
1445,
7464,
13,
4706,
525,
4906,
2396,
11297,
29873,
4286,
7122,
29898,
2704,
1839,
9012,
2033,
511,
13,
1678,
500,
13,
13,
1678,
3461,
29889,
18091,
29889,
3539,
29898,
3126,
29889,
29881,
17204,
29898,
1272,
29892,
3461,
29889,
18091,
29897,
718,
11297,
29876,
1495,
13,
1678,
3461,
29889,
18091,
29889,
23126,
580,
13,
13,
29937,
2069,
3461,
934,
7834,
13,
12276,
29889,
18091,
353,
6213,
13,
13,
13,
29937,
12782,
669,
2407,
13,
1753,
2254,
29918,
3757,
4339,
7295,
13,
1678,
1018,
29901,
13,
4706,
848,
353,
4390,
29889,
1359,
29898,
3150,
29898,
5527,
29889,
11651,
29918,
1445,
29892,
525,
29878,
8785,
13,
1678,
5174,
313,
5971,
2392,
29892,
7865,
2392,
1125,
13,
4706,
848,
353,
6571,
13,
13,
1678,
363,
3883,
29892,
2944,
297,
1970,
29889,
3198,
29918,
1761,
29889,
7076,
7295,
13,
4706,
565,
2944,
1839,
2084,
2033,
451,
297,
848,
29901,
13,
9651,
848,
29961,
667,
1839,
2084,
2033,
29962,
353,
11117,
262,
356,
2396,
29871,
29900,
29892,
525,
10289,
2396,
29871,
29900,
29913,
13,
13,
4706,
396,
29849,
2767,
3883,
1024,
13,
4706,
848,
29961,
667,
1839,
2084,
2033,
22322,
5453,
2033,
353,
3883,
13,
13,
1678,
736,
848,
13,
13,
13,
1753,
4078,
29918,
3757,
4339,
29898,
1272,
1125,
13,
1678,
736,
4390,
29889,
15070,
29898,
1272,
29892,
1722,
29898,
5527,
29889,
11651,
29918,
1445,
29892,
525,
29893,
5477,
29536,
29922,
29906,
29897,
13,
13,
13,
29937,
17778,
915,
271,
13,
1753,
5192,
915,
271,
7295,
13,
1678,
285,
29886,
353,
1722,
29898,
5527,
29889,
23057,
915,
271,
29918,
1445,
29892,
525,
29874,
1495,
13,
13,
1678,
848,
353,
426,
13,
4706,
525,
29895,
2396,
525,
29939,
284,
2817,
29989,
23057,
915,
271,
29989,
29906,
29900,
29896,
29989,
10633,
742,
13,
4706,
525,
29875,
2396,
525,
7640,
742,
13,
4706,
525,
29873,
2396,
938,
29898,
2230,
29889,
2230,
25739,
13,
4706,
525,
1853,
2396,
525,
29882,
29915,
13,
1678,
500,
13,
13,
1678,
285,
29886,
29889,
3539,
29898,
3126,
29889,
29881,
17204,
29898,
1272,
29897,
718,
11297,
29876,
1495,
13,
1678,
285,
29886,
29889,
5358,
580,
13,
13,
13,
1753,
1667,
7295,
13,
1678,
1596,
525,
463,
380,
4362,
856,
29915,
13,
13,
1678,
396,
16012,
6475,
13,
1678,
6475,
353,
2254,
29918,
3757,
4339,
580,
13,
1678,
363,
2224,
297,
6475,
29901,
13,
4706,
1596,
2224,
29892,
6475,
29961,
2084,
29962,
13,
13,
1678,
1833,
29918,
23057,
915,
271,
29918,
2230,
353,
6213,
13,
13,
1678,
396,
7525,
408,
1146,
9857,
13,
1678,
1550,
451,
1667,
29889,
9847,
29901,
13,
4706,
396,
17778,
915,
271,
639,
29871,
29945,
11015,
13,
4706,
1286,
353,
931,
29889,
2230,
580,
13,
4706,
565,
1833,
29918,
23057,
915,
271,
29918,
2230,
338,
6213,
470,
313,
3707,
448,
1833,
29918,
23057,
915,
271,
29918,
2230,
29897,
1405,
29871,
29941,
29900,
29900,
29901,
13,
9651,
1833,
29918,
23057,
915,
271,
29918,
2230,
353,
1286,
13,
9651,
5192,
915,
271,
580,
13,
13,
4706,
363,
2224,
29892,
2407,
297,
6475,
29889,
7076,
7295,
13,
9651,
396,
5399,
10379,
29892,
297,
356,
13,
9651,
1018,
29901,
13,
18884,
620,
353,
1002,
29898,
2084,
29897,
13,
9651,
5174,
438,
29173,
29901,
13,
18884,
6773,
13,
13,
9651,
396,
1570,
934,
29892,
12500,
304,
278,
1095,
13,
9651,
565,
2407,
1839,
262,
356,
2033,
1275,
29871,
29900,
322,
2407,
1839,
10289,
2033,
1275,
29871,
29900,
29901,
13,
18884,
1596,
525,
4373,
934,
2715,
29892,
12500,
304,
278,
1095,
1273,
29879,
29992,
29995,
29881,
16664,
29881,
29915,
1273,
313,
2084,
29892,
620,
29889,
303,
29918,
1789,
29892,
620,
29889,
303,
29918,
2311,
29897,
13,
18884,
2407,
1839,
262,
356,
2033,
353,
620,
29889,
303,
29918,
1789,
13,
18884,
2407,
1839,
10289,
2033,
353,
620,
29889,
303,
29918,
2311,
13,
18884,
6773,
13,
13,
9651,
396,
1939,
716,
848,
13,
9651,
25342,
620,
29889,
303,
29918,
1789,
1275,
2407,
1839,
262,
356,
2033,
322,
620,
29889,
303,
29918,
2311,
1275,
2407,
1839,
10289,
2033,
29901,
13,
18884,
6773,
13,
13,
9651,
396,
7280,
934,
13,
9651,
25342,
620,
29889,
303,
29918,
1789,
2804,
2407,
1839,
262,
356,
2033,
470,
620,
29889,
303,
29918,
2311,
529,
2407,
1839,
10289,
2033,
29901,
13,
18884,
1596,
525,
6585,
716,
934,
1273,
29879,
29992,
29995,
29881,
16664,
29881,
29915,
1273,
313,
2084,
29892,
620,
29889,
303,
29918,
1789,
29892,
2407,
1839,
10289,
11287,
13,
18884,
2407,
1839,
262,
356,
2033,
353,
620,
29889,
303,
29918,
1789,
13,
18884,
2407,
1839,
10289,
2033,
353,
29871,
29900,
13,
13,
9651,
396,
4673,
769,
731,
9210,
13,
9651,
1596,
525,
3403,
934,
19356,
1273,
29879,
29992,
29995,
29881,
16664,
29881,
29915,
1273,
313,
2084,
29892,
620,
29889,
303,
29918,
1789,
29892,
2407,
1839,
10289,
11287,
13,
9651,
285,
29886,
353,
1722,
29898,
2084,
29892,
525,
29878,
1495,
13,
9651,
285,
29886,
29889,
344,
1416,
29898,
11651,
1839,
10289,
11287,
13,
13,
9651,
396,
10554,
13,
9651,
3883,
353,
2407,
1839,
5453,
2033,
13,
9651,
3158,
353,
1970,
29889,
3198,
29918,
1761,
29961,
5453,
22322,
2467,
2033,
13,
9651,
3158,
29898,
18091,
29892,
3883,
29892,
3461,
29897,
13,
13,
9651,
396,
16913,
9210,
13,
9651,
2407,
1839,
10289,
2033,
353,
285,
29886,
29889,
29873,
514,
580,
13,
9651,
285,
29886,
29889,
5358,
580,
13,
13,
4706,
4078,
29918,
3757,
4339,
29898,
3757,
4339,
29897,
13,
4706,
931,
29889,
17059,
29898,
29896,
29897,
13,
13,
1678,
1596,
525,
4951,
728,
380,
4362,
29915,
13,
13,
29937,
731,
5040,
7353,
13,
3396,
29889,
9847,
353,
7700,
13,
13,
13,
1753,
4365,
29918,
13789,
29898,
4530,
398,
29892,
3515,
1125,
13,
1678,
1596,
525,
10140,
284,
7834,
2000,
411,
7182,
742,
1804,
398,
13,
1678,
1667,
29889,
9847,
353,
5852,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
13,
1678,
7182,
29889,
25436,
29898,
25436,
29889,
5425,
29954,
4945,
29924,
29892,
4365,
29918,
13789,
29897,
13,
13,
1678,
1667,
580,
13,
2
] |
player.py | Drayux/Battlematus | 0 | 1189 | # PLAYER
class player:
def __init__(self):
| [
1,
396,
349,
18799,
1001,
13,
13,
1990,
4847,
29901,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
308,
13,
2
] |
hwt/interfaces/agents/signal.py | mgielda/hwt | 0 | 146339 | from collections import deque
from hwt.hdl.constants import Time
from hwt.simulator.agentBase import AgentBase, SyncAgentBase
from hwt.synthesizer.exceptions import IntfLvlConfErr
# 100 MHz
DEFAULT_CLOCK = 10 * Time.ns
class SignalAgent(SyncAgentBase):
"""
Agent for signal interface, it can use clock and reset interface
for synchronization or can be synchronized by delay
:attention: clock synchronization has higher priority
"""
def __init__(self, intf, delay=DEFAULT_CLOCK):
AgentBase.__init__(self, intf)
self.delay = delay
self.initDelay = 0
# resolve clk and rstn
try:
self.clk = self.intf._getAssociatedClk()
except IntfLvlConfErr:
self.clk = None
self._discoverReset(True)
self.data = deque()
self.initPending = True
if self.clk is not None:
if self.initDelay:
raise NotImplementedError("initDelay only without clock")
c = self.SELECTED_EDGE_CALLBACK
self.monitor = c(self.clk, self.monitor, self.getEnable)
self.driver = c(self.clk, self.driver, self.getEnable)
def getDrivers(self):
d = SyncAgentBase.getDrivers(self)
if self.clk is None:
return d
else:
return d + [self.driverInit_nonClk]
def driverInit_nonClk(self, sim):
try:
d = self.data[0]
except IndexError:
d = None
self.doWrite(sim, d)
return
yield
def doRead(self, s):
return s.read(self.intf)
def doWrite(self, s, data):
s.write(data, self.intf)
def driver(self, sim):
if self.clk is None:
if self.initPending:
if self.initDelay:
yield sim.wait(self.initDelay)
self.initPending = False
# if clock is specified this function is periodically called every
# clk tick
while True:
if self._enabled and self.data and self.notReset(sim):
d = self.data.popleft()
self.doWrite(sim, d)
yield sim.wait(self.delay)
else:
# if clock is specified this function is periodically called every
# clk tick, when agent is enabled
if self.data and self.notReset(sim):
d = self.data.popleft()
self.doWrite(sim, d)
def monitor(self, sim):
if self.clk is None:
if self.initPending and self.initDelay:
yield sim.wait(self.initDelay)
self.initPending = False
# if there is no clk, we have to manage periodic call by our selfs
while True:
if self._enabled and self.notReset(sim):
yield sim.waitOnCombUpdate()
d = self.doRead(sim)
self.data.append(d)
yield sim.wait(self.delay)
else:
# if clock is specified this function is periodically called every
# clk tick, when agent is enabled
yield sim.waitOnCombUpdate()
if self.notReset(sim):
d = self.doRead(sim)
self.data.append(d)
| [
1,
515,
16250,
1053,
316,
802,
13,
13,
3166,
298,
14554,
29889,
29882,
11671,
29889,
3075,
1934,
1053,
5974,
13,
3166,
298,
14554,
29889,
3601,
9183,
29889,
14748,
5160,
1053,
28330,
5160,
29892,
317,
2720,
19661,
5160,
13,
3166,
298,
14554,
29889,
19274,
26041,
3950,
29889,
11739,
29879,
1053,
3159,
29888,
29931,
20901,
16376,
19212,
13,
13,
13,
29937,
29871,
29896,
29900,
29900,
341,
12661,
13,
23397,
29918,
29907,
21339,
353,
29871,
29896,
29900,
334,
5974,
29889,
1983,
13,
13,
13,
1990,
9954,
284,
19661,
29898,
21077,
19661,
5160,
1125,
13,
1678,
9995,
13,
1678,
28330,
363,
7182,
5067,
29892,
372,
508,
671,
12006,
322,
10092,
5067,
13,
1678,
363,
12231,
2133,
470,
508,
367,
12231,
1891,
491,
9055,
13,
13,
1678,
584,
1131,
2509,
29901,
12006,
12231,
2133,
756,
6133,
20136,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
938,
29888,
29892,
9055,
29922,
23397,
29918,
29907,
21339,
1125,
13,
4706,
28330,
5160,
17255,
2344,
12035,
1311,
29892,
938,
29888,
29897,
13,
4706,
1583,
29889,
18829,
353,
9055,
13,
4706,
1583,
29889,
2344,
24996,
353,
29871,
29900,
13,
13,
4706,
396,
8814,
1067,
29895,
322,
364,
303,
29876,
13,
4706,
1018,
29901,
13,
9651,
1583,
29889,
20495,
353,
1583,
29889,
524,
29888,
3032,
657,
29254,
630,
6821,
29895,
580,
13,
4706,
5174,
3159,
29888,
29931,
20901,
16376,
19212,
29901,
13,
9651,
1583,
29889,
20495,
353,
6213,
13,
13,
4706,
1583,
3032,
2218,
11911,
27175,
29898,
5574,
29897,
13,
4706,
1583,
29889,
1272,
353,
316,
802,
580,
13,
13,
4706,
1583,
29889,
2344,
29925,
2548,
353,
5852,
13,
13,
4706,
565,
1583,
29889,
20495,
338,
451,
6213,
29901,
13,
9651,
565,
1583,
29889,
2344,
24996,
29901,
13,
18884,
12020,
2216,
1888,
2037,
287,
2392,
703,
2344,
24996,
871,
1728,
12006,
1159,
13,
9651,
274,
353,
1583,
29889,
6404,
3352,
29918,
3352,
1692,
29918,
29907,
9818,
29933,
11375,
13,
9651,
1583,
29889,
3712,
2105,
353,
274,
29898,
1311,
29889,
20495,
29892,
1583,
29889,
3712,
2105,
29892,
1583,
29889,
657,
20701,
29897,
13,
9651,
1583,
29889,
9465,
353,
274,
29898,
1311,
29889,
20495,
29892,
1583,
29889,
9465,
29892,
1583,
29889,
657,
20701,
29897,
13,
13,
1678,
822,
679,
29928,
374,
874,
29898,
1311,
1125,
13,
4706,
270,
353,
317,
2720,
19661,
5160,
29889,
657,
29928,
374,
874,
29898,
1311,
29897,
13,
4706,
565,
1583,
29889,
20495,
338,
6213,
29901,
13,
9651,
736,
270,
13,
4706,
1683,
29901,
13,
9651,
736,
270,
718,
518,
1311,
29889,
9465,
6644,
29918,
5464,
6821,
29895,
29962,
13,
13,
1678,
822,
7156,
6644,
29918,
5464,
6821,
29895,
29898,
1311,
29892,
1027,
1125,
13,
4706,
1018,
29901,
13,
9651,
270,
353,
1583,
29889,
1272,
29961,
29900,
29962,
13,
4706,
5174,
11374,
2392,
29901,
13,
9651,
270,
353,
6213,
13,
13,
4706,
1583,
29889,
1867,
6113,
29898,
3601,
29892,
270,
29897,
13,
13,
4706,
736,
13,
4706,
7709,
13,
13,
1678,
822,
437,
6359,
29898,
1311,
29892,
269,
1125,
13,
4706,
736,
269,
29889,
949,
29898,
1311,
29889,
524,
29888,
29897,
13,
13,
1678,
822,
437,
6113,
29898,
1311,
29892,
269,
29892,
848,
1125,
13,
4706,
269,
29889,
3539,
29898,
1272,
29892,
1583,
29889,
524,
29888,
29897,
13,
13,
1678,
822,
7156,
29898,
1311,
29892,
1027,
1125,
13,
4706,
565,
1583,
29889,
20495,
338,
6213,
29901,
13,
9651,
565,
1583,
29889,
2344,
29925,
2548,
29901,
13,
18884,
565,
1583,
29889,
2344,
24996,
29901,
13,
462,
1678,
7709,
1027,
29889,
10685,
29898,
1311,
29889,
2344,
24996,
29897,
13,
18884,
1583,
29889,
2344,
29925,
2548,
353,
7700,
13,
9651,
396,
565,
12006,
338,
6790,
445,
740,
338,
3785,
1711,
2000,
1432,
13,
9651,
396,
1067,
29895,
16892,
13,
9651,
1550,
5852,
29901,
13,
18884,
565,
1583,
3032,
17590,
322,
1583,
29889,
1272,
322,
1583,
29889,
1333,
27175,
29898,
3601,
1125,
13,
462,
1678,
270,
353,
1583,
29889,
1272,
29889,
7323,
1563,
580,
13,
462,
1678,
1583,
29889,
1867,
6113,
29898,
3601,
29892,
270,
29897,
13,
18884,
7709,
1027,
29889,
10685,
29898,
1311,
29889,
18829,
29897,
13,
4706,
1683,
29901,
13,
9651,
396,
565,
12006,
338,
6790,
445,
740,
338,
3785,
1711,
2000,
1432,
13,
9651,
396,
1067,
29895,
16892,
29892,
746,
10823,
338,
9615,
13,
9651,
565,
1583,
29889,
1272,
322,
1583,
29889,
1333,
27175,
29898,
3601,
1125,
13,
18884,
270,
353,
1583,
29889,
1272,
29889,
7323,
1563,
580,
13,
18884,
1583,
29889,
1867,
6113,
29898,
3601,
29892,
270,
29897,
13,
13,
1678,
822,
11819,
29898,
1311,
29892,
1027,
1125,
13,
4706,
565,
1583,
29889,
20495,
338,
6213,
29901,
13,
9651,
565,
1583,
29889,
2344,
29925,
2548,
322,
1583,
29889,
2344,
24996,
29901,
13,
18884,
7709,
1027,
29889,
10685,
29898,
1311,
29889,
2344,
24996,
29897,
13,
18884,
1583,
29889,
2344,
29925,
2548,
353,
7700,
13,
9651,
396,
565,
727,
338,
694,
1067,
29895,
29892,
591,
505,
304,
10933,
29591,
1246,
491,
1749,
1583,
29879,
13,
9651,
1550,
5852,
29901,
13,
18884,
565,
1583,
3032,
17590,
322,
1583,
29889,
1333,
27175,
29898,
3601,
1125,
13,
462,
1678,
7709,
1027,
29889,
10685,
2951,
1523,
29890,
6422,
580,
13,
462,
1678,
270,
353,
1583,
29889,
1867,
6359,
29898,
3601,
29897,
13,
462,
1678,
1583,
29889,
1272,
29889,
4397,
29898,
29881,
29897,
13,
462,
1678,
7709,
1027,
29889,
10685,
29898,
1311,
29889,
18829,
29897,
13,
4706,
1683,
29901,
13,
9651,
396,
565,
12006,
338,
6790,
445,
740,
338,
3785,
1711,
2000,
1432,
13,
9651,
396,
1067,
29895,
16892,
29892,
746,
10823,
338,
9615,
13,
9651,
7709,
1027,
29889,
10685,
2951,
1523,
29890,
6422,
580,
13,
9651,
565,
1583,
29889,
1333,
27175,
29898,
3601,
1125,
13,
18884,
270,
353,
1583,
29889,
1867,
6359,
29898,
3601,
29897,
13,
18884,
1583,
29889,
1272,
29889,
4397,
29898,
29881,
29897,
13,
2
] |
src/test/unit/testgamer.py | alok1974/pychess | 2 | 73347 | import unittest
from pychess.core.gamer import Game
from pychess.element.squarer import Square
from pychess.element.piecer import Piece
from pychess import constant as c
from pychess.core.mover import Move
def _check_win(game):
if game.is_game_over:
winner = str(game.winner.name).capitalize()
print(f'{winner} wins!')
class TestGamer(unittest.TestCase):
@classmethod
def setUpClass(cls):
# Some short hands for fitting one move in one line
p = c.PieceType.pawn
b = c.PieceType.bishop
r = c.PieceType.rook
q = c.PieceType.queen
wt = c.Color.white
bl = c.Color.black
s = Square
cls.expected_move_history = []
# A simple gameplay (even a noob would not play so bad ;)
cls.game = Game()
# Illegal Move - White rook trying to move diagonally
cls.game.move(('a1h8', None))
_check_win(cls.game)
# Move 1 - White opening with d4
cls.game.move(('d2d4', None))
_check_win(cls.game)
cls.expected_move_history.append(
Move(Piece(p, wt, 3), s('d2'), s('d4'))
)
# Move 2 - Black opening with c6
cls.game.move(('c7c6', None))
_check_win(cls.game)
cls.expected_move_history.append(
Move(Piece(p, bl, 2), s('c7'), s('c6'))
)
# Illegal Move - Trying to capture white pawn at d4 by white queen
cls.game.move(('d1d4', None))
_check_win(cls.game)
# Move 3 - White Queen to d3
cls.game.move(('d1d3', None))
_check_win(cls.game)
cls.expected_move_history.append(
Move(Piece(q, wt, 0), s('d1'), s('d3'))
)
# Illegal Move - Queen trying to jump over white pawn at d4
# nothing will happen
cls.game.move(('d3d5', None))
_check_win(cls.game)
# Move 4 - Black moves pawn a6
cls.game.move(('a7a6', None))
_check_win(cls.game)
cls.expected_move_history.append(
Move(Piece(p, bl, 0), s('a7'), s('a6'))
)
# Move 5 - Black pawn at h7 captured by the white queen
cls.game.move(('d3h7', None))
_check_win(cls.game)
cls.expected_move_history.append(
Move(Piece(q, wt, 0), s('d3'), s('h7'))
)
# Move 6 - Black pawn to a5
cls.game.move(('a6a5', None))
_check_win(cls.game)
cls.expected_move_history.append(
Move(Piece(p, bl, 0), s('a6'), s('a5'))
)
# Move 7 - White queen to f5
cls.game.move(('h7f5', None))
_check_win(cls.game)
cls.expected_move_history.append(
Move(Piece(q, wt, 0), s('h7'), s('f5'))
)
# Move 8 - Black rook to h6, where it comes under attack
# by the black bishop at c1
cls.game.move(('h8h6', None))
_check_win(cls.game)
cls.expected_move_history.append(
Move(Piece(r, bl, 1), s('h8'), s('h6'))
)
# Move 9 - White pawn to e4
cls.game.move(('e2e4', None))
_check_win(cls.game)
cls.expected_move_history.append(
Move(Piece(p, wt, 4), s('e2'), s('e4'))
)
# Move 10 - Black pawn to a4
cls.game.move(('a5a4', None))
_check_win(cls.game)
cls.expected_move_history.append(
Move(Piece(p, bl, 0), s('a5'), s('a4'))
)
# Move 11 - White rook to c4
cls.game.move(('f1c4', None))
_check_win(cls.game)
cls.expected_move_history.append(
Move(Piece(b, wt, 1), s('f1'), s('c4'))
)
# Move 12 - White rook to h5 attacking the queen
cls.game.move(('h6h5', None))
_check_win(cls.game)
cls.expected_move_history.append(
Move(Piece(r, bl, 1), s('h6'), s('h5'))
)
# Move 13 - White queen to f7, it's a mate!
cls.game.move(('f5f7', None))
_check_win(cls.game)
cls.expected_move_history.append(
Move(Piece(q, wt, 0), s('f5'), s('f7'))
)
def test_board(self):
expected_result = (
' a b c d e f g h\n'
' 8 |r|n|b|q|k|b|n|#| 8\n'
' 7 |#|p|#|p|p|Q|p|_| 7\n'
' 6 |_|#|p|#|_|#|_|#| 6\n'
' 5 |#|_|#|_|#|_|#|r| 5\n'
' 4 |p|#|B|P|P|#|_|#| 4\n'
' 3 |#|_|#|_|#|_|#|_| 3\n'
' 2 |P|P|P|#|_|P|P|P| 2\n'
' 1 |R|N|B|_|K|_|N|R| 1\n'
' a b c d e f g h'
)
self.assertEqual(repr(self.game.board), expected_result)
def test_captured_black(self):
expected_result = [
Piece(c.PieceType.pawn, c.Color.black, order=7),
Piece(c.PieceType.pawn, c.Color.black, order=5),
]
self.assertEqual(self.game.captured_black, expected_result)
def test_captured_white(self):
expected_result = []
self.assertEqual(self.game.captured_white, expected_result)
def test_white_points(self):
expected_result = 2
self.assertEqual(self.game.white_points, expected_result)
def test_black_points(self):
expected_result = 0
self.assertEqual(self.game.black_points, expected_result)
def test_leader(self):
expected_result = c.Color.white
self.assertEqual(self.game.leader, expected_result)
def test_lead(self):
expected_result = 2
self.assertEqual(self.game.lead, expected_result)
def test_pieces_checking_black(self):
expected_result = [Piece(c.PieceType.queen, c.Color.white)]
self.assertEqual(self.game.pieces_checking_black, expected_result)
def test_pieces_checking_white(self):
expected_result = []
self.assertEqual(self.game.pieces_checking_white, expected_result)
def test_move_history(self):
self.assertEqual(self.game.move_history, self.expected_move_history)
def test_capturables(self):
expected_result = {
c.Color.white: {
Piece(c.PieceType.king, c.Color.black): [
Piece(c.PieceType.queen, c.Color.white)
],
Piece(c.PieceType.rook, c.Color.black, 1): [
Piece(c.PieceType.pawn, c.Color.white, 7)
]
},
c.Color.black: {
Piece(c.PieceType.queen, c.Color.white): [
Piece(c.PieceType.pawn, c.Color.black, 4),
Piece(c.PieceType.king, c.Color.black),
Piece(c.PieceType.bishop, c.Color.black, 1),
Piece(c.PieceType.pawn, c.Color.black, 6),
Piece(c.PieceType.knight, c.Color.black, 1),
Piece(c.PieceType.rook, c.Color.black, 1),
]
}
}
self.assertEqual(self.game.capturables, expected_result)
def test_winner(self):
expected_result = c.Color.white
self.assertEqual(self.game.winner, expected_result)
def test_parse_move_spec_1(self):
move_spec = 'a1h8'
expected_result = (Square('a1'), Square('h8'))
self.assertEqual(Game.parse_move_spec(move_spec), expected_result)
def test_parse_move_spec_2(self):
move_spec = ('a1', 'h8')
expected_result = (Square('a1'), Square('h8'))
self.assertEqual(Game.parse_move_spec(move_spec), expected_result)
def test_parse_move_spec_3(self):
move_spec = ((0, 0), (0, 7))
expected_result = (Square((0, 0)), Square((0, 7)))
self.assertEqual(Game.parse_move_spec(move_spec), expected_result)
def test_parse_move_spec_4(self):
move_spec = [1, 2, 3, 4]
exc_str = (
f'`move_spec={move_spec}` should either be a tuple or a string'
)
with self.assertRaises(Exception) as context:
Game.parse_move_spec(move_spec)
self.assertTrue(exc_str in str(context.exception))
def test_parse_move_spec_5(self):
move_spec = (1, 2, 3)
exc_str = (
f'{move_spec} tuple should have exactly two elements!'
)
with self.assertRaises(Exception) as context:
Game.parse_move_spec(move_spec)
self.assertTrue(exc_str in str(context.exception))
def test_parse_move_spec_6(self):
addr_1 = 'aa'
addr_2 = '11'
move_spec = (addr_1, addr_2)
exc_str = (
f'Malformed address! The address {addr_1} supplied '
f'in arg `move_spec={move_spec}` should be of '
'the format \'<alpha><number>\' where alpha is '
'one of [a, b, c, d, e, f, g, h] and number '
'is from 1 to 8'
)
with self.assertRaises(Exception) as context:
Game.parse_move_spec(move_spec)
self.assertTrue(exc_str in str(context.exception))
def test_parse_move_spec_7(self):
addr_1 = 'a1'
addr_2 = '11'
move_spec = (addr_1, addr_2)
exc_str = (
f'Malformed address! The address {addr_2} supplied '
f'in arg `move_spec={move_spec}` should be of '
'the format \'<alpha><number>\' where alpha is '
'one of [a, b, c, d, e, f, g, h] and number '
'is from 1 to 8'
)
with self.assertRaises(Exception) as context:
Game.parse_move_spec(move_spec)
self.assertTrue(exc_str in str(context.exception))
def test_parse_move_spec_8(self):
addr_1 = (10, 30)
addr_2 = (12, 40)
move_spec = (addr_1, addr_2)
exc_str = (
f'The address {addr_1} supplied in arg '
f'`move_spec={move_spec}` should exactly be a '
'tuple of the form (a, b) where both a and b '
'are one of the numbers 0 to 7'
)
with self.assertRaises(Exception) as context:
Game.parse_move_spec(move_spec)
self.assertTrue(exc_str in str(context.exception))
def test_parse_move_spec_9(self):
addr_1 = (0, 5)
addr_2 = (12, 40)
move_spec = (addr_1, addr_2)
exc_str = (
f'The address {addr_2} supplied in arg '
f'`move_spec={move_spec}` should exactly be a '
'tuple of the form (a, b) where both a and b '
'are one of the numbers 0 to 7'
)
with self.assertRaises(Exception) as context:
Game.parse_move_spec(move_spec)
self.assertTrue(exc_str in str(context.exception))
def test_parse_move_spec_10(self):
move_spec = ((0, 5), (0, 5))
exc_str = (
f'`move_spec={move_spec}` should have distinct source and '
'destination'
)
with self.assertRaises(Exception) as context:
Game.parse_move_spec(move_spec)
self.assertTrue(exc_str in str(context.exception))
def test_parse_move_spec_11(self):
move_spec = ('a1', 'a1')
exc_str = (
f'`move_spec={move_spec}` should have distinct source and '
'destination'
)
with self.assertRaises(Exception) as context:
Game.parse_move_spec(move_spec)
self.assertTrue(exc_str in str(context.exception))
def test_parse_move_spec_12(self):
move_spec = 'c6c6'
exc_str = (
f'`move_spec={move_spec}` should have distinct source and '
'destination'
)
with self.assertRaises(Exception) as context:
Game.parse_move_spec(move_spec)
self.assertTrue(exc_str in str(context.exception))
def test_parse_move_spec_13(self):
move_spec = (Square('e1'), Square('e4'))
expected_result = move_spec
self.assertEqual(Game.parse_move_spec(move_spec), expected_result)
if __name__ == '__main__':
unittest.main()
| [
1,
1053,
443,
27958,
13,
13,
13,
3166,
282,
3376,
404,
29889,
3221,
29889,
29887,
4183,
1053,
8448,
13,
3166,
282,
3376,
404,
29889,
5029,
29889,
26613,
279,
261,
1053,
19256,
13,
3166,
282,
3376,
404,
29889,
5029,
29889,
12343,
2265,
1053,
26005,
346,
13,
3166,
282,
3376,
404,
1053,
4868,
408,
274,
13,
3166,
282,
3376,
404,
29889,
3221,
29889,
29885,
957,
1053,
25249,
13,
13,
13,
1753,
903,
3198,
29918,
5080,
29898,
11802,
1125,
13,
1678,
565,
3748,
29889,
275,
29918,
11802,
29918,
957,
29901,
13,
4706,
19576,
353,
851,
29898,
11802,
29889,
29893,
3993,
29889,
978,
467,
5030,
2410,
675,
580,
13,
4706,
1596,
29898,
29888,
29915,
29912,
29893,
3993,
29913,
21614,
29991,
1495,
13,
13,
13,
1990,
4321,
29954,
4183,
29898,
348,
27958,
29889,
3057,
8259,
1125,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
731,
3373,
2385,
29898,
25932,
1125,
13,
4706,
396,
3834,
3273,
6567,
363,
28221,
697,
4337,
297,
697,
1196,
13,
4706,
282,
353,
274,
29889,
29925,
347,
346,
1542,
29889,
3274,
1233,
13,
4706,
289,
353,
274,
29889,
29925,
347,
346,
1542,
29889,
28693,
13,
4706,
364,
353,
274,
29889,
29925,
347,
346,
1542,
29889,
307,
554,
13,
4706,
3855,
353,
274,
29889,
29925,
347,
346,
1542,
29889,
802,
264,
13,
13,
4706,
281,
29873,
353,
274,
29889,
3306,
29889,
10921,
13,
4706,
1999,
353,
274,
29889,
3306,
29889,
8517,
13,
4706,
269,
353,
19256,
13,
13,
4706,
1067,
29879,
29889,
9684,
29918,
11631,
29918,
18434,
353,
5159,
13,
4706,
396,
319,
2560,
3748,
1456,
313,
11884,
263,
694,
711,
723,
451,
1708,
577,
4319,
15718,
13,
4706,
1067,
29879,
29889,
11802,
353,
8448,
580,
13,
13,
4706,
396,
1720,
12018,
25249,
448,
8037,
696,
554,
1811,
304,
4337,
7936,
265,
635,
13,
4706,
1067,
29879,
29889,
11802,
29889,
11631,
29898,
877,
29874,
29896,
29882,
29947,
742,
6213,
876,
13,
4706,
903,
3198,
29918,
5080,
29898,
25932,
29889,
11802,
29897,
13,
13,
4706,
396,
25249,
29871,
29896,
448,
8037,
8718,
411,
270,
29946,
13,
4706,
1067,
29879,
29889,
11802,
29889,
11631,
29898,
877,
29881,
29906,
29881,
29946,
742,
6213,
876,
13,
4706,
903,
3198,
29918,
5080,
29898,
25932,
29889,
11802,
29897,
13,
4706,
1067,
29879,
29889,
9684,
29918,
11631,
29918,
18434,
29889,
4397,
29898,
13,
9651,
25249,
29898,
29925,
347,
346,
29898,
29886,
29892,
281,
29873,
29892,
29871,
29941,
511,
269,
877,
29881,
29906,
5477,
269,
877,
29881,
29946,
8785,
13,
4706,
1723,
13,
13,
4706,
396,
25249,
29871,
29906,
448,
6054,
8718,
411,
274,
29953,
13,
4706,
1067,
29879,
29889,
11802,
29889,
11631,
29898,
877,
29883,
29955,
29883,
29953,
742,
6213,
876,
13,
4706,
903,
3198,
29918,
5080,
29898,
25932,
29889,
11802,
29897,
13,
4706,
1067,
29879,
29889,
9684,
29918,
11631,
29918,
18434,
29889,
4397,
29898,
13,
9651,
25249,
29898,
29925,
347,
346,
29898,
29886,
29892,
1999,
29892,
29871,
29906,
511,
269,
877,
29883,
29955,
5477,
269,
877,
29883,
29953,
8785,
13,
4706,
1723,
13,
13,
4706,
396,
1720,
12018,
25249,
448,
24428,
304,
10446,
4796,
3300,
1233,
472,
270,
29946,
491,
4796,
26624,
13,
4706,
1067,
29879,
29889,
11802,
29889,
11631,
29898,
877,
29881,
29896,
29881,
29946,
742,
6213,
876,
13,
4706,
903,
3198,
29918,
5080,
29898,
25932,
29889,
11802,
29897,
13,
13,
4706,
396,
25249,
29871,
29941,
448,
8037,
10470,
304,
270,
29941,
13,
4706,
1067,
29879,
29889,
11802,
29889,
11631,
29898,
877,
29881,
29896,
29881,
29941,
742,
6213,
876,
13,
4706,
903,
3198,
29918,
5080,
29898,
25932,
29889,
11802,
29897,
13,
4706,
1067,
29879,
29889,
9684,
29918,
11631,
29918,
18434,
29889,
4397,
29898,
13,
9651,
25249,
29898,
29925,
347,
346,
29898,
29939,
29892,
281,
29873,
29892,
29871,
29900,
511,
269,
877,
29881,
29896,
5477,
269,
877,
29881,
29941,
8785,
13,
4706,
1723,
13,
13,
4706,
396,
1720,
12018,
25249,
448,
10470,
1811,
304,
12500,
975,
4796,
3300,
1233,
472,
270,
29946,
13,
4706,
396,
3078,
674,
3799,
13,
4706,
1067,
29879,
29889,
11802,
29889,
11631,
29898,
877,
29881,
29941,
29881,
29945,
742,
6213,
876,
13,
4706,
903,
3198,
29918,
5080,
29898,
25932,
29889,
11802,
29897,
13,
13,
4706,
396,
25249,
29871,
29946,
448,
6054,
16229,
3300,
1233,
263,
29953,
13,
4706,
1067,
29879,
29889,
11802,
29889,
11631,
29898,
877,
29874,
29955,
29874,
29953,
742,
6213,
876,
13,
4706,
903,
3198,
29918,
5080,
29898,
25932,
29889,
11802,
29897,
13,
4706,
1067,
29879,
29889,
9684,
29918,
11631,
29918,
18434,
29889,
4397,
29898,
13,
9651,
25249,
29898,
29925,
347,
346,
29898,
29886,
29892,
1999,
29892,
29871,
29900,
511,
269,
877,
29874,
29955,
5477,
269,
877,
29874,
29953,
8785,
13,
4706,
1723,
13,
13,
4706,
396,
25249,
29871,
29945,
448,
6054,
3300,
1233,
472,
298,
29955,
15468,
491,
278,
4796,
26624,
13,
4706,
1067,
29879,
29889,
11802,
29889,
11631,
29898,
877,
29881,
29941,
29882,
29955,
742,
6213,
876,
13,
4706,
903,
3198,
29918,
5080,
29898,
25932,
29889,
11802,
29897,
13,
4706,
1067,
29879,
29889,
9684,
29918,
11631,
29918,
18434,
29889,
4397,
29898,
13,
9651,
25249,
29898,
29925,
347,
346,
29898,
29939,
29892,
281,
29873,
29892,
29871,
29900,
511,
269,
877,
29881,
29941,
5477,
269,
877,
29882,
29955,
8785,
13,
4706,
1723,
13,
13,
4706,
396,
25249,
29871,
29953,
448,
6054,
3300,
1233,
304,
263,
29945,
13,
4706,
1067,
29879,
29889,
11802,
29889,
11631,
29898,
877,
29874,
29953,
29874,
29945,
742,
6213,
876,
13,
4706,
903,
3198,
29918,
5080,
29898,
25932,
29889,
11802,
29897,
13,
4706,
1067,
29879,
29889,
9684,
29918,
11631,
29918,
18434,
29889,
4397,
29898,
13,
9651,
25249,
29898,
29925,
347,
346,
29898,
29886,
29892,
1999,
29892,
29871,
29900,
511,
269,
877,
29874,
29953,
5477,
269,
877,
29874,
29945,
8785,
13,
4706,
1723,
13,
13,
4706,
396,
25249,
29871,
29955,
448,
8037,
26624,
304,
285,
29945,
13,
4706,
1067,
29879,
29889,
11802,
29889,
11631,
29898,
877,
29882,
29955,
29888,
29945,
742,
6213,
876,
13,
4706,
903,
3198,
29918,
5080,
29898,
25932,
29889,
11802,
29897,
13,
4706,
1067,
29879,
29889,
9684,
29918,
11631,
29918,
18434,
29889,
4397,
29898,
13,
9651,
25249,
29898,
29925,
347,
346,
29898,
29939,
29892,
281,
29873,
29892,
29871,
29900,
511,
269,
877,
29882,
29955,
5477,
269,
877,
29888,
29945,
8785,
13,
4706,
1723,
13,
13,
4706,
396,
25249,
29871,
29947,
448,
6054,
696,
554,
304,
298,
29953,
29892,
988,
372,
5304,
1090,
5337,
13,
4706,
396,
491,
278,
4628,
26201,
472,
274,
29896,
13,
4706,
1067,
29879,
29889,
11802,
29889,
11631,
29898,
877,
29882,
29947,
29882,
29953,
742,
6213,
876,
13,
4706,
903,
3198,
29918,
5080,
29898,
25932,
29889,
11802,
29897,
13,
4706,
1067,
29879,
29889,
9684,
29918,
11631,
29918,
18434,
29889,
4397,
29898,
13,
9651,
25249,
29898,
29925,
347,
346,
29898,
29878,
29892,
1999,
29892,
29871,
29896,
511,
269,
877,
29882,
29947,
5477,
269,
877,
29882,
29953,
8785,
13,
4706,
1723,
13,
13,
4706,
396,
25249,
29871,
29929,
448,
8037,
3300,
1233,
304,
321,
29946,
13,
4706,
1067,
29879,
29889,
11802,
29889,
11631,
29898,
877,
29872,
29906,
29872,
29946,
742,
6213,
876,
13,
4706,
903,
3198,
29918,
5080,
29898,
25932,
29889,
11802,
29897,
13,
4706,
1067,
29879,
29889,
9684,
29918,
11631,
29918,
18434,
29889,
4397,
29898,
13,
9651,
25249,
29898,
29925,
347,
346,
29898,
29886,
29892,
281,
29873,
29892,
29871,
29946,
511,
269,
877,
29872,
29906,
5477,
269,
877,
29872,
29946,
8785,
13,
4706,
1723,
13,
13,
4706,
396,
25249,
29871,
29896,
29900,
448,
6054,
3300,
1233,
304,
263,
29946,
13,
4706,
1067,
29879,
29889,
11802,
29889,
11631,
29898,
877,
29874,
29945,
29874,
29946,
742,
6213,
876,
13,
4706,
903,
3198,
29918,
5080,
29898,
25932,
29889,
11802,
29897,
13,
4706,
1067,
29879,
29889,
9684,
29918,
11631,
29918,
18434,
29889,
4397,
29898,
13,
9651,
25249,
29898,
29925,
347,
346,
29898,
29886,
29892,
1999,
29892,
29871,
29900,
511,
269,
877,
29874,
29945,
5477,
269,
877,
29874,
29946,
8785,
13,
4706,
1723,
13,
13,
4706,
396,
25249,
29871,
29896,
29896,
448,
8037,
696,
554,
304,
274,
29946,
13,
4706,
1067,
29879,
29889,
11802,
29889,
11631,
29898,
877,
29888,
29896,
29883,
29946,
742,
6213,
876,
13,
4706,
903,
3198,
29918,
5080,
29898,
25932,
29889,
11802,
29897,
13,
4706,
1067,
29879,
29889,
9684,
29918,
11631,
29918,
18434,
29889,
4397,
29898,
13,
9651,
25249,
29898,
29925,
347,
346,
29898,
29890,
29892,
281,
29873,
29892,
29871,
29896,
511,
269,
877,
29888,
29896,
5477,
269,
877,
29883,
29946,
8785,
13,
4706,
1723,
13,
13,
4706,
396,
25249,
29871,
29896,
29906,
448,
8037,
696,
554,
304,
298,
29945,
5337,
292,
278,
26624,
13,
4706,
1067,
29879,
29889,
11802,
29889,
11631,
29898,
877,
29882,
29953,
29882,
29945,
742,
6213,
876,
13,
4706,
903,
3198,
29918,
5080,
29898,
25932,
29889,
11802,
29897,
13,
4706,
1067,
29879,
29889,
9684,
29918,
11631,
29918,
18434,
29889,
4397,
29898,
13,
9651,
25249,
29898,
29925,
347,
346,
29898,
29878,
29892,
1999,
29892,
29871,
29896,
511,
269,
877,
29882,
29953,
5477,
269,
877,
29882,
29945,
8785,
13,
4706,
1723,
13,
13,
4706,
396,
25249,
29871,
29896,
29941,
448,
8037,
26624,
304,
285,
29955,
29892,
372,
29915,
29879,
263,
15358,
29991,
13,
4706,
1067,
29879,
29889,
11802,
29889,
11631,
29898,
877,
29888,
29945,
29888,
29955,
742,
6213,
876,
13,
4706,
903,
3198,
29918,
5080,
29898,
25932,
29889,
11802,
29897,
13,
4706,
1067,
29879,
29889,
9684,
29918,
11631,
29918,
18434,
29889,
4397,
29898,
13,
9651,
25249,
29898,
29925,
347,
346,
29898,
29939,
29892,
281,
29873,
29892,
29871,
29900,
511,
269,
877,
29888,
29945,
5477,
269,
877,
29888,
29955,
8785,
13,
13,
4706,
1723,
13,
13,
1678,
822,
1243,
29918,
3377,
29898,
1311,
1125,
13,
4706,
3806,
29918,
2914,
353,
313,
13,
9651,
525,
1678,
263,
289,
274,
270,
321,
285,
330,
298,
29905,
29876,
29915,
13,
9651,
525,
29871,
29947,
891,
29878,
29989,
29876,
29989,
29890,
29989,
29939,
29989,
29895,
29989,
29890,
29989,
29876,
29989,
29937,
29989,
29871,
29947,
29905,
29876,
29915,
13,
9651,
525,
29871,
29955,
891,
29937,
29989,
29886,
29989,
29937,
29989,
29886,
29989,
29886,
29989,
29984,
29989,
29886,
29989,
29918,
29989,
29871,
29955,
29905,
29876,
29915,
13,
9651,
525,
29871,
29953,
891,
29918,
29989,
29937,
29989,
29886,
29989,
29937,
29989,
29918,
29989,
29937,
29989,
29918,
29989,
29937,
29989,
29871,
29953,
29905,
29876,
29915,
13,
9651,
525,
29871,
29945,
891,
29937,
29989,
29918,
29989,
29937,
29989,
29918,
29989,
29937,
29989,
29918,
29989,
29937,
29989,
29878,
29989,
29871,
29945,
29905,
29876,
29915,
13,
9651,
525,
29871,
29946,
891,
29886,
29989,
29937,
29989,
29933,
29989,
29925,
29989,
29925,
29989,
29937,
29989,
29918,
29989,
29937,
29989,
29871,
29946,
29905,
29876,
29915,
13,
9651,
525,
29871,
29941,
891,
29937,
29989,
29918,
29989,
29937,
29989,
29918,
29989,
29937,
29989,
29918,
29989,
29937,
29989,
29918,
29989,
29871,
29941,
29905,
29876,
29915,
13,
9651,
525,
29871,
29906,
891,
29925,
29989,
29925,
29989,
29925,
29989,
29937,
29989,
29918,
29989,
29925,
29989,
29925,
29989,
29925,
29989,
29871,
29906,
29905,
29876,
29915,
13,
9651,
525,
29871,
29896,
891,
29934,
29989,
29940,
29989,
29933,
29989,
29918,
29989,
29968,
29989,
29918,
29989,
29940,
29989,
29934,
29989,
29871,
29896,
29905,
29876,
29915,
13,
9651,
525,
1678,
263,
289,
274,
270,
321,
285,
330,
298,
29915,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
9843,
29898,
276,
558,
29898,
1311,
29889,
11802,
29889,
3377,
511,
3806,
29918,
2914,
29897,
13,
13,
1678,
822,
1243,
29918,
17885,
2955,
29918,
8517,
29898,
1311,
1125,
13,
4706,
3806,
29918,
2914,
353,
518,
13,
9651,
26005,
346,
29898,
29883,
29889,
29925,
347,
346,
1542,
29889,
3274,
1233,
29892,
274,
29889,
3306,
29889,
8517,
29892,
1797,
29922,
29955,
511,
13,
9651,
26005,
346,
29898,
29883,
29889,
29925,
347,
346,
1542,
29889,
3274,
1233,
29892,
274,
29889,
3306,
29889,
8517,
29892,
1797,
29922,
29945,
511,
13,
4706,
4514,
13,
13,
4706,
1583,
29889,
9294,
9843,
29898,
1311,
29889,
11802,
29889,
17885,
2955,
29918,
8517,
29892,
3806,
29918,
2914,
29897,
13,
13,
1678,
822,
1243,
29918,
17885,
2955,
29918,
10921,
29898,
1311,
1125,
13,
4706,
3806,
29918,
2914,
353,
5159,
13,
4706,
1583,
29889,
9294,
9843,
29898,
1311,
29889,
11802,
29889,
17885,
2955,
29918,
10921,
29892,
3806,
29918,
2914,
29897,
13,
13,
1678,
822,
1243,
29918,
10921,
29918,
9748,
29898,
1311,
1125,
13,
4706,
3806,
29918,
2914,
353,
29871,
29906,
13,
4706,
1583,
29889,
9294,
9843,
29898,
1311,
29889,
11802,
29889,
10921,
29918,
9748,
29892,
3806,
29918,
2914,
29897,
13,
13,
1678,
822,
1243,
29918,
8517,
29918,
9748,
29898,
1311,
1125,
13,
4706,
3806,
29918,
2914,
353,
29871,
29900,
13,
4706,
1583,
29889,
9294,
9843,
29898,
1311,
29889,
11802,
29889,
8517,
29918,
9748,
29892,
3806,
29918,
2914,
29897,
13,
13,
1678,
822,
1243,
29918,
280,
1664,
29898,
1311,
1125,
13,
4706,
3806,
29918,
2914,
353,
274,
29889,
3306,
29889,
10921,
13,
4706,
1583,
29889,
9294,
9843,
29898,
1311,
29889,
11802,
29889,
280,
1664,
29892,
3806,
29918,
2914,
29897,
13,
13,
1678,
822,
1243,
29918,
280,
328,
29898,
1311,
1125,
13,
4706,
3806,
29918,
2914,
353,
29871,
29906,
13,
4706,
1583,
29889,
9294,
9843,
29898,
1311,
29889,
11802,
29889,
280,
328,
29892,
3806,
29918,
2914,
29897,
13,
13,
1678,
822,
1243,
29918,
12343,
778,
29918,
3198,
292,
29918,
8517,
29898,
1311,
1125,
13,
4706,
3806,
29918,
2914,
353,
518,
29925,
347,
346,
29898,
29883,
29889,
29925,
347,
346,
1542,
29889,
802,
264,
29892,
274,
29889,
3306,
29889,
10921,
4638,
13,
4706,
1583,
29889,
9294,
9843,
29898,
1311,
29889,
11802,
29889,
12343,
778,
29918,
3198,
292,
29918,
8517,
29892,
3806,
29918,
2914,
29897,
13,
13,
1678,
822,
1243,
29918,
12343,
778,
29918,
3198,
292,
29918,
10921,
29898,
1311,
1125,
13,
4706,
3806,
29918,
2914,
353,
5159,
13,
4706,
1583,
29889,
9294,
9843,
29898,
1311,
29889,
11802,
29889,
12343,
778,
29918,
3198,
292,
29918,
10921,
29892,
3806,
29918,
2914,
29897,
13,
13,
1678,
822,
1243,
29918,
11631,
29918,
18434,
29898,
1311,
1125,
13,
4706,
1583,
29889,
9294,
9843,
29898,
1311,
29889,
11802,
29889,
11631,
29918,
18434,
29892,
1583,
29889,
9684,
29918,
11631,
29918,
18434,
29897,
13,
13,
1678,
822,
1243,
29918,
17885,
332,
1849,
29898,
1311,
1125,
13,
4706,
3806,
29918,
2914,
353,
426,
13,
9651,
274,
29889,
3306,
29889,
10921,
29901,
426,
13,
18884,
26005,
346,
29898,
29883,
29889,
29925,
347,
346,
1542,
29889,
9292,
29892,
274,
29889,
3306,
29889,
8517,
1125,
518,
13,
462,
1678,
26005,
346,
29898,
29883,
29889,
29925,
347,
346,
1542,
29889,
802,
264,
29892,
274,
29889,
3306,
29889,
10921,
29897,
13,
18884,
21251,
13,
18884,
26005,
346,
29898,
29883,
29889,
29925,
347,
346,
1542,
29889,
307,
554,
29892,
274,
29889,
3306,
29889,
8517,
29892,
29871,
29896,
1125,
518,
13,
462,
1678,
26005,
346,
29898,
29883,
29889,
29925,
347,
346,
1542,
29889,
3274,
1233,
29892,
274,
29889,
3306,
29889,
10921,
29892,
29871,
29955,
29897,
13,
18884,
4514,
13,
9651,
2981,
13,
9651,
274,
29889,
3306,
29889,
8517,
29901,
426,
13,
18884,
26005,
346,
29898,
29883,
29889,
29925,
347,
346,
1542,
29889,
802,
264,
29892,
274,
29889,
3306,
29889,
10921,
1125,
518,
13,
462,
1678,
26005,
346,
29898,
29883,
29889,
29925,
347,
346,
1542,
29889,
3274,
1233,
29892,
274,
29889,
3306,
29889,
8517,
29892,
29871,
29946,
511,
13,
462,
1678,
26005,
346,
29898,
29883,
29889,
29925,
347,
346,
1542,
29889,
9292,
29892,
274,
29889,
3306,
29889,
8517,
511,
13,
462,
1678,
26005,
346,
29898,
29883,
29889,
29925,
347,
346,
1542,
29889,
28693,
29892,
274,
29889,
3306,
29889,
8517,
29892,
29871,
29896,
511,
13,
462,
1678,
26005,
346,
29898,
29883,
29889,
29925,
347,
346,
1542,
29889,
3274,
1233,
29892,
274,
29889,
3306,
29889,
8517,
29892,
29871,
29953,
511,
13,
462,
1678,
26005,
346,
29898,
29883,
29889,
29925,
347,
346,
1542,
29889,
3959,
523,
29892,
274,
29889,
3306,
29889,
8517,
29892,
29871,
29896,
511,
13,
462,
1678,
26005,
346,
29898,
29883,
29889,
29925,
347,
346,
1542,
29889,
307,
554,
29892,
274,
29889,
3306,
29889,
8517,
29892,
29871,
29896,
511,
13,
13,
18884,
4514,
13,
9651,
500,
13,
4706,
500,
13,
4706,
1583,
29889,
9294,
9843,
29898,
1311,
29889,
11802,
29889,
17885,
332,
1849,
29892,
3806,
29918,
2914,
29897,
13,
13,
1678,
822,
1243,
29918,
29893,
3993,
29898,
1311,
1125,
13,
4706,
3806,
29918,
2914,
353,
274,
29889,
3306,
29889,
10921,
13,
4706,
1583,
29889,
9294,
9843,
29898,
1311,
29889,
11802,
29889,
29893,
3993,
29892,
3806,
29918,
2914,
29897,
13,
13,
1678,
822,
1243,
29918,
5510,
29918,
11631,
29918,
6550,
29918,
29896,
29898,
1311,
1125,
13,
4706,
4337,
29918,
6550,
353,
525,
29874,
29896,
29882,
29947,
29915,
13,
4706,
3806,
29918,
2914,
353,
313,
29903,
4718,
877,
29874,
29896,
5477,
19256,
877,
29882,
29947,
8785,
13,
4706,
1583,
29889,
9294,
9843,
29898,
14199,
29889,
5510,
29918,
11631,
29918,
6550,
29898,
11631,
29918,
6550,
511,
3806,
29918,
2914,
29897,
13,
13,
1678,
822,
1243,
29918,
5510,
29918,
11631,
29918,
6550,
29918,
29906,
29898,
1311,
1125,
13,
4706,
4337,
29918,
6550,
353,
6702,
29874,
29896,
742,
525,
29882,
29947,
1495,
13,
4706,
3806,
29918,
2914,
353,
313,
29903,
4718,
877,
29874,
29896,
5477,
19256,
877,
29882,
29947,
8785,
13,
4706,
1583,
29889,
9294,
9843,
29898,
14199,
29889,
5510,
29918,
11631,
29918,
6550,
29898,
11631,
29918,
6550,
511,
3806,
29918,
2914,
29897,
13,
13,
1678,
822,
1243,
29918,
5510,
29918,
11631,
29918,
6550,
29918,
29941,
29898,
1311,
1125,
13,
4706,
4337,
29918,
6550,
353,
5135,
29900,
29892,
29871,
29900,
511,
313,
29900,
29892,
29871,
29955,
876,
13,
4706,
3806,
29918,
2914,
353,
313,
29903,
4718,
3552,
29900,
29892,
29871,
29900,
8243,
19256,
3552,
29900,
29892,
29871,
29955,
4961,
13,
4706,
1583,
29889,
9294,
9843,
29898,
14199,
29889,
5510,
29918,
11631,
29918,
6550,
29898,
11631,
29918,
6550,
511,
3806,
29918,
2914,
29897,
13,
13,
1678,
822,
1243,
29918,
5510,
29918,
11631,
29918,
6550,
29918,
29946,
29898,
1311,
1125,
13,
4706,
4337,
29918,
6550,
353,
518,
29896,
29892,
29871,
29906,
29892,
29871,
29941,
29892,
29871,
29946,
29962,
13,
4706,
5566,
29918,
710,
353,
313,
13,
9651,
285,
11120,
11631,
29918,
6550,
3790,
11631,
29918,
6550,
10114,
881,
2845,
367,
263,
18761,
470,
263,
1347,
29915,
13,
4706,
1723,
13,
4706,
411,
1583,
29889,
9294,
29934,
1759,
267,
29898,
2451,
29897,
408,
3030,
29901,
13,
9651,
8448,
29889,
5510,
29918,
11631,
29918,
6550,
29898,
11631,
29918,
6550,
29897,
13,
13,
4706,
1583,
29889,
9294,
5574,
29898,
735,
29883,
29918,
710,
297,
851,
29898,
4703,
29889,
11739,
876,
13,
13,
1678,
822,
1243,
29918,
5510,
29918,
11631,
29918,
6550,
29918,
29945,
29898,
1311,
1125,
13,
4706,
4337,
29918,
6550,
353,
313,
29896,
29892,
29871,
29906,
29892,
29871,
29941,
29897,
13,
4706,
5566,
29918,
710,
353,
313,
13,
9651,
285,
29915,
29912,
11631,
29918,
6550,
29913,
18761,
881,
505,
3721,
1023,
3161,
20714,
13,
4706,
1723,
13,
4706,
411,
1583,
29889,
9294,
29934,
1759,
267,
29898,
2451,
29897,
408,
3030,
29901,
13,
9651,
8448,
29889,
5510,
29918,
11631,
29918,
6550,
29898,
11631,
29918,
6550,
29897,
13,
13,
4706,
1583,
29889,
9294,
5574,
29898,
735,
29883,
29918,
710,
297,
851,
29898,
4703,
29889,
11739,
876,
13,
13,
1678,
822,
1243,
29918,
5510,
29918,
11631,
29918,
6550,
29918,
29953,
29898,
1311,
1125,
13,
4706,
28915,
29918,
29896,
353,
525,
7340,
29915,
13,
4706,
28915,
29918,
29906,
353,
525,
29896,
29896,
29915,
13,
4706,
4337,
29918,
6550,
353,
313,
10030,
29918,
29896,
29892,
28915,
29918,
29906,
29897,
13,
4706,
5566,
29918,
710,
353,
313,
13,
9651,
285,
29915,
22995,
15628,
3211,
29991,
450,
3211,
426,
10030,
29918,
29896,
29913,
19056,
525,
13,
9651,
285,
29915,
262,
1852,
421,
11631,
29918,
6550,
3790,
11631,
29918,
6550,
10114,
881,
367,
310,
525,
13,
9651,
525,
1552,
3402,
320,
29915,
29966,
2312,
5299,
4537,
14247,
29915,
988,
15595,
338,
525,
13,
9651,
525,
650,
310,
518,
29874,
29892,
289,
29892,
274,
29892,
270,
29892,
321,
29892,
285,
29892,
330,
29892,
298,
29962,
322,
1353,
525,
13,
9651,
525,
275,
515,
29871,
29896,
304,
29871,
29947,
29915,
13,
4706,
1723,
13,
4706,
411,
1583,
29889,
9294,
29934,
1759,
267,
29898,
2451,
29897,
408,
3030,
29901,
13,
9651,
8448,
29889,
5510,
29918,
11631,
29918,
6550,
29898,
11631,
29918,
6550,
29897,
13,
13,
4706,
1583,
29889,
9294,
5574,
29898,
735,
29883,
29918,
710,
297,
851,
29898,
4703,
29889,
11739,
876,
13,
13,
1678,
822,
1243,
29918,
5510,
29918,
11631,
29918,
6550,
29918,
29955,
29898,
1311,
1125,
13,
4706,
28915,
29918,
29896,
353,
525,
29874,
29896,
29915,
13,
4706,
28915,
29918,
29906,
353,
525,
29896,
29896,
29915,
13,
4706,
4337,
29918,
6550,
353,
313,
10030,
29918,
29896,
29892,
28915,
29918,
29906,
29897,
13,
4706,
5566,
29918,
710,
353,
313,
13,
9651,
285,
29915,
22995,
15628,
3211,
29991,
450,
3211,
426,
10030,
29918,
29906,
29913,
19056,
525,
13,
9651,
285,
29915,
262,
1852,
421,
11631,
29918,
6550,
3790,
11631,
29918,
6550,
10114,
881,
367,
310,
525,
13,
9651,
525,
1552,
3402,
320,
29915,
29966,
2312,
5299,
4537,
14247,
29915,
988,
15595,
338,
525,
13,
9651,
525,
650,
310,
518,
29874,
29892,
289,
29892,
274,
29892,
270,
29892,
321,
29892,
285,
29892,
330,
29892,
298,
29962,
322,
1353,
525,
13,
9651,
525,
275,
515,
29871,
29896,
304,
29871,
29947,
29915,
13,
4706,
1723,
13,
4706,
411,
1583,
29889,
9294,
29934,
1759,
267,
29898,
2451,
29897,
408,
3030,
29901,
13,
9651,
8448,
29889,
5510,
29918,
11631,
29918,
6550,
29898,
11631,
29918,
6550,
29897,
13,
13,
4706,
1583,
29889,
9294,
5574,
29898,
735,
29883,
29918,
710,
297,
851,
29898,
4703,
29889,
11739,
876,
13,
13,
1678,
822,
1243,
29918,
5510,
29918,
11631,
29918,
6550,
29918,
29947,
29898,
1311,
1125,
13,
4706,
28915,
29918,
29896,
353,
313,
29896,
29900,
29892,
29871,
29941,
29900,
29897,
13,
4706,
28915,
29918,
29906,
353,
313,
29896,
29906,
29892,
29871,
29946,
29900,
29897,
13,
4706,
4337,
29918,
6550,
353,
313,
10030,
29918,
29896,
29892,
28915,
29918,
29906,
29897,
13,
4706,
5566,
29918,
710,
353,
313,
13,
9651,
285,
29915,
1576,
3211,
426,
10030,
29918,
29896,
29913,
19056,
297,
1852,
525,
13,
9651,
285,
11120,
11631,
29918,
6550,
3790,
11631,
29918,
6550,
10114,
881,
3721,
367,
263,
525,
13,
9651,
525,
23583,
310,
278,
883,
313,
29874,
29892,
289,
29897,
988,
1716,
263,
322,
289,
525,
13,
9651,
525,
598,
697,
310,
278,
3694,
29871,
29900,
304,
29871,
29955,
29915,
13,
4706,
1723,
13,
4706,
411,
1583,
29889,
9294,
29934,
1759,
267,
29898,
2451,
29897,
408,
3030,
29901,
13,
9651,
8448,
29889,
5510,
29918,
11631,
29918,
6550,
29898,
11631,
29918,
6550,
29897,
13,
13,
4706,
1583,
29889,
9294,
5574,
29898,
735,
29883,
29918,
710,
297,
851,
29898,
4703,
29889,
11739,
876,
13,
13,
1678,
822,
1243,
29918,
5510,
29918,
11631,
29918,
6550,
29918,
29929,
29898,
1311,
1125,
13,
4706,
28915,
29918,
29896,
353,
313,
29900,
29892,
29871,
29945,
29897,
13,
4706,
28915,
29918,
29906,
353,
313,
29896,
29906,
29892,
29871,
29946,
29900,
29897,
13,
4706,
4337,
29918,
6550,
353,
313,
10030,
29918,
29896,
29892,
28915,
29918,
29906,
29897,
13,
4706,
5566,
29918,
710,
353,
313,
13,
9651,
285,
29915,
1576,
3211,
426,
10030,
29918,
29906,
29913,
19056,
297,
1852,
525,
13,
9651,
285,
11120,
11631,
29918,
6550,
3790,
11631,
29918,
6550,
10114,
881,
3721,
367,
263,
525,
13,
9651,
525,
23583,
310,
278,
883,
313,
29874,
29892,
289,
29897,
988,
1716,
263,
322,
289,
525,
13,
9651,
525,
598,
697,
310,
278,
3694,
29871,
29900,
304,
29871,
29955,
29915,
13,
4706,
1723,
13,
4706,
411,
1583,
29889,
9294,
29934,
1759,
267,
29898,
2451,
29897,
408,
3030,
29901,
13,
9651,
8448,
29889,
5510,
29918,
11631,
29918,
6550,
29898,
11631,
29918,
6550,
29897,
13,
13,
4706,
1583,
29889,
9294,
5574,
29898,
735,
29883,
29918,
710,
297,
851,
29898,
4703,
29889,
11739,
876,
13,
13,
1678,
822,
1243,
29918,
5510,
29918,
11631,
29918,
6550,
29918,
29896,
29900,
29898,
1311,
1125,
13,
4706,
4337,
29918,
6550,
353,
5135,
29900,
29892,
29871,
29945,
511,
313,
29900,
29892,
29871,
29945,
876,
13,
4706,
5566,
29918,
710,
353,
313,
13,
9651,
285,
11120,
11631,
29918,
6550,
3790,
11631,
29918,
6550,
10114,
881,
505,
8359,
2752,
322,
525,
13,
9651,
525,
23848,
29915,
13,
4706,
1723,
13,
4706,
411,
1583,
29889,
9294,
29934,
1759,
267,
29898,
2451,
29897,
408,
3030,
29901,
13,
9651,
8448,
29889,
5510,
29918,
11631,
29918,
6550,
29898,
11631,
29918,
6550,
29897,
13,
13,
4706,
1583,
29889,
9294,
5574,
29898,
735,
29883,
29918,
710,
297,
851,
29898,
4703,
29889,
11739,
876,
13,
13,
1678,
822,
1243,
29918,
5510,
29918,
11631,
29918,
6550,
29918,
29896,
29896,
29898,
1311,
1125,
13,
4706,
4337,
29918,
6550,
353,
6702,
29874,
29896,
742,
525,
29874,
29896,
1495,
13,
4706,
5566,
29918,
710,
353,
313,
13,
9651,
285,
11120,
11631,
29918,
6550,
3790,
11631,
29918,
6550,
10114,
881,
505,
8359,
2752,
322,
525,
13,
9651,
525,
23848,
29915,
13,
4706,
1723,
13,
4706,
411,
1583,
29889,
9294,
29934,
1759,
267,
29898,
2451,
29897,
408,
3030,
29901,
13,
9651,
8448,
29889,
5510,
29918,
11631,
29918,
6550,
29898,
11631,
29918,
6550,
29897,
13,
13,
4706,
1583,
29889,
9294,
5574,
29898,
735,
29883,
29918,
710,
297,
851,
29898,
4703,
29889,
11739,
876,
13,
13,
1678,
822,
1243,
29918,
5510,
29918,
11631,
29918,
6550,
29918,
29896,
29906,
29898,
1311,
1125,
13,
4706,
4337,
29918,
6550,
353,
525,
29883,
29953,
29883,
29953,
29915,
13,
4706,
5566,
29918,
710,
353,
313,
13,
9651,
285,
11120,
11631,
29918,
6550,
3790,
11631,
29918,
6550,
10114,
881,
505,
8359,
2752,
322,
525,
13,
9651,
525,
23848,
29915,
13,
4706,
1723,
13,
4706,
411,
1583,
29889,
9294,
29934,
1759,
267,
29898,
2451,
29897,
408,
3030,
29901,
13,
9651,
8448,
29889,
5510,
29918,
11631,
29918,
6550,
29898,
11631,
29918,
6550,
29897,
13,
13,
4706,
1583,
29889,
9294,
5574,
29898,
735,
29883,
29918,
710,
297,
851,
29898,
4703,
29889,
11739,
876,
13,
13,
1678,
822,
1243,
29918,
5510,
29918,
11631,
29918,
6550,
29918,
29896,
29941,
29898,
1311,
1125,
13,
4706,
4337,
29918,
6550,
353,
313,
29903,
4718,
877,
29872,
29896,
5477,
19256,
877,
29872,
29946,
8785,
13,
4706,
3806,
29918,
2914,
353,
4337,
29918,
6550,
13,
4706,
1583,
29889,
9294,
9843,
29898,
14199,
29889,
5510,
29918,
11631,
29918,
6550,
29898,
11631,
29918,
6550,
511,
3806,
29918,
2914,
29897,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
443,
27958,
29889,
3396,
580,
13,
2
] |
FabricUI/widget/ConfigWidget.py | shuaih7/FabricUI | 0 | 194782 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Created on 11.25.2020
Updated on 04.12.2020
Author: <EMAIL>
"""
import os
import sys
import json
from PyQt5.uic import loadUi
from PyQt5.QtGui import QIntValidator
from PyQt5.QtCore import Qt, pyqtSignal, pyqtSlot
from PyQt5.QtWidgets import QTabWidget, QFileDialog
abs_path = os.path.abspath(os.path.dirname(__file__))
cfg_path = os.path.abspath(os.path.join(abs_path, ".."))
def dtype_cast(value, dtype):
if dtype == 'int':
return int(value)
elif dtype == 'float':
return float(value)
elif dtype == 'str':
return str(value)
elif dtype in ['list', 'dict']:
return eval(value)
else:
return value
class ConfigWidget(QTabWidget):
configSignal = pyqtSignal(str)
def __init__(self, config_matrix):
super(ConfigWidget, self).__init__()
loadUi(os.path.join(os.path.abspath(os.path.dirname(__file__)), "ConfigWidget.ui"), self)
self.setWindowFlags(Qt.WindowStaysOnTopHint)
self.config_matrix = config_matrix
self.func_dict = {
'General': {
'save_mode': [self.getSaveMode, self.setSaveMode, 'str'],
'save_dir': [self.lnSaveDir.text, self.lnSaveDir.setText, 'str']
},
'Camera': {
'serial_number': [self.lnSN.text, self.lnSN.setText, 'str'],
'exposure_time': [self.lnExpose.text, self.lnExpose.setText, 'int'],
'gain': [self.lnGain.text, self.lnGain.setText, 'int'],
'binning': [self.lnBinning.text, self.lnBinning.setText, 'int']
},
'Light': {
},
'Model': {
'offsets': [self.getOffsets, self.setOffsets, 'list'],
'input_h': [self.lnInputHeight.text, self.lnInputHeight.setText, 'int'],
'input_w': [self.lnInputWidth.text, self.lnInputWidth.setText, 'int'],
'obj_threshold': [self.lnThresh.text, self.lnThresh.setText, 'float'],
'nms_threshold': [self.lnNMS.text, self.lnNMS.setText, 'float']
}
}
def showConfig(self):
for module in self.func_dict:
params = self.config_matrix[module]
funcs = self.func_dict[module]
self.loadConfig(params, funcs)
self.show()
def loadConfig(self, params, funcs):
for item in funcs:
value = params[item]
func_get, func_set, data_type = funcs[item]
func_set(str(value))
@pyqtSlot()
def updateConfig(self):
for module in self.func_dict:
params = self.config_matrix[module]
funcs = self.func_dict[module]
self.setConfig(params, funcs, module)
self.exitConfig()
def setConfig(self, params, funcs, module):
flag = False
for item in funcs:
func_get, func_set, data_type = funcs[item]
pre_value = str(params[item])
cur_value = str(func_get())
if pre_value != cur_value:
params[item] = dtype_cast(cur_value, data_type)
flag = True
if flag:
self.writeConfig()
self.configSignal.emit(module)
@pyqtSlot()
def exitConfig(self):
self.close()
def writeConfig(self):
json_file = os.path.join(cfg_path, "config.json")
with open(json_file, "w", encoding="utf-8") as f:
cfg_obj = json.dumps(self.config_matrix, indent=4)
f.write(cfg_obj)
f.close()
@pyqtSlot()
def setSaveDir(self):
save_dir = QFileDialog.getExistingDirectory()
if not os.path.exists(save_dir):
save_dir = self.config_matrix['General']['save_dir']
self.lnSaveDir.setText(save_dir)
def setSaveMode(self, mode="1"):
"""Set the save mode: 0 for not saving, 1 for saving all, 2 for saving the defect images
"""
self.save_mode = mode
if str(mode) == "1":
self.btnSaveAll.setChecked(True)
self.btnSaveDef.setChecked(False)
elif str(mode) == "2":
self.btnSaveAll.setChecked(False)
self.btnSaveDef.setChecked(True)
else:
self.btnSaveAll.setChecked(False)
self.btnSaveDef.setChecked(False)
def getSaveMode(self):
mode = "0"
if self.btnSaveDef.isChecked(): mode = "2"
elif self.btnSaveAll.isChecked(): mode = "1"
return mode
@pyqtSlot()
def setSaveAll(self):
if str(self.save_mode) == "1": self.setSaveMode("0")
else: self.setSaveMode("1")
@pyqtSlot()
def setSaveDefect(self):
if str(self.save_mode) == "2": self.setSaveMode("0")
else: self.setSaveMode("2")
def getOffsets(self):
offLeft = int(self.lnOffLeft.text())
offRight = int(self.lnOffRight.text())
offTop = int(self.lnOffTop.text())
offBottom = int(self.lnOffBottom.text())
return str([offLeft, offRight, offTop, offBottom])
def setOffsets(self, offsets):
if isinstance(offsets, str):
offsets = eval(offsets)
offLeft, offRight, offTop, offBottom = offsets
self.lnOffLeft.setText(str(offLeft))
self.lnOffRight.setText(str(offRight))
self.lnOffTop.setText(str(offTop))
self.lnOffBottom.setText(str(offBottom))
| [
1,
18787,
4855,
29914,
2109,
29914,
4691,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
13,
15945,
29908,
13,
20399,
373,
29871,
29896,
29896,
29889,
29906,
29945,
29889,
29906,
29900,
29906,
29900,
13,
29248,
373,
29871,
29900,
29946,
29889,
29896,
29906,
29889,
29906,
29900,
29906,
29900,
13,
13,
13720,
29901,
529,
26862,
6227,
29958,
13,
15945,
29908,
13,
13,
5215,
2897,
13,
5215,
10876,
13,
5215,
4390,
13,
3166,
10772,
17303,
29945,
29889,
29884,
293,
1053,
2254,
29965,
29875,
13,
3166,
10772,
17303,
29945,
29889,
17303,
28707,
1053,
660,
2928,
24204,
13,
3166,
10772,
17303,
29945,
29889,
17303,
9203,
1053,
14705,
29892,
11451,
17915,
10140,
284,
29892,
11451,
17915,
29903,
8276,
13,
3166,
10772,
17303,
29945,
29889,
17303,
8801,
29879,
1053,
660,
8863,
8801,
29892,
660,
2283,
7647,
13,
13,
13,
6897,
29918,
2084,
353,
2897,
29889,
2084,
29889,
370,
1028,
493,
29898,
359,
29889,
2084,
29889,
25721,
22168,
1445,
1649,
876,
13,
16859,
29918,
2084,
353,
2897,
29889,
2084,
29889,
370,
1028,
493,
29898,
359,
29889,
2084,
29889,
7122,
29898,
6897,
29918,
2084,
29892,
376,
636,
5783,
13,
13,
13,
1753,
26688,
29918,
4384,
29898,
1767,
29892,
26688,
1125,
13,
1678,
565,
26688,
1275,
525,
524,
2396,
13,
4706,
736,
938,
29898,
1767,
29897,
13,
1678,
25342,
26688,
1275,
525,
7411,
2396,
13,
4706,
736,
5785,
29898,
1767,
29897,
13,
1678,
25342,
26688,
1275,
525,
710,
2396,
13,
4706,
736,
851,
29898,
1767,
29897,
13,
1678,
25342,
26688,
297,
6024,
1761,
742,
525,
8977,
2033,
29901,
13,
4706,
736,
19745,
29898,
1767,
29897,
13,
1678,
1683,
29901,
13,
4706,
736,
995,
13,
268,
13,
13,
1990,
12782,
8801,
29898,
29984,
8863,
8801,
1125,
13,
1678,
2295,
10140,
284,
353,
11451,
17915,
10140,
284,
29898,
710,
29897,
13,
268,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
2295,
29918,
5344,
1125,
13,
4706,
2428,
29898,
3991,
8801,
29892,
1583,
467,
1649,
2344,
1649,
580,
13,
4706,
2254,
29965,
29875,
29898,
359,
29889,
2084,
29889,
7122,
29898,
359,
29889,
2084,
29889,
370,
1028,
493,
29898,
359,
29889,
2084,
29889,
25721,
22168,
1445,
1649,
8243,
376,
3991,
8801,
29889,
1481,
4968,
1583,
29897,
13,
4706,
1583,
29889,
842,
5907,
15675,
29898,
17303,
29889,
5907,
855,
1036,
2951,
7031,
28016,
29897,
13,
4706,
1583,
29889,
2917,
29918,
5344,
353,
2295,
29918,
5344,
13,
308,
13,
4706,
1583,
29889,
9891,
29918,
8977,
353,
426,
13,
9651,
525,
15263,
2396,
426,
13,
18884,
525,
7620,
29918,
8513,
2396,
518,
1311,
29889,
657,
11371,
6818,
29892,
1583,
29889,
842,
11371,
6818,
29892,
525,
710,
7464,
13,
18884,
525,
7620,
29918,
3972,
2396,
518,
1311,
29889,
3083,
11371,
9170,
29889,
726,
29892,
1583,
29889,
3083,
11371,
9170,
29889,
12038,
29892,
525,
710,
2033,
13,
9651,
2981,
13,
9651,
525,
20717,
2396,
426,
13,
18884,
525,
15550,
29918,
4537,
2396,
518,
1311,
29889,
3083,
19296,
29889,
726,
29892,
1583,
29889,
3083,
19296,
29889,
12038,
29892,
525,
710,
7464,
13,
18884,
525,
735,
1066,
545,
29918,
2230,
2396,
518,
1311,
29889,
3083,
1252,
4220,
29889,
726,
29892,
1583,
29889,
3083,
1252,
4220,
29889,
12038,
29892,
525,
524,
7464,
13,
18884,
525,
29887,
475,
2396,
518,
1311,
29889,
3083,
29954,
475,
29889,
726,
29892,
1583,
29889,
3083,
29954,
475,
29889,
12038,
29892,
525,
524,
7464,
13,
18884,
525,
2109,
1076,
2396,
518,
1311,
29889,
3083,
29933,
262,
1076,
29889,
726,
29892,
1583,
29889,
3083,
29933,
262,
1076,
29889,
12038,
29892,
525,
524,
2033,
13,
9651,
2981,
13,
9651,
525,
20769,
2396,
426,
13,
632,
13,
9651,
2981,
13,
9651,
525,
3195,
2396,
426,
13,
18884,
525,
2696,
7224,
2396,
518,
1311,
29889,
657,
6880,
7224,
29892,
1583,
29889,
842,
6880,
7224,
29892,
525,
1761,
7464,
13,
18884,
525,
2080,
29918,
29882,
2396,
518,
1311,
29889,
3083,
4290,
7011,
29889,
726,
29892,
1583,
29889,
3083,
4290,
7011,
29889,
12038,
29892,
525,
524,
7464,
13,
18884,
525,
2080,
29918,
29893,
2396,
518,
1311,
29889,
3083,
4290,
6110,
29889,
726,
29892,
1583,
29889,
3083,
4290,
6110,
29889,
12038,
29892,
525,
524,
7464,
13,
18884,
525,
5415,
29918,
386,
12268,
2396,
518,
1311,
29889,
3083,
1349,
3781,
29889,
726,
29892,
1583,
29889,
3083,
1349,
3781,
29889,
12038,
29892,
525,
7411,
7464,
13,
18884,
525,
29876,
1516,
29918,
386,
12268,
2396,
518,
1311,
29889,
3083,
29940,
4345,
29889,
726,
29892,
1583,
29889,
3083,
29940,
4345,
29889,
12038,
29892,
525,
7411,
2033,
13,
9651,
500,
13,
4706,
500,
13,
308,
13,
1678,
822,
1510,
3991,
29898,
1311,
1125,
13,
4706,
363,
3883,
297,
1583,
29889,
9891,
29918,
8977,
29901,
13,
9651,
8636,
353,
1583,
29889,
2917,
29918,
5344,
29961,
5453,
29962,
13,
9651,
2090,
2395,
353,
1583,
29889,
9891,
29918,
8977,
29961,
5453,
29962,
13,
9651,
1583,
29889,
1359,
3991,
29898,
7529,
29892,
2090,
2395,
29897,
13,
4706,
1583,
29889,
4294,
580,
13,
308,
13,
1678,
822,
2254,
3991,
29898,
1311,
29892,
8636,
29892,
2090,
2395,
1125,
13,
4706,
363,
2944,
297,
2090,
2395,
29901,
13,
9651,
995,
353,
8636,
29961,
667,
29962,
13,
9651,
3653,
29918,
657,
29892,
3653,
29918,
842,
29892,
848,
29918,
1853,
353,
2090,
2395,
29961,
667,
29962,
13,
9651,
3653,
29918,
842,
29898,
710,
29898,
1767,
876,
13,
268,
13,
1678,
732,
2272,
17915,
29903,
8276,
580,
268,
13,
1678,
822,
2767,
3991,
29898,
1311,
1125,
13,
4706,
363,
3883,
297,
1583,
29889,
9891,
29918,
8977,
29901,
13,
9651,
8636,
353,
1583,
29889,
2917,
29918,
5344,
29961,
5453,
29962,
13,
9651,
2090,
2395,
353,
1583,
29889,
9891,
29918,
8977,
29961,
5453,
29962,
13,
9651,
1583,
29889,
842,
3991,
29898,
7529,
29892,
2090,
2395,
29892,
3883,
29897,
13,
4706,
1583,
29889,
13322,
3991,
580,
13,
308,
13,
1678,
822,
731,
3991,
29898,
1311,
29892,
8636,
29892,
2090,
2395,
29892,
3883,
1125,
13,
4706,
7353,
353,
7700,
13,
4706,
363,
2944,
297,
2090,
2395,
29901,
13,
9651,
3653,
29918,
657,
29892,
3653,
29918,
842,
29892,
848,
29918,
1853,
353,
2090,
2395,
29961,
667,
29962,
13,
9651,
758,
29918,
1767,
353,
851,
29898,
7529,
29961,
667,
2314,
13,
9651,
3151,
29918,
1767,
353,
851,
29898,
9891,
29918,
657,
3101,
13,
632,
13,
9651,
565,
758,
29918,
1767,
2804,
3151,
29918,
1767,
29901,
13,
18884,
8636,
29961,
667,
29962,
353,
26688,
29918,
4384,
29898,
2764,
29918,
1767,
29892,
848,
29918,
1853,
29897,
13,
18884,
7353,
353,
5852,
13,
308,
13,
4706,
565,
7353,
29901,
29871,
13,
9651,
1583,
29889,
3539,
3991,
580,
13,
9651,
1583,
29889,
2917,
10140,
284,
29889,
21976,
29898,
5453,
29897,
13,
308,
13,
1678,
732,
2272,
17915,
29903,
8276,
580,
13,
1678,
822,
6876,
3991,
29898,
1311,
1125,
13,
4706,
1583,
29889,
5358,
580,
13,
308,
13,
1678,
822,
2436,
3991,
29898,
1311,
1125,
13,
4706,
4390,
29918,
1445,
353,
2897,
29889,
2084,
29889,
7122,
29898,
16859,
29918,
2084,
29892,
376,
2917,
29889,
3126,
1159,
13,
4706,
411,
1722,
29898,
3126,
29918,
1445,
29892,
376,
29893,
613,
8025,
543,
9420,
29899,
29947,
1159,
408,
285,
29901,
13,
9651,
274,
16434,
29918,
5415,
353,
4390,
29889,
29881,
17204,
29898,
1311,
29889,
2917,
29918,
5344,
29892,
29536,
29922,
29946,
29897,
13,
9651,
285,
29889,
3539,
29898,
16859,
29918,
5415,
29897,
13,
9651,
285,
29889,
5358,
580,
13,
268,
13,
1678,
732,
2272,
17915,
29903,
8276,
580,
268,
13,
1678,
822,
731,
11371,
9170,
29898,
1311,
1125,
13,
4706,
4078,
29918,
3972,
353,
660,
2283,
7647,
29889,
657,
1252,
15423,
9882,
580,
13,
4706,
565,
451,
2897,
29889,
2084,
29889,
9933,
29898,
7620,
29918,
3972,
1125,
13,
9651,
4078,
29918,
3972,
353,
1583,
29889,
2917,
29918,
5344,
1839,
15263,
16215,
7620,
29918,
3972,
2033,
13,
4706,
1583,
29889,
3083,
11371,
9170,
29889,
12038,
29898,
7620,
29918,
3972,
29897,
13,
308,
13,
1678,
822,
731,
11371,
6818,
29898,
1311,
29892,
4464,
543,
29896,
29908,
1125,
13,
4706,
9995,
2697,
278,
4078,
4464,
29901,
29871,
29900,
363,
451,
14238,
29892,
29871,
29896,
363,
14238,
599,
29892,
29871,
29906,
363,
14238,
278,
23503,
4558,
13,
4706,
9995,
13,
4706,
1583,
29889,
7620,
29918,
8513,
353,
4464,
13,
308,
13,
4706,
565,
851,
29898,
8513,
29897,
1275,
376,
29896,
1115,
29871,
13,
9651,
1583,
29889,
7290,
11371,
3596,
29889,
842,
17817,
29898,
5574,
29897,
13,
9651,
1583,
29889,
7290,
11371,
3206,
29889,
842,
17817,
29898,
8824,
29897,
13,
4706,
25342,
851,
29898,
8513,
29897,
1275,
376,
29906,
1115,
29871,
13,
9651,
1583,
29889,
7290,
11371,
3596,
29889,
842,
17817,
29898,
8824,
29897,
13,
9651,
1583,
29889,
7290,
11371,
3206,
29889,
842,
17817,
29898,
5574,
29897,
13,
4706,
1683,
29901,
13,
9651,
1583,
29889,
7290,
11371,
3596,
29889,
842,
17817,
29898,
8824,
29897,
13,
9651,
1583,
29889,
7290,
11371,
3206,
29889,
842,
17817,
29898,
8824,
29897,
13,
632,
13,
1678,
822,
679,
11371,
6818,
29898,
1311,
1125,
13,
4706,
4464,
353,
376,
29900,
29908,
13,
4706,
565,
1583,
29889,
7290,
11371,
3206,
29889,
275,
17817,
7295,
4464,
353,
376,
29906,
29908,
13,
4706,
25342,
1583,
29889,
7290,
11371,
3596,
29889,
275,
17817,
7295,
4464,
353,
376,
29896,
29908,
13,
308,
13,
4706,
736,
4464,
13,
268,
13,
1678,
732,
2272,
17915,
29903,
8276,
580,
268,
13,
1678,
822,
731,
11371,
3596,
29898,
1311,
1125,
13,
4706,
565,
851,
29898,
1311,
29889,
7620,
29918,
8513,
29897,
1275,
376,
29896,
1115,
1583,
29889,
842,
11371,
6818,
703,
29900,
1159,
13,
4706,
1683,
29901,
1583,
29889,
842,
11371,
6818,
703,
29896,
1159,
13,
268,
13,
1678,
732,
2272,
17915,
29903,
8276,
580,
13,
1678,
822,
731,
11371,
3206,
522,
29898,
1311,
1125,
13,
4706,
565,
851,
29898,
1311,
29889,
7620,
29918,
8513,
29897,
1275,
376,
29906,
1115,
1583,
29889,
842,
11371,
6818,
703,
29900,
1159,
13,
4706,
1683,
29901,
1583,
29889,
842,
11371,
6818,
703,
29906,
1159,
13,
308,
13,
1678,
822,
679,
6880,
7224,
29898,
1311,
1125,
13,
4706,
1283,
8091,
353,
938,
29898,
1311,
29889,
3083,
6880,
8091,
29889,
726,
3101,
13,
4706,
1283,
7341,
353,
938,
29898,
1311,
29889,
3083,
6880,
7341,
29889,
726,
3101,
13,
4706,
1283,
7031,
353,
938,
29898,
1311,
29889,
3083,
6880,
7031,
29889,
726,
3101,
13,
4706,
1283,
15342,
353,
938,
29898,
1311,
29889,
3083,
6880,
15342,
29889,
726,
3101,
13,
308,
13,
4706,
736,
851,
4197,
2696,
8091,
29892,
1283,
7341,
29892,
1283,
7031,
29892,
1283,
15342,
2314,
13,
308,
13,
1678,
822,
731,
6880,
7224,
29898,
1311,
29892,
1283,
7224,
1125,
13,
4706,
565,
338,
8758,
29898,
2696,
7224,
29892,
851,
1125,
13,
9651,
1283,
7224,
353,
19745,
29898,
2696,
7224,
29897,
13,
308,
13,
4706,
1283,
8091,
29892,
1283,
7341,
29892,
1283,
7031,
29892,
1283,
15342,
353,
1283,
7224,
13,
4706,
1583,
29889,
3083,
6880,
8091,
29889,
12038,
29898,
710,
29898,
2696,
8091,
876,
13,
4706,
1583,
29889,
3083,
6880,
7341,
29889,
12038,
29898,
710,
29898,
2696,
7341,
876,
13,
4706,
1583,
29889,
3083,
6880,
7031,
29889,
12038,
29898,
710,
29898,
2696,
7031,
876,
13,
4706,
1583,
29889,
3083,
6880,
15342,
29889,
12038,
29898,
710,
29898,
2696,
15342,
876,
13,
268,
13,
632,
13,
268,
2
] |
Preprocessing/randomSampler.py | kstisser/DeepLearningPointCloud | 0 | 78934 | <reponame>kstisser/DeepLearningPointCloud<filename>Preprocessing/randomSampler.py
import numpy as np
class RandomSampler:
def __init__(self):
print("Opened random sampler")
def randomlySamplePoints(self, points, downsampleNumber):
rows = points.shape[0]
randomIndices = (np.random.choice(rows, size=downsampleNumber, replace=False))
downsampled = points[randomIndices,:]
print("Downsampled shape: ", downsampled.shape)
return downsampled
| [
1,
529,
276,
1112,
420,
29958,
29895,
303,
29415,
29914,
2772,
1022,
29931,
799,
1076,
5228,
20442,
29966,
9507,
29958,
6572,
19170,
29914,
8172,
22966,
20069,
29889,
2272,
13,
5215,
12655,
408,
7442,
13,
13,
1990,
16968,
22966,
20069,
29901,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
1596,
703,
6585,
287,
4036,
3514,
20069,
1159,
13,
13,
1678,
822,
20459,
17708,
20325,
29898,
1311,
29892,
3291,
29892,
1623,
11249,
4557,
1125,
13,
4706,
4206,
353,
3291,
29889,
12181,
29961,
29900,
29962,
13,
4706,
4036,
2568,
1575,
353,
313,
9302,
29889,
8172,
29889,
16957,
29898,
5727,
29892,
2159,
29922,
3204,
11249,
4557,
29892,
5191,
29922,
8824,
876,
13,
4706,
1623,
11249,
29881,
353,
3291,
29961,
8172,
2568,
1575,
29892,
17531,
1678,
13,
13,
4706,
1596,
703,
6767,
11249,
29881,
8267,
29901,
9162,
1623,
11249,
29881,
29889,
12181,
29897,
13,
4706,
736,
1623,
11249,
29881,
13,
2
] |
tests/auth/auth_test.py | oslokommune/okdata-sdk-python | 2 | 1604066 | import json
import logging
import re
import pytest
from okdata.sdk.auth.auth import Authenticate
from okdata.sdk.auth.credentials.client_credentials import ClientCredentialsProvider
from okdata.sdk.config import Config
from okdata.sdk.exceptions import ApiAuthenticateError
from freezegun import freeze_time
from tests.auth.client_credentials_test_utils import (
from_cache_not_expired_token,
from_cache_expired_token,
utc_now,
)
from tests.test_utils import (
client_credentials_response,
client_credentials_response_no_refresh,
)
logging.basicConfig(level=logging.INFO)
config = Config(env="prod")
token_endpoint = "https://login.oslo.kommune.no/auth/realms/api-catalog/protocol/openid-connect/token"
@pytest.fixture(scope="function")
def mock_home_dir(monkeypatch, tmp_path):
monkeypatch.setenv("HOME", str(tmp_path))
@freeze_time(utc_now)
class TestAuthenticate:
def test_authenticate_cache_disabled(self, requests_mock, mock_home_dir):
client_credentials_provider = ClientCredentialsProvider(config)
auth = Authenticate(config=config, token_provider=client_credentials_provider)
auth.file_cache.credentials_cache_enabled = False
response = json.dumps(client_credentials_response)
matcher = re.compile(token_endpoint)
requests_mock.register_uri("POST", matcher, text=response, status_code=200)
auth.login()
assert auth._access_token == client_credentials_response["access_token"]
assert auth._refresh_token == client_credentials_response["refresh_token"]
def test_authenticat_no_cache(self, requests_mock, mock_home_dir):
client_credentials_provider = ClientCredentialsProvider(config)
auth = Authenticate(config=config, token_provider=client_credentials_provider)
auth.file_cache.credentials_cache_enabled = True
response = json.dumps(client_credentials_response)
matcher = re.compile(token_endpoint)
requests_mock.register_uri("POST", matcher, text=response, status_code=200)
auth.login()
assert auth._access_token == client_credentials_response["access_token"]
assert auth._refresh_token == client_credentials_response["refresh_token"]
def test_authenticate_cached_credentials(self, mock_home_dir):
client_credentials_provider = ClientCredentialsProvider(config)
auth = Authenticate(config=config, token_provider=client_credentials_provider)
auth.file_cache.credentials_cache_enabled = True
cached_credentials = {
"provider": "ClientCredentialsProvider",
"access_token": from_cache_not_expired_token,
"refresh_token": from_cache_not_expired_token,
}
auth.file_cache.write_credentials(json.dumps(cached_credentials))
auth.login()
assert auth._access_token == cached_credentials["access_token"]
assert auth._refresh_token == cached_credentials["refresh_token"]
def test_authenticate_refresh_credentials(self, requests_mock, mock_home_dir):
client_credentials_provider = ClientCredentialsProvider(config)
auth = Authenticate(config=config, token_provider=client_credentials_provider)
auth.file_cache.credentials_cache_enabled = True
cached_credentials = {
"provider": "ClientCredentialsProvider",
"access_token": from_cache_not_expired_token,
"refresh_token": from_cache_not_expired_token,
}
auth.file_cache.write_credentials(json.dumps(cached_credentials))
response = json.dumps(client_credentials_response)
matcher = re.compile(token_endpoint)
requests_mock.register_uri("POST", matcher, text=response, status_code=200)
auth.login()
assert auth._access_token == cached_credentials["access_token"]
assert auth._refresh_token == cached_credentials["refresh_token"]
def test_authenticate_expired_tokens(self, requests_mock, mock_home_dir):
client_credentials_provider = ClientCredentialsProvider(config)
auth = Authenticate(config=config, token_provider=client_credentials_provider)
auth.file_cache.credentials_cache_enabled = True
cached_credentials = {
"provider": "TokenServiceProvider",
"access_token": from_cache_expired_token,
"refresh_token": from_cache_expired_token,
}
auth.file_cache.write_credentials(json.dumps(cached_credentials))
response = json.dumps(client_credentials_response)
matcher = re.compile(token_endpoint)
requests_mock.register_uri("POST", matcher, text=response, status_code=200)
auth.login()
print(from_cache_not_expired_token)
print(from_cache_expired_token)
assert auth._access_token == client_credentials_response["access_token"]
assert auth._refresh_token == client_credentials_response["access_token"]
def test_authenticate_expired_access_token(self, requests_mock, mock_home_dir):
client_credentials_provider = ClientCredentialsProvider(config)
auth = Authenticate(config=config, token_provider=client_credentials_provider)
auth.file_cache.credentials_cache_enabled = True
cached_credentials = {
"provider": "TokenServiceProvider",
"access_token": from_cache_expired_token,
"refresh_token": from_cache_not_expired_token,
}
auth.file_cache.write_credentials(json.dumps(cached_credentials))
response = json.dumps(client_credentials_response)
matcher = re.compile(token_endpoint)
requests_mock.register_uri("POST", matcher, text=response, status_code=200)
auth.login()
assert auth._access_token == from_cache_not_expired_token
assert auth._refresh_token == cached_credentials["refresh_token"]
def test_authenticate_fail(self, requests_mock, mock_home_dir):
client_credentials_provider = ClientCredentialsProvider(
config, client_id="wrong_id"
)
auth = Authenticate(config=config, token_provider=client_credentials_provider)
response = json.dumps(
{"error": "authentication error", "error_description": "No such client"}
)
matcher = re.compile(token_endpoint)
requests_mock.register_uri("POST", matcher, text=response, status_code=200)
try:
auth.login()
except ApiAuthenticateError:
assert True
def test_refresh_inactive_session(self, requests_mock, mock_home_dir):
client_credentials_provider = ClientCredentialsProvider(config)
auth = Authenticate(config=config, token_provider=client_credentials_provider)
auth.file_cache.credentials_cache_enabled = True
cached_credentials = {
"provider": "TokenServiceProvider",
"access_token": from_cache_expired_token,
"refresh_token": from_cache_not_expired_token,
}
auth.file_cache.write_credentials(json.dumps(cached_credentials))
error_msg = {
"error": "invalid_grant",
"error_description": "Session not active",
}
refresh_response = {"text": json.dumps(error_msg), "status_code": 400}
login_response = {
"text": json.dumps(client_credentials_response),
"status_code": 200,
}
matcher = re.compile(token_endpoint)
requests_mock.register_uri("POST", matcher, [refresh_response, login_response])
auth.login()
assert auth._access_token == from_cache_not_expired_token
assert auth._refresh_token == cached_credentials["refresh_token"]
def test_refresh_no_refresh_token(self, requests_mock, mock_home_dir):
client_credentials_provider = ClientCredentialsProvider(config)
auth = Authenticate(config=config, token_provider=client_credentials_provider)
auth.file_cache.credentials_cache_enabled = True
cached_credentials = {
"provider": "TokenServiceProvider",
"access_token": from_cache_expired_token,
}
auth.file_cache.write_credentials(json.dumps(cached_credentials))
response = json.dumps(client_credentials_response_no_refresh)
matcher = re.compile(token_endpoint)
requests_mock.register_uri("POST", matcher, text=response, status_code=200)
auth.login()
assert auth._access_token == from_cache_not_expired_token
assert auth._refresh_token is None
| [
1,
1053,
4390,
13,
5215,
12183,
13,
5215,
337,
13,
13,
5215,
11451,
1688,
13,
13,
3166,
3431,
1272,
29889,
15348,
29889,
5150,
29889,
5150,
1053,
13189,
4173,
403,
13,
3166,
3431,
1272,
29889,
15348,
29889,
5150,
29889,
11944,
9409,
29889,
4645,
29918,
11944,
9409,
1053,
12477,
28037,
6980,
13,
3166,
3431,
1272,
29889,
15348,
29889,
2917,
1053,
12782,
13,
3166,
3431,
1272,
29889,
15348,
29889,
11739,
29879,
1053,
29749,
6444,
4173,
403,
2392,
13,
3166,
3889,
28530,
348,
1053,
3889,
911,
29918,
2230,
13,
13,
3166,
6987,
29889,
5150,
29889,
4645,
29918,
11944,
9409,
29918,
1688,
29918,
13239,
1053,
313,
13,
1678,
515,
29918,
8173,
29918,
1333,
29918,
4548,
2859,
29918,
6979,
29892,
13,
1678,
515,
29918,
8173,
29918,
4548,
2859,
29918,
6979,
29892,
13,
1678,
3477,
29883,
29918,
3707,
29892,
13,
29897,
13,
3166,
6987,
29889,
1688,
29918,
13239,
1053,
313,
13,
1678,
3132,
29918,
11944,
9409,
29918,
5327,
29892,
13,
1678,
3132,
29918,
11944,
9409,
29918,
5327,
29918,
1217,
29918,
22379,
29892,
13,
29897,
13,
13,
21027,
29889,
16121,
3991,
29898,
5563,
29922,
21027,
29889,
11690,
29897,
13,
13,
13,
2917,
353,
12782,
29898,
6272,
543,
10633,
1159,
13,
6979,
29918,
29734,
353,
376,
991,
597,
7507,
29889,
359,
417,
29889,
29895,
3011,
1540,
29889,
1217,
29914,
5150,
29914,
6370,
1516,
29914,
2754,
29899,
28045,
29914,
20464,
29914,
3150,
333,
29899,
6915,
29914,
6979,
29908,
13,
13,
13,
29992,
2272,
1688,
29889,
7241,
15546,
29898,
6078,
543,
2220,
1159,
13,
1753,
11187,
29918,
5184,
29918,
3972,
29898,
3712,
446,
1478,
905,
29892,
13128,
29918,
2084,
1125,
13,
1678,
1601,
446,
1478,
905,
29889,
842,
6272,
703,
17353,
613,
851,
29898,
7050,
29918,
2084,
876,
13,
13,
13,
29992,
9021,
911,
29918,
2230,
29898,
329,
29883,
29918,
3707,
29897,
13,
1990,
4321,
6444,
4173,
403,
29901,
13,
1678,
822,
1243,
29918,
27218,
403,
29918,
8173,
29918,
18279,
29898,
1311,
29892,
7274,
29918,
17640,
29892,
11187,
29918,
5184,
29918,
3972,
1125,
13,
4706,
3132,
29918,
11944,
9409,
29918,
18121,
353,
12477,
28037,
6980,
29898,
2917,
29897,
13,
4706,
4817,
353,
13189,
4173,
403,
29898,
2917,
29922,
2917,
29892,
5993,
29918,
18121,
29922,
4645,
29918,
11944,
9409,
29918,
18121,
29897,
13,
13,
4706,
4817,
29889,
1445,
29918,
8173,
29889,
11944,
9409,
29918,
8173,
29918,
17590,
353,
7700,
13,
13,
4706,
2933,
353,
4390,
29889,
29881,
17204,
29898,
4645,
29918,
11944,
9409,
29918,
5327,
29897,
13,
4706,
1993,
261,
353,
337,
29889,
12198,
29898,
6979,
29918,
29734,
29897,
13,
4706,
7274,
29918,
17640,
29889,
9573,
29918,
5338,
703,
5438,
613,
1993,
261,
29892,
1426,
29922,
5327,
29892,
4660,
29918,
401,
29922,
29906,
29900,
29900,
29897,
13,
13,
4706,
4817,
29889,
7507,
580,
13,
4706,
4974,
4817,
3032,
5943,
29918,
6979,
1275,
3132,
29918,
11944,
9409,
29918,
5327,
3366,
5943,
29918,
6979,
3108,
13,
4706,
4974,
4817,
3032,
22379,
29918,
6979,
1275,
3132,
29918,
11944,
9409,
29918,
5327,
3366,
22379,
29918,
6979,
3108,
13,
13,
1678,
822,
1243,
29918,
27218,
271,
29918,
1217,
29918,
8173,
29898,
1311,
29892,
7274,
29918,
17640,
29892,
11187,
29918,
5184,
29918,
3972,
1125,
13,
13,
4706,
3132,
29918,
11944,
9409,
29918,
18121,
353,
12477,
28037,
6980,
29898,
2917,
29897,
13,
4706,
4817,
353,
13189,
4173,
403,
29898,
2917,
29922,
2917,
29892,
5993,
29918,
18121,
29922,
4645,
29918,
11944,
9409,
29918,
18121,
29897,
13,
13,
4706,
4817,
29889,
1445,
29918,
8173,
29889,
11944,
9409,
29918,
8173,
29918,
17590,
353,
5852,
13,
13,
4706,
2933,
353,
4390,
29889,
29881,
17204,
29898,
4645,
29918,
11944,
9409,
29918,
5327,
29897,
13,
4706,
1993,
261,
353,
337,
29889,
12198,
29898,
6979,
29918,
29734,
29897,
13,
4706,
7274,
29918,
17640,
29889,
9573,
29918,
5338,
703,
5438,
613,
1993,
261,
29892,
1426,
29922,
5327,
29892,
4660,
29918,
401,
29922,
29906,
29900,
29900,
29897,
13,
13,
4706,
4817,
29889,
7507,
580,
13,
4706,
4974,
4817,
3032,
5943,
29918,
6979,
1275,
3132,
29918,
11944,
9409,
29918,
5327,
3366,
5943,
29918,
6979,
3108,
13,
4706,
4974,
4817,
3032,
22379,
29918,
6979,
1275,
3132,
29918,
11944,
9409,
29918,
5327,
3366,
22379,
29918,
6979,
3108,
13,
13,
1678,
822,
1243,
29918,
27218,
403,
29918,
29883,
3791,
29918,
11944,
9409,
29898,
1311,
29892,
11187,
29918,
5184,
29918,
3972,
1125,
13,
4706,
3132,
29918,
11944,
9409,
29918,
18121,
353,
12477,
28037,
6980,
29898,
2917,
29897,
13,
4706,
4817,
353,
13189,
4173,
403,
29898,
2917,
29922,
2917,
29892,
5993,
29918,
18121,
29922,
4645,
29918,
11944,
9409,
29918,
18121,
29897,
13,
13,
4706,
4817,
29889,
1445,
29918,
8173,
29889,
11944,
9409,
29918,
8173,
29918,
17590,
353,
5852,
13,
4706,
22152,
29918,
11944,
9409,
353,
426,
13,
9651,
376,
18121,
1115,
376,
4032,
28037,
6980,
613,
13,
9651,
376,
5943,
29918,
6979,
1115,
515,
29918,
8173,
29918,
1333,
29918,
4548,
2859,
29918,
6979,
29892,
13,
9651,
376,
22379,
29918,
6979,
1115,
515,
29918,
8173,
29918,
1333,
29918,
4548,
2859,
29918,
6979,
29892,
13,
4706,
500,
13,
13,
4706,
4817,
29889,
1445,
29918,
8173,
29889,
3539,
29918,
11944,
9409,
29898,
3126,
29889,
29881,
17204,
29898,
29883,
3791,
29918,
11944,
9409,
876,
13,
4706,
4817,
29889,
7507,
580,
13,
4706,
4974,
4817,
3032,
5943,
29918,
6979,
1275,
22152,
29918,
11944,
9409,
3366,
5943,
29918,
6979,
3108,
13,
4706,
4974,
4817,
3032,
22379,
29918,
6979,
1275,
22152,
29918,
11944,
9409,
3366,
22379,
29918,
6979,
3108,
13,
13,
1678,
822,
1243,
29918,
27218,
403,
29918,
22379,
29918,
11944,
9409,
29898,
1311,
29892,
7274,
29918,
17640,
29892,
11187,
29918,
5184,
29918,
3972,
1125,
13,
13,
4706,
3132,
29918,
11944,
9409,
29918,
18121,
353,
12477,
28037,
6980,
29898,
2917,
29897,
13,
4706,
4817,
353,
13189,
4173,
403,
29898,
2917,
29922,
2917,
29892,
5993,
29918,
18121,
29922,
4645,
29918,
11944,
9409,
29918,
18121,
29897,
13,
13,
4706,
4817,
29889,
1445,
29918,
8173,
29889,
11944,
9409,
29918,
8173,
29918,
17590,
353,
5852,
13,
13,
4706,
22152,
29918,
11944,
9409,
353,
426,
13,
9651,
376,
18121,
1115,
376,
4032,
28037,
6980,
613,
13,
9651,
376,
5943,
29918,
6979,
1115,
515,
29918,
8173,
29918,
1333,
29918,
4548,
2859,
29918,
6979,
29892,
13,
9651,
376,
22379,
29918,
6979,
1115,
515,
29918,
8173,
29918,
1333,
29918,
4548,
2859,
29918,
6979,
29892,
13,
4706,
500,
13,
13,
4706,
4817,
29889,
1445,
29918,
8173,
29889,
3539,
29918,
11944,
9409,
29898,
3126,
29889,
29881,
17204,
29898,
29883,
3791,
29918,
11944,
9409,
876,
13,
13,
4706,
2933,
353,
4390,
29889,
29881,
17204,
29898,
4645,
29918,
11944,
9409,
29918,
5327,
29897,
13,
4706,
1993,
261,
353,
337,
29889,
12198,
29898,
6979,
29918,
29734,
29897,
13,
4706,
7274,
29918,
17640,
29889,
9573,
29918,
5338,
703,
5438,
613,
1993,
261,
29892,
1426,
29922,
5327,
29892,
4660,
29918,
401,
29922,
29906,
29900,
29900,
29897,
13,
13,
4706,
4817,
29889,
7507,
580,
13,
4706,
4974,
4817,
3032,
5943,
29918,
6979,
1275,
22152,
29918,
11944,
9409,
3366,
5943,
29918,
6979,
3108,
13,
4706,
4974,
4817,
3032,
22379,
29918,
6979,
1275,
22152,
29918,
11944,
9409,
3366,
22379,
29918,
6979,
3108,
13,
13,
1678,
822,
1243,
29918,
27218,
403,
29918,
4548,
2859,
29918,
517,
12360,
29898,
1311,
29892,
7274,
29918,
17640,
29892,
11187,
29918,
5184,
29918,
3972,
1125,
13,
4706,
3132,
29918,
11944,
9409,
29918,
18121,
353,
12477,
28037,
6980,
29898,
2917,
29897,
13,
4706,
4817,
353,
13189,
4173,
403,
29898,
2917,
29922,
2917,
29892,
5993,
29918,
18121,
29922,
4645,
29918,
11944,
9409,
29918,
18121,
29897,
13,
13,
4706,
4817,
29889,
1445,
29918,
8173,
29889,
11944,
9409,
29918,
8173,
29918,
17590,
353,
5852,
13,
13,
4706,
22152,
29918,
11944,
9409,
353,
426,
13,
9651,
376,
18121,
1115,
376,
6066,
3170,
6980,
613,
13,
9651,
376,
5943,
29918,
6979,
1115,
515,
29918,
8173,
29918,
4548,
2859,
29918,
6979,
29892,
13,
9651,
376,
22379,
29918,
6979,
1115,
515,
29918,
8173,
29918,
4548,
2859,
29918,
6979,
29892,
13,
4706,
500,
13,
13,
4706,
4817,
29889,
1445,
29918,
8173,
29889,
3539,
29918,
11944,
9409,
29898,
3126,
29889,
29881,
17204,
29898,
29883,
3791,
29918,
11944,
9409,
876,
13,
13,
4706,
2933,
353,
4390,
29889,
29881,
17204,
29898,
4645,
29918,
11944,
9409,
29918,
5327,
29897,
13,
4706,
1993,
261,
353,
337,
29889,
12198,
29898,
6979,
29918,
29734,
29897,
13,
4706,
7274,
29918,
17640,
29889,
9573,
29918,
5338,
703,
5438,
613,
1993,
261,
29892,
1426,
29922,
5327,
29892,
4660,
29918,
401,
29922,
29906,
29900,
29900,
29897,
13,
13,
4706,
4817,
29889,
7507,
580,
13,
4706,
1596,
29898,
3166,
29918,
8173,
29918,
1333,
29918,
4548,
2859,
29918,
6979,
29897,
13,
4706,
1596,
29898,
3166,
29918,
8173,
29918,
4548,
2859,
29918,
6979,
29897,
13,
4706,
4974,
4817,
3032,
5943,
29918,
6979,
1275,
3132,
29918,
11944,
9409,
29918,
5327,
3366,
5943,
29918,
6979,
3108,
13,
4706,
4974,
4817,
3032,
22379,
29918,
6979,
1275,
3132,
29918,
11944,
9409,
29918,
5327,
3366,
5943,
29918,
6979,
3108,
13,
13,
1678,
822,
1243,
29918,
27218,
403,
29918,
4548,
2859,
29918,
5943,
29918,
6979,
29898,
1311,
29892,
7274,
29918,
17640,
29892,
11187,
29918,
5184,
29918,
3972,
1125,
13,
4706,
3132,
29918,
11944,
9409,
29918,
18121,
353,
12477,
28037,
6980,
29898,
2917,
29897,
13,
4706,
4817,
353,
13189,
4173,
403,
29898,
2917,
29922,
2917,
29892,
5993,
29918,
18121,
29922,
4645,
29918,
11944,
9409,
29918,
18121,
29897,
13,
13,
4706,
4817,
29889,
1445,
29918,
8173,
29889,
11944,
9409,
29918,
8173,
29918,
17590,
353,
5852,
13,
13,
4706,
22152,
29918,
11944,
9409,
353,
426,
13,
9651,
376,
18121,
1115,
376,
6066,
3170,
6980,
613,
13,
9651,
376,
5943,
29918,
6979,
1115,
515,
29918,
8173,
29918,
4548,
2859,
29918,
6979,
29892,
13,
9651,
376,
22379,
29918,
6979,
1115,
515,
29918,
8173,
29918,
1333,
29918,
4548,
2859,
29918,
6979,
29892,
13,
4706,
500,
13,
13,
4706,
4817,
29889,
1445,
29918,
8173,
29889,
3539,
29918,
11944,
9409,
29898,
3126,
29889,
29881,
17204,
29898,
29883,
3791,
29918,
11944,
9409,
876,
13,
13,
4706,
2933,
353,
4390,
29889,
29881,
17204,
29898,
4645,
29918,
11944,
9409,
29918,
5327,
29897,
13,
4706,
1993,
261,
353,
337,
29889,
12198,
29898,
6979,
29918,
29734,
29897,
13,
4706,
7274,
29918,
17640,
29889,
9573,
29918,
5338,
703,
5438,
613,
1993,
261,
29892,
1426,
29922,
5327,
29892,
4660,
29918,
401,
29922,
29906,
29900,
29900,
29897,
13,
13,
4706,
4817,
29889,
7507,
580,
13,
4706,
4974,
4817,
3032,
5943,
29918,
6979,
1275,
515,
29918,
8173,
29918,
1333,
29918,
4548,
2859,
29918,
6979,
13,
4706,
4974,
4817,
3032,
22379,
29918,
6979,
1275,
22152,
29918,
11944,
9409,
3366,
22379,
29918,
6979,
3108,
13,
13,
1678,
822,
1243,
29918,
27218,
403,
29918,
14057,
29898,
1311,
29892,
7274,
29918,
17640,
29892,
11187,
29918,
5184,
29918,
3972,
1125,
13,
4706,
3132,
29918,
11944,
9409,
29918,
18121,
353,
12477,
28037,
6980,
29898,
13,
9651,
2295,
29892,
3132,
29918,
333,
543,
15866,
549,
29918,
333,
29908,
13,
4706,
1723,
13,
4706,
4817,
353,
13189,
4173,
403,
29898,
2917,
29922,
2917,
29892,
5993,
29918,
18121,
29922,
4645,
29918,
11944,
9409,
29918,
18121,
29897,
13,
13,
4706,
2933,
353,
4390,
29889,
29881,
17204,
29898,
13,
9651,
8853,
2704,
1115,
376,
23055,
1059,
613,
376,
2704,
29918,
8216,
1115,
376,
3782,
1316,
3132,
9092,
13,
4706,
1723,
13,
4706,
1993,
261,
353,
337,
29889,
12198,
29898,
6979,
29918,
29734,
29897,
13,
4706,
7274,
29918,
17640,
29889,
9573,
29918,
5338,
703,
5438,
613,
1993,
261,
29892,
1426,
29922,
5327,
29892,
4660,
29918,
401,
29922,
29906,
29900,
29900,
29897,
13,
13,
4706,
1018,
29901,
13,
9651,
4817,
29889,
7507,
580,
13,
4706,
5174,
29749,
6444,
4173,
403,
2392,
29901,
13,
9651,
4974,
5852,
13,
13,
1678,
822,
1243,
29918,
22379,
29918,
262,
4925,
29918,
7924,
29898,
1311,
29892,
7274,
29918,
17640,
29892,
11187,
29918,
5184,
29918,
3972,
1125,
13,
4706,
3132,
29918,
11944,
9409,
29918,
18121,
353,
12477,
28037,
6980,
29898,
2917,
29897,
13,
4706,
4817,
353,
13189,
4173,
403,
29898,
2917,
29922,
2917,
29892,
5993,
29918,
18121,
29922,
4645,
29918,
11944,
9409,
29918,
18121,
29897,
13,
13,
4706,
4817,
29889,
1445,
29918,
8173,
29889,
11944,
9409,
29918,
8173,
29918,
17590,
353,
5852,
13,
13,
4706,
22152,
29918,
11944,
9409,
353,
426,
13,
9651,
376,
18121,
1115,
376,
6066,
3170,
6980,
613,
13,
9651,
376,
5943,
29918,
6979,
1115,
515,
29918,
8173,
29918,
4548,
2859,
29918,
6979,
29892,
13,
9651,
376,
22379,
29918,
6979,
1115,
515,
29918,
8173,
29918,
1333,
29918,
4548,
2859,
29918,
6979,
29892,
13,
4706,
500,
13,
13,
4706,
4817,
29889,
1445,
29918,
8173,
29889,
3539,
29918,
11944,
9409,
29898,
3126,
29889,
29881,
17204,
29898,
29883,
3791,
29918,
11944,
9409,
876,
13,
13,
4706,
1059,
29918,
7645,
353,
426,
13,
9651,
376,
2704,
1115,
376,
20965,
29918,
629,
424,
613,
13,
9651,
376,
2704,
29918,
8216,
1115,
376,
7317,
451,
6136,
613,
13,
4706,
500,
13,
4706,
11086,
29918,
5327,
353,
8853,
726,
1115,
4390,
29889,
29881,
17204,
29898,
2704,
29918,
7645,
511,
376,
4882,
29918,
401,
1115,
29871,
29946,
29900,
29900,
29913,
13,
4706,
6464,
29918,
5327,
353,
426,
13,
9651,
376,
726,
1115,
4390,
29889,
29881,
17204,
29898,
4645,
29918,
11944,
9409,
29918,
5327,
511,
13,
9651,
376,
4882,
29918,
401,
1115,
29871,
29906,
29900,
29900,
29892,
13,
4706,
500,
13,
4706,
1993,
261,
353,
337,
29889,
12198,
29898,
6979,
29918,
29734,
29897,
13,
4706,
7274,
29918,
17640,
29889,
9573,
29918,
5338,
703,
5438,
613,
1993,
261,
29892,
518,
22379,
29918,
5327,
29892,
6464,
29918,
5327,
2314,
13,
13,
4706,
4817,
29889,
7507,
580,
13,
13,
4706,
4974,
4817,
3032,
5943,
29918,
6979,
1275,
515,
29918,
8173,
29918,
1333,
29918,
4548,
2859,
29918,
6979,
13,
4706,
4974,
4817,
3032,
22379,
29918,
6979,
1275,
22152,
29918,
11944,
9409,
3366,
22379,
29918,
6979,
3108,
13,
13,
1678,
822,
1243,
29918,
22379,
29918,
1217,
29918,
22379,
29918,
6979,
29898,
1311,
29892,
7274,
29918,
17640,
29892,
11187,
29918,
5184,
29918,
3972,
1125,
13,
4706,
3132,
29918,
11944,
9409,
29918,
18121,
353,
12477,
28037,
6980,
29898,
2917,
29897,
13,
4706,
4817,
353,
13189,
4173,
403,
29898,
2917,
29922,
2917,
29892,
5993,
29918,
18121,
29922,
4645,
29918,
11944,
9409,
29918,
18121,
29897,
13,
13,
4706,
4817,
29889,
1445,
29918,
8173,
29889,
11944,
9409,
29918,
8173,
29918,
17590,
353,
5852,
13,
13,
4706,
22152,
29918,
11944,
9409,
353,
426,
13,
9651,
376,
18121,
1115,
376,
6066,
3170,
6980,
613,
13,
9651,
376,
5943,
29918,
6979,
1115,
515,
29918,
8173,
29918,
4548,
2859,
29918,
6979,
29892,
13,
4706,
500,
13,
13,
4706,
4817,
29889,
1445,
29918,
8173,
29889,
3539,
29918,
11944,
9409,
29898,
3126,
29889,
29881,
17204,
29898,
29883,
3791,
29918,
11944,
9409,
876,
13,
13,
4706,
2933,
353,
4390,
29889,
29881,
17204,
29898,
4645,
29918,
11944,
9409,
29918,
5327,
29918,
1217,
29918,
22379,
29897,
13,
4706,
1993,
261,
353,
337,
29889,
12198,
29898,
6979,
29918,
29734,
29897,
13,
4706,
7274,
29918,
17640,
29889,
9573,
29918,
5338,
703,
5438,
613,
1993,
261,
29892,
1426,
29922,
5327,
29892,
4660,
29918,
401,
29922,
29906,
29900,
29900,
29897,
13,
13,
4706,
4817,
29889,
7507,
580,
13,
13,
4706,
4974,
4817,
3032,
5943,
29918,
6979,
1275,
515,
29918,
8173,
29918,
1333,
29918,
4548,
2859,
29918,
6979,
13,
4706,
4974,
4817,
3032,
22379,
29918,
6979,
338,
6213,
13,
2
] |
Easy/1629_slowestKey.py | a-shah8/LeetCode | 1 | 129234 | class Solution:
def slowestKey(self, releaseTimes: List[int], keysPressed: str) -> str:
# Time Complexity: O(N)
# Space Complexity: O(1)
longest = releaseTimes[0]
slowestKey = keysPressed[0]
for i in range(1, len(releaseTimes)):
cur = releaseTimes[i] - releaseTimes[i-1]
if (cur > longest or (cur==longest and keysPressed[i] > slowestKey)):
longest = cur
slowestKey = keysPressed[i]
return slowestKey
| [
1,
770,
24380,
29901,
13,
1678,
822,
5232,
342,
2558,
29898,
1311,
29892,
6507,
29164,
29901,
2391,
29961,
524,
1402,
6611,
24104,
29901,
851,
29897,
1599,
851,
29901,
13,
308,
13,
4706,
396,
5974,
26596,
537,
29901,
438,
29898,
29940,
29897,
13,
4706,
396,
14121,
26596,
537,
29901,
438,
29898,
29896,
29897,
13,
308,
13,
4706,
27217,
353,
6507,
29164,
29961,
29900,
29962,
13,
4706,
5232,
342,
2558,
353,
6611,
24104,
29961,
29900,
29962,
13,
308,
13,
4706,
363,
474,
297,
3464,
29898,
29896,
29892,
7431,
29898,
14096,
29164,
22164,
13,
632,
13,
9651,
3151,
353,
6507,
29164,
29961,
29875,
29962,
448,
6507,
29164,
29961,
29875,
29899,
29896,
29962,
13,
9651,
565,
313,
2764,
1405,
27217,
470,
313,
2764,
1360,
5426,
342,
322,
6611,
24104,
29961,
29875,
29962,
1405,
5232,
342,
2558,
22164,
13,
18884,
27217,
353,
3151,
13,
18884,
5232,
342,
2558,
353,
6611,
24104,
29961,
29875,
29962,
13,
462,
13,
4706,
736,
5232,
342,
2558,
13,
2
] |
lib/main.py | gammaforceio/infrascript | 0 | 56916 | #!/usr/bin/env python3
# vim: set ft=python:sw=4:ts=4
import os
import sys
# This location is set within the Dockerfile.
sys.path.insert(0, '/opt/infra/lib')
from infra import (
load_definitions_file,
parse_args,
get_org_repo,
cleanup_boilerplate,
write_tf_backend_file,
write_tfvars_file,
run_terraform,
save_outputs,
write_awstf_file,
)
if __name__ == '__main__':
# TODO: Ensure the AWS envvars are set
GLOBALS, SECTIONS = load_definitions_file()
args = parse_args(
legal_sections=SECTIONS.keys(),
)
# TODO: Handle the None,None and the x,'' cases
org, repo = get_org_repo()
# Set ourselves in the right directory. This simplifies the rest of the code
# The directory is either specified in the SECTIONS definition or defaults
# to the section name.
os.chdir(SECTIONS[args.section].get('subdir', args.section))
cleanup_boilerplate()
# There are a very few cases where we don't want to write a TF backend file.
# Specifically, when we're creating the TF backend in the first place.
if not args.no_backend:
write_tf_backend_file(
region=GLOBALS['region'],
bucket=GLOBALS['backend']['bucket_name'],
dynamodb_table=GLOBALS['backend']['dynamodb_table'],
org=org,
repo=repo,
environment=args.environment,
section=args.section,
)
section_values = SECTIONS.get(args.section, {}).get('inputs', {})
tfvars_filename = write_tfvars_file(
GLOBALS=GLOBALS,
# These are the values that all sections must handle
global_values={
"environment": args.environment,
# This will be used by the boilerplate aws.tf file
"region": section_values.get('region', GLOBALS['region']),
},
section_values=section_values,
org=org,
repo=repo,
environment=args.environment,
)
write_awstf_file()
# TODO: Generate the boilerplate aws.tf file with the region variable
# The output subcommand's STDOUT needs to be parseable as JSON.
suppress_verbiage = False
if args.subcmd == 'output':
suppress_verbiage = True
# Always run "terraform init". This is safe.
run_terraform('init',
reconfigure=args.reconfigure,
tfvars_filename=tfvars_filename,
suppress_verbiage=suppress_verbiage,
)
options = []
suppress_input = True
# Force -auto-approve otherwise terraform apply/destroy will error out.
if args.subcmd == 'apply':
options.append('-auto-approve')
elif args.subcmd == 'destroy':
options.append('-auto-approve')
elif args.subcmd == 'output':
# The output subcommand cannot handle the -var-file parameter.
tfvars_filename = None
suppress_input = False
# Always display outputs in JSON
options.append('-json')
# Run the command we were asked to run.
rv = run_terraform(args.subcmd,
options=options,
suppress_input=suppress_input,
tfvars_filename=tfvars_filename,
suppress_verbiage=suppress_verbiage,
)
# TODO: Do something here with rv - it's a CompletedProcess object
# q.v. https://docs.python.org/3/library/subprocess.html#subprocess.CompletedProcess
# TODO: Add a remove_outputs() to be called when destroying
# TODO: Add a read_outputs() to be used when reading
if args.subcmd == 'apply':
save_outputs(
bucket=GLOBALS['backend']['bucket_name'],
org=org,
repo=repo,
environment=args.environment,
section=args.section,
)
cleanup_boilerplate()
# Scripts should be clear when they succeed. A visual statement is helpful.
if not suppress_verbiage:
print("Ok", flush=True)
| [
1,
18787,
4855,
29914,
2109,
29914,
6272,
3017,
29941,
13,
29937,
325,
326,
29901,
731,
11791,
29922,
4691,
29901,
2774,
29922,
29946,
29901,
1372,
29922,
29946,
13,
13,
5215,
2897,
13,
5215,
10876,
13,
13,
29937,
910,
4423,
338,
731,
2629,
278,
20868,
1445,
29889,
13,
9675,
29889,
2084,
29889,
7851,
29898,
29900,
29892,
8207,
3670,
29914,
7192,
336,
29914,
1982,
1495,
13,
13,
3166,
3041,
336,
1053,
313,
13,
1678,
2254,
29918,
25476,
2187,
29918,
1445,
29892,
13,
1678,
6088,
29918,
5085,
29892,
13,
1678,
679,
29918,
990,
29918,
20095,
29892,
13,
1678,
5941,
786,
29918,
833,
3955,
2341,
29892,
13,
1678,
2436,
29918,
13264,
29918,
27852,
29918,
1445,
29892,
13,
1678,
2436,
29918,
13264,
16908,
29918,
1445,
29892,
13,
1678,
1065,
29918,
27331,
689,
29892,
13,
1678,
4078,
29918,
4905,
29879,
29892,
13,
1678,
2436,
29918,
1450,
303,
29888,
29918,
1445,
29892,
13,
29897,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
396,
14402,
29901,
22521,
545,
278,
15540,
8829,
16908,
526,
731,
13,
13,
1678,
402,
28902,
1964,
29903,
29892,
3725,
9838,
29903,
353,
2254,
29918,
25476,
2187,
29918,
1445,
580,
13,
13,
1678,
6389,
353,
6088,
29918,
5085,
29898,
13,
4706,
11706,
29918,
27117,
29922,
1660,
9838,
29903,
29889,
8149,
3285,
13,
1678,
1723,
13,
13,
1678,
396,
14402,
29901,
29273,
278,
6213,
29892,
8516,
322,
278,
921,
29892,
4907,
4251,
13,
1678,
1638,
29892,
13761,
353,
679,
29918,
990,
29918,
20095,
580,
13,
13,
1678,
396,
3789,
20278,
297,
278,
1492,
3884,
29889,
910,
5466,
11057,
278,
1791,
310,
278,
775,
13,
1678,
396,
450,
3884,
338,
2845,
6790,
297,
278,
3725,
9838,
29903,
5023,
470,
21274,
13,
1678,
396,
304,
278,
4004,
1024,
29889,
13,
1678,
2897,
29889,
305,
3972,
29898,
1660,
9838,
29903,
29961,
5085,
29889,
2042,
1822,
657,
877,
1491,
3972,
742,
6389,
29889,
2042,
876,
13,
13,
1678,
5941,
786,
29918,
833,
3955,
2341,
580,
13,
13,
1678,
396,
1670,
526,
263,
1407,
2846,
4251,
988,
591,
1016,
29915,
29873,
864,
304,
2436,
263,
323,
29943,
14998,
934,
29889,
13,
1678,
396,
26321,
29892,
746,
591,
29915,
276,
4969,
278,
323,
29943,
14998,
297,
278,
937,
2058,
29889,
13,
1678,
565,
451,
6389,
29889,
1217,
29918,
27852,
29901,
13,
4706,
2436,
29918,
13264,
29918,
27852,
29918,
1445,
29898,
13,
9651,
5120,
29922,
29954,
28902,
1964,
29903,
1839,
12803,
7464,
13,
9651,
20968,
29922,
29954,
28902,
1964,
29903,
1839,
27852,
16215,
21454,
29918,
978,
7464,
13,
9651,
4292,
10396,
29918,
2371,
29922,
29954,
28902,
1964,
29903,
1839,
27852,
16215,
29881,
2926,
10396,
29918,
2371,
7464,
13,
9651,
1638,
29922,
990,
29892,
13,
9651,
13761,
29922,
20095,
29892,
13,
9651,
5177,
29922,
5085,
29889,
20944,
29892,
13,
9651,
4004,
29922,
5085,
29889,
2042,
29892,
13,
4706,
1723,
13,
13,
1678,
4004,
29918,
5975,
353,
3725,
9838,
29903,
29889,
657,
29898,
5085,
29889,
2042,
29892,
6571,
467,
657,
877,
2080,
29879,
742,
426,
1800,
13,
1678,
15886,
16908,
29918,
9507,
353,
2436,
29918,
13264,
16908,
29918,
1445,
29898,
13,
4706,
402,
28902,
1964,
29903,
29922,
29954,
28902,
1964,
29903,
29892,
13,
4706,
396,
4525,
526,
278,
1819,
393,
599,
13926,
1818,
4386,
13,
4706,
5534,
29918,
5975,
3790,
13,
9651,
376,
20944,
1115,
6389,
29889,
20944,
29892,
13,
13,
9651,
396,
910,
674,
367,
1304,
491,
278,
1045,
3955,
2341,
25879,
29889,
13264,
934,
13,
9651,
376,
12803,
1115,
4004,
29918,
5975,
29889,
657,
877,
12803,
742,
402,
28902,
1964,
29903,
1839,
12803,
2033,
511,
13,
4706,
2981,
13,
4706,
4004,
29918,
5975,
29922,
2042,
29918,
5975,
29892,
13,
4706,
1638,
29922,
990,
29892,
13,
4706,
13761,
29922,
20095,
29892,
13,
4706,
5177,
29922,
5085,
29889,
20944,
29892,
13,
1678,
1723,
13,
13,
1678,
2436,
29918,
1450,
303,
29888,
29918,
1445,
580,
13,
13,
1678,
396,
14402,
29901,
3251,
403,
278,
1045,
3955,
2341,
25879,
29889,
13264,
934,
411,
278,
5120,
2286,
13,
13,
1678,
396,
450,
1962,
1014,
6519,
29915,
29879,
6850,
3970,
2692,
4225,
304,
367,
6088,
519,
408,
4663,
29889,
13,
1678,
21301,
29918,
369,
5365,
482,
353,
7700,
13,
1678,
565,
6389,
29889,
1491,
9006,
1275,
525,
4905,
2396,
13,
4706,
21301,
29918,
369,
5365,
482,
353,
5852,
13,
13,
1678,
396,
29849,
1065,
376,
27331,
689,
2069,
1642,
910,
338,
9109,
29889,
13,
1678,
1065,
29918,
27331,
689,
877,
2344,
742,
13,
4706,
337,
17591,
29922,
5085,
29889,
276,
17591,
29892,
13,
4706,
15886,
16908,
29918,
9507,
29922,
13264,
16908,
29918,
9507,
29892,
13,
4706,
21301,
29918,
369,
5365,
482,
29922,
19303,
1253,
29918,
369,
5365,
482,
29892,
13,
1678,
1723,
13,
13,
1678,
3987,
353,
5159,
13,
13,
1678,
21301,
29918,
2080,
353,
5852,
13,
1678,
396,
11004,
448,
6921,
29899,
9961,
345,
6467,
15087,
689,
3394,
29914,
20524,
674,
1059,
714,
29889,
13,
1678,
565,
6389,
29889,
1491,
9006,
1275,
525,
7302,
2396,
13,
4706,
3987,
29889,
4397,
877,
29899,
6921,
29899,
9961,
345,
1495,
13,
1678,
25342,
6389,
29889,
1491,
9006,
1275,
525,
20524,
2396,
13,
4706,
3987,
29889,
4397,
877,
29899,
6921,
29899,
9961,
345,
1495,
13,
1678,
25342,
6389,
29889,
1491,
9006,
1275,
525,
4905,
2396,
13,
4706,
396,
450,
1962,
1014,
6519,
2609,
4386,
278,
448,
1707,
29899,
1445,
3443,
29889,
13,
4706,
15886,
16908,
29918,
9507,
353,
6213,
13,
4706,
21301,
29918,
2080,
353,
7700,
13,
13,
4706,
396,
29849,
2479,
14391,
297,
4663,
13,
4706,
3987,
29889,
4397,
877,
29899,
3126,
1495,
13,
13,
1678,
396,
7525,
278,
1899,
591,
892,
4433,
304,
1065,
29889,
13,
1678,
364,
29894,
353,
1065,
29918,
27331,
689,
29898,
5085,
29889,
1491,
9006,
29892,
13,
4706,
3987,
29922,
6768,
29892,
13,
4706,
21301,
29918,
2080,
29922,
19303,
1253,
29918,
2080,
29892,
13,
4706,
15886,
16908,
29918,
9507,
29922,
13264,
16908,
29918,
9507,
29892,
13,
4706,
21301,
29918,
369,
5365,
482,
29922,
19303,
1253,
29918,
369,
5365,
482,
29892,
13,
1678,
1723,
13,
1678,
396,
14402,
29901,
1938,
1554,
1244,
411,
364,
29894,
448,
372,
29915,
29879,
263,
15642,
9446,
7032,
1203,
13,
1678,
396,
3855,
29889,
29894,
29889,
2045,
597,
2640,
29889,
4691,
29889,
990,
29914,
29941,
29914,
5258,
29914,
1491,
5014,
29889,
1420,
29937,
1491,
5014,
29889,
26010,
7032,
13,
13,
1678,
396,
14402,
29901,
3462,
263,
3349,
29918,
4905,
29879,
580,
304,
367,
2000,
746,
8174,
292,
13,
1678,
396,
14402,
29901,
3462,
263,
1303,
29918,
4905,
29879,
580,
304,
367,
1304,
746,
5183,
13,
1678,
565,
6389,
29889,
1491,
9006,
1275,
525,
7302,
2396,
13,
4706,
4078,
29918,
4905,
29879,
29898,
13,
9651,
20968,
29922,
29954,
28902,
1964,
29903,
1839,
27852,
16215,
21454,
29918,
978,
7464,
13,
9651,
1638,
29922,
990,
29892,
13,
9651,
13761,
29922,
20095,
29892,
13,
9651,
5177,
29922,
5085,
29889,
20944,
29892,
13,
9651,
4004,
29922,
5085,
29889,
2042,
29892,
13,
4706,
1723,
13,
13,
1678,
5941,
786,
29918,
833,
3955,
2341,
580,
13,
13,
1678,
396,
14415,
29879,
881,
367,
2821,
746,
896,
9269,
29889,
319,
7604,
3229,
338,
8444,
29889,
13,
1678,
565,
451,
21301,
29918,
369,
5365,
482,
29901,
13,
4706,
1596,
703,
20434,
613,
28371,
29922,
5574,
29897,
13,
2
] |
cryptopanic-producer/src/utils/fetch_utils.py | bietdoikiem/pipeline-asm-1 | 0 | 69587 | import requests
from requests.models import Response
from asyncio.queues import Queue
import asyncio
async def producer(queue: Queue, arg, callback):
result: Response
try:
result = await callback(arg)
await asyncio.sleep(0.2)
await queue.put(result.json())
except Exception as error:
print("Producer failed (%s)" % error)
return result
async def consumer(queue: Queue, agg_result: list):
result = await queue.get()
queue.task_done()
agg_result.append(result)
async def fetch(url):
try:
r = requests.get(url)
return r
except Exception as error:
print("Request to CryptoPanic failed (%s)" % error)
return None
async def batch_async_fetch(url_list):
agg_result = []
queue = asyncio.Queue()
# fire up both producers and consumers
producers = [
asyncio.create_task(producer(queue, url, fetch)) for url in url_list
]
consumers = [
asyncio.create_task(consumer(queue, agg_result))
for _ in range(len(url_list))
]
# with both producers and consumers running, wait for
# the producers to finish
await asyncio.gather(*producers)
# wait for the remaining tasks to be processed
await queue.join()
# cancel the consumers, which are idle
for c in consumers:
c.cancel()
return agg_result
| [
1,
1053,
7274,
30004,
13,
3166,
7274,
29889,
9794,
1053,
13291,
30004,
13,
3166,
408,
948,
3934,
29889,
802,
1041,
1053,
5462,
434,
30004,
13,
5215,
408,
948,
3934,
30004,
13,
30004,
13,
30004,
13,
12674,
822,
14297,
29898,
9990,
29901,
5462,
434,
29892,
1852,
29892,
6939,
1125,
30004,
13,
29871,
1121,
29901,
13291,
30004,
13,
29871,
1018,
29901,
30004,
13,
1678,
1121,
353,
7272,
6939,
29898,
1191,
8443,
13,
1678,
7272,
408,
948,
3934,
29889,
17059,
29898,
29900,
29889,
29906,
8443,
13,
1678,
7272,
9521,
29889,
649,
29898,
2914,
29889,
3126,
3101,
30004,
13,
29871,
5174,
8960,
408,
1059,
29901,
30004,
13,
1678,
1596,
703,
23665,
2265,
5229,
313,
29995,
29879,
5513,
1273,
1059,
8443,
13,
29871,
736,
1121,
30004,
13,
30004,
13,
30004,
13,
12674,
822,
21691,
29898,
9990,
29901,
5462,
434,
29892,
946,
29887,
29918,
2914,
29901,
1051,
1125,
30004,
13,
29871,
1121,
353,
7272,
9521,
29889,
657,
26471,
13,
29871,
9521,
29889,
7662,
29918,
15091,
26471,
13,
29871,
946,
29887,
29918,
2914,
29889,
4397,
29898,
2914,
8443,
13,
30004,
13,
30004,
13,
12674,
822,
6699,
29898,
2271,
1125,
30004,
13,
29871,
1018,
29901,
30004,
13,
1678,
364,
353,
7274,
29889,
657,
29898,
2271,
8443,
13,
1678,
736,
364,
30004,
13,
29871,
5174,
8960,
408,
1059,
29901,
30004,
13,
1678,
1596,
703,
3089,
304,
315,
17929,
23684,
293,
5229,
313,
29995,
29879,
5513,
1273,
1059,
8443,
13,
29871,
736,
6213,
30004,
13,
30004,
13,
30004,
13,
12674,
822,
9853,
29918,
12674,
29918,
9155,
29898,
2271,
29918,
1761,
1125,
30004,
13,
29871,
946,
29887,
29918,
2914,
353,
5159,
30004,
13,
29871,
9521,
353,
408,
948,
3934,
29889,
10620,
26471,
13,
30004,
13,
29871,
396,
3974,
701,
1716,
1391,
22543,
322,
11233,
414,
30004,
13,
29871,
1391,
22543,
353,
518,
30004,
13,
418,
408,
948,
3934,
29889,
3258,
29918,
7662,
29898,
5498,
2265,
29898,
9990,
29892,
3142,
29892,
6699,
876,
363,
3142,
297,
3142,
29918,
1761,
30004,
13,
29871,
4514,
30004,
13,
29871,
11233,
414,
353,
518,
30004,
13,
418,
408,
948,
3934,
29889,
3258,
29918,
7662,
29898,
25978,
261,
29898,
9990,
29892,
946,
29887,
29918,
2914,
876,
30004,
13,
418,
363,
903,
297,
3464,
29898,
2435,
29898,
2271,
29918,
1761,
876,
30004,
13,
29871,
4514,
30004,
13,
30004,
13,
29871,
396,
411,
1716,
1391,
22543,
322,
11233,
414,
2734,
29892,
4480,
363,
30004,
13,
29871,
396,
278,
1391,
22543,
304,
8341,
30004,
13,
29871,
7272,
408,
948,
3934,
29889,
29887,
1624,
10456,
5498,
22543,
8443,
13,
30004,
13,
29871,
396,
4480,
363,
278,
9886,
9595,
304,
367,
19356,
30004,
13,
29871,
7272,
9521,
29889,
7122,
26471,
13,
30004,
13,
29871,
396,
12611,
278,
11233,
414,
29892,
607,
526,
28132,
30004,
13,
29871,
363,
274,
297,
11233,
414,
29901,
30004,
13,
1678,
274,
29889,
20713,
26471,
13,
30004,
13,
29871,
736,
946,
29887,
29918,
2914,
30004,
13,
2
] |
mrplot/modules/design/variable_design.py | enzofabricio/mrplot | 0 | 24126 | <reponame>enzofabricio/mrplot
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'variable_design.ui'
#
# Created by: PyQt5 UI code generator 5.11.3
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.setWindowModality(QtCore.Qt.WindowModal)
MainWindow.resize(929, 461)
MainWindow.setMinimumSize(QtCore.QSize(929, 461))
MainWindow.setMaximumSize(QtCore.QSize(929, 461))
MainWindow.setStyleSheet("background-color: rgb(70, 70, 70);")
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.x_variable_lineEdit = QtWidgets.QLineEdit(self.centralwidget)
self.x_variable_lineEdit.setGeometry(QtCore.QRect(10, 40, 651, 51))
font = QtGui.QFont()
font.setFamily("Courier")
font.setPointSize(10)
self.x_variable_lineEdit.setFont(font)
self.x_variable_lineEdit.setStyleSheet("color: rgb(255, 255, 255);\n"
"background-color: rgb(53, 53, 53);\n"
"\n"
"")
self.x_variable_lineEdit.setObjectName("x_variable_lineEdit")
self.newVariableButton = QtWidgets.QPushButton(self.centralwidget)
self.newVariableButton.setGeometry(QtCore.QRect(10, 380, 35, 35))
font = QtGui.QFont()
font.setPointSize(8)
self.newVariableButton.setFont(font)
self.newVariableButton.setStyleSheet("color: rgb(255, 255, 255);")
self.newVariableButton.setText("")
self.newVariableButton.setObjectName("newVariableButton")
self.variablesList_treeWidget = QtWidgets.QTreeWidget(self.centralwidget)
self.variablesList_treeWidget.setGeometry(QtCore.QRect(10, 190, 651, 181))
self.variablesList_treeWidget.setStyleSheet("color: rgb(1, 1, 1);\n"
"background-color: rgb(120, 120, 120);")
self.variablesList_treeWidget.setObjectName("variablesList_treeWidget")
self.variablesList_treeWidget.header().setDefaultSectionSize(120)
self.RemoveVar_Button = QtWidgets.QPushButton(self.centralwidget)
self.RemoveVar_Button.setGeometry(QtCore.QRect(50, 380, 35, 35))
self.RemoveVar_Button.setStyleSheet("color: rgb(255, 255, 255);")
self.RemoveVar_Button.setText("")
self.RemoveVar_Button.setObjectName("RemoveVar_Button")
self.label = QtWidgets.QLabel(self.centralwidget)
self.label.setGeometry(QtCore.QRect(10, 10, 91, 16))
font = QtGui.QFont()
font.setPointSize(8)
self.label.setFont(font)
self.label.setStyleSheet("color: rgb(255, 255, 255);")
self.label.setObjectName("label")
self.x_expr_lineEdit = QtWidgets.QLineEdit(self.centralwidget)
self.x_expr_lineEdit.setGeometry(QtCore.QRect(110, 10, 551, 20))
font = QtGui.QFont()
font.setFamily("Courier")
self.x_expr_lineEdit.setFont(font)
self.x_expr_lineEdit.setStyleSheet("color: rgb(204, 204, 204);")
self.x_expr_lineEdit.setReadOnly(True)
self.x_expr_lineEdit.setObjectName("x_expr_lineEdit")
self.y_variable_lineEdit = QtWidgets.QLineEdit(self.centralwidget)
self.y_variable_lineEdit.setGeometry(QtCore.QRect(10, 130, 651, 51))
font = QtGui.QFont()
font.setFamily("Courier")
font.setPointSize(10)
self.y_variable_lineEdit.setFont(font)
self.y_variable_lineEdit.setStyleSheet("color: rgb(255, 255, 255);\n"
"background-color: rgb(53, 53, 53);\n"
"\n"
"")
self.y_variable_lineEdit.setObjectName("y_variable_lineEdit")
self.label_2 = QtWidgets.QLabel(self.centralwidget)
self.label_2.setGeometry(QtCore.QRect(10, 100, 91, 16))
font = QtGui.QFont()
font.setPointSize(8)
self.label_2.setFont(font)
self.label_2.setStyleSheet("color: rgb(255, 255, 255);")
self.label_2.setObjectName("label_2")
self.y_expr_lineEdit = QtWidgets.QLineEdit(self.centralwidget)
self.y_expr_lineEdit.setGeometry(QtCore.QRect(110, 100, 551, 20))
font = QtGui.QFont()
font.setFamily("Courier")
self.y_expr_lineEdit.setFont(font)
self.y_expr_lineEdit.setStyleSheet("color: rgb(204, 204, 204);")
self.y_expr_lineEdit.setReadOnly(True)
self.y_expr_lineEdit.setObjectName("y_expr_lineEdit")
self.apply_pushButton = QtWidgets.QPushButton(self.centralwidget)
self.apply_pushButton.setGeometry(QtCore.QRect(500, 380, 75, 35))
self.apply_pushButton.setStyleSheet("color: rgb(255, 255, 255);")
self.apply_pushButton.setObjectName("apply_pushButton")
self.cancel_pushButton = QtWidgets.QPushButton(self.centralwidget)
self.cancel_pushButton.setGeometry(QtCore.QRect(580, 380, 75, 35))
self.cancel_pushButton.setStyleSheet("color: rgb(255, 255, 255);")
self.cancel_pushButton.setObjectName("cancel_pushButton")
self.ok_btn = QtWidgets.QPushButton(self.centralwidget)
self.ok_btn.setGeometry(QtCore.QRect(420, 380, 75, 35))
self.ok_btn.setStyleSheet("color: rgb(255, 255, 255);")
self.ok_btn.setObjectName("ok_btn")
self.groupBox = QtWidgets.QGroupBox(self.centralwidget)
self.groupBox.setGeometry(QtCore.QRect(670, 0, 251, 181))
self.groupBox.setStyleSheet("color: rgb(200, 200, 200);")
self.groupBox.setObjectName("groupBox")
self.grab_gbl_btn = QtWidgets.QPushButton(self.groupBox)
self.grab_gbl_btn.setGeometry(QtCore.QRect(90, 150, 75, 23))
self.grab_gbl_btn.setObjectName("grab_gbl_btn")
self.rm_gbl_btn = QtWidgets.QPushButton(self.groupBox)
self.rm_gbl_btn.setGeometry(QtCore.QRect(170, 150, 71, 23))
self.rm_gbl_btn.setObjectName("rm_gbl_btn")
self.global_treeview = QtWidgets.QTreeView(self.groupBox)
self.global_treeview.setGeometry(QtCore.QRect(10, 20, 231, 121))
self.global_treeview.setObjectName("global_treeview")
self.set_gbl_btn = QtWidgets.QPushButton(self.groupBox)
self.set_gbl_btn.setGeometry(QtCore.QRect(10, 150, 75, 23))
self.set_gbl_btn.setToolTip("")
self.set_gbl_btn.setObjectName("set_gbl_btn")
self.groupBox_2 = QtWidgets.QGroupBox(self.centralwidget)
self.groupBox_2.setGeometry(QtCore.QRect(670, 190, 251, 221))
self.groupBox_2.setStyleSheet("color: rgb(200, 200, 200);")
self.groupBox_2.setObjectName("groupBox_2")
self.search_alf_le = QtWidgets.QLineEdit(self.groupBox_2)
self.search_alf_le.setGeometry(QtCore.QRect(10, 190, 110, 20))
self.search_alf_le.setStyleSheet("color: rgb(200, 200, 200);")
self.search_alf_le.setObjectName("search_alf_le")
self.search_num_le = QtWidgets.QLineEdit(self.groupBox_2)
self.search_num_le.setGeometry(QtCore.QRect(130, 190, 110, 20))
self.search_num_le.setStyleSheet("color: rgb(200, 200, 200);")
self.search_num_le.setObjectName("search_num_le")
self.num_view = QtWidgets.QListView(self.groupBox_2)
self.num_view.setGeometry(QtCore.QRect(130, 60, 110, 121))
self.num_view.setStyleSheet("color: rgb(150, 150, 150);\n"
"background-color: rgb(60, 60, 60);\n"
"")
self.num_view.setObjectName("num_view")
self.alf_view = QtWidgets.QListView(self.groupBox_2)
self.alf_view.setGeometry(QtCore.QRect(10, 60, 110, 121))
self.alf_view.setStyleSheet("color: rgb(150, 150, 150);\n"
"background-color: rgb(60, 60, 60);\n"
"")
self.alf_view.setObjectName("alf_view")
self.alf_label_2 = QtWidgets.QLabel(self.groupBox_2)
self.alf_label_2.setGeometry(QtCore.QRect(140, 40, 51, 16))
font = QtGui.QFont()
font.setPointSize(8)
self.alf_label_2.setFont(font)
self.alf_label_2.setStyleSheet("color: rgb(255, 255, 255);")
self.alf_label_2.setObjectName("alf_label_2")
self.alf_label = QtWidgets.QLabel(self.groupBox_2)
self.alf_label.setGeometry(QtCore.QRect(10, 40, 51, 16))
font = QtGui.QFont()
font.setPointSize(8)
self.alf_label.setFont(font)
self.alf_label.setStyleSheet("color: rgb(255, 255, 255);")
self.alf_label.setObjectName("alf_label")
self.add2Y_checkBox = QtWidgets.QCheckBox(self.groupBox_2)
self.add2Y_checkBox.setGeometry(QtCore.QRect(90, 20, 61, 17))
self.add2Y_checkBox.setStyleSheet("color: rgb(255, 255, 255);")
self.add2Y_checkBox.setObjectName("add2Y_checkBox")
self.add2XcheckBox = QtWidgets.QCheckBox(self.groupBox_2)
self.add2XcheckBox.setGeometry(QtCore.QRect(10, 20, 70, 17))
self.add2XcheckBox.setStyleSheet("color: rgb(255, 255, 255);")
self.add2XcheckBox.setObjectName("add2XcheckBox")
MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtWidgets.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 929, 21))
self.menubar.setObjectName("menubar")
MainWindow.setMenuBar(self.menubar)
self.statusbar = QtWidgets.QStatusBar(MainWindow)
self.statusbar.setObjectName("statusbar")
MainWindow.setStatusBar(self.statusbar)
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "Variables"))
self.variablesList_treeWidget.headerItem().setText(0, _translate("MainWindow", "Variable Name"))
self.variablesList_treeWidget.headerItem().setText(1, _translate("MainWindow", "Label"))
self.variablesList_treeWidget.headerItem().setText(2, _translate("MainWindow", "x"))
self.variablesList_treeWidget.headerItem().setText(3, _translate("MainWindow", "y"))
self.variablesList_treeWidget.headerItem().setText(4, _translate("MainWindow", "Restart"))
self.variablesList_treeWidget.headerItem().setText(5, _translate("MainWindow", "csv"))
self.variablesList_treeWidget.headerItem().setText(6, _translate("MainWindow", "Plot"))
self.label.setText(_translate("MainWindow", "Current xVariable"))
self.label_2.setText(_translate("MainWindow", "Current yVariable"))
self.apply_pushButton.setText(_translate("MainWindow", "Apply"))
self.cancel_pushButton.setText(_translate("MainWindow", "Cancel"))
self.ok_btn.setText(_translate("MainWindow", "Ok"))
self.groupBox.setTitle(_translate("MainWindow", "Global expressions"))
self.grab_gbl_btn.setText(_translate("MainWindow", "grab"))
self.rm_gbl_btn.setText(_translate("MainWindow", "remove"))
self.set_gbl_btn.setText(_translate("MainWindow", "set"))
self.groupBox_2.setTitle(_translate("MainWindow", "Plot_alf | Plot_num"))
self.search_alf_le.setPlaceholderText(_translate("MainWindow", "find plot_alfa"))
self.search_num_le.setPlaceholderText(_translate("MainWindow", "find plot_num"))
self.alf_label_2.setText(_translate("MainWindow", "plot_num"))
self.alf_label.setText(_translate("MainWindow", "plot_alf"))
self.add2Y_checkBox.setText(_translate("MainWindow", "Add to Y"))
self.add2XcheckBox.setText(_translate("MainWindow", "Add to X"))
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
MainWindow = QtWidgets.QMainWindow()
ui = Ui_MainWindow()
ui.setupUi(MainWindow)
MainWindow.show()
sys.exit(app.exec_())
| [
1,
529,
276,
1112,
420,
29958,
4666,
974,
370,
2200,
601,
29914,
29885,
29878,
5317,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
30004,
13,
30004,
13,
29937,
3812,
5314,
5759,
515,
5183,
14313,
934,
525,
11918,
29918,
13892,
29889,
1481,
29915,
30004,
13,
29937,
30004,
13,
29937,
6760,
630,
491,
29901,
10772,
17303,
29945,
3740,
775,
15299,
29871,
29945,
29889,
29896,
29896,
29889,
29941,
30004,
13,
29937,
30004,
13,
29937,
399,
25614,
29991,
2178,
3620,
1754,
297,
445,
934,
674,
367,
5714,
29991,
30004,
13,
30004,
13,
3166,
10772,
17303,
29945,
1053,
14705,
9203,
29892,
14705,
28707,
29892,
14705,
8801,
29879,
30004,
13,
30004,
13,
1990,
501,
29875,
29918,
6330,
5907,
29898,
3318,
1125,
30004,
13,
1678,
822,
6230,
29965,
29875,
29898,
1311,
29892,
4241,
5907,
1125,
30004,
13,
4706,
4241,
5907,
29889,
842,
2061,
1170,
703,
6330,
5907,
1159,
30004,
13,
4706,
4241,
5907,
29889,
842,
5907,
2111,
2877,
29898,
17303,
9203,
29889,
17303,
29889,
5907,
19751,
8443,
13,
4706,
4241,
5907,
29889,
21476,
29898,
29929,
29906,
29929,
29892,
29871,
29946,
29953,
29896,
8443,
13,
4706,
4241,
5907,
29889,
842,
8140,
12539,
3505,
29898,
17303,
9203,
29889,
29984,
3505,
29898,
29929,
29906,
29929,
29892,
29871,
29946,
29953,
29896,
876,
30004,
13,
4706,
4241,
5907,
29889,
842,
7976,
12539,
3505,
29898,
17303,
9203,
29889,
29984,
3505,
29898,
29929,
29906,
29929,
29892,
29871,
29946,
29953,
29896,
876,
30004,
13,
4706,
4241,
5907,
29889,
842,
5568,
10654,
703,
7042,
29899,
2780,
29901,
15552,
29890,
29898,
29955,
29900,
29892,
29871,
29955,
29900,
29892,
29871,
29955,
29900,
416,
1159,
30004,
13,
4706,
1583,
29889,
25171,
8030,
353,
14705,
8801,
29879,
29889,
29984,
8801,
29898,
6330,
5907,
8443,
13,
4706,
1583,
29889,
25171,
8030,
29889,
842,
2061,
1170,
703,
25171,
8030,
1159,
30004,
13,
4706,
1583,
29889,
29916,
29918,
11918,
29918,
1220,
6103,
353,
14705,
8801,
29879,
29889,
2239,
457,
6103,
29898,
1311,
29889,
25171,
8030,
8443,
13,
4706,
1583,
29889,
29916,
29918,
11918,
29918,
1220,
6103,
29889,
842,
7999,
7843,
29898,
17303,
9203,
29889,
29984,
7364,
29898,
29896,
29900,
29892,
29871,
29946,
29900,
29892,
29871,
29953,
29945,
29896,
29892,
29871,
29945,
29896,
876,
30004,
13,
4706,
4079,
353,
14705,
28707,
29889,
29984,
9824,
26471,
13,
4706,
4079,
29889,
842,
27104,
703,
29907,
283,
4336,
1159,
30004,
13,
4706,
4079,
29889,
842,
5228,
3505,
29898,
29896,
29900,
8443,
13,
4706,
1583,
29889,
29916,
29918,
11918,
29918,
1220,
6103,
29889,
842,
9824,
29898,
5657,
8443,
13,
4706,
1583,
29889,
29916,
29918,
11918,
29918,
1220,
6103,
29889,
842,
5568,
10654,
703,
2780,
29901,
15552,
29890,
29898,
29906,
29945,
29945,
29892,
29871,
29906,
29945,
29945,
29892,
29871,
29906,
29945,
29945,
416,
29905,
29876,
19451,
13,
29908,
7042,
29899,
2780,
29901,
15552,
29890,
29898,
29945,
29941,
29892,
29871,
29945,
29941,
29892,
29871,
29945,
29941,
416,
29905,
29876,
19451,
13,
26732,
29876,
19451,
13,
29908,
1159,
30004,
13,
4706,
1583,
29889,
29916,
29918,
11918,
29918,
1220,
6103,
29889,
842,
2061,
1170,
703,
29916,
29918,
11918,
29918,
1220,
6103,
1159,
30004,
13,
4706,
1583,
29889,
1482,
16174,
3125,
353,
14705,
8801,
29879,
29889,
29984,
27031,
3125,
29898,
1311,
29889,
25171,
8030,
8443,
13,
4706,
1583,
29889,
1482,
16174,
3125,
29889,
842,
7999,
7843,
29898,
17303,
9203,
29889,
29984,
7364,
29898,
29896,
29900,
29892,
29871,
29941,
29947,
29900,
29892,
29871,
29941,
29945,
29892,
29871,
29941,
29945,
876,
30004,
13,
4706,
4079,
353,
14705,
28707,
29889,
29984,
9824,
26471,
13,
4706,
4079,
29889,
842,
5228,
3505,
29898,
29947,
8443,
13,
4706,
1583,
29889,
1482,
16174,
3125,
29889,
842,
9824,
29898,
5657,
8443,
13,
4706,
1583,
29889,
1482,
16174,
3125,
29889,
842,
5568,
10654,
703,
2780,
29901,
15552,
29890,
29898,
29906,
29945,
29945,
29892,
29871,
29906,
29945,
29945,
29892,
29871,
29906,
29945,
29945,
416,
1159,
30004,
13,
4706,
1583,
29889,
1482,
16174,
3125,
29889,
12038,
703,
1159,
30004,
13,
4706,
1583,
29889,
1482,
16174,
3125,
29889,
842,
2061,
1170,
703,
1482,
16174,
3125,
1159,
30004,
13,
4706,
1583,
29889,
20897,
1293,
29918,
8336,
8801,
353,
14705,
8801,
29879,
29889,
29984,
9643,
8801,
29898,
1311,
29889,
25171,
8030,
8443,
13,
4706,
1583,
29889,
20897,
1293,
29918,
8336,
8801,
29889,
842,
7999,
7843,
29898,
17303,
9203,
29889,
29984,
7364,
29898,
29896,
29900,
29892,
29871,
29896,
29929,
29900,
29892,
29871,
29953,
29945,
29896,
29892,
29871,
29896,
29947,
29896,
876,
30004,
13,
4706,
1583,
29889,
20897,
1293,
29918,
8336,
8801,
29889,
842,
5568,
10654,
703,
2780,
29901,
15552,
29890,
29898,
29896,
29892,
29871,
29896,
29892,
29871,
29896,
416,
29905,
29876,
19451,
13,
29908,
7042,
29899,
2780,
29901,
15552,
29890,
29898,
29896,
29906,
29900,
29892,
29871,
29896,
29906,
29900,
29892,
29871,
29896,
29906,
29900,
416,
1159,
30004,
13,
4706,
1583,
29889,
20897,
1293,
29918,
8336,
8801,
29889,
842,
2061,
1170,
703,
20897,
1293,
29918,
8336,
8801,
1159,
30004,
13,
4706,
1583,
29889,
20897,
1293,
29918,
8336,
8801,
29889,
6672,
2141,
842,
4592,
13438,
3505,
29898,
29896,
29906,
29900,
8443,
13,
4706,
1583,
29889,
15941,
9037,
29918,
3125,
353,
14705,
8801,
29879,
29889,
29984,
27031,
3125,
29898,
1311,
29889,
25171,
8030,
8443,
13,
4706,
1583,
29889,
15941,
9037,
29918,
3125,
29889,
842,
7999,
7843,
29898,
17303,
9203,
29889,
29984,
7364,
29898,
29945,
29900,
29892,
29871,
29941,
29947,
29900,
29892,
29871,
29941,
29945,
29892,
29871,
29941,
29945,
876,
30004,
13,
4706,
1583,
29889,
15941,
9037,
29918,
3125,
29889,
842,
5568,
10654,
703,
2780,
29901,
15552,
29890,
29898,
29906,
29945,
29945,
29892,
29871,
29906,
29945,
29945,
29892,
29871,
29906,
29945,
29945,
416,
1159,
30004,
13,
4706,
1583,
29889,
15941,
9037,
29918,
3125,
29889,
12038,
703,
1159,
30004,
13,
4706,
1583,
29889,
15941,
9037,
29918,
3125,
29889,
842,
2061,
1170,
703,
15941,
9037,
29918,
3125,
1159,
30004,
13,
4706,
1583,
29889,
1643,
353,
14705,
8801,
29879,
29889,
2239,
1107,
29898,
1311,
29889,
25171,
8030,
8443,
13,
4706,
1583,
29889,
1643,
29889,
842,
7999,
7843,
29898,
17303,
9203,
29889,
29984,
7364,
29898,
29896,
29900,
29892,
29871,
29896,
29900,
29892,
29871,
29929,
29896,
29892,
29871,
29896,
29953,
876,
30004,
13,
4706,
4079,
353,
14705,
28707,
29889,
29984,
9824,
26471,
13,
4706,
4079,
29889,
842,
5228,
3505,
29898,
29947,
8443,
13,
4706,
1583,
29889,
1643,
29889,
842,
9824,
29898,
5657,
8443,
13,
4706,
1583,
29889,
1643,
29889,
842,
5568,
10654,
703,
2780,
29901,
15552,
29890,
29898,
29906,
29945,
29945,
29892,
29871,
29906,
29945,
29945,
29892,
29871,
29906,
29945,
29945,
416,
1159,
30004,
13,
4706,
1583,
29889,
1643,
29889,
842,
2061,
1170,
703,
1643,
1159,
30004,
13,
4706,
1583,
29889,
29916,
29918,
13338,
29918,
1220,
6103,
353,
14705,
8801,
29879,
29889,
2239,
457,
6103,
29898,
1311,
29889,
25171,
8030,
8443,
13,
4706,
1583,
29889,
29916,
29918,
13338,
29918,
1220,
6103,
29889,
842,
7999,
7843,
29898,
17303,
9203,
29889,
29984,
7364,
29898,
29896,
29896,
29900,
29892,
29871,
29896,
29900,
29892,
29871,
29945,
29945,
29896,
29892,
29871,
29906,
29900,
876,
30004,
13,
4706,
4079,
353,
14705,
28707,
29889,
29984,
9824,
26471,
13,
4706,
4079,
29889,
842,
27104,
703,
29907,
283,
4336,
1159,
30004,
13,
4706,
1583,
29889,
29916,
29918,
13338,
29918,
1220,
6103,
29889,
842,
9824,
29898,
5657,
8443,
13,
4706,
1583,
29889,
29916,
29918,
13338,
29918,
1220,
6103,
29889,
842,
5568,
10654,
703,
2780,
29901,
15552,
29890,
29898,
29906,
29900,
29946,
29892,
29871,
29906,
29900,
29946,
29892,
29871,
29906,
29900,
29946,
416,
1159,
30004,
13,
4706,
1583,
29889,
29916,
29918,
13338,
29918,
1220,
6103,
29889,
842,
6359,
11730,
29898,
5574,
8443,
13,
4706,
1583,
29889,
29916,
29918,
13338,
29918,
1220,
6103,
29889,
842,
2061,
1170,
703,
29916,
29918,
13338,
29918,
1220,
6103,
1159,
30004,
13,
4706,
1583,
29889,
29891,
29918,
11918,
29918,
1220,
6103,
353,
14705,
8801,
29879,
29889,
2239,
457,
6103,
29898,
1311,
29889,
25171,
8030,
8443,
13,
4706,
1583,
29889,
29891,
29918,
11918,
29918,
1220,
6103,
29889,
842,
7999,
7843,
29898,
17303,
9203,
29889,
29984,
7364,
29898,
29896,
29900,
29892,
29871,
29896,
29941,
29900,
29892,
29871,
29953,
29945,
29896,
29892,
29871,
29945,
29896,
876,
30004,
13,
4706,
4079,
353,
14705,
28707,
29889,
29984,
9824,
26471,
13,
4706,
4079,
29889,
842,
27104,
703,
29907,
283,
4336,
1159,
30004,
13,
4706,
4079,
29889,
842,
5228,
3505,
29898,
29896,
29900,
8443,
13,
4706,
1583,
29889,
29891,
29918,
11918,
29918,
1220,
6103,
29889,
842,
9824,
29898,
5657,
8443,
13,
4706,
1583,
29889,
29891,
29918,
11918,
29918,
1220,
6103,
29889,
842,
5568,
10654,
703,
2780,
29901,
15552,
29890,
29898,
29906,
29945,
29945,
29892,
29871,
29906,
29945,
29945,
29892,
29871,
29906,
29945,
29945,
416,
29905,
29876,
19451,
13,
29908,
7042,
29899,
2780,
29901,
15552,
29890,
29898,
29945,
29941,
29892,
29871,
29945,
29941,
29892,
29871,
29945,
29941,
416,
29905,
29876,
19451,
13,
26732,
29876,
19451,
13,
29908,
1159,
30004,
13,
4706,
1583,
29889,
29891,
29918,
11918,
29918,
1220,
6103,
29889,
842,
2061,
1170,
703,
29891,
29918,
11918,
29918,
1220,
6103,
1159,
30004,
13,
4706,
1583,
29889,
1643,
29918,
29906,
353,
14705,
8801,
29879,
29889,
2239,
1107,
29898,
1311,
29889,
25171,
8030,
8443,
13,
4706,
1583,
29889,
1643,
29918,
29906,
29889,
842,
7999,
7843,
29898,
17303,
9203,
29889,
29984,
7364,
29898,
29896,
29900,
29892,
29871,
29896,
29900,
29900,
29892,
29871,
29929,
29896,
29892,
29871,
29896,
29953,
876,
30004,
13,
4706,
4079,
353,
14705,
28707,
29889,
29984,
9824,
26471,
13,
4706,
4079,
29889,
842,
5228,
3505,
29898,
29947,
8443,
13,
4706,
1583,
29889,
1643,
29918,
29906,
29889,
842,
9824,
29898,
5657,
8443,
13,
4706,
1583,
29889,
1643,
29918,
29906,
29889,
842,
5568,
10654,
703,
2780,
29901,
15552,
29890,
29898,
29906,
29945,
29945,
29892,
29871,
29906,
29945,
29945,
29892,
29871,
29906,
29945,
29945,
416,
1159,
30004,
13,
4706,
1583,
29889,
1643,
29918,
29906,
29889,
842,
2061,
1170,
703,
1643,
29918,
29906,
1159,
30004,
13,
4706,
1583,
29889,
29891,
29918,
13338,
29918,
1220,
6103,
353,
14705,
8801,
29879,
29889,
2239,
457,
6103,
29898,
1311,
29889,
25171,
8030,
8443,
13,
4706,
1583,
29889,
29891,
29918,
13338,
29918,
1220,
6103,
29889,
842,
7999,
7843,
29898,
17303,
9203,
29889,
29984,
7364,
29898,
29896,
29896,
29900,
29892,
29871,
29896,
29900,
29900,
29892,
29871,
29945,
29945,
29896,
29892,
29871,
29906,
29900,
876,
30004,
13,
4706,
4079,
353,
14705,
28707,
29889,
29984,
9824,
26471,
13,
4706,
4079,
29889,
842,
27104,
703,
29907,
283,
4336,
1159,
30004,
13,
4706,
1583,
29889,
29891,
29918,
13338,
29918,
1220,
6103,
29889,
842,
9824,
29898,
5657,
8443,
13,
4706,
1583,
29889,
29891,
29918,
13338,
29918,
1220,
6103,
29889,
842,
5568,
10654,
703,
2780,
29901,
15552,
29890,
29898,
29906,
29900,
29946,
29892,
29871,
29906,
29900,
29946,
29892,
29871,
29906,
29900,
29946,
416,
1159,
30004,
13,
4706,
1583,
29889,
29891,
29918,
13338,
29918,
1220,
6103,
29889,
842,
6359,
11730,
29898,
5574,
8443,
13,
4706,
1583,
29889,
29891,
29918,
13338,
29918,
1220,
6103,
29889,
842,
2061,
1170,
703,
29891,
29918,
13338,
29918,
1220,
6103,
1159,
30004,
13,
4706,
1583,
29889,
7302,
29918,
5910,
3125,
353,
14705,
8801,
29879,
29889,
29984,
27031,
3125,
29898,
1311,
29889,
25171,
8030,
8443,
13,
4706,
1583,
29889,
7302,
29918,
5910,
3125,
29889,
842,
7999,
7843,
29898,
17303,
9203,
29889,
29984,
7364,
29898,
29945,
29900,
29900,
29892,
29871,
29941,
29947,
29900,
29892,
29871,
29955,
29945,
29892,
29871,
29941,
29945,
876,
30004,
13,
4706,
1583,
29889,
7302,
29918,
5910,
3125,
29889,
842,
5568,
10654,
703,
2780,
29901,
15552,
29890,
29898,
29906,
29945,
29945,
29892,
29871,
29906,
29945,
29945,
29892,
29871,
29906,
29945,
29945,
416,
1159,
30004,
13,
4706,
1583,
29889,
7302,
29918,
5910,
3125,
29889,
842,
2061,
1170,
703,
7302,
29918,
5910,
3125,
1159,
30004,
13,
4706,
1583,
29889,
20713,
29918,
5910,
3125,
353,
14705,
8801,
29879,
29889,
29984,
27031,
3125,
29898,
1311,
29889,
25171,
8030,
8443,
13,
4706,
1583,
29889,
20713,
29918,
5910,
3125,
29889,
842,
7999,
7843,
29898,
17303,
9203,
29889,
29984,
7364,
29898,
29945,
29947,
29900,
29892,
29871,
29941,
29947,
29900,
29892,
29871,
29955,
29945,
29892,
29871,
29941,
29945,
876,
30004,
13,
4706,
1583,
29889,
20713,
29918,
5910,
3125,
29889,
842,
5568,
10654,
703,
2780,
29901,
15552,
29890,
29898,
29906,
29945,
29945,
29892,
29871,
29906,
29945,
29945,
29892,
29871,
29906,
29945,
29945,
416,
1159,
30004,
13,
4706,
1583,
29889,
20713,
29918,
5910,
3125,
29889,
842,
2061,
1170,
703,
20713,
29918,
5910,
3125,
1159,
30004,
13,
4706,
1583,
29889,
554,
29918,
7290,
353,
14705,
8801,
29879,
29889,
29984,
27031,
3125,
29898,
1311,
29889,
25171,
8030,
8443,
13,
4706,
1583,
29889,
554,
29918,
7290,
29889,
842,
7999,
7843,
29898,
17303,
9203,
29889,
29984,
7364,
29898,
29946,
29906,
29900,
29892,
29871,
29941,
29947,
29900,
29892,
29871,
29955,
29945,
29892,
29871,
29941,
29945,
876,
30004,
13,
4706,
1583,
29889,
554,
29918,
7290,
29889,
842,
5568,
10654,
703,
2780,
29901,
15552,
29890,
29898,
29906,
29945,
29945,
29892,
29871,
29906,
29945,
29945,
29892,
29871,
29906,
29945,
29945,
416,
1159,
30004,
13,
4706,
1583,
29889,
554,
29918,
7290,
29889,
842,
2061,
1170,
703,
554,
29918,
7290,
1159,
30004,
13,
4706,
1583,
29889,
2972,
3313,
353,
14705,
8801,
29879,
29889,
29984,
4782,
3313,
29898,
1311,
29889,
25171,
8030,
8443,
13,
4706,
1583,
29889,
2972,
3313,
29889,
842,
7999,
7843,
29898,
17303,
9203,
29889,
29984,
7364,
29898,
29953,
29955,
29900,
29892,
29871,
29900,
29892,
29871,
29906,
29945,
29896,
29892,
29871,
29896,
29947,
29896,
876,
30004,
13,
4706,
1583,
29889,
2972,
3313,
29889,
842,
5568,
10654,
703,
2780,
29901,
15552,
29890,
29898,
29906,
29900,
29900,
29892,
29871,
29906,
29900,
29900,
29892,
29871,
29906,
29900,
29900,
416,
1159,
30004,
13,
4706,
1583,
29889,
2972,
3313,
29889,
842,
2061,
1170,
703,
2972,
3313,
1159,
30004,
13,
4706,
1583,
29889,
3874,
29890,
29918,
29887,
2204,
29918,
7290,
353,
14705,
8801,
29879,
29889,
29984,
27031,
3125,
29898,
1311,
29889,
2972,
3313,
8443,
13,
4706,
1583,
29889,
3874,
29890,
29918,
29887,
2204,
29918,
7290,
29889,
842,
7999,
7843,
29898,
17303,
9203,
29889,
29984,
7364,
29898,
29929,
29900,
29892,
29871,
29896,
29945,
29900,
29892,
29871,
29955,
29945,
29892,
29871,
29906,
29941,
876,
30004,
13,
4706,
1583,
29889,
3874,
29890,
29918,
29887,
2204,
29918,
7290,
29889,
842,
2061,
1170,
703,
3874,
29890,
29918,
29887,
2204,
29918,
7290,
1159,
30004,
13,
4706,
1583,
29889,
1758,
29918,
29887,
2204,
29918,
7290,
353,
14705,
8801,
29879,
29889,
29984,
27031,
3125,
29898,
1311,
29889,
2972,
3313,
8443,
13,
4706,
1583,
29889,
1758,
29918,
29887,
2204,
29918,
7290,
29889,
842,
7999,
7843,
29898,
17303,
9203,
29889,
29984,
7364,
29898,
29896,
29955,
29900,
29892,
29871,
29896,
29945,
29900,
29892,
29871,
29955,
29896,
29892,
29871,
29906,
29941,
876,
30004,
13,
4706,
1583,
29889,
1758,
29918,
29887,
2204,
29918,
7290,
29889,
842,
2061,
1170,
703,
1758,
29918,
29887,
2204,
29918,
7290,
1159,
30004,
13,
4706,
1583,
29889,
10945,
29918,
8336,
1493,
353,
14705,
8801,
29879,
29889,
29984,
9643,
1043,
29898,
1311,
29889,
2972,
3313,
8443,
13,
4706,
1583,
29889,
10945,
29918,
8336,
1493,
29889,
842,
7999,
7843,
29898,
17303,
9203,
29889,
29984,
7364,
29898,
29896,
29900,
29892,
29871,
29906,
29900,
29892,
29871,
29906,
29941,
29896,
29892,
29871,
29896,
29906,
29896,
876,
30004,
13,
4706,
1583,
29889,
10945,
29918,
8336,
1493,
29889,
842,
2061,
1170,
703,
10945,
29918,
8336,
1493,
1159,
30004,
13,
4706,
1583,
29889,
842,
29918,
29887,
2204,
29918,
7290,
353,
14705,
8801,
29879,
29889,
29984,
27031,
3125,
29898,
1311,
29889,
2972,
3313,
8443,
13,
4706,
1583,
29889,
842,
29918,
29887,
2204,
29918,
7290,
29889,
842,
7999,
7843,
29898,
17303,
9203,
29889,
29984,
7364,
29898,
29896,
29900,
29892,
29871,
29896,
29945,
29900,
29892,
29871,
29955,
29945,
29892,
29871,
29906,
29941,
876,
30004,
13,
4706,
1583,
29889,
842,
29918,
29887,
2204,
29918,
7290,
29889,
842,
12229,
29911,
666,
703,
1159,
30004,
13,
4706,
1583,
29889,
842,
29918,
29887,
2204,
29918,
7290,
29889,
842,
2061,
1170,
703,
842,
29918,
29887,
2204,
29918,
7290,
1159,
30004,
13,
4706,
1583,
29889,
2972,
3313,
29918,
29906,
353,
14705,
8801,
29879,
29889,
29984,
4782,
3313,
29898,
1311,
29889,
25171,
8030,
8443,
13,
4706,
1583,
29889,
2972,
3313,
29918,
29906,
29889,
842,
7999,
7843,
29898,
17303,
9203,
29889,
29984,
7364,
29898,
29953,
29955,
29900,
29892,
29871,
29896,
29929,
29900,
29892,
29871,
29906,
29945,
29896,
29892,
29871,
29906,
29906,
29896,
876,
30004,
13,
4706,
1583,
29889,
2972,
3313,
29918,
29906,
29889,
842,
5568,
10654,
703,
2780,
29901,
15552,
29890,
29898,
29906,
29900,
29900,
29892,
29871,
29906,
29900,
29900,
29892,
29871,
29906,
29900,
29900,
416,
1159,
30004,
13,
4706,
1583,
29889,
2972,
3313,
29918,
29906,
29889,
842,
2061,
1170,
703,
2972,
3313,
29918,
29906,
1159,
30004,
13,
4706,
1583,
29889,
4478,
29918,
3131,
29918,
280,
353,
14705,
8801,
29879,
29889,
2239,
457,
6103,
29898,
1311,
29889,
2972,
3313,
29918,
29906,
8443,
13,
4706,
1583,
29889,
4478,
29918,
3131,
29918,
280,
29889,
842,
7999,
7843,
29898,
17303,
9203,
29889,
29984,
7364,
29898,
29896,
29900,
29892,
29871,
29896,
29929,
29900,
29892,
29871,
29896,
29896,
29900,
29892,
29871,
29906,
29900,
876,
30004,
13,
4706,
1583,
29889,
4478,
29918,
3131,
29918,
280,
29889,
842,
5568,
10654,
703,
2780,
29901,
15552,
29890,
29898,
29906,
29900,
29900,
29892,
29871,
29906,
29900,
29900,
29892,
29871,
29906,
29900,
29900,
416,
1159,
30004,
13,
4706,
1583,
29889,
4478,
29918,
3131,
29918,
280,
29889,
842,
2061,
1170,
703,
4478,
29918,
3131,
29918,
280,
1159,
30004,
13,
4706,
1583,
29889,
4478,
29918,
1949,
29918,
280,
353,
14705,
8801,
29879,
29889,
2239,
457,
6103,
29898,
1311,
29889,
2972,
3313,
29918,
29906,
8443,
13,
4706,
1583,
29889,
4478,
29918,
1949,
29918,
280,
29889,
842,
7999,
7843,
29898,
17303,
9203,
29889,
29984,
7364,
29898,
29896,
29941,
29900,
29892,
29871,
29896,
29929,
29900,
29892,
29871,
29896,
29896,
29900,
29892,
29871,
29906,
29900,
876,
30004,
13,
4706,
1583,
29889,
4478,
29918,
1949,
29918,
280,
29889,
842,
5568,
10654,
703,
2780,
29901,
15552,
29890,
29898,
29906,
29900,
29900,
29892,
29871,
29906,
29900,
29900,
29892,
29871,
29906,
29900,
29900,
416,
1159,
30004,
13,
4706,
1583,
29889,
4478,
29918,
1949,
29918,
280,
29889,
842,
2061,
1170,
703,
4478,
29918,
1949,
29918,
280,
1159,
30004,
13,
4706,
1583,
29889,
1949,
29918,
1493,
353,
14705,
8801,
29879,
29889,
29984,
15660,
29898,
1311,
29889,
2972,
3313,
29918,
29906,
8443,
13,
4706,
1583,
29889,
1949,
29918,
1493,
29889,
842,
7999,
7843,
29898,
17303,
9203,
29889,
29984,
7364,
29898,
29896,
29941,
29900,
29892,
29871,
29953,
29900,
29892,
29871,
29896,
29896,
29900,
29892,
29871,
29896,
29906,
29896,
876,
30004,
13,
4706,
1583,
29889,
1949,
29918,
1493,
29889,
842,
5568,
10654,
703,
2780,
29901,
15552,
29890,
29898,
29896,
29945,
29900,
29892,
29871,
29896,
29945,
29900,
29892,
29871,
29896,
29945,
29900,
416,
29905,
29876,
19451,
13,
29908,
7042,
29899,
2780,
29901,
15552,
29890,
29898,
29953,
29900,
29892,
29871,
29953,
29900,
29892,
29871,
29953,
29900,
416,
29905,
29876,
19451,
13,
29908,
1159,
30004,
13,
4706,
1583,
29889,
1949,
29918,
1493,
29889,
842,
2061,
1170,
703,
1949,
29918,
1493,
1159,
30004,
13,
4706,
1583,
29889,
3131,
29918,
1493,
353,
14705,
8801,
29879,
29889,
29984,
15660,
29898,
1311,
29889,
2972,
3313,
29918,
29906,
8443,
13,
4706,
1583,
29889,
3131,
29918,
1493,
29889,
842,
7999,
7843,
29898,
17303,
9203,
29889,
29984,
7364,
29898,
29896,
29900,
29892,
29871,
29953,
29900,
29892,
29871,
29896,
29896,
29900,
29892,
29871,
29896,
29906,
29896,
876,
30004,
13,
4706,
1583,
29889,
3131,
29918,
1493,
29889,
842,
5568,
10654,
703,
2780,
29901,
15552,
29890,
29898,
29896,
29945,
29900,
29892,
29871,
29896,
29945,
29900,
29892,
29871,
29896,
29945,
29900,
416,
29905,
29876,
19451,
13,
29908,
7042,
29899,
2780,
29901,
15552,
29890,
29898,
29953,
29900,
29892,
29871,
29953,
29900,
29892,
29871,
29953,
29900,
416,
29905,
29876,
19451,
13,
29908,
1159,
30004,
13,
4706,
1583,
29889,
3131,
29918,
1493,
29889,
842,
2061,
1170,
703,
3131,
29918,
1493,
1159,
30004,
13,
4706,
1583,
29889,
3131,
29918,
1643,
29918,
29906,
353,
14705,
8801,
29879,
29889,
2239,
1107,
29898,
1311,
29889,
2972,
3313,
29918,
29906,
8443,
13,
4706,
1583,
29889,
3131,
29918,
1643,
29918,
29906,
29889,
842,
7999,
7843,
29898,
17303,
9203,
29889,
29984,
7364,
29898,
29896,
29946,
29900,
29892,
29871,
29946,
29900,
29892,
29871,
29945,
29896,
29892,
29871,
29896,
29953,
876,
30004,
13,
4706,
4079,
353,
14705,
28707,
29889,
29984,
9824,
26471,
13,
4706,
4079,
29889,
842,
5228,
3505,
29898,
29947,
8443,
13,
4706,
1583,
29889,
3131,
29918,
1643,
29918,
29906,
29889,
842,
9824,
29898,
5657,
8443,
13,
4706,
1583,
29889,
3131,
29918,
1643,
29918,
29906,
29889,
842,
5568,
10654,
703,
2780,
29901,
15552,
29890,
29898,
29906,
29945,
29945,
29892,
29871,
29906,
29945,
29945,
29892,
29871,
29906,
29945,
29945,
416,
1159,
30004,
13,
4706,
1583,
29889,
3131,
29918,
1643,
29918,
29906,
29889,
842,
2061,
1170,
703,
3131,
29918,
1643,
29918,
29906,
1159,
30004,
13,
4706,
1583,
29889,
3131,
29918,
1643,
353,
14705,
8801,
29879,
29889,
2239,
1107,
29898,
1311,
29889,
2972,
3313,
29918,
29906,
8443,
13,
4706,
1583,
29889,
3131,
29918,
1643,
29889,
842,
7999,
7843,
29898,
17303,
9203,
29889,
29984,
7364,
29898,
29896,
29900,
29892,
29871,
29946,
29900,
29892,
29871,
29945,
29896,
29892,
29871,
29896,
29953,
876,
30004,
13,
4706,
4079,
353,
14705,
28707,
29889,
29984,
9824,
26471,
13,
4706,
4079,
29889,
842,
5228,
3505,
29898,
29947,
8443,
13,
4706,
1583,
29889,
3131,
29918,
1643,
29889,
842,
9824,
29898,
5657,
8443,
13,
4706,
1583,
29889,
3131,
29918,
1643,
29889,
842,
5568,
10654,
703,
2780,
29901,
15552,
29890,
29898,
29906,
29945,
29945,
29892,
29871,
29906,
29945,
29945,
29892,
29871,
29906,
29945,
29945,
416,
1159,
30004,
13,
4706,
1583,
29889,
3131,
29918,
1643,
29889,
842,
2061,
1170,
703,
3131,
29918,
1643,
1159,
30004,
13,
4706,
1583,
29889,
1202,
29906,
29979,
29918,
3198,
3313,
353,
14705,
8801,
29879,
29889,
29984,
28360,
29898,
1311,
29889,
2972,
3313,
29918,
29906,
8443,
13,
4706,
1583,
29889,
1202,
29906,
29979,
29918,
3198,
3313,
29889,
842,
7999,
7843,
29898,
17303,
9203,
29889,
29984,
7364,
29898,
29929,
29900,
29892,
29871,
29906,
29900,
29892,
29871,
29953,
29896,
29892,
29871,
29896,
29955,
876,
30004,
13,
4706,
1583,
29889,
1202,
29906,
29979,
29918,
3198,
3313,
29889,
842,
5568,
10654,
703,
2780,
29901,
15552,
29890,
29898,
29906,
29945,
29945,
29892,
29871,
29906,
29945,
29945,
29892,
29871,
29906,
29945,
29945,
416,
1159,
30004,
13,
4706,
1583,
29889,
1202,
29906,
29979,
29918,
3198,
3313,
29889,
842,
2061,
1170,
703,
1202,
29906,
29979,
29918,
3198,
3313,
1159,
30004,
13,
4706,
1583,
29889,
1202,
29906,
29990,
3198,
3313,
353,
14705,
8801,
29879,
29889,
29984,
28360,
29898,
1311,
29889,
2972,
3313,
29918,
29906,
8443,
13,
4706,
1583,
29889,
1202,
29906,
29990,
3198,
3313,
29889,
842,
7999,
7843,
29898,
17303,
9203,
29889,
29984,
7364,
29898,
29896,
29900,
29892,
29871,
29906,
29900,
29892,
29871,
29955,
29900,
29892,
29871,
29896,
29955,
876,
30004,
13,
4706,
1583,
29889,
1202,
29906,
29990,
3198,
3313,
29889,
842,
5568,
10654,
703,
2780,
29901,
15552,
29890,
29898,
29906,
29945,
29945,
29892,
29871,
29906,
29945,
29945,
29892,
29871,
29906,
29945,
29945,
416,
1159,
30004,
13,
4706,
1583,
29889,
1202,
29906,
29990,
3198,
3313,
29889,
842,
2061,
1170,
703,
1202,
29906,
29990,
3198,
3313,
1159,
30004,
13,
4706,
4241,
5907,
29889,
842,
23369,
1705,
8801,
29898,
1311,
29889,
25171,
8030,
8443,
13,
4706,
1583,
29889,
1527,
431,
279,
353,
14705,
8801,
29879,
29889,
29984,
6823,
4297,
29898,
6330,
5907,
8443,
13,
4706,
1583,
29889,
1527,
431,
279,
29889,
842,
7999,
7843,
29898,
17303,
9203,
29889,
29984,
7364,
29898,
29900,
29892,
29871,
29900,
29892,
29871,
29929,
29906,
29929,
29892,
29871,
29906,
29896,
876,
30004,
13,
4706,
1583,
29889,
1527,
431,
279,
29889,
842,
2061,
1170,
703,
1527,
431,
279,
1159,
30004,
13,
4706,
4241,
5907,
29889,
842,
6823,
4297,
29898,
1311,
29889,
1527,
431,
279,
8443,
13,
4706,
1583,
29889,
4882,
1646,
353,
14705,
8801,
29879,
29889,
29984,
5709,
4297,
29898,
6330,
5907,
8443,
13,
4706,
1583,
29889,
4882,
1646,
29889,
842,
2061,
1170,
703,
4882,
1646,
1159,
30004,
13,
4706,
4241,
5907,
29889,
842,
5709,
4297,
29898,
1311,
29889,
4882,
1646,
8443,
13,
30004,
13,
4706,
1583,
29889,
276,
21652,
29965,
29875,
29898,
6330,
5907,
8443,
13,
4706,
14705,
9203,
29889,
29984,
19346,
2061,
29889,
6915,
16973,
1862,
2059,
1170,
29898,
6330,
5907,
8443,
13,
30004,
13,
1678,
822,
337,
21652,
29965,
29875,
29898,
1311,
29892,
4241,
5907,
1125,
30004,
13,
4706,
903,
21652,
353,
14705,
9203,
29889,
29984,
9203,
4873,
29889,
21652,
30004,
13,
4706,
4241,
5907,
29889,
842,
5907,
7030,
7373,
21652,
703,
6330,
5907,
613,
376,
10444,
1849,
5783,
30004,
13,
4706,
1583,
29889,
20897,
1293,
29918,
8336,
8801,
29889,
6672,
2001,
2141,
12038,
29898,
29900,
29892,
903,
21652,
703,
6330,
5907,
613,
376,
16174,
4408,
5783,
30004,
13,
4706,
1583,
29889,
20897,
1293,
29918,
8336,
8801,
29889,
6672,
2001,
2141,
12038,
29898,
29896,
29892,
903,
21652,
703,
6330,
5907,
613,
376,
4775,
5783,
30004,
13,
4706,
1583,
29889,
20897,
1293,
29918,
8336,
8801,
29889,
6672,
2001,
2141,
12038,
29898,
29906,
29892,
903,
21652,
703,
6330,
5907,
613,
376,
29916,
5783,
30004,
13,
4706,
1583,
29889,
20897,
1293,
29918,
8336,
8801,
29889,
6672,
2001,
2141,
12038,
29898,
29941,
29892,
903,
21652,
703,
6330,
5907,
613,
376,
29891,
5783,
30004,
13,
4706,
1583,
29889,
20897,
1293,
29918,
8336,
8801,
29889,
6672,
2001,
2141,
12038,
29898,
29946,
29892,
903,
21652,
703,
6330,
5907,
613,
376,
15078,
442,
5783,
30004,
13,
4706,
1583,
29889,
20897,
1293,
29918,
8336,
8801,
29889,
6672,
2001,
2141,
12038,
29898,
29945,
29892,
903,
21652,
703,
6330,
5907,
613,
376,
7638,
5783,
30004,
13,
4706,
1583,
29889,
20897,
1293,
29918,
8336,
8801,
29889,
6672,
2001,
2141,
12038,
29898,
29953,
29892,
903,
21652,
703,
6330,
5907,
613,
376,
20867,
5783,
30004,
13,
4706,
1583,
29889,
1643,
29889,
12038,
7373,
21652,
703,
6330,
5907,
613,
376,
7583,
921,
16174,
5783,
30004,
13,
4706,
1583,
29889,
1643,
29918,
29906,
29889,
12038,
7373,
21652,
703,
6330,
5907,
613,
376,
7583,
343,
16174,
5783,
30004,
13,
4706,
1583,
29889,
7302,
29918,
5910,
3125,
29889,
12038,
7373,
21652,
703,
6330,
5907,
613,
376,
2052,
368,
5783,
30004,
13,
4706,
1583,
29889,
20713,
29918,
5910,
3125,
29889,
12038,
7373,
21652,
703,
6330,
5907,
613,
376,
19420,
5783,
30004,
13,
4706,
1583,
29889,
554,
29918,
7290,
29889,
12038,
7373,
21652,
703,
6330,
5907,
613,
376,
20434,
5783,
30004,
13,
4706,
1583,
29889,
2972,
3313,
29889,
842,
7030,
7373,
21652,
703,
6330,
5907,
613,
376,
12756,
12241,
5783,
30004,
13,
4706,
1583,
29889,
3874,
29890,
29918,
29887,
2204,
29918,
7290,
29889,
12038,
7373,
21652,
703,
6330,
5907,
613,
376,
3874,
29890,
5783,
30004,
13,
4706,
1583,
29889,
1758,
29918,
29887,
2204,
29918,
7290,
29889,
12038,
7373,
21652,
703,
6330,
5907,
613,
376,
5992,
5783,
30004,
13,
4706,
1583,
29889,
842,
29918,
29887,
2204,
29918,
7290,
29889,
12038,
7373,
21652,
703,
6330,
5907,
613,
376,
842,
5783,
30004,
13,
4706,
1583,
29889,
2972,
3313,
29918,
29906,
29889,
842,
7030,
7373,
21652,
703,
6330,
5907,
613,
376,
20867,
29918,
3131,
891,
18399,
29918,
1949,
5783,
30004,
13,
4706,
1583,
29889,
4478,
29918,
3131,
29918,
280,
29889,
842,
22150,
7694,
1626,
7373,
21652,
703,
6330,
5907,
613,
376,
2886,
6492,
29918,
3131,
29874,
5783,
30004,
13,
4706,
1583,
29889,
4478,
29918,
1949,
29918,
280,
29889,
842,
22150,
7694,
1626,
7373,
21652,
703,
6330,
5907,
613,
376,
2886,
6492,
29918,
1949,
5783,
30004,
13,
4706,
1583,
29889,
3131,
29918,
1643,
29918,
29906,
29889,
12038,
7373,
21652,
703,
6330,
5907,
613,
376,
5317,
29918,
1949,
5783,
30004,
13,
4706,
1583,
29889,
3131,
29918,
1643,
29889,
12038,
7373,
21652,
703,
6330,
5907,
613,
376,
5317,
29918,
3131,
5783,
30004,
13,
4706,
1583,
29889,
1202,
29906,
29979,
29918,
3198,
3313,
29889,
12038,
7373,
21652,
703,
6330,
5907,
613,
376,
2528,
304,
612,
5783,
30004,
13,
4706,
1583,
29889,
1202,
29906,
29990,
3198,
3313,
29889,
12038,
7373,
21652,
703,
6330,
5907,
613,
376,
2528,
304,
1060,
5783,
30004,
13,
30004,
13,
30004,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
30004,
13,
1678,
1053,
10876,
30004,
13,
1678,
623,
353,
14705,
8801,
29879,
29889,
29984,
4873,
29898,
9675,
29889,
19218,
8443,
13,
1678,
4241,
5907,
353,
14705,
8801,
29879,
29889,
29984,
6330,
5907,
26471,
13,
1678,
14313,
353,
501,
29875,
29918,
6330,
5907,
26471,
13,
1678,
14313,
29889,
14669,
29965,
29875,
29898,
6330,
5907,
8443,
13,
1678,
4241,
5907,
29889,
4294,
26471,
13,
1678,
10876,
29889,
13322,
29898,
932,
29889,
4258,
29918,
3101,
30004,
13,
30004,
13,
2
] |
src/rrt/rrt.py | hjp-muser/rrt-algorithms | 0 | 132241 | from src.rrt.rrt_base import RRTBase
class RRT(RRTBase):
def __init__(self, X, Q, x_init, x_goal, max_samples, r, prc=0.01):
"""
Template RRT planner
:param X: Search Space
:param Q: list of lengths of edges added to tree
:param x_init: tuple, initial location
:param x_goal: tuple, goal location
:param max_samples: max number of samples to take
:param r: resolution of points to sample along edge when checking for collisions
:param prc: probability of checking whether there is a solution
"""
super().__init__(X, Q, x_init, x_goal, max_samples, r, prc)
def rrt_search(self):
"""
Create and return a Rapidly-exploring Random Tree, keeps expanding until can connect to goal
https://en.wikipedia.org/wiki/Rapidly-exploring_random_tree
:return: list representation of path, dict representing edges of tree in form E[child] = parent
"""
self.add_vertex(0, self.x_init)
self.add_edge(0, self.x_init, None)
while True:
for q in self.Q: # iterate over different edge lengths until solution found or time out
for i in range(q[1]): # iterate over number of edges of given length to add
x_new, x_nearest = self.new_and_near(0, q)
if x_new is None:
continue
# connect shortest valid edge
self.connect_to_point(0, x_nearest, x_new)
solution = self.check_solution()
if solution[0]:
return solution
| [
1,
515,
4765,
29889,
29878,
2273,
29889,
29878,
2273,
29918,
3188,
1053,
390,
13079,
5160,
13,
13,
13,
1990,
390,
13079,
29898,
29934,
13079,
5160,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1060,
29892,
660,
29892,
921,
29918,
2344,
29892,
921,
29918,
28111,
29892,
4236,
29918,
27736,
29892,
364,
29892,
544,
29883,
29922,
29900,
29889,
29900,
29896,
1125,
13,
4706,
9995,
13,
4706,
25663,
390,
13079,
715,
7310,
13,
4706,
584,
3207,
1060,
29901,
11856,
14121,
13,
4706,
584,
3207,
660,
29901,
1051,
310,
27497,
310,
12770,
2715,
304,
5447,
13,
4706,
584,
3207,
921,
29918,
2344,
29901,
18761,
29892,
2847,
4423,
13,
4706,
584,
3207,
921,
29918,
28111,
29901,
18761,
29892,
7306,
4423,
13,
4706,
584,
3207,
4236,
29918,
27736,
29901,
4236,
1353,
310,
11916,
304,
2125,
13,
4706,
584,
3207,
364,
29901,
10104,
310,
3291,
304,
4559,
3412,
7636,
746,
8454,
363,
5321,
12112,
13,
4706,
584,
3207,
544,
29883,
29901,
6976,
310,
8454,
3692,
727,
338,
263,
1650,
13,
4706,
9995,
13,
4706,
2428,
2141,
1649,
2344,
12035,
29990,
29892,
660,
29892,
921,
29918,
2344,
29892,
921,
29918,
28111,
29892,
4236,
29918,
27736,
29892,
364,
29892,
544,
29883,
29897,
13,
13,
1678,
822,
364,
2273,
29918,
4478,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
6204,
322,
736,
263,
16866,
333,
368,
29899,
24516,
8253,
16968,
15472,
29892,
14874,
7985,
292,
2745,
508,
4511,
304,
7306,
13,
4706,
2045,
597,
264,
29889,
6011,
29889,
990,
29914,
4594,
29914,
29934,
481,
333,
368,
29899,
24516,
8253,
29918,
8172,
29918,
8336,
13,
4706,
584,
2457,
29901,
1051,
8954,
310,
2224,
29892,
9657,
15783,
12770,
310,
5447,
297,
883,
382,
29961,
5145,
29962,
353,
3847,
13,
4706,
9995,
13,
4706,
1583,
29889,
1202,
29918,
369,
4776,
29898,
29900,
29892,
1583,
29889,
29916,
29918,
2344,
29897,
13,
4706,
1583,
29889,
1202,
29918,
12864,
29898,
29900,
29892,
1583,
29889,
29916,
29918,
2344,
29892,
6213,
29897,
13,
13,
4706,
1550,
5852,
29901,
13,
9651,
363,
3855,
297,
1583,
29889,
29984,
29901,
29871,
396,
13649,
975,
1422,
7636,
27497,
2745,
1650,
1476,
470,
931,
714,
13,
18884,
363,
474,
297,
3464,
29898,
29939,
29961,
29896,
29962,
1125,
29871,
396,
13649,
975,
1353,
310,
12770,
310,
2183,
3309,
304,
788,
13,
462,
1678,
921,
29918,
1482,
29892,
921,
29918,
28502,
342,
353,
1583,
29889,
1482,
29918,
392,
29918,
28502,
29898,
29900,
29892,
3855,
29897,
13,
13,
462,
1678,
565,
921,
29918,
1482,
338,
6213,
29901,
13,
462,
4706,
6773,
13,
13,
462,
1678,
396,
4511,
3273,
342,
2854,
7636,
13,
462,
1678,
1583,
29889,
6915,
29918,
517,
29918,
3149,
29898,
29900,
29892,
921,
29918,
28502,
342,
29892,
921,
29918,
1482,
29897,
13,
13,
462,
1678,
1650,
353,
1583,
29889,
3198,
29918,
2929,
918,
580,
13,
462,
1678,
565,
1650,
29961,
29900,
5387,
13,
462,
4706,
736,
1650,
13,
2
] |
Textbook/Chapter 3/statsFunctions2.py | hunterluepke/Learn-Python-for-Stats-and-Econ | 16 | 42574 | #statsFunctions2.py
def total(list_obj):
total = 0
n = len(list_obj)
for i in range(n):
total += list_obj[i]
return total
def mean(list_obj):
n = len(list_obj)
mean = total(list_obj) / n
return mean
list1 = [3, 6, 9, 12, 15]
total_list1 = total(list1)
print(total_list1)
mean_list1 = mean(list1)
print("Mean of list1:", mean_list1)
| [
1,
396,
16202,
6678,
29879,
29906,
29889,
2272,
13,
1753,
3001,
29898,
1761,
29918,
5415,
1125,
13,
1678,
3001,
353,
29871,
29900,
13,
1678,
302,
353,
7431,
29898,
1761,
29918,
5415,
29897,
13,
1678,
363,
474,
297,
3464,
29898,
29876,
1125,
13,
4706,
3001,
4619,
1051,
29918,
5415,
29961,
29875,
29962,
13,
1678,
736,
3001,
13,
13,
1753,
2099,
29898,
1761,
29918,
5415,
1125,
13,
1678,
302,
353,
7431,
29898,
1761,
29918,
5415,
29897,
13,
1678,
2099,
353,
3001,
29898,
1761,
29918,
5415,
29897,
847,
302,
13,
1678,
736,
2099,
13,
13,
1761,
29896,
353,
518,
29941,
29892,
29871,
29953,
29892,
29871,
29929,
29892,
29871,
29896,
29906,
29892,
29871,
29896,
29945,
29962,
13,
7827,
29918,
1761,
29896,
353,
3001,
29898,
1761,
29896,
29897,
13,
2158,
29898,
7827,
29918,
1761,
29896,
29897,
13,
13,
12676,
29918,
1761,
29896,
353,
2099,
29898,
1761,
29896,
29897,
13,
2158,
703,
6816,
273,
310,
1051,
29896,
29901,
613,
2099,
29918,
1761,
29896,
29897,
13,
13,
2
] |
insta/migrations/0003_auto_20200106_0720.py | Josephat-n/instagram | 0 | 186712 | # Generated by Django 2.1 on 2020-01-06 04:20
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('insta', '0002_profile_name'),
]
operations = [
migrations.AlterField(
model_name='image',
name='image_comments',
field=models.TextField(blank=True),
),
migrations.AlterField(
model_name='image',
name='image_likes',
field=models.IntegerField(blank=True),
),
]
| [
1,
396,
3251,
630,
491,
15337,
29871,
29906,
29889,
29896,
373,
29871,
29906,
29900,
29906,
29900,
29899,
29900,
29896,
29899,
29900,
29953,
29871,
29900,
29946,
29901,
29906,
29900,
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,
2611,
29874,
742,
525,
29900,
29900,
29900,
29906,
29918,
10185,
29918,
978,
5477,
13,
1678,
4514,
13,
13,
1678,
6931,
353,
518,
13,
4706,
9725,
800,
29889,
2499,
357,
3073,
29898,
13,
9651,
1904,
29918,
978,
2433,
3027,
742,
13,
9651,
1024,
2433,
3027,
29918,
21032,
742,
13,
9651,
1746,
29922,
9794,
29889,
15778,
29898,
19465,
29922,
5574,
511,
13,
4706,
10353,
13,
4706,
9725,
800,
29889,
2499,
357,
3073,
29898,
13,
9651,
1904,
29918,
978,
2433,
3027,
742,
13,
9651,
1024,
2433,
3027,
29918,
5081,
267,
742,
13,
9651,
1746,
29922,
9794,
29889,
7798,
3073,
29898,
19465,
29922,
5574,
511,
13,
4706,
10353,
13,
1678,
4514,
13,
2
] |
vedro/plugins/slicer/__init__.py | iri6e4k0/vedro | 2 | 172943 | <gh_stars>1-10
from ._slicer import Slicer
__all__ = ("Slicer",)
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
3166,
869,
29918,
29879,
506,
261,
1053,
317,
506,
261,
13,
13,
1649,
497,
1649,
353,
4852,
29903,
506,
261,
613,
29897,
13,
2
] |
libary/yml_wrapper.py | NekoFanatic/kaiji | 0 | 19221 | from typing import Union
import yaml
class ConfigReader:
def __init__(self):
with open("config.yml", "r") as f:
data = yaml.safe_load(f)
self.data = data
def __getattr__(self, __name: str):
s = __name.split("_")
data = self.data
try:
for i in s:
data = data[i]
return data
except KeyError:
raise Exception("Can't find object")
class TextReader:
def __init__(self):
with open("text.yml", "r") as f:
data = yaml.safe_load(f)
self.data = data
def __getattr__(self, __name: str):
s = __name.split("_")
data = self.data
try:
for i in s:
data = data[i]
return data
except KeyError:
raise Exception("Can't find object")
def find(self, string: str) -> Union[str, list]:
s = string.split("_")
data = self.data
try:
for i in s:
data = data[i]
return data
except KeyError:
raise Exception("Can't find object")
| [
1,
515,
19229,
1053,
7761,
13,
5215,
343,
8807,
13,
13,
13,
1990,
12782,
6982,
29901,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
411,
1722,
703,
2917,
29889,
21053,
613,
376,
29878,
1159,
408,
285,
29901,
13,
9651,
848,
353,
343,
8807,
29889,
11177,
29918,
1359,
29898,
29888,
29897,
13,
4706,
1583,
29889,
1272,
353,
848,
13,
13,
1678,
822,
4770,
657,
5552,
12035,
1311,
29892,
4770,
978,
29901,
851,
1125,
13,
4706,
269,
353,
4770,
978,
29889,
5451,
703,
29918,
1159,
13,
4706,
848,
353,
1583,
29889,
1272,
13,
4706,
1018,
29901,
13,
9651,
363,
474,
297,
269,
29901,
13,
18884,
848,
353,
848,
29961,
29875,
29962,
13,
9651,
736,
848,
13,
4706,
5174,
7670,
2392,
29901,
13,
9651,
12020,
8960,
703,
6028,
29915,
29873,
1284,
1203,
1159,
13,
13,
13,
1990,
3992,
6982,
29901,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
411,
1722,
703,
726,
29889,
21053,
613,
376,
29878,
1159,
408,
285,
29901,
13,
9651,
848,
353,
343,
8807,
29889,
11177,
29918,
1359,
29898,
29888,
29897,
13,
4706,
1583,
29889,
1272,
353,
848,
13,
13,
1678,
822,
4770,
657,
5552,
12035,
1311,
29892,
4770,
978,
29901,
851,
1125,
13,
4706,
269,
353,
4770,
978,
29889,
5451,
703,
29918,
1159,
13,
4706,
848,
353,
1583,
29889,
1272,
13,
4706,
1018,
29901,
13,
9651,
363,
474,
297,
269,
29901,
13,
18884,
848,
353,
848,
29961,
29875,
29962,
13,
9651,
736,
848,
13,
4706,
5174,
7670,
2392,
29901,
13,
9651,
12020,
8960,
703,
6028,
29915,
29873,
1284,
1203,
1159,
13,
13,
1678,
822,
1284,
29898,
1311,
29892,
1347,
29901,
851,
29897,
1599,
7761,
29961,
710,
29892,
1051,
5387,
13,
4706,
269,
353,
1347,
29889,
5451,
703,
29918,
1159,
13,
4706,
848,
353,
1583,
29889,
1272,
13,
4706,
1018,
29901,
13,
9651,
363,
474,
297,
269,
29901,
13,
18884,
848,
353,
848,
29961,
29875,
29962,
13,
9651,
736,
848,
13,
4706,
5174,
7670,
2392,
29901,
13,
9651,
12020,
8960,
703,
6028,
29915,
29873,
1284,
1203,
1159,
13,
2
] |
bdbc/lib/python3.5/site-packages/bigchaindb_driver/crypto.py | entropyx/fiduchain-blockchain-interface | 0 | 5693 | from collections import namedtuple
from cryptoconditions import crypto
CryptoKeypair = namedtuple('CryptoKeypair', ('signing_key', 'verifying_key'))
def generate_keypair():
"""Generates a cryptographic key pair.
Returns:
:class:`~bigchaindb_driver.crypto.CryptoKeypair`: A
:obj:`collections.namedtuple` with named fields
:attr:`~bigchaindb_driver.crypto.CryptoKeypair.signing_key` and
:attr:`~bigchaindb_driver.crypto.CryptoKeypair.verifying_key`.
"""
return CryptoKeypair(
*(k.decode() for k in crypto.ed25519_generate_key_pair()))
| [
1,
515,
16250,
1053,
4257,
23583,
13,
13,
3166,
274,
17929,
1116,
2187,
1053,
274,
17929,
13,
13,
13,
29907,
17929,
2558,
18784,
353,
4257,
23583,
877,
29907,
17929,
2558,
18784,
742,
6702,
4530,
292,
29918,
1989,
742,
525,
369,
9215,
29918,
1989,
8785,
13,
13,
13,
1753,
5706,
29918,
446,
1478,
1466,
7295,
13,
1678,
9995,
5631,
1078,
263,
24941,
12122,
1820,
5101,
29889,
13,
13,
1678,
16969,
29901,
13,
4706,
584,
1990,
18078,
30022,
3752,
14153,
2585,
29918,
9465,
29889,
29883,
17929,
29889,
29907,
17929,
2558,
18784,
6998,
319,
13,
4706,
584,
5415,
18078,
29027,
29889,
17514,
23583,
29952,
411,
4257,
4235,
13,
4706,
584,
5552,
18078,
30022,
3752,
14153,
2585,
29918,
9465,
29889,
29883,
17929,
29889,
29907,
17929,
2558,
18784,
29889,
4530,
292,
29918,
1989,
29952,
322,
13,
4706,
584,
5552,
18078,
30022,
3752,
14153,
2585,
29918,
9465,
29889,
29883,
17929,
29889,
29907,
17929,
2558,
18784,
29889,
369,
9215,
29918,
1989,
1412,
13,
13,
1678,
9995,
13,
1678,
736,
315,
17929,
2558,
18784,
29898,
13,
4706,
334,
29898,
29895,
29889,
13808,
580,
363,
413,
297,
274,
17929,
29889,
287,
29906,
29945,
29945,
29896,
29929,
29918,
17158,
29918,
1989,
29918,
18784,
22130,
13,
2
] |
rltf/agents/pg_agent.py | psFournier/rltf | 90 | 188132 | import gym
import numpy as np
from rltf.agents import LoggingAgent
from rltf.memory import PGBuffer
from rltf.monitoring import Monitor
class AgentPG(LoggingAgent):
def __init__(self,
env_maker,
model,
gamma,
lam,
rollout_len,
stop_step,
vf_iters=1,
stack_frames=3,
**agent_kwargs
):
"""
Args:
env_maker: callable. Function that takes the mode of an env and retruns a new environment instance
gamma: float. Discount factor for GAE(gamma, lambda)
lam: float. Lambda value for GAE(gamma, lambda)
rollout_len: int. Number of agent steps before taking a policy gradient step
stop_step: int. Total number of agent steps
vf_iters: int. Number of value function training steps in a single epoch
"""
super().__init__(**agent_kwargs)
assert self.log_period % rollout_len == 0, "Log period must be divisible by rollout length"
if self.eval_len > 0:
assert self.eval_period % rollout_len == 0, "Eval period must be divisible by rollout length"
if self.save_period > np.inf:
assert self.save_period % rollout_len == 0, "Save period must be divisible by rollout length"
self.env_train = Monitor(
env=env_maker('t'),
log_dir=self.model_dir,
mode='t',
log_period=None,
video_spec=self.video_period,
)
self.env_eval = Monitor(
env=env_maker('e'),
log_dir=self.model_dir,
mode='e',
log_period=self.eval_len,
video_spec=self.video_period,
eval_period=self.eval_period,
)
self.rollout_len = rollout_len
self.stop_step = stop_step
self.epochs = self.stop_step // self.rollout_len
self.vf_iters = vf_iters
self.gamma = gamma
self.lam = lam
# Get environment specs
obs_shape, obs_dtype, act_shape, act_dtype, obs_len = self._state_action_spec(stack_frames)
# Initialize the model and the experience buffer
self.model = model(obs_shape=obs_shape, act_space=self.env_train.action_space, **self.model_kwargs)
self.buffer = PGBuffer(self.rollout_len, obs_shape, obs_dtype, act_shape, act_dtype, obs_len)
def _train(self):
# Get the function that generates trajectories
run_policy = self._trajectory_generator(self.rollout_len)
for t in range(self.agent_step+1, self.epochs+1):
if self._terminate:
break
step = t * self.rollout_len
# Collect experience in the environment
run_policy()
# Train the model
self._run_train_step(t)
if step % self.log_period == 0:
self.env_train.monitor.log_stats()
# Stop and run evaluation procedure
if self.eval_len > 0 and step % self.eval_period == 0:
self._eval_agent()
# Update the agent step - corresponds to number of epochs
self.agent_step = step
# Save **after** agent step is correct and completed
if step % self.save_period == 0:
self.save()
def _trajectory_generator(self, horizon):
"""
Args:
horizon: int. Number of steps to run before yielding the trajectories
Returns:
A function which generates trajectories
"""
obs = self.reset()
def run_env():
nonlocal obs
# Clear the buffer to avoid using old data
self.buffer.reset()
for _ in range(horizon):
if self._terminate:
return
# Get an action to run and the value function estimate of this state
action, vf, logp = self._action_train(obs)
# Run action
next_obs, reward, done, info = self.env_train.step(action)
# Store the effect of the action taken upon obs
self.buffer.store(obs, action, reward, done, vf, logp)
# Reset the environment if end of episode
if done:
next_obs = self.reset()
obs = next_obs
# Store the value function for the next state. Needed to compute GAE(lambda)
if not done:
_, next_vf, _ = self._action_train(obs)
else:
next_vf = 0
# Compute GAE(gamma, lambda) and TD(lambda)
self.buffer.compute_estimates(self.gamma, self.lam, next_vf)
return run_env
def _get_feed_dict(self, batch, t):
feed_dict = {
self.model.obs_ph: batch["obs"],
self.model.act_ph: batch["act"],
self.model.adv_ph: batch["adv"],
self.model.ret_ph: batch["ret"],
self.model.old_logp_ph: batch["logp"],
self.model.pi_opt_conf.lr_ph: self.model.pi_opt_conf.lr_value(t),
self.model.vf_opt_conf.lr_ph: self.model.vf_opt_conf.lr_value(t),
}
return feed_dict
def _run_summary_op(self, t, feed_dict):
if t * self.rollout_len % self.log_period == 0:
self.summary = self.sess.run(self.summary_op, feed_dict=feed_dict)
def _run_train_step(self, t):
batch = self.buffer.get_data()
feed_dict = self._get_feed_dict(batch, t)
train_pi = self.model.ops_dict["train_pi"]
train_vf = self.model.ops_dict["train_vf"]
# Run a policy gradient step and a value function training step
self.sess.run([train_pi, train_vf], feed_dict=feed_dict)
# self.sess.run([self.model.train_op], feed_dict=feed_dict)
# Run a policy gradient step
# self.sess.run(train_pi, feed_dict=feed_dict)
# Train the value function additionally
for _ in range(self.vf_iters-1):
if self._terminate:
break
self.sess.run(train_vf, feed_dict=feed_dict)
# Run the summary op to log the changes from the update if necessary
self._run_summary_op(t, feed_dict)
def _action_train(self, state):
data = self.model.action_train_ops(self.sess, state)
action = data["action"][0]
vf = data["vf"][0]
logp = data["logp"][0]
return action, vf, logp
def _action_eval(self, state):
data = self.model.action_eval_ops(self.sess, state)
action = data["action"][0]
return action
def _save_allowed(self):
# Prevent saving if the process was terminated - state is most likely inconsistent
return not self._terminate
def _state_action_spec(self, stack_frames):
assert isinstance(self.env_train.observation_space, gym.spaces.Box)
# Get environment specs
act_shape = list(self.env_train.action_space.shape)
obs_shape = list(self.env_train.observation_space.shape)
# Get obs_shape and obs_dtype
if len(obs_shape) == 3:
assert stack_frames > 1
obs_dtype = np.uint8
obs_len = stack_frames
else:
obs_dtype = np.float32
obs_len = 1
# Get act_shape and act_dtype
if isinstance(self.env_train.action_space, gym.spaces.Box):
act_shape = list(self.env_train.action_space.shape)
act_dtype = np.float32
elif isinstance(self.env_train.action_space, gym.spaces.Discrete):
act_shape = []
act_dtype = np.uint8
else:
raise ValueError("Unsupported action space")
return obs_shape, obs_dtype, act_shape, act_dtype, obs_len
def _reset(self):
pass
def _append_log_spec(self):
return [ ( "pi_learn_rate", "f", self.model.pi_opt_conf.lr_value), ]
| [
1,
1053,
330,
962,
13,
5215,
12655,
408,
7442,
13,
13,
3166,
364,
1896,
29888,
29889,
351,
1237,
418,
1053,
4522,
3460,
19661,
13,
3166,
364,
1896,
29888,
29889,
14834,
418,
1053,
349,
7210,
3043,
13,
3166,
364,
1896,
29888,
29889,
3712,
2105,
292,
29871,
1053,
2598,
2105,
13,
13,
13,
1990,
28330,
16903,
29898,
3403,
3460,
19661,
1125,
13,
13,
29871,
822,
4770,
2344,
12035,
1311,
29892,
13,
1669,
8829,
29918,
28107,
29892,
13,
1669,
1904,
29892,
13,
1669,
330,
2735,
29892,
13,
1669,
301,
314,
29892,
13,
1669,
9679,
449,
29918,
2435,
29892,
13,
1669,
5040,
29918,
10568,
29892,
13,
1669,
325,
29888,
29918,
277,
414,
29922,
29896,
29892,
13,
1669,
5096,
29918,
19935,
29922,
29941,
29892,
13,
1669,
3579,
14748,
29918,
19290,
13,
1669,
1125,
13,
1678,
9995,
13,
1678,
826,
3174,
29901,
13,
418,
8829,
29918,
28107,
29901,
1246,
519,
29889,
6680,
393,
4893,
278,
4464,
310,
385,
8829,
322,
5663,
6948,
263,
716,
5177,
2777,
13,
418,
330,
2735,
29901,
5785,
29889,
3295,
2798,
7329,
363,
402,
16036,
29898,
4283,
29892,
14013,
29897,
13,
418,
301,
314,
29901,
5785,
29889,
365,
2269,
995,
363,
402,
16036,
29898,
4283,
29892,
14013,
29897,
13,
418,
9679,
449,
29918,
2435,
29901,
938,
29889,
9681,
310,
10823,
6576,
1434,
5622,
263,
8898,
16030,
4331,
13,
418,
5040,
29918,
10568,
29901,
938,
29889,
14990,
1353,
310,
10823,
6576,
13,
418,
325,
29888,
29918,
277,
414,
29901,
938,
29889,
9681,
310,
995,
740,
6694,
6576,
297,
263,
2323,
21502,
305,
13,
1678,
9995,
13,
13,
1678,
2428,
2141,
1649,
2344,
12035,
1068,
14748,
29918,
19290,
29897,
13,
13,
1678,
4974,
1583,
29889,
1188,
29918,
19145,
1273,
9679,
449,
29918,
2435,
1275,
29871,
29900,
29892,
376,
3403,
3785,
1818,
367,
8572,
1821,
491,
9679,
449,
3309,
29908,
13,
1678,
565,
1583,
29889,
14513,
29918,
2435,
1405,
29871,
29900,
29901,
13,
418,
4974,
1583,
29889,
14513,
29918,
19145,
1273,
9679,
449,
29918,
2435,
1275,
29871,
29900,
29892,
376,
29923,
791,
3785,
1818,
367,
8572,
1821,
491,
9679,
449,
3309,
29908,
13,
1678,
565,
1583,
29889,
7620,
29918,
19145,
1405,
7442,
29889,
7192,
29901,
13,
418,
4974,
1583,
29889,
7620,
29918,
19145,
1273,
9679,
449,
29918,
2435,
1275,
29871,
29900,
29892,
376,
11371,
3785,
1818,
367,
8572,
1821,
491,
9679,
449,
3309,
29908,
13,
13,
1678,
1583,
29889,
6272,
29918,
14968,
353,
2598,
2105,
29898,
13,
462,
418,
8829,
29922,
6272,
29918,
28107,
877,
29873,
5477,
13,
462,
418,
1480,
29918,
3972,
29922,
1311,
29889,
4299,
29918,
3972,
29892,
13,
462,
418,
4464,
2433,
29873,
742,
13,
462,
418,
1480,
29918,
19145,
29922,
8516,
29892,
13,
462,
418,
4863,
29918,
6550,
29922,
1311,
29889,
9641,
29918,
19145,
29892,
13,
462,
1678,
1723,
13,
13,
1678,
1583,
29889,
6272,
29918,
14513,
29871,
353,
2598,
2105,
29898,
13,
462,
418,
8829,
29922,
6272,
29918,
28107,
877,
29872,
5477,
13,
462,
418,
1480,
29918,
3972,
29922,
1311,
29889,
4299,
29918,
3972,
29892,
13,
462,
418,
4464,
2433,
29872,
742,
13,
462,
418,
1480,
29918,
19145,
29922,
1311,
29889,
14513,
29918,
2435,
29892,
13,
462,
418,
4863,
29918,
6550,
29922,
1311,
29889,
9641,
29918,
19145,
29892,
13,
462,
418,
19745,
29918,
19145,
29922,
1311,
29889,
14513,
29918,
19145,
29892,
13,
462,
1678,
1723,
13,
13,
1678,
1583,
29889,
1245,
449,
29918,
2435,
29871,
353,
9679,
449,
29918,
2435,
13,
1678,
1583,
29889,
9847,
29918,
10568,
1678,
353,
5040,
29918,
10568,
13,
1678,
1583,
29889,
1022,
2878,
29879,
539,
353,
1583,
29889,
9847,
29918,
10568,
849,
1583,
29889,
1245,
449,
29918,
2435,
13,
1678,
1583,
29889,
29894,
29888,
29918,
277,
414,
268,
353,
325,
29888,
29918,
277,
414,
13,
13,
1678,
1583,
29889,
4283,
29871,
353,
330,
2735,
13,
1678,
1583,
29889,
5288,
1678,
353,
301,
314,
13,
13,
1678,
396,
3617,
5177,
1580,
29879,
13,
1678,
20881,
29918,
12181,
29892,
20881,
29918,
29881,
1853,
29892,
1044,
29918,
12181,
29892,
1044,
29918,
29881,
1853,
29892,
20881,
29918,
2435,
353,
1583,
3032,
3859,
29918,
2467,
29918,
6550,
29898,
1429,
29918,
19935,
29897,
13,
13,
1678,
396,
25455,
278,
1904,
322,
278,
7271,
6835,
13,
1678,
1583,
29889,
4299,
29871,
353,
1904,
29898,
26290,
29918,
12181,
29922,
26290,
29918,
12181,
29892,
1044,
29918,
3493,
29922,
1311,
29889,
6272,
29918,
14968,
29889,
2467,
29918,
3493,
29892,
3579,
1311,
29889,
4299,
29918,
19290,
29897,
13,
1678,
1583,
29889,
9040,
353,
349,
7210,
3043,
29898,
1311,
29889,
1245,
449,
29918,
2435,
29892,
20881,
29918,
12181,
29892,
20881,
29918,
29881,
1853,
29892,
1044,
29918,
12181,
29892,
1044,
29918,
29881,
1853,
29892,
20881,
29918,
2435,
29897,
13,
13,
13,
29871,
822,
903,
14968,
29898,
1311,
1125,
13,
1678,
396,
3617,
278,
740,
393,
16785,
23324,
3842,
13,
1678,
1065,
29918,
22197,
353,
1583,
3032,
3018,
622,
706,
29918,
27959,
29898,
1311,
29889,
1245,
449,
29918,
2435,
29897,
13,
13,
1678,
363,
260,
297,
3464,
29898,
1311,
29889,
14748,
29918,
10568,
29974,
29896,
29892,
1583,
29889,
1022,
2878,
29879,
29974,
29896,
1125,
13,
418,
565,
1583,
3032,
18821,
403,
29901,
13,
4706,
2867,
13,
13,
418,
4331,
353,
260,
334,
1583,
29889,
1245,
449,
29918,
2435,
13,
13,
418,
396,
24930,
7271,
297,
278,
5177,
13,
418,
1065,
29918,
22197,
580,
13,
13,
418,
396,
28186,
278,
1904,
13,
418,
1583,
3032,
3389,
29918,
14968,
29918,
10568,
29898,
29873,
29897,
13,
13,
418,
565,
4331,
1273,
1583,
29889,
1188,
29918,
19145,
1275,
29871,
29900,
29901,
13,
4706,
1583,
29889,
6272,
29918,
14968,
29889,
3712,
2105,
29889,
1188,
29918,
16202,
580,
13,
13,
418,
396,
22303,
322,
1065,
17983,
8792,
13,
418,
565,
1583,
29889,
14513,
29918,
2435,
1405,
29871,
29900,
322,
4331,
1273,
1583,
29889,
14513,
29918,
19145,
1275,
29871,
29900,
29901,
13,
4706,
1583,
3032,
14513,
29918,
14748,
580,
13,
13,
418,
396,
10318,
278,
10823,
4331,
448,
16161,
304,
1353,
310,
21502,
12168,
13,
418,
1583,
29889,
14748,
29918,
10568,
353,
4331,
13,
13,
418,
396,
16913,
3579,
7045,
1068,
10823,
4331,
338,
1959,
322,
8676,
13,
418,
565,
4331,
1273,
1583,
29889,
7620,
29918,
19145,
1275,
29871,
29900,
29901,
13,
4706,
1583,
29889,
7620,
580,
13,
13,
13,
29871,
822,
903,
3018,
622,
706,
29918,
27959,
29898,
1311,
29892,
28205,
1125,
13,
1678,
9995,
13,
1678,
826,
3174,
29901,
13,
418,
28205,
29901,
938,
29889,
9681,
310,
6576,
304,
1065,
1434,
7709,
292,
278,
23324,
3842,
13,
1678,
16969,
29901,
13,
418,
319,
740,
607,
16785,
23324,
3842,
13,
1678,
9995,
13,
13,
1678,
20881,
353,
1583,
29889,
12071,
580,
13,
13,
1678,
822,
1065,
29918,
6272,
7295,
13,
418,
1661,
2997,
20881,
13,
13,
418,
396,
17732,
278,
6835,
304,
4772,
773,
2030,
848,
13,
418,
1583,
29889,
9040,
29889,
12071,
580,
13,
13,
418,
363,
903,
297,
3464,
29898,
2015,
18162,
1125,
13,
4706,
565,
1583,
3032,
18821,
403,
29901,
13,
3986,
736,
13,
13,
4706,
396,
3617,
385,
3158,
304,
1065,
322,
278,
995,
740,
12678,
310,
445,
2106,
13,
4706,
3158,
29892,
325,
29888,
29892,
1480,
29886,
353,
1583,
3032,
2467,
29918,
14968,
29898,
26290,
29897,
13,
13,
4706,
396,
7525,
3158,
13,
4706,
2446,
29918,
26290,
29892,
20751,
29892,
2309,
29892,
5235,
353,
1583,
29889,
6272,
29918,
14968,
29889,
10568,
29898,
2467,
29897,
13,
13,
4706,
396,
14491,
278,
2779,
310,
278,
3158,
4586,
2501,
20881,
13,
4706,
1583,
29889,
9040,
29889,
8899,
29898,
26290,
29892,
3158,
29892,
20751,
29892,
2309,
29892,
325,
29888,
29892,
1480,
29886,
29897,
13,
13,
4706,
396,
2538,
300,
278,
5177,
565,
1095,
310,
12720,
13,
4706,
565,
2309,
29901,
13,
3986,
2446,
29918,
26290,
353,
1583,
29889,
12071,
580,
13,
4706,
20881,
353,
2446,
29918,
26290,
13,
13,
418,
396,
14491,
278,
995,
740,
363,
278,
2446,
2106,
29889,
2448,
19226,
304,
10272,
402,
16036,
29898,
2892,
29897,
13,
418,
565,
451,
2309,
29901,
13,
4706,
17117,
2446,
29918,
29894,
29888,
29892,
903,
353,
1583,
3032,
2467,
29918,
14968,
29898,
26290,
29897,
13,
418,
1683,
29901,
13,
4706,
2446,
29918,
29894,
29888,
353,
29871,
29900,
13,
13,
418,
396,
11796,
29872,
402,
16036,
29898,
4283,
29892,
14013,
29897,
322,
323,
29928,
29898,
2892,
29897,
13,
418,
1583,
29889,
9040,
29889,
26017,
29918,
342,
326,
1078,
29898,
1311,
29889,
4283,
29892,
1583,
29889,
5288,
29892,
2446,
29918,
29894,
29888,
29897,
13,
13,
1678,
736,
1065,
29918,
6272,
13,
13,
13,
29871,
822,
903,
657,
29918,
18798,
29918,
8977,
29898,
1311,
29892,
9853,
29892,
260,
1125,
13,
1678,
8343,
29918,
8977,
353,
426,
13,
418,
1583,
29889,
4299,
29889,
26290,
29918,
561,
29901,
795,
9853,
3366,
26290,
12436,
13,
418,
1583,
29889,
4299,
29889,
627,
29918,
561,
29901,
795,
9853,
3366,
627,
12436,
13,
418,
1583,
29889,
4299,
29889,
17263,
29918,
561,
29901,
795,
9853,
3366,
17263,
12436,
13,
418,
1583,
29889,
4299,
29889,
2267,
29918,
561,
29901,
795,
9853,
3366,
2267,
12436,
13,
418,
1583,
29889,
4299,
29889,
1025,
29918,
1188,
29886,
29918,
561,
29901,
308,
9853,
3366,
1188,
29886,
12436,
13,
418,
1583,
29889,
4299,
29889,
1631,
29918,
3670,
29918,
5527,
29889,
29212,
29918,
561,
29901,
259,
1583,
29889,
4299,
29889,
1631,
29918,
3670,
29918,
5527,
29889,
29212,
29918,
1767,
29898,
29873,
511,
13,
418,
1583,
29889,
4299,
29889,
29894,
29888,
29918,
3670,
29918,
5527,
29889,
29212,
29918,
561,
29901,
259,
1583,
29889,
4299,
29889,
29894,
29888,
29918,
3670,
29918,
5527,
29889,
29212,
29918,
1767,
29898,
29873,
511,
13,
1678,
500,
13,
13,
1678,
736,
8343,
29918,
8977,
13,
13,
13,
29871,
822,
903,
3389,
29918,
7727,
29918,
459,
29898,
1311,
29892,
260,
29892,
8343,
29918,
8977,
1125,
13,
1678,
565,
260,
334,
1583,
29889,
1245,
449,
29918,
2435,
1273,
1583,
29889,
1188,
29918,
19145,
1275,
29871,
29900,
29901,
13,
418,
1583,
29889,
7727,
353,
1583,
29889,
29879,
404,
29889,
3389,
29898,
1311,
29889,
7727,
29918,
459,
29892,
8343,
29918,
8977,
29922,
18798,
29918,
8977,
29897,
13,
13,
13,
29871,
822,
903,
3389,
29918,
14968,
29918,
10568,
29898,
1311,
29892,
260,
1125,
13,
1678,
9853,
268,
353,
1583,
29889,
9040,
29889,
657,
29918,
1272,
580,
13,
1678,
8343,
29918,
8977,
353,
1583,
3032,
657,
29918,
18798,
29918,
8977,
29898,
16175,
29892,
260,
29897,
13,
13,
1678,
7945,
29918,
1631,
29871,
353,
1583,
29889,
4299,
29889,
3554,
29918,
8977,
3366,
14968,
29918,
1631,
3108,
13,
1678,
7945,
29918,
29894,
29888,
29871,
353,
1583,
29889,
4299,
29889,
3554,
29918,
8977,
3366,
14968,
29918,
29894,
29888,
3108,
13,
13,
1678,
396,
7525,
263,
8898,
16030,
4331,
322,
263,
995,
740,
6694,
4331,
13,
1678,
1583,
29889,
29879,
404,
29889,
3389,
4197,
14968,
29918,
1631,
29892,
7945,
29918,
29894,
29888,
1402,
8343,
29918,
8977,
29922,
18798,
29918,
8977,
29897,
13,
1678,
396,
1583,
29889,
29879,
404,
29889,
3389,
4197,
1311,
29889,
4299,
29889,
14968,
29918,
459,
1402,
8343,
29918,
8977,
29922,
18798,
29918,
8977,
29897,
13,
13,
1678,
396,
7525,
263,
8898,
16030,
4331,
13,
1678,
396,
1583,
29889,
29879,
404,
29889,
3389,
29898,
14968,
29918,
1631,
29892,
8343,
29918,
8977,
29922,
18798,
29918,
8977,
29897,
13,
13,
1678,
396,
28186,
278,
995,
740,
6124,
635,
13,
1678,
363,
903,
297,
3464,
29898,
1311,
29889,
29894,
29888,
29918,
277,
414,
29899,
29896,
1125,
13,
418,
565,
1583,
3032,
18821,
403,
29901,
13,
4706,
2867,
13,
418,
1583,
29889,
29879,
404,
29889,
3389,
29898,
14968,
29918,
29894,
29888,
29892,
8343,
29918,
8977,
29922,
18798,
29918,
8977,
29897,
13,
13,
1678,
396,
7525,
278,
15837,
1015,
304,
1480,
278,
3620,
515,
278,
2767,
565,
5181,
13,
1678,
1583,
3032,
3389,
29918,
7727,
29918,
459,
29898,
29873,
29892,
8343,
29918,
8977,
29897,
13,
13,
13,
29871,
822,
903,
2467,
29918,
14968,
29898,
1311,
29892,
2106,
1125,
13,
1678,
848,
259,
353,
1583,
29889,
4299,
29889,
2467,
29918,
14968,
29918,
3554,
29898,
1311,
29889,
29879,
404,
29892,
2106,
29897,
13,
1678,
3158,
353,
848,
3366,
2467,
3108,
29961,
29900,
29962,
13,
1678,
325,
29888,
268,
353,
848,
3366,
29894,
29888,
3108,
29961,
29900,
29962,
13,
1678,
1480,
29886,
259,
353,
848,
3366,
1188,
29886,
3108,
29961,
29900,
29962,
13,
1678,
736,
3158,
29892,
325,
29888,
29892,
1480,
29886,
13,
13,
13,
29871,
822,
903,
2467,
29918,
14513,
29898,
1311,
29892,
2106,
1125,
13,
1678,
848,
259,
353,
1583,
29889,
4299,
29889,
2467,
29918,
14513,
29918,
3554,
29898,
1311,
29889,
29879,
404,
29892,
2106,
29897,
13,
1678,
3158,
353,
848,
3366,
2467,
3108,
29961,
29900,
29962,
13,
1678,
736,
3158,
13,
13,
13,
29871,
822,
903,
7620,
29918,
24622,
29898,
1311,
1125,
13,
1678,
396,
4721,
794,
14238,
565,
278,
1889,
471,
29185,
448,
2106,
338,
1556,
5517,
22435,
9696,
13,
1678,
736,
451,
1583,
3032,
18821,
403,
13,
13,
13,
29871,
822,
903,
3859,
29918,
2467,
29918,
6550,
29898,
1311,
29892,
5096,
29918,
19935,
1125,
13,
1678,
4974,
338,
8758,
29898,
1311,
29889,
6272,
29918,
14968,
29889,
26739,
362,
29918,
3493,
29892,
330,
962,
29889,
22854,
29889,
3313,
29897,
13,
13,
1678,
396,
3617,
5177,
1580,
29879,
13,
1678,
1044,
29918,
12181,
353,
1051,
29898,
1311,
29889,
6272,
29918,
14968,
29889,
2467,
29918,
3493,
29889,
12181,
29897,
13,
1678,
20881,
29918,
12181,
353,
1051,
29898,
1311,
29889,
6272,
29918,
14968,
29889,
26739,
362,
29918,
3493,
29889,
12181,
29897,
13,
13,
1678,
396,
3617,
20881,
29918,
12181,
322,
20881,
29918,
29881,
1853,
13,
1678,
565,
7431,
29898,
26290,
29918,
12181,
29897,
1275,
29871,
29941,
29901,
13,
418,
4974,
5096,
29918,
19935,
1405,
29871,
29896,
13,
418,
20881,
29918,
29881,
1853,
353,
7442,
29889,
13470,
29947,
13,
418,
20881,
29918,
2435,
259,
353,
5096,
29918,
19935,
13,
1678,
1683,
29901,
13,
418,
20881,
29918,
29881,
1853,
353,
7442,
29889,
7411,
29941,
29906,
13,
418,
20881,
29918,
2435,
259,
353,
29871,
29896,
13,
13,
1678,
396,
3617,
1044,
29918,
12181,
322,
1044,
29918,
29881,
1853,
13,
1678,
565,
338,
8758,
29898,
1311,
29889,
6272,
29918,
14968,
29889,
2467,
29918,
3493,
29892,
330,
962,
29889,
22854,
29889,
3313,
1125,
13,
418,
1044,
29918,
12181,
353,
1051,
29898,
1311,
29889,
6272,
29918,
14968,
29889,
2467,
29918,
3493,
29889,
12181,
29897,
13,
418,
1044,
29918,
29881,
1853,
353,
7442,
29889,
7411,
29941,
29906,
13,
1678,
25342,
338,
8758,
29898,
1311,
29889,
6272,
29918,
14968,
29889,
2467,
29918,
3493,
29892,
330,
962,
29889,
22854,
29889,
4205,
9084,
1125,
13,
418,
1044,
29918,
12181,
353,
5159,
13,
418,
1044,
29918,
29881,
1853,
353,
7442,
29889,
13470,
29947,
13,
1678,
1683,
29901,
13,
418,
12020,
7865,
2392,
703,
25807,
29884,
3016,
287,
3158,
2913,
1159,
13,
13,
1678,
736,
20881,
29918,
12181,
29892,
20881,
29918,
29881,
1853,
29892,
1044,
29918,
12181,
29892,
1044,
29918,
29881,
1853,
29892,
20881,
29918,
2435,
13,
13,
13,
29871,
822,
903,
12071,
29898,
1311,
1125,
13,
1678,
1209,
13,
13,
13,
29871,
822,
903,
4397,
29918,
1188,
29918,
6550,
29898,
1311,
1125,
13,
1678,
736,
518,
313,
376,
1631,
29918,
19668,
29918,
10492,
613,
376,
29888,
613,
1583,
29889,
4299,
29889,
1631,
29918,
3670,
29918,
5527,
29889,
29212,
29918,
1767,
511,
4514,
13,
2
] |
pyportable_installer/__main__.py | wuye999/pyportable-installer | 20 | 101022 | from lk_utils import relpath
from rich_click import Path
from ._vendor.rich_click_ext import click
@click.grp(help='PyPortable Installer command line interface.')
def cli():
pass
@click.cmd()
@click.arg('directory', default='.', type=Path())
def init(directory='.'):
"""
Initialize project with template config file.
args:
directory:
Create a [cyan]"pyproject.json"[/] under this directory.
If directory not exists, will create it.
If directory parameter is not given, will use [magenta]current
directory[/].
"""
import os
from shutil import copyfile
file_i = relpath('./template/pyproject.json')
file_o = f'{directory}/pyproject.json'
if not os.path.exists(directory):
os.mkdir(directory)
elif os.path.exists(file_o):
os.remove(file_o)
copyfile(file_i, file_o)
@click.cmd()
@click.arg('pyproject-file', default='./pyproject.json', type=Path(exists=True))
def build(pyproject_file='./pyproject.json'):
"""
Start building application from pyproject config file.
args:
pyproject-file:
Choose a pyproject config file. Accepts ".json", ".yaml", ".toml"
formats.
If parameter is not given, will use [magenta]"./pyproject.json"[/]
as default.
"""
from .main import full_build
full_build(pyproject_file)
@click.cmd()
def gui():
"""
Launch PyPortable Installer GUI. [dim](experimental feature)[/]
"""
from .user_interface import gui_on_psg
gui_on_psg.main()
if __name__ == '__main__':
cli()
| [
1,
515,
301,
29895,
29918,
13239,
1053,
1104,
2084,
13,
3166,
8261,
29918,
3808,
1053,
10802,
13,
13,
3166,
869,
29918,
19167,
29889,
4018,
29918,
3808,
29918,
1062,
1053,
2828,
13,
13,
13,
29992,
3808,
29889,
629,
29886,
29898,
8477,
2433,
19737,
2290,
519,
2799,
12572,
1899,
1196,
5067,
29889,
1495,
13,
1753,
9335,
7295,
13,
1678,
1209,
13,
13,
13,
29992,
3808,
29889,
9006,
580,
13,
29992,
3808,
29889,
1191,
877,
12322,
742,
2322,
2433,
29889,
742,
1134,
29922,
2605,
3101,
13,
1753,
2069,
29898,
12322,
2433,
6169,
1125,
13,
1678,
9995,
13,
1678,
25455,
2060,
411,
4472,
2295,
934,
29889,
13,
268,
13,
1678,
6389,
29901,
13,
4706,
3884,
29901,
13,
9651,
6204,
263,
518,
1270,
273,
18017,
2272,
4836,
29889,
3126,
29908,
29961,
29914,
29962,
1090,
445,
3884,
29889,
13,
9651,
960,
3884,
451,
4864,
29892,
674,
1653,
372,
29889,
13,
9651,
960,
3884,
3443,
338,
451,
2183,
29892,
674,
671,
518,
11082,
6381,
29962,
3784,
13,
632,
3884,
29961,
29914,
1822,
13,
1678,
9995,
13,
1678,
1053,
2897,
13,
1678,
515,
528,
4422,
1053,
3509,
1445,
13,
268,
13,
1678,
934,
29918,
29875,
353,
1104,
2084,
877,
6904,
6886,
29914,
2272,
4836,
29889,
3126,
1495,
13,
1678,
934,
29918,
29877,
353,
285,
29915,
29912,
12322,
6822,
2272,
4836,
29889,
3126,
29915,
13,
268,
13,
1678,
565,
451,
2897,
29889,
2084,
29889,
9933,
29898,
12322,
1125,
13,
4706,
2897,
29889,
11256,
3972,
29898,
12322,
29897,
13,
1678,
25342,
2897,
29889,
2084,
29889,
9933,
29898,
1445,
29918,
29877,
1125,
13,
4706,
2897,
29889,
5992,
29898,
1445,
29918,
29877,
29897,
13,
1678,
3509,
1445,
29898,
1445,
29918,
29875,
29892,
934,
29918,
29877,
29897,
13,
13,
13,
29992,
3808,
29889,
9006,
580,
13,
29992,
3808,
29889,
1191,
877,
2272,
4836,
29899,
1445,
742,
2322,
2433,
6904,
2272,
4836,
29889,
3126,
742,
1134,
29922,
2605,
29898,
9933,
29922,
5574,
876,
13,
1753,
2048,
29898,
2272,
4836,
29918,
1445,
2433,
6904,
2272,
4836,
29889,
3126,
29374,
13,
1678,
9995,
13,
1678,
7370,
5214,
2280,
515,
11451,
4836,
2295,
934,
29889,
13,
268,
13,
1678,
6389,
29901,
13,
4706,
11451,
4836,
29899,
1445,
29901,
13,
9651,
14542,
852,
263,
11451,
4836,
2295,
934,
29889,
29848,
29879,
11393,
3126,
613,
11393,
25162,
613,
11393,
15135,
29880,
29908,
13,
632,
21971,
29889,
13,
9651,
960,
3443,
338,
451,
2183,
29892,
674,
671,
518,
11082,
6381,
29962,
1642,
29914,
2272,
4836,
29889,
3126,
29908,
29961,
29914,
29962,
13,
632,
408,
2322,
29889,
13,
1678,
9995,
13,
1678,
515,
869,
3396,
1053,
2989,
29918,
4282,
13,
1678,
2989,
29918,
4282,
29898,
2272,
4836,
29918,
1445,
29897,
13,
13,
13,
29992,
3808,
29889,
9006,
580,
13,
1753,
1410,
29875,
7295,
13,
1678,
9995,
13,
1678,
997,
3322,
10772,
2290,
519,
2799,
12572,
14839,
29889,
518,
6229,
850,
735,
27910,
4682,
9601,
29914,
29962,
13,
1678,
9995,
13,
1678,
515,
869,
1792,
29918,
13248,
1053,
1410,
29875,
29918,
265,
29918,
567,
29887,
13,
1678,
1410,
29875,
29918,
265,
29918,
567,
29887,
29889,
3396,
580,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
9335,
580,
13,
2
] |
main.py | CaioMar/dsutils | 1 | 168200 | """
Author: <NAME>
Since: 2019-12
"""
import json
import querybuilder as qb
import importlib
importlib.reload(qb)
with open('./config.json', 'rb') as file:
CONFIG = json.load(fp=file)
SAFRAS = ['201901']
QUERY_DICT = CONFIG["123456"]
print(qb.ConfigQueryReader(SAFRAS, QUERY_DICT)\
.build())
| [
1,
9995,
13,
13720,
29901,
529,
5813,
29958,
13,
23036,
29901,
29871,
29906,
29900,
29896,
29929,
29899,
29896,
29906,
13,
15945,
29908,
13,
5215,
4390,
13,
13,
5215,
2346,
16409,
408,
3855,
29890,
13,
5215,
1053,
1982,
13,
5215,
1982,
29889,
28120,
29898,
29939,
29890,
29897,
13,
2541,
1722,
877,
6904,
2917,
29889,
3126,
742,
525,
6050,
1495,
408,
934,
29901,
13,
1678,
8707,
18667,
353,
4390,
29889,
1359,
29898,
18091,
29922,
1445,
29897,
13,
13,
29903,
5098,
29934,
3289,
353,
6024,
29906,
29900,
29896,
29929,
29900,
29896,
2033,
13,
13356,
24422,
29918,
4571,
1783,
353,
8707,
18667,
3366,
29896,
29906,
29941,
29946,
29945,
29953,
3108,
13,
13,
2158,
29898,
29939,
29890,
29889,
3991,
3010,
6982,
29898,
29903,
5098,
29934,
3289,
29892,
660,
29965,
24422,
29918,
4571,
1783,
2144,
13,
29889,
4282,
3101,
13,
13,
2
] |
tests/test_misc.py | untom/scikits.cuda | 0 | 1607981 | <gh_stars>0
#!/usr/bin/env python
"""
Unit tests for scikits.cuda.misc
"""
from unittest import main, TestCase, TestSuite
import pycuda.autoinit
import pycuda.gpuarray as gpuarray
import numpy as np
from numpy.testing import assert_raises
import skcuda.misc as misc
class test_misc(TestCase):
def setUp(self):
np.random.seed(0)
misc.init()
def test_maxabs_float32(self):
x = np.array([-1, 2, -3], np.float32)
x_gpu = gpuarray.to_gpu(x)
m_gpu = misc.maxabs(x_gpu)
assert np.allclose(m_gpu.get(), np.max(np.abs(x)))
def test_maxabs_float64(self):
x = np.array([-1, 2, -3], np.float64)
x_gpu = gpuarray.to_gpu(x)
m_gpu = misc.maxabs(x_gpu)
assert np.allclose(m_gpu.get(), np.max(np.abs(x)))
def test_maxabs_complex64(self):
x = np.array([-1j, 2, -3j], np.complex64)
x_gpu = gpuarray.to_gpu(x)
m_gpu = misc.maxabs(x_gpu)
assert np.allclose(m_gpu.get(), np.max(np.abs(x)))
def test_maxabs_complex128(self):
x = np.array([-1j, 2, -3j], np.complex128)
x_gpu = gpuarray.to_gpu(x)
m_gpu = misc.maxabs(x_gpu)
assert np.allclose(m_gpu.get(), np.max(np.abs(x)))
def test_cumsum_float32(self):
x = np.array([1, 4, 3, 2, 8], np.float32)
x_gpu = gpuarray.to_gpu(x)
c_gpu = misc.cumsum(x_gpu)
assert np.allclose(c_gpu.get(), np.cumsum(x))
def test_cumsum_float64(self):
x = np.array([1, 4, 3, 2, 8], np.float64)
x_gpu = gpuarray.to_gpu(x)
c_gpu = misc.cumsum(x_gpu)
assert np.allclose(c_gpu.get(), np.cumsum(x))
def test_cumsum_complex64(self):
x = np.array([1, 4j, 3, 2j, 8], np.complex64)
x_gpu = gpuarray.to_gpu(x)
c_gpu = misc.cumsum(x_gpu)
assert np.allclose(c_gpu.get(), np.cumsum(x))
def test_cumsum_complex128(self):
x = np.array([1, 4j, 3, 2j, 8], np.complex128)
x_gpu = gpuarray.to_gpu(x)
c_gpu = misc.cumsum(x_gpu)
assert np.allclose(c_gpu.get(), np.cumsum(x))
def test_diff_float32(self):
x = np.array([1.3, 2.7, 4.9, 5.1], np.float32)
x_gpu = gpuarray.to_gpu(x)
y_gpu = misc.diff(x_gpu)
assert np.allclose(y_gpu.get(), np.diff(x))
def test_diff_float64(self):
x = np.array([1.3, 2.7, 4.9, 5.1], np.float64)
x_gpu = gpuarray.to_gpu(x)
y_gpu = misc.diff(x_gpu)
assert np.allclose(y_gpu.get(), np.diff(x))
def test_diff_complex64(self):
x = np.array([1.3+2.0j, 2.7-3.9j, 4.9+1.0j, 5.1-9.0j], np.complex64)
x_gpu = gpuarray.to_gpu(x)
y_gpu = misc.diff(x_gpu)
assert np.allclose(y_gpu.get(), np.diff(x))
def test_diff_complex128(self):
x = np.array([1.3+2.0j, 2.7-3.9j, 4.9+1.0j, 5.1-9.0j], np.complex128)
x_gpu = gpuarray.to_gpu(x)
y_gpu = misc.diff(x_gpu)
assert np.allclose(y_gpu.get(), np.diff(x))
def test_get_by_index_float32(self):
src = np.random.rand(5).astype(np.float32)
src_gpu = gpuarray.to_gpu(src)
ind = gpuarray.to_gpu(np.array([0, 2, 4]))
res_gpu = misc.get_by_index(src_gpu, ind)
assert np.allclose(res_gpu.get(), src[[0, 2, 4]])
ind = gpuarray.to_gpu(np.array([], np.int64))
res_gpu = misc.get_by_index(src_gpu, ind)
assert len(res_gpu) == 0
def test_get_by_index_float64(self):
src = np.random.rand(5).astype(np.float64)
src_gpu = gpuarray.to_gpu(src)
ind = gpuarray.to_gpu(np.array([0, 2, 4]))
res_gpu = misc.get_by_index(src_gpu, ind)
assert np.allclose(res_gpu.get(), src[[0, 2, 4]])
ind = gpuarray.to_gpu(np.array([], np.int64))
res_gpu = misc.get_by_index(src_gpu, ind)
assert len(res_gpu) == 0
def test_set_by_index_dest_float32(self):
dest_gpu = gpuarray.to_gpu(np.arange(5, dtype=np.float32))
ind = gpuarray.to_gpu(np.array([0, 2, 4]))
src_gpu = gpuarray.to_gpu(np.array([1, 1, 1], dtype=np.float32))
misc.set_by_index(dest_gpu, ind, src_gpu, 'dest')
assert np.allclose(dest_gpu.get(),
np.array([1, 1, 1, 3, 1], dtype=np.float32))
dest_gpu = gpuarray.to_gpu(np.arange(5, dtype=np.float32))
ind = gpuarray.to_gpu(np.array([], np.int64))
src_gpu = gpuarray.to_gpu(np.array([1, 1, 1], dtype=np.float32))
misc.set_by_index(dest_gpu, ind, src_gpu, 'dest')
assert np.allclose(dest_gpu.get(),
np.arange(5, dtype=np.float32))
def test_set_by_index_dest_float64(self):
dest_gpu = gpuarray.to_gpu(np.arange(5, dtype=np.double))
ind = gpuarray.to_gpu(np.array([0, 2, 4]))
src_gpu = gpuarray.to_gpu(np.array([1, 1, 1], dtype=np.double))
misc.set_by_index(dest_gpu, ind, src_gpu, 'dest')
assert np.allclose(dest_gpu.get(),
np.array([1, 1, 1, 3, 1], dtype=np.double))
dest_gpu = gpuarray.to_gpu(np.arange(5, dtype=np.double))
ind = gpuarray.to_gpu(np.array([], np.int64))
src_gpu = gpuarray.to_gpu(np.array([1, 1, 1], dtype=np.double))
misc.set_by_index(dest_gpu, ind, src_gpu, 'dest')
assert np.allclose(dest_gpu.get(),
np.arange(5, dtype=np.double))
def test_set_by_index_src_float32(self):
dest_gpu = gpuarray.to_gpu(np.zeros(3, dtype=np.float32))
ind = gpuarray.to_gpu(np.array([0, 2, 4]))
src_gpu = gpuarray.to_gpu(np.arange(5, dtype=np.float32))
misc.set_by_index(dest_gpu, ind, src_gpu, 'src')
assert np.allclose(dest_gpu.get(),
np.array([0, 2, 4], dtype=np.float32))
dest_gpu = gpuarray.to_gpu(np.arange(5, dtype=np.float32))
ind = gpuarray.to_gpu(np.array([], np.int64))
src_gpu = gpuarray.to_gpu(np.array([1, 1, 1], dtype=np.float32))
misc.set_by_index(dest_gpu, ind, src_gpu, 'src')
assert np.allclose(dest_gpu.get(),
np.arange(5, dtype=np.float32))
def test_set_by_index_src_float64(self):
dest_gpu = gpuarray.to_gpu(np.zeros(3, dtype=np.double))
ind = gpuarray.to_gpu(np.array([0, 2, 4]))
src_gpu = gpuarray.to_gpu(np.arange(5, dtype=np.double))
misc.set_by_index(dest_gpu, ind, src_gpu, 'src')
assert np.allclose(dest_gpu.get(),
np.array([0, 2, 4], dtype=np.double))
dest_gpu = gpuarray.to_gpu(np.arange(5, dtype=np.double))
ind = gpuarray.to_gpu(np.array([], np.int64))
src_gpu = gpuarray.to_gpu(np.array([1, 1, 1], dtype=np.double))
misc.set_by_index(dest_gpu, ind, src_gpu, 'src')
assert np.allclose(dest_gpu.get(),
np.arange(5, dtype=np.double))
def impl_test_binaryop_matvec(self, dtype):
x = np.random.normal(scale=5.0, size=(3, 5)).astype(dtype)
a = np.random.normal(scale=5.0, size=(1, 5)).astype(dtype)
b = np.random.normal(scale=5.0, size=(3, 1)).astype(dtype)
# the following two test correct broadcasting on 0D vectors
c = np.random.normal(scale=5.0, size=(5, )).astype(dtype)
d = np.random.normal(scale=5.0, size=(3, )).astype(dtype)
x_gpu = gpuarray.to_gpu(x)
a_gpu = gpuarray.to_gpu(a)
b_gpu = gpuarray.to_gpu(b)
c_gpu = gpuarray.to_gpu(c)
d_gpu = gpuarray.to_gpu(d)
out = gpuarray.empty(x.shape, dtype=dtype)
# addition
res = misc.add_matvec(x_gpu, a_gpu, out=out).get()
assert np.allclose(res, x+a)
assert np.allclose(misc.add_matvec(x_gpu, b_gpu).get(), x+b)
assert np.allclose(misc.add_matvec(x_gpu, c_gpu).get(), x+c)
assert_raises(ValueError, misc.add_matvec, x_gpu, d_gpu)
# multiplication
res = misc.mult_matvec(x_gpu, a_gpu, out=out).get()
assert np.allclose(res, x*a)
assert np.allclose(misc.mult_matvec(x_gpu, b_gpu).get(), x*b)
assert np.allclose(misc.mult_matvec(x_gpu, c_gpu).get(), x*c)
assert_raises(ValueError, misc.mult_matvec, x_gpu, d_gpu)
# division
res = misc.div_matvec(x_gpu, a_gpu, out=out).get()
assert np.allclose(res, x/a)
assert np.allclose(misc.div_matvec(x_gpu, b_gpu).get(), x/b)
assert np.allclose(misc.div_matvec(x_gpu, c_gpu).get(), x/c)
assert_raises(ValueError, misc.div_matvec, x_gpu, d_gpu)
def test_binaryop_matvec_float32(self):
self.impl_test_binaryop_matvec(np.float32)
def test_binaryop_matvec_float64(self):
self.impl_test_binaryop_matvec(np.float64)
def test_binaryop_matvec_complex64(self):
self.impl_test_binaryop_matvec(np.complex64)
def test_binaryop_matvec_complex128(self):
self.impl_test_binaryop_matvec(np.complex128)
def impl_test_sum(self, dtype):
x = np.random.normal(scale=5.0, size=(3, 5))
x = x.astype(dtype=dtype, order='C')
x_gpu = gpuarray.to_gpu(x)
assert np.allclose(misc.sum(x_gpu).get(), x.sum())
assert np.allclose(misc.sum(x_gpu, axis=0).get(), x.sum(axis=0))
assert np.allclose(misc.sum(x_gpu, axis=1).get(), x.sum(axis=1))
x = x.astype(dtype=dtype, order='F')
x_gpu = gpuarray.to_gpu(x)
assert np.allclose(misc.sum(x_gpu).get(), x.sum())
assert np.allclose(misc.sum(x_gpu, axis=0).get(), x.sum(axis=0))
assert np.allclose(misc.sum(x_gpu, axis=1).get(), x.sum(axis=1))
def test_sum_float32(self):
self.impl_test_sum(np.float32)
def test_sum_float64(self):
self.impl_test_sum(np.float64)
def test_sum_complex64(self):
self.impl_test_sum(np.complex64)
def test_sum_complex128(self):
self.impl_test_sum(np.complex128)
def impl_test_mean(self, dtype):
x = np.random.normal(scale=5.0, size=(3, 5))
x = x.astype(dtype=dtype, order='C')
x_gpu = gpuarray.to_gpu(x)
assert np.allclose(misc.mean(x_gpu).get(), x.mean())
assert np.allclose(misc.mean(x_gpu, axis=0).get(), x.mean(axis=0))
assert np.allclose(misc.mean(x_gpu, axis=1).get(), x.mean(axis=1))
x = x.astype(dtype=dtype, order='F')
x_gpu = gpuarray.to_gpu(x)
assert np.allclose(misc.mean(x_gpu).get(), x.mean())
assert np.allclose(misc.mean(x_gpu, axis=-1).get(), x.mean(axis=-1))
assert np.allclose(misc.mean(x_gpu, axis=-2).get(), x.mean(axis=-2))
def test_mean_float32(self):
self.impl_test_mean(np.float32)
def test_mean_float64(self):
self.impl_test_mean(np.float64)
def test_mean_complex64(self):
self.impl_test_mean(np.complex64)
def test_mean_complex128(self):
self.impl_test_mean(np.complex128)
def impl_test_var(self, dtype):
x = np.random.normal(scale=5.0, size=(3, 5))
x = x.astype(dtype=dtype, order='C')
x_gpu = gpuarray.to_gpu(x)
assert np.allclose(misc.var(x_gpu).get(), x.var())
assert np.allclose(misc.var(x_gpu, axis=0).get(), x.var(axis=0))
assert np.allclose(misc.var(x_gpu, axis=1).get(), x.var(axis=1))
# Currently not working due to a bug in PyCUDA, see Issue #92
#x = x.astype(dtype=dtype, order='F')
#x_gpu = gpuarray.to_gpu(x)
#assert np.allclose(misc.var(x_gpu).get(), x.var())
#assert np.allclose(misc.var(x_gpu, axis=-1).get(), x.var(axis=-1))
#assert np.allclose(misc.var(x_gpu, axis=-2).get(), x.var(axis=-2))
def test_var_float32(self):
self.impl_test_var(np.float32)
def test_var_float64(self):
self.impl_test_var(np.float64)
def test_var_complex64(self):
self.impl_test_var(np.complex64)
def test_var_complex128(self):
self.impl_test_var(np.complex128)
def impl_test_std(self, dtype):
x = np.random.normal(scale=5.0, size=(3, 5))
x = x.astype(dtype=dtype, order='C')
x_gpu = gpuarray.to_gpu(x)
assert np.allclose(misc.std(x_gpu).get(), x.std())
assert np.allclose(misc.std(x_gpu, axis=0).get(), x.std(axis=0))
assert np.allclose(misc.std(x_gpu, axis=1).get(), x.std(axis=1))
# Currently not working due to a bug in PyCUDA, see Issue #92
#x = x.astype(dtype=dtype, order='F')
#x_gpu = gpuarray.to_gpu(x)
#assert np.allclose(misc.std(x_gpu).get(), x.std())
#assert np.allclose(misc.std(x_gpu, axis=-1).get(), x.std(axis=-1))
#assert np.allclose(misc.std(x_gpu, axis=-2).get(), x.std(axis=-2))
def test_std_float32(self):
self.impl_test_std(np.float32)
def test_std_float64(self):
self.impl_test_std(np.float64)
def test_std_complex64(self):
self.impl_test_std(np.complex64)
def test_std_complex128(self):
self.impl_test_std(np.complex128)
def _impl_test_minmax(self, dtype):
x = np.random.normal(scale=5.0, size=(3, 5))
x = x.astype(dtype=dtype, order='C')
x_gpu = gpuarray.to_gpu(x)
assert np.allclose(misc.max(x_gpu, axis=0).get(), x.max(axis=0))
assert np.allclose(misc.max(x_gpu, axis=1).get(), x.max(axis=1))
assert np.allclose(misc.min(x_gpu, axis=0).get(), x.min(axis=0))
assert np.allclose(misc.min(x_gpu, axis=1).get(), x.min(axis=1))
x = x.astype(dtype=dtype, order='F')
x_gpu = gpuarray.to_gpu(x)
assert np.allclose(misc.max(x_gpu, axis=0).get(), x.max(axis=0))
assert np.allclose(misc.max(x_gpu, axis=1).get(), x.max(axis=1))
assert np.allclose(misc.min(x_gpu, axis=0).get(), x.min(axis=0))
assert np.allclose(misc.min(x_gpu, axis=1).get(), x.min(axis=1))
def test_minmax_float32(self):
self._impl_test_minmax(np.float32)
def test_minmax_float64(self):
self._impl_test_minmax(np.float64)
def _impl_test_argminmax(self, dtype):
x = np.random.normal(scale=5.0, size=(3, 5))
x = x.astype(dtype=dtype, order='C')
x_gpu = gpuarray.to_gpu(x)
assert np.allclose(misc.argmax(x_gpu, axis=0).get(), x.argmax(axis=0))
assert np.allclose(misc.argmax(x_gpu, axis=1).get(), x.argmax(axis=1))
assert np.allclose(misc.argmin(x_gpu, axis=0).get(), x.argmin(axis=0))
assert np.allclose(misc.argmin(x_gpu, axis=1).get(), x.argmin(axis=1))
x = x.astype(dtype=dtype, order='F')
x_gpu = gpuarray.to_gpu(x)
assert np.allclose(misc.argmax(x_gpu, axis=0).get(), x.argmax(axis=0))
assert np.allclose(misc.argmax(x_gpu, axis=1).get(), x.argmax(axis=1))
assert np.allclose(misc.argmin(x_gpu, axis=0).get(), x.argmin(axis=0))
assert np.allclose(misc.argmin(x_gpu, axis=1).get(), x.argmin(axis=1))
def test_argminmax_float32(self):
self._impl_test_argminmax(np.float32)
def test_argminmax_float64(self):
self._impl_test_argminmax(np.float64)
def suite():
s = TestSuite()
s.addTest(test_misc('test_maxabs_float32'))
s.addTest(test_misc('test_maxabs_complex64'))
s.addTest(test_misc('test_cumsum_float32'))
s.addTest(test_misc('test_cumsum_complex64'))
s.addTest(test_misc('test_diff_float32'))
s.addTest(test_misc('test_diff_complex64'))
s.addTest(test_misc('test_get_by_index_float32'))
s.addTest(test_misc('test_set_by_index_dest_float32'))
s.addTest(test_misc('test_set_by_index_src_float32'))
s.addTest(test_misc('test_binaryop_matvec_float32'))
s.addTest(test_misc('test_binaryop_matvec_complex64'))
s.addTest(test_misc('test_sum_float32'))
s.addTest(test_misc('test_sum_complex64'))
s.addTest(test_misc('test_mean_float32'))
s.addTest(test_misc('test_mean_complex64'))
s.addTest(test_misc('test_var_float32'))
s.addTest(test_misc('test_var_complex64'))
s.addTest(test_misc('test_std_float32'))
s.addTest(test_misc('test_std_complex64'))
s.addTest(test_misc('test_minmax_float32'))
s.addTest(test_misc('test_argminmax_float32'))
if misc.get_compute_capability(pycuda.autoinit.device) >= 1.3:
s.addTest(test_misc('test_maxabs_float64'))
s.addTest(test_misc('test_maxabs_complex128'))
s.addTest(test_misc('test_cumsum_float64'))
s.addTest(test_misc('test_cumsum_complex128'))
s.addTest(test_misc('test_diff_float64'))
s.addTest(test_misc('test_diff_complex128'))
s.addTest(test_misc('test_get_by_index_float32'))
s.addTest(test_misc('test_set_by_index_dest_float64'))
s.addTest(test_misc('test_set_by_index_src_float64'))
s.addTest(test_misc('test_sum_float64'))
s.addTest(test_misc('test_sum_complex128'))
s.addTest(test_misc('test_mean_float64'))
s.addTest(test_misc('test_mean_complex128'))
s.addTest(test_misc('test_binaryop_matvec_float64'))
s.addTest(test_misc('test_binaryop_matvec_complex128'))
s.addTest(test_misc('test_var_float64'))
s.addTest(test_misc('test_var_complex128'))
s.addTest(test_misc('test_std_float64'))
s.addTest(test_misc('test_std_complex128'))
s.addTest(test_misc('test_minmax_float64'))
s.addTest(test_misc('test_argminmax_float64'))
return s
if __name__ == '__main__':
main(defaultTest = 'suite')
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
29937,
14708,
4855,
29914,
2109,
29914,
6272,
3017,
13,
13,
15945,
29908,
13,
8325,
6987,
363,
4560,
29895,
1169,
29889,
29883,
6191,
29889,
29885,
10669,
13,
15945,
29908,
13,
13,
3166,
443,
27958,
1053,
1667,
29892,
4321,
8259,
29892,
4321,
5091,
568,
13,
13,
5215,
282,
11078,
6191,
29889,
6921,
2344,
13,
5215,
282,
11078,
6191,
29889,
29887,
3746,
2378,
408,
330,
3746,
2378,
13,
5215,
12655,
408,
7442,
13,
3166,
12655,
29889,
13424,
1053,
4974,
29918,
336,
4637,
13,
5215,
2071,
29883,
6191,
29889,
29885,
10669,
408,
3984,
29883,
13,
13,
1990,
1243,
29918,
29885,
10669,
29898,
3057,
8259,
1125,
13,
13,
1678,
822,
731,
3373,
29898,
1311,
1125,
13,
4706,
7442,
29889,
8172,
29889,
26776,
29898,
29900,
29897,
13,
4706,
3984,
29883,
29889,
2344,
580,
13,
13,
1678,
822,
1243,
29918,
3317,
6897,
29918,
7411,
29941,
29906,
29898,
1311,
1125,
13,
4706,
921,
353,
7442,
29889,
2378,
4197,
29899,
29896,
29892,
29871,
29906,
29892,
448,
29941,
1402,
7442,
29889,
7411,
29941,
29906,
29897,
13,
4706,
921,
29918,
29887,
3746,
353,
330,
3746,
2378,
29889,
517,
29918,
29887,
3746,
29898,
29916,
29897,
13,
4706,
286,
29918,
29887,
3746,
353,
3984,
29883,
29889,
3317,
6897,
29898,
29916,
29918,
29887,
3746,
29897,
13,
4706,
4974,
7442,
29889,
497,
5358,
29898,
29885,
29918,
29887,
3746,
29889,
657,
3285,
7442,
29889,
3317,
29898,
9302,
29889,
6897,
29898,
29916,
4961,
13,
13,
1678,
822,
1243,
29918,
3317,
6897,
29918,
7411,
29953,
29946,
29898,
1311,
1125,
13,
4706,
921,
353,
7442,
29889,
2378,
4197,
29899,
29896,
29892,
29871,
29906,
29892,
448,
29941,
1402,
7442,
29889,
7411,
29953,
29946,
29897,
13,
4706,
921,
29918,
29887,
3746,
353,
330,
3746,
2378,
29889,
517,
29918,
29887,
3746,
29898,
29916,
29897,
13,
4706,
286,
29918,
29887,
3746,
353,
3984,
29883,
29889,
3317,
6897,
29898,
29916,
29918,
29887,
3746,
29897,
13,
4706,
4974,
7442,
29889,
497,
5358,
29898,
29885,
29918,
29887,
3746,
29889,
657,
3285,
7442,
29889,
3317,
29898,
9302,
29889,
6897,
29898,
29916,
4961,
13,
13,
1678,
822,
1243,
29918,
3317,
6897,
29918,
19676,
29953,
29946,
29898,
1311,
1125,
13,
4706,
921,
353,
7442,
29889,
2378,
4197,
29899,
29896,
29926,
29892,
29871,
29906,
29892,
448,
29941,
29926,
1402,
7442,
29889,
19676,
29953,
29946,
29897,
13,
4706,
921,
29918,
29887,
3746,
353,
330,
3746,
2378,
29889,
517,
29918,
29887,
3746,
29898,
29916,
29897,
13,
4706,
286,
29918,
29887,
3746,
353,
3984,
29883,
29889,
3317,
6897,
29898,
29916,
29918,
29887,
3746,
29897,
13,
4706,
4974,
7442,
29889,
497,
5358,
29898,
29885,
29918,
29887,
3746,
29889,
657,
3285,
7442,
29889,
3317,
29898,
9302,
29889,
6897,
29898,
29916,
4961,
13,
13,
1678,
822,
1243,
29918,
3317,
6897,
29918,
19676,
29896,
29906,
29947,
29898,
1311,
1125,
13,
4706,
921,
353,
7442,
29889,
2378,
4197,
29899,
29896,
29926,
29892,
29871,
29906,
29892,
448,
29941,
29926,
1402,
7442,
29889,
19676,
29896,
29906,
29947,
29897,
13,
4706,
921,
29918,
29887,
3746,
353,
330,
3746,
2378,
29889,
517,
29918,
29887,
3746,
29898,
29916,
29897,
13,
4706,
286,
29918,
29887,
3746,
353,
3984,
29883,
29889,
3317,
6897,
29898,
29916,
29918,
29887,
3746,
29897,
13,
4706,
4974,
7442,
29889,
497,
5358,
29898,
29885,
29918,
29887,
3746,
29889,
657,
3285,
7442,
29889,
3317,
29898,
9302,
29889,
6897,
29898,
29916,
4961,
13,
13,
1678,
822,
1243,
29918,
29883,
398,
2083,
29918,
7411,
29941,
29906,
29898,
1311,
1125,
13,
4706,
921,
353,
7442,
29889,
2378,
4197,
29896,
29892,
29871,
29946,
29892,
29871,
29941,
29892,
29871,
29906,
29892,
29871,
29947,
1402,
7442,
29889,
7411,
29941,
29906,
29897,
13,
4706,
921,
29918,
29887,
3746,
353,
330,
3746,
2378,
29889,
517,
29918,
29887,
3746,
29898,
29916,
29897,
13,
4706,
274,
29918,
29887,
3746,
353,
3984,
29883,
29889,
29883,
398,
2083,
29898,
29916,
29918,
29887,
3746,
29897,
13,
4706,
4974,
7442,
29889,
497,
5358,
29898,
29883,
29918,
29887,
3746,
29889,
657,
3285,
7442,
29889,
29883,
398,
2083,
29898,
29916,
876,
13,
13,
1678,
822,
1243,
29918,
29883,
398,
2083,
29918,
7411,
29953,
29946,
29898,
1311,
1125,
13,
4706,
921,
353,
7442,
29889,
2378,
4197,
29896,
29892,
29871,
29946,
29892,
29871,
29941,
29892,
29871,
29906,
29892,
29871,
29947,
1402,
7442,
29889,
7411,
29953,
29946,
29897,
13,
4706,
921,
29918,
29887,
3746,
353,
330,
3746,
2378,
29889,
517,
29918,
29887,
3746,
29898,
29916,
29897,
13,
4706,
274,
29918,
29887,
3746,
353,
3984,
29883,
29889,
29883,
398,
2083,
29898,
29916,
29918,
29887,
3746,
29897,
13,
4706,
4974,
7442,
29889,
497,
5358,
29898,
29883,
29918,
29887,
3746,
29889,
657,
3285,
7442,
29889,
29883,
398,
2083,
29898,
29916,
876,
13,
13,
1678,
822,
1243,
29918,
29883,
398,
2083,
29918,
19676,
29953,
29946,
29898,
1311,
1125,
13,
4706,
921,
353,
7442,
29889,
2378,
4197,
29896,
29892,
29871,
29946,
29926,
29892,
29871,
29941,
29892,
29871,
29906,
29926,
29892,
29871,
29947,
1402,
7442,
29889,
19676,
29953,
29946,
29897,
13,
4706,
921,
29918,
29887,
3746,
353,
330,
3746,
2378,
29889,
517,
29918,
29887,
3746,
29898,
29916,
29897,
13,
4706,
274,
29918,
29887,
3746,
353,
3984,
29883,
29889,
29883,
398,
2083,
29898,
29916,
29918,
29887,
3746,
29897,
13,
4706,
4974,
7442,
29889,
497,
5358,
29898,
29883,
29918,
29887,
3746,
29889,
657,
3285,
7442,
29889,
29883,
398,
2083,
29898,
29916,
876,
13,
13,
1678,
822,
1243,
29918,
29883,
398,
2083,
29918,
19676,
29896,
29906,
29947,
29898,
1311,
1125,
13,
4706,
921,
353,
7442,
29889,
2378,
4197,
29896,
29892,
29871,
29946,
29926,
29892,
29871,
29941,
29892,
29871,
29906,
29926,
29892,
29871,
29947,
1402,
7442,
29889,
19676,
29896,
29906,
29947,
29897,
13,
4706,
921,
29918,
29887,
3746,
353,
330,
3746,
2378,
29889,
517,
29918,
29887,
3746,
29898,
29916,
29897,
13,
4706,
274,
29918,
29887,
3746,
353,
3984,
29883,
29889,
29883,
398,
2083,
29898,
29916,
29918,
29887,
3746,
29897,
13,
4706,
4974,
7442,
29889,
497,
5358,
29898,
29883,
29918,
29887,
3746,
29889,
657,
3285,
7442,
29889,
29883,
398,
2083,
29898,
29916,
876,
13,
13,
1678,
822,
1243,
29918,
12765,
29918,
7411,
29941,
29906,
29898,
1311,
1125,
13,
4706,
921,
353,
7442,
29889,
2378,
4197,
29896,
29889,
29941,
29892,
29871,
29906,
29889,
29955,
29892,
29871,
29946,
29889,
29929,
29892,
29871,
29945,
29889,
29896,
1402,
7442,
29889,
7411,
29941,
29906,
29897,
13,
4706,
921,
29918,
29887,
3746,
353,
330,
3746,
2378,
29889,
517,
29918,
29887,
3746,
29898,
29916,
29897,
13,
4706,
343,
29918,
29887,
3746,
353,
3984,
29883,
29889,
12765,
29898,
29916,
29918,
29887,
3746,
29897,
13,
4706,
4974,
7442,
29889,
497,
5358,
29898,
29891,
29918,
29887,
3746,
29889,
657,
3285,
7442,
29889,
12765,
29898,
29916,
876,
13,
13,
1678,
822,
1243,
29918,
12765,
29918,
7411,
29953,
29946,
29898,
1311,
1125,
13,
4706,
921,
353,
7442,
29889,
2378,
4197,
29896,
29889,
29941,
29892,
29871,
29906,
29889,
29955,
29892,
29871,
29946,
29889,
29929,
29892,
29871,
29945,
29889,
29896,
1402,
7442,
29889,
7411,
29953,
29946,
29897,
13,
4706,
921,
29918,
29887,
3746,
353,
330,
3746,
2378,
29889,
517,
29918,
29887,
3746,
29898,
29916,
29897,
13,
4706,
343,
29918,
29887,
3746,
353,
3984,
29883,
29889,
12765,
29898,
29916,
29918,
29887,
3746,
29897,
13,
4706,
4974,
7442,
29889,
497,
5358,
29898,
29891,
29918,
29887,
3746,
29889,
657,
3285,
7442,
29889,
12765,
29898,
29916,
876,
13,
13,
1678,
822,
1243,
29918,
12765,
29918,
19676,
29953,
29946,
29898,
1311,
1125,
13,
4706,
921,
353,
7442,
29889,
2378,
4197,
29896,
29889,
29941,
29974,
29906,
29889,
29900,
29926,
29892,
29871,
29906,
29889,
29955,
29899,
29941,
29889,
29929,
29926,
29892,
29871,
29946,
29889,
29929,
29974,
29896,
29889,
29900,
29926,
29892,
29871,
29945,
29889,
29896,
29899,
29929,
29889,
29900,
29926,
1402,
7442,
29889,
19676,
29953,
29946,
29897,
13,
4706,
921,
29918,
29887,
3746,
353,
330,
3746,
2378,
29889,
517,
29918,
29887,
3746,
29898,
29916,
29897,
13,
4706,
343,
29918,
29887,
3746,
353,
3984,
29883,
29889,
12765,
29898,
29916,
29918,
29887,
3746,
29897,
13,
4706,
4974,
7442,
29889,
497,
5358,
29898,
29891,
29918,
29887,
3746,
29889,
657,
3285,
7442,
29889,
12765,
29898,
29916,
876,
13,
13,
1678,
822,
1243,
29918,
12765,
29918,
19676,
29896,
29906,
29947,
29898,
1311,
1125,
13,
4706,
921,
353,
7442,
29889,
2378,
4197,
29896,
29889,
29941,
29974,
29906,
29889,
29900,
29926,
29892,
29871,
29906,
29889,
29955,
29899,
29941,
29889,
29929,
29926,
29892,
29871,
29946,
29889,
29929,
29974,
29896,
29889,
29900,
29926,
29892,
29871,
29945,
29889,
29896,
29899,
29929,
29889,
29900,
29926,
1402,
7442,
29889,
19676,
29896,
29906,
29947,
29897,
13,
4706,
921,
29918,
29887,
3746,
353,
330,
3746,
2378,
29889,
517,
29918,
29887,
3746,
29898,
29916,
29897,
13,
4706,
343,
29918,
29887,
3746,
353,
3984,
29883,
29889,
12765,
29898,
29916,
29918,
29887,
3746,
29897,
13,
4706,
4974,
7442,
29889,
497,
5358,
29898,
29891,
29918,
29887,
3746,
29889,
657,
3285,
7442,
29889,
12765,
29898,
29916,
876,
13,
13,
1678,
822,
1243,
29918,
657,
29918,
1609,
29918,
2248,
29918,
7411,
29941,
29906,
29898,
1311,
1125,
13,
4706,
4765,
353,
7442,
29889,
8172,
29889,
9502,
29898,
29945,
467,
579,
668,
29898,
9302,
29889,
7411,
29941,
29906,
29897,
13,
4706,
4765,
29918,
29887,
3746,
353,
330,
3746,
2378,
29889,
517,
29918,
29887,
3746,
29898,
4351,
29897,
13,
4706,
1399,
353,
330,
3746,
2378,
29889,
517,
29918,
29887,
3746,
29898,
9302,
29889,
2378,
4197,
29900,
29892,
29871,
29906,
29892,
29871,
29946,
12622,
13,
4706,
620,
29918,
29887,
3746,
353,
3984,
29883,
29889,
657,
29918,
1609,
29918,
2248,
29898,
4351,
29918,
29887,
3746,
29892,
1399,
29897,
13,
4706,
4974,
7442,
29889,
497,
5358,
29898,
690,
29918,
29887,
3746,
29889,
657,
3285,
4765,
8999,
29900,
29892,
29871,
29906,
29892,
29871,
29946,
24960,
13,
13,
4706,
1399,
353,
330,
3746,
2378,
29889,
517,
29918,
29887,
3746,
29898,
9302,
29889,
2378,
4197,
1402,
7442,
29889,
524,
29953,
29946,
876,
13,
4706,
620,
29918,
29887,
3746,
353,
3984,
29883,
29889,
657,
29918,
1609,
29918,
2248,
29898,
4351,
29918,
29887,
3746,
29892,
1399,
29897,
13,
4706,
4974,
7431,
29898,
690,
29918,
29887,
3746,
29897,
1275,
29871,
29900,
13,
13,
1678,
822,
1243,
29918,
657,
29918,
1609,
29918,
2248,
29918,
7411,
29953,
29946,
29898,
1311,
1125,
13,
4706,
4765,
353,
7442,
29889,
8172,
29889,
9502,
29898,
29945,
467,
579,
668,
29898,
9302,
29889,
7411,
29953,
29946,
29897,
13,
4706,
4765,
29918,
29887,
3746,
353,
330,
3746,
2378,
29889,
517,
29918,
29887,
3746,
29898,
4351,
29897,
13,
4706,
1399,
353,
330,
3746,
2378,
29889,
517,
29918,
29887,
3746,
29898,
9302,
29889,
2378,
4197,
29900,
29892,
29871,
29906,
29892,
29871,
29946,
12622,
13,
4706,
620,
29918,
29887,
3746,
353,
3984,
29883,
29889,
657,
29918,
1609,
29918,
2248,
29898,
4351,
29918,
29887,
3746,
29892,
1399,
29897,
13,
4706,
4974,
7442,
29889,
497,
5358,
29898,
690,
29918,
29887,
3746,
29889,
657,
3285,
4765,
8999,
29900,
29892,
29871,
29906,
29892,
29871,
29946,
24960,
13,
13,
4706,
1399,
353,
330,
3746,
2378,
29889,
517,
29918,
29887,
3746,
29898,
9302,
29889,
2378,
4197,
1402,
7442,
29889,
524,
29953,
29946,
876,
13,
4706,
620,
29918,
29887,
3746,
353,
3984,
29883,
29889,
657,
29918,
1609,
29918,
2248,
29898,
4351,
29918,
29887,
3746,
29892,
1399,
29897,
13,
4706,
4974,
7431,
29898,
690,
29918,
29887,
3746,
29897,
1275,
29871,
29900,
13,
13,
1678,
822,
1243,
29918,
842,
29918,
1609,
29918,
2248,
29918,
7854,
29918,
7411,
29941,
29906,
29898,
1311,
1125,
13,
4706,
2731,
29918,
29887,
3746,
353,
330,
3746,
2378,
29889,
517,
29918,
29887,
3746,
29898,
9302,
29889,
279,
927,
29898,
29945,
29892,
26688,
29922,
9302,
29889,
7411,
29941,
29906,
876,
13,
4706,
1399,
353,
330,
3746,
2378,
29889,
517,
29918,
29887,
3746,
29898,
9302,
29889,
2378,
4197,
29900,
29892,
29871,
29906,
29892,
29871,
29946,
12622,
13,
4706,
4765,
29918,
29887,
3746,
353,
330,
3746,
2378,
29889,
517,
29918,
29887,
3746,
29898,
9302,
29889,
2378,
4197,
29896,
29892,
29871,
29896,
29892,
29871,
29896,
1402,
26688,
29922,
9302,
29889,
7411,
29941,
29906,
876,
13,
4706,
3984,
29883,
29889,
842,
29918,
1609,
29918,
2248,
29898,
7854,
29918,
29887,
3746,
29892,
1399,
29892,
4765,
29918,
29887,
3746,
29892,
525,
7854,
1495,
13,
4706,
4974,
7442,
29889,
497,
5358,
29898,
7854,
29918,
29887,
3746,
29889,
657,
3285,
13,
462,
965,
7442,
29889,
2378,
4197,
29896,
29892,
29871,
29896,
29892,
29871,
29896,
29892,
29871,
29941,
29892,
29871,
29896,
1402,
26688,
29922,
9302,
29889,
7411,
29941,
29906,
876,
13,
13,
4706,
2731,
29918,
29887,
3746,
353,
330,
3746,
2378,
29889,
517,
29918,
29887,
3746,
29898,
9302,
29889,
279,
927,
29898,
29945,
29892,
26688,
29922,
9302,
29889,
7411,
29941,
29906,
876,
13,
4706,
1399,
353,
330,
3746,
2378,
29889,
517,
29918,
29887,
3746,
29898,
9302,
29889,
2378,
4197,
1402,
7442,
29889,
524,
29953,
29946,
876,
13,
4706,
4765,
29918,
29887,
3746,
353,
330,
3746,
2378,
29889,
517,
29918,
29887,
3746,
29898,
9302,
29889,
2378,
4197,
29896,
29892,
29871,
29896,
29892,
29871,
29896,
1402,
26688,
29922,
9302,
29889,
7411,
29941,
29906,
876,
13,
4706,
3984,
29883,
29889,
842,
29918,
1609,
29918,
2248,
29898,
7854,
29918,
29887,
3746,
29892,
1399,
29892,
4765,
29918,
29887,
3746,
29892,
525,
7854,
1495,
13,
4706,
4974,
7442,
29889,
497,
5358,
29898,
7854,
29918,
29887,
3746,
29889,
657,
3285,
13,
462,
965,
7442,
29889,
279,
927,
29898,
29945,
29892,
26688,
29922,
9302,
29889,
7411,
29941,
29906,
876,
13,
13,
1678,
822,
1243,
29918,
842,
29918,
1609,
29918,
2248,
29918,
7854,
29918,
7411,
29953,
29946,
29898,
1311,
1125,
13,
4706,
2731,
29918,
29887,
3746,
353,
330,
3746,
2378,
29889,
517,
29918,
29887,
3746,
29898,
9302,
29889,
279,
927,
29898,
29945,
29892,
26688,
29922,
9302,
29889,
8896,
876,
13,
4706,
1399,
353,
330,
3746,
2378,
29889,
517,
29918,
29887,
3746,
29898,
9302,
29889,
2378,
4197,
29900,
29892,
29871,
29906,
29892,
29871,
29946,
12622,
13,
4706,
4765,
29918,
29887,
3746,
353,
330,
3746,
2378,
29889,
517,
29918,
29887,
3746,
29898,
9302,
29889,
2378,
4197,
29896,
29892,
29871,
29896,
29892,
29871,
29896,
1402,
26688,
29922,
9302,
29889,
8896,
876,
13,
4706,
3984,
29883,
29889,
842,
29918,
1609,
29918,
2248,
29898,
7854,
29918,
29887,
3746,
29892,
1399,
29892,
4765,
29918,
29887,
3746,
29892,
525,
7854,
1495,
13,
4706,
4974,
7442,
29889,
497,
5358,
29898,
7854,
29918,
29887,
3746,
29889,
657,
3285,
13,
462,
965,
7442,
29889,
2378,
4197,
29896,
29892,
29871,
29896,
29892,
29871,
29896,
29892,
29871,
29941,
29892,
29871,
29896,
1402,
26688,
29922,
9302,
29889,
8896,
876,
13,
13,
4706,
2731,
29918,
29887,
3746,
353,
330,
3746,
2378,
29889,
517,
29918,
29887,
3746,
29898,
9302,
29889,
279,
927,
29898,
29945,
29892,
26688,
29922,
9302,
29889,
8896,
876,
13,
4706,
1399,
353,
330,
3746,
2378,
29889,
517,
29918,
29887,
3746,
29898,
9302,
29889,
2378,
4197,
1402,
7442,
29889,
524,
29953,
29946,
876,
13,
4706,
4765,
29918,
29887,
3746,
353,
330,
3746,
2378,
29889,
517,
29918,
29887,
3746,
29898,
9302,
29889,
2378,
4197,
29896,
29892,
29871,
29896,
29892,
29871,
29896,
1402,
26688,
29922,
9302,
29889,
8896,
876,
13,
4706,
3984,
29883,
29889,
842,
29918,
1609,
29918,
2248,
29898,
7854,
29918,
29887,
3746,
29892,
1399,
29892,
4765,
29918,
29887,
3746,
29892,
525,
7854,
1495,
13,
4706,
4974,
7442,
29889,
497,
5358,
29898,
7854,
29918,
29887,
3746,
29889,
657,
3285,
13,
462,
965,
7442,
29889,
279,
927,
29898,
29945,
29892,
26688,
29922,
9302,
29889,
8896,
876,
13,
13,
1678,
822,
1243,
29918,
842,
29918,
1609,
29918,
2248,
29918,
4351,
29918,
7411,
29941,
29906,
29898,
1311,
1125,
13,
4706,
2731,
29918,
29887,
3746,
353,
330,
3746,
2378,
29889,
517,
29918,
29887,
3746,
29898,
9302,
29889,
3298,
359,
29898,
29941,
29892,
26688,
29922,
9302,
29889,
7411,
29941,
29906,
876,
13,
4706,
1399,
353,
330,
3746,
2378,
29889,
517,
29918,
29887,
3746,
29898,
9302,
29889,
2378,
4197,
29900,
29892,
29871,
29906,
29892,
29871,
29946,
12622,
13,
4706,
4765,
29918,
29887,
3746,
353,
330,
3746,
2378,
29889,
517,
29918,
29887,
3746,
29898,
9302,
29889,
279,
927,
29898,
29945,
29892,
26688,
29922,
9302,
29889,
7411,
29941,
29906,
876,
13,
4706,
3984,
29883,
29889,
842,
29918,
1609,
29918,
2248,
29898,
7854,
29918,
29887,
3746,
29892,
1399,
29892,
4765,
29918,
29887,
3746,
29892,
525,
4351,
1495,
13,
4706,
4974,
7442,
29889,
497,
5358,
29898,
7854,
29918,
29887,
3746,
29889,
657,
3285,
13,
462,
965,
7442,
29889,
2378,
4197,
29900,
29892,
29871,
29906,
29892,
29871,
29946,
1402,
26688,
29922,
9302,
29889,
7411,
29941,
29906,
876,
13,
13,
4706,
2731,
29918,
29887,
3746,
353,
330,
3746,
2378,
29889,
517,
29918,
29887,
3746,
29898,
9302,
29889,
279,
927,
29898,
29945,
29892,
26688,
29922,
9302,
29889,
7411,
29941,
29906,
876,
13,
4706,
1399,
353,
330,
3746,
2378,
29889,
517,
29918,
29887,
3746,
29898,
9302,
29889,
2378,
4197,
1402,
7442,
29889,
524,
29953,
29946,
876,
13,
4706,
4765,
29918,
29887,
3746,
353,
330,
3746,
2378,
29889,
517,
29918,
29887,
3746,
29898,
9302,
29889,
2378,
4197,
29896,
29892,
29871,
29896,
29892,
29871,
29896,
1402,
26688,
29922,
9302,
29889,
7411,
29941,
29906,
876,
13,
4706,
3984,
29883,
29889,
842,
29918,
1609,
29918,
2248,
29898,
7854,
29918,
29887,
3746,
29892,
1399,
29892,
4765,
29918,
29887,
3746,
29892,
525,
4351,
1495,
13,
4706,
4974,
7442,
29889,
497,
5358,
29898,
7854,
29918,
29887,
3746,
29889,
657,
3285,
13,
462,
965,
7442,
29889,
279,
927,
29898,
29945,
29892,
26688,
29922,
9302,
29889,
7411,
29941,
29906,
876,
13,
13,
1678,
822,
1243,
29918,
842,
29918,
1609,
29918,
2248,
29918,
4351,
29918,
7411,
29953,
29946,
29898,
1311,
1125,
13,
4706,
2731,
29918,
29887,
3746,
353,
330,
3746,
2378,
29889,
517,
29918,
29887,
3746,
29898,
9302,
29889,
3298,
359,
29898,
29941,
29892,
26688,
29922,
9302,
29889,
8896,
876,
13,
4706,
1399,
353,
330,
3746,
2378,
29889,
517,
29918,
29887,
3746,
29898,
9302,
29889,
2378,
4197,
29900,
29892,
29871,
29906,
29892,
29871,
29946,
12622,
13,
4706,
4765,
29918,
29887,
3746,
353,
330,
3746,
2378,
29889,
517,
29918,
29887,
3746,
29898,
9302,
29889,
279,
927,
29898,
29945,
29892,
26688,
29922,
9302,
29889,
8896,
876,
13,
4706,
3984,
29883,
29889,
842,
29918,
1609,
29918,
2248,
29898,
7854,
29918,
29887,
3746,
29892,
1399,
29892,
4765,
29918,
29887,
3746,
29892,
525,
4351,
1495,
13,
4706,
4974,
7442,
29889,
497,
5358,
29898,
7854,
29918,
29887,
3746,
29889,
657,
3285,
13,
462,
965,
7442,
29889,
2378,
4197,
29900,
29892,
29871,
29906,
29892,
29871,
29946,
1402,
26688,
29922,
9302,
29889,
8896,
876,
13,
13,
4706,
2731,
29918,
29887,
3746,
353,
330,
3746,
2378,
29889,
517,
29918,
29887,
3746,
29898,
9302,
29889,
279,
927,
29898,
29945,
29892,
26688,
29922,
9302,
29889,
8896,
876,
13,
4706,
1399,
353,
330,
3746,
2378,
29889,
517,
29918,
29887,
3746,
29898,
9302,
29889,
2378,
4197,
1402,
7442,
29889,
524,
29953,
29946,
876,
13,
4706,
4765,
29918,
29887,
3746,
353,
330,
3746,
2378,
29889,
517,
29918,
29887,
3746,
29898,
9302,
29889,
2378,
4197,
29896,
29892,
29871,
29896,
29892,
29871,
29896,
1402,
26688,
29922,
9302,
29889,
8896,
876,
13,
4706,
3984,
29883,
29889,
842,
29918,
1609,
29918,
2248,
29898,
7854,
29918,
29887,
3746,
29892,
1399,
29892,
4765,
29918,
29887,
3746,
29892,
525,
4351,
1495,
13,
4706,
4974,
7442,
29889,
497,
5358,
29898,
7854,
29918,
29887,
3746,
29889,
657,
3285,
13,
462,
965,
7442,
29889,
279,
927,
29898,
29945,
29892,
26688,
29922,
9302,
29889,
8896,
876,
13,
13,
1678,
822,
13374,
29918,
1688,
29918,
19541,
459,
29918,
2922,
2003,
29898,
1311,
29892,
26688,
1125,
13,
4706,
921,
353,
7442,
29889,
8172,
29889,
8945,
29898,
7052,
29922,
29945,
29889,
29900,
29892,
2159,
7607,
29941,
29892,
29871,
29945,
8106,
579,
668,
29898,
29881,
1853,
29897,
13,
4706,
263,
353,
7442,
29889,
8172,
29889,
8945,
29898,
7052,
29922,
29945,
29889,
29900,
29892,
2159,
7607,
29896,
29892,
29871,
29945,
8106,
579,
668,
29898,
29881,
1853,
29897,
13,
4706,
289,
353,
7442,
29889,
8172,
29889,
8945,
29898,
7052,
29922,
29945,
29889,
29900,
29892,
2159,
7607,
29941,
29892,
29871,
29896,
8106,
579,
668,
29898,
29881,
1853,
29897,
13,
13,
4706,
396,
278,
1494,
1023,
1243,
1959,
12672,
292,
373,
29871,
29900,
29928,
12047,
13,
4706,
274,
353,
7442,
29889,
8172,
29889,
8945,
29898,
7052,
29922,
29945,
29889,
29900,
29892,
2159,
7607,
29945,
29892,
1723,
467,
579,
668,
29898,
29881,
1853,
29897,
13,
4706,
270,
353,
7442,
29889,
8172,
29889,
8945,
29898,
7052,
29922,
29945,
29889,
29900,
29892,
2159,
7607,
29941,
29892,
1723,
467,
579,
668,
29898,
29881,
1853,
29897,
13,
4706,
921,
29918,
29887,
3746,
353,
330,
3746,
2378,
29889,
517,
29918,
29887,
3746,
29898,
29916,
29897,
13,
4706,
263,
29918,
29887,
3746,
353,
330,
3746,
2378,
29889,
517,
29918,
29887,
3746,
29898,
29874,
29897,
13,
4706,
289,
29918,
29887,
3746,
353,
330,
3746,
2378,
29889,
517,
29918,
29887,
3746,
29898,
29890,
29897,
13,
4706,
274,
29918,
29887,
3746,
353,
330,
3746,
2378,
29889,
517,
29918,
29887,
3746,
29898,
29883,
29897,
13,
4706,
270,
29918,
29887,
3746,
353,
330,
3746,
2378,
29889,
517,
29918,
29887,
3746,
29898,
29881,
29897,
13,
4706,
714,
353,
330,
3746,
2378,
29889,
6310,
29898,
29916,
29889,
12181,
29892,
26688,
29922,
29881,
1853,
29897,
13,
4706,
396,
6124,
13,
4706,
620,
353,
3984,
29883,
29889,
1202,
29918,
2922,
2003,
29898,
29916,
29918,
29887,
3746,
29892,
263,
29918,
29887,
3746,
29892,
714,
29922,
449,
467,
657,
580,
13,
4706,
4974,
7442,
29889,
497,
5358,
29898,
690,
29892,
921,
29974,
29874,
29897,
13,
4706,
4974,
7442,
29889,
497,
5358,
29898,
29885,
10669,
29889,
1202,
29918,
2922,
2003,
29898,
29916,
29918,
29887,
3746,
29892,
289,
29918,
29887,
3746,
467,
657,
3285,
921,
29974,
29890,
29897,
13,
4706,
4974,
7442,
29889,
497,
5358,
29898,
29885,
10669,
29889,
1202,
29918,
2922,
2003,
29898,
29916,
29918,
29887,
3746,
29892,
274,
29918,
29887,
3746,
467,
657,
3285,
921,
29974,
29883,
29897,
13,
4706,
4974,
29918,
336,
4637,
29898,
1917,
2392,
29892,
3984,
29883,
29889,
1202,
29918,
2922,
2003,
29892,
921,
29918,
29887,
3746,
29892,
270,
29918,
29887,
3746,
29897,
13,
4706,
396,
21666,
13,
4706,
620,
353,
3984,
29883,
29889,
4713,
29918,
2922,
2003,
29898,
29916,
29918,
29887,
3746,
29892,
263,
29918,
29887,
3746,
29892,
714,
29922,
449,
467,
657,
580,
13,
4706,
4974,
7442,
29889,
497,
5358,
29898,
690,
29892,
921,
29930,
29874,
29897,
13,
4706,
4974,
7442,
29889,
497,
5358,
29898,
29885,
10669,
29889,
4713,
29918,
2922,
2003,
29898,
29916,
29918,
29887,
3746,
29892,
289,
29918,
29887,
3746,
467,
657,
3285,
921,
29930,
29890,
29897,
13,
4706,
4974,
7442,
29889,
497,
5358,
29898,
29885,
10669,
29889,
4713,
29918,
2922,
2003,
29898,
29916,
29918,
29887,
3746,
29892,
274,
29918,
29887,
3746,
467,
657,
3285,
921,
29930,
29883,
29897,
13,
4706,
4974,
29918,
336,
4637,
29898,
1917,
2392,
29892,
3984,
29883,
29889,
4713,
29918,
2922,
2003,
29892,
921,
29918,
29887,
3746,
29892,
270,
29918,
29887,
3746,
29897,
13,
4706,
396,
8542,
13,
4706,
620,
353,
3984,
29883,
29889,
4563,
29918,
2922,
2003,
29898,
29916,
29918,
29887,
3746,
29892,
263,
29918,
29887,
3746,
29892,
714,
29922,
449,
467,
657,
580,
13,
4706,
4974,
7442,
29889,
497,
5358,
29898,
690,
29892,
921,
29914,
29874,
29897,
13,
4706,
4974,
7442,
29889,
497,
5358,
29898,
29885,
10669,
29889,
4563,
29918,
2922,
2003,
29898,
29916,
29918,
29887,
3746,
29892,
289,
29918,
29887,
3746,
467,
657,
3285,
921,
29914,
29890,
29897,
13,
4706,
4974,
7442,
29889,
497,
5358,
29898,
29885,
10669,
29889,
4563,
29918,
2922,
2003,
29898,
29916,
29918,
29887,
3746,
29892,
274,
29918,
29887,
3746,
467,
657,
3285,
921,
29914,
29883,
29897,
13,
4706,
4974,
29918,
336,
4637,
29898,
1917,
2392,
29892,
3984,
29883,
29889,
4563,
29918,
2922,
2003,
29892,
921,
29918,
29887,
3746,
29892,
270,
29918,
29887,
3746,
29897,
13,
13,
13,
1678,
822,
1243,
29918,
19541,
459,
29918,
2922,
2003,
29918,
7411,
29941,
29906,
29898,
1311,
1125,
13,
4706,
1583,
29889,
13699,
29918,
1688,
29918,
19541,
459,
29918,
2922,
2003,
29898,
9302,
29889,
7411,
29941,
29906,
29897,
13,
13,
1678,
822,
1243,
29918,
19541,
459,
29918,
2922,
2003,
29918,
7411,
29953,
29946,
29898,
1311,
1125,
13,
4706,
1583,
29889,
13699,
29918,
1688,
29918,
19541,
459,
29918,
2922,
2003,
29898,
9302,
29889,
7411,
29953,
29946,
29897,
13,
13,
1678,
822,
1243,
29918,
19541,
459,
29918,
2922,
2003,
29918,
19676,
29953,
29946,
29898,
1311,
1125,
13,
4706,
1583,
29889,
13699,
29918,
1688,
29918,
19541,
459,
29918,
2922,
2003,
29898,
9302,
29889,
19676,
29953,
29946,
29897,
13,
13,
1678,
822,
1243,
29918,
19541,
459,
29918,
2922,
2003,
29918,
19676,
29896,
29906,
29947,
29898,
1311,
1125,
13,
4706,
1583,
29889,
13699,
29918,
1688,
29918,
19541,
459,
29918,
2922,
2003,
29898,
9302,
29889,
19676,
29896,
29906,
29947,
29897,
13,
13,
1678,
822,
13374,
29918,
1688,
29918,
2083,
29898,
1311,
29892,
26688,
1125,
13,
4706,
921,
353,
7442,
29889,
8172,
29889,
8945,
29898,
7052,
29922,
29945,
29889,
29900,
29892,
2159,
7607,
29941,
29892,
29871,
29945,
876,
13,
4706,
921,
353,
921,
29889,
579,
668,
29898,
29881,
1853,
29922,
29881,
1853,
29892,
1797,
2433,
29907,
1495,
13,
4706,
921,
29918,
29887,
3746,
353,
330,
3746,
2378,
29889,
517,
29918,
29887,
3746,
29898,
29916,
29897,
13,
4706,
4974,
7442,
29889,
497,
5358,
29898,
29885,
10669,
29889,
2083,
29898,
29916,
29918,
29887,
3746,
467,
657,
3285,
921,
29889,
2083,
3101,
13,
4706,
4974,
7442,
29889,
497,
5358,
29898,
29885,
10669,
29889,
2083,
29898,
29916,
29918,
29887,
3746,
29892,
9685,
29922,
29900,
467,
657,
3285,
921,
29889,
2083,
29898,
8990,
29922,
29900,
876,
13,
4706,
4974,
7442,
29889,
497,
5358,
29898,
29885,
10669,
29889,
2083,
29898,
29916,
29918,
29887,
3746,
29892,
9685,
29922,
29896,
467,
657,
3285,
921,
29889,
2083,
29898,
8990,
29922,
29896,
876,
13,
4706,
921,
353,
921,
29889,
579,
668,
29898,
29881,
1853,
29922,
29881,
1853,
29892,
1797,
2433,
29943,
1495,
13,
4706,
921,
29918,
29887,
3746,
353,
330,
3746,
2378,
29889,
517,
29918,
29887,
3746,
29898,
29916,
29897,
13,
4706,
4974,
7442,
29889,
497,
5358,
29898,
29885,
10669,
29889,
2083,
29898,
29916,
29918,
29887,
3746,
467,
657,
3285,
921,
29889,
2083,
3101,
13,
4706,
4974,
7442,
29889,
497,
5358,
29898,
29885,
10669,
29889,
2083,
29898,
29916,
29918,
29887,
3746,
29892,
9685,
29922,
29900,
467,
657,
3285,
921,
29889,
2083,
29898,
8990,
29922,
29900,
876,
13,
4706,
4974,
7442,
29889,
497,
5358,
29898,
29885,
10669,
29889,
2083,
29898,
29916,
29918,
29887,
3746,
29892,
9685,
29922,
29896,
467,
657,
3285,
921,
29889,
2083,
29898,
8990,
29922,
29896,
876,
13,
13,
1678,
822,
1243,
29918,
2083,
29918,
7411,
29941,
29906,
29898,
1311,
1125,
13,
4706,
1583,
29889,
13699,
29918,
1688,
29918,
2083,
29898,
9302,
29889,
7411,
29941,
29906,
29897,
13,
13,
1678,
822,
1243,
29918,
2083,
29918,
7411,
29953,
29946,
29898,
1311,
1125,
13,
4706,
1583,
29889,
13699,
29918,
1688,
29918,
2083,
29898,
9302,
29889,
7411,
29953,
29946,
29897,
13,
13,
1678,
822,
1243,
29918,
2083,
29918,
19676,
29953,
29946,
29898,
1311,
1125,
13,
4706,
1583,
29889,
13699,
29918,
1688,
29918,
2083,
29898,
9302,
29889,
19676,
29953,
29946,
29897,
13,
13,
1678,
822,
1243,
29918,
2083,
29918,
19676,
29896,
29906,
29947,
29898,
1311,
1125,
13,
4706,
1583,
29889,
13699,
29918,
1688,
29918,
2083,
29898,
9302,
29889,
19676,
29896,
29906,
29947,
29897,
13,
13,
1678,
822,
13374,
29918,
1688,
29918,
12676,
29898,
1311,
29892,
26688,
1125,
13,
4706,
921,
353,
7442,
29889,
8172,
29889,
8945,
29898,
7052,
29922,
29945,
29889,
29900,
29892,
2159,
7607,
29941,
29892,
29871,
29945,
876,
13,
4706,
921,
353,
921,
29889,
579,
668,
29898,
29881,
1853,
29922,
29881,
1853,
29892,
1797,
2433,
29907,
1495,
13,
4706,
921,
29918,
29887,
3746,
353,
330,
3746,
2378,
29889,
517,
29918,
29887,
3746,
29898,
29916,
29897,
13,
4706,
4974,
7442,
29889,
497,
5358,
29898,
29885,
10669,
29889,
12676,
29898,
29916,
29918,
29887,
3746,
467,
657,
3285,
921,
29889,
12676,
3101,
13,
4706,
4974,
7442,
29889,
497,
5358,
29898,
29885,
10669,
29889,
12676,
29898,
29916,
29918,
29887,
3746,
29892,
9685,
29922,
29900,
467,
657,
3285,
921,
29889,
12676,
29898,
8990,
29922,
29900,
876,
13,
4706,
4974,
7442,
29889,
497,
5358,
29898,
29885,
10669,
29889,
12676,
29898,
29916,
29918,
29887,
3746,
29892,
9685,
29922,
29896,
467,
657,
3285,
921,
29889,
12676,
29898,
8990,
29922,
29896,
876,
13,
4706,
921,
353,
921,
29889,
579,
668,
29898,
29881,
1853,
29922,
29881,
1853,
29892,
1797,
2433,
29943,
1495,
13,
4706,
921,
29918,
29887,
3746,
353,
330,
3746,
2378,
29889,
517,
29918,
29887,
3746,
29898,
29916,
29897,
13,
4706,
4974,
7442,
29889,
497,
5358,
29898,
29885,
10669,
29889,
12676,
29898,
29916,
29918,
29887,
3746,
467,
657,
3285,
921,
29889,
12676,
3101,
13,
4706,
4974,
7442,
29889,
497,
5358,
29898,
29885,
10669,
29889,
12676,
29898,
29916,
29918,
29887,
3746,
29892,
9685,
10457,
29896,
467,
657,
3285,
921,
29889,
12676,
29898,
8990,
10457,
29896,
876,
13,
4706,
4974,
7442,
29889,
497,
5358,
29898,
29885,
10669,
29889,
12676,
29898,
29916,
29918,
29887,
3746,
29892,
9685,
10457,
29906,
467,
657,
3285,
921,
29889,
12676,
29898,
8990,
10457,
29906,
876,
13,
13,
1678,
822,
1243,
29918,
12676,
29918,
7411,
29941,
29906,
29898,
1311,
1125,
13,
4706,
1583,
29889,
13699,
29918,
1688,
29918,
12676,
29898,
9302,
29889,
7411,
29941,
29906,
29897,
13,
13,
1678,
822,
1243,
29918,
12676,
29918,
7411,
29953,
29946,
29898,
1311,
1125,
13,
4706,
1583,
29889,
13699,
29918,
1688,
29918,
12676,
29898,
9302,
29889,
7411,
29953,
29946,
29897,
13,
13,
1678,
822,
1243,
29918,
12676,
29918,
19676,
29953,
29946,
29898,
1311,
1125,
13,
4706,
1583,
29889,
13699,
29918,
1688,
29918,
12676,
29898,
9302,
29889,
19676,
29953,
29946,
29897,
13,
13,
1678,
822,
1243,
29918,
12676,
29918,
19676,
29896,
29906,
29947,
29898,
1311,
1125,
13,
4706,
1583,
29889,
13699,
29918,
1688,
29918,
12676,
29898,
9302,
29889,
19676,
29896,
29906,
29947,
29897,
13,
13,
1678,
822,
13374,
29918,
1688,
29918,
1707,
29898,
1311,
29892,
26688,
1125,
13,
4706,
921,
353,
7442,
29889,
8172,
29889,
8945,
29898,
7052,
29922,
29945,
29889,
29900,
29892,
2159,
7607,
29941,
29892,
29871,
29945,
876,
13,
4706,
921,
353,
921,
29889,
579,
668,
29898,
29881,
1853,
29922,
29881,
1853,
29892,
1797,
2433,
29907,
1495,
13,
4706,
921,
29918,
29887,
3746,
353,
330,
3746,
2378,
29889,
517,
29918,
29887,
3746,
29898,
29916,
29897,
13,
4706,
4974,
7442,
29889,
497,
5358,
29898,
29885,
10669,
29889,
1707,
29898,
29916,
29918,
29887,
3746,
467,
657,
3285,
921,
29889,
1707,
3101,
13,
4706,
4974,
7442,
29889,
497,
5358,
29898,
29885,
10669,
29889,
1707,
29898,
29916,
29918,
29887,
3746,
29892,
9685,
29922,
29900,
467,
657,
3285,
921,
29889,
1707,
29898,
8990,
29922,
29900,
876,
13,
4706,
4974,
7442,
29889,
497,
5358,
29898,
29885,
10669,
29889,
1707,
29898,
29916,
29918,
29887,
3746,
29892,
9685,
29922,
29896,
467,
657,
3285,
921,
29889,
1707,
29898,
8990,
29922,
29896,
876,
13,
4706,
396,
15447,
451,
1985,
2861,
304,
263,
6494,
297,
10772,
29907,
29965,
7698,
29892,
1074,
26246,
396,
29929,
29906,
13,
4706,
396,
29916,
353,
921,
29889,
579,
668,
29898,
29881,
1853,
29922,
29881,
1853,
29892,
1797,
2433,
29943,
1495,
13,
4706,
396,
29916,
29918,
29887,
3746,
353,
330,
3746,
2378,
29889,
517,
29918,
29887,
3746,
29898,
29916,
29897,
13,
4706,
396,
9294,
7442,
29889,
497,
5358,
29898,
29885,
10669,
29889,
1707,
29898,
29916,
29918,
29887,
3746,
467,
657,
3285,
921,
29889,
1707,
3101,
13,
4706,
396,
9294,
7442,
29889,
497,
5358,
29898,
29885,
10669,
29889,
1707,
29898,
29916,
29918,
29887,
3746,
29892,
9685,
10457,
29896,
467,
657,
3285,
921,
29889,
1707,
29898,
8990,
10457,
29896,
876,
13,
4706,
396,
9294,
7442,
29889,
497,
5358,
29898,
29885,
10669,
29889,
1707,
29898,
29916,
29918,
29887,
3746,
29892,
9685,
10457,
29906,
467,
657,
3285,
921,
29889,
1707,
29898,
8990,
10457,
29906,
876,
13,
13,
1678,
822,
1243,
29918,
1707,
29918,
7411,
29941,
29906,
29898,
1311,
1125,
13,
4706,
1583,
29889,
13699,
29918,
1688,
29918,
1707,
29898,
9302,
29889,
7411,
29941,
29906,
29897,
13,
13,
1678,
822,
1243,
29918,
1707,
29918,
7411,
29953,
29946,
29898,
1311,
1125,
13,
4706,
1583,
29889,
13699,
29918,
1688,
29918,
1707,
29898,
9302,
29889,
7411,
29953,
29946,
29897,
13,
13,
1678,
822,
1243,
29918,
1707,
29918,
19676,
29953,
29946,
29898,
1311,
1125,
13,
4706,
1583,
29889,
13699,
29918,
1688,
29918,
1707,
29898,
9302,
29889,
19676,
29953,
29946,
29897,
13,
13,
1678,
822,
1243,
29918,
1707,
29918,
19676,
29896,
29906,
29947,
29898,
1311,
1125,
13,
4706,
1583,
29889,
13699,
29918,
1688,
29918,
1707,
29898,
9302,
29889,
19676,
29896,
29906,
29947,
29897,
13,
13,
1678,
822,
13374,
29918,
1688,
29918,
4172,
29898,
1311,
29892,
26688,
1125,
13,
4706,
921,
353,
7442,
29889,
8172,
29889,
8945,
29898,
7052,
29922,
29945,
29889,
29900,
29892,
2159,
7607,
29941,
29892,
29871,
29945,
876,
13,
4706,
921,
353,
921,
29889,
579,
668,
29898,
29881,
1853,
29922,
29881,
1853,
29892,
1797,
2433,
29907,
1495,
13,
4706,
921,
29918,
29887,
3746,
353,
330,
3746,
2378,
29889,
517,
29918,
29887,
3746,
29898,
29916,
29897,
13,
4706,
4974,
7442,
29889,
497,
5358,
29898,
29885,
10669,
29889,
4172,
29898,
29916,
29918,
29887,
3746,
467,
657,
3285,
921,
29889,
4172,
3101,
13,
4706,
4974,
7442,
29889,
497,
5358,
29898,
29885,
10669,
29889,
4172,
29898,
29916,
29918,
29887,
3746,
29892,
9685,
29922,
29900,
467,
657,
3285,
921,
29889,
4172,
29898,
8990,
29922,
29900,
876,
13,
4706,
4974,
7442,
29889,
497,
5358,
29898,
29885,
10669,
29889,
4172,
29898,
29916,
29918,
29887,
3746,
29892,
9685,
29922,
29896,
467,
657,
3285,
921,
29889,
4172,
29898,
8990,
29922,
29896,
876,
13,
4706,
396,
15447,
451,
1985,
2861,
304,
263,
6494,
297,
10772,
29907,
29965,
7698,
29892,
1074,
26246,
396,
29929,
29906,
13,
4706,
396,
29916,
353,
921,
29889,
579,
668,
29898,
29881,
1853,
29922,
29881,
1853,
29892,
1797,
2433,
29943,
1495,
13,
4706,
396,
29916,
29918,
29887,
3746,
353,
330,
3746,
2378,
29889,
517,
29918,
29887,
3746,
29898,
29916,
29897,
13,
4706,
396,
9294,
7442,
29889,
497,
5358,
29898,
29885,
10669,
29889,
4172,
29898,
29916,
29918,
29887,
3746,
467,
657,
3285,
921,
29889,
4172,
3101,
13,
4706,
396,
9294,
7442,
29889,
497,
5358,
29898,
29885,
10669,
29889,
4172,
29898,
29916,
29918,
29887,
3746,
29892,
9685,
10457,
29896,
467,
657,
3285,
921,
29889,
4172,
29898,
8990,
10457,
29896,
876,
13,
4706,
396,
9294,
7442,
29889,
497,
5358,
29898,
29885,
10669,
29889,
4172,
29898,
29916,
29918,
29887,
3746,
29892,
9685,
10457,
29906,
467,
657,
3285,
921,
29889,
4172,
29898,
8990,
10457,
29906,
876,
13,
13,
1678,
822,
1243,
29918,
4172,
29918,
7411,
29941,
29906,
29898,
1311,
1125,
13,
4706,
1583,
29889,
13699,
29918,
1688,
29918,
4172,
29898,
9302,
29889,
7411,
29941,
29906,
29897,
13,
13,
1678,
822,
1243,
29918,
4172,
29918,
7411,
29953,
29946,
29898,
1311,
1125,
13,
4706,
1583,
29889,
13699,
29918,
1688,
29918,
4172,
29898,
9302,
29889,
7411,
29953,
29946,
29897,
13,
13,
1678,
822,
1243,
29918,
4172,
29918,
19676,
29953,
29946,
29898,
1311,
1125,
13,
4706,
1583,
29889,
13699,
29918,
1688,
29918,
4172,
29898,
9302,
29889,
19676,
29953,
29946,
29897,
13,
13,
1678,
822,
1243,
29918,
4172,
29918,
19676,
29896,
29906,
29947,
29898,
1311,
1125,
13,
4706,
1583,
29889,
13699,
29918,
1688,
29918,
4172,
29898,
9302,
29889,
19676,
29896,
29906,
29947,
29897,
13,
13,
1678,
822,
903,
13699,
29918,
1688,
29918,
1195,
3317,
29898,
1311,
29892,
26688,
1125,
13,
4706,
921,
353,
7442,
29889,
8172,
29889,
8945,
29898,
7052,
29922,
29945,
29889,
29900,
29892,
2159,
7607,
29941,
29892,
29871,
29945,
876,
13,
4706,
921,
353,
921,
29889,
579,
668,
29898,
29881,
1853,
29922,
29881,
1853,
29892,
1797,
2433,
29907,
1495,
13,
4706,
921,
29918,
29887,
3746,
353,
330,
3746,
2378,
29889,
517,
29918,
29887,
3746,
29898,
29916,
29897,
13,
4706,
4974,
7442,
29889,
497,
5358,
29898,
29885,
10669,
29889,
3317,
29898,
29916,
29918,
29887,
3746,
29892,
9685,
29922,
29900,
467,
657,
3285,
921,
29889,
3317,
29898,
8990,
29922,
29900,
876,
13,
4706,
4974,
7442,
29889,
497,
5358,
29898,
29885,
10669,
29889,
3317,
29898,
29916,
29918,
29887,
3746,
29892,
9685,
29922,
29896,
467,
657,
3285,
921,
29889,
3317,
29898,
8990,
29922,
29896,
876,
13,
4706,
4974,
7442,
29889,
497,
5358,
29898,
29885,
10669,
29889,
1195,
29898,
29916,
29918,
29887,
3746,
29892,
9685,
29922,
29900,
467,
657,
3285,
921,
29889,
1195,
29898,
8990,
29922,
29900,
876,
13,
4706,
4974,
7442,
29889,
497,
5358,
29898,
29885,
10669,
29889,
1195,
29898,
29916,
29918,
29887,
3746,
29892,
9685,
29922,
29896,
467,
657,
3285,
921,
29889,
1195,
29898,
8990,
29922,
29896,
876,
13,
13,
4706,
921,
353,
921,
29889,
579,
668,
29898,
29881,
1853,
29922,
29881,
1853,
29892,
1797,
2433,
29943,
1495,
13,
4706,
921,
29918,
29887,
3746,
353,
330,
3746,
2378,
29889,
517,
29918,
29887,
3746,
29898,
29916,
29897,
13,
4706,
4974,
7442,
29889,
497,
5358,
29898,
29885,
10669,
29889,
3317,
29898,
29916,
29918,
29887,
3746,
29892,
9685,
29922,
29900,
467,
657,
3285,
921,
29889,
3317,
29898,
8990,
29922,
29900,
876,
13,
4706,
4974,
7442,
29889,
497,
5358,
29898,
29885,
10669,
29889,
3317,
29898,
29916,
29918,
29887,
3746,
29892,
9685,
29922,
29896,
467,
657,
3285,
921,
29889,
3317,
29898,
8990,
29922,
29896,
876,
13,
4706,
4974,
7442,
29889,
497,
5358,
29898,
29885,
10669,
29889,
1195,
29898,
29916,
29918,
29887,
3746,
29892,
9685,
29922,
29900,
467,
657,
3285,
921,
29889,
1195,
29898,
8990,
29922,
29900,
876,
13,
4706,
4974,
7442,
29889,
497,
5358,
29898,
29885,
10669,
29889,
1195,
29898,
29916,
29918,
29887,
3746,
29892,
9685,
29922,
29896,
467,
657,
3285,
921,
29889,
1195,
29898,
8990,
29922,
29896,
876,
13,
13,
1678,
822,
1243,
29918,
1195,
3317,
29918,
7411,
29941,
29906,
29898,
1311,
1125,
13,
4706,
1583,
3032,
13699,
29918,
1688,
29918,
1195,
3317,
29898,
9302,
29889,
7411,
29941,
29906,
29897,
13,
13,
1678,
822,
1243,
29918,
1195,
3317,
29918,
7411,
29953,
29946,
29898,
1311,
1125,
13,
4706,
1583,
3032,
13699,
29918,
1688,
29918,
1195,
3317,
29898,
9302,
29889,
7411,
29953,
29946,
29897,
13,
13,
1678,
822,
903,
13699,
29918,
1688,
29918,
1191,
1195,
3317,
29898,
1311,
29892,
26688,
1125,
13,
4706,
921,
353,
7442,
29889,
8172,
29889,
8945,
29898,
7052,
29922,
29945,
29889,
29900,
29892,
2159,
7607,
29941,
29892,
29871,
29945,
876,
13,
4706,
921,
353,
921,
29889,
579,
668,
29898,
29881,
1853,
29922,
29881,
1853,
29892,
1797,
2433,
29907,
1495,
13,
4706,
921,
29918,
29887,
3746,
353,
330,
3746,
2378,
29889,
517,
29918,
29887,
3746,
29898,
29916,
29897,
13,
4706,
4974,
7442,
29889,
497,
5358,
29898,
29885,
10669,
29889,
1191,
3317,
29898,
29916,
29918,
29887,
3746,
29892,
9685,
29922,
29900,
467,
657,
3285,
921,
29889,
1191,
3317,
29898,
8990,
29922,
29900,
876,
13,
4706,
4974,
7442,
29889,
497,
5358,
29898,
29885,
10669,
29889,
1191,
3317,
29898,
29916,
29918,
29887,
3746,
29892,
9685,
29922,
29896,
467,
657,
3285,
921,
29889,
1191,
3317,
29898,
8990,
29922,
29896,
876,
13,
4706,
4974,
7442,
29889,
497,
5358,
29898,
29885,
10669,
29889,
1191,
1195,
29898,
29916,
29918,
29887,
3746,
29892,
9685,
29922,
29900,
467,
657,
3285,
921,
29889,
1191,
1195,
29898,
8990,
29922,
29900,
876,
13,
4706,
4974,
7442,
29889,
497,
5358,
29898,
29885,
10669,
29889,
1191,
1195,
29898,
29916,
29918,
29887,
3746,
29892,
9685,
29922,
29896,
467,
657,
3285,
921,
29889,
1191,
1195,
29898,
8990,
29922,
29896,
876,
13,
13,
4706,
921,
353,
921,
29889,
579,
668,
29898,
29881,
1853,
29922,
29881,
1853,
29892,
1797,
2433,
29943,
1495,
13,
4706,
921,
29918,
29887,
3746,
353,
330,
3746,
2378,
29889,
517,
29918,
29887,
3746,
29898,
29916,
29897,
13,
4706,
4974,
7442,
29889,
497,
5358,
29898,
29885,
10669,
29889,
1191,
3317,
29898,
29916,
29918,
29887,
3746,
29892,
9685,
29922,
29900,
467,
657,
3285,
921,
29889,
1191,
3317,
29898,
8990,
29922,
29900,
876,
13,
4706,
4974,
7442,
29889,
497,
5358,
29898,
29885,
10669,
29889,
1191,
3317,
29898,
29916,
29918,
29887,
3746,
29892,
9685,
29922,
29896,
467,
657,
3285,
921,
29889,
1191,
3317,
29898,
8990,
29922,
29896,
876,
13,
4706,
4974,
7442,
29889,
497,
5358,
29898,
29885,
10669,
29889,
1191,
1195,
29898,
29916,
29918,
29887,
3746,
29892,
9685,
29922,
29900,
467,
657,
3285,
921,
29889,
1191,
1195,
29898,
8990,
29922,
29900,
876,
13,
4706,
4974,
7442,
29889,
497,
5358,
29898,
29885,
10669,
29889,
1191,
1195,
29898,
29916,
29918,
29887,
3746,
29892,
9685,
29922,
29896,
467,
657,
3285,
921,
29889,
1191,
1195,
29898,
8990,
29922,
29896,
876,
13,
13,
1678,
822,
1243,
29918,
1191,
1195,
3317,
29918,
7411,
29941,
29906,
29898,
1311,
1125,
13,
4706,
1583,
3032,
13699,
29918,
1688,
29918,
1191,
1195,
3317,
29898,
9302,
29889,
7411,
29941,
29906,
29897,
13,
13,
1678,
822,
1243,
29918,
1191,
1195,
3317,
29918,
7411,
29953,
29946,
29898,
1311,
1125,
13,
4706,
1583,
3032,
13699,
29918,
1688,
29918,
1191,
1195,
3317,
29898,
9302,
29889,
7411,
29953,
29946,
29897,
13,
13,
1753,
9460,
7295,
13,
1678,
269,
353,
4321,
5091,
568,
580,
13,
1678,
269,
29889,
1202,
3057,
29898,
1688,
29918,
29885,
10669,
877,
1688,
29918,
3317,
6897,
29918,
7411,
29941,
29906,
8785,
13,
1678,
269,
29889,
1202,
3057,
29898,
1688,
29918,
29885,
10669,
877,
1688,
29918,
3317,
6897,
29918,
19676,
29953,
29946,
8785,
13,
1678,
269,
29889,
1202,
3057,
29898,
1688,
29918,
29885,
10669,
877,
1688,
29918,
29883,
398,
2083,
29918,
7411,
29941,
29906,
8785,
13,
1678,
269,
29889,
1202,
3057,
29898,
1688,
29918,
29885,
10669,
877,
1688,
29918,
29883,
398,
2083,
29918,
19676,
29953,
29946,
8785,
13,
1678,
269,
29889,
1202,
3057,
29898,
1688,
29918,
29885,
10669,
877,
1688,
29918,
12765,
29918,
7411,
29941,
29906,
8785,
13,
1678,
269,
29889,
1202,
3057,
29898,
1688,
29918,
29885,
10669,
877,
1688,
29918,
12765,
29918,
19676,
29953,
29946,
8785,
13,
1678,
269,
29889,
1202,
3057,
29898,
1688,
29918,
29885,
10669,
877,
1688,
29918,
657,
29918,
1609,
29918,
2248,
29918,
7411,
29941,
29906,
8785,
13,
1678,
269,
29889,
1202,
3057,
29898,
1688,
29918,
29885,
10669,
877,
1688,
29918,
842,
29918,
1609,
29918,
2248,
29918,
7854,
29918,
7411,
29941,
29906,
8785,
13,
1678,
269,
29889,
1202,
3057,
29898,
1688,
29918,
29885,
10669,
877,
1688,
29918,
842,
29918,
1609,
29918,
2248,
29918,
4351,
29918,
7411,
29941,
29906,
8785,
13,
1678,
269,
29889,
1202,
3057,
29898,
1688,
29918,
29885,
10669,
877,
1688,
29918,
19541,
459,
29918,
2922,
2003,
29918,
7411,
29941,
29906,
8785,
13,
1678,
269,
29889,
1202,
3057,
29898,
1688,
29918,
29885,
10669,
877,
1688,
29918,
19541,
459,
29918,
2922,
2003,
29918,
19676,
29953,
29946,
8785,
13,
1678,
269,
29889,
1202,
3057,
29898,
1688,
29918,
29885,
10669,
877,
1688,
29918,
2083,
29918,
7411,
29941,
29906,
8785,
13,
1678,
269,
29889,
1202,
3057,
29898,
1688,
29918,
29885,
10669,
877,
1688,
29918,
2083,
29918,
19676,
29953,
29946,
8785,
13,
1678,
269,
29889,
1202,
3057,
29898,
1688,
29918,
29885,
10669,
877,
1688,
29918,
12676,
29918,
7411,
29941,
29906,
8785,
13,
1678,
269,
29889,
1202,
3057,
29898,
1688,
29918,
29885,
10669,
877,
1688,
29918,
12676,
29918,
19676,
29953,
29946,
8785,
13,
1678,
269,
29889,
1202,
3057,
29898,
1688,
29918,
29885,
10669,
877,
1688,
29918,
1707,
29918,
7411,
29941,
29906,
8785,
13,
1678,
269,
29889,
1202,
3057,
29898,
1688,
29918,
29885,
10669,
877,
1688,
29918,
1707,
29918,
19676,
29953,
29946,
8785,
13,
1678,
269,
29889,
1202,
3057,
29898,
1688,
29918,
29885,
10669,
877,
1688,
29918,
4172,
29918,
7411,
29941,
29906,
8785,
13,
1678,
269,
29889,
1202,
3057,
29898,
1688,
29918,
29885,
10669,
877,
1688,
29918,
4172,
29918,
19676,
29953,
29946,
8785,
13,
1678,
269,
29889,
1202,
3057,
29898,
1688,
29918,
29885,
10669,
877,
1688,
29918,
1195,
3317,
29918,
7411,
29941,
29906,
8785,
13,
1678,
269,
29889,
1202,
3057,
29898,
1688,
29918,
29885,
10669,
877,
1688,
29918,
1191,
1195,
3317,
29918,
7411,
29941,
29906,
8785,
13,
1678,
565,
3984,
29883,
29889,
657,
29918,
26017,
29918,
5030,
3097,
29898,
2272,
29883,
6191,
29889,
6921,
2344,
29889,
10141,
29897,
6736,
29871,
29896,
29889,
29941,
29901,
13,
4706,
269,
29889,
1202,
3057,
29898,
1688,
29918,
29885,
10669,
877,
1688,
29918,
3317,
6897,
29918,
7411,
29953,
29946,
8785,
13,
4706,
269,
29889,
1202,
3057,
29898,
1688,
29918,
29885,
10669,
877,
1688,
29918,
3317,
6897,
29918,
19676,
29896,
29906,
29947,
8785,
13,
4706,
269,
29889,
1202,
3057,
29898,
1688,
29918,
29885,
10669,
877,
1688,
29918,
29883,
398,
2083,
29918,
7411,
29953,
29946,
8785,
13,
4706,
269,
29889,
1202,
3057,
29898,
1688,
29918,
29885,
10669,
877,
1688,
29918,
29883,
398,
2083,
29918,
19676,
29896,
29906,
29947,
8785,
13,
4706,
269,
29889,
1202,
3057,
29898,
1688,
29918,
29885,
10669,
877,
1688,
29918,
12765,
29918,
7411,
29953,
29946,
8785,
13,
4706,
269,
29889,
1202,
3057,
29898,
1688,
29918,
29885,
10669,
877,
1688,
29918,
12765,
29918,
19676,
29896,
29906,
29947,
8785,
13,
4706,
269,
29889,
1202,
3057,
29898,
1688,
29918,
29885,
10669,
877,
1688,
29918,
657,
29918,
1609,
29918,
2248,
29918,
7411,
29941,
29906,
8785,
13,
4706,
269,
29889,
1202,
3057,
29898,
1688,
29918,
29885,
10669,
877,
1688,
29918,
842,
29918,
1609,
29918,
2248,
29918,
7854,
29918,
7411,
29953,
29946,
8785,
13,
4706,
269,
29889,
1202,
3057,
29898,
1688,
29918,
29885,
10669,
877,
1688,
29918,
842,
29918,
1609,
29918,
2248,
29918,
4351,
29918,
7411,
29953,
29946,
8785,
13,
4706,
269,
29889,
1202,
3057,
29898,
1688,
29918,
29885,
10669,
877,
1688,
29918,
2083,
29918,
7411,
29953,
29946,
8785,
13,
4706,
269,
29889,
1202,
3057,
29898,
1688,
29918,
29885,
10669,
877,
1688,
29918,
2083,
29918,
19676,
29896,
29906,
29947,
8785,
13,
4706,
269,
29889,
1202,
3057,
29898,
1688,
29918,
29885,
10669,
877,
1688,
29918,
12676,
29918,
7411,
29953,
29946,
8785,
13,
4706,
269,
29889,
1202,
3057,
29898,
1688,
29918,
29885,
10669,
877,
1688,
29918,
12676,
29918,
19676,
29896,
29906,
29947,
8785,
13,
4706,
269,
29889,
1202,
3057,
29898,
1688,
29918,
29885,
10669,
877,
1688,
29918,
19541,
459,
29918,
2922,
2003,
29918,
7411,
29953,
29946,
8785,
13,
4706,
269,
29889,
1202,
3057,
29898,
1688,
29918,
29885,
10669,
877,
1688,
29918,
19541,
459,
29918,
2922,
2003,
29918,
19676,
29896,
29906,
29947,
8785,
13,
4706,
269,
29889,
1202,
3057,
29898,
1688,
29918,
29885,
10669,
877,
1688,
29918,
1707,
29918,
7411,
29953,
29946,
8785,
13,
4706,
269,
29889,
1202,
3057,
29898,
1688,
29918,
29885,
10669,
877,
1688,
29918,
1707,
29918,
19676,
29896,
29906,
29947,
8785,
13,
4706,
269,
29889,
1202,
3057,
29898,
1688,
29918,
29885,
10669,
877,
1688,
29918,
4172,
29918,
7411,
29953,
29946,
8785,
13,
4706,
269,
29889,
1202,
3057,
29898,
1688,
29918,
29885,
10669,
877,
1688,
29918,
4172,
29918,
19676,
29896,
29906,
29947,
8785,
13,
1678,
269,
29889,
1202,
3057,
29898,
1688,
29918,
29885,
10669,
877,
1688,
29918,
1195,
3317,
29918,
7411,
29953,
29946,
8785,
13,
1678,
269,
29889,
1202,
3057,
29898,
1688,
29918,
29885,
10669,
877,
1688,
29918,
1191,
1195,
3317,
29918,
7411,
29953,
29946,
8785,
13,
1678,
736,
269,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
1667,
29898,
4381,
3057,
353,
525,
13495,
1495,
13,
2
] |
test/integration/ggrc/proposal/api/test_property.py | j0gurt/ggrc-core | 1 | 196711 | <gh_stars>1-10
# Copyright (C) 2018 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""TestCase for proposal property api."""
from ggrc.models import all_models
from integration.ggrc.models import factories
from integration.ggrc.proposal.api import base
class TestPropoertyProposals(base.BaseTestProposalApi):
"""Test case for proposal property api."""
def test_simple_get_proposal(self):
"""Test simple get proposal."""
with factories.single_commit():
control = factories.ControlFactory()
proposal = factories.ProposalFactory(instance=control,
content={"field": "a"},
agenda="agenda content")
instance_dict = {"id": control.id, "type": control.type}
resp = self.api.get(all_models.Proposal, proposal.id)
self.assert200(resp)
self.assertIn("proposal", resp.json)
data = resp.json["proposal"]
self.assertIn("content", data)
self.assertIn("instance", data)
self.assertIn("agenda", data)
self.assertDictEqual(instance_dict, data["instance"])
self.assertDictEqual({"field": "a"}, data["content"])
self.assertEqual("agenda content", data["agenda"])
def test_simple_create_proposal(self):
"""Test simple create proposal."""
new_title = "2"
control = factories.ControlFactory(title="1")
control_id = control.id
control.title = new_title
self.assertEqual(0, len(control.comments))
self.create_proposal(control,
full_instance_content=control.log_json(),
agenda="update title from 1 to 2",
context=None)
control = all_models.Control.query.get(control_id)
self.assertEqual(1, len(control.proposals))
self.assertIn("fields", control.proposals[0].content)
self.assertEqual({"title": "2"}, control.proposals[0].content["fields"])
self.assertEqual(1, len(control.comments))
def test_simple_apply_status(self):
"""Test simple apply status."""
with factories.single_commit():
control = factories.ControlFactory(title="1")
proposal = factories.ProposalFactory(
instance=control,
content={"fields": {"title": "2"}},
agenda="agenda content")
control_id = control.id
proposal_id = proposal.id
self.assertEqual(proposal.STATES.PROPOSED, proposal.status)
self.assertEqual(0, len(control.comments))
with self.number_obj_revisions_for(control):
self.apply_proposal(proposal, apply_reason="approved")
control = all_models.Control.query.get(control_id)
proposal = all_models.Proposal.query.get(proposal_id)
self.assertEqual(proposal.STATES.APPLIED, proposal.status)
self.assertEqual("2", control.title)
self.assertEqual("2", self.latest_revision_for(control).content['title'])
self.assertEqual(1, len(control.comments))
def test_simple_decline_status(self):
"""Test simple decline status."""
with factories.single_commit():
control = factories.ControlFactory(title="1")
proposal = factories.ProposalFactory(
instance=control,
content={"fields": {"title": "2"}},
agenda="agenda content")
control_id = control.id
proposal_id = proposal.id
self.assertEqual(proposal.STATES.PROPOSED, proposal.status)
self.assertEqual(0, len(control.comments))
with self.number_obj_revisions_for(control, increase_on=0):
self.decline_proposal(proposal, decline_reason="declined bla")
control = all_models.Control.query.get(control_id)
proposal = all_models.Proposal.query.get(proposal_id)
self.assertEqual(proposal.STATES.DECLINED, proposal.status)
self.assertEqual("1", control.title)
self.assertEqual(1, len(control.comments))
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
29937,
14187,
1266,
313,
29907,
29897,
29871,
29906,
29900,
29896,
29947,
5087,
9266,
29889,
13,
29937,
10413,
21144,
1090,
1732,
597,
1636,
29889,
4288,
29889,
990,
29914,
506,
11259,
29914,
27888,
1430,
1660,
29899,
29906,
29889,
29900,
529,
4149,
365,
2965,
1430,
1660,
934,
29958,
13,
13,
15945,
29908,
3057,
8259,
363,
24963,
2875,
7882,
1213,
15945,
13,
13,
3166,
330,
629,
29883,
29889,
9794,
1053,
599,
29918,
9794,
13,
13,
3166,
13465,
29889,
29887,
629,
29883,
29889,
9794,
1053,
2114,
3842,
13,
3166,
13465,
29889,
29887,
629,
29883,
29889,
771,
1066,
284,
29889,
2754,
1053,
2967,
13,
13,
13,
1990,
4321,
1184,
1129,
814,
29891,
1184,
1066,
1338,
29898,
3188,
29889,
5160,
3057,
1184,
1066,
284,
11713,
1125,
13,
29871,
9995,
3057,
1206,
363,
24963,
2875,
7882,
1213,
15945,
13,
13,
29871,
822,
1243,
29918,
12857,
29918,
657,
29918,
771,
1066,
284,
29898,
1311,
1125,
13,
1678,
9995,
3057,
2560,
679,
24963,
1213,
15945,
13,
1678,
411,
2114,
3842,
29889,
14369,
29918,
15060,
7295,
13,
418,
2761,
353,
2114,
3842,
29889,
4809,
5126,
580,
13,
418,
24963,
353,
2114,
3842,
29889,
1184,
1066,
284,
5126,
29898,
8758,
29922,
6451,
29892,
13,
462,
462,
965,
2793,
3790,
29908,
2671,
1115,
376,
29874,
10758,
13,
462,
462,
965,
946,
8395,
543,
351,
8395,
2793,
1159,
13,
1678,
2777,
29918,
8977,
353,
8853,
333,
1115,
2761,
29889,
333,
29892,
376,
1853,
1115,
2761,
29889,
1853,
29913,
13,
1678,
4613,
353,
1583,
29889,
2754,
29889,
657,
29898,
497,
29918,
9794,
29889,
1184,
1066,
284,
29892,
24963,
29889,
333,
29897,
13,
1678,
1583,
29889,
9294,
29906,
29900,
29900,
29898,
13713,
29897,
13,
1678,
1583,
29889,
9294,
797,
703,
771,
1066,
284,
613,
4613,
29889,
3126,
29897,
13,
1678,
848,
353,
4613,
29889,
3126,
3366,
771,
1066,
284,
3108,
13,
1678,
1583,
29889,
9294,
797,
703,
3051,
613,
848,
29897,
13,
1678,
1583,
29889,
9294,
797,
703,
8758,
613,
848,
29897,
13,
1678,
1583,
29889,
9294,
797,
703,
351,
8395,
613,
848,
29897,
13,
1678,
1583,
29889,
9294,
21533,
9843,
29898,
8758,
29918,
8977,
29892,
848,
3366,
8758,
20068,
13,
1678,
1583,
29889,
9294,
21533,
9843,
3319,
29908,
2671,
1115,
376,
29874,
10758,
848,
3366,
3051,
20068,
13,
1678,
1583,
29889,
9294,
9843,
703,
351,
8395,
2793,
613,
848,
3366,
351,
8395,
20068,
13,
13,
29871,
822,
1243,
29918,
12857,
29918,
3258,
29918,
771,
1066,
284,
29898,
1311,
1125,
13,
1678,
9995,
3057,
2560,
1653,
24963,
1213,
15945,
13,
1678,
716,
29918,
3257,
353,
376,
29906,
29908,
13,
1678,
2761,
353,
2114,
3842,
29889,
4809,
5126,
29898,
3257,
543,
29896,
1159,
13,
1678,
2761,
29918,
333,
353,
2761,
29889,
333,
13,
1678,
2761,
29889,
3257,
353,
716,
29918,
3257,
13,
1678,
1583,
29889,
9294,
9843,
29898,
29900,
29892,
7431,
29898,
6451,
29889,
21032,
876,
13,
1678,
1583,
29889,
3258,
29918,
771,
1066,
284,
29898,
6451,
29892,
13,
462,
308,
2989,
29918,
8758,
29918,
3051,
29922,
6451,
29889,
1188,
29918,
3126,
3285,
13,
462,
308,
946,
8395,
543,
5504,
3611,
515,
29871,
29896,
304,
29871,
29906,
613,
13,
462,
308,
3030,
29922,
8516,
29897,
13,
1678,
2761,
353,
599,
29918,
9794,
29889,
4809,
29889,
1972,
29889,
657,
29898,
6451,
29918,
333,
29897,
13,
1678,
1583,
29889,
9294,
9843,
29898,
29896,
29892,
7431,
29898,
6451,
29889,
771,
1066,
1338,
876,
13,
1678,
1583,
29889,
9294,
797,
703,
9621,
613,
2761,
29889,
771,
1066,
1338,
29961,
29900,
1822,
3051,
29897,
13,
1678,
1583,
29889,
9294,
9843,
3319,
29908,
3257,
1115,
376,
29906,
10758,
2761,
29889,
771,
1066,
1338,
29961,
29900,
1822,
3051,
3366,
9621,
20068,
13,
1678,
1583,
29889,
9294,
9843,
29898,
29896,
29892,
7431,
29898,
6451,
29889,
21032,
876,
13,
13,
29871,
822,
1243,
29918,
12857,
29918,
7302,
29918,
4882,
29898,
1311,
1125,
13,
1678,
9995,
3057,
2560,
3394,
4660,
1213,
15945,
13,
1678,
411,
2114,
3842,
29889,
14369,
29918,
15060,
7295,
13,
418,
2761,
353,
2114,
3842,
29889,
4809,
5126,
29898,
3257,
543,
29896,
1159,
13,
418,
24963,
353,
2114,
3842,
29889,
1184,
1066,
284,
5126,
29898,
13,
3986,
2777,
29922,
6451,
29892,
13,
3986,
2793,
3790,
29908,
9621,
1115,
8853,
3257,
1115,
376,
29906,
29908,
11656,
13,
3986,
946,
8395,
543,
351,
8395,
2793,
1159,
13,
1678,
2761,
29918,
333,
353,
2761,
29889,
333,
13,
1678,
24963,
29918,
333,
353,
24963,
29889,
333,
13,
1678,
1583,
29889,
9294,
9843,
29898,
771,
1066,
284,
29889,
17816,
2890,
29889,
8618,
13152,
1660,
29928,
29892,
24963,
29889,
4882,
29897,
13,
1678,
1583,
29889,
9294,
9843,
29898,
29900,
29892,
7431,
29898,
6451,
29889,
21032,
876,
13,
1678,
411,
1583,
29889,
4537,
29918,
5415,
29918,
276,
1730,
1080,
29918,
1454,
29898,
6451,
1125,
13,
418,
1583,
29889,
7302,
29918,
771,
1066,
284,
29898,
771,
1066,
284,
29892,
3394,
29918,
23147,
543,
9961,
1490,
1159,
13,
1678,
2761,
353,
599,
29918,
9794,
29889,
4809,
29889,
1972,
29889,
657,
29898,
6451,
29918,
333,
29897,
13,
1678,
24963,
353,
599,
29918,
9794,
29889,
1184,
1066,
284,
29889,
1972,
29889,
657,
29898,
771,
1066,
284,
29918,
333,
29897,
13,
13,
1678,
1583,
29889,
9294,
9843,
29898,
771,
1066,
284,
29889,
17816,
2890,
29889,
20576,
5265,
3352,
29892,
24963,
29889,
4882,
29897,
13,
1678,
1583,
29889,
9294,
9843,
703,
29906,
613,
2761,
29889,
3257,
29897,
13,
1678,
1583,
29889,
9294,
9843,
703,
29906,
613,
1583,
29889,
12333,
29918,
276,
4924,
29918,
1454,
29898,
6451,
467,
3051,
1839,
3257,
11287,
13,
1678,
1583,
29889,
9294,
9843,
29898,
29896,
29892,
7431,
29898,
6451,
29889,
21032,
876,
13,
13,
29871,
822,
1243,
29918,
12857,
29918,
27787,
457,
29918,
4882,
29898,
1311,
1125,
13,
1678,
9995,
3057,
2560,
4845,
457,
4660,
1213,
15945,
13,
1678,
411,
2114,
3842,
29889,
14369,
29918,
15060,
7295,
13,
418,
2761,
353,
2114,
3842,
29889,
4809,
5126,
29898,
3257,
543,
29896,
1159,
13,
418,
24963,
353,
2114,
3842,
29889,
1184,
1066,
284,
5126,
29898,
13,
3986,
2777,
29922,
6451,
29892,
13,
3986,
2793,
3790,
29908,
9621,
1115,
8853,
3257,
1115,
376,
29906,
29908,
11656,
13,
3986,
946,
8395,
543,
351,
8395,
2793,
1159,
13,
1678,
2761,
29918,
333,
353,
2761,
29889,
333,
13,
1678,
24963,
29918,
333,
353,
24963,
29889,
333,
13,
1678,
1583,
29889,
9294,
9843,
29898,
771,
1066,
284,
29889,
17816,
2890,
29889,
8618,
13152,
1660,
29928,
29892,
24963,
29889,
4882,
29897,
13,
1678,
1583,
29889,
9294,
9843,
29898,
29900,
29892,
7431,
29898,
6451,
29889,
21032,
876,
13,
1678,
411,
1583,
29889,
4537,
29918,
5415,
29918,
276,
1730,
1080,
29918,
1454,
29898,
6451,
29892,
7910,
29918,
265,
29922,
29900,
1125,
13,
418,
1583,
29889,
27787,
457,
29918,
771,
1066,
284,
29898,
771,
1066,
284,
29892,
4845,
457,
29918,
23147,
543,
27787,
1312,
12995,
1159,
13,
1678,
2761,
353,
599,
29918,
9794,
29889,
4809,
29889,
1972,
29889,
657,
29898,
6451,
29918,
333,
29897,
13,
1678,
24963,
353,
599,
29918,
9794,
29889,
1184,
1066,
284,
29889,
1972,
29889,
657,
29898,
771,
1066,
284,
29918,
333,
29897,
13,
1678,
1583,
29889,
9294,
9843,
29898,
771,
1066,
284,
29889,
17816,
2890,
29889,
2287,
6154,
1177,
3352,
29892,
24963,
29889,
4882,
29897,
13,
1678,
1583,
29889,
9294,
9843,
703,
29896,
613,
2761,
29889,
3257,
29897,
13,
1678,
1583,
29889,
9294,
9843,
29898,
29896,
29892,
7431,
29898,
6451,
29889,
21032,
876,
13,
2
] |
tests/test_patch.py | ElMehdi19/flask-mux | 1 | 100899 | from flask.testing import FlaskClient
import pytest
from flask import Flask
from flask_mux import Mux
from testing import test_router
from testing.test_cases.middlewares import test_mws_router
@pytest.fixture
def client():
app = Flask(__name__)
mux = Mux(app)
mux.use('/', test_mws_router)
return app.test_client()
def test_basic(client: FlaskClient):
return test_router.test_basic(client, 'patch')
def test_one_mw(client: FlaskClient):
return test_router.test_one_mw(client, 'patch')
def test_one_mw_failing(client: FlaskClient):
return test_router.test_one_mw_failing(client, 'patch')
def test_multi_mws(client: FlaskClient):
return test_router.test_multi_mws(client, 'patch')
def test_multi_mws_failing(client: FlaskClient):
return test_router.test_multi_mws_failing(client, 'patch')
def test_extra_mws(client: FlaskClient):
return test_router.test_extra_mws(client, 'patch')
def test_extra_mws_failing_1(client: FlaskClient):
return test_router.test_extra_mws_failing_1(client, 'patch')
def test_extra_mws_failing_2(client: FlaskClient):
return test_router.test_extra_mws_failing_2(client, 'patch')
def test_extra_mws_failing_3(client: FlaskClient):
return test_router.test_extra_mws_failing_3(client, 'patch')
| [
1,
515,
29784,
29889,
13424,
1053,
2379,
1278,
4032,
13,
5215,
11451,
1688,
13,
3166,
29784,
1053,
2379,
1278,
13,
3166,
29784,
29918,
29885,
1314,
1053,
341,
1314,
13,
3166,
6724,
1053,
1243,
29918,
15140,
13,
3166,
6724,
29889,
1688,
29918,
11436,
29889,
17662,
4495,
267,
1053,
1243,
29918,
29885,
5652,
29918,
15140,
13,
13,
13,
29992,
2272,
1688,
29889,
7241,
15546,
13,
1753,
3132,
7295,
13,
1678,
623,
353,
2379,
1278,
22168,
978,
1649,
29897,
13,
1678,
286,
1314,
353,
341,
1314,
29898,
932,
29897,
13,
1678,
286,
1314,
29889,
1509,
11219,
742,
1243,
29918,
29885,
5652,
29918,
15140,
29897,
13,
1678,
736,
623,
29889,
1688,
29918,
4645,
580,
13,
13,
13,
1753,
1243,
29918,
16121,
29898,
4645,
29901,
2379,
1278,
4032,
1125,
13,
1678,
736,
1243,
29918,
15140,
29889,
1688,
29918,
16121,
29898,
4645,
29892,
525,
5041,
1495,
13,
13,
13,
1753,
1243,
29918,
650,
29918,
29885,
29893,
29898,
4645,
29901,
2379,
1278,
4032,
1125,
13,
1678,
736,
1243,
29918,
15140,
29889,
1688,
29918,
650,
29918,
29885,
29893,
29898,
4645,
29892,
525,
5041,
1495,
13,
13,
13,
1753,
1243,
29918,
650,
29918,
29885,
29893,
29918,
14057,
292,
29898,
4645,
29901,
2379,
1278,
4032,
1125,
13,
1678,
736,
1243,
29918,
15140,
29889,
1688,
29918,
650,
29918,
29885,
29893,
29918,
14057,
292,
29898,
4645,
29892,
525,
5041,
1495,
13,
13,
13,
1753,
1243,
29918,
9910,
29918,
29885,
5652,
29898,
4645,
29901,
2379,
1278,
4032,
1125,
13,
1678,
736,
1243,
29918,
15140,
29889,
1688,
29918,
9910,
29918,
29885,
5652,
29898,
4645,
29892,
525,
5041,
1495,
13,
13,
13,
1753,
1243,
29918,
9910,
29918,
29885,
5652,
29918,
14057,
292,
29898,
4645,
29901,
2379,
1278,
4032,
1125,
13,
1678,
736,
1243,
29918,
15140,
29889,
1688,
29918,
9910,
29918,
29885,
5652,
29918,
14057,
292,
29898,
4645,
29892,
525,
5041,
1495,
13,
13,
13,
1753,
1243,
29918,
17833,
29918,
29885,
5652,
29898,
4645,
29901,
2379,
1278,
4032,
1125,
13,
1678,
736,
1243,
29918,
15140,
29889,
1688,
29918,
17833,
29918,
29885,
5652,
29898,
4645,
29892,
525,
5041,
1495,
13,
13,
13,
1753,
1243,
29918,
17833,
29918,
29885,
5652,
29918,
14057,
292,
29918,
29896,
29898,
4645,
29901,
2379,
1278,
4032,
1125,
13,
1678,
736,
1243,
29918,
15140,
29889,
1688,
29918,
17833,
29918,
29885,
5652,
29918,
14057,
292,
29918,
29896,
29898,
4645,
29892,
525,
5041,
1495,
13,
13,
13,
1753,
1243,
29918,
17833,
29918,
29885,
5652,
29918,
14057,
292,
29918,
29906,
29898,
4645,
29901,
2379,
1278,
4032,
1125,
13,
1678,
736,
1243,
29918,
15140,
29889,
1688,
29918,
17833,
29918,
29885,
5652,
29918,
14057,
292,
29918,
29906,
29898,
4645,
29892,
525,
5041,
1495,
13,
13,
13,
1753,
1243,
29918,
17833,
29918,
29885,
5652,
29918,
14057,
292,
29918,
29941,
29898,
4645,
29901,
2379,
1278,
4032,
1125,
13,
1678,
736,
1243,
29918,
15140,
29889,
1688,
29918,
17833,
29918,
29885,
5652,
29918,
14057,
292,
29918,
29941,
29898,
4645,
29892,
525,
5041,
1495,
13,
2
] |
modular_exp.py | a-l-r1/cryptography | 0 | 1609294 | <reponame>a-l-r1/cryptography
def square_modular_exp(x:int, power:int, modulus:int) -> int:
if (modulus <= 0):
raise ValueError("modular_pow: modulus must be " + \
"positive: (%d ** %d) %% %d" % (x, power, modulus))
result = 1
bit_list = []
while (power != 0):
bit_list.insert(0, power % 2)
power //= 2
for i in bit_list:
result = (result * result) % modulus
if (i == 1):
result = (result * x) % modulus
return result
modular_exp = square_modular_exp
def generic_modular_exp(x:int, power:int, modulus:int) -> int:
if (modulus <= 0):
raise ValueError("modular_pow: modulus must be " + \
"positive: (%d ** %d) %% %d" % (x, power, modulus))
result = 1
for i in range(power):
result = (result * x) % modulus
return result
| [
1,
529,
276,
1112,
420,
29958,
29874,
29899,
29880,
29899,
29878,
29896,
29914,
29883,
4641,
5275,
13,
1753,
6862,
29918,
1545,
1070,
29918,
4548,
29898,
29916,
29901,
524,
29892,
3081,
29901,
524,
29892,
878,
14999,
29901,
524,
29897,
1599,
938,
29901,
13,
12,
361,
313,
1545,
14999,
5277,
29871,
29900,
1125,
13,
12,
12,
22692,
7865,
2392,
703,
1545,
1070,
29918,
12248,
29901,
878,
14999,
1818,
367,
376,
718,
320,
13,
12,
12,
12,
29908,
1066,
3321,
29901,
313,
29995,
29881,
3579,
1273,
29881,
29897,
17806,
1273,
29881,
29908,
1273,
313,
29916,
29892,
3081,
29892,
878,
14999,
876,
13,
12,
13,
12,
2914,
353,
29871,
29896,
13,
12,
13,
12,
2966,
29918,
1761,
353,
5159,
13,
12,
8000,
313,
13519,
2804,
29871,
29900,
1125,
13,
12,
12,
2966,
29918,
1761,
29889,
7851,
29898,
29900,
29892,
3081,
1273,
29871,
29906,
29897,
13,
12,
12,
13519,
849,
29922,
29871,
29906,
13,
12,
13,
12,
1454,
474,
297,
2586,
29918,
1761,
29901,
13,
12,
12,
2914,
353,
313,
2914,
334,
1121,
29897,
1273,
878,
14999,
13,
12,
12,
13,
12,
12,
361,
313,
29875,
1275,
29871,
29896,
1125,
13,
12,
12,
12,
2914,
353,
313,
2914,
334,
921,
29897,
1273,
878,
14999,
13,
308,
13,
12,
2457,
1121,
13,
13,
1545,
1070,
29918,
4548,
353,
6862,
29918,
1545,
1070,
29918,
4548,
13,
13,
1753,
10035,
29918,
1545,
1070,
29918,
4548,
29898,
29916,
29901,
524,
29892,
3081,
29901,
524,
29892,
878,
14999,
29901,
524,
29897,
1599,
938,
29901,
13,
12,
361,
313,
1545,
14999,
5277,
29871,
29900,
1125,
13,
12,
12,
22692,
7865,
2392,
703,
1545,
1070,
29918,
12248,
29901,
878,
14999,
1818,
367,
376,
718,
320,
13,
12,
12,
12,
29908,
1066,
3321,
29901,
313,
29995,
29881,
3579,
1273,
29881,
29897,
17806,
1273,
29881,
29908,
1273,
313,
29916,
29892,
3081,
29892,
878,
14999,
876,
13,
12,
13,
12,
2914,
353,
29871,
29896,
13,
12,
13,
12,
1454,
474,
297,
3464,
29898,
13519,
1125,
13,
12,
12,
2914,
353,
313,
2914,
334,
921,
29897,
1273,
878,
14999,
13,
12,
13,
12,
2457,
1121,
13,
13,
2
] |
lib/desconst.py | elp2/des | 20 | 67565 |
# Applied once at the beginning of the algorithm.
INITIAL_PERMUTATION = [
58, 50, 42, 34, 26, 18, 10, 2,
60, 52, 44, 36, 28, 20, 12, 4,
62, 54, 46, 38, 30, 22, 14, 6,
64, 56, 48, 40, 32, 24, 16, 8,
57, 49, 41, 33, 25, 17, 9, 1,
59, 51, 43, 35, 27, 19, 11, 3,
61, 53, 45, 37, 29, 21, 13, 5,
63, 55, 47, 39, 31, 23, 15, 7,
]
# Inverse of INITIAL_PERMUTATION. Applied once at the end of the algorithm.
FINAL_PERMUTATION = [
40, 8, 48, 16, 56, 24, 64, 32,
39, 7, 47, 15, 55, 23, 63, 31,
38, 6, 46, 14, 54, 22, 62, 30,
37, 5, 45, 13, 53, 21, 61, 29,
36, 4, 44, 12, 52, 20, 60, 28,
35, 3, 43, 11, 51, 19, 59, 27,
34, 2, 42, 10, 50, 18, 58, 26,
33, 1, 41, 9, 49, 17, 57, 25,
]
# Applied to the half-block at the beginning of the Fiestel function.
EXPANSION = [
32, 1, 2, 3, 4, 5,
4, 5, 6, 7, 8, 9,
8, 9, 10, 11, 12, 13,
12, 13, 14, 15, 16, 17,
16, 17, 18, 19, 20, 21,
20, 21, 22, 23, 24, 25,
24, 25, 26, 27, 28, 29,
28, 29, 30, 31, 32, 1,
]
# Applied at the end of the Feistel function.
PERMUTATION = [
16, 7, 20, 21, 29, 12, 28, 17,
1, 15, 23, 26, 5, 18, 31, 10,
2, 8, 24, 14, 32, 27, 3, 9,
19, 13, 30, 6, 22, 11, 4, 25,
]
# Converts from full 64-bit key to two key halves: left and right. Only 48
# bits from the original key are used.
PERMUTED_CHOICE_1_LEFT = [
57, 49, 41, 33, 25, 17, 9,
1, 58, 50, 42, 34, 26, 18,
10, 2, 59, 51, 43, 35, 27,
19, 11, 3, 60, 52, 44, 36,
]
PERMUTED_CHOICE_1_RIGHT = [
63, 55, 47, 39, 31, 23, 15,
7, 62, 54, 46, 38, 30, 22,
14, 6, 61, 53, 45, 37, 29,
21, 13, 5, 28, 20, 12, 4,
]
# Converts the shifted right and left key halves (concatenated together) into
# the subkey for the round (input into Feistel function).
PERMUTED_CHOICE_2 = [
14, 17, 11, 24, 1, 5, 3, 28,
15, 6, 21, 10, 23, 19, 12, 4,
26, 8, 16, 7, 27, 20, 13, 2,
41, 52, 31, 37, 47, 55, 30, 40,
51, 45, 33, 48, 44, 49, 39, 56,
34, 53, 46, 42, 50, 36, 29, 32,
]
# S-Boxes
# SBOX[outer 2 bits][inner 4 bits]
# Each value represents 4 bits that the 6-bit input is mapped to.
SBOX_1 = [
[14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7],
[0, 15, 7, 4, 14, 2, 13, 1, 10, 6, 12, 11, 9, 5, 3, 8],
[4, 1, 14, 8, 13, 6, 2, 11, 15, 12, 9, 7, 3, 10, 5, 0],
[15, 12, 8, 2, 4, 9, 1, 7, 5, 11, 3, 14, 10, 0, 6, 13],
]
SBOX_2 = [
[15, 1, 8, 14, 6, 11, 3, 4, 9, 7, 2, 13, 12, 0, 5, 10],
[3, 13, 4, 7, 15, 2, 8, 14, 12, 0, 1, 10, 6, 9, 11, 5],
[0, 14, 7, 11, 10, 4, 13, 1, 5, 8, 12, 6, 9, 3, 2, 15],
[13, 8, 10, 1, 3, 15, 4, 2, 11, 6, 7, 12, 0, 5, 14, 9],
]
SBOX_3 = [
[10, 0, 9, 14, 6, 3, 15, 5, 1, 13, 12, 7, 11, 4, 2, 8],
[13, 7, 0, 9, 3, 4, 6, 10, 2, 8, 5, 14, 12, 11, 15, 1],
[13, 6, 4, 9, 8, 15, 3, 0, 11, 1, 2, 12, 5, 10, 14, 7],
[1, 10, 13, 0, 6, 9, 8, 7, 4, 15, 14, 3, 11, 5, 2, 12],
]
SBOX_4 = [
[7, 13, 14, 3, 0, 6, 9, 10, 1, 2, 8, 5, 11, 12, 4, 15],
[13, 8, 11, 5, 6, 15, 0, 3, 4, 7, 2, 12, 1, 10, 14, 9],
[10, 6, 9, 0, 12, 11, 7, 13, 15, 1, 3, 14, 5, 2, 8, 4],
[3, 15, 0, 6, 10, 1, 13, 8, 9, 4, 5, 11, 12, 7, 2, 14],
]
SBOX_5 = [
[2, 12, 4, 1, 7, 10, 11, 6, 8, 5, 3, 15, 13, 0, 14, 9],
[14, 11, 2, 12, 4, 7, 13, 1, 5, 0, 15, 10, 3, 9, 8, 6],
[4, 2, 1, 11, 10, 13, 7, 8, 15, 9, 12, 5, 6, 3, 0, 14],
[11, 8, 12, 7, 1, 14, 2, 13, 6, 15, 0, 9, 10, 4, 5, 3],
]
SBOX_6 = [
[12, 1, 10, 15, 9, 2, 6, 8, 0, 13, 3, 4, 14, 7, 5, 11],
[10, 15, 4, 2, 7, 12, 9, 5, 6, 1, 13, 14, 0, 11, 3, 8],
[9, 14, 15, 5, 2, 8, 12, 3, 7, 0, 4, 10, 1, 13, 11, 6],
[4, 3, 2, 12, 9, 5, 15, 10, 11, 14, 1, 7, 6, 0, 8, 13],
]
SBOX_7 = [
[4, 11, 2, 14, 15, 0, 8, 13, 3, 12, 9, 7, 5, 10, 6, 1],
[13, 0, 11, 7, 4, 9, 1, 10, 14, 3, 5, 12, 2, 15, 8, 6],
[1, 4, 11, 13, 12, 3, 7, 14, 10, 15, 6, 8, 0, 5, 9, 2],
[6, 11, 13, 8, 1, 4, 10, 7, 9, 5, 0, 15, 14, 2, 3, 12],
]
SBOX_8 = [
[13, 2, 8, 4, 6, 15, 11, 1, 10, 9, 3, 14, 5, 0, 12, 7],
[1, 15, 13, 8, 10, 3, 7, 4, 12, 5, 6, 11, 0, 14, 9, 2],
[7, 11, 4, 1, 9, 12, 14, 2, 0, 6, 10, 13, 15, 3, 5, 8],
[2, 1, 14, 7, 4, 10, 8, 13, 15, 12, 9, 0, 3, 5, 6, 11],
]
SBOXES = [SBOX_1, SBOX_2, SBOX_3, SBOX_4, SBOX_5, SBOX_6, SBOX_7, SBOX_8]
# How much the left and right key halves are shifted every round.
KEY_SHIFT_AMOUNTS = [1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1]
| [
1,
29871,
13,
29937,
2401,
2957,
2748,
472,
278,
6763,
310,
278,
5687,
29889,
13,
26019,
25758,
29918,
13171,
29924,
2692,
8098,
353,
518,
13,
268,
29945,
29947,
29892,
29871,
29945,
29900,
29892,
29871,
29946,
29906,
29892,
29871,
29941,
29946,
29892,
29871,
29906,
29953,
29892,
29871,
29896,
29947,
29892,
29871,
29896,
29900,
29892,
29871,
29906,
29892,
13,
268,
29953,
29900,
29892,
29871,
29945,
29906,
29892,
29871,
29946,
29946,
29892,
29871,
29941,
29953,
29892,
29871,
29906,
29947,
29892,
29871,
29906,
29900,
29892,
29871,
29896,
29906,
29892,
29871,
29946,
29892,
13,
268,
29953,
29906,
29892,
29871,
29945,
29946,
29892,
29871,
29946,
29953,
29892,
29871,
29941,
29947,
29892,
29871,
29941,
29900,
29892,
29871,
29906,
29906,
29892,
29871,
29896,
29946,
29892,
29871,
29953,
29892,
13,
268,
29953,
29946,
29892,
29871,
29945,
29953,
29892,
29871,
29946,
29947,
29892,
29871,
29946,
29900,
29892,
29871,
29941,
29906,
29892,
29871,
29906,
29946,
29892,
29871,
29896,
29953,
29892,
29871,
29947,
29892,
13,
268,
29945,
29955,
29892,
29871,
29946,
29929,
29892,
29871,
29946,
29896,
29892,
29871,
29941,
29941,
29892,
29871,
29906,
29945,
29892,
29871,
29896,
29955,
29892,
259,
29929,
29892,
29871,
29896,
29892,
13,
268,
29945,
29929,
29892,
29871,
29945,
29896,
29892,
29871,
29946,
29941,
29892,
29871,
29941,
29945,
29892,
29871,
29906,
29955,
29892,
29871,
29896,
29929,
29892,
29871,
29896,
29896,
29892,
29871,
29941,
29892,
13,
268,
29953,
29896,
29892,
29871,
29945,
29941,
29892,
29871,
29946,
29945,
29892,
29871,
29941,
29955,
29892,
29871,
29906,
29929,
29892,
29871,
29906,
29896,
29892,
29871,
29896,
29941,
29892,
29871,
29945,
29892,
13,
268,
29953,
29941,
29892,
29871,
29945,
29945,
29892,
29871,
29946,
29955,
29892,
29871,
29941,
29929,
29892,
29871,
29941,
29896,
29892,
29871,
29906,
29941,
29892,
29871,
29896,
29945,
29892,
29871,
29955,
29892,
13,
29962,
13,
13,
29937,
512,
3901,
310,
2672,
1806,
25758,
29918,
13171,
29924,
2692,
8098,
29889,
29871,
2401,
2957,
2748,
472,
278,
1095,
310,
278,
5687,
29889,
13,
29943,
1177,
1964,
29918,
13171,
29924,
2692,
8098,
353,
518,
13,
268,
29946,
29900,
29892,
29871,
29947,
29892,
29871,
29946,
29947,
29892,
29871,
29896,
29953,
29892,
29871,
29945,
29953,
29892,
29871,
29906,
29946,
29892,
29871,
29953,
29946,
29892,
29871,
29941,
29906,
29892,
13,
268,
29941,
29929,
29892,
29871,
29955,
29892,
29871,
29946,
29955,
29892,
29871,
29896,
29945,
29892,
29871,
29945,
29945,
29892,
29871,
29906,
29941,
29892,
29871,
29953,
29941,
29892,
29871,
29941,
29896,
29892,
13,
268,
29941,
29947,
29892,
29871,
29953,
29892,
29871,
29946,
29953,
29892,
29871,
29896,
29946,
29892,
29871,
29945,
29946,
29892,
29871,
29906,
29906,
29892,
29871,
29953,
29906,
29892,
29871,
29941,
29900,
29892,
13,
268,
29941,
29955,
29892,
29871,
29945,
29892,
29871,
29946,
29945,
29892,
29871,
29896,
29941,
29892,
29871,
29945,
29941,
29892,
29871,
29906,
29896,
29892,
29871,
29953,
29896,
29892,
29871,
29906,
29929,
29892,
13,
268,
29941,
29953,
29892,
29871,
29946,
29892,
29871,
29946,
29946,
29892,
29871,
29896,
29906,
29892,
29871,
29945,
29906,
29892,
29871,
29906,
29900,
29892,
29871,
29953,
29900,
29892,
29871,
29906,
29947,
29892,
13,
268,
29941,
29945,
29892,
29871,
29941,
29892,
29871,
29946,
29941,
29892,
29871,
29896,
29896,
29892,
29871,
29945,
29896,
29892,
29871,
29896,
29929,
29892,
29871,
29945,
29929,
29892,
29871,
29906,
29955,
29892,
13,
268,
29941,
29946,
29892,
29871,
29906,
29892,
29871,
29946,
29906,
29892,
29871,
29896,
29900,
29892,
29871,
29945,
29900,
29892,
29871,
29896,
29947,
29892,
29871,
29945,
29947,
29892,
29871,
29906,
29953,
29892,
13,
268,
29941,
29941,
29892,
29871,
29896,
29892,
29871,
29946,
29896,
29892,
259,
29929,
29892,
29871,
29946,
29929,
29892,
29871,
29896,
29955,
29892,
29871,
29945,
29955,
29892,
29871,
29906,
29945,
29892,
13,
29962,
13,
13,
29937,
2401,
2957,
304,
278,
4203,
29899,
1271,
472,
278,
6763,
310,
278,
383,
12239,
295,
740,
29889,
13,
5746,
29925,
2190,
13381,
353,
518,
13,
268,
29941,
29906,
29892,
259,
29896,
29892,
259,
29906,
29892,
259,
29941,
29892,
259,
29946,
29892,
259,
29945,
29892,
13,
418,
29946,
29892,
259,
29945,
29892,
259,
29953,
29892,
259,
29955,
29892,
259,
29947,
29892,
259,
29929,
29892,
13,
418,
29947,
29892,
259,
29929,
29892,
29871,
29896,
29900,
29892,
29871,
29896,
29896,
29892,
29871,
29896,
29906,
29892,
29871,
29896,
29941,
29892,
13,
268,
29896,
29906,
29892,
29871,
29896,
29941,
29892,
29871,
29896,
29946,
29892,
29871,
29896,
29945,
29892,
29871,
29896,
29953,
29892,
29871,
29896,
29955,
29892,
13,
268,
29896,
29953,
29892,
29871,
29896,
29955,
29892,
29871,
29896,
29947,
29892,
29871,
29896,
29929,
29892,
29871,
29906,
29900,
29892,
29871,
29906,
29896,
29892,
13,
268,
29906,
29900,
29892,
29871,
29906,
29896,
29892,
29871,
29906,
29906,
29892,
29871,
29906,
29941,
29892,
29871,
29906,
29946,
29892,
29871,
29906,
29945,
29892,
13,
268,
29906,
29946,
29892,
29871,
29906,
29945,
29892,
29871,
29906,
29953,
29892,
29871,
29906,
29955,
29892,
29871,
29906,
29947,
29892,
29871,
29906,
29929,
29892,
13,
268,
29906,
29947,
29892,
29871,
29906,
29929,
29892,
29871,
29941,
29900,
29892,
29871,
29941,
29896,
29892,
29871,
29941,
29906,
29892,
259,
29896,
29892,
13,
29962,
13,
13,
29937,
2401,
2957,
472,
278,
1095,
310,
278,
5169,
391,
295,
740,
29889,
13,
13171,
29924,
2692,
8098,
353,
518,
13,
268,
29896,
29953,
29892,
259,
29955,
29892,
29871,
29906,
29900,
29892,
29871,
29906,
29896,
29892,
29871,
29906,
29929,
29892,
29871,
29896,
29906,
29892,
29871,
29906,
29947,
29892,
29871,
29896,
29955,
29892,
13,
418,
29896,
29892,
29871,
29896,
29945,
29892,
29871,
29906,
29941,
29892,
29871,
29906,
29953,
29892,
259,
29945,
29892,
29871,
29896,
29947,
29892,
29871,
29941,
29896,
29892,
29871,
29896,
29900,
29892,
13,
418,
29906,
29892,
259,
29947,
29892,
29871,
29906,
29946,
29892,
29871,
29896,
29946,
29892,
29871,
29941,
29906,
29892,
29871,
29906,
29955,
29892,
259,
29941,
29892,
259,
29929,
29892,
13,
268,
29896,
29929,
29892,
29871,
29896,
29941,
29892,
29871,
29941,
29900,
29892,
259,
29953,
29892,
29871,
29906,
29906,
29892,
29871,
29896,
29896,
29892,
259,
29946,
29892,
29871,
29906,
29945,
29892,
13,
29962,
13,
13,
29937,
1281,
369,
1372,
515,
2989,
29871,
29953,
29946,
29899,
2966,
1820,
304,
1023,
1820,
8870,
1960,
29901,
2175,
322,
1492,
29889,
29871,
9333,
29871,
29946,
29947,
13,
29937,
9978,
515,
278,
2441,
1820,
526,
1304,
29889,
13,
13171,
29924,
2692,
3352,
29918,
3210,
29949,
12107,
29918,
29896,
29918,
28024,
353,
518,
13,
268,
29945,
29955,
29892,
29871,
29946,
29929,
29892,
29871,
29946,
29896,
29892,
29871,
29941,
29941,
29892,
29871,
29906,
29945,
29892,
29871,
29896,
29955,
29892,
259,
29929,
29892,
13,
418,
29896,
29892,
29871,
29945,
29947,
29892,
29871,
29945,
29900,
29892,
29871,
29946,
29906,
29892,
29871,
29941,
29946,
29892,
29871,
29906,
29953,
29892,
29871,
29896,
29947,
29892,
13,
268,
29896,
29900,
29892,
259,
29906,
29892,
29871,
29945,
29929,
29892,
29871,
29945,
29896,
29892,
29871,
29946,
29941,
29892,
29871,
29941,
29945,
29892,
29871,
29906,
29955,
29892,
13,
268,
29896,
29929,
29892,
29871,
29896,
29896,
29892,
259,
29941,
29892,
29871,
29953,
29900,
29892,
29871,
29945,
29906,
29892,
29871,
29946,
29946,
29892,
29871,
29941,
29953,
29892,
13,
29962,
13,
13171,
29924,
2692,
3352,
29918,
3210,
29949,
12107,
29918,
29896,
29918,
22789,
3912,
353,
518,
13,
268,
29953,
29941,
29892,
29871,
29945,
29945,
29892,
29871,
29946,
29955,
29892,
29871,
29941,
29929,
29892,
29871,
29941,
29896,
29892,
29871,
29906,
29941,
29892,
29871,
29896,
29945,
29892,
13,
418,
29955,
29892,
29871,
29953,
29906,
29892,
29871,
29945,
29946,
29892,
29871,
29946,
29953,
29892,
29871,
29941,
29947,
29892,
29871,
29941,
29900,
29892,
29871,
29906,
29906,
29892,
13,
268,
29896,
29946,
29892,
259,
29953,
29892,
29871,
29953,
29896,
29892,
29871,
29945,
29941,
29892,
29871,
29946,
29945,
29892,
29871,
29941,
29955,
29892,
29871,
29906,
29929,
29892,
13,
268,
29906,
29896,
29892,
29871,
29896,
29941,
29892,
259,
29945,
29892,
29871,
29906,
29947,
29892,
29871,
29906,
29900,
29892,
29871,
29896,
29906,
29892,
259,
29946,
29892,
13,
29962,
13,
13,
29937,
1281,
369,
1372,
278,
9500,
287,
1492,
322,
2175,
1820,
8870,
1960,
313,
535,
29883,
2579,
630,
4208,
29897,
964,
13,
29937,
278,
1014,
1989,
363,
278,
4513,
313,
2080,
964,
5169,
391,
295,
740,
467,
13,
13171,
29924,
2692,
3352,
29918,
3210,
29949,
12107,
29918,
29906,
353,
518,
13,
268,
29896,
29946,
29892,
29871,
29896,
29955,
29892,
29871,
29896,
29896,
29892,
29871,
29906,
29946,
29892,
259,
29896,
29892,
259,
29945,
29892,
259,
29941,
29892,
29871,
29906,
29947,
29892,
13,
268,
29896,
29945,
29892,
259,
29953,
29892,
29871,
29906,
29896,
29892,
29871,
29896,
29900,
29892,
29871,
29906,
29941,
29892,
29871,
29896,
29929,
29892,
29871,
29896,
29906,
29892,
259,
29946,
29892,
13,
268,
29906,
29953,
29892,
259,
29947,
29892,
29871,
29896,
29953,
29892,
259,
29955,
29892,
29871,
29906,
29955,
29892,
29871,
29906,
29900,
29892,
29871,
29896,
29941,
29892,
259,
29906,
29892,
13,
268,
29946,
29896,
29892,
29871,
29945,
29906,
29892,
29871,
29941,
29896,
29892,
29871,
29941,
29955,
29892,
29871,
29946,
29955,
29892,
29871,
29945,
29945,
29892,
29871,
29941,
29900,
29892,
29871,
29946,
29900,
29892,
13,
268,
29945,
29896,
29892,
29871,
29946,
29945,
29892,
29871,
29941,
29941,
29892,
29871,
29946,
29947,
29892,
29871,
29946,
29946,
29892,
29871,
29946,
29929,
29892,
29871,
29941,
29929,
29892,
29871,
29945,
29953,
29892,
13,
268,
29941,
29946,
29892,
29871,
29945,
29941,
29892,
29871,
29946,
29953,
29892,
29871,
29946,
29906,
29892,
29871,
29945,
29900,
29892,
29871,
29941,
29953,
29892,
29871,
29906,
29929,
29892,
29871,
29941,
29906,
29892,
13,
29962,
13,
13,
29937,
317,
29899,
3313,
267,
13,
29937,
317,
8456,
29990,
29961,
5561,
29871,
29906,
9978,
3816,
3993,
29871,
29946,
9978,
29962,
13,
29937,
7806,
995,
11524,
29871,
29946,
9978,
393,
278,
29871,
29953,
29899,
2966,
1881,
338,
20545,
304,
29889,
13,
1744,
29949,
29990,
29918,
29896,
353,
518,
13,
1678,
518,
29896,
29946,
29892,
29871,
29946,
29892,
29871,
29896,
29941,
29892,
29871,
29896,
29892,
29871,
29906,
29892,
29871,
29896,
29945,
29892,
29871,
29896,
29896,
29892,
29871,
29947,
29892,
29871,
29941,
29892,
29871,
29896,
29900,
29892,
29871,
29953,
29892,
29871,
29896,
29906,
29892,
29871,
29945,
29892,
29871,
29929,
29892,
29871,
29900,
29892,
29871,
29955,
1402,
13,
1678,
518,
29900,
29892,
29871,
29896,
29945,
29892,
29871,
29955,
29892,
29871,
29946,
29892,
29871,
29896,
29946,
29892,
29871,
29906,
29892,
29871,
29896,
29941,
29892,
29871,
29896,
29892,
29871,
29896,
29900,
29892,
29871,
29953,
29892,
29871,
29896,
29906,
29892,
29871,
29896,
29896,
29892,
29871,
29929,
29892,
29871,
29945,
29892,
29871,
29941,
29892,
29871,
29947,
1402,
13,
1678,
518,
29946,
29892,
29871,
29896,
29892,
29871,
29896,
29946,
29892,
29871,
29947,
29892,
29871,
29896,
29941,
29892,
29871,
29953,
29892,
29871,
29906,
29892,
29871,
29896,
29896,
29892,
29871,
29896,
29945,
29892,
29871,
29896,
29906,
29892,
29871,
29929,
29892,
29871,
29955,
29892,
29871,
29941,
29892,
29871,
29896,
29900,
29892,
29871,
29945,
29892,
29871,
29900,
1402,
13,
1678,
518,
29896,
29945,
29892,
29871,
29896,
29906,
29892,
29871,
29947,
29892,
29871,
29906,
29892,
29871,
29946,
29892,
29871,
29929,
29892,
29871,
29896,
29892,
29871,
29955,
29892,
29871,
29945,
29892,
29871,
29896,
29896,
29892,
29871,
29941,
29892,
29871,
29896,
29946,
29892,
29871,
29896,
29900,
29892,
29871,
29900,
29892,
29871,
29953,
29892,
29871,
29896,
29941,
1402,
13,
29962,
13,
1744,
29949,
29990,
29918,
29906,
353,
518,
13,
1678,
518,
29896,
29945,
29892,
29871,
29896,
29892,
29871,
29947,
29892,
29871,
29896,
29946,
29892,
29871,
29953,
29892,
29871,
29896,
29896,
29892,
29871,
29941,
29892,
29871,
29946,
29892,
29871,
29929,
29892,
29871,
29955,
29892,
29871,
29906,
29892,
29871,
29896,
29941,
29892,
29871,
29896,
29906,
29892,
29871,
29900,
29892,
29871,
29945,
29892,
29871,
29896,
29900,
1402,
13,
1678,
518,
29941,
29892,
29871,
29896,
29941,
29892,
29871,
29946,
29892,
29871,
29955,
29892,
29871,
29896,
29945,
29892,
29871,
29906,
29892,
29871,
29947,
29892,
29871,
29896,
29946,
29892,
29871,
29896,
29906,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29896,
29900,
29892,
29871,
29953,
29892,
29871,
29929,
29892,
29871,
29896,
29896,
29892,
29871,
29945,
1402,
13,
1678,
518,
29900,
29892,
29871,
29896,
29946,
29892,
29871,
29955,
29892,
29871,
29896,
29896,
29892,
29871,
29896,
29900,
29892,
29871,
29946,
29892,
29871,
29896,
29941,
29892,
29871,
29896,
29892,
29871,
29945,
29892,
29871,
29947,
29892,
29871,
29896,
29906,
29892,
29871,
29953,
29892,
29871,
29929,
29892,
29871,
29941,
29892,
29871,
29906,
29892,
29871,
29896,
29945,
1402,
13,
1678,
518,
29896,
29941,
29892,
29871,
29947,
29892,
29871,
29896,
29900,
29892,
29871,
29896,
29892,
29871,
29941,
29892,
29871,
29896,
29945,
29892,
29871,
29946,
29892,
29871,
29906,
29892,
29871,
29896,
29896,
29892,
29871,
29953,
29892,
29871,
29955,
29892,
29871,
29896,
29906,
29892,
29871,
29900,
29892,
29871,
29945,
29892,
29871,
29896,
29946,
29892,
29871,
29929,
1402,
13,
29962,
13,
1744,
29949,
29990,
29918,
29941,
353,
518,
13,
1678,
518,
29896,
29900,
29892,
29871,
29900,
29892,
29871,
29929,
29892,
29871,
29896,
29946,
29892,
29871,
29953,
29892,
29871,
29941,
29892,
29871,
29896,
29945,
29892,
29871,
29945,
29892,
29871,
29896,
29892,
29871,
29896,
29941,
29892,
29871,
29896,
29906,
29892,
29871,
29955,
29892,
29871,
29896,
29896,
29892,
29871,
29946,
29892,
29871,
29906,
29892,
29871,
29947,
1402,
13,
1678,
518,
29896,
29941,
29892,
29871,
29955,
29892,
29871,
29900,
29892,
29871,
29929,
29892,
29871,
29941,
29892,
29871,
29946,
29892,
29871,
29953,
29892,
29871,
29896,
29900,
29892,
29871,
29906,
29892,
29871,
29947,
29892,
29871,
29945,
29892,
29871,
29896,
29946,
29892,
29871,
29896,
29906,
29892,
29871,
29896,
29896,
29892,
29871,
29896,
29945,
29892,
29871,
29896,
1402,
13,
1678,
518,
29896,
29941,
29892,
29871,
29953,
29892,
29871,
29946,
29892,
29871,
29929,
29892,
29871,
29947,
29892,
29871,
29896,
29945,
29892,
29871,
29941,
29892,
29871,
29900,
29892,
29871,
29896,
29896,
29892,
29871,
29896,
29892,
29871,
29906,
29892,
29871,
29896,
29906,
29892,
29871,
29945,
29892,
29871,
29896,
29900,
29892,
29871,
29896,
29946,
29892,
29871,
29955,
1402,
13,
1678,
518,
29896,
29892,
29871,
29896,
29900,
29892,
29871,
29896,
29941,
29892,
29871,
29900,
29892,
29871,
29953,
29892,
29871,
29929,
29892,
29871,
29947,
29892,
29871,
29955,
29892,
29871,
29946,
29892,
29871,
29896,
29945,
29892,
29871,
29896,
29946,
29892,
29871,
29941,
29892,
29871,
29896,
29896,
29892,
29871,
29945,
29892,
29871,
29906,
29892,
29871,
29896,
29906,
1402,
13,
29962,
13,
1744,
29949,
29990,
29918,
29946,
353,
518,
13,
1678,
518,
29955,
29892,
29871,
29896,
29941,
29892,
29871,
29896,
29946,
29892,
29871,
29941,
29892,
29871,
29900,
29892,
29871,
29953,
29892,
29871,
29929,
29892,
29871,
29896,
29900,
29892,
29871,
29896,
29892,
29871,
29906,
29892,
29871,
29947,
29892,
29871,
29945,
29892,
29871,
29896,
29896,
29892,
29871,
29896,
29906,
29892,
29871,
29946,
29892,
29871,
29896,
29945,
1402,
13,
1678,
518,
29896,
29941,
29892,
29871,
29947,
29892,
29871,
29896,
29896,
29892,
29871,
29945,
29892,
29871,
29953,
29892,
29871,
29896,
29945,
29892,
29871,
29900,
29892,
29871,
29941,
29892,
29871,
29946,
29892,
29871,
29955,
29892,
29871,
29906,
29892,
29871,
29896,
29906,
29892,
29871,
29896,
29892,
29871,
29896,
29900,
29892,
29871,
29896,
29946,
29892,
29871,
29929,
1402,
13,
1678,
518,
29896,
29900,
29892,
29871,
29953,
29892,
29871,
29929,
29892,
29871,
29900,
29892,
29871,
29896,
29906,
29892,
29871,
29896,
29896,
29892,
29871,
29955,
29892,
29871,
29896,
29941,
29892,
29871,
29896,
29945,
29892,
29871,
29896,
29892,
29871,
29941,
29892,
29871,
29896,
29946,
29892,
29871,
29945,
29892,
29871,
29906,
29892,
29871,
29947,
29892,
29871,
29946,
1402,
13,
1678,
518,
29941,
29892,
29871,
29896,
29945,
29892,
29871,
29900,
29892,
29871,
29953,
29892,
29871,
29896,
29900,
29892,
29871,
29896,
29892,
29871,
29896,
29941,
29892,
29871,
29947,
29892,
29871,
29929,
29892,
29871,
29946,
29892,
29871,
29945,
29892,
29871,
29896,
29896,
29892,
29871,
29896,
29906,
29892,
29871,
29955,
29892,
29871,
29906,
29892,
29871,
29896,
29946,
1402,
13,
29962,
13,
1744,
29949,
29990,
29918,
29945,
353,
518,
13,
1678,
518,
29906,
29892,
29871,
29896,
29906,
29892,
29871,
29946,
29892,
29871,
29896,
29892,
29871,
29955,
29892,
29871,
29896,
29900,
29892,
29871,
29896,
29896,
29892,
29871,
29953,
29892,
29871,
29947,
29892,
29871,
29945,
29892,
29871,
29941,
29892,
29871,
29896,
29945,
29892,
29871,
29896,
29941,
29892,
29871,
29900,
29892,
29871,
29896,
29946,
29892,
29871,
29929,
1402,
13,
1678,
518,
29896,
29946,
29892,
29871,
29896,
29896,
29892,
29871,
29906,
29892,
29871,
29896,
29906,
29892,
29871,
29946,
29892,
29871,
29955,
29892,
29871,
29896,
29941,
29892,
29871,
29896,
29892,
29871,
29945,
29892,
29871,
29900,
29892,
29871,
29896,
29945,
29892,
29871,
29896,
29900,
29892,
29871,
29941,
29892,
29871,
29929,
29892,
29871,
29947,
29892,
29871,
29953,
1402,
13,
1678,
518,
29946,
29892,
29871,
29906,
29892,
29871,
29896,
29892,
29871,
29896,
29896,
29892,
29871,
29896,
29900,
29892,
29871,
29896,
29941,
29892,
29871,
29955,
29892,
29871,
29947,
29892,
29871,
29896,
29945,
29892,
29871,
29929,
29892,
29871,
29896,
29906,
29892,
29871,
29945,
29892,
29871,
29953,
29892,
29871,
29941,
29892,
29871,
29900,
29892,
29871,
29896,
29946,
1402,
13,
1678,
518,
29896,
29896,
29892,
29871,
29947,
29892,
29871,
29896,
29906,
29892,
29871,
29955,
29892,
29871,
29896,
29892,
29871,
29896,
29946,
29892,
29871,
29906,
29892,
29871,
29896,
29941,
29892,
29871,
29953,
29892,
29871,
29896,
29945,
29892,
29871,
29900,
29892,
29871,
29929,
29892,
29871,
29896,
29900,
29892,
29871,
29946,
29892,
29871,
29945,
29892,
29871,
29941,
1402,
13,
29962,
13,
1744,
29949,
29990,
29918,
29953,
353,
518,
13,
1678,
518,
29896,
29906,
29892,
29871,
29896,
29892,
29871,
29896,
29900,
29892,
29871,
29896,
29945,
29892,
29871,
29929,
29892,
29871,
29906,
29892,
29871,
29953,
29892,
29871,
29947,
29892,
29871,
29900,
29892,
29871,
29896,
29941,
29892,
29871,
29941,
29892,
29871,
29946,
29892,
29871,
29896,
29946,
29892,
29871,
29955,
29892,
29871,
29945,
29892,
29871,
29896,
29896,
1402,
13,
1678,
518,
29896,
29900,
29892,
29871,
29896,
29945,
29892,
29871,
29946,
29892,
29871,
29906,
29892,
29871,
29955,
29892,
29871,
29896,
29906,
29892,
29871,
29929,
29892,
29871,
29945,
29892,
29871,
29953,
29892,
29871,
29896,
29892,
29871,
29896,
29941,
29892,
29871,
29896,
29946,
29892,
29871,
29900,
29892,
29871,
29896,
29896,
29892,
29871,
29941,
29892,
29871,
29947,
1402,
13,
1678,
518,
29929,
29892,
29871,
29896,
29946,
29892,
29871,
29896,
29945,
29892,
29871,
29945,
29892,
29871,
29906,
29892,
29871,
29947,
29892,
29871,
29896,
29906,
29892,
29871,
29941,
29892,
29871,
29955,
29892,
29871,
29900,
29892,
29871,
29946,
29892,
29871,
29896,
29900,
29892,
29871,
29896,
29892,
29871,
29896,
29941,
29892,
29871,
29896,
29896,
29892,
29871,
29953,
1402,
13,
1678,
518,
29946,
29892,
29871,
29941,
29892,
29871,
29906,
29892,
29871,
29896,
29906,
29892,
29871,
29929,
29892,
29871,
29945,
29892,
29871,
29896,
29945,
29892,
29871,
29896,
29900,
29892,
29871,
29896,
29896,
29892,
29871,
29896,
29946,
29892,
29871,
29896,
29892,
29871,
29955,
29892,
29871,
29953,
29892,
29871,
29900,
29892,
29871,
29947,
29892,
29871,
29896,
29941,
1402,
13,
29962,
13,
1744,
29949,
29990,
29918,
29955,
353,
518,
13,
1678,
518,
29946,
29892,
29871,
29896,
29896,
29892,
29871,
29906,
29892,
29871,
29896,
29946,
29892,
29871,
29896,
29945,
29892,
29871,
29900,
29892,
29871,
29947,
29892,
29871,
29896,
29941,
29892,
29871,
29941,
29892,
29871,
29896,
29906,
29892,
29871,
29929,
29892,
29871,
29955,
29892,
29871,
29945,
29892,
29871,
29896,
29900,
29892,
29871,
29953,
29892,
29871,
29896,
1402,
13,
1678,
518,
29896,
29941,
29892,
29871,
29900,
29892,
29871,
29896,
29896,
29892,
29871,
29955,
29892,
29871,
29946,
29892,
29871,
29929,
29892,
29871,
29896,
29892,
29871,
29896,
29900,
29892,
29871,
29896,
29946,
29892,
29871,
29941,
29892,
29871,
29945,
29892,
29871,
29896,
29906,
29892,
29871,
29906,
29892,
29871,
29896,
29945,
29892,
29871,
29947,
29892,
29871,
29953,
1402,
13,
1678,
518,
29896,
29892,
29871,
29946,
29892,
29871,
29896,
29896,
29892,
29871,
29896,
29941,
29892,
29871,
29896,
29906,
29892,
29871,
29941,
29892,
29871,
29955,
29892,
29871,
29896,
29946,
29892,
29871,
29896,
29900,
29892,
29871,
29896,
29945,
29892,
29871,
29953,
29892,
29871,
29947,
29892,
29871,
29900,
29892,
29871,
29945,
29892,
29871,
29929,
29892,
29871,
29906,
1402,
13,
1678,
518,
29953,
29892,
29871,
29896,
29896,
29892,
29871,
29896,
29941,
29892,
29871,
29947,
29892,
29871,
29896,
29892,
29871,
29946,
29892,
29871,
29896,
29900,
29892,
29871,
29955,
29892,
29871,
29929,
29892,
29871,
29945,
29892,
29871,
29900,
29892,
29871,
29896,
29945,
29892,
29871,
29896,
29946,
29892,
29871,
29906,
29892,
29871,
29941,
29892,
29871,
29896,
29906,
1402,
13,
29962,
13,
1744,
29949,
29990,
29918,
29947,
353,
518,
13,
1678,
518,
29896,
29941,
29892,
29871,
29906,
29892,
29871,
29947,
29892,
29871,
29946,
29892,
29871,
29953,
29892,
29871,
29896,
29945,
29892,
29871,
29896,
29896,
29892,
29871,
29896,
29892,
29871,
29896,
29900,
29892,
29871,
29929,
29892,
29871,
29941,
29892,
29871,
29896,
29946,
29892,
29871,
29945,
29892,
29871,
29900,
29892,
29871,
29896,
29906,
29892,
29871,
29955,
1402,
13,
1678,
518,
29896,
29892,
29871,
29896,
29945,
29892,
29871,
29896,
29941,
29892,
29871,
29947,
29892,
29871,
29896,
29900,
29892,
29871,
29941,
29892,
29871,
29955,
29892,
29871,
29946,
29892,
29871,
29896,
29906,
29892,
29871,
29945,
29892,
29871,
29953,
29892,
29871,
29896,
29896,
29892,
29871,
29900,
29892,
29871,
29896,
29946,
29892,
29871,
29929,
29892,
29871,
29906,
1402,
13,
1678,
518,
29955,
29892,
29871,
29896,
29896,
29892,
29871,
29946,
29892,
29871,
29896,
29892,
29871,
29929,
29892,
29871,
29896,
29906,
29892,
29871,
29896,
29946,
29892,
29871,
29906,
29892,
29871,
29900,
29892,
29871,
29953,
29892,
29871,
29896,
29900,
29892,
29871,
29896,
29941,
29892,
29871,
29896,
29945,
29892,
29871,
29941,
29892,
29871,
29945,
29892,
29871,
29947,
1402,
13,
1678,
518,
29906,
29892,
29871,
29896,
29892,
29871,
29896,
29946,
29892,
29871,
29955,
29892,
29871,
29946,
29892,
29871,
29896,
29900,
29892,
29871,
29947,
29892,
29871,
29896,
29941,
29892,
29871,
29896,
29945,
29892,
29871,
29896,
29906,
29892,
29871,
29929,
29892,
29871,
29900,
29892,
29871,
29941,
29892,
29871,
29945,
29892,
29871,
29953,
29892,
29871,
29896,
29896,
1402,
13,
29962,
13,
1744,
29949,
29990,
2890,
353,
518,
1744,
29949,
29990,
29918,
29896,
29892,
317,
8456,
29990,
29918,
29906,
29892,
317,
8456,
29990,
29918,
29941,
29892,
317,
8456,
29990,
29918,
29946,
29892,
317,
8456,
29990,
29918,
29945,
29892,
317,
8456,
29990,
29918,
29953,
29892,
317,
8456,
29990,
29918,
29955,
29892,
317,
8456,
29990,
29918,
29947,
29962,
13,
13,
29937,
1128,
1568,
278,
2175,
322,
1492,
1820,
8870,
1960,
526,
9500,
287,
1432,
4513,
29889,
13,
10818,
29918,
7068,
6545,
29911,
29918,
5194,
29949,
3904,
9375,
353,
518,
29896,
29892,
29871,
29896,
29892,
29871,
29906,
29892,
29871,
29906,
29892,
29871,
29906,
29892,
29871,
29906,
29892,
29871,
29906,
29892,
29871,
29906,
29892,
29871,
29896,
29892,
29871,
29906,
29892,
29871,
29906,
29892,
29871,
29906,
29892,
29871,
29906,
29892,
29871,
29906,
29892,
29871,
29906,
29892,
29871,
29896,
29962,
13,
2
] |
src/tests/assembly/structured_config/assembled_config/test_assembled_config.py | fabio-d/fuchsia-stardock | 5 | 29848 | <gh_stars>1-10
# Copyright 2022 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import argparse
import pathlib
import subprocess
import sys
from run_assembly import run_product_assembly
def main():
parser = argparse.ArgumentParser(
description=
"Ensure that ffx assembly product adds structured config with the right ffx config."
)
parser.add_argument(
"--ffx-bin",
type=pathlib.Path,
required=True,
help="Path to ffx binary.")
parser.add_argument(
"--product-assembly-config",
type=pathlib.Path,
required=True,
help="Path to product assembly configuration input.")
parser.add_argument(
"--input-bundles-dir",
type=pathlib.Path,
required=True,
help="Path to input bundles directory.")
parser.add_argument(
"--outdir",
type=pathlib.Path,
required=True,
help="Path to output directory.")
parser.add_argument(
"--stamp",
type=pathlib.Path,
required=True,
help="Path to stampfile for telling ninja we're done.")
args = parser.parse_args()
output = run_product_assembly(
ffx_bin=args.ffx_bin,
product=args.product_assembly_config,
input_bundles=args.input_bundles_dir,
outdir=args.outdir,
extra_config=["assembly_example_enabled=true"])
output.check_returncode()
with open(args.stamp, 'w') as f:
pass # creates the file
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
29937,
14187,
1266,
29871,
29906,
29900,
29906,
29906,
450,
383,
19873,
423,
13189,
943,
29889,
2178,
10462,
21676,
29889,
13,
29937,
4803,
310,
445,
2752,
775,
338,
4095,
287,
491,
263,
350,
7230,
29899,
3293,
19405,
393,
508,
367,
13,
29937,
1476,
297,
278,
365,
2965,
1430,
1660,
934,
29889,
13,
13,
5215,
1852,
5510,
13,
5215,
2224,
1982,
13,
5215,
1014,
5014,
13,
5215,
10876,
13,
13,
3166,
1065,
29918,
26936,
1053,
1065,
29918,
4704,
29918,
26936,
13,
13,
13,
1753,
1667,
7295,
13,
1678,
13812,
353,
1852,
5510,
29889,
15730,
11726,
29898,
13,
4706,
6139,
29922,
13,
4706,
376,
29923,
1983,
545,
393,
285,
11093,
11470,
3234,
12778,
2281,
2955,
2295,
411,
278,
1492,
285,
11093,
2295,
1213,
13,
1678,
1723,
13,
1678,
13812,
29889,
1202,
29918,
23516,
29898,
13,
4706,
376,
489,
600,
29916,
29899,
2109,
613,
13,
4706,
1134,
29922,
2084,
1982,
29889,
2605,
29892,
13,
4706,
3734,
29922,
5574,
29892,
13,
4706,
1371,
543,
2605,
304,
285,
11093,
7581,
23157,
13,
1678,
13812,
29889,
1202,
29918,
23516,
29898,
13,
4706,
376,
489,
4704,
29899,
26936,
29899,
2917,
613,
13,
4706,
1134,
29922,
2084,
1982,
29889,
2605,
29892,
13,
4706,
3734,
29922,
5574,
29892,
13,
4706,
1371,
543,
2605,
304,
3234,
11470,
5285,
1881,
23157,
13,
1678,
13812,
29889,
1202,
29918,
23516,
29898,
13,
4706,
376,
489,
2080,
29899,
16293,
793,
29899,
3972,
613,
13,
4706,
1134,
29922,
2084,
1982,
29889,
2605,
29892,
13,
4706,
3734,
29922,
5574,
29892,
13,
4706,
1371,
543,
2605,
304,
1881,
22813,
793,
3884,
23157,
13,
1678,
13812,
29889,
1202,
29918,
23516,
29898,
13,
4706,
376,
489,
449,
3972,
613,
13,
4706,
1134,
29922,
2084,
1982,
29889,
2605,
29892,
13,
4706,
3734,
29922,
5574,
29892,
13,
4706,
1371,
543,
2605,
304,
1962,
3884,
23157,
13,
1678,
13812,
29889,
1202,
29918,
23516,
29898,
13,
4706,
376,
489,
303,
1160,
613,
13,
4706,
1134,
29922,
2084,
1982,
29889,
2605,
29892,
13,
4706,
3734,
29922,
5574,
29892,
13,
4706,
1371,
543,
2605,
304,
25214,
1445,
363,
14509,
17081,
1764,
591,
29915,
276,
2309,
23157,
13,
1678,
6389,
353,
13812,
29889,
5510,
29918,
5085,
580,
13,
13,
1678,
1962,
353,
1065,
29918,
4704,
29918,
26936,
29898,
13,
4706,
285,
11093,
29918,
2109,
29922,
5085,
29889,
600,
29916,
29918,
2109,
29892,
13,
4706,
3234,
29922,
5085,
29889,
4704,
29918,
26936,
29918,
2917,
29892,
13,
4706,
1881,
29918,
16293,
793,
29922,
5085,
29889,
2080,
29918,
16293,
793,
29918,
3972,
29892,
13,
4706,
714,
3972,
29922,
5085,
29889,
449,
3972,
29892,
13,
4706,
4805,
29918,
2917,
29922,
3366,
26936,
29918,
4773,
29918,
17590,
29922,
3009,
20068,
13,
1678,
1962,
29889,
3198,
29918,
2457,
401,
580,
13,
1678,
411,
1722,
29898,
5085,
29889,
303,
1160,
29892,
525,
29893,
1495,
408,
285,
29901,
13,
4706,
1209,
29871,
396,
10017,
278,
934,
13,
2
] |
wflow-water-index/wflow-water-index.py | Fondus/Fondus-Python-SDK | 0 | 26305 | <filename>wflow-water-index/wflow-water-index.py
import argparse
import datetime
import math
from netCDF4 import Dataset
import numpy as np
import threading
import queue
# Worker 類別,負責處理資料
class Worker(threading.Thread):
def __init__(self, req, res, num):
threading.Thread.__init__(self)
self.req = req
self.res = res
self.num = num
self.running = True
def run(self):
while self.running or not self.req.empty():
try:
data = self.req.get(timeout=1)
x, y, cx, cy, array = data
res.put((x, y, np.max(array), np.count_nonzero(array > 0.01)))
req.task_done()
# print("Worker %d: %f,%f" % (self.num, x, y))
except queue.Empty:
print("Worker %d: Nothing to do, wait 1 second" % (self.num))
def stop(self):
self.running = False
def get_range(v, low, high):
dim = v.get_dims()[0].size
d = (v[1]-v[0])/2
i0 = None
i1 = dim
for i in range(0, dim):
if i0 is None and v[i]+d >= low:
i0 = i
if v[i]-d <= high:
i1 = i
if not i0:
i0 = 0
return [i0, i1]
def get_skip_index(v_time):
dim = v_time.get_dims()[0].size
n0 = v_time[0]
for i in range(1, dim):
if (v_time[i] - n0) >= 1440:
return i
return 0
parser = argparse.ArgumentParser()
parser.add_argument("--input", help="source NC filename")
parser.add_argument("--output", help="output XYM ascii filename")
parser.add_argument(
"--bbox", help="bounding box to filter grids, format as x1,y1,x2,y2")
parser.add_argument(
"--skip", help="skip data of first N steps when model is warming up, default = 24 hour")
args = parser.parse_args()
input_filename = args.input if args.input else "wflow.nc"
print("Input file:", input_filename)
output_filename = args.output if args.output else "flow.asc"
print("Output file:", output_filename)
bbox = list(map(lambda s: float(s), args.bbox.split(','))
) if args.bbox else [-180.0, -90.0, 180, 90.0]
print("Bounding box:", bbox)
wflow = Dataset(input_filename, "r")
print("NETCDF metadata")
# print(wflow.dimensions)
# print(wflow.variables)
v_time = wflow.variables['time']
# print(v_time[:])
skip = args.skip if args.skip else get_skip_index(v_time)
print("Will skip first", skip, "steps")
v_lon = wflow.variables['x']
v_lat = wflow.variables['y']
dx = (v_lon[1]-v_lon[0])/2
dy = (v_lat[1]-v_lat[0])/2
lon_range = get_range(v_lon, bbox[0], bbox[2])
lat_range = get_range(v_lat, bbox[1], bbox[3])
v_data = wflow.variables['flow_simulated']
print("Loading data...")
# cache all data in memory
time = v_time[:]
lon = v_lon[:]
lat = v_lat[:]
data = v_data[:, lat_range[0]:lat_range[1], lon_range[0]:lon_range[1]]
print("Start processing...")
dim_t = wflow.dimensions['time'].size
tt = dim_t - skip
max_v = np.empty([lon.size, lat.size])
count_0_01_v = np.empty([lon.size, lat.size])
progress = dict(processed=0, queued=0, total_grid=(
lon_range[1]-lon_range[0])*(lat_range[1]-lat_range[0]))
# prepare for multithread
req = queue.Queue()
res = queue.Queue()
workers = [Worker(req, res, 1), Worker(req, res, 2)]
for i in range(0, len(workers)):
workers[i].start()
def processing_res():
while workers[0].is_alive() or workers[1].is_alive() or not res.empty():
try:
result = res.get(timeout=1)
(x, y, m, c) = result
max_v[x, y] = m
count_0_01_v[x, y] = 1.0 * c / tt
progress["processed"] += 1
res.task_done()
except queue.Empty:
print("Response worker: Nothing to do, wait 1 second")
if (progress["processed"] % 1000 == 0):
print("processed:", progress)
print("processed:", progress)
threading.Thread(target=processing_res, daemon=True).start()
for x in range(lon_range[0], lon_range[1]):
cx = lon[x]
print(cx, "queued:", progress)
for y in range(lat_range[0], lat_range[1]):
cy = lat[y]
id = 'x'+f'{cx:.4f}'+'y'+f'{cy:.4f}'
vt = np.array(data[skip:dim_t, y, x])
req.put((x, y, cx, cy, vt))
progress["queued"] += 1
# max_v[x,y]=np.max(vt)
# count_0_1_v=np.count_nonzero(vt>0.01)
wflow.close()
for i in range(0, len(workers)):
workers[i].stop()
for i in range(0, len(workers)):
workers[i].join()
res.join()
print("grid with flow value: ",np.count_nonzero(max_v > 0))
print("count with flow value: ",np.count_nonzero(count_0_01_v > 0))
with open(output_filename, 'w') as out_file:
for x in range(lon_range[0], lon_range[1]):
cx = lon[x]
for y in range(lat_range[0], lat_range[1]):
cy = lat[y]
m = max_v[x, y]
c = count_0_01_v[x, y]
if m > 0 or c > 0:
out_file.write("%f,%f,%f,%f\n" % (cx, cy, m, c))
| [
1,
529,
9507,
29958,
29893,
1731,
29899,
13405,
29899,
2248,
29914,
29893,
1731,
29899,
13405,
29899,
2248,
29889,
2272,
13,
5215,
1852,
5510,
13,
5215,
12865,
13,
5215,
5844,
13,
3166,
7787,
29907,
4037,
29946,
1053,
13373,
24541,
13,
5215,
12655,
408,
7442,
13,
5215,
3244,
292,
13,
5215,
9521,
13,
13,
29937,
5244,
261,
29871,
236,
164,
161,
31661,
30214,
235,
181,
163,
235,
181,
175,
235,
156,
152,
30687,
235,
182,
138,
31949,
13,
13,
13,
1990,
5244,
261,
29898,
7097,
292,
29889,
4899,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
12428,
29892,
620,
29892,
954,
1125,
13,
4706,
3244,
292,
29889,
4899,
17255,
2344,
12035,
1311,
29897,
13,
4706,
1583,
29889,
7971,
353,
12428,
13,
4706,
1583,
29889,
690,
353,
620,
13,
4706,
1583,
29889,
1949,
353,
954,
13,
4706,
1583,
29889,
21094,
353,
5852,
13,
13,
1678,
822,
1065,
29898,
1311,
1125,
13,
4706,
1550,
1583,
29889,
21094,
470,
451,
1583,
29889,
7971,
29889,
6310,
7295,
13,
9651,
1018,
29901,
13,
18884,
848,
353,
1583,
29889,
7971,
29889,
657,
29898,
15619,
29922,
29896,
29897,
13,
18884,
921,
29892,
343,
29892,
28232,
29892,
5094,
29892,
1409,
353,
848,
13,
18884,
620,
29889,
649,
3552,
29916,
29892,
343,
29892,
7442,
29889,
3317,
29898,
2378,
511,
7442,
29889,
2798,
29918,
5464,
9171,
29898,
2378,
1405,
29871,
29900,
29889,
29900,
29896,
4961,
13,
18884,
12428,
29889,
7662,
29918,
15091,
580,
13,
18884,
396,
1596,
703,
16164,
1273,
29881,
29901,
1273,
29888,
24163,
29888,
29908,
1273,
313,
1311,
29889,
1949,
29892,
921,
29892,
343,
876,
13,
9651,
5174,
9521,
29889,
8915,
29901,
13,
18884,
1596,
703,
16164,
1273,
29881,
29901,
9531,
304,
437,
29892,
4480,
29871,
29896,
1473,
29908,
1273,
313,
1311,
29889,
1949,
876,
13,
13,
1678,
822,
5040,
29898,
1311,
1125,
13,
4706,
1583,
29889,
21094,
353,
7700,
13,
13,
13,
1753,
679,
29918,
3881,
29898,
29894,
29892,
4482,
29892,
1880,
1125,
13,
1678,
3964,
353,
325,
29889,
657,
29918,
6229,
29879,
580,
29961,
29900,
1822,
2311,
13,
1678,
270,
353,
313,
29894,
29961,
29896,
29962,
29899,
29894,
29961,
29900,
2314,
29914,
29906,
13,
1678,
474,
29900,
353,
6213,
13,
1678,
474,
29896,
353,
3964,
13,
1678,
363,
474,
297,
3464,
29898,
29900,
29892,
3964,
1125,
13,
4706,
565,
474,
29900,
338,
6213,
322,
325,
29961,
29875,
10062,
29881,
6736,
4482,
29901,
13,
9651,
474,
29900,
353,
474,
13,
4706,
565,
325,
29961,
29875,
29962,
29899,
29881,
5277,
1880,
29901,
13,
9651,
474,
29896,
353,
474,
13,
1678,
565,
451,
474,
29900,
29901,
13,
4706,
474,
29900,
353,
29871,
29900,
13,
1678,
736,
518,
29875,
29900,
29892,
474,
29896,
29962,
13,
13,
13,
1753,
679,
29918,
11014,
29918,
2248,
29898,
29894,
29918,
2230,
1125,
13,
1678,
3964,
353,
325,
29918,
2230,
29889,
657,
29918,
6229,
29879,
580,
29961,
29900,
1822,
2311,
13,
1678,
302,
29900,
353,
325,
29918,
2230,
29961,
29900,
29962,
13,
1678,
363,
474,
297,
3464,
29898,
29896,
29892,
3964,
1125,
13,
4706,
565,
313,
29894,
29918,
2230,
29961,
29875,
29962,
448,
302,
29900,
29897,
6736,
29871,
29896,
29946,
29946,
29900,
29901,
13,
9651,
736,
474,
13,
1678,
736,
29871,
29900,
13,
13,
13,
16680,
353,
1852,
5510,
29889,
15730,
11726,
580,
13,
16680,
29889,
1202,
29918,
23516,
703,
489,
2080,
613,
1371,
543,
4993,
25166,
10422,
1159,
13,
16680,
29889,
1202,
29918,
23516,
703,
489,
4905,
613,
1371,
543,
4905,
1060,
29979,
29924,
408,
18869,
10422,
1159,
13,
16680,
29889,
1202,
29918,
23516,
29898,
13,
1678,
376,
489,
29890,
1884,
613,
1371,
543,
9917,
292,
3800,
304,
4175,
867,
4841,
29892,
3402,
408,
921,
29896,
29892,
29891,
29896,
29892,
29916,
29906,
29892,
29891,
29906,
1159,
13,
16680,
29889,
1202,
29918,
23516,
29898,
13,
1678,
376,
489,
11014,
613,
1371,
543,
11014,
848,
310,
937,
405,
6576,
746,
1904,
338,
1370,
4056,
701,
29892,
2322,
353,
29871,
29906,
29946,
7234,
1159,
13,
5085,
353,
13812,
29889,
5510,
29918,
5085,
580,
13,
13,
2080,
29918,
9507,
353,
6389,
29889,
2080,
565,
6389,
29889,
2080,
1683,
376,
29893,
1731,
29889,
17608,
29908,
13,
2158,
703,
4290,
934,
29901,
613,
1881,
29918,
9507,
29897,
13,
4905,
29918,
9507,
353,
6389,
29889,
4905,
565,
6389,
29889,
4905,
1683,
376,
1731,
29889,
6151,
29908,
13,
2158,
703,
6466,
934,
29901,
613,
1962,
29918,
9507,
29897,
13,
13,
29890,
1884,
353,
1051,
29898,
1958,
29898,
2892,
269,
29901,
5785,
29898,
29879,
511,
6389,
29889,
29890,
1884,
29889,
5451,
29898,
3788,
876,
13,
9651,
1723,
565,
6389,
29889,
29890,
1884,
1683,
21069,
29896,
29947,
29900,
29889,
29900,
29892,
448,
29929,
29900,
29889,
29900,
29892,
29871,
29896,
29947,
29900,
29892,
29871,
29929,
29900,
29889,
29900,
29962,
13,
2158,
703,
29933,
12449,
3800,
29901,
613,
289,
1884,
29897,
13,
13,
29893,
1731,
353,
13373,
24541,
29898,
2080,
29918,
9507,
29892,
376,
29878,
1159,
13,
13,
2158,
703,
6006,
29907,
4037,
15562,
1159,
13,
29937,
1596,
29898,
29893,
1731,
29889,
6229,
5580,
29897,
13,
29937,
1596,
29898,
29893,
1731,
29889,
20897,
29897,
13,
13,
29894,
29918,
2230,
353,
281,
1731,
29889,
20897,
1839,
2230,
2033,
13,
29937,
1596,
29898,
29894,
29918,
2230,
7503,
2314,
13,
11014,
353,
6389,
29889,
11014,
565,
6389,
29889,
11014,
1683,
679,
29918,
11014,
29918,
2248,
29898,
29894,
29918,
2230,
29897,
13,
2158,
703,
12984,
14383,
937,
613,
14383,
29892,
376,
24530,
1159,
13,
13,
29894,
29918,
12957,
353,
281,
1731,
29889,
20897,
1839,
29916,
2033,
13,
29894,
29918,
5066,
353,
281,
1731,
29889,
20897,
1839,
29891,
2033,
13,
13,
8235,
353,
313,
29894,
29918,
12957,
29961,
29896,
29962,
29899,
29894,
29918,
12957,
29961,
29900,
2314,
29914,
29906,
13,
4518,
353,
313,
29894,
29918,
5066,
29961,
29896,
29962,
29899,
29894,
29918,
5066,
29961,
29900,
2314,
29914,
29906,
13,
13,
12957,
29918,
3881,
353,
679,
29918,
3881,
29898,
29894,
29918,
12957,
29892,
289,
1884,
29961,
29900,
1402,
289,
1884,
29961,
29906,
2314,
13,
5066,
29918,
3881,
353,
679,
29918,
3881,
29898,
29894,
29918,
5066,
29892,
289,
1884,
29961,
29896,
1402,
289,
1884,
29961,
29941,
2314,
13,
13,
29894,
29918,
1272,
353,
281,
1731,
29889,
20897,
1839,
1731,
29918,
3601,
7964,
2033,
13,
13,
2158,
703,
23456,
848,
856,
1159,
13,
29937,
7090,
599,
848,
297,
3370,
13,
2230,
353,
325,
29918,
2230,
7503,
29962,
13,
12957,
353,
325,
29918,
12957,
7503,
29962,
13,
5066,
353,
325,
29918,
5066,
7503,
29962,
13,
1272,
353,
325,
29918,
1272,
7503,
29892,
3405,
29918,
3881,
29961,
29900,
5387,
5066,
29918,
3881,
29961,
29896,
1402,
23123,
29918,
3881,
29961,
29900,
5387,
12957,
29918,
3881,
29961,
29896,
5262,
13,
13,
2158,
703,
4763,
9068,
856,
1159,
13,
6229,
29918,
29873,
353,
281,
1731,
29889,
6229,
5580,
1839,
2230,
13359,
2311,
13,
13,
698,
353,
3964,
29918,
29873,
448,
14383,
13,
13,
3317,
29918,
29894,
353,
7442,
29889,
6310,
4197,
12957,
29889,
2311,
29892,
3405,
29889,
2311,
2314,
13,
2798,
29918,
29900,
29918,
29900,
29896,
29918,
29894,
353,
7442,
29889,
6310,
4197,
12957,
29889,
2311,
29892,
3405,
29889,
2311,
2314,
13,
13,
18035,
353,
9657,
29898,
5014,
287,
29922,
29900,
29892,
712,
6742,
29922,
29900,
29892,
3001,
29918,
7720,
7607,
13,
1678,
23123,
29918,
3881,
29961,
29896,
29962,
29899,
12957,
29918,
3881,
29961,
29900,
2314,
16395,
5066,
29918,
3881,
29961,
29896,
29962,
29899,
5066,
29918,
3881,
29961,
29900,
12622,
13,
13,
29937,
19012,
363,
1773,
389,
949,
13,
7971,
353,
9521,
29889,
10620,
580,
13,
690,
353,
9521,
29889,
10620,
580,
13,
1287,
414,
353,
518,
16164,
29898,
7971,
29892,
620,
29892,
29871,
29896,
511,
5244,
261,
29898,
7971,
29892,
620,
29892,
29871,
29906,
4638,
13,
1454,
474,
297,
3464,
29898,
29900,
29892,
7431,
29898,
1287,
414,
22164,
13,
1678,
17162,
29961,
29875,
1822,
2962,
580,
13,
13,
13,
1753,
9068,
29918,
690,
7295,
13,
1678,
1550,
17162,
29961,
29900,
1822,
275,
29918,
284,
573,
580,
470,
17162,
29961,
29896,
1822,
275,
29918,
284,
573,
580,
470,
451,
620,
29889,
6310,
7295,
13,
4706,
1018,
29901,
13,
9651,
1121,
353,
620,
29889,
657,
29898,
15619,
29922,
29896,
29897,
13,
9651,
313,
29916,
29892,
343,
29892,
286,
29892,
274,
29897,
353,
1121,
13,
9651,
4236,
29918,
29894,
29961,
29916,
29892,
343,
29962,
353,
286,
13,
9651,
2302,
29918,
29900,
29918,
29900,
29896,
29918,
29894,
29961,
29916,
29892,
343,
29962,
353,
29871,
29896,
29889,
29900,
334,
274,
847,
260,
29873,
13,
9651,
6728,
3366,
5014,
287,
3108,
4619,
29871,
29896,
13,
9651,
620,
29889,
7662,
29918,
15091,
580,
13,
4706,
5174,
9521,
29889,
8915,
29901,
13,
9651,
1596,
703,
5103,
15645,
29901,
9531,
304,
437,
29892,
4480,
29871,
29896,
1473,
1159,
13,
4706,
565,
313,
18035,
3366,
5014,
287,
3108,
1273,
29871,
29896,
29900,
29900,
29900,
1275,
29871,
29900,
1125,
13,
9651,
1596,
703,
5014,
287,
29901,
613,
6728,
29897,
13,
1678,
1596,
703,
5014,
287,
29901,
613,
6728,
29897,
13,
13,
13,
7097,
292,
29889,
4899,
29898,
5182,
29922,
19170,
29918,
690,
29892,
1146,
9857,
29922,
5574,
467,
2962,
580,
13,
13,
1454,
921,
297,
3464,
29898,
12957,
29918,
3881,
29961,
29900,
1402,
23123,
29918,
3881,
29961,
29896,
29962,
1125,
13,
1678,
28232,
353,
23123,
29961,
29916,
29962,
13,
1678,
1596,
29898,
18904,
29892,
376,
802,
6742,
29901,
613,
6728,
29897,
13,
1678,
363,
343,
297,
3464,
29898,
5066,
29918,
3881,
29961,
29900,
1402,
3405,
29918,
3881,
29961,
29896,
29962,
1125,
13,
4706,
5094,
353,
3405,
29961,
29891,
29962,
13,
4706,
1178,
353,
525,
29916,
18717,
29888,
29915,
29912,
18904,
29901,
29889,
29946,
29888,
10162,
23097,
29891,
18717,
29888,
29915,
29912,
1270,
29901,
29889,
29946,
29888,
10162,
13,
13,
4706,
325,
29873,
353,
7442,
29889,
2378,
29898,
1272,
29961,
11014,
29901,
6229,
29918,
29873,
29892,
343,
29892,
921,
2314,
13,
4706,
12428,
29889,
649,
3552,
29916,
29892,
343,
29892,
28232,
29892,
5094,
29892,
325,
29873,
876,
13,
4706,
6728,
3366,
802,
6742,
3108,
4619,
29871,
29896,
13,
29937,
4706,
4236,
29918,
29894,
29961,
29916,
29892,
29891,
13192,
9302,
29889,
3317,
29898,
21908,
29897,
13,
29937,
4706,
2302,
29918,
29900,
29918,
29896,
29918,
29894,
29922,
9302,
29889,
2798,
29918,
5464,
9171,
29898,
21908,
29958,
29900,
29889,
29900,
29896,
29897,
13,
29893,
1731,
29889,
5358,
580,
13,
13,
1454,
474,
297,
3464,
29898,
29900,
29892,
7431,
29898,
1287,
414,
22164,
13,
1678,
17162,
29961,
29875,
1822,
9847,
580,
13,
13,
1454,
474,
297,
3464,
29898,
29900,
29892,
7431,
29898,
1287,
414,
22164,
13,
1678,
17162,
29961,
29875,
1822,
7122,
580,
13,
13,
690,
29889,
7122,
580,
13,
13,
2158,
703,
7720,
411,
4972,
995,
29901,
9162,
9302,
29889,
2798,
29918,
5464,
9171,
29898,
3317,
29918,
29894,
1405,
29871,
29900,
876,
13,
2158,
703,
2798,
411,
4972,
995,
29901,
9162,
9302,
29889,
2798,
29918,
5464,
9171,
29898,
2798,
29918,
29900,
29918,
29900,
29896,
29918,
29894,
1405,
29871,
29900,
876,
13,
13,
2541,
1722,
29898,
4905,
29918,
9507,
29892,
525,
29893,
1495,
408,
714,
29918,
1445,
29901,
13,
1678,
363,
921,
297,
3464,
29898,
12957,
29918,
3881,
29961,
29900,
1402,
23123,
29918,
3881,
29961,
29896,
29962,
1125,
13,
4706,
28232,
353,
23123,
29961,
29916,
29962,
13,
4706,
363,
343,
297,
3464,
29898,
5066,
29918,
3881,
29961,
29900,
1402,
3405,
29918,
3881,
29961,
29896,
29962,
1125,
13,
9651,
5094,
353,
3405,
29961,
29891,
29962,
13,
9651,
286,
353,
4236,
29918,
29894,
29961,
29916,
29892,
343,
29962,
13,
9651,
274,
353,
2302,
29918,
29900,
29918,
29900,
29896,
29918,
29894,
29961,
29916,
29892,
343,
29962,
13,
9651,
565,
286,
1405,
29871,
29900,
470,
274,
1405,
29871,
29900,
29901,
13,
18884,
714,
29918,
1445,
29889,
3539,
11702,
29888,
24163,
29888,
24163,
29888,
24163,
29888,
29905,
29876,
29908,
1273,
313,
18904,
29892,
5094,
29892,
286,
29892,
274,
876,
13,
2
] |
parser_app/api/serializers.py | prantoamt/django-parser-app | 3 | 99187 | from rest_framework import serializers
from rest_framework import serializers
from rest_framework.fields import SkipField
from rest_framework.fields import ChoiceField
import six
from parser_app.models import RegisteredModel
class ChoiceDisplayField(ChoiceField):
def __init__(self, *args, **kwargs):
super(ChoiceDisplayField, self).__init__(*args, **kwargs)
self.choice_strings_to_display = {
six.text_type(key): value for key, value in self.choices.items()
}
def to_representation(self, value):
if value is None:
return value
return {
'value': self.choice_strings_to_values.get(six.text_type(value), value),
'name': self.choice_strings_to_display.get(six.text_type(value), value),
}
class DefaultModelSerializer(serializers.ModelSerializer):
serializer_choice_field = ChoiceDisplayField
class RegisteredModelSerializer(DefaultModelSerializer):
class Meta:
model = RegisteredModel
fields = '__all__'
class MappingErrorSerializer(serializers.Serializer):
detail = serializers.CharField(max_length=256, required=False)
model_columns = serializers.ListField(child=serializers.CharField())
file_columns = serializers.ListField(child=serializers.CharField())
required_fields = serializers.ListField(child=serializers.CharField())
foreign_key_fields = serializers.ListField(child=serializers.CharField())
class ValidationErrorSerializer(serializers.Serializer):
detail = serializers.ListField(child=serializers.JSONField()) | [
1,
515,
1791,
29918,
4468,
1053,
7797,
19427,
13,
3166,
1791,
29918,
4468,
1053,
7797,
19427,
13,
3166,
1791,
29918,
4468,
29889,
9621,
1053,
4971,
666,
3073,
13,
3166,
1791,
29918,
4468,
29889,
9621,
1053,
14542,
625,
3073,
13,
5215,
4832,
13,
3166,
13812,
29918,
932,
29889,
9794,
1053,
12577,
287,
3195,
13,
13,
13,
1990,
14542,
625,
9323,
3073,
29898,
29620,
3073,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
334,
5085,
29892,
3579,
19290,
1125,
13,
4706,
2428,
29898,
29620,
9323,
3073,
29892,
1583,
467,
1649,
2344,
1649,
10456,
5085,
29892,
3579,
19290,
29897,
13,
4706,
1583,
29889,
16957,
29918,
19651,
29918,
517,
29918,
4990,
353,
426,
13,
9651,
4832,
29889,
726,
29918,
1853,
29898,
1989,
1125,
995,
363,
1820,
29892,
995,
297,
1583,
29889,
1859,
1575,
29889,
7076,
580,
13,
4706,
500,
13,
13,
1678,
822,
304,
29918,
276,
26081,
29898,
1311,
29892,
995,
1125,
13,
4706,
565,
995,
338,
6213,
29901,
13,
9651,
736,
995,
13,
4706,
736,
426,
13,
9651,
525,
1767,
2396,
1583,
29889,
16957,
29918,
19651,
29918,
517,
29918,
5975,
29889,
657,
29898,
28319,
29889,
726,
29918,
1853,
29898,
1767,
511,
995,
511,
13,
9651,
525,
978,
2396,
1583,
29889,
16957,
29918,
19651,
29918,
517,
29918,
4990,
29889,
657,
29898,
28319,
29889,
726,
29918,
1853,
29898,
1767,
511,
995,
511,
13,
4706,
500,
13,
13,
13,
1990,
13109,
3195,
17679,
29898,
15550,
19427,
29889,
3195,
17679,
1125,
13,
1678,
7797,
3950,
29918,
16957,
29918,
2671,
353,
14542,
625,
9323,
3073,
13,
13,
13,
1990,
12577,
287,
3195,
17679,
29898,
4592,
3195,
17679,
1125,
13,
1678,
770,
20553,
29901,
13,
4706,
1904,
353,
12577,
287,
3195,
13,
4706,
4235,
353,
525,
1649,
497,
1649,
29915,
13,
13,
13,
1990,
341,
20304,
2392,
17679,
29898,
15550,
19427,
29889,
17679,
1125,
13,
1678,
9493,
353,
7797,
19427,
29889,
27890,
29898,
3317,
29918,
2848,
29922,
29906,
29945,
29953,
29892,
3734,
29922,
8824,
29897,
13,
1678,
1904,
29918,
13099,
353,
7797,
19427,
29889,
1293,
3073,
29898,
5145,
29922,
15550,
19427,
29889,
27890,
3101,
13,
1678,
934,
29918,
13099,
353,
7797,
19427,
29889,
1293,
3073,
29898,
5145,
29922,
15550,
19427,
29889,
27890,
3101,
13,
1678,
3734,
29918,
9621,
353,
7797,
19427,
29889,
1293,
3073,
29898,
5145,
29922,
15550,
19427,
29889,
27890,
3101,
13,
1678,
9117,
29918,
1989,
29918,
9621,
353,
7797,
19427,
29889,
1293,
3073,
29898,
5145,
29922,
15550,
19427,
29889,
27890,
3101,
13,
13,
1990,
15758,
362,
2392,
17679,
29898,
15550,
19427,
29889,
17679,
1125,
13,
1678,
9493,
353,
7797,
19427,
29889,
1293,
3073,
29898,
5145,
29922,
15550,
19427,
29889,
7249,
3073,
3101,
2
] |
glymur/lib/openjpeg.py | jarrelscy/glymur | 0 | 197350 | """Wraps library calls to openjpeg.
"""
import ctypes
import sys
from ..config import glymur_config
_, OPENJPEG = glymur_config()
# Maximum number of tile parts expected by JPWL: increase at your will
JPWL_MAX_NO_TILESPECS = 16
J2K_MAXRLVLS = 33 # Number of maximum resolution level authorized
PATH_LEN = 4096 # maximum allowed size for filenames
def version():
"""Wrapper for opj_version library routine."""
OPENJPEG.opj_version.restype = ctypes.c_char_p
library_version = OPENJPEG.opj_version()
if sys.hexversion >= 0x03000000:
return library_version.decode('utf-8')
else:
return library_version
# Need to get the minor version, make sure we are at least at 1.4.x
if OPENJPEG is not None:
_MINOR = version().split('.')[1]
else:
# Does not really matter. But version should not be called if there is no
# OpenJPEG library found.
_MINOR = 0
class EventMgrType(ctypes.Structure):
"""Message handler object.
Corresponds to event_mgr_t type in openjpeg headers.
"""
_fields_ = [("error_handler", ctypes.c_void_p),
("warning_handler", ctypes.c_void_p),
("info_handler", ctypes.c_void_p)]
class CommonStructType(ctypes.Structure):
"""Common fields between JPEG 2000 compression and decompression contextx.
"""
_fields_ = [("event_mgr", ctypes.POINTER(EventMgrType)),
("client_data", ctypes.c_void_p),
("is_decompressor", ctypes.c_bool),
("codec_format", ctypes.c_int),
("j2k_handle", ctypes.c_void_p),
("jp2_handle", ctypes.c_void_p),
("mj2_handle", ctypes.c_void_p)]
STREAM_READ = 0x0001 # The stream was opened for reading.
STREAM_WRITE = 0x0002 # The stream was opened for writing.
class CioType(ctypes.Structure):
"""Byte input-output stream (CIO)
Corresponds to cio_t in openjpeg headers.
"""
_fields_ = [("cinfo", ctypes.POINTER(CommonStructType)), # codec context
# STREAM_READ or STREAM_WRITE
("openmode", ctypes.c_int),
# pointer to start of buffer
("buffer", ctypes.POINTER(ctypes.c_char)),
# buffer size in bytes
("length", ctypes.c_int),
# pointer to start of stream
("start", ctypes.c_char_p),
# pointer to end of stream
("end", ctypes.c_char_p),
# pointer to current position
("bp", ctypes.c_char_p)]
class CompressionInfoType(CommonStructType):
"""Common fields between JPEG-2000 compression and decompression contexts.
This is for compression contexts. Corresponds to common_struct_t.
"""
pass
class PocType(ctypes.Structure):
"""Progression order changes."""
_fields_ = [("resno", ctypes.c_int),
# Resolution num start, Component num start, given by POC
("compno0", ctypes.c_int),
# Layer num end,Resolution num end, Component num end, given
# by POC
("layno1", ctypes.c_int),
("resno1", ctypes.c_int),
("compno1", ctypes.c_int),
# Layer num start,Precinct num start, Precinct num end
("layno0", ctypes.c_int),
("precno0", ctypes.c_int),
("precno1", ctypes.c_int),
# Progression order enum
# OPJ_PROG_ORDER prg1,prg;
("prg1", ctypes.c_int),
("prg", ctypes.c_int),
# Progression order string
# char progorder[5];
("progorder", ctypes.c_char * 5),
# Tile number
# int tile;
("tile", ctypes.c_int),
("tx0", ctypes.c_int),
("tx1", ctypes.c_int),
("ty0", ctypes.c_int),
("ty1", ctypes.c_int),
("layS", ctypes.c_int),
("resS", ctypes.c_int),
("compS", ctypes.c_int),
("prcS", ctypes.c_int),
("layE", ctypes.c_int),
("resE", ctypes.c_int),
("compE", ctypes.c_int),
("prcE", ctypes.c_int),
("txS", ctypes.c_int),
("txE", ctypes.c_int),
("tyS", ctypes.c_int),
("tyE", ctypes.c_int),
("dx", ctypes.c_int),
("dy", ctypes.c_int),
("lay_t", ctypes.c_int),
("res_t", ctypes.c_int),
("comp_t", ctypes.c_int),
("prc_t", ctypes.c_int),
("tx0_t", ctypes.c_int),
("ty0_t", ctypes.c_int)]
class CompressionParametersType(ctypes.Structure):
"""Compression parameters.
Corresponds to cparameters_t type in openjp2 headers.
"""
_fields_ = [
# size of tile:
# tile_size_on = false (not in argument) or
# = true (in argument)
("tile_size_on", ctypes.c_int),
# XTOsiz, YTOsiz
("cp_tx0", ctypes.c_int),
("cp_ty0", ctypes.c_int),
# XTsiz, YTsiz
("cp_tdx", ctypes.c_int),
("cp_tdy", ctypes.c_int),
# allocation by rate/distortion
("cp_disto_alloc", ctypes.c_int),
# allocation by fixed layer
("cp_fixed_alloc", ctypes.c_int),
# add fixed_quality
("cp_fixed_quality", ctypes.c_int),
# fixed layer
("cp_matrice", ctypes.c_void_p),
# comment for coding
("cp_comment", ctypes.c_char_p),
# csty : coding style
("csty", ctypes.c_int),
# progression order (default OPJ_LRCP)
("prog_order", ctypes.c_int),
# progression order changes
("poc", PocType * 32),
# number of progression order changes (POC), default to 0
("numpocs", ctypes.c_uint),
# number of layers
("tcp_numlayers", ctypes.c_int),
# rates of layers
("tcp_rates", ctypes.c_float * 100),
# different psnr for successive layers
("tcp_distoratio", ctypes.c_float * 100),
# number of resolutions
("numresolution", ctypes.c_int),
# initial code block width, default to 64
("cblockw_init", ctypes.c_int),
# initial code block height, default to 64
("cblockh_init", ctypes.c_int),
# mode switch (cblk_style)
("mode", ctypes.c_int),
# 1 : use the irreversible DWT 9-7
# 0 : use lossless compression (default)
("irreversible", ctypes.c_int),
# region of interest: affected component in [0..3], -1 means no ROI
("roi_compno", ctypes.c_int),
# region of interest: upshift value
("roi_shift", ctypes.c_int),
# number of precinct size specifications
("res_spec", ctypes.c_int),
# initial precinct width
("prcw_init", ctypes.c_int * J2K_MAXRLVLS),
# initial precinct height
("prch_init", ctypes.c_int * J2K_MAXRLVLS),
# input file name
("infile", ctypes.c_char * PATH_LEN),
# output file name
("outfile", ctypes.c_char * PATH_LEN),
# DEPRECATED.
("index_on", ctypes.c_int),
# DEPRECATED.
("index", ctypes.c_char * PATH_LEN),
# subimage encoding: origin image offset in x direction
# subimage encoding: origin image offset in y direction
("image_offset_x0", ctypes.c_int),
("image_offset_y0", ctypes.c_int),
# subsampling value for dx
# subsampling value for dy
("subsampling_dx", ctypes.c_int),
("subsampling_dy", ctypes.c_int),
# input file format 0: PGX, 1: PxM, 2: BMP 3:TIF
# output file format 0: J2K, 1: JP2, 2: JPT
("decod_format", ctypes.c_int),
("cod_format", ctypes.c_int),
# JPWL encoding parameters
# enables writing of EPC in MH, thus activating JPWL
("jpwl_epc_on", ctypes.c_int),
# error protection method for MH (0,1,16,32,37-128)
("jpwl_hprot_mh", ctypes.c_int),
# tile number of header protection specification (>=0)
("jpwl_hprot_tph_tileno", ctypes.c_int * JPWL_MAX_NO_TILESPECS),
# error protection methods for TPHs (0,1,16,32,37-128)
("jpwl_hprot_tph", ctypes.c_int * JPWL_MAX_NO_TILESPECS),
# tile number of packet protection specification (>=0)
("jpwl_pprot_tileno", ctypes.c_int * JPWL_MAX_NO_TILESPECS),
# packet number of packet protection specification (>=0)
("jpwl_pprot_packno", ctypes.c_int * JPWL_MAX_NO_TILESPECS),
# error protection methods for packets (0,1,16,32,37-128)
("jpwl_pprot", ctypes.c_int * JPWL_MAX_NO_TILESPECS),
# enables writing of ESD, (0=no/1/2 bytes)
("jpwl_sens_size", ctypes.c_int),
# sensitivity addressing size (0=auto/2/4 bytes)
("jpwl_sens_addr", ctypes.c_int),
# sensitivity range (0-3)
("jpwl_sens_range", ctypes.c_int),
# sensitivity method for MH (-1=no,0-7)
("jpwl_sens_mh", ctypes.c_int),
# tile number of sensitivity specification (>=0)
("jpwl_sens_tph_tileno", ctypes.c_int * JPWL_MAX_NO_TILESPECS),
# sensitivity methods for TPHs (-1=no,0-7)
("jpwl_sens_tph", ctypes.c_int * JPWL_MAX_NO_TILESPECS),
# Digital Cinema compliance 0-not compliant, 1-compliant
("cp_cinema", ctypes.c_int),
# Maximum rate for each component.
# If == 0, component size limitation is not considered
("max_comp_size", ctypes.c_int),
# Profile name
("cp_rsiz", ctypes.c_int),
# Tile part generation
("tp_on", ctypes.c_uint8),
# Flag for Tile part generation
("tp_flag", ctypes.c_uint8),
# MCT (multiple component transform)
("tcp_mct", ctypes.c_uint8),
# Enable JPIP indexing
("jpip_on", ctypes.c_int)]
class DecompressionInfoType(ctypes.Structure):
"""This is for decompression contexts.
Corresponds to dinfo_t type in openjpeg headers.
"""
pass
class DecompressionParametersType(ctypes.Structure):
"""Decompression parameters.
Corresponds to dparameters_t type in openjpeg headers.
"""
# cp_reduce: the number of highest resolution levels to be discarded
_fields_ = [("cp_reduce", ctypes.c_int),
# cp_layer: the maximum number of quality layers to decode
("cp_layer", ctypes.c_int),
# infile: input file name
("infile", ctypes.c_char * PATH_LEN),
# outfile: output file name
("outfile", ctypes.c_char * PATH_LEN),
# decod_format: input file format 0: J2K, 1: JP2, 2: JPT
("decod_format", ctypes.c_int),
# cod_format: output file format 0: PGX, 1: PxM, 2: BMP
("cod_format", ctypes.c_int),
# jpwl_correct: activates the JPWL correction capabilities
("jpwl_correct", ctypes.c_bool),
# jpwl_exp_comps: expected number of components
("jpwl_exp_comps", ctypes.c_int),
# jpwl_max_tiles: maximum number of tiles
("jpwl_max_tiles", ctypes.c_int),
# cp_limit_decoding: whether decoding should be done on the
# entire codestream or be limited to the main header
("cp_limit_decoding", ctypes.c_int)]
if _MINOR == '5':
_fields_.append(("flags", ctypes.c_uint))
class ImageComptParmType(ctypes.Structure):
"""Component parameters structure used by the opj_image_create function.
"""
_fields_ = [("dx", ctypes.c_int),
# XRsiz: horizontal separation of a sample of ith component
# with respect to the reference grid
# YRsiz: vertical separation of a sample of ith component with
# respect to the reference grid */
("dy", ctypes.c_int),
# data width, height
("w", ctypes.c_int),
("h", ctypes.c_int),
# x component offset compared to the whole image
# y component offset compared to the whole image
("x0", ctypes.c_int),
("y0", ctypes.c_int),
# precision
('prec', ctypes.c_int),
# image depth in bits
('bpp', ctypes.c_int),
# signed (1) / unsigned (0)
('sgnd', ctypes.c_int)]
class ImageCompType(ctypes.Structure):
"""Defines a single image component. """
_fields_ = [("dx", ctypes.c_int),
("dy", ctypes.c_int),
("w", ctypes.c_int),
("h", ctypes.c_int),
("x0", ctypes.c_int),
("y0", ctypes.c_int),
("prec", ctypes.c_int),
("bpp", ctypes.c_int),
("sgnd", ctypes.c_int),
("resno_decoded", ctypes.c_int),
("factor", ctypes.c_int),
("data", ctypes.POINTER(ctypes.c_int))]
class ImageType(ctypes.Structure):
"""Defines image data and characteristics.
Corresponds to image_t type in openjpeg headers.
"""
_fields_ = [("x0", ctypes.c_int),
("y0", ctypes.c_int),
("x1", ctypes.c_int),
("y1", ctypes.c_int),
("numcomps", ctypes.c_int),
("color_space", ctypes.c_int),
("comps", ctypes.POINTER(ImageCompType)),
("icc_profile_buf", ctypes.c_char_p),
("icc_profile_len", ctypes.c_int)]
def cio_open(cinfo, src=None):
"""Wrapper for openjpeg library function opj_cio_open."""
argtypes = [ctypes.POINTER(CommonStructType), ctypes.c_char_p,
ctypes.c_int]
OPENJPEG.opj_cio_open.argtypes = argtypes
OPENJPEG.opj_cio_open.restype = ctypes.POINTER(CioType)
if src is None:
length = 0
else:
length = len(src)
cio = OPENJPEG.opj_cio_open(ctypes.cast(cinfo,
ctypes.POINTER(CommonStructType)),
src,
length)
return cio
def cio_close(cio):
"""Wraps openjpeg library function cio_close.
"""
OPENJPEG.opj_cio_close.argtypes = [ctypes.POINTER(CioType)]
OPENJPEG.opj_cio_close(cio)
def cio_tell(cio):
"""Get position in byte stream."""
OPENJPEG.cio_tell.argtypes = [ctypes.POINTER(CioType)]
OPENJPEG.cio_tell.restype = ctypes.c_int
pos = OPENJPEG.cio_tell(cio)
return pos
def create_compress(fmt):
"""Wrapper for openjpeg library function opj_create_compress.
Creates a J2K/JPT/JP2 compression structure.
"""
OPENJPEG.opj_create_compress.argtypes = [ctypes.c_int]
OPENJPEG.opj_create_compress.restype = ctypes.POINTER(CompressionInfoType)
cinfo = OPENJPEG.opj_create_compress(fmt)
return cinfo
def create_decompress(fmt):
"""Wraps openjpeg library function opj_create_decompress.
"""
OPENJPEG.opj_create_decompress.argtypes = [ctypes.c_int]
restype = ctypes.POINTER(DecompressionInfoType)
OPENJPEG.opj_create_decompress.restype = restype
dinfo = OPENJPEG.opj_create_decompress(fmt)
return dinfo
def decode(dinfo, cio):
"""Wrapper for opj_decode.
"""
argtypes = [ctypes.POINTER(DecompressionInfoType), ctypes.POINTER(CioType)]
OPENJPEG.opj_decode.argtypes = argtypes
OPENJPEG.opj_decode.restype = ctypes.POINTER(ImageType)
image = OPENJPEG.opj_decode(dinfo, cio)
return image
def destroy_compress(cinfo):
"""Wrapper for openjpeg library function opj_destroy_compress.
Release resources for a compressor handle.
"""
argtypes = [ctypes.POINTER(CompressionInfoType)]
OPENJPEG.opj_destroy_compress.argtypes = argtypes
OPENJPEG.opj_destroy_compress(cinfo)
def encode(cinfo, cio, image):
"""Wrapper for openjpeg library function opj_encode.
Encodes an image into a JPEG-2000 codestream.
Parameters
----------
cinfo : compression handle
cio : output buffer stream
image : image to encode
"""
argtypes = [ctypes.POINTER(CompressionInfoType),
ctypes.POINTER(CioType),
ctypes.POINTER(ImageType)]
OPENJPEG.opj_encode.argtypes = argtypes
OPENJPEG.opj_encode.restype = ctypes.c_int
status = OPENJPEG.opj_encode(cinfo, cio, image)
return status
def destroy_decompress(dinfo):
"""Wraps openjpeg library function opj_destroy_decompress."""
argtypes = [ctypes.POINTER(DecompressionInfoType)]
OPENJPEG.opj_destroy_decompress.argtypes = argtypes
OPENJPEG.opj_destroy_decompress(dinfo)
def image_create(cmptparms, cspace):
"""Wrapper for openjpeg library function opj_image_create.
"""
lst = [ctypes.c_int, ctypes.POINTER(ImageComptParmType), ctypes.c_int]
OPENJPEG.opj_image_create.argtypes = lst
OPENJPEG.opj_image_create.restype = ctypes.POINTER(ImageType)
image = OPENJPEG.opj_image_create(len(cmptparms), cmptparms, cspace)
return(image)
def image_destroy(image):
"""Wraps openjpeg library function opj_image_destroy."""
OPENJPEG.opj_image_destroy.argtypes = [ctypes.POINTER(ImageType)]
OPENJPEG.opj_image_destroy(image)
def set_default_encoder_parameters():
"""Wrapper for openjpeg library function opj_set_default_encoder_parameters.
"""
cparams = CompressionParametersType()
argtypes = [ctypes.POINTER(CompressionParametersType)]
OPENJPEG.opj_set_default_encoder_parameters.argtypes = argtypes
OPENJPEG.opj_set_default_encoder_parameters(ctypes.byref(cparams))
return cparams
def set_default_decoder_parameters(dparams_p):
"""Wrapper for opj_set_default_decoder_parameters.
"""
argtypes = [ctypes.POINTER(DecompressionParametersType)]
OPENJPEG.opj_set_default_decoder_parameters.argtypes = argtypes
OPENJPEG.opj_set_default_decoder_parameters(dparams_p)
def set_event_mgr(dinfo, event_mgr, context=None):
"""Wrapper for openjpeg library function opj_set_event_mgr.
"""
argtypes = [ctypes.POINTER(CommonStructType),
ctypes.POINTER(EventMgrType),
ctypes.c_void_p]
OPENJPEG.opj_set_event_mgr.argtypes = argtypes
OPENJPEG.opj_set_event_mgr(ctypes.cast(dinfo,
ctypes.POINTER(CommonStructType)),
event_mgr, context)
def setup_encoder(cinfo, cparameters, image):
"""Wrapper for openjpeg library function opj_setup_decoder."""
argtypes = [ctypes.POINTER(CompressionInfoType),
ctypes.POINTER(CompressionParametersType),
ctypes.POINTER(ImageType)]
OPENJPEG.opj_setup_encoder.argtypes = argtypes
OPENJPEG.opj_setup_encoder(cinfo, cparameters, image)
def setup_decoder(dinfo, dparams):
"""Wrapper for openjpeg library function opj_setup_decoder."""
argtypes = [ctypes.POINTER(DecompressionInfoType),
ctypes.POINTER(DecompressionParametersType)]
OPENJPEG.opj_setup_decoder.argtypes = argtypes
OPENJPEG.opj_setup_decoder(dinfo, dparams)
| [
1,
9995,
29956,
336,
567,
3489,
5717,
304,
1722,
26568,
29889,
13,
15945,
29908,
13,
13,
5215,
274,
8768,
13,
5215,
10876,
13,
13,
3166,
6317,
2917,
1053,
330,
368,
29885,
332,
29918,
2917,
13,
13,
3383,
6418,
1430,
29967,
4162,
29954,
353,
330,
368,
29885,
332,
29918,
2917,
580,
13,
13,
29937,
5918,
12539,
1353,
310,
25900,
5633,
3806,
491,
435,
29925,
29956,
29931,
29901,
7910,
472,
596,
674,
13,
29967,
29925,
29956,
29931,
29918,
12648,
29918,
6632,
29918,
24301,
17101,
4162,
9295,
353,
29871,
29896,
29953,
13,
13,
29967,
29906,
29968,
29918,
12648,
2241,
29963,
8547,
353,
29871,
29941,
29941,
29871,
396,
9681,
310,
7472,
10104,
3233,
4148,
1891,
13,
10145,
29918,
1307,
29940,
353,
29871,
29946,
29900,
29929,
29953,
1678,
396,
7472,
6068,
2159,
363,
977,
264,
1280,
13,
13,
13,
1753,
1873,
7295,
13,
1678,
9995,
15646,
363,
1015,
29926,
29918,
3259,
3489,
26529,
1213,
15945,
13,
1678,
6418,
1430,
29967,
4162,
29954,
29889,
459,
29926,
29918,
3259,
29889,
5060,
668,
353,
274,
8768,
29889,
29883,
29918,
3090,
29918,
29886,
13,
1678,
3489,
29918,
3259,
353,
6418,
1430,
29967,
4162,
29954,
29889,
459,
29926,
29918,
3259,
580,
13,
1678,
565,
10876,
29889,
20970,
3259,
6736,
29871,
29900,
29916,
29900,
29941,
29900,
29900,
29900,
29900,
29900,
29900,
29901,
13,
4706,
736,
3489,
29918,
3259,
29889,
13808,
877,
9420,
29899,
29947,
1495,
13,
1678,
1683,
29901,
13,
4706,
736,
3489,
29918,
3259,
13,
13,
29937,
20768,
304,
679,
278,
9461,
1873,
29892,
1207,
1854,
591,
526,
472,
3203,
472,
29871,
29896,
29889,
29946,
29889,
29916,
13,
361,
6418,
1430,
29967,
4162,
29954,
338,
451,
6213,
29901,
13,
1678,
903,
16173,
1955,
353,
1873,
2141,
5451,
12839,
29861,
29896,
29962,
13,
2870,
29901,
13,
1678,
396,
5538,
451,
2289,
4383,
29889,
29871,
1205,
1873,
881,
451,
367,
2000,
565,
727,
338,
694,
13,
1678,
396,
4673,
29967,
4162,
29954,
3489,
1476,
29889,
13,
1678,
903,
16173,
1955,
353,
29871,
29900,
13,
13,
13,
1990,
6864,
29924,
629,
1542,
29898,
312,
7384,
29889,
5015,
12425,
1125,
13,
1678,
9995,
3728,
7834,
1203,
29889,
13,
13,
1678,
2994,
3636,
29879,
304,
1741,
29918,
29885,
629,
29918,
29873,
1134,
297,
1722,
26568,
9066,
29889,
13,
1678,
9995,
13,
1678,
903,
9621,
29918,
353,
518,
703,
2704,
29918,
13789,
613,
274,
8768,
29889,
29883,
29918,
5405,
29918,
29886,
511,
13,
18884,
4852,
27392,
29918,
13789,
613,
274,
8768,
29889,
29883,
29918,
5405,
29918,
29886,
511,
13,
18884,
4852,
3888,
29918,
13789,
613,
274,
8768,
29889,
29883,
29918,
5405,
29918,
29886,
4638,
13,
13,
13,
1990,
13103,
19560,
1542,
29898,
312,
7384,
29889,
5015,
12425,
1125,
13,
1678,
9995,
18877,
4235,
1546,
435,
4162,
29954,
29871,
29906,
29900,
29900,
29900,
24221,
322,
17753,
2590,
3030,
29916,
29889,
13,
1678,
9995,
13,
1678,
903,
9621,
29918,
353,
518,
703,
3696,
29918,
29885,
629,
613,
274,
8768,
29889,
29925,
6992,
4945,
29898,
2624,
29924,
629,
1542,
8243,
13,
18884,
4852,
4645,
29918,
1272,
613,
274,
8768,
29889,
29883,
29918,
5405,
29918,
29886,
511,
13,
18884,
4852,
275,
29918,
311,
510,
2139,
272,
613,
274,
8768,
29889,
29883,
29918,
11227,
511,
13,
18884,
4852,
401,
29883,
29918,
4830,
613,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
18884,
4852,
29926,
29906,
29895,
29918,
8411,
613,
274,
8768,
29889,
29883,
29918,
5405,
29918,
29886,
511,
13,
18884,
4852,
16865,
29906,
29918,
8411,
613,
274,
8768,
29889,
29883,
29918,
5405,
29918,
29886,
511,
13,
18884,
4852,
29885,
29926,
29906,
29918,
8411,
613,
274,
8768,
29889,
29883,
29918,
5405,
29918,
29886,
4638,
13,
13,
13,
1254,
1525,
5194,
29918,
16310,
353,
29871,
29900,
29916,
29900,
29900,
29900,
29896,
29871,
396,
450,
4840,
471,
6496,
363,
5183,
29889,
13,
1254,
1525,
5194,
29918,
16365,
353,
29871,
29900,
29916,
29900,
29900,
29900,
29906,
29871,
396,
450,
4840,
471,
6496,
363,
5007,
29889,
13,
13,
13,
1990,
315,
601,
1542,
29898,
312,
7384,
29889,
5015,
12425,
1125,
13,
1678,
9995,
12901,
1881,
29899,
4905,
4840,
313,
29907,
5971,
29897,
13,
13,
1678,
2994,
3636,
29879,
304,
274,
601,
29918,
29873,
297,
1722,
26568,
9066,
29889,
13,
1678,
9995,
13,
1678,
903,
9621,
29918,
353,
518,
703,
29883,
3888,
613,
274,
8768,
29889,
29925,
6992,
4945,
29898,
18877,
19560,
1542,
8243,
29871,
396,
775,
29883,
3030,
13,
18884,
396,
6850,
1525,
5194,
29918,
16310,
470,
6850,
1525,
5194,
29918,
16365,
13,
18884,
4852,
3150,
8513,
613,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
18884,
396,
4879,
304,
1369,
310,
6835,
13,
18884,
4852,
9040,
613,
274,
8768,
29889,
29925,
6992,
4945,
29898,
312,
7384,
29889,
29883,
29918,
3090,
8243,
13,
18884,
396,
6835,
2159,
297,
6262,
13,
18884,
4852,
2848,
613,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
18884,
396,
4879,
304,
1369,
310,
4840,
13,
18884,
4852,
2962,
613,
274,
8768,
29889,
29883,
29918,
3090,
29918,
29886,
511,
13,
18884,
396,
4879,
304,
1095,
310,
4840,
13,
18884,
4852,
355,
613,
274,
8768,
29889,
29883,
29918,
3090,
29918,
29886,
511,
13,
18884,
396,
4879,
304,
1857,
2602,
13,
18884,
4852,
25288,
613,
274,
8768,
29889,
29883,
29918,
3090,
29918,
29886,
4638,
13,
13,
13,
1990,
422,
2590,
3401,
1542,
29898,
18877,
19560,
1542,
1125,
13,
1678,
9995,
18877,
4235,
1546,
435,
4162,
29954,
29899,
29906,
29900,
29900,
29900,
24221,
322,
17753,
2590,
3030,
29879,
29889,
13,
1678,
910,
338,
363,
24221,
3030,
29879,
29889,
29871,
2994,
3636,
29879,
304,
3619,
29918,
4984,
29918,
29873,
29889,
13,
1678,
9995,
13,
1678,
1209,
13,
13,
13,
1990,
349,
542,
1542,
29898,
312,
7384,
29889,
5015,
12425,
1125,
13,
1678,
9995,
1184,
11476,
1797,
3620,
1213,
15945,
13,
1678,
903,
9621,
29918,
353,
518,
703,
690,
1217,
613,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
18884,
396,
24062,
918,
954,
1369,
29892,
15924,
954,
1369,
29892,
2183,
491,
349,
20166,
13,
18884,
4852,
2388,
1217,
29900,
613,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
13,
18884,
396,
365,
2747,
954,
1095,
29892,
12375,
918,
954,
1095,
29892,
15924,
954,
1095,
29892,
2183,
13,
18884,
396,
491,
349,
20166,
13,
18884,
4852,
8387,
1217,
29896,
613,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
18884,
4852,
690,
1217,
29896,
613,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
18884,
4852,
2388,
1217,
29896,
613,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
13,
18884,
396,
365,
2747,
954,
1369,
29892,
29925,
3757,
5562,
954,
1369,
29892,
349,
3757,
5562,
954,
1095,
13,
18884,
4852,
8387,
1217,
29900,
613,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
18884,
4852,
17990,
1217,
29900,
613,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
18884,
4852,
17990,
1217,
29896,
613,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
13,
18884,
396,
1019,
11476,
1797,
14115,
13,
18884,
396,
6418,
29967,
29918,
8618,
29954,
29918,
22364,
544,
29887,
29896,
29892,
558,
29887,
29936,
13,
18884,
4852,
558,
29887,
29896,
613,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
18884,
4852,
558,
29887,
613,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
13,
18884,
396,
1019,
11476,
1797,
1347,
13,
18884,
396,
1373,
410,
29887,
2098,
29961,
29945,
1385,
13,
18884,
4852,
29097,
2098,
613,
9651,
274,
8768,
29889,
29883,
29918,
3090,
334,
29871,
29945,
511,
13,
13,
18884,
396,
323,
488,
1353,
13,
18884,
396,
938,
25900,
29936,
13,
18884,
4852,
29873,
488,
613,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
13,
18884,
4852,
7508,
29900,
613,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
18884,
4852,
7508,
29896,
613,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
18884,
4852,
1017,
29900,
613,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
18884,
4852,
1017,
29896,
613,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
18884,
4852,
8387,
29903,
613,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
18884,
4852,
690,
29903,
613,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
18884,
4852,
2388,
29903,
613,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
18884,
4852,
558,
29883,
29903,
613,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
18884,
4852,
8387,
29923,
613,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
18884,
4852,
690,
29923,
613,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
18884,
4852,
2388,
29923,
613,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
18884,
4852,
558,
29883,
29923,
613,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
18884,
4852,
7508,
29903,
613,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
18884,
4852,
7508,
29923,
613,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
18884,
4852,
1017,
29903,
613,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
18884,
4852,
1017,
29923,
613,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
18884,
4852,
8235,
613,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
18884,
4852,
4518,
613,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
18884,
4852,
8387,
29918,
29873,
613,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
18884,
4852,
690,
29918,
29873,
613,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
18884,
4852,
2388,
29918,
29873,
613,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
18884,
4852,
558,
29883,
29918,
29873,
613,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
18884,
4852,
7508,
29900,
29918,
29873,
613,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
18884,
4852,
1017,
29900,
29918,
29873,
613,
274,
8768,
29889,
29883,
29918,
524,
4638,
13,
13,
13,
1990,
422,
2590,
11507,
1542,
29898,
312,
7384,
29889,
5015,
12425,
1125,
13,
1678,
9995,
1523,
2590,
4128,
29889,
13,
13,
1678,
2994,
3636,
29879,
304,
274,
16744,
29918,
29873,
1134,
297,
1722,
16865,
29906,
9066,
29889,
13,
1678,
9995,
13,
1678,
903,
9621,
29918,
353,
518,
13,
4706,
396,
2159,
310,
25900,
29901,
13,
4706,
396,
268,
25900,
29918,
2311,
29918,
265,
353,
2089,
313,
1333,
297,
2980,
29897,
470,
13,
4706,
396,
462,
29871,
353,
1565,
313,
262,
2980,
29897,
13,
4706,
4852,
29873,
488,
29918,
2311,
29918,
265,
613,
268,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
13,
4706,
396,
1060,
4986,
29879,
466,
29892,
612,
4986,
29879,
466,
13,
4706,
4852,
6814,
29918,
7508,
29900,
613,
965,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
4706,
4852,
6814,
29918,
1017,
29900,
613,
965,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
13,
4706,
396,
1060,
29911,
29879,
466,
29892,
612,
29911,
29879,
466,
13,
4706,
4852,
6814,
29918,
1594,
29916,
613,
965,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
4706,
4852,
6814,
29918,
1594,
29891,
613,
965,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
13,
4706,
396,
24082,
491,
6554,
29914,
5721,
441,
291,
13,
4706,
4852,
6814,
29918,
29881,
5137,
29918,
15956,
613,
259,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
13,
4706,
396,
24082,
491,
4343,
7546,
13,
4706,
4852,
6814,
29918,
20227,
29918,
15956,
613,
259,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
13,
4706,
396,
788,
4343,
29918,
29567,
13,
4706,
4852,
6814,
29918,
20227,
29918,
29567,
613,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
13,
4706,
396,
4343,
7546,
13,
4706,
4852,
6814,
29918,
2922,
11674,
613,
539,
274,
8768,
29889,
29883,
29918,
5405,
29918,
29886,
511,
13,
13,
4706,
396,
3440,
363,
14137,
13,
4706,
4852,
6814,
29918,
9342,
613,
539,
274,
8768,
29889,
29883,
29918,
3090,
29918,
29886,
511,
13,
13,
4706,
396,
274,
22062,
584,
14137,
3114,
13,
4706,
4852,
29883,
22062,
613,
632,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
13,
4706,
396,
410,
11476,
1797,
313,
4381,
6418,
29967,
29918,
29519,
6271,
29897,
13,
4706,
4852,
29097,
29918,
2098,
613,
539,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
13,
4706,
396,
410,
11476,
1797,
3620,
13,
4706,
4852,
29886,
542,
613,
795,
349,
542,
1542,
334,
29871,
29941,
29906,
511,
13,
13,
4706,
396,
1353,
310,
410,
11476,
1797,
3620,
313,
13152,
29907,
511,
2322,
304,
29871,
29900,
13,
4706,
4852,
1949,
29886,
12332,
613,
3986,
274,
8768,
29889,
29883,
29918,
13470,
511,
13,
13,
4706,
396,
1353,
310,
15359,
13,
4706,
4852,
23981,
29918,
1949,
29277,
613,
1678,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
13,
4706,
396,
19257,
310,
15359,
13,
4706,
4852,
23981,
29918,
29878,
1078,
613,
4706,
274,
8768,
29889,
29883,
29918,
7411,
334,
29871,
29896,
29900,
29900,
511,
13,
13,
4706,
396,
1422,
6529,
22230,
363,
2551,
573,
15359,
13,
4706,
4852,
23981,
29918,
29881,
2118,
20819,
613,
259,
274,
8768,
29889,
29883,
29918,
7411,
334,
29871,
29896,
29900,
29900,
511,
13,
13,
4706,
396,
1353,
310,
10104,
29879,
13,
4706,
4852,
1949,
9778,
918,
613,
1678,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
13,
4706,
396,
2847,
775,
2908,
2920,
29892,
2322,
304,
29871,
29953,
29946,
13,
4706,
4852,
29883,
1271,
29893,
29918,
2344,
613,
268,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
13,
4706,
396,
2847,
775,
2908,
3171,
29892,
2322,
304,
29871,
29953,
29946,
13,
4706,
4852,
29883,
1271,
29882,
29918,
2344,
613,
268,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
13,
4706,
396,
4464,
4607,
313,
29883,
2204,
29895,
29918,
3293,
29897,
13,
4706,
4852,
8513,
613,
632,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
13,
4706,
396,
29871,
29896,
584,
671,
278,
19950,
874,
1821,
360,
17755,
29871,
29929,
29899,
29955,
13,
4706,
396,
29871,
29900,
584,
671,
6410,
2222,
24221,
313,
4381,
29897,
13,
4706,
4852,
381,
276,
874,
1821,
613,
268,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
13,
4706,
396,
5120,
310,
4066,
29901,
15201,
4163,
297,
518,
29900,
636,
29941,
1402,
448,
29896,
2794,
694,
16641,
29902,
13,
4706,
4852,
307,
29875,
29918,
2388,
1217,
613,
539,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
13,
4706,
396,
5120,
310,
4066,
29901,
24081,
29882,
2027,
995,
13,
4706,
4852,
307,
29875,
29918,
10889,
613,
4706,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
13,
4706,
396,
1353,
310,
8303,
5562,
2159,
2702,
800,
13,
4706,
4852,
690,
29918,
6550,
613,
308,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
13,
4706,
396,
2847,
8303,
5562,
2920,
13,
4706,
4852,
558,
29883,
29893,
29918,
2344,
613,
4706,
274,
8768,
29889,
29883,
29918,
524,
334,
435,
29906,
29968,
29918,
12648,
2241,
29963,
8547,
511,
13,
13,
4706,
396,
2847,
8303,
5562,
3171,
13,
4706,
4852,
558,
305,
29918,
2344,
613,
4706,
274,
8768,
29889,
29883,
29918,
524,
334,
435,
29906,
29968,
29918,
12648,
2241,
29963,
8547,
511,
13,
13,
4706,
396,
1881,
934,
1024,
13,
4706,
4852,
262,
1445,
613,
965,
274,
8768,
29889,
29883,
29918,
3090,
334,
23611,
29918,
1307,
29940,
511,
13,
13,
4706,
396,
1962,
934,
1024,
13,
4706,
4852,
449,
1445,
613,
3986,
274,
8768,
29889,
29883,
29918,
3090,
334,
23611,
29918,
1307,
29940,
511,
13,
13,
4706,
396,
5012,
15094,
29907,
3040,
29928,
29889,
13,
4706,
4852,
2248,
29918,
265,
613,
308,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
13,
4706,
396,
5012,
15094,
29907,
3040,
29928,
29889,
13,
4706,
4852,
2248,
613,
9651,
274,
8768,
29889,
29883,
29918,
3090,
334,
23611,
29918,
1307,
29940,
511,
13,
13,
4706,
396,
1014,
3027,
8025,
29901,
3978,
1967,
9210,
297,
921,
5305,
13,
4706,
396,
1014,
3027,
8025,
29901,
3978,
1967,
9210,
297,
343,
5305,
13,
4706,
4852,
3027,
29918,
10289,
29918,
29916,
29900,
613,
29871,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
4706,
4852,
3027,
29918,
10289,
29918,
29891,
29900,
613,
29871,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
13,
4706,
396,
11684,
314,
10335,
995,
363,
15414,
13,
4706,
396,
11684,
314,
10335,
995,
363,
13475,
13,
4706,
4852,
1491,
13445,
10335,
29918,
8235,
613,
29871,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
4706,
4852,
1491,
13445,
10335,
29918,
4518,
613,
29871,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
13,
4706,
396,
1881,
934,
3402,
29871,
29900,
29901,
349,
29954,
29990,
29892,
29871,
29896,
29901,
349,
29916,
29924,
29892,
29871,
29906,
29901,
350,
3580,
29871,
29941,
29901,
29911,
6545,
13,
4706,
396,
1962,
934,
3402,
29871,
29900,
29901,
435,
29906,
29968,
29892,
29871,
29896,
29901,
435,
29925,
29906,
29892,
29871,
29906,
29901,
435,
7982,
13,
4706,
4852,
7099,
397,
29918,
4830,
613,
1678,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
4706,
4852,
19284,
29918,
4830,
613,
418,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
13,
4706,
396,
435,
29925,
29956,
29931,
8025,
4128,
13,
4706,
396,
28936,
5007,
310,
382,
9026,
297,
341,
29950,
29892,
4550,
5039,
1218,
435,
29925,
29956,
29931,
13,
4706,
4852,
16865,
29893,
29880,
29918,
1022,
29883,
29918,
265,
613,
268,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
13,
4706,
396,
1059,
13047,
1158,
363,
341,
29950,
313,
29900,
29892,
29896,
29892,
29896,
29953,
29892,
29941,
29906,
29892,
29941,
29955,
29899,
29896,
29906,
29947,
29897,
13,
4706,
4852,
16865,
29893,
29880,
29918,
29882,
771,
29873,
29918,
29885,
29882,
613,
259,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
13,
4706,
396,
25900,
1353,
310,
4839,
13047,
21992,
313,
18572,
29900,
29897,
13,
4706,
4852,
16865,
29893,
29880,
29918,
29882,
771,
29873,
29918,
29873,
561,
29918,
1376,
8154,
613,
274,
8768,
29889,
29883,
29918,
524,
334,
435,
29925,
29956,
29931,
29918,
12648,
29918,
6632,
29918,
24301,
17101,
4162,
9295,
511,
13,
13,
4706,
396,
1059,
13047,
3519,
363,
323,
19689,
29879,
313,
29900,
29892,
29896,
29892,
29896,
29953,
29892,
29941,
29906,
29892,
29941,
29955,
29899,
29896,
29906,
29947,
29897,
13,
4706,
4852,
16865,
29893,
29880,
29918,
29882,
771,
29873,
29918,
29873,
561,
613,
4706,
274,
8768,
29889,
29883,
29918,
524,
334,
435,
29925,
29956,
29931,
29918,
12648,
29918,
6632,
29918,
24301,
17101,
4162,
9295,
511,
13,
13,
4706,
396,
25900,
1353,
310,
18203,
13047,
21992,
313,
18572,
29900,
29897,
13,
4706,
4852,
16865,
29893,
29880,
29918,
407,
5450,
29918,
1376,
8154,
613,
268,
274,
8768,
29889,
29883,
29918,
524,
334,
435,
29925,
29956,
29931,
29918,
12648,
29918,
6632,
29918,
24301,
17101,
4162,
9295,
511,
13,
13,
4706,
396,
18203,
1353,
310,
18203,
13047,
21992,
313,
18572,
29900,
29897,
13,
4706,
4852,
16865,
29893,
29880,
29918,
407,
5450,
29918,
4058,
1217,
613,
268,
274,
8768,
29889,
29883,
29918,
524,
334,
435,
29925,
29956,
29931,
29918,
12648,
29918,
6632,
29918,
24301,
17101,
4162,
9295,
511,
13,
13,
4706,
396,
1059,
13047,
3519,
363,
23912,
313,
29900,
29892,
29896,
29892,
29896,
29953,
29892,
29941,
29906,
29892,
29941,
29955,
29899,
29896,
29906,
29947,
29897,
13,
4706,
4852,
16865,
29893,
29880,
29918,
407,
5450,
613,
9651,
274,
8768,
29889,
29883,
29918,
524,
334,
435,
29925,
29956,
29931,
29918,
12648,
29918,
6632,
29918,
24301,
17101,
4162,
9295,
511,
13,
13,
4706,
396,
28936,
5007,
310,
382,
7230,
29892,
313,
29900,
29922,
1217,
29914,
29896,
29914,
29906,
6262,
29897,
13,
4706,
4852,
16865,
29893,
29880,
29918,
23149,
29918,
2311,
613,
4706,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
13,
4706,
396,
4771,
24858,
3211,
292,
2159,
313,
29900,
29922,
6921,
29914,
29906,
29914,
29946,
6262,
29897,
13,
4706,
4852,
16865,
29893,
29880,
29918,
23149,
29918,
10030,
613,
4706,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
13,
4706,
396,
4771,
24858,
3464,
313,
29900,
29899,
29941,
29897,
13,
4706,
4852,
16865,
29893,
29880,
29918,
23149,
29918,
3881,
613,
539,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
13,
4706,
396,
4771,
24858,
1158,
363,
341,
29950,
8521,
29896,
29922,
1217,
29892,
29900,
29899,
29955,
29897,
13,
4706,
4852,
16865,
29893,
29880,
29918,
23149,
29918,
29885,
29882,
613,
3986,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
13,
4706,
396,
25900,
1353,
310,
4771,
24858,
21992,
313,
18572,
29900,
29897,
13,
4706,
4852,
16865,
29893,
29880,
29918,
23149,
29918,
29873,
561,
29918,
1376,
8154,
613,
29871,
274,
8768,
29889,
29883,
29918,
524,
334,
435,
29925,
29956,
29931,
29918,
12648,
29918,
6632,
29918,
24301,
17101,
4162,
9295,
511,
13,
13,
4706,
396,
4771,
24858,
3519,
363,
323,
19689,
29879,
8521,
29896,
29922,
1217,
29892,
29900,
29899,
29955,
29897,
13,
4706,
4852,
16865,
29893,
29880,
29918,
23149,
29918,
29873,
561,
613,
308,
274,
8768,
29889,
29883,
29918,
524,
334,
435,
29925,
29956,
29931,
29918,
12648,
29918,
6632,
29918,
24301,
17101,
4162,
9295,
511,
13,
13,
4706,
396,
15918,
27306,
752,
13036,
29871,
29900,
29899,
1333,
752,
492,
424,
29892,
29871,
29896,
29899,
2388,
492,
424,
13,
4706,
4852,
6814,
29918,
16381,
2603,
613,
632,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
13,
4706,
396,
5918,
12539,
6554,
363,
1269,
4163,
29889,
13,
4706,
396,
960,
1275,
29871,
29900,
29892,
4163,
2159,
29485,
338,
451,
5545,
13,
4706,
4852,
3317,
29918,
2388,
29918,
2311,
613,
308,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
13,
4706,
396,
20802,
1024,
13,
4706,
4852,
6814,
29918,
2288,
466,
613,
1669,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
13,
4706,
396,
323,
488,
760,
12623,
13,
4706,
4852,
9392,
29918,
265,
613,
462,
274,
8768,
29889,
29883,
29918,
13470,
29947,
511,
13,
13,
4706,
396,
28697,
363,
323,
488,
760,
12623,
13,
4706,
4852,
9392,
29918,
15581,
613,
1669,
274,
8768,
29889,
29883,
29918,
13470,
29947,
511,
13,
13,
4706,
396,
341,
1783,
313,
20787,
4163,
4327,
29897,
13,
4706,
4852,
23981,
29918,
29885,
312,
613,
1669,
274,
8768,
29889,
29883,
29918,
13470,
29947,
511,
13,
13,
4706,
396,
1174,
519,
435,
2227,
29925,
26190,
13,
4706,
4852,
29926,
13096,
29918,
265,
613,
1669,
274,
8768,
29889,
29883,
29918,
524,
4638,
13,
13,
13,
1990,
897,
510,
2590,
3401,
1542,
29898,
312,
7384,
29889,
5015,
12425,
1125,
13,
1678,
9995,
4013,
338,
363,
17753,
2590,
3030,
29879,
29889,
13,
13,
1678,
2994,
3636,
29879,
304,
270,
3888,
29918,
29873,
1134,
297,
1722,
26568,
9066,
29889,
13,
1678,
9995,
13,
1678,
1209,
13,
13,
13,
1990,
897,
510,
2590,
11507,
1542,
29898,
312,
7384,
29889,
5015,
12425,
1125,
13,
1678,
9995,
2772,
510,
2590,
4128,
29889,
13,
13,
1678,
2994,
3636,
29879,
304,
270,
16744,
29918,
29873,
1134,
297,
1722,
26568,
9066,
29889,
13,
1678,
9995,
13,
1678,
396,
21447,
29918,
17469,
29901,
29871,
278,
1353,
310,
9939,
10104,
11174,
304,
367,
2313,
25600,
13,
1678,
903,
9621,
29918,
353,
518,
703,
6814,
29918,
17469,
613,
308,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
18884,
396,
21447,
29918,
13148,
29901,
29871,
278,
7472,
1353,
310,
11029,
15359,
304,
21822,
13,
18884,
4852,
6814,
29918,
13148,
613,
3986,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
18884,
396,
297,
1445,
29901,
29871,
1881,
934,
1024,
13,
18884,
4852,
262,
1445,
613,
9651,
274,
8768,
29889,
29883,
29918,
3090,
334,
23611,
29918,
1307,
29940,
511,
13,
18884,
396,
714,
1445,
29901,
29871,
1962,
934,
1024,
13,
18884,
4852,
449,
1445,
613,
965,
274,
8768,
29889,
29883,
29918,
3090,
334,
23611,
29918,
1307,
29940,
511,
13,
18884,
396,
1602,
397,
29918,
4830,
29901,
29871,
1881,
934,
3402,
29871,
29900,
29901,
435,
29906,
29968,
29892,
29871,
29896,
29901,
435,
29925,
29906,
29892,
29871,
29906,
29901,
435,
7982,
13,
18884,
4852,
7099,
397,
29918,
4830,
613,
418,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
18884,
396,
15234,
29918,
4830,
29901,
29871,
1962,
934,
3402,
29871,
29900,
29901,
349,
29954,
29990,
29892,
29871,
29896,
29901,
349,
29916,
29924,
29892,
29871,
29906,
29901,
350,
3580,
13,
18884,
4852,
19284,
29918,
4830,
613,
4706,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
18884,
396,
432,
29886,
29893,
29880,
29918,
15728,
29901,
29871,
5039,
1078,
278,
435,
29925,
29956,
29931,
26385,
27108,
13,
18884,
4852,
16865,
29893,
29880,
29918,
15728,
613,
418,
274,
8768,
29889,
29883,
29918,
11227,
511,
13,
18884,
396,
432,
29886,
29893,
29880,
29918,
4548,
29918,
510,
567,
29901,
29871,
3806,
1353,
310,
7117,
13,
18884,
4852,
16865,
29893,
29880,
29918,
4548,
29918,
510,
567,
613,
1678,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
18884,
396,
432,
29886,
29893,
29880,
29918,
3317,
29918,
1376,
267,
29901,
29871,
7472,
1353,
310,
260,
5475,
13,
18884,
4852,
16865,
29893,
29880,
29918,
3317,
29918,
1376,
267,
613,
1678,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
18884,
396,
21447,
29918,
13400,
29918,
7099,
3689,
29901,
29871,
3692,
1602,
3689,
881,
367,
2309,
373,
278,
13,
18884,
396,
4152,
15234,
342,
1633,
470,
367,
9078,
304,
278,
1667,
4839,
13,
18884,
4852,
6814,
29918,
13400,
29918,
7099,
3689,
613,
274,
8768,
29889,
29883,
29918,
524,
4638,
13,
13,
1678,
565,
903,
16173,
1955,
1275,
525,
29945,
2396,
13,
4706,
903,
9621,
5396,
4397,
29898,
703,
15764,
613,
632,
274,
8768,
29889,
29883,
29918,
13470,
876,
13,
13,
13,
1990,
7084,
1523,
415,
2177,
29885,
1542,
29898,
312,
7384,
29889,
5015,
12425,
1125,
13,
1678,
9995,
5308,
4128,
3829,
1304,
491,
278,
1015,
29926,
29918,
3027,
29918,
3258,
740,
29889,
13,
1678,
9995,
13,
1678,
903,
9621,
29918,
353,
518,
703,
8235,
613,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
18884,
396,
1060,
29934,
29879,
466,
29901,
14698,
23683,
310,
263,
4559,
310,
372,
29882,
4163,
13,
18884,
396,
411,
3390,
304,
278,
3407,
6856,
13,
13,
18884,
396,
612,
29934,
29879,
466,
29901,
11408,
23683,
310,
263,
4559,
310,
372,
29882,
4163,
411,
13,
18884,
396,
3390,
304,
278,
3407,
6856,
3776,
13,
18884,
4852,
4518,
613,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
13,
18884,
396,
848,
2920,
29892,
3171,
13,
18884,
4852,
29893,
613,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
18884,
4852,
29882,
613,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
13,
18884,
396,
921,
4163,
9210,
9401,
304,
278,
3353,
1967,
13,
18884,
396,
343,
4163,
9210,
9401,
304,
278,
3353,
1967,
13,
18884,
4852,
29916,
29900,
613,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
18884,
4852,
29891,
29900,
613,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
13,
18884,
396,
16716,
13,
18884,
6702,
17990,
742,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
13,
18884,
396,
1967,
10809,
297,
9978,
13,
18884,
6702,
29890,
407,
742,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
13,
18884,
396,
8794,
313,
29896,
29897,
847,
12780,
313,
29900,
29897,
13,
18884,
6702,
5311,
299,
742,
274,
8768,
29889,
29883,
29918,
524,
4638,
13,
13,
13,
1990,
7084,
6843,
1542,
29898,
312,
7384,
29889,
5015,
12425,
1125,
13,
1678,
9995,
3206,
1475,
263,
2323,
1967,
4163,
29889,
9995,
13,
1678,
903,
9621,
29918,
353,
518,
703,
8235,
613,
4706,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
18884,
4852,
4518,
613,
9651,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
18884,
4852,
29893,
613,
632,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
18884,
4852,
29882,
613,
632,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
18884,
4852,
29916,
29900,
613,
9651,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
18884,
4852,
29891,
29900,
613,
9651,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
18884,
4852,
17990,
613,
3986,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
18884,
4852,
29890,
407,
613,
965,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
18884,
4852,
5311,
299,
613,
3986,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
18884,
4852,
690,
1217,
29918,
7099,
6797,
613,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
18884,
4852,
19790,
613,
4706,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
18884,
4852,
1272,
613,
3986,
274,
8768,
29889,
29925,
6992,
4945,
29898,
312,
7384,
29889,
29883,
29918,
524,
28166,
13,
13,
13,
1990,
7084,
1542,
29898,
312,
7384,
29889,
5015,
12425,
1125,
13,
1678,
9995,
3206,
1475,
1967,
848,
322,
21862,
29889,
13,
13,
1678,
2994,
3636,
29879,
304,
1967,
29918,
29873,
1134,
297,
1722,
26568,
9066,
29889,
13,
1678,
9995,
13,
1678,
903,
9621,
29918,
353,
518,
703,
29916,
29900,
613,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
18884,
4852,
29891,
29900,
613,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
18884,
4852,
29916,
29896,
613,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
18884,
4852,
29891,
29896,
613,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
18884,
4852,
1949,
510,
567,
613,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
18884,
4852,
2780,
29918,
3493,
613,
274,
8768,
29889,
29883,
29918,
524,
511,
13,
18884,
4852,
510,
567,
613,
274,
8768,
29889,
29925,
6992,
4945,
29898,
2940,
6843,
1542,
8243,
13,
18884,
4852,
293,
29883,
29918,
10185,
29918,
9721,
613,
274,
8768,
29889,
29883,
29918,
3090,
29918,
29886,
511,
13,
18884,
4852,
293,
29883,
29918,
10185,
29918,
2435,
613,
274,
8768,
29889,
29883,
29918,
524,
4638,
13,
13,
13,
1753,
274,
601,
29918,
3150,
29898,
29883,
3888,
29892,
4765,
29922,
8516,
1125,
13,
1678,
9995,
15646,
363,
1722,
26568,
3489,
740,
1015,
29926,
29918,
3934,
29918,
3150,
1213,
15945,
13,
1678,
1852,
8768,
353,
518,
312,
7384,
29889,
29925,
6992,
4945,
29898,
18877,
19560,
1542,
511,
274,
8768,
29889,
29883,
29918,
3090,
29918,
29886,
29892,
13,
18884,
274,
8768,
29889,
29883,
29918,
524,
29962,
13,
1678,
6418,
1430,
29967,
4162,
29954,
29889,
459,
29926,
29918,
3934,
29918,
3150,
29889,
1191,
8768,
353,
1852,
8768,
13,
1678,
6418,
1430,
29967,
4162,
29954,
29889,
459,
29926,
29918,
3934,
29918,
3150,
29889,
5060,
668,
353,
274,
8768,
29889,
29925,
6992,
4945,
29898,
29907,
601,
1542,
29897,
13,
13,
1678,
565,
4765,
338,
6213,
29901,
13,
4706,
3309,
353,
29871,
29900,
13,
1678,
1683,
29901,
13,
4706,
3309,
353,
7431,
29898,
4351,
29897,
13,
13,
1678,
274,
601,
353,
6418,
1430,
29967,
4162,
29954,
29889,
459,
29926,
29918,
3934,
29918,
3150,
29898,
312,
7384,
29889,
4384,
29898,
29883,
3888,
29892,
13,
462,
462,
9651,
274,
8768,
29889,
29925,
6992,
4945,
29898,
18877,
19560,
1542,
8243,
13,
462,
18884,
4765,
29892,
13,
462,
18884,
3309,
29897,
13,
1678,
736,
274,
601,
13,
13,
13,
1753,
274,
601,
29918,
5358,
29898,
3934,
1125,
13,
1678,
9995,
29956,
336,
567,
1722,
26568,
3489,
740,
274,
601,
29918,
5358,
29889,
13,
1678,
9995,
13,
1678,
6418,
1430,
29967,
4162,
29954,
29889,
459,
29926,
29918,
3934,
29918,
5358,
29889,
1191,
8768,
353,
518,
312,
7384,
29889,
29925,
6992,
4945,
29898,
29907,
601,
1542,
4638,
13,
1678,
6418,
1430,
29967,
4162,
29954,
29889,
459,
29926,
29918,
3934,
29918,
5358,
29898,
3934,
29897,
13,
13,
13,
1753,
274,
601,
29918,
29873,
514,
29898,
3934,
1125,
13,
1678,
9995,
2577,
2602,
297,
7023,
4840,
1213,
15945,
13,
1678,
6418,
1430,
29967,
4162,
29954,
29889,
3934,
29918,
29873,
514,
29889,
1191,
8768,
353,
518,
312,
7384,
29889,
29925,
6992,
4945,
29898,
29907,
601,
1542,
4638,
13,
1678,
6418,
1430,
29967,
4162,
29954,
29889,
3934,
29918,
29873,
514,
29889,
5060,
668,
353,
274,
8768,
29889,
29883,
29918,
524,
13,
1678,
926,
353,
6418,
1430,
29967,
4162,
29954,
29889,
3934,
29918,
29873,
514,
29898,
3934,
29897,
13,
1678,
736,
926,
13,
13,
13,
1753,
1653,
29918,
510,
2139,
29898,
23479,
1125,
13,
1678,
9995,
15646,
363,
1722,
26568,
3489,
740,
1015,
29926,
29918,
3258,
29918,
510,
2139,
29889,
13,
13,
1678,
6760,
1078,
263,
435,
29906,
29968,
29914,
29967,
7982,
29914,
29967,
29925,
29906,
24221,
3829,
29889,
13,
1678,
9995,
13,
1678,
6418,
1430,
29967,
4162,
29954,
29889,
459,
29926,
29918,
3258,
29918,
510,
2139,
29889,
1191,
8768,
353,
518,
312,
7384,
29889,
29883,
29918,
524,
29962,
13,
1678,
6418,
1430,
29967,
4162,
29954,
29889,
459,
29926,
29918,
3258,
29918,
510,
2139,
29889,
5060,
668,
353,
274,
8768,
29889,
29925,
6992,
4945,
29898,
1523,
2590,
3401,
1542,
29897,
13,
1678,
274,
3888,
353,
6418,
1430,
29967,
4162,
29954,
29889,
459,
29926,
29918,
3258,
29918,
510,
2139,
29898,
23479,
29897,
13,
1678,
736,
274,
3888,
13,
13,
13,
1753,
1653,
29918,
311,
510,
2139,
29898,
23479,
1125,
13,
1678,
9995,
29956,
336,
567,
1722,
26568,
3489,
740,
1015,
29926,
29918,
3258,
29918,
311,
510,
2139,
29889,
13,
1678,
9995,
13,
1678,
6418,
1430,
29967,
4162,
29954,
29889,
459,
29926,
29918,
3258,
29918,
311,
510,
2139,
29889,
1191,
8768,
353,
518,
312,
7384,
29889,
29883,
29918,
524,
29962,
13,
1678,
1791,
668,
353,
274,
8768,
29889,
29925,
6992,
4945,
29898,
2772,
510,
2590,
3401,
1542,
29897,
13,
1678,
6418,
1430,
29967,
4162,
29954,
29889,
459,
29926,
29918,
3258,
29918,
311,
510,
2139,
29889,
5060,
668,
353,
1791,
668,
13,
1678,
270,
3888,
353,
6418,
1430,
29967,
4162,
29954,
29889,
459,
29926,
29918,
3258,
29918,
311,
510,
2139,
29898,
23479,
29897,
13,
1678,
736,
270,
3888,
13,
13,
13,
1753,
21822,
29898,
29881,
3888,
29892,
274,
601,
1125,
13,
1678,
9995,
15646,
363,
1015,
29926,
29918,
13808,
29889,
13,
1678,
9995,
13,
1678,
1852,
8768,
353,
518,
312,
7384,
29889,
29925,
6992,
4945,
29898,
2772,
510,
2590,
3401,
1542,
511,
274,
8768,
29889,
29925,
6992,
4945,
29898,
29907,
601,
1542,
4638,
13,
1678,
6418,
1430,
29967,
4162,
29954,
29889,
459,
29926,
29918,
13808,
29889,
1191,
8768,
353,
1852,
8768,
13,
1678,
6418,
1430,
29967,
4162,
29954,
29889,
459,
29926,
29918,
13808,
29889,
5060,
668,
353,
274,
8768,
29889,
29925,
6992,
4945,
29898,
2940,
1542,
29897,
13,
1678,
1967,
353,
6418,
1430,
29967,
4162,
29954,
29889,
459,
29926,
29918,
13808,
29898,
29881,
3888,
29892,
274,
601,
29897,
13,
1678,
736,
1967,
13,
13,
13,
1753,
8174,
29918,
510,
2139,
29898,
29883,
3888,
1125,
13,
1678,
9995,
15646,
363,
1722,
26568,
3489,
740,
1015,
29926,
29918,
20524,
29918,
510,
2139,
29889,
13,
13,
1678,
23708,
7788,
363,
263,
27122,
272,
4386,
29889,
13,
1678,
9995,
13,
1678,
1852,
8768,
353,
518,
312,
7384,
29889,
29925,
6992,
4945,
29898,
1523,
2590,
3401,
1542,
4638,
13,
1678,
6418,
1430,
29967,
4162,
29954,
29889,
459,
29926,
29918,
20524,
29918,
510,
2139,
29889,
1191,
8768,
353,
1852,
8768,
13,
1678,
6418,
1430,
29967,
4162,
29954,
29889,
459,
29926,
29918,
20524,
29918,
510,
2139,
29898,
29883,
3888,
29897,
13,
13,
13,
1753,
19750,
29898,
29883,
3888,
29892,
274,
601,
29892,
1967,
1125,
13,
1678,
9995,
15646,
363,
1722,
26568,
3489,
740,
1015,
29926,
29918,
12508,
29889,
13,
13,
1678,
11346,
2631,
385,
1967,
964,
263,
435,
4162,
29954,
29899,
29906,
29900,
29900,
29900,
15234,
342,
1633,
29889,
13,
13,
1678,
12662,
2699,
13,
1678,
448,
1378,
29899,
13,
1678,
274,
3888,
584,
24221,
4386,
13,
13,
1678,
274,
601,
584,
1962,
6835,
4840,
13,
13,
1678,
1967,
584,
1967,
304,
19750,
13,
1678,
9995,
13,
1678,
1852,
8768,
353,
518,
312,
7384,
29889,
29925,
6992,
4945,
29898,
1523,
2590,
3401,
1542,
511,
13,
18884,
274,
8768,
29889,
29925,
6992,
4945,
29898,
29907,
601,
1542,
511,
13,
18884,
274,
8768,
29889,
29925,
6992,
4945,
29898,
2940,
1542,
4638,
13,
1678,
6418,
1430,
29967,
4162,
29954,
29889,
459,
29926,
29918,
12508,
29889,
1191,
8768,
353,
1852,
8768,
13,
1678,
6418,
1430,
29967,
4162,
29954,
29889,
459,
29926,
29918,
12508,
29889,
5060,
668,
353,
274,
8768,
29889,
29883,
29918,
524,
13,
1678,
4660,
353,
6418,
1430,
29967,
4162,
29954,
29889,
459,
29926,
29918,
12508,
29898,
29883,
3888,
29892,
274,
601,
29892,
1967,
29897,
13,
1678,
736,
4660,
13,
13,
13,
1753,
8174,
29918,
311,
510,
2139,
29898,
29881,
3888,
1125,
13,
1678,
9995,
29956,
336,
567,
1722,
26568,
3489,
740,
1015,
29926,
29918,
20524,
29918,
311,
510,
2139,
1213,
15945,
13,
1678,
1852,
8768,
353,
518,
312,
7384,
29889,
29925,
6992,
4945,
29898,
2772,
510,
2590,
3401,
1542,
4638,
13,
1678,
6418,
1430,
29967,
4162,
29954,
29889,
459,
29926,
29918,
20524,
29918,
311,
510,
2139,
29889,
1191,
8768,
353,
1852,
8768,
13,
1678,
6418,
1430,
29967,
4162,
29954,
29889,
459,
29926,
29918,
20524,
29918,
311,
510,
2139,
29898,
29881,
3888,
29897,
13,
13,
13,
1753,
1967,
29918,
3258,
29898,
4912,
415,
862,
1516,
29892,
274,
3493,
1125,
13,
1678,
9995,
15646,
363,
1722,
26568,
3489,
740,
1015,
29926,
29918,
3027,
29918,
3258,
29889,
13,
1678,
9995,
13,
1678,
24471,
353,
518,
312,
7384,
29889,
29883,
29918,
524,
29892,
274,
8768,
29889,
29925,
6992,
4945,
29898,
2940,
1523,
415,
2177,
29885,
1542,
511,
274,
8768,
29889,
29883,
29918,
524,
29962,
13,
1678,
6418,
1430,
29967,
4162,
29954,
29889,
459,
29926,
29918,
3027,
29918,
3258,
29889,
1191,
8768,
353,
24471,
13,
1678,
6418,
1430,
29967,
4162,
29954,
29889,
459,
29926,
29918,
3027,
29918,
3258,
29889,
5060,
668,
353,
274,
8768,
29889,
29925,
6992,
4945,
29898,
2940,
1542,
29897,
13,
13,
1678,
1967,
353,
6418,
1430,
29967,
4162,
29954,
29889,
459,
29926,
29918,
3027,
29918,
3258,
29898,
2435,
29898,
4912,
415,
862,
1516,
511,
7477,
415,
862,
1516,
29892,
274,
3493,
29897,
13,
1678,
736,
29898,
3027,
29897,
13,
13,
13,
1753,
1967,
29918,
20524,
29898,
3027,
1125,
13,
1678,
9995,
29956,
336,
567,
1722,
26568,
3489,
740,
1015,
29926,
29918,
3027,
29918,
20524,
1213,
15945,
13,
1678,
6418,
1430,
29967,
4162,
29954,
29889,
459,
29926,
29918,
3027,
29918,
20524,
29889,
1191,
8768,
353,
518,
312,
7384,
29889,
29925,
6992,
4945,
29898,
2940,
1542,
4638,
13,
1678,
6418,
1430,
29967,
4162,
29954,
29889,
459,
29926,
29918,
3027,
29918,
20524,
29898,
3027,
29897,
13,
13,
13,
1753,
731,
29918,
4381,
29918,
3977,
6119,
29918,
16744,
7295,
13,
1678,
9995,
15646,
363,
1722,
26568,
3489,
740,
1015,
29926,
29918,
842,
29918,
4381,
29918,
3977,
6119,
29918,
16744,
29889,
13,
1678,
9995,
13,
1678,
274,
7529,
353,
422,
2590,
11507,
1542,
580,
13,
1678,
1852,
8768,
353,
518,
312,
7384,
29889,
29925,
6992,
4945,
29898,
1523,
2590,
11507,
1542,
4638,
13,
1678,
6418,
1430,
29967,
4162,
29954,
29889,
459,
29926,
29918,
842,
29918,
4381,
29918,
3977,
6119,
29918,
16744,
29889,
1191,
8768,
353,
1852,
8768,
13,
1678,
6418,
1430,
29967,
4162,
29954,
29889,
459,
29926,
29918,
842,
29918,
4381,
29918,
3977,
6119,
29918,
16744,
29898,
312,
7384,
29889,
1609,
999,
29898,
29883,
7529,
876,
13,
1678,
736,
274,
7529,
13,
13,
13,
1753,
731,
29918,
4381,
29918,
7099,
6119,
29918,
16744,
29898,
29881,
7529,
29918,
29886,
1125,
13,
1678,
9995,
15646,
363,
1015,
29926,
29918,
842,
29918,
4381,
29918,
7099,
6119,
29918,
16744,
29889,
13,
1678,
9995,
13,
1678,
1852,
8768,
353,
518,
312,
7384,
29889,
29925,
6992,
4945,
29898,
2772,
510,
2590,
11507,
1542,
4638,
13,
1678,
6418,
1430,
29967,
4162,
29954,
29889,
459,
29926,
29918,
842,
29918,
4381,
29918,
7099,
6119,
29918,
16744,
29889,
1191,
8768,
353,
1852,
8768,
13,
1678,
6418,
1430,
29967,
4162,
29954,
29889,
459,
29926,
29918,
842,
29918,
4381,
29918,
7099,
6119,
29918,
16744,
29898,
29881,
7529,
29918,
29886,
29897,
13,
13,
13,
1753,
731,
29918,
3696,
29918,
29885,
629,
29898,
29881,
3888,
29892,
1741,
29918,
29885,
629,
29892,
3030,
29922,
8516,
1125,
13,
1678,
9995,
15646,
363,
1722,
26568,
3489,
740,
1015,
29926,
29918,
842,
29918,
3696,
29918,
29885,
629,
29889,
13,
1678,
9995,
13,
1678,
1852,
8768,
353,
518,
312,
7384,
29889,
29925,
6992,
4945,
29898,
18877,
19560,
1542,
511,
13,
18884,
274,
8768,
29889,
29925,
6992,
4945,
29898,
2624,
29924,
629,
1542,
511,
13,
18884,
274,
8768,
29889,
29883,
29918,
5405,
29918,
29886,
29962,
13,
1678,
6418,
1430,
29967,
4162,
29954,
29889,
459,
29926,
29918,
842,
29918,
3696,
29918,
29885,
629,
29889,
1191,
8768,
353,
1852,
8768,
13,
1678,
6418,
1430,
29967,
4162,
29954,
29889,
459,
29926,
29918,
842,
29918,
3696,
29918,
29885,
629,
29898,
312,
7384,
29889,
4384,
29898,
29881,
3888,
29892,
13,
462,
462,
965,
274,
8768,
29889,
29925,
6992,
4945,
29898,
18877,
19560,
1542,
8243,
13,
462,
1669,
1741,
29918,
29885,
629,
29892,
3030,
29897,
13,
13,
13,
1753,
6230,
29918,
3977,
6119,
29898,
29883,
3888,
29892,
274,
16744,
29892,
1967,
1125,
13,
1678,
9995,
15646,
363,
1722,
26568,
3489,
740,
1015,
29926,
29918,
14669,
29918,
7099,
6119,
1213,
15945,
13,
1678,
1852,
8768,
353,
518,
312,
7384,
29889,
29925,
6992,
4945,
29898,
1523,
2590,
3401,
1542,
511,
13,
18884,
274,
8768,
29889,
29925,
6992,
4945,
29898,
1523,
2590,
11507,
1542,
511,
13,
18884,
274,
8768,
29889,
29925,
6992,
4945,
29898,
2940,
1542,
4638,
13,
1678,
6418,
1430,
29967,
4162,
29954,
29889,
459,
29926,
29918,
14669,
29918,
3977,
6119,
29889,
1191,
8768,
353,
1852,
8768,
13,
1678,
6418,
1430,
29967,
4162,
29954,
29889,
459,
29926,
29918,
14669,
29918,
3977,
6119,
29898,
29883,
3888,
29892,
274,
16744,
29892,
1967,
29897,
13,
13,
13,
1753,
6230,
29918,
7099,
6119,
29898,
29881,
3888,
29892,
270,
7529,
1125,
13,
1678,
9995,
15646,
363,
1722,
26568,
3489,
740,
1015,
29926,
29918,
14669,
29918,
7099,
6119,
1213,
15945,
13,
1678,
1852,
8768,
353,
518,
312,
7384,
29889,
29925,
6992,
4945,
29898,
2772,
510,
2590,
3401,
1542,
511,
13,
18884,
274,
8768,
29889,
29925,
6992,
4945,
29898,
2772,
510,
2590,
11507,
1542,
4638,
13,
1678,
6418,
1430,
29967,
4162,
29954,
29889,
459,
29926,
29918,
14669,
29918,
7099,
6119,
29889,
1191,
8768,
353,
1852,
8768,
13,
1678,
6418,
1430,
29967,
4162,
29954,
29889,
459,
29926,
29918,
14669,
29918,
7099,
6119,
29898,
29881,
3888,
29892,
270,
7529,
29897,
13,
2
] |
env.py | Reeche/metacognitive_learning_part23 | 0 | 81790 | import numpy as np
from heuristics import lex, equalweight
from utils import select_p_based_on_experiment
class environment():
def __init__(self, x1, y1, x2, y2, p, experiment):
"""
The environment is initiated with different parameters of x1, x2, y1, y2 and p.
:param x1: uniform[-10, 10]
:param y1: uniform[-10, 10]
:param x2: uniform[-10, 10]
:param y2: uniform[-10, 10]
:param p: uniform[0.5, 1]
:param experiment: which experiment is currently run, 1 denotes part II.a,
2 denotes part II.b, 3 denotes part II.c, 4 denotes the part III
"""
# gamble 1
self.x1 = x1
self.y1 = y1
# gamble 2
self.x2 = x2
self.y2 = y2
self.p = p
self.experiment = experiment
def step(self, strategy: int):
"""
The environment receives the selected strategy/heuristic and outputs the selected outcome (x1, y1, x2 or y2).
It also selects the next p.
:param strategy: the selected heuristic/strategy (LEX or EQW) by the RL agent
:return: the selected outcome (x1, y1, x2, y2), the execution time of the selected strategy and next p
"""
# creates a dictionary combining the payoffs and their corresponding probabilities
probability_dict = {"x1": self.p,
"y1": 1 - self.p,
"x2": self.p,
"y2": 1 - self.p}
# creates a dictionary combining the payoffs and their corresponding values
values_dict = {"x1": self.x1,
"y1": self.y1,
"x2": self.x2,
"y2": self.y2}
if strategy == 0: #LEX
outcome, execution_time = lex(probability_dict, values_dict)
else: #EQW
outcome, execution_time = equalweight(values_dict)
# get p
next_p = select_p_based_on_experiment(self.experiment)
return outcome, execution_time, next_p
def reward(self, selected_outcome: str, execution_time: float):
"""
The selected outcome determines whether gamble 1 or gamble 2 is played
(if x1 or y1 is chosen -> gamble 1; if x2 or y2 is chosen -> gamble 2).
Based on the gamble, the reward is calculated based on the uniformly generated values and the probabilities.
:param selected_outcome: the selected outcome (x1, y1, x2, y2)
:param execution_time: the execution time of the used strategy
:return:
"""
if selected_outcome.endswith("1"): #selected gamble 1
reward = np.random.choice([float(self.x1), float(self.y1)], 1, p=[self.p, 1 - self.p])
else: #selected gamble 2
reward = np.random.choice([float(self.x2), float(self.y2)], 1, p=[self.p, 1 - self.p])
return reward - execution_time
| [
1,
1053,
12655,
408,
7442,
13,
13,
3166,
540,
332,
6765,
1053,
19566,
29892,
5186,
7915,
13,
3166,
3667,
29879,
1053,
1831,
29918,
29886,
29918,
6707,
29918,
265,
29918,
735,
15362,
13,
13,
1990,
5177,
7295,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
921,
29896,
29892,
343,
29896,
29892,
921,
29906,
29892,
343,
29906,
29892,
282,
29892,
7639,
1125,
13,
4706,
9995,
13,
4706,
450,
5177,
338,
14511,
630,
411,
1422,
4128,
310,
921,
29896,
29892,
921,
29906,
29892,
343,
29896,
29892,
343,
29906,
322,
282,
29889,
13,
13,
4706,
584,
3207,
921,
29896,
29901,
9090,
14352,
29896,
29900,
29892,
29871,
29896,
29900,
29962,
13,
4706,
584,
3207,
343,
29896,
29901,
9090,
14352,
29896,
29900,
29892,
29871,
29896,
29900,
29962,
13,
4706,
584,
3207,
921,
29906,
29901,
9090,
14352,
29896,
29900,
29892,
29871,
29896,
29900,
29962,
13,
4706,
584,
3207,
343,
29906,
29901,
9090,
14352,
29896,
29900,
29892,
29871,
29896,
29900,
29962,
13,
4706,
584,
3207,
282,
29901,
9090,
29961,
29900,
29889,
29945,
29892,
29871,
29896,
29962,
13,
4706,
584,
3207,
7639,
29901,
607,
7639,
338,
5279,
1065,
29892,
29871,
29896,
20169,
760,
1944,
29889,
29874,
29892,
13,
308,
29906,
20169,
760,
1944,
29889,
29890,
29892,
29871,
29941,
20169,
760,
1944,
29889,
29883,
29892,
29871,
29946,
20169,
278,
760,
4786,
13,
4706,
9995,
13,
4706,
396,
24988,
569,
29871,
29896,
13,
4706,
1583,
29889,
29916,
29896,
353,
921,
29896,
13,
4706,
1583,
29889,
29891,
29896,
353,
343,
29896,
13,
13,
4706,
396,
24988,
569,
29871,
29906,
13,
4706,
1583,
29889,
29916,
29906,
353,
921,
29906,
13,
4706,
1583,
29889,
29891,
29906,
353,
343,
29906,
13,
13,
4706,
1583,
29889,
29886,
353,
282,
13,
4706,
1583,
29889,
735,
15362,
353,
7639,
13,
13,
1678,
822,
4331,
29898,
1311,
29892,
13705,
29901,
938,
1125,
13,
4706,
9995,
13,
4706,
450,
5177,
20586,
278,
4629,
13705,
29914,
354,
332,
4695,
322,
14391,
278,
4629,
21957,
313,
29916,
29896,
29892,
343,
29896,
29892,
921,
29906,
470,
343,
29906,
467,
13,
4706,
739,
884,
27778,
278,
2446,
282,
29889,
13,
13,
4706,
584,
3207,
13705,
29901,
278,
4629,
540,
332,
4695,
29914,
710,
8963,
313,
1307,
29990,
470,
382,
29984,
29956,
29897,
491,
278,
390,
29931,
10823,
13,
4706,
584,
2457,
29901,
278,
4629,
21957,
313,
29916,
29896,
29892,
343,
29896,
29892,
921,
29906,
29892,
343,
29906,
511,
278,
8225,
931,
310,
278,
4629,
13705,
322,
2446,
282,
13,
4706,
9995,
13,
4706,
396,
10017,
263,
8600,
29299,
278,
5146,
22450,
322,
1009,
6590,
2070,
11614,
13,
4706,
6976,
29918,
8977,
353,
8853,
29916,
29896,
1115,
1583,
29889,
29886,
29892,
13,
462,
9651,
376,
29891,
29896,
1115,
29871,
29896,
448,
1583,
29889,
29886,
29892,
13,
462,
9651,
376,
29916,
29906,
1115,
1583,
29889,
29886,
29892,
13,
462,
9651,
376,
29891,
29906,
1115,
29871,
29896,
448,
1583,
29889,
29886,
29913,
13,
13,
4706,
396,
10017,
263,
8600,
29299,
278,
5146,
22450,
322,
1009,
6590,
1819,
13,
4706,
1819,
29918,
8977,
353,
8853,
29916,
29896,
1115,
1583,
29889,
29916,
29896,
29892,
13,
462,
539,
376,
29891,
29896,
1115,
1583,
29889,
29891,
29896,
29892,
13,
462,
539,
376,
29916,
29906,
1115,
1583,
29889,
29916,
29906,
29892,
13,
462,
539,
376,
29891,
29906,
1115,
1583,
29889,
29891,
29906,
29913,
13,
13,
4706,
565,
13705,
1275,
29871,
29900,
29901,
396,
1307,
29990,
13,
9651,
21957,
29892,
8225,
29918,
2230,
353,
19566,
29898,
22795,
3097,
29918,
8977,
29892,
1819,
29918,
8977,
29897,
13,
4706,
1683,
29901,
396,
28879,
29956,
13,
9651,
21957,
29892,
8225,
29918,
2230,
353,
5186,
7915,
29898,
5975,
29918,
8977,
29897,
13,
13,
4706,
396,
679,
282,
13,
4706,
2446,
29918,
29886,
353,
1831,
29918,
29886,
29918,
6707,
29918,
265,
29918,
735,
15362,
29898,
1311,
29889,
735,
15362,
29897,
13,
13,
4706,
736,
21957,
29892,
8225,
29918,
2230,
29892,
2446,
29918,
29886,
13,
13,
1678,
822,
20751,
29898,
1311,
29892,
4629,
29918,
449,
2763,
29901,
851,
29892,
8225,
29918,
2230,
29901,
5785,
1125,
13,
4706,
9995,
13,
4706,
450,
4629,
21957,
3683,
1475,
3692,
24988,
569,
29871,
29896,
470,
24988,
569,
29871,
29906,
338,
5318,
13,
4706,
313,
361,
921,
29896,
470,
343,
29896,
338,
10434,
1599,
24988,
569,
29871,
29896,
29936,
565,
921,
29906,
470,
343,
29906,
338,
10434,
1599,
24988,
569,
29871,
29906,
467,
13,
4706,
16564,
373,
278,
24988,
569,
29892,
278,
20751,
338,
12833,
2729,
373,
278,
26018,
5759,
1819,
322,
278,
2070,
11614,
29889,
13,
13,
4706,
584,
3207,
4629,
29918,
449,
2763,
29901,
278,
4629,
21957,
313,
29916,
29896,
29892,
343,
29896,
29892,
921,
29906,
29892,
343,
29906,
29897,
13,
4706,
584,
3207,
8225,
29918,
2230,
29901,
278,
8225,
931,
310,
278,
1304,
13705,
13,
4706,
584,
2457,
29901,
13,
4706,
9995,
13,
4706,
565,
4629,
29918,
449,
2763,
29889,
1975,
2541,
703,
29896,
29908,
1125,
396,
8391,
24988,
569,
29871,
29896,
13,
9651,
20751,
353,
7442,
29889,
8172,
29889,
16957,
4197,
7411,
29898,
1311,
29889,
29916,
29896,
511,
5785,
29898,
1311,
29889,
29891,
29896,
29897,
1402,
29871,
29896,
29892,
282,
11759,
1311,
29889,
29886,
29892,
29871,
29896,
448,
1583,
29889,
29886,
2314,
13,
4706,
1683,
29901,
396,
8391,
24988,
569,
29871,
29906,
13,
9651,
20751,
353,
7442,
29889,
8172,
29889,
16957,
4197,
7411,
29898,
1311,
29889,
29916,
29906,
511,
5785,
29898,
1311,
29889,
29891,
29906,
29897,
1402,
29871,
29896,
29892,
282,
11759,
1311,
29889,
29886,
29892,
29871,
29896,
448,
1583,
29889,
29886,
2314,
13,
4706,
736,
20751,
448,
8225,
29918,
2230,
13,
13,
2
] |
venv/lib/python3.6/site-packages/ansible_collections/dellemc/openmanage/tests/unit/plugins/modules/test_dellemc_configure_idrac_eventing.py | usegalaxy-no/usegalaxy | 1 | 172225 | # -*- coding: utf-8 -*-
#
# Dell EMC OpenManage Ansible Modules
# Version 3.0.0
# Copyright (C) 2020-2021 Dell Inc. or its subsidiaries. All Rights Reserved.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
#
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import pytest
from ansible_collections.dellemc.openmanage.plugins.modules import dellemc_configure_idrac_eventing
from ansible_collections.dellemc.openmanage.tests.unit.plugins.modules.common import FakeAnsibleModule, Constants
from ansible_collections.dellemc.openmanage.tests.unit.compat.mock import MagicMock, patch, Mock, PropertyMock
from pytest import importorskip
importorskip("omsdk.sdkfile")
importorskip("omsdk.sdkcreds")
class TestConfigureEventing(FakeAnsibleModule):
module = dellemc_configure_idrac_eventing
@pytest.fixture
def idrac_configure_eventing_mock(self, mocker):
omsdk_mock = MagicMock()
idrac_obj = MagicMock()
omsdk_mock.file_share_manager = idrac_obj
omsdk_mock.config_mgr = idrac_obj
type(idrac_obj).create_share_obj = Mock(return_value="Status")
type(idrac_obj).set_liason_share = Mock(return_value="Status")
return idrac_obj
@pytest.fixture
def idrac_file_manager_config_eventing_mock(self, mocker):
try:
file_manager_obj = mocker.patch(
'ansible_collections.dellemc.openmanage.plugins.modules.dellemc_configure_idrac_eventing.file_share_manager')
except AttributeError:
file_manager_obj = MagicMock()
obj = MagicMock()
file_manager_obj.create_share_obj.return_value = obj
return file_manager_obj
@pytest.fixture
def is_changes_applicable_eventing_mock(self, mocker):
try:
changes_applicable_obj = mocker.patch(
'ansible_collections.dellemc.openmanage.plugins.modules.dellemc_configure_idrac_eventing.config_mgr')
except AttributeError:
changes_applicable_obj = MagicMock()
obj = MagicMock()
changes_applicable_obj.is_change_applicable.return_value = obj
return changes_applicable_obj
@pytest.fixture
def idrac_connection_configure_eventing_mock(self, mocker, idrac_configure_eventing_mock):
idrac_conn_class_mock = mocker.patch('ansible_collections.dellemc.openmanage.plugins.modules.'
'dellemc_configure_idrac_eventing.iDRACConnection',
return_value=idrac_configure_eventing_mock)
idrac_conn_class_mock.return_value.__enter__.return_value = idrac_configure_eventing_mock
return idrac_configure_eventing_mock
def test_main_configure_eventing_success_case01(self, idrac_connection_configure_eventing_mock, idrac_default_args,
mocker, idrac_file_manager_config_eventing_mock):
idrac_default_args.update({"share_name": "sharename", 'share_password': None, "destination_number": 1,
"destination": "1.1.1.1", 'share_mnt': None, 'share_user': None})
message = {'msg': 'Successfully configured the idrac eventing settings.',
'eventing_status': {"Id": "JID_12345123456", "JobState": "Completed"},
'changed': True}
mocker.patch('ansible_collections.dellemc.openmanage.plugins.modules.'
'dellemc_configure_idrac_eventing.run_idrac_eventing_config', return_value=message)
result = self._run_module(idrac_default_args)
assert result["msg"] == "Successfully configured the iDRAC eventing settings."
def test_run_idrac_eventing_config_success_case01(self, idrac_connection_configure_eventing_mock,
idrac_file_manager_config_eventing_mock, idrac_default_args,
is_changes_applicable_eventing_mock):
idrac_default_args.update({"share_name": "sharename", "share_mnt": "mountname", "share_user": "shareuser",
"share_password": "<PASSWORD>", "destination_number": 1, "destination": "1.1.1.1",
"snmp_v3_username": "snmpuser", "snmp_trap_state": "Enabled", "alert_number": 4,
"email_alert_state": "Enabled", "address": "abc@xyz", "custom_message": "test",
"enable_alerts": "Enabled", "authentication": "Enabled",
"smtp_ip_address": "192.168.0.1", "smtp_port": 443, "username": "uname",
"password": "<PASSWORD>"})
message = {"changes_applicable": True, "message": "Changes found to commit!"}
idrac_connection_configure_eventing_mock.config_mgr.is_change_applicable.return_value = message
f_module = self.get_module_mock(params=idrac_default_args, check_mode=True)
with pytest.raises(Exception) as ex:
self.module.run_idrac_eventing_config(idrac_connection_configure_eventing_mock, f_module)
assert "Changes found to commit!" == ex.value.args[0]
def test_run_idrac_eventing_config_success_case02(self, idrac_connection_configure_eventing_mock,
idrac_file_manager_config_eventing_mock, idrac_default_args):
idrac_default_args.update({"share_name": "sharename", "share_mnt": "mountname", "share_user": "shareuser",
"share_password": "<PASSWORD>", "destination_number": 1, "destination": "1.1.1.1",
"snmp_v3_username": "snmpuser", "snmp_trap_state": "Enabled", "alert_number": 4,
"email_alert_state": "Enabled", "address": "abc@xyz", "custom_message": "test",
"enable_alerts": "Enabled", "authentication": "Enabled",
"smtp_ip_address": "192.168.0.1", "smtp_port": 443, "username": "uname",
"password": "<PASSWORD>"})
message = {"changes_applicable": True, "message": "changes found to commit!", "changed": True,
"Status": "Success"}
idrac_connection_configure_eventing_mock.config_mgr.apply_changes.return_value = message
f_module = self.get_module_mock(params=idrac_default_args)
f_module.check_mode = False
result = self.module.run_idrac_eventing_config(idrac_connection_configure_eventing_mock, f_module)
assert result['message'] == 'changes found to commit!'
def test_run_idrac_eventing_config_success_case03(self, idrac_connection_configure_eventing_mock,
idrac_file_manager_config_eventing_mock, idrac_default_args):
idrac_default_args.update({"share_name": "sharename", "share_mnt": "mountname", "share_user": "shareuser",
"share_password": "<PASSWORD>", "destination_number": 1,
"destination": "1.1.1.1", "snmp_v3_username": "snmpuser",
"snmp_trap_state": "Enabled", "alert_number": 4, "email_alert_state": "Enabled",
"address": "abc@xyz", "custom_message": "test", "enable_alerts": "Enabled",
"authentication": "Enabled", "smtp_ip_address": "192.168.0.1", "smtp_port": 443,
"username": "uname", "password": "<PASSWORD>"})
message = {"changes_applicable": False, "Message": "No changes found to commit!", "changed": False,
"Status": "Success"}
idrac_connection_configure_eventing_mock.config_mgr.apply_changes.return_value = message
f_module = self.get_module_mock(params=idrac_default_args)
f_module.check_mode = False
result = self.module.run_idrac_eventing_config(idrac_connection_configure_eventing_mock, f_module)
assert result["Message"] == 'No changes found to commit!'
def test_run_idrac_eventing_config_success_case04(self, idrac_connection_configure_eventing_mock,
idrac_default_args, idrac_file_manager_config_eventing_mock):
idrac_default_args.update({"share_name": "sharename", "share_mnt": "mountname", "share_user": "shareuser",
"share_password": "<PASSWORD>", "destination_number": 1, "destination": "1.1.1.1",
"snmp_v3_username": "snmpuser", "snmp_trap_state": "Enabled", "alert_number": 4,
"email_alert_state": "Enabled", "address": "abc@xyz", "custom_message": "test",
"enable_alerts": "Enabled", "authentication": "Enabled",
"smtp_ip_address": "192.168.0.1", "smtp_port": 443, "username": "uname",
"password": "<PASSWORD>"})
message = {"changes_applicable": False, "Message": "No changes were applied", "changed": False,
"Status": "Success"}
idrac_connection_configure_eventing_mock.config_mgr.apply_changes.return_value = message
f_module = self.get_module_mock(params=idrac_default_args)
f_module.check_mode = False
result = self.module.run_idrac_eventing_config(idrac_connection_configure_eventing_mock, f_module)
assert result['Message'] == 'No changes were applied'
def test_run_idrac_eventing_config_success_case05(self, idrac_connection_configure_eventing_mock,
idrac_file_manager_config_eventing_mock, idrac_default_args):
idrac_default_args.update({"share_name": "sharename", "share_mnt": "mountname", "share_user": "shareuser",
"share_password": "<PASSWORD>", "destination_number": None, "destination": None,
"snmp_v3_username": None, "snmp_trap_state": None, "alert_number": None,
"email_alert_state": None, "address": None, "custom_message": None,
"enable_alerts": None, "authentication": None,
"smtp_ip_address": None, "smtp_port": None, "username": None,
"password": <PASSWORD>})
message = {"changes_applicable": False, "Message": "No changes were applied", "changed": False,
"Status": "Success"}
obj = MagicMock()
idrac_connection_configure_eventing_mock.config_mgr = obj
type(obj).configure_snmp_trap_destination = PropertyMock(return_value=message)
type(obj).configure_email_alerts = PropertyMock(return_value=message)
type(obj).configure_idrac_alerts = PropertyMock(return_value=message)
type(obj).configure_smtp_server_settings = PropertyMock(return_value=message)
idrac_connection_configure_eventing_mock.config_mgr.apply_changes.return_value = message
f_module = self.get_module_mock(params=idrac_default_args)
f_module.check_mode = False
result = self.module.run_idrac_eventing_config(idrac_connection_configure_eventing_mock, f_module)
assert result['Message'] == 'No changes were applied'
def test_run_idrac_eventing_config_failed_case01(self, idrac_connection_configure_eventing_mock,
idrac_file_manager_config_eventing_mock, idrac_default_args):
idrac_default_args.update({"share_name": "sharename", "share_mnt": "mountname", "share_user": "shareuser",
"share_password": "<PASSWORD>", "destination_number": 1, "destination": "1.1.1.1",
"snmp_v3_username": "snmpuser", "snmp_trap_state": "Enabled", "alert_number": 4,
"email_alert_state": "Enabled", "address": "abc@xyz", "custom_message": "test",
"enable_alerts": "Enabled", "authentication": "Enabled",
"smtp_ip_address": "192.168.0.1", "smtp_port": 443, "username": "uname",
"password": "<PASSWORD>"})
message = {'Status': 'Failed', "Data": {'Message': 'status failed in checking Data'}}
idrac_connection_configure_eventing_mock.file_share_manager.create_share_obj.return_value = "mnt/iso"
idrac_connection_configure_eventing_mock.config_mgr.set_liason_share.return_value = message
f_module = self.get_module_mock(params=idrac_default_args)
with pytest.raises(Exception) as ex:
self.module.run_idrac_eventing_config(idrac_connection_configure_eventing_mock, f_module)
assert ex.value.args[0] == 'status failed in checking Data'
def test_run_idrac_eventing_config_failed_case02(self, idrac_connection_configure_eventing_mock,
idrac_default_args, idrac_file_manager_config_eventing_mock):
idrac_default_args.update({"share_name": "sharename", "share_mnt": "mountname", "share_user": "shareuser",
"share_password": "<PASSWORD>", "destination_number": 1, "destination": "1.1.1.1",
"snmp_v3_username": "snmpuser", "snmp_trap_state": "Enabled", "alert_number": 4,
"email_alert_state": "Enabled", "address": "abc@xyz", "custom_message": "test",
"enable_alerts": "Enabled", "authentication": "Enabled",
"smtp_ip_address": "192.168.0.1", "smtp_port": 443, "username": "uname",
"password": "<PASSWORD>"})
message = {"changes_applicable": False, "Message": "No changes were applied", "changed": False,
"Status": "failed"}
idrac_connection_configure_eventing_mock.config_mgr.apply_changes.return_value = message
f_module = self.get_module_mock(params=idrac_default_args)
f_module.check_mode = False
result = self.module.run_idrac_eventing_config(idrac_connection_configure_eventing_mock, f_module)
assert result['Message'] == 'No changes were applied'
def test_run_idrac_eventing_config_failed_case03(self, idrac_connection_configure_eventing_mock,
idrac_default_args, idrac_file_manager_config_eventing_mock):
idrac_default_args.update({"share_name": "sharename", "share_mnt": "mountname", "share_user": "shareuser",
"share_password": "<PASSWORD>", "destination_number": 1,
"destination": "1.1.1.1", "snmp_v3_username": "snmpuser",
"snmp_trap_state": "Enabled", "alert_number": 4, "email_alert_state": "Enabled",
"address": "abc@xyz", "custom_message": "test", "enable_alerts": "Enabled",
"authentication": "Enabled", "smtp_ip_address": "192.168.0.1",
"smtp_port": 443, "username": "uname", "password": "<PASSWORD>"})
message = {'Status': 'Failed', "Data": {'Message': "Failed to found changes"}}
idrac_connection_configure_eventing_mock.file_share_manager.create_share_obj.return_value = "mnt/iso"
idrac_connection_configure_eventing_mock.config_mgr.set_liason_share.return_value = message
f_module = self.get_module_mock(params=idrac_default_args)
with pytest.raises(Exception) as ex:
self.module.run_idrac_eventing_config(idrac_connection_configure_eventing_mock, f_module)
assert ex.value.args[0] == 'Failed to found changes'
@pytest.mark.parametrize("exc_type", [ImportError, ValueError, RuntimeError])
def test_main_configure_eventing_exception_handling_case(self, exc_type, mocker, idrac_default_args,
idrac_connection_configure_eventing_mock,
idrac_file_manager_config_eventing_mock):
idrac_default_args.update({"share_name": "sharename", 'share_password': <PASSWORD>,
'share_mnt': None, 'share_user': None})
mocker.patch('ansible_collections.dellemc.openmanage.plugins.modules.'
'dellemc_configure_idrac_eventing.run_idrac_eventing_config', side_effect=exc_type('test'))
result = self._run_module_with_fail_json(idrac_default_args)
assert 'msg' in result
assert result['failed'] is True
| [
1,
396,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
13,
29937,
13,
29937,
360,
514,
382,
12513,
4673,
2517,
482,
530,
1687,
3382,
2540,
13,
29937,
10079,
29871,
29941,
29889,
29900,
29889,
29900,
13,
29937,
14187,
1266,
313,
29907,
29897,
29871,
29906,
29900,
29906,
29900,
29899,
29906,
29900,
29906,
29896,
360,
514,
9266,
29889,
470,
967,
11684,
8819,
4314,
29889,
2178,
26863,
2538,
9841,
29889,
13,
13,
29937,
15143,
4593,
5236,
19245,
325,
29941,
29889,
29900,
29974,
313,
4149,
315,
4590,
29979,
4214,
470,
2045,
597,
1636,
29889,
18713,
29889,
990,
29914,
506,
11259,
29914,
29887,
572,
29899,
29941,
29889,
29900,
29889,
3945,
29897,
13,
29937,
13,
13,
3166,
4770,
29888,
9130,
1649,
1053,
313,
23552,
29918,
5215,
29892,
8542,
29892,
1596,
29918,
2220,
29897,
13,
13,
1649,
2527,
562,
605,
1649,
353,
1134,
13,
13,
5215,
11451,
1688,
13,
3166,
385,
1687,
29918,
29027,
29889,
29881,
1808,
14047,
29889,
3150,
1171,
482,
29889,
12800,
29889,
7576,
1053,
628,
2409,
29883,
29918,
17591,
29918,
333,
945,
29918,
3696,
292,
13,
3166,
385,
1687,
29918,
29027,
29889,
29881,
1808,
14047,
29889,
3150,
1171,
482,
29889,
21150,
29889,
5441,
29889,
12800,
29889,
7576,
29889,
9435,
1053,
383,
1296,
2744,
1687,
7355,
29892,
5798,
1934,
13,
3166,
385,
1687,
29918,
29027,
29889,
29881,
1808,
14047,
29889,
3150,
1171,
482,
29889,
21150,
29889,
5441,
29889,
12667,
29889,
17640,
1053,
26494,
18680,
29892,
13261,
29892,
26297,
29892,
9079,
18680,
13,
3166,
11451,
1688,
1053,
1053,
272,
11014,
13,
13,
5215,
272,
11014,
703,
4835,
8181,
29889,
15348,
1445,
1159,
13,
5215,
272,
11014,
703,
4835,
8181,
29889,
15348,
1037,
6289,
1159,
13,
13,
13,
1990,
4321,
3991,
545,
2624,
292,
29898,
29943,
1296,
2744,
1687,
7355,
1125,
13,
1678,
3883,
353,
628,
2409,
29883,
29918,
17591,
29918,
333,
945,
29918,
3696,
292,
13,
13,
1678,
732,
2272,
1688,
29889,
7241,
15546,
13,
1678,
822,
1178,
945,
29918,
17591,
29918,
3696,
292,
29918,
17640,
29898,
1311,
29892,
286,
8658,
1125,
13,
4706,
288,
1516,
8181,
29918,
17640,
353,
26494,
18680,
580,
13,
4706,
1178,
945,
29918,
5415,
353,
26494,
18680,
580,
13,
4706,
288,
1516,
8181,
29918,
17640,
29889,
1445,
29918,
13653,
29918,
12847,
353,
1178,
945,
29918,
5415,
13,
4706,
288,
1516,
8181,
29918,
17640,
29889,
2917,
29918,
29885,
629,
353,
1178,
945,
29918,
5415,
13,
4706,
1134,
29898,
333,
945,
29918,
5415,
467,
3258,
29918,
13653,
29918,
5415,
353,
26297,
29898,
2457,
29918,
1767,
543,
5709,
1159,
13,
4706,
1134,
29898,
333,
945,
29918,
5415,
467,
842,
29918,
492,
1658,
29918,
13653,
353,
26297,
29898,
2457,
29918,
1767,
543,
5709,
1159,
13,
4706,
736,
1178,
945,
29918,
5415,
13,
13,
1678,
732,
2272,
1688,
29889,
7241,
15546,
13,
1678,
822,
1178,
945,
29918,
1445,
29918,
12847,
29918,
2917,
29918,
3696,
292,
29918,
17640,
29898,
1311,
29892,
286,
8658,
1125,
13,
4706,
1018,
29901,
13,
9651,
934,
29918,
12847,
29918,
5415,
353,
286,
8658,
29889,
5041,
29898,
13,
18884,
525,
550,
1821,
29918,
29027,
29889,
29881,
1808,
14047,
29889,
3150,
1171,
482,
29889,
12800,
29889,
7576,
29889,
29881,
1808,
14047,
29918,
17591,
29918,
333,
945,
29918,
3696,
292,
29889,
1445,
29918,
13653,
29918,
12847,
1495,
13,
4706,
5174,
23833,
2392,
29901,
13,
9651,
934,
29918,
12847,
29918,
5415,
353,
26494,
18680,
580,
13,
4706,
5446,
353,
26494,
18680,
580,
13,
4706,
934,
29918,
12847,
29918,
5415,
29889,
3258,
29918,
13653,
29918,
5415,
29889,
2457,
29918,
1767,
353,
5446,
13,
4706,
736,
934,
29918,
12847,
29918,
5415,
13,
13,
1678,
732,
2272,
1688,
29889,
7241,
15546,
13,
1678,
822,
338,
29918,
25990,
29918,
932,
506,
519,
29918,
3696,
292,
29918,
17640,
29898,
1311,
29892,
286,
8658,
1125,
13,
4706,
1018,
29901,
13,
9651,
3620,
29918,
932,
506,
519,
29918,
5415,
353,
286,
8658,
29889,
5041,
29898,
13,
18884,
525,
550,
1821,
29918,
29027,
29889,
29881,
1808,
14047,
29889,
3150,
1171,
482,
29889,
12800,
29889,
7576,
29889,
29881,
1808,
14047,
29918,
17591,
29918,
333,
945,
29918,
3696,
292,
29889,
2917,
29918,
29885,
629,
1495,
13,
4706,
5174,
23833,
2392,
29901,
13,
9651,
3620,
29918,
932,
506,
519,
29918,
5415,
353,
26494,
18680,
580,
13,
4706,
5446,
353,
26494,
18680,
580,
13,
4706,
3620,
29918,
932,
506,
519,
29918,
5415,
29889,
275,
29918,
3167,
29918,
932,
506,
519,
29889,
2457,
29918,
1767,
353,
5446,
13,
4706,
736,
3620,
29918,
932,
506,
519,
29918,
5415,
13,
13,
1678,
732,
2272,
1688,
29889,
7241,
15546,
13,
1678,
822,
1178,
945,
29918,
9965,
29918,
17591,
29918,
3696,
292,
29918,
17640,
29898,
1311,
29892,
286,
8658,
29892,
1178,
945,
29918,
17591,
29918,
3696,
292,
29918,
17640,
1125,
13,
4706,
1178,
945,
29918,
13082,
29918,
1990,
29918,
17640,
353,
286,
8658,
29889,
5041,
877,
550,
1821,
29918,
29027,
29889,
29881,
1808,
14047,
29889,
3150,
1171,
482,
29889,
12800,
29889,
7576,
6169,
13,
462,
462,
632,
525,
29881,
1808,
14047,
29918,
17591,
29918,
333,
945,
29918,
3696,
292,
29889,
29875,
8353,
2477,
5350,
742,
13,
462,
462,
632,
736,
29918,
1767,
29922,
333,
945,
29918,
17591,
29918,
3696,
292,
29918,
17640,
29897,
13,
4706,
1178,
945,
29918,
13082,
29918,
1990,
29918,
17640,
29889,
2457,
29918,
1767,
17255,
5893,
26914,
2457,
29918,
1767,
353,
1178,
945,
29918,
17591,
29918,
3696,
292,
29918,
17640,
13,
4706,
736,
1178,
945,
29918,
17591,
29918,
3696,
292,
29918,
17640,
13,
13,
1678,
822,
1243,
29918,
3396,
29918,
17591,
29918,
3696,
292,
29918,
8698,
29918,
4878,
29900,
29896,
29898,
1311,
29892,
1178,
945,
29918,
9965,
29918,
17591,
29918,
3696,
292,
29918,
17640,
29892,
1178,
945,
29918,
4381,
29918,
5085,
29892,
13,
462,
462,
462,
1678,
286,
8658,
29892,
1178,
945,
29918,
1445,
29918,
12847,
29918,
2917,
29918,
3696,
292,
29918,
17640,
1125,
13,
4706,
1178,
945,
29918,
4381,
29918,
5085,
29889,
5504,
3319,
29908,
13653,
29918,
978,
1115,
376,
845,
279,
3871,
613,
525,
13653,
29918,
5630,
2396,
6213,
29892,
376,
23848,
29918,
4537,
1115,
29871,
29896,
29892,
13,
462,
462,
259,
376,
23848,
1115,
376,
29896,
29889,
29896,
29889,
29896,
29889,
29896,
613,
525,
13653,
29918,
29885,
593,
2396,
6213,
29892,
525,
13653,
29918,
1792,
2396,
6213,
1800,
13,
4706,
2643,
353,
11117,
7645,
2396,
525,
14191,
3730,
13252,
278,
1178,
945,
1741,
292,
6055,
29889,
742,
13,
462,
259,
525,
3696,
292,
29918,
4882,
2396,
8853,
1204,
1115,
376,
29967,
1367,
29918,
29896,
29906,
29941,
29946,
29945,
29896,
29906,
29941,
29946,
29945,
29953,
613,
376,
11947,
2792,
1115,
376,
26010,
10758,
13,
462,
259,
525,
15033,
2396,
5852,
29913,
13,
4706,
286,
8658,
29889,
5041,
877,
550,
1821,
29918,
29027,
29889,
29881,
1808,
14047,
29889,
3150,
1171,
482,
29889,
12800,
29889,
7576,
6169,
13,
462,
268,
525,
29881,
1808,
14047,
29918,
17591,
29918,
333,
945,
29918,
3696,
292,
29889,
3389,
29918,
333,
945,
29918,
3696,
292,
29918,
2917,
742,
736,
29918,
1767,
29922,
4906,
29897,
13,
4706,
1121,
353,
1583,
3032,
3389,
29918,
5453,
29898,
333,
945,
29918,
4381,
29918,
5085,
29897,
13,
4706,
4974,
1121,
3366,
7645,
3108,
1275,
376,
14191,
3730,
13252,
278,
474,
8353,
2477,
1741,
292,
6055,
1213,
13,
13,
1678,
822,
1243,
29918,
3389,
29918,
333,
945,
29918,
3696,
292,
29918,
2917,
29918,
8698,
29918,
4878,
29900,
29896,
29898,
1311,
29892,
1178,
945,
29918,
9965,
29918,
17591,
29918,
3696,
292,
29918,
17640,
29892,
13,
462,
462,
462,
418,
1178,
945,
29918,
1445,
29918,
12847,
29918,
2917,
29918,
3696,
292,
29918,
17640,
29892,
1178,
945,
29918,
4381,
29918,
5085,
29892,
13,
462,
462,
462,
418,
338,
29918,
25990,
29918,
932,
506,
519,
29918,
3696,
292,
29918,
17640,
1125,
13,
4706,
1178,
945,
29918,
4381,
29918,
5085,
29889,
5504,
3319,
29908,
13653,
29918,
978,
1115,
376,
845,
279,
3871,
613,
376,
13653,
29918,
29885,
593,
1115,
376,
16476,
978,
613,
376,
13653,
29918,
1792,
1115,
376,
13653,
1792,
613,
13,
462,
462,
259,
376,
13653,
29918,
5630,
1115,
9872,
25711,
17013,
28341,
376,
23848,
29918,
4537,
1115,
29871,
29896,
29892,
376,
23848,
1115,
376,
29896,
29889,
29896,
29889,
29896,
29889,
29896,
613,
13,
462,
462,
259,
376,
16586,
1526,
29918,
29894,
29941,
29918,
6786,
1115,
376,
16586,
1526,
1792,
613,
376,
16586,
1526,
29918,
29873,
2390,
29918,
3859,
1115,
376,
10861,
613,
376,
12888,
29918,
4537,
1115,
29871,
29946,
29892,
13,
462,
462,
259,
376,
5269,
29918,
12888,
29918,
3859,
1115,
376,
10861,
613,
376,
7328,
1115,
376,
10736,
29992,
20230,
613,
376,
6341,
29918,
4906,
1115,
376,
1688,
613,
13,
462,
462,
259,
376,
12007,
29918,
12888,
29879,
1115,
376,
10861,
613,
376,
23055,
1115,
376,
10861,
613,
13,
462,
462,
259,
376,
3844,
9392,
29918,
666,
29918,
7328,
1115,
376,
29896,
29929,
29906,
29889,
29896,
29953,
29947,
29889,
29900,
29889,
29896,
613,
376,
3844,
9392,
29918,
637,
1115,
29871,
29946,
29946,
29941,
29892,
376,
6786,
1115,
376,
348,
420,
613,
13,
462,
462,
259,
376,
5630,
1115,
9872,
25711,
17013,
11903,
1800,
13,
4706,
2643,
353,
8853,
25990,
29918,
932,
506,
519,
1115,
5852,
29892,
376,
4906,
1115,
376,
21459,
1476,
304,
9063,
3850,
29913,
13,
4706,
1178,
945,
29918,
9965,
29918,
17591,
29918,
3696,
292,
29918,
17640,
29889,
2917,
29918,
29885,
629,
29889,
275,
29918,
3167,
29918,
932,
506,
519,
29889,
2457,
29918,
1767,
353,
2643,
13,
4706,
285,
29918,
5453,
353,
1583,
29889,
657,
29918,
5453,
29918,
17640,
29898,
7529,
29922,
333,
945,
29918,
4381,
29918,
5085,
29892,
1423,
29918,
8513,
29922,
5574,
29897,
13,
4706,
411,
11451,
1688,
29889,
336,
4637,
29898,
2451,
29897,
408,
429,
29901,
13,
9651,
1583,
29889,
5453,
29889,
3389,
29918,
333,
945,
29918,
3696,
292,
29918,
2917,
29898,
333,
945,
29918,
9965,
29918,
17591,
29918,
3696,
292,
29918,
17640,
29892,
285,
29918,
5453,
29897,
13,
4706,
4974,
376,
21459,
1476,
304,
9063,
3850,
1275,
429,
29889,
1767,
29889,
5085,
29961,
29900,
29962,
13,
13,
1678,
822,
1243,
29918,
3389,
29918,
333,
945,
29918,
3696,
292,
29918,
2917,
29918,
8698,
29918,
4878,
29900,
29906,
29898,
1311,
29892,
1178,
945,
29918,
9965,
29918,
17591,
29918,
3696,
292,
29918,
17640,
29892,
13,
462,
462,
462,
418,
1178,
945,
29918,
1445,
29918,
12847,
29918,
2917,
29918,
3696,
292,
29918,
17640,
29892,
1178,
945,
29918,
4381,
29918,
5085,
1125,
13,
4706,
1178,
945,
29918,
4381,
29918,
5085,
29889,
5504,
3319,
29908,
13653,
29918,
978,
1115,
376,
845,
279,
3871,
613,
376,
13653,
29918,
29885,
593,
1115,
376,
16476,
978,
613,
376,
13653,
29918,
1792,
1115,
376,
13653,
1792,
613,
13,
462,
462,
259,
376,
13653,
29918,
5630,
1115,
9872,
25711,
17013,
28341,
376,
23848,
29918,
4537,
1115,
29871,
29896,
29892,
376,
23848,
1115,
376,
29896,
29889,
29896,
29889,
29896,
29889,
29896,
613,
13,
462,
462,
259,
376,
16586,
1526,
29918,
29894,
29941,
29918,
6786,
1115,
376,
16586,
1526,
1792,
613,
376,
16586,
1526,
29918,
29873,
2390,
29918,
3859,
1115,
376,
10861,
613,
376,
12888,
29918,
4537,
1115,
29871,
29946,
29892,
13,
462,
462,
259,
376,
5269,
29918,
12888,
29918,
3859,
1115,
376,
10861,
613,
376,
7328,
1115,
376,
10736,
29992,
20230,
613,
376,
6341,
29918,
4906,
1115,
376,
1688,
613,
13,
462,
462,
259,
376,
12007,
29918,
12888,
29879,
1115,
376,
10861,
613,
376,
23055,
1115,
376,
10861,
613,
13,
462,
462,
259,
376,
3844,
9392,
29918,
666,
29918,
7328,
1115,
376,
29896,
29929,
29906,
29889,
29896,
29953,
29947,
29889,
29900,
29889,
29896,
613,
376,
3844,
9392,
29918,
637,
1115,
29871,
29946,
29946,
29941,
29892,
376,
6786,
1115,
376,
348,
420,
613,
13,
462,
462,
259,
376,
5630,
1115,
9872,
25711,
17013,
11903,
1800,
13,
4706,
2643,
353,
8853,
25990,
29918,
932,
506,
519,
1115,
5852,
29892,
376,
4906,
1115,
376,
25990,
1476,
304,
9063,
29991,
613,
376,
15033,
1115,
5852,
29892,
13,
462,
259,
376,
5709,
1115,
376,
14191,
9092,
13,
4706,
1178,
945,
29918,
9965,
29918,
17591,
29918,
3696,
292,
29918,
17640,
29889,
2917,
29918,
29885,
629,
29889,
7302,
29918,
25990,
29889,
2457,
29918,
1767,
353,
2643,
13,
4706,
285,
29918,
5453,
353,
1583,
29889,
657,
29918,
5453,
29918,
17640,
29898,
7529,
29922,
333,
945,
29918,
4381,
29918,
5085,
29897,
13,
4706,
285,
29918,
5453,
29889,
3198,
29918,
8513,
353,
7700,
13,
4706,
1121,
353,
1583,
29889,
5453,
29889,
3389,
29918,
333,
945,
29918,
3696,
292,
29918,
2917,
29898,
333,
945,
29918,
9965,
29918,
17591,
29918,
3696,
292,
29918,
17640,
29892,
285,
29918,
5453,
29897,
13,
4706,
4974,
1121,
1839,
4906,
2033,
1275,
525,
25990,
1476,
304,
9063,
20714,
13,
13,
1678,
822,
1243,
29918,
3389,
29918,
333,
945,
29918,
3696,
292,
29918,
2917,
29918,
8698,
29918,
4878,
29900,
29941,
29898,
1311,
29892,
1178,
945,
29918,
9965,
29918,
17591,
29918,
3696,
292,
29918,
17640,
29892,
13,
462,
462,
462,
418,
1178,
945,
29918,
1445,
29918,
12847,
29918,
2917,
29918,
3696,
292,
29918,
17640,
29892,
1178,
945,
29918,
4381,
29918,
5085,
1125,
13,
4706,
1178,
945,
29918,
4381,
29918,
5085,
29889,
5504,
3319,
29908,
13653,
29918,
978,
1115,
376,
845,
279,
3871,
613,
376,
13653,
29918,
29885,
593,
1115,
376,
16476,
978,
613,
376,
13653,
29918,
1792,
1115,
376,
13653,
1792,
613,
13,
462,
462,
259,
376,
13653,
29918,
5630,
1115,
9872,
25711,
17013,
28341,
376,
23848,
29918,
4537,
1115,
29871,
29896,
29892,
13,
462,
462,
259,
376,
23848,
1115,
376,
29896,
29889,
29896,
29889,
29896,
29889,
29896,
613,
376,
16586,
1526,
29918,
29894,
29941,
29918,
6786,
1115,
376,
16586,
1526,
1792,
613,
13,
462,
462,
259,
376,
16586,
1526,
29918,
29873,
2390,
29918,
3859,
1115,
376,
10861,
613,
376,
12888,
29918,
4537,
1115,
29871,
29946,
29892,
376,
5269,
29918,
12888,
29918,
3859,
1115,
376,
10861,
613,
13,
462,
462,
259,
376,
7328,
1115,
376,
10736,
29992,
20230,
613,
376,
6341,
29918,
4906,
1115,
376,
1688,
613,
376,
12007,
29918,
12888,
29879,
1115,
376,
10861,
613,
13,
462,
462,
259,
376,
23055,
1115,
376,
10861,
613,
376,
3844,
9392,
29918,
666,
29918,
7328,
1115,
376,
29896,
29929,
29906,
29889,
29896,
29953,
29947,
29889,
29900,
29889,
29896,
613,
376,
3844,
9392,
29918,
637,
1115,
29871,
29946,
29946,
29941,
29892,
13,
462,
462,
259,
376,
6786,
1115,
376,
348,
420,
613,
376,
5630,
1115,
9872,
25711,
17013,
11903,
1800,
13,
4706,
2643,
353,
8853,
25990,
29918,
932,
506,
519,
1115,
7700,
29892,
376,
3728,
1115,
376,
3782,
3620,
1476,
304,
9063,
29991,
613,
376,
15033,
1115,
7700,
29892,
13,
462,
259,
376,
5709,
1115,
376,
14191,
9092,
13,
4706,
1178,
945,
29918,
9965,
29918,
17591,
29918,
3696,
292,
29918,
17640,
29889,
2917,
29918,
29885,
629,
29889,
7302,
29918,
25990,
29889,
2457,
29918,
1767,
353,
2643,
13,
4706,
285,
29918,
5453,
353,
1583,
29889,
657,
29918,
5453,
29918,
17640,
29898,
7529,
29922,
333,
945,
29918,
4381,
29918,
5085,
29897,
13,
4706,
285,
29918,
5453,
29889,
3198,
29918,
8513,
353,
7700,
13,
4706,
1121,
353,
1583,
29889,
5453,
29889,
3389,
29918,
333,
945,
29918,
3696,
292,
29918,
2917,
29898,
333,
945,
29918,
9965,
29918,
17591,
29918,
3696,
292,
29918,
17640,
29892,
285,
29918,
5453,
29897,
13,
4706,
4974,
1121,
3366,
3728,
3108,
1275,
525,
3782,
3620,
1476,
304,
9063,
20714,
13,
13,
1678,
822,
1243,
29918,
3389,
29918,
333,
945,
29918,
3696,
292,
29918,
2917,
29918,
8698,
29918,
4878,
29900,
29946,
29898,
1311,
29892,
1178,
945,
29918,
9965,
29918,
17591,
29918,
3696,
292,
29918,
17640,
29892,
13,
462,
462,
462,
418,
1178,
945,
29918,
4381,
29918,
5085,
29892,
1178,
945,
29918,
1445,
29918,
12847,
29918,
2917,
29918,
3696,
292,
29918,
17640,
1125,
13,
4706,
1178,
945,
29918,
4381,
29918,
5085,
29889,
5504,
3319,
29908,
13653,
29918,
978,
1115,
376,
845,
279,
3871,
613,
376,
13653,
29918,
29885,
593,
1115,
376,
16476,
978,
613,
376,
13653,
29918,
1792,
1115,
376,
13653,
1792,
613,
13,
462,
462,
259,
376,
13653,
29918,
5630,
1115,
9872,
25711,
17013,
28341,
376,
23848,
29918,
4537,
1115,
29871,
29896,
29892,
376,
23848,
1115,
376,
29896,
29889,
29896,
29889,
29896,
29889,
29896,
613,
13,
462,
462,
259,
376,
16586,
1526,
29918,
29894,
29941,
29918,
6786,
1115,
376,
16586,
1526,
1792,
613,
376,
16586,
1526,
29918,
29873,
2390,
29918,
3859,
1115,
376,
10861,
613,
376,
12888,
29918,
4537,
1115,
29871,
29946,
29892,
13,
462,
462,
259,
376,
5269,
29918,
12888,
29918,
3859,
1115,
376,
10861,
613,
376,
7328,
1115,
376,
10736,
29992,
20230,
613,
376,
6341,
29918,
4906,
1115,
376,
1688,
613,
13,
462,
462,
259,
376,
12007,
29918,
12888,
29879,
1115,
376,
10861,
613,
376,
23055,
1115,
376,
10861,
613,
13,
462,
462,
259,
376,
3844,
9392,
29918,
666,
29918,
7328,
1115,
376,
29896,
29929,
29906,
29889,
29896,
29953,
29947,
29889,
29900,
29889,
29896,
613,
376,
3844,
9392,
29918,
637,
1115,
29871,
29946,
29946,
29941,
29892,
376,
6786,
1115,
376,
348,
420,
613,
13,
462,
462,
259,
376,
5630,
1115,
9872,
25711,
17013,
11903,
1800,
13,
4706,
2643,
353,
8853,
25990,
29918,
932,
506,
519,
1115,
7700,
29892,
376,
3728,
1115,
376,
3782,
3620,
892,
7436,
613,
376,
15033,
1115,
7700,
29892,
13,
462,
259,
376,
5709,
1115,
376,
14191,
9092,
13,
4706,
1178,
945,
29918,
9965,
29918,
17591,
29918,
3696,
292,
29918,
17640,
29889,
2917,
29918,
29885,
629,
29889,
7302,
29918,
25990,
29889,
2457,
29918,
1767,
353,
2643,
13,
4706,
285,
29918,
5453,
353,
1583,
29889,
657,
29918,
5453,
29918,
17640,
29898,
7529,
29922,
333,
945,
29918,
4381,
29918,
5085,
29897,
13,
4706,
285,
29918,
5453,
29889,
3198,
29918,
8513,
353,
7700,
13,
4706,
1121,
353,
1583,
29889,
5453,
29889,
3389,
29918,
333,
945,
29918,
3696,
292,
29918,
2917,
29898,
333,
945,
29918,
9965,
29918,
17591,
29918,
3696,
292,
29918,
17640,
29892,
285,
29918,
5453,
29897,
13,
4706,
4974,
1121,
1839,
3728,
2033,
1275,
525,
3782,
3620,
892,
7436,
29915,
13,
13,
1678,
822,
1243,
29918,
3389,
29918,
333,
945,
29918,
3696,
292,
29918,
2917,
29918,
8698,
29918,
4878,
29900,
29945,
29898,
1311,
29892,
1178,
945,
29918,
9965,
29918,
17591,
29918,
3696,
292,
29918,
17640,
29892,
13,
462,
462,
462,
418,
1178,
945,
29918,
1445,
29918,
12847,
29918,
2917,
29918,
3696,
292,
29918,
17640,
29892,
1178,
945,
29918,
4381,
29918,
5085,
1125,
13,
4706,
1178,
945,
29918,
4381,
29918,
5085,
29889,
5504,
3319,
29908,
13653,
29918,
978,
1115,
376,
845,
279,
3871,
613,
376,
13653,
29918,
29885,
593,
1115,
376,
16476,
978,
613,
376,
13653,
29918,
1792,
1115,
376,
13653,
1792,
613,
13,
462,
462,
259,
376,
13653,
29918,
5630,
1115,
9872,
25711,
17013,
28341,
376,
23848,
29918,
4537,
1115,
6213,
29892,
376,
23848,
1115,
6213,
29892,
13,
462,
462,
259,
376,
16586,
1526,
29918,
29894,
29941,
29918,
6786,
1115,
6213,
29892,
376,
16586,
1526,
29918,
29873,
2390,
29918,
3859,
1115,
6213,
29892,
376,
12888,
29918,
4537,
1115,
6213,
29892,
13,
462,
462,
259,
376,
5269,
29918,
12888,
29918,
3859,
1115,
6213,
29892,
376,
7328,
1115,
6213,
29892,
376,
6341,
29918,
4906,
1115,
6213,
29892,
13,
462,
462,
259,
376,
12007,
29918,
12888,
29879,
1115,
6213,
29892,
376,
23055,
1115,
6213,
29892,
13,
462,
462,
259,
376,
3844,
9392,
29918,
666,
29918,
7328,
1115,
6213,
29892,
376,
3844,
9392,
29918,
637,
1115,
6213,
29892,
376,
6786,
1115,
6213,
29892,
13,
462,
462,
259,
376,
5630,
1115,
529,
25711,
17013,
29958,
1800,
13,
4706,
2643,
353,
8853,
25990,
29918,
932,
506,
519,
1115,
7700,
29892,
376,
3728,
1115,
376,
3782,
3620,
892,
7436,
613,
376,
15033,
1115,
7700,
29892,
13,
462,
259,
376,
5709,
1115,
376,
14191,
9092,
13,
4706,
5446,
353,
26494,
18680,
580,
13,
4706,
1178,
945,
29918,
9965,
29918,
17591,
29918,
3696,
292,
29918,
17640,
29889,
2917,
29918,
29885,
629,
353,
5446,
13,
4706,
1134,
29898,
5415,
467,
17591,
29918,
16586,
1526,
29918,
29873,
2390,
29918,
23848,
353,
9079,
18680,
29898,
2457,
29918,
1767,
29922,
4906,
29897,
13,
4706,
1134,
29898,
5415,
467,
17591,
29918,
5269,
29918,
12888,
29879,
353,
9079,
18680,
29898,
2457,
29918,
1767,
29922,
4906,
29897,
13,
4706,
1134,
29898,
5415,
467,
17591,
29918,
333,
945,
29918,
12888,
29879,
353,
9079,
18680,
29898,
2457,
29918,
1767,
29922,
4906,
29897,
13,
4706,
1134,
29898,
5415,
467,
17591,
29918,
3844,
9392,
29918,
2974,
29918,
11027,
353,
9079,
18680,
29898,
2457,
29918,
1767,
29922,
4906,
29897,
13,
4706,
1178,
945,
29918,
9965,
29918,
17591,
29918,
3696,
292,
29918,
17640,
29889,
2917,
29918,
29885,
629,
29889,
7302,
29918,
25990,
29889,
2457,
29918,
1767,
353,
2643,
13,
4706,
285,
29918,
5453,
353,
1583,
29889,
657,
29918,
5453,
29918,
17640,
29898,
7529,
29922,
333,
945,
29918,
4381,
29918,
5085,
29897,
13,
4706,
285,
29918,
5453,
29889,
3198,
29918,
8513,
353,
7700,
13,
4706,
1121,
353,
1583,
29889,
5453,
29889,
3389,
29918,
333,
945,
29918,
3696,
292,
29918,
2917,
29898,
333,
945,
29918,
9965,
29918,
17591,
29918,
3696,
292,
29918,
17640,
29892,
285,
29918,
5453,
29897,
13,
4706,
4974,
1121,
1839,
3728,
2033,
1275,
525,
3782,
3620,
892,
7436,
29915,
13,
13,
1678,
822,
1243,
29918,
3389,
29918,
333,
945,
29918,
3696,
292,
29918,
2917,
29918,
26061,
29918,
4878,
29900,
29896,
29898,
1311,
29892,
1178,
945,
29918,
9965,
29918,
17591,
29918,
3696,
292,
29918,
17640,
29892,
13,
462,
462,
462,
268,
1178,
945,
29918,
1445,
29918,
12847,
29918,
2917,
29918,
3696,
292,
29918,
17640,
29892,
1178,
945,
29918,
4381,
29918,
5085,
1125,
13,
4706,
1178,
945,
29918,
4381,
29918,
5085,
29889,
5504,
3319,
29908,
13653,
29918,
978,
1115,
376,
845,
279,
3871,
613,
376,
13653,
29918,
29885,
593,
1115,
376,
16476,
978,
613,
376,
13653,
29918,
1792,
1115,
376,
13653,
1792,
613,
13,
462,
462,
259,
376,
13653,
29918,
5630,
1115,
9872,
25711,
17013,
28341,
376,
23848,
29918,
4537,
1115,
29871,
29896,
29892,
376,
23848,
1115,
376,
29896,
29889,
29896,
29889,
29896,
29889,
29896,
613,
13,
462,
462,
259,
376,
16586,
1526,
29918,
29894,
29941,
29918,
6786,
1115,
376,
16586,
1526,
1792,
613,
376,
16586,
1526,
29918,
29873,
2390,
29918,
3859,
1115,
376,
10861,
613,
376,
12888,
29918,
4537,
1115,
29871,
29946,
29892,
13,
462,
462,
259,
376,
5269,
29918,
12888,
29918,
3859,
1115,
376,
10861,
613,
376,
7328,
1115,
376,
10736,
29992,
20230,
613,
376,
6341,
29918,
4906,
1115,
376,
1688,
613,
13,
462,
462,
259,
376,
12007,
29918,
12888,
29879,
1115,
376,
10861,
613,
376,
23055,
1115,
376,
10861,
613,
13,
462,
462,
259,
376,
3844,
9392,
29918,
666,
29918,
7328,
1115,
376,
29896,
29929,
29906,
29889,
29896,
29953,
29947,
29889,
29900,
29889,
29896,
613,
376,
3844,
9392,
29918,
637,
1115,
29871,
29946,
29946,
29941,
29892,
376,
6786,
1115,
376,
348,
420,
613,
13,
462,
462,
259,
376,
5630,
1115,
9872,
25711,
17013,
11903,
1800,
13,
4706,
2643,
353,
11117,
5709,
2396,
525,
17776,
742,
376,
1469,
1115,
11117,
3728,
2396,
525,
4882,
5229,
297,
8454,
3630,
29915,
930,
13,
4706,
1178,
945,
29918,
9965,
29918,
17591,
29918,
3696,
292,
29918,
17640,
29889,
1445,
29918,
13653,
29918,
12847,
29889,
3258,
29918,
13653,
29918,
5415,
29889,
2457,
29918,
1767,
353,
376,
29885,
593,
29914,
10718,
29908,
13,
4706,
1178,
945,
29918,
9965,
29918,
17591,
29918,
3696,
292,
29918,
17640,
29889,
2917,
29918,
29885,
629,
29889,
842,
29918,
492,
1658,
29918,
13653,
29889,
2457,
29918,
1767,
353,
2643,
13,
4706,
285,
29918,
5453,
353,
1583,
29889,
657,
29918,
5453,
29918,
17640,
29898,
7529,
29922,
333,
945,
29918,
4381,
29918,
5085,
29897,
13,
4706,
411,
11451,
1688,
29889,
336,
4637,
29898,
2451,
29897,
408,
429,
29901,
13,
9651,
1583,
29889,
5453,
29889,
3389,
29918,
333,
945,
29918,
3696,
292,
29918,
2917,
29898,
333,
945,
29918,
9965,
29918,
17591,
29918,
3696,
292,
29918,
17640,
29892,
285,
29918,
5453,
29897,
13,
4706,
4974,
429,
29889,
1767,
29889,
5085,
29961,
29900,
29962,
1275,
525,
4882,
5229,
297,
8454,
3630,
29915,
13,
13,
1678,
822,
1243,
29918,
3389,
29918,
333,
945,
29918,
3696,
292,
29918,
2917,
29918,
26061,
29918,
4878,
29900,
29906,
29898,
1311,
29892,
1178,
945,
29918,
9965,
29918,
17591,
29918,
3696,
292,
29918,
17640,
29892,
13,
462,
462,
462,
268,
1178,
945,
29918,
4381,
29918,
5085,
29892,
1178,
945,
29918,
1445,
29918,
12847,
29918,
2917,
29918,
3696,
292,
29918,
17640,
1125,
13,
4706,
1178,
945,
29918,
4381,
29918,
5085,
29889,
5504,
3319,
29908,
13653,
29918,
978,
1115,
376,
845,
279,
3871,
613,
376,
13653,
29918,
29885,
593,
1115,
376,
16476,
978,
613,
376,
13653,
29918,
1792,
1115,
376,
13653,
1792,
613,
13,
462,
462,
259,
376,
13653,
29918,
5630,
1115,
9872,
25711,
17013,
28341,
376,
23848,
29918,
4537,
1115,
29871,
29896,
29892,
376,
23848,
1115,
376,
29896,
29889,
29896,
29889,
29896,
29889,
29896,
613,
13,
462,
462,
259,
376,
16586,
1526,
29918,
29894,
29941,
29918,
6786,
1115,
376,
16586,
1526,
1792,
613,
376,
16586,
1526,
29918,
29873,
2390,
29918,
3859,
1115,
376,
10861,
613,
376,
12888,
29918,
4537,
1115,
29871,
29946,
29892,
13,
462,
462,
259,
376,
5269,
29918,
12888,
29918,
3859,
1115,
376,
10861,
613,
376,
7328,
1115,
376,
10736,
29992,
20230,
613,
376,
6341,
29918,
4906,
1115,
376,
1688,
613,
13,
462,
462,
259,
376,
12007,
29918,
12888,
29879,
1115,
376,
10861,
613,
376,
23055,
1115,
376,
10861,
613,
13,
462,
462,
259,
376,
3844,
9392,
29918,
666,
29918,
7328,
1115,
376,
29896,
29929,
29906,
29889,
29896,
29953,
29947,
29889,
29900,
29889,
29896,
613,
376,
3844,
9392,
29918,
637,
1115,
29871,
29946,
29946,
29941,
29892,
376,
6786,
1115,
376,
348,
420,
613,
13,
462,
462,
259,
376,
5630,
1115,
9872,
25711,
17013,
11903,
1800,
13,
4706,
2643,
353,
8853,
25990,
29918,
932,
506,
519,
1115,
7700,
29892,
376,
3728,
1115,
376,
3782,
3620,
892,
7436,
613,
376,
15033,
1115,
7700,
29892,
13,
462,
259,
376,
5709,
1115,
376,
26061,
9092,
13,
4706,
1178,
945,
29918,
9965,
29918,
17591,
29918,
3696,
292,
29918,
17640,
29889,
2917,
29918,
29885,
629,
29889,
7302,
29918,
25990,
29889,
2457,
29918,
1767,
353,
2643,
13,
4706,
285,
29918,
5453,
353,
1583,
29889,
657,
29918,
5453,
29918,
17640,
29898,
7529,
29922,
333,
945,
29918,
4381,
29918,
5085,
29897,
13,
4706,
285,
29918,
5453,
29889,
3198,
29918,
8513,
353,
7700,
13,
4706,
1121,
353,
1583,
29889,
5453,
29889,
3389,
29918,
333,
945,
29918,
3696,
292,
29918,
2917,
29898,
333,
945,
29918,
9965,
29918,
17591,
29918,
3696,
292,
29918,
17640,
29892,
285,
29918,
5453,
29897,
13,
4706,
4974,
1121,
1839,
3728,
2033,
1275,
525,
3782,
3620,
892,
7436,
29915,
13,
13,
1678,
822,
1243,
29918,
3389,
29918,
333,
945,
29918,
3696,
292,
29918,
2917,
29918,
26061,
29918,
4878,
29900,
29941,
29898,
1311,
29892,
1178,
945,
29918,
9965,
29918,
17591,
29918,
3696,
292,
29918,
17640,
29892,
13,
462,
462,
462,
268,
1178,
945,
29918,
4381,
29918,
5085,
29892,
1178,
945,
29918,
1445,
29918,
12847,
29918,
2917,
29918,
3696,
292,
29918,
17640,
1125,
13,
4706,
1178,
945,
29918,
4381,
29918,
5085,
29889,
5504,
3319,
29908,
13653,
29918,
978,
1115,
376,
845,
279,
3871,
613,
376,
13653,
29918,
29885,
593,
1115,
376,
16476,
978,
613,
376,
13653,
29918,
1792,
1115,
376,
13653,
1792,
613,
13,
462,
462,
259,
376,
13653,
29918,
5630,
1115,
9872,
25711,
17013,
28341,
376,
23848,
29918,
4537,
1115,
29871,
29896,
29892,
13,
462,
462,
259,
376,
23848,
1115,
376,
29896,
29889,
29896,
29889,
29896,
29889,
29896,
613,
376,
16586,
1526,
29918,
29894,
29941,
29918,
6786,
1115,
376,
16586,
1526,
1792,
613,
13,
462,
462,
259,
376,
16586,
1526,
29918,
29873,
2390,
29918,
3859,
1115,
376,
10861,
613,
376,
12888,
29918,
4537,
1115,
29871,
29946,
29892,
376,
5269,
29918,
12888,
29918,
3859,
1115,
376,
10861,
613,
13,
462,
462,
259,
376,
7328,
1115,
376,
10736,
29992,
20230,
613,
376,
6341,
29918,
4906,
1115,
376,
1688,
613,
376,
12007,
29918,
12888,
29879,
1115,
376,
10861,
613,
13,
462,
462,
259,
376,
23055,
1115,
376,
10861,
613,
376,
3844,
9392,
29918,
666,
29918,
7328,
1115,
376,
29896,
29929,
29906,
29889,
29896,
29953,
29947,
29889,
29900,
29889,
29896,
613,
13,
462,
462,
259,
376,
3844,
9392,
29918,
637,
1115,
29871,
29946,
29946,
29941,
29892,
376,
6786,
1115,
376,
348,
420,
613,
376,
5630,
1115,
9872,
25711,
17013,
11903,
1800,
13,
4706,
2643,
353,
11117,
5709,
2396,
525,
17776,
742,
376,
1469,
1115,
11117,
3728,
2396,
376,
17776,
304,
1476,
3620,
29908,
930,
13,
4706,
1178,
945,
29918,
9965,
29918,
17591,
29918,
3696,
292,
29918,
17640,
29889,
1445,
29918,
13653,
29918,
12847,
29889,
3258,
29918,
13653,
29918,
5415,
29889,
2457,
29918,
1767,
353,
376,
29885,
593,
29914,
10718,
29908,
13,
4706,
1178,
945,
29918,
9965,
29918,
17591,
29918,
3696,
292,
29918,
17640,
29889,
2917,
29918,
29885,
629,
29889,
842,
29918,
492,
1658,
29918,
13653,
29889,
2457,
29918,
1767,
353,
2643,
13,
4706,
285,
29918,
5453,
353,
1583,
29889,
657,
29918,
5453,
29918,
17640,
29898,
7529,
29922,
333,
945,
29918,
4381,
29918,
5085,
29897,
13,
4706,
411,
11451,
1688,
29889,
336,
4637,
29898,
2451,
29897,
408,
429,
29901,
13,
9651,
1583,
29889,
5453,
29889,
3389,
29918,
333,
945,
29918,
3696,
292,
29918,
2917,
29898,
333,
945,
29918,
9965,
29918,
17591,
29918,
3696,
292,
29918,
17640,
29892,
285,
29918,
5453,
29897,
13,
4706,
4974,
429,
29889,
1767,
29889,
5085,
29961,
29900,
29962,
1275,
525,
17776,
304,
1476,
3620,
29915,
13,
13,
1678,
732,
2272,
1688,
29889,
3502,
29889,
3207,
300,
374,
911,
703,
735,
29883,
29918,
1853,
613,
518,
17518,
2392,
29892,
7865,
2392,
29892,
24875,
2392,
2314,
13,
1678,
822,
1243,
29918,
3396,
29918,
17591,
29918,
3696,
292,
29918,
11739,
29918,
3179,
1847,
29918,
4878,
29898,
1311,
29892,
5566,
29918,
1853,
29892,
286,
8658,
29892,
1178,
945,
29918,
4381,
29918,
5085,
29892,
13,
462,
462,
462,
632,
1178,
945,
29918,
9965,
29918,
17591,
29918,
3696,
292,
29918,
17640,
29892,
13,
462,
462,
462,
632,
1178,
945,
29918,
1445,
29918,
12847,
29918,
2917,
29918,
3696,
292,
29918,
17640,
1125,
13,
4706,
1178,
945,
29918,
4381,
29918,
5085,
29889,
5504,
3319,
29908,
13653,
29918,
978,
1115,
376,
845,
279,
3871,
613,
525,
13653,
29918,
5630,
2396,
529,
25711,
17013,
10202,
13,
462,
462,
259,
525,
13653,
29918,
29885,
593,
2396,
6213,
29892,
525,
13653,
29918,
1792,
2396,
6213,
1800,
13,
4706,
286,
8658,
29889,
5041,
877,
550,
1821,
29918,
29027,
29889,
29881,
1808,
14047,
29889,
3150,
1171,
482,
29889,
12800,
29889,
7576,
6169,
13,
462,
268,
525,
29881,
1808,
14047,
29918,
17591,
29918,
333,
945,
29918,
3696,
292,
29889,
3389,
29918,
333,
945,
29918,
3696,
292,
29918,
2917,
742,
2625,
29918,
15987,
29922,
735,
29883,
29918,
1853,
877,
1688,
8785,
13,
4706,
1121,
353,
1583,
3032,
3389,
29918,
5453,
29918,
2541,
29918,
14057,
29918,
3126,
29898,
333,
945,
29918,
4381,
29918,
5085,
29897,
13,
4706,
4974,
525,
7645,
29915,
297,
1121,
13,
4706,
4974,
1121,
1839,
26061,
2033,
338,
5852,
13,
2
] |
pose_sync_pytorch/video_pose_landmarks.py | lilly9117/Cross-Cutting | 40 | 57765 | from torchvision import models
import numpy as np
import torch
import os
from moviepy.editor import VideoFileClip
SKIP_FRAME_RATE = 10
MINIMAX_FRAME = 4
# 함수에서 documentaiton 읽기
model = models.detection.fasterrcnn_resnet50_fpn(pretrained=True)
model.eval()
os.environ['KMP_DUPLICATE_LIB_OK']='True'
def extract_boxes(reference_clip, compare_clip):
clips = [reference_clip, compare_clip]
clips_frame_info = []
for clip in clips:
i = 0
every_frame_info = []
# loop over the frames from the video stream
while True:
i+=SKIP_FRAME_RATE # 1초에 60 fps가 있으므로 몇개는 skip해도 될거 같음!
if (i*1.0/clip.fps)> clip.duration:
break
frame = clip.get_frame(i*1.0/clip.fps)
frame = frame/255 # image, and should be in ``0-1`` range.
frame = np.transpose(frame, (2,0,1)) # HWC -> CHW(그 위치에 몇차원 애를 넣을거냔?)
x = [torch.from_numpy(frame).float()]
# label list https://github.com/tensorflow/models/blob/master/research/object_detection/data/mscoco_label_map.pbtxt
predictions = model(x)
prediction= predictions[0]
each_box_list = zip(prediction['boxes'].tolist(), prediction['labels'].tolist(), prediction['scores'].tolist())
# 0.95 정도 올려야 까맣게 보이는 관중이 없어짐!
filtered_box_list = filter(lambda x: x[1]==1 and x[2] >= 0.95, each_box_list)
filtered_center_dot_list = list(map(lambda x: [(x[0][0]+x[0][2])/2, (x[0][1]+x[0][3])/2], filtered_box_list))
# x좌표로 정렬하기(대형이 가로로 늘어져 있다고 가정하고 순서대로 정렬)
sorted_dot_list = sorted(filtered_center_dot_list, key = lambda x: x[0])
every_frame_info.append(sorted_dot_list) # 프레임별 정보
clips_frame_info.append(np.array(every_frame_info)) # 각 영상별로 붙이기
return clips_frame_info
def calculate_pose_distance(reference_clip, compare_clip):
clips_frame_info = extract_boxes(reference_clip, compare_clip) # 모든 프레임마다 길이 계산해줌
min_size = min(len(clips_frame_info[0]),len(clips_frame_info[1]))
dist_arr = list()
# Calculate distance (by frame)
for i in range(min_size):
if len(clips_frame_info[0][i])>0 and len(clips_frame_info[1][i])>0: # 둘다 있으면
# x축 값이 가장 가까운걸로 찾고 그거랑 비교(어차피 대형이 중요한거니까)
ref_frame_dots = clips_frame_info[0][i] # 해당 frame의 정보
compare_frame_dots = clips_frame_info[1][i] # 해당 frame의 정보
min_dot_num = min(len(ref_frame_dots), len(compare_frame_dots)) # reference 기준으로 계산할거양
penalty = ((reference_clip.w **2 + reference_clip.h**2)**0.5) * abs(len(ref_frame_dots)-len(compare_frame_dots)) # 개수가 다를때 주는 패널티
total_diff = penalty
for dot_idx in range(min_dot_num):
ref_frame_dots[dot_idx] and compare_frame_dots[dot_idx]
total_diff += ((ref_frame_dots[dot_idx][0] - compare_frame_dots[dot_idx][0])**2 + (ref_frame_dots[dot_idx][1] - compare_frame_dots[dot_idx][1])**2)**0.5
dist_arr.append(total_diff)
else:
dist_arr.append(None)
# Minimize max distance in (minimax_frames) frames
min_diff = np.float('Inf')
min_idx = 0
max_dist = []
for i in range(min_size-(MINIMAX_FRAME-1)):
if None in dist_arr[i:i+MINIMAX_FRAME]:
max_dist.append(None)
else:
tmp_max = np.max(dist_arr[i:i+MINIMAX_FRAME])
max_dist.append(tmp_max)
if min_diff > tmp_max:
min_diff = tmp_max
min_idx = i
# return distance, second, additional_info
return min_diff, (min_idx*SKIP_FRAME_RATE)/reference_clip.fps, {} | [
1,
515,
4842,
305,
4924,
1053,
4733,
13,
5215,
12655,
408,
7442,
13,
5215,
4842,
305,
13,
5215,
2897,
13,
3166,
14064,
2272,
29889,
15204,
1053,
13987,
2283,
29907,
3466,
13,
13,
16033,
5690,
29918,
29943,
4717,
2303,
29918,
29934,
3040,
353,
29871,
29896,
29900,
13,
16173,
2260,
29990,
29918,
29943,
4717,
2303,
353,
29871,
29946,
13,
29937,
29871,
240,
152,
171,
30970,
31054,
31093,
1842,
1249,
265,
29871,
239,
160,
192,
30827,
13,
4299,
353,
4733,
29889,
29881,
2650,
428,
29889,
29888,
1901,
2214,
15755,
29918,
690,
1212,
29945,
29900,
29918,
18091,
29876,
29898,
1457,
3018,
1312,
29922,
5574,
29897,
13,
4299,
29889,
14513,
580,
13,
359,
29889,
21813,
1839,
29968,
3580,
29918,
29928,
4897,
27888,
3040,
29918,
5265,
29933,
29918,
8949,
2033,
2433,
5574,
29915,
13,
13,
1753,
6597,
29918,
1884,
267,
29898,
5679,
29918,
24049,
29892,
7252,
29918,
24049,
1125,
13,
1678,
9335,
567,
353,
518,
5679,
29918,
24049,
29892,
7252,
29918,
24049,
29962,
13,
1678,
9335,
567,
29918,
2557,
29918,
3888,
353,
5159,
13,
1678,
363,
20102,
297,
9335,
567,
29901,
13,
4706,
474,
353,
29871,
29900,
13,
4706,
1432,
29918,
2557,
29918,
3888,
353,
5159,
13,
4706,
396,
2425,
975,
278,
16608,
515,
278,
4863,
4840,
13,
4706,
1550,
5852,
29901,
13,
9651,
474,
23661,
16033,
5690,
29918,
29943,
4717,
2303,
29918,
29934,
3040,
396,
29871,
29896,
239,
183,
139,
31054,
29871,
29953,
29900,
285,
567,
30903,
29871,
239,
161,
139,
239,
159,
191,
238,
178,
131,
30906,
29871,
238,
173,
138,
31789,
31081,
14383,
31435,
31136,
29871,
238,
147,
163,
237,
180,
179,
29871,
237,
179,
156,
31966,
29991,
13,
9651,
565,
313,
29875,
29930,
29896,
29889,
29900,
29914,
24049,
29889,
29888,
567,
15410,
20102,
29889,
19708,
29901,
13,
18884,
2867,
13,
13,
9651,
3515,
353,
20102,
29889,
657,
29918,
2557,
29898,
29875,
29930,
29896,
29889,
29900,
29914,
24049,
29889,
29888,
567,
29897,
13,
9651,
3515,
353,
3515,
29914,
29906,
29945,
29945,
396,
1967,
29892,
322,
881,
367,
297,
4954,
29900,
29899,
29896,
16159,
3464,
29889,
13,
9651,
3515,
353,
7442,
29889,
3286,
4220,
29898,
2557,
29892,
313,
29906,
29892,
29900,
29892,
29896,
876,
396,
29871,
379,
29956,
29907,
1599,
5868,
29956,
29898,
31607,
29871,
31724,
239,
188,
155,
31054,
29871,
238,
173,
138,
31817,
31198,
29871,
239,
152,
163,
31517,
29871,
238,
135,
166,
31286,
237,
180,
179,
238,
134,
151,
7897,
13,
9651,
921,
353,
518,
7345,
305,
29889,
3166,
29918,
23749,
29898,
2557,
467,
7411,
580,
29962,
13,
9651,
396,
3858,
1051,
2045,
597,
3292,
29889,
510,
29914,
29056,
29914,
9794,
29914,
10054,
29914,
6207,
29914,
690,
2842,
29914,
3318,
29918,
29881,
2650,
428,
29914,
1272,
29914,
1516,
29883,
6235,
29918,
1643,
29918,
1958,
29889,
29886,
3116,
486,
13,
9651,
27303,
353,
1904,
29898,
29916,
29897,
13,
9651,
18988,
29922,
27303,
29961,
29900,
29962,
13,
9651,
1269,
29918,
1884,
29918,
1761,
353,
14319,
29898,
11965,
2463,
1839,
1884,
267,
13359,
25027,
391,
3285,
18988,
1839,
21134,
13359,
25027,
391,
3285,
18988,
1839,
1557,
2361,
13359,
25027,
391,
3101,
13,
9651,
396,
29871,
29900,
29889,
29929,
29945,
29871,
30852,
31136,
29871,
239,
155,
175,
238,
163,
167,
239,
152,
191,
29871,
237,
188,
143,
238,
170,
166,
237,
181,
143,
29871,
31199,
30393,
31081,
29871,
237,
183,
131,
31941,
30393,
29871,
239,
154,
137,
31129,
239,
170,
147,
29991,
13,
9651,
22289,
29918,
1884,
29918,
1761,
353,
4175,
29898,
2892,
921,
29901,
921,
29961,
29896,
29962,
1360,
29896,
322,
921,
29961,
29906,
29962,
6736,
29871,
29900,
29889,
29929,
29945,
29892,
1269,
29918,
1884,
29918,
1761,
29897,
13,
9651,
22289,
29918,
5064,
29918,
6333,
29918,
1761,
353,
1051,
29898,
1958,
29898,
2892,
921,
29901,
17288,
29916,
29961,
29900,
3816,
29900,
10062,
29916,
29961,
29900,
3816,
29906,
2314,
29914,
29906,
29892,
313,
29916,
29961,
29900,
3816,
29896,
10062,
29916,
29961,
29900,
3816,
29941,
2314,
29914,
29906,
1402,
22289,
29918,
1884,
29918,
1761,
876,
13,
9651,
396,
921,
239,
165,
143,
240,
148,
159,
30906,
29871,
30852,
238,
163,
175,
30944,
30827,
29898,
30890,
240,
155,
152,
30393,
29871,
30903,
30906,
30906,
29871,
238,
141,
155,
31129,
239,
163,
187,
29871,
239,
161,
139,
30709,
31137,
29871,
30903,
30852,
30944,
31137,
29871,
239,
139,
159,
31093,
30890,
30906,
29871,
30852,
238,
163,
175,
29897,
13,
9651,
12705,
29918,
6333,
29918,
1761,
353,
12705,
29898,
4572,
287,
29918,
5064,
29918,
6333,
29918,
1761,
29892,
1820,
353,
14013,
921,
29901,
921,
29961,
29900,
2314,
13,
9651,
1432,
29918,
2557,
29918,
3888,
29889,
4397,
29898,
24582,
29918,
6333,
29918,
1761,
29897,
396,
29871,
240,
151,
135,
238,
163,
139,
239,
161,
135,
238,
182,
135,
29871,
30852,
31199,
13,
308,
13,
4706,
9335,
567,
29918,
2557,
29918,
3888,
29889,
4397,
29898,
9302,
29889,
2378,
29898,
17991,
29918,
2557,
29918,
3888,
876,
396,
29871,
237,
179,
132,
29871,
31288,
31158,
238,
182,
135,
30906,
29871,
238,
185,
156,
30393,
30827,
13,
13,
1678,
736,
9335,
567,
29918,
2557,
29918,
3888,
13,
13,
1753,
8147,
29918,
4220,
29918,
19244,
29898,
5679,
29918,
24049,
29892,
7252,
29918,
24049,
1125,
13,
1678,
9335,
567,
29918,
2557,
29918,
3888,
353,
6597,
29918,
1884,
267,
29898,
5679,
29918,
24049,
29892,
7252,
29918,
24049,
29897,
396,
29871,
31962,
238,
150,
163,
29871,
240,
151,
135,
238,
163,
139,
239,
161,
135,
31417,
30709,
29871,
237,
187,
187,
30393,
29871,
237,
182,
135,
31458,
31435,
239,
167,
143,
13,
13,
1678,
1375,
29918,
2311,
353,
1375,
29898,
2435,
29898,
11303,
567,
29918,
2557,
29918,
3888,
29961,
29900,
11724,
2435,
29898,
11303,
567,
29918,
2557,
29918,
3888,
29961,
29896,
12622,
13,
268,
13,
1678,
1320,
29918,
2749,
353,
1051,
580,
13,
1678,
396,
20535,
403,
5418,
313,
1609,
3515,
29897,
13,
1678,
363,
474,
297,
3464,
29898,
1195,
29918,
2311,
1125,
13,
4706,
565,
7431,
29898,
11303,
567,
29918,
2557,
29918,
3888,
29961,
29900,
3816,
29875,
2314,
29958,
29900,
322,
7431,
29898,
11303,
567,
29918,
2557,
29918,
3888,
29961,
29896,
3816,
29875,
2314,
29958,
29900,
29901,
396,
29871,
238,
148,
155,
30709,
29871,
239,
161,
139,
239,
159,
191,
31747,
13,
9651,
396,
921,
239,
185,
152,
29871,
237,
179,
149,
30393,
29871,
30903,
31299,
29871,
30903,
237,
188,
143,
239,
157,
183,
237,
180,
187,
30906,
29871,
239,
179,
193,
31137,
29871,
31607,
237,
180,
179,
238,
161,
148,
29871,
31487,
31972,
29898,
31129,
31817,
240,
151,
191,
29871,
30890,
240,
155,
152,
30393,
29871,
31941,
31527,
30877,
237,
180,
179,
31063,
237,
188,
143,
29897,
13,
9651,
2143,
29918,
2557,
29918,
7778,
353,
9335,
567,
29918,
2557,
29918,
3888,
29961,
29900,
3816,
29875,
29962,
396,
29871,
31435,
238,
142,
188,
3515,
30708,
29871,
30852,
31199,
13,
9651,
7252,
29918,
2557,
29918,
7778,
353,
9335,
567,
29918,
2557,
29918,
3888,
29961,
29896,
3816,
29875,
29962,
396,
29871,
31435,
238,
142,
188,
3515,
30708,
29871,
30852,
31199,
13,
9651,
1375,
29918,
6333,
29918,
1949,
353,
1375,
29898,
2435,
29898,
999,
29918,
2557,
29918,
7778,
511,
7431,
29898,
18307,
29918,
2557,
29918,
7778,
876,
396,
3407,
29871,
30827,
239,
167,
131,
239,
159,
191,
30906,
29871,
237,
182,
135,
31458,
240,
152,
163,
237,
180,
179,
239,
153,
148,
13,
9651,
27368,
353,
5135,
5679,
29918,
24049,
29889,
29893,
3579,
29906,
718,
3407,
29918,
24049,
29889,
29882,
1068,
29906,
29897,
1068,
29900,
29889,
29945,
29897,
334,
6425,
29898,
2435,
29898,
999,
29918,
2557,
29918,
7778,
6817,
2435,
29898,
18307,
29918,
2557,
29918,
7778,
876,
396,
29871,
31789,
30970,
30903,
29871,
30709,
31517,
238,
152,
143,
29871,
30981,
31081,
29871,
240,
143,
171,
238,
135,
147,
240,
142,
179,
13,
9651,
3001,
29918,
12765,
353,
27368,
13,
9651,
363,
8329,
29918,
13140,
297,
3464,
29898,
1195,
29918,
6333,
29918,
1949,
1125,
13,
18884,
2143,
29918,
2557,
29918,
7778,
29961,
6333,
29918,
13140,
29962,
322,
7252,
29918,
2557,
29918,
7778,
29961,
6333,
29918,
13140,
29962,
13,
18884,
3001,
29918,
12765,
4619,
5135,
999,
29918,
2557,
29918,
7778,
29961,
6333,
29918,
13140,
3816,
29900,
29962,
448,
7252,
29918,
2557,
29918,
7778,
29961,
6333,
29918,
13140,
3816,
29900,
2314,
1068,
29906,
718,
313,
999,
29918,
2557,
29918,
7778,
29961,
6333,
29918,
13140,
3816,
29896,
29962,
448,
7252,
29918,
2557,
29918,
7778,
29961,
6333,
29918,
13140,
3816,
29896,
2314,
1068,
29906,
29897,
1068,
29900,
29889,
29945,
13,
9651,
1320,
29918,
2749,
29889,
4397,
29898,
7827,
29918,
12765,
29897,
13,
4706,
1683,
29901,
13,
9651,
1320,
29918,
2749,
29889,
4397,
29898,
8516,
29897,
13,
13,
1678,
396,
3080,
326,
675,
4236,
5418,
297,
313,
1195,
326,
1165,
29918,
19935,
29897,
16608,
13,
1678,
1375,
29918,
12765,
353,
7442,
29889,
7411,
877,
25433,
1495,
13,
1678,
1375,
29918,
13140,
353,
29871,
29900,
29871,
13,
1678,
4236,
29918,
5721,
353,
5159,
13,
1678,
363,
474,
297,
3464,
29898,
1195,
29918,
2311,
17722,
16173,
2260,
29990,
29918,
29943,
4717,
2303,
29899,
29896,
22164,
13,
4706,
565,
6213,
297,
1320,
29918,
2749,
29961,
29875,
29901,
29875,
29974,
16173,
2260,
29990,
29918,
29943,
4717,
2303,
5387,
13,
9651,
4236,
29918,
5721,
29889,
4397,
29898,
8516,
29897,
13,
4706,
1683,
29901,
13,
9651,
13128,
29918,
3317,
353,
7442,
29889,
3317,
29898,
5721,
29918,
2749,
29961,
29875,
29901,
29875,
29974,
16173,
2260,
29990,
29918,
29943,
4717,
2303,
2314,
13,
9651,
4236,
29918,
5721,
29889,
4397,
29898,
7050,
29918,
3317,
29897,
13,
9651,
565,
1375,
29918,
12765,
1405,
13128,
29918,
3317,
29901,
13,
18884,
1375,
29918,
12765,
353,
13128,
29918,
3317,
13,
18884,
1375,
29918,
13140,
353,
474,
13,
13,
1678,
396,
736,
5418,
29892,
1473,
29892,
5684,
29918,
3888,
13,
1678,
736,
1375,
29918,
12765,
29892,
313,
1195,
29918,
13140,
29930,
16033,
5690,
29918,
29943,
4717,
2303,
29918,
29934,
3040,
6802,
5679,
29918,
24049,
29889,
29888,
567,
29892,
6571,
2
] |
esphome/components/zyaura/sensor.py | OttoWinter/esphomeyaml | 249 | 117170 | import esphome.codegen as cg
import esphome.config_validation as cv
from esphome import pins
from esphome.components import sensor
from esphome.const import (
CONF_ID,
CONF_CLOCK_PIN,
CONF_DATA_PIN,
CONF_CO2,
CONF_TEMPERATURE,
CONF_HUMIDITY,
DEVICE_CLASS_CARBON_DIOXIDE,
DEVICE_CLASS_HUMIDITY,
DEVICE_CLASS_TEMPERATURE,
STATE_CLASS_MEASUREMENT,
UNIT_PARTS_PER_MILLION,
UNIT_CELSIUS,
UNIT_PERCENT,
ICON_MOLECULE_CO2,
)
from esphome.cpp_helpers import gpio_pin_expression
zyaura_ns = cg.esphome_ns.namespace("zyaura")
ZyAuraSensor = zyaura_ns.class_("ZyAuraSensor", cg.PollingComponent)
CONFIG_SCHEMA = cv.Schema(
{
cv.GenerateID(): cv.declare_id(ZyAuraSensor),
cv.Required(CONF_CLOCK_PIN): cv.All(pins.internal_gpio_input_pin_schema),
cv.Required(CONF_DATA_PIN): cv.All(pins.internal_gpio_input_pin_schema),
cv.Optional(CONF_CO2): sensor.sensor_schema(
unit_of_measurement=UNIT_PARTS_PER_MILLION,
icon=ICON_MOLECULE_CO2,
accuracy_decimals=0,
device_class=DEVICE_CLASS_CARBON_DIOXIDE,
state_class=STATE_CLASS_MEASUREMENT,
),
cv.Optional(CONF_TEMPERATURE): sensor.sensor_schema(
unit_of_measurement=UNIT_CELSIUS,
accuracy_decimals=1,
device_class=DEVICE_CLASS_TEMPERATURE,
state_class=STATE_CLASS_MEASUREMENT,
),
cv.Optional(CONF_HUMIDITY): sensor.sensor_schema(
unit_of_measurement=UNIT_PERCENT,
accuracy_decimals=1,
device_class=DEVICE_CLASS_HUMIDITY,
state_class=STATE_CLASS_MEASUREMENT,
),
}
).extend(cv.polling_component_schema("60s"))
async def to_code(config):
var = cg.new_Pvariable(config[CONF_ID])
await cg.register_component(var, config)
pin_clock = await gpio_pin_expression(config[CONF_CLOCK_PIN])
cg.add(var.set_pin_clock(pin_clock))
pin_data = await gpio_pin_expression(config[CONF_DATA_PIN])
cg.add(var.set_pin_data(pin_data))
if CONF_CO2 in config:
sens = await sensor.new_sensor(config[CONF_CO2])
cg.add(var.set_co2_sensor(sens))
if CONF_TEMPERATURE in config:
sens = await sensor.new_sensor(config[CONF_TEMPERATURE])
cg.add(var.set_temperature_sensor(sens))
if CONF_HUMIDITY in config:
sens = await sensor.new_sensor(config[CONF_HUMIDITY])
cg.add(var.set_humidity_sensor(sens))
| [
1,
1053,
831,
561,
608,
29889,
401,
1885,
408,
274,
29887,
13,
5215,
831,
561,
608,
29889,
2917,
29918,
18157,
408,
13850,
13,
3166,
831,
561,
608,
1053,
282,
1144,
13,
3166,
831,
561,
608,
29889,
14036,
1053,
23530,
13,
3166,
831,
561,
608,
29889,
3075,
1053,
313,
13,
1678,
8707,
29943,
29918,
1367,
29892,
13,
1678,
8707,
29943,
29918,
29907,
21339,
29918,
29925,
1177,
29892,
13,
1678,
8707,
29943,
29918,
14573,
29918,
29925,
1177,
29892,
13,
1678,
8707,
29943,
29918,
3217,
29906,
29892,
13,
1678,
8707,
29943,
29918,
4330,
3580,
1001,
1299,
11499,
29892,
13,
1678,
8707,
29943,
29918,
29950,
5005,
1367,
11937,
29892,
13,
1678,
5012,
19059,
29918,
13875,
1799,
29918,
29907,
1718,
29933,
1164,
29918,
4571,
29949,
29990,
22027,
29892,
13,
1678,
5012,
19059,
29918,
13875,
1799,
29918,
29950,
5005,
1367,
11937,
29892,
13,
1678,
5012,
19059,
29918,
13875,
1799,
29918,
4330,
3580,
1001,
1299,
11499,
29892,
13,
1678,
6850,
3040,
29918,
13875,
1799,
29918,
2303,
3289,
11499,
13780,
29892,
13,
1678,
8291,
1806,
29918,
26092,
29903,
29918,
13171,
29918,
10403,
2208,
2725,
29892,
13,
1678,
8291,
1806,
29918,
4741,
29931,
5425,
3308,
29892,
13,
1678,
8291,
1806,
29918,
13171,
29907,
3919,
29892,
13,
1678,
306,
6007,
29918,
6720,
1307,
29907,
29965,
1307,
29918,
3217,
29906,
29892,
13,
29897,
13,
3166,
831,
561,
608,
29889,
8223,
29918,
3952,
6774,
1053,
330,
16168,
29918,
12687,
29918,
17471,
13,
13,
1537,
29874,
2002,
29918,
1983,
353,
274,
29887,
29889,
267,
561,
608,
29918,
1983,
29889,
22377,
703,
1537,
29874,
2002,
1159,
13,
29999,
29891,
29909,
2002,
29903,
6073,
353,
503,
3761,
2002,
29918,
1983,
29889,
1990,
29918,
703,
29999,
29891,
29909,
2002,
29903,
6073,
613,
274,
29887,
29889,
7713,
1847,
5308,
29897,
13,
13,
25903,
29918,
29903,
3210,
26862,
353,
13850,
29889,
12763,
29898,
13,
1678,
426,
13,
4706,
13850,
29889,
5631,
403,
1367,
7295,
13850,
29889,
7099,
8663,
29918,
333,
29898,
29999,
29891,
29909,
2002,
29903,
6073,
511,
13,
4706,
13850,
29889,
19347,
29898,
6007,
29943,
29918,
29907,
21339,
29918,
29925,
1177,
1125,
13850,
29889,
3596,
29898,
29886,
1144,
29889,
7564,
29918,
29887,
16168,
29918,
2080,
29918,
12687,
29918,
11010,
511,
13,
4706,
13850,
29889,
19347,
29898,
6007,
29943,
29918,
14573,
29918,
29925,
1177,
1125,
13850,
29889,
3596,
29898,
29886,
1144,
29889,
7564,
29918,
29887,
16168,
29918,
2080,
29918,
12687,
29918,
11010,
511,
13,
4706,
13850,
29889,
27636,
29898,
6007,
29943,
29918,
3217,
29906,
1125,
23530,
29889,
29879,
6073,
29918,
11010,
29898,
13,
9651,
5190,
29918,
974,
29918,
26658,
358,
29922,
3904,
1806,
29918,
26092,
29903,
29918,
13171,
29918,
10403,
2208,
2725,
29892,
13,
9651,
9849,
29922,
2965,
1164,
29918,
6720,
1307,
29907,
29965,
1307,
29918,
3217,
29906,
29892,
13,
9651,
13600,
29918,
7099,
326,
1338,
29922,
29900,
29892,
13,
9651,
4742,
29918,
1990,
29922,
2287,
19059,
29918,
13875,
1799,
29918,
29907,
1718,
29933,
1164,
29918,
4571,
29949,
29990,
22027,
29892,
13,
9651,
2106,
29918,
1990,
29922,
19713,
29918,
13875,
1799,
29918,
2303,
3289,
11499,
13780,
29892,
13,
4706,
10353,
13,
4706,
13850,
29889,
27636,
29898,
6007,
29943,
29918,
4330,
3580,
1001,
1299,
11499,
1125,
23530,
29889,
29879,
6073,
29918,
11010,
29898,
13,
9651,
5190,
29918,
974,
29918,
26658,
358,
29922,
3904,
1806,
29918,
4741,
29931,
5425,
3308,
29892,
13,
9651,
13600,
29918,
7099,
326,
1338,
29922,
29896,
29892,
13,
9651,
4742,
29918,
1990,
29922,
2287,
19059,
29918,
13875,
1799,
29918,
4330,
3580,
1001,
1299,
11499,
29892,
13,
9651,
2106,
29918,
1990,
29922,
19713,
29918,
13875,
1799,
29918,
2303,
3289,
11499,
13780,
29892,
13,
4706,
10353,
13,
4706,
13850,
29889,
27636,
29898,
6007,
29943,
29918,
29950,
5005,
1367,
11937,
1125,
23530,
29889,
29879,
6073,
29918,
11010,
29898,
13,
9651,
5190,
29918,
974,
29918,
26658,
358,
29922,
3904,
1806,
29918,
13171,
29907,
3919,
29892,
13,
9651,
13600,
29918,
7099,
326,
1338,
29922,
29896,
29892,
13,
9651,
4742,
29918,
1990,
29922,
2287,
19059,
29918,
13875,
1799,
29918,
29950,
5005,
1367,
11937,
29892,
13,
9651,
2106,
29918,
1990,
29922,
19713,
29918,
13875,
1799,
29918,
2303,
3289,
11499,
13780,
29892,
13,
4706,
10353,
13,
1678,
500,
13,
467,
21843,
29898,
11023,
29889,
3733,
1847,
29918,
9700,
29918,
11010,
703,
29953,
29900,
29879,
5783,
13,
13,
13,
12674,
822,
304,
29918,
401,
29898,
2917,
1125,
13,
1678,
722,
353,
274,
29887,
29889,
1482,
29918,
29925,
11918,
29898,
2917,
29961,
6007,
29943,
29918,
1367,
2314,
13,
1678,
7272,
274,
29887,
29889,
9573,
29918,
9700,
29898,
1707,
29892,
2295,
29897,
13,
13,
1678,
12534,
29918,
13058,
353,
7272,
330,
16168,
29918,
12687,
29918,
17471,
29898,
2917,
29961,
6007,
29943,
29918,
29907,
21339,
29918,
29925,
1177,
2314,
13,
1678,
274,
29887,
29889,
1202,
29898,
1707,
29889,
842,
29918,
12687,
29918,
13058,
29898,
12687,
29918,
13058,
876,
13,
1678,
12534,
29918,
1272,
353,
7272,
330,
16168,
29918,
12687,
29918,
17471,
29898,
2917,
29961,
6007,
29943,
29918,
14573,
29918,
29925,
1177,
2314,
13,
1678,
274,
29887,
29889,
1202,
29898,
1707,
29889,
842,
29918,
12687,
29918,
1272,
29898,
12687,
29918,
1272,
876,
13,
13,
1678,
565,
8707,
29943,
29918,
3217,
29906,
297,
2295,
29901,
13,
4706,
4771,
353,
7272,
23530,
29889,
1482,
29918,
29879,
6073,
29898,
2917,
29961,
6007,
29943,
29918,
3217,
29906,
2314,
13,
4706,
274,
29887,
29889,
1202,
29898,
1707,
29889,
842,
29918,
1111,
29906,
29918,
29879,
6073,
29898,
23149,
876,
13,
1678,
565,
8707,
29943,
29918,
4330,
3580,
1001,
1299,
11499,
297,
2295,
29901,
13,
4706,
4771,
353,
7272,
23530,
29889,
1482,
29918,
29879,
6073,
29898,
2917,
29961,
6007,
29943,
29918,
4330,
3580,
1001,
1299,
11499,
2314,
13,
4706,
274,
29887,
29889,
1202,
29898,
1707,
29889,
842,
29918,
12863,
1535,
29918,
29879,
6073,
29898,
23149,
876,
13,
1678,
565,
8707,
29943,
29918,
29950,
5005,
1367,
11937,
297,
2295,
29901,
13,
4706,
4771,
353,
7272,
23530,
29889,
1482,
29918,
29879,
6073,
29898,
2917,
29961,
6007,
29943,
29918,
29950,
5005,
1367,
11937,
2314,
13,
4706,
274,
29887,
29889,
1202,
29898,
1707,
29889,
842,
29918,
16063,
333,
537,
29918,
29879,
6073,
29898,
23149,
876,
13,
2
] |
recsys/recommender/utils.py | shenghuiliuu/recsys | 50 | 1615750 | import numpy as np
import pandas as pd
from copy import deepcopy
def super_str(x):
if isinstance(x,np.int64):
x=float(x)
if isinstance(x,int):
x=float(x)
ans=str(x)
return ans
def convert_to_array(x):
if isinstance(x, np.ndarray):
return x
else:
return np.array(x)
def special_sort(a, order='ascending'):
n=len(a)
if order=='ascending':
for i in range(1,n):
j=deepcopy(i)
while j>0 and a[j][1]<a[j-1][1]:
temp=a[j-1]
a[j-1]=a[j]
a[j]=temp
j=j-1
elif order=='descending':
for i in range(1,n):
j=deepcopy(i)
while j>0 and a[j][1]>a[j-1][1]:
temp=a[j-1]
a[j-1]=a[j]
a[j]=temp
j=j-1
return a
def dissimilarity(arr1, arr2, weighted):
n=arr1.shape[0]
s=0
if weighted==True:
for i in range(0,n):
diff=abs(arr1[i]-arr2[i])
s = s + (diff*(n-i)/n)
else:
for i in range(0,n):
diff=abs(arr1[i]-arr2[i])
s = s + (diff)
return s
def create_utility_matrix(data, formatizer = {'user':0, 'item': 1, 'value': 2}):
"""
:param data: pandas dataframe, 2D, nx3
:param formatizer: dict having the column name or ids for users, items and ratings/values
:return: 1. the utility matrix. (2D, n x m, n=users, m=items)
2. list of users (in order with the utility matrix rows)
3. list of items (in order with the utility matrix columns)
"""
itemField = formatizer['item']
userField = formatizer['user']
valueField = formatizer['value']
userList = data.ix[:,userField].tolist()
itemList = data.ix[:,itemField].tolist()
valueList = data.ix[:,valueField].tolist()
users = list(set(data.ix[:,userField]))
items = list(set(data.ix[:,itemField]))
users_index = {users[i]: i for i in range(len(users))}
pd_dict = {item: [np.nan for i in range(len(users))] for item in items}
for i in range(0,len(data)):
item = itemList[i]
user = userList[i]
value = valueList[i]
pd_dict[item][users_index[user]] = value
X = pd.DataFrame(pd_dict)
X.index = users
users = list(X.index)
items = list(X.columns)
return np.array(X), users, items | [
1,
1053,
12655,
408,
7442,
13,
5215,
11701,
408,
10518,
13,
3166,
3509,
1053,
6483,
8552,
13,
13,
1753,
2428,
29918,
710,
29898,
29916,
1125,
13,
13,
1678,
565,
338,
8758,
29898,
29916,
29892,
9302,
29889,
524,
29953,
29946,
1125,
13,
4706,
921,
29922,
7411,
29898,
29916,
29897,
13,
13,
1678,
565,
338,
8758,
29898,
29916,
29892,
524,
1125,
13,
4706,
921,
29922,
7411,
29898,
29916,
29897,
13,
13,
1678,
6063,
29922,
710,
29898,
29916,
29897,
13,
13,
1678,
736,
6063,
13,
13,
1753,
3588,
29918,
517,
29918,
2378,
29898,
29916,
1125,
13,
13,
1678,
565,
338,
8758,
29898,
29916,
29892,
7442,
29889,
299,
2378,
1125,
13,
4706,
736,
921,
13,
1678,
1683,
29901,
13,
4706,
736,
7442,
29889,
2378,
29898,
29916,
29897,
13,
13,
1753,
4266,
29918,
6605,
29898,
29874,
29892,
1797,
2433,
6151,
2548,
29374,
13,
1678,
302,
29922,
2435,
29898,
29874,
29897,
13,
13,
1678,
565,
1797,
1360,
29915,
6151,
2548,
2396,
13,
4706,
363,
474,
297,
3464,
29898,
29896,
29892,
29876,
1125,
13,
9651,
432,
29922,
24535,
8552,
29898,
29875,
29897,
13,
13,
9651,
1550,
432,
29958,
29900,
322,
263,
29961,
29926,
3816,
29896,
29962,
29966,
29874,
29961,
29926,
29899,
29896,
3816,
29896,
5387,
13,
18884,
5694,
29922,
29874,
29961,
29926,
29899,
29896,
29962,
13,
18884,
263,
29961,
29926,
29899,
29896,
13192,
29874,
29961,
29926,
29962,
13,
18884,
263,
29961,
29926,
13192,
7382,
13,
13,
18884,
432,
29922,
29926,
29899,
29896,
13,
13,
1678,
25342,
1797,
1360,
29915,
14273,
2548,
2396,
13,
4706,
363,
474,
297,
3464,
29898,
29896,
29892,
29876,
1125,
13,
9651,
432,
29922,
24535,
8552,
29898,
29875,
29897,
13,
13,
9651,
1550,
432,
29958,
29900,
322,
263,
29961,
29926,
3816,
29896,
29962,
29958,
29874,
29961,
29926,
29899,
29896,
3816,
29896,
5387,
13,
18884,
5694,
29922,
29874,
29961,
29926,
29899,
29896,
29962,
13,
18884,
263,
29961,
29926,
29899,
29896,
13192,
29874,
29961,
29926,
29962,
13,
18884,
263,
29961,
29926,
13192,
7382,
13,
13,
18884,
432,
29922,
29926,
29899,
29896,
13,
1678,
736,
263,
13,
13,
1753,
766,
29764,
537,
29898,
2749,
29896,
29892,
3948,
29906,
29892,
7688,
287,
1125,
13,
1678,
302,
29922,
2749,
29896,
29889,
12181,
29961,
29900,
29962,
13,
1678,
269,
29922,
29900,
13,
1678,
565,
7688,
287,
1360,
5574,
29901,
13,
4706,
363,
474,
297,
3464,
29898,
29900,
29892,
29876,
1125,
13,
9651,
2923,
29922,
6897,
29898,
2749,
29896,
29961,
29875,
29962,
29899,
2749,
29906,
29961,
29875,
2314,
13,
9651,
269,
353,
269,
718,
313,
12765,
16395,
29876,
29899,
29875,
6802,
29876,
29897,
13,
1678,
1683,
29901,
13,
4706,
363,
474,
297,
3464,
29898,
29900,
29892,
29876,
1125,
13,
9651,
2923,
29922,
6897,
29898,
2749,
29896,
29961,
29875,
29962,
29899,
2749,
29906,
29961,
29875,
2314,
13,
9651,
269,
353,
269,
718,
313,
12765,
29897,
13,
1678,
736,
269,
13,
13,
13,
1753,
1653,
29918,
329,
1793,
29918,
5344,
29898,
1272,
29892,
3402,
3950,
353,
11117,
1792,
2396,
29900,
29892,
525,
667,
2396,
29871,
29896,
29892,
525,
1767,
2396,
29871,
29906,
29913,
1125,
13,
13,
1678,
9995,
13,
13,
1678,
584,
3207,
848,
29901,
9651,
11701,
12205,
29892,
29871,
29906,
29928,
29892,
302,
29916,
29941,
13,
1678,
584,
3207,
3402,
3950,
29901,
418,
9657,
2534,
278,
1897,
1024,
470,
18999,
363,
4160,
29892,
4452,
322,
26838,
29914,
5975,
13,
1678,
584,
2457,
29901,
462,
29896,
29889,
278,
19725,
4636,
29889,
313,
29906,
29928,
29892,
302,
921,
286,
29892,
302,
29922,
7193,
29892,
286,
29922,
7076,
29897,
13,
462,
632,
29906,
29889,
1051,
310,
4160,
313,
262,
1797,
411,
278,
19725,
4636,
4206,
29897,
13,
462,
632,
29941,
29889,
1051,
310,
4452,
313,
262,
1797,
411,
278,
19725,
4636,
4341,
29897,
13,
1678,
9995,
13,
1678,
2944,
3073,
353,
3402,
3950,
1839,
667,
2033,
13,
1678,
1404,
3073,
353,
3402,
3950,
1839,
1792,
2033,
13,
1678,
995,
3073,
353,
3402,
3950,
1839,
1767,
2033,
13,
13,
1678,
1404,
1293,
353,
848,
29889,
861,
7503,
29892,
1792,
3073,
1822,
25027,
391,
580,
13,
1678,
2944,
1293,
353,
848,
29889,
861,
7503,
29892,
667,
3073,
1822,
25027,
391,
580,
13,
1678,
995,
1293,
353,
848,
29889,
861,
7503,
29892,
1767,
3073,
1822,
25027,
391,
580,
13,
13,
1678,
4160,
353,
1051,
29898,
842,
29898,
1272,
29889,
861,
7503,
29892,
1792,
3073,
12622,
13,
1678,
4452,
353,
1051,
29898,
842,
29898,
1272,
29889,
861,
7503,
29892,
667,
3073,
12622,
13,
13,
1678,
4160,
29918,
2248,
353,
426,
7193,
29961,
29875,
5387,
474,
363,
474,
297,
3464,
29898,
2435,
29898,
7193,
876,
29913,
13,
13,
1678,
10518,
29918,
8977,
353,
426,
667,
29901,
518,
9302,
29889,
13707,
363,
474,
297,
3464,
29898,
2435,
29898,
7193,
28166,
363,
2944,
297,
4452,
29913,
13,
13,
1678,
363,
474,
297,
3464,
29898,
29900,
29892,
2435,
29898,
1272,
22164,
13,
4706,
2944,
353,
2944,
1293,
29961,
29875,
29962,
13,
4706,
1404,
353,
1404,
1293,
29961,
29875,
29962,
13,
4706,
995,
353,
995,
1293,
29961,
29875,
29962,
13,
13,
4706,
10518,
29918,
8977,
29961,
667,
3816,
7193,
29918,
2248,
29961,
1792,
5262,
353,
995,
13,
13,
1678,
1060,
353,
10518,
29889,
17271,
29898,
15926,
29918,
8977,
29897,
13,
1678,
1060,
29889,
2248,
353,
4160,
13,
13,
1678,
4160,
353,
1051,
29898,
29990,
29889,
2248,
29897,
13,
1678,
4452,
353,
1051,
29898,
29990,
29889,
13099,
29897,
13,
13,
1678,
736,
7442,
29889,
2378,
29898,
29990,
511,
4160,
29892,
4452,
2
] |
Scripts/Prepare/generate_tif.py | broxtopd/Map-Tiling-App | 0 | 1605149 | <gh_stars>0
# Script create an image (tif) file from GIS data
#
###############################################################################
# Copyright (c) 2018, <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
###############################################################################
import sys,os
import zipfile
import gdal, osr
import subprocess
from PIL import Image
import tempfile
import shutil
import urllib
(major,minor,micro,releaselevel,serial) = sys.version_info
if major == 2:
from cStringIO import StringIO
elif major == 3:
from io import StringIO
from cgi import parse_qs, escape
import numpy as np
import multiprocessing
from itertools import repeat
resampling_list = ('average','near','bilinear','cubic','cubicspline','lanczos','antialias')
__version__ = "0.1"
scriptdir = os.path.dirname(os.path.realpath(__file__))
def optparse_init():
"""Prepare the option parser for input (argv)"""
from optparse import OptionParser, OptionGroup
usage = 'Usage: %prog [options] input_file(s) [output]'
p = OptionParser(usage, version='%prog '+ __version__)
p.add_option('-r', '--resample', dest='resample', type='choice', choices=resampling_list,
help='Resampling method (%s) - default "average"' % ','.join(resampling_list))
p.add_option('-s', '--shpfile', dest='shpfilename',
help='Shapefile used to clip the raster')
p.add_option('-o', '--outsideMask', dest='outsideMask', action='store_true',
help='If specified, specifies that everything outside of shape is masked')
p.add_option('-c', '--clrfile', dest='clrfilename',
help='Color file to be used to make the file into a color file')
p.add_option('-f', '--bgfile', dest='bgfilename',
help='Background data to be blended with foreground data')
p.add_option('-b', '--blend', dest='blend',
help='Fractional blend between background and foreground file (0-1)')
p.add_option('-p', '--pct', dest='pct', action='store_true',
help='If speficied, creates a pct file from an rgb file')
p.add_option('-a', '--s_srs', dest='s_srs',
help='Coordinate System')
p.add_option('-d', '--t_srs', dest='t_srs',
help='Coordinate System')
p.add_option('-e', '--te', dest='te',
help='Map Bounds')
p.add_option('-q', '--tr', dest='tr',
help='Map Resolution')
p.add_option('-t', '--ts', dest='ts',
help='Map Scale')
p.add_option('-x', '--ExactColorEntry', dest='ExactColorEntry', action='store_true',
help='Exact Color Entry')
p.add_option('-n', '--NearestColorEntry', dest='NearestColorEntry', action='store_true',
help='Nearest Color Entry')
p.add_option('-g', '--GISOptimizedImage', dest='GISOptimizedImage', action='store_true',
help='Tiled image, GIS Optimized')
p.set_defaults(resample='near', blend='0.5', shpfilename='', s_srs = '', t_srs = '', te = '', tr = '', ts = '', overlayName = '', FType='', outsideMask=False, clrfilename='', bgfilename='', pct=False,ExactColorEntry=False,NearestColorEntry=False,GISOptimizedImage=False)
return p
if __name__ == '__main__':
# Parse the command line arguments
argv = gdal.GeneralCmdLineProcessor( sys.argv )
parser = optparse_init()
options,args = parser.parse_args(args=argv[1:])
inraster = args[0]
inpath, infile = os.path.split(inraster)
outraster = args[1]
resample = options.resample
shpfilename = options.shpfilename
outsideMask = options.outsideMask
clrfilename = options.clrfilename
bgfilename = options.bgfilename
blend = options.blend
pct = options.pct
GISOptimizedImage = options.GISOptimizedImage
s_srs = options.s_srs
te = options.te
ts = options.ts
tr = options.tr
t_srs = options.t_srs
ExactColorEntry = options.ExactColorEntry
NearestColorEntry = options.NearestColorEntry
working_dir = outraster.replace('.tif','_' + os.path.basename(tempfile.mktemp()))
if ~os.path.exists(working_dir):
os.makedirs(working_dir)
tempfilename_web = working_dir + '/prepare_web'
tempfilename_vrt = working_dir + '/prepare_vrt'
tempfilename_raster = working_dir + '/prepare_raster' + infile[-4:]
tempfilename_a = working_dir + '/prepare_a.tif'
tempfilename_clr = working_dir + '/prepare_clr.vrt'
tempfilename_shp = working_dir + '/prepare_shp.tif'
tempfilename_bg = working_dir + '/prepare_bg.tif'
tempfilename_bg2 = working_dir + '/prepare_bg2.tif'
tempfilename_pct = working_dir + '/prepare_pct.vrt'
ifname = inraster
if '.zip' in inraster:
zf,zp = inraster.split('.zip')
fh = open(zf + '.zip', 'rb')
z = zipfile.ZipFile(fh)
outfile = open(tempfilename_raster, 'wb')
outfile.write(z.read(zp[1:]))
outfile.close()
fh.close()
ifname = tempfilename_raster
if clrfilename != '':
command = 'gdaldem color-relief -alpha -of vrt'
if NearestColorEntry == True:
command += ' -nearest_color_entry'
elif ExactColorEntry == True:
commmand += ' -exact_color_entry'
command += ' "' + ifname + '" "' + clrfilename + '" "' + tempfilename_clr + '"'
print(command)
subprocess.call(command, shell=True)
ifname = tempfilename_clr
else:
in_ds = gdal.Open(ifname)
bands = in_ds.RasterCount
del in_ds
if bands == 1:
command = 'gdal_translate -of vrt "' + ifname + '" "' + tempfilename_clr + '"'
subprocess.call(command, shell=True)
ifname = tempfilename_clr
args = ''
if s_srs != '':
args += ' -s_srs "' + s_srs + '"'
if te != '':
args += ' -te ' + te
if ts != '':
args += ' -ts ' + ts
if tr!= '':
args += ' -tr ' + tr
if t_srs!= '':
args += ' -t_srs "' + t_srs + '"'
in_ds = gdal.Open(ifname)
bands = in_ds.RasterCount
del in_ds
if bands == 3 or bands == 1:
args += ' -dstalpha'
command = 'gdalwarp' + args + ' -multi -r ' + resample + ' -overwrite "' + ifname + '" "' + tempfilename_a + '"'
print(command)
subprocess.call(command, shell=True)
ifname = tempfilename_a
if shpfilename != '':
path, shpfile = os.path.split(shpfilename)
shplayer = shpfile.replace('.shp','')
os.rename(ifname,tempfilename_shp)
if outsideMask == True:
command = 'gdal_rasterize -b 4 -burn 0 -l "' + shplayer + '" "' + shpfilename + '" "' + tempfilename_shp + '"'
print(command)
subprocess.call(command, shell=True)
ifname = tempfilename_shp
else:
command = 'gdal_rasterize -i -b 4 -burn 0 -l "' + shplayer + '" "' + shpfilename + '" "' + tempfilename_shp + '"'
print(command)
subprocess.call(command, shell=True)
ifname = tempfilename_shp
if bgfilename != '':
in_ds = gdal.Open(ifname)
projection = in_ds.GetProjection()
geotransform = in_ds.GetGeoTransform()
minx = geotransform[0]
maxy = geotransform[3]
maxx = minx + geotransform[1]*in_ds.RasterXSize
miny = maxy + geotransform[5]*in_ds.RasterYSize
te_str = str(minx) + ' ' + str(miny) + ' ' + str(maxx) + ' ' + str(maxy)
ts_str = str(in_ds.RasterXSize) + ' ' + str(in_ds.RasterYSize)
srs = osr.SpatialReference()
srs.ImportFromWkt(projection)
t_srs = srs.ExportToProj4()
del in_ds
command = 'gdalwarp -multi -r ' + resample + ' -overwrite -te ' + te_str + ' -ts ' + ts_str + ' -t_srs "' + t_srs + '" "' + bgfilename + '" "' + tempfilename_bg + '"'
print(command)
subprocess.call(command, shell=True)
command = 'python "' + scriptdir + os.path.sep + 'rgb_merge.py" "' + ifname + '" "' + tempfilename_bg + '" ' + blend + ' "' + tempfilename_bg2 + '"'
print(command)
subprocess.call(command, shell=True)
ifname = tempfilename_bg2
if pct == True:
command = 'python "' + scriptdir + os.path.sep + 'rgb2pct.py" -of VRT "' + ifname + '" "' + tempfilename_pct + '"'
print(command)
subprocess.call(command, shell=True)
ifname = tempfilename_pct
if GISOptimizedImage == True:
command = 'gdalwarp -co COMPRESS=LZW -co TILED=YES -co BIGTIFF=IF_SAFER -multi -overwrite "' + ifname + '" "' + outraster + '"'
print(command)
subprocess.call(command, shell=True)
command = 'gdaladdo --config COMPRESS_OVERVIEW LZW --config INTERLEAVE_OVERVIEW PIXEL -r average "' + outraster + '" 2 4 8 16 32 64'
print(command)
subprocess.call(command, shell=True)
else:
command = 'gdalwarp -co COMPRESS=JPEG -multi -overwrite "' + ifname + '" "' + outraster + '"'
print(command)
subprocess.call(command, shell=True)
# Remove temporary files
shutil.rmtree(working_dir)
print('DONE CREATING MAP!')
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
29937,
14415,
1653,
385,
1967,
313,
29873,
361,
29897,
934,
515,
402,
3235,
848,
30004,
13,
29937,
30004,
13,
13383,
13383,
13383,
13383,
7346,
4136,
2277,
29937,
30004,
13,
29937,
14187,
1266,
313,
29883,
29897,
29871,
29906,
29900,
29896,
29947,
29892,
529,
5813,
3238,
13,
29937,
6756,
13,
29937,
29871,
20894,
2333,
338,
1244,
1609,
16896,
29892,
3889,
310,
8323,
29892,
304,
738,
2022,
4017,
292,
263,
30004,
13,
29937,
29871,
3509,
310,
445,
7047,
322,
6942,
5106,
2066,
313,
1552,
376,
6295,
14093,
4968,
30004,
13,
29937,
29871,
304,
5376,
297,
278,
18540,
1728,
24345,
29892,
3704,
1728,
29485,
30004,
13,
29937,
29871,
278,
10462,
304,
671,
29892,
3509,
29892,
6623,
29892,
10366,
29892,
9805,
29892,
1320,
2666,
29892,
269,
803,
1947,
11167,
13,
29937,
29871,
322,
29914,
272,
19417,
14591,
310,
278,
18540,
29892,
322,
304,
14257,
12407,
304,
6029,
278,
30004,
13,
29937,
29871,
18540,
338,
15252,
3276,
304,
437,
577,
29892,
4967,
304,
278,
1494,
5855,
29901,
30004,
13,
29937,
6756,
13,
29937,
29871,
450,
2038,
3509,
1266,
8369,
322,
445,
10751,
8369,
4091,
367,
5134,
30004,
13,
29937,
29871,
297,
599,
14591,
470,
23228,
2011,
1080,
310,
278,
18540,
22993,
13,
29937,
6756,
13,
29937,
29871,
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,
30004,
13,
29937,
29871,
6323,
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,
11167,
13,
29937,
29871,
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,
30004,
13,
29937,
29871,
6093,
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,
30004,
13,
29937,
29871,
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,
30004,
13,
29937,
29871,
3895,
29892,
19474,
8079,
6323,
2672,
8707,
8186,
9838,
22659,
6093,
7791,
7818,
12982,
1525,
6323,
6093,
501,
1660,
6323,
438,
29911,
4448,
30004,
13,
29937,
29871,
5012,
1964,
4214,
29903,
2672,
6093,
7791,
7818,
12982,
1525,
22993,
13,
13383,
13383,
13383,
13383,
7346,
4136,
2277,
29937,
30004,
13,
5215,
10876,
29892,
359,
30004,
13,
5215,
14319,
1445,
30004,
13,
5215,
330,
12293,
29892,
2897,
29878,
30004,
13,
5215,
1014,
5014,
30004,
13,
3166,
349,
6227,
1053,
7084,
30004,
13,
5215,
5694,
1445,
30004,
13,
5215,
528,
4422,
30004,
13,
5215,
3142,
1982,
30004,
13,
29898,
21355,
29892,
1195,
272,
29892,
29885,
2357,
29892,
14096,
5563,
29892,
15550,
29897,
353,
10876,
29889,
3259,
29918,
3888,
30004,
13,
361,
4655,
1275,
29871,
29906,
29901,
30004,
13,
1678,
515,
274,
1231,
5971,
1053,
1714,
5971,
30004,
13,
23681,
4655,
1275,
29871,
29941,
29901,
30004,
13,
1678,
515,
12013,
1053,
1714,
5971,
30004,
13,
3166,
274,
3146,
1053,
6088,
29918,
29939,
29879,
29892,
10169,
30004,
13,
5215,
12655,
408,
7442,
30004,
13,
5215,
6674,
307,
985,
292,
30004,
13,
3166,
4256,
8504,
1053,
12312,
30004,
13,
30004,
13,
690,
314,
10335,
29918,
1761,
353,
6702,
12483,
482,
3788,
28502,
3788,
18152,
457,
279,
3788,
29883,
431,
293,
3788,
29883,
431,
1199,
572,
457,
3788,
6468,
2067,
359,
3788,
424,
616,
3173,
1495,
30004,
13,
1649,
3259,
1649,
353,
376,
29900,
29889,
29896,
19451,
13,
2154,
3972,
353,
2897,
29889,
2084,
29889,
25721,
29898,
359,
29889,
2084,
29889,
6370,
2084,
22168,
1445,
1649,
876,
30004,
13,
30004,
13,
1753,
3523,
5510,
29918,
2344,
7295,
30004,
13,
4706,
9995,
29925,
3445,
598,
278,
2984,
13812,
363,
1881,
313,
19218,
5513,
15945,
30004,
13,
30004,
13,
4706,
515,
3523,
5510,
1053,
10831,
11726,
29892,
10831,
4782,
30004,
13,
4706,
8744,
353,
525,
27573,
29901,
1273,
29097,
518,
6768,
29962,
1881,
29918,
1445,
29898,
29879,
29897,
518,
4905,
29962,
29915,
30004,
13,
4706,
282,
353,
10831,
11726,
29898,
21125,
29892,
1873,
2433,
29995,
29097,
525,
29974,
4770,
3259,
1649,
8443,
13,
4706,
282,
29889,
1202,
29918,
3385,
877,
29899,
29878,
742,
525,
489,
690,
981,
742,
2731,
2433,
690,
981,
742,
1134,
2433,
16957,
742,
19995,
29922,
690,
314,
10335,
29918,
1761,
11167,
13,
462,
4706,
1371,
2433,
1666,
314,
10335,
1158,
313,
29995,
29879,
29897,
448,
2322,
376,
12483,
482,
29908,
29915,
1273,
13420,
4286,
7122,
29898,
690,
314,
10335,
29918,
1761,
876,
30004,
13,
4706,
282,
29889,
1202,
29918,
3385,
877,
29899,
29879,
742,
525,
489,
845,
29886,
1445,
742,
2731,
2433,
845,
29886,
9507,
23592,
13,
462,
3986,
1371,
2433,
24111,
1445,
1304,
304,
20102,
278,
364,
1901,
1495,
30004,
13,
4706,
282,
29889,
1202,
29918,
3385,
877,
29899,
29877,
742,
525,
489,
449,
2975,
19832,
742,
2731,
2433,
449,
2975,
19832,
742,
3158,
2433,
8899,
29918,
3009,
23592,
13,
462,
3986,
1371,
2433,
3644,
6790,
29892,
1580,
11057,
393,
4129,
5377,
310,
8267,
338,
11105,
287,
1495,
30004,
13,
4706,
282,
29889,
1202,
29918,
3385,
877,
29899,
29883,
742,
525,
489,
695,
29878,
1445,
742,
2731,
2433,
695,
29878,
9507,
742,
6756,
13,
462,
3986,
1371,
2433,
3306,
934,
304,
367,
1304,
304,
1207,
278,
934,
964,
263,
2927,
934,
1495,
30004,
13,
4706,
282,
29889,
1202,
29918,
3385,
877,
29899,
29888,
742,
525,
489,
16264,
1445,
742,
2731,
2433,
16264,
9507,
23592,
13,
462,
3986,
1371,
2433,
10581,
848,
304,
367,
1999,
2760,
411,
363,
18128,
848,
1495,
30004,
13,
4706,
282,
29889,
1202,
29918,
3385,
877,
29899,
29890,
742,
525,
489,
2204,
355,
742,
2731,
2433,
2204,
355,
23592,
13,
462,
3986,
1371,
2433,
29943,
13857,
284,
1999,
355,
1546,
3239,
322,
363,
18128,
934,
313,
29900,
29899,
29896,
29897,
1495,
30004,
13,
4706,
282,
29889,
1202,
29918,
3385,
877,
29899,
29886,
742,
525,
489,
29886,
312,
742,
2731,
2433,
29886,
312,
742,
3158,
2433,
8899,
29918,
3009,
23592,
13,
462,
3986,
1371,
2433,
3644,
961,
9639,
1000,
29892,
10017,
263,
282,
312,
934,
515,
385,
15552,
29890,
934,
1495,
268,
6756,
13,
4706,
282,
29889,
1202,
29918,
3385,
877,
29899,
29874,
742,
525,
489,
29879,
29918,
29879,
2288,
742,
2731,
2433,
29879,
29918,
29879,
2288,
23592,
13,
462,
3986,
1371,
2433,
7967,
16065,
2184,
1495,
29871,
6756,
13,
4706,
282,
29889,
1202,
29918,
3385,
877,
29899,
29881,
742,
525,
489,
29873,
29918,
29879,
2288,
742,
2731,
2433,
29873,
29918,
29879,
2288,
23592,
13,
462,
3986,
1371,
2433,
7967,
16065,
2184,
1495,
29871,
6756,
13,
4706,
282,
29889,
1202,
29918,
3385,
877,
29899,
29872,
742,
525,
489,
371,
742,
2731,
2433,
371,
23592,
13,
462,
3986,
1371,
2433,
3388,
350,
3885,
1495,
29871,
6756,
13,
4706,
282,
29889,
1202,
29918,
3385,
877,
29899,
29939,
742,
525,
489,
509,
742,
2731,
2433,
509,
23592,
13,
462,
3986,
1371,
2433,
3388,
24062,
918,
1495,
6756,
13,
4706,
282,
29889,
1202,
29918,
3385,
877,
29899,
29873,
742,
525,
489,
1372,
742,
2731,
2433,
1372,
23592,
13,
462,
3986,
1371,
2433,
3388,
2522,
744,
1495,
6756,
13,
4706,
282,
29889,
1202,
29918,
3385,
877,
29899,
29916,
742,
525,
489,
1252,
627,
3306,
9634,
742,
2731,
2433,
1252,
627,
3306,
9634,
742,
3158,
2433,
8899,
29918,
3009,
23592,
13,
462,
3986,
1371,
2433,
1252,
627,
9159,
28236,
1495,
6756,
13,
4706,
282,
29889,
1202,
29918,
3385,
877,
29899,
29876,
742,
525,
489,
29940,
799,
342,
3306,
9634,
742,
2731,
2433,
29940,
799,
342,
3306,
9634,
742,
3158,
2433,
8899,
29918,
3009,
23592,
13,
462,
3986,
1371,
2433,
29940,
799,
342,
9159,
28236,
1495,
29871,
6756,
13,
4706,
282,
29889,
1202,
29918,
3385,
877,
29899,
29887,
742,
525,
489,
29954,
3235,
20624,
326,
1891,
2940,
742,
2731,
2433,
29954,
3235,
20624,
326,
1891,
2940,
742,
3158,
2433,
8899,
29918,
3009,
23592,
13,
462,
3986,
1371,
2433,
29911,
2356,
1967,
29892,
402,
3235,
20693,
326,
1891,
1495,
30004,
13,
4706,
282,
29889,
842,
29918,
4381,
29879,
29898,
690,
981,
2433,
28502,
742,
1999,
355,
2433,
29900,
29889,
29945,
742,
528,
29886,
9507,
2433,
742,
269,
29918,
29879,
2288,
353,
15516,
260,
29918,
29879,
2288,
353,
15516,
734,
353,
15516,
534,
353,
15516,
18696,
353,
15516,
27292,
1170,
353,
15516,
383,
1542,
2433,
742,
5377,
19832,
29922,
8824,
29892,
1067,
29878,
9507,
2433,
742,
25989,
9507,
2433,
742,
282,
312,
29922,
8824,
29892,
1252,
627,
3306,
9634,
29922,
8824,
29892,
29940,
799,
342,
3306,
9634,
29922,
8824,
29892,
29954,
3235,
20624,
326,
1891,
2940,
29922,
8824,
8443,
13,
30004,
13,
4706,
736,
282,
30004,
13,
1678,
6756,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
30004,
13,
1678,
396,
20969,
278,
1899,
1196,
6273,
418,
6756,
13,
1678,
1852,
29894,
353,
330,
12293,
29889,
15263,
23651,
3542,
18689,
29898,
10876,
29889,
19218,
1723,
30004,
13,
1678,
13812,
353,
3523,
5510,
29918,
2344,
26471,
13,
1678,
3987,
29892,
5085,
353,
13812,
29889,
5510,
29918,
5085,
29898,
5085,
29922,
19218,
29961,
29896,
29901,
2314,
30004,
13,
1678,
297,
29878,
1901,
353,
6389,
29961,
29900,
29962,
30004,
13,
1678,
297,
2084,
29892,
297,
1445,
353,
2897,
29889,
2084,
29889,
5451,
29898,
262,
29878,
1901,
8443,
13,
30004,
13,
1678,
714,
29878,
1901,
353,
6389,
29961,
29896,
29962,
30004,
13,
1678,
620,
981,
353,
3987,
29889,
690,
981,
30004,
13,
1678,
528,
29886,
9507,
353,
3987,
29889,
845,
29886,
9507,
30004,
13,
1678,
5377,
19832,
353,
3987,
29889,
449,
2975,
19832,
30004,
13,
1678,
1067,
29878,
9507,
353,
3987,
29889,
695,
29878,
9507,
30004,
13,
1678,
25989,
9507,
353,
3987,
29889,
16264,
9507,
30004,
13,
1678,
1999,
355,
353,
3987,
29889,
2204,
355,
30004,
13,
1678,
282,
312,
353,
3987,
29889,
29886,
312,
30004,
13,
1678,
402,
3235,
20624,
326,
1891,
2940,
353,
3987,
29889,
29954,
3235,
20624,
326,
1891,
2940,
30004,
13,
1678,
269,
29918,
29879,
2288,
353,
3987,
29889,
29879,
29918,
29879,
2288,
30004,
13,
1678,
734,
353,
3987,
29889,
371,
30004,
13,
1678,
18696,
353,
3987,
29889,
1372,
30004,
13,
1678,
534,
353,
3987,
29889,
509,
30004,
13,
1678,
260,
29918,
29879,
2288,
353,
3987,
29889,
29873,
29918,
29879,
2288,
30004,
13,
1678,
1222,
627,
3306,
9634,
353,
3987,
29889,
1252,
627,
3306,
9634,
30004,
13,
1678,
26206,
342,
3306,
9634,
353,
3987,
29889,
29940,
799,
342,
3306,
9634,
30004,
13,
1678,
6756,
13,
1678,
1985,
29918,
3972,
353,
714,
29878,
1901,
29889,
6506,
12839,
29873,
361,
3788,
29918,
29915,
718,
2897,
29889,
2084,
29889,
6500,
3871,
29898,
7382,
1445,
29889,
29885,
1193,
3451,
22130,
30004,
13,
1678,
565,
3695,
359,
29889,
2084,
29889,
9933,
29898,
22899,
29918,
3972,
1125,
30004,
13,
4706,
2897,
29889,
29885,
12535,
12935,
29898,
22899,
29918,
3972,
8443,
13,
4706,
6756,
13,
1678,
5694,
9507,
29918,
2676,
353,
1985,
29918,
3972,
718,
8207,
19125,
29918,
2676,
29915,
30004,
13,
1678,
5694,
9507,
29918,
29894,
2273,
353,
1985,
29918,
3972,
718,
8207,
19125,
29918,
29894,
2273,
29915,
30004,
13,
1678,
5694,
9507,
29918,
29878,
1901,
353,
1985,
29918,
3972,
718,
8207,
19125,
29918,
29878,
1901,
29915,
718,
297,
1445,
14352,
29946,
17531,
6756,
13,
1678,
5694,
9507,
29918,
29874,
353,
1985,
29918,
3972,
718,
8207,
19125,
29918,
29874,
29889,
29873,
361,
29915,
30004,
13,
1678,
5694,
9507,
29918,
695,
29878,
353,
1985,
29918,
3972,
718,
8207,
19125,
29918,
695,
29878,
29889,
29894,
2273,
29915,
30004,
13,
1678,
5694,
9507,
29918,
845,
29886,
353,
1985,
29918,
3972,
718,
8207,
19125,
29918,
845,
29886,
29889,
29873,
361,
29915,
30004,
13,
1678,
5694,
9507,
29918,
16264,
353,
1985,
29918,
3972,
718,
8207,
19125,
29918,
16264,
29889,
29873,
361,
29915,
30004,
13,
1678,
5694,
9507,
29918,
16264,
29906,
353,
1985,
29918,
3972,
718,
8207,
19125,
29918,
16264,
29906,
29889,
29873,
361,
29915,
30004,
13,
1678,
5694,
9507,
29918,
29886,
312,
353,
1985,
29918,
3972,
718,
8207,
19125,
29918,
29886,
312,
29889,
29894,
2273,
29915,
30004,
13,
30004,
13,
1678,
565,
978,
353,
297,
29878,
1901,
30004,
13,
30004,
13,
1678,
565,
15300,
7554,
29915,
297,
297,
29878,
1901,
29901,
30004,
13,
4706,
503,
29888,
29892,
29920,
29886,
353,
297,
29878,
1901,
29889,
5451,
12839,
7554,
1495,
30004,
13,
4706,
285,
29882,
353,
1722,
29898,
29920,
29888,
718,
15300,
7554,
742,
525,
6050,
1495,
30004,
13,
4706,
503,
353,
14319,
1445,
29889,
26264,
2283,
29898,
29888,
29882,
8443,
13,
4706,
714,
1445,
353,
1722,
29898,
7382,
9507,
29918,
29878,
1901,
29892,
525,
29893,
29890,
1495,
30004,
13,
4706,
714,
1445,
29889,
3539,
29898,
29920,
29889,
949,
29898,
29920,
29886,
29961,
29896,
29901,
12622,
30004,
13,
4706,
714,
1445,
29889,
5358,
26471,
13,
4706,
285,
29882,
29889,
5358,
26471,
13,
4706,
565,
978,
353,
5694,
9507,
29918,
29878,
1901,
30004,
13,
30004,
13,
1678,
565,
1067,
29878,
9507,
2804,
525,
2396,
1678,
6756,
13,
4706,
1899,
353,
525,
29887,
12293,
2310,
2927,
29899,
2674,
2575,
448,
2312,
448,
974,
325,
2273,
29915,
30004,
13,
4706,
565,
26206,
342,
3306,
9634,
1275,
5852,
29901,
30004,
13,
9651,
1899,
4619,
525,
448,
28502,
342,
29918,
2780,
29918,
8269,
29915,
30004,
13,
4706,
25342,
1222,
627,
3306,
9634,
1275,
5852,
29901,
30004,
13,
9651,
844,
29885,
392,
4619,
525,
448,
735,
627,
29918,
2780,
29918,
8269,
29915,
30004,
13,
4706,
1899,
4619,
525,
13577,
718,
565,
978,
718,
18793,
13577,
718,
1067,
29878,
9507,
718,
18793,
13577,
718,
5694,
9507,
29918,
695,
29878,
718,
18793,
29915,
30004,
13,
4706,
1596,
29898,
6519,
8443,
13,
4706,
1014,
5014,
29889,
4804,
29898,
6519,
29892,
6473,
29922,
5574,
29897,
29871,
6756,
13,
4706,
565,
978,
353,
5694,
9507,
29918,
695,
29878,
30004,
13,
1678,
1683,
29901,
30004,
13,
4706,
297,
29918,
6289,
353,
330,
12293,
29889,
6585,
29898,
361,
978,
8443,
13,
4706,
22706,
353,
297,
29918,
6289,
29889,
29934,
1901,
3981,
30004,
13,
4706,
628,
297,
29918,
6289,
30004,
13,
4706,
565,
22706,
1275,
29871,
29896,
29901,
30004,
13,
9651,
1899,
353,
525,
29887,
12293,
29918,
21652,
448,
974,
325,
2273,
13577,
718,
565,
978,
718,
18793,
13577,
718,
5694,
9507,
29918,
695,
29878,
718,
18793,
29915,
30004,
13,
9651,
1014,
5014,
29889,
4804,
29898,
6519,
29892,
6473,
29922,
5574,
29897,
29871,
6756,
13,
9651,
565,
978,
353,
5694,
9507,
29918,
695,
29878,
30004,
13,
30004,
13,
1678,
6389,
353,
6629,
30004,
13,
1678,
565,
269,
29918,
29879,
2288,
2804,
525,
2396,
30004,
13,
4706,
6389,
4619,
525,
448,
29879,
29918,
29879,
2288,
13577,
718,
269,
29918,
29879,
2288,
718,
18793,
29915,
30004,
13,
1678,
565,
734,
2804,
525,
2396,
30004,
13,
4706,
6389,
4619,
525,
448,
371,
525,
718,
734,
6756,
13,
1678,
565,
18696,
2804,
525,
2396,
30004,
13,
4706,
6389,
4619,
525,
448,
1372,
525,
718,
18696,
30004,
13,
1678,
565,
534,
19216,
525,
2396,
30004,
13,
4706,
6389,
4619,
525,
448,
509,
525,
718,
534,
30004,
13,
1678,
565,
260,
29918,
29879,
2288,
19216,
525,
2396,
30004,
13,
4706,
6389,
4619,
525,
448,
29873,
29918,
29879,
2288,
13577,
718,
260,
29918,
29879,
2288,
718,
18793,
29915,
30004,
13,
4706,
6756,
13,
1678,
297,
29918,
6289,
353,
330,
12293,
29889,
6585,
29898,
361,
978,
8443,
13,
1678,
22706,
353,
297,
29918,
6289,
29889,
29934,
1901,
3981,
30004,
13,
1678,
628,
297,
29918,
6289,
30004,
13,
1678,
565,
22706,
1275,
29871,
29941,
470,
22706,
1275,
29871,
29896,
29901,
30004,
13,
4706,
6389,
4619,
525,
448,
22992,
2312,
29915,
30004,
13,
4706,
6756,
13,
1678,
1899,
353,
525,
29887,
12293,
4495,
29886,
29915,
718,
6389,
718,
525,
448,
9910,
448,
29878,
525,
718,
620,
981,
718,
525,
448,
957,
3539,
13577,
718,
565,
978,
718,
18793,
13577,
718,
5694,
9507,
29918,
29874,
718,
18793,
29915,
30004,
13,
1678,
1596,
29898,
6519,
8443,
13,
1678,
1014,
5014,
29889,
4804,
29898,
6519,
29892,
6473,
29922,
5574,
29897,
6756,
13,
1678,
565,
978,
353,
5694,
9507,
29918,
29874,
30004,
13,
30004,
13,
1678,
565,
528,
29886,
9507,
2804,
525,
2396,
30004,
13,
4706,
2224,
29892,
528,
29886,
1445,
353,
2897,
29889,
2084,
29889,
5451,
29898,
845,
29886,
9507,
8443,
13,
4706,
528,
9106,
353,
528,
29886,
1445,
29889,
6506,
12839,
845,
29886,
3788,
1495,
30004,
13,
4706,
2897,
29889,
1267,
420,
29898,
361,
978,
29892,
7382,
9507,
29918,
845,
29886,
8443,
13,
4706,
565,
5377,
19832,
1275,
5852,
29901,
6756,
13,
9651,
1899,
353,
525,
29887,
12293,
29918,
29878,
1901,
675,
448,
29890,
29871,
29946,
448,
18712,
29871,
29900,
448,
29880,
13577,
718,
528,
9106,
718,
18793,
13577,
718,
528,
29886,
9507,
718,
18793,
13577,
718,
5694,
9507,
29918,
845,
29886,
718,
18793,
29915,
30004,
13,
9651,
1596,
29898,
6519,
8443,
13,
9651,
1014,
5014,
29889,
4804,
29898,
6519,
29892,
6473,
29922,
5574,
8443,
13,
9651,
565,
978,
353,
5694,
9507,
29918,
845,
29886,
30004,
13,
4706,
1683,
29901,
18884,
6756,
13,
9651,
1899,
353,
525,
29887,
12293,
29918,
29878,
1901,
675,
448,
29875,
448,
29890,
29871,
29946,
448,
18712,
29871,
29900,
448,
29880,
13577,
718,
528,
9106,
718,
18793,
13577,
718,
528,
29886,
9507,
718,
18793,
13577,
718,
5694,
9507,
29918,
845,
29886,
718,
18793,
29915,
30004,
13,
9651,
1596,
29898,
6519,
8443,
13,
9651,
1014,
5014,
29889,
4804,
29898,
6519,
29892,
6473,
29922,
5574,
8443,
13,
9651,
565,
978,
353,
5694,
9507,
29918,
845,
29886,
30004,
13,
30004,
13,
1678,
565,
25989,
9507,
2804,
525,
2396,
30004,
13,
4706,
297,
29918,
6289,
353,
330,
12293,
29889,
6585,
29898,
361,
978,
8443,
13,
4706,
18246,
259,
353,
297,
29918,
6289,
29889,
2577,
1184,
6929,
26471,
13,
4706,
1737,
25730,
550,
689,
353,
297,
29918,
6289,
29889,
2577,
7999,
29877,
13372,
26471,
13,
4706,
1375,
29916,
353,
1737,
25730,
550,
689,
29961,
29900,
29962,
30004,
13,
4706,
611,
3594,
353,
1737,
25730,
550,
689,
29961,
29941,
29962,
30004,
13,
4706,
4236,
29916,
353,
1375,
29916,
718,
1737,
25730,
550,
689,
29961,
29896,
14178,
262,
29918,
6289,
29889,
29934,
1901,
29990,
3505,
30004,
13,
4706,
1375,
29891,
353,
611,
3594,
718,
1737,
25730,
550,
689,
29961,
29945,
14178,
262,
29918,
6289,
29889,
29934,
1901,
29979,
3505,
30004,
13,
4706,
734,
29918,
710,
353,
851,
29898,
1195,
29916,
29897,
718,
525,
525,
718,
851,
29898,
1195,
29891,
29897,
718,
525,
525,
718,
851,
29898,
3317,
29916,
29897,
718,
525,
525,
718,
851,
29898,
3317,
29891,
8443,
13,
4706,
18696,
29918,
710,
353,
851,
29898,
262,
29918,
6289,
29889,
29934,
1901,
29990,
3505,
29897,
718,
525,
525,
718,
851,
29898,
262,
29918,
6289,
29889,
29934,
1901,
29979,
3505,
8443,
13,
4706,
269,
2288,
353,
2897,
29878,
29889,
29903,
5031,
616,
7422,
26471,
13,
4706,
269,
2288,
29889,
17518,
4591,
29956,
1193,
29898,
771,
6929,
8443,
13,
4706,
260,
29918,
29879,
2288,
353,
269,
2288,
29889,
26382,
1762,
1184,
29926,
29946,
26471,
13,
4706,
628,
297,
29918,
6289,
30004,
13,
4706,
6756,
13,
4706,
1899,
353,
525,
29887,
12293,
4495,
29886,
448,
9910,
448,
29878,
525,
718,
620,
981,
718,
525,
448,
957,
3539,
448,
371,
525,
718,
734,
29918,
710,
718,
525,
448,
1372,
525,
718,
18696,
29918,
710,
718,
525,
448,
29873,
29918,
29879,
2288,
13577,
718,
260,
29918,
29879,
2288,
718,
18793,
13577,
718,
25989,
9507,
718,
18793,
13577,
718,
5694,
9507,
29918,
16264,
718,
18793,
29915,
30004,
13,
4706,
1596,
29898,
6519,
8443,
13,
4706,
1014,
5014,
29889,
4804,
29898,
6519,
29892,
6473,
29922,
5574,
8443,
13,
4706,
6756,
13,
4706,
1899,
353,
525,
4691,
13577,
718,
2471,
3972,
718,
2897,
29889,
2084,
29889,
19570,
718,
525,
23973,
29918,
14634,
29889,
2272,
29908,
13577,
718,
565,
978,
718,
18793,
13577,
718,
5694,
9507,
29918,
16264,
718,
18793,
525,
718,
1999,
355,
718,
525,
13577,
718,
5694,
9507,
29918,
16264,
29906,
718,
18793,
29915,
30004,
13,
4706,
1596,
29898,
6519,
8443,
13,
4706,
1014,
5014,
29889,
4804,
29898,
6519,
29892,
6473,
29922,
5574,
8443,
13,
4706,
565,
978,
353,
5694,
9507,
29918,
16264,
29906,
30004,
13,
4706,
6756,
13,
1678,
565,
282,
312,
1275,
5852,
29901,
30004,
13,
4706,
1899,
353,
525,
4691,
13577,
718,
2471,
3972,
718,
2897,
29889,
2084,
29889,
19570,
718,
525,
23973,
29906,
29886,
312,
29889,
2272,
29908,
448,
974,
478,
13079,
13577,
718,
565,
978,
718,
18793,
13577,
718,
5694,
9507,
29918,
29886,
312,
718,
18793,
29915,
30004,
13,
4706,
1596,
29898,
6519,
8443,
13,
4706,
1014,
5014,
29889,
4804,
29898,
6519,
29892,
6473,
29922,
5574,
8443,
13,
4706,
565,
978,
353,
5694,
9507,
29918,
29886,
312,
30004,
13,
30004,
13,
1678,
565,
402,
3235,
20624,
326,
1891,
2940,
1275,
5852,
29901,
30004,
13,
4706,
1899,
353,
525,
29887,
12293,
4495,
29886,
448,
1111,
4810,
3580,
26785,
29922,
29931,
29999,
29956,
448,
1111,
323,
29902,
20566,
29922,
21143,
448,
1111,
350,
6259,
24301,
4198,
29922,
6545,
29918,
29903,
5098,
1001,
448,
9910,
448,
957,
3539,
13577,
718,
565,
978,
718,
18793,
13577,
718,
714,
29878,
1901,
718,
18793,
29915,
30004,
13,
4706,
1596,
29898,
6519,
8443,
13,
4706,
1014,
5014,
29889,
4804,
29898,
6519,
29892,
6473,
29922,
5574,
29897,
6756,
13,
4706,
1899,
353,
525,
29887,
12293,
1202,
29877,
1192,
2917,
4810,
3580,
26785,
29918,
29949,
5348,
29963,
8673,
29956,
365,
29999,
29956,
1192,
2917,
2672,
4945,
1307,
7520,
29923,
29918,
29949,
5348,
29963,
8673,
29956,
349,
6415,
6670,
448,
29878,
6588,
13577,
718,
714,
29878,
1901,
718,
18793,
29871,
29906,
29871,
29946,
29871,
29947,
29871,
29896,
29953,
29871,
29941,
29906,
29871,
29953,
29946,
29915,
30004,
13,
4706,
1596,
29898,
6519,
8443,
13,
4706,
1014,
5014,
29889,
4804,
29898,
6519,
29892,
6473,
29922,
5574,
8443,
13,
1678,
1683,
29901,
30004,
13,
4706,
1899,
353,
525,
29887,
12293,
4495,
29886,
448,
1111,
4810,
3580,
26785,
29922,
29967,
4162,
29954,
448,
9910,
448,
957,
3539,
13577,
718,
565,
978,
718,
18793,
13577,
718,
714,
29878,
1901,
718,
18793,
29915,
30004,
13,
4706,
1596,
29898,
6519,
8443,
13,
4706,
1014,
5014,
29889,
4804,
29898,
6519,
29892,
6473,
29922,
5574,
29897,
6756,
13,
4706,
6756,
13,
4706,
6756,
13,
1678,
396,
15154,
13201,
2066,
6756,
13,
1678,
528,
4422,
29889,
1758,
8336,
29898,
22899,
29918,
3972,
8443,
13,
1678,
6756,
13,
1678,
1596,
877,
29928,
12413,
315,
1525,
1299,
4214,
341,
3301,
29991,
1495,
30004,
13,
30004,
13,
2
] |
threadingHelpers.py | Mimieam/NMouse | 0 | 71914 | from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
import traceback, sys
import logging
# Make this threadsafe
class QtHandler(logging.Handler):
def __init__(self, output_widget: QTextEdit):
logging.Handler.__init__(self)
self.widget: QTextEdit = output_widget
self.widget.setReadOnly(True)
def emit(self, record):
try:
msg = self.format(record)
print(f"emiting: {msg}")
self.widget.appendPlainText(msg)
except:
print("something bad happened")
def setup_logs(logger, output_widget=None):
# to Gui
qtLogHandler = QtHandler(output_widget)
qtLogHandler.setFormatter(logging.Formatter("%(levelname)s: %(message)s"))
logger.addHandler(qtLogHandler)
logger = logging.getLogger(__name__)
# to console
syslog = logging.StreamHandler()
formatter = logging.Formatter('[%(asctime)s.%(msecs)03d %(threadName)10s] -- %(funcName)20s() -> %(levelname)5s: %(message)s',"%H:%M:%S")
syslog.setFormatter(formatter)
logger.addHandler(syslog)
logger.setLevel(logging.DEBUG)
# thanks https://www.learnpyqt.com/courses/concurrent-execution/multithreading-pyqt-applications-qthreadpool/
class WorkerSignals(QObject):
'''
Defines the signals available from a running worker thread.
Supported signals are:
finished
No data
error
`tuple` (exctype, value, traceback.format_exc() )
result
`object` data returned from processing, anything
progress
`int` indicating % progress
'''
finished = pyqtSignal()
error = pyqtSignal(tuple)
result = pyqtSignal(object)
progress = pyqtSignal(int)
class Worker(QRunnable):
'''
Worker thread
Inherits from QRunnable to handler worker thread setup, signals and wrap-up.
:param callback: The function callback to run on this worker thread. Supplied args and
kwargs will be passed through to the runner.
:type callback: function
:param args: Arguments to pass to the callback function
:param kwargs: Keywords to pass to the callback function
'''
def __init__(self, fn, *args, **kwargs):
super(Worker, self).__init__()
# Store constructor arguments (re-used for processing)
self.fn = fn
self.args = args
self.kwargs = kwargs
self.signals = WorkerSignals()
# Add the callback to our kwargs
# self.kwargs['progress_callback'] = self.signals.progress
@pyqtSlot()
def run(self):
'''
Initialise the runner function with passed args, kwargs.
'''
# Retrieve args/kwargs here; and fire processing using them
try:
print(self.fn, self.args, self.kwargs)
result = self.fn(*self.args, **self.kwargs)
except:
traceback.print_exc()
exctype, value = sys.exc_info()[:2]
self.signals.error.emit((exctype, value, traceback.format_exc()))
else:
self.signals.result.emit(result) # Return the result of the processing
finally:
self.signals.finished.emit() # Done
| [
1,
515,
10772,
17303,
29945,
29889,
17303,
28707,
1053,
334,
13,
3166,
10772,
17303,
29945,
29889,
17303,
8801,
29879,
1053,
334,
13,
3166,
10772,
17303,
29945,
29889,
17303,
9203,
1053,
334,
13,
13,
5215,
9637,
1627,
29892,
10876,
13,
5215,
12183,
13,
13,
13,
29937,
8561,
445,
3244,
11177,
13,
1990,
14705,
4598,
29898,
21027,
29889,
4598,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1962,
29918,
8030,
29901,
660,
1626,
6103,
1125,
13,
4706,
12183,
29889,
4598,
17255,
2344,
12035,
1311,
29897,
13,
4706,
1583,
29889,
8030,
29901,
660,
1626,
6103,
353,
1962,
29918,
8030,
13,
4706,
1583,
29889,
8030,
29889,
842,
6359,
11730,
29898,
5574,
29897,
259,
13,
13,
1678,
822,
20076,
29898,
1311,
29892,
2407,
1125,
13,
4706,
1018,
29901,
13,
9651,
10191,
353,
1583,
29889,
4830,
29898,
11651,
29897,
13,
9651,
1596,
29898,
29888,
29908,
331,
11407,
29901,
426,
7645,
27195,
13,
9651,
1583,
29889,
8030,
29889,
4397,
29925,
7420,
1626,
29898,
7645,
29897,
13,
13,
4706,
5174,
29901,
13,
9651,
1596,
703,
14481,
4319,
9559,
1159,
13,
13,
1753,
6230,
29918,
20756,
29898,
21707,
29892,
1962,
29918,
8030,
29922,
8516,
1125,
13,
1678,
396,
304,
402,
1481,
13,
1678,
3855,
29873,
3403,
4598,
353,
14705,
4598,
29898,
4905,
29918,
8030,
29897,
13,
1678,
3855,
29873,
3403,
4598,
29889,
842,
18522,
29898,
21027,
29889,
18522,
11702,
29898,
5563,
978,
29897,
29879,
29901,
1273,
29898,
4906,
29897,
29879,
5783,
13,
1678,
17927,
29889,
1202,
4598,
29898,
17915,
3403,
4598,
29897,
13,
13,
21707,
353,
12183,
29889,
657,
16363,
22168,
978,
1649,
29897,
13,
29937,
304,
2991,
13,
9675,
1188,
353,
12183,
29889,
3835,
4598,
580,
13,
689,
2620,
353,
12183,
29889,
18522,
877,
29961,
29995,
29898,
294,
312,
603,
29897,
29879,
29889,
29995,
29898,
29885,
344,
2395,
29897,
29900,
29941,
29881,
1273,
29898,
7097,
1170,
29897,
29896,
29900,
29879,
29962,
1192,
1273,
29898,
9891,
1170,
29897,
29906,
29900,
29879,
580,
1599,
1273,
29898,
5563,
978,
29897,
29945,
29879,
29901,
1273,
29898,
4906,
29897,
29879,
742,
29908,
29995,
29950,
16664,
29924,
16664,
29903,
1159,
13,
9675,
1188,
29889,
842,
18522,
29898,
689,
2620,
29897,
13,
21707,
29889,
1202,
4598,
29898,
9675,
1188,
29897,
13,
13,
21707,
29889,
842,
10108,
29898,
21027,
29889,
18525,
29897,
13,
13,
13,
13,
29937,
3969,
2045,
597,
1636,
29889,
19668,
2272,
17915,
29889,
510,
29914,
29883,
29781,
29914,
19279,
29899,
22256,
29914,
4713,
389,
19715,
29899,
2272,
17915,
29899,
932,
5795,
29899,
29939,
7097,
10109,
29914,
13,
1990,
5244,
261,
10140,
1338,
29898,
29984,
2061,
1125,
13,
1678,
14550,
13,
1678,
5282,
1475,
278,
18470,
3625,
515,
263,
2734,
15645,
3244,
29889,
13,
13,
1678,
18601,
287,
18470,
526,
29901,
13,
13,
1678,
7743,
13,
4706,
1939,
848,
13,
268,
13,
1678,
1059,
13,
4706,
421,
23583,
29952,
313,
735,
312,
668,
29892,
995,
29892,
9637,
1627,
29889,
4830,
29918,
735,
29883,
580,
1723,
13,
268,
13,
1678,
1121,
13,
4706,
421,
3318,
29952,
848,
4133,
515,
9068,
29892,
3099,
13,
13,
1678,
6728,
13,
4706,
421,
524,
29952,
23941,
1273,
6728,
29871,
13,
13,
1678,
14550,
13,
1678,
7743,
353,
11451,
17915,
10140,
284,
580,
13,
1678,
1059,
353,
11451,
17915,
10140,
284,
29898,
23583,
29897,
13,
1678,
1121,
353,
11451,
17915,
10140,
284,
29898,
3318,
29897,
13,
1678,
6728,
353,
11451,
17915,
10140,
284,
29898,
524,
29897,
13,
13,
13,
1990,
5244,
261,
29898,
29984,
29934,
21725,
1125,
13,
1678,
14550,
13,
1678,
5244,
261,
3244,
13,
13,
1678,
512,
2276,
1169,
515,
660,
29934,
21725,
304,
7834,
15645,
3244,
6230,
29892,
18470,
322,
12244,
29899,
786,
29889,
13,
13,
1678,
584,
3207,
6939,
29901,
450,
740,
6939,
304,
1065,
373,
445,
15645,
3244,
29889,
9179,
2957,
6389,
322,
29871,
13,
462,
268,
9049,
5085,
674,
367,
4502,
1549,
304,
278,
28877,
29889,
13,
1678,
584,
1853,
6939,
29901,
740,
13,
1678,
584,
3207,
6389,
29901,
11842,
9331,
304,
1209,
304,
278,
6939,
740,
13,
1678,
584,
3207,
9049,
5085,
29901,
7670,
9303,
304,
1209,
304,
278,
6939,
740,
13,
13,
1678,
14550,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
7876,
29892,
334,
5085,
29892,
3579,
19290,
1125,
13,
4706,
2428,
29898,
16164,
29892,
1583,
467,
1649,
2344,
1649,
580,
13,
13,
4706,
396,
14491,
5823,
6273,
313,
276,
29899,
3880,
363,
9068,
29897,
13,
4706,
1583,
29889,
9144,
353,
7876,
13,
4706,
1583,
29889,
5085,
353,
6389,
13,
4706,
1583,
29889,
19290,
353,
9049,
5085,
13,
4706,
1583,
29889,
4530,
1338,
353,
5244,
261,
10140,
1338,
580,
13,
4706,
396,
3462,
278,
6939,
304,
1749,
9049,
5085,
13,
4706,
396,
1583,
29889,
19290,
1839,
18035,
29918,
14035,
2033,
353,
1583,
29889,
4530,
1338,
29889,
18035,
308,
13,
13,
1678,
732,
2272,
17915,
29903,
8276,
580,
13,
1678,
822,
1065,
29898,
1311,
1125,
13,
4706,
14550,
13,
4706,
17250,
895,
278,
28877,
740,
411,
4502,
6389,
29892,
9049,
5085,
29889,
13,
4706,
14550,
13,
308,
13,
4706,
396,
4649,
29878,
2418,
6389,
29914,
19290,
1244,
29936,
322,
3974,
9068,
773,
963,
13,
4706,
1018,
29901,
13,
9651,
1596,
29898,
1311,
29889,
9144,
29892,
1583,
29889,
5085,
29892,
1583,
29889,
19290,
29897,
13,
9651,
1121,
353,
1583,
29889,
9144,
10456,
1311,
29889,
5085,
29892,
3579,
1311,
29889,
19290,
29897,
13,
4706,
5174,
29901,
13,
9651,
9637,
1627,
29889,
2158,
29918,
735,
29883,
580,
13,
9651,
429,
312,
668,
29892,
995,
353,
10876,
29889,
735,
29883,
29918,
3888,
580,
7503,
29906,
29962,
13,
9651,
1583,
29889,
4530,
1338,
29889,
2704,
29889,
21976,
3552,
735,
312,
668,
29892,
995,
29892,
9637,
1627,
29889,
4830,
29918,
735,
29883,
22130,
13,
4706,
1683,
29901,
13,
9651,
1583,
29889,
4530,
1338,
29889,
2914,
29889,
21976,
29898,
2914,
29897,
29871,
396,
7106,
278,
1121,
310,
278,
9068,
13,
4706,
7146,
29901,
13,
9651,
1583,
29889,
4530,
1338,
29889,
4951,
3276,
29889,
21976,
580,
29871,
396,
25679,
13,
308,
13,
2
] |
dm_control/scripts/print_profile.py | mhauskn/dm_control | 0 | 1601647 | <reponame>mhauskn/dm_control
import sys
import pstats
p = pstats.Stats(sys.argv[1])
p.sort_stats('cumtime').print_stats(50) | [
1,
529,
276,
1112,
420,
29958,
29885,
6208,
3959,
29914,
18933,
29918,
6451,
13,
5215,
10876,
13,
5215,
282,
16202,
13,
13,
29886,
353,
282,
16202,
29889,
25060,
29898,
9675,
29889,
19218,
29961,
29896,
2314,
13,
29886,
29889,
6605,
29918,
16202,
877,
29883,
398,
2230,
2824,
2158,
29918,
16202,
29898,
29945,
29900,
29897,
2
] |
contests_atcoder/arc113/arc113_d_stupid.py | takelifetime/competitive-programming | 0 | 149513 | <filename>contests_atcoder/arc113/arc113_d_stupid.py
from itertools import product
from collections import defaultdict
MOD = 998244353
n, m, k = map(int, input().split())
def stupid(n, m, k):
ret = defaultdict(int)
for content in product(range(1, k + 1), repeat=n * m):
a = []
b = [0] * m
for i in range(n):
for j in range(m):
b[j] = max(b[j], content[i * m + j])
a.append(min(content[i * m:(i + 1) * m]))
ret[tuple(a + b)] = 1
return ret.keys()
ret = stupid(n, m, k)
print(*sorted(ret))
print(len(ret)) | [
1,
529,
9507,
29958,
1285,
9197,
29918,
271,
29883,
6119,
29914,
5666,
29896,
29896,
29941,
29914,
5666,
29896,
29896,
29941,
29918,
29881,
29918,
303,
786,
333,
29889,
2272,
13,
3166,
4256,
8504,
1053,
3234,
13,
3166,
16250,
1053,
2322,
8977,
13,
6720,
29928,
353,
29871,
29929,
29929,
29947,
29906,
29946,
29946,
29941,
29945,
29941,
13,
29876,
29892,
286,
29892,
413,
353,
2910,
29898,
524,
29892,
1881,
2141,
5451,
3101,
13,
13,
1753,
20239,
29898,
29876,
29892,
286,
29892,
413,
1125,
13,
1678,
3240,
353,
2322,
8977,
29898,
524,
29897,
13,
13,
13,
1678,
363,
2793,
297,
3234,
29898,
3881,
29898,
29896,
29892,
413,
718,
29871,
29896,
511,
12312,
29922,
29876,
334,
286,
1125,
13,
4706,
263,
353,
5159,
13,
4706,
289,
353,
518,
29900,
29962,
334,
286,
13,
4706,
363,
474,
297,
3464,
29898,
29876,
1125,
13,
9651,
363,
432,
297,
3464,
29898,
29885,
1125,
13,
18884,
289,
29961,
29926,
29962,
353,
4236,
29898,
29890,
29961,
29926,
1402,
2793,
29961,
29875,
334,
286,
718,
432,
2314,
13,
9651,
263,
29889,
4397,
29898,
1195,
29898,
3051,
29961,
29875,
334,
286,
5919,
29875,
718,
29871,
29896,
29897,
334,
286,
12622,
13,
4706,
3240,
29961,
23583,
29898,
29874,
718,
289,
4638,
353,
29871,
29896,
13,
268,
13,
1678,
736,
3240,
29889,
8149,
580,
13,
13,
13,
2267,
353,
20239,
29898,
29876,
29892,
286,
29892,
413,
29897,
13,
2158,
10456,
24582,
29898,
2267,
876,
13,
2158,
29898,
2435,
29898,
2267,
876,
2
] |
portal/capstone/simulator.py | LDSSA/portal | 2 | 178642 | <reponame>LDSSA/portal<gh_stars>1-10
import json
import logging
import queue
import random
import time
import traceback
from concurrent.futures import ThreadPoolExecutor as PoolExecutor
from datetime import datetime, timezone
import requests
from django.db import transaction, close_old_connections
from django.conf import settings
from portal.capstone import models
logger = logging.getLogger(__name__)
def run():
# Queue
submissions = queue.Queue()
# Start consumer pool
with PoolExecutor(max_workers=50) as executor:
# Start simulator
logger.info("Starting simulator..")
executor.submit(run_simulator)
# Start producer
logger.info("Starting producer...")
executor.submit(run_producer, submissions)
logger.info("Starting consumer...")
while True:
# Consume queue
id_ = submissions.get(block=True)
executor.submit(consume, id_)
def run_simulator():
while True:
logger.debug("Simulator cycle...")
close_old_connections()
try:
with transaction.atomic():
simulators = models.Simulator.objects.select_for_update().all()
for simulator in simulators:
simulator.reset()
simulator.start()
except Exception:
logger.exception("Exception in simulator")
time.sleep(settings.SIMULATOR_INTERVAL)
def run_producer(submissions):
# Prevent thundering herd
time.sleep(2 * random.random())
while True:
logger.debug("Producer cycle...")
close_old_connections()
try:
# Retrieve a block of due datapoints
with transaction.atomic():
# Lock due datapoints
# prevent multiple producers from repeating datapoints
now = datetime.now(timezone.utc)
qs = (
models.DueDatapoint.objects.select_for_update()
.filter(simulator__status="started")
.filter(state="due")
.filter(due__lte=now)
)[: settings.BLOCK_SIZE]
items = []
for due_datapoint in qs:
items.append(due_datapoint.id)
due_datapoint.status = "queued"
due_datapoint.save()
# Queue due datapoints outside lock
if items:
logger.info("Queuing due datapoints")
for item in items:
logger.info("Producing %s", item)
submissions.put(item)
logger.debug("Queue size: %s", submissions.qsize())
except Exception:
logger.exception("Exception in producer")
time.sleep(settings.PRODUCER_INTERVAL)
# TODO mark as due any unconsumed due datapoints
def consume(id_):
close_old_connections()
logger.info("Consuming %s", id_)
try:
with transaction.atomic():
due_datapoint = (
models.DueDatapoint.objects.select_related("datapoint")
.select_for_update()
.get(id=id_)
)
try:
logger.info("Posting %s", id_)
data = json.loads(due_datapoint.datapoint.data)
response = requests.post(
due_datapoint.url, json=data, timeout=settings.TIMEOUT
)
except requests.exceptions.RequestException as exc:
logger.info("Request Exception %s", id_, exc_info=True)
logger.debug(exc.__class__.__name__)
logger.debug(traceback.format_tb(exc.__traceback__))
due_datapoint.state = "fail"
due_datapoint.response_exception = exc.__class__.__name__
due_datapoint.response_traceback = traceback.format_tb(
exc.__traceback__
)
if isinstance(exc, requests.exceptions.Timeout):
due_datapoint.response_timeout = True
due_datapoint.save()
return
try:
response.raise_for_status()
except requests.exceptions.HTTPError as exc:
logger.info("HTTP Exception %s", id_, exc_info=True)
due_datapoint.state = "fail"
due_datapoint.response_exception = exc.__class__.__name__
due_datapoint.response_traceback = traceback.format_tb(
exc.__traceback__
)
due_datapoint.response_status = response.status_code
due_datapoint.response_elapsed = (
response.elapsed.total_seconds()
)
due_datapoint.response_content = response.text
due_datapoint.save()
return
try:
response.json()
content = response.text
except json.JSONDecodeError as exc:
logger.info("Response Exception %s", id_, exc_info=True)
due_datapoint.state = "fail"
due_datapoint.response_exception = exc.__class__.__name__
due_datapoint.response_traceback = traceback.format_tb(
exc.__traceback__
)
due_datapoint.response_status = response.status_code
due_datapoint.response_elapsed = (
response.elapsed.total_seconds()
)
due_datapoint.response_content = response.text
due_datapoint.save()
return
else:
logger.info("Success %s", id_)
due_datapoint.state = "success"
due_datapoint.response_content = content
due_datapoint.response_status = response.status_code
due_datapoint.response_elapsed = (
response.elapsed.total_seconds()
)
due_datapoint.save()
except Exception:
logger.exception("Exception consuming %s", id_)
| [
1,
529,
276,
1112,
420,
29958,
10249,
1799,
29909,
29914,
25089,
29966,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
5215,
4390,
13,
5215,
12183,
13,
5215,
9521,
13,
5215,
4036,
13,
5215,
931,
13,
5215,
9637,
1627,
13,
3166,
21984,
29889,
29888,
329,
1973,
1053,
10480,
11426,
13366,
408,
28625,
13366,
13,
3166,
12865,
1053,
12865,
29892,
29431,
13,
13,
5215,
7274,
13,
3166,
9557,
29889,
2585,
1053,
10804,
29892,
3802,
29918,
1025,
29918,
11958,
1953,
13,
3166,
9557,
29889,
5527,
1053,
6055,
13,
13,
3166,
25792,
29889,
5030,
12734,
1053,
4733,
13,
13,
13,
21707,
353,
12183,
29889,
657,
16363,
22168,
978,
1649,
29897,
13,
13,
13,
1753,
1065,
7295,
13,
1678,
396,
5462,
434,
13,
1678,
11834,
6847,
353,
9521,
29889,
10620,
580,
13,
13,
1678,
396,
7370,
21691,
11565,
13,
1678,
411,
28625,
13366,
29898,
3317,
29918,
1287,
414,
29922,
29945,
29900,
29897,
408,
2279,
3406,
29901,
13,
4706,
396,
7370,
1027,
9183,
13,
4706,
17927,
29889,
3888,
703,
4763,
292,
1027,
9183,
636,
1159,
13,
4706,
2279,
3406,
29889,
7892,
29898,
3389,
29918,
3601,
9183,
29897,
13,
13,
4706,
396,
7370,
14297,
13,
4706,
17927,
29889,
3888,
703,
4763,
292,
14297,
856,
1159,
13,
4706,
2279,
3406,
29889,
7892,
29898,
3389,
29918,
5498,
2265,
29892,
11834,
6847,
29897,
13,
13,
4706,
17927,
29889,
3888,
703,
4763,
292,
21691,
856,
1159,
13,
4706,
1550,
5852,
29901,
13,
9651,
396,
2138,
2017,
9521,
13,
9651,
1178,
29918,
353,
11834,
6847,
29889,
657,
29898,
1271,
29922,
5574,
29897,
13,
9651,
2279,
3406,
29889,
7892,
29898,
3200,
2017,
29892,
1178,
19925,
13,
13,
13,
1753,
1065,
29918,
3601,
9183,
7295,
13,
1678,
1550,
5852,
29901,
13,
4706,
17927,
29889,
8382,
703,
8942,
9183,
11412,
856,
1159,
13,
4706,
3802,
29918,
1025,
29918,
11958,
1953,
580,
13,
13,
4706,
1018,
29901,
13,
9651,
411,
10804,
29889,
21641,
7295,
13,
18884,
1027,
352,
4097,
353,
4733,
29889,
8942,
9183,
29889,
12650,
29889,
2622,
29918,
1454,
29918,
5504,
2141,
497,
580,
13,
18884,
363,
1027,
9183,
297,
1027,
352,
4097,
29901,
13,
462,
1678,
1027,
9183,
29889,
12071,
580,
13,
462,
1678,
1027,
9183,
29889,
2962,
580,
13,
13,
4706,
5174,
8960,
29901,
13,
9651,
17927,
29889,
11739,
703,
2451,
297,
1027,
9183,
1159,
13,
13,
4706,
931,
29889,
17059,
29898,
11027,
29889,
5425,
29924,
13309,
1299,
1955,
29918,
23845,
8932,
29897,
13,
13,
13,
1753,
1065,
29918,
5498,
2265,
29898,
1491,
29885,
6847,
1125,
13,
1678,
396,
4721,
794,
266,
870,
3241,
902,
29881,
13,
1678,
931,
29889,
17059,
29898,
29906,
334,
4036,
29889,
8172,
3101,
13,
13,
1678,
1550,
5852,
29901,
13,
4706,
17927,
29889,
8382,
703,
23665,
2265,
11412,
856,
1159,
13,
4706,
3802,
29918,
1025,
29918,
11958,
1953,
580,
13,
13,
4706,
1018,
29901,
13,
9651,
396,
4649,
29878,
2418,
263,
2908,
310,
2861,
1418,
481,
2461,
29879,
13,
9651,
411,
10804,
29889,
21641,
7295,
13,
18884,
396,
18199,
2861,
1418,
481,
2461,
29879,
13,
18884,
396,
5557,
2999,
1391,
22543,
515,
28769,
1418,
481,
2461,
29879,
13,
18884,
1286,
353,
12865,
29889,
3707,
29898,
2230,
8028,
29889,
329,
29883,
29897,
13,
18884,
3855,
29879,
353,
313,
13,
462,
1678,
4733,
29889,
29928,
434,
16390,
481,
2461,
29889,
12650,
29889,
2622,
29918,
1454,
29918,
5504,
580,
13,
462,
1678,
869,
4572,
29898,
3601,
9183,
1649,
4882,
543,
2962,
287,
1159,
13,
462,
1678,
869,
4572,
29898,
3859,
543,
29123,
1159,
13,
462,
1678,
869,
4572,
29898,
29123,
1649,
29880,
371,
29922,
3707,
29897,
13,
18884,
1723,
7503,
6055,
29889,
29933,
21339,
29918,
14226,
29962,
13,
13,
18884,
4452,
353,
5159,
13,
18884,
363,
2861,
29918,
4130,
481,
2461,
297,
3855,
29879,
29901,
13,
462,
1678,
4452,
29889,
4397,
29898,
29123,
29918,
4130,
481,
2461,
29889,
333,
29897,
13,
462,
1678,
2861,
29918,
4130,
481,
2461,
29889,
4882,
353,
376,
802,
6742,
29908,
13,
462,
1678,
2861,
29918,
4130,
481,
2461,
29889,
7620,
580,
13,
13,
9651,
396,
5462,
434,
2861,
1418,
481,
2461,
29879,
5377,
7714,
13,
9651,
565,
4452,
29901,
13,
18884,
17927,
29889,
3888,
703,
8654,
26420,
2861,
1418,
481,
2461,
29879,
1159,
13,
9651,
363,
2944,
297,
4452,
29901,
13,
18884,
17927,
29889,
3888,
703,
23665,
3277,
1273,
29879,
613,
2944,
29897,
13,
18884,
11834,
6847,
29889,
649,
29898,
667,
29897,
13,
13,
9651,
17927,
29889,
8382,
703,
10620,
2159,
29901,
1273,
29879,
613,
11834,
6847,
29889,
29939,
2311,
3101,
13,
13,
4706,
5174,
8960,
29901,
13,
9651,
17927,
29889,
11739,
703,
2451,
297,
14297,
1159,
13,
13,
4706,
931,
29889,
17059,
29898,
11027,
29889,
8618,
14849,
29907,
1001,
29918,
23845,
8932,
29897,
13,
13,
13,
29937,
14402,
2791,
408,
2861,
738,
443,
25978,
287,
2861,
1418,
481,
2461,
29879,
13,
1753,
29151,
29898,
333,
29918,
1125,
13,
1678,
3802,
29918,
1025,
29918,
11958,
1953,
580,
13,
1678,
17927,
29889,
3888,
703,
13696,
9929,
1273,
29879,
613,
1178,
19925,
13,
13,
1678,
1018,
29901,
13,
4706,
411,
10804,
29889,
21641,
7295,
13,
9651,
2861,
29918,
4130,
481,
2461,
353,
313,
13,
18884,
4733,
29889,
29928,
434,
16390,
481,
2461,
29889,
12650,
29889,
2622,
29918,
12817,
703,
4130,
481,
2461,
1159,
13,
18884,
869,
2622,
29918,
1454,
29918,
5504,
580,
13,
18884,
869,
657,
29898,
333,
29922,
333,
19925,
13,
9651,
1723,
13,
13,
9651,
1018,
29901,
13,
18884,
17927,
29889,
3888,
703,
6747,
292,
1273,
29879,
613,
1178,
19925,
13,
18884,
848,
353,
4390,
29889,
18132,
29898,
29123,
29918,
4130,
481,
2461,
29889,
4130,
481,
2461,
29889,
1272,
29897,
13,
18884,
2933,
353,
7274,
29889,
2490,
29898,
13,
462,
1678,
2861,
29918,
4130,
481,
2461,
29889,
2271,
29892,
4390,
29922,
1272,
29892,
11815,
29922,
11027,
29889,
15307,
12015,
13,
18884,
1723,
13,
13,
9651,
5174,
7274,
29889,
11739,
29879,
29889,
3089,
2451,
408,
5566,
29901,
13,
18884,
17927,
29889,
3888,
703,
3089,
8960,
1273,
29879,
613,
1178,
3383,
5566,
29918,
3888,
29922,
5574,
29897,
13,
18884,
17927,
29889,
8382,
29898,
735,
29883,
17255,
1990,
1649,
17255,
978,
1649,
29897,
13,
18884,
17927,
29889,
8382,
29898,
15003,
1627,
29889,
4830,
29918,
22625,
29898,
735,
29883,
17255,
15003,
1627,
1649,
876,
13,
13,
18884,
2861,
29918,
4130,
481,
2461,
29889,
3859,
353,
376,
14057,
29908,
13,
18884,
2861,
29918,
4130,
481,
2461,
29889,
5327,
29918,
11739,
353,
5566,
17255,
1990,
1649,
17255,
978,
1649,
13,
18884,
2861,
29918,
4130,
481,
2461,
29889,
5327,
29918,
15003,
1627,
353,
9637,
1627,
29889,
4830,
29918,
22625,
29898,
13,
462,
1678,
5566,
17255,
15003,
1627,
1649,
13,
18884,
1723,
13,
18884,
565,
338,
8758,
29898,
735,
29883,
29892,
7274,
29889,
11739,
29879,
29889,
10851,
1125,
13,
462,
1678,
2861,
29918,
4130,
481,
2461,
29889,
5327,
29918,
15619,
353,
5852,
13,
18884,
2861,
29918,
4130,
481,
2461,
29889,
7620,
580,
13,
18884,
736,
13,
13,
9651,
1018,
29901,
13,
18884,
2933,
29889,
22692,
29918,
1454,
29918,
4882,
580,
13,
13,
9651,
5174,
7274,
29889,
11739,
29879,
29889,
10493,
2392,
408,
5566,
29901,
13,
18884,
17927,
29889,
3888,
703,
10493,
8960,
1273,
29879,
613,
1178,
3383,
5566,
29918,
3888,
29922,
5574,
29897,
13,
18884,
2861,
29918,
4130,
481,
2461,
29889,
3859,
353,
376,
14057,
29908,
13,
18884,
2861,
29918,
4130,
481,
2461,
29889,
5327,
29918,
11739,
353,
5566,
17255,
1990,
1649,
17255,
978,
1649,
13,
18884,
2861,
29918,
4130,
481,
2461,
29889,
5327,
29918,
15003,
1627,
353,
9637,
1627,
29889,
4830,
29918,
22625,
29898,
13,
462,
1678,
5566,
17255,
15003,
1627,
1649,
13,
18884,
1723,
13,
18884,
2861,
29918,
4130,
481,
2461,
29889,
5327,
29918,
4882,
353,
2933,
29889,
4882,
29918,
401,
13,
18884,
2861,
29918,
4130,
481,
2461,
29889,
5327,
29918,
295,
28170,
353,
313,
13,
462,
1678,
2933,
29889,
295,
28170,
29889,
7827,
29918,
23128,
580,
13,
18884,
1723,
13,
18884,
2861,
29918,
4130,
481,
2461,
29889,
5327,
29918,
3051,
353,
2933,
29889,
726,
13,
18884,
2861,
29918,
4130,
481,
2461,
29889,
7620,
580,
13,
18884,
736,
13,
13,
9651,
1018,
29901,
13,
18884,
2933,
29889,
3126,
580,
13,
18884,
2793,
353,
2933,
29889,
726,
13,
13,
9651,
5174,
4390,
29889,
7249,
2772,
401,
2392,
408,
5566,
29901,
13,
18884,
17927,
29889,
3888,
703,
5103,
8960,
1273,
29879,
613,
1178,
3383,
5566,
29918,
3888,
29922,
5574,
29897,
13,
13,
18884,
2861,
29918,
4130,
481,
2461,
29889,
3859,
353,
376,
14057,
29908,
13,
18884,
2861,
29918,
4130,
481,
2461,
29889,
5327,
29918,
11739,
353,
5566,
17255,
1990,
1649,
17255,
978,
1649,
13,
18884,
2861,
29918,
4130,
481,
2461,
29889,
5327,
29918,
15003,
1627,
353,
9637,
1627,
29889,
4830,
29918,
22625,
29898,
13,
462,
1678,
5566,
17255,
15003,
1627,
1649,
13,
18884,
1723,
13,
18884,
2861,
29918,
4130,
481,
2461,
29889,
5327,
29918,
4882,
353,
2933,
29889,
4882,
29918,
401,
13,
18884,
2861,
29918,
4130,
481,
2461,
29889,
5327,
29918,
295,
28170,
353,
313,
13,
462,
1678,
2933,
29889,
295,
28170,
29889,
7827,
29918,
23128,
580,
13,
18884,
1723,
13,
18884,
2861,
29918,
4130,
481,
2461,
29889,
5327,
29918,
3051,
353,
2933,
29889,
726,
13,
18884,
2861,
29918,
4130,
481,
2461,
29889,
7620,
580,
13,
18884,
736,
13,
13,
9651,
1683,
29901,
13,
18884,
17927,
29889,
3888,
703,
14191,
1273,
29879,
613,
1178,
19925,
13,
18884,
2861,
29918,
4130,
481,
2461,
29889,
3859,
353,
376,
8698,
29908,
13,
18884,
2861,
29918,
4130,
481,
2461,
29889,
5327,
29918,
3051,
353,
2793,
13,
18884,
2861,
29918,
4130,
481,
2461,
29889,
5327,
29918,
4882,
353,
2933,
29889,
4882,
29918,
401,
13,
18884,
2861,
29918,
4130,
481,
2461,
29889,
5327,
29918,
295,
28170,
353,
313,
13,
462,
1678,
2933,
29889,
295,
28170,
29889,
7827,
29918,
23128,
580,
13,
18884,
1723,
13,
18884,
2861,
29918,
4130,
481,
2461,
29889,
7620,
580,
13,
13,
1678,
5174,
8960,
29901,
13,
4706,
17927,
29889,
11739,
703,
2451,
1136,
9929,
1273,
29879,
613,
1178,
19925,
13,
2
] |
flink-python/pyflink/examples/datastream/windowing/sliding_time_window.py | rudikershaw/flink | 9 | 146909 | ################################################################################
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
################################################################################
import sys
import argparse
from typing import Iterable
from pyflink.datastream.connectors import FileSink, OutputFileConfig, RollingPolicy
from pyflink.common import Types, WatermarkStrategy, Time, Encoder
from pyflink.common.watermark_strategy import TimestampAssigner
from pyflink.datastream import StreamExecutionEnvironment, ProcessWindowFunction
from pyflink.datastream.window import SlidingEventTimeWindows, TimeWindow
class MyTimestampAssigner(TimestampAssigner):
def extract_timestamp(self, value, record_timestamp) -> int:
return int(value[1])
class CountWindowProcessFunction(ProcessWindowFunction[tuple, tuple, str, TimeWindow]):
def process(self,
key: str,
context: ProcessWindowFunction.Context[TimeWindow],
elements: Iterable[tuple]) -> Iterable[tuple]:
return [(key, context.window().start, context.window().end, len([e for e in elements]))]
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument(
'--output',
dest='output',
required=False,
help='Output file to write results to.')
argv = sys.argv[1:]
known_args, _ = parser.parse_known_args(argv)
output_path = known_args.output
env = StreamExecutionEnvironment.get_execution_environment()
# write all the data to one file
env.set_parallelism(1)
# define the source
data_stream = env.from_collection([
('hi', 1), ('hi', 2), ('hi', 3), ('hi', 4), ('hi', 5), ('hi', 8), ('hi', 9), ('hi', 15)],
type_info=Types.TUPLE([Types.STRING(), Types.INT()]))
# define the watermark strategy
watermark_strategy = WatermarkStrategy.for_monotonous_timestamps() \
.with_timestamp_assigner(MyTimestampAssigner())
ds = data_stream.assign_timestamps_and_watermarks(watermark_strategy) \
.key_by(lambda x: x[0], key_type=Types.STRING()) \
.window(SlidingEventTimeWindows.of(Time.milliseconds(5), Time.milliseconds(2))) \
.process(CountWindowProcessFunction(),
Types.TUPLE([Types.STRING(), Types.INT(), Types.INT(), Types.INT()]))
# define the sink
if output_path is not None:
ds.sink_to(
sink=FileSink.for_row_format(
base_path=output_path,
encoder=Encoder.simple_string_encoder())
.with_output_file_config(
OutputFileConfig.builder()
.with_part_prefix("prefix")
.with_part_suffix(".ext")
.build())
.with_rolling_policy(RollingPolicy.default_rolling_policy())
.build()
)
else:
print("Printing result to stdout. Use --output to specify output path.")
ds.print()
# submit for execution
env.execute()
| [
1,
835,
13383,
13383,
13383,
13383,
7346,
4136,
29937,
13,
29937,
29871,
10413,
21144,
304,
278,
13380,
18540,
10606,
313,
3289,
29943,
29897,
1090,
697,
13,
29937,
29871,
470,
901,
17737,
3406,
19405,
8571,
4110,
29889,
29871,
2823,
278,
6058,
12107,
934,
13,
29937,
29871,
13235,
411,
445,
664,
363,
5684,
2472,
13,
29937,
29871,
11211,
3509,
1266,
27428,
29889,
29871,
450,
3339,
29943,
7794,
11259,
445,
934,
13,
29937,
29871,
304,
366,
1090,
278,
13380,
19245,
29892,
10079,
29871,
29906,
29889,
29900,
313,
1552,
13,
29937,
29871,
376,
29931,
293,
1947,
1496,
366,
1122,
451,
671,
445,
934,
5174,
297,
752,
13036,
13,
29937,
29871,
411,
278,
19245,
29889,
29871,
887,
1122,
4017,
263,
3509,
310,
278,
19245,
472,
13,
29937,
13,
29937,
418,
1732,
597,
1636,
29889,
4288,
29889,
990,
29914,
506,
11259,
29914,
27888,
1430,
1660,
29899,
29906,
29889,
29900,
13,
29937,
13,
29937,
29871,
25870,
3734,
491,
22903,
4307,
470,
15502,
304,
297,
5007,
29892,
7047,
13,
29937,
29871,
13235,
1090,
278,
19245,
338,
13235,
373,
385,
376,
3289,
8519,
29908,
350,
3289,
3235,
29892,
13,
29937,
29871,
399,
1806,
8187,
2692,
399,
1718,
29934,
13566,
29059,
6323,
8707,
29928,
22122,
29903,
8079,
13764,
29979,
476,
22255,
29892,
2845,
4653,
470,
2411,
2957,
29889,
13,
29937,
29871,
2823,
278,
19245,
363,
278,
2702,
4086,
14765,
1076,
11239,
322,
13,
29937,
27028,
1090,
278,
19245,
29889,
13,
13383,
13383,
13383,
13383,
13383,
13,
5215,
10876,
13,
13,
5215,
1852,
5510,
13,
3166,
19229,
1053,
20504,
519,
13,
13,
3166,
11451,
1579,
682,
29889,
4130,
579,
1633,
29889,
6915,
943,
1053,
3497,
29903,
682,
29892,
10604,
2283,
3991,
29892,
8731,
1847,
15644,
13,
13,
3166,
11451,
1579,
682,
29889,
9435,
1053,
28025,
29892,
14269,
837,
935,
26910,
29892,
5974,
29892,
11346,
6119,
13,
3166,
11451,
1579,
682,
29889,
9435,
29889,
29893,
271,
837,
935,
29918,
710,
8963,
1053,
7870,
7416,
7900,
21216,
13,
3166,
11451,
1579,
682,
29889,
4130,
579,
1633,
1053,
13763,
20418,
18649,
29892,
10554,
5907,
6678,
13,
3166,
11451,
1579,
682,
29889,
4130,
579,
1633,
29889,
7165,
1053,
14866,
4821,
2624,
2481,
7685,
29892,
5974,
5907,
13,
13,
13,
1990,
1619,
27939,
7900,
21216,
29898,
27939,
7900,
21216,
1125,
13,
1678,
822,
6597,
29918,
16394,
29898,
1311,
29892,
995,
29892,
2407,
29918,
16394,
29897,
1599,
938,
29901,
13,
4706,
736,
938,
29898,
1767,
29961,
29896,
2314,
13,
13,
13,
1990,
3917,
5907,
7032,
6678,
29898,
7032,
5907,
6678,
29961,
23583,
29892,
18761,
29892,
851,
29892,
5974,
5907,
29962,
1125,
13,
1678,
822,
1889,
29898,
1311,
29892,
13,
18884,
1820,
29901,
851,
29892,
13,
18884,
3030,
29901,
10554,
5907,
6678,
29889,
2677,
29961,
2481,
5907,
1402,
13,
18884,
3161,
29901,
20504,
519,
29961,
23583,
2314,
1599,
20504,
519,
29961,
23583,
5387,
13,
4706,
736,
17288,
1989,
29892,
3030,
29889,
7165,
2141,
2962,
29892,
3030,
29889,
7165,
2141,
355,
29892,
7431,
4197,
29872,
363,
321,
297,
3161,
12622,
29962,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
13812,
353,
1852,
5510,
29889,
15730,
11726,
580,
13,
1678,
13812,
29889,
1202,
29918,
23516,
29898,
13,
4706,
525,
489,
4905,
742,
13,
4706,
2731,
2433,
4905,
742,
13,
4706,
3734,
29922,
8824,
29892,
13,
4706,
1371,
2433,
6466,
934,
304,
2436,
2582,
304,
29889,
1495,
13,
13,
1678,
1852,
29894,
353,
10876,
29889,
19218,
29961,
29896,
17531,
13,
1678,
2998,
29918,
5085,
29892,
903,
353,
13812,
29889,
5510,
29918,
5203,
29918,
5085,
29898,
19218,
29897,
13,
1678,
1962,
29918,
2084,
353,
2998,
29918,
5085,
29889,
4905,
13,
13,
1678,
8829,
353,
13763,
20418,
18649,
29889,
657,
29918,
22256,
29918,
20944,
580,
13,
1678,
396,
2436,
599,
278,
848,
304,
697,
934,
13,
1678,
8829,
29889,
842,
29918,
23482,
1608,
29898,
29896,
29897,
13,
13,
1678,
396,
4529,
278,
2752,
13,
1678,
848,
29918,
5461,
353,
8829,
29889,
3166,
29918,
10855,
4197,
13,
4706,
6702,
2918,
742,
29871,
29896,
511,
6702,
2918,
742,
29871,
29906,
511,
6702,
2918,
742,
29871,
29941,
511,
6702,
2918,
742,
29871,
29946,
511,
6702,
2918,
742,
29871,
29945,
511,
6702,
2918,
742,
29871,
29947,
511,
6702,
2918,
742,
29871,
29929,
511,
6702,
2918,
742,
29871,
29896,
29945,
29897,
1402,
13,
4706,
1134,
29918,
3888,
29922,
10562,
29889,
29911,
4897,
1307,
4197,
10562,
29889,
20785,
3285,
28025,
29889,
10192,
580,
12622,
13,
13,
1678,
396,
4529,
278,
16699,
837,
935,
13705,
13,
1678,
16699,
837,
935,
29918,
710,
8963,
353,
14269,
837,
935,
26910,
29889,
1454,
29918,
3712,
327,
265,
681,
29918,
9346,
342,
15092,
580,
320,
13,
4706,
869,
2541,
29918,
16394,
29918,
16645,
261,
29898,
3421,
27939,
7900,
21216,
3101,
13,
13,
1678,
18031,
353,
848,
29918,
5461,
29889,
16645,
29918,
9346,
342,
15092,
29918,
392,
29918,
29893,
271,
837,
17862,
29898,
29893,
271,
837,
935,
29918,
710,
8963,
29897,
320,
13,
4706,
869,
1989,
29918,
1609,
29898,
2892,
921,
29901,
921,
29961,
29900,
1402,
1820,
29918,
1853,
29922,
10562,
29889,
20785,
3101,
320,
13,
4706,
869,
7165,
29898,
16973,
4821,
2624,
2481,
7685,
29889,
974,
29898,
2481,
29889,
19958,
21462,
29898,
29945,
511,
5974,
29889,
19958,
21462,
29898,
29906,
4961,
320,
13,
4706,
869,
5014,
29898,
3981,
5907,
7032,
6678,
3285,
13,
462,
28025,
29889,
29911,
4897,
1307,
4197,
10562,
29889,
20785,
3285,
28025,
29889,
10192,
3285,
28025,
29889,
10192,
3285,
28025,
29889,
10192,
580,
12622,
13,
13,
1678,
396,
4529,
278,
28169,
13,
1678,
565,
1962,
29918,
2084,
338,
451,
6213,
29901,
13,
4706,
18031,
29889,
29879,
682,
29918,
517,
29898,
13,
9651,
28169,
29922,
2283,
29903,
682,
29889,
1454,
29918,
798,
29918,
4830,
29898,
13,
18884,
2967,
29918,
2084,
29922,
4905,
29918,
2084,
29892,
13,
18884,
2094,
6119,
29922,
8566,
6119,
29889,
12857,
29918,
1807,
29918,
3977,
6119,
3101,
13,
9651,
869,
2541,
29918,
4905,
29918,
1445,
29918,
2917,
29898,
13,
18884,
10604,
2283,
3991,
29889,
16409,
580,
13,
18884,
869,
2541,
29918,
1595,
29918,
13506,
703,
13506,
1159,
13,
18884,
869,
2541,
29918,
1595,
29918,
2146,
600,
861,
17350,
1062,
1159,
13,
18884,
869,
4282,
3101,
13,
9651,
869,
2541,
29918,
22155,
29918,
22197,
29898,
29934,
324,
1847,
15644,
29889,
4381,
29918,
22155,
29918,
22197,
3101,
13,
9651,
869,
4282,
580,
13,
4706,
1723,
13,
1678,
1683,
29901,
13,
4706,
1596,
703,
11816,
292,
1121,
304,
27591,
29889,
4803,
1192,
4905,
304,
6084,
1962,
2224,
23157,
13,
4706,
18031,
29889,
2158,
580,
13,
13,
1678,
396,
9752,
363,
8225,
13,
1678,
8829,
29889,
7978,
580,
13,
2
] |
src/preprocessing/compute_moments.py | thomasjo/nemo-redux | 0 | 102371 | from argparse import ArgumentParser
from pathlib import Path
import torch
from nemo.datasets import classification_dataloaders, detection_dataloaders
from nemo.utils import ensure_reproducibility
DATASET_TYPES = [
"classification",
"detection",
]
class RunningAverage:
def __init__(self, num_channels=3):
self.num_channels = 3
self.average = torch.zeros(num_channels)
self.num_samples = 0
def update(self, values):
batch_size, num_channels = values.size()
if num_channels != self.num_channels:
raise RuntimeError("num_channels mismatch")
updated_num_samples = self.num_samples + batch_size
correction_factor = self.num_samples / updated_num_samples
updated_average = self.average * correction_factor
updated_average += torch.sum(values, dim=0) / updated_num_samples
self.average = updated_average
self.num_samples = updated_num_samples
def tolist(self):
return self.average.detach().tolist()
def __str__(self):
return "[" + ", ".join([f"{value:.3f}" for value in self.tolist()]) + "]"
def main(args):
ensure_reproducibility(seed=42)
if args.type == DATASET_TYPES[0]:
train_loader, _, _ = classification_dataloaders(
args.data_dir,
no_augmentation=True,
num_workers=args.num_workers,
)
elif args.type == DATASET_TYPES[1]:
train_loader, _, _ = detection_dataloaders(
args.data_dir,
no_augmentation=True,
num_workers=args.num_workers,
)
running_mean = RunningAverage()
running_std = RunningAverage()
with torch.no_grad():
for batch_idx, (image, _) in enumerate(train_loader):
print("Processing batch {}".format(batch_idx + 1))
if isinstance(image, list):
image = torch.stack(image)
image_flattened = torch.flatten(image, start_dim=2)
mean = torch.mean(image_flattened, dim=2)
running_mean.update(mean)
std = torch.std(image_flattened, dim=2)
running_std.update(std)
print(f"mean={running_mean}, std={running_std}")
def parse_args():
parser = ArgumentParser()
parser.add_argument("--data-dir", type=Path, metavar="PATH", required=True, help="path to partitioned data directory")
parser.add_argument("--type", type=str, metavar="NAME", choices=DATASET_TYPES, default=DATASET_TYPES[0], help="type of dataset to process")
parser.add_argument("--batch-size", type=int, metavar="N", default=2, help="number of examples per batch")
parser.add_argument("--num-workers", type=int, metavar="N", default=2, help="number of workers to use for preparing batches of data")
return parser.parse_args()
if __name__ == "__main__":
args = parse_args()
main(args)
| [
1,
515,
1852,
5510,
1053,
23125,
11726,
13,
3166,
2224,
1982,
1053,
10802,
13,
13,
5215,
4842,
305,
13,
13,
3166,
6583,
29877,
29889,
14538,
1691,
1053,
12965,
29918,
29881,
2075,
29877,
24574,
29892,
15326,
29918,
29881,
2075,
29877,
24574,
13,
3166,
6583,
29877,
29889,
13239,
1053,
9801,
29918,
276,
5498,
455,
29890,
1793,
13,
13,
25832,
8127,
29911,
29918,
15631,
29925,
2890,
353,
518,
13,
1678,
376,
1990,
2450,
613,
13,
1678,
376,
29881,
2650,
428,
613,
13,
29962,
13,
13,
13,
1990,
19509,
29909,
19698,
29901,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
954,
29918,
305,
12629,
29922,
29941,
1125,
13,
4706,
1583,
29889,
1949,
29918,
305,
12629,
353,
29871,
29941,
13,
4706,
1583,
29889,
12483,
482,
353,
4842,
305,
29889,
3298,
359,
29898,
1949,
29918,
305,
12629,
29897,
13,
4706,
1583,
29889,
1949,
29918,
27736,
353,
29871,
29900,
13,
13,
1678,
822,
2767,
29898,
1311,
29892,
1819,
1125,
13,
4706,
9853,
29918,
2311,
29892,
954,
29918,
305,
12629,
353,
1819,
29889,
2311,
580,
13,
13,
4706,
565,
954,
29918,
305,
12629,
2804,
1583,
29889,
1949,
29918,
305,
12629,
29901,
13,
9651,
12020,
24875,
2392,
703,
1949,
29918,
305,
12629,
29635,
1159,
13,
13,
4706,
4784,
29918,
1949,
29918,
27736,
353,
1583,
29889,
1949,
29918,
27736,
718,
9853,
29918,
2311,
13,
4706,
26385,
29918,
19790,
353,
1583,
29889,
1949,
29918,
27736,
847,
4784,
29918,
1949,
29918,
27736,
13,
13,
4706,
4784,
29918,
12483,
482,
353,
1583,
29889,
12483,
482,
334,
26385,
29918,
19790,
13,
4706,
4784,
29918,
12483,
482,
4619,
4842,
305,
29889,
2083,
29898,
5975,
29892,
3964,
29922,
29900,
29897,
847,
4784,
29918,
1949,
29918,
27736,
13,
13,
4706,
1583,
29889,
12483,
482,
353,
4784,
29918,
12483,
482,
13,
4706,
1583,
29889,
1949,
29918,
27736,
353,
4784,
29918,
1949,
29918,
27736,
13,
13,
1678,
822,
304,
1761,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
12483,
482,
29889,
4801,
496,
2141,
25027,
391,
580,
13,
13,
1678,
822,
4770,
710,
12035,
1311,
1125,
13,
4706,
736,
376,
3366,
718,
9162,
11393,
7122,
4197,
29888,
29908,
29912,
1767,
29901,
29889,
29941,
29888,
5038,
363,
995,
297,
1583,
29889,
25027,
391,
580,
2314,
718,
376,
18017,
13,
13,
13,
1753,
1667,
29898,
5085,
1125,
13,
1678,
9801,
29918,
276,
5498,
455,
29890,
1793,
29898,
26776,
29922,
29946,
29906,
29897,
13,
13,
1678,
565,
6389,
29889,
1853,
1275,
27640,
8127,
29911,
29918,
15631,
29925,
2890,
29961,
29900,
5387,
13,
4706,
7945,
29918,
12657,
29892,
17117,
903,
353,
12965,
29918,
29881,
2075,
29877,
24574,
29898,
13,
9651,
6389,
29889,
1272,
29918,
3972,
29892,
13,
9651,
694,
29918,
2987,
358,
362,
29922,
5574,
29892,
13,
9651,
954,
29918,
1287,
414,
29922,
5085,
29889,
1949,
29918,
1287,
414,
29892,
13,
4706,
1723,
13,
1678,
25342,
6389,
29889,
1853,
1275,
27640,
8127,
29911,
29918,
15631,
29925,
2890,
29961,
29896,
5387,
13,
4706,
7945,
29918,
12657,
29892,
17117,
903,
353,
15326,
29918,
29881,
2075,
29877,
24574,
29898,
13,
9651,
6389,
29889,
1272,
29918,
3972,
29892,
13,
9651,
694,
29918,
2987,
358,
362,
29922,
5574,
29892,
13,
9651,
954,
29918,
1287,
414,
29922,
5085,
29889,
1949,
29918,
1287,
414,
29892,
13,
4706,
1723,
13,
13,
1678,
2734,
29918,
12676,
353,
19509,
29909,
19698,
580,
13,
1678,
2734,
29918,
4172,
353,
19509,
29909,
19698,
580,
13,
13,
1678,
411,
4842,
305,
29889,
1217,
29918,
5105,
7295,
13,
4706,
363,
9853,
29918,
13140,
29892,
313,
3027,
29892,
24459,
297,
26985,
29898,
14968,
29918,
12657,
1125,
13,
9651,
1596,
703,
7032,
292,
9853,
6571,
1642,
4830,
29898,
16175,
29918,
13140,
718,
29871,
29896,
876,
13,
13,
9651,
565,
338,
8758,
29898,
3027,
29892,
1051,
1125,
13,
18884,
1967,
353,
4842,
305,
29889,
1429,
29898,
3027,
29897,
13,
9651,
1967,
29918,
1579,
8606,
287,
353,
4842,
305,
29889,
1579,
8606,
29898,
3027,
29892,
1369,
29918,
6229,
29922,
29906,
29897,
13,
13,
9651,
2099,
353,
4842,
305,
29889,
12676,
29898,
3027,
29918,
1579,
8606,
287,
29892,
3964,
29922,
29906,
29897,
13,
9651,
2734,
29918,
12676,
29889,
5504,
29898,
12676,
29897,
13,
13,
9651,
3659,
353,
4842,
305,
29889,
4172,
29898,
3027,
29918,
1579,
8606,
287,
29892,
3964,
29922,
29906,
29897,
13,
9651,
2734,
29918,
4172,
29889,
5504,
29898,
4172,
29897,
13,
13,
1678,
1596,
29898,
29888,
29908,
12676,
3790,
21094,
29918,
12676,
1118,
3659,
3790,
21094,
29918,
4172,
27195,
13,
13,
13,
1753,
6088,
29918,
5085,
7295,
13,
1678,
13812,
353,
23125,
11726,
580,
13,
1678,
13812,
29889,
1202,
29918,
23516,
703,
489,
1272,
29899,
3972,
613,
1134,
29922,
2605,
29892,
1539,
485,
279,
543,
10145,
613,
3734,
29922,
5574,
29892,
1371,
543,
2084,
304,
8877,
287,
848,
3884,
1159,
13,
1678,
13812,
29889,
1202,
29918,
23516,
703,
489,
1853,
613,
1134,
29922,
710,
29892,
1539,
485,
279,
543,
5813,
613,
19995,
29922,
25832,
8127,
29911,
29918,
15631,
29925,
2890,
29892,
2322,
29922,
25832,
8127,
29911,
29918,
15631,
29925,
2890,
29961,
29900,
1402,
1371,
543,
1853,
310,
8783,
304,
1889,
1159,
13,
1678,
13812,
29889,
1202,
29918,
23516,
703,
489,
16175,
29899,
2311,
613,
1134,
29922,
524,
29892,
1539,
485,
279,
543,
29940,
613,
2322,
29922,
29906,
29892,
1371,
543,
4537,
310,
6455,
639,
9853,
1159,
13,
1678,
13812,
29889,
1202,
29918,
23516,
703,
489,
1949,
29899,
1287,
414,
613,
1134,
29922,
524,
29892,
1539,
485,
279,
543,
29940,
613,
2322,
29922,
29906,
29892,
1371,
543,
4537,
310,
17162,
304,
671,
363,
10223,
292,
9853,
267,
310,
848,
1159,
13,
13,
1678,
736,
13812,
29889,
5510,
29918,
5085,
580,
13,
13,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
1678,
6389,
353,
6088,
29918,
5085,
580,
13,
1678,
1667,
29898,
5085,
29897,
13,
2
] |
tests/functional/test_cmd_line_call.py | fevral13/django-migration-linter | 0 | 86542 | # Copyright 2019 3YOURMIND GmbH
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import os
import shutil
import unittest
from subprocess import Popen, PIPE
from django_migration_linter import utils, DEFAULT_CACHE_PATH
from tests import fixtures
import sys
class CallLinterFromCommandLineTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
super(CallLinterFromCommandLineTest, cls).setUpClass()
linter_name = 'django-migration-linter'
cls.linter_exec = '{0}/bin/{1}'.format(sys.prefix, linter_name) if hasattr(sys, 'real_prefix') else linter_name
def test_call_linter_cmd_line_working(self):
cmd = '{0} --no-cache {1}'.format(self.linter_exec, fixtures.CORRECT_PROJECT)
process = Popen(
cmd, shell=True, stdout=PIPE, stderr=PIPE)
process.wait()
self.assertEqual(process.returncode, 0)
lines = list(map(utils.clean_bytes_to_str, process.stdout.readlines()))
self.assertEqual(len(lines), 6)
self.assertEqual(
sorted(lines[:4]),
sorted([
"(test_app1, 0001_initial)... OK",
"(test_app1, 0002_a_new_null_field)... OK",
"(test_app2, 0001_foo)... OK",
"(test_app3, 0001_initial)... OK",
])
)
def test_call_linter_cmd_line_errors(self):
cmd = '{0} --no-cache {1}'.format(
self.linter_exec,
fixtures.ADD_NOT_NULL_COLUMN_PROJECT)
process = Popen(
cmd, shell=True, stdout=PIPE, stderr=PIPE)
process.wait()
self.assertNotEqual(process.returncode, 0)
lines = list(map(utils.clean_bytes_to_str, process.stdout.readlines()))
self.assertEqual(len(lines), 5)
self.assertTrue(lines[0].endswith('OK'))
self.assertTrue(lines[1].endswith('ERR'))
self.assertTrue('RENAMING tables' in lines[2])
def test_call_linter_cmd_line_exclude_apps(self):
cmd = '{0} --no-cache {1} --exclude-apps test_app2'.format(
self.linter_exec,
fixtures.CORRECT_PROJECT)
process = Popen(
cmd, shell=True, stdout=PIPE, stderr=PIPE)
process.wait()
self.assertEqual(process.returncode, 0)
lines = list(map(utils.clean_bytes_to_str, process.stdout.readlines()))
self.assertEqual(len(lines), 6)
self.assertEqual(
sorted(lines[:4]),
sorted([
"(test_app1, 0001_initial)... OK",
"(test_app1, 0002_a_new_null_field)... OK",
"(test_app2, 0001_foo)... IGNORE",
"(test_app3, 0001_initial)... OK",
])
)
def test_call_linter_cmd_line_include_apps(self):
cmd = '{0} --no-cache {1} --include-apps test_app2'.format(
self.linter_exec,
fixtures.CORRECT_PROJECT)
process = Popen(
cmd, shell=True, stdout=PIPE, stderr=PIPE)
process.wait()
self.assertEqual(process.returncode, 0)
lines = list(map(utils.clean_bytes_to_str, process.stdout.readlines()))
self.assertEqual(len(lines), 6)
self.assertEqual(
sorted(lines[:4]),
sorted([
"(test_app1, 0001_initial)... IGNORE",
"(test_app1, 0002_a_new_null_field)... IGNORE",
"(test_app2, 0001_foo)... OK",
"(test_app3, 0001_initial)... IGNORE",
])
)
def test_call_linter_cmd_line_ignore_name(self):
cmd = '{0} --no-cache {1} --ignore-name 0001_initial'.format(
self.linter_exec,
fixtures.CORRECT_PROJECT)
process = Popen(
cmd, shell=True, stdout=PIPE, stderr=PIPE)
process.wait()
self.assertEqual(process.returncode, 0)
lines = list(map(utils.clean_bytes_to_str, process.stdout.readlines()))
self.assertEqual(len(lines), 6)
self.assertEqual(
sorted(lines[:4]),
sorted([
"(test_app1, 0001_initial)... IGNORE",
"(test_app1, 0002_a_new_null_field)... OK",
"(test_app2, 0001_foo)... OK",
"(test_app3, 0001_initial)... IGNORE",
])
)
def test_call_linter_cmd_line_ignore_name_contains(self):
cmd = '{0} --no-cache {1} --ignore-name-contains 0001'.format(
self.linter_exec,
fixtures.CORRECT_PROJECT)
process = Popen(
cmd, shell=True, stdout=PIPE, stderr=PIPE)
process.wait()
self.assertEqual(process.returncode, 0)
lines = list(map(utils.clean_bytes_to_str, process.stdout.readlines()))
self.assertEqual(len(lines), 6)
self.assertEqual(
sorted(lines[:4]),
sorted([
"(test_app1, 0001_initial)... IGNORE",
"(test_app1, 0002_a_new_null_field)... OK",
"(test_app2, 0001_foo)... IGNORE",
"(test_app3, 0001_initial)... IGNORE",
])
)
def test_call_linter_cmd_line_cache(self):
cache_file = os.path.join(DEFAULT_CACHE_PATH, 'test_correct_project.pickle')
if os.path.exists(cache_file):
os.remove(cache_file)
cmd = '{0} {1}'.format(
self.linter_exec,
fixtures.CORRECT_PROJECT
)
process = Popen(
cmd, shell=True, stdout=PIPE, stderr=PIPE)
process.wait()
self.assertTrue(os.path.exists(DEFAULT_CACHE_PATH))
def test_call_linter_cmd_line_cache_path(self):
if os.path.exists('/tmp/migration-linter-cache-tests/'):
shutil.rmtree('/tmp/migration-linter-cache-tests/')
cmd = '{0} {1} --cache-path={2}'.format(
self.linter_exec,
fixtures.CORRECT_PROJECT,
'/tmp/migration-linter-cache-tests/'
)
process = Popen(
cmd, shell=True, stdout=PIPE, stderr=PIPE)
process.wait()
self.assertEqual(process.returncode, 0)
self.assertTrue(os.path.exists('/tmp/migration-linter-cache-tests'))
def test_call_linter_cmd_line_no_cache(self):
cache_file = os.path.join(DEFAULT_CACHE_PATH, 'test_correct_project.pickle')
if os.path.exists(cache_file):
os.remove(cache_file)
cmd = '{0} --no-cache {1}'.format(
self.linter_exec,
fixtures.CORRECT_PROJECT
)
process = Popen(
cmd, shell=True, stdout=PIPE, stderr=PIPE)
process.wait()
self.assertEqual(process.returncode, 0)
self.assertFalse(os.path.exists(cache_file))
def test_call_linter_cmd_line_git_id(self):
cmd = '{0} --no-cache {1} d7125d5f4f0cc9623f670a66c54f131acc50032d'.format(
self.linter_exec,
fixtures.MULTI_COMMIT_PROJECT)
fixtures.prepare_git_project(fixtures.MULTI_COMMIT_PROJECT)
process = Popen(
cmd, shell=True, stdout=PIPE, stderr=PIPE)
process.wait()
self.assertEqual(process.returncode, 0)
lines = list(map(utils.clean_bytes_to_str, process.stdout.readlines()))
self.assertEqual(len(lines), 3)
self.assertTrue(lines[0].endswith('OK'))
self.assertTrue(lines[1].startswith('*** Summary'))
def test_call_linter_with_deleted_migrations(self):
cmd = '{0} --no-cache {1} 154ecf6119325cc3b1f3f5a4e709bfbd61a4a4ba'.format(
self.linter_exec,
fixtures.DELETED_MIGRATION_PROJECT)
fixtures.prepare_git_project(fixtures.DELETED_MIGRATION_PROJECT)
process = Popen(
cmd, shell=True, stdout=PIPE, stderr=PIPE)
process.wait()
self.assertEqual(process.returncode, 0)
lines = list(map(utils.clean_bytes_to_str, process.stdout.readlines()))
self.assertEqual(len(lines), 3)
self.assertTrue(lines[0].endswith('OK'))
self.assertTrue(lines[1].startswith('*** Summary'))
def test_call_from_within_project(self):
cmd = 'cd {0} && {1} --no-cache .'.format(
fixtures.CORRECT_PROJECT,
self.linter_exec)
process = Popen(
cmd, shell=True, stdout=PIPE, stderr=PIPE)
process.wait()
self.assertEqual(process.returncode, 0)
lines = list(map(utils.clean_bytes_to_str, process.stdout.readlines()))
self.assertEqual(len(lines), 6)
self.assertEqual(
sorted(lines[:4]),
sorted([
"(test_app1, 0001_initial)... OK",
"(test_app1, 0002_a_new_null_field)... OK",
"(test_app2, 0001_foo)... OK",
"(test_app3, 0001_initial)... OK",
])
)
def test_call_project_non_git_root(self):
# could use tag: version_ok (but doesn't work in Travis)
cmd = '{0} --no-cache {1} 2c46f438a89972f9ce2d5151a825a5bfb7f7db4b'.format(
self.linter_exec,
fixtures.NON_GIT_ROOT_DJANGO_PROJECT)
fixtures.prepare_git_project(fixtures.NON_GIT_ROOT_GIT_FOLDER)
process = Popen(
cmd, shell=True, stdout=PIPE, stderr=PIPE)
process.wait()
self.assertEqual(process.returncode, 0)
lines = list(map(utils.clean_bytes_to_str, process.stdout.readlines()))
self.assertEqual(len(lines), 3)
self.assertTrue(lines[0].endswith('OK'))
self.assertTrue(lines[1].startswith('*** Summary'))
def test_call_project_non_git_root_ko(self):
# could use tag: version_ko (but doesn't work in Travis)
cmd = '{0} --no-cache {1} 0140e142724fc58944797f9ddc2ebf964146339a'.format(
self.linter_exec,
fixtures.NON_GIT_ROOT_DJANGO_PROJECT)
fixtures.prepare_git_project(fixtures.NON_GIT_ROOT_GIT_FOLDER)
process = Popen(
cmd, shell=True, stdout=PIPE, stderr=PIPE)
process.wait()
self.assertNotEqual(process.returncode, 0)
lines = list(map(utils.clean_bytes_to_str, process.stdout.readlines()))
self.assertEqual(len(lines), 5)
self.assertTrue(lines[0].endswith('ERR'))
self.assertTrue(lines[2].endswith('OK'))
self.assertTrue(lines[3].startswith('*** Summary'))
| [
1,
396,
14187,
1266,
29871,
29906,
29900,
29896,
29929,
29871,
29941,
29979,
22970,
16173,
29928,
18156,
13,
13,
29937,
10413,
21144,
1090,
278,
13380,
19245,
29892,
10079,
29871,
29906,
29889,
29900,
313,
1552,
376,
29931,
293,
1947,
1496,
13,
29937,
366,
1122,
451,
671,
445,
934,
5174,
297,
752,
13036,
411,
278,
19245,
29889,
13,
29937,
887,
1122,
4017,
263,
3509,
310,
278,
19245,
472,
13,
13,
29937,
1732,
597,
1636,
29889,
4288,
29889,
990,
29914,
506,
11259,
29914,
27888,
1430,
1660,
29899,
29906,
29889,
29900,
13,
13,
29937,
25870,
3734,
491,
22903,
4307,
470,
15502,
304,
297,
5007,
29892,
7047,
13,
29937,
13235,
1090,
278,
19245,
338,
13235,
373,
385,
376,
3289,
8519,
29908,
350,
3289,
3235,
29892,
13,
29937,
399,
1806,
8187,
2692,
399,
1718,
29934,
13566,
29059,
6323,
8707,
29928,
22122,
29903,
8079,
13764,
29979,
476,
22255,
29892,
2845,
4653,
470,
2411,
2957,
29889,
13,
29937,
2823,
278,
19245,
363,
278,
2702,
4086,
14765,
1076,
11239,
322,
13,
29937,
27028,
1090,
278,
19245,
29889,
13,
13,
5215,
2897,
13,
5215,
528,
4422,
13,
5215,
443,
27958,
13,
3166,
1014,
5014,
1053,
349,
3150,
29892,
349,
29902,
4162,
13,
3166,
9557,
29918,
29885,
16783,
29918,
29880,
1639,
1053,
3667,
29879,
29892,
22236,
29918,
29907,
2477,
9606,
29918,
10145,
13,
3166,
6987,
1053,
5713,
486,
1973,
13,
5215,
10876,
13,
13,
13,
1990,
8251,
29931,
1639,
4591,
6255,
3542,
3057,
29898,
348,
27958,
29889,
3057,
8259,
1125,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
731,
3373,
2385,
29898,
25932,
1125,
13,
4706,
2428,
29898,
5594,
29931,
1639,
4591,
6255,
3542,
3057,
29892,
1067,
29879,
467,
842,
3373,
2385,
580,
13,
4706,
301,
1639,
29918,
978,
353,
525,
14095,
29899,
29885,
16783,
29899,
29880,
1639,
29915,
13,
4706,
1067,
29879,
29889,
29880,
1639,
29918,
4258,
353,
22372,
29900,
6822,
2109,
19248,
29896,
29913,
4286,
4830,
29898,
9675,
29889,
13506,
29892,
29871,
301,
1639,
29918,
978,
29897,
565,
756,
5552,
29898,
9675,
29892,
525,
6370,
29918,
13506,
1495,
1683,
301,
1639,
29918,
978,
13,
13,
1678,
822,
1243,
29918,
4804,
29918,
29880,
1639,
29918,
9006,
29918,
1220,
29918,
22899,
29898,
1311,
1125,
13,
4706,
9920,
353,
22372,
29900,
29913,
1192,
1217,
29899,
8173,
426,
29896,
29913,
4286,
4830,
29898,
1311,
29889,
29880,
1639,
29918,
4258,
29892,
5713,
486,
1973,
29889,
29907,
1955,
26282,
29918,
8618,
17637,
29897,
13,
13,
4706,
1889,
353,
349,
3150,
29898,
13,
9651,
9920,
29892,
6473,
29922,
5574,
29892,
27591,
29922,
2227,
4162,
29892,
380,
20405,
29922,
2227,
4162,
29897,
13,
4706,
1889,
29889,
10685,
580,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5014,
29889,
2457,
401,
29892,
29871,
29900,
29897,
13,
4706,
3454,
353,
1051,
29898,
1958,
29898,
13239,
29889,
14941,
29918,
13193,
29918,
517,
29918,
710,
29892,
1889,
29889,
25393,
29889,
949,
9012,
22130,
13,
4706,
1583,
29889,
9294,
9843,
29898,
2435,
29898,
9012,
511,
29871,
29953,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
13,
9651,
12705,
29898,
9012,
7503,
29946,
11724,
13,
9651,
12705,
4197,
13,
462,
18227,
1688,
29918,
932,
29896,
29892,
29871,
29900,
29900,
29900,
29896,
29918,
11228,
467,
636,
9280,
613,
13,
462,
18227,
1688,
29918,
932,
29896,
29892,
29871,
29900,
29900,
29900,
29906,
29918,
29874,
29918,
1482,
29918,
4304,
29918,
2671,
467,
636,
9280,
613,
13,
462,
18227,
1688,
29918,
932,
29906,
29892,
29871,
29900,
29900,
29900,
29896,
29918,
5431,
467,
636,
9280,
613,
13,
462,
18227,
1688,
29918,
932,
29941,
29892,
29871,
29900,
29900,
29900,
29896,
29918,
11228,
467,
636,
9280,
613,
13,
795,
2314,
13,
4706,
1723,
13,
13,
1678,
822,
1243,
29918,
4804,
29918,
29880,
1639,
29918,
9006,
29918,
1220,
29918,
12523,
29898,
1311,
1125,
13,
4706,
9920,
353,
22372,
29900,
29913,
1192,
1217,
29899,
8173,
426,
29896,
29913,
4286,
4830,
29898,
13,
9651,
1583,
29889,
29880,
1639,
29918,
4258,
29892,
13,
9651,
5713,
486,
1973,
29889,
17744,
29918,
12256,
29918,
10074,
29918,
15032,
29127,
29918,
8618,
17637,
29897,
13,
13,
4706,
1889,
353,
349,
3150,
29898,
13,
9651,
9920,
29892,
6473,
29922,
5574,
29892,
27591,
29922,
2227,
4162,
29892,
380,
20405,
29922,
2227,
4162,
29897,
13,
4706,
1889,
29889,
10685,
580,
13,
4706,
1583,
29889,
9294,
3664,
9843,
29898,
5014,
29889,
2457,
401,
29892,
29871,
29900,
29897,
13,
4706,
3454,
353,
1051,
29898,
1958,
29898,
13239,
29889,
14941,
29918,
13193,
29918,
517,
29918,
710,
29892,
1889,
29889,
25393,
29889,
949,
9012,
22130,
13,
4706,
1583,
29889,
9294,
9843,
29898,
2435,
29898,
9012,
511,
29871,
29945,
29897,
13,
4706,
1583,
29889,
9294,
5574,
29898,
9012,
29961,
29900,
1822,
1975,
2541,
877,
8949,
8785,
13,
4706,
1583,
29889,
9294,
5574,
29898,
9012,
29961,
29896,
1822,
1975,
2541,
877,
21662,
8785,
13,
4706,
1583,
29889,
9294,
5574,
877,
29934,
1430,
5194,
4214,
6131,
29915,
297,
3454,
29961,
29906,
2314,
13,
13,
1678,
822,
1243,
29918,
4804,
29918,
29880,
1639,
29918,
9006,
29918,
1220,
29918,
735,
2325,
29918,
13371,
29898,
1311,
1125,
13,
4706,
9920,
353,
22372,
29900,
29913,
1192,
1217,
29899,
8173,
426,
29896,
29913,
1192,
735,
2325,
29899,
13371,
1243,
29918,
932,
29906,
4286,
4830,
29898,
13,
9651,
1583,
29889,
29880,
1639,
29918,
4258,
29892,
13,
9651,
5713,
486,
1973,
29889,
29907,
1955,
26282,
29918,
8618,
17637,
29897,
13,
13,
4706,
1889,
353,
349,
3150,
29898,
13,
9651,
9920,
29892,
6473,
29922,
5574,
29892,
27591,
29922,
2227,
4162,
29892,
380,
20405,
29922,
2227,
4162,
29897,
13,
4706,
1889,
29889,
10685,
580,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5014,
29889,
2457,
401,
29892,
29871,
29900,
29897,
13,
4706,
3454,
353,
1051,
29898,
1958,
29898,
13239,
29889,
14941,
29918,
13193,
29918,
517,
29918,
710,
29892,
1889,
29889,
25393,
29889,
949,
9012,
22130,
13,
4706,
1583,
29889,
9294,
9843,
29898,
2435,
29898,
9012,
511,
29871,
29953,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
13,
9651,
12705,
29898,
9012,
7503,
29946,
11724,
13,
9651,
12705,
4197,
13,
462,
18227,
1688,
29918,
932,
29896,
29892,
29871,
29900,
29900,
29900,
29896,
29918,
11228,
467,
636,
9280,
613,
13,
462,
18227,
1688,
29918,
932,
29896,
29892,
29871,
29900,
29900,
29900,
29906,
29918,
29874,
29918,
1482,
29918,
4304,
29918,
2671,
467,
636,
9280,
613,
13,
462,
18227,
1688,
29918,
932,
29906,
29892,
29871,
29900,
29900,
29900,
29896,
29918,
5431,
467,
636,
306,
29954,
6632,
1525,
613,
13,
462,
18227,
1688,
29918,
932,
29941,
29892,
29871,
29900,
29900,
29900,
29896,
29918,
11228,
467,
636,
9280,
613,
13,
795,
2314,
13,
4706,
1723,
13,
13,
1678,
822,
1243,
29918,
4804,
29918,
29880,
1639,
29918,
9006,
29918,
1220,
29918,
2856,
29918,
13371,
29898,
1311,
1125,
13,
4706,
9920,
353,
22372,
29900,
29913,
1192,
1217,
29899,
8173,
426,
29896,
29913,
1192,
2856,
29899,
13371,
1243,
29918,
932,
29906,
4286,
4830,
29898,
13,
9651,
1583,
29889,
29880,
1639,
29918,
4258,
29892,
13,
9651,
5713,
486,
1973,
29889,
29907,
1955,
26282,
29918,
8618,
17637,
29897,
13,
13,
4706,
1889,
353,
349,
3150,
29898,
13,
9651,
9920,
29892,
6473,
29922,
5574,
29892,
27591,
29922,
2227,
4162,
29892,
380,
20405,
29922,
2227,
4162,
29897,
13,
4706,
1889,
29889,
10685,
580,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5014,
29889,
2457,
401,
29892,
29871,
29900,
29897,
13,
4706,
3454,
353,
1051,
29898,
1958,
29898,
13239,
29889,
14941,
29918,
13193,
29918,
517,
29918,
710,
29892,
1889,
29889,
25393,
29889,
949,
9012,
22130,
13,
4706,
1583,
29889,
9294,
9843,
29898,
2435,
29898,
9012,
511,
29871,
29953,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
13,
9651,
12705,
29898,
9012,
7503,
29946,
11724,
13,
9651,
12705,
4197,
13,
462,
18227,
1688,
29918,
932,
29896,
29892,
29871,
29900,
29900,
29900,
29896,
29918,
11228,
467,
636,
306,
29954,
6632,
1525,
613,
13,
462,
18227,
1688,
29918,
932,
29896,
29892,
29871,
29900,
29900,
29900,
29906,
29918,
29874,
29918,
1482,
29918,
4304,
29918,
2671,
467,
636,
306,
29954,
6632,
1525,
613,
13,
462,
18227,
1688,
29918,
932,
29906,
29892,
29871,
29900,
29900,
29900,
29896,
29918,
5431,
467,
636,
9280,
613,
13,
462,
18227,
1688,
29918,
932,
29941,
29892,
29871,
29900,
29900,
29900,
29896,
29918,
11228,
467,
636,
306,
29954,
6632,
1525,
613,
13,
795,
2314,
13,
4706,
1723,
13,
13,
1678,
822,
1243,
29918,
4804,
29918,
29880,
1639,
29918,
9006,
29918,
1220,
29918,
17281,
29918,
978,
29898,
1311,
1125,
13,
4706,
9920,
353,
22372,
29900,
29913,
1192,
1217,
29899,
8173,
426,
29896,
29913,
1192,
17281,
29899,
978,
29871,
29900,
29900,
29900,
29896,
29918,
11228,
4286,
4830,
29898,
13,
9651,
1583,
29889,
29880,
1639,
29918,
4258,
29892,
13,
9651,
5713,
486,
1973,
29889,
29907,
1955,
26282,
29918,
8618,
17637,
29897,
13,
13,
4706,
1889,
353,
349,
3150,
29898,
13,
9651,
9920,
29892,
6473,
29922,
5574,
29892,
27591,
29922,
2227,
4162,
29892,
380,
20405,
29922,
2227,
4162,
29897,
13,
4706,
1889,
29889,
10685,
580,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5014,
29889,
2457,
401,
29892,
29871,
29900,
29897,
13,
4706,
3454,
353,
1051,
29898,
1958,
29898,
13239,
29889,
14941,
29918,
13193,
29918,
517,
29918,
710,
29892,
1889,
29889,
25393,
29889,
949,
9012,
22130,
13,
4706,
1583,
29889,
9294,
9843,
29898,
2435,
29898,
9012,
511,
29871,
29953,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
13,
9651,
12705,
29898,
9012,
7503,
29946,
11724,
13,
9651,
12705,
4197,
13,
462,
18227,
1688,
29918,
932,
29896,
29892,
29871,
29900,
29900,
29900,
29896,
29918,
11228,
467,
636,
306,
29954,
6632,
1525,
613,
13,
462,
18227,
1688,
29918,
932,
29896,
29892,
29871,
29900,
29900,
29900,
29906,
29918,
29874,
29918,
1482,
29918,
4304,
29918,
2671,
467,
636,
9280,
613,
13,
462,
18227,
1688,
29918,
932,
29906,
29892,
29871,
29900,
29900,
29900,
29896,
29918,
5431,
467,
636,
9280,
613,
13,
462,
18227,
1688,
29918,
932,
29941,
29892,
29871,
29900,
29900,
29900,
29896,
29918,
11228,
467,
636,
306,
29954,
6632,
1525,
613,
13,
795,
2314,
13,
4706,
1723,
13,
13,
1678,
822,
1243,
29918,
4804,
29918,
29880,
1639,
29918,
9006,
29918,
1220,
29918,
17281,
29918,
978,
29918,
11516,
29898,
1311,
1125,
13,
4706,
9920,
353,
22372,
29900,
29913,
1192,
1217,
29899,
8173,
426,
29896,
29913,
1192,
17281,
29899,
978,
29899,
11516,
29871,
29900,
29900,
29900,
29896,
4286,
4830,
29898,
13,
9651,
1583,
29889,
29880,
1639,
29918,
4258,
29892,
13,
9651,
5713,
486,
1973,
29889,
29907,
1955,
26282,
29918,
8618,
17637,
29897,
13,
13,
4706,
1889,
353,
349,
3150,
29898,
13,
9651,
9920,
29892,
6473,
29922,
5574,
29892,
27591,
29922,
2227,
4162,
29892,
380,
20405,
29922,
2227,
4162,
29897,
13,
4706,
1889,
29889,
10685,
580,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5014,
29889,
2457,
401,
29892,
29871,
29900,
29897,
13,
4706,
3454,
353,
1051,
29898,
1958,
29898,
13239,
29889,
14941,
29918,
13193,
29918,
517,
29918,
710,
29892,
1889,
29889,
25393,
29889,
949,
9012,
22130,
13,
4706,
1583,
29889,
9294,
9843,
29898,
2435,
29898,
9012,
511,
29871,
29953,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
13,
9651,
12705,
29898,
9012,
7503,
29946,
11724,
13,
9651,
12705,
4197,
13,
462,
18227,
1688,
29918,
932,
29896,
29892,
29871,
29900,
29900,
29900,
29896,
29918,
11228,
467,
636,
306,
29954,
6632,
1525,
613,
13,
462,
18227,
1688,
29918,
932,
29896,
29892,
29871,
29900,
29900,
29900,
29906,
29918,
29874,
29918,
1482,
29918,
4304,
29918,
2671,
467,
636,
9280,
613,
13,
462,
18227,
1688,
29918,
932,
29906,
29892,
29871,
29900,
29900,
29900,
29896,
29918,
5431,
467,
636,
306,
29954,
6632,
1525,
613,
13,
462,
18227,
1688,
29918,
932,
29941,
29892,
29871,
29900,
29900,
29900,
29896,
29918,
11228,
467,
636,
306,
29954,
6632,
1525,
613,
13,
795,
2314,
13,
4706,
1723,
13,
13,
1678,
822,
1243,
29918,
4804,
29918,
29880,
1639,
29918,
9006,
29918,
1220,
29918,
8173,
29898,
1311,
1125,
13,
4706,
7090,
29918,
1445,
353,
2897,
29889,
2084,
29889,
7122,
29898,
23397,
29918,
29907,
2477,
9606,
29918,
10145,
29892,
525,
1688,
29918,
15728,
29918,
4836,
29889,
23945,
280,
1495,
13,
4706,
565,
2897,
29889,
2084,
29889,
9933,
29898,
8173,
29918,
1445,
1125,
13,
9651,
2897,
29889,
5992,
29898,
8173,
29918,
1445,
29897,
13,
4706,
9920,
353,
22372,
29900,
29913,
426,
29896,
29913,
4286,
4830,
29898,
13,
9651,
1583,
29889,
29880,
1639,
29918,
4258,
29892,
13,
9651,
5713,
486,
1973,
29889,
29907,
1955,
26282,
29918,
8618,
17637,
13,
4706,
1723,
13,
13,
4706,
1889,
353,
349,
3150,
29898,
13,
9651,
9920,
29892,
6473,
29922,
5574,
29892,
27591,
29922,
2227,
4162,
29892,
380,
20405,
29922,
2227,
4162,
29897,
13,
4706,
1889,
29889,
10685,
580,
13,
4706,
1583,
29889,
9294,
5574,
29898,
359,
29889,
2084,
29889,
9933,
29898,
23397,
29918,
29907,
2477,
9606,
29918,
10145,
876,
13,
13,
1678,
822,
1243,
29918,
4804,
29918,
29880,
1639,
29918,
9006,
29918,
1220,
29918,
8173,
29918,
2084,
29898,
1311,
1125,
13,
4706,
565,
2897,
29889,
2084,
29889,
9933,
11219,
7050,
29914,
29885,
16783,
29899,
29880,
1639,
29899,
8173,
29899,
21150,
22208,
1125,
13,
9651,
528,
4422,
29889,
1758,
8336,
11219,
7050,
29914,
29885,
16783,
29899,
29880,
1639,
29899,
8173,
29899,
21150,
29914,
1495,
13,
4706,
9920,
353,
22372,
29900,
29913,
426,
29896,
29913,
1192,
8173,
29899,
2084,
3790,
29906,
29913,
4286,
4830,
29898,
13,
9651,
1583,
29889,
29880,
1639,
29918,
4258,
29892,
13,
9651,
5713,
486,
1973,
29889,
29907,
1955,
26282,
29918,
8618,
17637,
29892,
13,
9651,
8207,
7050,
29914,
29885,
16783,
29899,
29880,
1639,
29899,
8173,
29899,
21150,
22208,
13,
4706,
1723,
13,
13,
4706,
1889,
353,
349,
3150,
29898,
13,
9651,
9920,
29892,
6473,
29922,
5574,
29892,
27591,
29922,
2227,
4162,
29892,
380,
20405,
29922,
2227,
4162,
29897,
13,
4706,
1889,
29889,
10685,
580,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5014,
29889,
2457,
401,
29892,
29871,
29900,
29897,
13,
4706,
1583,
29889,
9294,
5574,
29898,
359,
29889,
2084,
29889,
9933,
11219,
7050,
29914,
29885,
16783,
29899,
29880,
1639,
29899,
8173,
29899,
21150,
8785,
13,
13,
1678,
822,
1243,
29918,
4804,
29918,
29880,
1639,
29918,
9006,
29918,
1220,
29918,
1217,
29918,
8173,
29898,
1311,
1125,
13,
4706,
7090,
29918,
1445,
353,
2897,
29889,
2084,
29889,
7122,
29898,
23397,
29918,
29907,
2477,
9606,
29918,
10145,
29892,
525,
1688,
29918,
15728,
29918,
4836,
29889,
23945,
280,
1495,
13,
4706,
565,
2897,
29889,
2084,
29889,
9933,
29898,
8173,
29918,
1445,
1125,
13,
9651,
2897,
29889,
5992,
29898,
8173,
29918,
1445,
29897,
13,
13,
4706,
9920,
353,
22372,
29900,
29913,
1192,
1217,
29899,
8173,
426,
29896,
29913,
4286,
4830,
29898,
13,
9651,
1583,
29889,
29880,
1639,
29918,
4258,
29892,
13,
9651,
5713,
486,
1973,
29889,
29907,
1955,
26282,
29918,
8618,
17637,
13,
4706,
1723,
13,
13,
4706,
1889,
353,
349,
3150,
29898,
13,
9651,
9920,
29892,
6473,
29922,
5574,
29892,
27591,
29922,
2227,
4162,
29892,
380,
20405,
29922,
2227,
4162,
29897,
13,
4706,
1889,
29889,
10685,
580,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5014,
29889,
2457,
401,
29892,
29871,
29900,
29897,
13,
4706,
1583,
29889,
9294,
8824,
29898,
359,
29889,
2084,
29889,
9933,
29898,
8173,
29918,
1445,
876,
13,
13,
1678,
822,
1243,
29918,
4804,
29918,
29880,
1639,
29918,
9006,
29918,
1220,
29918,
5559,
29918,
333,
29898,
1311,
1125,
13,
4706,
9920,
353,
22372,
29900,
29913,
1192,
1217,
29899,
8173,
426,
29896,
29913,
270,
29955,
29896,
29906,
29945,
29881,
29945,
29888,
29946,
29888,
29900,
617,
29929,
29953,
29906,
29941,
29888,
29953,
29955,
29900,
29874,
29953,
29953,
29883,
29945,
29946,
29888,
29896,
29941,
29896,
5753,
29945,
29900,
29900,
29941,
29906,
29881,
4286,
4830,
29898,
13,
9651,
1583,
29889,
29880,
1639,
29918,
4258,
29892,
13,
9651,
5713,
486,
1973,
29889,
29924,
8647,
29902,
29918,
3217,
7428,
1806,
29918,
8618,
17637,
29897,
13,
4706,
5713,
486,
1973,
29889,
19125,
29918,
5559,
29918,
4836,
29898,
7241,
486,
1973,
29889,
29924,
8647,
29902,
29918,
3217,
7428,
1806,
29918,
8618,
17637,
29897,
13,
13,
4706,
1889,
353,
349,
3150,
29898,
13,
9651,
9920,
29892,
6473,
29922,
5574,
29892,
27591,
29922,
2227,
4162,
29892,
380,
20405,
29922,
2227,
4162,
29897,
13,
4706,
1889,
29889,
10685,
580,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5014,
29889,
2457,
401,
29892,
29871,
29900,
29897,
13,
4706,
3454,
353,
1051,
29898,
1958,
29898,
13239,
29889,
14941,
29918,
13193,
29918,
517,
29918,
710,
29892,
1889,
29889,
25393,
29889,
949,
9012,
22130,
13,
4706,
1583,
29889,
9294,
9843,
29898,
2435,
29898,
9012,
511,
29871,
29941,
29897,
13,
4706,
1583,
29889,
9294,
5574,
29898,
9012,
29961,
29900,
1822,
1975,
2541,
877,
8949,
8785,
13,
4706,
1583,
29889,
9294,
5574,
29898,
9012,
29961,
29896,
1822,
27382,
2541,
877,
17435,
6991,
5219,
8785,
13,
13,
1678,
822,
1243,
29918,
4804,
29918,
29880,
1639,
29918,
2541,
29918,
311,
22742,
29918,
26983,
800,
29898,
1311,
1125,
13,
4706,
9920,
353,
22372,
29900,
29913,
1192,
1217,
29899,
8173,
426,
29896,
29913,
29871,
29896,
29945,
29946,
687,
29888,
29953,
29896,
29896,
29929,
29941,
29906,
29945,
617,
29941,
29890,
29896,
29888,
29941,
29888,
29945,
29874,
29946,
29872,
29955,
29900,
29929,
1635,
6448,
29953,
29896,
29874,
29946,
29874,
29946,
2291,
4286,
4830,
29898,
13,
9651,
1583,
29889,
29880,
1639,
29918,
4258,
29892,
13,
9651,
5713,
486,
1973,
29889,
2287,
1307,
29911,
3352,
29918,
29924,
6259,
29934,
8098,
29918,
8618,
17637,
29897,
13,
4706,
5713,
486,
1973,
29889,
19125,
29918,
5559,
29918,
4836,
29898,
7241,
486,
1973,
29889,
2287,
1307,
29911,
3352,
29918,
29924,
6259,
29934,
8098,
29918,
8618,
17637,
29897,
13,
13,
4706,
1889,
353,
349,
3150,
29898,
13,
9651,
9920,
29892,
6473,
29922,
5574,
29892,
27591,
29922,
2227,
4162,
29892,
380,
20405,
29922,
2227,
4162,
29897,
13,
4706,
1889,
29889,
10685,
580,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5014,
29889,
2457,
401,
29892,
29871,
29900,
29897,
13,
4706,
3454,
353,
1051,
29898,
1958,
29898,
13239,
29889,
14941,
29918,
13193,
29918,
517,
29918,
710,
29892,
1889,
29889,
25393,
29889,
949,
9012,
22130,
13,
4706,
1583,
29889,
9294,
9843,
29898,
2435,
29898,
9012,
511,
29871,
29941,
29897,
13,
4706,
1583,
29889,
9294,
5574,
29898,
9012,
29961,
29900,
1822,
1975,
2541,
877,
8949,
8785,
13,
4706,
1583,
29889,
9294,
5574,
29898,
9012,
29961,
29896,
1822,
27382,
2541,
877,
17435,
6991,
5219,
8785,
13,
13,
1678,
822,
1243,
29918,
4804,
29918,
3166,
29918,
2541,
262,
29918,
4836,
29898,
1311,
1125,
13,
4706,
9920,
353,
525,
2252,
426,
29900,
29913,
2607,
426,
29896,
29913,
1192,
1217,
29899,
8173,
869,
4286,
4830,
29898,
13,
9651,
5713,
486,
1973,
29889,
29907,
1955,
26282,
29918,
8618,
17637,
29892,
13,
9651,
1583,
29889,
29880,
1639,
29918,
4258,
29897,
13,
13,
4706,
1889,
353,
349,
3150,
29898,
13,
9651,
9920,
29892,
6473,
29922,
5574,
29892,
27591,
29922,
2227,
4162,
29892,
380,
20405,
29922,
2227,
4162,
29897,
13,
4706,
1889,
29889,
10685,
580,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5014,
29889,
2457,
401,
29892,
29871,
29900,
29897,
13,
4706,
3454,
353,
1051,
29898,
1958,
29898,
13239,
29889,
14941,
29918,
13193,
29918,
517,
29918,
710,
29892,
1889,
29889,
25393,
29889,
949,
9012,
22130,
13,
4706,
1583,
29889,
9294,
9843,
29898,
2435,
29898,
9012,
511,
29871,
29953,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
13,
9651,
12705,
29898,
9012,
7503,
29946,
11724,
13,
9651,
12705,
4197,
13,
462,
18227,
1688,
29918,
932,
29896,
29892,
29871,
29900,
29900,
29900,
29896,
29918,
11228,
467,
636,
9280,
613,
13,
462,
18227,
1688,
29918,
932,
29896,
29892,
29871,
29900,
29900,
29900,
29906,
29918,
29874,
29918,
1482,
29918,
4304,
29918,
2671,
467,
636,
9280,
613,
13,
462,
18227,
1688,
29918,
932,
29906,
29892,
29871,
29900,
29900,
29900,
29896,
29918,
5431,
467,
636,
9280,
613,
13,
462,
18227,
1688,
29918,
932,
29941,
29892,
29871,
29900,
29900,
29900,
29896,
29918,
11228,
467,
636,
9280,
613,
13,
795,
2314,
13,
4706,
1723,
13,
13,
1678,
822,
1243,
29918,
4804,
29918,
4836,
29918,
5464,
29918,
5559,
29918,
4632,
29898,
1311,
1125,
13,
4706,
396,
1033,
671,
4055,
29901,
1873,
29918,
554,
313,
4187,
1838,
29915,
29873,
664,
297,
3201,
1730,
29897,
13,
4706,
9920,
353,
22372,
29900,
29913,
1192,
1217,
29899,
8173,
426,
29896,
29913,
29871,
29906,
29883,
29946,
29953,
29888,
29946,
29941,
29947,
29874,
29947,
29929,
29929,
29955,
29906,
29888,
29929,
346,
29906,
29881,
29945,
29896,
29945,
29896,
29874,
29947,
29906,
29945,
29874,
29945,
1635,
29890,
29955,
29888,
29955,
2585,
29946,
29890,
4286,
4830,
29898,
13,
9651,
1583,
29889,
29880,
1639,
29918,
4258,
29892,
13,
9651,
5713,
486,
1973,
29889,
29940,
1164,
29918,
29954,
1806,
29918,
21289,
29918,
29928,
29967,
2190,
17080,
29918,
8618,
17637,
29897,
13,
4706,
5713,
486,
1973,
29889,
19125,
29918,
5559,
29918,
4836,
29898,
7241,
486,
1973,
29889,
29940,
1164,
29918,
29954,
1806,
29918,
21289,
29918,
29954,
1806,
29918,
29943,
5607,
8032,
29897,
13,
13,
4706,
1889,
353,
349,
3150,
29898,
13,
9651,
9920,
29892,
6473,
29922,
5574,
29892,
27591,
29922,
2227,
4162,
29892,
380,
20405,
29922,
2227,
4162,
29897,
13,
4706,
1889,
29889,
10685,
580,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5014,
29889,
2457,
401,
29892,
29871,
29900,
29897,
13,
4706,
3454,
353,
1051,
29898,
1958,
29898,
13239,
29889,
14941,
29918,
13193,
29918,
517,
29918,
710,
29892,
1889,
29889,
25393,
29889,
949,
9012,
22130,
13,
4706,
1583,
29889,
9294,
9843,
29898,
2435,
29898,
9012,
511,
29871,
29941,
29897,
13,
4706,
1583,
29889,
9294,
5574,
29898,
9012,
29961,
29900,
1822,
1975,
2541,
877,
8949,
8785,
13,
4706,
1583,
29889,
9294,
5574,
29898,
9012,
29961,
29896,
1822,
27382,
2541,
877,
17435,
6991,
5219,
8785,
13,
13,
1678,
822,
1243,
29918,
4804,
29918,
4836,
29918,
5464,
29918,
5559,
29918,
4632,
29918,
2901,
29898,
1311,
1125,
13,
4706,
396,
1033,
671,
4055,
29901,
1873,
29918,
2901,
313,
4187,
1838,
29915,
29873,
664,
297,
3201,
1730,
29897,
13,
4706,
9920,
353,
22372,
29900,
29913,
1192,
1217,
29899,
8173,
426,
29896,
29913,
29871,
29900,
29896,
29946,
29900,
29872,
29896,
29946,
29906,
29955,
29906,
29946,
13801,
29945,
29947,
29929,
29946,
29946,
29955,
29929,
29955,
29888,
29929,
1289,
29883,
29906,
774,
29888,
29929,
29953,
29946,
29896,
29946,
29953,
29941,
29941,
29929,
29874,
4286,
4830,
29898,
13,
9651,
1583,
29889,
29880,
1639,
29918,
4258,
29892,
13,
9651,
5713,
486,
1973,
29889,
29940,
1164,
29918,
29954,
1806,
29918,
21289,
29918,
29928,
29967,
2190,
17080,
29918,
8618,
17637,
29897,
13,
4706,
5713,
486,
1973,
29889,
19125,
29918,
5559,
29918,
4836,
29898,
7241,
486,
1973,
29889,
29940,
1164,
29918,
29954,
1806,
29918,
21289,
29918,
29954,
1806,
29918,
29943,
5607,
8032,
29897,
13,
13,
4706,
1889,
353,
349,
3150,
29898,
13,
9651,
9920,
29892,
6473,
29922,
5574,
29892,
27591,
29922,
2227,
4162,
29892,
380,
20405,
29922,
2227,
4162,
29897,
13,
4706,
1889,
29889,
10685,
580,
13,
4706,
1583,
29889,
9294,
3664,
9843,
29898,
5014,
29889,
2457,
401,
29892,
29871,
29900,
29897,
13,
4706,
3454,
353,
1051,
29898,
1958,
29898,
13239,
29889,
14941,
29918,
13193,
29918,
517,
29918,
710,
29892,
1889,
29889,
25393,
29889,
949,
9012,
22130,
13,
4706,
1583,
29889,
9294,
9843,
29898,
2435,
29898,
9012,
511,
29871,
29945,
29897,
13,
4706,
1583,
29889,
9294,
5574,
29898,
9012,
29961,
29900,
1822,
1975,
2541,
877,
21662,
8785,
13,
4706,
1583,
29889,
9294,
5574,
29898,
9012,
29961,
29906,
1822,
1975,
2541,
877,
8949,
8785,
13,
4706,
1583,
29889,
9294,
5574,
29898,
9012,
29961,
29941,
1822,
27382,
2541,
877,
17435,
6991,
5219,
8785,
13,
2
] |
estimate_nislands_params.py | willyrv/estimate_islands | 1 | 96495 | <reponame>willyrv/estimate_islands<filename>estimate_nislands_params.py
# -*- coding: utf-8 -*-
"""
Created on Mon May 2 14:48:39 2016
@author: willy
"""
import re
import argparse
from nisland_model import max_llk_estim_hist_theta_variable
parser = argparse.ArgumentParser(description='Estimates the parameters of an n-island model.')
# The file with the data (.ndiff)
parser.add_argument('input_file', type=str,
help='Full path to the input data.')
parameters = parser.parse_args()
INPUT_FILENAME = parameters.input_file
# Reading the file
with open(INPUT_FILENAME, 'r') as f:
text = f.read()
(header, obs_text) = text.split('# Value|count\n')
# Get the observed values
obs = []
pattern = '[0-9]*\|[0-9]*\n'
p = re.compile(pattern)
for line in p.findall(obs_text):
obs.append(int(line.split('|')[1]))
# Do the maximum likelihood estimation
[n, M, theta, llk] = max_llk_estim_hist_theta_variable(obs)
# Print the results
print("Number of islands: {}. Migration rate: {} ".format(n, M))
print("theta: {}".format(theta))
print("Value of the log-likelihood function: {}".format(llk))
| [
1,
529,
276,
1112,
420,
29958,
29893,
9403,
15291,
29914,
342,
6490,
29918,
275,
5252,
29966,
9507,
29958,
342,
6490,
29918,
6994,
5252,
29918,
7529,
29889,
2272,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
15945,
29908,
13,
20399,
373,
2598,
2610,
259,
29906,
29871,
29896,
29946,
29901,
29946,
29947,
29901,
29941,
29929,
29871,
29906,
29900,
29896,
29953,
13,
13,
29992,
8921,
29901,
281,
9403,
13,
15945,
29908,
13,
13,
5215,
337,
13,
5215,
1852,
5510,
13,
13,
3166,
302,
275,
1049,
29918,
4299,
1053,
4236,
29918,
645,
29895,
29918,
342,
326,
29918,
29882,
391,
29918,
3416,
29918,
11918,
13,
13,
16680,
353,
1852,
5510,
29889,
15730,
11726,
29898,
8216,
2433,
12787,
326,
1078,
278,
4128,
310,
385,
302,
29899,
275,
1049,
1904,
29889,
1495,
13,
13,
13,
29937,
450,
934,
411,
278,
848,
14544,
299,
2593,
29897,
13,
16680,
29889,
1202,
29918,
23516,
877,
2080,
29918,
1445,
742,
1134,
29922,
710,
29892,
13,
462,
418,
1371,
2433,
13658,
2224,
304,
278,
1881,
848,
29889,
1495,
13,
13,
16744,
353,
13812,
29889,
5510,
29918,
5085,
580,
13,
1177,
12336,
29918,
7724,
5813,
353,
4128,
29889,
2080,
29918,
1445,
13,
13,
29937,
21439,
278,
934,
13,
2541,
1722,
29898,
1177,
12336,
29918,
7724,
5813,
29892,
525,
29878,
1495,
408,
285,
29901,
13,
1678,
1426,
353,
285,
29889,
949,
580,
13,
29898,
6672,
29892,
20881,
29918,
726,
29897,
353,
1426,
29889,
5451,
14237,
7865,
29989,
2798,
29905,
29876,
1495,
13,
13,
29937,
3617,
278,
8900,
1819,
268,
13,
26290,
353,
5159,
13,
11037,
353,
525,
29961,
29900,
29899,
29929,
14178,
7893,
29961,
29900,
29899,
29929,
14178,
29905,
29876,
29915,
13,
29886,
353,
337,
29889,
12198,
29898,
11037,
29897,
13,
1454,
1196,
297,
282,
29889,
2886,
497,
29898,
26290,
29918,
726,
1125,
13,
1678,
20881,
29889,
4397,
29898,
524,
29898,
1220,
29889,
5451,
877,
29989,
29861,
29896,
12622,
13,
268,
13,
29937,
1938,
278,
7472,
4188,
22342,
23248,
29871,
13,
29961,
29876,
29892,
341,
29892,
278,
941,
29892,
11148,
29895,
29962,
353,
4236,
29918,
645,
29895,
29918,
342,
326,
29918,
29882,
391,
29918,
3416,
29918,
11918,
29898,
26290,
29897,
13,
13,
29937,
13905,
278,
2582,
13,
13,
2158,
703,
4557,
310,
24191,
29901,
426,
1836,
341,
16783,
6554,
29901,
6571,
11393,
4830,
29898,
29876,
29892,
341,
876,
13,
2158,
703,
3416,
29901,
6571,
1642,
4830,
29898,
3416,
876,
13,
2158,
703,
1917,
310,
278,
1480,
29899,
5081,
22342,
740,
29901,
6571,
1642,
4830,
29898,
645,
29895,
876,
13,
2
] |
SENN/scripts/main_beer.py | ricokoff/FACT-AI | 1 | 92831 | ''' Code for training and evaluating Self-Explaining Neural Networks.
Copyright (C) 2018 <NAME> <<EMAIL>>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License,
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
'''
| [
1,
14550,
5920,
363,
6694,
322,
6161,
1218,
21782,
29899,
9544,
433,
2827,
2448,
3631,
8527,
29879,
29889,
13,
14187,
1266,
313,
29907,
29897,
29871,
29906,
29900,
29896,
29947,
529,
5813,
29958,
3532,
26862,
6227,
6778,
13,
13,
910,
1824,
338,
3889,
7047,
29901,
366,
508,
2654,
391,
2666,
372,
322,
29914,
272,
6623,
13,
372,
1090,
278,
4958,
310,
278,
15143,
4593,
5236,
19245,
408,
6369,
491,
13,
278,
12362,
18540,
10606,
29892,
2845,
1873,
29871,
29941,
310,
278,
19245,
29892,
29871,
13,
313,
271,
596,
2984,
29897,
738,
2678,
1873,
29889,
13,
13,
910,
1824,
338,
13235,
297,
278,
4966,
393,
372,
674,
367,
5407,
29892,
13,
541,
399,
1806,
8187,
2692,
13764,
29979,
399,
1718,
29934,
13566,
29979,
29936,
1728,
1584,
278,
2411,
2957,
1370,
21867,
29891,
310,
13,
341,
1001,
3210,
13566,
2882,
6227,
11937,
470,
383,
1806,
8186,
1799,
15842,
319,
349,
8322,
2965,
13309,
1718,
349,
4574,
13152,
1660,
29889,
2823,
278,
13,
15143,
4593,
5236,
19245,
363,
901,
4902,
29889,
13,
13,
887,
881,
505,
4520,
263,
3509,
310,
278,
15143,
4593,
5236,
19245,
13,
3412,
411,
445,
1824,
29889,
960,
451,
29892,
1074,
529,
991,
597,
1636,
29889,
18713,
29889,
990,
29914,
506,
11259,
3779,
29889,
13,
14550,
13,
13,
2
] |
app/lib/duplication_check/compare.py | WHUT-XGP/ASoulCnki | 0 | 1609614 | <reponame>WHUT-XGP/ASoulCnki
# -*- encoding: utf-8 -*-
"""
Filename :compare.py
Description :1:1文章比较
Time :2021/06/22 22:54:18
Author :hwa
Version :1.0
"""
def article_compare(article1, article2):
red_list = []
for i in range(0, len(article1)):
if article1[i:i + 3] in article2:
red_list = red_list + [i, i + 1, i + 2, i + 3]
count = 0
for index, c in enumerate(article1):
if index in red_list:
# print("\033[31m" + c + "\033[0m", end="")
count += 1
# else:
# print(c, end="")
return count
| [
1,
529,
276,
1112,
420,
29958,
25039,
2692,
29899,
29990,
19903,
29914,
3289,
5059,
29907,
29876,
1984,
13,
29937,
448,
29930,
29899,
8025,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
15945,
29908,
13,
3434,
3871,
308,
584,
18307,
29889,
2272,
13,
9868,
418,
584,
29896,
29901,
29896,
30333,
31374,
31419,
235,
193,
134,
13,
2481,
632,
584,
29906,
29900,
29906,
29896,
29914,
29900,
29953,
29914,
29906,
29906,
29871,
29906,
29906,
29901,
29945,
29946,
29901,
29896,
29947,
13,
13720,
965,
584,
29882,
2766,
13,
6594,
3986,
584,
29896,
29889,
29900,
13,
15945,
29908,
13,
13,
13,
1753,
4274,
29918,
18307,
29898,
7914,
29896,
29892,
4274,
29906,
1125,
13,
1678,
2654,
29918,
1761,
353,
5159,
13,
1678,
363,
474,
297,
3464,
29898,
29900,
29892,
7431,
29898,
7914,
29896,
22164,
13,
4706,
565,
4274,
29896,
29961,
29875,
29901,
29875,
718,
29871,
29941,
29962,
297,
4274,
29906,
29901,
13,
9651,
2654,
29918,
1761,
353,
2654,
29918,
1761,
718,
518,
29875,
29892,
474,
718,
29871,
29896,
29892,
474,
718,
29871,
29906,
29892,
474,
718,
29871,
29941,
29962,
13,
1678,
2302,
353,
29871,
29900,
13,
1678,
363,
2380,
29892,
274,
297,
26985,
29898,
7914,
29896,
1125,
13,
4706,
565,
2380,
297,
2654,
29918,
1761,
29901,
13,
9651,
396,
1596,
14182,
29900,
29941,
29941,
29961,
29941,
29896,
29885,
29908,
718,
274,
718,
6634,
29900,
29941,
29941,
29961,
29900,
29885,
613,
1095,
543,
1159,
13,
9651,
2302,
4619,
29871,
29896,
13,
4706,
396,
1683,
29901,
13,
9651,
396,
1596,
29898,
29883,
29892,
1095,
543,
1159,
13,
1678,
736,
2302,
13,
2
] |
dirbot/items.py | lihongqiang/crawl-image | 1 | 39076 | from scrapy.item import Item, Field
class MyImage(Item):
image_urls = Field()
images = Field()
image_paths = Field()
image_label = Field()
| [
1,
515,
24559,
2272,
29889,
667,
1053,
10976,
29892,
8989,
13,
13,
13,
1990,
1619,
2940,
29898,
2001,
1125,
13,
13,
1678,
1967,
29918,
26045,
353,
8989,
580,
13,
1678,
4558,
353,
8989,
580,
13,
1678,
1967,
29918,
24772,
353,
8989,
580,
13,
1678,
1967,
29918,
1643,
353,
8989,
580,
13,
2
] |
caos/_internal/utils/working_directory.py | caotic-co/caos | 0 | 84890 | <filename>caos/_internal/utils/working_directory.py
import os
def is_dev_environment() -> bool:
"""Returns True if the project source code structure is found in the working directory"""
return os.path.isdir("caos") and \
os.path.isdir("caos/_cli_commands") and \
os.path.isfile("caos/_cli.py") and \
os.path.isdir("docs") and\
os.path.isdir("tests") and\
os.path.isfile("LICENSE") and\
os.path.isfile("caos.py")
def get_current_dir() -> str:
if is_dev_environment():
if not os.path.isdir("tmp"):
os.mkdir("tmp")
return os.path.abspath(os.getcwd()+"/tmp")
return os.path.abspath(os.getcwd()) | [
1,
529,
9507,
29958,
1113,
359,
19891,
7564,
29914,
13239,
29914,
22899,
29918,
12322,
29889,
2272,
13,
5215,
2897,
13,
13,
13,
1753,
338,
29918,
3359,
29918,
20944,
580,
1599,
6120,
29901,
13,
1678,
9995,
11609,
29879,
5852,
565,
278,
2060,
2752,
775,
3829,
338,
1476,
297,
278,
1985,
3884,
15945,
29908,
13,
1678,
736,
2897,
29889,
2084,
29889,
275,
3972,
703,
1113,
359,
1159,
322,
320,
13,
18884,
2897,
29889,
2084,
29889,
275,
3972,
703,
1113,
359,
19891,
11303,
29918,
26381,
1159,
322,
320,
13,
18884,
2897,
29889,
2084,
29889,
275,
1445,
703,
1113,
359,
19891,
11303,
29889,
2272,
1159,
322,
320,
13,
965,
2897,
29889,
2084,
29889,
275,
3972,
703,
2640,
1159,
322,
29905,
13,
965,
2897,
29889,
2084,
29889,
275,
3972,
703,
21150,
1159,
322,
29905,
13,
965,
2897,
29889,
2084,
29889,
275,
1445,
703,
27888,
1430,
1660,
1159,
322,
29905,
13,
965,
2897,
29889,
2084,
29889,
275,
1445,
703,
1113,
359,
29889,
2272,
1159,
13,
13,
13,
1753,
679,
29918,
3784,
29918,
3972,
580,
1599,
851,
29901,
13,
1678,
565,
338,
29918,
3359,
29918,
20944,
7295,
13,
4706,
565,
451,
2897,
29889,
2084,
29889,
275,
3972,
703,
7050,
29908,
1125,
13,
9651,
2897,
29889,
11256,
3972,
703,
7050,
1159,
13,
4706,
736,
2897,
29889,
2084,
29889,
370,
1028,
493,
29898,
359,
29889,
657,
29883,
9970,
580,
13578,
29914,
7050,
1159,
13,
1678,
736,
2897,
29889,
2084,
29889,
370,
1028,
493,
29898,
359,
29889,
657,
29883,
9970,
3101,
2
] |
atlas/auth/voms/models.py | kiae-grid/panda-bigmon-atlas | 0 | 187810 | <reponame>kiae-grid/panda-bigmon-atlas
__author__ = 'sbel'
from django.db import models
from django.utils import timezone
class VomsUser(models.Model):
id = models.AutoField(db_column='ID', primary_key=True)
username = models.CharField(max_length=60, db_column='USERNAME', db_index=True)
dn = models.CharField(max_length=255, db_column='DN', db_index=True)
ca = models.CharField(max_length=255, db_column='CA')
added_on = models.DateTimeField(auto_now_add=True, db_column='ADDED_ON')
def save(self, *args, **kwargs):
if not self.added_on:
self.added_on = timezone.now()
super(VomsUser, self).save(*args, **kwargs)
class Meta:
managed = True
db_table = u'VOMS_USERS_MAP'
app_label = 'auth'
unique_together = (("username", "dn"),)
| [
1,
529,
276,
1112,
420,
29958,
29895,
23395,
29899,
7720,
29914,
29886,
5863,
29899,
3752,
3712,
29899,
271,
3333,
13,
1649,
8921,
1649,
353,
525,
29879,
6596,
29915,
13,
13,
3166,
9557,
29889,
2585,
1053,
4733,
13,
3166,
9557,
29889,
13239,
1053,
29431,
13,
13,
1990,
478,
4835,
2659,
29898,
9794,
29889,
3195,
1125,
13,
1678,
1178,
353,
4733,
29889,
12300,
3073,
29898,
2585,
29918,
4914,
2433,
1367,
742,
7601,
29918,
1989,
29922,
5574,
29897,
13,
1678,
8952,
353,
4733,
29889,
27890,
29898,
3317,
29918,
2848,
29922,
29953,
29900,
29892,
4833,
29918,
4914,
2433,
11889,
5813,
742,
4833,
29918,
2248,
29922,
5574,
29897,
13,
1678,
270,
29876,
353,
4733,
29889,
27890,
29898,
3317,
29918,
2848,
29922,
29906,
29945,
29945,
29892,
4833,
29918,
4914,
2433,
28307,
742,
4833,
29918,
2248,
29922,
5574,
29897,
13,
1678,
5777,
353,
4733,
29889,
27890,
29898,
3317,
29918,
2848,
29922,
29906,
29945,
29945,
29892,
4833,
29918,
4914,
2433,
5454,
1495,
13,
1678,
2715,
29918,
265,
353,
4733,
29889,
11384,
3073,
29898,
6921,
29918,
3707,
29918,
1202,
29922,
5574,
29892,
4833,
29918,
4914,
2433,
3035,
2287,
29928,
29918,
1164,
1495,
13,
13,
1678,
822,
4078,
29898,
1311,
29892,
334,
5085,
29892,
3579,
19290,
1125,
13,
4706,
565,
451,
1583,
29889,
23959,
29918,
265,
29901,
13,
9651,
1583,
29889,
23959,
29918,
265,
353,
29431,
29889,
3707,
580,
13,
4706,
2428,
29898,
29963,
4835,
2659,
29892,
1583,
467,
7620,
10456,
5085,
29892,
3579,
19290,
29897,
13,
13,
13,
1678,
770,
20553,
29901,
13,
4706,
8745,
353,
5852,
13,
4706,
4833,
29918,
2371,
353,
318,
29915,
24898,
4345,
29918,
11889,
29903,
29918,
23827,
29915,
13,
4706,
623,
29918,
1643,
353,
525,
5150,
29915,
13,
4706,
5412,
29918,
29873,
12966,
353,
313,
703,
6786,
613,
376,
5200,
4968,
29897,
13,
2
] |
pqu/Check/check.py | brown170/fudge | 14 | 36702 | <filename>pqu/Check/check.py
# <<BEGIN-copyright>>
# Copyright 2021, Lawrence Livermore National Security, LLC.
# See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: BSD-3-Clause
# <<END-copyright>>
import sys
import glob, os, shutil, filecmp
PYTHON = sys.executable
files = sorted( glob.glob( 't*.py' ) )
if( os.path.exists( 'Out' ) ) : shutil.rmtree( 'Out' )
os.mkdir( 'Out' )
for file in files :
base = file[:-3]
status = os.system( '%s %s > Out/%s.out' % ( PYTHON, file, base ) )
if( status ) : print( '=========== %s ===========' % file )
outs = sorted( glob.glob( 'Out/t*.out' ) )
for out in outs :
file = os.path.basename( out )
if( not( filecmp.cmp( os.path.join( 'Out.checked', file ), out ) ) ) : print( 'ERROR: %s' % out )
| [
1,
529,
9507,
29958,
29886,
339,
29914,
5596,
29914,
3198,
29889,
2272,
13,
29937,
3532,
29933,
17958,
29899,
8552,
1266,
6778,
13,
29937,
14187,
1266,
29871,
29906,
29900,
29906,
29896,
29892,
19520,
22469,
5514,
3086,
14223,
29892,
365,
12182,
29889,
13,
29937,
2823,
278,
2246,
29899,
5563,
315,
4590,
29979,
22789,
3912,
934,
363,
4902,
29889,
13,
29937,
29871,
13,
29937,
10937,
29928,
29990,
29899,
29931,
293,
1947,
29899,
12889,
29901,
350,
7230,
29899,
29941,
29899,
20216,
1509,
13,
29937,
3532,
11794,
29899,
8552,
1266,
6778,
13,
13,
5215,
10876,
13,
5215,
13149,
29892,
2897,
29892,
528,
4422,
29892,
934,
21058,
13,
13,
20055,
4690,
1164,
353,
10876,
29889,
4258,
9246,
13,
13,
5325,
353,
12705,
29898,
13149,
29889,
23705,
29898,
525,
29873,
10521,
2272,
29915,
1723,
1723,
13,
13,
361,
29898,
2897,
29889,
2084,
29889,
9933,
29898,
525,
3744,
29915,
1723,
1723,
584,
528,
4422,
29889,
1758,
8336,
29898,
525,
3744,
29915,
1723,
13,
359,
29889,
11256,
3972,
29898,
525,
3744,
29915,
1723,
13,
13,
1454,
934,
297,
2066,
584,
13,
1678,
2967,
353,
934,
7503,
29899,
29941,
29962,
13,
1678,
4660,
353,
2897,
29889,
5205,
29898,
14210,
29879,
1273,
29879,
1405,
4451,
22584,
29879,
29889,
449,
29915,
1273,
313,
349,
29979,
4690,
1164,
29892,
934,
29892,
2967,
1723,
1723,
13,
1678,
565,
29898,
4660,
1723,
584,
1596,
29898,
525,
4936,
25512,
1273,
29879,
1275,
4936,
2433,
1273,
934,
1723,
13,
13,
17718,
353,
12705,
29898,
13149,
29889,
23705,
29898,
525,
3744,
29914,
29873,
10521,
449,
29915,
1723,
1723,
13,
1454,
714,
297,
714,
29879,
584,
13,
1678,
934,
353,
2897,
29889,
2084,
29889,
6500,
3871,
29898,
714,
1723,
13,
1678,
565,
29898,
451,
29898,
934,
21058,
29889,
21058,
29898,
2897,
29889,
2084,
29889,
7122,
29898,
525,
3744,
29889,
11238,
742,
934,
10353,
714,
1723,
1723,
1723,
584,
1596,
29898,
525,
11432,
29901,
1273,
29879,
29915,
1273,
714,
1723,
13,
2
] |
src/ganground/metric/kernel.py | tsirif/ganground | 1 | 147789 | # -*- coding: utf-8 -*-
r"""
:mod:`ganground.metric.kernel` -- Kernel function definitions
=============================================================
.. module:: kernel
:platform: Unix
:synopsis: Helper functions for Maximum Mean Discrepancy, plus kernel
function definitions.
"""
from abc import abstractmethod
import logging
import torch
import torch.nn.functional as F
from ganground.utils import (AbstractSingletonType, SingletonFactory)
logger = logging.getLogger(__name__)
__all__ = [
'mmd2', 'cross_mean_kernel_wrap',
'_pairwise_dot', '_pairwise_dist', '_pairwise_pow_dist',
'AbstractKernel', 'Kernel', 'Gaussian', 'Laplacian', 'Exp',
'Linear', 'Poly', 'Tanh', 'IMQ'
]
def mmd2(PPk, QQk, PQk):
"""Calculate squared Maximum Mean Discrepancy distance.
Args:
PPk: None, scalar torch tensor containing the mean PPk
or the full pairwise distance matrix
QQk: scalar torch tensor containing the mean QQk
or the full pairwise distance matrix
PQk: scalar torch tensor containing the mean PQk
or the full pairwise distance matrix
"""
assert(PQk is not None)
# Allow `PPk` to be None, if we want to compute mmd2 for the generator
if PPk is None:
PPk_ = 0
elif len(PPk.shape) == 2:
m = PPk.size(0)
PPk_ = (PPk.sum() - PPk.trace()) / (m**2 - m) if m != 1 else 0
elif len(PPk.shape) == 1:
PPk_ = PPk.mean()
elif len(PPk.shape) == 0:
PPk_ = PPk
else:
raise ValueError("Not supported `PPk`.")
if QQk is None:
QQk_ = 0
elif len(QQk.shape) == 2:
n = QQk.size(0)
QQk_ = (QQk.sum() - QQk.trace()) / (n**2 - n) if n != 1 else 0
elif len(QQk.shape) == 1:
QQk_ = QQk.mean()
elif len(QQk.shape) == 0:
QQk_ = QQk
else:
raise ValueError("Not supported `QQk`.")
if PQk.size():
PQk_ = PQk.mean()
else:
PQk_ = PQk
return PPk_ + QQk_ - 2 * PQk_
################################################################################
# Helper Kernel Functions #
################################################################################
def _find_tensor_device(tensor):
try:
dev = tensor.get_device()
except RuntimeError as e:
if 'CPU backend' in str(e):
return 'cpu'
else:
raise
if dev == -1:
return 'cpu'
return 'cuda:' + str(dev)
def cross_mean_kernel_wrap(kernel_fn, calcpp=True, calcqq=True,
try_pdist=False):
def kernel(cp, cq, **kernel_args):
m = cp.size(0)
n = cq.size(0)
cp_cq_len = m + n
if try_pdist:
# logger.debug("Using pytorch.pdist with concatenation to calc cross means.")
# It will use F.pdist to calculate cpp, cpq, and cqq
cp_cq = torch.cat((cp, cq), dim=0).contiguous()
res_type = cp_cq.dtype
res_device = _find_tensor_device(cp_cq)
res = kernel_fn(cp_cq, cp_cq, **kernel_args).to(torch.float64)
inds = torch.triu_indices(cp_cq_len, cp_cq_len, offset=1,
dtype=torch.float64, device=res_device)
inds_r = inds[0, :]
inds_c = inds[1, :]
# Split to get Ecxx, Ecxy, and Ecyy
if calcpp:
mask = inds_c.sub(m).mul_(-1).clamp_(0, 1)
n = mask.sum()
cpp = mask.mul_(res).sum().div_(n).to(res_type)
else:
cpp = None
if calcqq:
mask = inds_r.sub(m - 1).clamp_(0, 1)
n = mask.sum()
cqq = mask.mul_(res).sum().div_(n).to(res_type)
else:
cqq = None
mask = inds_r.sub(m).mul_(-1).clamp_(0, 1)
mask = inds_c.sub(m - 1).clamp_(0, 1).mul_(mask)
n = mask.sum()
cpq = mask.mul_(res).sum().div_(n).to(res_type)
else:
# logger.debug("Invoking three times the kernel to calc cross means.")
if calcpp:
cpp = kernel_fn(cp, cp, **kernel_args)
else:
cpp = None
if calcqq:
cqq = kernel_fn(cq, cq, **kernel_args)
else:
cqq = None
cpq = kernel_fn(cp, cq, **kernel_args)
return cpp, cqq, cpq
return kernel
def _pairwise_dist(cx, cy, p=2, _pow_flag=False):
"""Compute pairwise distances between two Tensors of size m x `shape`
and n x `shape`.
This should be done as efficiently as possible. Discussions:
https://github.com/pytorch/pytorch/issues/9406
"""
def _are_equal(cx, cy):
if cx is cy:
return True
return torch.equal(cx, cy)
res = None
m = cx.size(0)
n = cy.size(0)
imsize = cx.view(m, -1).size(-1)
cx_eq_cy = _are_equal(cx, cy)
if cx_eq_cy:
# logger.debug("Calc pairwise distance with pytorch.pdist.")
# Calculate only triangular, fast, cheaper, stable. Looks like this:
# torch.cat([torch.full((n - i - 1,), i, dtype=torch.int64) for i in range(n)])
res = F.pdist(cx.view(m, -1), p=p)
elif p == 2 and m * n * imsize * (torch.finfo(cx.dtype).bits // 8) > 4 * 1024**2:
# logger.debug("Calc pairwise distance with quadratic expansion.")
# If more than 4MB needed to repr a full matrix
# Faster and cheaper, but less stable (quadratic expansion)
# Still slower than the first choice
cx_ = cx.view(m, -1)
cy_ = cy.view(n, -1)
cx_norm = cx_.pow(2).sum(dim=-1, keepdim=True)
cy_norm = cy_.pow(2).sum(dim=-1, keepdim=True).transpose(-2, -1)
res = cx_norm + cy_norm - 2 * cx_.matmul(cy_.transpose(-2, -1))
if cx_eq_cy:
# Ensure zero diagonal
diag_inds = torch.arange(m)
res[diag_inds, diag_inds] = 0
# Zero out negative values
res.clamp_min_(0)
if _pow_flag:
_pow_flag[0] = True
else:
res = res.sqrt()
else:
# logger.debug("Calc pairwise distance with naive broadcasting.")
# More expensive - Θ(n^2 d), but numerically more stable
cx_ = cx.view(m, 1, -1)
cy_ = cy.view(1, n, -1)
# XXX does not support broadcasting yet #15918 and #15901
# res = F.pairwise_distance(cx_, cy_, p=p, eps=1e-8)
res = torch.norm(cx_ - cy_, p=p, dim=-1)
return res
def _pairwise_pow_dist(cx, cy, p=2):
pow_flag = [False]
res = _pairwise_dist(cx, cy, p=p, _pow_flag=pow_flag)
if pow_flag[0]:
return res
return res.pow(p)
def _pairwise_dot(cx, cy):
# TODO Find a more memory efficient way to do this
# Can pytorch cosine similarity be used perhaps??
m = cx.size(0)
n = cy.size(0)
cx_ = cx.view(m, 1, -1)
cy_ = cy.view(1, n, -1)
return cx_.mul(cy_).sum(dim=-1)
################################################################################
# Kernel Function Definitions #
################################################################################
class AbstractKernel(object, metaclass=AbstractSingletonType):
@abstractmethod
def __call__(self, cx, cy, **kernel_kwargs):
pass
class Gaussian(AbstractKernel):
def __call__(self, cx, cy, sigma=1):
XY = _pairwise_pow_dist(cx, cy)
return XY.div_(- 2 * sigma**2).exp_()
class Laplacian(AbstractKernel):
def __call__(self, cx, cy, p=2, sigma=1):
XY = _pairwise_dist(cx, cy, p=p)
return XY.div_(-sigma).exp_()
class Exp(AbstractKernel):
def __call__(self, cx, cy, sigma=1):
XY = _pairwise_dot(cx, cy)
return XY.div_(sigma).exp_()
class Linear(AbstractKernel):
def __call__(self, cx, cy, c=0):
return _pairwise_dot(cx - c, cy - c)
class Poly(AbstractKernel):
def __call__(self, cx, cy, a=1, c=1, d=2):
XY = _pairwise_dot(cx, cy)
return XY.mul_(a).add_(c).pow_(d)
class Tanh(AbstractKernel):
def __call__(self, cx, cy, a=1, c=0):
XY = _pairwise_dot(cx, cy)
return XY.mul_(a).add_(c).tanh_()
class IMQ(AbstractKernel):
def __call__(self, cx, cy, c=1, d=2, sigma=1):
XY = _pairwise_pow_dist(cx, cy)
return XY.div_(sigma**2).add_(c).pow_(-d / 2)
class Kernel(AbstractKernel, metaclass=SingletonFactory):
rbf = ('gaussian', 'exp', 'laplacian', 'imq')
| [
1,
396,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
29878,
15945,
29908,
13,
29901,
1545,
18078,
8029,
14486,
29889,
16414,
29889,
17460,
29952,
1192,
476,
5851,
740,
15848,
13,
9166,
9166,
9166,
4936,
2751,
29922,
13,
13,
636,
3883,
1057,
8466,
13,
259,
584,
12120,
29901,
26663,
13,
259,
584,
19274,
15368,
29901,
6162,
546,
3168,
363,
5918,
12539,
16316,
3295,
1037,
29886,
6906,
29892,
2298,
8466,
13,
418,
740,
15848,
29889,
13,
13,
15945,
29908,
13,
3166,
25638,
1053,
9846,
5696,
13,
5215,
12183,
13,
13,
5215,
4842,
305,
13,
5215,
4842,
305,
29889,
15755,
29889,
2220,
284,
408,
383,
13,
13,
3166,
20676,
14486,
29889,
13239,
1053,
313,
9118,
10873,
11285,
1542,
29892,
6106,
11285,
5126,
29897,
13,
13,
21707,
353,
12183,
29889,
657,
16363,
22168,
978,
1649,
29897,
13,
1649,
497,
1649,
353,
518,
13,
1678,
525,
29885,
3487,
29906,
742,
525,
19128,
29918,
12676,
29918,
17460,
29918,
6312,
742,
13,
1678,
22868,
18784,
3538,
29918,
6333,
742,
22868,
18784,
3538,
29918,
5721,
742,
22868,
18784,
3538,
29918,
12248,
29918,
5721,
742,
13,
1678,
525,
9118,
29968,
5851,
742,
525,
29968,
5851,
742,
525,
29954,
17019,
742,
525,
29931,
481,
433,
28445,
742,
525,
9544,
742,
13,
1678,
525,
12697,
742,
525,
7713,
29891,
742,
525,
29911,
27731,
742,
525,
7833,
29984,
29915,
13,
29962,
13,
13,
13,
1753,
286,
3487,
29906,
29898,
18009,
29895,
29892,
660,
29984,
29895,
29892,
349,
29984,
29895,
1125,
13,
1678,
9995,
27065,
403,
10674,
1965,
5918,
12539,
16316,
3295,
1037,
29886,
6906,
5418,
29889,
13,
13,
1678,
826,
3174,
29901,
13,
4706,
349,
29925,
29895,
29901,
6213,
29892,
17336,
4842,
305,
12489,
6943,
278,
2099,
349,
29925,
29895,
13,
632,
470,
278,
2989,
5101,
3538,
5418,
4636,
13,
4706,
660,
29984,
29895,
29901,
17336,
4842,
305,
12489,
6943,
278,
2099,
660,
29984,
29895,
13,
632,
470,
278,
2989,
5101,
3538,
5418,
4636,
13,
4706,
349,
29984,
29895,
29901,
17336,
4842,
305,
12489,
6943,
278,
2099,
349,
29984,
29895,
13,
632,
470,
278,
2989,
5101,
3538,
5418,
4636,
13,
13,
1678,
9995,
13,
1678,
4974,
29898,
29925,
29984,
29895,
338,
451,
6213,
29897,
13,
1678,
396,
29408,
421,
18009,
29895,
29952,
304,
367,
6213,
29892,
565,
591,
864,
304,
10272,
286,
3487,
29906,
363,
278,
15299,
13,
1678,
565,
349,
29925,
29895,
338,
6213,
29901,
13,
4706,
349,
29925,
29895,
29918,
353,
29871,
29900,
13,
1678,
25342,
7431,
29898,
18009,
29895,
29889,
12181,
29897,
1275,
29871,
29906,
29901,
13,
4706,
286,
353,
349,
29925,
29895,
29889,
2311,
29898,
29900,
29897,
13,
4706,
349,
29925,
29895,
29918,
353,
313,
18009,
29895,
29889,
2083,
580,
448,
349,
29925,
29895,
29889,
15003,
3101,
847,
313,
29885,
1068,
29906,
448,
286,
29897,
565,
286,
2804,
29871,
29896,
1683,
29871,
29900,
13,
1678,
25342,
7431,
29898,
18009,
29895,
29889,
12181,
29897,
1275,
29871,
29896,
29901,
13,
4706,
349,
29925,
29895,
29918,
353,
349,
29925,
29895,
29889,
12676,
580,
13,
1678,
25342,
7431,
29898,
18009,
29895,
29889,
12181,
29897,
1275,
29871,
29900,
29901,
13,
4706,
349,
29925,
29895,
29918,
353,
349,
29925,
29895,
13,
1678,
1683,
29901,
13,
4706,
12020,
7865,
2392,
703,
3664,
6969,
421,
18009,
29895,
1412,
1159,
13,
13,
1678,
565,
660,
29984,
29895,
338,
6213,
29901,
13,
4706,
660,
29984,
29895,
29918,
353,
29871,
29900,
13,
1678,
25342,
7431,
29898,
29984,
29984,
29895,
29889,
12181,
29897,
1275,
29871,
29906,
29901,
13,
4706,
302,
353,
660,
29984,
29895,
29889,
2311,
29898,
29900,
29897,
13,
4706,
660,
29984,
29895,
29918,
353,
313,
29984,
29984,
29895,
29889,
2083,
580,
448,
660,
29984,
29895,
29889,
15003,
3101,
847,
313,
29876,
1068,
29906,
448,
302,
29897,
565,
302,
2804,
29871,
29896,
1683,
29871,
29900,
13,
1678,
25342,
7431,
29898,
29984,
29984,
29895,
29889,
12181,
29897,
1275,
29871,
29896,
29901,
13,
4706,
660,
29984,
29895,
29918,
353,
660,
29984,
29895,
29889,
12676,
580,
13,
1678,
25342,
7431,
29898,
29984,
29984,
29895,
29889,
12181,
29897,
1275,
29871,
29900,
29901,
13,
4706,
660,
29984,
29895,
29918,
353,
660,
29984,
29895,
13,
1678,
1683,
29901,
13,
4706,
12020,
7865,
2392,
703,
3664,
6969,
421,
29984,
29984,
29895,
1412,
1159,
13,
13,
1678,
565,
349,
29984,
29895,
29889,
2311,
7295,
13,
4706,
349,
29984,
29895,
29918,
353,
349,
29984,
29895,
29889,
12676,
580,
13,
1678,
1683,
29901,
13,
4706,
349,
29984,
29895,
29918,
353,
349,
29984,
29895,
13,
13,
1678,
736,
349,
29925,
29895,
29918,
718,
660,
29984,
29895,
29918,
448,
29871,
29906,
334,
349,
29984,
29895,
29918,
13,
13,
13,
13383,
13383,
13383,
13383,
13383,
13,
29937,
462,
965,
6162,
546,
476,
5851,
6680,
29879,
462,
9651,
396,
13,
13383,
13383,
13383,
13383,
13383,
13,
13,
13,
1753,
903,
2886,
29918,
20158,
29918,
10141,
29898,
20158,
1125,
13,
1678,
1018,
29901,
13,
4706,
2906,
353,
12489,
29889,
657,
29918,
10141,
580,
13,
1678,
5174,
24875,
2392,
408,
321,
29901,
13,
4706,
565,
525,
6271,
29965,
14998,
29915,
297,
851,
29898,
29872,
1125,
13,
9651,
736,
525,
21970,
29915,
13,
4706,
1683,
29901,
13,
9651,
12020,
13,
13,
1678,
565,
2906,
1275,
448,
29896,
29901,
13,
4706,
736,
525,
21970,
29915,
13,
13,
1678,
736,
525,
29883,
6191,
11283,
718,
851,
29898,
3359,
29897,
13,
13,
13,
1753,
4891,
29918,
12676,
29918,
17460,
29918,
6312,
29898,
17460,
29918,
9144,
29892,
1208,
8223,
29922,
5574,
29892,
22235,
24349,
29922,
5574,
29892,
13,
462,
965,
1018,
29918,
29886,
5721,
29922,
8824,
1125,
13,
13,
1678,
822,
8466,
29898,
6814,
29892,
274,
29939,
29892,
3579,
17460,
29918,
5085,
1125,
13,
4706,
286,
353,
21447,
29889,
2311,
29898,
29900,
29897,
13,
4706,
302,
353,
274,
29939,
29889,
2311,
29898,
29900,
29897,
13,
4706,
21447,
29918,
29883,
29939,
29918,
2435,
353,
286,
718,
302,
13,
4706,
565,
1018,
29918,
29886,
5721,
29901,
13,
9651,
396,
29871,
17927,
29889,
8382,
703,
15156,
282,
3637,
25350,
29889,
29886,
5721,
411,
16125,
362,
304,
22235,
4891,
2794,
23157,
13,
9651,
396,
739,
674,
671,
383,
29889,
29886,
5721,
304,
8147,
274,
407,
29892,
21447,
29939,
29892,
322,
274,
24349,
13,
9651,
21447,
29918,
29883,
29939,
353,
4842,
305,
29889,
4117,
3552,
6814,
29892,
274,
29939,
511,
3964,
29922,
29900,
467,
1285,
5526,
681,
580,
13,
9651,
620,
29918,
1853,
353,
21447,
29918,
29883,
29939,
29889,
29881,
1853,
13,
9651,
620,
29918,
10141,
353,
903,
2886,
29918,
20158,
29918,
10141,
29898,
6814,
29918,
29883,
29939,
29897,
13,
9651,
620,
353,
8466,
29918,
9144,
29898,
6814,
29918,
29883,
29939,
29892,
21447,
29918,
29883,
29939,
29892,
3579,
17460,
29918,
5085,
467,
517,
29898,
7345,
305,
29889,
7411,
29953,
29946,
29897,
13,
9651,
1399,
29879,
353,
4842,
305,
29889,
3626,
29884,
29918,
513,
1575,
29898,
6814,
29918,
29883,
29939,
29918,
2435,
29892,
21447,
29918,
29883,
29939,
29918,
2435,
29892,
9210,
29922,
29896,
29892,
13,
462,
462,
418,
26688,
29922,
7345,
305,
29889,
7411,
29953,
29946,
29892,
4742,
29922,
690,
29918,
10141,
29897,
13,
9651,
1399,
29879,
29918,
29878,
353,
1399,
29879,
29961,
29900,
29892,
584,
29962,
13,
9651,
1399,
29879,
29918,
29883,
353,
1399,
29879,
29961,
29896,
29892,
584,
29962,
13,
13,
9651,
396,
26178,
304,
679,
382,
29883,
4419,
29892,
382,
29883,
3594,
29892,
322,
382,
1270,
29891,
13,
9651,
565,
1208,
8223,
29901,
13,
18884,
11105,
353,
1399,
29879,
29918,
29883,
29889,
1491,
29898,
29885,
467,
16109,
29918,
6278,
29896,
467,
695,
1160,
23538,
29900,
29892,
29871,
29896,
29897,
13,
18884,
302,
353,
11105,
29889,
2083,
580,
13,
18884,
274,
407,
353,
11105,
29889,
16109,
23538,
690,
467,
2083,
2141,
4563,
23538,
29876,
467,
517,
29898,
690,
29918,
1853,
29897,
13,
9651,
1683,
29901,
13,
18884,
274,
407,
353,
6213,
13,
13,
9651,
565,
22235,
24349,
29901,
13,
18884,
11105,
353,
1399,
29879,
29918,
29878,
29889,
1491,
29898,
29885,
448,
29871,
29896,
467,
695,
1160,
23538,
29900,
29892,
29871,
29896,
29897,
13,
18884,
302,
353,
11105,
29889,
2083,
580,
13,
18884,
274,
24349,
353,
11105,
29889,
16109,
23538,
690,
467,
2083,
2141,
4563,
23538,
29876,
467,
517,
29898,
690,
29918,
1853,
29897,
13,
9651,
1683,
29901,
13,
18884,
274,
24349,
353,
6213,
13,
13,
9651,
11105,
353,
1399,
29879,
29918,
29878,
29889,
1491,
29898,
29885,
467,
16109,
29918,
6278,
29896,
467,
695,
1160,
23538,
29900,
29892,
29871,
29896,
29897,
13,
9651,
11105,
353,
1399,
29879,
29918,
29883,
29889,
1491,
29898,
29885,
448,
29871,
29896,
467,
695,
1160,
23538,
29900,
29892,
29871,
29896,
467,
16109,
23538,
13168,
29897,
13,
9651,
302,
353,
11105,
29889,
2083,
580,
13,
9651,
21447,
29939,
353,
11105,
29889,
16109,
23538,
690,
467,
2083,
2141,
4563,
23538,
29876,
467,
517,
29898,
690,
29918,
1853,
29897,
13,
13,
4706,
1683,
29901,
13,
9651,
396,
29871,
17927,
29889,
8382,
703,
12165,
17223,
2211,
3064,
278,
8466,
304,
22235,
4891,
2794,
23157,
13,
9651,
565,
1208,
8223,
29901,
13,
18884,
274,
407,
353,
8466,
29918,
9144,
29898,
6814,
29892,
21447,
29892,
3579,
17460,
29918,
5085,
29897,
13,
9651,
1683,
29901,
13,
18884,
274,
407,
353,
6213,
13,
9651,
565,
22235,
24349,
29901,
13,
18884,
274,
24349,
353,
8466,
29918,
9144,
29898,
29883,
29939,
29892,
274,
29939,
29892,
3579,
17460,
29918,
5085,
29897,
13,
9651,
1683,
29901,
13,
18884,
274,
24349,
353,
6213,
13,
9651,
21447,
29939,
353,
8466,
29918,
9144,
29898,
6814,
29892,
274,
29939,
29892,
3579,
17460,
29918,
5085,
29897,
13,
13,
4706,
736,
274,
407,
29892,
274,
24349,
29892,
21447,
29939,
13,
13,
1678,
736,
8466,
13,
13,
13,
1753,
903,
18784,
3538,
29918,
5721,
29898,
18904,
29892,
5094,
29892,
282,
29922,
29906,
29892,
903,
12248,
29918,
15581,
29922,
8824,
1125,
13,
1678,
9995,
20606,
29872,
5101,
3538,
24610,
1546,
1023,
323,
575,
943,
310,
2159,
286,
921,
421,
12181,
29952,
13,
1678,
322,
302,
921,
421,
12181,
1412,
13,
13,
1678,
910,
881,
367,
2309,
408,
29497,
408,
1950,
29889,
8565,
1558,
1080,
29901,
13,
1678,
2045,
597,
3292,
29889,
510,
29914,
2272,
7345,
305,
29914,
2272,
7345,
305,
29914,
12175,
29914,
29929,
29946,
29900,
29953,
13,
13,
1678,
9995,
13,
1678,
822,
903,
598,
29918,
11745,
29898,
18904,
29892,
5094,
1125,
13,
4706,
565,
28232,
338,
5094,
29901,
13,
9651,
736,
5852,
13,
4706,
736,
4842,
305,
29889,
11745,
29898,
18904,
29892,
5094,
29897,
13,
13,
1678,
620,
353,
6213,
13,
1678,
286,
353,
28232,
29889,
2311,
29898,
29900,
29897,
13,
1678,
302,
353,
5094,
29889,
2311,
29898,
29900,
29897,
13,
1678,
527,
2311,
353,
28232,
29889,
1493,
29898,
29885,
29892,
448,
29896,
467,
2311,
6278,
29896,
29897,
13,
1678,
28232,
29918,
1837,
29918,
1270,
353,
903,
598,
29918,
11745,
29898,
18904,
29892,
5094,
29897,
13,
13,
1678,
565,
28232,
29918,
1837,
29918,
1270,
29901,
13,
4706,
396,
29871,
17927,
29889,
8382,
703,
7856,
29883,
5101,
3538,
5418,
411,
282,
3637,
25350,
29889,
29886,
5721,
23157,
13,
4706,
396,
20535,
403,
871,
3367,
6825,
29892,
5172,
29892,
923,
7202,
29892,
13714,
29889,
19887,
763,
445,
29901,
13,
4706,
396,
4842,
305,
29889,
4117,
4197,
7345,
305,
29889,
8159,
3552,
29876,
448,
474,
448,
29871,
29896,
29892,
511,
474,
29892,
26688,
29922,
7345,
305,
29889,
524,
29953,
29946,
29897,
363,
474,
297,
3464,
29898,
29876,
29897,
2314,
13,
4706,
620,
353,
383,
29889,
29886,
5721,
29898,
18904,
29889,
1493,
29898,
29885,
29892,
448,
29896,
511,
282,
29922,
29886,
29897,
13,
1678,
25342,
282,
1275,
29871,
29906,
322,
286,
334,
302,
334,
527,
2311,
334,
313,
7345,
305,
29889,
29888,
3888,
29898,
18904,
29889,
29881,
1853,
467,
14836,
849,
29871,
29947,
29897,
1405,
29871,
29946,
334,
29871,
29896,
29900,
29906,
29946,
1068,
29906,
29901,
13,
4706,
396,
29871,
17927,
29889,
8382,
703,
7856,
29883,
5101,
3538,
5418,
411,
25904,
13184,
23157,
13,
4706,
396,
960,
901,
1135,
29871,
29946,
9486,
4312,
304,
2062,
263,
2989,
4636,
13,
4706,
396,
383,
1901,
322,
923,
7202,
29892,
541,
3109,
13714,
313,
3425,
29878,
2454,
13184,
29897,
13,
4706,
396,
12074,
20312,
1135,
278,
937,
7348,
13,
4706,
28232,
29918,
353,
28232,
29889,
1493,
29898,
29885,
29892,
448,
29896,
29897,
13,
4706,
5094,
29918,
353,
5094,
29889,
1493,
29898,
29876,
29892,
448,
29896,
29897,
13,
4706,
28232,
29918,
12324,
353,
28232,
5396,
12248,
29898,
29906,
467,
2083,
29898,
6229,
10457,
29896,
29892,
3013,
6229,
29922,
5574,
29897,
13,
4706,
5094,
29918,
12324,
353,
5094,
5396,
12248,
29898,
29906,
467,
2083,
29898,
6229,
10457,
29896,
29892,
3013,
6229,
29922,
5574,
467,
3286,
4220,
6278,
29906,
29892,
448,
29896,
29897,
13,
4706,
620,
353,
28232,
29918,
12324,
718,
5094,
29918,
12324,
448,
29871,
29906,
334,
28232,
5396,
2922,
16109,
29898,
1270,
5396,
3286,
4220,
6278,
29906,
29892,
448,
29896,
876,
13,
13,
4706,
565,
28232,
29918,
1837,
29918,
1270,
29901,
13,
9651,
396,
22521,
545,
5225,
19640,
13,
9651,
7936,
29918,
12772,
353,
4842,
305,
29889,
279,
927,
29898,
29885,
29897,
13,
9651,
620,
29961,
6051,
351,
29918,
12772,
29892,
7936,
29918,
12772,
29962,
353,
29871,
29900,
13,
13,
4706,
396,
28933,
714,
8178,
1819,
13,
4706,
620,
29889,
695,
1160,
29918,
1195,
23538,
29900,
29897,
13,
4706,
565,
903,
12248,
29918,
15581,
29901,
13,
9651,
903,
12248,
29918,
15581,
29961,
29900,
29962,
353,
5852,
13,
4706,
1683,
29901,
13,
9651,
620,
353,
620,
29889,
3676,
580,
13,
1678,
1683,
29901,
13,
4706,
396,
29871,
17927,
29889,
8382,
703,
7856,
29883,
5101,
3538,
5418,
411,
1055,
573,
12672,
292,
23157,
13,
4706,
396,
5853,
19390,
448,
29871,
30546,
29898,
29876,
29985,
29906,
270,
511,
541,
4825,
1711,
901,
13714,
13,
4706,
28232,
29918,
353,
28232,
29889,
1493,
29898,
29885,
29892,
29871,
29896,
29892,
448,
29896,
29897,
13,
4706,
5094,
29918,
353,
5094,
29889,
1493,
29898,
29896,
29892,
302,
29892,
448,
29896,
29897,
13,
4706,
396,
22615,
947,
451,
2304,
12672,
292,
3447,
396,
29896,
29945,
29929,
29896,
29947,
322,
396,
29896,
29945,
29929,
29900,
29896,
13,
4706,
396,
29871,
620,
353,
383,
29889,
18784,
3538,
29918,
19244,
29898,
18904,
3383,
5094,
3383,
282,
29922,
29886,
29892,
321,
567,
29922,
29896,
29872,
29899,
29947,
29897,
13,
4706,
620,
353,
4842,
305,
29889,
12324,
29898,
18904,
29918,
448,
5094,
3383,
282,
29922,
29886,
29892,
3964,
10457,
29896,
29897,
13,
13,
1678,
736,
620,
13,
13,
13,
1753,
903,
18784,
3538,
29918,
12248,
29918,
5721,
29898,
18904,
29892,
5094,
29892,
282,
29922,
29906,
1125,
13,
1678,
4764,
29918,
15581,
353,
518,
8824,
29962,
13,
1678,
620,
353,
903,
18784,
3538,
29918,
5721,
29898,
18904,
29892,
5094,
29892,
282,
29922,
29886,
29892,
903,
12248,
29918,
15581,
29922,
12248,
29918,
15581,
29897,
13,
13,
1678,
565,
4764,
29918,
15581,
29961,
29900,
5387,
13,
4706,
736,
620,
13,
13,
1678,
736,
620,
29889,
12248,
29898,
29886,
29897,
13,
13,
13,
1753,
903,
18784,
3538,
29918,
6333,
29898,
18904,
29892,
5094,
1125,
13,
1678,
396,
14402,
10987,
263,
901,
3370,
8543,
982,
304,
437,
445,
13,
1678,
396,
1815,
282,
3637,
25350,
6776,
457,
29501,
367,
1304,
6060,
8773,
13,
1678,
286,
353,
28232,
29889,
2311,
29898,
29900,
29897,
13,
1678,
302,
353,
5094,
29889,
2311,
29898,
29900,
29897,
13,
1678,
28232,
29918,
353,
28232,
29889,
1493,
29898,
29885,
29892,
29871,
29896,
29892,
448,
29896,
29897,
13,
1678,
5094,
29918,
353,
5094,
29889,
1493,
29898,
29896,
29892,
302,
29892,
448,
29896,
29897,
13,
1678,
736,
28232,
5396,
16109,
29898,
1270,
29918,
467,
2083,
29898,
6229,
10457,
29896,
29897,
13,
13,
13,
13383,
13383,
13383,
13383,
13383,
13,
29937,
462,
308,
476,
5851,
6680,
897,
4951,
2187,
462,
3986,
396,
13,
13383,
13383,
13383,
13383,
13383,
13,
13,
13,
1990,
25513,
29968,
5851,
29898,
3318,
29892,
1539,
562,
605,
29922,
9118,
10873,
11285,
1542,
1125,
13,
1678,
732,
16595,
5696,
13,
1678,
822,
4770,
4804,
12035,
1311,
29892,
28232,
29892,
5094,
29892,
3579,
17460,
29918,
19290,
1125,
13,
4706,
1209,
13,
13,
13,
1990,
22477,
29898,
9118,
29968,
5851,
1125,
13,
1678,
822,
4770,
4804,
12035,
1311,
29892,
28232,
29892,
5094,
29892,
269,
2934,
29922,
29896,
1125,
13,
4706,
1060,
29979,
353,
903,
18784,
3538,
29918,
12248,
29918,
5721,
29898,
18904,
29892,
5094,
29897,
13,
4706,
736,
1060,
29979,
29889,
4563,
29918,
6278,
29871,
29906,
334,
269,
2934,
1068,
29906,
467,
4548,
29918,
580,
13,
13,
13,
1990,
20298,
433,
28445,
29898,
9118,
29968,
5851,
1125,
13,
1678,
822,
4770,
4804,
12035,
1311,
29892,
28232,
29892,
5094,
29892,
282,
29922,
29906,
29892,
269,
2934,
29922,
29896,
1125,
13,
4706,
1060,
29979,
353,
903,
18784,
3538,
29918,
5721,
29898,
18904,
29892,
5094,
29892,
282,
29922,
29886,
29897,
13,
4706,
736,
1060,
29979,
29889,
4563,
29918,
6278,
3754,
467,
4548,
29918,
580,
13,
13,
13,
1990,
12027,
29898,
9118,
29968,
5851,
1125,
13,
1678,
822,
4770,
4804,
12035,
1311,
29892,
28232,
29892,
5094,
29892,
269,
2934,
29922,
29896,
1125,
13,
4706,
1060,
29979,
353,
903,
18784,
3538,
29918,
6333,
29898,
18904,
29892,
5094,
29897,
13,
4706,
736,
1060,
29979,
29889,
4563,
23538,
3754,
467,
4548,
29918,
580,
13,
13,
13,
1990,
22985,
29898,
9118,
29968,
5851,
1125,
13,
1678,
822,
4770,
4804,
12035,
1311,
29892,
28232,
29892,
5094,
29892,
274,
29922,
29900,
1125,
13,
4706,
736,
903,
18784,
3538,
29918,
6333,
29898,
18904,
448,
274,
29892,
5094,
448,
274,
29897,
13,
13,
13,
1990,
21755,
29898,
9118,
29968,
5851,
1125,
13,
1678,
822,
4770,
4804,
12035,
1311,
29892,
28232,
29892,
5094,
29892,
263,
29922,
29896,
29892,
274,
29922,
29896,
29892,
270,
29922,
29906,
1125,
13,
4706,
1060,
29979,
353,
903,
18784,
3538,
29918,
6333,
29898,
18904,
29892,
5094,
29897,
13,
4706,
736,
1060,
29979,
29889,
16109,
23538,
29874,
467,
1202,
23538,
29883,
467,
12248,
23538,
29881,
29897,
13,
13,
13,
1990,
15066,
29882,
29898,
9118,
29968,
5851,
1125,
13,
1678,
822,
4770,
4804,
12035,
1311,
29892,
28232,
29892,
5094,
29892,
263,
29922,
29896,
29892,
274,
29922,
29900,
1125,
13,
4706,
1060,
29979,
353,
903,
18784,
3538,
29918,
6333,
29898,
18904,
29892,
5094,
29897,
13,
4706,
736,
1060,
29979,
29889,
16109,
23538,
29874,
467,
1202,
23538,
29883,
467,
13161,
29882,
29918,
580,
13,
13,
13,
1990,
22313,
29984,
29898,
9118,
29968,
5851,
1125,
13,
1678,
822,
4770,
4804,
12035,
1311,
29892,
28232,
29892,
5094,
29892,
274,
29922,
29896,
29892,
270,
29922,
29906,
29892,
269,
2934,
29922,
29896,
1125,
13,
4706,
1060,
29979,
353,
903,
18784,
3538,
29918,
12248,
29918,
5721,
29898,
18904,
29892,
5094,
29897,
13,
4706,
736,
1060,
29979,
29889,
4563,
23538,
3754,
1068,
29906,
467,
1202,
23538,
29883,
467,
12248,
29918,
6278,
29881,
847,
29871,
29906,
29897,
13,
13,
13,
1990,
476,
5851,
29898,
9118,
29968,
5851,
29892,
1539,
562,
605,
29922,
10873,
11285,
5126,
1125,
13,
1678,
364,
1635,
353,
6702,
29887,
17019,
742,
525,
4548,
742,
525,
6984,
433,
28445,
742,
525,
326,
29939,
1495,
13,
2
] |
allennlp/nn/parallel/__init__.py | MSLars/allennlp | 11,433 | 88956 | <filename>allennlp/nn/parallel/__init__.py
from allennlp.nn.parallel.sharded_module_mixin import ShardedModuleMixin
from allennlp.nn.parallel.ddp_accelerator import (
DdpAccelerator,
DdpWrappedModel,
TorchDdpAccelerator,
)
from allennlp.nn.parallel.fairscale_fsdp_accelerator import (
FairScaleFsdpAccelerator,
FairScaleFsdpWrappedModel,
)
| [
1,
529,
9507,
29958,
497,
2108,
22833,
29914,
15755,
29914,
23482,
29914,
1649,
2344,
26914,
2272,
13,
3166,
599,
2108,
22833,
29889,
15755,
29889,
23482,
29889,
845,
25600,
29918,
5453,
29918,
28084,
262,
1053,
1383,
25600,
7355,
29924,
861,
262,
13,
3166,
599,
2108,
22833,
29889,
15755,
29889,
23482,
29889,
1289,
29886,
29918,
562,
2242,
261,
1061,
1053,
313,
13,
1678,
360,
6099,
7504,
7367,
1061,
29892,
13,
1678,
360,
6099,
29956,
336,
2986,
3195,
29892,
13,
1678,
4794,
305,
29928,
6099,
7504,
7367,
1061,
29892,
13,
29897,
13,
3166,
599,
2108,
22833,
29889,
15755,
29889,
23482,
29889,
29888,
1466,
7052,
29918,
29888,
4928,
29886,
29918,
562,
2242,
261,
1061,
1053,
313,
13,
1678,
13822,
17185,
29943,
4928,
29886,
7504,
7367,
1061,
29892,
13,
1678,
13822,
17185,
29943,
4928,
29886,
29956,
336,
2986,
3195,
29892,
13,
29897,
13,
2
] |
aries_cloudcontroller/model/v10_credential_exchange.py | didx-xyz/aries-cloudcontroller-pyton | 5 | 150921 | <gh_stars>1-10
# coding: utf-8
from __future__ import annotations
from datetime import date, datetime # noqa: F401
import re # noqa: F401
from typing import Any, Dict, List, Optional, Union, Literal # noqa: F401
from pydantic import AnyUrl, BaseModel, EmailStr, validator, Field, Extra # noqa: F401
from aries_cloudcontroller.model.credential_offer import CredentialOffer
from aries_cloudcontroller.model.credential_proposal import CredentialProposal
from aries_cloudcontroller.model.indy_cred_abstract import IndyCredAbstract
from aries_cloudcontroller.model.indy_cred_info import IndyCredInfo
from aries_cloudcontroller.model.indy_cred_request import IndyCredRequest
from aries_cloudcontroller.model.indy_credential import IndyCredential
class V10CredentialExchange(BaseModel):
"""NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Do not edit the class manually.
V10CredentialExchange - a model defined in OpenAPI
auto_issue: Issuer choice to issue to request in this credential exchange [Optional].
auto_offer: Holder choice to accept offer in this credential exchange [Optional].
auto_remove: Issuer choice to remove this credential exchange record when complete [Optional].
connection_id: Connection identifier [Optional].
created_at: Time of record creation [Optional].
credential: Credential as stored [Optional].
credential_definition_id: Credential definition identifier [Optional].
credential_exchange_id: Credential exchange identifier [Optional].
credential_id: Credential identifier [Optional].
credential_offer: (Indy) credential offer [Optional].
credential_offer_dict: Credential offer message [Optional].
credential_proposal_dict: Credential proposal message [Optional].
credential_request: (Indy) credential request [Optional].
credential_request_metadata: (Indy) credential request metadata [Optional].
error_msg: Error message [Optional].
initiator: Issue-credential exchange initiator: self or external [Optional].
parent_thread_id: Parent thread identifier [Optional].
raw_credential: Credential as received, prior to storage in holder wallet [Optional].
revoc_reg_id: Revocation registry identifier [Optional].
revocation_id: Credential identifier within revocation registry [Optional].
role: Issue-credential exchange role: holder or issuer [Optional].
schema_id: Schema identifier [Optional].
state: Issue-credential exchange state [Optional].
thread_id: Thread identifier [Optional].
trace: Record trace information, based on agent configuration [Optional].
updated_at: Time of last record update [Optional].
"""
auto_issue: Optional[bool] = None
auto_offer: Optional[bool] = None
auto_remove: Optional[bool] = None
connection_id: Optional[str] = None
created_at: Optional[str] = None
credential: Optional[IndyCredInfo] = None
credential_definition_id: Optional[str] = None
credential_exchange_id: Optional[str] = None
credential_id: Optional[str] = None
credential_offer: Optional[IndyCredAbstract] = None
credential_offer_dict: Optional[CredentialOffer] = None
credential_proposal_dict: Optional[CredentialProposal] = None
credential_request: Optional[IndyCredRequest] = None
credential_request_metadata: Optional[Dict[str, Any]] = None
error_msg: Optional[str] = None
initiator: Optional[Literal["self", "external"]] = None
parent_thread_id: Optional[str] = None
raw_credential: Optional[IndyCredential] = None
revoc_reg_id: Optional[str] = None
revocation_id: Optional[str] = None
role: Optional[Literal["holder", "issuer"]] = None
schema_id: Optional[str] = None
state: Optional[str] = None
thread_id: Optional[str] = None
trace: Optional[bool] = None
updated_at: Optional[str] = None
def __init__(
self,
*,
auto_issue: Optional[bool] = None,
auto_offer: Optional[bool] = None,
auto_remove: Optional[bool] = None,
connection_id: Optional[str] = None,
created_at: Optional[str] = None,
credential: Optional[IndyCredInfo] = None,
credential_definition_id: Optional[str] = None,
credential_exchange_id: Optional[str] = None,
credential_id: Optional[str] = None,
credential_offer: Optional[IndyCredAbstract] = None,
credential_offer_dict: Optional[CredentialOffer] = None,
credential_proposal_dict: Optional[CredentialProposal] = None,
credential_request: Optional[IndyCredRequest] = None,
credential_request_metadata: Optional[Dict[str, Any]] = None,
error_msg: Optional[str] = None,
initiator: Optional[Literal["self", "external"]] = None,
parent_thread_id: Optional[str] = None,
raw_credential: Optional[IndyCredential] = None,
revoc_reg_id: Optional[str] = None,
revocation_id: Optional[str] = None,
role: Optional[Literal["holder", "issuer"]] = None,
schema_id: Optional[str] = None,
state: Optional[str] = None,
thread_id: Optional[str] = None,
trace: Optional[bool] = None,
updated_at: Optional[str] = None,
**kwargs,
):
super().__init__(
auto_issue=auto_issue,
auto_offer=auto_offer,
auto_remove=auto_remove,
connection_id=connection_id,
created_at=created_at,
credential=credential,
credential_definition_id=credential_definition_id,
credential_exchange_id=credential_exchange_id,
credential_id=credential_id,
credential_offer=credential_offer,
credential_offer_dict=credential_offer_dict,
credential_proposal_dict=credential_proposal_dict,
credential_request=credential_request,
credential_request_metadata=credential_request_metadata,
error_msg=error_msg,
initiator=initiator,
parent_thread_id=parent_thread_id,
raw_credential=raw_credential,
revoc_reg_id=revoc_reg_id,
revocation_id=revocation_id,
role=role,
schema_id=schema_id,
state=state,
thread_id=thread_id,
trace=trace,
updated_at=updated_at,
**kwargs,
)
@validator("created_at")
def created_at_pattern(cls, value):
# Property is optional
if value is None:
return
pattern = r"^\d{4}-\d\d-\d\d[T ]\d\d:\d\d(?:\:(?:\d\d(?:\.\d{1,6})?))?(?:[+-]\d\d:?\d\d|Z|)$"
if not re.match(pattern, value):
raise ValueError(
f"Value of created_at does not match regex pattern ('{pattern}')"
)
return value
@validator("credential_definition_id")
def credential_definition_id_pattern(cls, value):
# Property is optional
if value is None:
return
pattern = r"^([123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{21,22}):3:CL:(([1-9][0-9]*)|([123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{21,22}:2:.+:[0-9.]+)):(.+)?$"
if not re.match(pattern, value):
raise ValueError(
f"Value of credential_definition_id does not match regex pattern ('{pattern}')"
)
return value
@validator("schema_id")
def schema_id_pattern(cls, value):
# Property is optional
if value is None:
return
pattern = r"^[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{21,22}:2:.+:[0-9.]+$"
if not re.match(pattern, value):
raise ValueError(
f"Value of schema_id does not match regex pattern ('{pattern}')"
)
return value
@validator("updated_at")
def updated_at_pattern(cls, value):
# Property is optional
if value is None:
return
pattern = r"^\d{4}-\d\d-\d\d[T ]\d\d:\d\d(?:\:(?:\d\d(?:\.\d{1,6})?))?(?:[+-]\d\d:?\d\d|Z|)$"
if not re.match(pattern, value):
raise ValueError(
f"Value of updated_at does not match regex pattern ('{pattern}')"
)
return value
class Config:
allow_population_by_field_name = True
V10CredentialExchange.update_forward_refs()
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
29937,
14137,
29901,
23616,
29899,
29947,
13,
13,
3166,
4770,
29888,
9130,
1649,
1053,
25495,
13,
13,
3166,
12865,
1053,
2635,
29892,
12865,
29871,
396,
694,
25621,
29901,
383,
29946,
29900,
29896,
13,
13,
5215,
337,
29871,
396,
694,
25621,
29901,
383,
29946,
29900,
29896,
13,
3166,
19229,
1053,
3139,
29892,
360,
919,
29892,
2391,
29892,
28379,
29892,
7761,
29892,
5449,
284,
29871,
396,
694,
25621,
29901,
383,
29946,
29900,
29896,
13,
13,
3166,
282,
2941,
7716,
1053,
3139,
5983,
29892,
7399,
3195,
29892,
22608,
5015,
29892,
2854,
1061,
29892,
8989,
29892,
7338,
336,
29871,
396,
694,
25621,
29901,
383,
29946,
29900,
29896,
13,
3166,
263,
2722,
29918,
9274,
8299,
29889,
4299,
29889,
11944,
2556,
29918,
974,
571,
1053,
24596,
2556,
2776,
571,
13,
3166,
263,
2722,
29918,
9274,
8299,
29889,
4299,
29889,
11944,
2556,
29918,
771,
1066,
284,
1053,
24596,
2556,
1184,
1066,
284,
13,
3166,
263,
2722,
29918,
9274,
8299,
29889,
4299,
29889,
513,
29891,
29918,
11944,
29918,
16595,
1053,
1894,
29891,
15507,
9118,
13,
3166,
263,
2722,
29918,
9274,
8299,
29889,
4299,
29889,
513,
29891,
29918,
11944,
29918,
3888,
1053,
1894,
29891,
15507,
3401,
13,
3166,
263,
2722,
29918,
9274,
8299,
29889,
4299,
29889,
513,
29891,
29918,
11944,
29918,
3827,
1053,
1894,
29891,
15507,
3089,
13,
3166,
263,
2722,
29918,
9274,
8299,
29889,
4299,
29889,
513,
29891,
29918,
11944,
2556,
1053,
1894,
29891,
15507,
2556,
13,
13,
13,
1990,
478,
29896,
29900,
15507,
2556,
1252,
3167,
29898,
5160,
3195,
1125,
13,
1678,
9995,
12256,
29923,
29901,
910,
770,
338,
4469,
5759,
491,
4673,
8787,
3251,
1061,
313,
991,
597,
3150,
2754,
29899,
27959,
29889,
11345,
467,
13,
13,
1678,
1938,
451,
3863,
278,
770,
7522,
29889,
13,
13,
1678,
478,
29896,
29900,
15507,
2556,
1252,
3167,
448,
263,
1904,
3342,
297,
4673,
8787,
13,
4706,
4469,
29918,
15118,
29901,
16982,
2853,
7348,
304,
2228,
304,
2009,
297,
445,
6625,
2556,
14523,
518,
27636,
1822,
13,
4706,
4469,
29918,
974,
571,
29901,
379,
3194,
7348,
304,
3544,
5957,
297,
445,
6625,
2556,
14523,
518,
27636,
1822,
13,
4706,
4469,
29918,
5992,
29901,
16982,
2853,
7348,
304,
3349,
445,
6625,
2556,
14523,
2407,
746,
4866,
518,
27636,
1822,
13,
4706,
3957,
29918,
333,
29901,
15160,
15882,
518,
27636,
1822,
13,
4706,
2825,
29918,
271,
29901,
5974,
310,
2407,
11265,
518,
27636,
1822,
13,
4706,
6625,
2556,
29901,
24596,
2556,
408,
6087,
518,
27636,
1822,
13,
4706,
6625,
2556,
29918,
16553,
29918,
333,
29901,
24596,
2556,
5023,
15882,
518,
27636,
1822,
13,
4706,
6625,
2556,
29918,
6543,
29918,
333,
29901,
24596,
2556,
14523,
15882,
518,
27636,
1822,
13,
4706,
6625,
2556,
29918,
333,
29901,
24596,
2556,
15882,
518,
27636,
1822,
13,
4706,
6625,
2556,
29918,
974,
571,
29901,
313,
2568,
29891,
29897,
6625,
2556,
5957,
518,
27636,
1822,
13,
4706,
6625,
2556,
29918,
974,
571,
29918,
8977,
29901,
24596,
2556,
5957,
2643,
518,
27636,
1822,
13,
4706,
6625,
2556,
29918,
771,
1066,
284,
29918,
8977,
29901,
24596,
2556,
24963,
2643,
518,
27636,
1822,
13,
4706,
6625,
2556,
29918,
3827,
29901,
313,
2568,
29891,
29897,
6625,
2556,
2009,
518,
27636,
1822,
13,
4706,
6625,
2556,
29918,
3827,
29918,
19635,
29901,
313,
2568,
29891,
29897,
6625,
2556,
2009,
15562,
518,
27636,
1822,
13,
4706,
1059,
29918,
7645,
29901,
4829,
2643,
518,
27636,
1822,
13,
4706,
14511,
1061,
29901,
26246,
29899,
11944,
2556,
14523,
14511,
1061,
29901,
1583,
470,
7029,
518,
27636,
1822,
13,
4706,
3847,
29918,
7097,
29918,
333,
29901,
22280,
3244,
15882,
518,
27636,
1822,
13,
4706,
10650,
29918,
11944,
2556,
29901,
24596,
2556,
408,
4520,
29892,
7536,
304,
8635,
297,
19464,
17042,
1026,
518,
27636,
1822,
13,
4706,
6664,
542,
29918,
1727,
29918,
333,
29901,
11459,
10610,
21235,
15882,
518,
27636,
1822,
13,
4706,
6664,
10610,
29918,
333,
29901,
24596,
2556,
15882,
2629,
6664,
10610,
21235,
518,
27636,
1822,
13,
4706,
6297,
29901,
26246,
29899,
11944,
2556,
14523,
6297,
29901,
19464,
470,
1721,
2853,
518,
27636,
1822,
13,
4706,
10938,
29918,
333,
29901,
1102,
2603,
15882,
518,
27636,
1822,
13,
4706,
2106,
29901,
26246,
29899,
11944,
2556,
14523,
2106,
518,
27636,
1822,
13,
4706,
3244,
29918,
333,
29901,
10480,
15882,
518,
27636,
1822,
13,
4706,
9637,
29901,
14164,
9637,
2472,
29892,
2729,
373,
10823,
5285,
518,
27636,
1822,
13,
4706,
4784,
29918,
271,
29901,
5974,
310,
1833,
2407,
2767,
518,
27636,
1822,
13,
1678,
9995,
13,
13,
1678,
4469,
29918,
15118,
29901,
28379,
29961,
11227,
29962,
353,
6213,
13,
1678,
4469,
29918,
974,
571,
29901,
28379,
29961,
11227,
29962,
353,
6213,
13,
1678,
4469,
29918,
5992,
29901,
28379,
29961,
11227,
29962,
353,
6213,
13,
1678,
3957,
29918,
333,
29901,
28379,
29961,
710,
29962,
353,
6213,
13,
1678,
2825,
29918,
271,
29901,
28379,
29961,
710,
29962,
353,
6213,
13,
1678,
6625,
2556,
29901,
28379,
29961,
2568,
29891,
15507,
3401,
29962,
353,
6213,
13,
1678,
6625,
2556,
29918,
16553,
29918,
333,
29901,
28379,
29961,
710,
29962,
353,
6213,
13,
1678,
6625,
2556,
29918,
6543,
29918,
333,
29901,
28379,
29961,
710,
29962,
353,
6213,
13,
1678,
6625,
2556,
29918,
333,
29901,
28379,
29961,
710,
29962,
353,
6213,
13,
1678,
6625,
2556,
29918,
974,
571,
29901,
28379,
29961,
2568,
29891,
15507,
9118,
29962,
353,
6213,
13,
1678,
6625,
2556,
29918,
974,
571,
29918,
8977,
29901,
28379,
29961,
15507,
2556,
2776,
571,
29962,
353,
6213,
13,
1678,
6625,
2556,
29918,
771,
1066,
284,
29918,
8977,
29901,
28379,
29961,
15507,
2556,
1184,
1066,
284,
29962,
353,
6213,
13,
1678,
6625,
2556,
29918,
3827,
29901,
28379,
29961,
2568,
29891,
15507,
3089,
29962,
353,
6213,
13,
1678,
6625,
2556,
29918,
3827,
29918,
19635,
29901,
28379,
29961,
21533,
29961,
710,
29892,
3139,
5262,
353,
6213,
13,
1678,
1059,
29918,
7645,
29901,
28379,
29961,
710,
29962,
353,
6213,
13,
1678,
14511,
1061,
29901,
28379,
29961,
24938,
284,
3366,
1311,
613,
376,
23176,
3108,
29962,
353,
6213,
13,
1678,
3847,
29918,
7097,
29918,
333,
29901,
28379,
29961,
710,
29962,
353,
6213,
13,
1678,
10650,
29918,
11944,
2556,
29901,
28379,
29961,
2568,
29891,
15507,
2556,
29962,
353,
6213,
13,
1678,
6664,
542,
29918,
1727,
29918,
333,
29901,
28379,
29961,
710,
29962,
353,
6213,
13,
1678,
6664,
10610,
29918,
333,
29901,
28379,
29961,
710,
29962,
353,
6213,
13,
1678,
6297,
29901,
28379,
29961,
24938,
284,
3366,
7694,
613,
376,
790,
2853,
3108,
29962,
353,
6213,
13,
1678,
10938,
29918,
333,
29901,
28379,
29961,
710,
29962,
353,
6213,
13,
1678,
2106,
29901,
28379,
29961,
710,
29962,
353,
6213,
13,
1678,
3244,
29918,
333,
29901,
28379,
29961,
710,
29962,
353,
6213,
13,
1678,
9637,
29901,
28379,
29961,
11227,
29962,
353,
6213,
13,
1678,
4784,
29918,
271,
29901,
28379,
29961,
710,
29962,
353,
6213,
13,
13,
1678,
822,
4770,
2344,
12035,
13,
4706,
1583,
29892,
13,
4706,
334,
29892,
13,
4706,
4469,
29918,
15118,
29901,
28379,
29961,
11227,
29962,
353,
6213,
29892,
13,
4706,
4469,
29918,
974,
571,
29901,
28379,
29961,
11227,
29962,
353,
6213,
29892,
13,
4706,
4469,
29918,
5992,
29901,
28379,
29961,
11227,
29962,
353,
6213,
29892,
13,
4706,
3957,
29918,
333,
29901,
28379,
29961,
710,
29962,
353,
6213,
29892,
13,
4706,
2825,
29918,
271,
29901,
28379,
29961,
710,
29962,
353,
6213,
29892,
13,
4706,
6625,
2556,
29901,
28379,
29961,
2568,
29891,
15507,
3401,
29962,
353,
6213,
29892,
13,
4706,
6625,
2556,
29918,
16553,
29918,
333,
29901,
28379,
29961,
710,
29962,
353,
6213,
29892,
13,
4706,
6625,
2556,
29918,
6543,
29918,
333,
29901,
28379,
29961,
710,
29962,
353,
6213,
29892,
13,
4706,
6625,
2556,
29918,
333,
29901,
28379,
29961,
710,
29962,
353,
6213,
29892,
13,
4706,
6625,
2556,
29918,
974,
571,
29901,
28379,
29961,
2568,
29891,
15507,
9118,
29962,
353,
6213,
29892,
13,
4706,
6625,
2556,
29918,
974,
571,
29918,
8977,
29901,
28379,
29961,
15507,
2556,
2776,
571,
29962,
353,
6213,
29892,
13,
4706,
6625,
2556,
29918,
771,
1066,
284,
29918,
8977,
29901,
28379,
29961,
15507,
2556,
1184,
1066,
284,
29962,
353,
6213,
29892,
13,
4706,
6625,
2556,
29918,
3827,
29901,
28379,
29961,
2568,
29891,
15507,
3089,
29962,
353,
6213,
29892,
13,
4706,
6625,
2556,
29918,
3827,
29918,
19635,
29901,
28379,
29961,
21533,
29961,
710,
29892,
3139,
5262,
353,
6213,
29892,
13,
4706,
1059,
29918,
7645,
29901,
28379,
29961,
710,
29962,
353,
6213,
29892,
13,
4706,
14511,
1061,
29901,
28379,
29961,
24938,
284,
3366,
1311,
613,
376,
23176,
3108,
29962,
353,
6213,
29892,
13,
4706,
3847,
29918,
7097,
29918,
333,
29901,
28379,
29961,
710,
29962,
353,
6213,
29892,
13,
4706,
10650,
29918,
11944,
2556,
29901,
28379,
29961,
2568,
29891,
15507,
2556,
29962,
353,
6213,
29892,
13,
4706,
6664,
542,
29918,
1727,
29918,
333,
29901,
28379,
29961,
710,
29962,
353,
6213,
29892,
13,
4706,
6664,
10610,
29918,
333,
29901,
28379,
29961,
710,
29962,
353,
6213,
29892,
13,
4706,
6297,
29901,
28379,
29961,
24938,
284,
3366,
7694,
613,
376,
790,
2853,
3108,
29962,
353,
6213,
29892,
13,
4706,
10938,
29918,
333,
29901,
28379,
29961,
710,
29962,
353,
6213,
29892,
13,
4706,
2106,
29901,
28379,
29961,
710,
29962,
353,
6213,
29892,
13,
4706,
3244,
29918,
333,
29901,
28379,
29961,
710,
29962,
353,
6213,
29892,
13,
4706,
9637,
29901,
28379,
29961,
11227,
29962,
353,
6213,
29892,
13,
4706,
4784,
29918,
271,
29901,
28379,
29961,
710,
29962,
353,
6213,
29892,
13,
4706,
3579,
19290,
29892,
13,
268,
1125,
13,
4706,
2428,
2141,
1649,
2344,
12035,
13,
9651,
4469,
29918,
15118,
29922,
6921,
29918,
15118,
29892,
13,
9651,
4469,
29918,
974,
571,
29922,
6921,
29918,
974,
571,
29892,
13,
9651,
4469,
29918,
5992,
29922,
6921,
29918,
5992,
29892,
13,
9651,
3957,
29918,
333,
29922,
9965,
29918,
333,
29892,
13,
9651,
2825,
29918,
271,
29922,
11600,
29918,
271,
29892,
13,
9651,
6625,
2556,
29922,
11944,
2556,
29892,
13,
9651,
6625,
2556,
29918,
16553,
29918,
333,
29922,
11944,
2556,
29918,
16553,
29918,
333,
29892,
13,
9651,
6625,
2556,
29918,
6543,
29918,
333,
29922,
11944,
2556,
29918,
6543,
29918,
333,
29892,
13,
9651,
6625,
2556,
29918,
333,
29922,
11944,
2556,
29918,
333,
29892,
13,
9651,
6625,
2556,
29918,
974,
571,
29922,
11944,
2556,
29918,
974,
571,
29892,
13,
9651,
6625,
2556,
29918,
974,
571,
29918,
8977,
29922,
11944,
2556,
29918,
974,
571,
29918,
8977,
29892,
13,
9651,
6625,
2556,
29918,
771,
1066,
284,
29918,
8977,
29922,
11944,
2556,
29918,
771,
1066,
284,
29918,
8977,
29892,
13,
9651,
6625,
2556,
29918,
3827,
29922,
11944,
2556,
29918,
3827,
29892,
13,
9651,
6625,
2556,
29918,
3827,
29918,
19635,
29922,
11944,
2556,
29918,
3827,
29918,
19635,
29892,
13,
9651,
1059,
29918,
7645,
29922,
2704,
29918,
7645,
29892,
13,
9651,
14511,
1061,
29922,
2344,
29875,
1061,
29892,
13,
9651,
3847,
29918,
7097,
29918,
333,
29922,
3560,
29918,
7097,
29918,
333,
29892,
13,
9651,
10650,
29918,
11944,
2556,
29922,
1610,
29918,
11944,
2556,
29892,
13,
9651,
6664,
542,
29918,
1727,
29918,
333,
29922,
13478,
542,
29918,
1727,
29918,
333,
29892,
13,
9651,
6664,
10610,
29918,
333,
29922,
13478,
10610,
29918,
333,
29892,
13,
9651,
6297,
29922,
12154,
29892,
13,
9651,
10938,
29918,
333,
29922,
11010,
29918,
333,
29892,
13,
9651,
2106,
29922,
3859,
29892,
13,
9651,
3244,
29918,
333,
29922,
7097,
29918,
333,
29892,
13,
9651,
9637,
29922,
15003,
29892,
13,
9651,
4784,
29918,
271,
29922,
21402,
29918,
271,
29892,
13,
9651,
3579,
19290,
29892,
13,
4706,
1723,
13,
13,
1678,
732,
3084,
1061,
703,
11600,
29918,
271,
1159,
13,
1678,
822,
2825,
29918,
271,
29918,
11037,
29898,
25932,
29892,
995,
1125,
13,
4706,
396,
9079,
338,
13136,
13,
4706,
565,
995,
338,
6213,
29901,
13,
9651,
736,
13,
13,
4706,
4766,
353,
364,
29908,
3823,
29881,
29912,
29946,
12775,
29881,
29905,
29881,
2612,
29881,
29905,
29881,
29961,
29911,
4514,
29905,
29881,
29905,
29881,
3583,
29881,
29905,
29881,
10780,
3583,
5919,
29973,
3583,
29881,
29905,
29881,
10780,
3583,
7790,
29881,
29912,
29896,
29892,
29953,
1800,
29973,
876,
29973,
10780,
10834,
29974,
29899,
10725,
29881,
29905,
29881,
29901,
29973,
29905,
29881,
29905,
29881,
29989,
29999,
29989,
1262,
29908,
13,
4706,
565,
451,
337,
29889,
4352,
29898,
11037,
29892,
995,
1125,
13,
9651,
12020,
7865,
2392,
29898,
13,
18884,
285,
29908,
1917,
310,
2825,
29918,
271,
947,
451,
1993,
6528,
4766,
6702,
29912,
11037,
29913,
1495,
29908,
13,
9651,
1723,
13,
4706,
736,
995,
13,
13,
1678,
732,
3084,
1061,
703,
11944,
2556,
29918,
16553,
29918,
333,
1159,
13,
1678,
822,
6625,
2556,
29918,
16553,
29918,
333,
29918,
11037,
29898,
25932,
29892,
995,
1125,
13,
4706,
396,
9079,
338,
13136,
13,
4706,
565,
995,
338,
6213,
29901,
13,
9651,
736,
13,
13,
4706,
4766,
353,
364,
29908,
29985,
4197,
29896,
29906,
29941,
29946,
29945,
29953,
29955,
29947,
29929,
19658,
24405,
29954,
29950,
29967,
29968,
26369,
25500,
29984,
29934,
1254,
29965,
29963,
29956,
18454,
29999,
10736,
1753,
12443,
823,
8848,
29876,
459,
29939,
29878,
303,
4090,
29893,
20230,
3199,
29906,
29896,
29892,
29906,
29906,
29913,
1125,
29941,
29901,
6154,
29901,
3552,
29961,
29896,
29899,
29929,
3816,
29900,
29899,
29929,
29962,
7528,
29989,
4197,
29896,
29906,
29941,
29946,
29945,
29953,
29955,
29947,
29929,
19658,
24405,
29954,
29950,
29967,
29968,
26369,
25500,
29984,
29934,
1254,
29965,
29963,
29956,
18454,
29999,
10736,
1753,
12443,
823,
8848,
29876,
459,
29939,
29878,
303,
4090,
29893,
20230,
3199,
29906,
29896,
29892,
29906,
29906,
6177,
29906,
29901,
29889,
29974,
10834,
29900,
29899,
29929,
5586,
29974,
876,
5919,
29889,
29974,
6877,
29938,
29908,
13,
4706,
565,
451,
337,
29889,
4352,
29898,
11037,
29892,
995,
1125,
13,
9651,
12020,
7865,
2392,
29898,
13,
18884,
285,
29908,
1917,
310,
6625,
2556,
29918,
16553,
29918,
333,
947,
451,
1993,
6528,
4766,
6702,
29912,
11037,
29913,
1495,
29908,
13,
9651,
1723,
13,
4706,
736,
995,
13,
13,
1678,
732,
3084,
1061,
703,
11010,
29918,
333,
1159,
13,
1678,
822,
10938,
29918,
333,
29918,
11037,
29898,
25932,
29892,
995,
1125,
13,
4706,
396,
9079,
338,
13136,
13,
4706,
565,
995,
338,
6213,
29901,
13,
9651,
736,
13,
13,
4706,
4766,
353,
364,
29908,
29985,
29961,
29896,
29906,
29941,
29946,
29945,
29953,
29955,
29947,
29929,
19658,
24405,
29954,
29950,
29967,
29968,
26369,
25500,
29984,
29934,
1254,
29965,
29963,
29956,
18454,
29999,
10736,
1753,
12443,
823,
8848,
29876,
459,
29939,
29878,
303,
4090,
29893,
20230,
3199,
29906,
29896,
29892,
29906,
29906,
6177,
29906,
29901,
29889,
29974,
10834,
29900,
29899,
29929,
5586,
24035,
29908,
13,
4706,
565,
451,
337,
29889,
4352,
29898,
11037,
29892,
995,
1125,
13,
9651,
12020,
7865,
2392,
29898,
13,
18884,
285,
29908,
1917,
310,
10938,
29918,
333,
947,
451,
1993,
6528,
4766,
6702,
29912,
11037,
29913,
1495,
29908,
13,
9651,
1723,
13,
4706,
736,
995,
13,
13,
1678,
732,
3084,
1061,
703,
21402,
29918,
271,
1159,
13,
1678,
822,
4784,
29918,
271,
29918,
11037,
29898,
25932,
29892,
995,
1125,
13,
4706,
396,
9079,
338,
13136,
13,
4706,
565,
995,
338,
6213,
29901,
13,
9651,
736,
13,
13,
4706,
4766,
353,
364,
29908,
3823,
29881,
29912,
29946,
12775,
29881,
29905,
29881,
2612,
29881,
29905,
29881,
29961,
29911,
4514,
29905,
29881,
29905,
29881,
3583,
29881,
29905,
29881,
10780,
3583,
5919,
29973,
3583,
29881,
29905,
29881,
10780,
3583,
7790,
29881,
29912,
29896,
29892,
29953,
1800,
29973,
876,
29973,
10780,
10834,
29974,
29899,
10725,
29881,
29905,
29881,
29901,
29973,
29905,
29881,
29905,
29881,
29989,
29999,
29989,
1262,
29908,
13,
4706,
565,
451,
337,
29889,
4352,
29898,
11037,
29892,
995,
1125,
13,
9651,
12020,
7865,
2392,
29898,
13,
18884,
285,
29908,
1917,
310,
4784,
29918,
271,
947,
451,
1993,
6528,
4766,
6702,
29912,
11037,
29913,
1495,
29908,
13,
9651,
1723,
13,
4706,
736,
995,
13,
13,
1678,
770,
12782,
29901,
13,
4706,
2758,
29918,
7323,
2785,
29918,
1609,
29918,
2671,
29918,
978,
353,
5852,
13,
13,
13,
29963,
29896,
29900,
15507,
2556,
1252,
3167,
29889,
5504,
29918,
11333,
29918,
24539,
580,
13,
2
] |
python/TrackExtrapolateTool.py | Plamenna/proba | 0 | 178466 | import ROOT
import shipunit as u
minNdf = 20
parallelToZ = ROOT.TVector3(0., 0., 1.)
top = ROOT.gGeoManager.GetTopVolume()
z_ecal = top.GetNode('Ecal_1').GetMatrix().GetTranslation()[2]
def extrapolateToPlane(fT,z):
# etrapolate to a plane perpendicular to beam direction (z)
rc,pos,mom = False,None,None
fst = fT.getFitStatus()
if fst.isFitConverged() and fst.getNdf() > minNdf:
fstate0,fstate1 = fT.getFittedState(0),fT.getFittedState(1)
fPos0,fPos1 = fstate0.getPos(),fstate1.getPos()
if abs(z-fPos0.z()) < abs(z-fPos1.z()): fstate = fstate0
else: fstate = fstate1
zs = min(z,z_ecal)
NewPosition = ROOT.TVector3(0., 0., zs)
rep = ROOT.genfit.RKTrackRep(13*cmp(fstate.getPDG(),0) )
state = ROOT.genfit.StateOnPlane(rep)
pos,mom = fstate.getPos(),fstate.getMom()
rep.setPosMom(state,pos,mom)
try:
rep.extrapolateToPlane(state, NewPosition, parallelToZ )
pos,mom = state.getPos(),state.getMom()
rc = True
except:
print 'error with extrapolation: z=',z/u.m,'m'
if not rc or z>z_ecal:
# use linear extrapolation
px,py,pz = mom.X(),mom.Y(),mom.Z()
lam = (z-pos.Z())/pz
pos = ROOT.TVector3( pos.X()+lam*px, pos.Y()+lam*py, z )
return rc,pos,mom
| [
1,
1053,
16641,
2891,
13,
5215,
7751,
5441,
408,
318,
13,
13,
1195,
29940,
2176,
353,
29871,
29906,
29900,
13,
23482,
1762,
29999,
353,
16641,
2891,
29889,
8050,
3019,
29941,
29898,
29900,
1696,
29871,
29900,
1696,
29871,
29896,
1846,
29871,
13,
3332,
353,
16641,
2891,
29889,
29887,
7999,
29877,
3260,
29889,
2577,
7031,
24679,
580,
13,
29920,
29918,
687,
284,
353,
2246,
29889,
2577,
4247,
877,
29923,
1052,
29918,
29896,
2824,
2577,
14609,
2141,
2577,
4300,
18411,
580,
29961,
29906,
29962,
13,
13,
1753,
1294,
2390,
23167,
1762,
3247,
1662,
29898,
29888,
29911,
29892,
29920,
1125,
13,
29937,
634,
2390,
23167,
304,
263,
10694,
639,
14081,
16311,
304,
22913,
5305,
313,
29920,
29897,
13,
29871,
364,
29883,
29892,
1066,
29892,
29885,
290,
353,
7700,
29892,
8516,
29892,
8516,
13,
29871,
285,
303,
353,
285,
29911,
29889,
657,
29943,
277,
5709,
580,
13,
29871,
565,
285,
303,
29889,
275,
29943,
277,
1168,
369,
3192,
580,
322,
285,
303,
29889,
657,
29940,
2176,
580,
1405,
1375,
29940,
2176,
29901,
13,
259,
285,
3859,
29900,
29892,
29888,
3859,
29896,
353,
285,
29911,
29889,
657,
29943,
4430,
2792,
29898,
29900,
511,
29888,
29911,
29889,
657,
29943,
4430,
2792,
29898,
29896,
29897,
29871,
13,
259,
285,
9135,
29900,
29892,
29888,
9135,
29896,
268,
353,
285,
3859,
29900,
29889,
657,
9135,
3285,
29888,
3859,
29896,
29889,
657,
9135,
580,
13,
259,
565,
6425,
29898,
29920,
29899,
29888,
9135,
29900,
29889,
29920,
3101,
529,
29871,
6425,
29898,
29920,
29899,
29888,
9135,
29896,
29889,
29920,
580,
1125,
285,
3859,
353,
285,
3859,
29900,
13,
259,
1683,
29901,
462,
462,
1678,
285,
3859,
353,
285,
3859,
29896,
13,
259,
503,
29879,
353,
1375,
29898,
29920,
29892,
29920,
29918,
687,
284,
29897,
13,
259,
1570,
8003,
353,
16641,
2891,
29889,
8050,
3019,
29941,
29898,
29900,
1696,
29871,
29900,
1696,
503,
29879,
29897,
29871,
13,
259,
1634,
1678,
353,
16641,
2891,
29889,
1885,
9202,
29889,
29934,
29968,
17936,
5612,
29898,
29896,
29941,
29930,
21058,
29898,
29888,
3859,
29889,
657,
25014,
29954,
3285,
29900,
29897,
1723,
29871,
13,
259,
2106,
29871,
353,
16641,
2891,
29889,
1885,
9202,
29889,
2792,
2951,
3247,
1662,
29898,
3445,
29897,
29871,
13,
259,
926,
29892,
29885,
290,
353,
285,
3859,
29889,
657,
9135,
3285,
29888,
3859,
29889,
657,
29924,
290,
580,
13,
259,
1634,
29889,
842,
9135,
29924,
290,
29898,
3859,
29892,
1066,
29892,
29885,
290,
29897,
29871,
13,
259,
1018,
29901,
268,
13,
268,
1634,
29889,
1062,
2390,
23167,
1762,
3247,
1662,
29898,
3859,
29892,
1570,
8003,
29892,
8943,
1762,
29999,
1723,
13,
268,
926,
29892,
29885,
290,
353,
2106,
29889,
657,
9135,
3285,
3859,
29889,
657,
29924,
290,
580,
13,
268,
364,
29883,
353,
5852,
29871,
13,
259,
5174,
29901,
29871,
13,
268,
1596,
525,
2704,
411,
1294,
2390,
22671,
29901,
503,
29922,
742,
29920,
29914,
29884,
29889,
29885,
5501,
29885,
29915,
13,
259,
565,
451,
364,
29883,
470,
503,
29958,
29920,
29918,
687,
284,
29901,
13,
268,
396,
671,
5608,
1294,
2390,
22671,
13,
268,
282,
29916,
29892,
2272,
29892,
29886,
29920,
29871,
353,
16823,
29889,
29990,
3285,
29885,
290,
29889,
29979,
3285,
29885,
290,
29889,
29999,
580,
13,
268,
301,
314,
353,
313,
29920,
29899,
1066,
29889,
29999,
3101,
29914,
29886,
29920,
13,
268,
926,
353,
16641,
2891,
29889,
8050,
3019,
29941,
29898,
926,
29889,
29990,
580,
29974,
5288,
29930,
1756,
29892,
926,
29889,
29979,
580,
29974,
5288,
29930,
2272,
29892,
503,
1723,
13,
29871,
736,
364,
29883,
29892,
1066,
29892,
29885,
290,
13,
2
] |
src/hydra_zen/experimental/_implementations.py | rlbellaire/hydra-zen | 0 | 165891 | # Copyright (c) 2021 Massachusetts Institute of Technology
# SPDX-License-Identifier: MIT
from pathlib import Path
from typing import Any, Callable, List, Mapping, Optional, Union
from hydra._internal.callbacks import Callbacks
from hydra._internal.hydra import Hydra
from hydra._internal.utils import create_config_search_path
from hydra.core.config_store import ConfigStore
from hydra.core.global_hydra import GlobalHydra
from hydra.core.utils import JobReturn
from hydra.plugins.sweeper import Sweeper
from hydra.types import HydraContext, RunMode
from omegaconf import DictConfig, OmegaConf
from .._hydra_overloads import instantiate
from ..typing import DataClass
def _store_config(
cfg: Union[DataClass, DictConfig, Mapping], config_name: str = "hydra_launch"
) -> str:
"""Stores configuration object in Hydra's ConfigStore.
Parameters
----------
cfg: Union[DataClass, DictConfig, Mapping]
A configuration as a dataclass, configuration object, or a dictionary.
config_name: str (default: hydra_launch)
The configuration name used to store the configuration.
Returns
-------
config_name: str
The configuration name used to store the default configuration.
Notes
-----
The input configuration is registered in the Hydra ConfigStore [1]_ using a
user-provided config name.
References
----------
.. [1] https://hydra.cc/docs/tutorials/structured_config/config_store
"""
cs = ConfigStore().instance()
cs.store(name=config_name, node=cfg)
return config_name
def hydra_run(
config: Union[DataClass, DictConfig, Mapping],
task_function: Callable[[DictConfig], Any],
overrides: Optional[List[str]] = None,
config_dir: Optional[Union[str, Path]] = None,
config_name: str = "hydra_run",
job_name: str = "hydra_run",
with_log_configuration: bool = True,
) -> JobReturn:
"""Launch a Hydra job defined by `task_function` using the configuration
provided in `config`.
Similar to how Hydra CLI works, `overrides` are a string list of configuration
values to use for a given experiment run. For example, the Hydra CLI provided by::
$ python -m job.task_function job/group=group_name job.group.param=1
would be::
>>> job = hydra_run(config, task_function, overrides=["job/group=group_name", "job.group.param=1"])
This functions executes Hydra and therefore creates its own working directory. See Configuring Hydra [2]_ for more
details on customizing Hydra.
Parameters
----------
config: Union[DataClass, DictConfig, Mapping]
A configuration as a dataclass, configuration object, or a dictionary.
task_function: Callable[[DictConfig], Any]
The function Hydra will execute with the given configuration.
overrides: Optional[List[str]] (default: None)
If provided, overrides default configurations, see [1]_ and [2]_.
config_dir: Optional[Union[str, Path]] (default: None)
Add configuration directories if needed.
config_name: str (default: "hydra_run")
Name of the stored configuration in Hydra's ConfigStore API.
job_name: str (default: "hydra_run")
with_log_configuration: bool (default: True)
Flag to configure logging subsystem from the loaded config
Returns
-------
result: JobReturn
The object storing the results of the Hydra experiment.
- overrides: From `overrides` and `multirun_overrides`
- return_value: The return value of the task function
- cfg: The configuration object sent to the task function
- hydra_cfg: The hydra configuration object
- working_dir: The experiment working directory
- task_name: The task name of the Hydra job
References
----------
.. [1] https://hydra.cc/docs/next/advanced/override_grammar/basic
.. [2] https://hydra.cc/docs/next/configure_hydra/intro
Examples
--------
Simple Hydra run:
>>> from hydra_zen import instantiate, builds
>>> from hydra_zen.experimental import hydra_run
>>> job = hydra_run(builds(dict, a=1, b=1), task_function=instantiate)
>>> job.return_value
{'a': 1, 'b': 1}
Using a more complex task function:
>>> from hydra_zen.experimental import hydra_run
>>> from hydra_zen import builds, instantiate
>>> cfg = dict(f=builds(pow, exp=2, hydra_partial=True), x=10)
>>> def task_function(cfg):
... return instantiate(cfg.f)(cfg.x)
Launch a job to evaluate the function using the given configuration:
>>> job = hydra_run(cfg, task_function)
>>> job.return_value
100
An example using PyTorch:
>>> from torch.optim import Adam
>>> from torch.nn import Linear
>>> AdamConfig = builds(Adam, lr=0.001, hydra_partial=True)
>>> ModelConfig = builds(Linear, in_features=1, out_features=1)
>>> cfg = dict(optim=AdamConfig(), model=ModelConfig())
>>> def task_function(cfg):
... cfg = instantiate(cfg)
... optim = cfg.optim(model.parameters())
... loss = cfg.model(torch.ones(1)).mean()
... optim.zero_grad()
... loss.backward()
... optim.step()
... return loss.item()
>>> jobs = hydra_run(cfg, task_function, overrides=["optim.lr=0.1"])
>>> j.return_value
0.3054758310317993
"""
config_name = _store_config(config, config_name)
if config_dir is not None:
config_dir = str(Path(config_dir).absolute())
search_path = create_config_search_path(config_dir)
hydra = Hydra.create_main_hydra2(task_name=job_name, config_search_path=search_path)
try:
job = hydra.run(
config_name=config_name,
task_function=task_function,
overrides=overrides if overrides is not None else [],
with_log_configuration=with_log_configuration,
)
finally:
GlobalHydra.instance().clear()
return job
def hydra_multirun(
config: Union[DataClass, DictConfig, Mapping],
task_function: Callable[[DictConfig], Any],
overrides: Optional[List[str]] = None,
config_dir: Optional[Union[str, Path]] = None,
config_name: str = "hydra_multirun",
job_name: str = "hydra_multirun",
with_log_configuration: bool = True,
) -> Any:
"""Launch a Hydra multi-run ([1]_) job defined by `task_function` using the configuration
provided in `config`.
Similar to how Hydra CLI works, `overrides` are a string list of configuration
values to use for a given experiment run. For example, the Hydra CLI provided by::
$ python -m job.task_function job/group=group_name job.group.param=1 --multirun
would be::
>>> job = hydra_multirun(config, task_function, overrides=["job/group=group_name", "job.group.param=1"])
To sweep over parameters the Hydra CLI provided by::
$ python -m job.task_function job/group=group_name job.group.param=1,2,3 --multirun
would be::
>>> job = hydra_multirun(config, task_function, overrides=["job/group=group_name", "job.group.param=1,2,3"])
This functions executes Hydra and therefore creates its own working directory. See Configuring Hydra [3]_ for more
details on customizing Hydra.
Parameters
----------
config: Union[DataClass, DictConfig]
A configuration as a dataclass, configuration object, or a dictionary.
task_function: Callable[[DictConfig], Any]
The function Hydra will execute with the given configuration.
overrides: Optional[List[str]] (default: None)
If provided, overrides default configurations, see [2]_ and [3]_.
config_dir: Optional[Union[str, Path]] (default: None)
Add configuration directories if needed.
config_name: str (default: "hydra_run")
Name of the stored configuration in Hydra's ConfigStore API.
job_name: str (default: "hydra_multirun")
with_log_configuration: bool (default: True)
Flag to configure logging subsystem from the loaded config
Returns
-------
result: Any
The return values of all launched jobs (depends on the Sweeper implementation).
References
----------
.. [1] https://hydra.cc/docs/tutorials/basic/running_your_app/multi-run
.. [2] https://hydra.cc/docs/next/advanced/override_grammar/basic
.. [3] https://hydra.cc/docs/next/configure_hydra/intro
Examples
--------
Simple Hydra multirun:
>>> job = hydra_multirun(
... builds(dict, a=1, b=1),
... task_function=instantiate,
... overrides=["a=1,2"],
... )
>>> [j.return_value for j in job[0]]
[{'a': 1, 'b': 1}, {'a': 2, 'b': 1}]
Using a more complex `task_function`
>>> from hydra_zen import builds, instantiate
>>> cfg = dict(f=builds(pow, exp=2, hydra_partial=True), x=1)
>>> def task_function(cfg):
... return instantiate(cfg.f)(cfg.x)
Launch a multi-run over a list of different `x` values using Hydra's override syntax `range`:
>>> jobs = hydra_multirun(cfg, task_function, overrides=["x=range(-2,3)"])
>>> [j.return_value for j in jobs[0]]
[4, 1, 0, 1, 4]
An example using PyTorch
>>> from torch.optim import Adam
>>> from torch.nn import Linear
>>> AdamConfig = builds(Adam, lr=0.001, hydra_partial=True)
>>> ModelConfig = builds(Linear, in_features=1, out_features=1)
>>> cfg = dict(optim=AdamConfig(), model=ModelConfig())
>>> def task_function(cfg):
... cfg = instantiate(cfg)
... optim = cfg.optim(model.parameters())
... loss = cfg.model(torch.ones(1)).mean()
... optim.zero_grad()
... loss.backward()
... optim.step()
... return loss.item()
Evaluate the function for different learning rates
>>> jobs = hydra_multirun(cfg, task_function, overrides=["optim.lr=0.1,1.0"])
>>> [j.return_value for j in jobs[0]]
[0.3054758310317993, 0.28910207748413086]
"""
config_name = _store_config(config, config_name)
if config_dir is not None:
config_dir = str(Path(config_dir).absolute())
search_path = create_config_search_path(config_dir)
hydra = Hydra.create_main_hydra2(task_name=job_name, config_search_path=search_path)
try:
cfg = hydra.compose_config(
config_name=config_name,
overrides=overrides if overrides is not None else [],
with_log_configuration=with_log_configuration,
run_mode=RunMode.MULTIRUN,
)
callbacks = Callbacks(cfg)
callbacks.on_multirun_start(config=cfg, config_name=config_name)
# Instantiate sweeper without using Hydra's Plugin discovery (Zen!)
sweeper = instantiate(cfg.hydra.sweeper)
assert isinstance(sweeper, Sweeper)
sweeper.setup(
config=cfg,
hydra_context=HydraContext(
config_loader=hydra.config_loader, callbacks=callbacks
),
task_function=task_function,
)
task_overrides = OmegaConf.to_container(cfg.hydra.overrides.task, resolve=False)
assert isinstance(task_overrides, list)
job = sweeper.sweep(arguments=task_overrides)
callbacks.on_multirun_end(config=cfg, config_name=config_name)
finally:
GlobalHydra.instance().clear()
return job
| [
1,
396,
14187,
1266,
313,
29883,
29897,
29871,
29906,
29900,
29906,
29896,
16167,
8907,
310,
17968,
13,
29937,
10937,
29928,
29990,
29899,
29931,
293,
1947,
29899,
12889,
29901,
341,
1806,
13,
3166,
2224,
1982,
1053,
10802,
13,
3166,
19229,
1053,
3139,
29892,
8251,
519,
29892,
2391,
29892,
341,
20304,
29892,
28379,
29892,
7761,
13,
13,
3166,
27246,
336,
3032,
7564,
29889,
14035,
29879,
1053,
8251,
1627,
29879,
13,
3166,
27246,
336,
3032,
7564,
29889,
29882,
2941,
336,
1053,
379,
2941,
336,
13,
3166,
27246,
336,
3032,
7564,
29889,
13239,
1053,
1653,
29918,
2917,
29918,
4478,
29918,
2084,
13,
3166,
27246,
336,
29889,
3221,
29889,
2917,
29918,
8899,
1053,
12782,
9044,
13,
3166,
27246,
336,
29889,
3221,
29889,
10945,
29918,
29882,
2941,
336,
1053,
12002,
29950,
2941,
336,
13,
3166,
27246,
336,
29889,
3221,
29889,
13239,
1053,
17163,
11609,
13,
3166,
27246,
336,
29889,
12800,
29889,
29879,
705,
11356,
1053,
317,
705,
11356,
13,
3166,
27246,
336,
29889,
8768,
1053,
379,
2941,
336,
2677,
29892,
7525,
6818,
13,
3166,
2703,
2442,
5527,
1053,
360,
919,
3991,
29892,
13352,
2442,
16376,
13,
13,
3166,
6317,
29918,
29882,
2941,
336,
29918,
957,
18132,
1053,
25112,
13,
3166,
6317,
1017,
15702,
1053,
3630,
2385,
13,
13,
13,
1753,
903,
8899,
29918,
2917,
29898,
13,
1678,
274,
16434,
29901,
7761,
29961,
1469,
2385,
29892,
360,
919,
3991,
29892,
341,
20304,
1402,
2295,
29918,
978,
29901,
851,
353,
376,
29882,
2941,
336,
29918,
15343,
29908,
13,
29897,
1599,
851,
29901,
13,
1678,
9995,
855,
2361,
5285,
1203,
297,
379,
2941,
336,
29915,
29879,
12782,
9044,
29889,
13,
13,
1678,
12662,
2699,
13,
1678,
448,
1378,
29899,
13,
1678,
274,
16434,
29901,
7761,
29961,
1469,
2385,
29892,
360,
919,
3991,
29892,
341,
20304,
29962,
13,
4706,
319,
5285,
408,
263,
848,
1990,
29892,
5285,
1203,
29892,
470,
263,
8600,
29889,
13,
13,
1678,
2295,
29918,
978,
29901,
851,
313,
4381,
29901,
27246,
336,
29918,
15343,
29897,
13,
4706,
450,
5285,
1024,
1304,
304,
3787,
278,
5285,
29889,
13,
13,
1678,
16969,
13,
1678,
448,
22158,
13,
1678,
2295,
29918,
978,
29901,
851,
13,
4706,
450,
5285,
1024,
1304,
304,
3787,
278,
2322,
5285,
29889,
13,
13,
1678,
8695,
13,
1678,
448,
807,
13,
1678,
450,
1881,
5285,
338,
15443,
297,
278,
379,
2941,
336,
12782,
9044,
518,
29896,
21540,
773,
263,
13,
1678,
1404,
29899,
16123,
2618,
2295,
1024,
29889,
13,
13,
1678,
28318,
13,
1678,
448,
1378,
29899,
13,
1678,
6317,
518,
29896,
29962,
2045,
597,
29882,
2941,
336,
29889,
617,
29914,
2640,
29914,
12631,
29879,
29914,
4984,
2955,
29918,
2917,
29914,
2917,
29918,
8899,
13,
1678,
9995,
13,
1678,
5939,
353,
12782,
9044,
2141,
8758,
580,
13,
1678,
5939,
29889,
8899,
29898,
978,
29922,
2917,
29918,
978,
29892,
2943,
29922,
16859,
29897,
13,
1678,
736,
2295,
29918,
978,
13,
13,
13,
1753,
27246,
336,
29918,
3389,
29898,
13,
1678,
2295,
29901,
7761,
29961,
1469,
2385,
29892,
360,
919,
3991,
29892,
341,
20304,
1402,
13,
1678,
3414,
29918,
2220,
29901,
8251,
519,
8999,
21533,
3991,
1402,
3139,
1402,
13,
1678,
975,
24040,
29901,
28379,
29961,
1293,
29961,
710,
5262,
353,
6213,
29892,
13,
1678,
2295,
29918,
3972,
29901,
28379,
29961,
19986,
29961,
710,
29892,
10802,
5262,
353,
6213,
29892,
13,
1678,
2295,
29918,
978,
29901,
851,
353,
376,
29882,
2941,
336,
29918,
3389,
613,
13,
1678,
4982,
29918,
978,
29901,
851,
353,
376,
29882,
2941,
336,
29918,
3389,
613,
13,
1678,
411,
29918,
1188,
29918,
13305,
29901,
6120,
353,
5852,
29892,
13,
29897,
1599,
17163,
11609,
29901,
13,
1678,
9995,
17641,
263,
379,
2941,
336,
4982,
3342,
491,
421,
7662,
29918,
2220,
29952,
773,
278,
5285,
13,
1678,
4944,
297,
421,
2917,
1412,
13,
13,
1678,
13999,
304,
920,
379,
2941,
336,
24492,
1736,
29892,
421,
957,
24040,
29952,
526,
263,
1347,
1051,
310,
5285,
13,
1678,
1819,
304,
671,
363,
263,
2183,
7639,
1065,
29889,
29871,
1152,
1342,
29892,
278,
379,
2941,
336,
24492,
4944,
491,
1057,
13,
13,
539,
395,
3017,
448,
29885,
4982,
29889,
7662,
29918,
2220,
4982,
29914,
2972,
29922,
2972,
29918,
978,
4982,
29889,
2972,
29889,
3207,
29922,
29896,
13,
13,
1678,
723,
367,
1057,
13,
13,
539,
8653,
4982,
353,
27246,
336,
29918,
3389,
29898,
2917,
29892,
3414,
29918,
2220,
29892,
975,
24040,
29922,
3366,
9057,
29914,
2972,
29922,
2972,
29918,
978,
613,
376,
9057,
29889,
2972,
29889,
3207,
29922,
29896,
20068,
13,
13,
1678,
910,
3168,
24138,
379,
2941,
336,
322,
5480,
10017,
967,
1914,
1985,
3884,
29889,
29871,
2823,
12782,
3864,
379,
2941,
336,
518,
29906,
21540,
363,
901,
13,
1678,
4902,
373,
2888,
5281,
379,
2941,
336,
29889,
13,
13,
1678,
12662,
2699,
13,
1678,
448,
1378,
29899,
13,
1678,
2295,
29901,
7761,
29961,
1469,
2385,
29892,
360,
919,
3991,
29892,
341,
20304,
29962,
13,
4706,
319,
5285,
408,
263,
848,
1990,
29892,
5285,
1203,
29892,
470,
263,
8600,
29889,
13,
13,
1678,
3414,
29918,
2220,
29901,
8251,
519,
8999,
21533,
3991,
1402,
3139,
29962,
13,
4706,
450,
740,
379,
2941,
336,
674,
6222,
411,
278,
2183,
5285,
29889,
13,
13,
1678,
975,
24040,
29901,
28379,
29961,
1293,
29961,
710,
5262,
313,
4381,
29901,
6213,
29897,
13,
4706,
960,
4944,
29892,
975,
24040,
2322,
22920,
29892,
1074,
518,
29896,
21540,
322,
518,
29906,
29962,
5396,
13,
13,
1678,
2295,
29918,
3972,
29901,
28379,
29961,
19986,
29961,
710,
29892,
10802,
5262,
313,
4381,
29901,
6213,
29897,
13,
4706,
3462,
5285,
17525,
565,
4312,
29889,
13,
13,
1678,
2295,
29918,
978,
29901,
851,
313,
4381,
29901,
376,
29882,
2941,
336,
29918,
3389,
1159,
13,
4706,
4408,
310,
278,
6087,
5285,
297,
379,
2941,
336,
29915,
29879,
12782,
9044,
3450,
29889,
13,
13,
1678,
4982,
29918,
978,
29901,
851,
313,
4381,
29901,
376,
29882,
2941,
336,
29918,
3389,
1159,
13,
13,
1678,
411,
29918,
1188,
29918,
13305,
29901,
6120,
313,
4381,
29901,
5852,
29897,
13,
4706,
28697,
304,
10822,
12183,
1014,
5205,
515,
278,
7500,
2295,
13,
13,
1678,
16969,
13,
1678,
448,
22158,
13,
1678,
1121,
29901,
17163,
11609,
13,
4706,
450,
1203,
15446,
278,
2582,
310,
278,
379,
2941,
336,
7639,
29889,
13,
9651,
448,
975,
24040,
29901,
3645,
421,
957,
24040,
29952,
322,
421,
4713,
381,
348,
29918,
957,
24040,
29952,
13,
9651,
448,
736,
29918,
1767,
29901,
450,
736,
995,
310,
278,
3414,
740,
13,
9651,
448,
274,
16434,
29901,
450,
5285,
1203,
2665,
304,
278,
3414,
740,
13,
9651,
448,
27246,
336,
29918,
16859,
29901,
450,
27246,
336,
5285,
1203,
13,
9651,
448,
1985,
29918,
3972,
29901,
450,
7639,
1985,
3884,
13,
9651,
448,
3414,
29918,
978,
29901,
450,
3414,
1024,
310,
278,
379,
2941,
336,
4982,
13,
13,
1678,
28318,
13,
1678,
448,
1378,
29899,
13,
1678,
6317,
518,
29896,
29962,
2045,
597,
29882,
2941,
336,
29889,
617,
29914,
2640,
29914,
4622,
29914,
328,
16858,
29914,
15752,
29918,
1393,
3034,
29914,
16121,
13,
1678,
6317,
518,
29906,
29962,
2045,
597,
29882,
2941,
336,
29889,
617,
29914,
2640,
29914,
4622,
29914,
17591,
29918,
29882,
2941,
336,
29914,
23333,
13,
13,
1678,
1222,
9422,
13,
1678,
448,
26589,
13,
13,
1678,
12545,
379,
2941,
336,
1065,
29901,
13,
13,
1678,
8653,
515,
27246,
336,
29918,
2256,
1053,
25112,
29892,
23315,
13,
1678,
8653,
515,
27246,
336,
29918,
2256,
29889,
735,
27910,
1053,
27246,
336,
29918,
3389,
13,
1678,
8653,
4982,
353,
27246,
336,
29918,
3389,
29898,
4282,
29879,
29898,
8977,
29892,
263,
29922,
29896,
29892,
289,
29922,
29896,
511,
3414,
29918,
2220,
29922,
2611,
3656,
403,
29897,
13,
1678,
8653,
4982,
29889,
2457,
29918,
1767,
13,
1678,
11117,
29874,
2396,
29871,
29896,
29892,
525,
29890,
2396,
29871,
29896,
29913,
13,
13,
1678,
5293,
263,
901,
4280,
3414,
740,
29901,
13,
13,
1678,
8653,
515,
27246,
336,
29918,
2256,
29889,
735,
27910,
1053,
27246,
336,
29918,
3389,
13,
1678,
8653,
515,
27246,
336,
29918,
2256,
1053,
23315,
29892,
25112,
13,
1678,
8653,
274,
16434,
353,
9657,
29898,
29888,
29922,
4282,
29879,
29898,
12248,
29892,
1518,
29922,
29906,
29892,
27246,
336,
29918,
3846,
29922,
5574,
511,
921,
29922,
29896,
29900,
29897,
13,
1678,
8653,
822,
3414,
29918,
2220,
29898,
16859,
1125,
13,
1678,
2023,
1678,
736,
25112,
29898,
16859,
29889,
29888,
5033,
16859,
29889,
29916,
29897,
13,
13,
1678,
997,
3322,
263,
4982,
304,
14707,
278,
740,
773,
278,
2183,
5285,
29901,
13,
13,
1678,
8653,
4982,
353,
27246,
336,
29918,
3389,
29898,
16859,
29892,
3414,
29918,
2220,
29897,
13,
1678,
8653,
4982,
29889,
2457,
29918,
1767,
13,
268,
29896,
29900,
29900,
13,
13,
1678,
530,
1342,
773,
10772,
29911,
25350,
29901,
13,
13,
1678,
8653,
515,
4842,
305,
29889,
20640,
1053,
11783,
13,
1678,
8653,
515,
4842,
305,
29889,
15755,
1053,
22985,
13,
1678,
8653,
11783,
3991,
353,
23315,
29898,
3253,
314,
29892,
301,
29878,
29922,
29900,
29889,
29900,
29900,
29896,
29892,
27246,
336,
29918,
3846,
29922,
5574,
29897,
13,
1678,
8653,
8125,
3991,
353,
23315,
29898,
12697,
29892,
297,
29918,
22100,
29922,
29896,
29892,
714,
29918,
22100,
29922,
29896,
29897,
13,
1678,
8653,
274,
16434,
353,
9657,
29898,
20640,
29922,
3253,
314,
3991,
3285,
1904,
29922,
3195,
3991,
3101,
13,
1678,
8653,
822,
3414,
29918,
2220,
29898,
16859,
1125,
13,
1678,
2023,
268,
274,
16434,
353,
25112,
29898,
16859,
29897,
13,
1678,
2023,
268,
5994,
353,
274,
16434,
29889,
20640,
29898,
4299,
29889,
16744,
3101,
13,
1678,
2023,
268,
6410,
353,
274,
16434,
29889,
4299,
29898,
7345,
305,
29889,
2873,
29898,
29896,
8106,
12676,
580,
13,
1678,
2023,
268,
5994,
29889,
9171,
29918,
5105,
580,
13,
1678,
2023,
268,
6410,
29889,
1627,
1328,
580,
13,
1678,
2023,
268,
5994,
29889,
10568,
580,
13,
1678,
2023,
268,
736,
6410,
29889,
667,
580,
13,
1678,
8653,
17643,
353,
27246,
336,
29918,
3389,
29898,
16859,
29892,
3414,
29918,
2220,
29892,
975,
24040,
29922,
3366,
20640,
29889,
29212,
29922,
29900,
29889,
29896,
20068,
13,
1678,
8653,
432,
29889,
2457,
29918,
1767,
13,
268,
29900,
29889,
29941,
29900,
29945,
29946,
29955,
29945,
29947,
29941,
29896,
29900,
29941,
29896,
29955,
29929,
29929,
29941,
13,
1678,
9995,
13,
1678,
2295,
29918,
978,
353,
903,
8899,
29918,
2917,
29898,
2917,
29892,
2295,
29918,
978,
29897,
13,
13,
1678,
565,
2295,
29918,
3972,
338,
451,
6213,
29901,
13,
4706,
2295,
29918,
3972,
353,
851,
29898,
2605,
29898,
2917,
29918,
3972,
467,
23552,
3101,
13,
1678,
2740,
29918,
2084,
353,
1653,
29918,
2917,
29918,
4478,
29918,
2084,
29898,
2917,
29918,
3972,
29897,
13,
13,
1678,
27246,
336,
353,
379,
2941,
336,
29889,
3258,
29918,
3396,
29918,
29882,
2941,
336,
29906,
29898,
7662,
29918,
978,
29922,
9057,
29918,
978,
29892,
2295,
29918,
4478,
29918,
2084,
29922,
4478,
29918,
2084,
29897,
13,
1678,
1018,
29901,
13,
4706,
4982,
353,
27246,
336,
29889,
3389,
29898,
13,
9651,
2295,
29918,
978,
29922,
2917,
29918,
978,
29892,
13,
9651,
3414,
29918,
2220,
29922,
7662,
29918,
2220,
29892,
13,
9651,
975,
24040,
29922,
957,
24040,
565,
975,
24040,
338,
451,
6213,
1683,
19997,
13,
9651,
411,
29918,
1188,
29918,
13305,
29922,
2541,
29918,
1188,
29918,
13305,
29892,
13,
4706,
1723,
13,
1678,
7146,
29901,
13,
4706,
12002,
29950,
2941,
336,
29889,
8758,
2141,
8551,
580,
13,
1678,
736,
4982,
13,
13,
13,
1753,
27246,
336,
29918,
4713,
381,
348,
29898,
13,
1678,
2295,
29901,
7761,
29961,
1469,
2385,
29892,
360,
919,
3991,
29892,
341,
20304,
1402,
13,
1678,
3414,
29918,
2220,
29901,
8251,
519,
8999,
21533,
3991,
1402,
3139,
1402,
13,
1678,
975,
24040,
29901,
28379,
29961,
1293,
29961,
710,
5262,
353,
6213,
29892,
13,
1678,
2295,
29918,
3972,
29901,
28379,
29961,
19986,
29961,
710,
29892,
10802,
5262,
353,
6213,
29892,
13,
1678,
2295,
29918,
978,
29901,
851,
353,
376,
29882,
2941,
336,
29918,
4713,
381,
348,
613,
13,
1678,
4982,
29918,
978,
29901,
851,
353,
376,
29882,
2941,
336,
29918,
4713,
381,
348,
613,
13,
1678,
411,
29918,
1188,
29918,
13305,
29901,
6120,
353,
5852,
29892,
13,
29897,
1599,
3139,
29901,
13,
1678,
9995,
17641,
263,
379,
2941,
336,
2473,
29899,
3389,
9310,
29896,
29962,
19925,
4982,
3342,
491,
421,
7662,
29918,
2220,
29952,
773,
278,
5285,
13,
1678,
4944,
297,
421,
2917,
1412,
13,
13,
1678,
13999,
304,
920,
379,
2941,
336,
24492,
1736,
29892,
421,
957,
24040,
29952,
526,
263,
1347,
1051,
310,
5285,
13,
1678,
1819,
304,
671,
363,
263,
2183,
7639,
1065,
29889,
29871,
1152,
1342,
29892,
278,
379,
2941,
336,
24492,
4944,
491,
1057,
13,
13,
539,
395,
3017,
448,
29885,
4982,
29889,
7662,
29918,
2220,
4982,
29914,
2972,
29922,
2972,
29918,
978,
4982,
29889,
2972,
29889,
3207,
29922,
29896,
1192,
4713,
381,
348,
13,
13,
1678,
723,
367,
1057,
13,
13,
539,
8653,
4982,
353,
27246,
336,
29918,
4713,
381,
348,
29898,
2917,
29892,
3414,
29918,
2220,
29892,
975,
24040,
29922,
3366,
9057,
29914,
2972,
29922,
2972,
29918,
978,
613,
376,
9057,
29889,
2972,
29889,
3207,
29922,
29896,
20068,
13,
13,
1678,
1763,
7901,
1022,
975,
4128,
278,
379,
2941,
336,
24492,
4944,
491,
1057,
13,
13,
539,
395,
3017,
448,
29885,
4982,
29889,
7662,
29918,
2220,
4982,
29914,
2972,
29922,
2972,
29918,
978,
4982,
29889,
2972,
29889,
3207,
29922,
29896,
29892,
29906,
29892,
29941,
1192,
4713,
381,
348,
13,
13,
1678,
723,
367,
1057,
13,
13,
539,
8653,
4982,
353,
27246,
336,
29918,
4713,
381,
348,
29898,
2917,
29892,
3414,
29918,
2220,
29892,
975,
24040,
29922,
3366,
9057,
29914,
2972,
29922,
2972,
29918,
978,
613,
376,
9057,
29889,
2972,
29889,
3207,
29922,
29896,
29892,
29906,
29892,
29941,
20068,
13,
13,
1678,
910,
3168,
24138,
379,
2941,
336,
322,
5480,
10017,
967,
1914,
1985,
3884,
29889,
29871,
2823,
12782,
3864,
379,
2941,
336,
518,
29941,
21540,
363,
901,
13,
1678,
4902,
373,
2888,
5281,
379,
2941,
336,
29889,
13,
13,
1678,
12662,
2699,
13,
1678,
448,
1378,
29899,
13,
1678,
2295,
29901,
7761,
29961,
1469,
2385,
29892,
360,
919,
3991,
29962,
13,
4706,
319,
5285,
408,
263,
848,
1990,
29892,
5285,
1203,
29892,
470,
263,
8600,
29889,
13,
13,
1678,
3414,
29918,
2220,
29901,
8251,
519,
8999,
21533,
3991,
1402,
3139,
29962,
13,
4706,
450,
740,
379,
2941,
336,
674,
6222,
411,
278,
2183,
5285,
29889,
13,
13,
1678,
975,
24040,
29901,
28379,
29961,
1293,
29961,
710,
5262,
313,
4381,
29901,
6213,
29897,
13,
4706,
960,
4944,
29892,
975,
24040,
2322,
22920,
29892,
1074,
518,
29906,
21540,
322,
518,
29941,
29962,
5396,
13,
13,
1678,
2295,
29918,
3972,
29901,
28379,
29961,
19986,
29961,
710,
29892,
10802,
5262,
313,
4381,
29901,
6213,
29897,
13,
4706,
3462,
5285,
17525,
565,
4312,
29889,
13,
13,
1678,
2295,
29918,
978,
29901,
851,
313,
4381,
29901,
376,
29882,
2941,
336,
29918,
3389,
1159,
13,
4706,
4408,
310,
278,
6087,
5285,
297,
379,
2941,
336,
29915,
29879,
12782,
9044,
3450,
29889,
13,
13,
1678,
4982,
29918,
978,
29901,
851,
313,
4381,
29901,
376,
29882,
2941,
336,
29918,
4713,
381,
348,
1159,
13,
13,
1678,
411,
29918,
1188,
29918,
13305,
29901,
6120,
313,
4381,
29901,
5852,
29897,
13,
4706,
28697,
304,
10822,
12183,
1014,
5205,
515,
278,
7500,
2295,
13,
13,
1678,
16969,
13,
1678,
448,
22158,
13,
1678,
1121,
29901,
3139,
13,
4706,
450,
736,
1819,
310,
599,
15241,
17643,
313,
2716,
1975,
373,
278,
317,
705,
11356,
5314,
467,
13,
13,
1678,
28318,
13,
1678,
448,
1378,
29899,
13,
1678,
6317,
518,
29896,
29962,
2045,
597,
29882,
2941,
336,
29889,
617,
29914,
2640,
29914,
12631,
29879,
29914,
16121,
29914,
21094,
29918,
8066,
29918,
932,
29914,
9910,
29899,
3389,
13,
1678,
6317,
518,
29906,
29962,
2045,
597,
29882,
2941,
336,
29889,
617,
29914,
2640,
29914,
4622,
29914,
328,
16858,
29914,
15752,
29918,
1393,
3034,
29914,
16121,
13,
1678,
6317,
518,
29941,
29962,
2045,
597,
29882,
2941,
336,
29889,
617,
29914,
2640,
29914,
4622,
29914,
17591,
29918,
29882,
2941,
336,
29914,
23333,
13,
13,
1678,
1222,
9422,
13,
1678,
448,
26589,
13,
13,
1678,
12545,
379,
2941,
336,
1773,
381,
348,
29901,
13,
13,
1678,
8653,
4982,
353,
27246,
336,
29918,
4713,
381,
348,
29898,
13,
1678,
2023,
268,
23315,
29898,
8977,
29892,
263,
29922,
29896,
29892,
289,
29922,
29896,
511,
13,
1678,
2023,
268,
3414,
29918,
2220,
29922,
2611,
3656,
403,
29892,
13,
1678,
2023,
268,
975,
24040,
29922,
3366,
29874,
29922,
29896,
29892,
29906,
12436,
13,
1678,
2023,
1723,
13,
1678,
8653,
518,
29926,
29889,
2457,
29918,
1767,
363,
432,
297,
4982,
29961,
29900,
5262,
13,
1678,
518,
10998,
29874,
2396,
29871,
29896,
29892,
525,
29890,
2396,
29871,
29896,
1118,
11117,
29874,
2396,
29871,
29906,
29892,
525,
29890,
2396,
29871,
29896,
6525,
13,
13,
1678,
5293,
263,
901,
4280,
421,
7662,
29918,
2220,
29952,
13,
13,
1678,
8653,
515,
27246,
336,
29918,
2256,
1053,
23315,
29892,
25112,
13,
1678,
8653,
274,
16434,
353,
9657,
29898,
29888,
29922,
4282,
29879,
29898,
12248,
29892,
1518,
29922,
29906,
29892,
27246,
336,
29918,
3846,
29922,
5574,
511,
921,
29922,
29896,
29897,
13,
1678,
8653,
822,
3414,
29918,
2220,
29898,
16859,
1125,
13,
1678,
2023,
1678,
736,
25112,
29898,
16859,
29889,
29888,
5033,
16859,
29889,
29916,
29897,
13,
13,
1678,
997,
3322,
263,
2473,
29899,
3389,
975,
263,
1051,
310,
1422,
421,
29916,
29952,
1819,
773,
379,
2941,
336,
29915,
29879,
5712,
5877,
421,
3881,
6998,
13,
13,
1678,
8653,
17643,
353,
27246,
336,
29918,
4713,
381,
348,
29898,
16859,
29892,
3414,
29918,
2220,
29892,
975,
24040,
29922,
3366,
29916,
29922,
3881,
6278,
29906,
29892,
29941,
5513,
2314,
13,
1678,
8653,
518,
29926,
29889,
2457,
29918,
1767,
363,
432,
297,
17643,
29961,
29900,
5262,
13,
1678,
518,
29946,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29946,
29962,
13,
13,
1678,
530,
1342,
773,
10772,
29911,
25350,
13,
13,
1678,
8653,
515,
4842,
305,
29889,
20640,
1053,
11783,
13,
1678,
8653,
515,
4842,
305,
29889,
15755,
1053,
22985,
13,
1678,
8653,
11783,
3991,
353,
23315,
29898,
3253,
314,
29892,
301,
29878,
29922,
29900,
29889,
29900,
29900,
29896,
29892,
27246,
336,
29918,
3846,
29922,
5574,
29897,
13,
1678,
8653,
8125,
3991,
353,
23315,
29898,
12697,
29892,
297,
29918,
22100,
29922,
29896,
29892,
714,
29918,
22100,
29922,
29896,
29897,
13,
1678,
8653,
274,
16434,
353,
9657,
29898,
20640,
29922,
3253,
314,
3991,
3285,
1904,
29922,
3195,
3991,
3101,
13,
1678,
8653,
822,
3414,
29918,
2220,
29898,
16859,
1125,
13,
1678,
2023,
268,
274,
16434,
353,
25112,
29898,
16859,
29897,
13,
1678,
2023,
268,
5994,
353,
274,
16434,
29889,
20640,
29898,
4299,
29889,
16744,
3101,
13,
1678,
2023,
268,
6410,
353,
274,
16434,
29889,
4299,
29898,
7345,
305,
29889,
2873,
29898,
29896,
8106,
12676,
580,
13,
1678,
2023,
268,
5994,
29889,
9171,
29918,
5105,
580,
13,
1678,
2023,
268,
6410,
29889,
1627,
1328,
580,
13,
1678,
2023,
268,
5994,
29889,
10568,
580,
13,
1678,
2023,
268,
736,
6410,
29889,
667,
580,
13,
13,
1678,
382,
4387,
403,
278,
740,
363,
1422,
6509,
19257,
13,
13,
1678,
8653,
17643,
353,
27246,
336,
29918,
4713,
381,
348,
29898,
16859,
29892,
3414,
29918,
2220,
29892,
975,
24040,
29922,
3366,
20640,
29889,
29212,
29922,
29900,
29889,
29896,
29892,
29896,
29889,
29900,
20068,
13,
1678,
8653,
518,
29926,
29889,
2457,
29918,
1767,
363,
432,
297,
17643,
29961,
29900,
5262,
13,
1678,
518,
29900,
29889,
29941,
29900,
29945,
29946,
29955,
29945,
29947,
29941,
29896,
29900,
29941,
29896,
29955,
29929,
29929,
29941,
29892,
29871,
29900,
29889,
29906,
29947,
29929,
29896,
29900,
29906,
29900,
29955,
29955,
29946,
29947,
29946,
29896,
29941,
29900,
29947,
29953,
29962,
13,
1678,
9995,
13,
1678,
2295,
29918,
978,
353,
903,
8899,
29918,
2917,
29898,
2917,
29892,
2295,
29918,
978,
29897,
13,
13,
1678,
565,
2295,
29918,
3972,
338,
451,
6213,
29901,
13,
4706,
2295,
29918,
3972,
353,
851,
29898,
2605,
29898,
2917,
29918,
3972,
467,
23552,
3101,
13,
1678,
2740,
29918,
2084,
353,
1653,
29918,
2917,
29918,
4478,
29918,
2084,
29898,
2917,
29918,
3972,
29897,
13,
13,
1678,
27246,
336,
353,
379,
2941,
336,
29889,
3258,
29918,
3396,
29918,
29882,
2941,
336,
29906,
29898,
7662,
29918,
978,
29922,
9057,
29918,
978,
29892,
2295,
29918,
4478,
29918,
2084,
29922,
4478,
29918,
2084,
29897,
13,
1678,
1018,
29901,
13,
4706,
274,
16434,
353,
27246,
336,
29889,
19438,
29918,
2917,
29898,
13,
9651,
2295,
29918,
978,
29922,
2917,
29918,
978,
29892,
13,
9651,
975,
24040,
29922,
957,
24040,
565,
975,
24040,
338,
451,
6213,
1683,
19997,
13,
9651,
411,
29918,
1188,
29918,
13305,
29922,
2541,
29918,
1188,
29918,
13305,
29892,
13,
9651,
1065,
29918,
8513,
29922,
6558,
6818,
29889,
29924,
8647,
8193,
3904,
29892,
13,
4706,
1723,
13,
13,
4706,
6939,
29879,
353,
8251,
1627,
29879,
29898,
16859,
29897,
13,
4706,
6939,
29879,
29889,
265,
29918,
4713,
381,
348,
29918,
2962,
29898,
2917,
29922,
16859,
29892,
2295,
29918,
978,
29922,
2917,
29918,
978,
29897,
13,
13,
4706,
396,
2799,
3656,
403,
7901,
11356,
1728,
773,
379,
2941,
336,
29915,
29879,
1858,
3851,
20699,
313,
29999,
264,
14366,
13,
4706,
7901,
11356,
353,
25112,
29898,
16859,
29889,
29882,
2941,
336,
29889,
29879,
705,
11356,
29897,
13,
4706,
4974,
338,
8758,
29898,
29879,
705,
11356,
29892,
317,
705,
11356,
29897,
13,
4706,
7901,
11356,
29889,
14669,
29898,
13,
9651,
2295,
29922,
16859,
29892,
13,
9651,
27246,
336,
29918,
4703,
29922,
29950,
2941,
336,
2677,
29898,
13,
18884,
2295,
29918,
12657,
29922,
29882,
2941,
336,
29889,
2917,
29918,
12657,
29892,
6939,
29879,
29922,
14035,
29879,
13,
9651,
10353,
13,
9651,
3414,
29918,
2220,
29922,
7662,
29918,
2220,
29892,
13,
4706,
1723,
13,
13,
4706,
3414,
29918,
957,
24040,
353,
13352,
2442,
16376,
29889,
517,
29918,
7611,
29898,
16859,
29889,
29882,
2941,
336,
29889,
957,
24040,
29889,
7662,
29892,
8814,
29922,
8824,
29897,
13,
4706,
4974,
338,
8758,
29898,
7662,
29918,
957,
24040,
29892,
1051,
29897,
13,
13,
4706,
4982,
353,
7901,
11356,
29889,
29879,
705,
1022,
29898,
25699,
29922,
7662,
29918,
957,
24040,
29897,
13,
4706,
6939,
29879,
29889,
265,
29918,
4713,
381,
348,
29918,
355,
29898,
2917,
29922,
16859,
29892,
2295,
29918,
978,
29922,
2917,
29918,
978,
29897,
13,
13,
1678,
7146,
29901,
13,
4706,
12002,
29950,
2941,
336,
29889,
8758,
2141,
8551,
580,
13,
1678,
736,
4982,
13,
2
] |
exercicios/agenda_de_contatos.py | ricardoluizbb/python-codes | 1 | 98516 | <reponame>ricardoluizbb/python-codes<gh_stars>1-10
AGENDA = {}
def exibir_contatos():
if len(AGENDA) > 0:
for contato in AGENDA:
buscar_contato(contato)
print('-' * 30)
else:
print('\nA sua agenda está vazia. Adicione alguns contatos!\n')
def buscar_contato(contato):
try:
print(f'Nome: {contato}')
print('Celular:', AGENDA[contato]['celular'])
print('E-mail:', AGENDA[contato]['email'])
except KeyError:
print(f'\nO contato {contato} não existe na agenda.\n')
except:
print('\nDesculpe, aconteceu um erro inesperado.\n')
# Verifica se o nome do contato digitado já existe na agenda. Linha 87 e 97 #
def verificando_se_existe(contato):
if contato in AGENDA:
return True
return False
def incluir_contato(contato, celular, email, verificacao_incluir_editar = True):
AGENDA[contato] = {
'celular': celular,
'email': email
}
# Verificação para retornar a mensagem correta. #
if verificacao_incluir_editar:
print(f'\nO contato {contato} foi incluido.\n')
else:
print(f'\nO contato {contato} foi editado.\n')
def editar_contato(contato, celular, email):
incluir_contato(contato, celular, email, verificacao_incluir_editar = False)
def deletar_contato(contato):
try:
AGENDA.pop(contato)
print(f'\nO contato {contato} foi deletado.\n')
except KeyError:
print(f'\nO contato {contato} não existe na agenda.\n')
# Função que exporta contatos para um arquivo txt #
def exportar_contatos():
try:
with open('agenda.txt', 'w') as arquivo:
arquivo.write('Nome, Celular, E-mail\n')
for contato in AGENDA:
celular = AGENDA[contato]['celular']
email = AGENDA[contato]['email']
arquivo.write(f'{contato}, {celular}, {email}\n')
print('\nSua agenda foi exportada com sucesso!\n')
except Exception as error:
print('\nDesculpe, aconteceu um erro inesperado.\n')
def imprimir_menu():
print('\n1 - Exibir contatos')
print('2 - Buscar um contato')
print('3 - Incluir um contato')
print('4 - Editar um contato')
print('5 - Deletar um contato')
print('6 - Exportar agenda para um arquivo txt')
print('0 - Fechar agenda\n')
while True:
imprimir_menu()
action = (input('Digite o que deseja fazer: '))
print()
if action == '1':
exibir_contatos()
elif action == '2':
contato = input('Digite o nome do contato: ')
print('-' * 30)
buscar_contato(contato)
print('-' * 30)
elif action == '3':
contato = input('Digite o nome do contato: ')
if verificando_se_existe(contato):
print(f'\nO contato {contato} já existe na agenda. Tente adicioná-lo com outro nome ou sobrenome.\n')
else:
celular = input('Digite o número do celular do contato: ')
email = input('Digite o e-mail do contato: ')
incluir_contato(contato, celular, email)
elif action == '4':
contato = input('Digite o nome do contato que deseja editar: ')
if verificando_se_existe(contato):
celular = input('Digite o número do celular do contato: ')
email = input('Digite o e-mail do contato: ')
editar_contato(contato, celular, email)
else:
print(f'\nO contato {contato} não existe na agenda.\n')
elif action == '5':
contato = input('Digite o nome do contato que deseja deletar: ')
deletar_contato(contato)
elif action == '6':
exportar_contatos()
elif action == '0':
print('A agenda foi fechada.')
break
else:
print('Por favor, dhigite um comando válido.') | [
1,
529,
276,
1112,
420,
29958,
2200,
538,
20424,
466,
1327,
29914,
4691,
29899,
18137,
29966,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
10051,
1430,
7698,
353,
6571,
13,
13,
1753,
429,
747,
381,
29918,
1285,
4507,
7295,
13,
1678,
565,
7431,
29898,
10051,
1430,
7698,
29897,
1405,
29871,
29900,
29901,
13,
4706,
363,
640,
1219,
297,
16369,
1430,
7698,
29901,
13,
9651,
3593,
4287,
29918,
1285,
1219,
29898,
1285,
1219,
29897,
13,
9651,
1596,
877,
29899,
29915,
334,
29871,
29941,
29900,
29897,
13,
1678,
1683,
29901,
13,
4706,
1596,
28909,
29876,
29909,
4171,
946,
8395,
7919,
325,
834,
423,
29889,
2087,
293,
1421,
25633,
640,
4507,
9903,
29876,
1495,
13,
13,
1753,
3593,
4287,
29918,
1285,
1219,
29898,
1285,
1219,
1125,
13,
1678,
1018,
29901,
13,
4706,
1596,
29898,
29888,
29915,
29940,
608,
29901,
426,
1285,
1219,
29913,
1495,
13,
4706,
1596,
877,
29907,
295,
1070,
29901,
742,
16369,
1430,
7698,
29961,
1285,
1219,
22322,
2242,
1070,
11287,
13,
4706,
1596,
877,
29923,
29899,
2549,
29901,
742,
16369,
1430,
7698,
29961,
1285,
1219,
22322,
5269,
11287,
13,
1678,
5174,
7670,
2392,
29901,
13,
4706,
1596,
29898,
29888,
12764,
29876,
29949,
640,
1219,
426,
1285,
1219,
29913,
8145,
19947,
1055,
946,
8395,
7790,
29876,
1495,
13,
1678,
5174,
29901,
13,
4706,
1596,
28909,
29876,
4002,
1810,
412,
29892,
23789,
371,
22541,
1922,
604,
307,
297,
27749,
912,
7790,
29876,
1495,
13,
13,
29937,
1798,
15039,
409,
288,
9235,
437,
640,
1219,
13615,
912,
17333,
19947,
1055,
946,
8395,
29889,
4342,
2350,
29871,
29947,
29955,
321,
29871,
29929,
29955,
396,
13,
1753,
1147,
928,
1743,
29918,
344,
29918,
735,
2488,
29898,
1285,
1219,
1125,
13,
1678,
565,
640,
1219,
297,
16369,
1430,
7698,
29901,
13,
4706,
736,
5852,
13,
1678,
736,
7700,
13,
13,
1753,
13654,
381,
29918,
1285,
1219,
29898,
1285,
1219,
29892,
6432,
1070,
29892,
4876,
29892,
1147,
928,
562,
6241,
29918,
262,
695,
29884,
381,
29918,
287,
3673,
353,
5852,
1125,
13,
1678,
16369,
1430,
7698,
29961,
1285,
1219,
29962,
353,
426,
13,
4706,
525,
2242,
1070,
2396,
6432,
1070,
29892,
13,
4706,
525,
5269,
2396,
4876,
13,
1678,
500,
13,
29937,
1798,
928,
8298,
1702,
3240,
1398,
279,
263,
18664,
13904,
14515,
941,
29889,
396,
13,
1678,
565,
1147,
928,
562,
6241,
29918,
262,
695,
29884,
381,
29918,
287,
3673,
29901,
13,
4706,
1596,
29898,
29888,
12764,
29876,
29949,
640,
1219,
426,
1285,
1219,
29913,
4732,
13654,
1941,
7790,
29876,
1495,
13,
1678,
1683,
29901,
13,
4706,
1596,
29898,
29888,
12764,
29876,
29949,
640,
1219,
426,
1285,
1219,
29913,
4732,
3863,
912,
7790,
29876,
1495,
13,
13,
1753,
1226,
3673,
29918,
1285,
1219,
29898,
1285,
1219,
29892,
6432,
1070,
29892,
4876,
1125,
13,
1678,
13654,
381,
29918,
1285,
1219,
29898,
1285,
1219,
29892,
6432,
1070,
29892,
4876,
29892,
1147,
928,
562,
6241,
29918,
262,
695,
29884,
381,
29918,
287,
3673,
353,
7700,
29897,
13,
268,
13,
1753,
7374,
279,
29918,
1285,
1219,
29898,
1285,
1219,
1125,
13,
1678,
1018,
29901,
13,
4706,
16369,
1430,
7698,
29889,
7323,
29898,
1285,
1219,
29897,
13,
4706,
1596,
29898,
29888,
12764,
29876,
29949,
640,
1219,
426,
1285,
1219,
29913,
4732,
7374,
912,
7790,
29876,
1495,
13,
1678,
5174,
7670,
2392,
29901,
13,
4706,
1596,
29898,
29888,
12764,
29876,
29949,
640,
1219,
426,
1285,
1219,
29913,
8145,
19947,
1055,
946,
8395,
7790,
29876,
1495,
13,
13,
29937,
13811,
2340,
712,
5609,
29874,
640,
4507,
1702,
1922,
19325,
4243,
13872,
396,
13,
1753,
5609,
279,
29918,
1285,
4507,
7295,
13,
1678,
1018,
29901,
13,
4706,
411,
1722,
877,
351,
8395,
29889,
3945,
742,
525,
29893,
1495,
408,
19325,
4243,
29901,
13,
9651,
19325,
4243,
29889,
3539,
877,
29940,
608,
29892,
14227,
1070,
29892,
382,
29899,
2549,
29905,
29876,
1495,
13,
9651,
363,
640,
1219,
297,
16369,
1430,
7698,
29901,
13,
18884,
6432,
1070,
353,
16369,
1430,
7698,
29961,
1285,
1219,
22322,
2242,
1070,
2033,
13,
18884,
4876,
353,
16369,
1430,
7698,
29961,
1285,
1219,
22322,
5269,
2033,
13,
18884,
19325,
4243,
29889,
3539,
29898,
29888,
29915,
29912,
1285,
1219,
1118,
426,
2242,
1070,
1118,
426,
5269,
1012,
29876,
1495,
13,
4706,
1596,
28909,
29876,
29903,
3357,
946,
8395,
4732,
5609,
1114,
419,
480,
985,
29877,
9903,
29876,
1495,
13,
1678,
5174,
8960,
408,
1059,
29901,
13,
4706,
1596,
28909,
29876,
4002,
1810,
412,
29892,
23789,
371,
22541,
1922,
604,
307,
297,
27749,
912,
7790,
29876,
1495,
13,
13,
1753,
527,
9469,
381,
29918,
6510,
7295,
29871,
13,
1678,
1596,
28909,
29876,
29896,
448,
1222,
747,
381,
640,
4507,
1495,
13,
1678,
1596,
877,
29906,
448,
8406,
4287,
1922,
640,
1219,
1495,
13,
1678,
1596,
877,
29941,
448,
512,
695,
29884,
381,
1922,
640,
1219,
1495,
13,
1678,
1596,
877,
29946,
448,
2155,
3673,
1922,
640,
1219,
1495,
13,
1678,
1596,
877,
29945,
448,
897,
1026,
279,
1922,
640,
1219,
1495,
13,
1678,
1596,
877,
29953,
448,
1222,
637,
279,
946,
8395,
1702,
1922,
19325,
4243,
13872,
1495,
13,
1678,
1596,
877,
29900,
448,
5169,
3090,
946,
8395,
29905,
29876,
1495,
13,
13,
8000,
5852,
29901,
13,
1678,
527,
9469,
381,
29918,
6510,
580,
13,
1678,
3158,
353,
313,
2080,
877,
14991,
568,
288,
712,
553,
29872,
1764,
16928,
261,
29901,
525,
876,
13,
1678,
1596,
580,
13,
13,
1678,
565,
3158,
1275,
525,
29896,
2396,
13,
4706,
429,
747,
381,
29918,
1285,
4507,
580,
13,
13,
1678,
25342,
3158,
1275,
525,
29906,
2396,
13,
4706,
640,
1219,
353,
1881,
877,
14991,
568,
288,
9235,
437,
640,
1219,
29901,
25710,
13,
4706,
1596,
877,
29899,
29915,
334,
29871,
29941,
29900,
29897,
13,
4706,
3593,
4287,
29918,
1285,
1219,
29898,
1285,
1219,
29897,
13,
4706,
1596,
877,
29899,
29915,
334,
29871,
29941,
29900,
29897,
13,
13,
1678,
25342,
3158,
1275,
525,
29941,
2396,
13,
4706,
640,
1219,
353,
1881,
877,
14991,
568,
288,
9235,
437,
640,
1219,
29901,
25710,
13,
13,
4706,
565,
1147,
928,
1743,
29918,
344,
29918,
735,
2488,
29898,
1285,
1219,
1125,
13,
9651,
1596,
29898,
29888,
12764,
29876,
29949,
640,
1219,
426,
1285,
1219,
29913,
17333,
19947,
1055,
946,
8395,
29889,
323,
2016,
594,
15353,
29976,
29899,
417,
419,
714,
307,
9235,
2123,
577,
1182,
264,
608,
7790,
29876,
1495,
13,
4706,
1683,
29901,
13,
9651,
6432,
1070,
353,
1881,
877,
14991,
568,
288,
13831,
437,
6432,
1070,
437,
640,
1219,
29901,
25710,
13,
9651,
4876,
353,
1881,
877,
14991,
568,
288,
321,
29899,
2549,
437,
640,
1219,
29901,
25710,
13,
9651,
13654,
381,
29918,
1285,
1219,
29898,
1285,
1219,
29892,
6432,
1070,
29892,
4876,
29897,
13,
13,
1678,
25342,
3158,
1275,
525,
29946,
2396,
13,
4706,
640,
1219,
353,
1881,
877,
14991,
568,
288,
9235,
437,
640,
1219,
712,
553,
29872,
1764,
1226,
3673,
29901,
25710,
13,
13,
4706,
565,
29871,
1147,
928,
1743,
29918,
344,
29918,
735,
2488,
29898,
1285,
1219,
1125,
13,
9651,
6432,
1070,
353,
1881,
877,
14991,
568,
288,
13831,
437,
6432,
1070,
437,
640,
1219,
29901,
25710,
13,
9651,
4876,
353,
1881,
877,
14991,
568,
288,
321,
29899,
2549,
437,
640,
1219,
29901,
25710,
13,
9651,
1226,
3673,
29918,
1285,
1219,
29898,
1285,
1219,
29892,
6432,
1070,
29892,
4876,
29897,
13,
4706,
1683,
29901,
13,
9651,
1596,
29898,
29888,
12764,
29876,
29949,
640,
1219,
426,
1285,
1219,
29913,
8145,
19947,
1055,
946,
8395,
7790,
29876,
1495,
13,
1678,
25342,
3158,
1275,
525,
29945,
2396,
13,
4706,
640,
1219,
353,
1881,
877,
14991,
568,
288,
9235,
437,
640,
1219,
712,
553,
29872,
1764,
7374,
279,
29901,
25710,
13,
4706,
7374,
279,
29918,
1285,
1219,
29898,
1285,
1219,
29897,
13,
1678,
25342,
3158,
1275,
525,
29953,
2396,
13,
4706,
5609,
279,
29918,
1285,
4507,
580,
13,
1678,
25342,
3158,
1275,
525,
29900,
2396,
13,
4706,
1596,
877,
29909,
946,
8395,
4732,
1238,
305,
1114,
29889,
1495,
13,
4706,
2867,
13,
1678,
1683,
29901,
13,
4706,
1596,
877,
29925,
272,
7853,
29892,
270,
29882,
335,
568,
1922,
419,
1743,
12196,
1941,
29889,
1495,
2
] |
difftorch/util.py | gbaydin/difftorch | 30 | 169092 | import torch
import typing
def check_vector(x, name):
if not torch.is_tensor(x):
raise RuntimeError('{} needs to be a Tensor'.format(name))
if x.dim() != 1:
raise RuntimeError('{} needs to be a vector (one-dimensional Tensor)'.format(name))
def check_scalar(x, name):
if not torch.is_tensor(x):
raise RuntimeError('{} needs to be a Tensor'.format(name))
if x.dim() != 0:
raise RuntimeError('{} needs to be a scalar (zero-dimensional Tensor)'.format(name))
def check_same_shape(x, xname, y, yname):
if x.shape != y.shape:
raise RuntimeError('Expecting {}.shape ({}) and {}.shape ({}) to be the same'.format(xname, x.shape, yname, y.shape))
def onehot_like(x, i):
ret = torch.zeros_like(x)
ret[i] = 1.
return ret
def unzip(lst):
return zip(*lst)
def check_tensor(value):
if not torch.is_tensor(value):
raise ValueError('Expecting value to be a tensor')
def check_list_or_tuple_of_tensors(value):
if not (isinstance(value, typing.List) or isinstance(value, typing.Tuple)):
raise ValueError('Expecting value to be a list or tuple')
for v in value:
check_tensor(v)
def flatten(tensors):
if torch.is_tensor(tensors):
return tensors.reshape(-1)
check_list_or_tuple_of_tensors(tensors)
return torch.cat([t.reshape(-1) for t in tensors])
def unflatten_as(tensor, tensors):
if torch.is_tensor(tensors):
return tensor.reshape(tensors.shape)
check_tensor(tensor)
check_list_or_tuple_of_tensors(tensors)
shapes = [t.shape for t in tensors]
nelements = [t.nelement() for t in tensors]
ts = torch.split(tensor.reshape(-1), nelements)
return [ts[i].reshape(shapes[i]) for i in range(len(tensors))]
| [
1,
1053,
4842,
305,
13,
5215,
19229,
13,
13,
13,
1753,
1423,
29918,
8111,
29898,
29916,
29892,
1024,
1125,
13,
1678,
565,
451,
4842,
305,
29889,
275,
29918,
20158,
29898,
29916,
1125,
13,
4706,
12020,
24875,
2392,
877,
8875,
4225,
304,
367,
263,
323,
6073,
4286,
4830,
29898,
978,
876,
13,
1678,
565,
921,
29889,
6229,
580,
2804,
29871,
29896,
29901,
13,
4706,
12020,
24875,
2392,
877,
8875,
4225,
304,
367,
263,
4608,
313,
650,
29899,
12531,
323,
6073,
29897,
4286,
4830,
29898,
978,
876,
13,
13,
13,
1753,
1423,
29918,
19529,
279,
29898,
29916,
29892,
1024,
1125,
13,
1678,
565,
451,
4842,
305,
29889,
275,
29918,
20158,
29898,
29916,
1125,
13,
4706,
12020,
24875,
2392,
877,
8875,
4225,
304,
367,
263,
323,
6073,
4286,
4830,
29898,
978,
876,
13,
1678,
565,
921,
29889,
6229,
580,
2804,
29871,
29900,
29901,
13,
4706,
12020,
24875,
2392,
877,
8875,
4225,
304,
367,
263,
17336,
313,
9171,
29899,
12531,
323,
6073,
29897,
4286,
4830,
29898,
978,
876,
13,
13,
13,
1753,
1423,
29918,
17642,
29918,
12181,
29898,
29916,
29892,
921,
978,
29892,
343,
29892,
343,
978,
1125,
13,
1678,
565,
921,
29889,
12181,
2804,
343,
29889,
12181,
29901,
13,
4706,
12020,
24875,
2392,
877,
1252,
1103,
292,
426,
1836,
12181,
21313,
1800,
322,
426,
1836,
12181,
21313,
1800,
304,
367,
278,
1021,
4286,
4830,
29898,
29916,
978,
29892,
921,
29889,
12181,
29892,
343,
978,
29892,
343,
29889,
12181,
876,
13,
13,
13,
1753,
697,
8711,
29918,
4561,
29898,
29916,
29892,
474,
1125,
13,
1678,
3240,
353,
4842,
305,
29889,
3298,
359,
29918,
4561,
29898,
29916,
29897,
13,
1678,
3240,
29961,
29875,
29962,
353,
29871,
29896,
29889,
13,
1678,
736,
3240,
13,
13,
13,
1753,
443,
7554,
29898,
20155,
1125,
13,
1678,
736,
14319,
10456,
20155,
29897,
13,
13,
13,
1753,
1423,
29918,
20158,
29898,
1767,
1125,
13,
1678,
565,
451,
4842,
305,
29889,
275,
29918,
20158,
29898,
1767,
1125,
13,
4706,
12020,
7865,
2392,
877,
1252,
1103,
292,
995,
304,
367,
263,
12489,
1495,
13,
13,
13,
1753,
1423,
29918,
1761,
29918,
272,
29918,
23583,
29918,
974,
29918,
29873,
575,
943,
29898,
1767,
1125,
13,
1678,
565,
451,
313,
275,
8758,
29898,
1767,
29892,
19229,
29889,
1293,
29897,
470,
338,
8758,
29898,
1767,
29892,
19229,
29889,
23215,
552,
22164,
13,
4706,
12020,
7865,
2392,
877,
1252,
1103,
292,
995,
304,
367,
263,
1051,
470,
18761,
1495,
13,
1678,
363,
325,
297,
995,
29901,
13,
4706,
1423,
29918,
20158,
29898,
29894,
29897,
13,
13,
13,
1753,
1652,
8606,
29898,
29873,
575,
943,
1125,
13,
1678,
565,
4842,
305,
29889,
275,
29918,
20158,
29898,
29873,
575,
943,
1125,
13,
4706,
736,
25187,
943,
29889,
690,
14443,
6278,
29896,
29897,
13,
1678,
1423,
29918,
1761,
29918,
272,
29918,
23583,
29918,
974,
29918,
29873,
575,
943,
29898,
29873,
575,
943,
29897,
13,
1678,
736,
4842,
305,
29889,
4117,
4197,
29873,
29889,
690,
14443,
6278,
29896,
29897,
363,
260,
297,
25187,
943,
2314,
13,
13,
13,
1753,
443,
1579,
8606,
29918,
294,
29898,
20158,
29892,
25187,
943,
1125,
13,
1678,
565,
4842,
305,
29889,
275,
29918,
20158,
29898,
29873,
575,
943,
1125,
13,
4706,
736,
12489,
29889,
690,
14443,
29898,
29873,
575,
943,
29889,
12181,
29897,
13,
1678,
1423,
29918,
20158,
29898,
20158,
29897,
13,
1678,
1423,
29918,
1761,
29918,
272,
29918,
23583,
29918,
974,
29918,
29873,
575,
943,
29898,
29873,
575,
943,
29897,
13,
1678,
25834,
353,
518,
29873,
29889,
12181,
363,
260,
297,
25187,
943,
29962,
13,
1678,
452,
944,
29879,
353,
518,
29873,
29889,
484,
944,
580,
363,
260,
297,
25187,
943,
29962,
13,
1678,
18696,
353,
4842,
305,
29889,
5451,
29898,
20158,
29889,
690,
14443,
6278,
29896,
511,
452,
944,
29879,
29897,
13,
1678,
736,
518,
1372,
29961,
29875,
1822,
690,
14443,
29898,
845,
11603,
29961,
29875,
2314,
363,
474,
297,
3464,
29898,
2435,
29898,
29873,
575,
943,
28166,
13,
2
] |
Multidimensional-Arrays/Lab-Multidimensional-Lists/primary_diagonal.py | dechevh/Python-Advanced | 2 | 137333 | <filename>Multidimensional-Arrays/Lab-Multidimensional-Lists/primary_diagonal.py<gh_stars>1-10
n = int(input())
matrix = [list(map(int, input().split(" "))) for _ in range(n)]
total = 0
for i in range(n):
value = matrix[i][i]
total += value
print(total) | [
1,
529,
9507,
29958,
6857,
333,
326,
8180,
29899,
2588,
29879,
29914,
28632,
29899,
6857,
333,
326,
8180,
29899,
1293,
29879,
29914,
16072,
29918,
6051,
351,
7177,
29889,
2272,
29966,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
29876,
353,
938,
29898,
2080,
3101,
13,
13,
5344,
353,
518,
1761,
29898,
1958,
29898,
524,
29892,
1881,
2141,
5451,
703,
376,
4961,
363,
903,
297,
3464,
29898,
29876,
4638,
13,
13,
7827,
353,
29871,
29900,
13,
1454,
474,
297,
3464,
29898,
29876,
1125,
13,
1678,
995,
353,
4636,
29961,
29875,
3816,
29875,
29962,
13,
1678,
3001,
4619,
995,
13,
13,
2158,
29898,
7827,
29897,
2
] |
jentry/entry/script/file.py | HansBug/jentry | 0 | 147173 | import codecs
from typing import Iterator, Tuple
import javalang
from javalang.ast import Node
from javalang.tree import MethodDeclaration, PackageDeclaration, ClassDeclaration
from ...model import JavaEntry
def is_entry_method(node: Node) -> bool:
"""
Determine if the given method node is an entry or not.
:param node: Given method node.
:return: Valid or not.
"""
if 'public' in node.modifiers and 'static' in node.modifiers \
and node.name == 'main' and node.return_type is None and len(node.parameters) == 1:
param = node.parameters[0]
if param.type.name == 'String' and (
(not param.varargs and param.type.dimensions == [None]) or
(param.varargs and param.type.dimensions == [])
):
return True
return False
def load_entries_from_file(filename: str) -> Iterator[JavaEntry]:
"""
Load entries from one java source code file.
:param filename: File name.
:return: Iterator of :class:`jentry.model.entry.JavaEntry` objects.
"""
with codecs.open(filename, 'r') as cf:
for package, clazz in load_entry_classes_from_code(cf.read()):
yield JavaEntry(filename, package, clazz)
def load_entry_classes_from_code(code: str) -> Iterator[Tuple[str, str]]:
"""
Load entry classes from one java source code.
:param code: Java source code string.
:return: Iterator of entry class tuples.
"""
parsed_code = javalang.parse.parse(code)
package = None
for pkgpath, pkgnode in parsed_code.filter(PackageDeclaration):
if isinstance(pkgnode, PackageDeclaration):
package = pkgnode.name
for clspath, clsnode in parsed_code.filter(ClassDeclaration):
if len(clspath) == 2 and 'private' not in clsnode.modifiers:
is_entry = False
for mthpath, mthnode in clsnode.filter(MethodDeclaration):
if len(mthpath) == 2 and is_entry_method(mthnode):
is_entry = True
break
if is_entry:
yield package, clsnode.name
| [
1,
1053,
775,
2395,
13,
3166,
19229,
1053,
20504,
1061,
29892,
12603,
552,
13,
13,
5215,
432,
7712,
574,
13,
3166,
432,
7712,
574,
29889,
579,
1053,
9071,
13,
3166,
432,
7712,
574,
29889,
8336,
1053,
8108,
6185,
23838,
29892,
22029,
6185,
23838,
29892,
4134,
6185,
23838,
13,
13,
3166,
2023,
4299,
1053,
3355,
9634,
13,
13,
13,
1753,
338,
29918,
8269,
29918,
5696,
29898,
3177,
29901,
9071,
29897,
1599,
6120,
29901,
13,
1678,
9995,
13,
1678,
5953,
837,
457,
565,
278,
2183,
1158,
2943,
338,
385,
6251,
470,
451,
29889,
13,
13,
1678,
584,
3207,
2943,
29901,
11221,
1158,
2943,
29889,
13,
1678,
584,
2457,
29901,
15758,
470,
451,
29889,
13,
1678,
9995,
13,
1678,
565,
525,
3597,
29915,
297,
2943,
29889,
1545,
14903,
322,
525,
7959,
29915,
297,
2943,
29889,
1545,
14903,
320,
13,
9651,
322,
2943,
29889,
978,
1275,
525,
3396,
29915,
322,
2943,
29889,
2457,
29918,
1853,
338,
6213,
322,
7431,
29898,
3177,
29889,
16744,
29897,
1275,
29871,
29896,
29901,
13,
4706,
1828,
353,
2943,
29889,
16744,
29961,
29900,
29962,
13,
4706,
565,
1828,
29889,
1853,
29889,
978,
1275,
525,
1231,
29915,
322,
313,
13,
18884,
313,
1333,
1828,
29889,
1707,
5085,
322,
1828,
29889,
1853,
29889,
6229,
5580,
1275,
518,
8516,
2314,
470,
13,
18884,
313,
3207,
29889,
1707,
5085,
322,
1828,
29889,
1853,
29889,
6229,
5580,
1275,
518,
2314,
13,
308,
1125,
13,
9651,
736,
5852,
13,
13,
1678,
736,
7700,
13,
13,
13,
1753,
2254,
29918,
26586,
29918,
3166,
29918,
1445,
29898,
9507,
29901,
851,
29897,
1599,
20504,
1061,
29961,
8404,
9634,
5387,
13,
1678,
9995,
13,
1678,
16012,
9976,
515,
697,
2115,
2752,
775,
934,
29889,
13,
13,
1678,
584,
3207,
10422,
29901,
3497,
1024,
29889,
13,
1678,
584,
2457,
29901,
20504,
1061,
310,
584,
1990,
18078,
29926,
8269,
29889,
4299,
29889,
8269,
29889,
8404,
9634,
29952,
3618,
29889,
13,
1678,
9995,
13,
1678,
411,
775,
2395,
29889,
3150,
29898,
9507,
29892,
525,
29878,
1495,
408,
274,
29888,
29901,
13,
4706,
363,
3577,
29892,
3711,
5617,
297,
2254,
29918,
8269,
29918,
13203,
29918,
3166,
29918,
401,
29898,
6854,
29889,
949,
580,
1125,
13,
9651,
7709,
3355,
9634,
29898,
9507,
29892,
3577,
29892,
3711,
5617,
29897,
13,
13,
13,
1753,
2254,
29918,
8269,
29918,
13203,
29918,
3166,
29918,
401,
29898,
401,
29901,
851,
29897,
1599,
20504,
1061,
29961,
23215,
552,
29961,
710,
29892,
851,
5262,
29901,
13,
1678,
9995,
13,
1678,
16012,
6251,
4413,
515,
697,
2115,
2752,
775,
29889,
13,
13,
1678,
584,
3207,
775,
29901,
3355,
2752,
775,
1347,
29889,
13,
1678,
584,
2457,
29901,
20504,
1061,
310,
6251,
770,
5291,
2701,
29889,
13,
1678,
9995,
13,
1678,
21213,
29918,
401,
353,
432,
7712,
574,
29889,
5510,
29889,
5510,
29898,
401,
29897,
13,
13,
1678,
3577,
353,
6213,
13,
1678,
363,
282,
9415,
2084,
29892,
282,
9415,
3177,
297,
21213,
29918,
401,
29889,
4572,
29898,
14459,
6185,
23838,
1125,
13,
4706,
565,
338,
8758,
29898,
15865,
3177,
29892,
22029,
6185,
23838,
1125,
13,
9651,
3577,
353,
282,
9415,
3177,
29889,
978,
13,
13,
1678,
363,
1067,
1028,
493,
29892,
1067,
29879,
3177,
297,
21213,
29918,
401,
29889,
4572,
29898,
2385,
6185,
23838,
1125,
13,
4706,
565,
7431,
29898,
695,
1028,
493,
29897,
1275,
29871,
29906,
322,
525,
9053,
29915,
451,
297,
1067,
29879,
3177,
29889,
1545,
14903,
29901,
13,
9651,
338,
29918,
8269,
353,
7700,
13,
9651,
363,
286,
386,
2084,
29892,
286,
386,
3177,
297,
1067,
29879,
3177,
29889,
4572,
29898,
4062,
6185,
23838,
1125,
13,
18884,
565,
7431,
29898,
29885,
386,
2084,
29897,
1275,
29871,
29906,
322,
338,
29918,
8269,
29918,
5696,
29898,
29885,
386,
3177,
1125,
13,
462,
1678,
338,
29918,
8269,
353,
5852,
13,
462,
1678,
2867,
13,
13,
9651,
565,
338,
29918,
8269,
29901,
13,
18884,
7709,
3577,
29892,
1067,
29879,
3177,
29889,
978,
13,
2
] |
src/asphalt/serialization/marshalling.py | Asphalt-framework/asphalt-serialization | 0 | 48131 | <filename>src/asphalt/serialization/marshalling.py
from __future__ import annotations
from typing import Any
from asphalt.core import qualified_name
def default_marshaller(obj: Any) -> Any:
"""
Retrieve the state of the given object.
Calls the ``__getstate__()`` method of the object if available, otherwise returns
the ``__dict__`` of the object.
:param obj: the object to marshal
:return: the marshalled object state
"""
if hasattr(obj, "__getstate__"):
return obj.__getstate__()
try:
return obj.__dict__
except AttributeError:
raise TypeError(
f"{qualified_name(obj.__class__)!r} has no __dict__ attribute and does not "
f"implement __getstate__()"
) from None
def default_unmarshaller(instance: Any, state: Any) -> None:
"""
Restore the state of an object.
If the ``__setstate__()`` method exists on the instance, it is called with the state
object as the argument. Otherwise, the instance's ``__dict__`` is replaced with
``state``.
:param instance: an uninitialized instance
:param state: the state object, as returned by :func:`default_marshaller`
"""
if hasattr(instance, "__setstate__"):
instance.__setstate__(state)
else:
try:
instance.__dict__.update(state)
except AttributeError:
raise TypeError(
f"{qualified_name(instance.__class__)!r} has no __dict__ attribute and "
f"does not implement __setstate__()"
) from None
| [
1,
529,
9507,
29958,
4351,
29914,
294,
561,
1997,
29914,
15550,
2133,
29914,
3034,
845,
27855,
29889,
2272,
13,
3166,
4770,
29888,
9130,
1649,
1053,
25495,
13,
13,
3166,
19229,
1053,
3139,
13,
13,
3166,
408,
561,
1997,
29889,
3221,
1053,
18698,
29918,
978,
13,
13,
13,
1753,
2322,
29918,
3034,
845,
12572,
29898,
5415,
29901,
3139,
29897,
1599,
3139,
29901,
13,
1678,
9995,
13,
1678,
4649,
29878,
2418,
278,
2106,
310,
278,
2183,
1203,
29889,
13,
13,
1678,
315,
4293,
278,
4954,
1649,
657,
3859,
1649,
2555,
29952,
1158,
310,
278,
1203,
565,
3625,
29892,
6467,
3639,
13,
1678,
278,
4954,
1649,
8977,
1649,
16159,
310,
278,
1203,
29889,
13,
13,
1678,
584,
3207,
5446,
29901,
278,
1203,
304,
1766,
23258,
13,
1678,
584,
2457,
29901,
278,
1766,
845,
4212,
1203,
2106,
13,
13,
1678,
9995,
13,
1678,
565,
756,
5552,
29898,
5415,
29892,
376,
1649,
657,
3859,
1649,
29908,
1125,
13,
4706,
736,
5446,
17255,
657,
3859,
1649,
580,
13,
13,
1678,
1018,
29901,
13,
4706,
736,
5446,
17255,
8977,
1649,
13,
1678,
5174,
23833,
2392,
29901,
13,
4706,
12020,
20948,
29898,
13,
9651,
285,
29908,
29912,
15380,
2164,
29918,
978,
29898,
5415,
17255,
1990,
1649,
20198,
29878,
29913,
756,
694,
4770,
8977,
1649,
5352,
322,
947,
451,
376,
13,
9651,
285,
29908,
326,
2037,
4770,
657,
3859,
1649,
25318,
13,
4706,
1723,
515,
6213,
13,
13,
13,
1753,
2322,
29918,
348,
3034,
845,
12572,
29898,
8758,
29901,
3139,
29892,
2106,
29901,
3139,
29897,
1599,
6213,
29901,
13,
1678,
9995,
13,
1678,
11654,
487,
278,
2106,
310,
385,
1203,
29889,
13,
13,
1678,
960,
278,
4954,
1649,
842,
3859,
1649,
2555,
29952,
1158,
4864,
373,
278,
2777,
29892,
372,
338,
2000,
411,
278,
2106,
13,
1678,
1203,
408,
278,
2980,
29889,
13466,
29892,
278,
2777,
29915,
29879,
4954,
1649,
8977,
1649,
16159,
338,
8611,
411,
13,
1678,
4954,
3859,
29952,
1412,
13,
13,
1678,
584,
3207,
2777,
29901,
385,
443,
11228,
1891,
2777,
13,
1678,
584,
3207,
2106,
29901,
278,
2106,
1203,
29892,
408,
4133,
491,
584,
9891,
18078,
4381,
29918,
3034,
845,
12572,
29952,
13,
13,
1678,
9995,
13,
1678,
565,
756,
5552,
29898,
8758,
29892,
376,
1649,
842,
3859,
1649,
29908,
1125,
13,
4706,
2777,
17255,
842,
3859,
12035,
3859,
29897,
13,
1678,
1683,
29901,
13,
4706,
1018,
29901,
13,
9651,
2777,
17255,
8977,
26914,
5504,
29898,
3859,
29897,
13,
4706,
5174,
23833,
2392,
29901,
13,
9651,
12020,
20948,
29898,
13,
18884,
285,
29908,
29912,
15380,
2164,
29918,
978,
29898,
8758,
17255,
1990,
1649,
20198,
29878,
29913,
756,
694,
4770,
8977,
1649,
5352,
322,
376,
13,
18884,
285,
29908,
13221,
451,
2334,
4770,
842,
3859,
1649,
25318,
13,
9651,
1723,
515,
6213,
13,
2
] |
src/plotting/TATA_enrichment_plots.py | Switham1/PromoterArchitecture | 0 | 139785 | <filename>src/plotting/TATA_enrichment_plots.py<gh_stars>0
import argparse
import os
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
def parse_args(args):
"""define arguments"""
parser = argparse.ArgumentParser(description="TATA_enrichment_plots")
parser.add_argument(
"file_names",
type=str,
help="Name of folder and filenames for the promoters extracted",
)
parser.add_argument(
"gat_TATA_constitutive_output",
type=str,
help="Location of constitutive promoter gat analysis output",
)
parser.add_argument(
"gat_TATA_variable_output",
type=str,
help="Location of variable promoter gat analysis output",
)
parser.add_argument(
"output_prefix",
type=str,
help="Output prefix to add to plot file name",
)
parser.add_argument(
"output_folder_name",
type=str,
help="Optional output folder name ending in a forward slash",
default="",
nargs="?",
)
parser.add_argument(
"variable1_name",
type=str,
help="Optional replacement name for 2nd variable eg. non-specific",
default="constitutive",
nargs="?",
)
parser.add_argument(
"variable2_name",
type=str,
help="Optional replacement name for 2nd variable eg. tissue_specific",
default="variable",
nargs="?",
)
parser.add_argument(
"palette",
type=str,
help="Optional replacement colour palette for plots",
default=None,
nargs="?",
)
return parser.parse_args(
args
) # let argparse grab args from sys.argv itself to allow for testing in module import
def create_plot(
file_names,
output_folder_name,
output_prefix,
gat_TATA_constitutive_output,
gat_TATA_variable_output,
palette,
variable1_name,
variable2_name,
):
"""import and process the raw outputs after running gat (Genomic association tester). Then create barplot of constitutive and variable gene TATA enrichment"""
# import gat output files as dfs
constitutive = pd.read_table(
gat_TATA_constitutive_output, sep="\t", header=0
)
variable = pd.read_table(gat_TATA_variable_output, sep="\t", header=0)
# merge dfs
merged = pd.concat([constitutive, variable], ignore_index=True)
# set style to ticks
sns.set(style="ticks", color_codes=True)
# set colour palette
colours = sns.color_palette(palette)
# bar chart, 95% confidence intervals
plot = sns.barplot(
x="annotation",
y="l2fold",
data=merged,
order=[variable1_name, variable2_name],
palette=colours,
)
plot.axhline(0, color="black")
plt.xlabel("Gene type")
plt.ylabel("Log2-fold enrichment over background").get_figure().savefig(
f"../../data/output/{file_names}/TATA/{output_folder_name}plots/{output_prefix}_log2fold.pdf",
format="pdf",
)
def main(args):
# parse arguments
args = parse_args(args)
# make directory for the plots to be exported to
dirName = (
f"../../data/output/{args.file_names}/TATA/{args.output_folder_name}"
)
try:
# Create target Directory
os.mkdir(dirName)
print("Directory ", dirName, " created")
except FileExistsError:
print("Directory ", dirName, " already exists")
# make directory for the plots to be exported to
dirName = f"../../data/output/{args.file_names}/TATA/{args.output_folder_name}/plots"
try:
# Create target Directory
os.mkdir(dirName)
print("Directory ", dirName, " created")
except FileExistsError:
print("Directory ", dirName, " already exists")
# Create barplot
create_plot(
args.file_names,
args.output_folder_name,
args.output_prefix,
args.gat_TATA_constitutive_output,
args.gat_TATA_variable_output,
args.palette,
args.variable1_name,
args.variable2_name,
)
if __name__ == "__main__":
import sys
main(sys.argv[1:])
| [
1,
529,
9507,
29958,
4351,
29914,
5317,
1259,
29914,
29911,
8254,
29918,
264,
4018,
358,
29918,
26762,
29889,
2272,
29966,
12443,
29918,
303,
1503,
29958,
29900,
13,
5215,
1852,
5510,
13,
5215,
2897,
13,
13,
5215,
22889,
29889,
2272,
5317,
408,
14770,
13,
5215,
11701,
408,
10518,
13,
5215,
409,
370,
1398,
408,
269,
1983,
13,
13,
13,
1753,
6088,
29918,
5085,
29898,
5085,
1125,
13,
1678,
9995,
7922,
6273,
15945,
29908,
13,
1678,
13812,
353,
1852,
5510,
29889,
15730,
11726,
29898,
8216,
543,
29911,
8254,
29918,
264,
4018,
358,
29918,
26762,
1159,
13,
1678,
13812,
29889,
1202,
29918,
23516,
29898,
13,
4706,
376,
1445,
29918,
7039,
613,
13,
4706,
1134,
29922,
710,
29892,
13,
4706,
1371,
543,
1170,
310,
4138,
322,
977,
264,
1280,
363,
278,
2504,
327,
414,
23892,
613,
13,
1678,
1723,
13,
1678,
13812,
29889,
1202,
29918,
23516,
29898,
13,
4706,
376,
28818,
29918,
29911,
8254,
29918,
3075,
277,
11067,
29918,
4905,
613,
13,
4706,
1134,
29922,
710,
29892,
13,
4706,
1371,
543,
6508,
310,
20016,
11067,
2504,
17084,
26989,
7418,
1962,
613,
13,
1678,
1723,
13,
1678,
13812,
29889,
1202,
29918,
23516,
29898,
13,
4706,
376,
28818,
29918,
29911,
8254,
29918,
11918,
29918,
4905,
613,
13,
4706,
1134,
29922,
710,
29892,
13,
4706,
1371,
543,
6508,
310,
2286,
2504,
17084,
26989,
7418,
1962,
613,
13,
1678,
1723,
13,
1678,
13812,
29889,
1202,
29918,
23516,
29898,
13,
4706,
376,
4905,
29918,
13506,
613,
13,
4706,
1134,
29922,
710,
29892,
13,
4706,
1371,
543,
6466,
10944,
304,
788,
304,
6492,
934,
1024,
613,
13,
1678,
1723,
13,
1678,
13812,
29889,
1202,
29918,
23516,
29898,
13,
4706,
376,
4905,
29918,
12083,
29918,
978,
613,
13,
4706,
1134,
29922,
710,
29892,
13,
4706,
1371,
543,
27636,
1962,
4138,
1024,
17140,
297,
263,
6375,
24765,
613,
13,
4706,
2322,
543,
613,
13,
4706,
302,
5085,
543,
29973,
613,
13,
1678,
1723,
13,
1678,
13812,
29889,
1202,
29918,
23516,
29898,
13,
4706,
376,
11918,
29896,
29918,
978,
613,
13,
4706,
1134,
29922,
710,
29892,
13,
4706,
1371,
543,
27636,
16920,
1024,
363,
29871,
29906,
299,
2286,
8087,
29889,
1661,
29899,
14940,
613,
13,
4706,
2322,
543,
3075,
277,
11067,
613,
13,
4706,
302,
5085,
543,
29973,
613,
13,
1678,
1723,
13,
1678,
13812,
29889,
1202,
29918,
23516,
29898,
13,
4706,
376,
11918,
29906,
29918,
978,
613,
13,
4706,
1134,
29922,
710,
29892,
13,
4706,
1371,
543,
27636,
16920,
1024,
363,
29871,
29906,
299,
2286,
8087,
29889,
260,
15118,
29918,
14940,
613,
13,
4706,
2322,
543,
11918,
613,
13,
4706,
302,
5085,
543,
29973,
613,
13,
1678,
1723,
13,
1678,
13812,
29889,
1202,
29918,
23516,
29898,
13,
4706,
376,
29886,
26456,
613,
13,
4706,
1134,
29922,
710,
29892,
13,
4706,
1371,
543,
27636,
16920,
12384,
282,
26456,
363,
24580,
613,
13,
4706,
2322,
29922,
8516,
29892,
13,
4706,
302,
5085,
543,
29973,
613,
13,
1678,
1723,
13,
13,
1678,
736,
13812,
29889,
5510,
29918,
5085,
29898,
13,
4706,
6389,
13,
1678,
1723,
29871,
396,
1235,
1852,
5510,
17229,
6389,
515,
10876,
29889,
19218,
3528,
304,
2758,
363,
6724,
297,
3883,
1053,
13,
13,
13,
1753,
1653,
29918,
5317,
29898,
13,
1678,
934,
29918,
7039,
29892,
13,
1678,
1962,
29918,
12083,
29918,
978,
29892,
13,
1678,
1962,
29918,
13506,
29892,
13,
1678,
26989,
29918,
29911,
8254,
29918,
3075,
277,
11067,
29918,
4905,
29892,
13,
1678,
26989,
29918,
29911,
8254,
29918,
11918,
29918,
4905,
29892,
13,
1678,
282,
26456,
29892,
13,
1678,
2286,
29896,
29918,
978,
29892,
13,
1678,
2286,
29906,
29918,
978,
29892,
13,
1125,
13,
1678,
9995,
5215,
322,
1889,
278,
10650,
14391,
1156,
2734,
26989,
313,
15462,
25426,
15477,
1243,
261,
467,
1987,
1653,
2594,
5317,
310,
20016,
11067,
322,
2286,
18530,
323,
8254,
427,
4018,
358,
15945,
29908,
13,
1678,
396,
1053,
26989,
1962,
2066,
408,
4489,
29879,
13,
1678,
20016,
11067,
353,
10518,
29889,
949,
29918,
2371,
29898,
13,
4706,
26989,
29918,
29911,
8254,
29918,
3075,
277,
11067,
29918,
4905,
29892,
16345,
543,
29905,
29873,
613,
4839,
29922,
29900,
13,
1678,
1723,
13,
1678,
2286,
353,
10518,
29889,
949,
29918,
2371,
29898,
28818,
29918,
29911,
8254,
29918,
11918,
29918,
4905,
29892,
16345,
543,
29905,
29873,
613,
4839,
29922,
29900,
29897,
13,
1678,
396,
10366,
4489,
29879,
13,
1678,
19412,
353,
10518,
29889,
17685,
4197,
3075,
277,
11067,
29892,
2286,
1402,
11455,
29918,
2248,
29922,
5574,
29897,
13,
1678,
396,
731,
3114,
304,
260,
7358,
13,
1678,
269,
1983,
29889,
842,
29898,
3293,
543,
29873,
7358,
613,
2927,
29918,
18137,
29922,
5574,
29897,
13,
13,
1678,
396,
731,
12384,
282,
26456,
13,
1678,
28061,
353,
269,
1983,
29889,
2780,
29918,
29886,
26456,
29898,
29886,
26456,
29897,
13,
13,
1678,
396,
2594,
8727,
29892,
29871,
29929,
29945,
29995,
16420,
18747,
13,
1678,
6492,
353,
269,
1983,
29889,
1646,
5317,
29898,
13,
4706,
921,
543,
18317,
613,
13,
4706,
343,
543,
29880,
29906,
8771,
613,
13,
4706,
848,
29922,
1050,
3192,
29892,
13,
4706,
1797,
11759,
11918,
29896,
29918,
978,
29892,
2286,
29906,
29918,
978,
1402,
13,
4706,
282,
26456,
29922,
1054,
2470,
29892,
13,
1678,
1723,
13,
1678,
6492,
29889,
1165,
7760,
29898,
29900,
29892,
2927,
543,
8517,
1159,
13,
1678,
14770,
29889,
29916,
1643,
703,
29954,
1600,
1134,
1159,
13,
1678,
14770,
29889,
29891,
1643,
703,
3403,
29906,
29899,
8771,
427,
4018,
358,
975,
3239,
2564,
657,
29918,
4532,
2141,
7620,
1003,
29898,
13,
4706,
285,
29908,
21546,
1272,
29914,
4905,
19248,
1445,
29918,
7039,
6822,
29911,
8254,
19248,
4905,
29918,
12083,
29918,
978,
29913,
26762,
19248,
4905,
29918,
13506,
2403,
1188,
29906,
8771,
29889,
5140,
613,
13,
4706,
3402,
543,
5140,
613,
13,
1678,
1723,
13,
13,
13,
1753,
1667,
29898,
5085,
1125,
13,
1678,
396,
6088,
6273,
13,
1678,
6389,
353,
6088,
29918,
5085,
29898,
5085,
29897,
13,
13,
1678,
396,
1207,
3884,
363,
278,
24580,
304,
367,
5609,
287,
304,
13,
1678,
4516,
1170,
353,
313,
13,
4706,
285,
29908,
21546,
1272,
29914,
4905,
19248,
5085,
29889,
1445,
29918,
7039,
6822,
29911,
8254,
19248,
5085,
29889,
4905,
29918,
12083,
29918,
978,
5038,
13,
1678,
1723,
13,
1678,
1018,
29901,
13,
4706,
396,
6204,
3646,
18862,
13,
4706,
2897,
29889,
11256,
3972,
29898,
3972,
1170,
29897,
13,
4706,
1596,
703,
9882,
9162,
4516,
1170,
29892,
376,
2825,
1159,
13,
1678,
5174,
3497,
24217,
2392,
29901,
13,
4706,
1596,
703,
9882,
9162,
4516,
1170,
29892,
376,
2307,
4864,
1159,
13,
13,
1678,
396,
1207,
3884,
363,
278,
24580,
304,
367,
5609,
287,
304,
13,
1678,
4516,
1170,
353,
285,
29908,
21546,
1272,
29914,
4905,
19248,
5085,
29889,
1445,
29918,
7039,
6822,
29911,
8254,
19248,
5085,
29889,
4905,
29918,
12083,
29918,
978,
6822,
26762,
29908,
13,
1678,
1018,
29901,
13,
4706,
396,
6204,
3646,
18862,
13,
4706,
2897,
29889,
11256,
3972,
29898,
3972,
1170,
29897,
13,
4706,
1596,
703,
9882,
9162,
4516,
1170,
29892,
376,
2825,
1159,
13,
1678,
5174,
3497,
24217,
2392,
29901,
13,
4706,
1596,
703,
9882,
9162,
4516,
1170,
29892,
376,
2307,
4864,
1159,
13,
13,
1678,
396,
6204,
2594,
5317,
13,
1678,
1653,
29918,
5317,
29898,
13,
4706,
6389,
29889,
1445,
29918,
7039,
29892,
13,
4706,
6389,
29889,
4905,
29918,
12083,
29918,
978,
29892,
13,
4706,
6389,
29889,
4905,
29918,
13506,
29892,
13,
4706,
6389,
29889,
28818,
29918,
29911,
8254,
29918,
3075,
277,
11067,
29918,
4905,
29892,
13,
4706,
6389,
29889,
28818,
29918,
29911,
8254,
29918,
11918,
29918,
4905,
29892,
13,
4706,
6389,
29889,
29886,
26456,
29892,
13,
4706,
6389,
29889,
11918,
29896,
29918,
978,
29892,
13,
4706,
6389,
29889,
11918,
29906,
29918,
978,
29892,
13,
1678,
1723,
13,
13,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
1678,
1053,
10876,
13,
13,
1678,
1667,
29898,
9675,
29889,
19218,
29961,
29896,
29901,
2314,
13,
2
] |
tensorflow_addons/optimizers/tests/moving_average_test.py | leandro-gracia-gil/addons | 2 | 66529 | # Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Tests for MovingAverage optimizers."""
import numpy as np
import pytest
import tensorflow as tf
from tensorflow_addons.optimizers import MovingAverage
@pytest.mark.usefixtures("maybe_run_functions_eagerly")
def test_run():
var0 = tf.Variable([1.0, 2.0])
var1 = tf.Variable([3.0, 4.0])
grads0 = tf.constant([0.1, 0.1])
grads1 = tf.constant([0.01, 0.01])
grads_and_vars = list(zip([grads0, grads1], [var0, var1]))
opt = MovingAverage(tf.keras.optimizers.SGD(lr=2.0), average_decay=0.5,)
opt.apply_gradients(grads_and_vars)
opt.apply_gradients(grads_and_vars)
np.testing.assert_allclose(var0.read_value(), [0.6, 1.6])
np.testing.assert_allclose(var1.read_value(), [2.96, 3.96])
ema_var0 = opt.get_slot(var0, "average")
ema_var1 = opt.get_slot(var1, "average")
np.testing.assert_allclose(ema_var0.read_value(), [0.75, 1.75])
np.testing.assert_allclose(ema_var1.read_value(), [2.975, 3.975])
_ = opt.assign_average_vars([var0, var1])
np.testing.assert_allclose(var0.read_value(), [0.75, 1.75])
np.testing.assert_allclose(var1.read_value(), [2.975, 3.975])
var0.assign_add([1.0, 1.0]),
var1.assign_add([2.0, 2.0]),
ema_var0.assign_add([3.0, 3.0]),
ema_var1.assign_add([4.0, 4.0]),
np.testing.assert_allclose(var0.read_value(), [1.75, 2.75])
np.testing.assert_allclose(var1.read_value(), [4.975, 5.975])
np.testing.assert_allclose(ema_var0.read_value(), [3.75, 4.75])
np.testing.assert_allclose(ema_var1.read_value(), [6.975, 7.975])
@pytest.mark.usefixtures("maybe_run_functions_eagerly")
def test_opt_failure():
base_opt = None
with pytest.raises(TypeError):
MovingAverage(base_opt, 0.5)
@pytest.mark.usefixtures("maybe_run_functions_eagerly")
def test_model_weights_update():
grad = tf.Variable([[0.1]])
model = tf.keras.Sequential(
[
tf.keras.layers.Dense(
1,
kernel_initializer=tf.keras.initializers.Constant([[1.0]]),
use_bias=False,
)
]
)
model.build(input_shape=[1, 1])
opt = MovingAverage(tf.keras.optimizers.SGD(lr=2.0), average_decay=0.5)
_ = opt.apply_gradients(list(zip([grad], model.variables)))
np.testing.assert_allclose(model.variables[0].read_value(), [[0.8]])
_ = opt.assign_average_vars(model.variables)
np.testing.assert_allclose(model.variables[0].read_value(), [[0.9]])
@pytest.mark.usefixtures("maybe_run_functions_eagerly")
def test_model_dynamic_lr():
grad = tf.Variable([[0.1]])
model = tf.keras.Sequential(
[
tf.keras.layers.Dense(
1,
kernel_initializer=tf.keras.initializers.Constant([[1.0]]),
use_bias=False,
)
]
)
model.build(input_shape=[1, 1])
opt = MovingAverage(tf.keras.optimizers.SGD(lr=1e-3), average_decay=0.5)
_ = opt.apply_gradients(list(zip([grad], model.variables)))
np.testing.assert_allclose(opt.lr.read_value(), 1e-3)
opt.lr = 1e-4
np.testing.assert_allclose(opt.lr.read_value(), 1e-4)
@pytest.mark.usefixtures("maybe_run_functions_eagerly")
def test_optimizer_string():
_ = MovingAverage("adam")
def test_config():
sgd_opt = tf.keras.optimizers.SGD(lr=2.0, nesterov=True, momentum=0.3, decay=0.1)
opt = MovingAverage(
sgd_opt, average_decay=0.5, num_updates=None, start_step=5, dynamic_decay=True,
)
config = opt.get_config()
assert config["average_decay"] == 0.5
assert config["num_updates"] is None
assert config["start_step"] == 5
assert config["dynamic_decay"] is True
new_opt = MovingAverage.from_config(config)
old_sgd_config = opt._optimizer.get_config()
new_sgd_config = new_opt._optimizer.get_config()
for k1, k2 in zip(old_sgd_config, new_sgd_config):
assert old_sgd_config[k1] == new_sgd_config[k2]
@pytest.mark.usefixtures("maybe_run_functions_eagerly")
def test_fit_simple_linear_model():
seed = 0x2019
np.random.seed(seed)
tf.random.set_seed(seed)
num_examples = 5000
x = np.random.standard_normal((num_examples, 3))
w = np.random.standard_normal((3, 1))
y = np.dot(x, w) + np.random.standard_normal((num_examples, 1)) * 1e-4
model = tf.keras.models.Sequential()
model.add(tf.keras.layers.Dense(input_shape=(3,), units=1))
opt = MovingAverage("sgd")
model.compile(opt, loss="mse")
model.fit(x, y, epochs=5)
opt.assign_average_vars(model.variables)
x = np.random.standard_normal((100, 3))
y = np.dot(x, w)
predicted = model.predict(x)
max_abs_diff = np.max(np.abs(predicted - y))
assert max_abs_diff < 5e-3
def test_serialization():
sgd_opt = tf.keras.optimizers.SGD(lr=2.0, nesterov=True, momentum=0.3, decay=0.1)
optimizer = MovingAverage(
sgd_opt, average_decay=0.5, num_updates=None, start_step=5, dynamic_decay=True,
)
config = tf.keras.optimizers.serialize(optimizer)
new_optimizer = tf.keras.optimizers.deserialize(config)
assert new_optimizer.get_config() == optimizer.get_config()
@pytest.mark.usefixtures("maybe_run_functions_eagerly")
def test_start_step():
var0 = tf.Variable([1.0, 2.0])
grads0 = tf.constant([0.1, 0.1])
grads_and_vars = [(grads0, var0)]
opt = MovingAverage(
tf.keras.optimizers.SGD(lr=1.0), average_decay=0.5, start_step=1,
)
opt.apply_gradients(grads_and_vars)
np.testing.assert_allclose(var0.read_value(), [0.9, 1.9])
ema_var0 = opt.get_slot(var0, "average")
opt.apply_gradients(grads_and_vars)
np.testing.assert_allclose(var0.read_value(), [0.8, 1.8])
np.testing.assert_allclose(ema_var0.read_value(), [0.85, 1.85])
@pytest.mark.usefixtures("maybe_run_functions_eagerly")
def test_dynamic_decay():
var0 = tf.Variable([1.0, 2.0])
grads0 = tf.constant([0.1, 0.1])
grads_and_vars = [(grads0, var0)]
opt = MovingAverage(
tf.keras.optimizers.SGD(lr=2.0), average_decay=0.5, dynamic_decay=True,
)
opt.apply_gradients(grads_and_vars)
opt.apply_gradients(grads_and_vars)
np.testing.assert_allclose(var0.read_value(), [0.6, 1.6])
ema_var0 = opt.get_slot(var0, "average")
np.testing.assert_allclose(ema_var0.read_value(), [0.64, 1.64])
@pytest.mark.usefixtures("maybe_run_functions_eagerly")
@pytest.mark.with_device([tf.distribute.MirroredStrategy])
def test_swap_weights(device):
with device.scope():
var = tf.Variable([1.0, 2.0])
grads = tf.constant([0.1, 0.1])
opt = MovingAverage(tf.keras.optimizers.SGD(lr=2.0), average_decay=0.5,)
@tf.function
def apply_gradients():
opt.apply_gradients([(grads, var)])
device.run(apply_gradients)
np.testing.assert_allclose(var.read_value(), [0.8, 1.8])
ema_var = opt.get_slot(var, "average")
np.testing.assert_allclose(ema_var.read_value(), [0.85, 1.85])
with device.scope():
opt.shadow_copy([var])
opt.swap_weights()
np.testing.assert_allclose(ema_var.read_value(), [0.8, 1.8])
np.testing.assert_allclose(var.read_value(), [0.85, 1.85])
with device.scope():
opt.swap_weights()
np.testing.assert_allclose(var.read_value(), [0.8, 1.8])
np.testing.assert_allclose(ema_var.read_value(), [0.85, 1.85])
| [
1,
396,
14187,
1266,
29871,
29906,
29900,
29896,
29929,
450,
323,
6073,
17907,
13189,
943,
29889,
2178,
26863,
2538,
9841,
29889,
13,
29937,
13,
29937,
10413,
21144,
1090,
278,
13380,
19245,
29892,
10079,
29871,
29906,
29889,
29900,
313,
1552,
376,
29931,
293,
1947,
1496,
13,
29937,
366,
1122,
451,
671,
445,
934,
5174,
297,
752,
13036,
411,
278,
19245,
29889,
13,
29937,
887,
1122,
4017,
263,
3509,
310,
278,
19245,
472,
13,
29937,
13,
29937,
268,
1732,
597,
1636,
29889,
4288,
29889,
990,
29914,
506,
11259,
29914,
27888,
1430,
1660,
29899,
29906,
29889,
29900,
13,
29937,
13,
29937,
25870,
3734,
491,
22903,
4307,
470,
15502,
304,
297,
5007,
29892,
7047,
13,
29937,
13235,
1090,
278,
19245,
338,
13235,
373,
385,
376,
3289,
8519,
29908,
350,
3289,
3235,
29892,
13,
29937,
399,
1806,
8187,
2692,
399,
1718,
29934,
13566,
29059,
6323,
8707,
29928,
22122,
29903,
8079,
13764,
29979,
476,
22255,
29892,
2845,
4653,
470,
2411,
2957,
29889,
13,
29937,
2823,
278,
19245,
363,
278,
2702,
4086,
14765,
1076,
11239,
322,
13,
29937,
27028,
1090,
278,
19245,
29889,
13,
29937,
1275,
9166,
9166,
9166,
9166,
4936,
2751,
13,
15945,
29908,
24376,
363,
14104,
292,
29909,
19698,
5994,
19427,
1213,
15945,
13,
13,
5215,
12655,
408,
7442,
13,
5215,
11451,
1688,
13,
5215,
26110,
408,
15886,
13,
13,
3166,
26110,
29918,
1202,
787,
29889,
20640,
19427,
1053,
14104,
292,
29909,
19698,
13,
13,
13,
29992,
2272,
1688,
29889,
3502,
29889,
1509,
7241,
486,
1973,
703,
26026,
29918,
3389,
29918,
12171,
29918,
29872,
1875,
368,
1159,
13,
1753,
1243,
29918,
3389,
7295,
13,
1678,
722,
29900,
353,
15886,
29889,
16174,
4197,
29896,
29889,
29900,
29892,
29871,
29906,
29889,
29900,
2314,
13,
1678,
722,
29896,
353,
15886,
29889,
16174,
4197,
29941,
29889,
29900,
29892,
29871,
29946,
29889,
29900,
2314,
13,
13,
1678,
4656,
29879,
29900,
353,
15886,
29889,
23362,
4197,
29900,
29889,
29896,
29892,
29871,
29900,
29889,
29896,
2314,
13,
1678,
4656,
29879,
29896,
353,
15886,
29889,
23362,
4197,
29900,
29889,
29900,
29896,
29892,
29871,
29900,
29889,
29900,
29896,
2314,
13,
13,
1678,
4656,
29879,
29918,
392,
29918,
16908,
353,
1051,
29898,
7554,
4197,
5105,
29879,
29900,
29892,
4656,
29879,
29896,
1402,
518,
1707,
29900,
29892,
722,
29896,
12622,
13,
13,
1678,
3523,
353,
14104,
292,
29909,
19698,
29898,
13264,
29889,
3946,
294,
29889,
20640,
19427,
29889,
26016,
29928,
29898,
29212,
29922,
29906,
29889,
29900,
511,
6588,
29918,
7099,
388,
29922,
29900,
29889,
29945,
29892,
29897,
13,
13,
1678,
3523,
29889,
7302,
29918,
5105,
10070,
29898,
5105,
29879,
29918,
392,
29918,
16908,
29897,
13,
1678,
3523,
29889,
7302,
29918,
5105,
10070,
29898,
5105,
29879,
29918,
392,
29918,
16908,
29897,
13,
13,
1678,
7442,
29889,
13424,
29889,
9294,
29918,
497,
5358,
29898,
1707,
29900,
29889,
949,
29918,
1767,
3285,
518,
29900,
29889,
29953,
29892,
29871,
29896,
29889,
29953,
2314,
13,
1678,
7442,
29889,
13424,
29889,
9294,
29918,
497,
5358,
29898,
1707,
29896,
29889,
949,
29918,
1767,
3285,
518,
29906,
29889,
29929,
29953,
29892,
29871,
29941,
29889,
29929,
29953,
2314,
13,
13,
1678,
321,
655,
29918,
1707,
29900,
353,
3523,
29889,
657,
29918,
2536,
327,
29898,
1707,
29900,
29892,
376,
12483,
482,
1159,
13,
1678,
321,
655,
29918,
1707,
29896,
353,
3523,
29889,
657,
29918,
2536,
327,
29898,
1707,
29896,
29892,
376,
12483,
482,
1159,
13,
13,
1678,
7442,
29889,
13424,
29889,
9294,
29918,
497,
5358,
29898,
2603,
29918,
1707,
29900,
29889,
949,
29918,
1767,
3285,
518,
29900,
29889,
29955,
29945,
29892,
29871,
29896,
29889,
29955,
29945,
2314,
13,
1678,
7442,
29889,
13424,
29889,
9294,
29918,
497,
5358,
29898,
2603,
29918,
1707,
29896,
29889,
949,
29918,
1767,
3285,
518,
29906,
29889,
29929,
29955,
29945,
29892,
29871,
29941,
29889,
29929,
29955,
29945,
2314,
13,
13,
1678,
903,
353,
3523,
29889,
16645,
29918,
12483,
482,
29918,
16908,
4197,
1707,
29900,
29892,
722,
29896,
2314,
13,
13,
1678,
7442,
29889,
13424,
29889,
9294,
29918,
497,
5358,
29898,
1707,
29900,
29889,
949,
29918,
1767,
3285,
518,
29900,
29889,
29955,
29945,
29892,
29871,
29896,
29889,
29955,
29945,
2314,
13,
1678,
7442,
29889,
13424,
29889,
9294,
29918,
497,
5358,
29898,
1707,
29896,
29889,
949,
29918,
1767,
3285,
518,
29906,
29889,
29929,
29955,
29945,
29892,
29871,
29941,
29889,
29929,
29955,
29945,
2314,
13,
13,
1678,
722,
29900,
29889,
16645,
29918,
1202,
4197,
29896,
29889,
29900,
29892,
29871,
29896,
29889,
29900,
11724,
13,
1678,
722,
29896,
29889,
16645,
29918,
1202,
4197,
29906,
29889,
29900,
29892,
29871,
29906,
29889,
29900,
11724,
13,
1678,
321,
655,
29918,
1707,
29900,
29889,
16645,
29918,
1202,
4197,
29941,
29889,
29900,
29892,
29871,
29941,
29889,
29900,
11724,
13,
1678,
321,
655,
29918,
1707,
29896,
29889,
16645,
29918,
1202,
4197,
29946,
29889,
29900,
29892,
29871,
29946,
29889,
29900,
11724,
13,
13,
1678,
7442,
29889,
13424,
29889,
9294,
29918,
497,
5358,
29898,
1707,
29900,
29889,
949,
29918,
1767,
3285,
518,
29896,
29889,
29955,
29945,
29892,
29871,
29906,
29889,
29955,
29945,
2314,
13,
1678,
7442,
29889,
13424,
29889,
9294,
29918,
497,
5358,
29898,
1707,
29896,
29889,
949,
29918,
1767,
3285,
518,
29946,
29889,
29929,
29955,
29945,
29892,
29871,
29945,
29889,
29929,
29955,
29945,
2314,
13,
1678,
7442,
29889,
13424,
29889,
9294,
29918,
497,
5358,
29898,
2603,
29918,
1707,
29900,
29889,
949,
29918,
1767,
3285,
518,
29941,
29889,
29955,
29945,
29892,
29871,
29946,
29889,
29955,
29945,
2314,
13,
1678,
7442,
29889,
13424,
29889,
9294,
29918,
497,
5358,
29898,
2603,
29918,
1707,
29896,
29889,
949,
29918,
1767,
3285,
518,
29953,
29889,
29929,
29955,
29945,
29892,
29871,
29955,
29889,
29929,
29955,
29945,
2314,
13,
13,
13,
29992,
2272,
1688,
29889,
3502,
29889,
1509,
7241,
486,
1973,
703,
26026,
29918,
3389,
29918,
12171,
29918,
29872,
1875,
368,
1159,
13,
1753,
1243,
29918,
3670,
29918,
14057,
545,
7295,
13,
1678,
2967,
29918,
3670,
353,
6213,
13,
1678,
411,
11451,
1688,
29889,
336,
4637,
29898,
1542,
2392,
1125,
13,
4706,
14104,
292,
29909,
19698,
29898,
3188,
29918,
3670,
29892,
29871,
29900,
29889,
29945,
29897,
13,
13,
13,
29992,
2272,
1688,
29889,
3502,
29889,
1509,
7241,
486,
1973,
703,
26026,
29918,
3389,
29918,
12171,
29918,
29872,
1875,
368,
1159,
13,
1753,
1243,
29918,
4299,
29918,
705,
5861,
29918,
5504,
7295,
13,
1678,
4656,
353,
15886,
29889,
16174,
4197,
29961,
29900,
29889,
29896,
24960,
13,
1678,
1904,
353,
15886,
29889,
3946,
294,
29889,
16941,
2556,
29898,
13,
4706,
518,
13,
9651,
15886,
29889,
3946,
294,
29889,
29277,
29889,
29928,
1947,
29898,
13,
462,
29896,
29892,
13,
18884,
8466,
29918,
11228,
3950,
29922,
13264,
29889,
3946,
294,
29889,
11228,
19427,
29889,
12075,
424,
4197,
29961,
29896,
29889,
29900,
5262,
511,
13,
18884,
671,
29918,
29890,
3173,
29922,
8824,
29892,
13,
9651,
1723,
13,
4706,
4514,
13,
1678,
1723,
13,
1678,
1904,
29889,
4282,
29898,
2080,
29918,
12181,
11759,
29896,
29892,
29871,
29896,
2314,
13,
13,
1678,
3523,
353,
14104,
292,
29909,
19698,
29898,
13264,
29889,
3946,
294,
29889,
20640,
19427,
29889,
26016,
29928,
29898,
29212,
29922,
29906,
29889,
29900,
511,
6588,
29918,
7099,
388,
29922,
29900,
29889,
29945,
29897,
13,
1678,
903,
353,
3523,
29889,
7302,
29918,
5105,
10070,
29898,
1761,
29898,
7554,
4197,
5105,
1402,
1904,
29889,
20897,
4961,
13,
1678,
7442,
29889,
13424,
29889,
9294,
29918,
497,
5358,
29898,
4299,
29889,
20897,
29961,
29900,
1822,
949,
29918,
1767,
3285,
5519,
29900,
29889,
29947,
24960,
13,
1678,
903,
353,
3523,
29889,
16645,
29918,
12483,
482,
29918,
16908,
29898,
4299,
29889,
20897,
29897,
13,
1678,
7442,
29889,
13424,
29889,
9294,
29918,
497,
5358,
29898,
4299,
29889,
20897,
29961,
29900,
1822,
949,
29918,
1767,
3285,
5519,
29900,
29889,
29929,
24960,
13,
13,
13,
29992,
2272,
1688,
29889,
3502,
29889,
1509,
7241,
486,
1973,
703,
26026,
29918,
3389,
29918,
12171,
29918,
29872,
1875,
368,
1159,
13,
1753,
1243,
29918,
4299,
29918,
16626,
29918,
29212,
7295,
13,
1678,
4656,
353,
15886,
29889,
16174,
4197,
29961,
29900,
29889,
29896,
24960,
13,
1678,
1904,
353,
15886,
29889,
3946,
294,
29889,
16941,
2556,
29898,
13,
4706,
518,
13,
9651,
15886,
29889,
3946,
294,
29889,
29277,
29889,
29928,
1947,
29898,
13,
462,
29896,
29892,
13,
18884,
8466,
29918,
11228,
3950,
29922,
13264,
29889,
3946,
294,
29889,
11228,
19427,
29889,
12075,
424,
4197,
29961,
29896,
29889,
29900,
5262,
511,
13,
18884,
671,
29918,
29890,
3173,
29922,
8824,
29892,
13,
9651,
1723,
13,
4706,
4514,
13,
1678,
1723,
13,
1678,
1904,
29889,
4282,
29898,
2080,
29918,
12181,
11759,
29896,
29892,
29871,
29896,
2314,
13,
13,
1678,
3523,
353,
14104,
292,
29909,
19698,
29898,
13264,
29889,
3946,
294,
29889,
20640,
19427,
29889,
26016,
29928,
29898,
29212,
29922,
29896,
29872,
29899,
29941,
511,
6588,
29918,
7099,
388,
29922,
29900,
29889,
29945,
29897,
13,
1678,
903,
353,
3523,
29889,
7302,
29918,
5105,
10070,
29898,
1761,
29898,
7554,
4197,
5105,
1402,
1904,
29889,
20897,
4961,
13,
1678,
7442,
29889,
13424,
29889,
9294,
29918,
497,
5358,
29898,
3670,
29889,
29212,
29889,
949,
29918,
1767,
3285,
29871,
29896,
29872,
29899,
29941,
29897,
13,
1678,
3523,
29889,
29212,
353,
29871,
29896,
29872,
29899,
29946,
13,
1678,
7442,
29889,
13424,
29889,
9294,
29918,
497,
5358,
29898,
3670,
29889,
29212,
29889,
949,
29918,
1767,
3285,
29871,
29896,
29872,
29899,
29946,
29897,
13,
13,
13,
29992,
2272,
1688,
29889,
3502,
29889,
1509,
7241,
486,
1973,
703,
26026,
29918,
3389,
29918,
12171,
29918,
29872,
1875,
368,
1159,
13,
1753,
1243,
29918,
20640,
3950,
29918,
1807,
7295,
13,
1678,
903,
353,
14104,
292,
29909,
19698,
703,
328,
314,
1159,
13,
13,
13,
1753,
1243,
29918,
2917,
7295,
13,
1678,
269,
29887,
29881,
29918,
3670,
353,
15886,
29889,
3946,
294,
29889,
20640,
19427,
29889,
26016,
29928,
29898,
29212,
29922,
29906,
29889,
29900,
29892,
302,
4156,
586,
29922,
5574,
29892,
19399,
29922,
29900,
29889,
29941,
29892,
20228,
29922,
29900,
29889,
29896,
29897,
13,
1678,
3523,
353,
14104,
292,
29909,
19698,
29898,
13,
4706,
269,
29887,
29881,
29918,
3670,
29892,
6588,
29918,
7099,
388,
29922,
29900,
29889,
29945,
29892,
954,
29918,
786,
15190,
29922,
8516,
29892,
1369,
29918,
10568,
29922,
29945,
29892,
7343,
29918,
7099,
388,
29922,
5574,
29892,
13,
1678,
1723,
13,
1678,
2295,
353,
3523,
29889,
657,
29918,
2917,
580,
13,
13,
1678,
4974,
2295,
3366,
12483,
482,
29918,
7099,
388,
3108,
1275,
29871,
29900,
29889,
29945,
13,
1678,
4974,
2295,
3366,
1949,
29918,
786,
15190,
3108,
338,
6213,
13,
1678,
4974,
2295,
3366,
2962,
29918,
10568,
3108,
1275,
29871,
29945,
13,
1678,
4974,
2295,
3366,
16626,
29918,
7099,
388,
3108,
338,
5852,
13,
13,
1678,
716,
29918,
3670,
353,
14104,
292,
29909,
19698,
29889,
3166,
29918,
2917,
29898,
2917,
29897,
13,
1678,
2030,
29918,
5311,
29881,
29918,
2917,
353,
3523,
3032,
20640,
3950,
29889,
657,
29918,
2917,
580,
13,
1678,
716,
29918,
5311,
29881,
29918,
2917,
353,
716,
29918,
3670,
3032,
20640,
3950,
29889,
657,
29918,
2917,
580,
13,
13,
1678,
363,
413,
29896,
29892,
413,
29906,
297,
14319,
29898,
1025,
29918,
5311,
29881,
29918,
2917,
29892,
716,
29918,
5311,
29881,
29918,
2917,
1125,
13,
4706,
4974,
2030,
29918,
5311,
29881,
29918,
2917,
29961,
29895,
29896,
29962,
1275,
716,
29918,
5311,
29881,
29918,
2917,
29961,
29895,
29906,
29962,
13,
13,
13,
29992,
2272,
1688,
29889,
3502,
29889,
1509,
7241,
486,
1973,
703,
26026,
29918,
3389,
29918,
12171,
29918,
29872,
1875,
368,
1159,
13,
1753,
1243,
29918,
9202,
29918,
12857,
29918,
10660,
29918,
4299,
7295,
13,
1678,
16717,
353,
29871,
29900,
29916,
29906,
29900,
29896,
29929,
13,
1678,
7442,
29889,
8172,
29889,
26776,
29898,
26776,
29897,
13,
1678,
15886,
29889,
8172,
29889,
842,
29918,
26776,
29898,
26776,
29897,
13,
1678,
954,
29918,
19057,
353,
29871,
29945,
29900,
29900,
29900,
13,
1678,
921,
353,
7442,
29889,
8172,
29889,
15770,
29918,
8945,
3552,
1949,
29918,
19057,
29892,
29871,
29941,
876,
13,
1678,
281,
353,
7442,
29889,
8172,
29889,
15770,
29918,
8945,
3552,
29941,
29892,
29871,
29896,
876,
13,
1678,
343,
353,
7442,
29889,
6333,
29898,
29916,
29892,
281,
29897,
718,
7442,
29889,
8172,
29889,
15770,
29918,
8945,
3552,
1949,
29918,
19057,
29892,
29871,
29896,
876,
334,
29871,
29896,
29872,
29899,
29946,
13,
13,
1678,
1904,
353,
15886,
29889,
3946,
294,
29889,
9794,
29889,
16941,
2556,
580,
13,
1678,
1904,
29889,
1202,
29898,
13264,
29889,
3946,
294,
29889,
29277,
29889,
29928,
1947,
29898,
2080,
29918,
12181,
7607,
29941,
29892,
511,
10340,
29922,
29896,
876,
13,
13,
1678,
3523,
353,
14104,
292,
29909,
19698,
703,
5311,
29881,
1159,
13,
1678,
1904,
29889,
12198,
29898,
3670,
29892,
6410,
543,
29885,
344,
1159,
13,
13,
1678,
1904,
29889,
9202,
29898,
29916,
29892,
343,
29892,
21502,
12168,
29922,
29945,
29897,
13,
1678,
3523,
29889,
16645,
29918,
12483,
482,
29918,
16908,
29898,
4299,
29889,
20897,
29897,
13,
13,
1678,
921,
353,
7442,
29889,
8172,
29889,
15770,
29918,
8945,
3552,
29896,
29900,
29900,
29892,
29871,
29941,
876,
13,
1678,
343,
353,
7442,
29889,
6333,
29898,
29916,
29892,
281,
29897,
13,
13,
1678,
25383,
353,
1904,
29889,
27711,
29898,
29916,
29897,
13,
13,
1678,
4236,
29918,
6897,
29918,
12765,
353,
7442,
29889,
3317,
29898,
9302,
29889,
6897,
29898,
11965,
18186,
448,
343,
876,
13,
1678,
4974,
4236,
29918,
6897,
29918,
12765,
529,
29871,
29945,
29872,
29899,
29941,
13,
13,
13,
1753,
1243,
29918,
15550,
2133,
7295,
13,
1678,
269,
29887,
29881,
29918,
3670,
353,
15886,
29889,
3946,
294,
29889,
20640,
19427,
29889,
26016,
29928,
29898,
29212,
29922,
29906,
29889,
29900,
29892,
302,
4156,
586,
29922,
5574,
29892,
19399,
29922,
29900,
29889,
29941,
29892,
20228,
29922,
29900,
29889,
29896,
29897,
13,
1678,
5994,
3950,
353,
14104,
292,
29909,
19698,
29898,
13,
4706,
269,
29887,
29881,
29918,
3670,
29892,
6588,
29918,
7099,
388,
29922,
29900,
29889,
29945,
29892,
954,
29918,
786,
15190,
29922,
8516,
29892,
1369,
29918,
10568,
29922,
29945,
29892,
7343,
29918,
7099,
388,
29922,
5574,
29892,
13,
1678,
1723,
13,
1678,
2295,
353,
15886,
29889,
3946,
294,
29889,
20640,
19427,
29889,
643,
6646,
29898,
20640,
3950,
29897,
13,
1678,
716,
29918,
20640,
3950,
353,
15886,
29889,
3946,
294,
29889,
20640,
19427,
29889,
2783,
261,
6646,
29898,
2917,
29897,
13,
1678,
4974,
716,
29918,
20640,
3950,
29889,
657,
29918,
2917,
580,
1275,
5994,
3950,
29889,
657,
29918,
2917,
580,
13,
13,
13,
29992,
2272,
1688,
29889,
3502,
29889,
1509,
7241,
486,
1973,
703,
26026,
29918,
3389,
29918,
12171,
29918,
29872,
1875,
368,
1159,
13,
1753,
1243,
29918,
2962,
29918,
10568,
7295,
13,
1678,
722,
29900,
353,
15886,
29889,
16174,
4197,
29896,
29889,
29900,
29892,
29871,
29906,
29889,
29900,
2314,
13,
1678,
4656,
29879,
29900,
353,
15886,
29889,
23362,
4197,
29900,
29889,
29896,
29892,
29871,
29900,
29889,
29896,
2314,
13,
1678,
4656,
29879,
29918,
392,
29918,
16908,
353,
17288,
5105,
29879,
29900,
29892,
722,
29900,
4638,
13,
13,
1678,
3523,
353,
14104,
292,
29909,
19698,
29898,
13,
4706,
15886,
29889,
3946,
294,
29889,
20640,
19427,
29889,
26016,
29928,
29898,
29212,
29922,
29896,
29889,
29900,
511,
6588,
29918,
7099,
388,
29922,
29900,
29889,
29945,
29892,
1369,
29918,
10568,
29922,
29896,
29892,
13,
1678,
1723,
13,
13,
1678,
3523,
29889,
7302,
29918,
5105,
10070,
29898,
5105,
29879,
29918,
392,
29918,
16908,
29897,
13,
13,
1678,
7442,
29889,
13424,
29889,
9294,
29918,
497,
5358,
29898,
1707,
29900,
29889,
949,
29918,
1767,
3285,
518,
29900,
29889,
29929,
29892,
29871,
29896,
29889,
29929,
2314,
13,
13,
1678,
321,
655,
29918,
1707,
29900,
353,
3523,
29889,
657,
29918,
2536,
327,
29898,
1707,
29900,
29892,
376,
12483,
482,
1159,
13,
13,
1678,
3523,
29889,
7302,
29918,
5105,
10070,
29898,
5105,
29879,
29918,
392,
29918,
16908,
29897,
13,
13,
1678,
7442,
29889,
13424,
29889,
9294,
29918,
497,
5358,
29898,
1707,
29900,
29889,
949,
29918,
1767,
3285,
518,
29900,
29889,
29947,
29892,
29871,
29896,
29889,
29947,
2314,
13,
13,
1678,
7442,
29889,
13424,
29889,
9294,
29918,
497,
5358,
29898,
2603,
29918,
1707,
29900,
29889,
949,
29918,
1767,
3285,
518,
29900,
29889,
29947,
29945,
29892,
29871,
29896,
29889,
29947,
29945,
2314,
13,
13,
13,
29992,
2272,
1688,
29889,
3502,
29889,
1509,
7241,
486,
1973,
703,
26026,
29918,
3389,
29918,
12171,
29918,
29872,
1875,
368,
1159,
13,
1753,
1243,
29918,
16626,
29918,
7099,
388,
7295,
13,
1678,
722,
29900,
353,
15886,
29889,
16174,
4197,
29896,
29889,
29900,
29892,
29871,
29906,
29889,
29900,
2314,
13,
1678,
4656,
29879,
29900,
353,
15886,
29889,
23362,
4197,
29900,
29889,
29896,
29892,
29871,
29900,
29889,
29896,
2314,
13,
1678,
4656,
29879,
29918,
392,
29918,
16908,
353,
17288,
5105,
29879,
29900,
29892,
722,
29900,
4638,
13,
13,
1678,
3523,
353,
14104,
292,
29909,
19698,
29898,
13,
4706,
15886,
29889,
3946,
294,
29889,
20640,
19427,
29889,
26016,
29928,
29898,
29212,
29922,
29906,
29889,
29900,
511,
6588,
29918,
7099,
388,
29922,
29900,
29889,
29945,
29892,
7343,
29918,
7099,
388,
29922,
5574,
29892,
13,
1678,
1723,
13,
13,
1678,
3523,
29889,
7302,
29918,
5105,
10070,
29898,
5105,
29879,
29918,
392,
29918,
16908,
29897,
13,
1678,
3523,
29889,
7302,
29918,
5105,
10070,
29898,
5105,
29879,
29918,
392,
29918,
16908,
29897,
13,
13,
1678,
7442,
29889,
13424,
29889,
9294,
29918,
497,
5358,
29898,
1707,
29900,
29889,
949,
29918,
1767,
3285,
518,
29900,
29889,
29953,
29892,
29871,
29896,
29889,
29953,
2314,
13,
13,
1678,
321,
655,
29918,
1707,
29900,
353,
3523,
29889,
657,
29918,
2536,
327,
29898,
1707,
29900,
29892,
376,
12483,
482,
1159,
13,
1678,
7442,
29889,
13424,
29889,
9294,
29918,
497,
5358,
29898,
2603,
29918,
1707,
29900,
29889,
949,
29918,
1767,
3285,
518,
29900,
29889,
29953,
29946,
29892,
29871,
29896,
29889,
29953,
29946,
2314,
13,
13,
13,
29992,
2272,
1688,
29889,
3502,
29889,
1509,
7241,
486,
1973,
703,
26026,
29918,
3389,
29918,
12171,
29918,
29872,
1875,
368,
1159,
13,
29992,
2272,
1688,
29889,
3502,
29889,
2541,
29918,
10141,
4197,
13264,
29889,
5721,
2666,
29889,
29924,
381,
729,
287,
26910,
2314,
13,
1753,
1243,
29918,
26276,
29918,
705,
5861,
29898,
10141,
1125,
13,
1678,
411,
4742,
29889,
6078,
7295,
13,
4706,
722,
353,
15886,
29889,
16174,
4197,
29896,
29889,
29900,
29892,
29871,
29906,
29889,
29900,
2314,
13,
4706,
4656,
29879,
353,
15886,
29889,
23362,
4197,
29900,
29889,
29896,
29892,
29871,
29900,
29889,
29896,
2314,
13,
13,
4706,
3523,
353,
14104,
292,
29909,
19698,
29898,
13264,
29889,
3946,
294,
29889,
20640,
19427,
29889,
26016,
29928,
29898,
29212,
29922,
29906,
29889,
29900,
511,
6588,
29918,
7099,
388,
29922,
29900,
29889,
29945,
29892,
29897,
13,
13,
1678,
732,
13264,
29889,
2220,
13,
1678,
822,
3394,
29918,
5105,
10070,
7295,
13,
4706,
3523,
29889,
7302,
29918,
5105,
10070,
4197,
29898,
5105,
29879,
29892,
722,
29897,
2314,
13,
13,
1678,
4742,
29889,
3389,
29898,
7302,
29918,
5105,
10070,
29897,
13,
13,
1678,
7442,
29889,
13424,
29889,
9294,
29918,
497,
5358,
29898,
1707,
29889,
949,
29918,
1767,
3285,
518,
29900,
29889,
29947,
29892,
29871,
29896,
29889,
29947,
2314,
13,
1678,
321,
655,
29918,
1707,
353,
3523,
29889,
657,
29918,
2536,
327,
29898,
1707,
29892,
376,
12483,
482,
1159,
13,
1678,
7442,
29889,
13424,
29889,
9294,
29918,
497,
5358,
29898,
2603,
29918,
1707,
29889,
949,
29918,
1767,
3285,
518,
29900,
29889,
29947,
29945,
29892,
29871,
29896,
29889,
29947,
29945,
2314,
13,
13,
1678,
411,
4742,
29889,
6078,
7295,
13,
4706,
3523,
29889,
17505,
29918,
8552,
4197,
1707,
2314,
13,
4706,
3523,
29889,
26276,
29918,
705,
5861,
580,
13,
13,
1678,
7442,
29889,
13424,
29889,
9294,
29918,
497,
5358,
29898,
2603,
29918,
1707,
29889,
949,
29918,
1767,
3285,
518,
29900,
29889,
29947,
29892,
29871,
29896,
29889,
29947,
2314,
13,
1678,
7442,
29889,
13424,
29889,
9294,
29918,
497,
5358,
29898,
1707,
29889,
949,
29918,
1767,
3285,
518,
29900,
29889,
29947,
29945,
29892,
29871,
29896,
29889,
29947,
29945,
2314,
13,
13,
1678,
411,
4742,
29889,
6078,
7295,
13,
4706,
3523,
29889,
26276,
29918,
705,
5861,
580,
13,
13,
1678,
7442,
29889,
13424,
29889,
9294,
29918,
497,
5358,
29898,
1707,
29889,
949,
29918,
1767,
3285,
518,
29900,
29889,
29947,
29892,
29871,
29896,
29889,
29947,
2314,
13,
1678,
7442,
29889,
13424,
29889,
9294,
29918,
497,
5358,
29898,
2603,
29918,
1707,
29889,
949,
29918,
1767,
3285,
518,
29900,
29889,
29947,
29945,
29892,
29871,
29896,
29889,
29947,
29945,
2314,
13,
2
] |
app/auth/passwords.py | LambArchie/Competition-Manager | 0 | 115230 | <reponame>LambArchie/Competition-Manager<gh_stars>0
"""
Controls passwords checks
"""
from hashlib import sha1
from urllib.request import Request, urlopen
from flask import current_app
PWNED_PASSWORD_API = "https://api.pwnedpasswords.com/range/"
def strength_check(password):
"""Checks if password reaches minimum requirement
Returns True if meets requirements, or string with error if issue"""
check = length_check(password)
if check != 0:
return check
if current_app.config['HIBP_PW_CHECK'] is True:
check = pwned_passwords_check(password)
if check != 0:
return "Password has been leaked {} times before".format(check)
return 0
def pwned_passwords_check(password):
"""Uses pwned passwords api"""
pw_hash = sha1(password.encode()).hexdigest()
hash_prefix = pw_hash[:5]
hash_suffix = pw_hash[5:].upper()
response = Request(url=PWNED_PASSWORD_API + hash_prefix, headers={
'User-Agent': 'Competition Manager'})
for line in urlopen(response).read().decode().split('\r\n'):
suffix, count = line.split(":")
if suffix == hash_suffix:
return count
return 0
def length_check(password):
"""Checks minimum length, gets value from config"""
if len(password) < int(current_app.config['MIN_LENGTH']):
return "Needs to be {} characters long".format(current_app.config['MIN_LENGTH'])
return 0
| [
1,
529,
276,
1112,
420,
29958,
29931,
1117,
13197,
347,
29914,
6843,
300,
654,
29899,
3260,
29966,
12443,
29918,
303,
1503,
29958,
29900,
13,
15945,
29908,
13,
17825,
27630,
12747,
13,
15945,
29908,
13,
3166,
6608,
1982,
1053,
528,
29874,
29896,
13,
3166,
3142,
1982,
29889,
3827,
1053,
10729,
29892,
5065,
417,
2238,
13,
3166,
29784,
1053,
1857,
29918,
932,
13,
13,
29925,
16048,
3352,
29918,
25711,
17013,
29918,
8787,
353,
376,
991,
597,
2754,
29889,
29886,
1233,
287,
5630,
29879,
29889,
510,
29914,
3881,
12975,
13,
13,
1753,
9324,
29918,
3198,
29898,
5630,
1125,
13,
1678,
9995,
5596,
29879,
565,
4800,
22170,
9212,
11809,
13,
1678,
16969,
5852,
565,
28103,
11780,
29892,
470,
1347,
411,
1059,
565,
2228,
15945,
29908,
13,
1678,
1423,
353,
3309,
29918,
3198,
29898,
5630,
29897,
13,
1678,
565,
1423,
2804,
29871,
29900,
29901,
13,
4706,
736,
1423,
13,
1678,
565,
1857,
29918,
932,
29889,
2917,
1839,
29950,
8979,
29925,
29918,
29925,
29956,
29918,
3210,
16658,
2033,
338,
5852,
29901,
13,
4706,
1423,
353,
282,
1233,
287,
29918,
5630,
29879,
29918,
3198,
29898,
5630,
29897,
13,
4706,
565,
1423,
2804,
29871,
29900,
29901,
13,
9651,
736,
376,
10048,
756,
1063,
454,
12535,
6571,
3064,
1434,
1642,
4830,
29898,
3198,
29897,
13,
1678,
736,
29871,
29900,
13,
13,
1753,
282,
1233,
287,
29918,
5630,
29879,
29918,
3198,
29898,
5630,
1125,
13,
1678,
9995,
15922,
267,
282,
1233,
287,
27630,
7882,
15945,
29908,
13,
1678,
282,
29893,
29918,
8568,
353,
528,
29874,
29896,
29898,
5630,
29889,
12508,
16655,
20970,
7501,
342,
580,
13,
1678,
6608,
29918,
13506,
353,
282,
29893,
29918,
8568,
7503,
29945,
29962,
13,
1678,
6608,
29918,
2146,
600,
861,
353,
282,
29893,
29918,
8568,
29961,
29945,
29901,
1822,
21064,
580,
13,
1678,
2933,
353,
10729,
29898,
2271,
29922,
29925,
16048,
3352,
29918,
25711,
17013,
29918,
8787,
718,
6608,
29918,
13506,
29892,
9066,
3790,
13,
4706,
525,
2659,
29899,
19661,
2396,
525,
6843,
300,
654,
15629,
29915,
1800,
13,
1678,
363,
1196,
297,
5065,
417,
2238,
29898,
5327,
467,
949,
2141,
13808,
2141,
5451,
28909,
29878,
29905,
29876,
29374,
13,
4706,
25557,
29892,
2302,
353,
1196,
29889,
5451,
703,
29901,
1159,
13,
4706,
565,
25557,
1275,
6608,
29918,
2146,
600,
861,
29901,
13,
9651,
736,
2302,
13,
1678,
736,
29871,
29900,
13,
13,
1753,
3309,
29918,
3198,
29898,
5630,
1125,
13,
1678,
9995,
5596,
29879,
9212,
3309,
29892,
4947,
995,
515,
2295,
15945,
29908,
13,
1678,
565,
7431,
29898,
5630,
29897,
529,
938,
29898,
3784,
29918,
932,
29889,
2917,
1839,
16173,
29918,
19433,
2033,
1125,
13,
4706,
736,
376,
8139,
5779,
304,
367,
6571,
4890,
1472,
1642,
4830,
29898,
3784,
29918,
932,
29889,
2917,
1839,
16173,
29918,
19433,
11287,
13,
1678,
736,
29871,
29900,
13,
2
] |
imblearn/utils/tests/test_validation.py | fengtongtong/imbalanced-learning | 1 | 83223 | <reponame>fengtongtong/imbalanced-learning
"""Test for the validation helper"""
# Authors: <NAME> <<EMAIL>>
# <NAME>
# License: MIT
from collections import Counter
import numpy as np
import pytest
from pytest import raises
from sklearn.neighbors.base import KNeighborsMixin
from sklearn.neighbors import NearestNeighbors
from sklearn.utils import check_random_state
from sklearn.externals import joblib
from sklearn.utils.testing import assert_array_equal
from imblearn.utils.testing import warns
from imblearn.utils import check_neighbors_object
from imblearn.utils import check_ratio
from imblearn.utils import hash_X_y
from imblearn.utils import check_target_type
def test_check_neighbors_object():
name = 'n_neighbors'
n_neighbors = 1
estimator = check_neighbors_object(name, n_neighbors)
assert issubclass(type(estimator), KNeighborsMixin)
assert estimator.n_neighbors == 1
estimator = check_neighbors_object(name, n_neighbors, 1)
assert issubclass(type(estimator), KNeighborsMixin)
assert estimator.n_neighbors == 2
estimator = NearestNeighbors(n_neighbors)
assert estimator is check_neighbors_object(name, estimator)
n_neighbors = 'rnd'
with raises(ValueError, match="has to be one of"):
check_neighbors_object(name, n_neighbors)
@pytest.mark.parametrize(
"target, output_target",
[(np.array([0, 1, 1]), np.array([0, 1, 1])),
(np.array([0, 1, 2]), np.array([0, 1, 2])),
(np.array([[0, 1], [1, 0]]), np.array([1, 0]))]
)
def test_check_target_type(target, output_target):
converted_target = check_target_type(target.astype(int))
assert_array_equal(converted_target, output_target.astype(int))
@pytest.mark.parametrize(
"target, output_target, is_ova",
[(np.array([0, 1, 1]), np.array([0, 1, 1]), False),
(np.array([0, 1, 2]), np.array([0, 1, 2]), False),
(np.array([[0, 1], [1, 0]]), np.array([1, 0]), True)]
)
def test_check_target_type_ova(target, output_target, is_ova):
converted_target, binarize_target = check_target_type(
target.astype(int), indicate_one_vs_all=True)
assert_array_equal(converted_target, output_target.astype(int))
assert binarize_target == is_ova
def test_check_target_warning():
target = np.arange(4).reshape((2, 2))
with pytest.warns(UserWarning, match='should be of types'):
check_target_type(target)
def test_check_ratio_error():
with raises(ValueError, match="'sampling_type' should be one of"):
check_ratio('auto', np.array([1, 2, 3]), 'rnd')
error_regex = "The target 'y' needs to have more than 1 class."
with raises(ValueError, match=error_regex):
check_ratio('auto', np.ones((10, )), 'over-sampling')
error_regex = "When 'ratio' is a string, it needs to be one of"
with raises(ValueError, match=error_regex):
check_ratio('rnd', np.array([1, 2, 3]), 'over-sampling')
def test_ratio_all_over_sampling():
y = np.array([1] * 50 + [2] * 100 + [3] * 25)
for each in ('all', 'auto'):
assert check_ratio(each, y, 'over-sampling') == {1: 50, 2: 0, 3: 75}
def test_ratio_all_under_sampling():
y = np.array([1] * 50 + [2] * 100 + [3] * 25)
ratio = check_ratio('all', y, 'under-sampling')
assert ratio == {1: 25, 2: 25, 3: 25}
def test_ratio_majority_over_sampling():
error_regex = "'ratio'='majority' cannot be used with over-sampler."
with raises(ValueError, match=error_regex):
check_ratio('majority', np.array([1, 2, 3]), 'over-sampling')
def test_ratio_majority_under_sampling():
y = np.array([1] * 50 + [2] * 100 + [3] * 25)
ratio = check_ratio('majority', y, 'under-sampling')
assert ratio == {2: 25}
def test_ratio_not_minority_over_sampling():
y = np.array([1] * 50 + [2] * 100 + [3] * 25)
ratio = check_ratio('not minority', y, 'over-sampling')
assert ratio == {1: 50, 2: 0}
def test_ratio_not_minority_under_sampling():
y = np.array([1] * 50 + [2] * 100 + [3] * 25)
ratio = check_ratio('not minority', y, 'under-sampling')
assert ratio == {1: 25, 2: 25}
ratio = check_ratio('auto', y, 'under-sampling')
assert ratio == {1: 25, 2: 25}
def test_ratio_minority_over_sampling():
y = np.array([1] * 50 + [2] * 100 + [3] * 25)
ratio = check_ratio('minority', y, 'over-sampling')
assert ratio == {3: 75}
def test_ratio_minority_under_sampling():
error_regex = "'ratio'='minority' cannot be used with under-sampler."
with raises(ValueError, match=error_regex):
check_ratio('minority', np.array([1, 2, 3]), 'under-sampling')
def test_ratio_dict_error():
y = np.array([1] * 50 + [2] * 100 + [3] * 25)
ratio = {1: -100, 2: 50, 3: 25}
with raises(ValueError, match="in a class cannot be negative."):
check_ratio(ratio, y, 'under-sampling')
ratio = {10: 10}
with raises(ValueError, match="are not present in the data."):
check_ratio(ratio, y, 'over-sampling')
ratio = {1: 45, 2: 100, 3: 70}
error_regex = ("With over-sampling methods, the number of samples in a"
" class should be greater or equal to the original number"
" of samples. Originally, there is 50 samples and 45"
" samples are asked.")
with raises(ValueError, match=error_regex):
check_ratio(ratio, y, 'over-sampling')
error_regex = ("With under-sampling methods, the number of samples in a"
" class should be less or equal to the original number of"
" samples. Originally, there is 25 samples and 70 samples"
" are asked.")
with raises(ValueError, match=error_regex):
check_ratio(ratio, y, 'under-sampling')
def test_ratio_dict_over_sampling():
y = np.array([1] * 50 + [2] * 100 + [3] * 25)
ratio = {1: 70, 2: 100, 3: 70}
ratio_ = check_ratio(ratio, y, 'over-sampling')
assert ratio_ == {1: 20, 2: 0, 3: 45}
ratio = {1: 70, 2: 140, 3: 70}
expected_msg = ("After over-sampling, the number of samples \(140\) in"
" class 2 will be larger than the number of samples in the"
" majority class \(class #2 -> 100\)")
with warns(UserWarning, expected_msg):
check_ratio(ratio, y, 'over-sampling')
def test_ratio_dict_under_sampling():
y = np.array([1] * 50 + [2] * 100 + [3] * 25)
ratio = {1: 30, 2: 45, 3: 25}
ratio_ = check_ratio(ratio, y, 'under-sampling')
assert ratio_ == ratio
def test_ratio_callable():
y = np.array([1] * 50 + [2] * 100 + [3] * 25)
def ratio_func(y):
# this function could create an equal number of samples
target_stats = Counter(y)
n_samples = max(target_stats.values())
return {key: int(n_samples)
for key in target_stats.keys()}
ratio_ = check_ratio(ratio_func, y, 'over-sampling')
assert ratio_ == {1: 50, 2: 0, 3: 75}
def test_ratio_callable_args():
y = np.array([1] * 50 + [2] * 100 + [3] * 25)
multiplier = {1: 1.5, 2: 1, 3: 3}
def ratio_func(y, multiplier):
"""samples such that each class will be affected by the multiplier."""
target_stats = Counter(y)
return {key: int(values * multiplier[key])
for key, values in target_stats.items()}
ratio_ = check_ratio(ratio_func, y, 'over-sampling',
multiplier=multiplier)
assert ratio_ == {1: 25, 2: 0, 3: 50}
def test_hash_X_y():
rng = check_random_state(0)
X = rng.randn(2000, 20)
y = np.array([0] * 500 + [1] * 1500)
assert hash_X_y(X, y, 10, 10) == (joblib.hash(X[::200, ::2]),
joblib.hash(y[::200]))
X = rng.randn(5, 2)
y = np.array([0] * 2 + [1] * 3)
# all data will be used in this case
assert hash_X_y(X, y) == (joblib.hash(X), joblib.hash(y))
| [
1,
529,
276,
1112,
420,
29958,
29888,
996,
29873,
549,
29873,
549,
29914,
326,
5521,
8362,
29899,
21891,
13,
15945,
29908,
3057,
363,
278,
8845,
16876,
15945,
29908,
13,
29937,
13189,
943,
29901,
529,
5813,
29958,
3532,
26862,
6227,
6778,
13,
29937,
3986,
529,
5813,
29958,
13,
29937,
19245,
29901,
341,
1806,
13,
13,
3166,
16250,
1053,
315,
5336,
13,
13,
5215,
12655,
408,
7442,
13,
5215,
11451,
1688,
13,
3166,
11451,
1688,
1053,
1153,
4637,
13,
13,
3166,
2071,
19668,
29889,
484,
1141,
29890,
943,
29889,
3188,
1053,
476,
8139,
1141,
29890,
943,
29924,
861,
262,
13,
3166,
2071,
19668,
29889,
484,
1141,
29890,
943,
1053,
26206,
342,
8139,
1141,
29890,
943,
13,
3166,
2071,
19668,
29889,
13239,
1053,
1423,
29918,
8172,
29918,
3859,
13,
3166,
2071,
19668,
29889,
735,
725,
1338,
1053,
4982,
1982,
13,
3166,
2071,
19668,
29889,
13239,
29889,
13424,
1053,
4974,
29918,
2378,
29918,
11745,
13,
13,
3166,
527,
569,
2753,
29889,
13239,
29889,
13424,
1053,
1370,
1983,
13,
3166,
527,
569,
2753,
29889,
13239,
1053,
1423,
29918,
484,
1141,
29890,
943,
29918,
3318,
13,
3166,
527,
569,
2753,
29889,
13239,
1053,
1423,
29918,
3605,
601,
13,
3166,
527,
569,
2753,
29889,
13239,
1053,
6608,
29918,
29990,
29918,
29891,
13,
3166,
527,
569,
2753,
29889,
13239,
1053,
1423,
29918,
5182,
29918,
1853,
13,
13,
13,
1753,
1243,
29918,
3198,
29918,
484,
1141,
29890,
943,
29918,
3318,
7295,
13,
1678,
1024,
353,
525,
29876,
29918,
484,
1141,
29890,
943,
29915,
13,
1678,
302,
29918,
484,
1141,
29890,
943,
353,
29871,
29896,
13,
1678,
4844,
1061,
353,
1423,
29918,
484,
1141,
29890,
943,
29918,
3318,
29898,
978,
29892,
302,
29918,
484,
1141,
29890,
943,
29897,
13,
1678,
4974,
338,
1491,
1990,
29898,
1853,
29898,
342,
326,
1061,
511,
476,
8139,
1141,
29890,
943,
29924,
861,
262,
29897,
13,
1678,
4974,
4844,
1061,
29889,
29876,
29918,
484,
1141,
29890,
943,
1275,
29871,
29896,
13,
1678,
4844,
1061,
353,
1423,
29918,
484,
1141,
29890,
943,
29918,
3318,
29898,
978,
29892,
302,
29918,
484,
1141,
29890,
943,
29892,
29871,
29896,
29897,
13,
1678,
4974,
338,
1491,
1990,
29898,
1853,
29898,
342,
326,
1061,
511,
476,
8139,
1141,
29890,
943,
29924,
861,
262,
29897,
13,
1678,
4974,
4844,
1061,
29889,
29876,
29918,
484,
1141,
29890,
943,
1275,
29871,
29906,
13,
1678,
4844,
1061,
353,
26206,
342,
8139,
1141,
29890,
943,
29898,
29876,
29918,
484,
1141,
29890,
943,
29897,
13,
1678,
4974,
4844,
1061,
338,
1423,
29918,
484,
1141,
29890,
943,
29918,
3318,
29898,
978,
29892,
4844,
1061,
29897,
13,
1678,
302,
29918,
484,
1141,
29890,
943,
353,
525,
29878,
299,
29915,
13,
1678,
411,
1153,
4637,
29898,
1917,
2392,
29892,
1993,
543,
5349,
304,
367,
697,
310,
29908,
1125,
13,
4706,
1423,
29918,
484,
1141,
29890,
943,
29918,
3318,
29898,
978,
29892,
302,
29918,
484,
1141,
29890,
943,
29897,
13,
13,
13,
29992,
2272,
1688,
29889,
3502,
29889,
3207,
300,
374,
911,
29898,
13,
1678,
376,
5182,
29892,
1962,
29918,
5182,
613,
13,
1678,
17288,
9302,
29889,
2378,
4197,
29900,
29892,
29871,
29896,
29892,
29871,
29896,
11724,
7442,
29889,
2378,
4197,
29900,
29892,
29871,
29896,
29892,
29871,
29896,
2314,
511,
13,
268,
313,
9302,
29889,
2378,
4197,
29900,
29892,
29871,
29896,
29892,
29871,
29906,
11724,
7442,
29889,
2378,
4197,
29900,
29892,
29871,
29896,
29892,
29871,
29906,
2314,
511,
13,
268,
313,
9302,
29889,
2378,
4197,
29961,
29900,
29892,
29871,
29896,
1402,
518,
29896,
29892,
29871,
29900,
5262,
511,
7442,
29889,
2378,
4197,
29896,
29892,
29871,
29900,
12622,
29962,
13,
29897,
13,
1753,
1243,
29918,
3198,
29918,
5182,
29918,
1853,
29898,
5182,
29892,
1962,
29918,
5182,
1125,
13,
1678,
11543,
29918,
5182,
353,
1423,
29918,
5182,
29918,
1853,
29898,
5182,
29889,
579,
668,
29898,
524,
876,
13,
1678,
4974,
29918,
2378,
29918,
11745,
29898,
13441,
287,
29918,
5182,
29892,
1962,
29918,
5182,
29889,
579,
668,
29898,
524,
876,
13,
13,
13,
29992,
2272,
1688,
29889,
3502,
29889,
3207,
300,
374,
911,
29898,
13,
1678,
376,
5182,
29892,
1962,
29918,
5182,
29892,
338,
29918,
4273,
613,
13,
1678,
17288,
9302,
29889,
2378,
4197,
29900,
29892,
29871,
29896,
29892,
29871,
29896,
11724,
7442,
29889,
2378,
4197,
29900,
29892,
29871,
29896,
29892,
29871,
29896,
11724,
7700,
511,
13,
268,
313,
9302,
29889,
2378,
4197,
29900,
29892,
29871,
29896,
29892,
29871,
29906,
11724,
7442,
29889,
2378,
4197,
29900,
29892,
29871,
29896,
29892,
29871,
29906,
11724,
7700,
511,
13,
268,
313,
9302,
29889,
2378,
4197,
29961,
29900,
29892,
29871,
29896,
1402,
518,
29896,
29892,
29871,
29900,
5262,
511,
7442,
29889,
2378,
4197,
29896,
29892,
29871,
29900,
11724,
5852,
4638,
13,
29897,
13,
1753,
1243,
29918,
3198,
29918,
5182,
29918,
1853,
29918,
4273,
29898,
5182,
29892,
1962,
29918,
5182,
29892,
338,
29918,
4273,
1125,
13,
1678,
11543,
29918,
5182,
29892,
9016,
279,
675,
29918,
5182,
353,
1423,
29918,
5182,
29918,
1853,
29898,
13,
4706,
3646,
29889,
579,
668,
29898,
524,
511,
12266,
29918,
650,
29918,
4270,
29918,
497,
29922,
5574,
29897,
13,
1678,
4974,
29918,
2378,
29918,
11745,
29898,
13441,
287,
29918,
5182,
29892,
1962,
29918,
5182,
29889,
579,
668,
29898,
524,
876,
13,
1678,
4974,
9016,
279,
675,
29918,
5182,
1275,
338,
29918,
4273,
13,
13,
13,
1753,
1243,
29918,
3198,
29918,
5182,
29918,
27392,
7295,
13,
1678,
3646,
353,
7442,
29889,
279,
927,
29898,
29946,
467,
690,
14443,
3552,
29906,
29892,
29871,
29906,
876,
13,
1678,
411,
11451,
1688,
29889,
4495,
1983,
29898,
2659,
22709,
29892,
1993,
2433,
9344,
367,
310,
4072,
29374,
13,
4706,
1423,
29918,
5182,
29918,
1853,
29898,
5182,
29897,
13,
13,
13,
1753,
1243,
29918,
3198,
29918,
3605,
601,
29918,
2704,
7295,
13,
1678,
411,
1153,
4637,
29898,
1917,
2392,
29892,
1993,
543,
29915,
13445,
10335,
29918,
1853,
29915,
881,
367,
697,
310,
29908,
1125,
13,
4706,
1423,
29918,
3605,
601,
877,
6921,
742,
7442,
29889,
2378,
4197,
29896,
29892,
29871,
29906,
29892,
29871,
29941,
11724,
525,
29878,
299,
1495,
13,
13,
1678,
1059,
29918,
13087,
353,
376,
1576,
3646,
525,
29891,
29915,
4225,
304,
505,
901,
1135,
29871,
29896,
770,
1213,
13,
1678,
411,
1153,
4637,
29898,
1917,
2392,
29892,
1993,
29922,
2704,
29918,
13087,
1125,
13,
4706,
1423,
29918,
3605,
601,
877,
6921,
742,
7442,
29889,
2873,
3552,
29896,
29900,
29892,
1723,
511,
525,
957,
29899,
13445,
10335,
1495,
13,
13,
1678,
1059,
29918,
13087,
353,
376,
10401,
525,
3605,
601,
29915,
338,
263,
1347,
29892,
372,
4225,
304,
367,
697,
310,
29908,
13,
1678,
411,
1153,
4637,
29898,
1917,
2392,
29892,
1993,
29922,
2704,
29918,
13087,
1125,
13,
4706,
1423,
29918,
3605,
601,
877,
29878,
299,
742,
7442,
29889,
2378,
4197,
29896,
29892,
29871,
29906,
29892,
29871,
29941,
11724,
525,
957,
29899,
13445,
10335,
1495,
13,
13,
13,
1753,
1243,
29918,
3605,
601,
29918,
497,
29918,
957,
29918,
13445,
10335,
7295,
13,
1678,
343,
353,
7442,
29889,
2378,
4197,
29896,
29962,
334,
29871,
29945,
29900,
718,
518,
29906,
29962,
334,
29871,
29896,
29900,
29900,
718,
518,
29941,
29962,
334,
29871,
29906,
29945,
29897,
13,
1678,
363,
1269,
297,
6702,
497,
742,
525,
6921,
29374,
13,
4706,
4974,
1423,
29918,
3605,
601,
29898,
4204,
29892,
343,
29892,
525,
957,
29899,
13445,
10335,
1495,
1275,
426,
29896,
29901,
29871,
29945,
29900,
29892,
29871,
29906,
29901,
29871,
29900,
29892,
29871,
29941,
29901,
29871,
29955,
29945,
29913,
13,
13,
13,
1753,
1243,
29918,
3605,
601,
29918,
497,
29918,
5062,
29918,
13445,
10335,
7295,
13,
1678,
343,
353,
7442,
29889,
2378,
4197,
29896,
29962,
334,
29871,
29945,
29900,
718,
518,
29906,
29962,
334,
29871,
29896,
29900,
29900,
718,
518,
29941,
29962,
334,
29871,
29906,
29945,
29897,
13,
1678,
11959,
353,
1423,
29918,
3605,
601,
877,
497,
742,
343,
29892,
525,
5062,
29899,
13445,
10335,
1495,
13,
1678,
4974,
11959,
1275,
426,
29896,
29901,
29871,
29906,
29945,
29892,
29871,
29906,
29901,
29871,
29906,
29945,
29892,
29871,
29941,
29901,
29871,
29906,
29945,
29913,
13,
13,
13,
1753,
1243,
29918,
3605,
601,
29918,
21355,
537,
29918,
957,
29918,
13445,
10335,
7295,
13,
1678,
1059,
29918,
13087,
353,
13577,
3605,
601,
29915,
2433,
21355,
537,
29915,
2609,
367,
1304,
411,
975,
29899,
13445,
20069,
1213,
13,
1678,
411,
1153,
4637,
29898,
1917,
2392,
29892,
1993,
29922,
2704,
29918,
13087,
1125,
13,
4706,
1423,
29918,
3605,
601,
877,
21355,
537,
742,
7442,
29889,
2378,
4197,
29896,
29892,
29871,
29906,
29892,
29871,
29941,
11724,
525,
957,
29899,
13445,
10335,
1495,
13,
13,
13,
1753,
1243,
29918,
3605,
601,
29918,
21355,
537,
29918,
5062,
29918,
13445,
10335,
7295,
13,
1678,
343,
353,
7442,
29889,
2378,
4197,
29896,
29962,
334,
29871,
29945,
29900,
718,
518,
29906,
29962,
334,
29871,
29896,
29900,
29900,
718,
518,
29941,
29962,
334,
29871,
29906,
29945,
29897,
13,
1678,
11959,
353,
1423,
29918,
3605,
601,
877,
21355,
537,
742,
343,
29892,
525,
5062,
29899,
13445,
10335,
1495,
13,
1678,
4974,
11959,
1275,
426,
29906,
29901,
29871,
29906,
29945,
29913,
13,
13,
13,
1753,
1243,
29918,
3605,
601,
29918,
1333,
29918,
1195,
272,
537,
29918,
957,
29918,
13445,
10335,
7295,
13,
1678,
343,
353,
7442,
29889,
2378,
4197,
29896,
29962,
334,
29871,
29945,
29900,
718,
518,
29906,
29962,
334,
29871,
29896,
29900,
29900,
718,
518,
29941,
29962,
334,
29871,
29906,
29945,
29897,
13,
1678,
11959,
353,
1423,
29918,
3605,
601,
877,
1333,
9461,
537,
742,
343,
29892,
525,
957,
29899,
13445,
10335,
1495,
13,
1678,
4974,
11959,
1275,
426,
29896,
29901,
29871,
29945,
29900,
29892,
29871,
29906,
29901,
29871,
29900,
29913,
13,
13,
13,
1753,
1243,
29918,
3605,
601,
29918,
1333,
29918,
1195,
272,
537,
29918,
5062,
29918,
13445,
10335,
7295,
13,
1678,
343,
353,
7442,
29889,
2378,
4197,
29896,
29962,
334,
29871,
29945,
29900,
718,
518,
29906,
29962,
334,
29871,
29896,
29900,
29900,
718,
518,
29941,
29962,
334,
29871,
29906,
29945,
29897,
13,
1678,
11959,
353,
1423,
29918,
3605,
601,
877,
1333,
9461,
537,
742,
343,
29892,
525,
5062,
29899,
13445,
10335,
1495,
13,
1678,
4974,
11959,
1275,
426,
29896,
29901,
29871,
29906,
29945,
29892,
29871,
29906,
29901,
29871,
29906,
29945,
29913,
13,
1678,
11959,
353,
1423,
29918,
3605,
601,
877,
6921,
742,
343,
29892,
525,
5062,
29899,
13445,
10335,
1495,
13,
1678,
4974,
11959,
1275,
426,
29896,
29901,
29871,
29906,
29945,
29892,
29871,
29906,
29901,
29871,
29906,
29945,
29913,
13,
13,
13,
1753,
1243,
29918,
3605,
601,
29918,
1195,
272,
537,
29918,
957,
29918,
13445,
10335,
7295,
13,
1678,
343,
353,
7442,
29889,
2378,
4197,
29896,
29962,
334,
29871,
29945,
29900,
718,
518,
29906,
29962,
334,
29871,
29896,
29900,
29900,
718,
518,
29941,
29962,
334,
29871,
29906,
29945,
29897,
13,
1678,
11959,
353,
1423,
29918,
3605,
601,
877,
1195,
272,
537,
742,
343,
29892,
525,
957,
29899,
13445,
10335,
1495,
13,
1678,
4974,
11959,
1275,
426,
29941,
29901,
29871,
29955,
29945,
29913,
13,
13,
13,
1753,
1243,
29918,
3605,
601,
29918,
1195,
272,
537,
29918,
5062,
29918,
13445,
10335,
7295,
13,
1678,
1059,
29918,
13087,
353,
13577,
3605,
601,
29915,
2433,
1195,
272,
537,
29915,
2609,
367,
1304,
411,
1090,
29899,
13445,
20069,
1213,
13,
1678,
411,
1153,
4637,
29898,
1917,
2392,
29892,
1993,
29922,
2704,
29918,
13087,
1125,
13,
4706,
1423,
29918,
3605,
601,
877,
1195,
272,
537,
742,
7442,
29889,
2378,
4197,
29896,
29892,
29871,
29906,
29892,
29871,
29941,
11724,
525,
5062,
29899,
13445,
10335,
1495,
13,
13,
13,
1753,
1243,
29918,
3605,
601,
29918,
8977,
29918,
2704,
7295,
13,
1678,
343,
353,
7442,
29889,
2378,
4197,
29896,
29962,
334,
29871,
29945,
29900,
718,
518,
29906,
29962,
334,
29871,
29896,
29900,
29900,
718,
518,
29941,
29962,
334,
29871,
29906,
29945,
29897,
13,
1678,
11959,
353,
426,
29896,
29901,
448,
29896,
29900,
29900,
29892,
29871,
29906,
29901,
29871,
29945,
29900,
29892,
29871,
29941,
29901,
29871,
29906,
29945,
29913,
13,
1678,
411,
1153,
4637,
29898,
1917,
2392,
29892,
1993,
543,
262,
263,
770,
2609,
367,
8178,
1213,
1125,
13,
4706,
1423,
29918,
3605,
601,
29898,
3605,
601,
29892,
343,
29892,
525,
5062,
29899,
13445,
10335,
1495,
13,
1678,
11959,
353,
426,
29896,
29900,
29901,
29871,
29896,
29900,
29913,
13,
1678,
411,
1153,
4637,
29898,
1917,
2392,
29892,
1993,
543,
598,
451,
2198,
297,
278,
848,
1213,
1125,
13,
4706,
1423,
29918,
3605,
601,
29898,
3605,
601,
29892,
343,
29892,
525,
957,
29899,
13445,
10335,
1495,
13,
1678,
11959,
353,
426,
29896,
29901,
29871,
29946,
29945,
29892,
29871,
29906,
29901,
29871,
29896,
29900,
29900,
29892,
29871,
29941,
29901,
29871,
29955,
29900,
29913,
13,
1678,
1059,
29918,
13087,
353,
4852,
3047,
975,
29899,
13445,
10335,
3519,
29892,
278,
1353,
310,
11916,
297,
263,
29908,
13,
462,
259,
376,
770,
881,
367,
7621,
470,
5186,
304,
278,
2441,
1353,
29908,
13,
462,
259,
376,
310,
11916,
29889,
22118,
635,
29892,
727,
338,
29871,
29945,
29900,
11916,
322,
29871,
29946,
29945,
29908,
13,
462,
259,
376,
11916,
526,
4433,
23157,
13,
1678,
411,
1153,
4637,
29898,
1917,
2392,
29892,
1993,
29922,
2704,
29918,
13087,
1125,
13,
4706,
1423,
29918,
3605,
601,
29898,
3605,
601,
29892,
343,
29892,
525,
957,
29899,
13445,
10335,
1495,
13,
13,
1678,
1059,
29918,
13087,
353,
4852,
3047,
1090,
29899,
13445,
10335,
3519,
29892,
278,
1353,
310,
11916,
297,
263,
29908,
13,
462,
259,
376,
770,
881,
367,
3109,
470,
5186,
304,
278,
2441,
1353,
310,
29908,
13,
462,
259,
376,
11916,
29889,
22118,
635,
29892,
727,
338,
29871,
29906,
29945,
11916,
322,
29871,
29955,
29900,
11916,
29908,
13,
462,
259,
376,
526,
4433,
23157,
13,
1678,
411,
1153,
4637,
29898,
1917,
2392,
29892,
1993,
29922,
2704,
29918,
13087,
1125,
13,
462,
4706,
1423,
29918,
3605,
601,
29898,
3605,
601,
29892,
343,
29892,
525,
5062,
29899,
13445,
10335,
1495,
13,
13,
13,
1753,
1243,
29918,
3605,
601,
29918,
8977,
29918,
957,
29918,
13445,
10335,
7295,
13,
1678,
343,
353,
7442,
29889,
2378,
4197,
29896,
29962,
334,
29871,
29945,
29900,
718,
518,
29906,
29962,
334,
29871,
29896,
29900,
29900,
718,
518,
29941,
29962,
334,
29871,
29906,
29945,
29897,
13,
1678,
11959,
353,
426,
29896,
29901,
29871,
29955,
29900,
29892,
29871,
29906,
29901,
29871,
29896,
29900,
29900,
29892,
29871,
29941,
29901,
29871,
29955,
29900,
29913,
13,
1678,
11959,
29918,
353,
1423,
29918,
3605,
601,
29898,
3605,
601,
29892,
343,
29892,
525,
957,
29899,
13445,
10335,
1495,
13,
1678,
4974,
11959,
29918,
1275,
426,
29896,
29901,
29871,
29906,
29900,
29892,
29871,
29906,
29901,
29871,
29900,
29892,
29871,
29941,
29901,
29871,
29946,
29945,
29913,
13,
1678,
11959,
353,
426,
29896,
29901,
29871,
29955,
29900,
29892,
29871,
29906,
29901,
29871,
29896,
29946,
29900,
29892,
29871,
29941,
29901,
29871,
29955,
29900,
29913,
13,
1678,
3806,
29918,
7645,
353,
4852,
13555,
975,
29899,
13445,
10335,
29892,
278,
1353,
310,
11916,
4269,
29896,
29946,
29900,
7244,
297,
29908,
13,
462,
1678,
376,
770,
29871,
29906,
674,
367,
7200,
1135,
278,
1353,
310,
11916,
297,
278,
29908,
13,
462,
1678,
376,
13638,
770,
4269,
1990,
396,
29906,
1599,
29871,
29896,
29900,
29900,
7244,
1159,
13,
1678,
411,
1370,
1983,
29898,
2659,
22709,
29892,
3806,
29918,
7645,
1125,
13,
4706,
1423,
29918,
3605,
601,
29898,
3605,
601,
29892,
343,
29892,
525,
957,
29899,
13445,
10335,
1495,
13,
13,
13,
1753,
1243,
29918,
3605,
601,
29918,
8977,
29918,
5062,
29918,
13445,
10335,
7295,
13,
1678,
343,
353,
7442,
29889,
2378,
4197,
29896,
29962,
334,
29871,
29945,
29900,
718,
518,
29906,
29962,
334,
29871,
29896,
29900,
29900,
718,
518,
29941,
29962,
334,
29871,
29906,
29945,
29897,
13,
1678,
11959,
353,
426,
29896,
29901,
29871,
29941,
29900,
29892,
29871,
29906,
29901,
29871,
29946,
29945,
29892,
29871,
29941,
29901,
29871,
29906,
29945,
29913,
13,
1678,
11959,
29918,
353,
1423,
29918,
3605,
601,
29898,
3605,
601,
29892,
343,
29892,
525,
5062,
29899,
13445,
10335,
1495,
13,
1678,
4974,
11959,
29918,
1275,
11959,
13,
13,
13,
1753,
1243,
29918,
3605,
601,
29918,
4804,
519,
7295,
13,
1678,
343,
353,
7442,
29889,
2378,
4197,
29896,
29962,
334,
29871,
29945,
29900,
718,
518,
29906,
29962,
334,
29871,
29896,
29900,
29900,
718,
518,
29941,
29962,
334,
29871,
29906,
29945,
29897,
13,
13,
1678,
822,
11959,
29918,
9891,
29898,
29891,
1125,
13,
4706,
396,
445,
740,
1033,
1653,
385,
5186,
1353,
310,
11916,
13,
4706,
3646,
29918,
16202,
353,
315,
5336,
29898,
29891,
29897,
13,
4706,
302,
29918,
27736,
353,
4236,
29898,
5182,
29918,
16202,
29889,
5975,
3101,
13,
4706,
736,
426,
1989,
29901,
938,
29898,
29876,
29918,
27736,
29897,
13,
18884,
363,
1820,
297,
3646,
29918,
16202,
29889,
8149,
28296,
13,
13,
1678,
11959,
29918,
353,
1423,
29918,
3605,
601,
29898,
3605,
601,
29918,
9891,
29892,
343,
29892,
525,
957,
29899,
13445,
10335,
1495,
13,
1678,
4974,
11959,
29918,
1275,
426,
29896,
29901,
29871,
29945,
29900,
29892,
29871,
29906,
29901,
29871,
29900,
29892,
29871,
29941,
29901,
29871,
29955,
29945,
29913,
13,
13,
13,
1753,
1243,
29918,
3605,
601,
29918,
4804,
519,
29918,
5085,
7295,
13,
1678,
343,
353,
7442,
29889,
2378,
4197,
29896,
29962,
334,
29871,
29945,
29900,
718,
518,
29906,
29962,
334,
29871,
29896,
29900,
29900,
718,
518,
29941,
29962,
334,
29871,
29906,
29945,
29897,
13,
1678,
6674,
4926,
353,
426,
29896,
29901,
29871,
29896,
29889,
29945,
29892,
29871,
29906,
29901,
29871,
29896,
29892,
29871,
29941,
29901,
29871,
29941,
29913,
13,
13,
1678,
822,
11959,
29918,
9891,
29898,
29891,
29892,
6674,
4926,
1125,
13,
4706,
9995,
27736,
1316,
393,
1269,
770,
674,
367,
15201,
491,
278,
6674,
4926,
1213,
15945,
13,
4706,
3646,
29918,
16202,
353,
315,
5336,
29898,
29891,
29897,
13,
4706,
736,
426,
1989,
29901,
938,
29898,
5975,
334,
6674,
4926,
29961,
1989,
2314,
13,
18884,
363,
1820,
29892,
1819,
297,
3646,
29918,
16202,
29889,
7076,
28296,
13,
13,
1678,
11959,
29918,
353,
1423,
29918,
3605,
601,
29898,
3605,
601,
29918,
9891,
29892,
343,
29892,
525,
957,
29899,
13445,
10335,
742,
13,
462,
308,
6674,
4926,
29922,
18056,
4926,
29897,
13,
1678,
4974,
11959,
29918,
1275,
426,
29896,
29901,
29871,
29906,
29945,
29892,
29871,
29906,
29901,
29871,
29900,
29892,
29871,
29941,
29901,
29871,
29945,
29900,
29913,
13,
13,
13,
1753,
1243,
29918,
8568,
29918,
29990,
29918,
29891,
7295,
13,
1678,
364,
865,
353,
1423,
29918,
8172,
29918,
3859,
29898,
29900,
29897,
13,
1678,
1060,
353,
364,
865,
29889,
9502,
29876,
29898,
29906,
29900,
29900,
29900,
29892,
29871,
29906,
29900,
29897,
13,
1678,
343,
353,
7442,
29889,
2378,
4197,
29900,
29962,
334,
29871,
29945,
29900,
29900,
718,
518,
29896,
29962,
334,
29871,
29896,
29945,
29900,
29900,
29897,
13,
1678,
4974,
6608,
29918,
29990,
29918,
29891,
29898,
29990,
29892,
343,
29892,
29871,
29896,
29900,
29892,
29871,
29896,
29900,
29897,
1275,
313,
9057,
1982,
29889,
8568,
29898,
29990,
29961,
1057,
29906,
29900,
29900,
29892,
4761,
29906,
11724,
13,
462,
462,
418,
4982,
1982,
29889,
8568,
29898,
29891,
29961,
1057,
29906,
29900,
29900,
12622,
13,
13,
1678,
1060,
353,
364,
865,
29889,
9502,
29876,
29898,
29945,
29892,
29871,
29906,
29897,
13,
1678,
343,
353,
7442,
29889,
2378,
4197,
29900,
29962,
334,
29871,
29906,
718,
518,
29896,
29962,
334,
29871,
29941,
29897,
13,
1678,
396,
599,
848,
674,
367,
1304,
297,
445,
1206,
13,
1678,
4974,
6608,
29918,
29990,
29918,
29891,
29898,
29990,
29892,
343,
29897,
1275,
313,
9057,
1982,
29889,
8568,
29898,
29990,
511,
4982,
1982,
29889,
8568,
29898,
29891,
876,
13,
2
] |
Chapter 4/restful_python_chapter_04_05/gamesapi/games/admin.py | Mohamed2011-bit/Building-RESTful-Python-Web-Services | 116 | 130133 | <gh_stars>100-1000
"""
Book: Building RESTful Python Web Services
Chapter 4: Throttling, Filtering, Testing and Deploying an API with Django
Author: <NAME> - Twitter.com/gastonhillar
Publisher: Packt Publishing Ltd. - http://www.packtpub.com
"""
from django.contrib import admin
# Register your models here.
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29900,
29900,
29899,
29896,
29900,
29900,
29900,
13,
15945,
29908,
13,
10967,
29901,
17166,
16759,
1319,
5132,
2563,
15538,
13,
1451,
3314,
29871,
29946,
29901,
498,
26970,
1847,
29892,
19916,
292,
29892,
4321,
292,
322,
10034,
2376,
292,
385,
3450,
411,
15337,
13,
13720,
29901,
529,
5813,
29958,
448,
20147,
29889,
510,
29914,
29887,
579,
265,
29131,
279,
13,
21076,
1674,
261,
29901,
18744,
29873,
19088,
19806,
29889,
448,
1732,
597,
1636,
29889,
4058,
29873,
5467,
29889,
510,
13,
15945,
29908,
13,
3166,
9557,
29889,
21570,
1053,
4113,
13,
13,
29937,
12577,
596,
4733,
1244,
29889,
13,
2
] |
setup.py | sdu-cfei/modest-py | 37 | 8804 | from setuptools import setup
setup(
name='modestpy',
version='0.1',
description='FMI-compliant model identification package',
url='https://github.com/sdu-cfei/modest-py',
keywords='fmi fmu optimization model identification estimation',
author='<NAME>, Center for Energy Informatics SDU',
author_email='<EMAIL>, <EMAIL>',
license='BSD',
platforms=['Windows', 'Linux'],
packages=[
'modestpy',
'modestpy.estim',
'modestpy.estim.ga_parallel',
'modestpy.estim.ga',
'modestpy.estim.ps',
'modestpy.estim.scipy',
'modestpy.fmi',
'modestpy.utilities',
'modestpy.test'],
include_package_data=True,
install_requires=[
'fmpy[complete]',
'scipy',
'pandas',
'matplotlib',
'numpy',
'pyDOE',
'modestga'
],
classifiers=[
'Programming Language :: Python :: 3'
]
)
| [
1,
515,
731,
21245,
8789,
1053,
6230,
13,
13,
14669,
29898,
13,
1678,
1024,
2433,
1545,
342,
2272,
742,
13,
1678,
1873,
2433,
29900,
29889,
29896,
742,
13,
1678,
6139,
2433,
29943,
10403,
29899,
2388,
492,
424,
1904,
29769,
3577,
742,
13,
1678,
3142,
2433,
991,
597,
3292,
29889,
510,
29914,
29879,
700,
29899,
29883,
1725,
29875,
29914,
1545,
342,
29899,
2272,
742,
13,
1678,
29361,
2433,
29888,
2460,
285,
2589,
13883,
1904,
29769,
23248,
742,
13,
1678,
4148,
2433,
29966,
5813,
10202,
7817,
363,
24836,
512,
4830,
1199,
8073,
29965,
742,
13,
1678,
4148,
29918,
5269,
2433,
29966,
26862,
6227,
10202,
529,
26862,
6227,
29958,
742,
13,
1678,
19405,
2433,
29933,
7230,
742,
13,
1678,
21796,
29922,
1839,
7685,
742,
525,
24085,
7464,
13,
1678,
9741,
11759,
13,
4706,
525,
1545,
342,
2272,
742,
13,
4706,
525,
1545,
342,
2272,
29889,
342,
326,
742,
13,
4706,
525,
1545,
342,
2272,
29889,
342,
326,
29889,
3249,
29918,
23482,
742,
13,
4706,
525,
1545,
342,
2272,
29889,
342,
326,
29889,
3249,
742,
13,
4706,
525,
1545,
342,
2272,
29889,
342,
326,
29889,
567,
742,
13,
4706,
525,
1545,
342,
2272,
29889,
342,
326,
29889,
26167,
2272,
742,
13,
4706,
525,
1545,
342,
2272,
29889,
29888,
2460,
742,
13,
4706,
525,
1545,
342,
2272,
29889,
4422,
1907,
742,
13,
4706,
525,
1545,
342,
2272,
29889,
1688,
7464,
13,
1678,
3160,
29918,
5113,
29918,
1272,
29922,
5574,
29892,
13,
1678,
2601,
29918,
276,
339,
2658,
11759,
13,
4706,
525,
29888,
1526,
29891,
29961,
8835,
29962,
742,
13,
4706,
525,
26167,
2272,
742,
13,
4706,
525,
15112,
742,
13,
4706,
525,
2922,
17357,
742,
13,
4706,
525,
23749,
742,
13,
4706,
525,
2272,
3970,
29923,
742,
13,
4706,
525,
1545,
342,
3249,
29915,
13,
1678,
21251,
13,
1678,
770,
14903,
11759,
13,
4706,
525,
9283,
4056,
17088,
4761,
5132,
4761,
29871,
29941,
29915,
13,
1678,
4514,
13,
29897,
13,
2
] |
farmer/version.py | jstaf/farmer | 0 | 1600758 | <reponame>jstaf/farmer
import click
import pkg_resources
def get_package_versions():
distributions = [dist for dist in pkg_resources.working_set if dist.project_name.startswith(__package__)]
return {dist.project_name: dist.version for dist in distributions}
def print_package_versions():
for package, version in sorted(get_package_versions().items()):
click.echo('{} {}'.format(package, version))
| [
1,
529,
276,
1112,
420,
29958,
29926,
303,
2142,
29914,
15641,
1050,
13,
5215,
2828,
13,
5215,
282,
9415,
29918,
13237,
13,
13,
13,
1753,
679,
29918,
5113,
29918,
26100,
7295,
13,
1678,
18822,
353,
518,
5721,
363,
1320,
297,
282,
9415,
29918,
13237,
29889,
22899,
29918,
842,
565,
1320,
29889,
4836,
29918,
978,
29889,
27382,
2541,
22168,
5113,
1649,
4638,
13,
1678,
736,
426,
5721,
29889,
4836,
29918,
978,
29901,
1320,
29889,
3259,
363,
1320,
297,
18822,
29913,
13,
13,
13,
1753,
1596,
29918,
5113,
29918,
26100,
7295,
13,
1678,
363,
3577,
29892,
1873,
297,
12705,
29898,
657,
29918,
5113,
29918,
26100,
2141,
7076,
580,
1125,
13,
4706,
2828,
29889,
8057,
877,
8875,
6571,
4286,
4830,
29898,
5113,
29892,
1873,
876,
13,
2
] |
main.py | ANOVAProjectUSYD/trading-bot | 0 | 68707 | import os, argparse
import datetime
import time
from poloniex import Poloniex
def read_ticker():
#TODO: should add a check to see if user input is in the list of valid options
ticker = input("Enter the ticker pair, e.g. BTC_ETH \n")
return ticker
def continueOption():
'''Allows user to be able to view option menu again'''
cont = input("Would you like to see the options again? Please enter yes or no \n")
if cont.lower() == "yes":
operating = True
elif cont.lower() == "no":
operating = False
else:
print("Invalid option. Terminating program.")
quit()
return operating
def clean_arguments(time_period):
'''Validates if time period is allowed.'''
if int(time_period) in [300,900,1800,7200,14400,86400]:
validPeriod = time_period
else:
print("Issue with time argument. Program terminating.")
quit()
return validPeriod
def connect_api():
'''Easiest way to connect to Poloniex API.'''
api_key = '<KEY>'
secret = '6bd7cf3f563edded66f6f73782fed44d0e9cc0b345d5a290a4abf60f7c9713e32a718f94a665237bc2d444320bb33bf98e3911dd547d2c7acdf7a464bc37ae53'
polo = Poloniex(api_key, secret) # connects to API with key.
return polo
def option(result, api_obj, ticker):
rdict = {'1': 'You chose to view live prices', '2': 'You chose to view 24 hour volume', '3': 'You chose to view Percentage change', '4': 'You chose to view 24 hour high/low', '5':'Program terminating'}
print (rdict[result])
if result == '1':
time_period = input("Enter the time period. Valid time periods are 300, 900, 1800, 7200, 14400 and 86400. Press Control-Z to terminate. \n")
validPeriod = clean_arguments(time_period)
stream_data(api_obj, ticker, validPeriod)
elif result == '2':
get_daily_vol(api_obj, ticker)
operating = continueOption()
return(operating)
elif result == '3':
get_percent_change(api_obj,ticker)
operating = continueOption()
return(operating)
elif result == '4':
get_high_low(api_obj,ticker)
operating = continueOption()
return(operating)
elif result == '5':
quit()
else:
print("Please enter a valid number")
def get_daily_vol(polo, ticker):
'''Computes the 24 hour volume.'''
polo_data = polo.returnTicker()[ticker]
volume = polo_data['baseVolume']
print("The 24 hour volume is {} BTC".format(volume))
def get_percent_change(polo, ticker):
'''Computes the 24 hour percentage change.'''
polo_data = polo.returnTicker()[ticker]
percentageChange = polo_data['percentChange']
print("The 24 hour percentage change is {}".format(percentageChange))
def get_high_low(polo, ticker):
'''Prints out the high and low of the ticker.'''
polo_data = polo.returnTicker()[ticker]
high = polo_data['high24hr']
low = polo_data['low24hr']
print("The 24 hour high is {} and the 24 hour low is {}".format(high,low))
def stream_data(polo, ticker, ticker_time):
'''Streams data regarding cryptocurrency.'''
while True:
polo_data = polo.returnTicker()[ticker] # polo_data is a dictionary containing info about the ticker.
#print(type polo_data) or #print(polo_data.keys())
date = datetime.datetime.now()
last_price = polo_data['last'] # read documentation section in README file to see other data we can get.
print("Time: {date} Last price: {last_price}".format(date = date, last_price=last_price))
new_time = float("." + str(ticker_time))
time.sleep(new_time) # pauses program and then grabs price after some time.
def main():
print("Please enter a trading pair, e.g. BTC_ETH")
ticker = read_ticker()
operating = True
api_obj = connect_api()
# While loop so user gets the choice to see options again
while operating:
result = input("""
Please enter one of the following number options:
1 Check live prices
2 Check 24 hour volume
3 Check 24 hour percentage change
4 Check 24 hour high/low
5 exit \n
""")
operating = option(result, api_obj, ticker)
# this executes the main method
if __name__ == "__main__":
main()
| [
1,
1053,
2897,
29892,
1852,
5510,
13,
5215,
12865,
13,
5215,
931,
13,
3166,
1248,
9599,
29916,
1053,
2043,
9599,
29916,
13,
13,
1753,
1303,
29918,
29873,
6541,
7295,
13,
1678,
396,
4986,
3970,
29901,
881,
788,
263,
1423,
304,
1074,
565,
1404,
1881,
338,
297,
278,
1051,
310,
2854,
3987,
13,
1678,
260,
6541,
353,
1881,
703,
10399,
278,
260,
6541,
5101,
29892,
321,
29889,
29887,
29889,
350,
9472,
29918,
2544,
29950,
320,
29876,
1159,
13,
1678,
736,
260,
6541,
13,
13,
13,
1753,
6773,
8375,
7295,
13,
1678,
14550,
3596,
1242,
1404,
304,
367,
2221,
304,
1776,
2984,
6143,
1449,
12008,
13,
1678,
640,
353,
1881,
703,
29956,
483,
366,
763,
304,
1074,
278,
3987,
1449,
29973,
3529,
3896,
4874,
470,
694,
320,
29876,
1159,
13,
1678,
565,
640,
29889,
13609,
580,
1275,
376,
3582,
1115,
13,
4706,
13598,
353,
5852,
13,
1678,
25342,
640,
29889,
13609,
580,
1275,
376,
1217,
1115,
13,
4706,
13598,
353,
7700,
13,
1678,
1683,
29901,
13,
4706,
1596,
703,
13919,
2984,
29889,
11814,
262,
1218,
1824,
23157,
13,
4706,
23283,
580,
13,
1678,
736,
13598,
13,
13,
13,
1753,
5941,
29918,
25699,
29898,
2230,
29918,
19145,
1125,
13,
1678,
14550,
7211,
1078,
565,
931,
3785,
338,
6068,
29889,
12008,
13,
1678,
565,
938,
29898,
2230,
29918,
19145,
29897,
297,
518,
29941,
29900,
29900,
29892,
29929,
29900,
29900,
29892,
29896,
29947,
29900,
29900,
29892,
29955,
29906,
29900,
29900,
29892,
29896,
29946,
29946,
29900,
29900,
29892,
29947,
29953,
29946,
29900,
29900,
5387,
13,
4706,
2854,
29853,
353,
931,
29918,
19145,
13,
1678,
1683,
29901,
13,
4706,
1596,
703,
29902,
893,
434,
411,
931,
2980,
29889,
7835,
6624,
1218,
23157,
13,
4706,
23283,
580,
13,
1678,
736,
2854,
29853,
13,
13,
13,
1753,
4511,
29918,
2754,
7295,
13,
1678,
14550,
29923,
6840,
342,
982,
304,
4511,
304,
2043,
9599,
29916,
3450,
29889,
12008,
13,
1678,
7882,
29918,
1989,
353,
12801,
10818,
16299,
13,
1678,
7035,
353,
525,
29953,
6448,
29955,
6854,
29941,
29888,
29945,
29953,
29941,
287,
7176,
29953,
29953,
29888,
29953,
29888,
29955,
29941,
29955,
29947,
29906,
29888,
287,
29946,
29946,
29881,
29900,
29872,
29929,
617,
29900,
29890,
29941,
29946,
29945,
29881,
29945,
29874,
29906,
29929,
29900,
29874,
29946,
370,
29888,
29953,
29900,
29888,
29955,
29883,
29929,
29955,
29896,
29941,
29872,
29941,
29906,
29874,
29955,
29896,
29947,
29888,
29929,
29946,
29874,
29953,
29953,
29945,
29906,
29941,
29955,
12328,
29906,
29881,
29946,
29946,
29946,
29941,
29906,
29900,
1327,
29941,
29941,
1635,
29929,
29947,
29872,
29941,
29929,
29896,
29896,
1289,
29945,
29946,
29955,
29881,
29906,
29883,
29955,
562,
2176,
29955,
29874,
29946,
29953,
29946,
12328,
29941,
29955,
3660,
29945,
29941,
29915,
13,
1678,
1248,
29877,
353,
2043,
9599,
29916,
29898,
2754,
29918,
1989,
29892,
7035,
29897,
396,
4511,
29879,
304,
3450,
411,
1820,
29889,
13,
1678,
736,
1248,
29877,
13,
13,
13,
1753,
2984,
29898,
2914,
29892,
7882,
29918,
5415,
29892,
260,
6541,
1125,
13,
4706,
364,
8977,
353,
11117,
29896,
2396,
525,
3492,
12784,
304,
1776,
5735,
26094,
742,
525,
29906,
2396,
525,
3492,
12784,
304,
1776,
29871,
29906,
29946,
7234,
7977,
742,
525,
29941,
2396,
525,
3492,
12784,
304,
1776,
2431,
1760,
482,
1735,
742,
525,
29946,
2396,
525,
3492,
12784,
304,
1776,
29871,
29906,
29946,
7234,
1880,
29914,
677,
742,
525,
29945,
22099,
9283,
6624,
1218,
10827,
13,
4706,
1596,
313,
5499,
919,
29961,
2914,
2314,
13,
4706,
565,
29871,
1121,
1275,
525,
29896,
2396,
13,
9651,
931,
29918,
19145,
353,
1881,
703,
10399,
278,
931,
3785,
29889,
15758,
931,
23704,
526,
29871,
29941,
29900,
29900,
29892,
29871,
29929,
29900,
29900,
29892,
29871,
29896,
29947,
29900,
29900,
29892,
29871,
29955,
29906,
29900,
29900,
29892,
29871,
29896,
29946,
29946,
29900,
29900,
322,
29871,
29947,
29953,
29946,
29900,
29900,
29889,
5254,
11264,
29899,
29999,
304,
29504,
29889,
320,
29876,
1159,
13,
9651,
2854,
29853,
353,
5941,
29918,
25699,
29898,
2230,
29918,
19145,
29897,
13,
9651,
4840,
29918,
1272,
29898,
2754,
29918,
5415,
29892,
260,
6541,
29892,
2854,
29853,
29897,
13,
4706,
25342,
1121,
1275,
525,
29906,
2396,
13,
9651,
679,
29918,
29881,
8683,
29918,
1555,
29898,
2754,
29918,
5415,
29892,
260,
6541,
29897,
13,
9651,
13598,
353,
6773,
8375,
580,
13,
9651,
736,
29898,
3372,
1218,
29897,
13,
4706,
25342,
1121,
1275,
525,
29941,
2396,
13,
9651,
679,
29918,
25376,
29918,
3167,
29898,
2754,
29918,
5415,
29892,
29873,
6541,
29897,
13,
9651,
13598,
353,
6773,
8375,
580,
13,
9651,
736,
29898,
3372,
1218,
29897,
13,
13,
4706,
25342,
1121,
1275,
525,
29946,
2396,
13,
9651,
679,
29918,
9812,
29918,
677,
29898,
2754,
29918,
5415,
29892,
29873,
6541,
29897,
13,
9651,
13598,
353,
6773,
8375,
580,
13,
9651,
736,
29898,
3372,
1218,
29897,
13,
13,
4706,
25342,
1121,
1275,
525,
29945,
2396,
13,
9651,
23283,
580,
13,
4706,
1683,
29901,
13,
9651,
1596,
703,
12148,
3896,
263,
2854,
1353,
1159,
13,
13,
13,
1753,
679,
29918,
29881,
8683,
29918,
1555,
29898,
29886,
3543,
29892,
260,
6541,
1125,
13,
1678,
14550,
20606,
267,
278,
29871,
29906,
29946,
7234,
7977,
29889,
12008,
13,
1678,
1248,
29877,
29918,
1272,
353,
1248,
29877,
29889,
2457,
29911,
6541,
580,
29961,
29873,
6541,
29962,
13,
1678,
7977,
353,
1248,
29877,
29918,
1272,
1839,
3188,
24679,
2033,
13,
1678,
1596,
703,
1576,
29871,
29906,
29946,
7234,
7977,
338,
6571,
350,
9472,
1642,
4830,
29898,
24623,
876,
13,
13,
13,
1753,
679,
29918,
25376,
29918,
3167,
29898,
29886,
3543,
29892,
260,
6541,
1125,
13,
1678,
14550,
20606,
267,
278,
29871,
29906,
29946,
7234,
19649,
1735,
29889,
12008,
13,
1678,
1248,
29877,
29918,
1272,
353,
1248,
29877,
29889,
2457,
29911,
6541,
580,
29961,
29873,
6541,
29962,
13,
1678,
19649,
7277,
353,
1248,
29877,
29918,
1272,
1839,
25376,
7277,
2033,
13,
1678,
1596,
703,
1576,
29871,
29906,
29946,
7234,
19649,
1735,
338,
6571,
1642,
4830,
29898,
25376,
482,
7277,
876,
13,
13,
13,
1753,
679,
29918,
9812,
29918,
677,
29898,
29886,
3543,
29892,
260,
6541,
1125,
13,
1678,
14550,
4040,
9466,
714,
278,
1880,
322,
4482,
310,
278,
260,
6541,
29889,
12008,
13,
1678,
1248,
29877,
29918,
1272,
353,
1248,
29877,
29889,
2457,
29911,
6541,
580,
29961,
29873,
6541,
29962,
13,
1678,
1880,
353,
1248,
29877,
29918,
1272,
1839,
9812,
29906,
29946,
1092,
2033,
13,
1678,
4482,
353,
1248,
29877,
29918,
1272,
1839,
677,
29906,
29946,
1092,
2033,
13,
1678,
1596,
703,
1576,
29871,
29906,
29946,
7234,
1880,
338,
6571,
322,
278,
29871,
29906,
29946,
7234,
4482,
338,
6571,
1642,
4830,
29898,
9812,
29892,
677,
876,
13,
13,
13,
1753,
4840,
29918,
1272,
29898,
29886,
3543,
29892,
260,
6541,
29892,
260,
6541,
29918,
2230,
1125,
13,
1678,
14550,
3835,
29879,
848,
11211,
24941,
542,
10880,
29889,
12008,
13,
1678,
1550,
5852,
29901,
13,
4706,
1248,
29877,
29918,
1272,
353,
1248,
29877,
29889,
2457,
29911,
6541,
580,
29961,
29873,
6541,
29962,
396,
1248,
29877,
29918,
1272,
338,
263,
8600,
6943,
5235,
1048,
278,
260,
6541,
29889,
13,
4706,
396,
2158,
29898,
1853,
1248,
29877,
29918,
1272,
29897,
470,
396,
2158,
29898,
29886,
3543,
29918,
1272,
29889,
8149,
3101,
13,
4706,
2635,
353,
12865,
29889,
12673,
29889,
3707,
580,
13,
4706,
1833,
29918,
9175,
353,
1248,
29877,
29918,
1272,
1839,
4230,
2033,
29871,
396,
1303,
5106,
4004,
297,
5195,
3035,
2303,
934,
304,
1074,
916,
848,
591,
508,
679,
29889,
13,
4706,
1596,
703,
2481,
29901,
426,
1256,
29913,
29871,
9208,
8666,
29901,
426,
4230,
29918,
9175,
29913,
1642,
4830,
29898,
1256,
353,
2635,
29892,
1833,
29918,
9175,
29922,
4230,
29918,
9175,
876,
13,
4706,
716,
29918,
2230,
353,
5785,
703,
1213,
718,
851,
29898,
29873,
6541,
29918,
2230,
876,
13,
4706,
931,
29889,
17059,
29898,
1482,
29918,
2230,
29897,
396,
282,
1485,
267,
1824,
322,
769,
2646,
5824,
8666,
1156,
777,
931,
29889,
13,
13,
13,
1753,
1667,
7295,
13,
1678,
1596,
703,
12148,
3896,
263,
3534,
292,
5101,
29892,
321,
29889,
29887,
29889,
350,
9472,
29918,
2544,
29950,
1159,
13,
1678,
260,
6541,
353,
1303,
29918,
29873,
6541,
580,
13,
1678,
13598,
353,
5852,
13,
1678,
7882,
29918,
5415,
353,
4511,
29918,
2754,
580,
13,
13,
1678,
396,
5806,
2425,
577,
1404,
4947,
278,
7348,
304,
1074,
3987,
1449,
13,
1678,
1550,
13598,
29901,
13,
4706,
1121,
353,
1881,
703,
15945,
13,
4706,
3529,
3896,
697,
310,
278,
1494,
1353,
3987,
29901,
13,
13,
308,
29896,
5399,
5735,
26094,
13,
308,
29906,
5399,
29871,
29906,
29946,
7234,
7977,
13,
308,
29941,
5399,
29871,
29906,
29946,
7234,
19649,
1735,
13,
308,
29946,
5399,
29871,
29906,
29946,
7234,
1880,
29914,
677,
13,
308,
29945,
6876,
320,
29876,
13,
4706,
5124,
1159,
13,
13,
4706,
13598,
353,
2984,
29898,
2914,
29892,
7882,
29918,
5415,
29892,
260,
6541,
29897,
13,
13,
13,
29937,
445,
24138,
278,
1667,
1158,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
1678,
1667,
580,
13,
2
] |
ceilometer/network/notifications.py | rackerlabs/instrumented-ceilometer | 3 | 16540 | # -*- encoding: utf-8 -*-
#
# Copyright © 2012 New Dream Network, LLC (DreamHost)
#
# Author: <NAME> <<EMAIL>>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""Handler for producing network counter messages from Neutron notification
events.
"""
from oslo.config import cfg
from ceilometer.openstack.common.gettextutils import _ # noqa
from ceilometer.openstack.common import log
from ceilometer import plugin
from ceilometer import sample
OPTS = [
cfg.StrOpt('neutron_control_exchange',
default='neutron',
help="Exchange name for Neutron notifications",
deprecated_name='quantum_control_exchange'),
]
cfg.CONF.register_opts(OPTS)
LOG = log.getLogger(__name__)
class NetworkNotificationBase(plugin.NotificationBase):
resource_name = None
@property
def event_types(self):
return [
# NOTE(flwang): When the *.create.start notification sending,
# there is no resource id assigned by Neutron yet. So we ignore
# the *.create.start notification for now and only listen the
# *.create.end to make sure the resource id is existed.
'%s.create.end' % (self.resource_name),
'%s.update.*' % (self.resource_name),
'%s.exists' % (self.resource_name),
# FIXME(dhellmann): Neutron delete notifications do
# not include the same metadata as the other messages,
# so we ignore them for now. This isn't ideal, since
# it may mean we miss charging for some amount of time,
# but it is better than throwing away the existing
# metadata for a resource when it is deleted.
##'%s.delete.start' % (self.resource_name),
]
@staticmethod
def get_exchange_topics(conf):
"""Return a sequence of ExchangeTopics defining the exchange and topics
to be connected for this plugin.
"""
return [
plugin.ExchangeTopics(
exchange=conf.neutron_control_exchange,
topics=set(topic + ".info"
for topic in conf.notification_topics)),
]
def process_notification(self, message):
LOG.info(_('network notification %r') % message)
message['payload'] = message['payload'][self.resource_name]
counter_name = getattr(self, 'counter_name', self.resource_name)
unit_value = getattr(self, 'unit', self.resource_name)
yield sample.Sample.from_notification(
name=counter_name,
type=sample.TYPE_GAUGE,
unit=unit_value,
volume=1,
user_id=message['_context_user_id'],
project_id=message['payload']['tenant_id'],
resource_id=message['payload']['id'],
message=message)
event_type_split = message['event_type'].split('.')
if len(event_type_split) > 2:
yield sample.Sample.from_notification(
name=counter_name
+ "." + event_type_split[1],
type=sample.TYPE_DELTA,
unit=unit_value,
volume=1,
user_id=message['_context_user_id'],
project_id=message['payload']['tenant_id'],
resource_id=message['payload']['id'],
message=message)
class Network(NetworkNotificationBase):
"""Listen for Neutron network notifications in order to mediate with the
metering framework.
"""
resource_name = 'network'
class Subnet(NetworkNotificationBase):
"""Listen for Neutron notifications in order to mediate with the
metering framework.
"""
resource_name = 'subnet'
class Port(NetworkNotificationBase):
"""Listen for Neutron notifications in order to mediate with the
metering framework.
"""
resource_name = 'port'
class Router(NetworkNotificationBase):
"""Listen for Neutron notifications in order to mediate with the
metering framework.
"""
resource_name = 'router'
class FloatingIP(NetworkNotificationBase):
"""Listen for Neutron notifications in order to mediate with the
metering framework.
"""
resource_name = 'floatingip'
counter_name = 'ip.floating'
unit = 'ip'
class Bandwidth(NetworkNotificationBase):
"""Listen for Neutron notifications in order to mediate with the
metering framework.
"""
event_types = ['l3.meter']
def process_notification(self, message):
yield sample.Sample.from_notification(
name='bandwidth',
type=sample.TYPE_DELTA,
unit='B',
volume=message['payload']['bytes'],
user_id=None,
project_id=message['payload']['tenant_id'],
resource_id=message['payload']['label_id'],
message=message)
| [
1,
396,
448,
29930,
29899,
8025,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
29937,
13,
29937,
14187,
1266,
29871,
30211,
29871,
29906,
29900,
29896,
29906,
1570,
16814,
8527,
29892,
365,
12182,
313,
29928,
1633,
8514,
29897,
13,
29937,
13,
29937,
13361,
29901,
529,
5813,
29958,
3532,
26862,
6227,
6778,
13,
29937,
13,
29937,
10413,
21144,
1090,
278,
13380,
19245,
29892,
10079,
29871,
29906,
29889,
29900,
313,
1552,
376,
29931,
293,
1947,
1496,
366,
1122,
13,
29937,
451,
671,
445,
934,
5174,
297,
752,
13036,
411,
278,
19245,
29889,
887,
1122,
4017,
13,
29937,
263,
3509,
310,
278,
19245,
472,
13,
29937,
13,
29937,
418,
1732,
597,
1636,
29889,
4288,
29889,
990,
29914,
506,
11259,
29914,
27888,
1430,
1660,
29899,
29906,
29889,
29900,
13,
29937,
13,
29937,
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,
399,
1806,
8187,
2692,
13,
29937,
399,
1718,
29934,
13566,
29059,
6323,
8707,
29928,
22122,
29903,
8079,
13764,
29979,
476,
22255,
29892,
2845,
4653,
470,
2411,
2957,
29889,
2823,
278,
13,
29937,
19245,
363,
278,
2702,
4086,
14765,
1076,
11239,
322,
27028,
13,
29937,
1090,
278,
19245,
29889,
13,
15945,
29908,
4598,
363,
20811,
3564,
6795,
7191,
515,
2448,
329,
1617,
12519,
13,
259,
4959,
29889,
13,
13,
15945,
29908,
13,
13,
3166,
2897,
417,
29889,
2917,
1053,
274,
16434,
13,
13,
3166,
2257,
309,
8328,
29889,
3150,
1429,
29889,
9435,
29889,
657,
726,
13239,
1053,
903,
29871,
396,
694,
25621,
13,
3166,
2257,
309,
8328,
29889,
3150,
1429,
29889,
9435,
1053,
1480,
13,
3166,
2257,
309,
8328,
1053,
7079,
13,
3166,
2257,
309,
8328,
1053,
4559,
13,
13,
4590,
9375,
353,
518,
13,
1678,
274,
16434,
29889,
5015,
20624,
877,
17821,
1617,
29918,
6451,
29918,
6543,
742,
13,
1669,
2322,
2433,
17821,
1617,
742,
13,
1669,
1371,
543,
1252,
3167,
1024,
363,
2448,
329,
1617,
25913,
613,
13,
1669,
18164,
29918,
978,
2433,
12150,
398,
29918,
6451,
29918,
6543,
5477,
13,
29962,
13,
13,
16859,
29889,
6007,
29943,
29889,
9573,
29918,
25707,
29898,
4590,
9375,
29897,
13,
13,
14480,
353,
1480,
29889,
657,
16363,
22168,
978,
1649,
29897,
13,
13,
13,
1990,
8527,
12958,
5160,
29898,
8582,
29889,
12958,
5160,
1125,
13,
13,
1678,
6503,
29918,
978,
353,
6213,
13,
13,
1678,
732,
6799,
13,
1678,
822,
1741,
29918,
8768,
29898,
1311,
1125,
13,
4706,
736,
518,
13,
9651,
396,
6058,
29923,
29898,
1579,
29893,
574,
1125,
1932,
278,
20611,
3258,
29889,
2962,
12519,
9348,
29892,
13,
9651,
396,
727,
338,
694,
6503,
1178,
9859,
491,
2448,
329,
1617,
3447,
29889,
1105,
591,
11455,
13,
9651,
396,
278,
20611,
3258,
29889,
2962,
12519,
363,
1286,
322,
871,
11621,
278,
13,
9651,
396,
20611,
3258,
29889,
355,
304,
1207,
1854,
278,
6503,
1178,
338,
22856,
29889,
13,
9651,
14210,
29879,
29889,
3258,
29889,
355,
29915,
1273,
313,
1311,
29889,
10314,
29918,
978,
511,
13,
9651,
14210,
29879,
29889,
5504,
5575,
29915,
1273,
313,
1311,
29889,
10314,
29918,
978,
511,
13,
9651,
14210,
29879,
29889,
9933,
29915,
1273,
313,
1311,
29889,
10314,
29918,
978,
511,
13,
9651,
396,
383,
6415,
2303,
29898,
12744,
514,
4403,
1125,
2448,
329,
1617,
5217,
25913,
437,
13,
9651,
396,
451,
3160,
278,
1021,
15562,
408,
278,
916,
7191,
29892,
13,
9651,
396,
577,
591,
11455,
963,
363,
1286,
29889,
910,
3508,
29915,
29873,
10839,
29892,
1951,
13,
9651,
396,
372,
1122,
2099,
591,
3052,
9151,
292,
363,
777,
5253,
310,
931,
29892,
13,
9651,
396,
541,
372,
338,
2253,
1135,
17452,
3448,
278,
5923,
13,
9651,
396,
15562,
363,
263,
6503,
746,
372,
338,
11132,
29889,
13,
9651,
444,
29915,
29995,
29879,
29889,
8143,
29889,
2962,
29915,
1273,
313,
1311,
29889,
10314,
29918,
978,
511,
13,
4706,
4514,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
679,
29918,
6543,
29918,
3332,
1199,
29898,
5527,
1125,
13,
4706,
9995,
11609,
263,
5665,
310,
24004,
7031,
1199,
16184,
278,
14523,
322,
23820,
13,
4706,
304,
367,
6631,
363,
445,
7079,
29889,
13,
13,
4706,
9995,
13,
4706,
736,
518,
13,
9651,
7079,
29889,
1252,
3167,
7031,
1199,
29898,
13,
18884,
14523,
29922,
5527,
29889,
17821,
1617,
29918,
6451,
29918,
6543,
29892,
13,
18884,
23820,
29922,
842,
29898,
13010,
718,
11393,
3888,
29908,
13,
462,
965,
363,
11261,
297,
1970,
29889,
24671,
29918,
3332,
1199,
8243,
13,
4706,
4514,
13,
13,
1678,
822,
1889,
29918,
24671,
29898,
1311,
29892,
2643,
1125,
13,
4706,
25401,
29889,
3888,
7373,
877,
11618,
12519,
1273,
29878,
1495,
1273,
2643,
29897,
13,
4706,
2643,
1839,
23813,
2033,
353,
2643,
1839,
23813,
2033,
29961,
1311,
29889,
10314,
29918,
978,
29962,
13,
4706,
6795,
29918,
978,
353,
679,
5552,
29898,
1311,
29892,
525,
11808,
29918,
978,
742,
1583,
29889,
10314,
29918,
978,
29897,
13,
4706,
5190,
29918,
1767,
353,
679,
5552,
29898,
1311,
29892,
525,
5441,
742,
1583,
29889,
10314,
29918,
978,
29897,
13,
13,
4706,
7709,
4559,
29889,
17708,
29889,
3166,
29918,
24671,
29898,
13,
9651,
1024,
29922,
11808,
29918,
978,
29892,
13,
9651,
1134,
29922,
11249,
29889,
11116,
29918,
12739,
29965,
1692,
29892,
13,
9651,
5190,
29922,
5441,
29918,
1767,
29892,
13,
9651,
7977,
29922,
29896,
29892,
13,
9651,
1404,
29918,
333,
29922,
4906,
1839,
29918,
4703,
29918,
1792,
29918,
333,
7464,
13,
9651,
2060,
29918,
333,
29922,
4906,
1839,
23813,
16215,
841,
424,
29918,
333,
7464,
13,
9651,
6503,
29918,
333,
29922,
4906,
1839,
23813,
16215,
333,
7464,
13,
9651,
2643,
29922,
4906,
29897,
13,
13,
4706,
1741,
29918,
1853,
29918,
5451,
353,
2643,
1839,
3696,
29918,
1853,
13359,
5451,
12839,
1495,
13,
4706,
565,
7431,
29898,
3696,
29918,
1853,
29918,
5451,
29897,
1405,
29871,
29906,
29901,
13,
9651,
7709,
4559,
29889,
17708,
29889,
3166,
29918,
24671,
29898,
13,
18884,
1024,
29922,
11808,
29918,
978,
13,
18884,
718,
376,
1213,
718,
1741,
29918,
1853,
29918,
5451,
29961,
29896,
1402,
13,
18884,
1134,
29922,
11249,
29889,
11116,
29918,
2287,
5850,
29909,
29892,
13,
18884,
5190,
29922,
5441,
29918,
1767,
29892,
13,
18884,
7977,
29922,
29896,
29892,
13,
18884,
1404,
29918,
333,
29922,
4906,
1839,
29918,
4703,
29918,
1792,
29918,
333,
7464,
13,
18884,
2060,
29918,
333,
29922,
4906,
1839,
23813,
16215,
841,
424,
29918,
333,
7464,
13,
18884,
6503,
29918,
333,
29922,
4906,
1839,
23813,
16215,
333,
7464,
13,
18884,
2643,
29922,
4906,
29897,
13,
13,
13,
1990,
8527,
29898,
13724,
12958,
5160,
1125,
13,
1678,
9995,
1293,
264,
363,
2448,
329,
1617,
3564,
25913,
297,
1797,
304,
14457,
403,
411,
278,
13,
1678,
11134,
292,
6890,
29889,
13,
13,
1678,
9995,
13,
1678,
6503,
29918,
978,
353,
525,
11618,
29915,
13,
13,
13,
1990,
3323,
1212,
29898,
13724,
12958,
5160,
1125,
13,
1678,
9995,
1293,
264,
363,
2448,
329,
1617,
25913,
297,
1797,
304,
14457,
403,
411,
278,
13,
1678,
11134,
292,
6890,
29889,
13,
13,
1678,
9995,
13,
1678,
6503,
29918,
978,
353,
525,
1491,
1212,
29915,
13,
13,
13,
1990,
3371,
29898,
13724,
12958,
5160,
1125,
13,
1678,
9995,
1293,
264,
363,
2448,
329,
1617,
25913,
297,
1797,
304,
14457,
403,
411,
278,
13,
1678,
11134,
292,
6890,
29889,
13,
13,
1678,
9995,
13,
1678,
6503,
29918,
978,
353,
525,
637,
29915,
13,
13,
13,
1990,
390,
5561,
29898,
13724,
12958,
5160,
1125,
13,
1678,
9995,
1293,
264,
363,
2448,
329,
1617,
25913,
297,
1797,
304,
14457,
403,
411,
278,
13,
1678,
11134,
292,
6890,
29889,
13,
13,
1678,
9995,
13,
1678,
6503,
29918,
978,
353,
525,
15140,
29915,
13,
13,
13,
1990,
26043,
1218,
5690,
29898,
13724,
12958,
5160,
1125,
13,
1678,
9995,
1293,
264,
363,
2448,
329,
1617,
25913,
297,
1797,
304,
14457,
403,
411,
278,
13,
1678,
11134,
292,
6890,
29889,
13,
13,
1678,
9995,
13,
1678,
6503,
29918,
978,
353,
525,
29888,
417,
1218,
666,
29915,
13,
1678,
6795,
29918,
978,
353,
525,
666,
29889,
29888,
417,
1218,
29915,
13,
1678,
5190,
353,
525,
666,
29915,
13,
13,
13,
1990,
5158,
2103,
29898,
13724,
12958,
5160,
1125,
13,
1678,
9995,
1293,
264,
363,
2448,
329,
1617,
25913,
297,
1797,
304,
14457,
403,
411,
278,
13,
1678,
11134,
292,
6890,
29889,
13,
13,
1678,
9995,
13,
1678,
1741,
29918,
8768,
353,
6024,
29880,
29941,
29889,
29391,
2033,
13,
13,
1678,
822,
1889,
29918,
24671,
29898,
1311,
29892,
2643,
1125,
13,
4706,
7709,
4559,
29889,
17708,
29889,
3166,
29918,
24671,
29898,
13,
9651,
1024,
2433,
4980,
2103,
742,
13,
9651,
1134,
29922,
11249,
29889,
11116,
29918,
2287,
5850,
29909,
29892,
13,
9651,
5190,
2433,
29933,
742,
13,
9651,
7977,
29922,
4906,
1839,
23813,
16215,
13193,
7464,
13,
9651,
1404,
29918,
333,
29922,
8516,
29892,
13,
9651,
2060,
29918,
333,
29922,
4906,
1839,
23813,
16215,
841,
424,
29918,
333,
7464,
13,
9651,
6503,
29918,
333,
29922,
4906,
1839,
23813,
16215,
1643,
29918,
333,
7464,
13,
9651,
2643,
29922,
4906,
29897,
13,
2
] |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.