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
|
---|---|---|---|---|---|
tools/config.py | emiliopomares/flow-separation-prediction | 0 | 87624 | import os
config = {
'project_path': os.getcwd() + '/../openfoam/run/Airfoil2D_full/'
} | [
1,
1053,
2897,
13,
13,
2917,
353,
426,
13,
1678,
525,
4836,
29918,
2084,
2396,
2897,
29889,
657,
29883,
9970,
580,
718,
8207,
6995,
3150,
1181,
314,
29914,
3389,
29914,
29909,
381,
1181,
309,
29906,
29928,
29918,
8159,
22208,
13,
29913,
2
] |
sge/input.py | python-sge/sge | 7 | 91953 | # This file is part of the Pygame SGE.
#
# The Pygame SGE is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# The Pygame SGE 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 Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with the Pygame SGE. If not, see <http://www.gnu.org/licenses/>.
"""
This module provides input event classes. Input event objects are used
to consolidate all necessary information about input events in a clean
way.
You normally don't need to use input event objects directly. Input
events are handled automatically in each frame of the SGE's main loop.
You only need to use input event objects directly if you take control
away from the SGE's main loop, e.g. to create your own loop.
"""
__all__ = ["KeyPress", "KeyRelease", "MouseMove", "MouseButtonPress",
"MouseButtonRelease", "JoystickAxisMove", "JoystickHatMove",
"JoystickTrackballMove", "JoystickButtonPress",
"JoystickButtonRelease", "JoystickEvent", "KeyboardFocusGain",
"KeyboardFocusLose", "MouseFocusGain", "MouseFocusLose",
"QuitRequest"]
class KeyPress:
"""
This input event represents a key on the keyboard being pressed.
.. attribute:: key
The identifier string of the key that was pressed. See the
table in the documentation for :mod:`sge.keyboard`.
.. attribute:: char
The unicode string associated with the key press, or an empty
unicode string if no text is associated with the key press.
See the table in the documentation for :mod:`sge.keyboard`.
"""
def __init__(self, key, char):
self.key = key
self.char = char
class KeyRelease:
"""
This input event represents a key on the keyboard being released.
.. attribute:: key
The identifier string of the key that was released. See the
table in the documentation for :class:`sge.input.KeyPress`.
"""
def __init__(self, key):
self.key = key
class MouseMove:
"""
This input event represents the mouse being moved.
.. attribute:: x
The horizontal relative movement of the mouse.
.. attribute:: y
The vertical relative movement of the mouse.
"""
def __init__(self, x, y):
self.x = x
self.y = y
class MouseButtonPress:
"""
This input event represents a mouse button being pressed.
.. attribute:: button
The identifier string of the mouse button that was pressed. See
the table below.
====================== =================
Mouse Button Name Identifier String
====================== =================
Left mouse button ``"left"``
Right mouse button ``"right"``
Middle mouse button ``"middle"``
Extra mouse button 1 ``"extra1"``
Extra mouse button 2 ``"extra2"``
====================== =================
"""
def __init__(self, button):
self.button = button
class MouseButtonRelease:
"""
This input event represents a mouse button being released.
.. attribute:: button
The identifier string of the mouse button that was released. See
the table in the documentation for
:class:`sge.input.MouseButtonPress`.
"""
def __init__(self, button):
self.button = button
class MouseWheelMove:
"""
This input event represents a mouse wheel moving.
.. attribute:: x
The horizontal scroll amount, where ``-1`` is to the left, ``1``
is to the right, and ``0`` is no horizontal scrolling.
.. attribute:: y
The vertical scroll amount, where ``-1`` is up, ``1`` is down,
and ``0`` is no vertical scrolling.
"""
def __init__(self, x, y):
self.x = x
self.y = y
class JoystickAxisMove:
"""
This input event represents a joystick axis moving.
.. attribute:: js_name
The name of the joystick.
.. attribute:: js_id
The number of the joystick, where ``0`` is the first joystick.
.. attribute:: axis
The number of the axis that moved, where ``0`` is the first axis
on the joystick.
.. attribute:: value
The tilt of the axis as a float from ``-1`` to ``1``, where ``0``
is centered, ``-1`` is all the way to the left or up, and ``1``
is all the way to the right or down.
"""
def __init__(self, js_name, js_id, axis, value):
self.js_name = js_name
self.js_id = js_id
self.axis = axis
self.value = max(-1.0, min(value, 1.0))
class JoystickHatMove:
"""
This input event represents a joystick hat moving.
.. attribute:: js_name
The name of the joystick.
.. attribute:: js_id
The number of the joystick, where ``0`` is the first joystick.
.. attribute:: hat
The number of the hat that moved, where ``0`` is the first axis
on the joystick.
.. attribute:: x
The horizontal position of the hat, where ``0`` is centered,
``-1`` is left, and ``1`` is right.
.. attribute:: y
The vertical position of the hat, where ``0`` is centered, ``-1``
is up, and ``1`` is down.
"""
def __init__(self, js_name, js_id, hat, x, y):
self.js_name = js_name
self.js_id = js_id
self.hat = hat
self.x = x
self.y = y
class JoystickTrackballMove:
"""
This input event represents a joystick trackball moving.
.. attribute:: js_name
The name of the joystick.
.. attribute:: js_id
The number of the joystick, where ``0`` is the first joystick.
.. attribute:: ball
The number of the trackball that moved, where ``0`` is the first
trackball on the joystick.
.. attribute:: x
The horizontal relative movement of the trackball.
.. attribute:: y
The vertical relative movement of the trackball.
"""
def __init__(self, js_name, js_id, ball, x, y):
self.js_name = js_name
self.js_id = js_id
self.ball = ball
self.x = x
self.y = y
class JoystickButtonPress:
"""
This input event represents a joystick button being pressed.
.. attribute:: js_name
The name of the joystick.
.. attribute:: js_id
The number of the joystick, where ``0`` is the first joystick.
.. attribute:: button
The number of the button that was pressed, where ``0`` is the
first button on the joystick.
"""
def __init__(self, js_name, js_id, button):
self.js_name = js_name
self.js_id = js_id
self.button = button
class JoystickButtonRelease:
"""
This input event represents a joystick button being released.
.. attribute:: js_name
The name of the joystick.
.. attribute:: js_id
The number of the joystick, where ``0`` is the first joystick.
.. attribute:: button
The number of the button that was released, where ``0`` is the
first button on the joystick.
"""
def __init__(self, js_name, js_id, button):
self.js_name = js_name
self.js_id = js_id
self.button = button
class JoystickEvent:
"""
This input event represents the movement of any joystick input.
This makes it possible to treat all joystick inputs the same way,
which can be used to simplify things like control customization.
.. attribute:: js_name
The name of the joystick.
.. attribute:: js_id
The number of the joystick, where ``0`` is the first joystick.
.. attribute:: input_type
The type of joystick control that was moved. Can be one of the
following:
- ``"axis-"`` -- The tilt of a joystick axis to the left or up
changes.
- ``"axis+"`` -- The tilt of a joystick axis to the right or down
changes.
- ``"axis0"`` -- The tilt of a joystick axis changes.
- ``"hat_left"`` -- Whether or not a joystick hat's position is
to the left changes.
- ``"hat_right"`` -- Whether or not a joystick hat's position is
to the right changes.
- ``"hat_center_x"`` -- Whether or not a joystick hat is
horizontally centered changes.
- ``"hat_up"`` -- Whether or not a joystick hat's position is up
changes.
- ``"hat_down"`` -- Whether or not a joystick hat's position is
down changes.
- ``"hat_center_y"`` -- Whether or not a joystick hat is
vertically centered changes.
- ``"trackball_left"`` -- A joystick trackball is moved left.
- ``"trackball_right"`` -- A joystick trackball is moved right.
- ``"trackball_up"`` -- A joystick trackball is moved up.
- ``"trackball_down"`` -- A joystick trackball is moved down.
- ``"button"`` -- Whether or not a joystick button is pressed
changes.
.. attribute:: input_id
The number of the joystick control that was moved, where ``0`` is
the first control of its type on the joystick.
.. attribute:: value
The value of the event, which is different depending on the value
of :attr:`input_type`. If :attr:`input_type` is
``"trackball_left"``, ``"trackball_right"``, ``"trackball_up"``,
or ``"trackball_down"``, this is the relative movement of the
trackball in the respective direction. Otherwise, this is the
new value of the respective control. See the documentation for
:func:`sge.joystick.get_value` for more information.
"""
def __init__(self, js_name, js_id, input_type, input_id, value):
self.js_name = js_name
self.js_id = js_id
self.input_type = input_type
self.input_id = input_id
self.value = value
class KeyboardFocusGain:
"""
This input event represents the game window gaining keyboard focus.
Keyboard focus is normally needed for keyboard input to be received.
.. note::
On some window systems, such as the one used by Windows, no
distinction is made between keyboard and mouse focus, but on
some other window systems, such as the X Window System, a
distinction is made: one window can have keyboard focus while
another has mouse focus. Be careful to observe the
difference; failing to do so may result in annoying bugs,
and you won't notice these bugs if you are testing on a
window manager that doesn't recognize the difference.
"""
class KeyboardFocusLose:
"""
This input event represents the game window losing keyboard focus.
Keyboard focus is normally needed for keyboard input to be received.
.. note::
See the note in the documentation for
:class:`sge.input.KeyboardFocusGain`.
"""
class MouseFocusGain:
"""
This input event represents the game window gaining mouse focus.
Mouse focus is normally needed for mouse input to be received.
.. note::
See the note in the documentation for
:class:`sge.input.KeyboardFocusGain`.
"""
class MouseFocusLose:
"""
This input event represents the game window losing mouse focus.
Mouse focus is normally needed for mouse input to be received.
.. note::
See the note in the documentation for
:class:`sge.input.KeyboardFocusGain`.
"""
class WindowResize:
"""
This input event represents the player resizing the window.
"""
class QuitRequest:
"""
This input event represents the OS requesting for the program to
close (e.g. when the user presses a "close" button on the window
border).
"""
| [
1,
396,
910,
934,
338,
760,
310,
278,
349,
4790,
420,
317,
1692,
29889,
13,
29937,
29871,
13,
29937,
450,
349,
4790,
420,
317,
1692,
338,
3889,
7047,
29901,
366,
508,
2654,
391,
2666,
372,
322,
29914,
272,
6623,
13,
29937,
372,
1090,
278,
4958,
310,
278,
15143,
365,
16136,
4593,
5236,
19245,
408,
6369,
491,
13,
29937,
278,
12362,
18540,
10606,
29892,
2845,
1873,
29871,
29941,
310,
278,
19245,
29892,
470,
13,
29937,
313,
271,
596,
2984,
29897,
738,
2678,
1873,
29889,
13,
29937,
29871,
13,
29937,
450,
349,
4790,
420,
317,
1692,
338,
13235,
297,
278,
4966,
393,
372,
674,
367,
5407,
29892,
13,
29937,
541,
399,
1806,
8187,
2692,
13764,
29979,
399,
1718,
29934,
13566,
29979,
29936,
1728,
1584,
278,
2411,
2957,
1370,
21867,
29891,
310,
13,
29937,
341,
1001,
3210,
13566,
2882,
6227,
11937,
470,
383,
1806,
8186,
1799,
15842,
319,
349,
8322,
2965,
13309,
1718,
349,
4574,
13152,
1660,
29889,
29871,
2823,
278,
13,
29937,
15143,
365,
16136,
4593,
5236,
19245,
363,
901,
4902,
29889,
13,
29937,
29871,
13,
29937,
887,
881,
505,
4520,
263,
3509,
310,
278,
15143,
365,
16136,
4593,
5236,
19245,
13,
29937,
3412,
411,
278,
349,
4790,
420,
317,
1692,
29889,
29871,
960,
451,
29892,
1074,
529,
1124,
597,
1636,
29889,
18713,
29889,
990,
29914,
506,
11259,
3779,
29889,
13,
13,
15945,
29908,
13,
4013,
3883,
8128,
1881,
1741,
4413,
29889,
29871,
10567,
1741,
3618,
526,
1304,
13,
517,
1136,
17211,
403,
599,
5181,
2472,
1048,
1881,
4959,
297,
263,
5941,
13,
1582,
29889,
13,
13,
3492,
12891,
1016,
29915,
29873,
817,
304,
671,
1881,
1741,
3618,
4153,
29889,
29871,
10567,
13,
13604,
526,
16459,
6336,
297,
1269,
3515,
310,
278,
317,
1692,
29915,
29879,
1667,
2425,
29889,
13,
3492,
871,
817,
304,
671,
1881,
1741,
3618,
4153,
565,
366,
2125,
2761,
13,
21694,
515,
278,
317,
1692,
29915,
29879,
1667,
2425,
29892,
321,
29889,
29887,
29889,
304,
1653,
596,
1914,
2425,
29889,
13,
15945,
29908,
13,
13,
13,
1649,
497,
1649,
353,
6796,
2558,
10923,
613,
376,
2558,
19729,
613,
376,
14346,
16619,
613,
376,
14346,
3125,
10923,
613,
13,
965,
376,
14346,
3125,
19729,
613,
376,
10844,
858,
860,
16070,
16619,
613,
376,
10844,
858,
860,
29950,
271,
16619,
613,
13,
965,
376,
10844,
858,
860,
17936,
2135,
16619,
613,
376,
10844,
858,
860,
3125,
10923,
613,
13,
965,
376,
10844,
858,
860,
3125,
19729,
613,
376,
10844,
858,
860,
2624,
613,
376,
2558,
3377,
20560,
29954,
475,
613,
13,
965,
376,
2558,
3377,
20560,
29931,
852,
613,
376,
14346,
20560,
29954,
475,
613,
376,
14346,
20560,
29931,
852,
613,
13,
965,
376,
2182,
277,
3089,
3108,
13,
13,
13,
1990,
7670,
10923,
29901,
13,
13,
1678,
9995,
13,
1678,
910,
1881,
1741,
11524,
263,
1820,
373,
278,
12247,
1641,
15385,
29889,
13,
13,
1678,
6317,
5352,
1057,
1820,
13,
13,
539,
450,
15882,
1347,
310,
278,
1820,
393,
471,
15385,
29889,
29871,
2823,
278,
13,
539,
1591,
297,
278,
5106,
363,
584,
1545,
18078,
29879,
479,
29889,
1989,
3377,
1412,
13,
13,
1678,
6317,
5352,
1057,
1373,
13,
13,
539,
450,
29104,
1347,
6942,
411,
278,
1820,
3965,
29892,
470,
385,
4069,
13,
539,
29104,
1347,
565,
694,
1426,
338,
6942,
411,
278,
1820,
3965,
29889,
13,
539,
2823,
278,
1591,
297,
278,
5106,
363,
584,
1545,
18078,
29879,
479,
29889,
1989,
3377,
1412,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1820,
29892,
1373,
1125,
13,
4706,
1583,
29889,
1989,
353,
1820,
13,
4706,
1583,
29889,
3090,
353,
1373,
13,
13,
13,
1990,
7670,
19729,
29901,
13,
13,
1678,
9995,
13,
1678,
910,
1881,
1741,
11524,
263,
1820,
373,
278,
12247,
1641,
5492,
29889,
13,
13,
1678,
6317,
5352,
1057,
1820,
13,
13,
539,
450,
15882,
1347,
310,
278,
1820,
393,
471,
5492,
29889,
29871,
2823,
278,
13,
539,
1591,
297,
278,
5106,
363,
584,
1990,
18078,
29879,
479,
29889,
2080,
29889,
2558,
10923,
1412,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1820,
1125,
13,
4706,
1583,
29889,
1989,
353,
1820,
13,
13,
13,
1990,
25992,
16619,
29901,
13,
13,
1678,
9995,
13,
1678,
910,
1881,
1741,
11524,
278,
9495,
1641,
6153,
29889,
13,
13,
1678,
6317,
5352,
1057,
921,
13,
13,
539,
450,
14698,
6198,
10298,
310,
278,
9495,
29889,
13,
13,
1678,
6317,
5352,
1057,
343,
13,
13,
539,
450,
11408,
6198,
10298,
310,
278,
9495,
29889,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
921,
29892,
343,
1125,
13,
4706,
1583,
29889,
29916,
353,
921,
13,
4706,
1583,
29889,
29891,
353,
343,
13,
13,
13,
1990,
25992,
3125,
10923,
29901,
13,
13,
1678,
9995,
13,
1678,
910,
1881,
1741,
11524,
263,
9495,
2826,
1641,
15385,
29889,
13,
13,
1678,
6317,
5352,
1057,
2826,
13,
13,
539,
450,
15882,
1347,
310,
278,
9495,
2826,
393,
471,
15385,
29889,
29871,
2823,
13,
539,
278,
1591,
2400,
29889,
13,
13,
1678,
1275,
9166,
2751,
1275,
4936,
2751,
25512,
13,
1678,
25992,
11025,
4408,
418,
20286,
1714,
13,
1678,
1275,
9166,
2751,
1275,
4936,
2751,
25512,
13,
1678,
19941,
9495,
2826,
418,
4954,
29908,
1563,
6937,
29952,
13,
1678,
10428,
9495,
2826,
268,
4954,
29908,
1266,
6937,
29952,
13,
1678,
14253,
9495,
2826,
1678,
4954,
29908,
17662,
6937,
29952,
13,
1678,
7338,
336,
9495,
2826,
29871,
29896,
259,
4954,
29908,
17833,
29896,
6937,
29952,
13,
1678,
7338,
336,
9495,
2826,
29871,
29906,
259,
4954,
29908,
17833,
29906,
6937,
29952,
13,
1678,
1275,
9166,
2751,
1275,
4936,
2751,
25512,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
2826,
1125,
13,
4706,
1583,
29889,
3092,
353,
2826,
13,
13,
13,
1990,
25992,
3125,
19729,
29901,
13,
13,
1678,
9995,
13,
1678,
910,
1881,
1741,
11524,
263,
9495,
2826,
1641,
5492,
29889,
13,
13,
1678,
6317,
5352,
1057,
2826,
13,
13,
539,
450,
15882,
1347,
310,
278,
9495,
2826,
393,
471,
5492,
29889,
29871,
2823,
13,
539,
278,
1591,
297,
278,
5106,
363,
13,
539,
584,
1990,
18078,
29879,
479,
29889,
2080,
29889,
14346,
3125,
10923,
1412,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
2826,
1125,
13,
4706,
1583,
29889,
3092,
353,
2826,
13,
13,
13,
1990,
25992,
29956,
10552,
16619,
29901,
13,
13,
1678,
9995,
13,
1678,
910,
1881,
1741,
11524,
263,
9495,
18875,
8401,
29889,
13,
13,
1678,
6317,
5352,
1057,
921,
13,
13,
539,
450,
14698,
6355,
5253,
29892,
988,
4954,
29899,
29896,
16159,
338,
304,
278,
2175,
29892,
4954,
29896,
16159,
13,
539,
338,
304,
278,
1492,
29892,
322,
4954,
29900,
16159,
338,
694,
14698,
23064,
29889,
13,
13,
1678,
6317,
5352,
1057,
343,
13,
13,
539,
450,
11408,
6355,
5253,
29892,
988,
4954,
29899,
29896,
16159,
338,
701,
29892,
4954,
29896,
16159,
338,
1623,
29892,
13,
539,
322,
4954,
29900,
16159,
338,
694,
11408,
23064,
29889,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
921,
29892,
343,
1125,
13,
4706,
1583,
29889,
29916,
353,
921,
13,
4706,
1583,
29889,
29891,
353,
343,
13,
13,
13,
1990,
3650,
858,
860,
16070,
16619,
29901,
13,
13,
1678,
9995,
13,
1678,
910,
1881,
1741,
11524,
263,
2958,
858,
860,
9685,
8401,
29889,
13,
13,
1678,
6317,
5352,
1057,
6965,
29918,
978,
13,
13,
539,
450,
1024,
310,
278,
2958,
858,
860,
29889,
13,
13,
1678,
6317,
5352,
1057,
6965,
29918,
333,
13,
13,
539,
450,
1353,
310,
278,
2958,
858,
860,
29892,
988,
4954,
29900,
16159,
338,
278,
937,
2958,
858,
860,
29889,
13,
13,
1678,
6317,
5352,
1057,
9685,
13,
13,
539,
450,
1353,
310,
278,
9685,
393,
6153,
29892,
988,
4954,
29900,
16159,
338,
278,
937,
9685,
13,
539,
373,
278,
2958,
858,
860,
29889,
13,
13,
1678,
6317,
5352,
1057,
995,
13,
13,
539,
450,
260,
2782,
310,
278,
9685,
408,
263,
5785,
515,
4954,
29899,
29896,
16159,
304,
4954,
29896,
29952,
1673,
988,
4954,
29900,
16159,
13,
539,
338,
24764,
29892,
4954,
29899,
29896,
16159,
338,
599,
278,
982,
304,
278,
2175,
470,
701,
29892,
322,
4954,
29896,
16159,
13,
539,
338,
599,
278,
982,
304,
278,
1492,
470,
1623,
29889,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
6965,
29918,
978,
29892,
6965,
29918,
333,
29892,
9685,
29892,
995,
1125,
13,
4706,
1583,
29889,
1315,
29918,
978,
353,
6965,
29918,
978,
13,
4706,
1583,
29889,
1315,
29918,
333,
353,
6965,
29918,
333,
13,
4706,
1583,
29889,
8990,
353,
9685,
13,
4706,
1583,
29889,
1767,
353,
4236,
6278,
29896,
29889,
29900,
29892,
1375,
29898,
1767,
29892,
29871,
29896,
29889,
29900,
876,
13,
13,
13,
1990,
3650,
858,
860,
29950,
271,
16619,
29901,
13,
13,
1678,
9995,
13,
1678,
910,
1881,
1741,
11524,
263,
2958,
858,
860,
3056,
8401,
29889,
13,
13,
1678,
6317,
5352,
1057,
6965,
29918,
978,
13,
13,
539,
450,
1024,
310,
278,
2958,
858,
860,
29889,
13,
13,
1678,
6317,
5352,
1057,
6965,
29918,
333,
13,
13,
539,
450,
1353,
310,
278,
2958,
858,
860,
29892,
988,
4954,
29900,
16159,
338,
278,
937,
2958,
858,
860,
29889,
13,
13,
1678,
6317,
5352,
1057,
3056,
13,
13,
539,
450,
1353,
310,
278,
3056,
393,
6153,
29892,
988,
4954,
29900,
16159,
338,
278,
937,
9685,
13,
539,
373,
278,
2958,
858,
860,
29889,
13,
13,
1678,
6317,
5352,
1057,
921,
13,
13,
539,
450,
14698,
2602,
310,
278,
3056,
29892,
988,
4954,
29900,
16159,
338,
24764,
29892,
13,
539,
4954,
29899,
29896,
16159,
338,
2175,
29892,
322,
4954,
29896,
16159,
338,
1492,
29889,
13,
13,
1678,
6317,
5352,
1057,
343,
13,
13,
539,
450,
11408,
2602,
310,
278,
3056,
29892,
988,
4954,
29900,
16159,
338,
24764,
29892,
4954,
29899,
29896,
16159,
13,
539,
338,
701,
29892,
322,
4954,
29896,
16159,
338,
1623,
29889,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
6965,
29918,
978,
29892,
6965,
29918,
333,
29892,
3056,
29892,
921,
29892,
343,
1125,
13,
4706,
1583,
29889,
1315,
29918,
978,
353,
6965,
29918,
978,
13,
4706,
1583,
29889,
1315,
29918,
333,
353,
6965,
29918,
333,
13,
4706,
1583,
29889,
2455,
353,
3056,
13,
4706,
1583,
29889,
29916,
353,
921,
13,
4706,
1583,
29889,
29891,
353,
343,
13,
13,
13,
1990,
3650,
858,
860,
17936,
2135,
16619,
29901,
13,
13,
1678,
9995,
13,
1678,
910,
1881,
1741,
11524,
263,
2958,
858,
860,
5702,
2135,
8401,
29889,
13,
13,
1678,
6317,
5352,
1057,
6965,
29918,
978,
13,
13,
539,
450,
1024,
310,
278,
2958,
858,
860,
29889,
13,
13,
1678,
6317,
5352,
1057,
6965,
29918,
333,
13,
13,
539,
450,
1353,
310,
278,
2958,
858,
860,
29892,
988,
4954,
29900,
16159,
338,
278,
937,
2958,
858,
860,
29889,
13,
13,
1678,
6317,
5352,
1057,
8287,
13,
13,
539,
450,
1353,
310,
278,
5702,
2135,
393,
6153,
29892,
988,
4954,
29900,
16159,
338,
278,
937,
13,
539,
5702,
2135,
373,
278,
2958,
858,
860,
29889,
13,
13,
1678,
6317,
5352,
1057,
921,
13,
13,
539,
450,
14698,
6198,
10298,
310,
278,
5702,
2135,
29889,
13,
13,
1678,
6317,
5352,
1057,
343,
13,
13,
539,
450,
11408,
6198,
10298,
310,
278,
5702,
2135,
29889,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
6965,
29918,
978,
29892,
6965,
29918,
333,
29892,
8287,
29892,
921,
29892,
343,
1125,
13,
4706,
1583,
29889,
1315,
29918,
978,
353,
6965,
29918,
978,
13,
4706,
1583,
29889,
1315,
29918,
333,
353,
6965,
29918,
333,
13,
4706,
1583,
29889,
2135,
353,
8287,
13,
4706,
1583,
29889,
29916,
353,
921,
13,
4706,
1583,
29889,
29891,
353,
343,
13,
13,
13,
1990,
3650,
858,
860,
3125,
10923,
29901,
13,
13,
1678,
9995,
13,
1678,
910,
1881,
1741,
11524,
263,
2958,
858,
860,
2826,
1641,
15385,
29889,
13,
13,
1678,
6317,
5352,
1057,
6965,
29918,
978,
13,
13,
539,
450,
1024,
310,
278,
2958,
858,
860,
29889,
13,
13,
1678,
6317,
5352,
1057,
6965,
29918,
333,
13,
13,
539,
450,
1353,
310,
278,
2958,
858,
860,
29892,
988,
4954,
29900,
16159,
338,
278,
937,
2958,
858,
860,
29889,
13,
13,
1678,
6317,
5352,
1057,
2826,
13,
13,
539,
450,
1353,
310,
278,
2826,
393,
471,
15385,
29892,
988,
4954,
29900,
16159,
338,
278,
13,
539,
937,
2826,
373,
278,
2958,
858,
860,
29889,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
6965,
29918,
978,
29892,
6965,
29918,
333,
29892,
2826,
1125,
13,
4706,
1583,
29889,
1315,
29918,
978,
353,
6965,
29918,
978,
13,
4706,
1583,
29889,
1315,
29918,
333,
353,
6965,
29918,
333,
13,
4706,
1583,
29889,
3092,
353,
2826,
13,
13,
13,
1990,
3650,
858,
860,
3125,
19729,
29901,
13,
13,
1678,
9995,
13,
1678,
910,
1881,
1741,
11524,
263,
2958,
858,
860,
2826,
1641,
5492,
29889,
13,
13,
1678,
6317,
5352,
1057,
6965,
29918,
978,
13,
13,
539,
450,
1024,
310,
278,
2958,
858,
860,
29889,
13,
13,
1678,
6317,
5352,
1057,
6965,
29918,
333,
13,
13,
539,
450,
1353,
310,
278,
2958,
858,
860,
29892,
988,
4954,
29900,
16159,
338,
278,
937,
2958,
858,
860,
29889,
13,
13,
1678,
6317,
5352,
1057,
2826,
13,
13,
539,
450,
1353,
310,
278,
2826,
393,
471,
5492,
29892,
988,
4954,
29900,
16159,
338,
278,
13,
539,
937,
2826,
373,
278,
2958,
858,
860,
29889,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
6965,
29918,
978,
29892,
6965,
29918,
333,
29892,
2826,
1125,
13,
4706,
1583,
29889,
1315,
29918,
978,
353,
6965,
29918,
978,
13,
4706,
1583,
29889,
1315,
29918,
333,
353,
6965,
29918,
333,
13,
4706,
1583,
29889,
3092,
353,
2826,
13,
13,
13,
1990,
3650,
858,
860,
2624,
29901,
13,
13,
1678,
9995,
13,
1678,
910,
1881,
1741,
11524,
278,
10298,
310,
738,
2958,
858,
860,
1881,
29889,
13,
1678,
910,
3732,
372,
1950,
304,
7539,
599,
2958,
858,
860,
10970,
278,
1021,
982,
29892,
13,
1678,
607,
508,
367,
1304,
304,
21092,
2712,
763,
2761,
2888,
2133,
29889,
13,
13,
1678,
6317,
5352,
1057,
6965,
29918,
978,
13,
13,
539,
450,
1024,
310,
278,
2958,
858,
860,
29889,
13,
13,
1678,
6317,
5352,
1057,
6965,
29918,
333,
13,
13,
539,
450,
1353,
310,
278,
2958,
858,
860,
29892,
988,
4954,
29900,
16159,
338,
278,
937,
2958,
858,
860,
29889,
13,
13,
1678,
6317,
5352,
1057,
1881,
29918,
1853,
13,
13,
539,
450,
1134,
310,
2958,
858,
860,
2761,
393,
471,
6153,
29889,
29871,
1815,
367,
697,
310,
278,
13,
539,
1494,
29901,
13,
13,
539,
448,
4954,
29908,
8990,
29899,
6937,
29952,
1192,
450,
260,
2782,
310,
263,
2958,
858,
860,
9685,
304,
278,
2175,
470,
701,
13,
308,
3620,
29889,
13,
539,
448,
4954,
29908,
8990,
29974,
6937,
29952,
1192,
450,
260,
2782,
310,
263,
2958,
858,
860,
9685,
304,
278,
1492,
470,
1623,
13,
308,
3620,
29889,
13,
539,
448,
4954,
29908,
8990,
29900,
6937,
29952,
1192,
450,
260,
2782,
310,
263,
2958,
858,
860,
9685,
3620,
29889,
13,
539,
448,
4954,
29908,
2455,
29918,
1563,
6937,
29952,
1192,
26460,
470,
451,
263,
2958,
858,
860,
3056,
29915,
29879,
2602,
338,
13,
308,
304,
278,
2175,
3620,
29889,
13,
539,
448,
4954,
29908,
2455,
29918,
1266,
6937,
29952,
1192,
26460,
470,
451,
263,
2958,
858,
860,
3056,
29915,
29879,
2602,
338,
13,
308,
304,
278,
1492,
3620,
29889,
13,
539,
448,
4954,
29908,
2455,
29918,
5064,
29918,
29916,
6937,
29952,
1192,
26460,
470,
451,
263,
2958,
858,
860,
3056,
338,
13,
308,
4029,
6753,
635,
24764,
3620,
29889,
13,
539,
448,
4954,
29908,
2455,
29918,
786,
6937,
29952,
1192,
26460,
470,
451,
263,
2958,
858,
860,
3056,
29915,
29879,
2602,
338,
701,
13,
308,
3620,
29889,
13,
539,
448,
4954,
29908,
2455,
29918,
3204,
6937,
29952,
1192,
26460,
470,
451,
263,
2958,
858,
860,
3056,
29915,
29879,
2602,
338,
13,
308,
1623,
3620,
29889,
13,
539,
448,
4954,
29908,
2455,
29918,
5064,
29918,
29891,
6937,
29952,
1192,
26460,
470,
451,
263,
2958,
858,
860,
3056,
338,
13,
308,
4837,
1711,
24764,
3620,
29889,
13,
539,
448,
4954,
29908,
11294,
2135,
29918,
1563,
6937,
29952,
1192,
319,
2958,
858,
860,
5702,
2135,
338,
6153,
2175,
29889,
13,
539,
448,
4954,
29908,
11294,
2135,
29918,
1266,
6937,
29952,
1192,
319,
2958,
858,
860,
5702,
2135,
338,
6153,
1492,
29889,
13,
539,
448,
4954,
29908,
11294,
2135,
29918,
786,
6937,
29952,
1192,
319,
2958,
858,
860,
5702,
2135,
338,
6153,
701,
29889,
13,
539,
448,
4954,
29908,
11294,
2135,
29918,
3204,
6937,
29952,
1192,
319,
2958,
858,
860,
5702,
2135,
338,
6153,
1623,
29889,
13,
539,
448,
4954,
29908,
3092,
6937,
29952,
1192,
26460,
470,
451,
263,
2958,
858,
860,
2826,
338,
15385,
13,
308,
3620,
29889,
13,
13,
1678,
6317,
5352,
1057,
1881,
29918,
333,
13,
13,
539,
450,
1353,
310,
278,
2958,
858,
860,
2761,
393,
471,
6153,
29892,
988,
4954,
29900,
16159,
338,
13,
539,
278,
937,
2761,
310,
967,
1134,
373,
278,
2958,
858,
860,
29889,
13,
13,
1678,
6317,
5352,
1057,
995,
13,
13,
539,
450,
995,
310,
278,
1741,
29892,
607,
338,
1422,
8679,
373,
278,
995,
13,
539,
310,
584,
5552,
18078,
2080,
29918,
1853,
1412,
29871,
960,
584,
5552,
18078,
2080,
29918,
1853,
29952,
338,
13,
539,
4954,
29908,
11294,
2135,
29918,
1563,
6937,
1673,
4954,
29908,
11294,
2135,
29918,
1266,
6937,
1673,
4954,
29908,
11294,
2135,
29918,
786,
6937,
1673,
13,
539,
470,
4954,
29908,
11294,
2135,
29918,
3204,
6937,
1673,
445,
338,
278,
6198,
10298,
310,
278,
13,
539,
5702,
2135,
297,
278,
18067,
5305,
29889,
29871,
13466,
29892,
445,
338,
278,
13,
539,
716,
995,
310,
278,
18067,
2761,
29889,
29871,
2823,
278,
5106,
363,
13,
539,
584,
9891,
18078,
29879,
479,
29889,
2212,
858,
860,
29889,
657,
29918,
1767,
29952,
363,
901,
2472,
29889,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
6965,
29918,
978,
29892,
6965,
29918,
333,
29892,
1881,
29918,
1853,
29892,
1881,
29918,
333,
29892,
995,
1125,
13,
4706,
1583,
29889,
1315,
29918,
978,
353,
6965,
29918,
978,
13,
4706,
1583,
29889,
1315,
29918,
333,
353,
6965,
29918,
333,
13,
4706,
1583,
29889,
2080,
29918,
1853,
353,
1881,
29918,
1853,
13,
4706,
1583,
29889,
2080,
29918,
333,
353,
1881,
29918,
333,
13,
4706,
1583,
29889,
1767,
353,
995,
13,
13,
13,
1990,
7670,
3377,
20560,
29954,
475,
29901,
13,
13,
1678,
9995,
13,
1678,
910,
1881,
1741,
11524,
278,
3748,
3474,
11581,
292,
12247,
8569,
29889,
13,
1678,
7670,
3377,
8569,
338,
12891,
4312,
363,
12247,
1881,
304,
367,
4520,
29889,
13,
13,
1678,
6317,
4443,
1057,
13,
13,
539,
1551,
777,
3474,
6757,
29892,
1316,
408,
278,
697,
1304,
491,
3852,
29892,
694,
13,
539,
21578,
338,
1754,
1546,
12247,
322,
9495,
8569,
29892,
541,
373,
13,
539,
777,
916,
3474,
6757,
29892,
1316,
408,
278,
1060,
18379,
2184,
29892,
263,
13,
539,
21578,
338,
1754,
29901,
697,
3474,
508,
505,
12247,
8569,
1550,
13,
539,
1790,
756,
9495,
8569,
29889,
29871,
1522,
16010,
304,
14111,
278,
13,
539,
4328,
29936,
17581,
304,
437,
577,
1122,
1121,
297,
12327,
5414,
24557,
29892,
13,
539,
322,
366,
2113,
29915,
29873,
8369,
1438,
24557,
565,
366,
526,
6724,
373,
263,
13,
539,
3474,
8455,
393,
1838,
29915,
29873,
18720,
278,
4328,
29889,
13,
1678,
9995,
13,
13,
13,
1990,
7670,
3377,
20560,
29931,
852,
29901,
13,
13,
1678,
9995,
13,
1678,
910,
1881,
1741,
11524,
278,
3748,
3474,
19035,
12247,
8569,
29889,
13,
1678,
7670,
3377,
8569,
338,
12891,
4312,
363,
12247,
1881,
304,
367,
4520,
29889,
13,
13,
1678,
6317,
4443,
1057,
13,
13,
539,
2823,
278,
4443,
297,
278,
5106,
363,
13,
539,
584,
1990,
18078,
29879,
479,
29889,
2080,
29889,
2558,
3377,
20560,
29954,
475,
1412,
13,
1678,
9995,
13,
13,
13,
1990,
25992,
20560,
29954,
475,
29901,
13,
13,
1678,
9995,
13,
1678,
910,
1881,
1741,
11524,
278,
3748,
3474,
11581,
292,
9495,
8569,
29889,
13,
1678,
25992,
8569,
338,
12891,
4312,
363,
9495,
1881,
304,
367,
4520,
29889,
13,
13,
1678,
6317,
4443,
1057,
13,
13,
539,
2823,
278,
4443,
297,
278,
5106,
363,
13,
539,
584,
1990,
18078,
29879,
479,
29889,
2080,
29889,
2558,
3377,
20560,
29954,
475,
1412,
13,
1678,
9995,
13,
13,
13,
1990,
25992,
20560,
29931,
852,
29901,
13,
13,
1678,
9995,
13,
1678,
910,
1881,
1741,
11524,
278,
3748,
3474,
19035,
9495,
8569,
29889,
13,
1678,
25992,
8569,
338,
12891,
4312,
363,
9495,
1881,
304,
367,
4520,
29889,
13,
13,
1678,
6317,
4443,
1057,
13,
13,
539,
2823,
278,
4443,
297,
278,
5106,
363,
13,
539,
584,
1990,
18078,
29879,
479,
29889,
2080,
29889,
2558,
3377,
20560,
29954,
475,
1412,
13,
1678,
9995,
13,
13,
13,
1990,
18379,
1666,
675,
29901,
13,
13,
1678,
9995,
13,
1678,
910,
1881,
1741,
11524,
278,
4847,
620,
5281,
278,
3474,
29889,
13,
1678,
9995,
13,
13,
13,
1990,
751,
277,
3089,
29901,
13,
13,
1678,
9995,
13,
1678,
910,
1881,
1741,
11524,
278,
6570,
2009,
292,
363,
278,
1824,
304,
13,
1678,
3802,
313,
29872,
29889,
29887,
29889,
746,
278,
1404,
3965,
267,
263,
376,
5358,
29908,
2826,
373,
278,
3474,
13,
1678,
5139,
467,
13,
1678,
9995,
13,
2
] |
qchem/qchem.py | SinaMostafanejad/MolSSI_project_FSHXF | 0 | 79457 | <filename>qchem/qchem.py
from __future__ import division
from qm.qm_calculator import QM_calculator
from misc import call_name
class QChem(QM_calculator):
""" Class for common parts of Q-Chem
:param string basis_set: Basis set information
:param string memory: Allocatable memory in the calculation
:param string qm_path: Path for Q-Chem
:param integer nthreads: Number of threads in the calculation
:param string version: Version of Q-Chem
"""
def __init__(self, basis_set, memory, qm_path, nthreads, version):
# Save name of QM calculator and its method
super().__init__()
# Initialize Q-Chem common variables
self.basis_set = basis_set
self.memory = memory
self.qm_path = qm_path
self.nthreads = nthreads
self.version = version
if (self.version != "5.2"):
raise ValueError (f"( {self.qm_prog}.{call_name()} ) Other version not implemented! {self.version}")
| [
1,
529,
9507,
29958,
29939,
14969,
29914,
29939,
14969,
29889,
2272,
13,
3166,
4770,
29888,
9130,
1649,
1053,
8542,
13,
3166,
3855,
29885,
29889,
29939,
29885,
29918,
15807,
1061,
1053,
660,
29924,
29918,
15807,
1061,
13,
3166,
3984,
29883,
1053,
1246,
29918,
978,
13,
13,
1990,
660,
1451,
331,
29898,
29984,
29924,
29918,
15807,
1061,
1125,
13,
1678,
9995,
4134,
363,
3619,
5633,
310,
660,
29899,
1451,
331,
13,
13,
4706,
584,
3207,
1347,
8405,
29918,
842,
29901,
4886,
275,
731,
2472,
13,
4706,
584,
3207,
1347,
3370,
29901,
838,
2029,
17219,
3370,
297,
278,
13944,
13,
4706,
584,
3207,
1347,
3855,
29885,
29918,
2084,
29901,
10802,
363,
660,
29899,
1451,
331,
13,
4706,
584,
3207,
6043,
302,
28993,
29901,
9681,
310,
9717,
297,
278,
13944,
13,
4706,
584,
3207,
1347,
1873,
29901,
10079,
310,
660,
29899,
1451,
331,
13,
1678,
9995,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
8405,
29918,
842,
29892,
3370,
29892,
3855,
29885,
29918,
2084,
29892,
302,
28993,
29892,
1873,
1125,
13,
4706,
396,
16913,
1024,
310,
660,
29924,
3408,
1061,
322,
967,
1158,
13,
4706,
2428,
2141,
1649,
2344,
1649,
580,
13,
13,
4706,
396,
25455,
660,
29899,
1451,
331,
3619,
3651,
13,
4706,
1583,
29889,
6500,
275,
29918,
842,
353,
8405,
29918,
842,
13,
13,
4706,
1583,
29889,
14834,
353,
3370,
13,
4706,
1583,
29889,
29939,
29885,
29918,
2084,
353,
3855,
29885,
29918,
2084,
13,
4706,
1583,
29889,
29876,
28993,
353,
302,
28993,
13,
4706,
1583,
29889,
3259,
353,
1873,
13,
13,
4706,
565,
313,
1311,
29889,
3259,
2804,
376,
29945,
29889,
29906,
29908,
1125,
13,
9651,
12020,
7865,
2392,
313,
29888,
29908,
29898,
426,
1311,
29889,
29939,
29885,
29918,
29097,
1836,
29912,
4804,
29918,
978,
28296,
1723,
5901,
1873,
451,
8762,
29991,
426,
1311,
29889,
3259,
27195,
13,
2
] |
fused_biattention.py | utahnlp/layer_augmentation_qa | 6 | 38188 | import sys
import torch
from torch import nn
from torch.autograd import Variable
from view import *
from holder import *
from util import *
from join_table import *
from trilinear_prod import *
from fusion import *
# fused bidir attention
class FusedBiAttention(torch.nn.Module):
def __init__(self, opt, shared):
super(FusedBiAttention, self).__init__()
self.opt = opt
self.shared = shared
enc_size = opt.hidden_size if 'elmo' not in opt.enc else opt.hidden_size + opt.elmo_size
self.trilinear_prod = TrilinearProd(opt, enc_size)
self.fusion = Fusion(opt, enc_size)
self.softmax2 = nn.Softmax(2)
self.phi_joiner = JoinTable(2)
def biattention(self, scores, C, Q):
batch_l = self.shared.batch_l
context_l = self.shared.context_l
enc_size = C.shape[2]
# attention
att1 = self.softmax2(scores) # (batch_l, context_l, max_query_l)
att2 = self.softmax2(scores.transpose(1,2)) # (batch_l, max_query_l, context_l)
# attend
agg1 = att1.bmm(Q) # (batch_l, context_l, enc_size)
agg2 = att2.bmm(C) # (batch_l, max_query_l, enc_size)
agg2 = self.masked_fill_query(agg2)
return att1, att2, agg1, agg2
def masked_fill_scores(self, scores):
return scores * self.shared.score_mask + (self.shared.one - self.shared.score_mask) * self.shared.neg_inf
def masked_fill_query(self, query):
return query * self.shared.query_mask.unsqueeze(-1)
# input encodings of context (C) and query (Q)
# C of shape (batch_l, context_l, hidden_size)
# Q of shape (batch_l, query_l, hidden_size)
def forward(self, C, Q):
self.update_context()
batch_l = self.shared.batch_l
context_l = self.shared.context_l
max_query_l = self.shared.query_l.max()
hidden_size = self.opt.hidden_size
# get similarity score
scores = self.trilinear_prod(C, Q)
scores = self.masked_fill_scores(scores)
#
att1, att2, agg1, agg2 = self.biattention(scores, C, Q)
#
G = self.fusion(C, agg1)
P = self.fusion(Q, agg2)
P = self.masked_fill_query(P)
# bookkeeping
self.shared.att_soft1 = att1
self.shared.att_soft2 = att2
self.shared.G = G
self.shared.P = P
return att1, att2, G
def update_context(self):
batch_l = self.shared.batch_l
context_l = self.shared.context_l
max_query_l = self.shared.query_l.max()
word_vec_size = self.opt.word_vec_size
hidden_size = self.opt.hidden_size
def begin_pass(self):
pass
def end_pass(self):
pass
| [
1,
1053,
10876,
13,
13,
5215,
4842,
305,
13,
3166,
4842,
305,
1053,
302,
29876,
13,
3166,
4842,
305,
29889,
1300,
468,
3665,
1053,
28736,
13,
3166,
1776,
1053,
334,
13,
3166,
19464,
1053,
334,
13,
3166,
3667,
1053,
334,
13,
3166,
5988,
29918,
2371,
1053,
334,
13,
3166,
534,
309,
457,
279,
29918,
10633,
1053,
334,
13,
3166,
21736,
1053,
334,
13,
13,
29937,
285,
3880,
21000,
381,
8570,
13,
1990,
383,
3880,
20517,
4165,
2509,
29898,
7345,
305,
29889,
15755,
29889,
7355,
1125,
13,
12,
1753,
4770,
2344,
12035,
1311,
29892,
3523,
29892,
7258,
1125,
13,
12,
12,
9136,
29898,
29943,
3880,
20517,
4165,
2509,
29892,
1583,
467,
1649,
2344,
1649,
580,
13,
12,
12,
1311,
29889,
3670,
353,
3523,
13,
12,
12,
1311,
29889,
12366,
353,
7258,
13,
13,
12,
12,
3977,
29918,
2311,
353,
3523,
29889,
10892,
29918,
2311,
565,
525,
295,
4346,
29915,
451,
297,
3523,
29889,
3977,
1683,
3523,
29889,
10892,
29918,
2311,
718,
3523,
29889,
295,
4346,
29918,
2311,
13,
12,
12,
1311,
29889,
509,
309,
457,
279,
29918,
10633,
353,
1605,
309,
457,
279,
1184,
29881,
29898,
3670,
29892,
2094,
29918,
2311,
29897,
13,
13,
12,
12,
1311,
29889,
29888,
3958,
353,
383,
3958,
29898,
3670,
29892,
2094,
29918,
2311,
29897,
13,
13,
12,
12,
1311,
29889,
2695,
3317,
29906,
353,
302,
29876,
29889,
6295,
615,
3317,
29898,
29906,
29897,
13,
12,
12,
1311,
29889,
2876,
29918,
2212,
4983,
353,
3650,
262,
3562,
29898,
29906,
29897,
13,
13,
13,
12,
1753,
4768,
1131,
2509,
29898,
1311,
29892,
19435,
29892,
315,
29892,
660,
1125,
13,
12,
12,
16175,
29918,
29880,
353,
1583,
29889,
12366,
29889,
16175,
29918,
29880,
13,
12,
12,
4703,
29918,
29880,
353,
1583,
29889,
12366,
29889,
4703,
29918,
29880,
13,
12,
12,
3977,
29918,
2311,
353,
315,
29889,
12181,
29961,
29906,
29962,
13,
13,
12,
12,
29937,
8570,
13,
12,
12,
1131,
29896,
353,
1583,
29889,
2695,
3317,
29906,
29898,
1557,
2361,
29897,
12,
12,
12,
12,
12,
29937,
313,
16175,
29918,
29880,
29892,
3030,
29918,
29880,
29892,
4236,
29918,
1972,
29918,
29880,
29897,
13,
12,
12,
1131,
29906,
353,
1583,
29889,
2695,
3317,
29906,
29898,
1557,
2361,
29889,
3286,
4220,
29898,
29896,
29892,
29906,
876,
12,
29937,
313,
16175,
29918,
29880,
29892,
4236,
29918,
1972,
29918,
29880,
29892,
3030,
29918,
29880,
29897,
13,
13,
12,
12,
29937,
14333,
13,
12,
12,
16170,
29896,
353,
1098,
29896,
29889,
29890,
4317,
29898,
29984,
29897,
12,
29937,
313,
16175,
29918,
29880,
29892,
3030,
29918,
29880,
29892,
2094,
29918,
2311,
29897,
13,
12,
12,
16170,
29906,
353,
1098,
29906,
29889,
29890,
4317,
29898,
29907,
29897,
12,
29937,
313,
16175,
29918,
29880,
29892,
4236,
29918,
1972,
29918,
29880,
29892,
2094,
29918,
2311,
29897,
13,
12,
12,
16170,
29906,
353,
1583,
29889,
13168,
287,
29918,
5589,
29918,
1972,
29898,
16170,
29906,
29897,
13,
12,
12,
2457,
1098,
29896,
29892,
1098,
29906,
29892,
946,
29887,
29896,
29892,
946,
29887,
29906,
13,
13,
13,
12,
1753,
11105,
287,
29918,
5589,
29918,
1557,
2361,
29898,
1311,
29892,
19435,
1125,
13,
12,
12,
2457,
19435,
334,
1583,
29889,
12366,
29889,
13628,
29918,
13168,
718,
313,
1311,
29889,
12366,
29889,
650,
448,
1583,
29889,
12366,
29889,
13628,
29918,
13168,
29897,
334,
1583,
29889,
12366,
29889,
10052,
29918,
7192,
13,
13,
12,
1753,
11105,
287,
29918,
5589,
29918,
1972,
29898,
1311,
29892,
2346,
1125,
13,
12,
12,
2457,
2346,
334,
1583,
29889,
12366,
29889,
1972,
29918,
13168,
29889,
6948,
802,
29872,
911,
6278,
29896,
29897,
13,
13,
13,
12,
29937,
1881,
2094,
397,
886,
310,
3030,
313,
29907,
29897,
322,
2346,
313,
29984,
29897,
13,
12,
29937,
12,
29907,
310,
8267,
313,
16175,
29918,
29880,
29892,
3030,
29918,
29880,
29892,
7934,
29918,
2311,
29897,
13,
12,
29937,
12,
29984,
310,
8267,
313,
16175,
29918,
29880,
29892,
2346,
29918,
29880,
29892,
7934,
29918,
2311,
29897,
13,
12,
1753,
6375,
29898,
1311,
29892,
315,
29892,
660,
1125,
13,
12,
12,
1311,
29889,
5504,
29918,
4703,
580,
13,
12,
12,
16175,
29918,
29880,
353,
1583,
29889,
12366,
29889,
16175,
29918,
29880,
13,
12,
12,
4703,
29918,
29880,
353,
1583,
29889,
12366,
29889,
4703,
29918,
29880,
13,
12,
12,
3317,
29918,
1972,
29918,
29880,
353,
1583,
29889,
12366,
29889,
1972,
29918,
29880,
29889,
3317,
580,
13,
12,
12,
10892,
29918,
2311,
353,
1583,
29889,
3670,
29889,
10892,
29918,
2311,
13,
13,
12,
12,
29937,
679,
29501,
8158,
13,
12,
12,
1557,
2361,
353,
1583,
29889,
509,
309,
457,
279,
29918,
10633,
29898,
29907,
29892,
660,
29897,
13,
12,
12,
1557,
2361,
353,
1583,
29889,
13168,
287,
29918,
5589,
29918,
1557,
2361,
29898,
1557,
2361,
29897,
13,
13,
12,
12,
29937,
13,
12,
12,
1131,
29896,
29892,
1098,
29906,
29892,
946,
29887,
29896,
29892,
946,
29887,
29906,
353,
1583,
29889,
5365,
1131,
2509,
29898,
1557,
2361,
29892,
315,
29892,
660,
29897,
13,
13,
12,
12,
29937,
13,
12,
12,
29954,
353,
1583,
29889,
29888,
3958,
29898,
29907,
29892,
946,
29887,
29896,
29897,
13,
12,
12,
29925,
353,
1583,
29889,
29888,
3958,
29898,
29984,
29892,
946,
29887,
29906,
29897,
13,
12,
12,
29925,
353,
1583,
29889,
13168,
287,
29918,
5589,
29918,
1972,
29898,
29925,
29897,
13,
13,
12,
12,
29937,
3143,
17462,
292,
13,
12,
12,
1311,
29889,
12366,
29889,
1131,
29918,
2695,
29896,
353,
1098,
29896,
13,
12,
12,
1311,
29889,
12366,
29889,
1131,
29918,
2695,
29906,
353,
1098,
29906,
13,
12,
12,
1311,
29889,
12366,
29889,
29954,
353,
402,
13,
12,
12,
1311,
29889,
12366,
29889,
29925,
353,
349,
13,
13,
12,
12,
2457,
1098,
29896,
29892,
1098,
29906,
29892,
402,
13,
13,
13,
12,
1753,
2767,
29918,
4703,
29898,
1311,
1125,
13,
12,
12,
16175,
29918,
29880,
353,
1583,
29889,
12366,
29889,
16175,
29918,
29880,
13,
12,
12,
4703,
29918,
29880,
353,
1583,
29889,
12366,
29889,
4703,
29918,
29880,
13,
12,
12,
3317,
29918,
1972,
29918,
29880,
353,
1583,
29889,
12366,
29889,
1972,
29918,
29880,
29889,
3317,
580,
13,
12,
12,
1742,
29918,
2003,
29918,
2311,
353,
1583,
29889,
3670,
29889,
1742,
29918,
2003,
29918,
2311,
13,
12,
12,
10892,
29918,
2311,
353,
1583,
29889,
3670,
29889,
10892,
29918,
2311,
13,
12,
12,
13,
13,
13,
13,
12,
1753,
3380,
29918,
3364,
29898,
1311,
1125,
13,
12,
12,
3364,
13,
13,
12,
1753,
1095,
29918,
3364,
29898,
1311,
1125,
13,
12,
12,
3364,
13,
13,
13,
13,
13,
12,
12,
13,
2
] |
src/residue.py | kabhel/Fold_U | 0 | 151709 | """
.. module:: Residue
:synopsis: This module implements the Residue class.
"""
# Third-party modules
import numpy as np
# Local modules
from src.atom import Atom
class Residue:
"""
.. class:: Residue
This class groups informations about a residue.
Attributes:
name (str): Name of the residue (1 letter code)
ca_coords (Numpy array): 3D coordinates of the residue
"""
def __init__(self, name):
self.name = name
self.ca_atom = Atom("CA")
self.cb_atom = Atom("CB")
self.c_atom = Atom("C")
self.n_atom = Atom("N")
self.secondary_struct = None
self.ss_confidence = None
def __str__(self):
return str(self.name)
def __repr__(self):
return str(self.name)
def calculate_distance(self, residue, carbon):
"""
Calculate Euclidian distance between two residues with THE most efficient method, the
Einstein summation convention with *numpy.einsum*.
.. math::
distance = \sqrt{(x_a-x_b)^2+(y_a-y_b)^2+(z_a-z_b)^2}
Args:
residue (object): An object of the Residue class.
carbon (str): Type of the carbon.
Returns:
float: The calculated distance.
"""
if carbon == "CA":
a_min_b = self.ca_atom.coords - residue.ca_atom.coords
elif carbon == "CB":
a_min_b = self.cb_atom.coords - residue.cb_atom.coords
# The Numpy's "einsum" function is the most efficient way to calculate a distance
# accordingly to this benchmarking: https://stackoverflow.com/a/47775357/6401758
dist = np.sqrt(np.einsum('i,i->', a_min_b, a_min_b))
return dist
| [
1,
9995,
13,
636,
3883,
1057,
2538,
333,
434,
13,
259,
584,
19274,
15368,
29901,
910,
3883,
10703,
278,
2538,
333,
434,
770,
29889,
13,
15945,
29908,
13,
13,
29937,
18008,
29899,
22633,
10585,
13,
5215,
12655,
408,
7442,
13,
13,
29937,
9959,
10585,
13,
3166,
4765,
29889,
8678,
1053,
2180,
290,
13,
13,
13,
1990,
2538,
333,
434,
29901,
13,
1678,
9995,
13,
1678,
6317,
770,
1057,
2538,
333,
434,
13,
13,
418,
910,
770,
6471,
19313,
1048,
263,
10995,
434,
29889,
13,
13,
1678,
6212,
5026,
29901,
13,
4706,
1024,
313,
710,
1125,
4408,
310,
278,
10995,
434,
313,
29896,
5497,
775,
29897,
13,
4706,
5777,
29918,
1111,
4339,
313,
8009,
2272,
1409,
1125,
29871,
29941,
29928,
10350,
310,
278,
10995,
434,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1024,
1125,
13,
4706,
1583,
29889,
978,
353,
1024,
13,
4706,
1583,
29889,
1113,
29918,
8678,
353,
2180,
290,
703,
5454,
1159,
13,
4706,
1583,
29889,
10702,
29918,
8678,
353,
2180,
290,
703,
21685,
1159,
13,
4706,
1583,
29889,
29883,
29918,
8678,
353,
2180,
290,
703,
29907,
1159,
13,
4706,
1583,
29889,
29876,
29918,
8678,
353,
2180,
290,
703,
29940,
1159,
13,
4706,
1583,
29889,
7496,
653,
29918,
4984,
353,
6213,
13,
4706,
1583,
29889,
893,
29918,
5527,
5084,
353,
6213,
13,
13,
1678,
822,
4770,
710,
12035,
1311,
1125,
13,
4706,
736,
851,
29898,
1311,
29889,
978,
29897,
13,
13,
1678,
822,
4770,
276,
558,
12035,
1311,
1125,
13,
4706,
736,
851,
29898,
1311,
29889,
978,
29897,
13,
13,
1678,
822,
8147,
29918,
19244,
29898,
1311,
29892,
10995,
434,
29892,
22004,
1125,
13,
4706,
9995,
13,
9651,
20535,
403,
16430,
695,
333,
713,
5418,
1546,
1023,
10995,
1041,
411,
6093,
1556,
8543,
1158,
29892,
278,
13,
9651,
2694,
5465,
22792,
362,
15687,
411,
334,
23749,
29889,
29872,
1144,
398,
10521,
13,
13,
9651,
6317,
5844,
1057,
13,
13,
1669,
5418,
353,
320,
3676,
8001,
29916,
29918,
29874,
29899,
29916,
29918,
29890,
4887,
29906,
17108,
29891,
29918,
29874,
29899,
29891,
29918,
29890,
4887,
29906,
17108,
29920,
29918,
29874,
29899,
29920,
29918,
29890,
4887,
29906,
29913,
13,
13,
9651,
826,
3174,
29901,
13,
18884,
10995,
434,
313,
3318,
1125,
530,
1203,
310,
278,
2538,
333,
434,
770,
29889,
13,
18884,
22004,
313,
710,
1125,
5167,
310,
278,
22004,
29889,
13,
13,
9651,
16969,
29901,
13,
18884,
5785,
29901,
450,
12833,
5418,
29889,
13,
4706,
9995,
13,
4706,
565,
22004,
1275,
376,
5454,
1115,
13,
9651,
263,
29918,
1195,
29918,
29890,
353,
1583,
29889,
1113,
29918,
8678,
29889,
1111,
4339,
448,
10995,
434,
29889,
1113,
29918,
8678,
29889,
1111,
4339,
13,
4706,
25342,
22004,
1275,
376,
21685,
1115,
13,
9651,
263,
29918,
1195,
29918,
29890,
353,
1583,
29889,
10702,
29918,
8678,
29889,
1111,
4339,
448,
10995,
434,
29889,
10702,
29918,
8678,
29889,
1111,
4339,
13,
4706,
396,
450,
11848,
2272,
29915,
29879,
376,
29872,
1144,
398,
29908,
740,
338,
278,
1556,
8543,
982,
304,
8147,
263,
5418,
13,
4706,
396,
29871,
16205,
304,
445,
23513,
292,
29901,
2045,
597,
2417,
29889,
510,
29914,
29874,
29914,
29946,
29955,
29955,
29955,
29945,
29941,
29945,
29955,
29914,
29953,
29946,
29900,
29896,
29955,
29945,
29947,
13,
4706,
1320,
353,
7442,
29889,
3676,
29898,
9302,
29889,
29872,
1144,
398,
877,
29875,
29892,
29875,
976,
742,
263,
29918,
1195,
29918,
29890,
29892,
263,
29918,
1195,
29918,
29890,
876,
13,
4706,
736,
1320,
13,
2
] |
credential_test.py | jmuema/password-locker | 0 | 139790 | import unittest # Importing the unittest module
from credential import Credential # Importing the credential class
class TestCredential(unittest.TestCase):
'''
Test class that defines test cases for the credential class behaviours.
Args:
unittest.TestCase: TestCase class that helps in creating test cases
'''
def setUp(self):
'''
Set up method to run before each test cases.
'''
self.new_credential = Credential("instagram", "ironman", "ironman20") # create credential object
def test_init(self):
'''
test_init test case to test if the object is initialized properly
'''
self.assertEqual(self.new_credential.myaccountname,"instagram")
self.assertEqual(self.new_credential.myusername,"ironman")
self.assertEqual(self.new_credential.mypassword,"<PASSWORD>")
def test_save_credential(self):
'''
test_save_credential test case to test if the credential object is saved into
the credential list
'''
self.new_credential.save_credential() # saving the new credential
self.assertEqual(len(Credential.credential_list),1)
def tearDown(self):
'''
tearDown method that does clean up after each test case has run.
'''
Credential.credential_list = []
def test_save_multiple_credential(self):
'''
test to check if we can check multiple objects within credenials list
'''
self.new_credential.save_credential()
test_credential = Credential("instagram","ironman","ironman20") # new credential
test_credential.save_credential()
self.assertEqual(len(Credential.credential_list),2)
def test_delete_credential(self):
'''
test to remove a credential from our credential list
'''
self.new_credential.save_credential()
test_credential = Credential("instagram","ironman","ironman20") # new credential
test_credential.save_credential()
self.new_credential.delete_credential()# Deleting a credential object
self.assertEqual(len(Credential.credential_list),1)
def test_find_credential_by_username(self):
'''
test to check if we can find a credential by username and display information
'''
self.new_credential.save_credential()
test_credential = Credential("instagram","ironman","ironman20") # new credential
test_credential.save_credential()
found_credential = Credential.find_by_username("ironman")
self.assertEqual(found_credential.mypassword,test_credential.mypassword)
def test_credential_exists(self):
'''
test to check if we can return a Boolean if we cannot find the credential.
'''
self.new_credential.save_credential()
test_credential = Credential("instagram","ironman","ironman20") # new credential
test_credential.save_credential()
credential_exists = Credential.credential_exist("ironman")
self.assertTrue(credential_exists)
def test_display_all_credentials(self):
'''
method that returns a list of all credentials saved
'''
self.assertEqual(Credential.display_credentials(),Credential.credential_list)
if __name__ == '__main__':
unittest.main()
| [
1,
1053,
443,
27958,
396,
16032,
292,
278,
443,
27958,
3883,
13,
3166,
6625,
2556,
1053,
24596,
2556,
396,
16032,
292,
278,
6625,
2556,
770,
13,
13,
1990,
4321,
15507,
2556,
29898,
348,
27958,
29889,
3057,
8259,
1125,
13,
13,
1678,
14550,
13,
1678,
4321,
770,
393,
17645,
1243,
4251,
363,
278,
6625,
2556,
770,
4010,
29875,
2470,
29889,
13,
13,
1678,
826,
3174,
29901,
13,
4706,
443,
27958,
29889,
3057,
8259,
29901,
4321,
8259,
770,
393,
6911,
297,
4969,
1243,
4251,
13,
1678,
14550,
13,
1678,
822,
731,
3373,
29898,
1311,
1125,
13,
4706,
14550,
13,
4706,
3789,
701,
1158,
304,
1065,
1434,
1269,
1243,
4251,
29889,
13,
4706,
14550,
13,
4706,
1583,
29889,
1482,
29918,
11944,
2556,
353,
24596,
2556,
703,
2611,
14442,
613,
376,
381,
265,
1171,
613,
376,
381,
265,
1171,
29906,
29900,
1159,
396,
1653,
6625,
2556,
1203,
13,
13,
13,
1678,
822,
1243,
29918,
2344,
29898,
1311,
1125,
13,
4706,
14550,
13,
4706,
1243,
29918,
2344,
1243,
1206,
304,
1243,
565,
278,
1203,
338,
16601,
6284,
13,
4706,
14550,
13,
13,
4706,
1583,
29889,
9294,
9843,
29898,
1311,
29889,
1482,
29918,
11944,
2556,
29889,
1357,
10149,
978,
1699,
2611,
14442,
1159,
13,
4706,
1583,
29889,
9294,
9843,
29898,
1311,
29889,
1482,
29918,
11944,
2556,
29889,
1357,
6786,
1699,
381,
265,
1171,
1159,
13,
4706,
1583,
29889,
9294,
9843,
29898,
1311,
29889,
1482,
29918,
11944,
2556,
29889,
1357,
5630,
1699,
29966,
25711,
17013,
29958,
1159,
13,
13,
1678,
822,
1243,
29918,
7620,
29918,
11944,
2556,
29898,
1311,
1125,
13,
4706,
14550,
13,
4706,
1243,
29918,
7620,
29918,
11944,
2556,
1243,
1206,
304,
1243,
565,
278,
6625,
2556,
1203,
338,
7160,
964,
13,
308,
278,
6625,
2556,
1051,
13,
4706,
14550,
13,
4706,
1583,
29889,
1482,
29918,
11944,
2556,
29889,
7620,
29918,
11944,
2556,
580,
396,
14238,
278,
716,
6625,
2556,
13,
4706,
1583,
29889,
9294,
9843,
29898,
2435,
29898,
15507,
2556,
29889,
11944,
2556,
29918,
1761,
511,
29896,
29897,
13,
1678,
822,
734,
279,
6767,
29898,
1311,
1125,
13,
4706,
14550,
13,
4706,
734,
279,
6767,
1158,
393,
947,
5941,
701,
1156,
1269,
1243,
1206,
756,
1065,
29889,
13,
4706,
14550,
13,
4706,
24596,
2556,
29889,
11944,
2556,
29918,
1761,
353,
5159,
13,
13,
1678,
822,
1243,
29918,
7620,
29918,
20787,
29918,
11944,
2556,
29898,
1311,
1125,
13,
4706,
14550,
13,
4706,
1243,
304,
1423,
565,
591,
508,
1423,
2999,
3618,
2629,
907,
1145,
616,
29879,
1051,
13,
4706,
14550,
13,
4706,
1583,
29889,
1482,
29918,
11944,
2556,
29889,
7620,
29918,
11944,
2556,
580,
13,
4706,
1243,
29918,
11944,
2556,
353,
24596,
2556,
703,
2611,
14442,
3284,
381,
265,
1171,
3284,
381,
265,
1171,
29906,
29900,
1159,
396,
716,
6625,
2556,
13,
4706,
1243,
29918,
11944,
2556,
29889,
7620,
29918,
11944,
2556,
580,
13,
4706,
1583,
29889,
9294,
9843,
29898,
2435,
29898,
15507,
2556,
29889,
11944,
2556,
29918,
1761,
511,
29906,
29897,
13,
13,
1678,
822,
1243,
29918,
8143,
29918,
11944,
2556,
29898,
1311,
1125,
13,
4706,
14550,
13,
4706,
1243,
304,
3349,
263,
6625,
2556,
515,
1749,
6625,
2556,
1051,
13,
4706,
14550,
13,
4706,
1583,
29889,
1482,
29918,
11944,
2556,
29889,
7620,
29918,
11944,
2556,
580,
13,
4706,
1243,
29918,
11944,
2556,
353,
24596,
2556,
703,
2611,
14442,
3284,
381,
265,
1171,
3284,
381,
265,
1171,
29906,
29900,
1159,
396,
716,
6625,
2556,
13,
4706,
1243,
29918,
11944,
2556,
29889,
7620,
29918,
11944,
2556,
580,
13,
13,
4706,
1583,
29889,
1482,
29918,
11944,
2556,
29889,
8143,
29918,
11944,
2556,
580,
29937,
897,
1026,
292,
263,
6625,
2556,
1203,
13,
4706,
1583,
29889,
9294,
9843,
29898,
2435,
29898,
15507,
2556,
29889,
11944,
2556,
29918,
1761,
511,
29896,
29897,
13,
13,
1678,
822,
1243,
29918,
2886,
29918,
11944,
2556,
29918,
1609,
29918,
6786,
29898,
1311,
1125,
13,
4706,
14550,
13,
4706,
1243,
304,
1423,
565,
591,
508,
1284,
263,
6625,
2556,
491,
8952,
322,
2479,
2472,
13,
4706,
14550,
13,
13,
4706,
1583,
29889,
1482,
29918,
11944,
2556,
29889,
7620,
29918,
11944,
2556,
580,
13,
4706,
1243,
29918,
11944,
2556,
353,
24596,
2556,
703,
2611,
14442,
3284,
381,
265,
1171,
3284,
381,
265,
1171,
29906,
29900,
1159,
396,
716,
6625,
2556,
13,
4706,
1243,
29918,
11944,
2556,
29889,
7620,
29918,
11944,
2556,
580,
13,
13,
4706,
1476,
29918,
11944,
2556,
353,
24596,
2556,
29889,
2886,
29918,
1609,
29918,
6786,
703,
381,
265,
1171,
1159,
13,
13,
4706,
1583,
29889,
9294,
9843,
29898,
11940,
29918,
11944,
2556,
29889,
1357,
5630,
29892,
1688,
29918,
11944,
2556,
29889,
1357,
5630,
29897,
13,
13,
1678,
822,
1243,
29918,
11944,
2556,
29918,
9933,
29898,
1311,
1125,
13,
4706,
14550,
13,
4706,
1243,
304,
1423,
565,
591,
508,
736,
263,
11185,
29871,
565,
591,
2609,
1284,
278,
6625,
2556,
29889,
13,
4706,
14550,
13,
13,
4706,
1583,
29889,
1482,
29918,
11944,
2556,
29889,
7620,
29918,
11944,
2556,
580,
13,
4706,
1243,
29918,
11944,
2556,
353,
24596,
2556,
703,
2611,
14442,
3284,
381,
265,
1171,
3284,
381,
265,
1171,
29906,
29900,
1159,
396,
716,
6625,
2556,
13,
4706,
1243,
29918,
11944,
2556,
29889,
7620,
29918,
11944,
2556,
580,
13,
13,
4706,
6625,
2556,
29918,
9933,
353,
24596,
2556,
29889,
11944,
2556,
29918,
28997,
703,
381,
265,
1171,
1159,
13,
13,
4706,
1583,
29889,
9294,
5574,
29898,
11944,
2556,
29918,
9933,
29897,
13,
418,
13,
1678,
822,
1243,
29918,
4990,
29918,
497,
29918,
11944,
9409,
29898,
1311,
1125,
13,
4706,
14550,
13,
4706,
1158,
393,
3639,
263,
1051,
310,
599,
16140,
7160,
13,
4706,
14550,
13,
13,
4706,
1583,
29889,
9294,
9843,
29898,
15507,
2556,
29889,
4990,
29918,
11944,
9409,
3285,
15507,
2556,
29889,
11944,
2556,
29918,
1761,
29897,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
443,
27958,
29889,
3396,
580,
13,
2
] |
colour/models/rgb/transfer_functions/tests/test_panasonic_vlog.py | JGoldstone/colour | 0 | 17884 | <gh_stars>0
# -*- coding: utf-8 -*-
"""
Defines the unit tests for the :mod:`colour.models.rgb.transfer_functions.\
panasonic_vlog` module.
"""
import numpy as np
import unittest
from colour.models.rgb.transfer_functions import (
log_encoding_VLog,
log_decoding_VLog,
)
from colour.utilities import domain_range_scale, ignore_numpy_errors
__author__ = 'Colour Developers'
__copyright__ = 'Copyright (C) 2013-2021 - Colour Developers'
__license__ = 'New BSD License - https://opensource.org/licenses/BSD-3-Clause'
__maintainer__ = 'Colour Developers'
__email__ = '<EMAIL>'
__status__ = 'Production'
__all__ = [
'TestLogEncoding_VLog',
'TestLogDecoding_VLog',
]
class TestLogEncoding_VLog(unittest.TestCase):
"""
Defines :func:`colour.models.rgb.transfer_functions.panasonic_vlog.\
log_encoding_VLog` definition unit tests methods.
"""
def test_log_encoding_VLog(self):
"""
Tests :func:`colour.models.rgb.transfer_functions.panasonic_vlog.\
log_encoding_VLog` definition.
"""
self.assertAlmostEqual(log_encoding_VLog(0.0), 0.125, places=7)
self.assertAlmostEqual(
log_encoding_VLog(0.18), 0.423311448760136, places=7)
self.assertAlmostEqual(
log_encoding_VLog(0.18, 12), 0.423311448760136, places=7)
self.assertAlmostEqual(
log_encoding_VLog(0.18, 10, False), 0.421287228403675, places=7)
self.assertAlmostEqual(
log_encoding_VLog(0.18, 10, False, False),
0.409009628526078,
places=7)
self.assertAlmostEqual(
log_encoding_VLog(1.0), 0.599117700158146, places=7)
def test_n_dimensional_log_encoding_VLog(self):
"""
Tests :func:`colour.models.rgb.transfer_functions.panasonic_vlog.\
log_encoding_VLog` definition n-dimensional arrays support.
"""
L_in = 0.18
V_out = log_encoding_VLog(L_in)
L_in = np.tile(L_in, 6)
V_out = np.tile(V_out, 6)
np.testing.assert_almost_equal(
log_encoding_VLog(L_in), V_out, decimal=7)
L_in = np.reshape(L_in, (2, 3))
V_out = np.reshape(V_out, (2, 3))
np.testing.assert_almost_equal(
log_encoding_VLog(L_in), V_out, decimal=7)
L_in = np.reshape(L_in, (2, 3, 1))
V_out = np.reshape(V_out, (2, 3, 1))
np.testing.assert_almost_equal(
log_encoding_VLog(L_in), V_out, decimal=7)
def test_domain_range_scale_log_encoding_VLog(self):
"""
Tests :func:`colour.models.rgb.transfer_functions.panasonic_vlog.\
log_encoding_VLog` definition domain and range scale support.
"""
L_in = 0.18
V_out = log_encoding_VLog(L_in)
d_r = (('reference', 1), (1, 1), (100, 100))
for scale, factor in d_r:
with domain_range_scale(scale):
np.testing.assert_almost_equal(
log_encoding_VLog(L_in * factor),
V_out * factor,
decimal=7)
@ignore_numpy_errors
def test_nan_log_encoding_VLog(self):
"""
Tests :func:`colour.models.rgb.transfer_functions.panasonic_vlog.\
log_encoding_VLog` definition nan support.
"""
log_encoding_VLog(np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan]))
class TestLogDecoding_VLog(unittest.TestCase):
"""
Defines :func:`colour.models.rgb.transfer_functions.panasonic_vlog.\
log_decoding_VLog` definition unit tests methods.
"""
def test_log_decoding_VLog(self):
"""
Tests :func:`colour.models.rgb.transfer_functions.panasonic_vlog.\
log_decoding_VLog` definition.
"""
self.assertAlmostEqual(log_decoding_VLog(0.125), 0.0, places=7)
self.assertAlmostEqual(
log_decoding_VLog(0.423311448760136), 0.18, places=7)
self.assertAlmostEqual(
log_decoding_VLog(0.423311448760136, 12), 0.18, places=7)
self.assertAlmostEqual(
log_decoding_VLog(0.421287228403675, 10, False), 0.18, places=7)
self.assertAlmostEqual(
log_decoding_VLog(0.409009628526078, 10, False, False),
0.18,
places=7)
self.assertAlmostEqual(
log_decoding_VLog(0.599117700158146), 1.0, places=7)
def test_n_dimensional_log_decoding_VLog(self):
"""
Tests :func:`colour.models.rgb.transfer_functions.panasonic_vlog.\
log_decoding_VLog` definition n-dimensional arrays support.
"""
V_out = 0.423311448760136
L_in = log_decoding_VLog(V_out)
V_out = np.tile(V_out, 6)
L_in = np.tile(L_in, 6)
np.testing.assert_almost_equal(
log_decoding_VLog(V_out), L_in, decimal=7)
V_out = np.reshape(V_out, (2, 3))
L_in = np.reshape(L_in, (2, 3))
np.testing.assert_almost_equal(
log_decoding_VLog(V_out), L_in, decimal=7)
V_out = np.reshape(V_out, (2, 3, 1))
L_in = np.reshape(L_in, (2, 3, 1))
np.testing.assert_almost_equal(
log_decoding_VLog(V_out), L_in, decimal=7)
def test_domain_range_scale_log_decoding_VLog(self):
"""
Tests :func:`colour.models.rgb.transfer_functions.panasonic_vlog.\
log_decoding_VLog` definition domain and range scale support.
"""
V_out = 0.423311448760136
L_in = log_decoding_VLog(V_out)
d_r = (('reference', 1), (1, 1), (100, 100))
for scale, factor in d_r:
with domain_range_scale(scale):
np.testing.assert_almost_equal(
log_decoding_VLog(V_out * factor),
L_in * factor,
decimal=7)
@ignore_numpy_errors
def test_nan_log_decoding_VLog(self):
"""
Tests :func:`colour.models.rgb.transfer_functions.panasonic_vlog.\
log_decoding_VLog` definition nan support.
"""
log_decoding_VLog(np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan]))
if __name__ == '__main__':
unittest.main()
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
15945,
29908,
13,
3206,
1475,
278,
5190,
6987,
363,
278,
584,
1545,
18078,
1054,
473,
29889,
9794,
29889,
23973,
29889,
3286,
571,
29918,
12171,
7790,
13,
8357,
1658,
293,
29918,
29894,
1188,
29952,
3883,
29889,
13,
15945,
29908,
13,
13,
5215,
12655,
408,
7442,
13,
5215,
443,
27958,
13,
13,
3166,
12384,
29889,
9794,
29889,
23973,
29889,
3286,
571,
29918,
12171,
1053,
313,
13,
1678,
1480,
29918,
22331,
29918,
29963,
3403,
29892,
13,
1678,
1480,
29918,
7099,
3689,
29918,
29963,
3403,
29892,
13,
29897,
13,
3166,
12384,
29889,
4422,
1907,
1053,
5354,
29918,
3881,
29918,
7052,
29892,
11455,
29918,
23749,
29918,
12523,
13,
13,
1649,
8921,
1649,
353,
525,
1625,
473,
10682,
414,
29915,
13,
1649,
8552,
1266,
1649,
353,
525,
11882,
1266,
313,
29907,
29897,
29871,
29906,
29900,
29896,
29941,
29899,
29906,
29900,
29906,
29896,
448,
1530,
473,
10682,
414,
29915,
13,
1649,
506,
1947,
1649,
353,
525,
4373,
350,
7230,
19245,
448,
2045,
597,
22156,
1167,
29889,
990,
29914,
506,
11259,
29914,
29933,
7230,
29899,
29941,
29899,
20216,
1509,
29915,
13,
1649,
29885,
2365,
4008,
1649,
353,
525,
1625,
473,
10682,
414,
29915,
13,
1649,
5269,
1649,
353,
12801,
26862,
6227,
16299,
13,
1649,
4882,
1649,
353,
525,
23665,
428,
29915,
13,
13,
1649,
497,
1649,
353,
518,
13,
1678,
525,
3057,
3403,
14934,
29918,
29963,
3403,
742,
13,
1678,
525,
3057,
3403,
6185,
3689,
29918,
29963,
3403,
742,
13,
29962,
13,
13,
13,
1990,
4321,
3403,
14934,
29918,
29963,
3403,
29898,
348,
27958,
29889,
3057,
8259,
1125,
13,
1678,
9995,
13,
1678,
5282,
1475,
584,
9891,
18078,
1054,
473,
29889,
9794,
29889,
23973,
29889,
3286,
571,
29918,
12171,
29889,
8357,
1658,
293,
29918,
29894,
1188,
7790,
13,
1188,
29918,
22331,
29918,
29963,
3403,
29952,
5023,
5190,
6987,
3519,
29889,
13,
1678,
9995,
13,
13,
1678,
822,
1243,
29918,
1188,
29918,
22331,
29918,
29963,
3403,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
4321,
29879,
584,
9891,
18078,
1054,
473,
29889,
9794,
29889,
23973,
29889,
3286,
571,
29918,
12171,
29889,
8357,
1658,
293,
29918,
29894,
1188,
7790,
13,
1188,
29918,
22331,
29918,
29963,
3403,
29952,
5023,
29889,
13,
4706,
9995,
13,
13,
4706,
1583,
29889,
9294,
2499,
3242,
9843,
29898,
1188,
29918,
22331,
29918,
29963,
3403,
29898,
29900,
29889,
29900,
511,
29871,
29900,
29889,
29896,
29906,
29945,
29892,
7600,
29922,
29955,
29897,
13,
13,
4706,
1583,
29889,
9294,
2499,
3242,
9843,
29898,
13,
9651,
1480,
29918,
22331,
29918,
29963,
3403,
29898,
29900,
29889,
29896,
29947,
511,
29871,
29900,
29889,
29946,
29906,
29941,
29941,
29896,
29896,
29946,
29946,
29947,
29955,
29953,
29900,
29896,
29941,
29953,
29892,
7600,
29922,
29955,
29897,
13,
13,
4706,
1583,
29889,
9294,
2499,
3242,
9843,
29898,
13,
9651,
1480,
29918,
22331,
29918,
29963,
3403,
29898,
29900,
29889,
29896,
29947,
29892,
29871,
29896,
29906,
511,
29871,
29900,
29889,
29946,
29906,
29941,
29941,
29896,
29896,
29946,
29946,
29947,
29955,
29953,
29900,
29896,
29941,
29953,
29892,
7600,
29922,
29955,
29897,
13,
13,
4706,
1583,
29889,
9294,
2499,
3242,
9843,
29898,
13,
9651,
1480,
29918,
22331,
29918,
29963,
3403,
29898,
29900,
29889,
29896,
29947,
29892,
29871,
29896,
29900,
29892,
7700,
511,
29871,
29900,
29889,
29946,
29906,
29896,
29906,
29947,
29955,
29906,
29906,
29947,
29946,
29900,
29941,
29953,
29955,
29945,
29892,
7600,
29922,
29955,
29897,
13,
13,
4706,
1583,
29889,
9294,
2499,
3242,
9843,
29898,
13,
9651,
1480,
29918,
22331,
29918,
29963,
3403,
29898,
29900,
29889,
29896,
29947,
29892,
29871,
29896,
29900,
29892,
7700,
29892,
7700,
511,
13,
632,
29900,
29889,
29946,
29900,
29929,
29900,
29900,
29929,
29953,
29906,
29947,
29945,
29906,
29953,
29900,
29955,
29947,
29892,
13,
9651,
7600,
29922,
29955,
29897,
13,
13,
4706,
1583,
29889,
9294,
2499,
3242,
9843,
29898,
13,
9651,
1480,
29918,
22331,
29918,
29963,
3403,
29898,
29896,
29889,
29900,
511,
29871,
29900,
29889,
29945,
29929,
29929,
29896,
29896,
29955,
29955,
29900,
29900,
29896,
29945,
29947,
29896,
29946,
29953,
29892,
7600,
29922,
29955,
29897,
13,
13,
1678,
822,
1243,
29918,
29876,
29918,
12531,
29918,
1188,
29918,
22331,
29918,
29963,
3403,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
4321,
29879,
584,
9891,
18078,
1054,
473,
29889,
9794,
29889,
23973,
29889,
3286,
571,
29918,
12171,
29889,
8357,
1658,
293,
29918,
29894,
1188,
7790,
13,
1188,
29918,
22331,
29918,
29963,
3403,
29952,
5023,
302,
29899,
12531,
7049,
2304,
29889,
13,
4706,
9995,
13,
13,
4706,
365,
29918,
262,
353,
29871,
29900,
29889,
29896,
29947,
13,
4706,
478,
29918,
449,
353,
1480,
29918,
22331,
29918,
29963,
3403,
29898,
29931,
29918,
262,
29897,
13,
13,
4706,
365,
29918,
262,
353,
7442,
29889,
29873,
488,
29898,
29931,
29918,
262,
29892,
29871,
29953,
29897,
13,
4706,
478,
29918,
449,
353,
7442,
29889,
29873,
488,
29898,
29963,
29918,
449,
29892,
29871,
29953,
29897,
13,
4706,
7442,
29889,
13424,
29889,
9294,
29918,
284,
3242,
29918,
11745,
29898,
13,
9651,
1480,
29918,
22331,
29918,
29963,
3403,
29898,
29931,
29918,
262,
511,
478,
29918,
449,
29892,
13677,
29922,
29955,
29897,
13,
13,
4706,
365,
29918,
262,
353,
7442,
29889,
690,
14443,
29898,
29931,
29918,
262,
29892,
313,
29906,
29892,
29871,
29941,
876,
13,
4706,
478,
29918,
449,
353,
7442,
29889,
690,
14443,
29898,
29963,
29918,
449,
29892,
313,
29906,
29892,
29871,
29941,
876,
13,
4706,
7442,
29889,
13424,
29889,
9294,
29918,
284,
3242,
29918,
11745,
29898,
13,
9651,
1480,
29918,
22331,
29918,
29963,
3403,
29898,
29931,
29918,
262,
511,
478,
29918,
449,
29892,
13677,
29922,
29955,
29897,
13,
13,
4706,
365,
29918,
262,
353,
7442,
29889,
690,
14443,
29898,
29931,
29918,
262,
29892,
313,
29906,
29892,
29871,
29941,
29892,
29871,
29896,
876,
13,
4706,
478,
29918,
449,
353,
7442,
29889,
690,
14443,
29898,
29963,
29918,
449,
29892,
313,
29906,
29892,
29871,
29941,
29892,
29871,
29896,
876,
13,
4706,
7442,
29889,
13424,
29889,
9294,
29918,
284,
3242,
29918,
11745,
29898,
13,
9651,
1480,
29918,
22331,
29918,
29963,
3403,
29898,
29931,
29918,
262,
511,
478,
29918,
449,
29892,
13677,
29922,
29955,
29897,
13,
13,
1678,
822,
1243,
29918,
7247,
29918,
3881,
29918,
7052,
29918,
1188,
29918,
22331,
29918,
29963,
3403,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
4321,
29879,
584,
9891,
18078,
1054,
473,
29889,
9794,
29889,
23973,
29889,
3286,
571,
29918,
12171,
29889,
8357,
1658,
293,
29918,
29894,
1188,
7790,
13,
1188,
29918,
22331,
29918,
29963,
3403,
29952,
5023,
5354,
322,
3464,
6287,
2304,
29889,
13,
4706,
9995,
13,
13,
4706,
365,
29918,
262,
353,
29871,
29900,
29889,
29896,
29947,
13,
4706,
478,
29918,
449,
353,
1480,
29918,
22331,
29918,
29963,
3403,
29898,
29931,
29918,
262,
29897,
13,
13,
4706,
270,
29918,
29878,
353,
313,
877,
5679,
742,
29871,
29896,
511,
313,
29896,
29892,
29871,
29896,
511,
313,
29896,
29900,
29900,
29892,
29871,
29896,
29900,
29900,
876,
13,
4706,
363,
6287,
29892,
7329,
297,
270,
29918,
29878,
29901,
13,
9651,
411,
5354,
29918,
3881,
29918,
7052,
29898,
7052,
1125,
13,
18884,
7442,
29889,
13424,
29889,
9294,
29918,
284,
3242,
29918,
11745,
29898,
13,
462,
1678,
1480,
29918,
22331,
29918,
29963,
3403,
29898,
29931,
29918,
262,
334,
7329,
511,
13,
462,
1678,
478,
29918,
449,
334,
7329,
29892,
13,
462,
1678,
13677,
29922,
29955,
29897,
13,
13,
1678,
732,
17281,
29918,
23749,
29918,
12523,
13,
1678,
822,
1243,
29918,
13707,
29918,
1188,
29918,
22331,
29918,
29963,
3403,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
4321,
29879,
584,
9891,
18078,
1054,
473,
29889,
9794,
29889,
23973,
29889,
3286,
571,
29918,
12171,
29889,
8357,
1658,
293,
29918,
29894,
1188,
7790,
13,
1188,
29918,
22331,
29918,
29963,
3403,
29952,
5023,
23432,
2304,
29889,
13,
4706,
9995,
13,
13,
4706,
1480,
29918,
22331,
29918,
29963,
3403,
29898,
9302,
29889,
2378,
4197,
29899,
29896,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29896,
29889,
29900,
29892,
448,
9302,
29889,
7192,
29892,
7442,
29889,
7192,
29892,
7442,
29889,
13707,
12622,
13,
13,
13,
1990,
4321,
3403,
6185,
3689,
29918,
29963,
3403,
29898,
348,
27958,
29889,
3057,
8259,
1125,
13,
1678,
9995,
13,
1678,
5282,
1475,
584,
9891,
18078,
1054,
473,
29889,
9794,
29889,
23973,
29889,
3286,
571,
29918,
12171,
29889,
8357,
1658,
293,
29918,
29894,
1188,
7790,
13,
1188,
29918,
7099,
3689,
29918,
29963,
3403,
29952,
5023,
5190,
6987,
3519,
29889,
13,
1678,
9995,
13,
13,
1678,
822,
1243,
29918,
1188,
29918,
7099,
3689,
29918,
29963,
3403,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
4321,
29879,
584,
9891,
18078,
1054,
473,
29889,
9794,
29889,
23973,
29889,
3286,
571,
29918,
12171,
29889,
8357,
1658,
293,
29918,
29894,
1188,
7790,
13,
1188,
29918,
7099,
3689,
29918,
29963,
3403,
29952,
5023,
29889,
13,
4706,
9995,
13,
13,
4706,
1583,
29889,
9294,
2499,
3242,
9843,
29898,
1188,
29918,
7099,
3689,
29918,
29963,
3403,
29898,
29900,
29889,
29896,
29906,
29945,
511,
29871,
29900,
29889,
29900,
29892,
7600,
29922,
29955,
29897,
13,
13,
4706,
1583,
29889,
9294,
2499,
3242,
9843,
29898,
13,
9651,
1480,
29918,
7099,
3689,
29918,
29963,
3403,
29898,
29900,
29889,
29946,
29906,
29941,
29941,
29896,
29896,
29946,
29946,
29947,
29955,
29953,
29900,
29896,
29941,
29953,
511,
29871,
29900,
29889,
29896,
29947,
29892,
7600,
29922,
29955,
29897,
13,
13,
4706,
1583,
29889,
9294,
2499,
3242,
9843,
29898,
13,
9651,
1480,
29918,
7099,
3689,
29918,
29963,
3403,
29898,
29900,
29889,
29946,
29906,
29941,
29941,
29896,
29896,
29946,
29946,
29947,
29955,
29953,
29900,
29896,
29941,
29953,
29892,
29871,
29896,
29906,
511,
29871,
29900,
29889,
29896,
29947,
29892,
7600,
29922,
29955,
29897,
13,
13,
4706,
1583,
29889,
9294,
2499,
3242,
9843,
29898,
13,
9651,
1480,
29918,
7099,
3689,
29918,
29963,
3403,
29898,
29900,
29889,
29946,
29906,
29896,
29906,
29947,
29955,
29906,
29906,
29947,
29946,
29900,
29941,
29953,
29955,
29945,
29892,
29871,
29896,
29900,
29892,
7700,
511,
29871,
29900,
29889,
29896,
29947,
29892,
7600,
29922,
29955,
29897,
13,
13,
4706,
1583,
29889,
9294,
2499,
3242,
9843,
29898,
13,
9651,
1480,
29918,
7099,
3689,
29918,
29963,
3403,
29898,
29900,
29889,
29946,
29900,
29929,
29900,
29900,
29929,
29953,
29906,
29947,
29945,
29906,
29953,
29900,
29955,
29947,
29892,
29871,
29896,
29900,
29892,
7700,
29892,
7700,
511,
13,
632,
29900,
29889,
29896,
29947,
29892,
13,
9651,
7600,
29922,
29955,
29897,
13,
13,
4706,
1583,
29889,
9294,
2499,
3242,
9843,
29898,
13,
9651,
1480,
29918,
7099,
3689,
29918,
29963,
3403,
29898,
29900,
29889,
29945,
29929,
29929,
29896,
29896,
29955,
29955,
29900,
29900,
29896,
29945,
29947,
29896,
29946,
29953,
511,
29871,
29896,
29889,
29900,
29892,
7600,
29922,
29955,
29897,
13,
13,
1678,
822,
1243,
29918,
29876,
29918,
12531,
29918,
1188,
29918,
7099,
3689,
29918,
29963,
3403,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
4321,
29879,
584,
9891,
18078,
1054,
473,
29889,
9794,
29889,
23973,
29889,
3286,
571,
29918,
12171,
29889,
8357,
1658,
293,
29918,
29894,
1188,
7790,
13,
1188,
29918,
7099,
3689,
29918,
29963,
3403,
29952,
5023,
302,
29899,
12531,
7049,
2304,
29889,
13,
4706,
9995,
13,
13,
4706,
478,
29918,
449,
353,
29871,
29900,
29889,
29946,
29906,
29941,
29941,
29896,
29896,
29946,
29946,
29947,
29955,
29953,
29900,
29896,
29941,
29953,
13,
4706,
365,
29918,
262,
353,
1480,
29918,
7099,
3689,
29918,
29963,
3403,
29898,
29963,
29918,
449,
29897,
13,
13,
4706,
478,
29918,
449,
353,
7442,
29889,
29873,
488,
29898,
29963,
29918,
449,
29892,
29871,
29953,
29897,
13,
4706,
365,
29918,
262,
353,
7442,
29889,
29873,
488,
29898,
29931,
29918,
262,
29892,
29871,
29953,
29897,
13,
4706,
7442,
29889,
13424,
29889,
9294,
29918,
284,
3242,
29918,
11745,
29898,
13,
9651,
1480,
29918,
7099,
3689,
29918,
29963,
3403,
29898,
29963,
29918,
449,
511,
365,
29918,
262,
29892,
13677,
29922,
29955,
29897,
13,
13,
4706,
478,
29918,
449,
353,
7442,
29889,
690,
14443,
29898,
29963,
29918,
449,
29892,
313,
29906,
29892,
29871,
29941,
876,
13,
4706,
365,
29918,
262,
353,
7442,
29889,
690,
14443,
29898,
29931,
29918,
262,
29892,
313,
29906,
29892,
29871,
29941,
876,
13,
4706,
7442,
29889,
13424,
29889,
9294,
29918,
284,
3242,
29918,
11745,
29898,
13,
9651,
1480,
29918,
7099,
3689,
29918,
29963,
3403,
29898,
29963,
29918,
449,
511,
365,
29918,
262,
29892,
13677,
29922,
29955,
29897,
13,
13,
4706,
478,
29918,
449,
353,
7442,
29889,
690,
14443,
29898,
29963,
29918,
449,
29892,
313,
29906,
29892,
29871,
29941,
29892,
29871,
29896,
876,
13,
4706,
365,
29918,
262,
353,
7442,
29889,
690,
14443,
29898,
29931,
29918,
262,
29892,
313,
29906,
29892,
29871,
29941,
29892,
29871,
29896,
876,
13,
4706,
7442,
29889,
13424,
29889,
9294,
29918,
284,
3242,
29918,
11745,
29898,
13,
9651,
1480,
29918,
7099,
3689,
29918,
29963,
3403,
29898,
29963,
29918,
449,
511,
365,
29918,
262,
29892,
13677,
29922,
29955,
29897,
13,
13,
1678,
822,
1243,
29918,
7247,
29918,
3881,
29918,
7052,
29918,
1188,
29918,
7099,
3689,
29918,
29963,
3403,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
4321,
29879,
584,
9891,
18078,
1054,
473,
29889,
9794,
29889,
23973,
29889,
3286,
571,
29918,
12171,
29889,
8357,
1658,
293,
29918,
29894,
1188,
7790,
13,
1188,
29918,
7099,
3689,
29918,
29963,
3403,
29952,
5023,
5354,
322,
3464,
6287,
2304,
29889,
13,
4706,
9995,
13,
13,
4706,
478,
29918,
449,
353,
29871,
29900,
29889,
29946,
29906,
29941,
29941,
29896,
29896,
29946,
29946,
29947,
29955,
29953,
29900,
29896,
29941,
29953,
13,
4706,
365,
29918,
262,
353,
1480,
29918,
7099,
3689,
29918,
29963,
3403,
29898,
29963,
29918,
449,
29897,
13,
13,
4706,
270,
29918,
29878,
353,
313,
877,
5679,
742,
29871,
29896,
511,
313,
29896,
29892,
29871,
29896,
511,
313,
29896,
29900,
29900,
29892,
29871,
29896,
29900,
29900,
876,
13,
4706,
363,
6287,
29892,
7329,
297,
270,
29918,
29878,
29901,
13,
9651,
411,
5354,
29918,
3881,
29918,
7052,
29898,
7052,
1125,
13,
18884,
7442,
29889,
13424,
29889,
9294,
29918,
284,
3242,
29918,
11745,
29898,
13,
462,
1678,
1480,
29918,
7099,
3689,
29918,
29963,
3403,
29898,
29963,
29918,
449,
334,
7329,
511,
13,
462,
1678,
365,
29918,
262,
334,
7329,
29892,
13,
462,
1678,
13677,
29922,
29955,
29897,
13,
13,
1678,
732,
17281,
29918,
23749,
29918,
12523,
13,
1678,
822,
1243,
29918,
13707,
29918,
1188,
29918,
7099,
3689,
29918,
29963,
3403,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
4321,
29879,
584,
9891,
18078,
1054,
473,
29889,
9794,
29889,
23973,
29889,
3286,
571,
29918,
12171,
29889,
8357,
1658,
293,
29918,
29894,
1188,
7790,
13,
1188,
29918,
7099,
3689,
29918,
29963,
3403,
29952,
5023,
23432,
2304,
29889,
13,
4706,
9995,
13,
13,
4706,
1480,
29918,
7099,
3689,
29918,
29963,
3403,
29898,
9302,
29889,
2378,
4197,
29899,
29896,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29896,
29889,
29900,
29892,
448,
9302,
29889,
7192,
29892,
7442,
29889,
7192,
29892,
7442,
29889,
13707,
12622,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
443,
27958,
29889,
3396,
580,
13,
2
] |
get_data/__init__.py | LilySu/nyc-health-API | 0 | 128258 | from flask import Flask
from flask import jsonify
import pandas as pd
import markdown
import requests
import os
app = Flask(__name__)
@app.route("/")
def index():
with open(os.path.dirname(app.root_path) + '/README.md','r') as markdown_file:
content = markdown_file.read()
return markdown.markdown(content)
@app.route("/boro")
def boro():
df = pd.read_csv('https://raw.githubusercontent.com/nychealth/coronavirus-data/master/boro.csv')
df.fillna(0, inplace=True)
return jsonify(df.to_dict('records')),200
@app.route("/by-age")
def byage():
df = pd.read_csv('https://raw.githubusercontent.com/nychealth/coronavirus-data/master/by-age.csv')
df.fillna(0, inplace=True)
return jsonify(df.to_dict('records')),200
@app.route("/by-sex")
def bysex():
df = pd.read_csv('https://raw.githubusercontent.com/nychealth/coronavirus-data/master/by-sex.csv')
df.fillna(0, inplace=True)
return jsonify(df.to_dict('records')),200
@app.route("/case-hosp-death")
def casehospdeath():
df = pd.read_csv('https://raw.githubusercontent.com/nychealth/coronavirus-data/master/case-hosp-death.csv')
df.fillna(0, inplace=True)
return jsonify(df.to_dict('records')),200
@app.route("/probable-confirmed-dod")
def probableconfirmeddod():
df = pd.read_csv('https://raw.githubusercontent.com/nychealth/coronavirus-data/master/probable-confirmed-dod.csv')
df.fillna(0, inplace=True)
return jsonify(df.to_dict('records')),200
@app.route("/summary")
def summary():
df = pd.read_csv('https://raw.githubusercontent.com/nychealth/coronavirus-data/master/summary.csv')
df.fillna(0, inplace=True)
return jsonify(df.to_dict('records')),200
@app.route("/tests-by-zcta")
def testsbyzcta():
df = pd.read_csv('https://raw.githubusercontent.com/nychealth/coronavirus-data/master/tests-by-zcta.csv')
df.fillna(0, inplace=True)
return jsonify(df.to_dict('records')),200 | [
1,
515,
29784,
1053,
2379,
1278,
13,
3166,
29784,
1053,
4390,
1598,
13,
5215,
11701,
408,
10518,
13,
5215,
2791,
3204,
13,
5215,
7274,
13,
5215,
2897,
13,
13,
13,
932,
353,
2379,
1278,
22168,
978,
1649,
29897,
13,
13,
29992,
932,
29889,
13134,
11974,
1159,
13,
1753,
2380,
7295,
13,
1678,
411,
1722,
29898,
359,
29889,
2084,
29889,
25721,
29898,
932,
29889,
4632,
29918,
2084,
29897,
718,
8207,
16310,
2303,
29889,
3487,
3788,
29878,
1495,
408,
2791,
3204,
29918,
1445,
29901,
13,
4706,
2793,
353,
2791,
3204,
29918,
1445,
29889,
949,
580,
13,
4706,
736,
2791,
3204,
29889,
3502,
3204,
29898,
3051,
29897,
13,
13,
29992,
932,
29889,
13134,
11974,
4089,
29877,
1159,
13,
1753,
289,
5801,
7295,
13,
1678,
4489,
353,
10518,
29889,
949,
29918,
7638,
877,
991,
597,
1610,
29889,
3292,
1792,
3051,
29889,
510,
29914,
1460,
1173,
4298,
29914,
2616,
265,
485,
22693,
29899,
1272,
29914,
6207,
29914,
4089,
29877,
29889,
7638,
1495,
13,
1678,
4489,
29889,
5589,
1056,
29898,
29900,
29892,
297,
6689,
29922,
5574,
29897,
13,
1678,
736,
4390,
1598,
29898,
2176,
29889,
517,
29918,
8977,
877,
3757,
4339,
1495,
511,
29906,
29900,
29900,
13,
13,
29992,
932,
29889,
13134,
11974,
1609,
29899,
482,
1159,
13,
1753,
491,
482,
7295,
13,
1678,
4489,
353,
10518,
29889,
949,
29918,
7638,
877,
991,
597,
1610,
29889,
3292,
1792,
3051,
29889,
510,
29914,
1460,
1173,
4298,
29914,
2616,
265,
485,
22693,
29899,
1272,
29914,
6207,
29914,
1609,
29899,
482,
29889,
7638,
1495,
13,
1678,
4489,
29889,
5589,
1056,
29898,
29900,
29892,
297,
6689,
29922,
5574,
29897,
13,
1678,
736,
4390,
1598,
29898,
2176,
29889,
517,
29918,
8977,
877,
3757,
4339,
1495,
511,
29906,
29900,
29900,
13,
13,
29992,
932,
29889,
13134,
11974,
1609,
29899,
14167,
1159,
13,
1753,
491,
14167,
7295,
13,
1678,
4489,
353,
10518,
29889,
949,
29918,
7638,
877,
991,
597,
1610,
29889,
3292,
1792,
3051,
29889,
510,
29914,
1460,
1173,
4298,
29914,
2616,
265,
485,
22693,
29899,
1272,
29914,
6207,
29914,
1609,
29899,
14167,
29889,
7638,
1495,
13,
1678,
4489,
29889,
5589,
1056,
29898,
29900,
29892,
297,
6689,
29922,
5574,
29897,
13,
1678,
736,
4390,
1598,
29898,
2176,
29889,
517,
29918,
8977,
877,
3757,
4339,
1495,
511,
29906,
29900,
29900,
13,
13,
29992,
932,
29889,
13134,
11974,
4878,
29899,
29882,
4705,
29899,
311,
493,
1159,
13,
1753,
1206,
29882,
4705,
311,
493,
7295,
13,
1678,
4489,
353,
10518,
29889,
949,
29918,
7638,
877,
991,
597,
1610,
29889,
3292,
1792,
3051,
29889,
510,
29914,
1460,
1173,
4298,
29914,
2616,
265,
485,
22693,
29899,
1272,
29914,
6207,
29914,
4878,
29899,
29882,
4705,
29899,
311,
493,
29889,
7638,
1495,
13,
1678,
4489,
29889,
5589,
1056,
29898,
29900,
29892,
297,
6689,
29922,
5574,
29897,
13,
1678,
736,
4390,
1598,
29898,
2176,
29889,
517,
29918,
8977,
877,
3757,
4339,
1495,
511,
29906,
29900,
29900,
13,
13,
29992,
932,
29889,
13134,
11974,
22795,
519,
29899,
5527,
381,
2168,
29899,
29881,
397,
1159,
13,
1753,
16269,
5527,
381,
2168,
29881,
397,
7295,
13,
1678,
4489,
353,
10518,
29889,
949,
29918,
7638,
877,
991,
597,
1610,
29889,
3292,
1792,
3051,
29889,
510,
29914,
1460,
1173,
4298,
29914,
2616,
265,
485,
22693,
29899,
1272,
29914,
6207,
29914,
22795,
519,
29899,
5527,
381,
2168,
29899,
29881,
397,
29889,
7638,
1495,
13,
1678,
4489,
29889,
5589,
1056,
29898,
29900,
29892,
297,
6689,
29922,
5574,
29897,
13,
1678,
736,
4390,
1598,
29898,
2176,
29889,
517,
29918,
8977,
877,
3757,
4339,
1495,
511,
29906,
29900,
29900,
13,
13,
29992,
932,
29889,
13134,
11974,
7727,
1159,
13,
1753,
15837,
7295,
13,
1678,
4489,
353,
10518,
29889,
949,
29918,
7638,
877,
991,
597,
1610,
29889,
3292,
1792,
3051,
29889,
510,
29914,
1460,
1173,
4298,
29914,
2616,
265,
485,
22693,
29899,
1272,
29914,
6207,
29914,
7727,
29889,
7638,
1495,
13,
1678,
4489,
29889,
5589,
1056,
29898,
29900,
29892,
297,
6689,
29922,
5574,
29897,
13,
1678,
736,
4390,
1598,
29898,
2176,
29889,
517,
29918,
8977,
877,
3757,
4339,
1495,
511,
29906,
29900,
29900,
13,
13,
29992,
932,
29889,
13134,
11974,
21150,
29899,
1609,
29899,
29920,
312,
29874,
1159,
13,
1753,
6987,
1609,
29920,
312,
29874,
7295,
13,
1678,
4489,
353,
10518,
29889,
949,
29918,
7638,
877,
991,
597,
1610,
29889,
3292,
1792,
3051,
29889,
510,
29914,
1460,
1173,
4298,
29914,
2616,
265,
485,
22693,
29899,
1272,
29914,
6207,
29914,
21150,
29899,
1609,
29899,
29920,
312,
29874,
29889,
7638,
1495,
13,
1678,
4489,
29889,
5589,
1056,
29898,
29900,
29892,
297,
6689,
29922,
5574,
29897,
13,
1678,
736,
4390,
1598,
29898,
2176,
29889,
517,
29918,
8977,
877,
3757,
4339,
1495,
511,
29906,
29900,
29900,
2
] |
src/cookbook/__init__.py | Vidreven/cookbook | 0 | 114374 | <reponame>Vidreven/cookbook<filename>src/cookbook/__init__.py
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from . import config
URL = (
f"{config.DB_DRIVER}://{config.DB_USER}:{config.DB_PWD}"
f"@{config.DB_HOST}:{config.DB_PORT}/{config.DB_NAME}"
)
engine = create_engine(URL, pool_pre_ping=True)
Session = sessionmaker(bind=engine)
| [
1,
529,
276,
1112,
420,
29958,
29963,
333,
27901,
29914,
15108,
2909,
29966,
9507,
29958,
4351,
29914,
15108,
2909,
29914,
1649,
2344,
26914,
2272,
13,
3166,
4576,
284,
305,
6764,
1053,
1653,
29918,
10599,
13,
3166,
4576,
284,
305,
6764,
29889,
555,
1053,
4867,
28107,
13,
13,
3166,
869,
1053,
2295,
13,
13,
4219,
353,
313,
13,
1678,
285,
29908,
29912,
2917,
29889,
4051,
29918,
29928,
3960,
5348,
29913,
597,
29912,
2917,
29889,
4051,
29918,
11889,
6177,
29912,
2917,
29889,
4051,
29918,
29925,
24668,
5038,
13,
1678,
285,
29908,
28312,
2917,
29889,
4051,
29918,
20832,
6177,
29912,
2917,
29889,
4051,
29918,
15082,
6822,
29912,
2917,
29889,
4051,
29918,
5813,
5038,
13,
29897,
13,
13,
10599,
353,
1653,
29918,
10599,
29898,
4219,
29892,
11565,
29918,
1457,
29918,
15702,
29922,
5574,
29897,
13,
7317,
353,
4867,
28107,
29898,
5355,
29922,
10599,
29897,
13,
2
] |
lib/arg.py | XanderXAJ/static-site-helpers | 0 | 122412 | import argparse
import typing
def generate_argument_parser(parser: argparse.ArgumentParser = None):
if parser is None:
parser = argparse.ArgumentParser()
parser.add_argument('--log_level', help='Set logging level', default='WARNING',
type=str.upper,
choices=['CRITICAL', 'ERROR', 'WARNING', 'INFO', 'DEBUG'])
parser.add_argument('paths', nargs='+', metavar='path')
return parser
def parse_arguments(args: typing.List[str] = None, parser: argparse.ArgumentParser = None):
parser = generate_argument_parser(parser=parser)
return parser.parse_args(args)
| [
1,
1053,
1852,
5510,
13,
5215,
19229,
13,
13,
13,
1753,
5706,
29918,
23516,
29918,
16680,
29898,
16680,
29901,
1852,
5510,
29889,
15730,
11726,
353,
6213,
1125,
13,
1678,
565,
13812,
338,
6213,
29901,
13,
4706,
13812,
353,
1852,
5510,
29889,
15730,
11726,
580,
13,
1678,
13812,
29889,
1202,
29918,
23516,
877,
489,
1188,
29918,
5563,
742,
1371,
2433,
2697,
12183,
3233,
742,
2322,
2433,
29956,
25614,
742,
13,
462,
4706,
1134,
29922,
710,
29889,
21064,
29892,
13,
462,
4706,
19995,
29922,
1839,
11341,
1806,
2965,
1964,
742,
525,
11432,
742,
525,
29956,
25614,
742,
525,
11690,
742,
525,
18525,
11287,
13,
1678,
13812,
29889,
1202,
29918,
23516,
877,
24772,
742,
302,
5085,
2433,
29974,
742,
1539,
485,
279,
2433,
2084,
1495,
13,
1678,
736,
13812,
13,
13,
13,
1753,
6088,
29918,
25699,
29898,
5085,
29901,
19229,
29889,
1293,
29961,
710,
29962,
353,
6213,
29892,
13812,
29901,
1852,
5510,
29889,
15730,
11726,
353,
6213,
1125,
13,
1678,
13812,
353,
5706,
29918,
23516,
29918,
16680,
29898,
16680,
29922,
16680,
29897,
13,
1678,
736,
13812,
29889,
5510,
29918,
5085,
29898,
5085,
29897,
13,
2
] |
quickcert.py | dedickinson/hub-util-tls | 0 | 149969 | #!/usr/bin/env python3
# PYTHON_ARGCOMPLETE_OK
import quickcert
quickcert.QuickCertCli().run() | [
1,
18787,
4855,
29914,
2109,
29914,
6272,
3017,
29941,
13,
29937,
349,
29979,
4690,
1164,
29918,
1718,
29954,
21514,
18476,
29918,
8949,
13,
13,
5215,
4996,
6327,
13,
13,
24561,
6327,
29889,
2182,
860,
20455,
29907,
492,
2141,
3389,
580,
2
] |
HUGGINGFACE.py | mkingopng/NBME_score_clinical_patient_notes | 1 | 21252 | import os
TRANSFORMERS = '/home/noone/documents/github/transformers'
TOKENIZERS = '/home/noone/documents/github/tokenizers'
DATASETS = '/home/noone/documents/github/datasets'
MODELS = os.path.join(TRANSFORMERS, 'src/transformers/models')
DEBERTA_V2 = os.path.join(MODELS, 'deberta_v2')
DEBERTA_V3 = os.path.join(MODELS, 'deberta-v3-base')
ENCODER_DECODER = os.path.join(MODELS, 'encoder_decoder')
HUGGINGFACE_HUB = '/home/noone/documents/github/huggingface_hub'
"""
Huggingface Repos Cloned:
- transformers
- tokenizers
= optimum
- datasets
- huggingface_hub
- accelerate
- notebooks
- blog
- huggingface sagemaker snowflake example
- education toolkit
- evaluate
- knockknock
- neuralcoref
- mongoku
- data-measurements-tool
- neural compressor
- allennlp
- pytorch-openai-transformer-lm
- pytorch pretrained bigGAN
- awesome NLP discussion papers
- torchMoji
- naacl_transfer_learning_tutorial
-
""" | [
1,
1053,
2897,
13,
13,
26813,
29903,
19094,
23598,
353,
8207,
5184,
29914,
1217,
650,
29914,
3225,
29879,
29914,
3292,
29914,
9067,
414,
29915,
13,
13,
4986,
29968,
1430,
26664,
23598,
353,
8207,
5184,
29914,
1217,
650,
29914,
3225,
29879,
29914,
3292,
29914,
6979,
19427,
29915,
13,
13,
25832,
8127,
9375,
353,
8207,
5184,
29914,
1217,
650,
29914,
3225,
29879,
29914,
3292,
29914,
14538,
1691,
29915,
13,
13,
20387,
8547,
353,
2897,
29889,
2084,
29889,
7122,
29898,
26813,
29903,
19094,
23598,
29892,
525,
4351,
29914,
9067,
414,
29914,
9794,
1495,
13,
13,
2287,
13635,
6040,
29918,
29963,
29906,
353,
2897,
29889,
2084,
29889,
7122,
29898,
20387,
8547,
29892,
525,
311,
19954,
29918,
29894,
29906,
1495,
13,
13,
2287,
13635,
6040,
29918,
29963,
29941,
353,
2897,
29889,
2084,
29889,
7122,
29898,
20387,
8547,
29892,
525,
311,
19954,
29899,
29894,
29941,
29899,
3188,
1495,
13,
13,
1430,
3217,
8032,
29918,
2287,
3217,
8032,
353,
2897,
29889,
2084,
29889,
7122,
29898,
20387,
8547,
29892,
525,
3977,
6119,
29918,
7099,
6119,
1495,
13,
13,
29950,
23338,
29954,
4214,
29943,
11538,
29918,
29950,
7466,
353,
8207,
5184,
29914,
1217,
650,
29914,
3225,
29879,
29914,
3292,
29914,
29882,
688,
3460,
2161,
29918,
29882,
431,
29915,
13,
13,
13,
15945,
29908,
13,
29950,
688,
3460,
2161,
830,
1066,
2233,
22367,
29901,
13,
1678,
448,
4327,
414,
13,
1678,
448,
5993,
19427,
13,
1678,
353,
5994,
398,
13,
1678,
448,
20035,
13,
1678,
448,
298,
688,
3460,
2161,
29918,
29882,
431,
13,
1678,
448,
15592,
403,
13,
308,
13,
1678,
448,
451,
19273,
29879,
13,
1678,
448,
12618,
13,
1678,
448,
298,
688,
3460,
2161,
269,
13904,
5790,
15007,
29888,
433,
446,
1342,
13,
1678,
448,
9793,
5780,
7354,
13,
1678,
448,
14707,
13,
1678,
448,
18232,
29895,
1217,
384,
13,
1678,
448,
19677,
3221,
29888,
13,
1678,
448,
286,
549,
9154,
13,
1678,
448,
848,
29899,
26658,
1860,
29899,
10154,
13,
1678,
448,
19677,
27122,
272,
13,
1678,
448,
599,
2108,
22833,
13,
1678,
448,
282,
3637,
25350,
29899,
3150,
1794,
29899,
9067,
261,
29899,
21457,
13,
1678,
448,
282,
3637,
25350,
758,
3018,
1312,
4802,
29954,
2190,
13,
1678,
448,
29663,
405,
13208,
10679,
15055,
13,
1678,
448,
4842,
305,
22638,
2397,
13,
1678,
448,
1055,
562,
29880,
29918,
3286,
571,
29918,
21891,
29918,
12631,
13,
1678,
448,
29871,
13,
15945,
29908,
2
] |
orio/main/tuner/tuner.py | parsabee/Orio | 24 | 11361 | <reponame>parsabee/Orio
#
# The tuner class to initiate the empirical performance tuning process
#
import re, sys, os
from orio.main.util.globals import *
import orio.main.dyn_loader, orio.main.tspec.tspec, orio.main.tuner.ptest_codegen, orio.main.tuner.ptest_driver
#--------------------------------------------------
# the name of the module containing various search algorithms
SEARCH_MOD_NAME = 'orio.main.tuner.search'
#--------------------------------------------------
class PerfTuner:
'''
The empirical performance tuner.
This class is responsible for invoking the code generators of the annotation modules,
compiling the resulting code, and interfacing with the search interface to run the
tests and collect the results.
'''
#-------------------------------------------------
def __init__(self, odriver):
'''To instantiate an empirical performance tuner object'''
self.odriver = odriver
self.dloader = orio.main.dyn_loader.DynLoader()
self.num_params=0
self.num_configs=0
self.num_bin=0
self.num_int=0
self.tinfo = None
#-------------------------------------------------
def tune(self, module_body_code, line_no, cfrags):
'''
Perform empirical performance tuning on the given annotated code. And return the best
optimized code variant.
'''
# extract the tuning information specified from the given annotation
tinfo = self.__extractTuningInfo(module_body_code, line_no)
self.tinfo = tinfo
# determine if parallel search is required
use_parallel_search = tinfo.batch_cmd != None
# create a performance-testing code generator for each distinct problem size
ptcodegens = []
#timing_code = ''
for prob_size in self.__getProblemSizes(tinfo.iparam_params, tinfo.iparam_constraints):
if self.odriver.lang == 'c':
c = orio.main.tuner.ptest_codegen.PerfTestCodeGen(prob_size, tinfo.ivar_decls, tinfo.ivar_decl_file,
tinfo.ivar_init_file, tinfo.ptest_skeleton_code_file, self.odriver.lang,
tinfo.random_seed, use_parallel_search, tinfo.validation_file)
elif self.odriver.lang == 'cuda':
c = orio.main.tuner.ptest_codegen.PerfTestCodeGenCUDA(prob_size, tinfo.ivar_decls, tinfo.ivar_decl_file,
tinfo.ivar_init_file, tinfo.ptest_skeleton_code_file, self.odriver.lang,
tinfo.random_seed, use_parallel_search)
elif self.odriver.lang == 'opencl':
c = orio.main.tuner.ptest_codegen.PerfTestCodeGenOpenCL(prob_size, tinfo.ivar_decls, tinfo.ivar_decl_file,
tinfo.ivar_init_file, tinfo.ptest_skeleton_code_file, self.odriver.lang,
tinfo.random_seed, use_parallel_search)
elif self.odriver.lang == 'fortran':
c = orio.main.tuner.ptest_codegen.PerfTestCodeGenFortran(prob_size, tinfo.ivar_decls, tinfo.ivar_decl_file,
tinfo.ivar_init_file, tinfo.ptest_skeleton_code_file, self.odriver.lang,
tinfo.random_seed, use_parallel_search)
else:
err('main.tuner.tuner: unknown output language specified: %s' % self.odriver.lang)
ptcodegens.append(c)
# create the performance-testing driver
ptdriver = orio.main.tuner.ptest_driver.PerfTestDriver(self.tinfo, use_parallel_search,
self.odriver.lang,
c.getTimerCode(use_parallel_search))
# get the axis names and axis value ranges to represent the search space
axis_names, axis_val_ranges = self.__buildCoordSystem(tinfo.pparam_params, tinfo.cmdline_params)
info('%s' % axis_names)
info('%s' % axis_val_ranges)
# combine the performance parameter constraints
pparam_constraint = 'True'
for vname, rhs in tinfo.pparam_constraints:
pparam_constraint += ' and (%s)' % rhs
# dynamically load the search engine class and configure it
if Globals().extern:
tinfo.search_algo='Extern'
info('Running in %s mode' % tinfo.search_algo)
info('Using parameters %s' % Globals().config)
class_name = tinfo.search_algo
mod_name = '.'.join([SEARCH_MOD_NAME, class_name.lower(), class_name.lower()])
search_class = self.dloader.loadClass(mod_name, class_name)
# convert the search time limit (from minutes to seconds) and get the total number of
# search runs
search_time_limit = 60 * tinfo.search_time_limit
search_total_runs = tinfo.search_total_runs
search_use_z3 = tinfo.search_use_z3
search_resume = tinfo.search_resume
# get the search-algorithm-specific arguments
search_opts = dict(tinfo.search_opts)
# perform the performance tuning for each distinct problem size
optimized_code_seq = []
for ptcodegen in ptcodegens:
if Globals().verbose:
info('\n----- begin empirical tuning for problem size -----')
# Sort y variable name... not sure it's really necessary
iparams = sorted(ptcodegen.input_params[:])
for pname, pvalue in iparams:
info(' %s = %s' % (pname, pvalue))
iparams = sorted(ptcodegen.input_params[:])
for pname, pvalue in iparams:
Globals().metadata['size_' + pname] = pvalue
debug(ptcodegen.input_params[:])
# create the search engine
search_eng = search_class({'cfrags':cfrags, # code versions
'axis_names':axis_names, # performance parameter names
'axis_val_ranges':axis_val_ranges, # performance parameter values
'pparam_constraint':pparam_constraint,
'search_time_limit':search_time_limit,
'search_total_runs':search_total_runs,
'search_resume':search_resume,
'search_opts':search_opts,
'ptcodegen':ptcodegen,
'ptdriver':ptdriver, 'odriver':self.odriver,
'use_parallel_search':use_parallel_search,
'input_params':ptcodegen.input_params[:]})
# search for the best performance parameters
best_perf_params, best_perf_cost = search_eng.search()
# output the best performance parameters
if Globals().verbose and not Globals().extern:
info('----- the obtained best performance parameters -----')
pparams = sorted(list(best_perf_params.items()))
for pname, pvalue in pparams:
info(' %s = %s' % (pname, pvalue))
# generate the optimized code using the obtained best performance parameters
if Globals().extern:
best_perf_params=Globals().config
debug("[orio.main.tuner.tuner] Globals config: %s" % str(Globals().config), obj=self, level=6)
cur_optimized_code_seq = self.odriver.optimizeCodeFrags(cfrags, best_perf_params)
# check the optimized code sequence
if len(cur_optimized_code_seq) != 1:
err('orio.main.tuner internal error: the empirically optimized code cannot contain multiple versions')
# get the optimized code
optimized_code, _, externals = cur_optimized_code_seq[0]
# insert comments into the optimized code to include information about
# the best performance parameters and the input problem sizes
iproblem_code = ''
iparams = sorted(ptcodegen.input_params[:])
for pname, pvalue in iparams:
if pname == '__builtins__':
continue
iproblem_code += ' %s = %s \n' % (pname, pvalue)
pparam_code = ''
pparams = sorted(list(best_perf_params.items()))
for pname, pvalue in pparams:
if pname == '__builtins__':
continue
pparam_code += ' %s = %s \n' % (pname, pvalue)
info_code = '\n/**-- (Generated by Orio) \n'
if not Globals().extern:
info_code += 'Best performance cost: \n'
info_code += ' %s \n' % best_perf_cost
info_code += 'Tuned for specific problem sizes: \n'
info_code += iproblem_code
info_code += 'Best performance parameters: \n'
info_code += pparam_code
info_code += '--**/\n'
optimized_code = info_code + optimized_code
# store the optimized for this problem size
optimized_code_seq.append((optimized_code, ptcodegen.input_params[:], externals))
# return the optimized code
return optimized_code_seq
# Private methods
#-------------------------------------------------
def __extractTuningInfo(self, code, line_no):
'''Extract tuning information from the given annotation code'''
# parse the code
match_obj = re.match(r'^\s*import\s+spec\s+([/A-Za-z_]+);\s*$', code)
# if the code contains a single import statement
if match_obj:
# get the specification name
spec_name = match_obj.group(1)
spec_file = spec_name+'.spec'
try:
src_dir = '/'.join(list(Globals().src_filenames.keys())[0].split('/')[:-1])
spec_file_path = os.getcwd() + '/' + src_dir + '/' + spec_file
f = open(spec_file_path, 'r')
tspec_code = f.read()
f.close()
except:
err('%s: cannot open file for reading: %s' % (self.__class__, spec_file_path))
tuning_spec_dict = orio.main.tspec.tspec.TSpec().parseProgram(tspec_code)
# if the tuning specification is hardcoded into the given code
elif code.lstrip().startswith('spec'):
tuning_spec_dict = orio.main.tspec.tspec.TSpec().parseProgram(code)
else:
# parse the specification code to get the tuning information
tuning_spec_dict = orio.main.tspec.tspec.TSpec().parseSpec(code, line_no)
# return the tuning information
return tuning_spec_dict
#-------------------------------------------------
def __listAllCombinations(self, seqs):
'''
Enumerate all combinations of the given sequences.
e.g. input: [['a','b'],[1,2]] --> [['a',1],['a',2],['b',1],['b',2]]
'''
# the base case
if len(seqs) == 0:
return []
# the recursive step
trailing_combs = self.__listAllCombinations(seqs[1:])
if trailing_combs == []:
trailing_combs = [[]]
combs = []
for i in seqs[0]:
for c in trailing_combs:
combs.append([i] + c)
# return the combinations
return combs
#-------------------------------------------------
def __getProblemSizes(self, iparam_params, iparam_constraints):
'''Return all valid problem sizes'''
# combine the input parameter constraints
iparam_constraint = 'True'
for vname, rhs in iparam_constraints:
iparam_constraint += ' and (%s)' % rhs
# compute all possible combinations of problem sizes
prob_sizes = []
pnames, pvalss = list(zip(*iparam_params))
for pvals in self.__listAllCombinations(pvalss):
prob_sizes.append(list(zip(pnames, pvals)))
# exclude all invalid problem sizes
n_prob_sizes = []
for p in prob_sizes:
try:
is_valid = eval(iparam_constraint, dict(p))
except Exception as e:
err('orio.main.tuner.tuner:%s: failed to evaluate the input parameter constraint expression\n --> %s: %s' % (iparam_constraint,e.__class__.__name__, e))
if is_valid:
n_prob_sizes.append(p)
prob_sizes = n_prob_sizes
# check if the new problem sizes is empty
if len(prob_sizes) == 0:
err('orio.main.tuner.tuner: no valid problem sizes exist. please check the input parameter ' +
'constraints')
# return all possible combinations of problem sizes
return prob_sizes
#-------------------------------------------------
def __buildCoordSystem(self, perf_params, cmdline_params):
'''Return information about the coordinate systems that represent the search space'''
debug("BUILDING COORD SYSTEM", obj=self,level=3)
# get the axis names and axis value ranges
axis_names = []
axis_val_ranges = []
for pname, prange in perf_params:
axis_names.append(pname)
# BN: why on earth would someone do this?????
# axis_val_ranges.append(self.__sort(prange))
axis_val_ranges.append(prange)
for pname, prange in cmdline_params:
axis_names.append('__cmdline_' + pname)
axis_val_ranges.append(prange)
self.num_params=len(axis_names)
self.num_configs=1
self.num_bin=0
self.num_categorical = 0
self.num_int=self.num_params
ptype=[]
for vals in axis_val_ranges:
self.num_configs=self.num_configs*len(vals)
ptype.append('I')
if type(vals[0]) == bool:
self.num_bin=self.num_bin+1
ptype[len(ptype)-1]=('B')
if type(vals[0]) == str:
self.num_categorical = self.num_categorical+1
self.num_int -= self.num_bin
self.num_int -= self.num_categorical
info('Search_Space = %1.3e' % self.num_configs)
info('Number_of_Parameters = %02d' % self.num_params)
info('Numeric_Parameters = %02d' % self.num_int)
info('Binary_Parameters = %02d' % self.num_bin)
info('Categorical_Parameters = %02d' % self.num_categorical)
sys.stderr.write('%s\n'% Globals().configfile)
return (axis_names, axis_val_ranges)
| [
1,
529,
276,
1112,
420,
29958,
862,
29879,
370,
3905,
29914,
29949,
5378,
13,
29937,
13,
29937,
450,
18515,
261,
770,
304,
14511,
403,
278,
29190,
936,
4180,
18515,
292,
1889,
13,
29937,
13,
13,
5215,
337,
29892,
10876,
29892,
2897,
13,
13,
3166,
470,
601,
29889,
3396,
29889,
4422,
29889,
23705,
1338,
1053,
334,
13,
5215,
470,
601,
29889,
3396,
29889,
29881,
948,
29918,
12657,
29892,
470,
601,
29889,
3396,
29889,
1372,
3135,
29889,
1372,
3135,
29892,
470,
601,
29889,
3396,
29889,
29873,
348,
261,
29889,
415,
342,
29918,
401,
1885,
29892,
470,
601,
29889,
3396,
29889,
29873,
348,
261,
29889,
415,
342,
29918,
9465,
13,
13,
13,
29937,
2683,
2683,
2683,
489,
13,
13,
29937,
278,
1024,
310,
278,
3883,
6943,
5164,
2740,
14009,
13,
1660,
1718,
3210,
29918,
6720,
29928,
29918,
5813,
353,
525,
10893,
29889,
3396,
29889,
29873,
348,
261,
29889,
4478,
29915,
13,
13,
29937,
2683,
2683,
2683,
489,
13,
13,
1990,
2431,
29888,
29911,
348,
261,
29901,
13,
1678,
14550,
13,
1678,
450,
29190,
936,
4180,
18515,
261,
29889,
13,
1678,
910,
770,
338,
14040,
363,
2437,
17223,
278,
775,
1176,
4097,
310,
278,
17195,
10585,
29892,
13,
1678,
22520,
278,
9819,
775,
29892,
322,
1006,
29888,
9390,
411,
278,
2740,
5067,
304,
1065,
278,
29871,
13,
1678,
6987,
322,
6314,
278,
2582,
29889,
13,
1678,
14550,
13,
13,
1678,
396,
2683,
2683,
2683,
29899,
13,
268,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
2413,
3511,
1125,
13,
4706,
14550,
1762,
25112,
385,
29190,
936,
4180,
18515,
261,
1203,
12008,
13,
13,
4706,
1583,
29889,
397,
3511,
353,
2413,
3511,
13,
4706,
1583,
29889,
29881,
12657,
353,
470,
601,
29889,
3396,
29889,
29881,
948,
29918,
12657,
29889,
29928,
948,
10036,
580,
13,
13,
4706,
1583,
29889,
1949,
29918,
7529,
29922,
29900,
13,
4706,
1583,
29889,
1949,
29918,
2917,
29879,
29922,
29900,
13,
4706,
1583,
29889,
1949,
29918,
2109,
29922,
29900,
13,
4706,
1583,
29889,
1949,
29918,
524,
29922,
29900,
13,
308,
13,
4706,
1583,
29889,
29873,
3888,
353,
6213,
13,
13,
268,
13,
1678,
396,
2683,
2683,
2683,
29899,
13,
13,
1678,
822,
260,
1540,
29898,
1311,
29892,
3883,
29918,
2587,
29918,
401,
29892,
1196,
29918,
1217,
29892,
274,
29888,
1431,
29879,
1125,
13,
4706,
14550,
13,
4706,
27313,
29190,
936,
4180,
18515,
292,
373,
278,
2183,
9732,
630,
775,
29889,
1126,
736,
278,
1900,
13,
4706,
27545,
775,
17305,
29889,
13,
4706,
14550,
13,
308,
13,
4706,
396,
6597,
278,
18515,
292,
2472,
6790,
515,
278,
2183,
17195,
13,
4706,
260,
3888,
353,
1583,
17255,
21111,
29911,
27964,
3401,
29898,
5453,
29918,
2587,
29918,
401,
29892,
1196,
29918,
1217,
29897,
13,
4706,
1583,
29889,
29873,
3888,
353,
260,
3888,
13,
308,
13,
4706,
396,
8161,
565,
8943,
2740,
338,
3734,
13,
4706,
671,
29918,
23482,
29918,
4478,
353,
260,
3888,
29889,
16175,
29918,
9006,
2804,
6213,
13,
13,
4706,
396,
1653,
263,
4180,
29899,
13424,
775,
15299,
363,
1269,
8359,
1108,
2159,
13,
4706,
19592,
401,
17397,
353,
5159,
13,
4706,
396,
9346,
292,
29918,
401,
353,
6629,
13,
4706,
363,
2070,
29918,
2311,
297,
1583,
17255,
657,
26604,
29903,
7093,
29898,
29873,
3888,
29889,
666,
11269,
29918,
7529,
29892,
260,
3888,
29889,
666,
11269,
29918,
13646,
29879,
1125,
13,
9651,
565,
1583,
29889,
397,
3511,
29889,
3893,
1275,
525,
29883,
2396,
13,
18884,
274,
353,
470,
601,
29889,
3396,
29889,
29873,
348,
261,
29889,
415,
342,
29918,
401,
1885,
29889,
5894,
29888,
3057,
3399,
15462,
29898,
22795,
29918,
2311,
29892,
260,
3888,
29889,
440,
279,
29918,
311,
25932,
29892,
260,
3888,
29889,
440,
279,
29918,
27787,
29918,
1445,
29892,
13,
462,
462,
462,
462,
29871,
260,
3888,
29889,
440,
279,
29918,
2344,
29918,
1445,
29892,
260,
3888,
29889,
415,
342,
29918,
26050,
11285,
29918,
401,
29918,
1445,
29892,
1583,
29889,
397,
3511,
29889,
3893,
29892,
13,
462,
462,
462,
462,
29871,
260,
3888,
29889,
8172,
29918,
26776,
29892,
671,
29918,
23482,
29918,
4478,
29892,
260,
3888,
29889,
18157,
29918,
1445,
29897,
13,
9651,
25342,
1583,
29889,
397,
3511,
29889,
3893,
1275,
525,
29883,
6191,
2396,
13,
18884,
274,
353,
470,
601,
29889,
3396,
29889,
29873,
348,
261,
29889,
415,
342,
29918,
401,
1885,
29889,
5894,
29888,
3057,
3399,
15462,
29907,
29965,
7698,
29898,
22795,
29918,
2311,
29892,
260,
3888,
29889,
440,
279,
29918,
311,
25932,
29892,
260,
3888,
29889,
440,
279,
29918,
27787,
29918,
1445,
29892,
13,
462,
462,
462,
462,
29871,
260,
3888,
29889,
440,
279,
29918,
2344,
29918,
1445,
29892,
260,
3888,
29889,
415,
342,
29918,
26050,
11285,
29918,
401,
29918,
1445,
29892,
1583,
29889,
397,
3511,
29889,
3893,
29892,
13,
462,
462,
462,
462,
29871,
260,
3888,
29889,
8172,
29918,
26776,
29892,
671,
29918,
23482,
29918,
4478,
29897,
13,
9651,
25342,
1583,
29889,
397,
3511,
29889,
3893,
1275,
525,
3150,
695,
2396,
13,
18884,
274,
353,
470,
601,
29889,
3396,
29889,
29873,
348,
261,
29889,
415,
342,
29918,
401,
1885,
29889,
5894,
29888,
3057,
3399,
15462,
6585,
6154,
29898,
22795,
29918,
2311,
29892,
260,
3888,
29889,
440,
279,
29918,
311,
25932,
29892,
260,
3888,
29889,
440,
279,
29918,
27787,
29918,
1445,
29892,
13,
462,
462,
462,
462,
29871,
260,
3888,
29889,
440,
279,
29918,
2344,
29918,
1445,
29892,
260,
3888,
29889,
415,
342,
29918,
26050,
11285,
29918,
401,
29918,
1445,
29892,
1583,
29889,
397,
3511,
29889,
3893,
29892,
13,
462,
462,
462,
462,
29871,
260,
3888,
29889,
8172,
29918,
26776,
29892,
671,
29918,
23482,
29918,
4478,
29897,
13,
9651,
25342,
1583,
29889,
397,
3511,
29889,
3893,
1275,
525,
3921,
661,
2396,
13,
18884,
274,
353,
470,
601,
29889,
3396,
29889,
29873,
348,
261,
29889,
415,
342,
29918,
401,
1885,
29889,
5894,
29888,
3057,
3399,
15462,
29943,
441,
661,
29898,
22795,
29918,
2311,
29892,
260,
3888,
29889,
440,
279,
29918,
311,
25932,
29892,
260,
3888,
29889,
440,
279,
29918,
27787,
29918,
1445,
29892,
13,
462,
462,
462,
462,
308,
260,
3888,
29889,
440,
279,
29918,
2344,
29918,
1445,
29892,
260,
3888,
29889,
415,
342,
29918,
26050,
11285,
29918,
401,
29918,
1445,
29892,
1583,
29889,
397,
3511,
29889,
3893,
29892,
13,
462,
462,
462,
462,
308,
260,
3888,
29889,
8172,
29918,
26776,
29892,
671,
29918,
23482,
29918,
4478,
29897,
13,
9651,
1683,
29901,
13,
18884,
4589,
877,
3396,
29889,
29873,
348,
261,
29889,
29873,
348,
261,
29901,
29871,
9815,
1962,
4086,
6790,
29901,
1273,
29879,
29915,
1273,
1583,
29889,
397,
3511,
29889,
3893,
29897,
13,
539,
13,
9651,
19592,
401,
17397,
29889,
4397,
29898,
29883,
29897,
13,
13,
4706,
396,
1653,
278,
4180,
29899,
13424,
7156,
13,
4706,
282,
1594,
3511,
353,
470,
601,
29889,
3396,
29889,
29873,
348,
261,
29889,
415,
342,
29918,
9465,
29889,
5894,
29888,
3057,
12376,
29898,
1311,
29889,
29873,
3888,
29892,
671,
29918,
23482,
29918,
4478,
29892,
29871,
13,
462,
462,
462,
1669,
1583,
29889,
397,
3511,
29889,
3893,
29892,
29871,
13,
462,
462,
462,
1669,
274,
29889,
657,
14745,
3399,
29898,
1509,
29918,
23482,
29918,
4478,
876,
13,
13,
4706,
396,
679,
278,
9685,
2983,
322,
9685,
995,
20238,
304,
2755,
278,
2740,
2913,
13,
308,
13,
4706,
9685,
29918,
7039,
29892,
9685,
29918,
791,
29918,
29878,
6916,
353,
1583,
17255,
4282,
7967,
536,
3924,
29898,
29873,
3888,
29889,
407,
11269,
29918,
7529,
29892,
260,
3888,
29889,
9006,
1220,
29918,
7529,
29897,
13,
13,
4706,
5235,
877,
29995,
29879,
29915,
1273,
9685,
29918,
7039,
29897,
13,
4706,
5235,
877,
29995,
29879,
29915,
1273,
9685,
29918,
791,
29918,
29878,
6916,
29897,
13,
308,
13,
13,
4706,
396,
14405,
278,
4180,
3443,
11938,
13,
4706,
282,
3207,
29918,
13646,
353,
525,
5574,
29915,
13,
4706,
363,
325,
978,
29892,
29365,
297,
260,
3888,
29889,
407,
11269,
29918,
13646,
29879,
29901,
13,
9651,
282,
3207,
29918,
13646,
4619,
525,
322,
313,
29995,
29879,
16029,
1273,
29365,
13,
13,
4706,
396,
11200,
2254,
278,
2740,
6012,
770,
322,
10822,
372,
13,
308,
13,
4706,
565,
402,
2127,
1338,
2141,
735,
725,
29901,
13,
9651,
260,
3888,
29889,
4478,
29918,
284,
1484,
2433,
1252,
725,
29915,
13,
9651,
5235,
877,
27795,
297,
1273,
29879,
4464,
29915,
1273,
260,
3888,
29889,
4478,
29918,
284,
1484,
29897,
13,
9651,
5235,
877,
15156,
4128,
1273,
29879,
29915,
1273,
402,
2127,
1338,
2141,
2917,
29897,
13,
632,
13,
4706,
770,
29918,
978,
353,
260,
3888,
29889,
4478,
29918,
284,
1484,
13,
4706,
878,
29918,
978,
353,
15300,
4286,
7122,
4197,
1660,
1718,
3210,
29918,
6720,
29928,
29918,
5813,
29892,
770,
29918,
978,
29889,
13609,
3285,
770,
29918,
978,
29889,
13609,
580,
2314,
13,
4706,
2740,
29918,
1990,
353,
1583,
29889,
29881,
12657,
29889,
1359,
2385,
29898,
1545,
29918,
978,
29892,
770,
29918,
978,
29897,
13,
13,
4706,
396,
3588,
278,
2740,
931,
4046,
313,
3166,
6233,
304,
6923,
29897,
322,
679,
278,
3001,
1353,
310,
13,
4706,
396,
2740,
6057,
13,
4706,
2740,
29918,
2230,
29918,
13400,
353,
29871,
29953,
29900,
334,
260,
3888,
29889,
4478,
29918,
2230,
29918,
13400,
13,
4706,
2740,
29918,
7827,
29918,
3389,
29879,
353,
260,
3888,
29889,
4478,
29918,
7827,
29918,
3389,
29879,
13,
4706,
2740,
29918,
1509,
29918,
29920,
29941,
353,
260,
3888,
29889,
4478,
29918,
1509,
29918,
29920,
29941,
13,
4706,
2740,
29918,
690,
2017,
353,
260,
3888,
29889,
4478,
29918,
690,
2017,
13,
13,
4706,
396,
679,
278,
2740,
29899,
20567,
29899,
14940,
6273,
13,
4706,
2740,
29918,
25707,
353,
9657,
29898,
29873,
3888,
29889,
4478,
29918,
25707,
29897,
13,
308,
13,
4706,
396,
2189,
278,
4180,
18515,
292,
363,
1269,
8359,
1108,
2159,
13,
4706,
27545,
29918,
401,
29918,
11762,
353,
5159,
13,
4706,
363,
19592,
401,
1885,
297,
19592,
401,
17397,
29901,
13,
9651,
565,
402,
2127,
1338,
2141,
369,
15828,
29901,
13,
18884,
5235,
28909,
29876,
23648,
3380,
29190,
936,
18515,
292,
363,
1108,
2159,
448,
807,
1495,
13,
18884,
396,
20025,
343,
2286,
1024,
856,
451,
1854,
372,
29915,
29879,
2289,
5181,
13,
18884,
474,
7529,
353,
12705,
29898,
415,
401,
1885,
29889,
2080,
29918,
7529,
7503,
2314,
13,
18884,
363,
282,
978,
29892,
282,
1767,
297,
474,
7529,
29901,
13,
462,
1678,
5235,
877,
1273,
29879,
353,
1273,
29879,
29915,
1273,
313,
29886,
978,
29892,
282,
1767,
876,
13,
9651,
474,
7529,
353,
12705,
29898,
415,
401,
1885,
29889,
2080,
29918,
7529,
7503,
2314,
13,
9651,
363,
282,
978,
29892,
282,
1767,
297,
474,
7529,
29901,
13,
18884,
402,
2127,
1338,
2141,
19635,
1839,
2311,
29918,
29915,
718,
282,
978,
29962,
353,
282,
1767,
13,
13,
9651,
4744,
29898,
415,
401,
1885,
29889,
2080,
29918,
7529,
7503,
2314,
13,
9651,
396,
1653,
278,
2740,
6012,
13,
9651,
2740,
29918,
996,
353,
2740,
29918,
1990,
3319,
29915,
6854,
1431,
29879,
2396,
6854,
1431,
29879,
29892,
462,
268,
396,
775,
6910,
13,
462,
462,
539,
525,
8990,
29918,
7039,
2396,
8990,
29918,
7039,
29892,
632,
396,
4180,
3443,
2983,
13,
462,
462,
539,
525,
8990,
29918,
791,
29918,
29878,
6916,
2396,
8990,
29918,
791,
29918,
29878,
6916,
29892,
259,
396,
4180,
3443,
1819,
13,
462,
462,
539,
525,
407,
11269,
29918,
13646,
2396,
407,
11269,
29918,
13646,
29892,
13,
462,
462,
539,
525,
4478,
29918,
2230,
29918,
13400,
2396,
4478,
29918,
2230,
29918,
13400,
29892,
29871,
13,
462,
462,
539,
525,
4478,
29918,
7827,
29918,
3389,
29879,
2396,
4478,
29918,
7827,
29918,
3389,
29879,
29892,
29871,
13,
462,
462,
539,
525,
4478,
29918,
690,
2017,
2396,
4478,
29918,
690,
2017,
29892,
13,
462,
462,
539,
525,
4478,
29918,
25707,
2396,
4478,
29918,
25707,
29892,
13,
462,
462,
539,
525,
415,
401,
1885,
2396,
415,
401,
1885,
29892,
29871,
13,
462,
462,
539,
525,
415,
9465,
2396,
415,
9465,
29892,
525,
397,
3511,
2396,
1311,
29889,
397,
3511,
29892,
13,
462,
462,
539,
525,
1509,
29918,
23482,
29918,
4478,
2396,
1509,
29918,
23482,
29918,
4478,
29892,
13,
462,
462,
539,
525,
2080,
29918,
7529,
2396,
415,
401,
1885,
29889,
2080,
29918,
7529,
7503,
29962,
1800,
13,
13,
632,
13,
9651,
396,
2740,
363,
278,
1900,
4180,
4128,
13,
9651,
1900,
29918,
546,
29888,
29918,
7529,
29892,
1900,
29918,
546,
29888,
29918,
18253,
353,
2740,
29918,
996,
29889,
4478,
580,
13,
13,
9651,
396,
1962,
278,
1900,
4180,
4128,
13,
9651,
565,
402,
2127,
1338,
2141,
369,
15828,
322,
451,
402,
2127,
1338,
2141,
735,
725,
29901,
13,
18884,
5235,
877,
23648,
278,
7625,
1900,
4180,
4128,
448,
807,
1495,
13,
18884,
282,
7529,
353,
12705,
29898,
1761,
29898,
13318,
29918,
546,
29888,
29918,
7529,
29889,
7076,
22130,
13,
18884,
363,
282,
978,
29892,
282,
1767,
297,
282,
7529,
29901,
13,
462,
1678,
5235,
877,
1273,
29879,
353,
1273,
29879,
29915,
1273,
313,
29886,
978,
29892,
282,
1767,
876,
13,
308,
13,
9651,
396,
5706,
278,
27545,
775,
773,
278,
7625,
1900,
4180,
4128,
13,
9651,
565,
402,
2127,
1338,
2141,
735,
725,
29901,
13,
18884,
1900,
29918,
546,
29888,
29918,
7529,
29922,
29954,
2127,
1338,
2141,
2917,
13,
13,
9651,
4744,
703,
29961,
10893,
29889,
3396,
29889,
29873,
348,
261,
29889,
29873,
348,
261,
29962,
402,
2127,
1338,
2295,
29901,
1273,
29879,
29908,
1273,
851,
29898,
29954,
2127,
1338,
2141,
2917,
511,
5446,
29922,
1311,
29892,
3233,
29922,
29953,
29897,
13,
632,
13,
9651,
3151,
29918,
20640,
1891,
29918,
401,
29918,
11762,
353,
1583,
29889,
397,
3511,
29889,
20640,
675,
3399,
29943,
1431,
29879,
29898,
6854,
1431,
29879,
29892,
1900,
29918,
546,
29888,
29918,
7529,
29897,
13,
13,
9651,
396,
1423,
278,
27545,
775,
5665,
13,
9651,
565,
7431,
29898,
2764,
29918,
20640,
1891,
29918,
401,
29918,
11762,
29897,
2804,
29871,
29896,
29901,
13,
18884,
4589,
877,
10893,
29889,
3396,
29889,
29873,
348,
261,
7463,
1059,
29901,
278,
29190,
1711,
27545,
775,
2609,
1712,
2999,
6910,
1495,
13,
632,
13,
9651,
396,
679,
278,
27545,
775,
13,
9651,
27545,
29918,
401,
29892,
17117,
3622,
1338,
353,
3151,
29918,
20640,
1891,
29918,
401,
29918,
11762,
29961,
29900,
29962,
13,
13,
9651,
396,
4635,
6589,
964,
278,
27545,
775,
304,
3160,
2472,
1048,
29871,
13,
9651,
396,
278,
1900,
4180,
4128,
322,
278,
1881,
1108,
15786,
13,
9651,
474,
17199,
29918,
401,
353,
6629,
13,
9651,
474,
7529,
353,
12705,
29898,
415,
401,
1885,
29889,
2080,
29918,
7529,
7503,
2314,
13,
9651,
363,
282,
978,
29892,
282,
1767,
297,
474,
7529,
29901,
13,
18884,
565,
282,
978,
1275,
525,
1649,
16145,
1144,
1649,
2396,
13,
462,
1678,
6773,
13,
18884,
474,
17199,
29918,
401,
4619,
525,
29871,
1273,
29879,
353,
1273,
29879,
320,
29876,
29915,
1273,
313,
29886,
978,
29892,
282,
1767,
29897,
13,
9651,
282,
3207,
29918,
401,
353,
6629,
13,
9651,
282,
7529,
353,
12705,
29898,
1761,
29898,
13318,
29918,
546,
29888,
29918,
7529,
29889,
7076,
22130,
13,
9651,
363,
282,
978,
29892,
282,
1767,
297,
282,
7529,
29901,
13,
18884,
565,
282,
978,
1275,
525,
1649,
16145,
1144,
1649,
2396,
13,
462,
1678,
6773,
13,
18884,
282,
3207,
29918,
401,
4619,
525,
29871,
1273,
29879,
353,
1273,
29879,
320,
29876,
29915,
1273,
313,
29886,
978,
29892,
282,
1767,
29897,
13,
9651,
5235,
29918,
401,
353,
11297,
29876,
7918,
489,
313,
24565,
491,
438,
5378,
29897,
320,
29876,
29915,
13,
9651,
565,
451,
402,
2127,
1338,
2141,
735,
725,
29901,
13,
18884,
5235,
29918,
401,
4619,
525,
25353,
4180,
3438,
29901,
320,
29876,
29915,
13,
18884,
5235,
29918,
401,
4619,
525,
29871,
1273,
29879,
320,
29876,
29915,
1273,
1900,
29918,
546,
29888,
29918,
18253,
13,
9651,
5235,
29918,
401,
4619,
525,
29911,
348,
287,
363,
2702,
1108,
15786,
29901,
320,
29876,
29915,
13,
9651,
5235,
29918,
401,
4619,
474,
17199,
29918,
401,
13,
9651,
5235,
29918,
401,
4619,
525,
25353,
4180,
4128,
29901,
320,
29876,
29915,
13,
9651,
5235,
29918,
401,
4619,
282,
3207,
29918,
401,
13,
9651,
5235,
29918,
401,
4619,
525,
489,
1068,
7998,
29876,
29915,
13,
9651,
27545,
29918,
401,
353,
5235,
29918,
401,
718,
27545,
29918,
401,
13,
13,
9651,
396,
3787,
278,
27545,
363,
445,
1108,
2159,
13,
9651,
27545,
29918,
401,
29918,
11762,
29889,
4397,
3552,
20640,
1891,
29918,
401,
29892,
19592,
401,
1885,
29889,
2080,
29918,
7529,
7503,
1402,
3622,
1338,
876,
13,
13,
4706,
396,
736,
278,
27545,
775,
13,
4706,
736,
27545,
29918,
401,
29918,
11762,
13,
13,
1678,
396,
12230,
3519,
13,
1678,
396,
2683,
2683,
2683,
29899,
13,
13,
1678,
822,
4770,
21111,
29911,
27964,
3401,
29898,
1311,
29892,
775,
29892,
1196,
29918,
1217,
1125,
13,
4706,
14550,
5647,
1461,
18515,
292,
2472,
515,
278,
2183,
17195,
775,
12008,
13,
13,
4706,
396,
6088,
278,
775,
13,
4706,
1993,
29918,
5415,
353,
337,
29889,
4352,
29898,
29878,
29915,
3823,
29879,
29930,
5215,
29905,
29879,
29974,
6550,
29905,
29879,
29974,
4197,
29914,
29909,
29899,
29999,
29874,
29899,
29920,
29918,
10062,
416,
29905,
29879,
29394,
742,
775,
29897,
13,
13,
4706,
396,
565,
278,
775,
3743,
263,
2323,
1053,
3229,
13,
4706,
565,
1993,
29918,
5415,
29901,
13,
13,
9651,
396,
679,
278,
21992,
1024,
13,
9651,
1580,
29918,
978,
353,
1993,
29918,
5415,
29889,
2972,
29898,
29896,
29897,
13,
9651,
1580,
29918,
1445,
353,
1580,
29918,
978,
29974,
4286,
6550,
29915,
13,
9651,
1018,
29901,
13,
18884,
4765,
29918,
3972,
353,
8207,
4286,
7122,
29898,
1761,
29898,
29954,
2127,
1338,
2141,
4351,
29918,
1777,
264,
1280,
29889,
8149,
3101,
29961,
29900,
1822,
5451,
11219,
1495,
7503,
29899,
29896,
2314,
13,
18884,
1580,
29918,
1445,
29918,
2084,
353,
2897,
29889,
657,
29883,
9970,
580,
718,
8207,
29915,
718,
4765,
29918,
3972,
718,
8207,
29915,
718,
1580,
29918,
1445,
13,
18884,
285,
353,
1722,
29898,
6550,
29918,
1445,
29918,
2084,
29892,
525,
29878,
1495,
13,
18884,
260,
6550,
29918,
401,
353,
285,
29889,
949,
580,
13,
18884,
285,
29889,
5358,
580,
13,
9651,
5174,
29901,
13,
18884,
4589,
877,
29995,
29879,
29901,
2609,
1722,
934,
363,
5183,
29901,
1273,
29879,
29915,
1273,
313,
1311,
17255,
1990,
1649,
29892,
1580,
29918,
1445,
29918,
2084,
876,
13,
13,
9651,
18515,
292,
29918,
6550,
29918,
8977,
353,
470,
601,
29889,
3396,
29889,
1372,
3135,
29889,
1372,
3135,
29889,
9375,
3135,
2141,
5510,
9283,
29898,
1372,
3135,
29918,
401,
29897,
13,
13,
4706,
396,
565,
278,
18515,
292,
21992,
338,
2898,
29659,
964,
278,
2183,
775,
13,
4706,
25342,
775,
29889,
29880,
17010,
2141,
27382,
2541,
877,
6550,
29374,
13,
9651,
18515,
292,
29918,
6550,
29918,
8977,
353,
470,
601,
29889,
3396,
29889,
1372,
3135,
29889,
1372,
3135,
29889,
9375,
3135,
2141,
5510,
9283,
29898,
401,
29897,
13,
4706,
1683,
29901,
13,
9651,
396,
6088,
278,
21992,
775,
304,
679,
278,
18515,
292,
2472,
13,
9651,
18515,
292,
29918,
6550,
29918,
8977,
353,
470,
601,
29889,
3396,
29889,
1372,
3135,
29889,
1372,
3135,
29889,
9375,
3135,
2141,
5510,
10299,
29898,
401,
29892,
1196,
29918,
1217,
29897,
13,
13,
4706,
396,
736,
278,
18515,
292,
2472,
13,
4706,
736,
18515,
292,
29918,
6550,
29918,
8977,
13,
308,
13,
1678,
396,
2683,
2683,
2683,
29899,
13,
13,
1678,
822,
4770,
1761,
3596,
1523,
2109,
800,
29898,
1311,
29892,
19359,
29879,
1125,
13,
4706,
14550,
13,
4706,
1174,
11351,
599,
18240,
310,
278,
2183,
15602,
29889,
13,
3986,
321,
29889,
29887,
29889,
1881,
29901,
518,
1839,
29874,
3788,
29890,
7464,
29961,
29896,
29892,
29906,
5262,
6660,
518,
1839,
29874,
742,
29896,
1402,
1839,
29874,
742,
29906,
1402,
1839,
29890,
742,
29896,
1402,
1839,
29890,
742,
29906,
5262,
13,
4706,
14550,
13,
308,
13,
4706,
396,
278,
2967,
1206,
13,
4706,
565,
7431,
29898,
11762,
29879,
29897,
1275,
29871,
29900,
29901,
13,
9651,
736,
5159,
13,
308,
13,
4706,
396,
278,
16732,
4331,
13,
4706,
25053,
29918,
510,
5824,
353,
1583,
17255,
1761,
3596,
1523,
2109,
800,
29898,
11762,
29879,
29961,
29896,
29901,
2314,
13,
4706,
565,
25053,
29918,
510,
5824,
1275,
5159,
29901,
13,
9651,
25053,
29918,
510,
5824,
353,
518,
2636,
29962,
13,
4706,
4145,
29879,
353,
5159,
13,
4706,
363,
474,
297,
19359,
29879,
29961,
29900,
5387,
13,
9651,
363,
274,
297,
25053,
29918,
510,
5824,
29901,
13,
18884,
4145,
29879,
29889,
4397,
4197,
29875,
29962,
718,
274,
29897,
13,
462,
13,
4706,
396,
736,
278,
18240,
13,
4706,
736,
4145,
29879,
13,
268,
13,
1678,
396,
2683,
2683,
2683,
29899,
13,
13,
1678,
822,
4770,
657,
26604,
29903,
7093,
29898,
1311,
29892,
474,
3207,
29918,
7529,
29892,
474,
3207,
29918,
13646,
29879,
1125,
13,
4706,
14550,
11609,
599,
2854,
1108,
15786,
12008,
13,
13,
4706,
396,
14405,
278,
1881,
3443,
11938,
13,
4706,
474,
3207,
29918,
13646,
353,
525,
5574,
29915,
13,
4706,
363,
325,
978,
29892,
29365,
297,
474,
3207,
29918,
13646,
29879,
29901,
13,
9651,
474,
3207,
29918,
13646,
4619,
525,
322,
313,
29995,
29879,
16029,
1273,
29365,
13,
13,
4706,
396,
10272,
599,
1950,
18240,
310,
1108,
15786,
13,
4706,
2070,
29918,
29879,
7093,
353,
5159,
13,
4706,
282,
7039,
29892,
282,
791,
893,
353,
1051,
29898,
7554,
10456,
666,
11269,
29918,
7529,
876,
13,
4706,
363,
282,
791,
29879,
297,
1583,
17255,
1761,
3596,
1523,
2109,
800,
29898,
29886,
791,
893,
1125,
13,
9651,
2070,
29918,
29879,
7093,
29889,
4397,
29898,
1761,
29898,
7554,
29898,
29886,
7039,
29892,
282,
791,
29879,
4961,
13,
13,
4706,
396,
19060,
599,
8340,
1108,
15786,
13,
4706,
302,
29918,
22795,
29918,
29879,
7093,
353,
5159,
13,
4706,
363,
282,
297,
2070,
29918,
29879,
7093,
29901,
13,
9651,
1018,
29901,
13,
18884,
338,
29918,
3084,
353,
19745,
29898,
666,
11269,
29918,
13646,
29892,
9657,
29898,
29886,
876,
13,
9651,
5174,
8960,
408,
321,
29901,
13,
18884,
4589,
877,
10893,
29889,
3396,
29889,
29873,
348,
261,
29889,
29873,
348,
261,
16664,
29879,
29901,
5229,
304,
14707,
278,
1881,
3443,
7276,
4603,
29905,
29876,
6660,
1273,
29879,
29901,
1273,
29879,
29915,
1273,
29871,
313,
666,
11269,
29918,
13646,
29892,
29872,
17255,
1990,
1649,
17255,
978,
1649,
29892,
321,
876,
13,
9651,
565,
338,
29918,
3084,
29901,
13,
18884,
302,
29918,
22795,
29918,
29879,
7093,
29889,
4397,
29898,
29886,
29897,
13,
4706,
2070,
29918,
29879,
7093,
353,
302,
29918,
22795,
29918,
29879,
7093,
13,
13,
4706,
396,
1423,
565,
278,
716,
1108,
15786,
338,
4069,
13,
4706,
565,
7431,
29898,
22795,
29918,
29879,
7093,
29897,
1275,
29871,
29900,
29901,
13,
9651,
4589,
877,
10893,
29889,
3396,
29889,
29873,
348,
261,
29889,
29873,
348,
261,
29901,
694,
2854,
1108,
15786,
1863,
29889,
3113,
1423,
278,
1881,
3443,
525,
718,
13,
462,
259,
525,
13646,
29879,
1495,
13,
308,
13,
4706,
396,
736,
599,
1950,
18240,
310,
1108,
15786,
13,
4706,
736,
2070,
29918,
29879,
7093,
13,
13,
1678,
396,
2683,
2683,
2683,
29899,
13,
13,
1678,
822,
4770,
4282,
7967,
536,
3924,
29898,
1311,
29892,
23895,
29918,
7529,
29892,
9920,
1220,
29918,
7529,
1125,
13,
4706,
14550,
11609,
2472,
1048,
278,
14821,
6757,
393,
2755,
278,
2740,
2913,
12008,
13,
13,
4706,
4744,
703,
29933,
25282,
4214,
4810,
25593,
28962,
1254,
12665,
613,
5446,
29922,
1311,
29892,
5563,
29922,
29941,
29897,
13,
13,
4706,
396,
679,
278,
9685,
2983,
322,
9685,
995,
20238,
13,
4706,
9685,
29918,
7039,
353,
5159,
13,
4706,
9685,
29918,
791,
29918,
29878,
6916,
353,
5159,
13,
4706,
363,
282,
978,
29892,
544,
927,
297,
23895,
29918,
7529,
29901,
13,
9651,
9685,
29918,
7039,
29889,
4397,
29898,
29886,
978,
29897,
13,
9651,
396,
350,
29940,
29901,
2020,
373,
8437,
723,
4856,
437,
445,
8773,
28772,
13,
9651,
396,
9685,
29918,
791,
29918,
29878,
6916,
29889,
4397,
29898,
1311,
17255,
6605,
29898,
558,
927,
876,
13,
9651,
9685,
29918,
791,
29918,
29878,
6916,
29889,
4397,
29898,
558,
927,
29897,
13,
13,
4706,
363,
282,
978,
29892,
544,
927,
297,
9920,
1220,
29918,
7529,
29901,
13,
9651,
9685,
29918,
7039,
29889,
4397,
877,
1649,
9006,
1220,
29918,
29915,
718,
282,
978,
29897,
13,
9651,
9685,
29918,
791,
29918,
29878,
6916,
29889,
4397,
29898,
558,
927,
29897,
13,
13,
4706,
1583,
29889,
1949,
29918,
7529,
29922,
2435,
29898,
8990,
29918,
7039,
29897,
13,
4706,
1583,
29889,
1949,
29918,
2917,
29879,
29922,
29896,
13,
4706,
1583,
29889,
1949,
29918,
2109,
29922,
29900,
13,
4706,
1583,
29889,
1949,
29918,
29883,
20440,
936,
353,
29871,
29900,
13,
4706,
1583,
29889,
1949,
29918,
524,
29922,
1311,
29889,
1949,
29918,
7529,
13,
13,
4706,
282,
1853,
29922,
2636,
13,
4706,
363,
659,
29879,
297,
9685,
29918,
791,
29918,
29878,
6916,
29901,
13,
9651,
1583,
29889,
1949,
29918,
2917,
29879,
29922,
1311,
29889,
1949,
29918,
2917,
29879,
29930,
2435,
29898,
791,
29879,
29897,
13,
9651,
282,
1853,
29889,
4397,
877,
29902,
1495,
13,
9651,
565,
1134,
29898,
791,
29879,
29961,
29900,
2314,
1275,
6120,
29901,
13,
18884,
1583,
29889,
1949,
29918,
2109,
29922,
1311,
29889,
1949,
29918,
2109,
29974,
29896,
13,
18884,
282,
1853,
29961,
2435,
29898,
415,
668,
6817,
29896,
13192,
877,
29933,
1495,
13,
9651,
565,
1134,
29898,
791,
29879,
29961,
29900,
2314,
1275,
851,
29901,
13,
18884,
1583,
29889,
1949,
29918,
29883,
20440,
936,
353,
1583,
29889,
1949,
29918,
29883,
20440,
936,
29974,
29896,
13,
13,
4706,
1583,
29889,
1949,
29918,
524,
22361,
1583,
29889,
1949,
29918,
2109,
13,
4706,
1583,
29889,
1949,
29918,
524,
22361,
1583,
29889,
1949,
29918,
29883,
20440,
936,
13,
13,
4706,
5235,
877,
7974,
29918,
14936,
965,
353,
1273,
29896,
29889,
29941,
29872,
29915,
1273,
1583,
29889,
1949,
29918,
2917,
29879,
29897,
13,
4706,
5235,
877,
4557,
29918,
974,
29918,
11507,
259,
353,
1273,
29900,
29906,
29881,
29915,
1273,
1583,
29889,
1949,
29918,
7529,
29897,
13,
4706,
5235,
877,
29940,
25099,
29918,
11507,
268,
353,
1273,
29900,
29906,
29881,
29915,
1273,
1583,
29889,
1949,
29918,
524,
29897,
13,
4706,
5235,
877,
25196,
29918,
11507,
418,
353,
1273,
29900,
29906,
29881,
29915,
1273,
1583,
29889,
1949,
29918,
2109,
29897,
13,
4706,
5235,
877,
29907,
20440,
936,
29918,
11507,
353,
1273,
29900,
29906,
29881,
29915,
1273,
1583,
29889,
1949,
29918,
29883,
20440,
936,
29897,
13,
308,
13,
4706,
10876,
29889,
303,
20405,
29889,
3539,
877,
29995,
29879,
29905,
29876,
29915,
29995,
402,
2127,
1338,
2141,
2917,
1445,
29897,
13,
13,
4706,
736,
313,
8990,
29918,
7039,
29892,
9685,
29918,
791,
29918,
29878,
6916,
29897,
13,
13,
2
] |
libcloud/extra/drivers/google.py | Scalr/libcloud | 0 | 42226 | <gh_stars>0
# 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.
"""
Module for Google Big Data Drivers.
"""
from libcloud.extra.drivers.google_bq_utils import QueryJob
from libcloud.common.google import GoogleAuthType, GoogleBaseConnection
from libcloud.common.base import BaseDriver
API_VERSION = 'v2'
class BQConnection(GoogleBaseConnection):
"""
Connection class for the BQ driver.
"""
def __init__(self, user_id, key, secure=None, auth_type=None, credential_file=None, **kwargs):
project = kwargs.pop('project')
super(BQConnection, self).__init__(user_id, key, secure=secure, auth_type=auth_type,
credential_file=credential_file, **kwargs)
self.request_path = '/bigquery/%s/projects/%s' % (API_VERSION, project)
class BigQuery(BaseDriver):
""" Google Big Query client """
connectionCls = BQConnection
api_name = 'google'
name = 'Big Query'
default_scopes = ['https://www.googleapis.com/auth/bigquery',
'https://www.googleapis.com/auth/bigquery.insertdata',
'https://www.googleapis.com/auth/cloud-platform.read-only',
'https://www.googleapis.com/auth/devstorage.full_control',
'https://www.googleapis.com/auth/devstorage.read_only',
'https://www.googleapis.com/auth/devstorage.read_write']
def __init__(self, user_id, key, project, **kwargs):
"""
:param user_id: The email address (for service accounts) or Client ID
(for installed apps) to be used for authentication.
:type user_id: ``str``
:param key: The RSA Key (for service accounts) or file path containing
key or Client Secret (for installed apps) to be used for
authentication.
:type key: ``str``
:keyword project: Your project name. (required)
:type project: ``str``
:keyword auth_type: Accepted values are "SA" or "IA" or "GCE"
("Service Account" or "Installed Application" or
"GCE" if libcloud is being used on a GCE instance
with service account enabled).
If not supplied, auth_type will be guessed based
on value of user_id or if the code is being
executed in a GCE instance.
:type auth_type: ``str``
:keyword scopes: List of authorization URLs. Default is empty and
grants read/write to Compute, Storage, DNS.
:type scopes: ``list``
"""
self.project = project
if 'auth_type' not in kwargs:
kwargs['auth_type'] = GoogleAuthType.SA
self.scopes = kwargs.get('scopes', self.default_scopes)
super(BigQuery, self).__init__(user_id, key, **kwargs)
def _ex_connection_class_kwargs(self):
"""
Add extra parameters to auth request
"""
res = super(BigQuery, self)._ex_connection_class_kwargs()
res['project'] = self.project
res['scopes'] = self.scopes
return res
def list_datasets(self):
"""
Get list of datasets
Api reference: https://cloud.google.com/bigquery/docs/reference/rest/v2/datasets/list
:return: list of dicts. Each dict contains two keys 'datasetId' and 'projectId'
"""
request = '/datasets'
response = self.connection.request(request, method='GET').object
return [l['datasetReference'] for l in response['datasets']]
def list_tables(self, dataset_id):
"""
Get list of tables for dataset
Api reference: https://cloud.google.com/bigquery/docs/reference/rest/v2/tables/list
:param dataset_id: str. Id of dataset.
:return: list of dicts. Each dict contains next keys 'datasetId', 'projectId' and 'tableId'
"""
request = '/datasets/%s/tables' % dataset_id
response = self.connection.request(request, method='GET').object
return [l['tableReference'] for l in response['tables']]
def query(self, query, max_results=50000, timeout_ms=60000, use_legacy_sql=False):
"""
Execute query and return result. Result will be chunked.
Reference: https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/query
:param query: str. BQ query. Example: SELECT * FROM {billing_table} LIMIT 1
:param max_results: int. Page size
:param timeout_ms: int. Max execution time. Default 1 min
:param use_legacy_sql: bool. Specifies whether to use BigQuery's legacy SQL dialect for this query.
:return: dict which represent row from result
"""
request = '/queries'
data = {'query': query,
'useLegacySql': use_legacy_sql,
'maxResults': max_results,
'timeoutMs': timeout_ms}
response = self.connection.request(request, method='POST', data=data).object
query_job = QueryJob(response)
return self._get_job_results(query_job, max_results, timeout_ms)
def _get_job_results(self, query_job, max_results, timeout_ms):
"""
Deal with paginated QueryJob results
Reference: https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/getQueryResults
:param query_job: query job object
:return: generator over rows
"""
while True:
for row in query_job.rows:
yield row
if not query_job.page_token:
# last page
break
# next request
data = {
'maxResults': max_results,
'pageToken': query_job.page_token,
'timeoutMs': timeout_ms
}
request = '/queries/' + query_job.job_id
response = self.connection.request(request, method='GET', params=data).object
query_job = QueryJob(response)
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
29937,
10413,
21144,
304,
278,
13380,
18540,
10606,
313,
3289,
29943,
29897,
1090,
697,
470,
901,
13,
29937,
17737,
3406,
19405,
8571,
4110,
29889,
29871,
2823,
278,
6058,
12107,
934,
13235,
411,
13,
29937,
445,
664,
363,
5684,
2472,
11211,
3509,
1266,
27428,
29889,
13,
29937,
450,
3339,
29943,
7794,
11259,
445,
934,
304,
887,
1090,
278,
13380,
19245,
29892,
10079,
29871,
29906,
29889,
29900,
13,
29937,
313,
1552,
376,
29931,
293,
1947,
1496,
366,
1122,
451,
671,
445,
934,
5174,
297,
752,
13036,
411,
13,
29937,
278,
19245,
29889,
29871,
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,
13,
13,
15945,
29908,
13,
7355,
363,
5087,
7997,
3630,
360,
374,
874,
29889,
13,
15945,
29908,
13,
3166,
4303,
9274,
29889,
17833,
29889,
24477,
874,
29889,
3608,
29918,
29890,
29939,
29918,
13239,
1053,
13641,
11947,
13,
3166,
4303,
9274,
29889,
9435,
29889,
3608,
1053,
5087,
6444,
1542,
29892,
5087,
5160,
5350,
13,
3166,
4303,
9274,
29889,
9435,
29889,
3188,
1053,
7399,
12376,
13,
13,
8787,
29918,
16358,
353,
525,
29894,
29906,
29915,
13,
13,
13,
1990,
350,
29984,
5350,
29898,
14207,
5160,
5350,
1125,
13,
1678,
9995,
13,
1678,
15160,
770,
363,
278,
350,
29984,
7156,
29889,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1404,
29918,
333,
29892,
1820,
29892,
11592,
29922,
8516,
29892,
4817,
29918,
1853,
29922,
8516,
29892,
6625,
2556,
29918,
1445,
29922,
8516,
29892,
3579,
19290,
1125,
13,
13,
4706,
2060,
353,
9049,
5085,
29889,
7323,
877,
4836,
1495,
13,
13,
4706,
2428,
29898,
29933,
29984,
5350,
29892,
1583,
467,
1649,
2344,
12035,
1792,
29918,
333,
29892,
1820,
29892,
11592,
29922,
24216,
29892,
4817,
29918,
1853,
29922,
5150,
29918,
1853,
29892,
13,
462,
462,
965,
6625,
2556,
29918,
1445,
29922,
11944,
2556,
29918,
1445,
29892,
3579,
19290,
29897,
13,
4706,
1583,
29889,
3827,
29918,
2084,
353,
8207,
3752,
1972,
22584,
29879,
29914,
16418,
22584,
29879,
29915,
1273,
313,
8787,
29918,
16358,
29892,
2060,
29897,
13,
13,
13,
1990,
7997,
3010,
29898,
5160,
12376,
1125,
13,
1678,
9995,
5087,
7997,
13641,
3132,
9995,
13,
13,
1678,
3957,
29907,
3137,
353,
350,
29984,
5350,
13,
1678,
7882,
29918,
978,
353,
525,
3608,
29915,
13,
1678,
1024,
353,
525,
6970,
13641,
29915,
13,
1678,
2322,
29918,
21785,
267,
353,
6024,
991,
597,
1636,
29889,
15947,
29889,
510,
29914,
5150,
29914,
3752,
1972,
742,
13,
462,
418,
525,
991,
597,
1636,
29889,
15947,
29889,
510,
29914,
5150,
29914,
3752,
1972,
29889,
7851,
1272,
742,
13,
462,
418,
525,
991,
597,
1636,
29889,
15947,
29889,
510,
29914,
5150,
29914,
9274,
29899,
12120,
29889,
949,
29899,
6194,
742,
13,
462,
418,
525,
991,
597,
1636,
29889,
15947,
29889,
510,
29914,
5150,
29914,
3359,
12925,
29889,
8159,
29918,
6451,
742,
13,
462,
418,
525,
991,
597,
1636,
29889,
15947,
29889,
510,
29914,
5150,
29914,
3359,
12925,
29889,
949,
29918,
6194,
742,
13,
462,
418,
525,
991,
597,
1636,
29889,
15947,
29889,
510,
29914,
5150,
29914,
3359,
12925,
29889,
949,
29918,
3539,
2033,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1404,
29918,
333,
29892,
1820,
29892,
2060,
29892,
3579,
19290,
1125,
13,
4706,
9995,
13,
4706,
584,
3207,
29871,
1404,
29918,
333,
29901,
450,
4876,
3211,
313,
1454,
2669,
15303,
29897,
470,
12477,
3553,
13,
462,
308,
313,
1454,
5130,
11446,
29897,
304,
367,
1304,
363,
10760,
29889,
13,
4706,
584,
1853,
259,
1404,
29918,
333,
29901,
4954,
710,
16159,
13,
13,
4706,
584,
3207,
29871,
1820,
29901,
450,
390,
8132,
7670,
313,
1454,
2669,
15303,
29897,
470,
934,
2224,
6943,
13,
462,
268,
1820,
470,
12477,
10213,
313,
1454,
5130,
11446,
29897,
304,
367,
1304,
363,
13,
462,
268,
10760,
29889,
13,
4706,
584,
1853,
259,
1820,
29901,
4954,
710,
16159,
13,
13,
4706,
584,
26766,
29871,
2060,
29901,
3575,
29871,
2060,
1024,
29889,
313,
12403,
29897,
13,
4706,
584,
1853,
268,
2060,
29901,
4954,
710,
16159,
13,
13,
4706,
584,
26766,
29871,
4817,
29918,
1853,
29901,
29848,
287,
1819,
526,
376,
8132,
29908,
470,
376,
10764,
29908,
470,
376,
29954,
4741,
29908,
13,
462,
632,
4852,
3170,
16535,
29908,
470,
376,
3379,
4212,
8427,
29908,
470,
13,
462,
632,
376,
29954,
4741,
29908,
565,
4303,
9274,
338,
1641,
1304,
373,
263,
402,
4741,
2777,
13,
462,
632,
411,
2669,
3633,
9615,
467,
13,
462,
632,
960,
451,
19056,
29892,
4817,
29918,
1853,
674,
367,
4140,
287,
2729,
13,
462,
632,
373,
995,
310,
1404,
29918,
333,
470,
565,
278,
775,
338,
1641,
13,
462,
632,
8283,
297,
263,
402,
4741,
2777,
29889,
13,
4706,
584,
1853,
268,
4817,
29918,
1853,
29901,
4954,
710,
16159,
13,
13,
4706,
584,
26766,
29871,
16505,
267,
29901,
2391,
310,
28733,
24295,
29889,
13109,
338,
4069,
322,
13,
462,
3986,
867,
1934,
1303,
29914,
3539,
304,
11796,
29872,
29892,
26162,
29892,
16332,
29889,
13,
4706,
584,
1853,
268,
16505,
267,
29901,
4954,
1761,
16159,
13,
4706,
9995,
13,
4706,
1583,
29889,
4836,
353,
2060,
13,
4706,
565,
525,
5150,
29918,
1853,
29915,
451,
297,
9049,
5085,
29901,
13,
9651,
9049,
5085,
1839,
5150,
29918,
1853,
2033,
353,
5087,
6444,
1542,
29889,
8132,
13,
13,
4706,
1583,
29889,
21785,
267,
353,
9049,
5085,
29889,
657,
877,
21785,
267,
742,
1583,
29889,
4381,
29918,
21785,
267,
29897,
13,
4706,
2428,
29898,
6970,
3010,
29892,
1583,
467,
1649,
2344,
12035,
1792,
29918,
333,
29892,
1820,
29892,
3579,
19290,
29897,
13,
13,
1678,
822,
903,
735,
29918,
9965,
29918,
1990,
29918,
19290,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
3462,
4805,
4128,
304,
4817,
2009,
13,
4706,
9995,
13,
4706,
620,
353,
2428,
29898,
6970,
3010,
29892,
1583,
467,
29918,
735,
29918,
9965,
29918,
1990,
29918,
19290,
580,
13,
4706,
620,
1839,
4836,
2033,
353,
1583,
29889,
4836,
13,
4706,
620,
1839,
21785,
267,
2033,
353,
1583,
29889,
21785,
267,
13,
4706,
736,
620,
13,
13,
1678,
822,
1051,
29918,
14538,
1691,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
3617,
1051,
310,
20035,
13,
4706,
29749,
3407,
29901,
2045,
597,
9274,
29889,
3608,
29889,
510,
29914,
3752,
1972,
29914,
2640,
29914,
5679,
29914,
5060,
29914,
29894,
29906,
29914,
14538,
1691,
29914,
1761,
13,
13,
4706,
584,
2457,
29901,
1051,
310,
9657,
29879,
29889,
7806,
9657,
3743,
1023,
6611,
525,
24713,
1204,
29915,
322,
525,
4836,
1204,
29915,
13,
4706,
9995,
13,
4706,
2009,
353,
8207,
14538,
1691,
29915,
13,
4706,
2933,
353,
1583,
29889,
9965,
29889,
3827,
29898,
3827,
29892,
1158,
2433,
7194,
2824,
3318,
13,
4706,
736,
518,
29880,
1839,
24713,
7422,
2033,
363,
301,
297,
2933,
1839,
14538,
1691,
2033,
29962,
13,
13,
1678,
822,
1051,
29918,
24051,
29898,
1311,
29892,
8783,
29918,
333,
1125,
13,
4706,
9995,
13,
4706,
3617,
1051,
310,
6131,
363,
8783,
13,
4706,
29749,
3407,
29901,
2045,
597,
9274,
29889,
3608,
29889,
510,
29914,
3752,
1972,
29914,
2640,
29914,
5679,
29914,
5060,
29914,
29894,
29906,
29914,
24051,
29914,
1761,
13,
13,
4706,
584,
3207,
8783,
29918,
333,
29901,
851,
29889,
5163,
310,
8783,
29889,
13,
4706,
584,
2457,
29901,
1051,
310,
9657,
29879,
29889,
7806,
9657,
3743,
2446,
6611,
525,
24713,
1204,
742,
525,
4836,
1204,
29915,
322,
525,
2371,
1204,
29915,
13,
4706,
9995,
13,
4706,
2009,
353,
8207,
14538,
1691,
22584,
29879,
29914,
24051,
29915,
1273,
8783,
29918,
333,
13,
4706,
2933,
353,
1583,
29889,
9965,
29889,
3827,
29898,
3827,
29892,
1158,
2433,
7194,
2824,
3318,
13,
4706,
736,
518,
29880,
1839,
2371,
7422,
2033,
363,
301,
297,
2933,
1839,
24051,
2033,
29962,
13,
13,
1678,
822,
2346,
29898,
1311,
29892,
2346,
29892,
4236,
29918,
9902,
29922,
29945,
29900,
29900,
29900,
29900,
29892,
11815,
29918,
1516,
29922,
29953,
29900,
29900,
29900,
29900,
29892,
671,
29918,
1397,
4135,
29918,
2850,
29922,
8824,
1125,
13,
4706,
9995,
13,
4706,
11080,
1082,
2346,
322,
736,
1121,
29889,
7867,
674,
367,
19875,
287,
29889,
13,
13,
4706,
12105,
29901,
2045,
597,
9274,
29889,
3608,
29889,
510,
29914,
3752,
1972,
29914,
2640,
29914,
5679,
29914,
5060,
29914,
29894,
29906,
29914,
9057,
29879,
29914,
1972,
13,
13,
4706,
584,
3207,
2346,
29901,
851,
29889,
350,
29984,
2346,
29889,
8741,
29901,
5097,
334,
3895,
426,
29890,
8873,
29918,
2371,
29913,
27848,
29871,
29896,
13,
4706,
584,
3207,
4236,
29918,
9902,
29901,
938,
29889,
9305,
2159,
13,
4706,
584,
3207,
11815,
29918,
1516,
29901,
938,
29889,
5918,
8225,
931,
29889,
13109,
29871,
29896,
1375,
13,
4706,
584,
3207,
671,
29918,
1397,
4135,
29918,
2850,
29901,
6120,
29889,
12048,
11057,
3692,
304,
671,
7997,
3010,
29915,
29879,
25000,
3758,
23725,
363,
445,
2346,
29889,
13,
13,
4706,
584,
2457,
29901,
9657,
607,
2755,
1948,
515,
1121,
13,
4706,
9995,
13,
4706,
2009,
353,
8207,
339,
6358,
29915,
13,
4706,
848,
353,
11117,
1972,
2396,
2346,
29892,
13,
18884,
525,
1509,
22988,
4135,
10520,
2396,
671,
29918,
1397,
4135,
29918,
2850,
29892,
13,
18884,
525,
3317,
12191,
2396,
4236,
29918,
9902,
29892,
13,
18884,
525,
15619,
29924,
29879,
2396,
11815,
29918,
1516,
29913,
13,
4706,
2933,
353,
1583,
29889,
9965,
29889,
3827,
29898,
3827,
29892,
1158,
2433,
5438,
742,
848,
29922,
1272,
467,
3318,
13,
4706,
2346,
29918,
9057,
353,
13641,
11947,
29898,
5327,
29897,
13,
4706,
736,
1583,
3032,
657,
29918,
9057,
29918,
9902,
29898,
1972,
29918,
9057,
29892,
4236,
29918,
9902,
29892,
11815,
29918,
1516,
29897,
13,
13,
1678,
822,
903,
657,
29918,
9057,
29918,
9902,
29898,
1311,
29892,
2346,
29918,
9057,
29892,
4236,
29918,
9902,
29892,
11815,
29918,
1516,
1125,
13,
4706,
9995,
13,
4706,
897,
284,
411,
10203,
262,
630,
13641,
11947,
2582,
13,
13,
4706,
12105,
29901,
2045,
597,
9274,
29889,
3608,
29889,
510,
29914,
3752,
1972,
29914,
2640,
29914,
5679,
29914,
5060,
29914,
29894,
29906,
29914,
9057,
29879,
29914,
657,
3010,
12191,
13,
13,
4706,
584,
3207,
2346,
29918,
9057,
29901,
2346,
4982,
1203,
13,
13,
4706,
584,
2457,
29901,
15299,
975,
4206,
13,
4706,
9995,
13,
4706,
1550,
5852,
29901,
13,
9651,
363,
1948,
297,
2346,
29918,
9057,
29889,
5727,
29901,
13,
18884,
7709,
1948,
13,
13,
9651,
565,
451,
2346,
29918,
9057,
29889,
3488,
29918,
6979,
29901,
13,
18884,
396,
1833,
1813,
13,
18884,
2867,
13,
13,
9651,
396,
2446,
2009,
13,
9651,
848,
353,
426,
13,
18884,
525,
3317,
12191,
2396,
4236,
29918,
9902,
29892,
13,
18884,
525,
3488,
6066,
2396,
2346,
29918,
9057,
29889,
3488,
29918,
6979,
29892,
13,
18884,
525,
15619,
29924,
29879,
2396,
11815,
29918,
1516,
13,
9651,
500,
13,
9651,
2009,
353,
8207,
339,
6358,
22208,
718,
2346,
29918,
9057,
29889,
9057,
29918,
333,
13,
13,
9651,
2933,
353,
1583,
29889,
9965,
29889,
3827,
29898,
3827,
29892,
1158,
2433,
7194,
742,
8636,
29922,
1272,
467,
3318,
13,
13,
9651,
2346,
29918,
9057,
353,
13641,
11947,
29898,
5327,
29897,
13,
2
] |
ed2d/mesh.py | explosiveduck/cubix | 1 | 1612026 | <filename>ed2d/mesh.py<gh_stars>1-10
from gem import matrix
from gem import vector
from ed2d.opengl import gl, pgl
from ed2d.assets import objloader
def buffer_object(data, typeM):
if data or 0:
vbo = pgl.glGenBuffers(1)
gl.glBindBuffer(gl.GL_ARRAY_BUFFER, vbo)
pgl.glBufferData(gl.GL_ARRAY_BUFFER, data, typeM, gl.GL_STATIC_DRAW)
gl.glBindBuffer(gl.GL_ARRAY_BUFFER, 0)
return vbo
else:
return None
def index_buffer_object(data, typeM):
if data or 0:
ibo = pgl.glGenBuffers(1)
gl.glBindBuffer(gl.GL_ELEMENT_ARRAY_BUFFER, ibo)
pgl.glBufferData(gl.GL_ELEMENT_ARRAY_BUFFER, data, typeM,
gl.GL_STATIC_DRAW)
gl.glBindBuffer(gl.GL_ELEMENT_ARRAY_BUFFER, 0)
return ibo
else:
return None
def bind_object(dataLoc, vbo, size):
if (dataLoc is not None) and (vbo is not None):
gl.glEnableVertexAttribArray(dataLoc)
gl.glBindBuffer(gl.GL_ARRAY_BUFFER, vbo)
pgl.glVertexAttribPointer(dataLoc, size, gl.GL_FLOAT, gl.GL_FALSE, 0,
None)
else:
pass
def unbind_object(dataLoc):
if dataLoc is not None:
gl.glBindBuffer(gl.GL_ARRAY_BUFFER, 0)
gl.glDisableVertexAttribArray(dataLoc)
else:
pass
def calc_face_normal(vertex1, vertex2, vertex3):
''' Calculate a face normal from 3 vertices. 3D Vector inputs. '''
vertex11 = vertex2 - vertex1
vertex22 = vertex3 - vertex1
normal = vertex11.cross(vertex22)
normal.i_normalize()
return normal
# Conver matrix 4x4 to 3x3
def convertM4to3(mat):
''' Convert a 4x4 Matrix to 3x3. '''
temp = [[0.0, 0.0, 0.0],
[0.0, 0.0, 0.0],
[0.0, 0.0, 0.0]]
for i in range(3):
for j in range(3):
temp[i][j] = mat[i][j]
out = matrix.Matrix(3)
out.matrix = temp
return out
class Indexer(object):
''' This is needed for CSG.'''
def __init__(self):
self.unique = []
self.indices = []
self.map = {}
def add(self, obj):
key = repr(obj)
if not (key in self.map):
self.map[key] = len(self.unique)
self.unique.append(obj)
return self.map[key]
class MeshBase(object):
def __init__(self):
self.program = None
self.vertLoc = None
self.UVLoc = None
self.colorLoc = None
self.normLoc = None
self.modelID = None
self.texture = None
self.obj2world = matrix.Matrix(4)
self.matrix = matrix.Matrix(4) # Model matrix
self.modelInverseTranspose = matrix.Matrix(4)
self.vbos = []
self.cbos = []
self.nbos = []
def addProgram(self, program):
self.program = program
self.vertLoc = self.program.get_attribute(b'vertexPosition_modelspace')
self.normLoc = self.program.get_attribute(b'normal_modelspace')
#self.UVLoc = self.program.get_attribute(b'vertexUV')
self.colorLoc = self.program.get_attribute(b'vertexColor')
self.modelID = self.program.new_uniform(b'model_matrix')
self.invModelLoc = self.program.new_uniform(b'gMdVw')
def render(self):
self.program.set_uniform_matrix(self.modelID, self.matrix)
self.program.set_uniform_matrix(self.invModelLoc, self.modelInverseTranspose)
i = 0
for key in self.materials:
try:
bind_object(self.vertLoc, self.vbos[i], 3)
bind_object(self.normLoc, self.nbos[i], 3)
bind_object(self.colorLoc, self.cbos[i], 3)
gl.glDrawArrays(gl.GL_TRIANGLES, 0, len(self.verData[key]))
unbind_object(self.colorLoc)
unbind_object(self.normLoc)
unbind_object(self.vertLoc)
i += 1
except KeyError:
pass
def buffer_objects(self):
if self.importedModel:
for key in self.materials:
try:
self.vbos.append(buffer_object(self.verData[key], gl.GLfloat))
self.nbos.append(buffer_object(self.norData[key], gl.GLfloat))
self.cbos.append(buffer_object(self.colData[key], gl.GLfloat))
except KeyError:
pass
else:
self.vbo = buffer_object(self.vertices, gl.GLfloat)
self.uvbo = buffer_object(self.texCoord, gl.GLfloat)
self.ibo = index_buffer_object(self.triangles, gl.GLuint)
class Mesh(MeshBase):
def __init__(self):
super(Mesh, self).__init__()
self.xPos = 0
self.yPos = 0
self.zPos = 0
self.xPosDelta = 0
self.yPosDelta = 0
self.zPosDelta = 0
self._scale = 1
self.scaleDelta = 0
self.verData = {}
self.norData = {}
self.colData = {}
self.rect = None
self.nverts = 0
self.ntris = 0
self.vertices = []
self.texCoord = []
self.normals = []
self.colors = []
self.triangles = []
self.materials = {}
self.physObj = None
self.importedModel = False
def setColorAll(self, r, g, b):
'''
This will populate the colors array with same color for every vertex.
'''
if not self.colors:
for i in range(self.nverts):
self.colors.append([r, g, b])
else:
for i in range(self.nverts):
self.colors[i] = [r, g, b]
def addMaterial(self, name, material):
# Add a material to the mesh
self.materials[name] = material
def fromData(self, data, normals=None, texCoord=None):
'''
This will take in any set of vertices, uv coordinates and colors arrays
'''
if isinstance(data, objloader.OBJ):
self.importedModel = True
self.materials = data.mtlfile.data
for key, value in data.fmvnig.items():
# Vertices
self.verData[key] = value[0]
# Normals
self.norData[key] = value[2]
for key, value in self.materials.items():
try:
self.colData[key] = []
for i in range(len(self.verData[key])):
self.colData[key].append(value.diffuse)
except KeyError:
pass
else:
self.importedModel = False
self.vertices = data
self.nverts = len(self.vertices)
if normals is not None:
self.normals = normals
if texCoord is not None:
self.texCoord = texCoord
else:
self.texCoord = self.vertices
self.buffer_objects()
def fromCSG(self, csg):
'''
This will take in a CSG object and convert it to mesh for
rendering and simulation purposes.
'''
indexer = Indexer()
polygons = csg.toPolygons()
for i in range(len(polygons)):
polygon = polygons[i]
indices = []
for j in range(len(polygon.vertices)):
vertex = polygon.vertices[j]
vertex.color = polygon.shared or [1.0, 1.0, 1.0]
index = indexer.add(vertex)
indices.append(index)
for k in range(2, len(indices), 1):
self.triangles.append([indices[0], indices[k - 1], indices[k]])
for i in range(len(indexer.unique)):
v = indexer.unique[i]
self.vertices.append(v.pos.vector)
self.normals.append(v.normal.vector)
self.colors.append(v.color)
# print("Indexer Unique Count: ", len(indexer.unique))
# print("Polygon Count: ", len(polygons))
# print("Triangles Count: ", len(self.triangles))
# print("Vertices Count: ", len(self.vertices))
self.nverts = len(self.vertices)
self.ntris = len(self.triangles)
self.buffer_objects()
def addPhysicsObject(self, physObj):
'''This will attach a physics object to the mesh.'''
self.physObj = physObj
self.rect = physObj.getCollisionModel().getModel()
self.vertices = self.rect.getVertices()
self.texCoord = self.rect.getVertices()
self.matrix = self.rect.getModelMatrix()
def scale(self, value):
self.scaleDelta = value / self._scale
self._scale = value
def translate(self, x, y, z):
self.xPosDelta += x - self.xPos
self.yPosDelta += y - self.yPos
self.zPosDelta += z - self.zPos
self.xPos = x
self.yPos = y
self.zPos = z
# TODO - Needs to be checked
def rotate(self, axis, angle):
self.rotationMatrix = matrix.Matrix(4).rotate(axis, angle)
self.matrix *= self.rotationMatrix
def update(self):
if self.physObj is None:
pass
else:
self.rect = self.physObj.getCollisionModel().getModel()
self.matrix = self.rect.getModelMatrix()
if self.scaleDelta:
vecScale = vector.Vector(
3,
data=[self.scaleDelta, self.scaleDelta, self.scaleDelta])
self.matrix.i_scale(vecScale)
self.scaleDelta = 0
if self.xPosDelta or self.yPosDelta or self.zPosDelta:
vecTrans = vector.Vector(
3,
data=[self.xPosDelta, self.yPosDelta, self.zPosDelta])
#self.matrix.i_translate(vecTrans)
self.matrix.i_translate(vecTrans)
self.xPosDelta = 0
self.yPosDelta = 0
self.zPosDelta = 0
temp4x4 = self.matrix.inverse().transpose()
self.modelInverseTranspose = convertM4to3(temp4x4.matrix) | [
1,
529,
9507,
29958,
287,
29906,
29881,
29914,
4467,
29882,
29889,
2272,
29966,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
3166,
7055,
1053,
4636,
13,
3166,
7055,
1053,
4608,
13,
3166,
1226,
29906,
29881,
29889,
459,
6180,
1053,
3144,
29892,
282,
3820,
13,
3166,
1226,
29906,
29881,
29889,
16596,
1053,
5446,
12657,
13,
13,
13,
1753,
6835,
29918,
3318,
29898,
1272,
29892,
1134,
29924,
1125,
13,
1678,
565,
848,
470,
29871,
29900,
29901,
13,
4706,
325,
833,
353,
282,
3820,
29889,
3820,
15462,
29933,
3096,
414,
29898,
29896,
29897,
13,
4706,
3144,
29889,
3820,
15708,
7701,
29898,
3820,
29889,
7239,
29918,
1718,
22800,
29918,
7838,
28483,
29892,
325,
833,
29897,
13,
4706,
282,
3820,
29889,
3820,
7701,
1469,
29898,
3820,
29889,
7239,
29918,
1718,
22800,
29918,
7838,
28483,
29892,
848,
29892,
1134,
29924,
29892,
3144,
29889,
7239,
29918,
17816,
2965,
29918,
29928,
4717,
29956,
29897,
13,
4706,
3144,
29889,
3820,
15708,
7701,
29898,
3820,
29889,
7239,
29918,
1718,
22800,
29918,
7838,
28483,
29892,
29871,
29900,
29897,
13,
4706,
736,
325,
833,
13,
1678,
1683,
29901,
13,
4706,
736,
6213,
13,
13,
13,
1753,
2380,
29918,
9040,
29918,
3318,
29898,
1272,
29892,
1134,
29924,
1125,
13,
1678,
565,
848,
470,
29871,
29900,
29901,
13,
4706,
474,
833,
353,
282,
3820,
29889,
3820,
15462,
29933,
3096,
414,
29898,
29896,
29897,
13,
4706,
3144,
29889,
3820,
15708,
7701,
29898,
3820,
29889,
7239,
29918,
29923,
1307,
13780,
29918,
1718,
22800,
29918,
7838,
28483,
29892,
474,
833,
29897,
13,
4706,
282,
3820,
29889,
3820,
7701,
1469,
29898,
3820,
29889,
7239,
29918,
29923,
1307,
13780,
29918,
1718,
22800,
29918,
7838,
28483,
29892,
848,
29892,
1134,
29924,
29892,
13,
462,
308,
3144,
29889,
7239,
29918,
17816,
2965,
29918,
29928,
4717,
29956,
29897,
13,
4706,
3144,
29889,
3820,
15708,
7701,
29898,
3820,
29889,
7239,
29918,
29923,
1307,
13780,
29918,
1718,
22800,
29918,
7838,
28483,
29892,
29871,
29900,
29897,
13,
4706,
736,
474,
833,
13,
1678,
1683,
29901,
13,
4706,
736,
6213,
13,
13,
13,
1753,
7868,
29918,
3318,
29898,
1272,
3524,
29892,
325,
833,
29892,
2159,
1125,
13,
1678,
565,
313,
1272,
3524,
338,
451,
6213,
29897,
322,
313,
29894,
833,
338,
451,
6213,
1125,
13,
4706,
3144,
29889,
3820,
20701,
22479,
4165,
1091,
2588,
29898,
1272,
3524,
29897,
13,
4706,
3144,
29889,
3820,
15708,
7701,
29898,
3820,
29889,
7239,
29918,
1718,
22800,
29918,
7838,
28483,
29892,
325,
833,
29897,
13,
4706,
282,
3820,
29889,
3820,
22479,
4165,
1091,
14516,
29898,
1272,
3524,
29892,
2159,
29892,
3144,
29889,
7239,
29918,
29943,
3927,
1299,
29892,
3144,
29889,
7239,
29918,
25717,
29892,
29871,
29900,
29892,
13,
462,
462,
29871,
6213,
29897,
13,
1678,
1683,
29901,
13,
4706,
1209,
13,
13,
13,
1753,
443,
5355,
29918,
3318,
29898,
1272,
3524,
1125,
13,
1678,
565,
848,
3524,
338,
451,
6213,
29901,
13,
4706,
3144,
29889,
3820,
15708,
7701,
29898,
3820,
29889,
7239,
29918,
1718,
22800,
29918,
7838,
28483,
29892,
29871,
29900,
29897,
13,
4706,
3144,
29889,
3820,
4205,
519,
22479,
4165,
1091,
2588,
29898,
1272,
3524,
29897,
13,
1678,
1683,
29901,
13,
4706,
1209,
13,
13,
1753,
22235,
29918,
2161,
29918,
8945,
29898,
369,
4776,
29896,
29892,
12688,
29906,
29892,
12688,
29941,
1125,
13,
1678,
14550,
20535,
403,
263,
3700,
4226,
515,
29871,
29941,
13791,
29889,
29871,
29941,
29928,
16510,
10970,
29889,
14550,
13,
1678,
12688,
29896,
29896,
353,
12688,
29906,
448,
12688,
29896,
13,
1678,
12688,
29906,
29906,
353,
12688,
29941,
448,
12688,
29896,
13,
1678,
4226,
353,
12688,
29896,
29896,
29889,
19128,
29898,
369,
4776,
29906,
29906,
29897,
13,
1678,
4226,
29889,
29875,
29918,
8945,
675,
580,
13,
1678,
736,
4226,
13,
13,
29937,
1281,
369,
4636,
29871,
29946,
29916,
29946,
304,
29871,
29941,
29916,
29941,
13,
1753,
3588,
29924,
29946,
517,
29941,
29898,
2922,
1125,
13,
1678,
14550,
14806,
263,
29871,
29946,
29916,
29946,
22513,
304,
29871,
29941,
29916,
29941,
29889,
14550,
13,
1678,
5694,
353,
5519,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
1402,
13,
9651,
518,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
1402,
13,
9651,
518,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
5262,
13,
13,
1678,
363,
474,
297,
3464,
29898,
29941,
1125,
13,
4706,
363,
432,
297,
3464,
29898,
29941,
1125,
13,
9651,
5694,
29961,
29875,
3816,
29926,
29962,
353,
1775,
29961,
29875,
3816,
29926,
29962,
13,
13,
1678,
714,
353,
4636,
29889,
14609,
29898,
29941,
29897,
13,
1678,
714,
29889,
5344,
353,
5694,
13,
1678,
736,
714,
13,
13,
13,
1990,
11374,
261,
29898,
3318,
1125,
13,
1678,
14550,
910,
338,
4312,
363,
21107,
29954,
29889,
12008,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
1583,
29889,
13092,
353,
5159,
13,
4706,
1583,
29889,
513,
1575,
353,
5159,
13,
4706,
1583,
29889,
1958,
353,
6571,
13,
13,
1678,
822,
788,
29898,
1311,
29892,
5446,
1125,
13,
4706,
1820,
353,
2062,
29898,
5415,
29897,
13,
13,
4706,
565,
451,
313,
1989,
297,
1583,
29889,
1958,
1125,
13,
9651,
1583,
29889,
1958,
29961,
1989,
29962,
353,
7431,
29898,
1311,
29889,
13092,
29897,
13,
9651,
1583,
29889,
13092,
29889,
4397,
29898,
5415,
29897,
13,
13,
4706,
736,
1583,
29889,
1958,
29961,
1989,
29962,
13,
13,
13,
1990,
341,
12094,
5160,
29898,
3318,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
1583,
29889,
8860,
353,
6213,
13,
4706,
1583,
29889,
1765,
3524,
353,
6213,
13,
4706,
1583,
29889,
29965,
29963,
3524,
353,
6213,
13,
4706,
1583,
29889,
2780,
3524,
353,
6213,
13,
4706,
1583,
29889,
12324,
3524,
353,
6213,
13,
4706,
1583,
29889,
4299,
1367,
353,
6213,
13,
4706,
1583,
29889,
726,
545,
353,
6213,
13,
4706,
1583,
29889,
5415,
29906,
11526,
353,
4636,
29889,
14609,
29898,
29946,
29897,
13,
4706,
1583,
29889,
5344,
353,
4636,
29889,
14609,
29898,
29946,
29897,
396,
8125,
4636,
13,
4706,
1583,
29889,
4299,
797,
3901,
4300,
4220,
353,
4636,
29889,
14609,
29898,
29946,
29897,
13,
13,
4706,
1583,
29889,
24666,
359,
353,
5159,
13,
4706,
1583,
29889,
10702,
359,
353,
5159,
13,
4706,
1583,
29889,
9877,
359,
353,
5159,
13,
13,
1678,
822,
788,
9283,
29898,
1311,
29892,
1824,
1125,
13,
4706,
1583,
29889,
8860,
353,
1824,
13,
4706,
1583,
29889,
1765,
3524,
353,
1583,
29889,
8860,
29889,
657,
29918,
12715,
29898,
29890,
29915,
369,
4776,
8003,
29918,
4299,
3493,
1495,
13,
4706,
1583,
29889,
12324,
3524,
353,
1583,
29889,
8860,
29889,
657,
29918,
12715,
29898,
29890,
29915,
8945,
29918,
4299,
3493,
1495,
13,
4706,
396,
1311,
29889,
29965,
29963,
3524,
353,
1583,
29889,
8860,
29889,
657,
29918,
12715,
29898,
29890,
29915,
369,
4776,
29965,
29963,
1495,
13,
4706,
1583,
29889,
2780,
3524,
353,
1583,
29889,
8860,
29889,
657,
29918,
12715,
29898,
29890,
29915,
369,
4776,
3306,
1495,
13,
4706,
1583,
29889,
4299,
1367,
353,
1583,
29889,
8860,
29889,
1482,
29918,
29590,
29898,
29890,
29915,
4299,
29918,
5344,
1495,
13,
4706,
1583,
29889,
11569,
3195,
3524,
353,
1583,
29889,
8860,
29889,
1482,
29918,
29590,
29898,
29890,
29915,
29887,
29924,
29881,
29963,
29893,
1495,
13,
13,
13,
1678,
822,
4050,
29898,
1311,
1125,
13,
4706,
1583,
29889,
8860,
29889,
842,
29918,
29590,
29918,
5344,
29898,
1311,
29889,
4299,
1367,
29892,
1583,
29889,
5344,
29897,
13,
4706,
1583,
29889,
8860,
29889,
842,
29918,
29590,
29918,
5344,
29898,
1311,
29889,
11569,
3195,
3524,
29892,
1583,
29889,
4299,
797,
3901,
4300,
4220,
29897,
13,
13,
4706,
474,
353,
29871,
29900,
13,
4706,
363,
1820,
297,
1583,
29889,
15388,
29879,
29901,
13,
9651,
1018,
29901,
13,
18884,
7868,
29918,
3318,
29898,
1311,
29889,
1765,
3524,
29892,
1583,
29889,
24666,
359,
29961,
29875,
1402,
29871,
29941,
29897,
13,
18884,
7868,
29918,
3318,
29898,
1311,
29889,
12324,
3524,
29892,
1583,
29889,
9877,
359,
29961,
29875,
1402,
29871,
29941,
29897,
13,
18884,
7868,
29918,
3318,
29898,
1311,
29889,
2780,
3524,
29892,
1583,
29889,
10702,
359,
29961,
29875,
1402,
29871,
29941,
29897,
13,
13,
18884,
3144,
29889,
3820,
8537,
2588,
29879,
29898,
3820,
29889,
7239,
29918,
29911,
3960,
19453,
17101,
29892,
29871,
29900,
29892,
7431,
29898,
1311,
29889,
369,
1469,
29961,
1989,
12622,
13,
13,
18884,
443,
5355,
29918,
3318,
29898,
1311,
29889,
2780,
3524,
29897,
13,
18884,
443,
5355,
29918,
3318,
29898,
1311,
29889,
12324,
3524,
29897,
13,
18884,
443,
5355,
29918,
3318,
29898,
1311,
29889,
1765,
3524,
29897,
13,
18884,
474,
4619,
29871,
29896,
13,
9651,
5174,
7670,
2392,
29901,
13,
18884,
1209,
13,
13,
1678,
822,
6835,
29918,
12650,
29898,
1311,
1125,
13,
4706,
565,
1583,
29889,
5215,
287,
3195,
29901,
13,
9651,
363,
1820,
297,
1583,
29889,
15388,
29879,
29901,
13,
18884,
1018,
29901,
13,
462,
1678,
1583,
29889,
24666,
359,
29889,
4397,
29898,
9040,
29918,
3318,
29898,
1311,
29889,
369,
1469,
29961,
1989,
1402,
3144,
29889,
7239,
7411,
876,
13,
462,
1678,
1583,
29889,
9877,
359,
29889,
4397,
29898,
9040,
29918,
3318,
29898,
1311,
29889,
15459,
1469,
29961,
1989,
1402,
3144,
29889,
7239,
7411,
876,
13,
462,
1678,
1583,
29889,
10702,
359,
29889,
4397,
29898,
9040,
29918,
3318,
29898,
1311,
29889,
1054,
1469,
29961,
1989,
1402,
3144,
29889,
7239,
7411,
876,
13,
18884,
5174,
7670,
2392,
29901,
13,
462,
1678,
1209,
13,
4706,
1683,
29901,
13,
9651,
1583,
29889,
29894,
833,
353,
6835,
29918,
3318,
29898,
1311,
29889,
1765,
1575,
29892,
3144,
29889,
7239,
7411,
29897,
13,
9651,
1583,
29889,
4090,
833,
353,
6835,
29918,
3318,
29898,
1311,
29889,
4776,
7967,
536,
29892,
3144,
29889,
7239,
7411,
29897,
13,
9651,
1583,
29889,
747,
29877,
353,
2380,
29918,
9040,
29918,
3318,
29898,
1311,
29889,
3626,
19536,
29892,
3144,
29889,
7239,
13470,
29897,
13,
13,
1990,
341,
12094,
29898,
29924,
12094,
5160,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
2428,
29898,
29924,
12094,
29892,
1583,
467,
1649,
2344,
1649,
580,
13,
13,
4706,
1583,
29889,
29916,
9135,
353,
29871,
29900,
13,
4706,
1583,
29889,
29891,
9135,
353,
29871,
29900,
13,
4706,
1583,
29889,
29920,
9135,
353,
29871,
29900,
13,
4706,
1583,
29889,
29916,
9135,
5268,
353,
29871,
29900,
13,
4706,
1583,
29889,
29891,
9135,
5268,
353,
29871,
29900,
13,
4706,
1583,
29889,
29920,
9135,
5268,
353,
29871,
29900,
13,
13,
4706,
1583,
3032,
7052,
353,
29871,
29896,
13,
4706,
1583,
29889,
7052,
5268,
353,
29871,
29900,
13,
13,
4706,
1583,
29889,
369,
1469,
353,
6571,
13,
4706,
1583,
29889,
15459,
1469,
353,
6571,
13,
4706,
1583,
29889,
1054,
1469,
353,
6571,
13,
4706,
1583,
29889,
1621,
353,
6213,
13,
4706,
1583,
29889,
29876,
369,
1372,
353,
29871,
29900,
13,
4706,
1583,
29889,
29876,
509,
275,
353,
29871,
29900,
13,
13,
4706,
1583,
29889,
1765,
1575,
353,
5159,
13,
4706,
1583,
29889,
4776,
7967,
536,
353,
5159,
13,
4706,
1583,
29889,
12324,
1338,
353,
5159,
13,
4706,
1583,
29889,
27703,
353,
5159,
13,
4706,
1583,
29889,
3626,
19536,
353,
5159,
13,
4706,
1583,
29889,
15388,
29879,
353,
6571,
13,
13,
4706,
1583,
29889,
14017,
9930,
353,
6213,
13,
4706,
1583,
29889,
5215,
287,
3195,
353,
7700,
13,
13,
1678,
822,
731,
3306,
3596,
29898,
1311,
29892,
364,
29892,
330,
29892,
289,
1125,
13,
4706,
14550,
13,
4706,
910,
674,
19450,
278,
11955,
1409,
411,
1021,
2927,
363,
1432,
12688,
29889,
13,
4706,
14550,
13,
4706,
565,
451,
1583,
29889,
27703,
29901,
13,
9651,
363,
474,
297,
3464,
29898,
1311,
29889,
29876,
369,
1372,
1125,
13,
18884,
1583,
29889,
27703,
29889,
4397,
4197,
29878,
29892,
330,
29892,
289,
2314,
13,
4706,
1683,
29901,
13,
9651,
363,
474,
297,
3464,
29898,
1311,
29889,
29876,
369,
1372,
1125,
13,
18884,
1583,
29889,
27703,
29961,
29875,
29962,
353,
518,
29878,
29892,
330,
29892,
289,
29962,
13,
13,
1678,
822,
788,
24095,
29898,
1311,
29892,
1024,
29892,
5518,
1125,
13,
4706,
396,
3462,
263,
5518,
304,
278,
27716,
13,
4706,
1583,
29889,
15388,
29879,
29961,
978,
29962,
353,
5518,
13,
13,
1678,
822,
515,
1469,
29898,
1311,
29892,
848,
29892,
6056,
1338,
29922,
8516,
29892,
19696,
7967,
536,
29922,
8516,
1125,
13,
4706,
14550,
13,
4706,
910,
674,
2125,
297,
738,
731,
310,
13791,
29892,
318,
29894,
10350,
322,
11955,
7049,
13,
4706,
14550,
13,
13,
4706,
565,
338,
8758,
29898,
1272,
29892,
5446,
12657,
29889,
14824,
29967,
1125,
13,
9651,
1583,
29889,
5215,
287,
3195,
353,
5852,
13,
9651,
1583,
29889,
15388,
29879,
353,
848,
29889,
4378,
29880,
1445,
29889,
1272,
13,
13,
9651,
363,
1820,
29892,
995,
297,
848,
29889,
24826,
18564,
335,
29889,
7076,
7295,
13,
18884,
396,
11198,
1575,
13,
18884,
1583,
29889,
369,
1469,
29961,
1989,
29962,
353,
995,
29961,
29900,
29962,
13,
18884,
396,
5655,
1338,
13,
18884,
1583,
29889,
15459,
1469,
29961,
1989,
29962,
353,
995,
29961,
29906,
29962,
13,
13,
9651,
363,
1820,
29892,
995,
297,
1583,
29889,
15388,
29879,
29889,
7076,
7295,
13,
18884,
1018,
29901,
13,
462,
1678,
1583,
29889,
1054,
1469,
29961,
1989,
29962,
353,
5159,
13,
462,
1678,
363,
474,
297,
3464,
29898,
2435,
29898,
1311,
29889,
369,
1469,
29961,
1989,
12622,
29901,
13,
462,
9651,
1583,
29889,
1054,
1469,
29961,
1989,
1822,
4397,
29898,
1767,
29889,
12765,
1509,
29897,
13,
18884,
5174,
7670,
2392,
29901,
13,
462,
1678,
1209,
13,
4706,
1683,
29901,
13,
9651,
1583,
29889,
5215,
287,
3195,
353,
7700,
13,
9651,
1583,
29889,
1765,
1575,
353,
848,
13,
9651,
1583,
29889,
29876,
369,
1372,
353,
7431,
29898,
1311,
29889,
1765,
1575,
29897,
13,
13,
9651,
565,
6056,
1338,
338,
451,
6213,
29901,
13,
18884,
1583,
29889,
12324,
1338,
353,
6056,
1338,
13,
13,
9651,
565,
19696,
7967,
536,
338,
451,
6213,
29901,
13,
18884,
1583,
29889,
4776,
7967,
536,
353,
19696,
7967,
536,
13,
9651,
1683,
29901,
13,
18884,
1583,
29889,
4776,
7967,
536,
353,
1583,
29889,
1765,
1575,
13,
13,
4706,
1583,
29889,
9040,
29918,
12650,
580,
13,
13,
1678,
822,
515,
9295,
29954,
29898,
1311,
29892,
274,
5311,
1125,
13,
4706,
14550,
13,
4706,
910,
674,
2125,
297,
263,
21107,
29954,
1203,
322,
3588,
372,
304,
27716,
363,
13,
4706,
15061,
322,
17402,
11976,
29889,
13,
4706,
14550,
13,
4706,
2380,
261,
353,
11374,
261,
580,
13,
4706,
1248,
4790,
787,
353,
274,
5311,
29889,
517,
7713,
4790,
787,
580,
13,
13,
4706,
363,
474,
297,
3464,
29898,
2435,
29898,
3733,
4790,
787,
22164,
13,
9651,
29807,
353,
1248,
4790,
787,
29961,
29875,
29962,
13,
9651,
16285,
353,
5159,
13,
9651,
363,
432,
297,
3464,
29898,
2435,
29898,
3733,
17125,
29889,
1765,
1575,
22164,
13,
18884,
12688,
353,
29807,
29889,
1765,
1575,
29961,
29926,
29962,
13,
18884,
12688,
29889,
2780,
353,
29807,
29889,
12366,
470,
518,
29896,
29889,
29900,
29892,
29871,
29896,
29889,
29900,
29892,
29871,
29896,
29889,
29900,
29962,
13,
18884,
2380,
353,
2380,
261,
29889,
1202,
29898,
369,
4776,
29897,
13,
18884,
16285,
29889,
4397,
29898,
2248,
29897,
13,
9651,
363,
413,
297,
3464,
29898,
29906,
29892,
7431,
29898,
513,
1575,
511,
29871,
29896,
1125,
13,
18884,
1583,
29889,
3626,
19536,
29889,
4397,
4197,
513,
1575,
29961,
29900,
1402,
16285,
29961,
29895,
448,
29871,
29896,
1402,
16285,
29961,
29895,
24960,
13,
13,
4706,
363,
474,
297,
3464,
29898,
2435,
29898,
2248,
261,
29889,
13092,
22164,
13,
9651,
325,
353,
2380,
261,
29889,
13092,
29961,
29875,
29962,
13,
9651,
1583,
29889,
1765,
1575,
29889,
4397,
29898,
29894,
29889,
1066,
29889,
8111,
29897,
13,
9651,
1583,
29889,
12324,
1338,
29889,
4397,
29898,
29894,
29889,
8945,
29889,
8111,
29897,
13,
9651,
1583,
29889,
27703,
29889,
4397,
29898,
29894,
29889,
2780,
29897,
13,
13,
4706,
396,
1596,
703,
3220,
261,
853,
1387,
3917,
29901,
9162,
7431,
29898,
2248,
261,
29889,
13092,
876,
13,
4706,
396,
1596,
703,
7713,
17125,
3917,
29901,
9162,
7431,
29898,
3733,
4790,
787,
876,
13,
4706,
396,
1596,
703,
29565,
19536,
3917,
29901,
9162,
7431,
29898,
1311,
29889,
3626,
19536,
876,
13,
4706,
396,
1596,
703,
9114,
1575,
3917,
29901,
9162,
7431,
29898,
1311,
29889,
1765,
1575,
876,
13,
13,
4706,
1583,
29889,
29876,
369,
1372,
353,
7431,
29898,
1311,
29889,
1765,
1575,
29897,
13,
4706,
1583,
29889,
29876,
509,
275,
353,
7431,
29898,
1311,
29889,
3626,
19536,
29897,
13,
13,
4706,
1583,
29889,
9040,
29918,
12650,
580,
13,
13,
1678,
822,
788,
25847,
1199,
2061,
29898,
1311,
29892,
4824,
9930,
1125,
13,
4706,
14550,
4013,
674,
10641,
263,
17558,
1203,
304,
278,
27716,
29889,
12008,
13,
4706,
1583,
29889,
14017,
9930,
353,
4824,
9930,
13,
4706,
1583,
29889,
1621,
353,
4824,
9930,
29889,
657,
28377,
2459,
3195,
2141,
657,
3195,
580,
13,
4706,
1583,
29889,
1765,
1575,
353,
1583,
29889,
1621,
29889,
657,
9114,
1575,
580,
13,
4706,
1583,
29889,
4776,
7967,
536,
353,
1583,
29889,
1621,
29889,
657,
9114,
1575,
580,
13,
4706,
1583,
29889,
5344,
353,
1583,
29889,
1621,
29889,
657,
3195,
14609,
580,
13,
13,
1678,
822,
6287,
29898,
1311,
29892,
995,
1125,
13,
4706,
1583,
29889,
7052,
5268,
353,
995,
847,
1583,
3032,
7052,
13,
4706,
1583,
3032,
7052,
353,
995,
13,
13,
1678,
822,
14240,
29898,
1311,
29892,
921,
29892,
343,
29892,
503,
1125,
13,
4706,
1583,
29889,
29916,
9135,
5268,
4619,
921,
448,
1583,
29889,
29916,
9135,
13,
4706,
1583,
29889,
29891,
9135,
5268,
4619,
343,
448,
1583,
29889,
29891,
9135,
13,
4706,
1583,
29889,
29920,
9135,
5268,
4619,
503,
448,
1583,
29889,
29920,
9135,
13,
4706,
1583,
29889,
29916,
9135,
353,
921,
13,
4706,
1583,
29889,
29891,
9135,
353,
343,
13,
4706,
1583,
29889,
29920,
9135,
353,
503,
13,
13,
1678,
396,
14402,
448,
2448,
5779,
304,
367,
7120,
13,
1678,
822,
16734,
29898,
1311,
29892,
9685,
29892,
10696,
1125,
13,
4706,
1583,
29889,
5450,
362,
14609,
353,
4636,
29889,
14609,
29898,
29946,
467,
23361,
29898,
8990,
29892,
10696,
29897,
13,
4706,
1583,
29889,
5344,
334,
29922,
1583,
29889,
5450,
362,
14609,
13,
13,
1678,
822,
2767,
29898,
1311,
1125,
13,
13,
4706,
565,
1583,
29889,
14017,
9930,
338,
6213,
29901,
13,
9651,
1209,
13,
4706,
1683,
29901,
13,
9651,
1583,
29889,
1621,
353,
1583,
29889,
14017,
9930,
29889,
657,
28377,
2459,
3195,
2141,
657,
3195,
580,
13,
9651,
1583,
29889,
5344,
353,
1583,
29889,
1621,
29889,
657,
3195,
14609,
580,
13,
13,
4706,
565,
1583,
29889,
7052,
5268,
29901,
13,
9651,
9649,
17185,
353,
4608,
29889,
12877,
29898,
13,
462,
29941,
29892,
13,
18884,
848,
11759,
1311,
29889,
7052,
5268,
29892,
1583,
29889,
7052,
5268,
29892,
1583,
29889,
7052,
5268,
2314,
13,
13,
9651,
1583,
29889,
5344,
29889,
29875,
29918,
7052,
29898,
2003,
17185,
29897,
13,
9651,
1583,
29889,
7052,
5268,
353,
29871,
29900,
13,
13,
4706,
565,
1583,
29889,
29916,
9135,
5268,
470,
1583,
29889,
29891,
9135,
5268,
470,
1583,
29889,
29920,
9135,
5268,
29901,
13,
9651,
9649,
4300,
353,
4608,
29889,
12877,
29898,
13,
462,
29941,
29892,
13,
18884,
848,
11759,
1311,
29889,
29916,
9135,
5268,
29892,
1583,
29889,
29891,
9135,
5268,
29892,
1583,
29889,
29920,
9135,
5268,
2314,
13,
13,
9651,
396,
1311,
29889,
5344,
29889,
29875,
29918,
21652,
29898,
2003,
4300,
29897,
13,
9651,
1583,
29889,
5344,
29889,
29875,
29918,
21652,
29898,
2003,
4300,
29897,
13,
9651,
1583,
29889,
29916,
9135,
5268,
353,
29871,
29900,
13,
9651,
1583,
29889,
29891,
9135,
5268,
353,
29871,
29900,
13,
9651,
1583,
29889,
29920,
9135,
5268,
353,
29871,
29900,
13,
13,
4706,
5694,
29946,
29916,
29946,
353,
1583,
29889,
5344,
29889,
262,
3901,
2141,
3286,
4220,
580,
13,
4706,
1583,
29889,
4299,
797,
3901,
4300,
4220,
353,
3588,
29924,
29946,
517,
29941,
29898,
7382,
29946,
29916,
29946,
29889,
5344,
29897,
2
] |
UNET_EM_DATASET/UNET_EM_DATASET_TERNARY/utility.py | hossein1387/U-Net-Fixed-Point-Quantization-for-Medical-Image-Segmentation | 69 | 34244 | ../UNET_EM_DATASET_BASE/utility.py | [
1,
29772,
3904,
2544,
29918,
12665,
29918,
25832,
8127,
29911,
29918,
25416,
29914,
329,
1793,
29889,
2272,
2
] |
jax_meta/datasets/transforms/functional.py | tristandeleu/jax-meta-learning | 5 | 189350 | import numpy as np
from numpy.random import default_rng
def random_crop(data, size, padding, rng=default_rng()):
x = rng.integers(2 * padding, size=data.shape[:-3] + (1, 1, 1))
y = rng.integers(2 * padding, size=data.shape[:-3] + (1, 1, 1))
arange = np.arange(size)
rows = x + arange.reshape((size, 1, 1))
cols = y + arange.reshape((1, size, 1))
padding = (padding, padding)
data = np.pad(data, ((0, 0),) * (data.ndim - 3) + (padding, padding, (0, 0)))
data = np.take_along_axis(data, rows, axis=-3)
data = np.take_along_axis(data, cols, axis=-2)
return data
def random_horizontal_flip(data, rng=default_rng()):
to_flip = (rng.random(size=data.shape[:-3]) < 0.5)
data[to_flip] = np.flip(data[to_flip], axis=-2)
return data
def normalize(data, mean, std):
data -= mean
data /= std
return data
def _blend(img1, img2, ratio):
ratio = ratio.reshape((-1,) + (1,) * (img1.ndim - 1))
img1 *= ratio
img1 += (1. - ratio) * img2
img1 = np.clip(img1, 0., 1., out=img1)
return img1
def rgb_to_grayscale(data):
col = np.array([0.2989, 0.587, 0.114], dtype=data.dtype)
return np.expand_dims(data.dot(col), axis=-1)
def adjust_brightness(data, factor):
return _blend(data, np.zeros_like(data), factor)
def adjust_saturation(data, factor):
gray = rgb_to_grayscale(data)
return _blend(data, gray, factor)
def adjust_contrast(data, factor):
mean_gray = np.mean(rgb_to_grayscale(data), axis=(-3, -2, -1), keepdims=True)
return _blend(data, mean_gray, factor)
def color_jitter(data, brightness, contrast, saturation, rng=default_rng()):
order = np.argsort(rng.random(size=(3,) + data.shape[:-3]), axis=0)
brightness = rng.uniform(1. - brightness, 1. + brightness, size=data.shape[:-3])
contrast = rng.uniform(1. - contrast, 1. + contrast, size=data.shape[:-3])
saturation = rng.uniform(1. - saturation, 1. + saturation, size=data.shape[:-3])
for transform in order:
data[transform == 0] = adjust_brightness(data[transform == 0], brightness[transform == 0])
data[transform == 1] = adjust_contrast(data[transform == 1], contrast[transform == 1])
data[transform == 2] = adjust_saturation(data[transform == 2], saturation[transform == 2])
return data
| [
1,
1053,
12655,
408,
7442,
13,
13,
3166,
12655,
29889,
8172,
1053,
2322,
29918,
29878,
865,
13,
13,
13,
1753,
4036,
29918,
29883,
1336,
29898,
1272,
29892,
2159,
29892,
7164,
29892,
364,
865,
29922,
4381,
29918,
29878,
865,
580,
1125,
13,
1678,
921,
353,
364,
865,
29889,
6693,
5743,
29898,
29906,
334,
7164,
29892,
2159,
29922,
1272,
29889,
12181,
7503,
29899,
29941,
29962,
718,
313,
29896,
29892,
29871,
29896,
29892,
29871,
29896,
876,
13,
1678,
343,
353,
364,
865,
29889,
6693,
5743,
29898,
29906,
334,
7164,
29892,
2159,
29922,
1272,
29889,
12181,
7503,
29899,
29941,
29962,
718,
313,
29896,
29892,
29871,
29896,
29892,
29871,
29896,
876,
13,
1678,
564,
927,
353,
7442,
29889,
279,
927,
29898,
2311,
29897,
13,
1678,
4206,
353,
921,
718,
564,
927,
29889,
690,
14443,
3552,
2311,
29892,
29871,
29896,
29892,
29871,
29896,
876,
13,
1678,
28730,
353,
343,
718,
564,
927,
29889,
690,
14443,
3552,
29896,
29892,
2159,
29892,
29871,
29896,
876,
13,
13,
1678,
7164,
353,
313,
12791,
29892,
7164,
29897,
13,
1678,
848,
353,
7442,
29889,
8305,
29898,
1272,
29892,
5135,
29900,
29892,
29871,
29900,
511,
29897,
334,
313,
1272,
29889,
299,
326,
448,
29871,
29941,
29897,
718,
313,
12791,
29892,
7164,
29892,
313,
29900,
29892,
29871,
29900,
4961,
13,
1678,
848,
353,
7442,
29889,
19730,
29918,
284,
549,
29918,
8990,
29898,
1272,
29892,
4206,
29892,
9685,
10457,
29941,
29897,
13,
1678,
848,
353,
7442,
29889,
19730,
29918,
284,
549,
29918,
8990,
29898,
1272,
29892,
28730,
29892,
9685,
10457,
29906,
29897,
13,
1678,
736,
848,
13,
13,
13,
1753,
4036,
29918,
22672,
29918,
29888,
3466,
29898,
1272,
29892,
364,
865,
29922,
4381,
29918,
29878,
865,
580,
1125,
13,
1678,
304,
29918,
29888,
3466,
353,
313,
29878,
865,
29889,
8172,
29898,
2311,
29922,
1272,
29889,
12181,
7503,
29899,
29941,
2314,
529,
29871,
29900,
29889,
29945,
29897,
13,
1678,
848,
29961,
517,
29918,
29888,
3466,
29962,
353,
7442,
29889,
29888,
3466,
29898,
1272,
29961,
517,
29918,
29888,
3466,
1402,
9685,
10457,
29906,
29897,
13,
1678,
736,
848,
13,
13,
13,
1753,
4226,
675,
29898,
1272,
29892,
2099,
29892,
3659,
1125,
13,
1678,
848,
22361,
2099,
13,
1678,
848,
847,
29922,
3659,
13,
1678,
736,
848,
13,
13,
13,
1753,
903,
2204,
355,
29898,
2492,
29896,
29892,
10153,
29906,
29892,
11959,
1125,
13,
1678,
11959,
353,
11959,
29889,
690,
14443,
3552,
29899,
29896,
29892,
29897,
718,
313,
29896,
29892,
29897,
334,
313,
2492,
29896,
29889,
299,
326,
448,
29871,
29896,
876,
13,
1678,
10153,
29896,
334,
29922,
11959,
13,
1678,
10153,
29896,
4619,
313,
29896,
29889,
448,
11959,
29897,
334,
10153,
29906,
13,
1678,
10153,
29896,
353,
7442,
29889,
24049,
29898,
2492,
29896,
29892,
29871,
29900,
1696,
29871,
29896,
1696,
714,
29922,
2492,
29896,
29897,
13,
1678,
736,
10153,
29896,
13,
13,
13,
1753,
15552,
29890,
29918,
517,
29918,
21012,
7052,
29898,
1272,
1125,
13,
1678,
784,
353,
7442,
29889,
2378,
4197,
29900,
29889,
29906,
29929,
29947,
29929,
29892,
29871,
29900,
29889,
29945,
29947,
29955,
29892,
29871,
29900,
29889,
29896,
29896,
29946,
1402,
26688,
29922,
1272,
29889,
29881,
1853,
29897,
13,
1678,
736,
7442,
29889,
18837,
29918,
6229,
29879,
29898,
1272,
29889,
6333,
29898,
1054,
511,
9685,
10457,
29896,
29897,
13,
13,
13,
1753,
10365,
29918,
1182,
523,
2264,
29898,
1272,
29892,
7329,
1125,
13,
1678,
736,
903,
2204,
355,
29898,
1272,
29892,
7442,
29889,
3298,
359,
29918,
4561,
29898,
1272,
511,
7329,
29897,
13,
13,
13,
1753,
10365,
29918,
29879,
1337,
362,
29898,
1272,
29892,
7329,
1125,
13,
1678,
16749,
353,
15552,
29890,
29918,
517,
29918,
21012,
7052,
29898,
1272,
29897,
13,
1678,
736,
903,
2204,
355,
29898,
1272,
29892,
16749,
29892,
7329,
29897,
13,
13,
13,
1753,
10365,
29918,
9996,
579,
29898,
1272,
29892,
7329,
1125,
13,
1678,
2099,
29918,
21012,
353,
7442,
29889,
12676,
29898,
23973,
29918,
517,
29918,
21012,
7052,
29898,
1272,
511,
9685,
29922,
6278,
29941,
29892,
448,
29906,
29892,
448,
29896,
511,
3013,
6229,
29879,
29922,
5574,
29897,
13,
1678,
736,
903,
2204,
355,
29898,
1272,
29892,
2099,
29918,
21012,
29892,
7329,
29897,
13,
13,
13,
1753,
2927,
29918,
29926,
5171,
29898,
1272,
29892,
11785,
2264,
29892,
12814,
29892,
269,
1337,
362,
29892,
364,
865,
29922,
4381,
29918,
29878,
865,
580,
1125,
13,
1678,
1797,
353,
7442,
29889,
5085,
441,
29898,
29878,
865,
29889,
8172,
29898,
2311,
7607,
29941,
29892,
29897,
718,
848,
29889,
12181,
7503,
29899,
29941,
11724,
9685,
29922,
29900,
29897,
13,
1678,
11785,
2264,
353,
364,
865,
29889,
29590,
29898,
29896,
29889,
448,
11785,
2264,
29892,
29871,
29896,
29889,
718,
11785,
2264,
29892,
2159,
29922,
1272,
29889,
12181,
7503,
29899,
29941,
2314,
13,
1678,
12814,
353,
364,
865,
29889,
29590,
29898,
29896,
29889,
448,
12814,
29892,
29871,
29896,
29889,
718,
12814,
29892,
2159,
29922,
1272,
29889,
12181,
7503,
29899,
29941,
2314,
13,
1678,
269,
1337,
362,
353,
364,
865,
29889,
29590,
29898,
29896,
29889,
448,
269,
1337,
362,
29892,
29871,
29896,
29889,
718,
269,
1337,
362,
29892,
2159,
29922,
1272,
29889,
12181,
7503,
29899,
29941,
2314,
13,
1678,
363,
4327,
297,
1797,
29901,
13,
4706,
848,
29961,
9067,
1275,
29871,
29900,
29962,
353,
10365,
29918,
1182,
523,
2264,
29898,
1272,
29961,
9067,
1275,
29871,
29900,
1402,
11785,
2264,
29961,
9067,
1275,
29871,
29900,
2314,
13,
4706,
848,
29961,
9067,
1275,
29871,
29896,
29962,
353,
10365,
29918,
9996,
579,
29898,
1272,
29961,
9067,
1275,
29871,
29896,
1402,
12814,
29961,
9067,
1275,
29871,
29896,
2314,
13,
4706,
848,
29961,
9067,
1275,
29871,
29906,
29962,
353,
10365,
29918,
29879,
1337,
362,
29898,
1272,
29961,
9067,
1275,
29871,
29906,
1402,
269,
1337,
362,
29961,
9067,
1275,
29871,
29906,
2314,
13,
1678,
736,
848,
13,
2
] |
initGame.py | Sabsterrexx/PingPongGame | 0 | 33010 | #Import required Modules:
import pygame
import constants
from paddle import Paddle
from ball import Ball
from score import Score
from text import Text
from screenState import ScreenState
#This function basically executes everything in the "screenState" module's class
def init():
#Initialize all the constants:
screen = constants.initialize()
#Making the FPS clock:
clock = pygame.time.Clock()
FPS = 60
#Creating paddle 1 score:
paddle1Score = Score(screen)
paddle1Score.x = 100
#Creating paddle 2 score:
paddle2Score = Score(screen)
paddle2Score.color = constants.colors["RED"]
#Making 2 paddles:
paddle1 = Paddle()
paddle1.x = 10
paddle1.color = constants.colors["BLUE"]
paddle2 = Paddle()
paddle2.x = 780
paddle2.color = constants.colors["RED"]
# Making the ball:
ball = Ball()
ball.dx = ball.speed
ball.dy = ball.speed
#The ball starts at the center:
ball.x = constants.cx
ball.y = constants.cy
#The ball's intital color is blue
ball.color = constants.colors["PURPLE"]
#Creating the title screen's text:
title_text = Text(screen)
title_text.text = "Welcome to Saabit Pong Game. Difficulty keys: Easy: 1, Medium: 2, Hard: 3"
#Creating the end game screen's text
endScreen_text = Text(screen)
endScreen_text.text = "Game Over. Press 'P' to play again"
return ScreenState(screen, title_text, endScreen_text, paddle1, paddle2, ball, paddle1Score, paddle2Score, clock, FPS)
| [
1,
396,
17518,
3734,
3382,
2540,
29901,
30004,
13,
5215,
22028,
30004,
13,
5215,
17727,
30004,
13,
3166,
282,
22352,
1053,
349,
22352,
30004,
13,
3166,
8287,
1053,
13402,
30004,
13,
3166,
8158,
1053,
2522,
487,
30004,
13,
3166,
1426,
1053,
3992,
30004,
13,
3166,
4315,
2792,
1053,
22666,
2792,
30004,
13,
30004,
13,
30004,
13,
29937,
4013,
740,
8830,
24138,
4129,
297,
278,
376,
10525,
2792,
29908,
3883,
29915,
29879,
770,
6756,
13,
1753,
2069,
7295,
30004,
13,
1678,
396,
6644,
6646,
599,
278,
17727,
29901,
30004,
13,
1678,
4315,
353,
17727,
29889,
24926,
26471,
13,
30004,
13,
30004,
13,
1678,
396,
29924,
5086,
278,
383,
7024,
12006,
29901,
30004,
13,
1678,
12006,
353,
22028,
29889,
2230,
29889,
29907,
908,
26471,
13,
1678,
383,
7024,
353,
29871,
29953,
29900,
30004,
13,
30004,
13,
1678,
396,
9832,
1218,
282,
22352,
29871,
29896,
8158,
29901,
30004,
13,
1678,
282,
22352,
29896,
20097,
353,
2522,
487,
29898,
10525,
8443,
13,
1678,
282,
22352,
29896,
20097,
29889,
29916,
353,
29871,
29896,
29900,
29900,
30004,
13,
30004,
13,
30004,
13,
1678,
396,
9832,
1218,
282,
22352,
29871,
29906,
8158,
29901,
30004,
13,
1678,
282,
22352,
29906,
20097,
353,
2522,
487,
29898,
10525,
8443,
13,
1678,
282,
22352,
29906,
20097,
29889,
2780,
353,
17727,
29889,
27703,
3366,
19386,
3108,
30004,
13,
30004,
13,
30004,
13,
1678,
396,
29924,
5086,
29871,
29906,
282,
1202,
793,
29901,
30004,
13,
1678,
282,
22352,
29896,
353,
349,
22352,
26471,
13,
1678,
282,
22352,
29896,
29889,
29916,
353,
29871,
29896,
29900,
30004,
13,
1678,
282,
22352,
29896,
29889,
2780,
353,
17727,
29889,
27703,
3366,
13367,
4462,
3108,
30004,
13,
30004,
13,
1678,
282,
22352,
29906,
353,
349,
22352,
26471,
13,
1678,
282,
22352,
29906,
29889,
29916,
353,
29871,
29955,
29947,
29900,
30004,
13,
1678,
282,
22352,
29906,
29889,
2780,
353,
17727,
29889,
27703,
3366,
19386,
3108,
30004,
13,
30004,
13,
30004,
13,
1678,
396,
341,
5086,
278,
8287,
29901,
30004,
13,
1678,
8287,
353,
13402,
26471,
13,
1678,
8287,
29889,
8235,
353,
8287,
29889,
19322,
30004,
13,
1678,
8287,
29889,
4518,
353,
8287,
29889,
19322,
1678,
6756,
13,
1678,
396,
1576,
8287,
8665,
472,
278,
4818,
29901,
965,
6756,
13,
1678,
8287,
29889,
29916,
353,
17727,
29889,
18904,
30004,
13,
1678,
8287,
29889,
29891,
353,
17727,
29889,
1270,
30004,
13,
1678,
396,
1576,
8287,
29915,
29879,
938,
2410,
2927,
338,
7254,
30004,
13,
1678,
8287,
29889,
2780,
353,
17727,
29889,
27703,
3366,
29925,
4574,
29925,
1307,
3108,
30004,
13,
30004,
13,
1678,
396,
9832,
1218,
278,
3611,
4315,
29915,
29879,
1426,
29901,
30004,
13,
1678,
3611,
29918,
726,
353,
3992,
29898,
10525,
8443,
13,
1678,
3611,
29918,
726,
29889,
726,
353,
376,
28862,
2763,
304,
5701,
370,
277,
349,
549,
8448,
29889,
360,
2593,
3953,
29891,
6611,
29901,
382,
8995,
29901,
29871,
29896,
29892,
3436,
1974,
29901,
29871,
29906,
29892,
10999,
29901,
29871,
29941,
19451,
13,
30004,
13,
1678,
396,
9832,
1218,
278,
1095,
3748,
4315,
29915,
29879,
1426,
30004,
13,
1678,
1095,
11357,
29918,
726,
353,
3992,
29898,
10525,
8443,
13,
1678,
1095,
11357,
29918,
726,
29889,
726,
353,
376,
14199,
6811,
29889,
5254,
525,
29925,
29915,
304,
1708,
1449,
19451,
13,
30004,
13,
30004,
13,
1678,
736,
22666,
2792,
29898,
10525,
29892,
3611,
29918,
726,
29892,
1095,
11357,
29918,
726,
29892,
282,
22352,
29896,
29892,
282,
22352,
29906,
29892,
8287,
29892,
282,
22352,
29896,
20097,
29892,
282,
22352,
29906,
20097,
29892,
12006,
29892,
383,
7024,
8443,
13,
2
] |
utils/model_trainer.py | heroclass728/alpr_egyptian | 0 | 142750 | <filename>utils/model_trainer.py
from darkflow.net.build import TFNet
if __name__ == '__main__':
options = {"model": "/media/mensa/Data/Task/EgyALPR/darkflow/cfg/yolo.cfg",
"load": "/media/mensa/Data/Task/EgyALPR/darkflow/bin/yolo.weights",
"batch": 8,
"epoch": 100,
"gpu": 0.9,
"train": True,
"annotation": "/media/mensa/Data/Task/EgyALPR/training_dataset/xml",
"dataset": "/media/mensa/Data/Task/EgyALPR/training_dataset/images"}
tf_net = TFNet(options)
tf_net.train()
tf_net.savepb()
| [
1,
529,
9507,
29958,
13239,
29914,
4299,
29918,
3018,
4983,
29889,
2272,
13,
3166,
6501,
1731,
29889,
1212,
29889,
4282,
1053,
323,
29943,
6779,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
13,
1678,
3987,
353,
8853,
4299,
1115,
5591,
9799,
29914,
29885,
14535,
29914,
1469,
29914,
5398,
29914,
29923,
1927,
1964,
10593,
29914,
26031,
1731,
29914,
16859,
29914,
29891,
3543,
29889,
16859,
613,
13,
1669,
376,
1359,
1115,
5591,
9799,
29914,
29885,
14535,
29914,
1469,
29914,
5398,
29914,
29923,
1927,
1964,
10593,
29914,
26031,
1731,
29914,
2109,
29914,
29891,
3543,
29889,
705,
5861,
613,
13,
1669,
376,
16175,
1115,
29871,
29947,
29892,
13,
1669,
376,
1022,
2878,
1115,
29871,
29896,
29900,
29900,
29892,
13,
1669,
376,
29887,
3746,
1115,
29871,
29900,
29889,
29929,
29892,
13,
1669,
376,
14968,
1115,
5852,
29892,
13,
1669,
376,
18317,
1115,
5591,
9799,
29914,
29885,
14535,
29914,
1469,
29914,
5398,
29914,
29923,
1927,
1964,
10593,
29914,
26495,
29918,
24713,
29914,
3134,
613,
13,
1669,
376,
24713,
1115,
5591,
9799,
29914,
29885,
14535,
29914,
1469,
29914,
5398,
29914,
29923,
1927,
1964,
10593,
29914,
26495,
29918,
24713,
29914,
8346,
9092,
13,
1678,
15886,
29918,
1212,
353,
323,
29943,
6779,
29898,
6768,
29897,
13,
1678,
15886,
29918,
1212,
29889,
14968,
580,
13,
1678,
15886,
29918,
1212,
29889,
7620,
24381,
580,
13,
2
] |
src/utils/colors.py | ShounoLab/res-net-interpretation-open | 0 | 180623 | import numpy as np
def rgb2yuv(r, g, b, mode="ycbcr"):
# 8 bit full scale Y Cb Cr
Y = [0.299, 0.587, 0.114]
U = [-0.169, -0.331, 0.5]
V = [0.5, -0.419, -0.081]
yuv = np.asarray([Y, U, V])
if mode == "ycbcr":
return yuv.dot(np.asarray([r, g, b]))
elif mode == "yuv":
return yuv.dot(np.asarray([r, g, b])) - np.array([0, 128.0, 128.0])
else:
return None
def yuv2rgb(y, u, v):
r = [1.0, 0.0, 1.402]
g = [1.0, -0.344, -0.714]
b = [1.0, 1.772, 0.0]
rgb = np.asarray([r, g, b])
return rgb.dot(np.asarray([[y, u, v]]))
def detectColormode(mode):
if mode == "RGB" or mode == "RGBY":
return "rgb"
elif mode == "YUV" or mode == "YCbYr":
return "yuv"
else:
raise ValueError("Unknow color mode: {}".format(mode))
| [
1,
1053,
12655,
408,
7442,
13,
13,
13,
1753,
15552,
29890,
29906,
29891,
4090,
29898,
29878,
29892,
330,
29892,
289,
29892,
4464,
543,
29891,
10702,
7283,
29908,
1125,
13,
1678,
396,
29871,
29947,
2586,
2989,
6287,
612,
315,
29890,
6781,
13,
1678,
612,
353,
518,
29900,
29889,
29906,
29929,
29929,
29892,
29871,
29900,
29889,
29945,
29947,
29955,
29892,
29871,
29900,
29889,
29896,
29896,
29946,
29962,
13,
1678,
501,
353,
21069,
29900,
29889,
29896,
29953,
29929,
29892,
448,
29900,
29889,
29941,
29941,
29896,
29892,
29871,
29900,
29889,
29945,
29962,
13,
1678,
478,
353,
518,
29900,
29889,
29945,
29892,
448,
29900,
29889,
29946,
29896,
29929,
29892,
448,
29900,
29889,
29900,
29947,
29896,
29962,
13,
1678,
343,
4090,
353,
7442,
29889,
294,
2378,
4197,
29979,
29892,
501,
29892,
478,
2314,
13,
13,
1678,
565,
4464,
1275,
376,
29891,
10702,
7283,
1115,
13,
4706,
736,
343,
4090,
29889,
6333,
29898,
9302,
29889,
294,
2378,
4197,
29878,
29892,
330,
29892,
289,
12622,
13,
1678,
25342,
4464,
1275,
376,
29891,
4090,
1115,
13,
4706,
736,
343,
4090,
29889,
6333,
29898,
9302,
29889,
294,
2378,
4197,
29878,
29892,
330,
29892,
289,
12622,
448,
7442,
29889,
2378,
4197,
29900,
29892,
29871,
29896,
29906,
29947,
29889,
29900,
29892,
29871,
29896,
29906,
29947,
29889,
29900,
2314,
13,
1678,
1683,
29901,
13,
4706,
736,
6213,
13,
13,
13,
1753,
343,
4090,
29906,
23973,
29898,
29891,
29892,
318,
29892,
325,
1125,
13,
1678,
364,
353,
518,
29896,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29896,
29889,
29946,
29900,
29906,
29962,
13,
1678,
330,
353,
518,
29896,
29889,
29900,
29892,
448,
29900,
29889,
29941,
29946,
29946,
29892,
448,
29900,
29889,
29955,
29896,
29946,
29962,
13,
1678,
289,
353,
518,
29896,
29889,
29900,
29892,
29871,
29896,
29889,
29955,
29955,
29906,
29892,
29871,
29900,
29889,
29900,
29962,
13,
1678,
15552,
29890,
353,
7442,
29889,
294,
2378,
4197,
29878,
29892,
330,
29892,
289,
2314,
13,
1678,
736,
15552,
29890,
29889,
6333,
29898,
9302,
29889,
294,
2378,
4197,
29961,
29891,
29892,
318,
29892,
325,
5262,
876,
13,
13,
13,
1753,
6459,
1625,
555,
356,
29898,
8513,
1125,
13,
1678,
565,
4464,
1275,
376,
28212,
29908,
470,
4464,
1275,
376,
28212,
29979,
1115,
13,
4706,
736,
376,
23973,
29908,
13,
1678,
25342,
4464,
1275,
376,
29979,
29965,
29963,
29908,
470,
4464,
1275,
376,
29979,
29907,
29890,
29979,
29878,
1115,
13,
4706,
736,
376,
29891,
4090,
29908,
13,
1678,
1683,
29901,
13,
4706,
12020,
7865,
2392,
703,
2525,
28385,
2927,
4464,
29901,
6571,
1642,
4830,
29898,
8513,
876,
13,
2
] |
src/opencmiss/neon/ui/misc/utils.py | hsorby/neon | 0 | 186953 | <gh_stars>0
'''
Copyright 2015 University of Auckland
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
'''
from functools import wraps
from PySide import QtCore, QtGui
def set_wait_cursor(f):
"""
Decorator to a gui action method (e.g. methods in QtGui.QWidget) to
set and unset a wait cursor and unset after the method is finished.
"""
@wraps(f)
def do_wait_cursor(*a, **kw):
try:
QtGui.QApplication.setOverrideCursor(QtCore.Qt.WaitCursor)
return f(*a, **kw)
finally:
# Always unset
QtGui.QApplication.restoreOverrideCursor()
return do_wait_cursor
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
12008,
13,
259,
14187,
1266,
29871,
29906,
29900,
29896,
29945,
3014,
310,
319,
2707,
1049,
13,
13,
259,
10413,
21144,
1090,
278,
13380,
19245,
29892,
10079,
29871,
29906,
29889,
29900,
313,
1552,
376,
29931,
293,
1947,
1496,
13,
259,
366,
1122,
451,
671,
445,
934,
5174,
297,
752,
13036,
411,
278,
19245,
29889,
13,
259,
887,
1122,
4017,
263,
3509,
310,
278,
19245,
472,
13,
13,
539,
1732,
597,
1636,
29889,
4288,
29889,
990,
29914,
506,
11259,
29914,
27888,
1430,
1660,
29899,
29906,
29889,
29900,
13,
13,
259,
25870,
3734,
491,
22903,
4307,
470,
15502,
304,
297,
5007,
29892,
7047,
13,
259,
13235,
1090,
278,
19245,
338,
13235,
373,
385,
376,
3289,
8519,
29908,
350,
3289,
3235,
29892,
13,
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,
259,
2823,
278,
19245,
363,
278,
2702,
4086,
14765,
1076,
11239,
322,
13,
259,
27028,
1090,
278,
19245,
29889,
13,
12008,
13,
3166,
2090,
312,
8789,
1053,
11463,
567,
13,
13,
3166,
10772,
23908,
1053,
14705,
9203,
29892,
14705,
28707,
13,
13,
13,
1753,
731,
29918,
10685,
29918,
18127,
29898,
29888,
1125,
13,
1678,
9995,
13,
1678,
3826,
272,
1061,
304,
263,
1410,
29875,
3158,
1158,
313,
29872,
29889,
29887,
29889,
3519,
297,
14705,
28707,
29889,
29984,
8801,
29897,
304,
13,
1678,
731,
322,
443,
842,
263,
4480,
10677,
322,
443,
842,
1156,
278,
1158,
338,
7743,
29889,
13,
1678,
9995,
13,
13,
1678,
732,
29893,
336,
567,
29898,
29888,
29897,
13,
1678,
822,
437,
29918,
10685,
29918,
18127,
10456,
29874,
29892,
3579,
11022,
1125,
13,
4706,
1018,
29901,
13,
9651,
14705,
28707,
29889,
29984,
4873,
29889,
842,
4640,
19890,
29898,
17303,
9203,
29889,
17303,
29889,
15716,
19890,
29897,
13,
9651,
736,
285,
10456,
29874,
29892,
3579,
11022,
29897,
13,
4706,
7146,
29901,
13,
9651,
396,
29849,
443,
842,
13,
9651,
14705,
28707,
29889,
29984,
4873,
29889,
5060,
487,
4640,
19890,
580,
13,
1678,
736,
437,
29918,
10685,
29918,
18127,
13,
2
] |
local/models.py | rodrigondec/Open_CliEng | 3 | 124113 | <gh_stars>1-10
from django.db import models
# Create your models here.
class Predio(models.Model):
nome = models.CharField(max_length=200)
descricao = models.TextField(max_length=200, null=True)
def __str__(self):
return self.nome
class Setor(models.Model):
predio = models.ForeignKey(Predio, on_delete=models.CASCADE)
nome = models.CharField(max_length=200)
def __str__(self):
return self.nome | [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
3166,
9557,
29889,
2585,
1053,
4733,
13,
13,
29937,
6204,
596,
4733,
1244,
29889,
13,
1990,
21099,
601,
29898,
9794,
29889,
3195,
1125,
13,
1678,
9235,
353,
4733,
29889,
27890,
29898,
3317,
29918,
2848,
29922,
29906,
29900,
29900,
29897,
13,
1678,
5153,
21148,
29877,
353,
4733,
29889,
15778,
29898,
3317,
29918,
2848,
29922,
29906,
29900,
29900,
29892,
1870,
29922,
5574,
29897,
13,
13,
1678,
822,
4770,
710,
12035,
1311,
1125,
13,
4706,
736,
1583,
29889,
25155,
13,
13,
1990,
3789,
272,
29898,
9794,
29889,
3195,
1125,
13,
1678,
4450,
601,
353,
4733,
29889,
27755,
2558,
29898,
23084,
601,
29892,
373,
29918,
8143,
29922,
9794,
29889,
29907,
3289,
5454,
2287,
29897,
13,
1678,
9235,
353,
4733,
29889,
27890,
29898,
3317,
29918,
2848,
29922,
29906,
29900,
29900,
29897,
13,
13,
1678,
822,
4770,
710,
12035,
1311,
1125,
13,
4706,
736,
1583,
29889,
25155,
2
] |
tests/test_data.py | prabhathur/CF | 0 | 152544 | <filename>tests/test_data.py
import pytest
import dice_ml
from dice_ml.utils import helpers
def test_data_initiation(public_data_object, private_data_object):
assert isinstance(public_data_object, dice_ml.data_interfaces.public_data_interface.PublicData), "the given parameters should instantiate PublicData class"
assert isinstance(private_data_object, dice_ml.data_interfaces.private_data_interface.PrivateData), "the given parameters should instantiate PrivateData class"
class TestCommonDataMethods:
"""
Test methods common to Public and Private data interfaces modules.
"""
@pytest.fixture(autouse=True)
def _get_data_object(self, public_data_object, private_data_object):
self.d = [public_data_object, private_data_object]
def test_get_valid_mads(self):
# public data
for normalized in [True, False]:
mads = self.d[0].get_valid_mads(normalized=normalized, display_warnings=False, return_mads=True)
assert all(mads[feature] > 0 for feature in mads) # mads denotes variability in features and should be positive for DiCE.
if normalized:
min_value = 0
max_value = 1
errors = 0
for feature in mads:
if not normalized:
min_value = self.d[0].train_df[feature].min()
max_value = self.d[0].train_df[feature].max()
if mads[feature] > max_value - min_value:
errors += 1
assert errors==0 # mads can't be larger than the feature range
# private data
for normalized in [True, False]:
mads = self.d[1].get_valid_mads(normalized=normalized, display_warnings=False, return_mads=True)
assert all(mads[feature] == 1 for feature in mads) # no mad is provided for private data by default, so a practical alternative is keeping all value at 1. Check get_valid_mads() in data interface classes for more info.
@pytest.mark.parametrize(
"encode_categorical, output_query",
[(False, [0.068, 'Private', 'HS-grad', 'Single', 'Service', 'White', 'Female', 0.449]),
(True, [0.068, 0.449, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 1.0, 0.0])]
)
def test_prepare_query_instance(self, sample_adultincome_query, encode_categorical, output_query):
"""
Tests prepare_query_instance method that covnerts continuous features into [0,1] range and one-hot encodes categorical features.
"""
for d in self.d:
prepared_query = d.prepare_query_instance(query_instance=sample_adultincome_query, encode=encode_categorical).iloc[0].tolist()
if encode_categorical:
assert output_query == pytest.approx(prepared_query, abs=1e-3)
else:
for ix, name in enumerate(d.feature_names):
if name in d.continuous_feature_names:
assert output_query[ix] == pytest.approx(prepared_query[ix], abs=1e-3)
else:
assert output_query[ix] == prepared_query[ix]
def test_encoded_categorical_features(self):
"""
Tests if correct encoded categorical feature indexes are returned. Should work even when feature names are starting with common names.
"""
res = []
for d in self.d:
d.categorical_feature_names = ['cat1', 'cat2']
d.continuous_feature_names = ['cat2_cont1', 'cont2']
d.encoded_feature_names = ['cat2_cont1', 'cont2', 'cat1_val1', 'cat1_val2', 'cat2_val1', 'cat2_val2']
res.append(d.get_encoded_categorical_feature_indexes())
assert [[2, 3], [4, 5]] == res[0] # 2,3,4,5 are correct indexes of encoded categorical features and the data object's method should not return the first continuous feature that starts with the same name. Returned value should be a list of lists.
assert res[0] == res[1]
def test_features_to_vary(self):
"""
Tests if correct indexes of features are returned. Should work even when feature names are starting with common names.
"""
res = []
for d in self.d:
d.categorical_feature_names = ['cat1', 'cat2']
d.encoded_feature_names = ['cat2_cont1', 'cont2', 'cat1_val1', 'cat1_val2', 'cat2_val1', 'cat2_val2']
d.continuous_feature_names = ['cat2_cont1', 'cont2']
res.append(d.get_indexes_of_features_to_vary(features_to_vary=['cat2']))
assert [4, 5] == res[0] # 4,5 are correct indexes of features that can be varied and the data object's method should not return the first continuous feature that starts with the same name.
assert res[0] == res[1]
| [
1,
529,
9507,
29958,
21150,
29914,
1688,
29918,
1272,
29889,
2272,
13,
5215,
11451,
1688,
13,
13,
5215,
17629,
29918,
828,
13,
3166,
17629,
29918,
828,
29889,
13239,
1053,
1371,
414,
13,
13,
1753,
1243,
29918,
1272,
29918,
2344,
11685,
29898,
3597,
29918,
1272,
29918,
3318,
29892,
2024,
29918,
1272,
29918,
3318,
1125,
13,
1678,
4974,
338,
8758,
29898,
3597,
29918,
1272,
29918,
3318,
29892,
17629,
29918,
828,
29889,
1272,
29918,
1639,
8726,
29889,
3597,
29918,
1272,
29918,
13248,
29889,
19858,
1469,
511,
376,
1552,
2183,
4128,
881,
25112,
5236,
1469,
770,
29908,
13,
13,
1678,
4974,
338,
8758,
29898,
9053,
29918,
1272,
29918,
3318,
29892,
17629,
29918,
828,
29889,
1272,
29918,
1639,
8726,
29889,
9053,
29918,
1272,
29918,
13248,
29889,
25207,
1469,
511,
376,
1552,
2183,
4128,
881,
25112,
12230,
1469,
770,
29908,
13,
13,
1990,
4321,
18877,
1469,
26112,
29901,
13,
1678,
9995,
13,
1678,
4321,
3519,
3619,
304,
5236,
322,
12230,
848,
19510,
10585,
29889,
13,
1678,
9995,
13,
1678,
732,
2272,
1688,
29889,
7241,
15546,
29898,
1300,
1709,
29922,
5574,
29897,
13,
1678,
822,
903,
657,
29918,
1272,
29918,
3318,
29898,
1311,
29892,
970,
29918,
1272,
29918,
3318,
29892,
2024,
29918,
1272,
29918,
3318,
1125,
13,
4706,
1583,
29889,
29881,
353,
518,
3597,
29918,
1272,
29918,
3318,
29892,
2024,
29918,
1272,
29918,
3318,
29962,
13,
13,
1678,
822,
1243,
29918,
657,
29918,
3084,
29918,
29885,
7925,
29898,
1311,
1125,
13,
4706,
396,
970,
848,
13,
4706,
363,
4226,
1891,
297,
518,
5574,
29892,
7700,
5387,
13,
9651,
286,
7925,
353,
1583,
29889,
29881,
29961,
29900,
1822,
657,
29918,
3084,
29918,
29885,
7925,
29898,
8945,
1891,
29922,
8945,
1891,
29892,
2479,
29918,
25442,
886,
29922,
8824,
29892,
736,
29918,
29885,
7925,
29922,
5574,
29897,
13,
9651,
4974,
599,
29898,
29885,
7925,
29961,
14394,
29962,
1405,
29871,
29900,
363,
4682,
297,
286,
7925,
29897,
396,
286,
7925,
20169,
1197,
3097,
297,
5680,
322,
881,
367,
6374,
363,
4671,
4741,
29889,
13,
13,
9651,
565,
4226,
1891,
29901,
13,
18884,
1375,
29918,
1767,
353,
29871,
29900,
13,
18884,
4236,
29918,
1767,
353,
29871,
29896,
13,
13,
9651,
4436,
353,
29871,
29900,
13,
9651,
363,
4682,
297,
286,
7925,
29901,
13,
18884,
565,
451,
4226,
1891,
29901,
13,
462,
1678,
1375,
29918,
1767,
353,
1583,
29889,
29881,
29961,
29900,
1822,
14968,
29918,
2176,
29961,
14394,
1822,
1195,
580,
13,
462,
1678,
4236,
29918,
1767,
353,
1583,
29889,
29881,
29961,
29900,
1822,
14968,
29918,
2176,
29961,
14394,
1822,
3317,
580,
13,
13,
18884,
565,
286,
7925,
29961,
14394,
29962,
1405,
4236,
29918,
1767,
448,
1375,
29918,
1767,
29901,
13,
462,
1678,
4436,
4619,
29871,
29896,
13,
9651,
4974,
4436,
1360,
29900,
396,
286,
7925,
508,
29915,
29873,
367,
7200,
1135,
278,
4682,
3464,
13,
13,
4706,
396,
2024,
848,
13,
4706,
363,
4226,
1891,
297,
518,
5574,
29892,
7700,
5387,
13,
9651,
286,
7925,
353,
1583,
29889,
29881,
29961,
29896,
1822,
657,
29918,
3084,
29918,
29885,
7925,
29898,
8945,
1891,
29922,
8945,
1891,
29892,
2479,
29918,
25442,
886,
29922,
8824,
29892,
736,
29918,
29885,
7925,
29922,
5574,
29897,
13,
9651,
4974,
599,
29898,
29885,
7925,
29961,
14394,
29962,
1275,
29871,
29896,
363,
4682,
297,
286,
7925,
29897,
396,
694,
10395,
338,
4944,
363,
2024,
848,
491,
2322,
29892,
577,
263,
15031,
8671,
338,
12515,
599,
995,
472,
29871,
29896,
29889,
5399,
679,
29918,
3084,
29918,
29885,
7925,
580,
297,
848,
5067,
4413,
363,
901,
5235,
29889,
13,
13,
1678,
732,
2272,
1688,
29889,
3502,
29889,
3207,
300,
374,
911,
29898,
13,
1678,
376,
12508,
29918,
29883,
20440,
936,
29892,
1962,
29918,
1972,
613,
13,
1678,
17288,
8824,
29892,
518,
29900,
29889,
29900,
29953,
29947,
29892,
525,
25207,
742,
525,
14851,
29899,
5105,
742,
525,
15771,
742,
525,
3170,
742,
525,
21823,
742,
525,
29943,
331,
744,
742,
29871,
29900,
29889,
29946,
29946,
29929,
11724,
13,
1678,
313,
5574,
29892,
518,
29900,
29889,
29900,
29953,
29947,
29892,
29871,
29900,
29889,
29946,
29946,
29929,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29896,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29896,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29896,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29896,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29896,
29889,
29900,
29892,
29871,
29896,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
2314,
29962,
13,
1678,
1723,
13,
1678,
822,
1243,
29918,
19125,
29918,
1972,
29918,
8758,
29898,
1311,
29892,
4559,
29918,
328,
499,
262,
2763,
29918,
1972,
29892,
19750,
29918,
29883,
20440,
936,
29892,
1962,
29918,
1972,
1125,
13,
4706,
9995,
13,
4706,
4321,
29879,
19012,
29918,
1972,
29918,
8758,
1158,
393,
18838,
29876,
814,
29879,
9126,
5680,
964,
518,
29900,
29892,
29896,
29962,
3464,
322,
697,
29899,
8711,
2094,
2631,
11608,
936,
5680,
29889,
13,
4706,
9995,
13,
4706,
363,
270,
297,
1583,
29889,
29881,
29901,
13,
9651,
13240,
29918,
1972,
353,
270,
29889,
19125,
29918,
1972,
29918,
8758,
29898,
1972,
29918,
8758,
29922,
11249,
29918,
328,
499,
262,
2763,
29918,
1972,
29892,
19750,
29922,
12508,
29918,
29883,
20440,
936,
467,
309,
542,
29961,
29900,
1822,
25027,
391,
580,
13,
9651,
565,
19750,
29918,
29883,
20440,
936,
29901,
13,
18884,
4974,
1962,
29918,
1972,
1275,
11451,
1688,
29889,
14850,
29898,
15287,
1965,
29918,
1972,
29892,
6425,
29922,
29896,
29872,
29899,
29941,
29897,
13,
9651,
1683,
29901,
13,
18884,
363,
474,
29916,
29892,
1024,
297,
26985,
29898,
29881,
29889,
14394,
29918,
7039,
1125,
13,
462,
1678,
565,
1024,
297,
270,
29889,
20621,
681,
29918,
14394,
29918,
7039,
29901,
13,
462,
4706,
4974,
1962,
29918,
1972,
29961,
861,
29962,
1275,
11451,
1688,
29889,
14850,
29898,
15287,
1965,
29918,
1972,
29961,
861,
1402,
6425,
29922,
29896,
29872,
29899,
29941,
29897,
13,
462,
1678,
1683,
29901,
13,
462,
4706,
4974,
1962,
29918,
1972,
29961,
861,
29962,
1275,
13240,
29918,
1972,
29961,
861,
29962,
13,
13,
1678,
822,
1243,
29918,
26716,
29918,
29883,
20440,
936,
29918,
22100,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
4321,
29879,
565,
1959,
18511,
11608,
936,
4682,
18111,
526,
4133,
29889,
10575,
664,
1584,
746,
4682,
2983,
526,
6257,
411,
3619,
2983,
29889,
13,
4706,
9995,
13,
4706,
620,
353,
5159,
13,
4706,
363,
270,
297,
1583,
29889,
29881,
29901,
13,
9651,
270,
29889,
29883,
20440,
936,
29918,
14394,
29918,
7039,
353,
6024,
4117,
29896,
742,
525,
4117,
29906,
2033,
13,
9651,
270,
29889,
20621,
681,
29918,
14394,
29918,
7039,
353,
6024,
4117,
29906,
29918,
1285,
29896,
742,
525,
1285,
29906,
2033,
13,
9651,
270,
29889,
26716,
29918,
14394,
29918,
7039,
353,
6024,
4117,
29906,
29918,
1285,
29896,
742,
525,
1285,
29906,
742,
525,
4117,
29896,
29918,
791,
29896,
742,
525,
4117,
29896,
29918,
791,
29906,
742,
525,
4117,
29906,
29918,
791,
29896,
742,
525,
4117,
29906,
29918,
791,
29906,
2033,
13,
9651,
620,
29889,
4397,
29898,
29881,
29889,
657,
29918,
26716,
29918,
29883,
20440,
936,
29918,
14394,
29918,
2248,
267,
3101,
13,
4706,
4974,
5519,
29906,
29892,
29871,
29941,
1402,
518,
29946,
29892,
29871,
29945,
5262,
1275,
620,
29961,
29900,
29962,
396,
29871,
29906,
29892,
29941,
29892,
29946,
29892,
29945,
526,
1959,
18111,
310,
18511,
11608,
936,
5680,
322,
278,
848,
1203,
29915,
29879,
1158,
881,
451,
736,
278,
937,
9126,
4682,
393,
8665,
411,
278,
1021,
1024,
29889,
7106,
287,
995,
881,
367,
263,
1051,
310,
8857,
29889,
13,
4706,
4974,
620,
29961,
29900,
29962,
1275,
620,
29961,
29896,
29962,
13,
13,
1678,
822,
1243,
29918,
22100,
29918,
517,
29918,
29894,
653,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
4321,
29879,
565,
1959,
18111,
310,
5680,
526,
4133,
29889,
10575,
664,
1584,
746,
4682,
2983,
526,
6257,
411,
3619,
2983,
29889,
13,
4706,
9995,
13,
4706,
620,
353,
5159,
13,
4706,
363,
270,
297,
1583,
29889,
29881,
29901,
13,
9651,
270,
29889,
29883,
20440,
936,
29918,
14394,
29918,
7039,
353,
6024,
4117,
29896,
742,
525,
4117,
29906,
2033,
13,
9651,
270,
29889,
26716,
29918,
14394,
29918,
7039,
353,
6024,
4117,
29906,
29918,
1285,
29896,
742,
525,
1285,
29906,
742,
525,
4117,
29896,
29918,
791,
29896,
742,
525,
4117,
29896,
29918,
791,
29906,
742,
525,
4117,
29906,
29918,
791,
29896,
742,
525,
4117,
29906,
29918,
791,
29906,
2033,
13,
9651,
270,
29889,
20621,
681,
29918,
14394,
29918,
7039,
353,
6024,
4117,
29906,
29918,
1285,
29896,
742,
525,
1285,
29906,
2033,
13,
9651,
620,
29889,
4397,
29898,
29881,
29889,
657,
29918,
2248,
267,
29918,
974,
29918,
22100,
29918,
517,
29918,
29894,
653,
29898,
22100,
29918,
517,
29918,
29894,
653,
29922,
1839,
4117,
29906,
25901,
13,
4706,
4974,
518,
29946,
29892,
29871,
29945,
29962,
1275,
620,
29961,
29900,
29962,
396,
29871,
29946,
29892,
29945,
526,
1959,
18111,
310,
5680,
393,
508,
367,
23821,
322,
278,
848,
1203,
29915,
29879,
1158,
881,
451,
736,
278,
937,
9126,
4682,
393,
8665,
411,
278,
1021,
1024,
29889,
13,
4706,
4974,
620,
29961,
29900,
29962,
1275,
620,
29961,
29896,
29962,
13,
2
] |
tensor2tensor/trax/rlax/ppo.py | funtion/tensor2tensor | 1 | 4859 | # coding=utf-8
# Copyright 2019 The Tensor2Tensor Authors.
#
# 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.
"""PPO in JAX.
Notation:
B, scalar - batch size
T, scalar - number of time-steps in a trajectory, or the value of the padded
time-step dimension.
OBS, tuple - shape of a singular observation from the environment.
Ex: For CartPole-v0 this is (4,) and Pong-v0 it's (210, 160, 3)
A, scalar - Number of actions, assuming a discrete space.
Policy and Value function signatures:
Policy Function :: [B, T] + OBS -> [B, T, A]
Value Function :: [B, T] + OBS -> [B, T, 1]
Policy and Value Function :: [B, T] + OBS -> ([B, T, A], [B, T, 1])
i.e. the policy net should take a batch of *trajectories* and at each time-step
in each batch deliver a probability distribution over actions.
NOTE: It doesn't return logits, rather the expectation is that it returns
log-probabilities instead.
NOTE: The policy and value functions need to take care to not take into account
future time-steps while deciding the actions (or value) for the current
time-step.
Policy and Value Function produces a tuple of the expected output of a policy
function and a value function.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import functools
import os
import pickle
import time
from absl import logging
import gym
from jax import grad
from jax import jit
from jax import lax
from jax import numpy as np
from jax import random as jax_random
import numpy as onp
from tensor2tensor.envs import env_problem
from tensor2tensor.envs import env_problem_utils
from tensor2tensor.trax import jaxboard
from tensor2tensor.trax import layers
from tensor2tensor.trax import optimizers as trax_opt
from tensor2tensor.trax import trax
from tensorflow.io import gfile
DEBUG_LOGGING = False
GAMMA = 0.99
LAMBDA = 0.95
EPSILON = 0.1
EPOCHS = 50 # 100
NUM_OPTIMIZER_STEPS = 100
PRINT_EVERY_OPTIMIZER_STEP = 20
BATCH_TRAJECTORIES = 32
def policy_and_value_net(rng_key,
batch_observations_shape,
num_actions,
bottom_layers_fn=None,
two_towers=True):
"""A policy and value net function."""
# Layers.
# Now, with the current logits, one head computes action probabilities and the
# other computes the value function.
# NOTE: The LogSoftmax instead of the Softmax because of numerical stability.
net = None
if not two_towers:
tower = [] if bottom_layers_fn is None else bottom_layers_fn()
tower.extend([
layers.Branch(
layers.Serial(layers.Dense(num_actions), layers.LogSoftmax()),
layers.Dense(1))
])
net = layers.Serial(*tower)
else:
tower1 = [] if bottom_layers_fn is None else bottom_layers_fn()
tower2 = [] if bottom_layers_fn is None else bottom_layers_fn()
tower1.extend([layers.Dense(num_actions), layers.LogSoftmax()])
tower2.extend([layers.Dense(1)])
net = layers.Branch(
layers.Serial(*tower1),
layers.Serial(*tower2),
)
assert net
return net.initialize(batch_observations_shape, rng_key), net
def optimizer_fun(net_params, step_size=1e-3):
opt = trax_opt.Adam(step_size=step_size, b1=0.9, b2=0.999, eps=1e-08)
opt_init = lambda x: (x, opt.tree_init(x))
opt_update = lambda i, g, s: opt.tree_update(i, g, s[0], s[1])
get_params = lambda x: x[0]
opt_state = opt_init(net_params)
return opt_state, opt_update, get_params
# Should this be collect 'n' trajectories, or
# Run the env for 'n' steps and take completed trajectories, or
# Any other option?
# TODO(afrozm): Replace this with EnvProblem?
def collect_trajectories(env,
policy_fun,
num_trajectories=1,
policy=env_problem_utils.CATEGORICAL_SAMPLING,
max_timestep=None,
boundary=20,
epsilon=0.1,
reset=True,
rng=None):
"""Collect trajectories with the given policy net and behaviour.
Args:
env: A gym env interface, for now this is not-batched.
policy_fun: observations(B,T+1) -> log-probabs(B,T+1, A) callable.
num_trajectories: int, number of trajectories.
policy: string, "greedy", "epsilon-greedy", or "categorical-sampling" i.e.
how to use the policy_fun to return an action.
max_timestep: int or None, the index of the maximum time-step at which we
return the trajectory, None for ending a trajectory only when env returns
done.
boundary: int, boundary for padding, used in EnvProblem envs.
epsilon: float, the epsilon for `epsilon-greedy` policy.
reset: bool, true if we want to reset the envs. The envs are also reset if
max_max_timestep is None or < 0
rng: jax rng, splittable.
Returns:
A tuple (trajectory, number of trajectories that are done)
trajectory: list of (observation, action, reward) tuples, where each element
`i` is a tuple of numpy arrays with shapes as follows:
observation[i] = (B, T_i + 1)
action[i] = (B, T_i)
reward[i] = (B, T_i)
"""
assert isinstance(env, env_problem.EnvProblem)
# This is an env_problem, run its collect function.
return env_problem_utils.play_env_problem_with_policy(
env,
policy_fun,
num_trajectories=num_trajectories,
max_timestep=max_timestep,
boundary=boundary,
policy_sampling=policy,
eps=epsilon,
reset=reset,
rng=rng)
# This function can probably be simplified, ask how?
# Can we do something much simpler than lax.pad, maybe np.pad?
# Others?
def get_padding_value(dtype):
"""Returns the padding value given a dtype."""
padding_value = None
if dtype == np.uint8:
padding_value = np.uint8(0)
elif dtype == np.uint16:
padding_value = np.uint16(0)
elif dtype == np.float32 or dtype == np.float64:
padding_value = 0.0
else:
padding_value = 0
assert padding_value is not None
return padding_value
# TODO(afrozm): Use np.pad instead and make jittable?
def pad_trajectories(trajectories, boundary=20):
"""Pad trajectories to a bucket length that is a multiple of boundary.
Args:
trajectories: list[(observation, actions, rewards)], where each observation
is shaped (t+1,) + OBS and actions & rewards are shaped (t,), with the
length of the list being B (batch size).
boundary: int, bucket length, the actions and rewards are padded to integer
multiples of boundary.
Returns:
tuple: (padding lengths, reward_mask, padded_observations, padded_actions,
padded_rewards) where padded_observations is shaped (B, T+1) + OBS and
padded_actions, padded_rewards & reward_mask are shaped (B, T).
Where T is max(t) rounded up to an integer multiple of boundary.
padded_length is how much padding we've added and
reward_mask is 1s for actual rewards and 0s for the padding.
"""
# Let's compute max(t) over all trajectories.
t_max = max(r.shape[0] for (_, _, r) in trajectories)
# t_max is rounded to the next multiple of `boundary`
boundary = int(boundary)
bucket_length = boundary * int(np.ceil(float(t_max) / boundary))
# So all obs will be padded to t_max + 1 and actions and rewards to t_max.
padded_observations = []
padded_actions = []
padded_rewards = []
padded_lengths = []
reward_masks = []
for (o, a, r) in trajectories:
# Determine the amount to pad, this holds true for obs, actions and rewards.
num_to_pad = bucket_length + 1 - o.shape[0]
padded_lengths.append(num_to_pad)
if num_to_pad == 0:
padded_observations.append(o)
padded_actions.append(a)
padded_rewards.append(r)
reward_masks.append(onp.ones_like(r, dtype=np.int32))
continue
# First pad observations.
padding_config = [(0, num_to_pad, 0)]
for _ in range(o.ndim - 1):
padding_config.append((0, 0, 0))
padding_config = tuple(padding_config)
padding_value = get_padding_value(o.dtype)
action_padding_value = get_padding_value(a.dtype)
reward_padding_value = get_padding_value(r.dtype)
padded_obs = lax.pad(o, padding_value, padding_config)
padded_observations.append(padded_obs)
# Now pad actions and rewards.
assert a.ndim == 1 and r.ndim == 1
padding_config = ((0, num_to_pad, 0),)
padded_action = lax.pad(a, action_padding_value, padding_config)
padded_actions.append(padded_action)
padded_reward = lax.pad(r, reward_padding_value, padding_config)
padded_rewards.append(padded_reward)
# Also create the mask to use later.
reward_mask = onp.ones_like(r, dtype=np.int32)
reward_masks.append(lax.pad(reward_mask, 0, padding_config))
return padded_lengths, np.stack(reward_masks), np.stack(
padded_observations), np.stack(padded_actions), np.stack(padded_rewards)
# TODO(afrozm): JAX-ify this, this is too slow for pong.
def rewards_to_go(rewards, mask, gamma=0.99):
r"""Computes rewards to go.
Reward to go is defined as follows, the discounted reward that we have to
yet collect, going forward from this point, i.e.:
r2g_t = \sum_{l=0}^{\infty} (\gamma^{l} * reward_{t+l})
Args:
rewards: np.ndarray of shape (B, T) of rewards.
mask: np.ndarray of shape (B, T) of mask for the rewards.
gamma: float, discount factor.
Returns:
rewards to go, np.ndarray of shape (B, T).
"""
B, T = rewards.shape # pylint: disable=invalid-name,unused-variable
masked_rewards = rewards * mask # (B, T)
# We use the following recurrence relation, derived from the equation above:
#
# r2g[t+1] = (r2g[t] - r[t]) / gamma
#
# This means we'll need to calculate r2g[0] first and then r2g[1] and so on ..
#
# **However** this leads to overflows for long sequences: r2g[t] - r[t] > 0
# and gamma < 1.0, so the division keeps increasing.
#
# So we just run the recurrence in reverse, i.e.
#
# r2g[t] = r[t] + (gamma*r2g[t+1])
#
# This is much better, but might have lost updates since the (small) rewards
# at earlier time-steps may get added to a (very?) large sum.
# Compute r2g_{T-1} at the start and then compute backwards in time.
r2gs = [masked_rewards[:, -1]]
# Go from T-2 down to 0.
for t in reversed(range(T - 1)):
r2gs.append(masked_rewards[:, t] + (gamma * r2gs[-1]))
# The list should have length T.
assert T == len(r2gs)
# First we stack them in the correct way to make it (B, T), but these are
# still from newest (T-1) to oldest (0), so then we flip it on time axis.
return np.flip(np.stack(r2gs, axis=1), axis=1)
@jit
def value_loss_given_predictions(value_prediction,
rewards,
reward_mask,
gamma=0.99,
epsilon=0.2,
value_prediction_old=None):
"""Computes the value loss given the prediction of the value function.
Args:
value_prediction: np.ndarray of shape (B, T+1, 1)
rewards: np.ndarray of shape (B, T) of rewards.
reward_mask: np.ndarray of shape (B, T), the mask over rewards.
gamma: float, discount factor.
epsilon: float, clip-fraction, used if value_value_prediction_old isn't None
value_prediction_old: np.ndarray of shape (B, T+1, 1) of value predictions
using the old parameters. If provided, we incorporate this in the loss as
well. This is from the OpenAI baselines implementation.
Returns:
The average L2 value loss, averaged over instances where reward_mask is 1.
"""
B, T = rewards.shape # pylint: disable=invalid-name
assert (B, T) == reward_mask.shape
assert (B, T + 1, 1) == value_prediction.shape
value_prediction = np.squeeze(value_prediction, axis=2) # (B, T+1)
value_prediction = value_prediction[:, :-1] * reward_mask # (B, T)
r2g = rewards_to_go(rewards, reward_mask, gamma=gamma) # (B, T)
loss = (value_prediction - r2g)**2
# From the baselines implementation.
if value_prediction_old is not None:
value_prediction_old = np.squeeze(value_prediction_old, axis=2) # (B, T+1)
value_prediction_old = value_prediction_old[:, :-1] * reward_mask # (B, T)
v_clipped = value_prediction_old + np.clip(
value_prediction - value_prediction_old, -epsilon, epsilon)
v_clipped_loss = (v_clipped - r2g)**2
loss = np.maximum(v_clipped_loss, loss)
# Take an average on only the points where mask != 0.
return np.sum(loss) / np.sum(reward_mask)
# TODO(afrozm): JAX-ify this, this is too slow for pong.
def deltas(predicted_values, rewards, mask, gamma=0.99):
r"""Computes TD-residuals from V(s) and rewards.
Where a `delta`, i.e. a td-residual is defined as:
delta_{b,t} = r_{b,t} + \gamma * v_{b,t+1} - v_{b,t}.
Args:
predicted_values: ndarray of shape (B, T+1). NOTE: Expects axis 2 was
squeezed. These represent V(s_bt) for b < B and t < T+1
rewards: ndarray of shape (B, T) of rewards.
mask: ndarray of shape (B, T) of mask for rewards.
gamma: float, discount factor.
Returns:
ndarray of shape (B, T) of one-step TD-residuals.
"""
# `d`s are basically one-step TD residuals.
d = []
_, T = rewards.shape # pylint: disable=invalid-name
for t in range(T):
d.append(rewards[:, t] + (gamma * predicted_values[:, t + 1]) -
predicted_values[:, t])
return np.array(d).T * mask
def gae_advantages(td_deltas, mask, lambda_=0.95, gamma=0.99):
r"""Computes the GAE advantages given the one step TD-residuals.
The formula for a GAE advantage estimator is as follows:
A_{bt} = \sum_{l=0}^{\infty}(\gamma * \lambda)^{l}(\delta_{b,t+l}).
Internally we just call rewards_to_go, since it is the same computation.
Args:
td_deltas: np.ndarray of shape (B, T) of one step TD-residuals.
mask: np.ndarray of shape (B, T) of mask for the residuals. It maybe the
case that the `td_deltas` are already masked correctly since they are
produced by `deltas(...)`
lambda_: float, lambda parameter for GAE estimators.
gamma: float, lambda parameter for GAE estimators.
Returns:
GAE advantage estimates.
"""
return rewards_to_go(td_deltas, mask, lambda_ * gamma)
def chosen_probabs(probab_observations, actions):
"""Picks out the probabilities of the actions along batch and time-steps.
Args:
probab_observations: ndarray of shape `[B, T+1, A]`, where
probab_observations[b, t, i] contains the log-probability of action = i at
the t^th time-step in the b^th trajectory.
actions: ndarray of shape `[B, T]`, with each entry in [0, A) denoting which
action was chosen in the b^th trajectory's t^th time-step.
Returns:
`[B, T]` ndarray with the log-probabilities of the chosen actions.
"""
B, T = actions.shape # pylint: disable=invalid-name
assert (B, T + 1) == probab_observations.shape[:2]
return probab_observations[np.arange(B)[:, None], np.arange(T), actions]
def compute_probab_ratios(p_new, p_old, actions, reward_mask):
"""Computes the probability ratios for each time-step in a trajectory.
Args:
p_new: ndarray of shape [B, T+1, A] of the log-probabilities that the policy
network assigns to all the actions at each time-step in each batch using
the old parameters.
p_old: ndarray of shape [B, T+1, A], same as above, but using old policy
network parameters.
actions: ndarray of shape [B, T] where each element is from [0, A).
reward_mask: ndarray of shape [B, T] masking over probabilities.
Returns:
probab_ratios: ndarray of shape [B, T], where
probab_ratios_{b,t} = p_new_{b,t,action_{b,t}} / p_old_{b,t,action_{b,t}}
"""
B, T = actions.shape # pylint: disable=invalid-name
assert (B, T + 1) == p_old.shape[:2]
assert (B, T + 1) == p_new.shape[:2]
logp_old = chosen_probabs(p_old, actions)
logp_new = chosen_probabs(p_new, actions)
assert (B, T) == logp_old.shape
assert (B, T) == logp_new.shape
# Since these are log-probabilities, we just subtract them.
probab_ratios = np.exp(logp_new - logp_old) * reward_mask
assert (B, T) == probab_ratios.shape
return probab_ratios
def clipped_probab_ratios(probab_ratios, epsilon=0.2):
return np.clip(probab_ratios, 1 - epsilon, 1 + epsilon)
def clipped_objective(probab_ratios, advantages, reward_mask, epsilon=0.2):
return np.minimum(
probab_ratios * advantages,
clipped_probab_ratios(probab_ratios, epsilon=epsilon) *
advantages) * reward_mask
@jit
def ppo_loss_given_predictions(log_probab_actions_new,
log_probab_actions_old,
value_predictions_old,
padded_actions,
padded_rewards,
reward_mask,
gamma=0.99,
lambda_=0.95,
epsilon=0.2):
"""PPO objective, with an eventual minus sign, given predictions."""
B, T = padded_rewards.shape # pylint: disable=invalid-name
assert (B, T) == padded_actions.shape
assert (B, T) == reward_mask.shape
_, _, A = log_probab_actions_old.shape # pylint: disable=invalid-name
assert (B, T + 1, 1) == value_predictions_old.shape
assert (B, T + 1, A) == log_probab_actions_old.shape
assert (B, T + 1, A) == log_probab_actions_new.shape
# (B, T)
td_deltas = deltas(
np.squeeze(value_predictions_old, axis=2), # (B, T+1)
padded_rewards,
reward_mask,
gamma=gamma)
# (B, T)
advantages = gae_advantages(
td_deltas, reward_mask, lambda_=lambda_, gamma=gamma)
# Normalize the advantages.
advantages = (advantages - np.mean(advantages)) / np.std(advantages)
# (B, T)
ratios = compute_probab_ratios(log_probab_actions_new, log_probab_actions_old,
padded_actions, reward_mask)
assert (B, T) == ratios.shape
# (B, T)
objective = clipped_objective(
ratios, advantages, reward_mask, epsilon=epsilon)
assert (B, T) == objective.shape
# ()
average_objective = np.sum(objective) / np.sum(reward_mask)
# Loss is negative objective.
return -average_objective
@jit
def combined_loss_given_predictions(log_probab_actions_new,
log_probab_actions_old,
value_prediction_new,
value_prediction_old,
padded_actions,
padded_rewards,
reward_mask,
gamma=0.99,
lambda_=0.95,
epsilon=0.2,
c1=1.0,
c2=0.01):
"""Computes the combined (clipped loss + value loss) given predictions."""
loss_value = value_loss_given_predictions(
value_prediction_new,
padded_rewards,
reward_mask,
gamma=gamma,
value_prediction_old=value_prediction_old,
epsilon=epsilon)
loss_ppo = ppo_loss_given_predictions(
log_probab_actions_new,
log_probab_actions_old,
value_prediction_old,
padded_actions,
padded_rewards,
reward_mask,
gamma=gamma,
lambda_=lambda_,
epsilon=epsilon)
entropy_bonus = masked_entropy(log_probab_actions_new, reward_mask)
return (loss_ppo + (c1 * loss_value) - (c2 * entropy_bonus), loss_ppo,
loss_value, entropy_bonus)
@functools.partial(jit, static_argnums=(3,))
def combined_loss(new_params,
log_probab_actions_old,
value_predictions_old,
policy_and_value_net_apply,
padded_observations,
padded_actions,
padded_rewards,
reward_mask,
gamma=0.99,
lambda_=0.95,
epsilon=0.2,
c1=1.0,
c2=0.01,
rng=None):
"""Computes the combined (clipped loss + value loss) given observations."""
log_probab_actions_new, value_predictions_new = policy_and_value_net_apply(
padded_observations, new_params, rng=rng)
# (combined_loss, ppo_loss, value_loss, entropy_bonus)
return combined_loss_given_predictions(
log_probab_actions_new,
log_probab_actions_old,
value_predictions_new,
value_predictions_old,
padded_actions,
padded_rewards,
reward_mask,
gamma=gamma,
lambda_=lambda_,
epsilon=epsilon,
c1=c1,
c2=c2)
@functools.partial(jit, static_argnums=(2, 3, 4))
def policy_and_value_opt_step(i,
opt_state,
opt_update,
get_params,
policy_and_value_net_apply,
log_probab_actions_old,
value_predictions_old,
padded_observations,
padded_actions,
padded_rewards,
reward_mask,
c1=1.0,
c2=0.01,
gamma=0.99,
lambda_=0.95,
epsilon=0.1,
rng=None):
"""Policy and Value optimizer step."""
# Combined loss function given the new params.
def policy_and_value_loss(params):
"""Returns the combined loss given just parameters."""
(loss, _, _, _) = combined_loss(
params,
log_probab_actions_old,
value_predictions_old,
policy_and_value_net_apply,
padded_observations,
padded_actions,
padded_rewards,
reward_mask,
c1=c1,
c2=c2,
gamma=gamma,
lambda_=lambda_,
epsilon=epsilon,
rng=rng)
return loss
new_params = get_params(opt_state)
g = grad(policy_and_value_loss)(new_params)
# TODO(afrozm): Maybe clip gradients?
return opt_update(i, g, opt_state)
def get_time(t1, t2=None):
if t2 is None:
t2 = time.time()
return round((t2 - t1) * 1000, 2)
def approximate_kl(log_prob_new, log_prob_old, mask):
"""Computes the approximate KL divergence between the old and new log-probs.
Args:
log_prob_new: (B, T+1, A) log probs new
log_prob_old: (B, T+1, A) log probs old
mask: (B, T)
Returns:
Approximate KL.
"""
diff = log_prob_old - log_prob_new
# Cut the last time-step out.
diff = diff[:, :-1]
# Mask out the irrelevant part.
diff *= mask[:, :, np.newaxis] # make mask (B, T, 1)
# Average on non-masked part.
return np.sum(diff) / np.sum(mask)
def masked_entropy(log_probs, mask):
"""Computes the entropy for the given log-probs.
Args:
log_probs: (B, T+1, A) log probs
mask: (B, T) mask.
Returns:
Entropy.
"""
# Cut the last time-step out.
lp = log_probs[:, :-1]
# Mask out the irrelevant part.
lp *= mask[:, :, np.newaxis] # make mask (B, T, 1)
p = np.exp(lp) * mask[:, :, np.newaxis] # (B, T, 1)
# Average on non-masked part and take negative.
return -(np.sum(lp * p) / np.sum(mask))
def evaluate_policy(eval_env,
get_predictions,
boundary,
max_timestep=20000,
rng=None):
"""Evaluate the policy."""
avg_rewards = {}
for policy in [
env_problem_utils.CATEGORICAL_SAMPLING, env_problem_utils.GUMBEL_SAMPLING,
env_problem_utils.EPSILON_GREEDY
]:
trajs, _ = env_problem_utils.play_env_problem_with_policy(
eval_env,
get_predictions,
boundary=boundary,
max_timestep=max_timestep,
reset=True,
policy_sampling=policy,
rng=rng)
avg_rewards[policy] = float(sum(
np.sum(traj[2]) for traj in trajs)) / len(trajs)
return avg_rewards
def maybe_restore_params(output_dir, policy_and_value_net_params):
"""Maybe restore the params from the checkpoint dir.
Args:
output_dir: Directory where saved model checkpoints are stored.
policy_and_value_net_params: Default params, returned if model is'nt found.
Returns:
triple (restore (bool), params, iter(int)) where iter is the epoch from
which we restored the params, 0 is restore = False.
"""
model_files = gfile.glob(os.path.join(output_dir, "model-??????.pkl"))
if not model_files:
return False, policy_and_value_net_params, 0
model_file = sorted(model_files)[-1]
model_file_basename = os.path.basename(model_file) # model-??????.pkl
i = int(filter(str.isdigit, model_file_basename))
with gfile.GFile(model_file, "rb") as f:
policy_and_value_net_params = pickle.load(f)
return True, policy_and_value_net_params, i
def training_loop(
env=None,
epochs=EPOCHS,
policy_and_value_net_fun=None,
policy_and_value_optimizer_fun=None,
batch_size=BATCH_TRAJECTORIES,
num_optimizer_steps=NUM_OPTIMIZER_STEPS,
print_every_optimizer_steps=PRINT_EVERY_OPTIMIZER_STEP,
target_kl=0.01,
boundary=20,
max_timestep=None,
max_timestep_eval=20000,
random_seed=None,
gamma=GAMMA,
lambda_=LAMBDA,
epsilon=EPSILON,
c1=1.0,
c2=0.01,
output_dir=None,
eval_every_n=1000,
eval_env=None,
done_frac_for_policy_save=0.5,
enable_early_stopping=True,
env_name=None,
):
"""Runs the training loop for PPO, with fixed policy and value nets."""
assert env
assert output_dir
assert env_name
gfile.makedirs(output_dir)
# Create summary writers and history.
train_sw = jaxboard.SummaryWriter(os.path.join(output_dir, "train"))
timing_sw = jaxboard.SummaryWriter(os.path.join(output_dir, "timing"))
eval_sw = jaxboard.SummaryWriter(os.path.join(output_dir, "eval"))
train_sw.text("env_name", env_name)
timing_sw.text("env_name", env_name)
eval_sw.text("env_name", env_name)
jax_rng_key = trax.get_random_number_generator_and_set_seed(random_seed)
# Batch Observations Shape = [-1, -1] + OBS, because we will eventually call
# policy and value networks on shape [B, T] +_OBS
batch_observations_shape = (-1, -1) + env.observation_space.shape
assert isinstance(env.action_space, gym.spaces.Discrete)
num_actions = env.action_space.n
jax_rng_key, key1 = jax_random.split(jax_rng_key, num=2)
# Initialize the policy and value network.
policy_and_value_net_params, policy_and_value_net_apply = (
policy_and_value_net_fun(key1, batch_observations_shape, num_actions))
# Maybe restore the policy params. If there is nothing to restore, then
# iteration = 0 and policy_and_value_net_params are returned as is.
restore, policy_and_value_net_params, iteration = (
maybe_restore_params(output_dir, policy_and_value_net_params))
if restore:
logging.info("Restored parameters from iteration [%d]", iteration)
# We should start from the next iteration.
iteration += 1
policy_and_value_net_apply = jit(policy_and_value_net_apply)
# Initialize the optimizers.
policy_and_value_optimizer = (
policy_and_value_optimizer_fun(policy_and_value_net_params))
(policy_and_value_opt_state, policy_and_value_opt_update,
policy_and_value_get_params) = policy_and_value_optimizer
num_trajectories_done = 0
last_saved_at = 0
logging.info("Starting the PPO training loop.")
for i in range(iteration, epochs):
epoch_start_time = time.time()
# Params we'll use to collect the trajectories.
policy_and_value_net_params = policy_and_value_get_params(
policy_and_value_opt_state)
# A function to get the policy and value predictions.
def get_predictions(observations, rng=None):
"""Returns log-probs, value predictions and key back."""
key, key1 = jax_random.split(rng, num=2)
log_probs, value_preds = policy_and_value_net_apply(
observations, policy_and_value_net_params, rng=key1)
return log_probs, value_preds, key
# Evaluate the policy.
policy_eval_start_time = time.time()
if ((i + 1) % eval_every_n == 0) or (i == epochs - 1):
jax_rng_key, key = jax_random.split(jax_rng_key, num=2)
logging.vlog(1, "Epoch [% 6d] evaluating policy.", i)
avg_reward = evaluate_policy(
eval_env,
get_predictions,
boundary,
max_timestep=max_timestep_eval,
rng=key)
for k, v in avg_reward.items():
eval_sw.scalar("eval/mean_reward/%s" % k, v, step=i)
logging.info("Epoch [% 6d] Policy Evaluation [%s] = %10.2f", i, k, v)
policy_eval_time = get_time(policy_eval_start_time)
trajectory_collection_start_time = time.time()
logging.vlog(1, "Epoch [% 6d] collecting trajectories.", i)
jax_rng_key, key = jax_random.split(jax_rng_key)
trajs, num_done = collect_trajectories(
env,
policy_fun=get_predictions,
num_trajectories=batch_size,
max_timestep=max_timestep,
boundary=boundary,
rng=key,
reset=(i == 0) or restore,
epsilon=(10.0 / (i + 10.0))) # this is a different epsilon.
trajectory_collection_time = get_time(trajectory_collection_start_time)
logging.vlog(1, "Collecting trajectories took %0.2f msec.",
trajectory_collection_time)
avg_reward = float(sum(np.sum(traj[2]) for traj in trajs)) / len(trajs)
max_reward = max(np.sum(traj[2]) for traj in trajs)
min_reward = min(np.sum(traj[2]) for traj in trajs)
train_sw.scalar("train/mean_reward", avg_reward, step=i)
logging.vlog(1, "Rewards avg=[%0.2f], max=[%0.2f], min=[%0.2f], all=%s",
avg_reward, max_reward, min_reward,
[float(np.sum(traj[2])) for traj in trajs])
logging.vlog(1,
"Trajectory Length average=[%0.2f], max=[%0.2f], min=[%0.2f]",
float(sum(len(traj[0]) for traj in trajs)) / len(trajs),
max(len(traj[0]) for traj in trajs),
min(len(traj[0]) for traj in trajs))
logging.vlog(2, "Trajectory Lengths: %s", [len(traj[0]) for traj in trajs])
padding_start_time = time.time()
(_, reward_mask, padded_observations, padded_actions,
padded_rewards) = pad_trajectories(
trajs, boundary=boundary)
padding_time = get_time(padding_start_time)
logging.vlog(1, "Padding trajectories took %0.2f msec.",
get_time(padding_start_time))
logging.vlog(1, "Padded Observations' shape [%s]",
str(padded_observations.shape))
logging.vlog(1, "Padded Actions' shape [%s]", str(padded_actions.shape))
logging.vlog(1, "Padded Rewards' shape [%s]", str(padded_rewards.shape))
# Calculate log-probabilities and value predictions of the trajectories.
# We'll pass these to the loss functions so as to not get recomputed.
# NOTE:
# There is a slight problem here, if the policy network contains
# stochasticity in the log-probabilities (ex: dropout), then calculating
# these again here is not going to be correct and should be done in the
# collect function.
log_prob_recompute_start_time = time.time()
jax_rng_key, key = jax_random.split(jax_rng_key)
log_probabs_traj, value_predictions_traj, _ = get_predictions(
padded_observations, rng=key)
log_prob_recompute_time = get_time(log_prob_recompute_start_time)
# Some assertions.
B, T = padded_actions.shape # pylint: disable=invalid-name
assert (B, T) == padded_rewards.shape
assert (B, T) == reward_mask.shape
assert (B, T + 1) == padded_observations.shape[:2]
assert (B, T + 1) + env.observation_space.shape == padded_observations.shape
# Linear annealing from 0.1 to 0.0
# epsilon_schedule = epsilon if epochs == 1 else epsilon * (1.0 -
# (i /
# (epochs - 1)))
# Constant epsilon.
epsilon_schedule = epsilon
# Compute value and ppo losses.
jax_rng_key, key1 = jax_random.split(jax_rng_key, num=2)
logging.vlog(2, "Starting to compute P&V loss.")
loss_compute_start_time = time.time()
cur_combined_loss, cur_ppo_loss, cur_value_loss, entropy_bonus = (
combined_loss(
policy_and_value_net_params,
log_probabs_traj,
value_predictions_traj,
policy_and_value_net_apply,
padded_observations,
padded_actions,
padded_rewards,
reward_mask,
gamma=gamma,
lambda_=lambda_,
epsilon=epsilon_schedule,
c1=c1,
c2=c2,
rng=key1))
loss_compute_time = get_time(loss_compute_start_time)
logging.vlog(
1,
"Calculating P&V loss [%10.2f(%10.2f, %10.2f, %10.2f)] took %0.2f msec.",
cur_combined_loss, cur_value_loss, cur_ppo_loss, entropy_bonus,
get_time(loss_compute_start_time))
jax_rng_key, key1 = jax_random.split(jax_rng_key, num=2)
logging.vlog(1, "Policy and Value Optimization")
optimization_start_time = time.time()
keys = jax_random.split(key1, num=num_optimizer_steps)
for j in range(num_optimizer_steps):
k1, k2, k3 = jax_random.split(keys[j], num=3)
t = time.time()
# Update the optimizer state.
policy_and_value_opt_state = policy_and_value_opt_step(
j,
policy_and_value_opt_state,
policy_and_value_opt_update,
policy_and_value_get_params,
policy_and_value_net_apply,
log_probabs_traj,
value_predictions_traj,
padded_observations,
padded_actions,
padded_rewards,
reward_mask,
c1=c1,
c2=c2,
gamma=gamma,
lambda_=lambda_,
epsilon=epsilon_schedule,
rng=k1)
# Compute the approx KL for early stopping.
new_policy_and_value_net_params = policy_and_value_get_params(
policy_and_value_opt_state)
log_probab_actions_new, _ = policy_and_value_net_apply(
padded_observations, new_policy_and_value_net_params, rng=k2)
approx_kl = approximate_kl(log_probab_actions_new, log_probabs_traj,
reward_mask)
early_stopping = enable_early_stopping and approx_kl > 1.5 * target_kl
if early_stopping:
logging.vlog(
1, "Early stopping policy and value optimization at iter: %d, "
"with approx_kl: %0.2f", j, approx_kl)
# We don't return right-away, we want the below to execute on the last
# iteration.
t2 = time.time()
if (((j + 1) % print_every_optimizer_steps == 0) or
(j == num_optimizer_steps - 1) or early_stopping):
# Compute and log the loss.
(loss_combined, loss_ppo, loss_value, entropy_bonus) = (
combined_loss(
new_policy_and_value_net_params,
log_probabs_traj,
value_predictions_traj,
policy_and_value_net_apply,
padded_observations,
padded_actions,
padded_rewards,
reward_mask,
gamma=gamma,
lambda_=lambda_,
epsilon=epsilon_schedule,
c1=c1,
c2=c2,
rng=k3))
logging.vlog(1, "One Policy and Value grad desc took: %0.2f msec",
get_time(t, t2))
logging.vlog(
1, "Combined Loss(value, ppo, entropy_bonus) [%10.2f] ->"
" [%10.2f(%10.2f,%10.2f,%10.2f)]", cur_combined_loss, loss_combined,
loss_value, loss_ppo, entropy_bonus)
if early_stopping:
break
optimization_time = get_time(optimization_start_time)
logging.vlog(
1, "Total Combined Loss reduction [%0.2f]%%",
(100 * (cur_combined_loss - loss_combined) / np.abs(cur_combined_loss)))
# Save parameters every time we see the end of at least a fraction of batch
# number of trajectories that are done (not completed -- completed includes
# truncated and done).
# Also don't save too frequently, enforce a minimum gap.
# Or if this is the last iteration.
policy_save_start_time = time.time()
num_trajectories_done += num_done
if (((num_trajectories_done >= done_frac_for_policy_save * batch_size)
and (i - last_saved_at > eval_every_n)) or (i == epochs - 1)):
logging.vlog(1, "Epoch [% 6d] saving model.", i)
params_file = os.path.join(output_dir, "model-%06d.pkl" % i)
with gfile.GFile(params_file, "wb") as f:
pickle.dump(policy_and_value_net_params, f)
# Reset this number.
num_trajectories_done = 0
last_saved_at = i
policy_save_time = get_time(policy_save_start_time)
epoch_time = get_time(epoch_start_time)
logging.info(
"Epoch [% 6d], Reward[min, max, avg] [%5.2f,%5.2f,%5.2f], Combined"
" Loss(value, ppo, entropy) [%2.5f(%2.5f,%2.5f,%2.5f)]", i, min_reward,
max_reward, avg_reward, loss_combined, loss_value, loss_ppo,
entropy_bonus)
timing_dict = {
"epoch": epoch_time,
"policy_eval": policy_eval_time,
"trajectory_collection": trajectory_collection_time,
"padding": padding_time,
"log_prob_recompute": log_prob_recompute_time,
"loss_compute": loss_compute_time,
"optimization": optimization_time,
"policy_save": policy_save_time,
}
for k, v in timing_dict.items():
timing_sw.scalar("timing/%s" % k, v, step=i)
max_key_len = max(len(k) for k in timing_dict)
timing_info_list = [
"%s : % 10.2f" % (k.rjust(max_key_len + 1), v)
for k, v in sorted(timing_dict.items())
]
logging.info("Epoch [% 6d], Timings: \n%s", i, "\n".join(timing_info_list))
# Reset restore.
restore = False
# Flush summary writers once in a while.
if (i+1) % 1000 == 0 or i == epochs - 1:
train_sw.flush()
timing_sw.flush()
eval_sw.flush()
| [
1,
396,
14137,
29922,
9420,
29899,
29947,
13,
29937,
14187,
1266,
29871,
29906,
29900,
29896,
29929,
450,
323,
6073,
29906,
29911,
6073,
13189,
943,
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,
13,
15945,
29908,
29925,
13152,
297,
435,
6604,
29889,
13,
13,
3664,
362,
29901,
13,
13,
29933,
29892,
17336,
29871,
448,
9853,
2159,
13,
29911,
29892,
17336,
29871,
448,
1353,
310,
931,
29899,
24530,
297,
263,
23324,
706,
29892,
470,
278,
995,
310,
278,
282,
23959,
13,
632,
931,
29899,
10568,
9927,
29889,
13,
29949,
9851,
29892,
18761,
448,
8267,
310,
263,
13512,
15500,
515,
278,
5177,
29889,
13,
632,
1222,
29901,
1152,
12370,
29925,
1772,
29899,
29894,
29900,
445,
338,
313,
29946,
29892,
29897,
322,
349,
549,
29899,
29894,
29900,
372,
29915,
29879,
313,
29906,
29896,
29900,
29892,
29871,
29896,
29953,
29900,
29892,
29871,
29941,
29897,
13,
29909,
29892,
17336,
29871,
448,
9681,
310,
8820,
29892,
10241,
263,
19554,
2913,
29889,
13,
13,
15644,
322,
7865,
740,
1804,
3698,
29901,
13,
13,
15644,
9651,
6680,
4761,
518,
29933,
29892,
323,
29962,
718,
438,
9851,
1599,
29871,
518,
29933,
29892,
323,
29892,
319,
29962,
13,
1917,
632,
6680,
4761,
518,
29933,
29892,
323,
29962,
718,
438,
9851,
1599,
29871,
518,
29933,
29892,
323,
29892,
29871,
29896,
29962,
13,
15644,
322,
7865,
29871,
6680,
4761,
518,
29933,
29892,
323,
29962,
718,
438,
9851,
1599,
9310,
29933,
29892,
323,
29892,
319,
1402,
518,
29933,
29892,
323,
29892,
29871,
29896,
2314,
13,
13,
29875,
29889,
29872,
29889,
278,
8898,
7787,
881,
2125,
263,
9853,
310,
334,
3018,
622,
3842,
29930,
322,
472,
1269,
931,
29899,
10568,
13,
262,
1269,
9853,
12021,
263,
6976,
4978,
975,
8820,
29889,
13,
13,
12256,
29923,
29901,
739,
1838,
29915,
29873,
736,
1480,
1169,
29892,
3265,
278,
23227,
338,
393,
372,
3639,
13,
1188,
29899,
22795,
11614,
2012,
29889,
13,
13,
12256,
29923,
29901,
450,
8898,
322,
995,
3168,
817,
304,
2125,
2562,
304,
451,
2125,
964,
3633,
13,
29888,
9130,
931,
29899,
24530,
1550,
1602,
4821,
278,
8820,
313,
272,
995,
29897,
363,
278,
1857,
13,
2230,
29899,
10568,
29889,
13,
13,
15644,
322,
7865,
6680,
13880,
263,
18761,
310,
278,
3806,
1962,
310,
263,
8898,
13,
2220,
322,
263,
995,
740,
29889,
13,
13,
15945,
29908,
13,
13,
3166,
4770,
29888,
9130,
1649,
1053,
8380,
29918,
5215,
13,
3166,
4770,
29888,
9130,
1649,
1053,
8542,
13,
3166,
4770,
29888,
9130,
1649,
1053,
1596,
29918,
2220,
13,
13,
5215,
2090,
312,
8789,
13,
5215,
2897,
13,
5215,
5839,
280,
13,
5215,
931,
13,
13,
3166,
633,
2536,
1053,
12183,
13,
5215,
330,
962,
13,
3166,
432,
1165,
1053,
4656,
13,
3166,
432,
1165,
1053,
432,
277,
13,
3166,
432,
1165,
1053,
425,
29916,
13,
3166,
432,
1165,
1053,
12655,
408,
7442,
13,
3166,
432,
1165,
1053,
4036,
408,
432,
1165,
29918,
8172,
13,
5215,
12655,
408,
373,
29886,
13,
3166,
12489,
29906,
20158,
29889,
264,
4270,
1053,
8829,
29918,
17199,
13,
3166,
12489,
29906,
20158,
29889,
264,
4270,
1053,
8829,
29918,
17199,
29918,
13239,
13,
3166,
12489,
29906,
20158,
29889,
3018,
29916,
1053,
432,
1165,
3377,
13,
3166,
12489,
29906,
20158,
29889,
3018,
29916,
1053,
15359,
13,
3166,
12489,
29906,
20158,
29889,
3018,
29916,
1053,
5994,
19427,
408,
1020,
29916,
29918,
3670,
13,
3166,
12489,
29906,
20158,
29889,
3018,
29916,
1053,
1020,
29916,
13,
3166,
26110,
29889,
601,
1053,
330,
1445,
13,
13,
18525,
29918,
14480,
29954,
4214,
353,
7700,
13,
29954,
5194,
1529,
353,
29871,
29900,
29889,
29929,
29929,
13,
4375,
9486,
7698,
353,
29871,
29900,
29889,
29929,
29945,
13,
15488,
5425,
29931,
1164,
353,
29871,
29900,
29889,
29896,
13,
29923,
13152,
3210,
29903,
353,
29871,
29945,
29900,
29871,
396,
29871,
29896,
29900,
29900,
13,
13967,
29918,
14094,
7833,
26664,
1001,
29918,
1254,
29923,
7024,
353,
29871,
29896,
29900,
29900,
13,
10593,
10192,
29918,
29923,
5348,
29979,
29918,
14094,
7833,
26664,
1001,
29918,
1254,
15488,
353,
29871,
29906,
29900,
13,
29933,
14789,
29918,
29911,
4717,
17637,
1955,
29059,
353,
29871,
29941,
29906,
13,
13,
13,
1753,
8898,
29918,
392,
29918,
1767,
29918,
1212,
29898,
29878,
865,
29918,
1989,
29892,
13,
462,
308,
9853,
29918,
26739,
800,
29918,
12181,
29892,
13,
462,
308,
954,
29918,
7387,
29892,
13,
462,
308,
5970,
29918,
29277,
29918,
9144,
29922,
8516,
29892,
13,
462,
308,
1023,
29918,
29873,
340,
414,
29922,
5574,
1125,
13,
29871,
9995,
29909,
8898,
322,
995,
7787,
740,
1213,
15945,
13,
13,
29871,
396,
365,
388,
414,
29889,
13,
13,
29871,
396,
2567,
29892,
411,
278,
1857,
1480,
1169,
29892,
697,
2343,
2912,
267,
3158,
2070,
11614,
322,
278,
13,
29871,
396,
916,
2912,
267,
278,
995,
740,
29889,
13,
29871,
396,
6058,
29923,
29901,
450,
4522,
6295,
615,
3317,
2012,
310,
278,
1105,
615,
3317,
1363,
310,
16259,
25806,
29889,
13,
13,
29871,
7787,
353,
6213,
13,
29871,
565,
451,
1023,
29918,
29873,
340,
414,
29901,
13,
1678,
19372,
353,
5159,
565,
5970,
29918,
29277,
29918,
9144,
338,
6213,
1683,
5970,
29918,
29277,
29918,
9144,
580,
13,
1678,
19372,
29889,
21843,
4197,
13,
4706,
15359,
29889,
29933,
4014,
29898,
13,
9651,
15359,
29889,
9125,
29898,
29277,
29889,
29928,
1947,
29898,
1949,
29918,
7387,
511,
15359,
29889,
3403,
6295,
615,
3317,
25739,
13,
9651,
15359,
29889,
29928,
1947,
29898,
29896,
876,
13,
268,
2314,
13,
1678,
7787,
353,
15359,
29889,
9125,
10456,
29873,
1680,
29897,
13,
29871,
1683,
29901,
13,
1678,
19372,
29896,
353,
5159,
565,
5970,
29918,
29277,
29918,
9144,
338,
6213,
1683,
5970,
29918,
29277,
29918,
9144,
580,
13,
1678,
19372,
29906,
353,
5159,
565,
5970,
29918,
29277,
29918,
9144,
338,
6213,
1683,
5970,
29918,
29277,
29918,
9144,
580,
13,
13,
1678,
19372,
29896,
29889,
21843,
4197,
29277,
29889,
29928,
1947,
29898,
1949,
29918,
7387,
511,
15359,
29889,
3403,
6295,
615,
3317,
580,
2314,
13,
1678,
19372,
29906,
29889,
21843,
4197,
29277,
29889,
29928,
1947,
29898,
29896,
29897,
2314,
13,
13,
1678,
7787,
353,
15359,
29889,
29933,
4014,
29898,
13,
4706,
15359,
29889,
9125,
10456,
29873,
1680,
29896,
511,
13,
4706,
15359,
29889,
9125,
10456,
29873,
1680,
29906,
511,
13,
1678,
1723,
13,
29871,
4974,
7787,
13,
29871,
736,
7787,
29889,
24926,
29898,
16175,
29918,
26739,
800,
29918,
12181,
29892,
364,
865,
29918,
1989,
511,
7787,
13,
13,
13,
1753,
5994,
3950,
29918,
7692,
29898,
1212,
29918,
7529,
29892,
4331,
29918,
2311,
29922,
29896,
29872,
29899,
29941,
1125,
13,
29871,
3523,
353,
1020,
29916,
29918,
3670,
29889,
3253,
314,
29898,
10568,
29918,
2311,
29922,
10568,
29918,
2311,
29892,
289,
29896,
29922,
29900,
29889,
29929,
29892,
289,
29906,
29922,
29900,
29889,
29929,
29929,
29929,
29892,
321,
567,
29922,
29896,
29872,
29899,
29900,
29947,
29897,
13,
29871,
3523,
29918,
2344,
353,
14013,
921,
29901,
313,
29916,
29892,
3523,
29889,
8336,
29918,
2344,
29898,
29916,
876,
13,
29871,
3523,
29918,
5504,
353,
14013,
474,
29892,
330,
29892,
269,
29901,
3523,
29889,
8336,
29918,
5504,
29898,
29875,
29892,
330,
29892,
269,
29961,
29900,
1402,
269,
29961,
29896,
2314,
13,
29871,
679,
29918,
7529,
353,
14013,
921,
29901,
921,
29961,
29900,
29962,
13,
29871,
3523,
29918,
3859,
353,
3523,
29918,
2344,
29898,
1212,
29918,
7529,
29897,
13,
29871,
736,
3523,
29918,
3859,
29892,
3523,
29918,
5504,
29892,
679,
29918,
7529,
13,
13,
13,
29937,
10575,
445,
367,
6314,
525,
29876,
29915,
23324,
3842,
29892,
470,
13,
29937,
7525,
278,
8829,
363,
525,
29876,
29915,
6576,
322,
2125,
8676,
23324,
3842,
29892,
470,
13,
29937,
3139,
916,
2984,
29973,
13,
29937,
14402,
29898,
2142,
307,
14018,
1125,
22108,
445,
411,
1174,
29894,
26604,
29973,
13,
1753,
6314,
29918,
3018,
622,
3842,
29898,
6272,
29892,
13,
462,
308,
8898,
29918,
7692,
29892,
13,
462,
308,
954,
29918,
3018,
622,
3842,
29922,
29896,
29892,
13,
462,
308,
8898,
29922,
6272,
29918,
17199,
29918,
13239,
29889,
29907,
3040,
29954,
1955,
2965,
1964,
29918,
8132,
3580,
29931,
4214,
29892,
13,
462,
308,
4236,
29918,
9346,
342,
1022,
29922,
8516,
29892,
13,
462,
308,
10452,
29922,
29906,
29900,
29892,
13,
462,
308,
321,
3232,
29922,
29900,
29889,
29896,
29892,
13,
462,
308,
10092,
29922,
5574,
29892,
13,
462,
308,
364,
865,
29922,
8516,
1125,
13,
29871,
9995,
28916,
23324,
3842,
411,
278,
2183,
8898,
7787,
322,
10468,
29889,
13,
13,
29871,
826,
3174,
29901,
13,
1678,
8829,
29901,
319,
330,
962,
8829,
5067,
29892,
363,
1286,
445,
338,
451,
29899,
16175,
287,
29889,
13,
1678,
8898,
29918,
7692,
29901,
13917,
29898,
29933,
29892,
29911,
29974,
29896,
29897,
1599,
1480,
29899,
22795,
6897,
29898,
29933,
29892,
29911,
29974,
29896,
29892,
319,
29897,
1246,
519,
29889,
13,
1678,
954,
29918,
3018,
622,
3842,
29901,
938,
29892,
1353,
310,
23324,
3842,
29889,
13,
1678,
8898,
29901,
1347,
29892,
376,
7979,
7584,
613,
376,
5463,
29899,
7979,
7584,
613,
470,
376,
29883,
20440,
936,
29899,
13445,
10335,
29908,
474,
29889,
29872,
29889,
13,
418,
920,
304,
671,
278,
8898,
29918,
7692,
304,
736,
385,
3158,
29889,
13,
1678,
4236,
29918,
9346,
342,
1022,
29901,
938,
470,
6213,
29892,
278,
2380,
310,
278,
7472,
931,
29899,
10568,
472,
607,
591,
13,
418,
736,
278,
23324,
706,
29892,
6213,
363,
17140,
263,
23324,
706,
871,
746,
8829,
3639,
13,
418,
2309,
29889,
13,
1678,
10452,
29901,
938,
29892,
10452,
363,
7164,
29892,
1304,
297,
1174,
29894,
26604,
427,
4270,
29889,
13,
1678,
321,
3232,
29901,
5785,
29892,
278,
321,
3232,
363,
421,
5463,
29899,
7979,
7584,
29952,
8898,
29889,
13,
1678,
10092,
29901,
6120,
29892,
1565,
565,
591,
864,
304,
10092,
278,
427,
4270,
29889,
450,
427,
4270,
526,
884,
10092,
565,
13,
418,
4236,
29918,
3317,
29918,
9346,
342,
1022,
338,
6213,
470,
529,
29871,
29900,
13,
1678,
364,
865,
29901,
432,
1165,
364,
865,
29892,
8536,
986,
519,
29889,
13,
13,
29871,
16969,
29901,
13,
1678,
319,
18761,
313,
3018,
622,
706,
29892,
1353,
310,
23324,
3842,
393,
526,
2309,
29897,
13,
1678,
23324,
706,
29901,
1051,
310,
313,
26739,
362,
29892,
3158,
29892,
20751,
29897,
5291,
2701,
29892,
988,
1269,
1543,
13,
1678,
421,
29875,
29952,
338,
263,
18761,
310,
12655,
7049,
411,
25834,
408,
4477,
29901,
13,
1678,
15500,
29961,
29875,
29962,
353,
313,
29933,
29892,
323,
29918,
29875,
718,
29871,
29896,
29897,
13,
1678,
3158,
29961,
29875,
29962,
353,
313,
29933,
29892,
323,
29918,
29875,
29897,
13,
1678,
20751,
29961,
29875,
29962,
353,
313,
29933,
29892,
323,
29918,
29875,
29897,
13,
29871,
9995,
13,
13,
29871,
4974,
338,
8758,
29898,
6272,
29892,
8829,
29918,
17199,
29889,
21745,
26604,
29897,
13,
29871,
396,
910,
338,
385,
8829,
29918,
17199,
29892,
1065,
967,
6314,
740,
29889,
13,
29871,
736,
8829,
29918,
17199,
29918,
13239,
29889,
1456,
29918,
6272,
29918,
17199,
29918,
2541,
29918,
22197,
29898,
13,
418,
8829,
29892,
13,
418,
8898,
29918,
7692,
29892,
13,
418,
954,
29918,
3018,
622,
3842,
29922,
1949,
29918,
3018,
622,
3842,
29892,
13,
418,
4236,
29918,
9346,
342,
1022,
29922,
3317,
29918,
9346,
342,
1022,
29892,
13,
418,
10452,
29922,
9917,
653,
29892,
13,
418,
8898,
29918,
13445,
10335,
29922,
22197,
29892,
13,
418,
321,
567,
29922,
5463,
29892,
13,
418,
10092,
29922,
12071,
29892,
13,
418,
364,
865,
29922,
29878,
865,
29897,
13,
13,
13,
29937,
910,
740,
508,
3117,
367,
20875,
29892,
2244,
920,
29973,
13,
29937,
1815,
591,
437,
1554,
1568,
13682,
1135,
425,
29916,
29889,
8305,
29892,
5505,
7442,
29889,
8305,
29973,
13,
29937,
438,
3341,
29973,
13,
13,
13,
1753,
679,
29918,
12791,
29918,
1767,
29898,
29881,
1853,
1125,
13,
29871,
9995,
11609,
29879,
278,
7164,
995,
2183,
263,
26688,
1213,
15945,
13,
29871,
7164,
29918,
1767,
353,
6213,
13,
29871,
565,
26688,
1275,
7442,
29889,
13470,
29947,
29901,
13,
1678,
7164,
29918,
1767,
353,
7442,
29889,
13470,
29947,
29898,
29900,
29897,
13,
29871,
25342,
26688,
1275,
7442,
29889,
13470,
29896,
29953,
29901,
13,
1678,
7164,
29918,
1767,
353,
7442,
29889,
13470,
29896,
29953,
29898,
29900,
29897,
13,
29871,
25342,
26688,
1275,
7442,
29889,
7411,
29941,
29906,
470,
26688,
1275,
7442,
29889,
7411,
29953,
29946,
29901,
13,
1678,
7164,
29918,
1767,
353,
29871,
29900,
29889,
29900,
13,
29871,
1683,
29901,
13,
1678,
7164,
29918,
1767,
353,
29871,
29900,
13,
29871,
4974,
7164,
29918,
1767,
338,
451,
6213,
13,
29871,
736,
7164,
29918,
1767,
13,
13,
13,
29937,
14402,
29898,
2142,
307,
14018,
1125,
4803,
7442,
29889,
8305,
2012,
322,
1207,
432,
986,
519,
29973,
13,
1753,
17132,
29918,
3018,
622,
3842,
29898,
3018,
622,
3842,
29892,
10452,
29922,
29906,
29900,
1125,
13,
29871,
9995,
20369,
23324,
3842,
304,
263,
20968,
3309,
393,
338,
263,
2999,
310,
10452,
29889,
13,
13,
29871,
826,
3174,
29901,
13,
1678,
23324,
3842,
29901,
1051,
15625,
26739,
362,
29892,
8820,
29892,
337,
2935,
29897,
1402,
988,
1269,
15500,
13,
418,
338,
528,
10501,
313,
29873,
29974,
29896,
29892,
29897,
718,
438,
9851,
322,
8820,
669,
337,
2935,
526,
528,
10501,
313,
29873,
29892,
511,
411,
278,
13,
418,
3309,
310,
278,
1051,
1641,
350,
313,
16175,
2159,
467,
13,
1678,
10452,
29901,
938,
29892,
20968,
3309,
29892,
278,
8820,
322,
337,
2935,
526,
282,
23959,
304,
6043,
13,
418,
2473,
2701,
310,
10452,
29889,
13,
13,
29871,
16969,
29901,
13,
1678,
18761,
29901,
313,
12791,
27497,
29892,
20751,
29918,
13168,
29892,
282,
23959,
29918,
26739,
800,
29892,
282,
23959,
29918,
7387,
29892,
13,
4706,
282,
23959,
29918,
276,
2935,
29897,
988,
282,
23959,
29918,
26739,
800,
338,
528,
10501,
313,
29933,
29892,
323,
29974,
29896,
29897,
718,
438,
9851,
322,
13,
4706,
282,
23959,
29918,
7387,
29892,
282,
23959,
29918,
276,
2935,
669,
20751,
29918,
13168,
526,
528,
10501,
313,
29933,
29892,
323,
467,
13,
4706,
6804,
323,
338,
4236,
29898,
29873,
29897,
28240,
701,
304,
385,
6043,
2999,
310,
10452,
29889,
13,
4706,
282,
23959,
29918,
2848,
338,
920,
1568,
7164,
591,
29915,
345,
2715,
322,
13,
4706,
20751,
29918,
13168,
338,
29871,
29896,
29879,
363,
3935,
337,
2935,
322,
29871,
29900,
29879,
363,
278,
7164,
29889,
13,
29871,
9995,
13,
13,
29871,
396,
2803,
29915,
29879,
10272,
4236,
29898,
29873,
29897,
975,
599,
23324,
3842,
29889,
13,
29871,
260,
29918,
3317,
353,
4236,
29898,
29878,
29889,
12181,
29961,
29900,
29962,
363,
313,
3383,
17117,
364,
29897,
297,
23324,
3842,
29897,
13,
13,
29871,
396,
260,
29918,
3317,
338,
28240,
304,
278,
2446,
2999,
310,
421,
9917,
653,
29952,
13,
29871,
10452,
353,
938,
29898,
9917,
653,
29897,
13,
29871,
20968,
29918,
2848,
353,
10452,
334,
938,
29898,
9302,
29889,
27696,
29898,
7411,
29898,
29873,
29918,
3317,
29897,
847,
10452,
876,
13,
13,
29871,
396,
1105,
599,
20881,
674,
367,
282,
23959,
304,
260,
29918,
3317,
718,
29871,
29896,
322,
8820,
322,
337,
2935,
304,
260,
29918,
3317,
29889,
13,
29871,
282,
23959,
29918,
26739,
800,
353,
5159,
13,
29871,
282,
23959,
29918,
7387,
353,
5159,
13,
29871,
282,
23959,
29918,
276,
2935,
353,
5159,
13,
29871,
282,
23959,
29918,
2848,
29879,
353,
5159,
13,
29871,
20751,
29918,
13168,
29879,
353,
5159,
13,
29871,
363,
313,
29877,
29892,
263,
29892,
364,
29897,
297,
23324,
3842,
29901,
13,
1678,
396,
5953,
837,
457,
278,
5253,
304,
17132,
29892,
445,
8640,
1565,
363,
20881,
29892,
8820,
322,
337,
2935,
29889,
13,
1678,
954,
29918,
517,
29918,
8305,
353,
20968,
29918,
2848,
718,
29871,
29896,
448,
288,
29889,
12181,
29961,
29900,
29962,
13,
1678,
282,
23959,
29918,
2848,
29879,
29889,
4397,
29898,
1949,
29918,
517,
29918,
8305,
29897,
13,
1678,
565,
954,
29918,
517,
29918,
8305,
1275,
29871,
29900,
29901,
13,
418,
282,
23959,
29918,
26739,
800,
29889,
4397,
29898,
29877,
29897,
13,
418,
282,
23959,
29918,
7387,
29889,
4397,
29898,
29874,
29897,
13,
418,
282,
23959,
29918,
276,
2935,
29889,
4397,
29898,
29878,
29897,
13,
418,
20751,
29918,
13168,
29879,
29889,
4397,
29898,
265,
29886,
29889,
2873,
29918,
4561,
29898,
29878,
29892,
26688,
29922,
9302,
29889,
524,
29941,
29906,
876,
13,
418,
6773,
13,
13,
1678,
396,
3824,
17132,
13917,
29889,
13,
1678,
7164,
29918,
2917,
353,
17288,
29900,
29892,
954,
29918,
517,
29918,
8305,
29892,
29871,
29900,
4638,
13,
1678,
363,
903,
297,
3464,
29898,
29877,
29889,
299,
326,
448,
29871,
29896,
1125,
13,
418,
7164,
29918,
2917,
29889,
4397,
3552,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
876,
13,
1678,
7164,
29918,
2917,
353,
18761,
29898,
12791,
29918,
2917,
29897,
13,
13,
1678,
7164,
29918,
1767,
353,
679,
29918,
12791,
29918,
1767,
29898,
29877,
29889,
29881,
1853,
29897,
13,
1678,
3158,
29918,
12791,
29918,
1767,
353,
679,
29918,
12791,
29918,
1767,
29898,
29874,
29889,
29881,
1853,
29897,
13,
1678,
20751,
29918,
12791,
29918,
1767,
353,
679,
29918,
12791,
29918,
1767,
29898,
29878,
29889,
29881,
1853,
29897,
13,
13,
1678,
282,
23959,
29918,
26290,
353,
425,
29916,
29889,
8305,
29898,
29877,
29892,
7164,
29918,
1767,
29892,
7164,
29918,
2917,
29897,
13,
1678,
282,
23959,
29918,
26739,
800,
29889,
4397,
29898,
29886,
23959,
29918,
26290,
29897,
13,
13,
1678,
396,
2567,
17132,
8820,
322,
337,
2935,
29889,
13,
1678,
4974,
263,
29889,
299,
326,
1275,
29871,
29896,
322,
364,
29889,
299,
326,
1275,
29871,
29896,
13,
1678,
7164,
29918,
2917,
353,
5135,
29900,
29892,
954,
29918,
517,
29918,
8305,
29892,
29871,
29900,
511,
29897,
13,
13,
1678,
282,
23959,
29918,
2467,
353,
425,
29916,
29889,
8305,
29898,
29874,
29892,
3158,
29918,
12791,
29918,
1767,
29892,
7164,
29918,
2917,
29897,
13,
1678,
282,
23959,
29918,
7387,
29889,
4397,
29898,
29886,
23959,
29918,
2467,
29897,
13,
1678,
282,
23959,
29918,
276,
1328,
353,
425,
29916,
29889,
8305,
29898,
29878,
29892,
20751,
29918,
12791,
29918,
1767,
29892,
7164,
29918,
2917,
29897,
13,
1678,
282,
23959,
29918,
276,
2935,
29889,
4397,
29898,
29886,
23959,
29918,
276,
1328,
29897,
13,
13,
1678,
396,
3115,
1653,
278,
11105,
304,
671,
2678,
29889,
13,
1678,
20751,
29918,
13168,
353,
373,
29886,
29889,
2873,
29918,
4561,
29898,
29878,
29892,
26688,
29922,
9302,
29889,
524,
29941,
29906,
29897,
13,
1678,
20751,
29918,
13168,
29879,
29889,
4397,
29898,
21222,
29889,
8305,
29898,
276,
1328,
29918,
13168,
29892,
29871,
29900,
29892,
7164,
29918,
2917,
876,
13,
13,
29871,
736,
282,
23959,
29918,
2848,
29879,
29892,
7442,
29889,
1429,
29898,
276,
1328,
29918,
13168,
29879,
511,
7442,
29889,
1429,
29898,
13,
418,
282,
23959,
29918,
26739,
800,
511,
7442,
29889,
1429,
29898,
29886,
23959,
29918,
7387,
511,
7442,
29889,
1429,
29898,
29886,
23959,
29918,
276,
2935,
29897,
13,
13,
13,
29937,
14402,
29898,
2142,
307,
14018,
1125,
435,
6604,
29899,
1598,
445,
29892,
445,
338,
2086,
5232,
363,
282,
549,
29889,
13,
1753,
337,
2935,
29918,
517,
29918,
1484,
29898,
276,
2935,
29892,
11105,
29892,
330,
2735,
29922,
29900,
29889,
29929,
29929,
1125,
13,
29871,
364,
15945,
29908,
20606,
267,
337,
2935,
304,
748,
29889,
13,
13,
29871,
390,
809,
538,
304,
748,
338,
3342,
408,
4477,
29892,
278,
2313,
792,
287,
20751,
393,
591,
505,
304,
13,
29871,
3447,
6314,
29892,
2675,
6375,
515,
445,
1298,
29892,
474,
29889,
29872,
4898,
13,
13,
29871,
364,
29906,
29887,
29918,
29873,
353,
320,
2083,
648,
29880,
29922,
29900,
6292,
3411,
29913,
3441,
4283,
998,
29880,
29913,
334,
20751,
648,
29873,
29974,
29880,
1800,
13,
13,
29871,
826,
3174,
29901,
13,
1678,
337,
2935,
29901,
7442,
29889,
299,
2378,
310,
8267,
313,
29933,
29892,
323,
29897,
310,
337,
2935,
29889,
13,
1678,
11105,
29901,
7442,
29889,
299,
2378,
310,
8267,
313,
29933,
29892,
323,
29897,
310,
11105,
363,
278,
337,
2935,
29889,
13,
1678,
330,
2735,
29901,
5785,
29892,
2313,
792,
7329,
29889,
13,
13,
29871,
16969,
29901,
13,
1678,
337,
2935,
304,
748,
29892,
7442,
29889,
299,
2378,
310,
8267,
313,
29933,
29892,
323,
467,
13,
29871,
9995,
13,
29871,
350,
29892,
323,
353,
337,
2935,
29889,
12181,
29871,
396,
282,
2904,
524,
29901,
11262,
29922,
20965,
29899,
978,
29892,
348,
3880,
29899,
11918,
13,
13,
29871,
11105,
287,
29918,
276,
2935,
353,
337,
2935,
334,
11105,
29871,
396,
313,
29933,
29892,
323,
29897,
13,
13,
29871,
396,
1334,
671,
278,
1494,
1162,
26841,
8220,
29892,
10723,
515,
278,
6306,
2038,
29901,
13,
29871,
396,
13,
29871,
396,
364,
29906,
29887,
29961,
29873,
29974,
29896,
29962,
353,
313,
29878,
29906,
29887,
29961,
29873,
29962,
448,
364,
29961,
29873,
2314,
847,
330,
2735,
13,
29871,
396,
13,
29871,
396,
910,
2794,
591,
29915,
645,
817,
304,
8147,
364,
29906,
29887,
29961,
29900,
29962,
937,
322,
769,
364,
29906,
29887,
29961,
29896,
29962,
322,
577,
373,
6317,
13,
29871,
396,
13,
29871,
396,
3579,
17245,
1068,
445,
11981,
304,
11969,
29879,
363,
1472,
15602,
29901,
364,
29906,
29887,
29961,
29873,
29962,
448,
364,
29961,
29873,
29962,
1405,
29871,
29900,
13,
29871,
396,
322,
330,
2735,
529,
29871,
29896,
29889,
29900,
29892,
577,
278,
8542,
14874,
10231,
29889,
13,
29871,
396,
13,
29871,
396,
1105,
591,
925,
1065,
278,
1162,
26841,
297,
11837,
29892,
474,
29889,
29872,
29889,
13,
29871,
396,
13,
29871,
396,
364,
29906,
29887,
29961,
29873,
29962,
353,
364,
29961,
29873,
29962,
718,
313,
4283,
29930,
29878,
29906,
29887,
29961,
29873,
29974,
29896,
2314,
13,
29871,
396,
13,
29871,
396,
910,
338,
1568,
2253,
29892,
541,
1795,
505,
5714,
11217,
1951,
278,
313,
9278,
29897,
337,
2935,
13,
29871,
396,
472,
8859,
931,
29899,
24530,
1122,
679,
2715,
304,
263,
313,
1201,
7897,
2919,
2533,
29889,
13,
13,
29871,
396,
11796,
29872,
364,
29906,
29887,
648,
29911,
29899,
29896,
29913,
472,
278,
1369,
322,
769,
10272,
28953,
297,
931,
29889,
13,
29871,
364,
29906,
3174,
353,
518,
13168,
287,
29918,
276,
2935,
7503,
29892,
448,
29896,
5262,
13,
13,
29871,
396,
2921,
515,
323,
29899,
29906,
1623,
304,
29871,
29900,
29889,
13,
29871,
363,
260,
297,
18764,
287,
29898,
3881,
29898,
29911,
448,
29871,
29896,
22164,
13,
1678,
364,
29906,
3174,
29889,
4397,
29898,
13168,
287,
29918,
276,
2935,
7503,
29892,
260,
29962,
718,
313,
4283,
334,
364,
29906,
3174,
14352,
29896,
12622,
13,
13,
29871,
396,
450,
1051,
881,
505,
3309,
323,
29889,
13,
29871,
4974,
323,
1275,
7431,
29898,
29878,
29906,
3174,
29897,
13,
13,
29871,
396,
3824,
591,
5096,
963,
297,
278,
1959,
982,
304,
1207,
372,
313,
29933,
29892,
323,
511,
541,
1438,
526,
13,
29871,
396,
1603,
515,
716,
342,
313,
29911,
29899,
29896,
29897,
304,
23947,
313,
29900,
511,
577,
769,
591,
285,
3466,
372,
373,
931,
9685,
29889,
13,
29871,
736,
7442,
29889,
29888,
3466,
29898,
9302,
29889,
1429,
29898,
29878,
29906,
3174,
29892,
9685,
29922,
29896,
511,
9685,
29922,
29896,
29897,
13,
13,
13,
29992,
29926,
277,
13,
1753,
995,
29918,
6758,
29918,
29887,
5428,
29918,
27711,
1080,
29898,
1767,
29918,
11965,
2463,
29892,
13,
462,
462,
337,
2935,
29892,
13,
462,
462,
20751,
29918,
13168,
29892,
13,
462,
462,
330,
2735,
29922,
29900,
29889,
29929,
29929,
29892,
13,
462,
462,
321,
3232,
29922,
29900,
29889,
29906,
29892,
13,
462,
462,
995,
29918,
11965,
2463,
29918,
1025,
29922,
8516,
1125,
13,
29871,
9995,
20606,
267,
278,
995,
6410,
2183,
278,
18988,
310,
278,
995,
740,
29889,
13,
13,
29871,
826,
3174,
29901,
13,
1678,
995,
29918,
11965,
2463,
29901,
7442,
29889,
299,
2378,
310,
8267,
313,
29933,
29892,
323,
29974,
29896,
29892,
29871,
29896,
29897,
13,
1678,
337,
2935,
29901,
7442,
29889,
299,
2378,
310,
8267,
313,
29933,
29892,
323,
29897,
310,
337,
2935,
29889,
13,
1678,
20751,
29918,
13168,
29901,
7442,
29889,
299,
2378,
310,
8267,
313,
29933,
29892,
323,
511,
278,
11105,
975,
337,
2935,
29889,
13,
1678,
330,
2735,
29901,
5785,
29892,
2313,
792,
7329,
29889,
13,
1678,
321,
3232,
29901,
5785,
29892,
20102,
29899,
29888,
13857,
29892,
1304,
565,
995,
29918,
1767,
29918,
11965,
2463,
29918,
1025,
3508,
29915,
29873,
6213,
13,
1678,
995,
29918,
11965,
2463,
29918,
1025,
29901,
7442,
29889,
299,
2378,
310,
8267,
313,
29933,
29892,
323,
29974,
29896,
29892,
29871,
29896,
29897,
310,
995,
27303,
13,
418,
773,
278,
2030,
4128,
29889,
960,
4944,
29892,
591,
11039,
403,
445,
297,
278,
6410,
408,
13,
418,
1532,
29889,
910,
338,
515,
278,
4673,
23869,
2362,
24210,
5314,
29889,
13,
13,
29871,
16969,
29901,
13,
1678,
450,
6588,
365,
29906,
995,
6410,
29892,
4759,
4063,
975,
8871,
988,
20751,
29918,
13168,
338,
29871,
29896,
29889,
13,
29871,
9995,
13,
13,
29871,
350,
29892,
323,
353,
337,
2935,
29889,
12181,
29871,
396,
282,
2904,
524,
29901,
11262,
29922,
20965,
29899,
978,
13,
29871,
4974,
313,
29933,
29892,
323,
29897,
1275,
20751,
29918,
13168,
29889,
12181,
13,
29871,
4974,
313,
29933,
29892,
323,
718,
29871,
29896,
29892,
29871,
29896,
29897,
1275,
995,
29918,
11965,
2463,
29889,
12181,
13,
13,
29871,
995,
29918,
11965,
2463,
353,
7442,
29889,
29879,
802,
29872,
911,
29898,
1767,
29918,
11965,
2463,
29892,
9685,
29922,
29906,
29897,
29871,
396,
313,
29933,
29892,
323,
29974,
29896,
29897,
13,
29871,
995,
29918,
11965,
2463,
353,
995,
29918,
11965,
2463,
7503,
29892,
8956,
29896,
29962,
334,
20751,
29918,
13168,
29871,
396,
313,
29933,
29892,
323,
29897,
13,
29871,
364,
29906,
29887,
353,
337,
2935,
29918,
517,
29918,
1484,
29898,
276,
2935,
29892,
20751,
29918,
13168,
29892,
330,
2735,
29922,
4283,
29897,
29871,
396,
313,
29933,
29892,
323,
29897,
13,
29871,
6410,
353,
313,
1767,
29918,
11965,
2463,
448,
364,
29906,
29887,
29897,
1068,
29906,
13,
13,
29871,
396,
3645,
278,
2362,
24210,
5314,
29889,
13,
29871,
565,
995,
29918,
11965,
2463,
29918,
1025,
338,
451,
6213,
29901,
13,
1678,
995,
29918,
11965,
2463,
29918,
1025,
353,
7442,
29889,
29879,
802,
29872,
911,
29898,
1767,
29918,
11965,
2463,
29918,
1025,
29892,
9685,
29922,
29906,
29897,
29871,
396,
313,
29933,
29892,
323,
29974,
29896,
29897,
13,
1678,
995,
29918,
11965,
2463,
29918,
1025,
353,
995,
29918,
11965,
2463,
29918,
1025,
7503,
29892,
8956,
29896,
29962,
334,
20751,
29918,
13168,
29871,
396,
313,
29933,
29892,
323,
29897,
13,
13,
1678,
325,
29918,
11303,
2986,
353,
995,
29918,
11965,
2463,
29918,
1025,
718,
7442,
29889,
24049,
29898,
13,
4706,
995,
29918,
11965,
2463,
448,
995,
29918,
11965,
2463,
29918,
1025,
29892,
448,
5463,
29892,
321,
3232,
29897,
13,
1678,
325,
29918,
11303,
2986,
29918,
6758,
353,
313,
29894,
29918,
11303,
2986,
448,
364,
29906,
29887,
29897,
1068,
29906,
13,
1678,
6410,
353,
7442,
29889,
27525,
398,
29898,
29894,
29918,
11303,
2986,
29918,
6758,
29892,
6410,
29897,
13,
13,
29871,
396,
11190,
385,
6588,
373,
871,
278,
3291,
988,
11105,
2804,
29871,
29900,
29889,
13,
29871,
736,
7442,
29889,
2083,
29898,
6758,
29897,
847,
7442,
29889,
2083,
29898,
276,
1328,
29918,
13168,
29897,
13,
13,
13,
29937,
14402,
29898,
2142,
307,
14018,
1125,
435,
6604,
29899,
1598,
445,
29892,
445,
338,
2086,
5232,
363,
282,
549,
29889,
13,
1753,
628,
29873,
294,
29898,
11965,
18186,
29918,
5975,
29892,
337,
2935,
29892,
11105,
29892,
330,
2735,
29922,
29900,
29889,
29929,
29929,
1125,
13,
29871,
364,
15945,
29908,
20606,
267,
323,
29928,
29899,
690,
333,
27101,
515,
478,
29898,
29879,
29897,
322,
337,
2935,
29889,
13,
13,
29871,
6804,
263,
421,
4181,
1673,
474,
29889,
29872,
29889,
263,
22599,
29899,
690,
333,
950,
338,
3342,
408,
29901,
13,
13,
29871,
19471,
648,
29890,
29892,
29873,
29913,
353,
364,
648,
29890,
29892,
29873,
29913,
718,
320,
4283,
334,
325,
648,
29890,
29892,
29873,
29974,
29896,
29913,
448,
325,
648,
29890,
29892,
29873,
1836,
13,
13,
29871,
826,
3174,
29901,
13,
1678,
25383,
29918,
5975,
29901,
29871,
299,
2378,
310,
8267,
313,
29933,
29892,
323,
29974,
29896,
467,
6058,
29923,
29901,
1222,
1103,
29879,
9685,
29871,
29906,
471,
13,
418,
269,
802,
6096,
287,
29889,
4525,
2755,
478,
29898,
29879,
29918,
3116,
29897,
363,
289,
529,
350,
322,
260,
529,
323,
29974,
29896,
13,
1678,
337,
2935,
29901,
29871,
299,
2378,
310,
8267,
313,
29933,
29892,
323,
29897,
310,
337,
2935,
29889,
13,
1678,
11105,
29901,
29871,
299,
2378,
310,
8267,
313,
29933,
29892,
323,
29897,
310,
11105,
363,
337,
2935,
29889,
13,
1678,
330,
2735,
29901,
5785,
29892,
2313,
792,
7329,
29889,
13,
13,
29871,
16969,
29901,
13,
268,
299,
2378,
310,
8267,
313,
29933,
29892,
323,
29897,
310,
697,
29899,
10568,
323,
29928,
29899,
690,
333,
27101,
29889,
13,
29871,
9995,
13,
13,
29871,
396,
421,
29881,
29952,
29879,
526,
8830,
697,
29899,
10568,
323,
29928,
10995,
27101,
29889,
13,
29871,
270,
353,
5159,
13,
29871,
17117,
323,
353,
337,
2935,
29889,
12181,
29871,
396,
282,
2904,
524,
29901,
11262,
29922,
20965,
29899,
978,
13,
29871,
363,
260,
297,
3464,
29898,
29911,
1125,
13,
1678,
270,
29889,
4397,
29898,
276,
2935,
7503,
29892,
260,
29962,
718,
313,
4283,
334,
25383,
29918,
5975,
7503,
29892,
260,
718,
29871,
29896,
2314,
448,
13,
632,
25383,
29918,
5975,
7503,
29892,
260,
2314,
13,
13,
29871,
736,
7442,
29889,
2378,
29898,
29881,
467,
29911,
334,
11105,
13,
13,
13,
1753,
330,
3660,
29918,
17263,
19771,
29898,
1594,
29918,
29881,
2152,
294,
29892,
11105,
29892,
14013,
29918,
29922,
29900,
29889,
29929,
29945,
29892,
330,
2735,
29922,
29900,
29889,
29929,
29929,
1125,
13,
29871,
364,
15945,
29908,
20606,
267,
278,
402,
16036,
25486,
2183,
278,
697,
4331,
323,
29928,
29899,
690,
333,
27101,
29889,
13,
13,
29871,
450,
7063,
363,
263,
402,
16036,
10631,
4844,
1061,
338,
408,
4477,
29901,
13,
13,
29871,
319,
648,
3116,
29913,
353,
320,
2083,
648,
29880,
29922,
29900,
6292,
3411,
4678,
4283,
334,
320,
2892,
8940,
29880,
4678,
4181,
648,
29890,
29892,
29873,
29974,
29880,
7690,
13,
13,
29871,
2422,
635,
591,
925,
1246,
337,
2935,
29918,
517,
29918,
1484,
29892,
1951,
372,
338,
278,
1021,
16287,
29889,
13,
13,
29871,
826,
3174,
29901,
13,
1678,
22599,
29918,
29881,
2152,
294,
29901,
7442,
29889,
299,
2378,
310,
8267,
313,
29933,
29892,
323,
29897,
310,
697,
4331,
323,
29928,
29899,
690,
333,
27101,
29889,
13,
1678,
11105,
29901,
7442,
29889,
299,
2378,
310,
8267,
313,
29933,
29892,
323,
29897,
310,
11105,
363,
278,
10995,
27101,
29889,
739,
5505,
278,
13,
418,
1206,
393,
278,
421,
1594,
29918,
29881,
2152,
294,
29952,
526,
2307,
11105,
287,
5149,
1951,
896,
526,
13,
418,
7371,
491,
421,
29881,
2152,
294,
19327,
3569,
13,
1678,
14013,
29918,
29901,
5785,
29892,
14013,
3443,
363,
402,
16036,
4844,
4097,
29889,
13,
1678,
330,
2735,
29901,
5785,
29892,
14013,
3443,
363,
402,
16036,
4844,
4097,
29889,
13,
13,
29871,
16969,
29901,
13,
1678,
402,
16036,
10631,
21875,
29889,
13,
29871,
9995,
13,
13,
29871,
736,
337,
2935,
29918,
517,
29918,
1484,
29898,
1594,
29918,
29881,
2152,
294,
29892,
11105,
29892,
14013,
29918,
334,
330,
2735,
29897,
13,
13,
13,
1753,
10434,
29918,
22795,
6897,
29898,
22795,
370,
29918,
26739,
800,
29892,
8820,
1125,
13,
29871,
9995,
29925,
7358,
714,
278,
2070,
11614,
310,
278,
8820,
3412,
9853,
322,
931,
29899,
24530,
29889,
13,
13,
29871,
826,
3174,
29901,
13,
1678,
2070,
370,
29918,
26739,
800,
29901,
29871,
299,
2378,
310,
8267,
10338,
29933,
29892,
323,
29974,
29896,
29892,
319,
29962,
1673,
988,
13,
418,
2070,
370,
29918,
26739,
800,
29961,
29890,
29892,
260,
29892,
474,
29962,
3743,
278,
1480,
29899,
22795,
3097,
310,
3158,
353,
474,
472,
13,
418,
278,
260,
29985,
386,
931,
29899,
10568,
297,
278,
289,
29985,
386,
23324,
706,
29889,
13,
1678,
8820,
29901,
29871,
299,
2378,
310,
8267,
10338,
29933,
29892,
323,
29962,
1673,
411,
1269,
6251,
297,
518,
29900,
29892,
319,
29897,
972,
11427,
607,
13,
418,
3158,
471,
10434,
297,
278,
289,
29985,
386,
23324,
706,
29915,
29879,
260,
29985,
386,
931,
29899,
10568,
29889,
13,
13,
29871,
16969,
29901,
13,
1678,
10338,
29933,
29892,
323,
7961,
29871,
299,
2378,
411,
278,
1480,
29899,
22795,
11614,
310,
278,
10434,
8820,
29889,
13,
29871,
9995,
13,
29871,
350,
29892,
323,
353,
8820,
29889,
12181,
29871,
396,
282,
2904,
524,
29901,
11262,
29922,
20965,
29899,
978,
13,
29871,
4974,
313,
29933,
29892,
323,
718,
29871,
29896,
29897,
1275,
2070,
370,
29918,
26739,
800,
29889,
12181,
7503,
29906,
29962,
13,
29871,
736,
2070,
370,
29918,
26739,
800,
29961,
9302,
29889,
279,
927,
29898,
29933,
29897,
7503,
29892,
6213,
1402,
7442,
29889,
279,
927,
29898,
29911,
511,
8820,
29962,
13,
13,
13,
1753,
10272,
29918,
22795,
370,
29918,
29878,
2219,
359,
29898,
29886,
29918,
1482,
29892,
282,
29918,
1025,
29892,
8820,
29892,
20751,
29918,
13168,
1125,
13,
29871,
9995,
20606,
267,
278,
6976,
364,
2219,
359,
363,
1269,
931,
29899,
10568,
297,
263,
23324,
706,
29889,
13,
13,
29871,
826,
3174,
29901,
13,
1678,
282,
29918,
1482,
29901,
29871,
299,
2378,
310,
8267,
518,
29933,
29892,
323,
29974,
29896,
29892,
319,
29962,
310,
278,
1480,
29899,
22795,
11614,
393,
278,
8898,
13,
418,
3564,
3566,
29879,
304,
599,
278,
8820,
472,
1269,
931,
29899,
10568,
297,
1269,
9853,
773,
13,
418,
278,
2030,
4128,
29889,
13,
1678,
282,
29918,
1025,
29901,
29871,
299,
2378,
310,
8267,
518,
29933,
29892,
323,
29974,
29896,
29892,
319,
1402,
1021,
408,
2038,
29892,
541,
773,
2030,
8898,
13,
418,
3564,
4128,
29889,
13,
1678,
8820,
29901,
29871,
299,
2378,
310,
8267,
518,
29933,
29892,
323,
29962,
988,
1269,
1543,
338,
515,
518,
29900,
29892,
319,
467,
13,
1678,
20751,
29918,
13168,
29901,
29871,
299,
2378,
310,
8267,
518,
29933,
29892,
323,
29962,
11105,
292,
975,
2070,
11614,
29889,
13,
13,
29871,
16969,
29901,
13,
1678,
2070,
370,
29918,
29878,
2219,
359,
29901,
29871,
299,
2378,
310,
8267,
518,
29933,
29892,
323,
1402,
988,
13,
1678,
2070,
370,
29918,
29878,
2219,
359,
648,
29890,
29892,
29873,
29913,
353,
282,
29918,
1482,
648,
29890,
29892,
29873,
29892,
2467,
648,
29890,
29892,
29873,
930,
847,
282,
29918,
1025,
648,
29890,
29892,
29873,
29892,
2467,
648,
29890,
29892,
29873,
930,
13,
29871,
9995,
13,
13,
29871,
350,
29892,
323,
353,
8820,
29889,
12181,
29871,
396,
282,
2904,
524,
29901,
11262,
29922,
20965,
29899,
978,
13,
29871,
4974,
313,
29933,
29892,
323,
718,
29871,
29896,
29897,
1275,
282,
29918,
1025,
29889,
12181,
7503,
29906,
29962,
13,
29871,
4974,
313,
29933,
29892,
323,
718,
29871,
29896,
29897,
1275,
282,
29918,
1482,
29889,
12181,
7503,
29906,
29962,
13,
13,
29871,
1480,
29886,
29918,
1025,
353,
10434,
29918,
22795,
6897,
29898,
29886,
29918,
1025,
29892,
8820,
29897,
13,
29871,
1480,
29886,
29918,
1482,
353,
10434,
29918,
22795,
6897,
29898,
29886,
29918,
1482,
29892,
8820,
29897,
13,
13,
29871,
4974,
313,
29933,
29892,
323,
29897,
1275,
1480,
29886,
29918,
1025,
29889,
12181,
13,
29871,
4974,
313,
29933,
29892,
323,
29897,
1275,
1480,
29886,
29918,
1482,
29889,
12181,
13,
13,
29871,
396,
4001,
1438,
526,
1480,
29899,
22795,
11614,
29892,
591,
925,
23197,
963,
29889,
13,
29871,
2070,
370,
29918,
29878,
2219,
359,
353,
7442,
29889,
4548,
29898,
1188,
29886,
29918,
1482,
448,
1480,
29886,
29918,
1025,
29897,
334,
20751,
29918,
13168,
13,
29871,
4974,
313,
29933,
29892,
323,
29897,
1275,
2070,
370,
29918,
29878,
2219,
359,
29889,
12181,
13,
29871,
736,
2070,
370,
29918,
29878,
2219,
359,
13,
13,
13,
1753,
9335,
2986,
29918,
22795,
370,
29918,
29878,
2219,
359,
29898,
22795,
370,
29918,
29878,
2219,
359,
29892,
321,
3232,
29922,
29900,
29889,
29906,
1125,
13,
29871,
736,
7442,
29889,
24049,
29898,
22795,
370,
29918,
29878,
2219,
359,
29892,
29871,
29896,
448,
321,
3232,
29892,
29871,
29896,
718,
321,
3232,
29897,
13,
13,
13,
1753,
9335,
2986,
29918,
3318,
573,
29898,
22795,
370,
29918,
29878,
2219,
359,
29892,
25486,
29892,
20751,
29918,
13168,
29892,
321,
3232,
29922,
29900,
29889,
29906,
1125,
13,
29871,
736,
7442,
29889,
1195,
12539,
29898,
13,
418,
2070,
370,
29918,
29878,
2219,
359,
334,
25486,
29892,
13,
418,
9335,
2986,
29918,
22795,
370,
29918,
29878,
2219,
359,
29898,
22795,
370,
29918,
29878,
2219,
359,
29892,
321,
3232,
29922,
5463,
29897,
334,
13,
418,
25486,
29897,
334,
20751,
29918,
13168,
13,
13,
13,
29992,
29926,
277,
13,
1753,
282,
1129,
29918,
6758,
29918,
29887,
5428,
29918,
27711,
1080,
29898,
1188,
29918,
22795,
370,
29918,
7387,
29918,
1482,
29892,
13,
462,
1669,
1480,
29918,
22795,
370,
29918,
7387,
29918,
1025,
29892,
13,
462,
1669,
995,
29918,
27711,
1080,
29918,
1025,
29892,
13,
462,
1669,
282,
23959,
29918,
7387,
29892,
13,
462,
1669,
282,
23959,
29918,
276,
2935,
29892,
13,
462,
1669,
20751,
29918,
13168,
29892,
13,
462,
1669,
330,
2735,
29922,
29900,
29889,
29929,
29929,
29892,
13,
462,
1669,
14013,
29918,
29922,
29900,
29889,
29929,
29945,
29892,
13,
462,
1669,
321,
3232,
29922,
29900,
29889,
29906,
1125,
13,
29871,
9995,
29925,
13152,
12091,
29892,
411,
385,
1741,
950,
26134,
1804,
29892,
2183,
27303,
1213,
15945,
13,
29871,
350,
29892,
323,
353,
282,
23959,
29918,
276,
2935,
29889,
12181,
29871,
396,
282,
2904,
524,
29901,
11262,
29922,
20965,
29899,
978,
13,
29871,
4974,
313,
29933,
29892,
323,
29897,
1275,
282,
23959,
29918,
7387,
29889,
12181,
13,
29871,
4974,
313,
29933,
29892,
323,
29897,
1275,
20751,
29918,
13168,
29889,
12181,
13,
13,
29871,
17117,
17117,
319,
353,
1480,
29918,
22795,
370,
29918,
7387,
29918,
1025,
29889,
12181,
29871,
396,
282,
2904,
524,
29901,
11262,
29922,
20965,
29899,
978,
13,
29871,
4974,
313,
29933,
29892,
323,
718,
29871,
29896,
29892,
29871,
29896,
29897,
1275,
995,
29918,
27711,
1080,
29918,
1025,
29889,
12181,
13,
29871,
4974,
313,
29933,
29892,
323,
718,
29871,
29896,
29892,
319,
29897,
1275,
1480,
29918,
22795,
370,
29918,
7387,
29918,
1025,
29889,
12181,
13,
29871,
4974,
313,
29933,
29892,
323,
718,
29871,
29896,
29892,
319,
29897,
1275,
1480,
29918,
22795,
370,
29918,
7387,
29918,
1482,
29889,
12181,
13,
13,
29871,
396,
313,
29933,
29892,
323,
29897,
13,
29871,
22599,
29918,
29881,
2152,
294,
353,
628,
29873,
294,
29898,
13,
418,
7442,
29889,
29879,
802,
29872,
911,
29898,
1767,
29918,
27711,
1080,
29918,
1025,
29892,
9685,
29922,
29906,
511,
29871,
396,
313,
29933,
29892,
323,
29974,
29896,
29897,
13,
418,
282,
23959,
29918,
276,
2935,
29892,
13,
418,
20751,
29918,
13168,
29892,
13,
418,
330,
2735,
29922,
4283,
29897,
13,
13,
29871,
396,
313,
29933,
29892,
323,
29897,
13,
29871,
25486,
353,
330,
3660,
29918,
17263,
19771,
29898,
13,
418,
22599,
29918,
29881,
2152,
294,
29892,
20751,
29918,
13168,
29892,
14013,
29918,
29922,
2892,
3383,
330,
2735,
29922,
4283,
29897,
13,
13,
29871,
396,
21981,
675,
278,
25486,
29889,
13,
29871,
25486,
353,
313,
17263,
19771,
448,
7442,
29889,
12676,
29898,
17263,
19771,
876,
847,
7442,
29889,
4172,
29898,
17263,
19771,
29897,
13,
13,
29871,
396,
313,
29933,
29892,
323,
29897,
13,
29871,
364,
2219,
359,
353,
10272,
29918,
22795,
370,
29918,
29878,
2219,
359,
29898,
1188,
29918,
22795,
370,
29918,
7387,
29918,
1482,
29892,
1480,
29918,
22795,
370,
29918,
7387,
29918,
1025,
29892,
13,
462,
462,
282,
23959,
29918,
7387,
29892,
20751,
29918,
13168,
29897,
13,
29871,
4974,
313,
29933,
29892,
323,
29897,
1275,
364,
2219,
359,
29889,
12181,
13,
13,
29871,
396,
313,
29933,
29892,
323,
29897,
13,
29871,
12091,
353,
9335,
2986,
29918,
3318,
573,
29898,
13,
418,
364,
2219,
359,
29892,
25486,
29892,
20751,
29918,
13168,
29892,
321,
3232,
29922,
5463,
29897,
13,
29871,
4974,
313,
29933,
29892,
323,
29897,
1275,
12091,
29889,
12181,
13,
13,
29871,
396,
3861,
13,
29871,
6588,
29918,
3318,
573,
353,
7442,
29889,
2083,
29898,
3318,
573,
29897,
847,
7442,
29889,
2083,
29898,
276,
1328,
29918,
13168,
29897,
13,
13,
29871,
396,
365,
2209,
338,
8178,
12091,
29889,
13,
29871,
736,
448,
12483,
482,
29918,
3318,
573,
13,
13,
13,
29992,
29926,
277,
13,
1753,
12420,
29918,
6758,
29918,
29887,
5428,
29918,
27711,
1080,
29898,
1188,
29918,
22795,
370,
29918,
7387,
29918,
1482,
29892,
13,
462,
462,
1678,
1480,
29918,
22795,
370,
29918,
7387,
29918,
1025,
29892,
13,
462,
462,
1678,
995,
29918,
11965,
2463,
29918,
1482,
29892,
13,
462,
462,
1678,
995,
29918,
11965,
2463,
29918,
1025,
29892,
13,
462,
462,
1678,
282,
23959,
29918,
7387,
29892,
13,
462,
462,
1678,
282,
23959,
29918,
276,
2935,
29892,
13,
462,
462,
1678,
20751,
29918,
13168,
29892,
13,
462,
462,
1678,
330,
2735,
29922,
29900,
29889,
29929,
29929,
29892,
13,
462,
462,
1678,
14013,
29918,
29922,
29900,
29889,
29929,
29945,
29892,
13,
462,
462,
1678,
321,
3232,
29922,
29900,
29889,
29906,
29892,
13,
462,
462,
1678,
274,
29896,
29922,
29896,
29889,
29900,
29892,
13,
462,
462,
1678,
274,
29906,
29922,
29900,
29889,
29900,
29896,
1125,
13,
29871,
9995,
20606,
267,
278,
12420,
313,
11303,
2986,
6410,
718,
995,
6410,
29897,
2183,
27303,
1213,
15945,
13,
29871,
6410,
29918,
1767,
353,
995,
29918,
6758,
29918,
29887,
5428,
29918,
27711,
1080,
29898,
13,
418,
995,
29918,
11965,
2463,
29918,
1482,
29892,
13,
418,
282,
23959,
29918,
276,
2935,
29892,
13,
418,
20751,
29918,
13168,
29892,
13,
418,
330,
2735,
29922,
4283,
29892,
13,
418,
995,
29918,
11965,
2463,
29918,
1025,
29922,
1767,
29918,
11965,
2463,
29918,
1025,
29892,
13,
418,
321,
3232,
29922,
5463,
29897,
13,
29871,
6410,
29918,
9759,
353,
282,
1129,
29918,
6758,
29918,
29887,
5428,
29918,
27711,
1080,
29898,
13,
418,
1480,
29918,
22795,
370,
29918,
7387,
29918,
1482,
29892,
13,
418,
1480,
29918,
22795,
370,
29918,
7387,
29918,
1025,
29892,
13,
418,
995,
29918,
11965,
2463,
29918,
1025,
29892,
13,
418,
282,
23959,
29918,
7387,
29892,
13,
418,
282,
23959,
29918,
276,
2935,
29892,
13,
418,
20751,
29918,
13168,
29892,
13,
418,
330,
2735,
29922,
4283,
29892,
13,
418,
14013,
29918,
29922,
2892,
3383,
13,
418,
321,
3232,
29922,
5463,
29897,
13,
29871,
24687,
29918,
6718,
375,
353,
11105,
287,
29918,
296,
14441,
29898,
1188,
29918,
22795,
370,
29918,
7387,
29918,
1482,
29892,
20751,
29918,
13168,
29897,
13,
29871,
736,
313,
6758,
29918,
9759,
718,
313,
29883,
29896,
334,
6410,
29918,
1767,
29897,
448,
313,
29883,
29906,
334,
24687,
29918,
6718,
375,
511,
6410,
29918,
9759,
29892,
13,
3986,
6410,
29918,
1767,
29892,
24687,
29918,
6718,
375,
29897,
13,
13,
13,
29992,
7692,
312,
8789,
29889,
3846,
29898,
29926,
277,
29892,
2294,
29918,
1191,
1949,
29879,
7607,
29941,
29892,
876,
13,
1753,
12420,
29918,
6758,
29898,
1482,
29918,
7529,
29892,
13,
462,
29871,
1480,
29918,
22795,
370,
29918,
7387,
29918,
1025,
29892,
13,
462,
29871,
995,
29918,
27711,
1080,
29918,
1025,
29892,
13,
462,
29871,
8898,
29918,
392,
29918,
1767,
29918,
1212,
29918,
7302,
29892,
13,
462,
29871,
282,
23959,
29918,
26739,
800,
29892,
13,
462,
29871,
282,
23959,
29918,
7387,
29892,
13,
462,
29871,
282,
23959,
29918,
276,
2935,
29892,
13,
462,
29871,
20751,
29918,
13168,
29892,
13,
462,
29871,
330,
2735,
29922,
29900,
29889,
29929,
29929,
29892,
13,
462,
29871,
14013,
29918,
29922,
29900,
29889,
29929,
29945,
29892,
13,
462,
29871,
321,
3232,
29922,
29900,
29889,
29906,
29892,
13,
462,
29871,
274,
29896,
29922,
29896,
29889,
29900,
29892,
13,
462,
29871,
274,
29906,
29922,
29900,
29889,
29900,
29896,
29892,
13,
462,
29871,
364,
865,
29922,
8516,
1125,
13,
29871,
9995,
20606,
267,
278,
12420,
313,
11303,
2986,
6410,
718,
995,
6410,
29897,
2183,
13917,
1213,
15945,
13,
29871,
1480,
29918,
22795,
370,
29918,
7387,
29918,
1482,
29892,
995,
29918,
27711,
1080,
29918,
1482,
353,
8898,
29918,
392,
29918,
1767,
29918,
1212,
29918,
7302,
29898,
13,
418,
282,
23959,
29918,
26739,
800,
29892,
716,
29918,
7529,
29892,
364,
865,
29922,
29878,
865,
29897,
13,
13,
29871,
396,
313,
17743,
1312,
29918,
6758,
29892,
282,
1129,
29918,
6758,
29892,
995,
29918,
6758,
29892,
24687,
29918,
6718,
375,
29897,
13,
29871,
736,
12420,
29918,
6758,
29918,
29887,
5428,
29918,
27711,
1080,
29898,
13,
418,
1480,
29918,
22795,
370,
29918,
7387,
29918,
1482,
29892,
13,
418,
1480,
29918,
22795,
370,
29918,
7387,
29918,
1025,
29892,
13,
418,
995,
29918,
27711,
1080,
29918,
1482,
29892,
13,
418,
995,
29918,
27711,
1080,
29918,
1025,
29892,
13,
418,
282,
23959,
29918,
7387,
29892,
13,
418,
282,
23959,
29918,
276,
2935,
29892,
13,
418,
20751,
29918,
13168,
29892,
13,
418,
330,
2735,
29922,
4283,
29892,
13,
418,
14013,
29918,
29922,
2892,
3383,
13,
418,
321,
3232,
29922,
5463,
29892,
13,
418,
274,
29896,
29922,
29883,
29896,
29892,
13,
418,
274,
29906,
29922,
29883,
29906,
29897,
13,
13,
13,
29992,
7692,
312,
8789,
29889,
3846,
29898,
29926,
277,
29892,
2294,
29918,
1191,
1949,
29879,
7607,
29906,
29892,
29871,
29941,
29892,
29871,
29946,
876,
13,
1753,
8898,
29918,
392,
29918,
1767,
29918,
3670,
29918,
10568,
29898,
29875,
29892,
13,
462,
795,
3523,
29918,
3859,
29892,
13,
462,
795,
3523,
29918,
5504,
29892,
13,
462,
795,
679,
29918,
7529,
29892,
13,
462,
795,
8898,
29918,
392,
29918,
1767,
29918,
1212,
29918,
7302,
29892,
13,
462,
795,
1480,
29918,
22795,
370,
29918,
7387,
29918,
1025,
29892,
13,
462,
795,
995,
29918,
27711,
1080,
29918,
1025,
29892,
13,
462,
795,
282,
23959,
29918,
26739,
800,
29892,
13,
462,
795,
282,
23959,
29918,
7387,
29892,
13,
462,
795,
282,
23959,
29918,
276,
2935,
29892,
13,
462,
795,
20751,
29918,
13168,
29892,
13,
462,
795,
274,
29896,
29922,
29896,
29889,
29900,
29892,
13,
462,
795,
274,
29906,
29922,
29900,
29889,
29900,
29896,
29892,
13,
462,
795,
330,
2735,
29922,
29900,
29889,
29929,
29929,
29892,
13,
462,
795,
14013,
29918,
29922,
29900,
29889,
29929,
29945,
29892,
13,
462,
795,
321,
3232,
29922,
29900,
29889,
29896,
29892,
13,
462,
795,
364,
865,
29922,
8516,
1125,
13,
29871,
9995,
15644,
322,
7865,
5994,
3950,
4331,
1213,
15945,
13,
13,
29871,
396,
422,
29890,
1312,
6410,
740,
2183,
278,
716,
8636,
29889,
13,
29871,
822,
8898,
29918,
392,
29918,
1767,
29918,
6758,
29898,
7529,
1125,
13,
1678,
9995,
11609,
29879,
278,
12420,
6410,
2183,
925,
4128,
1213,
15945,
13,
1678,
313,
6758,
29892,
17117,
17117,
24459,
353,
12420,
29918,
6758,
29898,
13,
4706,
8636,
29892,
13,
4706,
1480,
29918,
22795,
370,
29918,
7387,
29918,
1025,
29892,
13,
4706,
995,
29918,
27711,
1080,
29918,
1025,
29892,
13,
4706,
8898,
29918,
392,
29918,
1767,
29918,
1212,
29918,
7302,
29892,
13,
4706,
282,
23959,
29918,
26739,
800,
29892,
13,
4706,
282,
23959,
29918,
7387,
29892,
13,
4706,
282,
23959,
29918,
276,
2935,
29892,
13,
4706,
20751,
29918,
13168,
29892,
13,
4706,
274,
29896,
29922,
29883,
29896,
29892,
13,
4706,
274,
29906,
29922,
29883,
29906,
29892,
13,
4706,
330,
2735,
29922,
4283,
29892,
13,
4706,
14013,
29918,
29922,
2892,
3383,
13,
4706,
321,
3232,
29922,
5463,
29892,
13,
4706,
364,
865,
29922,
29878,
865,
29897,
13,
1678,
736,
6410,
13,
13,
29871,
716,
29918,
7529,
353,
679,
29918,
7529,
29898,
3670,
29918,
3859,
29897,
13,
29871,
330,
353,
4656,
29898,
22197,
29918,
392,
29918,
1767,
29918,
6758,
5033,
1482,
29918,
7529,
29897,
13,
29871,
396,
14402,
29898,
2142,
307,
14018,
1125,
7198,
20102,
4656,
10070,
29973,
13,
29871,
736,
3523,
29918,
5504,
29898,
29875,
29892,
330,
29892,
3523,
29918,
3859,
29897,
13,
13,
13,
1753,
679,
29918,
2230,
29898,
29873,
29896,
29892,
260,
29906,
29922,
8516,
1125,
13,
29871,
565,
260,
29906,
338,
6213,
29901,
13,
1678,
260,
29906,
353,
931,
29889,
2230,
580,
13,
29871,
736,
4513,
3552,
29873,
29906,
448,
260,
29896,
29897,
334,
29871,
29896,
29900,
29900,
29900,
29892,
29871,
29906,
29897,
13,
13,
13,
1753,
26368,
29918,
6321,
29898,
1188,
29918,
22795,
29918,
1482,
29892,
1480,
29918,
22795,
29918,
1025,
29892,
11105,
1125,
13,
29871,
9995,
20606,
267,
278,
26368,
476,
29931,
17089,
10238,
1546,
278,
2030,
322,
716,
1480,
29899,
771,
5824,
29889,
13,
13,
29871,
826,
3174,
29901,
13,
1678,
1480,
29918,
22795,
29918,
1482,
29901,
313,
29933,
29892,
323,
29974,
29896,
29892,
319,
29897,
1480,
2070,
29879,
716,
13,
1678,
1480,
29918,
22795,
29918,
1025,
29901,
313,
29933,
29892,
323,
29974,
29896,
29892,
319,
29897,
1480,
2070,
29879,
2030,
13,
1678,
11105,
29901,
313,
29933,
29892,
323,
29897,
13,
13,
29871,
16969,
29901,
13,
1678,
28268,
2657,
403,
476,
29931,
29889,
13,
29871,
9995,
13,
29871,
2923,
353,
1480,
29918,
22795,
29918,
1025,
448,
1480,
29918,
22795,
29918,
1482,
13,
29871,
396,
315,
329,
278,
1833,
931,
29899,
10568,
714,
29889,
13,
29871,
2923,
353,
2923,
7503,
29892,
8956,
29896,
29962,
13,
29871,
396,
341,
1278,
714,
278,
28190,
760,
29889,
13,
29871,
2923,
334,
29922,
11105,
7503,
29892,
584,
29892,
7442,
29889,
1482,
8990,
29962,
29871,
396,
1207,
11105,
313,
29933,
29892,
323,
29892,
29871,
29896,
29897,
13,
29871,
396,
319,
19698,
373,
1661,
29899,
13168,
287,
760,
29889,
13,
29871,
736,
7442,
29889,
2083,
29898,
12765,
29897,
847,
7442,
29889,
2083,
29898,
13168,
29897,
13,
13,
13,
1753,
11105,
287,
29918,
296,
14441,
29898,
1188,
29918,
771,
5824,
29892,
11105,
1125,
13,
29871,
9995,
20606,
267,
278,
24687,
363,
278,
2183,
1480,
29899,
771,
5824,
29889,
13,
13,
29871,
826,
3174,
29901,
13,
1678,
1480,
29918,
771,
5824,
29901,
313,
29933,
29892,
323,
29974,
29896,
29892,
319,
29897,
1480,
2070,
29879,
13,
1678,
11105,
29901,
313,
29933,
29892,
323,
29897,
11105,
29889,
13,
13,
29871,
16969,
29901,
13,
1678,
4284,
14441,
29889,
13,
29871,
9995,
13,
29871,
396,
315,
329,
278,
1833,
931,
29899,
10568,
714,
29889,
13,
29871,
301,
29886,
353,
1480,
29918,
771,
5824,
7503,
29892,
8956,
29896,
29962,
13,
29871,
396,
341,
1278,
714,
278,
28190,
760,
29889,
13,
29871,
301,
29886,
334,
29922,
11105,
7503,
29892,
584,
29892,
7442,
29889,
1482,
8990,
29962,
29871,
396,
1207,
11105,
313,
29933,
29892,
323,
29892,
29871,
29896,
29897,
13,
29871,
282,
353,
7442,
29889,
4548,
29898,
22833,
29897,
334,
11105,
7503,
29892,
584,
29892,
7442,
29889,
1482,
8990,
29962,
29871,
396,
313,
29933,
29892,
323,
29892,
29871,
29896,
29897,
13,
29871,
396,
319,
19698,
373,
1661,
29899,
13168,
287,
760,
322,
2125,
8178,
29889,
13,
29871,
736,
19691,
9302,
29889,
2083,
29898,
22833,
334,
282,
29897,
847,
7442,
29889,
2083,
29898,
13168,
876,
13,
13,
13,
1753,
14707,
29918,
22197,
29898,
14513,
29918,
6272,
29892,
13,
462,
1678,
679,
29918,
27711,
1080,
29892,
13,
462,
1678,
10452,
29892,
13,
462,
1678,
4236,
29918,
9346,
342,
1022,
29922,
29906,
29900,
29900,
29900,
29900,
29892,
13,
462,
1678,
364,
865,
29922,
8516,
1125,
13,
29871,
9995,
29923,
4387,
403,
278,
8898,
1213,
15945,
13,
13,
29871,
1029,
29887,
29918,
276,
2935,
353,
6571,
13,
29871,
363,
8898,
297,
518,
13,
418,
8829,
29918,
17199,
29918,
13239,
29889,
29907,
3040,
29954,
1955,
2965,
1964,
29918,
8132,
3580,
29931,
4214,
29892,
8829,
29918,
17199,
29918,
13239,
29889,
29954,
5005,
29933,
6670,
29918,
8132,
3580,
29931,
4214,
29892,
13,
418,
8829,
29918,
17199,
29918,
13239,
29889,
15488,
5425,
29931,
1164,
29918,
29954,
1525,
3352,
29979,
13,
29871,
4514,
29901,
13,
1678,
1020,
1315,
29892,
903,
353,
8829,
29918,
17199,
29918,
13239,
29889,
1456,
29918,
6272,
29918,
17199,
29918,
2541,
29918,
22197,
29898,
13,
4706,
19745,
29918,
6272,
29892,
13,
4706,
679,
29918,
27711,
1080,
29892,
13,
4706,
10452,
29922,
9917,
653,
29892,
13,
4706,
4236,
29918,
9346,
342,
1022,
29922,
3317,
29918,
9346,
342,
1022,
29892,
13,
4706,
10092,
29922,
5574,
29892,
13,
4706,
8898,
29918,
13445,
10335,
29922,
22197,
29892,
13,
4706,
364,
865,
29922,
29878,
865,
29897,
13,
1678,
1029,
29887,
29918,
276,
2935,
29961,
22197,
29962,
353,
5785,
29898,
2083,
29898,
13,
4706,
7442,
29889,
2083,
29898,
3018,
29926,
29961,
29906,
2314,
363,
1020,
29926,
297,
1020,
1315,
876,
847,
7431,
29898,
3018,
1315,
29897,
13,
29871,
736,
1029,
29887,
29918,
276,
2935,
13,
13,
13,
1753,
5505,
29918,
5060,
487,
29918,
7529,
29898,
4905,
29918,
3972,
29892,
8898,
29918,
392,
29918,
1767,
29918,
1212,
29918,
7529,
1125,
13,
29871,
9995,
22762,
17749,
278,
8636,
515,
278,
1423,
3149,
4516,
29889,
13,
13,
29871,
826,
3174,
29901,
13,
1678,
1962,
29918,
3972,
29901,
18862,
988,
7160,
1904,
1423,
9748,
526,
6087,
29889,
13,
1678,
8898,
29918,
392,
29918,
1767,
29918,
1212,
29918,
7529,
29901,
13109,
8636,
29892,
4133,
565,
1904,
338,
29915,
593,
1476,
29889,
13,
13,
29871,
16969,
29901,
13,
1678,
21954,
313,
5060,
487,
313,
11227,
511,
8636,
29892,
4256,
29898,
524,
876,
988,
4256,
338,
278,
21502,
305,
515,
13,
1678,
607,
591,
23119,
278,
8636,
29892,
29871,
29900,
338,
17749,
353,
7700,
29889,
13,
29871,
9995,
13,
29871,
1904,
29918,
5325,
353,
330,
1445,
29889,
23705,
29898,
359,
29889,
2084,
29889,
7122,
29898,
4905,
29918,
3972,
29892,
376,
4299,
29899,
8773,
8773,
8773,
29889,
29886,
6321,
5783,
13,
29871,
565,
451,
1904,
29918,
5325,
29901,
13,
1678,
736,
7700,
29892,
8898,
29918,
392,
29918,
1767,
29918,
1212,
29918,
7529,
29892,
29871,
29900,
13,
13,
29871,
1904,
29918,
1445,
353,
12705,
29898,
4299,
29918,
5325,
9601,
29899,
29896,
29962,
13,
29871,
1904,
29918,
1445,
29918,
6500,
3871,
353,
2897,
29889,
2084,
29889,
6500,
3871,
29898,
4299,
29918,
1445,
29897,
29871,
396,
1904,
29899,
8773,
8773,
8773,
29889,
29886,
6321,
13,
29871,
474,
353,
938,
29898,
4572,
29898,
710,
29889,
275,
26204,
29892,
1904,
29918,
1445,
29918,
6500,
3871,
876,
13,
29871,
411,
330,
1445,
29889,
29954,
2283,
29898,
4299,
29918,
1445,
29892,
376,
6050,
1159,
408,
285,
29901,
13,
1678,
8898,
29918,
392,
29918,
1767,
29918,
1212,
29918,
7529,
353,
5839,
280,
29889,
1359,
29898,
29888,
29897,
13,
29871,
736,
5852,
29892,
8898,
29918,
392,
29918,
1767,
29918,
1212,
29918,
7529,
29892,
474,
13,
13,
13,
1753,
6694,
29918,
7888,
29898,
13,
1678,
8829,
29922,
8516,
29892,
13,
1678,
21502,
12168,
29922,
29923,
13152,
3210,
29903,
29892,
13,
1678,
8898,
29918,
392,
29918,
1767,
29918,
1212,
29918,
7692,
29922,
8516,
29892,
13,
1678,
8898,
29918,
392,
29918,
1767,
29918,
20640,
3950,
29918,
7692,
29922,
8516,
29892,
13,
1678,
9853,
29918,
2311,
29922,
29933,
14789,
29918,
29911,
4717,
17637,
1955,
29059,
29892,
13,
1678,
954,
29918,
20640,
3950,
29918,
24530,
29922,
13967,
29918,
14094,
7833,
26664,
1001,
29918,
1254,
29923,
7024,
29892,
13,
1678,
1596,
29918,
17991,
29918,
20640,
3950,
29918,
24530,
29922,
10593,
10192,
29918,
29923,
5348,
29979,
29918,
14094,
7833,
26664,
1001,
29918,
1254,
15488,
29892,
13,
1678,
3646,
29918,
6321,
29922,
29900,
29889,
29900,
29896,
29892,
13,
1678,
10452,
29922,
29906,
29900,
29892,
13,
1678,
4236,
29918,
9346,
342,
1022,
29922,
8516,
29892,
13,
1678,
4236,
29918,
9346,
342,
1022,
29918,
14513,
29922,
29906,
29900,
29900,
29900,
29900,
29892,
13,
1678,
4036,
29918,
26776,
29922,
8516,
29892,
13,
1678,
330,
2735,
29922,
29954,
5194,
1529,
29892,
13,
1678,
14013,
29918,
29922,
4375,
9486,
7698,
29892,
13,
1678,
321,
3232,
29922,
15488,
5425,
29931,
1164,
29892,
13,
1678,
274,
29896,
29922,
29896,
29889,
29900,
29892,
13,
1678,
274,
29906,
29922,
29900,
29889,
29900,
29896,
29892,
13,
1678,
1962,
29918,
3972,
29922,
8516,
29892,
13,
1678,
19745,
29918,
17991,
29918,
29876,
29922,
29896,
29900,
29900,
29900,
29892,
13,
1678,
19745,
29918,
6272,
29922,
8516,
29892,
13,
1678,
2309,
29918,
1154,
29918,
1454,
29918,
22197,
29918,
7620,
29922,
29900,
29889,
29945,
29892,
13,
1678,
9025,
29918,
799,
368,
29918,
7864,
3262,
29922,
5574,
29892,
13,
1678,
8829,
29918,
978,
29922,
8516,
29892,
13,
1125,
13,
29871,
9995,
6558,
29879,
278,
6694,
2425,
363,
349,
13152,
29892,
411,
4343,
8898,
322,
995,
302,
1691,
1213,
15945,
13,
29871,
4974,
8829,
13,
29871,
4974,
1962,
29918,
3972,
13,
29871,
4974,
8829,
29918,
978,
13,
13,
29871,
330,
1445,
29889,
29885,
12535,
12935,
29898,
4905,
29918,
3972,
29897,
13,
13,
29871,
396,
6204,
15837,
23550,
322,
4955,
29889,
13,
29871,
7945,
29918,
2774,
353,
432,
1165,
3377,
29889,
26289,
10507,
29898,
359,
29889,
2084,
29889,
7122,
29898,
4905,
29918,
3972,
29892,
376,
14968,
5783,
13,
29871,
28750,
29918,
2774,
353,
432,
1165,
3377,
29889,
26289,
10507,
29898,
359,
29889,
2084,
29889,
7122,
29898,
4905,
29918,
3972,
29892,
376,
9346,
292,
5783,
13,
29871,
19745,
29918,
2774,
353,
432,
1165,
3377,
29889,
26289,
10507,
29898,
359,
29889,
2084,
29889,
7122,
29898,
4905,
29918,
3972,
29892,
376,
14513,
5783,
13,
13,
29871,
7945,
29918,
2774,
29889,
726,
703,
6272,
29918,
978,
613,
8829,
29918,
978,
29897,
13,
29871,
28750,
29918,
2774,
29889,
726,
703,
6272,
29918,
978,
613,
8829,
29918,
978,
29897,
13,
29871,
19745,
29918,
2774,
29889,
726,
703,
6272,
29918,
978,
613,
8829,
29918,
978,
29897,
13,
13,
29871,
432,
1165,
29918,
29878,
865,
29918,
1989,
353,
1020,
29916,
29889,
657,
29918,
8172,
29918,
4537,
29918,
27959,
29918,
392,
29918,
842,
29918,
26776,
29898,
8172,
29918,
26776,
29897,
13,
13,
29871,
396,
350,
905,
21651,
800,
1383,
4085,
353,
21069,
29896,
29892,
448,
29896,
29962,
718,
438,
9851,
29892,
1363,
591,
674,
10201,
1246,
13,
29871,
396,
8898,
322,
995,
14379,
373,
8267,
518,
29933,
29892,
323,
29962,
718,
29918,
29949,
9851,
13,
29871,
9853,
29918,
26739,
800,
29918,
12181,
353,
8521,
29896,
29892,
448,
29896,
29897,
718,
8829,
29889,
26739,
362,
29918,
3493,
29889,
12181,
13,
13,
29871,
4974,
338,
8758,
29898,
6272,
29889,
2467,
29918,
3493,
29892,
330,
962,
29889,
22854,
29889,
4205,
9084,
29897,
13,
29871,
954,
29918,
7387,
353,
8829,
29889,
2467,
29918,
3493,
29889,
29876,
13,
13,
29871,
432,
1165,
29918,
29878,
865,
29918,
1989,
29892,
1820,
29896,
353,
432,
1165,
29918,
8172,
29889,
5451,
29898,
6487,
29918,
29878,
865,
29918,
1989,
29892,
954,
29922,
29906,
29897,
13,
13,
29871,
396,
25455,
278,
8898,
322,
995,
3564,
29889,
13,
29871,
8898,
29918,
392,
29918,
1767,
29918,
1212,
29918,
7529,
29892,
8898,
29918,
392,
29918,
1767,
29918,
1212,
29918,
7302,
353,
313,
13,
418,
8898,
29918,
392,
29918,
1767,
29918,
1212,
29918,
7692,
29898,
1989,
29896,
29892,
9853,
29918,
26739,
800,
29918,
12181,
29892,
954,
29918,
7387,
876,
13,
13,
29871,
396,
7198,
17749,
278,
8898,
8636,
29889,
960,
727,
338,
3078,
304,
17749,
29892,
769,
13,
29871,
396,
12541,
353,
29871,
29900,
322,
8898,
29918,
392,
29918,
1767,
29918,
1212,
29918,
7529,
526,
4133,
408,
338,
29889,
13,
29871,
17749,
29892,
8898,
29918,
392,
29918,
1767,
29918,
1212,
29918,
7529,
29892,
12541,
353,
313,
13,
418,
5505,
29918,
5060,
487,
29918,
7529,
29898,
4905,
29918,
3972,
29892,
8898,
29918,
392,
29918,
1767,
29918,
1212,
29918,
7529,
876,
13,
13,
29871,
565,
17749,
29901,
13,
1678,
12183,
29889,
3888,
703,
15078,
4395,
4128,
515,
12541,
518,
29995,
29881,
29962,
613,
12541,
29897,
13,
1678,
396,
1334,
881,
1369,
515,
278,
2446,
12541,
29889,
13,
1678,
12541,
4619,
29871,
29896,
13,
13,
29871,
8898,
29918,
392,
29918,
1767,
29918,
1212,
29918,
7302,
353,
432,
277,
29898,
22197,
29918,
392,
29918,
1767,
29918,
1212,
29918,
7302,
29897,
13,
13,
29871,
396,
25455,
278,
5994,
19427,
29889,
13,
29871,
8898,
29918,
392,
29918,
1767,
29918,
20640,
3950,
353,
313,
13,
418,
8898,
29918,
392,
29918,
1767,
29918,
20640,
3950,
29918,
7692,
29898,
22197,
29918,
392,
29918,
1767,
29918,
1212,
29918,
7529,
876,
13,
29871,
313,
22197,
29918,
392,
29918,
1767,
29918,
3670,
29918,
3859,
29892,
8898,
29918,
392,
29918,
1767,
29918,
3670,
29918,
5504,
29892,
13,
259,
8898,
29918,
392,
29918,
1767,
29918,
657,
29918,
7529,
29897,
353,
8898,
29918,
392,
29918,
1767,
29918,
20640,
3950,
13,
13,
29871,
954,
29918,
3018,
622,
3842,
29918,
15091,
353,
29871,
29900,
13,
29871,
1833,
29918,
17314,
29918,
271,
353,
29871,
29900,
13,
13,
29871,
12183,
29889,
3888,
703,
4763,
292,
278,
349,
13152,
6694,
2425,
23157,
13,
29871,
363,
474,
297,
3464,
29898,
1524,
362,
29892,
21502,
12168,
1125,
13,
1678,
21502,
305,
29918,
2962,
29918,
2230,
353,
931,
29889,
2230,
580,
13,
13,
1678,
396,
1459,
2232,
591,
29915,
645,
671,
304,
6314,
278,
23324,
3842,
29889,
13,
1678,
8898,
29918,
392,
29918,
1767,
29918,
1212,
29918,
7529,
353,
8898,
29918,
392,
29918,
1767,
29918,
657,
29918,
7529,
29898,
13,
4706,
8898,
29918,
392,
29918,
1767,
29918,
3670,
29918,
3859,
29897,
13,
13,
1678,
396,
319,
740,
304,
679,
278,
8898,
322,
995,
27303,
29889,
13,
1678,
822,
679,
29918,
27711,
1080,
29898,
26739,
800,
29892,
364,
865,
29922,
8516,
1125,
13,
418,
9995,
11609,
29879,
1480,
29899,
771,
5824,
29892,
995,
27303,
322,
1820,
1250,
1213,
15945,
13,
418,
1820,
29892,
1820,
29896,
353,
432,
1165,
29918,
8172,
29889,
5451,
29898,
29878,
865,
29892,
954,
29922,
29906,
29897,
13,
13,
418,
1480,
29918,
771,
5824,
29892,
995,
29918,
11965,
29879,
353,
8898,
29918,
392,
29918,
1767,
29918,
1212,
29918,
7302,
29898,
13,
3986,
13917,
29892,
8898,
29918,
392,
29918,
1767,
29918,
1212,
29918,
7529,
29892,
364,
865,
29922,
1989,
29896,
29897,
13,
13,
418,
736,
1480,
29918,
771,
5824,
29892,
995,
29918,
11965,
29879,
29892,
1820,
13,
13,
1678,
396,
382,
4387,
403,
278,
8898,
29889,
13,
1678,
8898,
29918,
14513,
29918,
2962,
29918,
2230,
353,
931,
29889,
2230,
580,
13,
1678,
565,
5135,
29875,
718,
29871,
29896,
29897,
1273,
19745,
29918,
17991,
29918,
29876,
1275,
29871,
29900,
29897,
470,
313,
29875,
1275,
21502,
12168,
448,
29871,
29896,
1125,
13,
418,
432,
1165,
29918,
29878,
865,
29918,
1989,
29892,
1820,
353,
432,
1165,
29918,
8172,
29889,
5451,
29898,
6487,
29918,
29878,
865,
29918,
1989,
29892,
954,
29922,
29906,
29897,
13,
13,
418,
12183,
29889,
29894,
1188,
29898,
29896,
29892,
376,
29923,
1129,
305,
518,
29995,
29871,
29953,
29881,
29962,
6161,
1218,
8898,
19602,
474,
29897,
13,
13,
418,
1029,
29887,
29918,
276,
1328,
353,
14707,
29918,
22197,
29898,
13,
3986,
19745,
29918,
6272,
29892,
13,
3986,
679,
29918,
27711,
1080,
29892,
13,
3986,
10452,
29892,
13,
3986,
4236,
29918,
9346,
342,
1022,
29922,
3317,
29918,
9346,
342,
1022,
29918,
14513,
29892,
13,
3986,
364,
865,
29922,
1989,
29897,
13,
418,
363,
413,
29892,
325,
297,
1029,
29887,
29918,
276,
1328,
29889,
7076,
7295,
13,
4706,
19745,
29918,
2774,
29889,
19529,
279,
703,
14513,
29914,
12676,
29918,
276,
1328,
22584,
29879,
29908,
1273,
413,
29892,
325,
29892,
4331,
29922,
29875,
29897,
13,
4706,
12183,
29889,
3888,
703,
29923,
1129,
305,
518,
29995,
29871,
29953,
29881,
29962,
25219,
382,
4387,
362,
518,
29995,
29879,
29962,
353,
1273,
29896,
29900,
29889,
29906,
29888,
613,
474,
29892,
413,
29892,
325,
29897,
13,
1678,
8898,
29918,
14513,
29918,
2230,
353,
679,
29918,
2230,
29898,
22197,
29918,
14513,
29918,
2962,
29918,
2230,
29897,
13,
13,
1678,
23324,
706,
29918,
10855,
29918,
2962,
29918,
2230,
353,
931,
29889,
2230,
580,
13,
1678,
12183,
29889,
29894,
1188,
29898,
29896,
29892,
376,
29923,
1129,
305,
518,
29995,
29871,
29953,
29881,
29962,
6314,
292,
23324,
3842,
19602,
474,
29897,
13,
1678,
432,
1165,
29918,
29878,
865,
29918,
1989,
29892,
1820,
353,
432,
1165,
29918,
8172,
29889,
5451,
29898,
6487,
29918,
29878,
865,
29918,
1989,
29897,
13,
1678,
1020,
1315,
29892,
954,
29918,
15091,
353,
6314,
29918,
3018,
622,
3842,
29898,
13,
4706,
8829,
29892,
13,
4706,
8898,
29918,
7692,
29922,
657,
29918,
27711,
1080,
29892,
13,
4706,
954,
29918,
3018,
622,
3842,
29922,
16175,
29918,
2311,
29892,
13,
4706,
4236,
29918,
9346,
342,
1022,
29922,
3317,
29918,
9346,
342,
1022,
29892,
13,
4706,
10452,
29922,
9917,
653,
29892,
13,
4706,
364,
865,
29922,
1989,
29892,
13,
4706,
10092,
7607,
29875,
1275,
29871,
29900,
29897,
470,
17749,
29892,
13,
4706,
321,
3232,
7607,
29896,
29900,
29889,
29900,
847,
313,
29875,
718,
29871,
29896,
29900,
29889,
29900,
4961,
29871,
396,
445,
338,
263,
1422,
321,
3232,
29889,
13,
1678,
23324,
706,
29918,
10855,
29918,
2230,
353,
679,
29918,
2230,
29898,
3018,
622,
706,
29918,
10855,
29918,
2962,
29918,
2230,
29897,
13,
13,
1678,
12183,
29889,
29894,
1188,
29898,
29896,
29892,
376,
28916,
292,
23324,
3842,
3614,
1273,
29900,
29889,
29906,
29888,
286,
3471,
19602,
13,
462,
23324,
706,
29918,
10855,
29918,
2230,
29897,
13,
13,
1678,
1029,
29887,
29918,
276,
1328,
353,
5785,
29898,
2083,
29898,
9302,
29889,
2083,
29898,
3018,
29926,
29961,
29906,
2314,
363,
1020,
29926,
297,
1020,
1315,
876,
847,
7431,
29898,
3018,
1315,
29897,
13,
1678,
4236,
29918,
276,
1328,
353,
4236,
29898,
9302,
29889,
2083,
29898,
3018,
29926,
29961,
29906,
2314,
363,
1020,
29926,
297,
1020,
1315,
29897,
13,
1678,
1375,
29918,
276,
1328,
353,
1375,
29898,
9302,
29889,
2083,
29898,
3018,
29926,
29961,
29906,
2314,
363,
1020,
29926,
297,
1020,
1315,
29897,
13,
13,
1678,
7945,
29918,
2774,
29889,
19529,
279,
703,
14968,
29914,
12676,
29918,
276,
1328,
613,
1029,
29887,
29918,
276,
1328,
29892,
4331,
29922,
29875,
29897,
13,
13,
1678,
12183,
29889,
29894,
1188,
29898,
29896,
29892,
376,
29934,
809,
3163,
1029,
29887,
11759,
29995,
29900,
29889,
29906,
29888,
1402,
4236,
11759,
29995,
29900,
29889,
29906,
29888,
1402,
1375,
11759,
29995,
29900,
29889,
29906,
29888,
1402,
599,
16328,
29879,
613,
13,
462,
1029,
29887,
29918,
276,
1328,
29892,
4236,
29918,
276,
1328,
29892,
1375,
29918,
276,
1328,
29892,
13,
462,
518,
7411,
29898,
9302,
29889,
2083,
29898,
3018,
29926,
29961,
29906,
12622,
363,
1020,
29926,
297,
1020,
1315,
2314,
13,
13,
1678,
12183,
29889,
29894,
1188,
29898,
29896,
29892,
13,
462,
376,
5323,
622,
706,
365,
1477,
6588,
11759,
29995,
29900,
29889,
29906,
29888,
1402,
4236,
11759,
29995,
29900,
29889,
29906,
29888,
1402,
1375,
11759,
29995,
29900,
29889,
29906,
29888,
29962,
613,
13,
462,
5785,
29898,
2083,
29898,
2435,
29898,
3018,
29926,
29961,
29900,
2314,
363,
1020,
29926,
297,
1020,
1315,
876,
847,
7431,
29898,
3018,
1315,
511,
13,
462,
4236,
29898,
2435,
29898,
3018,
29926,
29961,
29900,
2314,
363,
1020,
29926,
297,
1020,
1315,
511,
13,
462,
1375,
29898,
2435,
29898,
3018,
29926,
29961,
29900,
2314,
363,
1020,
29926,
297,
1020,
1315,
876,
13,
1678,
12183,
29889,
29894,
1188,
29898,
29906,
29892,
376,
5323,
622,
706,
365,
1477,
29879,
29901,
1273,
29879,
613,
518,
2435,
29898,
3018,
29926,
29961,
29900,
2314,
363,
1020,
29926,
297,
1020,
1315,
2314,
13,
13,
1678,
7164,
29918,
2962,
29918,
2230,
353,
931,
29889,
2230,
580,
13,
1678,
313,
3383,
20751,
29918,
13168,
29892,
282,
23959,
29918,
26739,
800,
29892,
282,
23959,
29918,
7387,
29892,
13,
268,
282,
23959,
29918,
276,
2935,
29897,
353,
17132,
29918,
3018,
622,
3842,
29898,
13,
308,
1020,
1315,
29892,
10452,
29922,
9917,
653,
29897,
13,
1678,
7164,
29918,
2230,
353,
679,
29918,
2230,
29898,
12791,
29918,
2962,
29918,
2230,
29897,
13,
13,
1678,
12183,
29889,
29894,
1188,
29898,
29896,
29892,
376,
29925,
4676,
23324,
3842,
3614,
1273,
29900,
29889,
29906,
29888,
286,
3471,
19602,
13,
462,
679,
29918,
2230,
29898,
12791,
29918,
2962,
29918,
2230,
876,
13,
1678,
12183,
29889,
29894,
1188,
29898,
29896,
29892,
376,
29925,
23959,
21651,
800,
29915,
8267,
518,
29995,
29879,
29962,
613,
13,
462,
851,
29898,
29886,
23959,
29918,
26739,
800,
29889,
12181,
876,
13,
1678,
12183,
29889,
29894,
1188,
29898,
29896,
29892,
376,
29925,
23959,
319,
1953,
29915,
8267,
518,
29995,
29879,
29962,
613,
851,
29898,
29886,
23959,
29918,
7387,
29889,
12181,
876,
13,
1678,
12183,
29889,
29894,
1188,
29898,
29896,
29892,
376,
29925,
23959,
390,
809,
3163,
29915,
8267,
518,
29995,
29879,
29962,
613,
851,
29898,
29886,
23959,
29918,
276,
2935,
29889,
12181,
876,
13,
13,
1678,
396,
20535,
403,
1480,
29899,
22795,
11614,
322,
995,
27303,
310,
278,
23324,
3842,
29889,
13,
1678,
396,
1334,
29915,
645,
1209,
1438,
304,
278,
6410,
3168,
577,
408,
304,
451,
679,
337,
12097,
287,
29889,
13,
13,
1678,
396,
6058,
29923,
29901,
13,
1678,
396,
1670,
338,
263,
7248,
1108,
1244,
29892,
565,
278,
8898,
3564,
3743,
13,
1678,
396,
380,
28225,
537,
297,
278,
1480,
29899,
22795,
11614,
313,
735,
29901,
5768,
449,
511,
769,
25202,
13,
1678,
396,
1438,
1449,
1244,
338,
451,
2675,
304,
367,
1959,
322,
881,
367,
2309,
297,
278,
13,
1678,
396,
6314,
740,
29889,
13,
13,
1678,
1480,
29918,
22795,
29918,
276,
26017,
29918,
2962,
29918,
2230,
353,
931,
29889,
2230,
580,
13,
1678,
432,
1165,
29918,
29878,
865,
29918,
1989,
29892,
1820,
353,
432,
1165,
29918,
8172,
29889,
5451,
29898,
6487,
29918,
29878,
865,
29918,
1989,
29897,
13,
1678,
1480,
29918,
22795,
6897,
29918,
3018,
29926,
29892,
995,
29918,
27711,
1080,
29918,
3018,
29926,
29892,
903,
353,
679,
29918,
27711,
1080,
29898,
13,
4706,
282,
23959,
29918,
26739,
800,
29892,
364,
865,
29922,
1989,
29897,
13,
1678,
1480,
29918,
22795,
29918,
276,
26017,
29918,
2230,
353,
679,
29918,
2230,
29898,
1188,
29918,
22795,
29918,
276,
26017,
29918,
2962,
29918,
2230,
29897,
13,
13,
1678,
396,
3834,
4974,
1080,
29889,
13,
1678,
350,
29892,
323,
353,
282,
23959,
29918,
7387,
29889,
12181,
29871,
396,
282,
2904,
524,
29901,
11262,
29922,
20965,
29899,
978,
13,
1678,
4974,
313,
29933,
29892,
323,
29897,
1275,
282,
23959,
29918,
276,
2935,
29889,
12181,
13,
1678,
4974,
313,
29933,
29892,
323,
29897,
1275,
20751,
29918,
13168,
29889,
12181,
13,
1678,
4974,
313,
29933,
29892,
323,
718,
29871,
29896,
29897,
1275,
282,
23959,
29918,
26739,
800,
29889,
12181,
7503,
29906,
29962,
13,
1678,
4974,
313,
29933,
29892,
323,
718,
29871,
29896,
29897,
718,
8829,
29889,
26739,
362,
29918,
3493,
29889,
12181,
1275,
282,
23959,
29918,
26739,
800,
29889,
12181,
13,
13,
1678,
396,
22985,
385,
484,
12818,
515,
29871,
29900,
29889,
29896,
304,
29871,
29900,
29889,
29900,
13,
1678,
396,
321,
3232,
29918,
816,
11272,
353,
321,
3232,
565,
21502,
12168,
1275,
29871,
29896,
1683,
321,
3232,
334,
313,
29896,
29889,
29900,
448,
13,
1678,
396,
462,
462,
462,
965,
313,
29875,
847,
13,
1678,
396,
462,
462,
462,
9651,
313,
1022,
2878,
29879,
448,
29871,
29896,
4961,
13,
13,
1678,
396,
28601,
321,
3232,
29889,
13,
1678,
321,
3232,
29918,
816,
11272,
353,
321,
3232,
13,
13,
1678,
396,
11796,
29872,
995,
322,
282,
1129,
28495,
29889,
13,
1678,
432,
1165,
29918,
29878,
865,
29918,
1989,
29892,
1820,
29896,
353,
432,
1165,
29918,
8172,
29889,
5451,
29898,
6487,
29918,
29878,
865,
29918,
1989,
29892,
954,
29922,
29906,
29897,
13,
1678,
12183,
29889,
29894,
1188,
29898,
29906,
29892,
376,
4763,
292,
304,
10272,
349,
29987,
29963,
6410,
23157,
13,
1678,
6410,
29918,
26017,
29918,
2962,
29918,
2230,
353,
931,
29889,
2230,
580,
13,
1678,
3151,
29918,
17743,
1312,
29918,
6758,
29892,
3151,
29918,
9759,
29918,
6758,
29892,
3151,
29918,
1767,
29918,
6758,
29892,
24687,
29918,
6718,
375,
353,
313,
13,
4706,
12420,
29918,
6758,
29898,
13,
9651,
8898,
29918,
392,
29918,
1767,
29918,
1212,
29918,
7529,
29892,
13,
9651,
1480,
29918,
22795,
6897,
29918,
3018,
29926,
29892,
13,
9651,
995,
29918,
27711,
1080,
29918,
3018,
29926,
29892,
13,
9651,
8898,
29918,
392,
29918,
1767,
29918,
1212,
29918,
7302,
29892,
13,
9651,
282,
23959,
29918,
26739,
800,
29892,
13,
9651,
282,
23959,
29918,
7387,
29892,
13,
9651,
282,
23959,
29918,
276,
2935,
29892,
13,
9651,
20751,
29918,
13168,
29892,
13,
9651,
330,
2735,
29922,
4283,
29892,
13,
9651,
14013,
29918,
29922,
2892,
3383,
13,
9651,
321,
3232,
29922,
5463,
29918,
816,
11272,
29892,
13,
9651,
274,
29896,
29922,
29883,
29896,
29892,
13,
9651,
274,
29906,
29922,
29883,
29906,
29892,
13,
9651,
364,
865,
29922,
1989,
29896,
876,
13,
1678,
6410,
29918,
26017,
29918,
2230,
353,
679,
29918,
2230,
29898,
6758,
29918,
26017,
29918,
2962,
29918,
2230,
29897,
13,
1678,
12183,
29889,
29894,
1188,
29898,
13,
308,
29896,
29892,
13,
4706,
376,
27065,
1218,
349,
29987,
29963,
6410,
518,
29995,
29896,
29900,
29889,
29906,
29888,
29414,
29896,
29900,
29889,
29906,
29888,
29892,
1273,
29896,
29900,
29889,
29906,
29888,
29892,
1273,
29896,
29900,
29889,
29906,
29888,
4638,
3614,
1273,
29900,
29889,
29906,
29888,
286,
3471,
19602,
13,
4706,
3151,
29918,
17743,
1312,
29918,
6758,
29892,
3151,
29918,
1767,
29918,
6758,
29892,
3151,
29918,
9759,
29918,
6758,
29892,
24687,
29918,
6718,
375,
29892,
13,
4706,
679,
29918,
2230,
29898,
6758,
29918,
26017,
29918,
2962,
29918,
2230,
876,
13,
13,
1678,
432,
1165,
29918,
29878,
865,
29918,
1989,
29892,
1820,
29896,
353,
432,
1165,
29918,
8172,
29889,
5451,
29898,
6487,
29918,
29878,
865,
29918,
1989,
29892,
954,
29922,
29906,
29897,
13,
1678,
12183,
29889,
29894,
1188,
29898,
29896,
29892,
376,
15644,
322,
7865,
20693,
326,
2133,
1159,
13,
1678,
13883,
29918,
2962,
29918,
2230,
353,
931,
29889,
2230,
580,
13,
1678,
6611,
353,
432,
1165,
29918,
8172,
29889,
5451,
29898,
1989,
29896,
29892,
954,
29922,
1949,
29918,
20640,
3950,
29918,
24530,
29897,
13,
1678,
363,
432,
297,
3464,
29898,
1949,
29918,
20640,
3950,
29918,
24530,
1125,
13,
418,
413,
29896,
29892,
413,
29906,
29892,
413,
29941,
353,
432,
1165,
29918,
8172,
29889,
5451,
29898,
8149,
29961,
29926,
1402,
954,
29922,
29941,
29897,
13,
418,
260,
353,
931,
29889,
2230,
580,
13,
418,
396,
10318,
278,
5994,
3950,
2106,
29889,
13,
418,
8898,
29918,
392,
29918,
1767,
29918,
3670,
29918,
3859,
353,
8898,
29918,
392,
29918,
1767,
29918,
3670,
29918,
10568,
29898,
13,
3986,
432,
29892,
13,
3986,
8898,
29918,
392,
29918,
1767,
29918,
3670,
29918,
3859,
29892,
13,
3986,
8898,
29918,
392,
29918,
1767,
29918,
3670,
29918,
5504,
29892,
13,
3986,
8898,
29918,
392,
29918,
1767,
29918,
657,
29918,
7529,
29892,
13,
3986,
8898,
29918,
392,
29918,
1767,
29918,
1212,
29918,
7302,
29892,
13,
3986,
1480,
29918,
22795,
6897,
29918,
3018,
29926,
29892,
13,
3986,
995,
29918,
27711,
1080,
29918,
3018,
29926,
29892,
13,
3986,
282,
23959,
29918,
26739,
800,
29892,
13,
3986,
282,
23959,
29918,
7387,
29892,
13,
3986,
282,
23959,
29918,
276,
2935,
29892,
13,
3986,
20751,
29918,
13168,
29892,
13,
3986,
274,
29896,
29922,
29883,
29896,
29892,
13,
3986,
274,
29906,
29922,
29883,
29906,
29892,
13,
3986,
330,
2735,
29922,
4283,
29892,
13,
3986,
14013,
29918,
29922,
2892,
3383,
13,
3986,
321,
3232,
29922,
5463,
29918,
816,
11272,
29892,
13,
3986,
364,
865,
29922,
29895,
29896,
29897,
13,
13,
418,
396,
11796,
29872,
278,
2134,
29916,
476,
29931,
363,
4688,
25480,
29889,
13,
418,
716,
29918,
22197,
29918,
392,
29918,
1767,
29918,
1212,
29918,
7529,
353,
8898,
29918,
392,
29918,
1767,
29918,
657,
29918,
7529,
29898,
13,
3986,
8898,
29918,
392,
29918,
1767,
29918,
3670,
29918,
3859,
29897,
13,
13,
418,
1480,
29918,
22795,
370,
29918,
7387,
29918,
1482,
29892,
903,
353,
8898,
29918,
392,
29918,
1767,
29918,
1212,
29918,
7302,
29898,
13,
3986,
282,
23959,
29918,
26739,
800,
29892,
716,
29918,
22197,
29918,
392,
29918,
1767,
29918,
1212,
29918,
7529,
29892,
364,
865,
29922,
29895,
29906,
29897,
13,
13,
418,
2134,
29916,
29918,
6321,
353,
26368,
29918,
6321,
29898,
1188,
29918,
22795,
370,
29918,
7387,
29918,
1482,
29892,
1480,
29918,
22795,
6897,
29918,
3018,
29926,
29892,
13,
462,
462,
20751,
29918,
13168,
29897,
13,
13,
418,
4688,
29918,
7864,
3262,
353,
9025,
29918,
799,
368,
29918,
7864,
3262,
322,
2134,
29916,
29918,
6321,
1405,
29871,
29896,
29889,
29945,
334,
3646,
29918,
6321,
13,
418,
565,
4688,
29918,
7864,
3262,
29901,
13,
4706,
12183,
29889,
29894,
1188,
29898,
13,
632,
29896,
29892,
376,
29923,
279,
368,
25480,
8898,
322,
995,
13883,
472,
4256,
29901,
1273,
29881,
29892,
376,
13,
9651,
376,
2541,
2134,
29916,
29918,
6321,
29901,
1273,
29900,
29889,
29906,
29888,
613,
432,
29892,
2134,
29916,
29918,
6321,
29897,
13,
4706,
396,
1334,
1016,
29915,
29873,
736,
1492,
29899,
21694,
29892,
591,
864,
278,
2400,
304,
6222,
373,
278,
1833,
13,
4706,
396,
12541,
29889,
13,
13,
418,
260,
29906,
353,
931,
29889,
2230,
580,
13,
418,
565,
313,
3552,
29926,
718,
29871,
29896,
29897,
1273,
1596,
29918,
17991,
29918,
20640,
3950,
29918,
24530,
1275,
29871,
29900,
29897,
470,
13,
3986,
313,
29926,
1275,
954,
29918,
20640,
3950,
29918,
24530,
448,
29871,
29896,
29897,
470,
4688,
29918,
7864,
3262,
1125,
13,
4706,
396,
11796,
29872,
322,
1480,
278,
6410,
29889,
13,
4706,
313,
6758,
29918,
17743,
1312,
29892,
6410,
29918,
9759,
29892,
6410,
29918,
1767,
29892,
24687,
29918,
6718,
375,
29897,
353,
313,
13,
9651,
12420,
29918,
6758,
29898,
13,
18884,
716,
29918,
22197,
29918,
392,
29918,
1767,
29918,
1212,
29918,
7529,
29892,
13,
18884,
1480,
29918,
22795,
6897,
29918,
3018,
29926,
29892,
13,
18884,
995,
29918,
27711,
1080,
29918,
3018,
29926,
29892,
13,
18884,
8898,
29918,
392,
29918,
1767,
29918,
1212,
29918,
7302,
29892,
13,
18884,
282,
23959,
29918,
26739,
800,
29892,
13,
18884,
282,
23959,
29918,
7387,
29892,
13,
18884,
282,
23959,
29918,
276,
2935,
29892,
13,
18884,
20751,
29918,
13168,
29892,
13,
18884,
330,
2735,
29922,
4283,
29892,
13,
18884,
14013,
29918,
29922,
2892,
3383,
13,
18884,
321,
3232,
29922,
5463,
29918,
816,
11272,
29892,
13,
18884,
274,
29896,
29922,
29883,
29896,
29892,
13,
18884,
274,
29906,
29922,
29883,
29906,
29892,
13,
18884,
364,
865,
29922,
29895,
29941,
876,
13,
4706,
12183,
29889,
29894,
1188,
29898,
29896,
29892,
376,
6716,
25219,
322,
7865,
4656,
5153,
3614,
29901,
1273,
29900,
29889,
29906,
29888,
286,
3471,
613,
13,
462,
268,
679,
29918,
2230,
29898,
29873,
29892,
260,
29906,
876,
13,
4706,
12183,
29889,
29894,
1188,
29898,
13,
632,
29896,
29892,
376,
1523,
29890,
1312,
365,
2209,
29898,
1767,
29892,
282,
1129,
29892,
24687,
29918,
6718,
375,
29897,
518,
29995,
29896,
29900,
29889,
29906,
29888,
29962,
1599,
29908,
13,
9651,
376,
518,
29995,
29896,
29900,
29889,
29906,
29888,
29414,
29896,
29900,
29889,
29906,
29888,
24163,
29896,
29900,
29889,
29906,
29888,
24163,
29896,
29900,
29889,
29906,
29888,
4638,
613,
3151,
29918,
17743,
1312,
29918,
6758,
29892,
6410,
29918,
17743,
1312,
29892,
13,
9651,
6410,
29918,
1767,
29892,
6410,
29918,
9759,
29892,
24687,
29918,
6718,
375,
29897,
13,
13,
418,
565,
4688,
29918,
7864,
3262,
29901,
13,
4706,
2867,
13,
13,
1678,
13883,
29918,
2230,
353,
679,
29918,
2230,
29898,
20640,
2133,
29918,
2962,
29918,
2230,
29897,
13,
13,
1678,
12183,
29889,
29894,
1188,
29898,
13,
308,
29896,
29892,
376,
11536,
422,
29890,
1312,
365,
2209,
20376,
518,
29995,
29900,
29889,
29906,
29888,
29962,
7686,
613,
13,
4706,
313,
29896,
29900,
29900,
334,
313,
2764,
29918,
17743,
1312,
29918,
6758,
448,
6410,
29918,
17743,
1312,
29897,
847,
7442,
29889,
6897,
29898,
2764,
29918,
17743,
1312,
29918,
6758,
4961,
13,
13,
1678,
396,
16913,
4128,
1432,
931,
591,
1074,
278,
1095,
310,
472,
3203,
263,
15958,
310,
9853,
13,
1678,
396,
1353,
310,
23324,
3842,
393,
526,
2309,
313,
1333,
8676,
1192,
8676,
7805,
13,
1678,
396,
21022,
630,
322,
2309,
467,
13,
1678,
396,
3115,
1016,
29915,
29873,
4078,
2086,
13672,
29892,
427,
10118,
263,
9212,
17261,
29889,
13,
1678,
396,
1394,
565,
445,
338,
278,
1833,
12541,
29889,
13,
1678,
8898,
29918,
7620,
29918,
2962,
29918,
2230,
353,
931,
29889,
2230,
580,
13,
1678,
954,
29918,
3018,
622,
3842,
29918,
15091,
4619,
954,
29918,
15091,
13,
1678,
565,
313,
3552,
1949,
29918,
3018,
622,
3842,
29918,
15091,
6736,
2309,
29918,
1154,
29918,
1454,
29918,
22197,
29918,
7620,
334,
9853,
29918,
2311,
29897,
13,
308,
322,
313,
29875,
448,
1833,
29918,
17314,
29918,
271,
1405,
19745,
29918,
17991,
29918,
29876,
876,
470,
313,
29875,
1275,
21502,
12168,
448,
29871,
29896,
22164,
13,
418,
12183,
29889,
29894,
1188,
29898,
29896,
29892,
376,
29923,
1129,
305,
518,
29995,
29871,
29953,
29881,
29962,
14238,
1904,
19602,
474,
29897,
13,
418,
8636,
29918,
1445,
353,
2897,
29889,
2084,
29889,
7122,
29898,
4905,
29918,
3972,
29892,
376,
4299,
19222,
29900,
29953,
29881,
29889,
29886,
6321,
29908,
1273,
474,
29897,
13,
418,
411,
330,
1445,
29889,
29954,
2283,
29898,
7529,
29918,
1445,
29892,
376,
29893,
29890,
1159,
408,
285,
29901,
13,
4706,
5839,
280,
29889,
15070,
29898,
22197,
29918,
392,
29918,
1767,
29918,
1212,
29918,
7529,
29892,
285,
29897,
13,
418,
396,
2538,
300,
445,
1353,
29889,
13,
418,
954,
29918,
3018,
622,
3842,
29918,
15091,
353,
29871,
29900,
13,
418,
1833,
29918,
17314,
29918,
271,
353,
474,
13,
1678,
8898,
29918,
7620,
29918,
2230,
353,
679,
29918,
2230,
29898,
22197,
29918,
7620,
29918,
2962,
29918,
2230,
29897,
13,
13,
1678,
21502,
305,
29918,
2230,
353,
679,
29918,
2230,
29898,
1022,
2878,
29918,
2962,
29918,
2230,
29897,
13,
13,
1678,
12183,
29889,
3888,
29898,
13,
4706,
376,
29923,
1129,
305,
518,
29995,
29871,
29953,
29881,
1402,
390,
809,
538,
29961,
1195,
29892,
4236,
29892,
1029,
29887,
29962,
518,
29995,
29945,
29889,
29906,
29888,
24163,
29945,
29889,
29906,
29888,
24163,
29945,
29889,
29906,
29888,
1402,
422,
29890,
1312,
29908,
13,
4706,
376,
365,
2209,
29898,
1767,
29892,
282,
1129,
29892,
24687,
29897,
518,
29995,
29906,
29889,
29945,
29888,
29414,
29906,
29889,
29945,
29888,
24163,
29906,
29889,
29945,
29888,
24163,
29906,
29889,
29945,
29888,
4638,
613,
474,
29892,
1375,
29918,
276,
1328,
29892,
13,
4706,
4236,
29918,
276,
1328,
29892,
1029,
29887,
29918,
276,
1328,
29892,
6410,
29918,
17743,
1312,
29892,
6410,
29918,
1767,
29892,
6410,
29918,
9759,
29892,
13,
4706,
24687,
29918,
6718,
375,
29897,
13,
13,
1678,
28750,
29918,
8977,
353,
426,
13,
4706,
376,
1022,
2878,
1115,
21502,
305,
29918,
2230,
29892,
13,
4706,
376,
22197,
29918,
14513,
1115,
8898,
29918,
14513,
29918,
2230,
29892,
13,
4706,
376,
3018,
622,
706,
29918,
10855,
1115,
23324,
706,
29918,
10855,
29918,
2230,
29892,
13,
4706,
376,
12791,
1115,
7164,
29918,
2230,
29892,
13,
4706,
376,
1188,
29918,
22795,
29918,
276,
26017,
1115,
1480,
29918,
22795,
29918,
276,
26017,
29918,
2230,
29892,
13,
4706,
376,
6758,
29918,
26017,
1115,
6410,
29918,
26017,
29918,
2230,
29892,
13,
4706,
376,
20640,
2133,
1115,
13883,
29918,
2230,
29892,
13,
4706,
376,
22197,
29918,
7620,
1115,
8898,
29918,
7620,
29918,
2230,
29892,
13,
1678,
500,
13,
13,
1678,
363,
413,
29892,
325,
297,
28750,
29918,
8977,
29889,
7076,
7295,
13,
418,
28750,
29918,
2774,
29889,
19529,
279,
703,
9346,
292,
22584,
29879,
29908,
1273,
413,
29892,
325,
29892,
4331,
29922,
29875,
29897,
13,
13,
1678,
4236,
29918,
1989,
29918,
2435,
353,
4236,
29898,
2435,
29898,
29895,
29897,
363,
413,
297,
28750,
29918,
8977,
29897,
13,
1678,
28750,
29918,
3888,
29918,
1761,
353,
518,
13,
4706,
11860,
29879,
584,
1273,
29871,
29896,
29900,
29889,
29906,
29888,
29908,
1273,
313,
29895,
29889,
29878,
5143,
29898,
3317,
29918,
1989,
29918,
2435,
718,
29871,
29896,
511,
325,
29897,
13,
4706,
363,
413,
29892,
325,
297,
12705,
29898,
9346,
292,
29918,
8977,
29889,
7076,
3101,
13,
1678,
4514,
13,
1678,
12183,
29889,
3888,
703,
29923,
1129,
305,
518,
29995,
29871,
29953,
29881,
1402,
7870,
886,
29901,
320,
29876,
29995,
29879,
613,
474,
29892,
6634,
29876,
1642,
7122,
29898,
9346,
292,
29918,
3888,
29918,
1761,
876,
13,
13,
1678,
396,
2538,
300,
17749,
29889,
13,
1678,
17749,
353,
7700,
13,
13,
1678,
396,
2379,
1878,
15837,
23550,
2748,
297,
263,
1550,
29889,
13,
1678,
565,
313,
29875,
29974,
29896,
29897,
1273,
29871,
29896,
29900,
29900,
29900,
1275,
29871,
29900,
470,
474,
1275,
21502,
12168,
448,
29871,
29896,
29901,
13,
418,
7945,
29918,
2774,
29889,
23126,
580,
13,
418,
28750,
29918,
2774,
29889,
23126,
580,
13,
418,
19745,
29918,
2774,
29889,
23126,
580,
13,
2
] |
google/appengine/tools/devappserver2/http_runtime.py | airamrguez/appengine-1.8.0-golang-1.4.3-os-x-64bit | 1 | 198422 | <gh_stars>1-10
#!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
"""Serves content for "script" handlers using an HTTP runtime.
http_runtime supports two ways to start the runtime instance.
START_PROCESS sends the runtime_config protobuf (serialized and base64 encoded
as not all platforms support binary data over stdin) to the runtime instance
over stdin and requires the runtime instance to send the port it is listening on
over stdout.
START_PROCESS_FILE creates two temporary files and adds the paths of both files
to the runtime instance command line. The first file is written by http_runtime
with the runtime_config proto (serialized); the runtime instance is expected to
delete the file after reading it. The second file is written by the runtime
instance with the port it is listening on (the line must be newline terminated);
http_runtime is expected to delete the file after reading it.
TODO: convert all runtimes to START_PROCESS_FILE.
"""
import base64
import contextlib
import httplib
import logging
import os
import socket
import subprocess
import sys
import time
import threading
import urllib
import wsgiref.headers
from google.appengine.tools.devappserver2 import http_runtime_constants
from google.appengine.tools.devappserver2 import instance
from google.appengine.tools.devappserver2 import login
from google.appengine.tools.devappserver2 import safe_subprocess
from google.appengine.tools.devappserver2 import tee
from google.appengine.tools.devappserver2 import util
START_PROCESS = -1
START_PROCESS_FILE = -2
def _sleep_between_retries(attempt, max_attempts, sleep_base):
"""Sleep between retry attempts.
Do an exponential backoff between retry attempts on an operation. The general
pattern for use is:
for attempt in range(max_attempts):
# Try operation, either return or break on success
_sleep_between_retries(attempt, max_attempts, sleep_base)
Args:
attempt: Which attempt just failed (0 based).
max_attempts: The maximum number of attempts that will be made.
sleep_base: How long in seconds to sleep between the first and second
attempt (the time will be doubled between each successive attempt). The
value may be any numeric type that is convertible to float (complex
won't work but user types that are sufficiently numeric-like will).
"""
# Don't sleep after the last attempt as we're about to give up.
if attempt < (max_attempts - 1):
time.sleep((2 ** attempt) * sleep_base)
def _remove_retry_sharing_violation(path, max_attempts=10, sleep_base=.125):
"""Removes a file (with retries on Windows for sharing violations).
Args:
path: The filesystem path to remove.
max_attempts: The maximum number of attempts to try to remove the path
before giving up.
sleep_base: How long in seconds to sleep between the first and second
attempt (the time will be doubled between each successive attempt). The
value may be any numeric type that is convertible to float (complex
won't work but user types that are sufficiently numeric-like will).
Raises:
WindowsError: When an error other than a sharing violation occurs.
"""
if sys.platform == 'win32':
for attempt in range(max_attempts):
try:
os.remove(path)
break
except WindowsError as e:
import winerror
# Sharing violations are expected to occasionally occur when the runtime
# instance is context swapped after writing the port but before closing
# the file. Ignore these and try again.
if e.winerror != winerror.ERROR_SHARING_VIOLATION:
raise
_sleep_between_retries(attempt, max_attempts, sleep_base)
else:
logging.warn('Unable to delete %s', path)
else:
os.remove(path)
class HttpRuntimeProxy(instance.RuntimeProxy):
"""Manages a runtime subprocess used to handle dynamic content."""
_VALID_START_PROCESS_FLAVORS = [START_PROCESS, START_PROCESS_FILE]
def __init__(self, args, runtime_config_getter, module_configuration,
env=None, start_process_flavor=START_PROCESS):
"""Initializer for HttpRuntimeProxy.
Args:
args: Arguments to use to start the runtime subprocess.
runtime_config_getter: A function that can be called without arguments
and returns the runtime_config_pb2.Config containing the configuration
for the runtime.
module_configuration: An application_configuration.ModuleConfiguration
instance respresenting the configuration of the module that owns the
runtime.
env: A dict of environment variables to pass to the runtime subprocess.
start_process_flavor: Which version of start process to start your
runtime process. SUpported flavors are START_PROCESS and
START_PROCESS_FILE.
Raises:
ValueError: An unknown value for start_process_flavor was used.
"""
super(HttpRuntimeProxy, self).__init__()
self._host = 'localhost'
self._port = None
self._process = None
self._process_lock = threading.Lock() # Lock to guard self._process.
self._prior_error = None
self._stderr_tee = None
self._runtime_config_getter = runtime_config_getter
self._args = args
self._module_configuration = module_configuration
self._env = env
if start_process_flavor not in self._VALID_START_PROCESS_FLAVORS:
raise ValueError('Invalid start_process_flavor.')
self._start_process_flavor = start_process_flavor
def _get_error_file(self):
for error_handler in self._module_configuration.error_handlers or []:
if not error_handler.error_code or error_handler.error_code == 'default':
return os.path.join(self._module_configuration.application_root,
error_handler.file)
else:
return None
def handle(self, environ, start_response, url_map, match, request_id,
request_type):
"""Serves this request by forwarding it to the runtime process.
Args:
environ: An environ dict for the request as defined in PEP-333.
start_response: A function with semantics defined in PEP-333.
url_map: An appinfo.URLMap instance containing the configuration for the
handler matching this request.
match: A re.MatchObject containing the result of the matched URL pattern.
request_id: A unique string id associated with the request.
request_type: The type of the request. See instance.*_REQUEST module
constants.
Yields:
A sequence of strings containing the body of the HTTP response.
"""
if self._prior_error:
yield self._handle_error(self._prior_error, start_response)
return
environ[http_runtime_constants.SCRIPT_HEADER] = match.expand(url_map.script)
if request_type == instance.BACKGROUND_REQUEST:
environ[http_runtime_constants.REQUEST_TYPE_HEADER] = 'background'
elif request_type == instance.SHUTDOWN_REQUEST:
environ[http_runtime_constants.REQUEST_TYPE_HEADER] = 'shutdown'
elif request_type == instance.INTERACTIVE_REQUEST:
environ[http_runtime_constants.REQUEST_TYPE_HEADER] = 'interactive'
for name in http_runtime_constants.ENVIRONS_TO_PROPAGATE:
if http_runtime_constants.INTERNAL_ENVIRON_PREFIX + name not in environ:
value = environ.get(name, None)
if value is not None:
environ[
http_runtime_constants.INTERNAL_ENVIRON_PREFIX + name] = value
headers = util.get_headers_from_environ(environ)
if environ.get('QUERY_STRING'):
url = '%s?%s' % (urllib.quote(environ['PATH_INFO']),
environ['QUERY_STRING'])
else:
url = urllib.quote(environ['PATH_INFO'])
if 'CONTENT_LENGTH' in environ:
headers['CONTENT-LENGTH'] = environ['CONTENT_LENGTH']
data = environ['wsgi.input'].read(int(environ['CONTENT_LENGTH']))
else:
data = ''
cookies = environ.get('HTTP_COOKIE')
user_email, admin, user_id = login.get_user_info(cookies)
if user_email:
nickname, organization = user_email.split('@', 1)
else:
nickname = ''
organization = ''
headers[http_runtime_constants.REQUEST_ID_HEADER] = request_id
headers[http_runtime_constants.INTERNAL_HEADER_PREFIX + 'User-Id'] = (
user_id)
headers[http_runtime_constants.INTERNAL_HEADER_PREFIX + 'User-Email'] = (
user_email)
headers[
http_runtime_constants.INTERNAL_HEADER_PREFIX + 'User-Is-Admin'] = (
str(int(admin)))
headers[
http_runtime_constants.INTERNAL_HEADER_PREFIX + 'User-Nickname'] = (
nickname)
headers[
http_runtime_constants.INTERNAL_HEADER_PREFIX + 'User-Organization'] = (
organization)
headers['X-AppEngine-Country'] = 'ZZ'
connection = httplib.HTTPConnection(self._host, self._port)
with contextlib.closing(connection):
try:
connection.connect()
connection.request(environ.get('REQUEST_METHOD', 'GET'),
url,
data,
dict(headers.items()))
try:
response = connection.getresponse()
except httplib.HTTPException as e:
# The runtime process has written a bad HTTP response. For example,
# a Go runtime process may have crashed in app-specific code.
yield self._handle_error(
'the runtime process gave a bad HTTP response: %s' % e,
start_response)
return
# Ensures that we avoid merging repeat headers into a single header,
# allowing use of multiple Set-Cookie headers.
headers = []
for name in response.msg:
for value in response.msg.getheaders(name):
headers.append((name, value))
response_headers = wsgiref.headers.Headers(headers)
error_file = self._get_error_file()
if (error_file and
http_runtime_constants.ERROR_CODE_HEADER in response_headers):
try:
with open(error_file) as f:
content = f.read()
except IOError:
content = 'Failed to load error handler'
logging.exception('failed to load error file: %s', error_file)
start_response('500 Internal Server Error',
[('Content-Type', 'text/html'),
('Content-Length', str(len(content)))])
yield content
return
del response_headers[http_runtime_constants.ERROR_CODE_HEADER]
start_response('%s %s' % (response.status, response.reason),
response_headers.items())
# Yield the response body in small blocks.
while True:
try:
block = response.read(512)
if not block:
break
yield block
except httplib.HTTPException:
# The runtime process has encountered a problem, but has not
# necessarily crashed. For example, a Go runtime process' HTTP
# handler may have panicked in app-specific code (which the http
# package will recover from, so the process as a whole doesn't
# crash). At this point, we have already proxied onwards the HTTP
# header, so we cannot retroactively serve a 500 Internal Server
# Error. We silently break here; the runtime process has presumably
# already written to stderr (via the Tee).
break
except Exception:
with self._process_lock:
if self._process and self._process.poll() is not None:
# The development server is in a bad state. Log and return an error
# message.
self._prior_error = ('the runtime process for the instance running '
'on port %d has unexpectedly quit' % (
self._port))
yield self._handle_error(self._prior_error, start_response)
else:
raise
def _handle_error(self, message, start_response):
# Give the runtime process a bit of time to write to stderr.
time.sleep(0.1)
buf = self._stderr_tee.get_buf()
if buf:
message = message + '\n\n' + buf
# TODO: change 'text/plain' to 'text/plain; charset=utf-8'
# throughout devappserver2.
start_response('500 Internal Server Error',
[('Content-Type', 'text/plain'),
('Content-Length', str(len(message)))])
return message
def _read_start_process_file(self, max_attempts=10, sleep_base=.125):
"""Read the single line response expected in the start process file.
The START_PROCESS_FILE flavor uses a file for the runtime instance to
report back the port it is listening on. We can't rely on EOF semantics
as that is a race condition when the runtime instance is simultaneously
writing the file while the devappserver process is reading it; rather we
rely on the line being terminated with a newline.
Args:
max_attempts: The maximum number of attempts to read the line.
sleep_base: How long in seconds to sleep between the first and second
attempt (the time will be doubled between each successive attempt). The
value may be any numeric type that is convertible to float (complex
won't work but user types that are sufficiently numeric-like will).
Returns:
If a full single line (as indicated by a newline terminator) is found, all
data read up to that point is returned; return an empty string if no
newline is read before the process exits or the max number of attempts are
made.
"""
try:
for attempt in range(max_attempts):
# Yes, the final data may already be in the file even though the
# process exited. That said, since the process should stay alive
# if it's exited we don't care anyway.
if self._process.poll() is not None:
return ''
# On Mac, if the first read in this process occurs before the data is
# written, no data will ever be read by this process without the seek.
self._process.child_out.seek(0)
line = self._process.child_out.read()
if '\n' in line:
return line
_sleep_between_retries(attempt, max_attempts, sleep_base)
finally:
self._process.child_out.close()
return ''
def start(self):
"""Starts the runtime process and waits until it is ready to serve."""
runtime_config = self._runtime_config_getter()
# TODO: Use a different process group to isolate the child process
# from signals sent to the parent. Only available in subprocess in
# Python 2.7.
assert self._start_process_flavor in self._VALID_START_PROCESS_FLAVORS
if self._start_process_flavor == START_PROCESS:
serialized_config = base64.b64encode(runtime_config.SerializeToString())
with self._process_lock:
assert not self._process, 'start() can only be called once'
self._process = safe_subprocess.start_process(
self._args,
serialized_config,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
env=self._env,
cwd=self._module_configuration.application_root)
line = self._process.stdout.readline()
elif self._start_process_flavor == START_PROCESS_FILE:
serialized_config = runtime_config.SerializeToString()
with self._process_lock:
assert not self._process, 'start() can only be called once'
self._process = safe_subprocess.start_process_file(
args=self._args,
input_string=serialized_config,
env=self._env,
cwd=self._module_configuration.application_root,
stderr=subprocess.PIPE)
line = self._read_start_process_file()
_remove_retry_sharing_violation(self._process.child_out.name)
# _stderr_tee may be pre-set by unit tests.
if self._stderr_tee is None:
self._stderr_tee = tee.Tee(self._process.stderr, sys.stderr)
self._stderr_tee.start()
self._prior_error = None
self._port = None
try:
self._port = int(line)
except ValueError:
self._prior_error = 'bad runtime process port [%r]' % line
logging.error(self._prior_error)
else:
# Check if the runtime can serve requests.
if not self._can_connect():
self._prior_error = 'cannot connect to runtime on port %r' % self._port
logging.error(self._prior_error)
def _can_connect(self):
connection = httplib.HTTPConnection(self._host, self._port)
with contextlib.closing(connection):
try:
connection.connect()
except socket.error:
return False
else:
return True
def quit(self):
"""Causes the runtime process to exit."""
with self._process_lock:
assert self._process, 'module was not running'
try:
self._process.kill()
except OSError:
pass
# Mac leaks file descriptors without call to join. Suspect a race
# condition where the interpreter is unable to close the subprocess pipe
# as the thread hasn't returned from the readline call.
self._stderr_tee.join(5)
self._process = None
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
29937,
14708,
4855,
29914,
2109,
29914,
6272,
3017,
13,
29937,
13,
29937,
14187,
1266,
29871,
29906,
29900,
29900,
29955,
5087,
9266,
29889,
13,
29937,
13,
29937,
10413,
21144,
1090,
278,
13380,
19245,
29892,
10079,
29871,
29906,
29889,
29900,
313,
1552,
376,
29931,
293,
1947,
1496,
13,
29937,
366,
1122,
451,
671,
445,
934,
5174,
297,
752,
13036,
411,
278,
19245,
29889,
13,
29937,
887,
1122,
4017,
263,
3509,
310,
278,
19245,
472,
13,
29937,
13,
29937,
268,
1732,
597,
1636,
29889,
4288,
29889,
990,
29914,
506,
11259,
29914,
27888,
1430,
1660,
29899,
29906,
29889,
29900,
13,
29937,
13,
29937,
25870,
3734,
491,
22903,
4307,
470,
15502,
304,
297,
5007,
29892,
7047,
13,
29937,
13235,
1090,
278,
19245,
338,
13235,
373,
385,
376,
3289,
8519,
29908,
350,
3289,
3235,
29892,
13,
29937,
399,
1806,
8187,
2692,
399,
1718,
29934,
13566,
29059,
6323,
8707,
29928,
22122,
29903,
8079,
13764,
29979,
476,
22255,
29892,
2845,
4653,
470,
2411,
2957,
29889,
13,
29937,
2823,
278,
19245,
363,
278,
2702,
4086,
14765,
1076,
11239,
322,
13,
29937,
27028,
1090,
278,
19245,
29889,
13,
29937,
13,
15945,
29908,
1748,
1960,
2793,
363,
376,
2154,
29908,
25795,
773,
385,
7331,
10073,
29889,
13,
13,
1124,
29918,
15634,
11286,
1023,
5837,
304,
1369,
278,
10073,
2777,
29889,
13,
13,
25826,
29918,
8618,
23524,
16003,
278,
10073,
29918,
2917,
17814,
9721,
313,
15550,
1891,
322,
2967,
29953,
29946,
18511,
13,
294,
451,
599,
21796,
2304,
7581,
848,
975,
3659,
262,
29897,
304,
278,
10073,
2777,
13,
957,
3659,
262,
322,
6858,
278,
10073,
2777,
304,
3638,
278,
2011,
372,
338,
19866,
373,
13,
957,
27591,
29889,
13,
13,
25826,
29918,
8618,
23524,
29918,
7724,
10017,
1023,
13201,
2066,
322,
12778,
278,
10898,
310,
1716,
2066,
13,
517,
278,
10073,
2777,
1899,
1196,
29889,
450,
937,
934,
338,
3971,
491,
1732,
29918,
15634,
13,
2541,
278,
10073,
29918,
2917,
17814,
313,
15550,
1891,
416,
278,
10073,
2777,
338,
3806,
304,
13,
8143,
278,
934,
1156,
5183,
372,
29889,
450,
1473,
934,
338,
3971,
491,
278,
10073,
13,
8758,
411,
278,
2011,
372,
338,
19866,
373,
313,
1552,
1196,
1818,
367,
25899,
29185,
416,
13,
1124,
29918,
15634,
338,
3806,
304,
5217,
278,
934,
1156,
5183,
372,
29889,
13,
13,
4986,
3970,
29901,
3588,
599,
1065,
3706,
304,
6850,
8322,
29918,
8618,
23524,
29918,
7724,
29889,
13,
15945,
29908,
13,
13,
13,
5215,
2967,
29953,
29946,
13,
5215,
3030,
1982,
13,
5215,
1732,
1982,
13,
5215,
12183,
13,
5215,
2897,
13,
5215,
9909,
13,
5215,
1014,
5014,
13,
5215,
10876,
13,
5215,
931,
13,
5215,
3244,
292,
13,
5215,
3142,
1982,
13,
5215,
281,
5311,
533,
29888,
29889,
13662,
13,
13,
3166,
5386,
29889,
932,
10599,
29889,
8504,
29889,
3359,
932,
2974,
29906,
1053,
1732,
29918,
15634,
29918,
3075,
1934,
13,
3166,
5386,
29889,
932,
10599,
29889,
8504,
29889,
3359,
932,
2974,
29906,
1053,
2777,
13,
3166,
5386,
29889,
932,
10599,
29889,
8504,
29889,
3359,
932,
2974,
29906,
1053,
6464,
13,
3166,
5386,
29889,
932,
10599,
29889,
8504,
29889,
3359,
932,
2974,
29906,
1053,
9109,
29918,
1491,
5014,
13,
3166,
5386,
29889,
932,
10599,
29889,
8504,
29889,
3359,
932,
2974,
29906,
1053,
734,
29872,
13,
3166,
5386,
29889,
932,
10599,
29889,
8504,
29889,
3359,
932,
2974,
29906,
1053,
3667,
13,
13,
25826,
29918,
8618,
23524,
353,
448,
29896,
13,
25826,
29918,
8618,
23524,
29918,
7724,
353,
448,
29906,
13,
13,
13,
1753,
903,
17059,
29918,
14811,
29918,
2267,
2722,
29898,
1131,
3456,
29892,
4236,
29918,
1131,
3456,
29879,
29892,
8709,
29918,
3188,
1125,
13,
29871,
9995,
29903,
5436,
1546,
337,
2202,
14734,
29889,
13,
13,
29871,
1938,
385,
25658,
1250,
2696,
1546,
337,
2202,
14734,
373,
385,
5858,
29889,
450,
2498,
13,
29871,
4766,
363,
671,
338,
29901,
13,
1678,
363,
4218,
297,
3464,
29898,
3317,
29918,
1131,
3456,
29879,
1125,
13,
418,
396,
3967,
5858,
29892,
2845,
736,
470,
2867,
373,
2551,
13,
418,
903,
17059,
29918,
14811,
29918,
2267,
2722,
29898,
1131,
3456,
29892,
4236,
29918,
1131,
3456,
29879,
29892,
8709,
29918,
3188,
29897,
13,
13,
29871,
826,
3174,
29901,
13,
1678,
4218,
29901,
8449,
4218,
925,
5229,
313,
29900,
2729,
467,
13,
1678,
4236,
29918,
1131,
3456,
29879,
29901,
450,
7472,
1353,
310,
14734,
393,
674,
367,
1754,
29889,
13,
1678,
8709,
29918,
3188,
29901,
1128,
1472,
297,
6923,
304,
8709,
1546,
278,
937,
322,
1473,
13,
418,
4218,
313,
1552,
931,
674,
367,
3765,
29881,
1546,
1269,
2551,
573,
4218,
467,
450,
13,
418,
995,
1122,
367,
738,
16985,
1134,
393,
338,
3588,
1821,
304,
5785,
313,
19676,
13,
418,
2113,
29915,
29873,
664,
541,
1404,
4072,
393,
526,
18430,
16985,
29899,
4561,
674,
467,
13,
29871,
9995,
13,
29871,
396,
3872,
29915,
29873,
8709,
1156,
278,
1833,
4218,
408,
591,
29915,
276,
1048,
304,
2367,
701,
29889,
13,
29871,
565,
4218,
529,
313,
3317,
29918,
1131,
3456,
29879,
448,
29871,
29896,
1125,
13,
1678,
931,
29889,
17059,
3552,
29906,
3579,
4218,
29897,
334,
8709,
29918,
3188,
29897,
13,
13,
13,
1753,
903,
5992,
29918,
276,
2202,
29918,
845,
4362,
29918,
1403,
22671,
29898,
2084,
29892,
4236,
29918,
1131,
3456,
29879,
29922,
29896,
29900,
29892,
8709,
29918,
3188,
21098,
29896,
29906,
29945,
1125,
13,
29871,
9995,
7301,
586,
267,
263,
934,
313,
2541,
3240,
2722,
373,
3852,
363,
19383,
5537,
800,
467,
13,
13,
29871,
826,
3174,
29901,
13,
1678,
2224,
29901,
450,
22101,
2224,
304,
3349,
29889,
13,
1678,
4236,
29918,
1131,
3456,
29879,
29901,
450,
7472,
1353,
310,
14734,
304,
1018,
304,
3349,
278,
2224,
13,
418,
1434,
6820,
701,
29889,
13,
1678,
8709,
29918,
3188,
29901,
1128,
1472,
297,
6923,
304,
8709,
1546,
278,
937,
322,
1473,
13,
418,
4218,
313,
1552,
931,
674,
367,
3765,
29881,
1546,
1269,
2551,
573,
4218,
467,
450,
13,
418,
995,
1122,
367,
738,
16985,
1134,
393,
338,
3588,
1821,
304,
5785,
313,
19676,
13,
418,
2113,
29915,
29873,
664,
541,
1404,
4072,
393,
526,
18430,
16985,
29899,
4561,
674,
467,
13,
13,
29871,
390,
1759,
267,
29901,
13,
1678,
3852,
2392,
29901,
1932,
385,
1059,
916,
1135,
263,
19383,
5537,
362,
10008,
29889,
13,
29871,
9995,
13,
29871,
565,
10876,
29889,
12120,
1275,
525,
5080,
29941,
29906,
2396,
13,
1678,
363,
4218,
297,
3464,
29898,
3317,
29918,
1131,
3456,
29879,
1125,
13,
418,
1018,
29901,
13,
4706,
2897,
29889,
5992,
29898,
2084,
29897,
13,
4706,
2867,
13,
418,
5174,
3852,
2392,
408,
321,
29901,
13,
4706,
1053,
5401,
2704,
13,
4706,
396,
1383,
4362,
5537,
800,
526,
3806,
304,
23025,
6403,
746,
278,
10073,
13,
4706,
396,
2777,
338,
3030,
2381,
17280,
1156,
5007,
278,
2011,
541,
1434,
14382,
13,
4706,
396,
278,
934,
29889,
18076,
487,
1438,
322,
1018,
1449,
29889,
13,
4706,
565,
321,
29889,
5080,
2704,
2804,
5401,
2704,
29889,
11432,
29918,
7068,
1718,
4214,
29918,
18118,
5607,
8098,
29901,
13,
3986,
12020,
13,
418,
903,
17059,
29918,
14811,
29918,
2267,
2722,
29898,
1131,
3456,
29892,
4236,
29918,
1131,
3456,
29879,
29892,
8709,
29918,
3188,
29897,
13,
1678,
1683,
29901,
13,
418,
12183,
29889,
25442,
877,
2525,
519,
304,
5217,
1273,
29879,
742,
2224,
29897,
13,
29871,
1683,
29901,
13,
1678,
2897,
29889,
5992,
29898,
2084,
29897,
13,
13,
13,
1990,
9056,
7944,
14048,
29898,
8758,
29889,
7944,
14048,
1125,
13,
29871,
9995,
2517,
1179,
263,
10073,
1014,
5014,
1304,
304,
4386,
7343,
2793,
1213,
15945,
13,
13,
29871,
903,
26707,
29918,
25826,
29918,
8618,
23524,
29918,
18823,
29963,
24125,
353,
518,
25826,
29918,
8618,
23524,
29892,
6850,
8322,
29918,
8618,
23524,
29918,
7724,
29962,
13,
13,
29871,
822,
4770,
2344,
12035,
1311,
29892,
6389,
29892,
10073,
29918,
2917,
29918,
657,
357,
29892,
3883,
29918,
13305,
29892,
13,
1669,
8829,
29922,
8516,
29892,
1369,
29918,
5014,
29918,
29888,
4112,
272,
29922,
25826,
29918,
8618,
23524,
1125,
13,
1678,
9995,
15514,
3950,
363,
9056,
7944,
14048,
29889,
13,
13,
1678,
826,
3174,
29901,
13,
418,
6389,
29901,
11842,
9331,
304,
671,
304,
1369,
278,
10073,
1014,
5014,
29889,
13,
418,
10073,
29918,
2917,
29918,
657,
357,
29901,
319,
740,
393,
508,
367,
2000,
1728,
6273,
13,
3986,
322,
3639,
278,
10073,
29918,
2917,
29918,
24381,
29906,
29889,
3991,
6943,
278,
5285,
13,
3986,
363,
278,
10073,
29889,
13,
418,
3883,
29918,
13305,
29901,
530,
2280,
29918,
13305,
29889,
7355,
8614,
13,
3986,
2777,
620,
6338,
292,
278,
5285,
310,
278,
3883,
393,
1914,
29879,
278,
13,
3986,
10073,
29889,
13,
418,
8829,
29901,
319,
9657,
310,
5177,
3651,
304,
1209,
304,
278,
10073,
1014,
5014,
29889,
13,
418,
1369,
29918,
5014,
29918,
29888,
4112,
272,
29901,
8449,
1873,
310,
1369,
1889,
304,
1369,
596,
13,
4706,
10073,
1889,
29889,
20134,
3016,
287,
21054,
943,
526,
6850,
8322,
29918,
8618,
23524,
322,
13,
4706,
6850,
8322,
29918,
8618,
23524,
29918,
7724,
29889,
13,
13,
1678,
390,
1759,
267,
29901,
13,
418,
7865,
2392,
29901,
530,
9815,
995,
363,
1369,
29918,
5014,
29918,
29888,
4112,
272,
471,
1304,
29889,
13,
1678,
9995,
13,
1678,
2428,
29898,
5506,
7944,
14048,
29892,
1583,
467,
1649,
2344,
1649,
580,
13,
1678,
1583,
3032,
3069,
353,
525,
7640,
29915,
13,
1678,
1583,
3032,
637,
353,
6213,
13,
1678,
1583,
3032,
5014,
353,
6213,
13,
1678,
1583,
3032,
5014,
29918,
908,
353,
3244,
292,
29889,
16542,
580,
29871,
396,
18199,
304,
8372,
1583,
3032,
5014,
29889,
13,
1678,
1583,
3032,
29886,
13479,
29918,
2704,
353,
6213,
13,
1678,
1583,
3032,
303,
20405,
29918,
371,
29872,
353,
6213,
13,
1678,
1583,
3032,
15634,
29918,
2917,
29918,
657,
357,
353,
10073,
29918,
2917,
29918,
657,
357,
13,
1678,
1583,
3032,
5085,
353,
6389,
13,
1678,
1583,
3032,
5453,
29918,
13305,
353,
3883,
29918,
13305,
13,
1678,
1583,
3032,
6272,
353,
8829,
13,
1678,
565,
1369,
29918,
5014,
29918,
29888,
4112,
272,
451,
297,
1583,
3032,
26707,
29918,
25826,
29918,
8618,
23524,
29918,
18823,
29963,
24125,
29901,
13,
418,
12020,
7865,
2392,
877,
13919,
1369,
29918,
5014,
29918,
29888,
4112,
272,
29889,
1495,
13,
1678,
1583,
3032,
2962,
29918,
5014,
29918,
29888,
4112,
272,
353,
1369,
29918,
5014,
29918,
29888,
4112,
272,
13,
13,
29871,
822,
903,
657,
29918,
2704,
29918,
1445,
29898,
1311,
1125,
13,
1678,
363,
1059,
29918,
13789,
297,
1583,
3032,
5453,
29918,
13305,
29889,
2704,
29918,
3179,
9306,
470,
5159,
29901,
13,
418,
565,
451,
1059,
29918,
13789,
29889,
2704,
29918,
401,
470,
1059,
29918,
13789,
29889,
2704,
29918,
401,
1275,
525,
4381,
2396,
13,
4706,
736,
2897,
29889,
2084,
29889,
7122,
29898,
1311,
3032,
5453,
29918,
13305,
29889,
6214,
29918,
4632,
29892,
13,
462,
9651,
1059,
29918,
13789,
29889,
1445,
29897,
13,
1678,
1683,
29901,
13,
418,
736,
6213,
13,
13,
29871,
822,
4386,
29898,
1311,
29892,
12471,
29892,
1369,
29918,
5327,
29892,
3142,
29918,
1958,
29892,
1993,
29892,
2009,
29918,
333,
29892,
13,
632,
2009,
29918,
1853,
1125,
13,
1678,
9995,
1748,
1960,
445,
2009,
491,
6375,
292,
372,
304,
278,
10073,
1889,
29889,
13,
13,
1678,
826,
3174,
29901,
13,
418,
12471,
29901,
530,
12471,
9657,
363,
278,
2009,
408,
3342,
297,
349,
15488,
29899,
29941,
29941,
29941,
29889,
13,
418,
1369,
29918,
5327,
29901,
319,
740,
411,
29505,
3342,
297,
349,
15488,
29899,
29941,
29941,
29941,
29889,
13,
418,
3142,
29918,
1958,
29901,
530,
623,
3888,
29889,
4219,
3388,
2777,
6943,
278,
5285,
363,
278,
13,
3986,
7834,
9686,
445,
2009,
29889,
13,
418,
1993,
29901,
319,
337,
29889,
9652,
2061,
6943,
278,
1121,
310,
278,
19228,
3988,
4766,
29889,
13,
418,
2009,
29918,
333,
29901,
319,
5412,
1347,
1178,
6942,
411,
278,
2009,
29889,
13,
418,
2009,
29918,
1853,
29901,
450,
1134,
310,
278,
2009,
29889,
2823,
2777,
5575,
29918,
16244,
3883,
13,
3986,
17727,
29889,
13,
13,
1678,
612,
969,
29879,
29901,
13,
418,
319,
5665,
310,
6031,
6943,
278,
3573,
310,
278,
7331,
2933,
29889,
13,
1678,
9995,
13,
1678,
565,
1583,
3032,
29886,
13479,
29918,
2704,
29901,
13,
418,
7709,
1583,
3032,
8411,
29918,
2704,
29898,
1311,
3032,
29886,
13479,
29918,
2704,
29892,
1369,
29918,
5327,
29897,
13,
418,
736,
13,
13,
1678,
12471,
29961,
1124,
29918,
15634,
29918,
3075,
1934,
29889,
7187,
24290,
29918,
23252,
1001,
29962,
353,
1993,
29889,
18837,
29898,
2271,
29918,
1958,
29889,
2154,
29897,
13,
1678,
565,
2009,
29918,
1853,
1275,
2777,
29889,
29933,
11375,
29954,
1672,
18783,
29918,
16244,
29901,
13,
418,
12471,
29961,
1124,
29918,
15634,
29918,
3075,
1934,
29889,
16244,
29918,
11116,
29918,
23252,
1001,
29962,
353,
525,
7042,
29915,
13,
1678,
25342,
2009,
29918,
1853,
1275,
2777,
29889,
7068,
2692,
3970,
16048,
29918,
16244,
29901,
13,
418,
12471,
29961,
1124,
29918,
15634,
29918,
3075,
1934,
29889,
16244,
29918,
11116,
29918,
23252,
1001,
29962,
353,
525,
845,
329,
3204,
29915,
13,
1678,
25342,
2009,
29918,
1853,
1275,
2777,
29889,
23845,
17923,
18474,
29918,
16244,
29901,
13,
418,
12471,
29961,
1124,
29918,
15634,
29918,
3075,
1934,
29889,
16244,
29918,
11116,
29918,
23252,
1001,
29962,
353,
525,
1639,
4925,
29915,
13,
13,
1678,
363,
1024,
297,
1732,
29918,
15634,
29918,
3075,
1934,
29889,
25838,
8193,
1164,
29903,
29918,
4986,
29918,
8618,
7228,
29954,
3040,
29901,
13,
418,
565,
1732,
29918,
15634,
29918,
3075,
1934,
29889,
23845,
29940,
1964,
29918,
25838,
8193,
1164,
29918,
15094,
25634,
718,
1024,
451,
297,
12471,
29901,
13,
4706,
995,
353,
12471,
29889,
657,
29898,
978,
29892,
6213,
29897,
13,
4706,
565,
995,
338,
451,
6213,
29901,
13,
3986,
12471,
29961,
13,
795,
1732,
29918,
15634,
29918,
3075,
1934,
29889,
23845,
29940,
1964,
29918,
25838,
8193,
1164,
29918,
15094,
25634,
718,
1024,
29962,
353,
995,
13,
1678,
9066,
353,
3667,
29889,
657,
29918,
13662,
29918,
3166,
29918,
21813,
29898,
21813,
29897,
13,
1678,
565,
12471,
29889,
657,
877,
13356,
24422,
29918,
20785,
29374,
13,
418,
3142,
353,
14210,
29879,
29973,
29995,
29879,
29915,
1273,
313,
2271,
1982,
29889,
1396,
29898,
21813,
1839,
10145,
29918,
11690,
2033,
511,
13,
462,
539,
12471,
1839,
13356,
24422,
29918,
20785,
11287,
13,
1678,
1683,
29901,
13,
418,
3142,
353,
3142,
1982,
29889,
1396,
29898,
21813,
1839,
10145,
29918,
11690,
11287,
13,
1678,
565,
525,
22412,
3919,
29918,
19433,
29915,
297,
12471,
29901,
13,
418,
9066,
1839,
22412,
3919,
29899,
19433,
2033,
353,
12471,
1839,
22412,
3919,
29918,
19433,
2033,
13,
418,
848,
353,
12471,
1839,
5652,
3146,
29889,
2080,
13359,
949,
29898,
524,
29898,
21813,
1839,
22412,
3919,
29918,
19433,
25901,
13,
1678,
1683,
29901,
13,
418,
848,
353,
6629,
13,
13,
1678,
21046,
353,
12471,
29889,
657,
877,
10493,
29918,
3217,
8949,
8673,
1495,
13,
1678,
1404,
29918,
5269,
29892,
4113,
29892,
1404,
29918,
333,
353,
6464,
29889,
657,
29918,
1792,
29918,
3888,
29898,
15108,
583,
29897,
13,
1678,
565,
1404,
29918,
5269,
29901,
13,
418,
25985,
978,
29892,
13013,
353,
1404,
29918,
5269,
29889,
5451,
877,
29992,
742,
29871,
29896,
29897,
13,
1678,
1683,
29901,
13,
418,
25985,
978,
353,
6629,
13,
418,
13013,
353,
6629,
13,
1678,
9066,
29961,
1124,
29918,
15634,
29918,
3075,
1934,
29889,
16244,
29918,
1367,
29918,
23252,
1001,
29962,
353,
2009,
29918,
333,
13,
1678,
9066,
29961,
1124,
29918,
15634,
29918,
3075,
1934,
29889,
23845,
29940,
1964,
29918,
23252,
1001,
29918,
15094,
25634,
718,
525,
2659,
29899,
1204,
2033,
353,
313,
13,
4706,
1404,
29918,
333,
29897,
13,
1678,
9066,
29961,
1124,
29918,
15634,
29918,
3075,
1934,
29889,
23845,
29940,
1964,
29918,
23252,
1001,
29918,
15094,
25634,
718,
525,
2659,
29899,
9823,
2033,
353,
313,
13,
4706,
1404,
29918,
5269,
29897,
13,
1678,
9066,
29961,
13,
4706,
1732,
29918,
15634,
29918,
3075,
1934,
29889,
23845,
29940,
1964,
29918,
23252,
1001,
29918,
15094,
25634,
718,
525,
2659,
29899,
3624,
29899,
12754,
2033,
353,
313,
13,
9651,
851,
29898,
524,
29898,
6406,
4961,
13,
1678,
9066,
29961,
13,
4706,
1732,
29918,
15634,
29918,
3075,
1934,
29889,
23845,
29940,
1964,
29918,
23252,
1001,
29918,
15094,
25634,
718,
525,
2659,
29899,
29940,
860,
978,
2033,
353,
313,
13,
9651,
25985,
978,
29897,
13,
1678,
9066,
29961,
13,
4706,
1732,
29918,
15634,
29918,
3075,
1934,
29889,
23845,
29940,
1964,
29918,
23252,
1001,
29918,
15094,
25634,
718,
525,
2659,
29899,
27356,
2133,
2033,
353,
313,
13,
9651,
13013,
29897,
13,
1678,
9066,
1839,
29990,
29899,
2052,
12412,
29899,
20779,
2033,
353,
525,
29999,
29999,
29915,
13,
1678,
3957,
353,
1732,
1982,
29889,
10493,
5350,
29898,
1311,
3032,
3069,
29892,
1583,
3032,
637,
29897,
13,
1678,
411,
3030,
1982,
29889,
11291,
292,
29898,
9965,
1125,
13,
418,
1018,
29901,
13,
4706,
3957,
29889,
6915,
580,
13,
4706,
3957,
29889,
3827,
29898,
21813,
29889,
657,
877,
16244,
29918,
2303,
4690,
13668,
742,
525,
7194,
5477,
13,
462,
965,
3142,
29892,
13,
462,
965,
848,
29892,
13,
462,
965,
9657,
29898,
13662,
29889,
7076,
22130,
13,
13,
4706,
1018,
29901,
13,
3986,
2933,
353,
3957,
29889,
657,
5327,
580,
13,
4706,
5174,
1732,
1982,
29889,
10493,
2451,
408,
321,
29901,
13,
3986,
396,
450,
10073,
1889,
756,
3971,
263,
4319,
7331,
2933,
29889,
1152,
1342,
29892,
13,
3986,
396,
263,
2921,
10073,
1889,
1122,
505,
8095,
287,
297,
623,
29899,
14940,
775,
29889,
13,
3986,
7709,
1583,
3032,
8411,
29918,
2704,
29898,
13,
795,
525,
1552,
10073,
1889,
4846,
263,
4319,
7331,
2933,
29901,
1273,
29879,
29915,
1273,
321,
29892,
13,
795,
1369,
29918,
5327,
29897,
13,
3986,
736,
13,
13,
4706,
396,
22521,
1973,
393,
591,
4772,
2778,
3460,
12312,
9066,
964,
263,
2323,
4839,
29892,
13,
4706,
396,
14372,
671,
310,
2999,
3789,
29899,
24914,
9066,
29889,
13,
4706,
9066,
353,
5159,
13,
4706,
363,
1024,
297,
2933,
29889,
7645,
29901,
13,
3986,
363,
995,
297,
2933,
29889,
7645,
29889,
657,
13662,
29898,
978,
1125,
13,
9651,
9066,
29889,
4397,
3552,
978,
29892,
995,
876,
13,
13,
4706,
2933,
29918,
13662,
353,
281,
5311,
533,
29888,
29889,
13662,
29889,
18163,
29898,
13662,
29897,
13,
13,
4706,
1059,
29918,
1445,
353,
1583,
3032,
657,
29918,
2704,
29918,
1445,
580,
13,
4706,
565,
313,
2704,
29918,
1445,
322,
13,
9651,
1732,
29918,
15634,
29918,
3075,
1934,
29889,
11432,
29918,
16524,
29918,
23252,
1001,
297,
2933,
29918,
13662,
1125,
13,
3986,
1018,
29901,
13,
9651,
411,
1722,
29898,
2704,
29918,
1445,
29897,
408,
285,
29901,
13,
795,
2793,
353,
285,
29889,
949,
580,
13,
3986,
5174,
10663,
2392,
29901,
13,
9651,
2793,
353,
525,
17776,
304,
2254,
1059,
7834,
29915,
13,
9651,
12183,
29889,
11739,
877,
26061,
304,
2254,
1059,
934,
29901,
1273,
29879,
742,
1059,
29918,
1445,
29897,
13,
3986,
1369,
29918,
5327,
877,
29945,
29900,
29900,
512,
1890,
5656,
4829,
742,
13,
462,
308,
518,
877,
3916,
29899,
1542,
742,
525,
726,
29914,
1420,
5477,
13,
462,
3986,
6702,
3916,
29899,
6513,
742,
851,
29898,
2435,
29898,
3051,
4961,
2314,
13,
3986,
7709,
2793,
13,
3986,
736,
13,
4706,
628,
2933,
29918,
13662,
29961,
1124,
29918,
15634,
29918,
3075,
1934,
29889,
11432,
29918,
16524,
29918,
23252,
1001,
29962,
13,
4706,
1369,
29918,
5327,
877,
29995,
29879,
1273,
29879,
29915,
1273,
313,
5327,
29889,
4882,
29892,
2933,
29889,
23147,
511,
13,
462,
539,
2933,
29918,
13662,
29889,
7076,
3101,
13,
13,
4706,
396,
612,
969,
278,
2933,
3573,
297,
2319,
10930,
29889,
13,
4706,
1550,
5852,
29901,
13,
3986,
1018,
29901,
13,
9651,
2908,
353,
2933,
29889,
949,
29898,
29945,
29896,
29906,
29897,
13,
9651,
565,
451,
2908,
29901,
13,
795,
2867,
13,
9651,
7709,
2908,
13,
3986,
5174,
1732,
1982,
29889,
10493,
2451,
29901,
13,
9651,
396,
450,
10073,
1889,
756,
18169,
263,
1108,
29892,
541,
756,
451,
13,
9651,
396,
12695,
8095,
287,
29889,
1152,
1342,
29892,
263,
2921,
10073,
1889,
29915,
7331,
13,
9651,
396,
7834,
1122,
505,
7243,
17840,
297,
623,
29899,
14940,
775,
313,
4716,
278,
1732,
13,
9651,
396,
3577,
674,
9792,
515,
29892,
577,
278,
1889,
408,
263,
3353,
1838,
29915,
29873,
13,
9651,
396,
8095,
467,
2180,
445,
1298,
29892,
591,
505,
2307,
410,
29916,
1000,
373,
2935,
278,
7331,
13,
9651,
396,
4839,
29892,
577,
591,
2609,
24877,
627,
3598,
9080,
263,
29871,
29945,
29900,
29900,
512,
1890,
5656,
13,
9651,
396,
4829,
29889,
1334,
4047,
2705,
2867,
1244,
29936,
278,
10073,
1889,
756,
2225,
24873,
13,
9651,
396,
2307,
3971,
304,
380,
20405,
313,
6071,
278,
1920,
29872,
467,
13,
9651,
2867,
13,
418,
5174,
8960,
29901,
13,
4706,
411,
1583,
3032,
5014,
29918,
908,
29901,
13,
3986,
565,
1583,
3032,
5014,
322,
1583,
3032,
5014,
29889,
29886,
3028,
580,
338,
451,
6213,
29901,
13,
9651,
396,
450,
5849,
1923,
338,
297,
263,
4319,
2106,
29889,
4522,
322,
736,
385,
1059,
13,
9651,
396,
2643,
29889,
13,
9651,
1583,
3032,
29886,
13479,
29918,
2704,
353,
6702,
1552,
10073,
1889,
363,
278,
2777,
2734,
525,
13,
462,
462,
525,
265,
2011,
1273,
29881,
756,
15668,
368,
23283,
29915,
1273,
313,
13,
462,
462,
268,
1583,
3032,
637,
876,
13,
9651,
7709,
1583,
3032,
8411,
29918,
2704,
29898,
1311,
3032,
29886,
13479,
29918,
2704,
29892,
1369,
29918,
5327,
29897,
13,
3986,
1683,
29901,
13,
9651,
12020,
13,
13,
29871,
822,
903,
8411,
29918,
2704,
29898,
1311,
29892,
2643,
29892,
1369,
29918,
5327,
1125,
13,
1678,
396,
25538,
278,
10073,
1889,
263,
2586,
310,
931,
304,
2436,
304,
380,
20405,
29889,
13,
1678,
931,
29889,
17059,
29898,
29900,
29889,
29896,
29897,
13,
1678,
18392,
353,
1583,
3032,
303,
20405,
29918,
371,
29872,
29889,
657,
29918,
9721,
580,
13,
1678,
565,
18392,
29901,
13,
418,
2643,
353,
2643,
718,
11297,
29876,
29905,
29876,
29915,
718,
18392,
13,
1678,
396,
14402,
29901,
1735,
525,
726,
29914,
24595,
29915,
304,
525,
726,
29914,
24595,
29936,
17425,
29922,
9420,
29899,
29947,
29915,
13,
1678,
396,
10106,
2906,
932,
2974,
29906,
29889,
13,
1678,
1369,
29918,
5327,
877,
29945,
29900,
29900,
512,
1890,
5656,
4829,
742,
13,
462,
259,
518,
877,
3916,
29899,
1542,
742,
525,
726,
29914,
24595,
5477,
13,
462,
1678,
6702,
3916,
29899,
6513,
742,
851,
29898,
2435,
29898,
4906,
4961,
2314,
13,
1678,
736,
2643,
13,
13,
29871,
822,
903,
949,
29918,
2962,
29918,
5014,
29918,
1445,
29898,
1311,
29892,
4236,
29918,
1131,
3456,
29879,
29922,
29896,
29900,
29892,
8709,
29918,
3188,
21098,
29896,
29906,
29945,
1125,
13,
1678,
9995,
6359,
278,
2323,
1196,
2933,
3806,
297,
278,
1369,
1889,
934,
29889,
13,
13,
1678,
450,
6850,
8322,
29918,
8618,
23524,
29918,
7724,
21054,
272,
3913,
263,
934,
363,
278,
10073,
2777,
304,
13,
1678,
3461,
1250,
278,
2011,
372,
338,
19866,
373,
29889,
1334,
508,
29915,
29873,
19104,
373,
382,
9800,
29505,
13,
1678,
408,
393,
338,
263,
8175,
4195,
746,
278,
10073,
2777,
338,
21699,
13,
1678,
5007,
278,
934,
1550,
278,
2906,
932,
2974,
1889,
338,
5183,
372,
29936,
3265,
591,
13,
1678,
19104,
373,
278,
1196,
1641,
29185,
411,
263,
25899,
29889,
13,
13,
1678,
826,
3174,
29901,
13,
418,
4236,
29918,
1131,
3456,
29879,
29901,
450,
7472,
1353,
310,
14734,
304,
1303,
278,
1196,
29889,
13,
418,
8709,
29918,
3188,
29901,
1128,
1472,
297,
6923,
304,
8709,
1546,
278,
937,
322,
1473,
13,
4706,
4218,
313,
1552,
931,
674,
367,
3765,
29881,
1546,
1269,
2551,
573,
4218,
467,
450,
13,
4706,
995,
1122,
367,
738,
16985,
1134,
393,
338,
3588,
1821,
304,
5785,
313,
19676,
13,
4706,
2113,
29915,
29873,
664,
541,
1404,
4072,
393,
526,
18430,
16985,
29899,
4561,
674,
467,
13,
13,
1678,
16969,
29901,
13,
418,
960,
263,
2989,
2323,
1196,
313,
294,
18694,
491,
263,
25899,
6624,
1061,
29897,
338,
1476,
29892,
599,
13,
418,
848,
1303,
701,
304,
393,
1298,
338,
4133,
29936,
736,
385,
4069,
1347,
565,
694,
13,
418,
25899,
338,
1303,
1434,
278,
1889,
429,
1169,
470,
278,
4236,
1353,
310,
14734,
526,
13,
418,
1754,
29889,
13,
1678,
9995,
13,
1678,
1018,
29901,
13,
418,
363,
4218,
297,
3464,
29898,
3317,
29918,
1131,
3456,
29879,
1125,
13,
4706,
396,
3869,
29892,
278,
2186,
848,
1122,
2307,
367,
297,
278,
934,
1584,
2466,
278,
13,
4706,
396,
1889,
429,
1573,
29889,
2193,
1497,
29892,
1951,
278,
1889,
881,
7952,
18758,
13,
4706,
396,
565,
372,
29915,
29879,
429,
1573,
591,
1016,
29915,
29873,
2562,
8763,
29889,
13,
4706,
565,
1583,
3032,
5014,
29889,
29886,
3028,
580,
338,
451,
6213,
29901,
13,
3986,
736,
6629,
13,
4706,
396,
1551,
4326,
29892,
565,
278,
937,
1303,
297,
445,
1889,
10008,
1434,
278,
848,
338,
13,
4706,
396,
3971,
29892,
694,
848,
674,
3926,
367,
1303,
491,
445,
1889,
1728,
278,
16508,
29889,
13,
4706,
1583,
3032,
5014,
29889,
5145,
29918,
449,
29889,
344,
1416,
29898,
29900,
29897,
13,
4706,
1196,
353,
1583,
3032,
5014,
29889,
5145,
29918,
449,
29889,
949,
580,
13,
4706,
565,
11297,
29876,
29915,
297,
1196,
29901,
13,
3986,
736,
1196,
13,
4706,
903,
17059,
29918,
14811,
29918,
2267,
2722,
29898,
1131,
3456,
29892,
4236,
29918,
1131,
3456,
29879,
29892,
8709,
29918,
3188,
29897,
13,
1678,
7146,
29901,
13,
418,
1583,
3032,
5014,
29889,
5145,
29918,
449,
29889,
5358,
580,
13,
1678,
736,
6629,
13,
13,
29871,
822,
1369,
29898,
1311,
1125,
13,
1678,
9995,
4763,
29879,
278,
10073,
1889,
322,
11324,
1169,
2745,
372,
338,
7960,
304,
9080,
1213,
15945,
13,
1678,
10073,
29918,
2917,
353,
1583,
3032,
15634,
29918,
2917,
29918,
657,
357,
580,
13,
1678,
396,
14402,
29901,
4803,
263,
1422,
1889,
2318,
304,
11695,
403,
278,
2278,
1889,
13,
1678,
396,
515,
18470,
2665,
304,
278,
3847,
29889,
9333,
3625,
297,
1014,
5014,
297,
13,
1678,
396,
5132,
29871,
29906,
29889,
29955,
29889,
13,
1678,
4974,
1583,
3032,
2962,
29918,
5014,
29918,
29888,
4112,
272,
297,
1583,
3032,
26707,
29918,
25826,
29918,
8618,
23524,
29918,
18823,
29963,
24125,
13,
1678,
565,
1583,
3032,
2962,
29918,
5014,
29918,
29888,
4112,
272,
1275,
6850,
8322,
29918,
8618,
23524,
29901,
13,
418,
7797,
1891,
29918,
2917,
353,
2967,
29953,
29946,
29889,
29890,
29953,
29946,
12508,
29898,
15634,
29918,
2917,
29889,
1748,
6646,
8246,
3101,
13,
418,
411,
1583,
3032,
5014,
29918,
908,
29901,
13,
4706,
4974,
451,
1583,
3032,
5014,
29892,
525,
2962,
580,
508,
871,
367,
2000,
2748,
29915,
13,
4706,
1583,
3032,
5014,
353,
9109,
29918,
1491,
5014,
29889,
2962,
29918,
5014,
29898,
13,
9651,
1583,
3032,
5085,
29892,
13,
9651,
7797,
1891,
29918,
2917,
29892,
13,
9651,
27591,
29922,
1491,
5014,
29889,
2227,
4162,
29892,
13,
9651,
380,
20405,
29922,
1491,
5014,
29889,
2227,
4162,
29892,
13,
9651,
8829,
29922,
1311,
3032,
6272,
29892,
13,
9651,
274,
9970,
29922,
1311,
3032,
5453,
29918,
13305,
29889,
6214,
29918,
4632,
29897,
13,
418,
1196,
353,
1583,
3032,
5014,
29889,
25393,
29889,
949,
1220,
580,
13,
1678,
25342,
1583,
3032,
2962,
29918,
5014,
29918,
29888,
4112,
272,
1275,
6850,
8322,
29918,
8618,
23524,
29918,
7724,
29901,
13,
418,
7797,
1891,
29918,
2917,
353,
10073,
29918,
2917,
29889,
1748,
6646,
8246,
580,
13,
418,
411,
1583,
3032,
5014,
29918,
908,
29901,
13,
4706,
4974,
451,
1583,
3032,
5014,
29892,
525,
2962,
580,
508,
871,
367,
2000,
2748,
29915,
13,
4706,
1583,
3032,
5014,
353,
9109,
29918,
1491,
5014,
29889,
2962,
29918,
5014,
29918,
1445,
29898,
13,
9651,
6389,
29922,
1311,
3032,
5085,
29892,
13,
9651,
1881,
29918,
1807,
29922,
15550,
1891,
29918,
2917,
29892,
13,
9651,
8829,
29922,
1311,
3032,
6272,
29892,
13,
9651,
274,
9970,
29922,
1311,
3032,
5453,
29918,
13305,
29889,
6214,
29918,
4632,
29892,
13,
9651,
380,
20405,
29922,
1491,
5014,
29889,
2227,
4162,
29897,
13,
418,
1196,
353,
1583,
3032,
949,
29918,
2962,
29918,
5014,
29918,
1445,
580,
13,
418,
903,
5992,
29918,
276,
2202,
29918,
845,
4362,
29918,
1403,
22671,
29898,
1311,
3032,
5014,
29889,
5145,
29918,
449,
29889,
978,
29897,
13,
13,
1678,
396,
903,
303,
20405,
29918,
371,
29872,
1122,
367,
758,
29899,
842,
491,
5190,
6987,
29889,
13,
1678,
565,
1583,
3032,
303,
20405,
29918,
371,
29872,
338,
6213,
29901,
13,
418,
1583,
3032,
303,
20405,
29918,
371,
29872,
353,
734,
29872,
29889,
29911,
3905,
29898,
1311,
3032,
5014,
29889,
303,
20405,
29892,
10876,
29889,
303,
20405,
29897,
13,
418,
1583,
3032,
303,
20405,
29918,
371,
29872,
29889,
2962,
580,
13,
1678,
1583,
3032,
29886,
13479,
29918,
2704,
353,
6213,
13,
1678,
1583,
3032,
637,
353,
6213,
13,
1678,
1018,
29901,
13,
418,
1583,
3032,
637,
353,
938,
29898,
1220,
29897,
13,
1678,
5174,
7865,
2392,
29901,
13,
418,
1583,
3032,
29886,
13479,
29918,
2704,
353,
525,
12313,
10073,
1889,
2011,
518,
29995,
29878,
29962,
29915,
1273,
1196,
13,
418,
12183,
29889,
2704,
29898,
1311,
3032,
29886,
13479,
29918,
2704,
29897,
13,
1678,
1683,
29901,
13,
418,
396,
5399,
565,
278,
10073,
508,
9080,
7274,
29889,
13,
418,
565,
451,
1583,
3032,
3068,
29918,
6915,
7295,
13,
4706,
1583,
3032,
29886,
13479,
29918,
2704,
353,
525,
29883,
6735,
4511,
304,
10073,
373,
2011,
1273,
29878,
29915,
1273,
1583,
3032,
637,
13,
4706,
12183,
29889,
2704,
29898,
1311,
3032,
29886,
13479,
29918,
2704,
29897,
13,
13,
29871,
822,
903,
3068,
29918,
6915,
29898,
1311,
1125,
13,
1678,
3957,
353,
1732,
1982,
29889,
10493,
5350,
29898,
1311,
3032,
3069,
29892,
1583,
3032,
637,
29897,
13,
1678,
411,
3030,
1982,
29889,
11291,
292,
29898,
9965,
1125,
13,
418,
1018,
29901,
13,
4706,
3957,
29889,
6915,
580,
13,
418,
5174,
9909,
29889,
2704,
29901,
13,
4706,
736,
7700,
13,
418,
1683,
29901,
13,
4706,
736,
5852,
13,
13,
29871,
822,
23283,
29898,
1311,
1125,
13,
1678,
9995,
29907,
1485,
267,
278,
10073,
1889,
304,
6876,
1213,
15945,
13,
1678,
411,
1583,
3032,
5014,
29918,
908,
29901,
13,
418,
4974,
1583,
3032,
5014,
29892,
525,
5453,
471,
451,
2734,
29915,
13,
418,
1018,
29901,
13,
4706,
1583,
3032,
5014,
29889,
21174,
580,
13,
418,
5174,
438,
29173,
29901,
13,
4706,
1209,
13,
418,
396,
4326,
454,
10327,
934,
29037,
943,
1728,
1246,
304,
5988,
29889,
9511,
1103,
263,
8175,
13,
418,
396,
4195,
988,
278,
26997,
338,
9368,
304,
3802,
278,
1014,
5014,
14282,
13,
418,
396,
408,
278,
3244,
22602,
29915,
29873,
4133,
515,
278,
1303,
1220,
1246,
29889,
13,
418,
1583,
3032,
303,
20405,
29918,
371,
29872,
29889,
7122,
29898,
29945,
29897,
13,
418,
1583,
3032,
5014,
353,
6213,
13,
2
] |
main.py | omarkhaled850/photo_shop_for_pros | 0 | 93372 | <reponame>omarkhaled850/photo_shop_for_pros<filename>main.py<gh_stars>0
# Name : <NAME>
import imutils
from PyQt5 import QtCore, QtGui, QtWidgets
import cv2
import numpy as np
from PyQt5.QtGui import QPixmap
from PyQt5.QtWidgets import QAction, QFileDialog, QMainWindow, QDialog, QDialogButtonBox, QVBoxLayout, QInputDialog, \
QLineEdit
# dialog message
class CustomDialog(QDialog):
def __init__(self, *args, **kwargs):
super(CustomDialog, self).__init__(*args, **kwargs)
self.setWindowTitle("HELLO!")
buttons = QDialogButtonBox.Ok | QDialogButtonBox.Cancel
self.buttonBox = QDialogButtonBox(buttons)
self.buttonBox.accepted.connect(self.accept)
self.buttonBox.rejected.connect(self.reject)
self.layout = QVBoxLayout()
self.layout.addWidget(self.buttonBox)
self.setLayout(self.layout)
# qweight
class Ui_MainWindow(QMainWindow):
global_img = None
display_img = None
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(800, 500)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.formLayoutWidget = QtWidgets.QWidget(self.centralwidget)
self.formLayoutWidget.setGeometry(QtCore.QRect(0, 0, 161, 421))
self.formLayoutWidget.setObjectName("formLayoutWidget")
self.formLayout = QtWidgets.QFormLayout(self.formLayoutWidget)
self.formLayout.setContentsMargins(0, 0, 0, 0)
self.formLayout.setObjectName("formLayout")
self.main_toolbox = QtWidgets.QToolBox(self.formLayoutWidget)
self.main_toolbox.setEnabled(True)
self.main_toolbox.setMouseTracking(False)
self.main_toolbox.setObjectName("main_toolbox")
self.page = QtWidgets.QWidget()
self.page.setGeometry(QtCore.QRect(0, 0, 159, 338))
self.page.setObjectName("page")
self.verticalLayoutWidget = QtWidgets.QWidget(self.page)
self.verticalLayoutWidget.setGeometry(QtCore.QRect(0, -1, 160, 341))
self.verticalLayoutWidget.setObjectName("verticalLayoutWidget")
self.verticalLayout = QtWidgets.QVBoxLayout(self.verticalLayoutWidget)
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
self.verticalLayout.setObjectName("verticalLayout")
self.gray_scale_btn = QtWidgets.QPushButton(self.verticalLayoutWidget)
self.gray_scale_btn.setObjectName("gray_scale_btn")
self.verticalLayout.addWidget(self.gray_scale_btn)
self.flip_btn = QtWidgets.QPushButton(self.verticalLayoutWidget)
self.flip_btn.setObjectName("flip_btn")
self.verticalLayout.addWidget(self.flip_btn)
self.rot_btn = QtWidgets.QPushButton(self.verticalLayoutWidget)
self.rot_btn.setObjectName("rot_btn")
self.verticalLayout.addWidget(self.rot_btn)
self.skewing_btn = QtWidgets.QPushButton(self.verticalLayoutWidget)
self.skewing_btn.setObjectName("skewing_btn")
self.verticalLayout.addWidget(self.skewing_btn)
self.croping_btn = QtWidgets.QPushButton(self.verticalLayoutWidget)
self.croping_btn.setObjectName("croping_btn")
self.verticalLayout.addWidget(self.croping_btn)
self.scaling_btn = QtWidgets.QPushButton(self.verticalLayoutWidget)
self.scaling_btn.setObjectName("scaling_btn")
self.verticalLayout.addWidget(self.scaling_btn)
self.translation_btn = QtWidgets.QPushButton(self.verticalLayoutWidget)
self.translation_btn.setObjectName("translation_btn")
self.verticalLayout.addWidget(self.translation_btn)
self.main_toolbox.addItem(self.page, "")
self.page_2 = QtWidgets.QWidget()
self.page_2.setGeometry(QtCore.QRect(0, 0, 159, 338))
self.page_2.setObjectName("page_2")
self.verticalLayoutWidget_2 = QtWidgets.QWidget(self.page_2)
self.verticalLayoutWidget_2.setGeometry(QtCore.QRect(-20, 0, 187, 295))
self.verticalLayoutWidget_2.setObjectName("verticalLayoutWidget_2")
self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.verticalLayoutWidget_2)
self.verticalLayout_2.setContentsMargins(0, 0, 0, 0)
self.verticalLayout_2.setObjectName("verticalLayout_2")
self.label = QtWidgets.QLabel(self.verticalLayoutWidget_2)
self.label.setObjectName("label")
self.verticalLayout_2.addWidget(self.label)
self.negative_btn = QtWidgets.QPushButton(self.verticalLayoutWidget_2)
self.negative_btn.setObjectName("negative_btn")
self.verticalLayout_2.addWidget(self.negative_btn)
self.hist_btn = QtWidgets.QPushButton(self.verticalLayoutWidget_2)
self.hist_btn.setObjectName("hist_btn")
self.verticalLayout_2.addWidget(self.hist_btn)
self.log_btn = QtWidgets.QPushButton(self.verticalLayoutWidget_2)
self.log_btn.setObjectName("log_btn")
self.verticalLayout_2.addWidget(self.log_btn)
self.gamma_btn = QtWidgets.QPushButton(self.verticalLayoutWidget_2)
self.gamma_btn.setObjectName("gamma_btn")
self.verticalLayout_2.addWidget(self.gamma_btn)
self.blending_btn = QtWidgets.QPushButton(self.verticalLayoutWidget_2)
self.blending_btn.setObjectName("blending_btn")
self.verticalLayout_2.addWidget(self.blending_btn)
self.bitslicing_btn = QtWidgets.QPushButton(self.verticalLayoutWidget_2)
self.bitslicing_btn.setObjectName("bitslicing_btn")
self.verticalLayout_2.addWidget(self.bitslicing_btn)
self.slicing_btn = QtWidgets.QPushButton(self.verticalLayoutWidget_2)
self.slicing_btn.setObjectName("slicing_btn")
self.verticalLayout_2.addWidget(self.slicing_btn)
self.label_2 = QtWidgets.QLabel(self.verticalLayoutWidget_2)
self.label_2.setObjectName("label_2")
self.verticalLayout_2.addWidget(self.label_2)
self.smoothing_btn = QtWidgets.QPushButton(self.verticalLayoutWidget_2)
self.smoothing_btn.setObjectName("smoothing_btn")
self.verticalLayout_2.addWidget(self.smoothing_btn)
self.sharp_btn = QtWidgets.QPushButton(self.verticalLayoutWidget_2)
self.sharp_btn.setObjectName("sharp_btn")
self.verticalLayout_2.addWidget(self.sharp_btn)
self.main_toolbox.addItem(self.page_2, "")
self.page_3 = QtWidgets.QWidget()
self.page_3.setGeometry(QtCore.QRect(0, 0, 159, 338))
self.page_3.setObjectName("page_3")
self.verticalLayoutWidget_3 = QtWidgets.QWidget(self.page_3)
self.verticalLayoutWidget_3.setGeometry(QtCore.QRect(-10, 0, 171, 80))
self.verticalLayoutWidget_3.setObjectName("verticalLayoutWidget_3")
self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.verticalLayoutWidget_3)
self.verticalLayout_3.setContentsMargins(0, 0, 0, 0)
self.verticalLayout_3.setObjectName("verticalLayout_3")
self.threshold_btn = QtWidgets.QPushButton(self.verticalLayoutWidget_3)
self.threshold_btn.setObjectName("threshold_btn")
self.verticalLayout_3.addWidget(self.threshold_btn)
self.edge_btn = QtWidgets.QPushButton(self.verticalLayoutWidget_3)
self.edge_btn.setObjectName("edge_btn")
self.verticalLayout_3.addWidget(self.edge_btn)
self.main_toolbox.addItem(self.page_3, "")
self.formLayout.setWidget(0, QtWidgets.QFormLayout.SpanningRole, self.main_toolbox)
self.image_out = QtWidgets.QLabel(self.centralwidget)
self.image_out.setGeometry(QtCore.QRect(180, 0, 581, 441))
self.image_out.setText("")
##############################################################################################
self.image_out.setPixmap(QtGui.QPixmap(""))
self.image_out.setScaledContents(True)
self.image_out.setObjectName("image_out")
MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtWidgets.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 21))
self.menubar.setObjectName("menubar")
self.menuFiles = QtWidgets.QMenu(self.menubar)
self.menuFiles.setObjectName("menuFiles")
MainWindow.setMenuBar(self.menubar)
self.statusbar = QtWidgets.QStatusBar(MainWindow)
self.statusbar.setObjectName("statusbar")
MainWindow.setStatusBar(self.statusbar)
self.actionOpenFile = QtWidgets.QAction(MainWindow)
self.actionOpenFile.setObjectName("actionOpenFile")
self.menuFiles.addAction(self.actionOpenFile)
self.menubar.addAction(self.menuFiles.menuAction())
self.retranslateUi(MainWindow)
self.main_toolbox.setCurrentIndex(1)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
self.rot_btn.clicked.connect(self.rotate_fun)
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
self.gray_scale_btn.setText(_translate("MainWindow", "gray image"))
self.flip_btn.setText(_translate("MainWindow", "flip image"))
self.rot_btn.setText(_translate("MainWindow", "rotate image"))
self.skewing_btn.setText(_translate("MainWindow", "skewing"))
self.croping_btn.setText(_translate("MainWindow", "crop"))
self.scaling_btn.setText(_translate("MainWindow", "scaling"))
self.translation_btn.setText(_translate("MainWindow", "image translation"))
self.main_toolbox.setItemText(self.main_toolbox.indexOf(self.page),
_translate("MainWindow", "Image Operations"))
self.label.setText(_translate("MainWindow", " 1-Point Processing"))
self.hist_btn.setText(_translate("MainWindow", "histogram equalization"))
self.log_btn.setText(_translate("MainWindow", "Log transformation"))
self.gamma_btn.setText(_translate("MainWindow", "Power transformation"))
self.blending_btn.setText(_translate("MainWindow", "Image blending"))
self.bitslicing_btn.setText(_translate("MainWindow", "bite plane slicing"))
self.slicing_btn.setText(_translate("MainWindow", "Image slicing"))
self.negative_btn.setText(_translate("MainWindow", "negative"))
self.label_2.setText(_translate("MainWindow", " 2-Neighborhood Processing"))
self.smoothing_btn.setText(_translate("MainWindow", "smoothing"))
self.sharp_btn.setText(_translate("MainWindow", "sharping"))
self.main_toolbox.setItemText(self.main_toolbox.indexOf(self.page_2),
_translate("MainWindow", "Image Enhancement"))
self.threshold_btn.setText(_translate("MainWindow", "thresholding"))
self.edge_btn.setText(_translate("MainWindow", "edge segmantation"))
self.main_toolbox.setItemText(self.main_toolbox.indexOf(self.page_3),
_translate("MainWindow", "Image Enhancement"))
self.threshold_btn.setText(_translate("MainWindow", "thresholding"))
self.edge_btn.setText(_translate("MainWindow", "edge segmantation"))
self.main_toolbox.setItemText(self.main_toolbox.indexOf(self.page_3),
_translate("MainWindow", "Image Segmentation"))
self.menuFiles.setTitle(_translate("MainWindow", "Files"))
self.actionOpenFile.setText(_translate("MainWindow", "OpenFile"))
# connecting the open image function with the menbar button
self.actionOpenFile.triggered.connect(self.open_img)
# connecting buttons with functions
self.gray_scale_btn.clicked.connect(self.graScaleFun)
self.flip_btn.clicked.connect(self.flip_fun)
self.skewing_btn.clicked.connect(self.skewing_fun)
self.croping_btn.clicked.connect(self.crop_fun)
self.scaling_btn.clicked.connect(self.scaling_fun)
self.translation_btn.clicked.connect(self.trans_fun)
self.hist_btn.clicked.connect(self.histequ_fun)
self.log_btn.clicked.connect(self.log_fun)
self.gamma_btn.clicked.connect(self.gammacorrection)
self.blending_btn.clicked.connect(self.blend_fun)
self.slicing_btn.clicked.connect(self.slicing_fun)
self.negative_btn.clicked.connect(self.negative_fun)
self.smoothing_btn.clicked.connect(self.smoothing_fun)
self.sharp_btn.clicked.connect(self.sharp_fun)
self.threshold_btn.clicked.connect(self.threshold_fun)
self.edge_btn.clicked.connect(self.edge_fun)
self.bitslicing_btn.clicked.connect(self.bitslicing_fun)
#open a dialog fo the user to choose the image
def open_img(self):
imagePath, _ = QFileDialog.getOpenFileName()
self.global_img = cv2.imread(imagePath)
self.display_img = QPixmap(imagePath)
self.image_out.setPixmap(self.display_img)
self.resize(self.display_img.size())
self.adjustSize()
self.image_data()
def bitslicing_fun(self):
lst = []
for i in range(self.global_img.shape[0]):
for j in range(self.global_img.shape[1]):
lst.append(np.binary_repr(self.global_img[i][j], width=8))
eight_bit_img = (np.array([int(i[0]) for i in lst], dtype=np.uint8) * 128).reshape(self.global_img.shape[0],self.global_img.shape[1])
self.global_img = eight_bit_img
self.displayINlebal()
def OpenTextFile(self):
dialog = QtGui.QFileDialog()
dialog.setWindowTitle("Choose a file to open")
dialog.setFileMode(QtGui.QFileDialog.ExistingFile)
dialog.setNameFilter("Text (*.txt);; All files (*.*)")
dialog.setViewMode(QtGui.QFileDialog.Detail)
filename = QtCore.QStringList()
if (dialog.exec_()):
file_name = dialog.selectedFiles()
plain_text = open(file_name[0]).read()
self.Editor.setPlainText(plain_text)
self.file_path = str(file_name[0])
def graScaleFun(self):
gray_img = cv2.cvtColor(self.global_img, cv2.COLOR_BGR2GRAY)
self.global_img = gray_img
cv2.imwrite('savedImage.jpg', gray_img)
self.image_out.setPixmap(QtGui.QPixmap("savedImage.jpg"))
self.image_out.setScaledContents(True)
def negative_fun(self):
height, width = self.global_img.shape
self.global_img= 255 - self.global_img
negative_img = self.global_img
# Display the negative transformed image
self.displayINlebal()
def getTextForFlip(self):
text, okPressed = QInputDialog.getText(self, "fliping", "type:x or y or xy", QLineEdit.Normal, "")
if okPressed and text != '':
print(text)
return text
def flip_fun(self):
res = self.getTextForFlip()
if res == 'x':
flipedimage = cv2.flip(self.global_img, 0)
elif res == 'y':
flipedimage = cv2.flip(self.global_img, 1)
elif res == 'xy':
flipedimage = cv2.flip(self.global_img, -1)
self.global_img = flipedimage
self.displayINlebal()
return flipedimage
def getAngle(self):
angle, okPressed = QInputDialog.getDouble(self, "Get double", "Value:", 10.05, -360, 360, 10)
if okPressed:
print(angle)
return angle
def rotate_fun(self):
angle = self.getAngle()
rotated = imutils.rotate_bound(self.global_img, angle)
self.global_img = rotated
self.displayINlebal()
def skewing_fun(self):
a1, okPressed = QInputDialog.getDouble(self, "enter skewing destnation", "x value 1st point:", 0.0, -self.global_img.shape[0], self.global_img.shape[0], 1)
a2, okPressed = QInputDialog.getDouble(self, "enter skewing destnation", "y value 1st point:", 0.0, -self.global_img.shape[1], self.global_img.shape[1], 1)
b1, okPressed = QInputDialog.getDouble(self, "enter skewing destnation", "x value 2nd point:", 0.0, -self.global_img.shape[0], self.global_img.shape[0], 1)
#b2, okPressed = QInputDialog.getDouble(self, "enter skewing destnation", "y value 2nd point:", 0.0, -self.global_img.shape[1], self.global_img.shape[1], 1)
c1, okPressed = QInputDialog.getDouble(self, "enter skewing destnation", "x value 3rd point:", 0.0, -self.global_img.shape[0], self.global_img.shape[0], 1)
#c2, okPressed = QInputDialog.getDouble(self, "enter skewing destnation", "y value 3rd point:", 0.0, -self.global_img.shape[1], self.global_img.shape[1], 1)
image = self.global_img
src_pts = np.float32([[0, 0], [image.shape[0] - 1, 0], [0, image.shape[1] - 1]])
dst_pts = np.float32([[a1, a2], [image.shape[0]+b1, 0], [c1, image.shape[1]]])
Mat = cv2.getAffineTransform(src_pts, dst_pts)
skewed = cv2.warpAffine(image, Mat, (image.shape[1], image.shape[0]))
self.global_img = skewed
self.displayINlebal()
def crop_fun(self):
a1, okPressed = QInputDialog.getInt(self, "enter croping points", "from row number:", 0, -self.global_img.shape[0], self.global_img.shape[0], 1)
a2, okPressed = QInputDialog.getInt(self, "enter croping points", "to row number:", 0, -self.global_img.shape[1], self.global_img.shape[1], 1)
b1, okPressed = QInputDialog.getInt(self, "enter croping points", "from col number:", 0, -self.global_img.shape[0], self.global_img.shape[0], 1)
b2, okPressed = QInputDialog.getInt(self, "enter croping points", "to col number:", 0, -self.global_img.shape[1], self.global_img.shape[1], 1)
self.global_img = self.global_img[a1:a2, b1:b2]
self.displayINlebal()
cv2.imshow("Cropped Image", self.global_img)
cv2.waitKey(0)
def scaling_fun(self):
scaleX, okPressed = QInputDialog.getInt(self, "Get scaling value", "fx Value:", 1, -self.global_img.shape[0], self.global_img.shape[0], 1)
scaleY, okPressed = QInputDialog.getInt(self, "Get scaling value", "fy Value:", 1, -self.global_img.shape[1], self.global_img.shape[1], 1)
img = self.global_img
# Reduce the image to 0.6 times the original
scaled_img = cv2.resize(img, None, fx=scaleX, fy=scaleY, interpolation=cv2.INTER_LINEAR)
self.global_img = scaled_img
self.displayINlebal()
cv2.imshow("Scaled Image", self.global_img)
cv2.waitKey(0)
def histequ_fun(self):
equ = cv2.equalizeHist(self.global_img)
self.global_img = equ
self.displayINlebal()
def trans_fun(self):
# Store height and width of the image
gray_img = self.global_img
height, width = gray_img.shape[:2]
transX, okPressed = QInputDialog.getInt(self, "Get translation value", "x Value:", 1, -self.global_img.shape[0],self.global_img.shape[0], 1)
transY, okPressed = QInputDialog.getInt(self, "Get translation value", "y Value:", 1, -self.global_img.shape[1],self.global_img.shape[1], 1)
T = np.float32([[1, 0, transX], [0, 1, transY]])
# We use warpAffine to transform
# the image using the matrix, T
trans_img = cv2.warpAffine(gray_img, T, (width, height))
self.global_img = trans_img
self.displayINlebal()
def blend_fun(self):
factor1, okPressed = QInputDialog.getDouble(self, "1st image factor:", 0.5, 0.0, 1, 0.1)
factor2, okPressed = QInputDialog.getDouble(self, "2nd image factor:", 0.5, 0.0, 1, 0.1)
flipedimage = cv2.flip(self.global_img, 0)
dst = cv2.addWeighted(flipedimage, factor1, self.global_img, factor2, 0)
self.global_img = dst
self.displayINlebal()
# # Apply log transformation method
def log_fun(self):
c = 255 / np.log(1 + np.max(self.global_img))
log_image = c * (np.log(self.global_img + 1))
log_image = np.array(log_image, dtype=np.uint8)
self.global_img = log_image
self.displayINlebal()
# # gamma correction
def gammacorrection(self):
# Apply gamma correction.
gamma, okPressed = QInputDialog.getDouble(self, "enter gamma value ", "gamma<0 = darker , gamma>0 = lighter ", 0.5, 0, 4, 3)
gamma_corrected = np.array(255 * (self.global_img / 255) ** gamma, dtype='uint8')
self.global_img = gamma_corrected
self.displayINlebal()
def threshold_fun(self):
threshvalue, okPressed = QInputDialog.getDouble(self, "thresholding ", "enter the threshold value:",1, 0, 255, 1)
ret, thresh1 = cv2.threshold(self.global_img, threshvalue, 255, cv2.THRESH_BINARY)
self.global_img = thresh1
self.displayINlebal()
# grey level slicing
def slicing_fun(self):
# Find width and height of image
row, column = self.global_img.shape
# Create an zeros array to store the sliced image
img1 = np.zeros((row, column), dtype='uint8')
# Specify the min and max range
min_range, okPressed = QInputDialog.getInt(self, "slicing data", "min range", 0, 0, 255, 1)
max_range, okPressed = QInputDialog.getInt(self, "slicing data", "max range", 0, 0, 255, 1)
# Loop over the input image and if pixel value lies in desired range set it to 255 otherwise set it to 0.
for i in range(row):
for j in range(column):
if self.global_img[i, j] > max_range:
img1[i, j] = 255
elif self.global_img[i, j] < min_range:
img1[i, j] = 0
# Display the image
self.global_img = img1
self.displayINlebal()
# this function takes the user choice and give him the filter he\she wants
def smoothing_fun(self):
items = ("Gaussian", "Averaging", "circular","pyramidal","cone","median")
item, okPressed = QInputDialog.getItem(self, "choose method", "filter:", items, 0, False)
if okPressed and item:
print(item)
if item == 'Gaussian':
print(item)
if item == 'Gaussian':
self.global_img = cv2.GaussianBlur(self.global_img, (5, 5), 0)
self.displayINlebal()
elif item == "Averaging":
self.global_img = cv2.blur(self.global_img, (5, 5))
self.displayINlebal()
elif item == "circular":
circularKernal = np.array([[0, 1, 1, 1, 0], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [0, 1, 1, 1, 0]],np.float32) / 21
dst = cv2.filter2D(self.global_img, -1, circularKernal)
self.global_img = dst
self.displayINlebal()
elif item == "pyramidal":
pykernel = np.array([[1, 2, 3, 2, 1], [2, 4, 6, 4, 2], [3, 6, 9, 6, 3], [2, 4, 6, 4, 2], [1, 2, 3, 2, 1]],np.float32) / 81
dst = cv2.filter2D(self.global_img, -1, pykernel)
self.global_img = dst
self.displayINlebal()
elif item == "cone":
coneKernel = np.array([[0, 0, 1, 0, 0], [0, 2, 2, 2, 0], [1, 2, 5, 2, 1], [0, 2, 2, 2, 0], [0, 0, 1, 0, 0]],np.float32) / 25
dst = cv2.filter2D(self.global_img, -1, coneKernel)
self.global_img = dst
self.displayINlebal()
elif item == "median":
median = cv2.medianBlur(self.global_img, 5)
self.global_img = median
self.displayINlebal()
def sharp_fun(self):
items = ("laplacian", "sobelx", "sobely",)
item, okPressed = QInputDialog.getItem(self, "choose method", "filter:", items, 0, False)
if item == "sobely":
sobely = cv2.Sobel(self.global_img, cv2.CV_64F, 0, 1, ksize=5)
self.global_img = sobely
elif item == "sobelx":
sobelx = cv2.Sobel(self.global_img, cv2.CV_64F, 1, 0, ksize=5)
self.global_img = sobelx
elif item == "laplacian":
laplacian = cv2.Laplacian(self.global_img, cv2.CV_64F)
self.global_img = laplacian
self.displayINlebal()
def edge_fun(self):
# Remove noise by blurring with a Gaussian filter
blur = cv2.GaussianBlur(self.global_img, (5, 5), 0)
# Apply Laplace function
laplacian = cv2.Laplacian(blur, cv2.CV_64F)
# converting back to uint8
abs_dst = cv2.convertScaleAbs(laplacian)
self.global_img = abs_dst
self.displayINlebal()
# this function prints the data of any input image in console
def image_data(self):
print(type(self.global_img))
print('RGB shape: ') # Rows, cols, channels
print(self.global_img.shape)
imgshape = self.global_img.shape
rows = imgshape[0]
cols = imgshape[1]
print(rows)
print(cols)
print('Gray shape:')
print(self.global_img.shape)
print('img.dtype: ')
print(self.global_img.dtype)
print('img.size: ')
print(self.global_img.dtype)
# this function is for displaying the image in the fram of the program not in a imshow new fram
def displayINlebal(self):
filename = 'savedImage.jpg'
cv2.imwrite(filename, self.global_img)
self.image_out.setPixmap(QtGui.QPixmap("savedImage.jpg"))
self.image_out.setScaledContents(True)
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,
290,
935,
29882,
7943,
29947,
29945,
29900,
29914,
21596,
29918,
19032,
29918,
1454,
29918,
771,
29879,
29966,
9507,
29958,
3396,
29889,
2272,
29966,
12443,
29918,
303,
1503,
29958,
29900,
13,
29937,
4408,
584,
529,
5813,
29958,
6756,
13,
30004,
13,
30004,
13,
5215,
527,
13239,
30004,
13,
3166,
10772,
17303,
29945,
1053,
14705,
9203,
29892,
14705,
28707,
29892,
14705,
8801,
29879,
30004,
13,
5215,
13850,
29906,
30004,
13,
5215,
12655,
408,
7442,
30004,
13,
3166,
10772,
17303,
29945,
29889,
17303,
28707,
1053,
660,
29925,
861,
1958,
30004,
13,
3166,
10772,
17303,
29945,
29889,
17303,
8801,
29879,
1053,
660,
4276,
29892,
660,
2283,
7647,
29892,
660,
6330,
5907,
29892,
660,
7647,
29892,
660,
7647,
3125,
3313,
29892,
660,
29963,
3313,
3453,
29892,
660,
4290,
7647,
29892,
320,
30004,
13,
1678,
660,
3542,
6103,
30004,
13,
30004,
13,
30004,
13,
29937,
7928,
2643,
30004,
13,
1990,
8701,
7647,
29898,
29984,
7647,
1125,
30004,
13,
30004,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
334,
5085,
29892,
3579,
19290,
1125,
30004,
13,
4706,
2428,
29898,
7281,
7647,
29892,
1583,
467,
1649,
2344,
1649,
10456,
5085,
29892,
3579,
19290,
8443,
13,
30004,
13,
4706,
1583,
29889,
842,
5907,
7030,
703,
9606,
2208,
29949,
29991,
1159,
30004,
13,
30004,
13,
4706,
9828,
353,
660,
7647,
3125,
3313,
29889,
20434,
891,
660,
7647,
3125,
3313,
29889,
19420,
30004,
13,
30004,
13,
4706,
1583,
29889,
3092,
3313,
353,
660,
7647,
3125,
3313,
29898,
4187,
7453,
8443,
13,
4706,
1583,
29889,
3092,
3313,
29889,
16044,
287,
29889,
6915,
29898,
1311,
29889,
16044,
8443,
13,
4706,
1583,
29889,
3092,
3313,
29889,
276,
622,
287,
29889,
6915,
29898,
1311,
29889,
276,
622,
8443,
13,
30004,
13,
4706,
1583,
29889,
2680,
353,
660,
29963,
3313,
3453,
26471,
13,
4706,
1583,
29889,
2680,
29889,
1202,
8801,
29898,
1311,
29889,
3092,
3313,
8443,
13,
4706,
1583,
29889,
842,
3453,
29898,
1311,
29889,
2680,
8443,
13,
30004,
13,
29937,
3855,
7915,
30004,
13,
1990,
501,
29875,
29918,
6330,
5907,
29898,
29984,
6330,
5907,
1125,
30004,
13,
1678,
5534,
29918,
2492,
353,
6213,
30004,
13,
1678,
2479,
29918,
2492,
353,
6213,
30004,
13,
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,
21476,
29898,
29947,
29900,
29900,
29892,
29871,
29945,
29900,
29900,
8443,
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,
689,
3453,
8801,
353,
14705,
8801,
29879,
29889,
29984,
8801,
29898,
1311,
29889,
25171,
8030,
8443,
13,
4706,
1583,
29889,
689,
3453,
8801,
29889,
842,
7999,
7843,
29898,
17303,
9203,
29889,
29984,
7364,
29898,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29953,
29896,
29892,
29871,
29946,
29906,
29896,
876,
30004,
13,
4706,
1583,
29889,
689,
3453,
8801,
29889,
842,
2061,
1170,
703,
689,
3453,
8801,
1159,
30004,
13,
4706,
1583,
29889,
689,
3453,
353,
14705,
8801,
29879,
29889,
29984,
2500,
3453,
29898,
1311,
29889,
689,
3453,
8801,
8443,
13,
4706,
1583,
29889,
689,
3453,
29889,
842,
21002,
29924,
1191,
1144,
29898,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
8443,
13,
4706,
1583,
29889,
689,
3453,
29889,
842,
2061,
1170,
703,
689,
3453,
1159,
30004,
13,
4706,
1583,
29889,
3396,
29918,
10154,
1884,
353,
14705,
8801,
29879,
29889,
29984,
12229,
3313,
29898,
1311,
29889,
689,
3453,
8801,
8443,
13,
4706,
1583,
29889,
3396,
29918,
10154,
1884,
29889,
842,
10861,
29898,
5574,
8443,
13,
4706,
1583,
29889,
3396,
29918,
10154,
1884,
29889,
842,
14346,
17936,
292,
29898,
8824,
8443,
13,
4706,
1583,
29889,
3396,
29918,
10154,
1884,
29889,
842,
2061,
1170,
703,
3396,
29918,
10154,
1884,
1159,
30004,
13,
4706,
1583,
29889,
3488,
353,
14705,
8801,
29879,
29889,
29984,
8801,
26471,
13,
4706,
1583,
29889,
3488,
29889,
842,
7999,
7843,
29898,
17303,
9203,
29889,
29984,
7364,
29898,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29945,
29929,
29892,
29871,
29941,
29941,
29947,
876,
30004,
13,
4706,
1583,
29889,
3488,
29889,
842,
2061,
1170,
703,
3488,
1159,
30004,
13,
4706,
1583,
29889,
18575,
3453,
8801,
353,
14705,
8801,
29879,
29889,
29984,
8801,
29898,
1311,
29889,
3488,
8443,
13,
4706,
1583,
29889,
18575,
3453,
8801,
29889,
842,
7999,
7843,
29898,
17303,
9203,
29889,
29984,
7364,
29898,
29900,
29892,
448,
29896,
29892,
29871,
29896,
29953,
29900,
29892,
29871,
29941,
29946,
29896,
876,
30004,
13,
4706,
1583,
29889,
18575,
3453,
8801,
29889,
842,
2061,
1170,
703,
18575,
3453,
8801,
1159,
30004,
13,
4706,
1583,
29889,
18575,
3453,
353,
14705,
8801,
29879,
29889,
29984,
29963,
3313,
3453,
29898,
1311,
29889,
18575,
3453,
8801,
8443,
13,
4706,
1583,
29889,
18575,
3453,
29889,
842,
21002,
29924,
1191,
1144,
29898,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
8443,
13,
4706,
1583,
29889,
18575,
3453,
29889,
842,
2061,
1170,
703,
18575,
3453,
1159,
30004,
13,
4706,
1583,
29889,
21012,
29918,
7052,
29918,
7290,
353,
14705,
8801,
29879,
29889,
29984,
27031,
3125,
29898,
1311,
29889,
18575,
3453,
8801,
8443,
13,
4706,
1583,
29889,
21012,
29918,
7052,
29918,
7290,
29889,
842,
2061,
1170,
703,
21012,
29918,
7052,
29918,
7290,
1159,
30004,
13,
4706,
1583,
29889,
18575,
3453,
29889,
1202,
8801,
29898,
1311,
29889,
21012,
29918,
7052,
29918,
7290,
8443,
13,
4706,
1583,
29889,
29888,
3466,
29918,
7290,
353,
14705,
8801,
29879,
29889,
29984,
27031,
3125,
29898,
1311,
29889,
18575,
3453,
8801,
8443,
13,
4706,
1583,
29889,
29888,
3466,
29918,
7290,
29889,
842,
2061,
1170,
703,
29888,
3466,
29918,
7290,
1159,
30004,
13,
4706,
1583,
29889,
18575,
3453,
29889,
1202,
8801,
29898,
1311,
29889,
29888,
3466,
29918,
7290,
8443,
13,
4706,
1583,
29889,
5450,
29918,
7290,
353,
14705,
8801,
29879,
29889,
29984,
27031,
3125,
29898,
1311,
29889,
18575,
3453,
8801,
8443,
13,
4706,
1583,
29889,
5450,
29918,
7290,
29889,
842,
2061,
1170,
703,
5450,
29918,
7290,
1159,
30004,
13,
4706,
1583,
29889,
18575,
3453,
29889,
1202,
8801,
29898,
1311,
29889,
5450,
29918,
7290,
8443,
13,
4706,
1583,
29889,
26050,
16958,
29918,
7290,
353,
14705,
8801,
29879,
29889,
29984,
27031,
3125,
29898,
1311,
29889,
18575,
3453,
8801,
8443,
13,
4706,
1583,
29889,
26050,
16958,
29918,
7290,
29889,
842,
2061,
1170,
703,
26050,
16958,
29918,
7290,
1159,
30004,
13,
4706,
1583,
29889,
18575,
3453,
29889,
1202,
8801,
29898,
1311,
29889,
26050,
16958,
29918,
7290,
8443,
13,
30004,
13,
4706,
1583,
29889,
29883,
1336,
292,
29918,
7290,
353,
14705,
8801,
29879,
29889,
29984,
27031,
3125,
29898,
1311,
29889,
18575,
3453,
8801,
8443,
13,
4706,
1583,
29889,
29883,
1336,
292,
29918,
7290,
29889,
842,
2061,
1170,
703,
29883,
1336,
292,
29918,
7290,
1159,
30004,
13,
4706,
1583,
29889,
18575,
3453,
29889,
1202,
8801,
29898,
1311,
29889,
29883,
1336,
292,
29918,
7290,
8443,
13,
30004,
13,
4706,
1583,
29889,
19529,
292,
29918,
7290,
353,
14705,
8801,
29879,
29889,
29984,
27031,
3125,
29898,
1311,
29889,
18575,
3453,
8801,
8443,
13,
4706,
1583,
29889,
19529,
292,
29918,
7290,
29889,
842,
2061,
1170,
703,
19529,
292,
29918,
7290,
1159,
30004,
13,
4706,
1583,
29889,
18575,
3453,
29889,
1202,
8801,
29898,
1311,
29889,
19529,
292,
29918,
7290,
8443,
13,
4706,
1583,
29889,
3286,
18411,
29918,
7290,
353,
14705,
8801,
29879,
29889,
29984,
27031,
3125,
29898,
1311,
29889,
18575,
3453,
8801,
8443,
13,
4706,
1583,
29889,
3286,
18411,
29918,
7290,
29889,
842,
2061,
1170,
703,
3286,
18411,
29918,
7290,
1159,
30004,
13,
4706,
1583,
29889,
18575,
3453,
29889,
1202,
8801,
29898,
1311,
29889,
3286,
18411,
29918,
7290,
8443,
13,
30004,
13,
4706,
1583,
29889,
3396,
29918,
10154,
1884,
29889,
1202,
2001,
29898,
1311,
29889,
3488,
29892,
20569,
30004,
13,
4706,
1583,
29889,
3488,
29918,
29906,
353,
14705,
8801,
29879,
29889,
29984,
8801,
26471,
13,
4706,
1583,
29889,
3488,
29918,
29906,
29889,
842,
7999,
7843,
29898,
17303,
9203,
29889,
29984,
7364,
29898,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29945,
29929,
29892,
29871,
29941,
29941,
29947,
876,
30004,
13,
4706,
1583,
29889,
3488,
29918,
29906,
29889,
842,
2061,
1170,
703,
3488,
29918,
29906,
1159,
30004,
13,
4706,
1583,
29889,
18575,
3453,
8801,
29918,
29906,
353,
14705,
8801,
29879,
29889,
29984,
8801,
29898,
1311,
29889,
3488,
29918,
29906,
8443,
13,
4706,
1583,
29889,
18575,
3453,
8801,
29918,
29906,
29889,
842,
7999,
7843,
29898,
17303,
9203,
29889,
29984,
7364,
6278,
29906,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29947,
29955,
29892,
29871,
29906,
29929,
29945,
876,
30004,
13,
4706,
1583,
29889,
18575,
3453,
8801,
29918,
29906,
29889,
842,
2061,
1170,
703,
18575,
3453,
8801,
29918,
29906,
1159,
30004,
13,
4706,
1583,
29889,
18575,
3453,
29918,
29906,
353,
14705,
8801,
29879,
29889,
29984,
29963,
3313,
3453,
29898,
1311,
29889,
18575,
3453,
8801,
29918,
29906,
8443,
13,
4706,
1583,
29889,
18575,
3453,
29918,
29906,
29889,
842,
21002,
29924,
1191,
1144,
29898,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
8443,
13,
4706,
1583,
29889,
18575,
3453,
29918,
29906,
29889,
842,
2061,
1170,
703,
18575,
3453,
29918,
29906,
1159,
30004,
13,
4706,
1583,
29889,
1643,
353,
14705,
8801,
29879,
29889,
2239,
1107,
29898,
1311,
29889,
18575,
3453,
8801,
29918,
29906,
8443,
13,
4706,
1583,
29889,
1643,
29889,
842,
2061,
1170,
703,
1643,
1159,
30004,
13,
4706,
1583,
29889,
18575,
3453,
29918,
29906,
29889,
1202,
8801,
29898,
1311,
29889,
1643,
8443,
13,
4706,
1583,
29889,
22198,
29918,
7290,
353,
14705,
8801,
29879,
29889,
29984,
27031,
3125,
29898,
1311,
29889,
18575,
3453,
8801,
29918,
29906,
8443,
13,
4706,
1583,
29889,
22198,
29918,
7290,
29889,
842,
2061,
1170,
703,
22198,
29918,
7290,
1159,
30004,
13,
4706,
1583,
29889,
18575,
3453,
29918,
29906,
29889,
1202,
8801,
29898,
1311,
29889,
22198,
29918,
7290,
8443,
13,
30004,
13,
4706,
1583,
29889,
29882,
391,
29918,
7290,
353,
14705,
8801,
29879,
29889,
29984,
27031,
3125,
29898,
1311,
29889,
18575,
3453,
8801,
29918,
29906,
8443,
13,
4706,
1583,
29889,
29882,
391,
29918,
7290,
29889,
842,
2061,
1170,
703,
29882,
391,
29918,
7290,
1159,
30004,
13,
4706,
1583,
29889,
18575,
3453,
29918,
29906,
29889,
1202,
8801,
29898,
1311,
29889,
29882,
391,
29918,
7290,
8443,
13,
30004,
13,
4706,
1583,
29889,
1188,
29918,
7290,
353,
14705,
8801,
29879,
29889,
29984,
27031,
3125,
29898,
1311,
29889,
18575,
3453,
8801,
29918,
29906,
8443,
13,
4706,
1583,
29889,
1188,
29918,
7290,
29889,
842,
2061,
1170,
703,
1188,
29918,
7290,
1159,
30004,
13,
4706,
1583,
29889,
18575,
3453,
29918,
29906,
29889,
1202,
8801,
29898,
1311,
29889,
1188,
29918,
7290,
8443,
13,
4706,
1583,
29889,
4283,
29918,
7290,
353,
14705,
8801,
29879,
29889,
29984,
27031,
3125,
29898,
1311,
29889,
18575,
3453,
8801,
29918,
29906,
8443,
13,
4706,
1583,
29889,
4283,
29918,
7290,
29889,
842,
2061,
1170,
703,
4283,
29918,
7290,
1159,
30004,
13,
4706,
1583,
29889,
18575,
3453,
29918,
29906,
29889,
1202,
8801,
29898,
1311,
29889,
4283,
29918,
7290,
8443,
13,
30004,
13,
4706,
1583,
29889,
2204,
2548,
29918,
7290,
353,
14705,
8801,
29879,
29889,
29984,
27031,
3125,
29898,
1311,
29889,
18575,
3453,
8801,
29918,
29906,
8443,
13,
4706,
1583,
29889,
2204,
2548,
29918,
7290,
29889,
842,
2061,
1170,
703,
2204,
2548,
29918,
7290,
1159,
30004,
13,
4706,
1583,
29889,
18575,
3453,
29918,
29906,
29889,
1202,
8801,
29898,
1311,
29889,
2204,
2548,
29918,
7290,
8443,
13,
30004,
13,
4706,
1583,
29889,
14836,
506,
292,
29918,
7290,
353,
14705,
8801,
29879,
29889,
29984,
27031,
3125,
29898,
1311,
29889,
18575,
3453,
8801,
29918,
29906,
8443,
13,
4706,
1583,
29889,
14836,
506,
292,
29918,
7290,
29889,
842,
2061,
1170,
703,
14836,
506,
292,
29918,
7290,
1159,
30004,
13,
4706,
1583,
29889,
18575,
3453,
29918,
29906,
29889,
1202,
8801,
29898,
1311,
29889,
14836,
506,
292,
29918,
7290,
8443,
13,
30004,
13,
4706,
1583,
29889,
29879,
506,
292,
29918,
7290,
353,
14705,
8801,
29879,
29889,
29984,
27031,
3125,
29898,
1311,
29889,
18575,
3453,
8801,
29918,
29906,
8443,
13,
4706,
1583,
29889,
29879,
506,
292,
29918,
7290,
29889,
842,
2061,
1170,
703,
29879,
506,
292,
29918,
7290,
1159,
30004,
13,
4706,
1583,
29889,
18575,
3453,
29918,
29906,
29889,
1202,
8801,
29898,
1311,
29889,
29879,
506,
292,
29918,
7290,
8443,
13,
30004,
13,
30004,
13,
30004,
13,
30004,
13,
4706,
1583,
29889,
1643,
29918,
29906,
353,
14705,
8801,
29879,
29889,
2239,
1107,
29898,
1311,
29889,
18575,
3453,
8801,
29918,
29906,
8443,
13,
4706,
1583,
29889,
1643,
29918,
29906,
29889,
842,
2061,
1170,
703,
1643,
29918,
29906,
1159,
30004,
13,
4706,
1583,
29889,
18575,
3453,
29918,
29906,
29889,
1202,
8801,
29898,
1311,
29889,
1643,
29918,
29906,
8443,
13,
4706,
1583,
29889,
3844,
29877,
6046,
29918,
7290,
353,
14705,
8801,
29879,
29889,
29984,
27031,
3125,
29898,
1311,
29889,
18575,
3453,
8801,
29918,
29906,
8443,
13,
4706,
1583,
29889,
3844,
29877,
6046,
29918,
7290,
29889,
842,
2061,
1170,
703,
3844,
29877,
6046,
29918,
7290,
1159,
30004,
13,
4706,
1583,
29889,
18575,
3453,
29918,
29906,
29889,
1202,
8801,
29898,
1311,
29889,
3844,
29877,
6046,
29918,
7290,
8443,
13,
4706,
1583,
29889,
22064,
29918,
7290,
353,
14705,
8801,
29879,
29889,
29984,
27031,
3125,
29898,
1311,
29889,
18575,
3453,
8801,
29918,
29906,
8443,
13,
4706,
1583,
29889,
22064,
29918,
7290,
29889,
842,
2061,
1170,
703,
22064,
29918,
7290,
1159,
30004,
13,
4706,
1583,
29889,
18575,
3453,
29918,
29906,
29889,
1202,
8801,
29898,
1311,
29889,
22064,
29918,
7290,
8443,
13,
30004,
13,
4706,
1583,
29889,
3396,
29918,
10154,
1884,
29889,
1202,
2001,
29898,
1311,
29889,
3488,
29918,
29906,
29892,
20569,
30004,
13,
4706,
1583,
29889,
3488,
29918,
29941,
353,
14705,
8801,
29879,
29889,
29984,
8801,
26471,
13,
4706,
1583,
29889,
3488,
29918,
29941,
29889,
842,
7999,
7843,
29898,
17303,
9203,
29889,
29984,
7364,
29898,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29945,
29929,
29892,
29871,
29941,
29941,
29947,
876,
30004,
13,
4706,
1583,
29889,
3488,
29918,
29941,
29889,
842,
2061,
1170,
703,
3488,
29918,
29941,
1159,
30004,
13,
4706,
1583,
29889,
18575,
3453,
8801,
29918,
29941,
353,
14705,
8801,
29879,
29889,
29984,
8801,
29898,
1311,
29889,
3488,
29918,
29941,
8443,
13,
4706,
1583,
29889,
18575,
3453,
8801,
29918,
29941,
29889,
842,
7999,
7843,
29898,
17303,
9203,
29889,
29984,
7364,
6278,
29896,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29955,
29896,
29892,
29871,
29947,
29900,
876,
30004,
13,
4706,
1583,
29889,
18575,
3453,
8801,
29918,
29941,
29889,
842,
2061,
1170,
703,
18575,
3453,
8801,
29918,
29941,
1159,
30004,
13,
4706,
1583,
29889,
18575,
3453,
29918,
29941,
353,
14705,
8801,
29879,
29889,
29984,
29963,
3313,
3453,
29898,
1311,
29889,
18575,
3453,
8801,
29918,
29941,
8443,
13,
4706,
1583,
29889,
18575,
3453,
29918,
29941,
29889,
842,
21002,
29924,
1191,
1144,
29898,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
8443,
13,
4706,
1583,
29889,
18575,
3453,
29918,
29941,
29889,
842,
2061,
1170,
703,
18575,
3453,
29918,
29941,
1159,
30004,
13,
4706,
1583,
29889,
386,
12268,
29918,
7290,
353,
14705,
8801,
29879,
29889,
29984,
27031,
3125,
29898,
1311,
29889,
18575,
3453,
8801,
29918,
29941,
8443,
13,
4706,
1583,
29889,
386,
12268,
29918,
7290,
29889,
842,
2061,
1170,
703,
386,
12268,
29918,
7290,
1159,
30004,
13,
4706,
1583,
29889,
18575,
3453,
29918,
29941,
29889,
1202,
8801,
29898,
1311,
29889,
386,
12268,
29918,
7290,
8443,
13,
4706,
1583,
29889,
12864,
29918,
7290,
353,
14705,
8801,
29879,
29889,
29984,
27031,
3125,
29898,
1311,
29889,
18575,
3453,
8801,
29918,
29941,
8443,
13,
4706,
1583,
29889,
12864,
29918,
7290,
29889,
842,
2061,
1170,
703,
12864,
29918,
7290,
1159,
30004,
13,
4706,
1583,
29889,
18575,
3453,
29918,
29941,
29889,
1202,
8801,
29898,
1311,
29889,
12864,
29918,
7290,
8443,
13,
4706,
1583,
29889,
3396,
29918,
10154,
1884,
29889,
1202,
2001,
29898,
1311,
29889,
3488,
29918,
29941,
29892,
20569,
30004,
13,
4706,
1583,
29889,
689,
3453,
29889,
842,
8801,
29898,
29900,
29892,
14705,
8801,
29879,
29889,
29984,
2500,
3453,
29889,
5592,
9450,
16727,
29892,
1583,
29889,
3396,
29918,
10154,
1884,
8443,
13,
4706,
1583,
29889,
3027,
29918,
449,
353,
14705,
8801,
29879,
29889,
2239,
1107,
29898,
1311,
29889,
25171,
8030,
8443,
13,
4706,
1583,
29889,
3027,
29918,
449,
29889,
842,
7999,
7843,
29898,
17303,
9203,
29889,
29984,
7364,
29898,
29896,
29947,
29900,
29892,
29871,
29900,
29892,
29871,
29945,
29947,
29896,
29892,
29871,
29946,
29946,
29896,
876,
30004,
13,
4706,
1583,
29889,
3027,
29918,
449,
29889,
12038,
703,
1159,
30004,
13,
4706,
835,
13383,
13383,
13383,
13383,
13383,
7346,
2277,
29937,
30004,
13,
4706,
1583,
29889,
3027,
29918,
449,
29889,
842,
29925,
861,
1958,
29898,
17303,
28707,
29889,
29984,
29925,
861,
1958,
703,
5783,
30004,
13,
4706,
1583,
29889,
3027,
29918,
449,
29889,
842,
4421,
7943,
21002,
29898,
5574,
8443,
13,
4706,
1583,
29889,
3027,
29918,
449,
29889,
842,
2061,
1170,
703,
3027,
29918,
449,
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,
29947,
29900,
29900,
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,
1583,
29889,
6510,
10547,
353,
14705,
8801,
29879,
29889,
29984,
6823,
29898,
1311,
29889,
1527,
431,
279,
8443,
13,
4706,
1583,
29889,
6510,
10547,
29889,
842,
2061,
1170,
703,
6510,
10547,
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,
4706,
1583,
29889,
2467,
6585,
2283,
353,
14705,
8801,
29879,
29889,
29984,
4276,
29898,
6330,
5907,
8443,
13,
4706,
1583,
29889,
2467,
6585,
2283,
29889,
842,
2061,
1170,
703,
2467,
6585,
2283,
1159,
30004,
13,
4706,
1583,
29889,
6510,
10547,
29889,
1202,
4276,
29898,
1311,
29889,
2467,
6585,
2283,
8443,
13,
4706,
1583,
29889,
1527,
431,
279,
29889,
1202,
4276,
29898,
1311,
29889,
6510,
10547,
29889,
6510,
4276,
3101,
30004,
13,
30004,
13,
4706,
1583,
29889,
276,
21652,
29965,
29875,
29898,
6330,
5907,
8443,
13,
4706,
1583,
29889,
3396,
29918,
10154,
1884,
29889,
842,
7583,
3220,
29898,
29896,
8443,
13,
4706,
14705,
9203,
29889,
29984,
19346,
2061,
29889,
6915,
16973,
1862,
2059,
1170,
29898,
6330,
5907,
8443,
13,
4706,
1583,
29889,
5450,
29918,
7290,
29889,
3808,
287,
29889,
6915,
29898,
1311,
29889,
23361,
29918,
7692,
8443,
13,
30004,
13,
1678,
822,
337,
21652,
29965,
29875,
29898,
1311,
29892,
4241,
5907,
1125,
30004,
13,
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,
6330,
5907,
5783,
30004,
13,
4706,
1583,
29889,
21012,
29918,
7052,
29918,
7290,
29889,
12038,
7373,
21652,
703,
6330,
5907,
613,
376,
21012,
1967,
5783,
30004,
13,
4706,
1583,
29889,
29888,
3466,
29918,
7290,
29889,
12038,
7373,
21652,
703,
6330,
5907,
613,
376,
29888,
3466,
1967,
5783,
30004,
13,
4706,
1583,
29889,
5450,
29918,
7290,
29889,
12038,
7373,
21652,
703,
6330,
5907,
613,
376,
23361,
1967,
5783,
30004,
13,
4706,
1583,
29889,
26050,
16958,
29918,
7290,
29889,
12038,
7373,
21652,
703,
6330,
5907,
613,
376,
26050,
16958,
5783,
30004,
13,
4706,
1583,
29889,
29883,
1336,
292,
29918,
7290,
29889,
12038,
7373,
21652,
703,
6330,
5907,
613,
376,
29883,
1336,
5783,
30004,
13,
4706,
1583,
29889,
19529,
292,
29918,
7290,
29889,
12038,
7373,
21652,
703,
6330,
5907,
613,
376,
19529,
292,
5783,
30004,
13,
4706,
1583,
29889,
3286,
18411,
29918,
7290,
29889,
12038,
7373,
21652,
703,
6330,
5907,
613,
376,
3027,
13962,
5783,
30004,
13,
4706,
1583,
29889,
3396,
29918,
10154,
1884,
29889,
842,
2001,
1626,
29898,
1311,
29889,
3396,
29918,
10154,
1884,
29889,
19402,
29898,
1311,
29889,
3488,
511,
30004,
13,
462,
462,
418,
903,
21652,
703,
6330,
5907,
613,
376,
2940,
6607,
800,
5783,
30004,
13,
4706,
1583,
29889,
1643,
29889,
12038,
7373,
21652,
703,
6330,
5907,
613,
376,
308,
29896,
29899,
5228,
10554,
292,
5783,
30004,
13,
4706,
1583,
29889,
29882,
391,
29918,
7290,
29889,
12038,
7373,
21652,
703,
6330,
5907,
613,
376,
29882,
391,
13342,
5186,
2133,
5783,
30004,
13,
4706,
1583,
29889,
1188,
29918,
7290,
29889,
12038,
7373,
21652,
703,
6330,
5907,
613,
376,
3403,
13852,
5783,
30004,
13,
4706,
1583,
29889,
4283,
29918,
7290,
29889,
12038,
7373,
21652,
703,
6330,
5907,
613,
376,
21472,
13852,
5783,
30004,
13,
4706,
1583,
29889,
2204,
2548,
29918,
7290,
29889,
12038,
7373,
21652,
703,
6330,
5907,
613,
376,
2940,
1999,
2548,
5783,
30004,
13,
4706,
1583,
29889,
14836,
506,
292,
29918,
7290,
29889,
12038,
7373,
21652,
703,
6330,
5907,
613,
376,
29890,
568,
10694,
269,
506,
292,
5783,
30004,
13,
4706,
1583,
29889,
29879,
506,
292,
29918,
7290,
29889,
12038,
7373,
21652,
703,
6330,
5907,
613,
376,
2940,
269,
506,
292,
5783,
30004,
13,
4706,
1583,
29889,
22198,
29918,
7290,
29889,
12038,
7373,
21652,
703,
6330,
5907,
613,
376,
22198,
5783,
30004,
13,
30004,
13,
4706,
1583,
29889,
1643,
29918,
29906,
29889,
12038,
7373,
21652,
703,
6330,
5907,
613,
376,
3986,
29906,
29899,
8139,
1141,
4089,
6614,
10554,
292,
5783,
30004,
13,
4706,
1583,
29889,
3844,
29877,
6046,
29918,
7290,
29889,
12038,
7373,
21652,
703,
6330,
5907,
613,
376,
3844,
29877,
6046,
5783,
30004,
13,
4706,
1583,
29889,
22064,
29918,
7290,
29889,
12038,
7373,
21652,
703,
6330,
5907,
613,
376,
22064,
292,
5783,
30004,
13,
4706,
1583,
29889,
3396,
29918,
10154,
1884,
29889,
842,
2001,
1626,
29898,
1311,
29889,
3396,
29918,
10154,
1884,
29889,
19402,
29898,
1311,
29889,
3488,
29918,
29906,
511,
30004,
13,
462,
462,
418,
903,
21652,
703,
6330,
5907,
613,
376,
2940,
1174,
29882,
27967,
5783,
30004,
13,
4706,
1583,
29889,
386,
12268,
29918,
7290,
29889,
12038,
7373,
21652,
703,
6330,
5907,
613,
376,
386,
12268,
292,
5783,
30004,
13,
4706,
1583,
29889,
12864,
29918,
7290,
29889,
12038,
7373,
21652,
703,
6330,
5907,
613,
376,
12864,
2377,
29885,
424,
362,
5783,
30004,
13,
4706,
1583,
29889,
3396,
29918,
10154,
1884,
29889,
842,
2001,
1626,
29898,
1311,
29889,
3396,
29918,
10154,
1884,
29889,
19402,
29898,
1311,
29889,
3488,
29918,
29941,
511,
30004,
13,
462,
462,
418,
903,
21652,
703,
6330,
5907,
613,
376,
2940,
1174,
29882,
27967,
5783,
30004,
13,
4706,
1583,
29889,
386,
12268,
29918,
7290,
29889,
12038,
7373,
21652,
703,
6330,
5907,
613,
376,
386,
12268,
292,
5783,
30004,
13,
4706,
1583,
29889,
12864,
29918,
7290,
29889,
12038,
7373,
21652,
703,
6330,
5907,
613,
376,
12864,
2377,
29885,
424,
362,
5783,
30004,
13,
4706,
1583,
29889,
3396,
29918,
10154,
1884,
29889,
842,
2001,
1626,
29898,
1311,
29889,
3396,
29918,
10154,
1884,
29889,
19402,
29898,
1311,
29889,
3488,
29918,
29941,
511,
30004,
13,
462,
462,
418,
903,
21652,
703,
6330,
5907,
613,
376,
2940,
6667,
358,
362,
5783,
30004,
13,
4706,
1583,
29889,
6510,
10547,
29889,
842,
7030,
7373,
21652,
703,
6330,
5907,
613,
376,
10547,
5783,
30004,
13,
4706,
1583,
29889,
2467,
6585,
2283,
29889,
12038,
7373,
21652,
703,
6330,
5907,
613,
376,
6585,
2283,
5783,
30004,
13,
4706,
396,
16791,
278,
1722,
1967,
740,
411,
278,
1757,
1646,
2826,
30004,
13,
4706,
1583,
29889,
2467,
6585,
2283,
29889,
21001,
287,
29889,
6915,
29898,
1311,
29889,
3150,
29918,
2492,
8443,
13,
30004,
13,
4706,
396,
16791,
9828,
411,
3168,
30004,
13,
4706,
1583,
29889,
21012,
29918,
7052,
29918,
7290,
29889,
3808,
287,
29889,
6915,
29898,
1311,
29889,
3874,
17185,
25394,
8443,
13,
4706,
1583,
29889,
29888,
3466,
29918,
7290,
29889,
3808,
287,
29889,
6915,
29898,
1311,
29889,
29888,
3466,
29918,
7692,
8443,
13,
4706,
1583,
29889,
26050,
16958,
29918,
7290,
29889,
3808,
287,
29889,
6915,
29898,
1311,
29889,
26050,
16958,
29918,
7692,
8443,
13,
4706,
1583,
29889,
29883,
1336,
292,
29918,
7290,
29889,
3808,
287,
29889,
6915,
29898,
1311,
29889,
29883,
1336,
29918,
7692,
8443,
13,
4706,
1583,
29889,
19529,
292,
29918,
7290,
29889,
3808,
287,
29889,
6915,
29898,
1311,
29889,
19529,
292,
29918,
7692,
8443,
13,
4706,
1583,
29889,
3286,
18411,
29918,
7290,
29889,
3808,
287,
29889,
6915,
29898,
1311,
29889,
3286,
29918,
7692,
8443,
13,
4706,
1583,
29889,
29882,
391,
29918,
7290,
29889,
3808,
287,
29889,
6915,
29898,
1311,
29889,
29882,
2488,
339,
29918,
7692,
8443,
13,
4706,
1583,
29889,
1188,
29918,
7290,
29889,
3808,
287,
29889,
6915,
29898,
1311,
29889,
1188,
29918,
7692,
8443,
13,
4706,
1583,
29889,
4283,
29918,
7290,
29889,
3808,
287,
29889,
6915,
29898,
1311,
29889,
29887,
4850,
562,
272,
276,
428,
8443,
13,
4706,
1583,
29889,
2204,
2548,
29918,
7290,
29889,
3808,
287,
29889,
6915,
29898,
1311,
29889,
2204,
355,
29918,
7692,
8443,
13,
4706,
1583,
29889,
29879,
506,
292,
29918,
7290,
29889,
3808,
287,
29889,
6915,
29898,
1311,
29889,
29879,
506,
292,
29918,
7692,
8443,
13,
4706,
1583,
29889,
22198,
29918,
7290,
29889,
3808,
287,
29889,
6915,
29898,
1311,
29889,
22198,
29918,
7692,
8443,
13,
4706,
1583,
29889,
3844,
29877,
6046,
29918,
7290,
29889,
3808,
287,
29889,
6915,
29898,
1311,
29889,
3844,
29877,
6046,
29918,
7692,
8443,
13,
4706,
1583,
29889,
22064,
29918,
7290,
29889,
3808,
287,
29889,
6915,
29898,
1311,
29889,
22064,
29918,
7692,
8443,
13,
4706,
1583,
29889,
386,
12268,
29918,
7290,
29889,
3808,
287,
29889,
6915,
29898,
1311,
29889,
386,
12268,
29918,
7692,
8443,
13,
4706,
1583,
29889,
12864,
29918,
7290,
29889,
3808,
287,
29889,
6915,
29898,
1311,
29889,
12864,
29918,
7692,
8443,
13,
4706,
1583,
29889,
14836,
506,
292,
29918,
7290,
29889,
3808,
287,
29889,
6915,
29898,
1311,
29889,
14836,
506,
292,
29918,
7692,
8443,
13,
30004,
13,
30004,
13,
29937,
3150,
263,
7928,
1701,
278,
1404,
304,
6755,
278,
1967,
30004,
13,
30004,
13,
30004,
13,
1678,
822,
1722,
29918,
2492,
29898,
1311,
1125,
30004,
13,
4706,
1967,
2605,
29892,
903,
353,
660,
2283,
7647,
29889,
657,
6585,
17020,
26471,
13,
4706,
1583,
29889,
10945,
29918,
2492,
353,
13850,
29906,
29889,
326,
949,
29898,
3027,
2605,
8443,
13,
4706,
1583,
29889,
4990,
29918,
2492,
353,
660,
29925,
861,
1958,
29898,
3027,
2605,
8443,
13,
4706,
1583,
29889,
3027,
29918,
449,
29889,
842,
29925,
861,
1958,
29898,
1311,
29889,
4990,
29918,
2492,
8443,
13,
4706,
1583,
29889,
21476,
29898,
1311,
29889,
4990,
29918,
2492,
29889,
2311,
3101,
30004,
13,
4706,
1583,
29889,
328,
5143,
3505,
26471,
13,
4706,
1583,
29889,
3027,
29918,
1272,
26471,
13,
1678,
6756,
13,
30004,
13,
1678,
822,
9978,
506,
292,
29918,
7692,
29898,
1311,
1125,
30004,
13,
4706,
24471,
353,
5159,
30004,
13,
4706,
363,
474,
297,
3464,
29898,
1311,
29889,
10945,
29918,
2492,
29889,
12181,
29961,
29900,
29962,
1125,
30004,
13,
9651,
363,
432,
297,
3464,
29898,
1311,
29889,
10945,
29918,
2492,
29889,
12181,
29961,
29896,
29962,
1125,
30004,
13,
18884,
24471,
29889,
4397,
29898,
9302,
29889,
19541,
29918,
276,
558,
29898,
1311,
29889,
10945,
29918,
2492,
29961,
29875,
3816,
29926,
1402,
2920,
29922,
29947,
876,
30004,
13,
4706,
9475,
29918,
2966,
29918,
2492,
353,
313,
9302,
29889,
2378,
4197,
524,
29898,
29875,
29961,
29900,
2314,
363,
474,
297,
24471,
1402,
26688,
29922,
9302,
29889,
13470,
29947,
29897,
334,
29871,
29896,
29906,
29947,
467,
690,
14443,
29898,
1311,
29889,
10945,
29918,
2492,
29889,
12181,
29961,
29900,
1402,
1311,
29889,
10945,
29918,
2492,
29889,
12181,
29961,
29896,
2314,
30004,
13,
4706,
1583,
29889,
10945,
29918,
2492,
353,
9475,
29918,
2966,
29918,
2492,
30004,
13,
4706,
1583,
29889,
4990,
1177,
280,
5521,
26471,
13,
30004,
13,
30004,
13,
1678,
822,
4673,
1626,
2283,
29898,
1311,
1125,
30004,
13,
4706,
7928,
353,
14705,
28707,
29889,
29984,
2283,
7647,
26471,
13,
4706,
7928,
29889,
842,
5907,
7030,
703,
15954,
852,
263,
934,
304,
1722,
1159,
30004,
13,
4706,
7928,
29889,
842,
2283,
6818,
29898,
17303,
28707,
29889,
29984,
2283,
7647,
29889,
1252,
15423,
2283,
8443,
13,
4706,
7928,
29889,
842,
1170,
5072,
703,
1626,
3070,
29889,
3945,
416,
29936,
2178,
2066,
3070,
5575,
25760,
30004,
13,
4706,
7928,
29889,
842,
1043,
6818,
29898,
17303,
28707,
29889,
29984,
2283,
7647,
29889,
16570,
8443,
13,
30004,
13,
4706,
10422,
353,
14705,
9203,
29889,
29984,
1231,
1293,
26471,
13,
30004,
13,
4706,
565,
313,
15901,
29889,
4258,
29918,
580,
1125,
30004,
13,
9651,
934,
29918,
978,
353,
7928,
29889,
8391,
10547,
26471,
13,
4706,
8656,
29918,
726,
353,
1722,
29898,
1445,
29918,
978,
29961,
29900,
14664,
949,
26471,
13,
4706,
1583,
29889,
15280,
29889,
842,
29925,
7420,
1626,
29898,
24595,
29918,
726,
8443,
13,
4706,
1583,
29889,
1445,
29918,
2084,
353,
851,
29898,
1445,
29918,
978,
29961,
29900,
2314,
30004,
13,
30004,
13,
1678,
822,
2646,
17185,
25394,
29898,
1311,
1125,
30004,
13,
4706,
16749,
29918,
2492,
353,
13850,
29906,
29889,
11023,
29873,
3306,
29898,
1311,
29889,
10945,
29918,
2492,
29892,
13850,
29906,
29889,
15032,
1955,
29918,
29933,
14345,
29906,
29954,
22800,
8443,
13,
4706,
1583,
29889,
10945,
29918,
2492,
353,
16749,
29918,
2492,
30004,
13,
4706,
13850,
29906,
29889,
326,
3539,
877,
17314,
2940,
29889,
6173,
742,
16749,
29918,
2492,
8443,
13,
4706,
1583,
29889,
3027,
29918,
449,
29889,
842,
29925,
861,
1958,
29898,
17303,
28707,
29889,
29984,
29925,
861,
1958,
703,
17314,
2940,
29889,
6173,
5783,
30004,
13,
4706,
1583,
29889,
3027,
29918,
449,
29889,
842,
4421,
7943,
21002,
29898,
5574,
8443,
13,
30004,
13,
1678,
822,
8178,
29918,
7692,
29898,
1311,
1125,
30004,
13,
4706,
3171,
29892,
2920,
353,
1583,
29889,
10945,
29918,
2492,
29889,
12181,
30004,
13,
30004,
13,
30004,
13,
4706,
1583,
29889,
10945,
29918,
2492,
29922,
29871,
29906,
29945,
29945,
448,
1583,
29889,
10945,
29918,
2492,
30004,
13,
30004,
13,
4706,
8178,
29918,
2492,
353,
1583,
29889,
10945,
29918,
2492,
30004,
13,
4706,
396,
17440,
278,
8178,
27615,
1967,
30004,
13,
4706,
1583,
29889,
4990,
1177,
280,
5521,
26471,
13,
30004,
13,
30004,
13,
30004,
13,
1678,
822,
679,
1626,
2831,
29943,
3466,
29898,
1311,
1125,
30004,
13,
4706,
1426,
29892,
3431,
24104,
353,
660,
4290,
7647,
29889,
18516,
29898,
1311,
29892,
376,
29888,
3466,
292,
613,
376,
1853,
29901,
29916,
470,
343,
470,
921,
29891,
613,
660,
3542,
6103,
29889,
19077,
29892,
20569,
30004,
13,
4706,
565,
3431,
24104,
322,
1426,
2804,
525,
2396,
30004,
13,
9651,
1596,
29898,
726,
8443,
13,
9651,
736,
1426,
30004,
13,
1678,
822,
285,
3466,
29918,
7692,
29898,
1311,
1125,
30004,
13,
4706,
620,
353,
1583,
29889,
18516,
2831,
29943,
3466,
26471,
13,
4706,
565,
620,
1275,
525,
29916,
2396,
30004,
13,
9651,
285,
3466,
287,
3027,
353,
13850,
29906,
29889,
29888,
3466,
29898,
1311,
29889,
10945,
29918,
2492,
29892,
29871,
29900,
8443,
13,
4706,
25342,
620,
1275,
525,
29891,
2396,
30004,
13,
9651,
285,
3466,
287,
3027,
353,
13850,
29906,
29889,
29888,
3466,
29898,
1311,
29889,
10945,
29918,
2492,
29892,
29871,
29896,
8443,
13,
4706,
25342,
620,
1275,
525,
3594,
2396,
30004,
13,
9651,
285,
3466,
287,
3027,
353,
13850,
29906,
29889,
29888,
3466,
29898,
1311,
29889,
10945,
29918,
2492,
29892,
448,
29896,
8443,
13,
30004,
13,
4706,
1583,
29889,
10945,
29918,
2492,
353,
285,
3466,
287,
3027,
30004,
13,
4706,
1583,
29889,
4990,
1177,
280,
5521,
26471,
13,
4706,
736,
285,
3466,
287,
3027,
30004,
13,
30004,
13,
1678,
822,
679,
19582,
29898,
1311,
1125,
30004,
13,
4706,
10696,
29892,
3431,
24104,
353,
660,
4290,
7647,
29889,
657,
11843,
29898,
1311,
29892,
376,
2577,
3765,
613,
376,
1917,
29901,
613,
29871,
29896,
29900,
29889,
29900,
29945,
29892,
448,
29941,
29953,
29900,
29892,
29871,
29941,
29953,
29900,
29892,
29871,
29896,
29900,
8443,
13,
4706,
565,
3431,
24104,
29901,
30004,
13,
9651,
1596,
29898,
2521,
8443,
13,
4706,
736,
10696,
30004,
13,
30004,
13,
1678,
822,
16734,
29918,
7692,
29898,
1311,
1125,
30004,
13,
4706,
10696,
353,
1583,
29889,
657,
19582,
26471,
13,
4706,
5731,
630,
353,
527,
13239,
29889,
23361,
29918,
9917,
29898,
1311,
29889,
10945,
29918,
2492,
29892,
10696,
8443,
13,
4706,
1583,
29889,
10945,
29918,
2492,
353,
5731,
630,
30004,
13,
4706,
1583,
29889,
4990,
1177,
280,
5521,
26471,
13,
30004,
13,
1678,
822,
18109,
16958,
29918,
7692,
29898,
1311,
1125,
30004,
13,
30004,
13,
4706,
263,
29896,
29892,
3431,
24104,
353,
660,
4290,
7647,
29889,
657,
11843,
29898,
1311,
29892,
376,
5893,
18109,
16958,
2731,
29876,
362,
613,
376,
29916,
995,
29871,
29896,
303,
1298,
29901,
613,
29871,
29900,
29889,
29900,
29892,
448,
1311,
29889,
10945,
29918,
2492,
29889,
12181,
29961,
29900,
1402,
1583,
29889,
10945,
29918,
2492,
29889,
12181,
29961,
29900,
1402,
29871,
29896,
8443,
13,
4706,
263,
29906,
29892,
3431,
24104,
353,
660,
4290,
7647,
29889,
657,
11843,
29898,
1311,
29892,
376,
5893,
18109,
16958,
2731,
29876,
362,
613,
376,
29891,
995,
29871,
29896,
303,
1298,
29901,
613,
29871,
29900,
29889,
29900,
29892,
448,
1311,
29889,
10945,
29918,
2492,
29889,
12181,
29961,
29896,
1402,
1583,
29889,
10945,
29918,
2492,
29889,
12181,
29961,
29896,
1402,
29871,
29896,
8443,
13,
4706,
289,
29896,
29892,
3431,
24104,
353,
660,
4290,
7647,
29889,
657,
11843,
29898,
1311,
29892,
376,
5893,
18109,
16958,
2731,
29876,
362,
613,
376,
29916,
995,
29871,
29906,
299,
1298,
29901,
613,
29871,
29900,
29889,
29900,
29892,
448,
1311,
29889,
10945,
29918,
2492,
29889,
12181,
29961,
29900,
1402,
1583,
29889,
10945,
29918,
2492,
29889,
12181,
29961,
29900,
1402,
29871,
29896,
8443,
13,
4706,
396,
29890,
29906,
29892,
3431,
24104,
353,
660,
4290,
7647,
29889,
657,
11843,
29898,
1311,
29892,
376,
5893,
18109,
16958,
2731,
29876,
362,
613,
376,
29891,
995,
29871,
29906,
299,
1298,
29901,
613,
29871,
29900,
29889,
29900,
29892,
448,
1311,
29889,
10945,
29918,
2492,
29889,
12181,
29961,
29896,
1402,
1583,
29889,
10945,
29918,
2492,
29889,
12181,
29961,
29896,
1402,
29871,
29896,
8443,
13,
4706,
274,
29896,
29892,
3431,
24104,
353,
660,
4290,
7647,
29889,
657,
11843,
29898,
1311,
29892,
376,
5893,
18109,
16958,
2731,
29876,
362,
613,
376,
29916,
995,
29871,
29941,
5499,
1298,
29901,
613,
29871,
29900,
29889,
29900,
29892,
448,
1311,
29889,
10945,
29918,
2492,
29889,
12181,
29961,
29900,
1402,
1583,
29889,
10945,
29918,
2492,
29889,
12181,
29961,
29900,
1402,
29871,
29896,
8443,
13,
4706,
396,
29883,
29906,
29892,
3431,
24104,
353,
660,
4290,
7647,
29889,
657,
11843,
29898,
1311,
29892,
376,
5893,
18109,
16958,
2731,
29876,
362,
613,
376,
29891,
995,
29871,
29941,
5499,
1298,
29901,
613,
29871,
29900,
29889,
29900,
29892,
448,
1311,
29889,
10945,
29918,
2492,
29889,
12181,
29961,
29896,
1402,
1583,
29889,
10945,
29918,
2492,
29889,
12181,
29961,
29896,
1402,
29871,
29896,
8443,
13,
4706,
1967,
353,
1583,
29889,
10945,
29918,
2492,
30004,
13,
4706,
4765,
29918,
16485,
353,
7442,
29889,
7411,
29941,
29906,
4197,
29961,
29900,
29892,
29871,
29900,
1402,
518,
3027,
29889,
12181,
29961,
29900,
29962,
448,
29871,
29896,
29892,
29871,
29900,
1402,
518,
29900,
29892,
1967,
29889,
12181,
29961,
29896,
29962,
448,
29871,
29896,
24960,
30004,
13,
4706,
29743,
29918,
16485,
353,
7442,
29889,
7411,
29941,
29906,
4197,
29961,
29874,
29896,
29892,
263,
29906,
1402,
518,
3027,
29889,
12181,
29961,
29900,
10062,
29890,
29896,
29892,
29871,
29900,
1402,
518,
29883,
29896,
29892,
1967,
29889,
12181,
29961,
29896,
5262,
2314,
30004,
13,
4706,
5345,
353,
13850,
29906,
29889,
657,
27867,
457,
13372,
29898,
4351,
29918,
16485,
29892,
29743,
29918,
16485,
8443,
13,
4706,
18109,
8734,
353,
13850,
29906,
29889,
4495,
29886,
27867,
457,
29898,
3027,
29892,
5345,
29892,
313,
3027,
29889,
12181,
29961,
29896,
1402,
1967,
29889,
12181,
29961,
29900,
12622,
30004,
13,
4706,
1583,
29889,
10945,
29918,
2492,
353,
18109,
8734,
30004,
13,
4706,
1583,
29889,
4990,
1177,
280,
5521,
26471,
13,
30004,
13,
1678,
822,
274,
1336,
29918,
7692,
29898,
1311,
1125,
30004,
13,
4706,
263,
29896,
29892,
3431,
24104,
353,
660,
4290,
7647,
29889,
657,
2928,
29898,
1311,
29892,
376,
5893,
274,
1336,
292,
3291,
613,
376,
3166,
1948,
1353,
29901,
613,
29871,
29900,
29892,
448,
1311,
29889,
10945,
29918,
2492,
29889,
12181,
29961,
29900,
1402,
1583,
29889,
10945,
29918,
2492,
29889,
12181,
29961,
29900,
1402,
29871,
29896,
8443,
13,
4706,
263,
29906,
29892,
3431,
24104,
353,
660,
4290,
7647,
29889,
657,
2928,
29898,
1311,
29892,
376,
5893,
274,
1336,
292,
3291,
613,
376,
517,
1948,
1353,
29901,
613,
29871,
29900,
29892,
448,
1311,
29889,
10945,
29918,
2492,
29889,
12181,
29961,
29896,
1402,
1583,
29889,
10945,
29918,
2492,
29889,
12181,
29961,
29896,
1402,
29871,
29896,
8443,
13,
4706,
289,
29896,
29892,
3431,
24104,
353,
660,
4290,
7647,
29889,
657,
2928,
29898,
1311,
29892,
376,
5893,
274,
1336,
292,
3291,
613,
376,
3166,
784,
1353,
29901,
613,
29871,
29900,
29892,
448,
1311,
29889,
10945,
29918,
2492,
29889,
12181,
29961,
29900,
1402,
1583,
29889,
10945,
29918,
2492,
29889,
12181,
29961,
29900,
1402,
29871,
29896,
8443,
13,
4706,
289,
29906,
29892,
3431,
24104,
353,
660,
4290,
7647,
29889,
657,
2928,
29898,
1311,
29892,
376,
5893,
274,
1336,
292,
3291,
613,
376,
517,
784,
1353,
29901,
613,
29871,
29900,
29892,
448,
1311,
29889,
10945,
29918,
2492,
29889,
12181,
29961,
29896,
1402,
1583,
29889,
10945,
29918,
2492,
29889,
12181,
29961,
29896,
1402,
29871,
29896,
8443,
13,
4706,
1583,
29889,
10945,
29918,
2492,
353,
1583,
29889,
10945,
29918,
2492,
29961,
29874,
29896,
29901,
29874,
29906,
29892,
289,
29896,
29901,
29890,
29906,
29962,
30004,
13,
4706,
1583,
29889,
4990,
1177,
280,
5521,
26471,
13,
4706,
13850,
29906,
29889,
326,
4294,
703,
29907,
307,
2986,
7084,
613,
1583,
29889,
10945,
29918,
2492,
8443,
13,
4706,
13850,
29906,
29889,
10685,
2558,
29898,
29900,
8443,
13,
30004,
13,
1678,
822,
21640,
29918,
7692,
29898,
1311,
1125,
30004,
13,
4706,
6287,
29990,
29892,
3431,
24104,
353,
660,
4290,
7647,
29889,
657,
2928,
29898,
1311,
29892,
376,
2577,
21640,
995,
613,
376,
11093,
7865,
29901,
613,
29871,
29896,
29892,
448,
1311,
29889,
10945,
29918,
2492,
29889,
12181,
29961,
29900,
1402,
1583,
29889,
10945,
29918,
2492,
29889,
12181,
29961,
29900,
1402,
29871,
29896,
8443,
13,
4706,
6287,
29979,
29892,
3431,
24104,
353,
660,
4290,
7647,
29889,
657,
2928,
29898,
1311,
29892,
376,
2577,
21640,
995,
613,
376,
29888,
29891,
7865,
29901,
613,
29871,
29896,
29892,
448,
1311,
29889,
10945,
29918,
2492,
29889,
12181,
29961,
29896,
1402,
1583,
29889,
10945,
29918,
2492,
29889,
12181,
29961,
29896,
1402,
29871,
29896,
8443,
13,
4706,
10153,
353,
1583,
29889,
10945,
29918,
2492,
30004,
13,
4706,
396,
4367,
24551,
278,
1967,
304,
29871,
29900,
29889,
29953,
3064,
278,
2441,
30004,
13,
4706,
6287,
29881,
29918,
2492,
353,
13850,
29906,
29889,
21476,
29898,
2492,
29892,
6213,
29892,
285,
29916,
29922,
7052,
29990,
29892,
285,
29891,
29922,
7052,
29979,
29892,
29694,
29922,
11023,
29906,
29889,
23845,
29918,
18521,
1718,
8443,
13,
4706,
1583,
29889,
10945,
29918,
2492,
353,
6287,
29881,
29918,
2492,
30004,
13,
4706,
1583,
29889,
4990,
1177,
280,
5521,
26471,
13,
4706,
13850,
29906,
29889,
326,
4294,
703,
4421,
7943,
7084,
613,
1583,
29889,
10945,
29918,
2492,
8443,
13,
4706,
13850,
29906,
29889,
10685,
2558,
29898,
29900,
8443,
13,
30004,
13,
30004,
13,
1678,
822,
670,
371,
339,
29918,
7692,
29898,
1311,
1125,
30004,
13,
4706,
1592,
353,
13850,
29906,
29889,
11745,
675,
29950,
391,
29898,
1311,
29889,
10945,
29918,
2492,
8443,
13,
4706,
1583,
29889,
10945,
29918,
2492,
353,
1592,
30004,
13,
4706,
1583,
29889,
4990,
1177,
280,
5521,
26471,
13,
30004,
13,
30004,
13,
30004,
13,
1678,
822,
1301,
29918,
7692,
29898,
1311,
1125,
30004,
13,
4706,
396,
14491,
3171,
322,
2920,
310,
278,
1967,
30004,
13,
4706,
16749,
29918,
2492,
353,
1583,
29889,
10945,
29918,
2492,
30004,
13,
4706,
3171,
29892,
2920,
353,
16749,
29918,
2492,
29889,
12181,
7503,
29906,
29962,
30004,
13,
30004,
13,
4706,
1301,
29990,
29892,
3431,
24104,
353,
660,
4290,
7647,
29889,
657,
2928,
29898,
1311,
29892,
376,
2577,
13962,
995,
613,
376,
29916,
7865,
29901,
613,
29871,
29896,
29892,
448,
1311,
29889,
10945,
29918,
2492,
29889,
12181,
29961,
29900,
1402,
1311,
29889,
10945,
29918,
2492,
29889,
12181,
29961,
29900,
1402,
29871,
29896,
8443,
13,
4706,
1301,
29979,
29892,
3431,
24104,
353,
660,
4290,
7647,
29889,
657,
2928,
29898,
1311,
29892,
376,
2577,
13962,
995,
613,
376,
29891,
7865,
29901,
613,
29871,
29896,
29892,
448,
1311,
29889,
10945,
29918,
2492,
29889,
12181,
29961,
29896,
1402,
1311,
29889,
10945,
29918,
2492,
29889,
12181,
29961,
29896,
1402,
29871,
29896,
8443,
13,
30004,
13,
30004,
13,
4706,
323,
353,
7442,
29889,
7411,
29941,
29906,
4197,
29961,
29896,
29892,
29871,
29900,
29892,
1301,
29990,
1402,
518,
29900,
29892,
29871,
29896,
29892,
1301,
29979,
24960,
30004,
13,
30004,
13,
4706,
396,
1334,
671,
1370,
29886,
27867,
457,
304,
4327,
30004,
13,
4706,
396,
278,
1967,
773,
278,
4636,
29892,
323,
30004,
13,
4706,
1301,
29918,
2492,
353,
13850,
29906,
29889,
4495,
29886,
27867,
457,
29898,
21012,
29918,
2492,
29892,
323,
29892,
313,
2103,
29892,
3171,
876,
30004,
13,
4706,
1583,
29889,
10945,
29918,
2492,
353,
1301,
29918,
2492,
30004,
13,
4706,
1583,
29889,
4990,
1177,
280,
5521,
26471,
13,
30004,
13,
1678,
822,
1999,
355,
29918,
7692,
29898,
1311,
1125,
30004,
13,
30004,
13,
30004,
13,
4706,
7329,
29896,
29892,
3431,
24104,
353,
660,
4290,
7647,
29889,
657,
11843,
29898,
1311,
29892,
376,
29896,
303,
1967,
7329,
29901,
613,
29871,
29900,
29889,
29945,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29889,
29896,
8443,
13,
4706,
7329,
29906,
29892,
3431,
24104,
353,
660,
4290,
7647,
29889,
657,
11843,
29898,
1311,
29892,
376,
29906,
299,
1967,
7329,
29901,
613,
29871,
29900,
29889,
29945,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29889,
29896,
8443,
13,
30004,
13,
4706,
285,
3466,
287,
3027,
353,
13850,
29906,
29889,
29888,
3466,
29898,
1311,
29889,
10945,
29918,
2492,
29892,
29871,
29900,
8443,
13,
4706,
29743,
353,
13850,
29906,
29889,
1202,
22676,
287,
29898,
29888,
3466,
287,
3027,
29892,
7329,
29896,
29892,
1583,
29889,
10945,
29918,
2492,
29892,
7329,
29906,
29892,
29871,
29900,
8443,
13,
4706,
1583,
29889,
10945,
29918,
2492,
353,
29743,
30004,
13,
4706,
1583,
29889,
4990,
1177,
280,
5521,
26471,
13,
30004,
13,
1678,
396,
396,
2401,
368,
1480,
13852,
1158,
30004,
13,
1678,
822,
1480,
29918,
7692,
29898,
1311,
1125,
30004,
13,
4706,
274,
353,
29871,
29906,
29945,
29945,
847,
7442,
29889,
1188,
29898,
29896,
718,
7442,
29889,
3317,
29898,
1311,
29889,
10945,
29918,
2492,
876,
30004,
13,
4706,
1480,
29918,
3027,
353,
274,
334,
313,
9302,
29889,
1188,
29898,
1311,
29889,
10945,
29918,
2492,
718,
29871,
29896,
876,
30004,
13,
4706,
1480,
29918,
3027,
353,
7442,
29889,
2378,
29898,
1188,
29918,
3027,
29892,
26688,
29922,
9302,
29889,
13470,
29947,
8443,
13,
4706,
1583,
29889,
10945,
29918,
2492,
353,
1480,
29918,
3027,
30004,
13,
4706,
1583,
29889,
4990,
1177,
280,
5521,
26471,
13,
30004,
13,
1678,
396,
396,
330,
2735,
26385,
30004,
13,
30004,
13,
1678,
822,
330,
4850,
562,
272,
276,
428,
29898,
1311,
1125,
30004,
13,
4706,
396,
2401,
368,
330,
2735,
26385,
22993,
13,
4706,
330,
2735,
29892,
3431,
24104,
353,
660,
4290,
7647,
29889,
657,
11843,
29898,
1311,
29892,
376,
5893,
330,
2735,
995,
9162,
376,
4283,
29966,
29900,
353,
6501,
261,
1919,
330,
2735,
29958,
29900,
353,
301,
14643,
9162,
29871,
29900,
29889,
29945,
29892,
29871,
29900,
29892,
29871,
29946,
29892,
29871,
29941,
8443,
13,
30004,
13,
4706,
330,
2735,
29918,
15728,
287,
353,
7442,
29889,
2378,
29898,
29906,
29945,
29945,
334,
313,
1311,
29889,
10945,
29918,
2492,
847,
29871,
29906,
29945,
29945,
29897,
3579,
330,
2735,
29892,
26688,
2433,
13470,
29947,
1495,
30004,
13,
4706,
1583,
29889,
10945,
29918,
2492,
353,
330,
2735,
29918,
15728,
287,
30004,
13,
4706,
1583,
29889,
4990,
1177,
280,
5521,
26471,
13,
30004,
13,
1678,
822,
16897,
29918,
7692,
29898,
1311,
1125,
30004,
13,
30004,
13,
4706,
266,
3781,
1767,
29892,
3431,
24104,
353,
660,
4290,
7647,
29889,
657,
11843,
29898,
1311,
29892,
376,
386,
12268,
292,
9162,
376,
5893,
278,
16897,
995,
29901,
613,
29896,
29892,
29871,
29900,
29892,
29871,
29906,
29945,
29945,
29892,
29871,
29896,
8443,
13,
4706,
3240,
29892,
266,
3781,
29896,
353,
13850,
29906,
29889,
386,
12268,
29898,
1311,
29889,
10945,
29918,
2492,
29892,
266,
3781,
1767,
29892,
29871,
29906,
29945,
29945,
29892,
13850,
29906,
29889,
4690,
1525,
7068,
29918,
29933,
1177,
19926,
8443,
13,
4706,
1583,
29889,
10945,
29918,
2492,
353,
266,
3781,
29896,
30004,
13,
4706,
1583,
29889,
4990,
1177,
280,
5521,
26471,
13,
30004,
13,
30004,
13,
4706,
396,
18345,
3233,
269,
506,
292,
30004,
13,
30004,
13,
1678,
822,
269,
506,
292,
29918,
7692,
29898,
1311,
1125,
30004,
13,
4706,
396,
10987,
2920,
322,
3171,
310,
1967,
30004,
13,
4706,
1948,
29892,
1897,
353,
1583,
29889,
10945,
29918,
2492,
29889,
12181,
30004,
13,
4706,
396,
6204,
385,
24786,
1409,
304,
3787,
278,
269,
506,
287,
1967,
30004,
13,
4706,
10153,
29896,
353,
7442,
29889,
3298,
359,
3552,
798,
29892,
1897,
511,
26688,
2433,
13470,
29947,
1495,
30004,
13,
4706,
396,
12048,
1598,
278,
1375,
322,
4236,
3464,
30004,
13,
4706,
1375,
29918,
3881,
29892,
3431,
24104,
353,
660,
4290,
7647,
29889,
657,
2928,
29898,
1311,
29892,
376,
29879,
506,
292,
848,
613,
376,
1195,
3464,
613,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29906,
29945,
29945,
29892,
29871,
29896,
8443,
13,
4706,
4236,
29918,
3881,
29892,
3431,
24104,
353,
660,
4290,
7647,
29889,
657,
2928,
29898,
1311,
29892,
376,
29879,
506,
292,
848,
613,
376,
3317,
3464,
613,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29906,
29945,
29945,
29892,
29871,
29896,
8443,
13,
30004,
13,
4706,
396,
21493,
975,
278,
1881,
1967,
322,
565,
15526,
995,
12185,
297,
7429,
3464,
731,
372,
304,
29871,
29906,
29945,
29945,
6467,
731,
372,
304,
29871,
29900,
22993,
13,
4706,
363,
474,
297,
3464,
29898,
798,
1125,
30004,
13,
9651,
363,
432,
297,
3464,
29898,
4914,
1125,
30004,
13,
18884,
565,
1583,
29889,
10945,
29918,
2492,
29961,
29875,
29892,
432,
29962,
1405,
4236,
29918,
3881,
29901,
30004,
13,
462,
1678,
10153,
29896,
29961,
29875,
29892,
432,
29962,
353,
29871,
29906,
29945,
29945,
30004,
13,
18884,
25342,
1583,
29889,
10945,
29918,
2492,
29961,
29875,
29892,
432,
29962,
529,
1375,
29918,
3881,
29901,
30004,
13,
462,
1678,
10153,
29896,
29961,
29875,
29892,
432,
29962,
353,
29871,
29900,
30004,
13,
30004,
13,
4706,
396,
17440,
278,
1967,
30004,
13,
4706,
1583,
29889,
10945,
29918,
2492,
353,
10153,
29896,
30004,
13,
4706,
1583,
29889,
4990,
1177,
280,
5521,
26471,
13,
30004,
13,
29937,
445,
740,
4893,
278,
1404,
7348,
322,
2367,
1075,
278,
4175,
540,
29905,
11360,
10753,
30004,
13,
30004,
13,
1678,
822,
1560,
29877,
6046,
29918,
7692,
29898,
1311,
1125,
30004,
13,
4706,
4452,
353,
4852,
29954,
17019,
613,
376,
29909,
369,
6751,
613,
376,
6034,
1070,
3284,
2272,
2572,
23670,
3284,
535,
29872,
3284,
2168,
713,
1159,
30004,
13,
4706,
2944,
29892,
3431,
24104,
353,
660,
4290,
7647,
29889,
657,
2001,
29898,
1311,
29892,
376,
21803,
1158,
613,
376,
4572,
29901,
613,
4452,
29892,
29871,
29900,
29892,
7700,
8443,
13,
4706,
565,
3431,
24104,
322,
2944,
29901,
30004,
13,
9651,
1596,
29898,
667,
8443,
13,
4706,
565,
2944,
1275,
525,
29954,
17019,
2396,
30004,
13,
9651,
1596,
29898,
667,
8443,
13,
4706,
565,
2944,
1275,
525,
29954,
17019,
2396,
30004,
13,
9651,
1583,
29889,
10945,
29918,
2492,
353,
13850,
29906,
29889,
29954,
17019,
10358,
332,
29898,
1311,
29889,
10945,
29918,
2492,
29892,
313,
29945,
29892,
29871,
29945,
511,
29871,
29900,
8443,
13,
9651,
1583,
29889,
4990,
1177,
280,
5521,
26471,
13,
4706,
25342,
2944,
1275,
376,
29909,
369,
6751,
1115,
30004,
13,
9651,
1583,
29889,
10945,
29918,
2492,
353,
13850,
29906,
29889,
2204,
332,
29898,
1311,
29889,
10945,
29918,
2492,
29892,
313,
29945,
29892,
29871,
29945,
876,
30004,
13,
9651,
1583,
29889,
4990,
1177,
280,
5521,
26471,
13,
4706,
25342,
2944,
1275,
376,
6034,
1070,
1115,
30004,
13,
9651,
19308,
29968,
17196,
353,
7442,
29889,
2378,
4197,
29961,
29900,
29892,
29871,
29896,
29892,
29871,
29896,
29892,
29871,
29896,
29892,
29871,
29900,
1402,
518,
29896,
29892,
29871,
29896,
29892,
29871,
29896,
29892,
29871,
29896,
29892,
29871,
29896,
1402,
518,
29896,
29892,
29871,
29896,
29892,
29871,
29896,
29892,
29871,
29896,
29892,
29871,
29896,
1402,
518,
29896,
29892,
29871,
29896,
29892,
29871,
29896,
29892,
29871,
29896,
29892,
29871,
29896,
1402,
518,
29900,
29892,
29871,
29896,
29892,
29871,
29896,
29892,
29871,
29896,
29892,
29871,
29900,
20526,
9302,
29889,
7411,
29941,
29906,
29897,
847,
29871,
29906,
29896,
30004,
13,
9651,
29743,
353,
13850,
29906,
29889,
4572,
29906,
29928,
29898,
1311,
29889,
10945,
29918,
2492,
29892,
448,
29896,
29892,
19308,
29968,
17196,
8443,
13,
9651,
1583,
29889,
10945,
29918,
2492,
353,
29743,
30004,
13,
9651,
1583,
29889,
4990,
1177,
280,
5521,
26471,
13,
4706,
25342,
2944,
1275,
376,
2272,
2572,
23670,
1115,
30004,
13,
9651,
11451,
17460,
353,
7442,
29889,
2378,
4197,
29961,
29896,
29892,
29871,
29906,
29892,
29871,
29941,
29892,
29871,
29906,
29892,
29871,
29896,
1402,
518,
29906,
29892,
29871,
29946,
29892,
29871,
29953,
29892,
29871,
29946,
29892,
29871,
29906,
1402,
518,
29941,
29892,
29871,
29953,
29892,
29871,
29929,
29892,
29871,
29953,
29892,
29871,
29941,
1402,
518,
29906,
29892,
29871,
29946,
29892,
29871,
29953,
29892,
29871,
29946,
29892,
29871,
29906,
1402,
518,
29896,
29892,
29871,
29906,
29892,
29871,
29941,
29892,
29871,
29906,
29892,
29871,
29896,
20526,
9302,
29889,
7411,
29941,
29906,
29897,
847,
29871,
29947,
29896,
30004,
13,
9651,
29743,
353,
13850,
29906,
29889,
4572,
29906,
29928,
29898,
1311,
29889,
10945,
29918,
2492,
29892,
448,
29896,
29892,
11451,
17460,
8443,
13,
9651,
1583,
29889,
10945,
29918,
2492,
353,
29743,
30004,
13,
9651,
1583,
29889,
4990,
1177,
280,
5521,
26471,
13,
4706,
25342,
2944,
1275,
376,
535,
29872,
1115,
30004,
13,
9651,
27843,
29968,
5851,
353,
7442,
29889,
2378,
4197,
29961,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
1402,
518,
29900,
29892,
29871,
29906,
29892,
29871,
29906,
29892,
29871,
29906,
29892,
29871,
29900,
1402,
518,
29896,
29892,
29871,
29906,
29892,
29871,
29945,
29892,
29871,
29906,
29892,
29871,
29896,
1402,
518,
29900,
29892,
29871,
29906,
29892,
29871,
29906,
29892,
29871,
29906,
29892,
29871,
29900,
1402,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
20526,
9302,
29889,
7411,
29941,
29906,
29897,
847,
29871,
29906,
29945,
30004,
13,
9651,
29743,
353,
13850,
29906,
29889,
4572,
29906,
29928,
29898,
1311,
29889,
10945,
29918,
2492,
29892,
448,
29896,
29892,
27843,
29968,
5851,
8443,
13,
9651,
1583,
29889,
10945,
29918,
2492,
353,
29743,
30004,
13,
9651,
1583,
29889,
4990,
1177,
280,
5521,
26471,
13,
4706,
25342,
2944,
1275,
376,
2168,
713,
1115,
30004,
13,
9651,
19194,
353,
13850,
29906,
29889,
2168,
713,
10358,
332,
29898,
1311,
29889,
10945,
29918,
2492,
29892,
29871,
29945,
8443,
13,
9651,
1583,
29889,
10945,
29918,
2492,
353,
19194,
30004,
13,
9651,
1583,
29889,
4990,
1177,
280,
5521,
26471,
13,
30004,
13,
1678,
822,
15301,
29918,
7692,
29898,
1311,
1125,
30004,
13,
4706,
4452,
353,
4852,
6984,
433,
28445,
613,
376,
578,
6596,
29916,
613,
376,
15975,
873,
613,
8443,
13,
4706,
2944,
29892,
3431,
24104,
353,
660,
4290,
7647,
29889,
657,
2001,
29898,
1311,
29892,
376,
21803,
1158,
613,
376,
4572,
29901,
613,
4452,
29892,
29871,
29900,
29892,
7700,
8443,
13,
4706,
565,
2944,
1275,
376,
15975,
873,
1115,
30004,
13,
9651,
22810,
873,
353,
13850,
29906,
29889,
29903,
711,
295,
29898,
1311,
29889,
10945,
29918,
2492,
29892,
13850,
29906,
29889,
15633,
29918,
29953,
29946,
29943,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
413,
2311,
29922,
29945,
8443,
13,
9651,
1583,
29889,
10945,
29918,
2492,
353,
22810,
873,
30004,
13,
4706,
25342,
2944,
1275,
376,
578,
6596,
29916,
1115,
30004,
13,
9651,
577,
6596,
29916,
353,
13850,
29906,
29889,
29903,
711,
295,
29898,
1311,
29889,
10945,
29918,
2492,
29892,
13850,
29906,
29889,
15633,
29918,
29953,
29946,
29943,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
413,
2311,
29922,
29945,
8443,
13,
9651,
1583,
29889,
10945,
29918,
2492,
353,
577,
6596,
29916,
30004,
13,
4706,
25342,
2944,
1275,
376,
6984,
433,
28445,
1115,
30004,
13,
9651,
425,
13974,
28445,
353,
13850,
29906,
29889,
29931,
481,
433,
28445,
29898,
1311,
29889,
10945,
29918,
2492,
29892,
13850,
29906,
29889,
15633,
29918,
29953,
29946,
29943,
8443,
13,
9651,
1583,
29889,
10945,
29918,
2492,
353,
425,
13974,
28445,
30004,
13,
4706,
1583,
29889,
4990,
1177,
280,
5521,
26471,
13,
30004,
13,
1678,
822,
7636,
29918,
7692,
29898,
1311,
1125,
30004,
13,
4706,
396,
15154,
11462,
491,
1999,
1038,
292,
411,
263,
22477,
4175,
30004,
13,
4706,
1999,
332,
353,
13850,
29906,
29889,
29954,
17019,
10358,
332,
29898,
1311,
29889,
10945,
29918,
2492,
29892,
313,
29945,
29892,
29871,
29945,
511,
29871,
29900,
8443,
13,
4706,
396,
2401,
368,
20298,
1265,
740,
30004,
13,
4706,
425,
13974,
28445,
353,
13850,
29906,
29889,
29931,
481,
433,
28445,
29898,
2204,
332,
29892,
13850,
29906,
29889,
15633,
29918,
29953,
29946,
29943,
8443,
13,
4706,
396,
17415,
1250,
304,
13122,
29947,
30004,
13,
4706,
6425,
29918,
22992,
353,
13850,
29906,
29889,
13441,
17185,
4920,
29879,
29898,
6984,
433,
28445,
8443,
13,
4706,
1583,
29889,
10945,
29918,
2492,
353,
6425,
29918,
22992,
30004,
13,
4706,
1583,
29889,
4990,
1177,
280,
5521,
26471,
13,
30004,
13,
29937,
445,
740,
14677,
278,
848,
310,
738,
1881,
1967,
297,
2991,
30004,
13,
30004,
13,
1678,
822,
1967,
29918,
1272,
29898,
1311,
1125,
30004,
13,
4706,
1596,
29898,
1853,
29898,
1311,
29889,
10945,
29918,
2492,
876,
30004,
13,
4706,
1596,
877,
28212,
8267,
29901,
25710,
29871,
396,
390,
1242,
29892,
28730,
29892,
18196,
30004,
13,
4706,
1596,
29898,
1311,
29889,
10945,
29918,
2492,
29889,
12181,
8443,
13,
4706,
10153,
12181,
353,
1583,
29889,
10945,
29918,
2492,
29889,
12181,
30004,
13,
4706,
4206,
353,
10153,
12181,
29961,
29900,
29962,
30004,
13,
4706,
28730,
353,
10153,
12181,
29961,
29896,
29962,
30004,
13,
4706,
1596,
29898,
5727,
8443,
13,
4706,
1596,
29898,
22724,
8443,
13,
4706,
1596,
877,
29954,
764,
8267,
29901,
1495,
30004,
13,
4706,
1596,
29898,
1311,
29889,
10945,
29918,
2492,
29889,
12181,
8443,
13,
4706,
1596,
877,
2492,
29889,
29881,
1853,
29901,
525,
8443,
13,
4706,
1596,
29898,
1311,
29889,
10945,
29918,
2492,
29889,
29881,
1853,
8443,
13,
4706,
1596,
877,
2492,
29889,
2311,
29901,
525,
8443,
13,
4706,
1596,
29898,
1311,
29889,
10945,
29918,
2492,
29889,
29881,
1853,
8443,
13,
30004,
13,
29937,
445,
740,
338,
363,
16384,
278,
1967,
297,
278,
22767,
310,
278,
1824,
451,
297,
263,
527,
4294,
716,
22767,
30004,
13,
30004,
13,
30004,
13,
1678,
822,
2479,
1177,
280,
5521,
29898,
1311,
1125,
30004,
13,
4706,
10422,
353,
525,
17314,
2940,
29889,
6173,
29915,
30004,
13,
4706,
13850,
29906,
29889,
326,
3539,
29898,
9507,
29892,
1583,
29889,
10945,
29918,
2492,
8443,
13,
4706,
1583,
29889,
3027,
29918,
449,
29889,
842,
29925,
861,
1958,
29898,
17303,
28707,
29889,
29984,
29925,
861,
1958,
703,
17314,
2940,
29889,
6173,
5783,
30004,
13,
4706,
1583,
29889,
3027,
29918,
449,
29889,
842,
4421,
7943,
21002,
29898,
5574,
8443,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
30004,
13,
1678,
1053,
10876,
30004,
13,
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,
2
] |
src/setup.py | mjj4791/CCLLexer | 0 | 155425 | from setuptools import setup, find_packages
setup (
name='ccllexer',
packages=find_packages(),
entry_points =
"""
[pygments.lexers]
ccllexer = ccllexer.lexer:CCLLexer
""",
) | [
1,
515,
731,
21245,
8789,
1053,
6230,
29892,
1284,
29918,
8318,
13,
13,
14669,
313,
13,
29871,
1024,
2433,
617,
29880,
2506,
261,
742,
13,
29871,
9741,
29922,
2886,
29918,
8318,
3285,
13,
29871,
6251,
29918,
9748,
353,
13,
29871,
9995,
13,
29871,
518,
2272,
29887,
1860,
29889,
2506,
414,
29962,
13,
29871,
274,
695,
2506,
261,
353,
274,
695,
2506,
261,
29889,
2506,
261,
29901,
4174,
2208,
735,
261,
13,
29871,
5124,
613,
13,
29897,
2
] |
scale/storage/serializers.py | stevevarner/scale | 0 | 57585 | """Defines the serializers for Scale files and workspaces"""
from __future__ import unicode_literals
import rest_framework.serializers as serializers
from rest_framework.fields import CharField
from util.rest import ModelIdSerializer
class DataTypeField(CharField):
"""Field for displaying the list of data type tags for a Scale file"""
type_name = 'DataTypeField'
type_label = 'datatype'
def to_representation(self, value):
"""Converts the model field to a list of data type tags
:param value: the comma-separated data types for the Scale file
:type value: str
:rtype: list of str
:returns: the list of data type tags
"""
tags = []
if value:
for tag in value.split(','):
tags.append(tag)
return tags
class WktField(CharField):
"""Field for displaying geometry objects as Well Known Text"""
type_name = 'WktField'
type_label = 'wtk'
def to_representation(self, value):
"""Converts the model field to WKT
:param value: the associated geometry info
:type value: GEOSGeometry
:rtype: string
:returns: the WKT representation
"""
if value:
return value.wkt
class GeoJsonField(CharField):
"""Field for displaying geometry objects as Well Known Text"""
type_name = 'GeoJsonField'
type_label = 'geojson'
def to_representation(self, value):
"""Converts the model field to GeoJson
:param value: the associated geometry info
:type value: GEOSGeometry
:rtype: string
:returns: the GeoJson representation
"""
if value:
return value.geojson
class WorkspaceBaseSerializer(ModelIdSerializer):
"""Converts workspace model fields to REST output"""
name = serializers.CharField()
class WorkspaceSerializer(WorkspaceBaseSerializer):
"""Converts workspace model fields to REST output"""
title = serializers.CharField()
description = serializers.CharField()
base_url = serializers.URLField()
is_active = serializers.BooleanField()
used_size = serializers.IntegerField() # TODO: BigIntegerField?
total_size = serializers.IntegerField() # TODO: BigIntegerField?
created = serializers.DateTimeField()
archived = serializers.DateTimeField()
last_modified = serializers.DateTimeField()
class WorkspaceDetailsSerializer(WorkspaceSerializer):
"""Converts workspace model fields to REST output"""
json_config = serializers.JSONField(default=dict)
class ScaleFileBaseSerializerV5(ModelIdSerializer):
"""Converts Scale file model fields to REST output"""
workspace = WorkspaceBaseSerializer()
file_name = serializers.CharField()
media_type = serializers.CharField()
file_type = serializers.CharField()
file_size = serializers.IntegerField() # TODO: BigIntegerField?
data_type = DataTypeField()
is_deleted = serializers.BooleanField()
uuid = serializers.CharField()
url = serializers.URLField()
created = serializers.DateTimeField()
deleted = serializers.DateTimeField()
data_started = serializers.DateTimeField()
data_ended = serializers.DateTimeField()
source_started = serializers.DateTimeField()
source_ended = serializers.DateTimeField()
last_modified = serializers.DateTimeField()
class ScaleFileBaseSerializerV6(ModelIdSerializer):
"""Converts Scale file model fields to REST output"""
file_name = serializers.CharField()
class ScaleFileSerializerV5(ScaleFileBaseSerializerV5):
"""Converts Scale file model fields to REST output"""
file_path = serializers.CharField()
# TODO: update to use GeoJson instead of WKT
geometry = WktField()
center_point = WktField()
meta_data = serializers.JSONField(default=dict)
countries = serializers.StringRelatedField(many=True, read_only=True)
class ScaleFileSerializerV6(ScaleFileBaseSerializerV6):
"""Converts Scale file model fields to REST output"""
from batch.serializers import BatchBaseSerializerV6
from job.serializers import JobTypeBaseSerializerV6
from recipe.serializers import RecipeTypeBaseSerializerV6
workspace = WorkspaceBaseSerializer()
media_type = serializers.CharField()
file_type = serializers.CharField()
file_size = serializers.IntegerField() # TODO: BigIntegerField?
file_path = serializers.CharField()
is_deleted = serializers.BooleanField()
url = serializers.URLField()
created = serializers.DateTimeField()
deleted = serializers.DateTimeField()
data_started = serializers.DateTimeField()
data_ended = serializers.DateTimeField()
source_started = serializers.DateTimeField()
source_ended = serializers.DateTimeField()
last_modified = serializers.DateTimeField()
# TODO: update to use GeoJson instead of WKT
geometry = WktField()
center_point = WktField()
countries = serializers.StringRelatedField(many=True, read_only=True)
job_type = JobTypeBaseSerializerV6()
job = ModelIdSerializer()
job_exe = ModelIdSerializer()
job_output = serializers.CharField()
recipe_type = RecipeTypeBaseSerializerV6()
recipe = ModelIdSerializer()
recipe_node = serializers.CharField()
batch = BatchBaseSerializerV6()
is_superseded = serializers.BooleanField()
superseded = serializers.DateTimeField()
class ScaleFileDetailsSerializerV6(ScaleFileSerializerV6):
"""Converts file model fields to REST output"""
meta_data = serializers.JSONField(default=dict)
| [
1,
9995,
3206,
1475,
278,
7797,
19427,
363,
2522,
744,
2066,
322,
664,
22854,
15945,
29908,
13,
3166,
4770,
29888,
9130,
1649,
1053,
29104,
29918,
20889,
1338,
13,
13,
5215,
1791,
29918,
4468,
29889,
15550,
19427,
408,
7797,
19427,
13,
3166,
1791,
29918,
4468,
29889,
9621,
1053,
2896,
3073,
13,
13,
3166,
3667,
29889,
5060,
1053,
8125,
1204,
17679,
13,
13,
1990,
3630,
1542,
3073,
29898,
27890,
1125,
13,
1678,
9995,
3073,
363,
16384,
278,
1051,
310,
848,
1134,
8282,
363,
263,
2522,
744,
934,
15945,
29908,
13,
13,
1678,
1134,
29918,
978,
353,
525,
1469,
1542,
3073,
29915,
13,
1678,
1134,
29918,
1643,
353,
525,
4130,
23179,
29915,
13,
13,
1678,
822,
304,
29918,
276,
26081,
29898,
1311,
29892,
995,
1125,
13,
4706,
9995,
1168,
369,
1372,
278,
1904,
1746,
304,
263,
1051,
310,
848,
1134,
8282,
13,
13,
4706,
584,
3207,
995,
29901,
278,
16694,
29899,
25048,
630,
848,
4072,
363,
278,
2522,
744,
934,
13,
4706,
584,
1853,
995,
29901,
851,
13,
4706,
584,
29878,
1853,
29901,
1051,
310,
851,
13,
4706,
584,
18280,
29901,
278,
1051,
310,
848,
1134,
8282,
13,
4706,
9995,
13,
13,
4706,
8282,
353,
5159,
13,
4706,
565,
995,
29901,
13,
9651,
363,
4055,
297,
995,
29889,
5451,
29898,
3788,
1125,
13,
18884,
8282,
29889,
4397,
29898,
4039,
29897,
13,
4706,
736,
8282,
13,
13,
13,
1990,
399,
1193,
3073,
29898,
27890,
1125,
13,
1678,
9995,
3073,
363,
16384,
16303,
3618,
408,
5674,
8360,
776,
3992,
15945,
29908,
13,
13,
1678,
1134,
29918,
978,
353,
525,
29956,
1193,
3073,
29915,
13,
1678,
1134,
29918,
1643,
353,
525,
29893,
11178,
29915,
13,
13,
1678,
822,
304,
29918,
276,
26081,
29898,
1311,
29892,
995,
1125,
13,
4706,
9995,
1168,
369,
1372,
278,
1904,
1746,
304,
399,
29968,
29911,
13,
13,
4706,
584,
3207,
995,
29901,
278,
6942,
16303,
5235,
13,
4706,
584,
1853,
995,
29901,
402,
29923,
3267,
7999,
7843,
13,
4706,
584,
29878,
1853,
29901,
1347,
13,
4706,
584,
18280,
29901,
278,
399,
29968,
29911,
8954,
13,
4706,
9995,
13,
4706,
565,
995,
29901,
13,
9651,
736,
995,
29889,
29893,
1193,
13,
13,
13,
1990,
1879,
29877,
8148,
3073,
29898,
27890,
1125,
13,
1678,
9995,
3073,
363,
16384,
16303,
3618,
408,
5674,
8360,
776,
3992,
15945,
29908,
13,
13,
1678,
1134,
29918,
978,
353,
525,
7999,
29877,
8148,
3073,
29915,
13,
1678,
1134,
29918,
1643,
353,
525,
24756,
3126,
29915,
13,
13,
1678,
822,
304,
29918,
276,
26081,
29898,
1311,
29892,
995,
1125,
13,
4706,
9995,
1168,
369,
1372,
278,
1904,
1746,
304,
1879,
29877,
8148,
13,
13,
4706,
584,
3207,
995,
29901,
278,
6942,
16303,
5235,
13,
4706,
584,
1853,
995,
29901,
402,
29923,
3267,
7999,
7843,
13,
4706,
584,
29878,
1853,
29901,
1347,
13,
4706,
584,
18280,
29901,
278,
1879,
29877,
8148,
8954,
13,
4706,
9995,
13,
4706,
565,
995,
29901,
13,
9651,
736,
995,
29889,
24756,
3126,
13,
13,
13,
1990,
5244,
3493,
5160,
17679,
29898,
3195,
1204,
17679,
1125,
13,
1678,
9995,
1168,
369,
1372,
664,
3493,
1904,
4235,
304,
16759,
1962,
15945,
29908,
13,
1678,
1024,
353,
7797,
19427,
29889,
27890,
580,
13,
13,
13,
1990,
5244,
3493,
17679,
29898,
5531,
3493,
5160,
17679,
1125,
13,
1678,
9995,
1168,
369,
1372,
664,
3493,
1904,
4235,
304,
16759,
1962,
15945,
29908,
13,
1678,
3611,
353,
7797,
19427,
29889,
27890,
580,
13,
1678,
6139,
353,
7797,
19427,
29889,
27890,
580,
13,
1678,
2967,
29918,
2271,
353,
7797,
19427,
29889,
4219,
3073,
580,
13,
1678,
338,
29918,
4925,
353,
7797,
19427,
29889,
18146,
3073,
580,
13,
13,
1678,
1304,
29918,
2311,
353,
7797,
19427,
29889,
7798,
3073,
580,
29871,
396,
14402,
29901,
7997,
7798,
3073,
29973,
13,
1678,
3001,
29918,
2311,
353,
7797,
19427,
29889,
7798,
3073,
580,
29871,
396,
14402,
29901,
7997,
7798,
3073,
29973,
13,
13,
1678,
2825,
353,
7797,
19427,
29889,
11384,
3073,
580,
13,
1678,
3190,
2347,
353,
7797,
19427,
29889,
11384,
3073,
580,
13,
1678,
1833,
29918,
1545,
2164,
353,
7797,
19427,
29889,
11384,
3073,
580,
13,
13,
13,
1990,
5244,
3493,
10602,
17679,
29898,
5531,
3493,
17679,
1125,
13,
1678,
9995,
1168,
369,
1372,
664,
3493,
1904,
4235,
304,
16759,
1962,
15945,
29908,
13,
1678,
4390,
29918,
2917,
353,
7797,
19427,
29889,
7249,
3073,
29898,
4381,
29922,
8977,
29897,
13,
13,
13,
1990,
2522,
744,
2283,
5160,
17679,
29963,
29945,
29898,
3195,
1204,
17679,
1125,
13,
1678,
9995,
1168,
369,
1372,
2522,
744,
934,
1904,
4235,
304,
16759,
1962,
15945,
29908,
13,
1678,
664,
3493,
353,
5244,
3493,
5160,
17679,
580,
13,
13,
1678,
934,
29918,
978,
353,
7797,
19427,
29889,
27890,
580,
13,
1678,
5745,
29918,
1853,
353,
7797,
19427,
29889,
27890,
580,
13,
1678,
934,
29918,
1853,
353,
7797,
19427,
29889,
27890,
580,
13,
1678,
934,
29918,
2311,
353,
7797,
19427,
29889,
7798,
3073,
580,
29871,
396,
14402,
29901,
7997,
7798,
3073,
29973,
13,
1678,
848,
29918,
1853,
353,
3630,
1542,
3073,
580,
13,
1678,
338,
29918,
311,
22742,
353,
7797,
19427,
29889,
18146,
3073,
580,
13,
1678,
318,
5416,
353,
7797,
19427,
29889,
27890,
580,
13,
1678,
3142,
353,
7797,
19427,
29889,
4219,
3073,
580,
13,
13,
1678,
2825,
353,
7797,
19427,
29889,
11384,
3073,
580,
13,
1678,
11132,
353,
7797,
19427,
29889,
11384,
3073,
580,
13,
1678,
848,
29918,
2962,
287,
353,
7797,
19427,
29889,
11384,
3073,
580,
13,
1678,
848,
29918,
2760,
353,
7797,
19427,
29889,
11384,
3073,
580,
13,
1678,
2752,
29918,
2962,
287,
353,
7797,
19427,
29889,
11384,
3073,
580,
13,
1678,
2752,
29918,
2760,
353,
7797,
19427,
29889,
11384,
3073,
580,
13,
13,
1678,
1833,
29918,
1545,
2164,
353,
7797,
19427,
29889,
11384,
3073,
580,
13,
268,
13,
1990,
2522,
744,
2283,
5160,
17679,
29963,
29953,
29898,
3195,
1204,
17679,
1125,
13,
1678,
9995,
1168,
369,
1372,
2522,
744,
934,
1904,
4235,
304,
16759,
1962,
15945,
29908,
13,
13,
1678,
934,
29918,
978,
353,
7797,
19427,
29889,
27890,
580,
13,
13,
13,
1990,
2522,
744,
2283,
17679,
29963,
29945,
29898,
17185,
2283,
5160,
17679,
29963,
29945,
1125,
13,
1678,
9995,
1168,
369,
1372,
2522,
744,
934,
1904,
4235,
304,
16759,
1962,
15945,
29908,
13,
13,
1678,
934,
29918,
2084,
353,
7797,
19427,
29889,
27890,
580,
13,
13,
1678,
396,
14402,
29901,
2767,
304,
671,
1879,
29877,
8148,
2012,
310,
399,
29968,
29911,
13,
1678,
16303,
353,
399,
1193,
3073,
580,
13,
1678,
4818,
29918,
3149,
353,
399,
1193,
3073,
580,
13,
1678,
12700,
29918,
1272,
353,
7797,
19427,
29889,
7249,
3073,
29898,
4381,
29922,
8977,
29897,
13,
1678,
10916,
353,
7797,
19427,
29889,
1231,
9662,
630,
3073,
29898,
13011,
29922,
5574,
29892,
1303,
29918,
6194,
29922,
5574,
29897,
13,
268,
13,
1990,
2522,
744,
2283,
17679,
29963,
29953,
29898,
17185,
2283,
5160,
17679,
29963,
29953,
1125,
13,
1678,
9995,
1168,
369,
1372,
2522,
744,
934,
1904,
4235,
304,
16759,
1962,
15945,
29908,
13,
1678,
515,
9853,
29889,
15550,
19427,
1053,
350,
905,
5160,
17679,
29963,
29953,
13,
1678,
515,
4982,
29889,
15550,
19427,
1053,
17163,
1542,
5160,
17679,
29963,
29953,
13,
1678,
515,
9522,
412,
29889,
15550,
19427,
1053,
830,
24044,
1542,
5160,
17679,
29963,
29953,
13,
13,
1678,
664,
3493,
353,
5244,
3493,
5160,
17679,
580,
13,
1678,
5745,
29918,
1853,
353,
7797,
19427,
29889,
27890,
580,
13,
1678,
934,
29918,
1853,
353,
7797,
19427,
29889,
27890,
580,
13,
1678,
934,
29918,
2311,
353,
7797,
19427,
29889,
7798,
3073,
580,
29871,
396,
14402,
29901,
7997,
7798,
3073,
29973,
13,
1678,
934,
29918,
2084,
353,
7797,
19427,
29889,
27890,
580,
13,
1678,
338,
29918,
311,
22742,
353,
7797,
19427,
29889,
18146,
3073,
580,
13,
1678,
3142,
353,
7797,
19427,
29889,
4219,
3073,
580,
13,
13,
1678,
2825,
353,
7797,
19427,
29889,
11384,
3073,
580,
13,
1678,
11132,
353,
7797,
19427,
29889,
11384,
3073,
580,
13,
1678,
848,
29918,
2962,
287,
353,
7797,
19427,
29889,
11384,
3073,
580,
13,
1678,
848,
29918,
2760,
353,
7797,
19427,
29889,
11384,
3073,
580,
13,
1678,
2752,
29918,
2962,
287,
353,
7797,
19427,
29889,
11384,
3073,
580,
13,
1678,
2752,
29918,
2760,
353,
7797,
19427,
29889,
11384,
3073,
580,
13,
1678,
1833,
29918,
1545,
2164,
353,
7797,
19427,
29889,
11384,
3073,
580,
13,
1678,
396,
14402,
29901,
2767,
304,
671,
1879,
29877,
8148,
2012,
310,
399,
29968,
29911,
13,
1678,
16303,
353,
399,
1193,
3073,
580,
13,
1678,
4818,
29918,
3149,
353,
399,
1193,
3073,
580,
13,
1678,
10916,
353,
7797,
19427,
29889,
1231,
9662,
630,
3073,
29898,
13011,
29922,
5574,
29892,
1303,
29918,
6194,
29922,
5574,
29897,
13,
13,
1678,
4982,
29918,
1853,
353,
17163,
1542,
5160,
17679,
29963,
29953,
580,
13,
1678,
4982,
353,
8125,
1204,
17679,
580,
13,
1678,
4982,
29918,
8097,
353,
8125,
1204,
17679,
580,
13,
1678,
4982,
29918,
4905,
353,
7797,
19427,
29889,
27890,
580,
13,
13,
1678,
9522,
412,
29918,
1853,
353,
830,
24044,
1542,
5160,
17679,
29963,
29953,
580,
13,
1678,
9522,
412,
353,
8125,
1204,
17679,
580,
13,
1678,
9522,
412,
29918,
3177,
353,
7797,
19427,
29889,
27890,
580,
13,
1678,
9853,
353,
350,
905,
5160,
17679,
29963,
29953,
580,
13,
13,
1678,
338,
29918,
12587,
414,
19226,
353,
7797,
19427,
29889,
18146,
3073,
580,
13,
1678,
480,
6774,
19226,
353,
7797,
19427,
29889,
11384,
3073,
580,
13,
13,
13,
1990,
2522,
744,
2283,
10602,
17679,
29963,
29953,
29898,
17185,
2283,
17679,
29963,
29953,
1125,
13,
1678,
9995,
1168,
369,
1372,
934,
1904,
4235,
304,
16759,
1962,
15945,
29908,
13,
268,
13,
1678,
12700,
29918,
1272,
353,
7797,
19427,
29889,
7249,
3073,
29898,
4381,
29922,
8977,
29897,
13,
2
] |
models.py | nas3444/capstoneproject | 0 | 183397 | <reponame>nas3444/capstoneproject
from datetime import datetime
import os
from sqlalchemy import Column, String, Integer, create_engine, ForeignKey
from flask_sqlalchemy import SQLAlchemy
import json
from config import DatabaseURI
from flask_migrate import Migrate
# Creating DB
database_path = DatabaseURI.SQLALCHEMY_DATABASE_URI
db = SQLAlchemy()
def setup_db(app, database_path=database_path):
app.config["SQLALCHEMY_DATABASE_URI"] = database_path
app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False
db.app = app
db.init_app(app)
db.create_all()
migrate = Migrate(app, db)
# Movies Model
class Movie(db.Model):
__tablename__ = 'movies'
id = Column(Integer, primary_key=True)
title = Column(String, nullable=False, unique=True)
image = Column(String)
release_date = Column(db.DateTime)
actors = db.relationship('Actor', backref='Movie',
lazy='dynamic')
def __init__(self, title, image, release_date):
self.title = title
self.image = image
self.release_date = release_date
def insert(self):
db.session.add(self)
db.session.commit()
def update(self):
db.session.commit()
def delete(self):
db.session.delete(self)
db.session.commit()
def format(self):
return {
'id': self.id,
'title': self.title,
'image': self.image,
'release_date': self.release_date
}
# Actors Model
class Actor(db.Model):
___tablename___ = 'actors'
id = Column(Integer, primary_key=True)
name = Column(String, nullable=False, unique=True)
age = Column(Integer)
gender = Column(String)
movie_id = db.Column(db.Integer, db.ForeignKey('movies.id'))
def __init__(self, name, age, gender, movie_id):
self.name = name
self.age = age
self.gender = gender
self.movie_id = movie_id
def insert(self):
db.session.add(self)
db.session.commit()
def update(self):
db.session.commit()
def delete(self):
db.session.delete(self)
db.session.commit()
def format(self):
return {
'id': self.id,
'name': self.name,
'age': self.age,
'gender': self.gender,
'movie_id': self.movie_id
}
| [
1,
529,
276,
1112,
420,
29958,
22911,
29941,
29946,
29946,
29946,
29914,
5030,
12734,
4836,
13,
3166,
12865,
1053,
12865,
13,
5215,
2897,
13,
3166,
4576,
284,
305,
6764,
1053,
12481,
29892,
1714,
29892,
8102,
29892,
1653,
29918,
10599,
29892,
19358,
2558,
13,
3166,
29784,
29918,
2850,
284,
305,
6764,
1053,
3758,
2499,
305,
6764,
13,
5215,
4390,
13,
3166,
2295,
1053,
5470,
15551,
13,
3166,
29784,
29918,
26983,
403,
1053,
341,
4481,
403,
13,
13,
29937,
26221,
6535,
13,
9803,
29918,
2084,
353,
5470,
15551,
29889,
4176,
1964,
3210,
12665,
29979,
29918,
25832,
27982,
29918,
15551,
13,
2585,
353,
3758,
2499,
305,
6764,
580,
13,
13,
13,
1753,
6230,
29918,
2585,
29898,
932,
29892,
2566,
29918,
2084,
29922,
9803,
29918,
2084,
1125,
13,
1678,
623,
29889,
2917,
3366,
4176,
1964,
3210,
12665,
29979,
29918,
25832,
27982,
29918,
15551,
3108,
353,
2566,
29918,
2084,
13,
1678,
623,
29889,
2917,
3366,
4176,
1964,
3210,
12665,
29979,
29918,
5659,
11375,
29918,
6720,
4571,
29943,
28541,
29903,
3108,
353,
7700,
13,
1678,
4833,
29889,
932,
353,
623,
13,
1678,
4833,
29889,
2344,
29918,
932,
29898,
932,
29897,
13,
1678,
4833,
29889,
3258,
29918,
497,
580,
13,
1678,
9725,
403,
353,
341,
4481,
403,
29898,
932,
29892,
4833,
29897,
13,
13,
13,
29937,
14104,
583,
8125,
13,
1990,
7871,
29898,
2585,
29889,
3195,
1125,
13,
1678,
4770,
3891,
2435,
420,
1649,
353,
525,
13529,
583,
29915,
13,
13,
1678,
1178,
353,
12481,
29898,
7798,
29892,
7601,
29918,
1989,
29922,
5574,
29897,
13,
1678,
3611,
353,
12481,
29898,
1231,
29892,
1870,
519,
29922,
8824,
29892,
5412,
29922,
5574,
29897,
13,
1678,
1967,
353,
12481,
29898,
1231,
29897,
13,
1678,
6507,
29918,
1256,
353,
12481,
29898,
2585,
29889,
11384,
29897,
13,
1678,
29701,
353,
4833,
29889,
2674,
800,
4034,
877,
29909,
2801,
742,
1250,
999,
2433,
18749,
742,
13,
462,
632,
17366,
2433,
16626,
1495,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
3611,
29892,
1967,
29892,
6507,
29918,
1256,
1125,
13,
4706,
1583,
29889,
3257,
353,
3611,
13,
4706,
1583,
29889,
3027,
353,
1967,
13,
4706,
1583,
29889,
14096,
29918,
1256,
353,
6507,
29918,
1256,
13,
13,
1678,
822,
4635,
29898,
1311,
1125,
13,
4706,
4833,
29889,
7924,
29889,
1202,
29898,
1311,
29897,
13,
4706,
4833,
29889,
7924,
29889,
15060,
580,
13,
13,
1678,
822,
2767,
29898,
1311,
1125,
13,
4706,
4833,
29889,
7924,
29889,
15060,
580,
13,
13,
1678,
822,
5217,
29898,
1311,
1125,
13,
4706,
4833,
29889,
7924,
29889,
8143,
29898,
1311,
29897,
13,
4706,
4833,
29889,
7924,
29889,
15060,
580,
13,
13,
1678,
822,
3402,
29898,
1311,
1125,
13,
4706,
736,
426,
13,
9651,
525,
333,
2396,
1583,
29889,
333,
29892,
13,
9651,
525,
3257,
2396,
1583,
29889,
3257,
29892,
13,
9651,
525,
3027,
2396,
1583,
29889,
3027,
29892,
13,
9651,
525,
14096,
29918,
1256,
2396,
1583,
29889,
14096,
29918,
1256,
13,
4706,
500,
13,
13,
13,
29937,
3185,
943,
8125,
13,
1990,
319,
2801,
29898,
2585,
29889,
3195,
1125,
13,
1678,
903,
1649,
3891,
2435,
420,
22359,
353,
525,
627,
943,
29915,
13,
13,
1678,
1178,
353,
12481,
29898,
7798,
29892,
7601,
29918,
1989,
29922,
5574,
29897,
13,
1678,
1024,
353,
12481,
29898,
1231,
29892,
1870,
519,
29922,
8824,
29892,
5412,
29922,
5574,
29897,
13,
1678,
5046,
353,
12481,
29898,
7798,
29897,
13,
1678,
23346,
353,
12481,
29898,
1231,
29897,
13,
1678,
14064,
29918,
333,
353,
4833,
29889,
4409,
29898,
2585,
29889,
7798,
29892,
4833,
29889,
27755,
2558,
877,
13529,
583,
29889,
333,
8785,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1024,
29892,
5046,
29892,
23346,
29892,
14064,
29918,
333,
1125,
13,
4706,
1583,
29889,
978,
353,
1024,
13,
4706,
1583,
29889,
482,
353,
5046,
13,
4706,
1583,
29889,
26098,
353,
23346,
13,
4706,
1583,
29889,
27362,
29918,
333,
353,
14064,
29918,
333,
13,
13,
1678,
822,
4635,
29898,
1311,
1125,
13,
4706,
4833,
29889,
7924,
29889,
1202,
29898,
1311,
29897,
13,
4706,
4833,
29889,
7924,
29889,
15060,
580,
13,
13,
1678,
822,
2767,
29898,
1311,
1125,
13,
4706,
4833,
29889,
7924,
29889,
15060,
580,
13,
13,
1678,
822,
5217,
29898,
1311,
1125,
13,
4706,
4833,
29889,
7924,
29889,
8143,
29898,
1311,
29897,
13,
4706,
4833,
29889,
7924,
29889,
15060,
580,
13,
13,
1678,
822,
3402,
29898,
1311,
1125,
13,
4706,
736,
426,
13,
9651,
525,
333,
2396,
1583,
29889,
333,
29892,
13,
9651,
525,
978,
2396,
1583,
29889,
978,
29892,
13,
9651,
525,
482,
2396,
1583,
29889,
482,
29892,
13,
9651,
525,
26098,
2396,
1583,
29889,
26098,
29892,
13,
9651,
525,
27362,
29918,
333,
2396,
1583,
29889,
27362,
29918,
333,
13,
4706,
500,
13,
2
] |
smsapi/__init__.py | maciejga/smsapi-python-client | 0 | 93023 | <reponame>maciejga/smsapi-python-client<gh_stars>0
# -*- coding: utf-8 -*-
name = 'smsapi-client'
version = '2.3.0'
lib_info = '%s/%s' % (name, version) | [
1,
529,
276,
1112,
420,
29958,
8628,
8586,
3249,
29914,
29879,
1516,
2754,
29899,
4691,
29899,
4645,
29966,
12443,
29918,
303,
1503,
29958,
29900,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
13,
978,
353,
525,
29879,
1516,
2754,
29899,
4645,
29915,
13,
3259,
353,
525,
29906,
29889,
29941,
29889,
29900,
29915,
13,
13,
1982,
29918,
3888,
353,
14210,
29879,
22584,
29879,
29915,
1273,
313,
978,
29892,
1873,
29897,
2
] |
sagas/nlu/features.py | samlet/stack | 3 | 154658 | from typing import Text, Any, Dict, List, Union, Optional
from jsonpath_ng import jsonpath, parse
from pprint import pprint
from sagas.conf.conf import cf
def feats_for_path(path:Text):
if path=='_':
return '$.feats'
prefix = '$.'
suffix = '.feats'
parts = path.split('/')
parts_str = '.'.join([f"{t}[*]" for t in parts])
return f"{prefix}{parts_str}{suffix}"
def feats_map(ft:Text) -> Dict[Text, Text]:
if not ft:
return {}
def ensure(pair):
p=pair.split('=')
return (p[0],'_') if len(p)==1 else p
tuples=[ensure(pair) for pair in ft.split('|')]
ft_m={k:v for k,v in tuples}
return ft_m
def extract_feats_map(ft:Text, engine:Text) -> Dict[Text, Text]:
ex_fn={'corenlp': feats_map,
'stanza': feats_map}
engine=engine.split('_')[0]
if engine in ex_fn:
return ex_fn[engine](ft)
return {}
def get_feats_map(sents, lang, domain, path):
domain_name=f'{domain}_domains' if domain != 'predicts' else domain
from sagas.nlu.ruleset_procs import cached_chunks
chunks = cached_chunks(sents, lang, cf.engine(lang))
parser = parse(feats_for_path(path))
results=[]
for chunk in chunks[domain_name]:
vals = [match.value for match in parser.find(chunk)]
if vals:
results.extend([feats_map(val) for val in vals])
return results
| [
1,
515,
19229,
1053,
3992,
29892,
3139,
29892,
360,
919,
29892,
2391,
29892,
7761,
29892,
28379,
13,
3166,
4390,
2084,
29918,
865,
1053,
4390,
2084,
29892,
6088,
13,
3166,
282,
2158,
1053,
282,
2158,
13,
3166,
17233,
294,
29889,
5527,
29889,
5527,
1053,
274,
29888,
13,
13,
1753,
1238,
1446,
29918,
1454,
29918,
2084,
29898,
2084,
29901,
1626,
1125,
13,
1678,
565,
2224,
1360,
15972,
2396,
13,
4706,
736,
525,
1504,
1725,
1446,
29915,
13,
1678,
10944,
353,
525,
1504,
29915,
13,
1678,
25557,
353,
15300,
1725,
1446,
29915,
13,
1678,
5633,
353,
2224,
29889,
5451,
11219,
1495,
13,
1678,
5633,
29918,
710,
353,
15300,
4286,
7122,
4197,
29888,
29908,
29912,
29873,
4400,
29930,
18017,
363,
260,
297,
5633,
2314,
13,
1678,
736,
285,
29908,
29912,
13506,
1157,
20895,
29918,
710,
1157,
2146,
600,
861,
5038,
13,
13,
1753,
1238,
1446,
29918,
1958,
29898,
615,
29901,
1626,
29897,
1599,
360,
919,
29961,
1626,
29892,
3992,
5387,
13,
1678,
565,
451,
11791,
29901,
13,
4706,
736,
6571,
13,
13,
1678,
822,
9801,
29898,
18784,
1125,
13,
4706,
282,
29922,
18784,
29889,
5451,
877,
29922,
1495,
13,
4706,
736,
313,
29886,
29961,
29900,
1402,
15972,
1495,
565,
7431,
29898,
29886,
29897,
1360,
29896,
1683,
282,
13,
1678,
5291,
2701,
11759,
7469,
29898,
18784,
29897,
363,
5101,
297,
11791,
29889,
5451,
877,
29989,
1495,
29962,
13,
1678,
11791,
29918,
29885,
3790,
29895,
29901,
29894,
363,
413,
29892,
29894,
297,
5291,
2701,
29913,
13,
1678,
736,
11791,
29918,
29885,
13,
13,
1753,
6597,
29918,
1725,
1446,
29918,
1958,
29898,
615,
29901,
1626,
29892,
6012,
29901,
1626,
29897,
1599,
360,
919,
29961,
1626,
29892,
3992,
5387,
13,
1678,
429,
29918,
9144,
3790,
29915,
2616,
264,
22833,
2396,
1238,
1446,
29918,
1958,
29892,
13,
965,
525,
303,
8520,
2396,
1238,
1446,
29918,
1958,
29913,
13,
1678,
6012,
29922,
10599,
29889,
5451,
877,
29918,
29861,
29900,
29962,
13,
1678,
565,
6012,
297,
429,
29918,
9144,
29901,
13,
4706,
736,
429,
29918,
9144,
29961,
10599,
850,
615,
29897,
13,
1678,
736,
6571,
13,
13,
1753,
679,
29918,
1725,
1446,
29918,
1958,
29898,
29879,
1237,
29892,
6361,
29892,
5354,
29892,
2224,
1125,
13,
1678,
5354,
29918,
978,
29922,
29888,
29915,
29912,
7247,
2403,
3129,
2708,
29915,
565,
5354,
2804,
525,
27711,
29879,
29915,
1683,
5354,
13,
1678,
515,
17233,
294,
29889,
29876,
6092,
29889,
19238,
300,
29918,
771,
2395,
1053,
22152,
29918,
305,
18801,
13,
1678,
521,
18801,
353,
22152,
29918,
305,
18801,
29898,
29879,
1237,
29892,
6361,
29892,
274,
29888,
29889,
10599,
29898,
3893,
876,
13,
1678,
13812,
353,
6088,
29898,
1725,
1446,
29918,
1454,
29918,
2084,
29898,
2084,
876,
13,
1678,
2582,
29922,
2636,
13,
1678,
363,
19875,
297,
521,
18801,
29961,
7247,
29918,
978,
5387,
13,
4706,
659,
29879,
353,
518,
4352,
29889,
1767,
363,
1993,
297,
13812,
29889,
2886,
29898,
29812,
4638,
13,
4706,
565,
659,
29879,
29901,
13,
9651,
2582,
29889,
21843,
4197,
1725,
1446,
29918,
1958,
29898,
791,
29897,
363,
659,
297,
659,
29879,
2314,
13,
1678,
736,
2582,
13,
13,
2
] |
school/eCornell/Python Cert/Controlling Programming Flow/for statements/exercise4/funcs.py | KyleGortych/sample_work | 0 | 125919 | """
funcs
Descript:
File name: funcs.py
Maintainer: <NAME>
created: 03-22-2022
"""
def skip(s,n):
"""
Returns a copy of s, only including positions that are multiples of n
A position is a multiple of n if pos % n == 0.
Examples:
skip('hello world',1) returns 'hello world'
skip('hello world',2) returns 'hlowrd'
skip('hello world',3) returns 'hlwl'
skip('hello world',4) returns 'hor'
Parameter s: the string to copy
Precondition: s is a nonempty string
Parameter n: the letter positions to accept
Precondition: n is an int > 0
"""
assert type(s) == str and len(s) != 0
assert type(n) == int and n > 0
s2 = ''
idx = 0
for element in s:
if idx % n == 0:
s2 = s[idx] + s2
idx += 1
return s2[::-1]
# pass
def fixed_points(tup):
"""
Returns a copy of tup, including only the "fixed points".
A fixed point of a tuple is an element that is equal to its position in the tuple.
For example 0 and 2 are fixed points of (0,3,2). The fixed points are returned in
the order that they appear in the tuple.
Examples:
fixed_points((0,3,2)) returns (0,2)
fixed_points((0,1,2)) returns (0,1,2)
fixed_points((2,1,0)) returns (1,)
Parameter tup: the tuple to copy
Precondition: tup is a tuple of ints
"""
assert type(tup) == tuple
tuplist = list(tup)
tuplist2 = []
idx = 0
for element in tuplist:
if idx == element:
tuplist2.append(tuplist[idx])
idx += 1
return tuple(tuplist2)
#pass
| [
1,
9995,
13,
7692,
2395,
13,
4002,
924,
29901,
13,
13,
13,
2283,
1024,
29901,
29871,
2090,
2395,
29889,
2272,
13,
29924,
2365,
4008,
29901,
529,
5813,
29958,
13,
11600,
29901,
268,
29900,
29941,
29899,
29906,
29906,
29899,
29906,
29900,
29906,
29906,
13,
15945,
29908,
13,
1753,
14383,
29898,
29879,
29892,
29876,
1125,
13,
1678,
9995,
13,
1678,
16969,
263,
3509,
310,
269,
29892,
871,
3704,
11909,
393,
526,
2473,
2701,
310,
302,
13,
13,
1678,
319,
2602,
338,
263,
2999,
310,
302,
565,
926,
1273,
302,
1275,
29871,
29900,
29889,
13,
13,
1678,
1222,
9422,
29901,
13,
4706,
14383,
877,
12199,
3186,
742,
29896,
29897,
3639,
525,
12199,
3186,
29915,
13,
4706,
14383,
877,
12199,
3186,
742,
29906,
29897,
3639,
525,
29882,
677,
5499,
29915,
13,
4706,
14383,
877,
12199,
3186,
742,
29941,
29897,
3639,
525,
4415,
29893,
29880,
29915,
13,
4706,
14383,
877,
12199,
3186,
742,
29946,
29897,
3639,
525,
2015,
29915,
13,
13,
1678,
24953,
269,
29901,
278,
1347,
304,
3509,
13,
1678,
4721,
16122,
29901,
269,
338,
263,
1661,
6310,
1347,
13,
13,
1678,
24953,
302,
29901,
278,
5497,
11909,
304,
3544,
13,
1678,
4721,
16122,
29901,
302,
338,
385,
938,
1405,
29871,
29900,
13,
1678,
9995,
13,
1678,
4974,
1134,
29898,
29879,
29897,
1275,
851,
322,
7431,
29898,
29879,
29897,
2804,
29871,
29900,
13,
1678,
4974,
1134,
29898,
29876,
29897,
1275,
938,
322,
302,
1405,
29871,
29900,
13,
13,
1678,
269,
29906,
353,
6629,
13,
1678,
22645,
353,
29871,
29900,
13,
13,
1678,
363,
1543,
297,
269,
29901,
13,
4706,
565,
22645,
1273,
302,
1275,
29871,
29900,
29901,
13,
9651,
269,
29906,
353,
269,
29961,
13140,
29962,
718,
269,
29906,
13,
4706,
22645,
4619,
29871,
29896,
13,
1678,
736,
269,
29906,
29961,
1057,
29899,
29896,
29962,
13,
1678,
396,
1209,
13,
13,
13,
1753,
4343,
29918,
9748,
29898,
29873,
786,
1125,
13,
1678,
9995,
13,
1678,
16969,
263,
3509,
310,
260,
786,
29892,
3704,
871,
278,
376,
20227,
3291,
1642,
13,
13,
1678,
319,
4343,
1298,
310,
263,
18761,
338,
385,
1543,
393,
338,
5186,
304,
967,
2602,
297,
278,
18761,
29889,
13,
1678,
1152,
1342,
29871,
29900,
322,
29871,
29906,
526,
4343,
3291,
310,
313,
29900,
29892,
29941,
29892,
29906,
467,
29871,
450,
4343,
3291,
526,
4133,
297,
13,
1678,
278,
1797,
393,
896,
2615,
297,
278,
18761,
29889,
13,
13,
1678,
1222,
9422,
29901,
13,
4706,
4343,
29918,
9748,
3552,
29900,
29892,
29941,
29892,
29906,
876,
3639,
313,
29900,
29892,
29906,
29897,
13,
4706,
4343,
29918,
9748,
3552,
29900,
29892,
29896,
29892,
29906,
876,
3639,
313,
29900,
29892,
29896,
29892,
29906,
29897,
13,
4706,
4343,
29918,
9748,
3552,
29906,
29892,
29896,
29892,
29900,
876,
3639,
313,
29896,
29892,
29897,
13,
13,
1678,
24953,
260,
786,
29901,
278,
18761,
304,
3509,
13,
1678,
4721,
16122,
29901,
260,
786,
338,
263,
18761,
310,
938,
29879,
13,
1678,
9995,
13,
1678,
4974,
1134,
29898,
29873,
786,
29897,
1275,
18761,
13,
13,
1678,
5291,
572,
391,
353,
1051,
29898,
29873,
786,
29897,
13,
1678,
5291,
572,
391,
29906,
353,
5159,
13,
1678,
22645,
353,
29871,
29900,
13,
13,
1678,
363,
1543,
297,
5291,
572,
391,
29901,
13,
4706,
565,
22645,
1275,
1543,
29901,
13,
9651,
5291,
572,
391,
29906,
29889,
4397,
29898,
9161,
572,
391,
29961,
13140,
2314,
13,
4706,
22645,
4619,
29871,
29896,
13,
1678,
736,
18761,
29898,
9161,
572,
391,
29906,
29897,
13,
1678,
396,
3364,
13,
2
] |
networkx/generators/tests/test_random_graphs.py | SultanOrazbayev/networkx | 2 | 69006 | """Unit tests for the :mod:`networkx.generators.random_graphs` module."""
import networkx as nx
import pytest
_gnp_generators = [
nx.gnp_random_graph,
nx.fast_gnp_random_graph,
nx.binomial_graph,
nx.erdos_renyi_graph,
]
@pytest.mark.parametrize("generator", _gnp_generators)
@pytest.mark.parametrize("directed", (True, False))
def test_gnp_generators_negative_edge_probability(generator, directed):
"""If the edge probability `p` is <=0, the resulting graph should have no edges."""
G = generator(10, -1.1, directed=directed)
assert len(G) == 10
assert G.number_of_edges() == 0
assert G.is_directed() == directed
@pytest.mark.parametrize("generator", _gnp_generators)
@pytest.mark.parametrize(
("directed", "expected_num_edges"),
[(False, 45), (True, 90)],
)
def test_gnp_generators_greater_than_1_edge_probability(
generator, directed, expected_num_edges
):
"""If the edge probability `p` is >=1, the resulting graph should be complete."""
G = generator(10, 1.1, directed=directed)
assert len(G) == 10
assert G.number_of_edges() == expected_num_edges
assert G.is_directed() == directed
@pytest.mark.parametrize("generator", _gnp_generators)
@pytest.mark.parametrize("directed", (True, False))
def test_gnp_generators_basic(generator, directed):
"""If the edge probability `p` is >0 and <1, test only the basic properties."""
G = generator(10, 0.1, directed=directed)
assert len(G) == 10
assert G.is_directed() == directed
@pytest.mark.parametrize("generator", _gnp_generators)
def test_gnp_generators_for_p_close_to_1(generator):
"""If the edge probability `p` is close to 1, the resulting graph should have all edges."""
runs = 100
edges = sum(
generator(10, 0.99999, directed=True).number_of_edges() for _ in range(runs)
)
assert abs(edges / float(runs) - 90) <= runs * 2.0 / 100
@pytest.mark.parametrize("generator", _gnp_generators)
@pytest.mark.parametrize("p", (0.2, 0.8))
@pytest.mark.parametrize("directed", (True, False))
def test_gnp_generators_edge_probability(generator, p, directed):
"""Test that gnp generators generate edges according to the their probability `p`."""
runs = 5000
n = 5
edge_counts = [[0] * n for _ in range(n)]
for i in range(runs):
G = generator(n, p, directed=directed)
for (v, w) in G.edges:
edge_counts[v][w] += 1
if not directed:
edge_counts[w][v] += 1
for v in range(n):
for w in range(n):
if v == w:
# There should be no loops
assert edge_counts[v][w] == 0
else:
# Each edge should have been generated with probability close to p
assert abs(edge_counts[v][w] / float(runs) - p) <= 0.03
@pytest.mark.parametrize(
"generator", [nx.gnp_random_graph, nx.binomial_graph, nx.erdos_renyi_graph]
)
@pytest.mark.parametrize(
("seed", "directed", "expected_num_edges"),
[(42, False, 1219), (42, True, 2454), (314, False, 1247), (314, True, 2476)],
)
def test_gnp_random_graph_aliases(generator, seed, directed, expected_num_edges):
"""Test that aliases give the same result with the same seed."""
G = generator(100, 0.25, seed=seed, directed=directed)
assert len(G) == 100
assert G.number_of_edges() == expected_num_edges
assert G.is_directed() == directed
class TestGeneratorsRandom:
def test_random_graph(self):
seed = 42
G = nx.gnm_random_graph(100, 20, seed)
G = nx.gnm_random_graph(100, 20, seed, directed=True)
G = nx.dense_gnm_random_graph(100, 20, seed)
G = nx.watts_strogatz_graph(10, 2, 0.25, seed)
assert len(G) == 10
assert G.number_of_edges() == 10
G = nx.connected_watts_strogatz_graph(10, 2, 0.1, tries=10, seed=seed)
assert len(G) == 10
assert G.number_of_edges() == 10
pytest.raises(
nx.NetworkXError, nx.connected_watts_strogatz_graph, 10, 2, 0.1, tries=0
)
G = nx.watts_strogatz_graph(10, 4, 0.25, seed)
assert len(G) == 10
assert G.number_of_edges() == 20
G = nx.newman_watts_strogatz_graph(10, 2, 0.0, seed)
assert len(G) == 10
assert G.number_of_edges() == 10
G = nx.newman_watts_strogatz_graph(10, 4, 0.25, seed)
assert len(G) == 10
assert G.number_of_edges() >= 20
G = nx.barabasi_albert_graph(100, 1, seed)
G = nx.barabasi_albert_graph(100, 3, seed)
assert G.number_of_edges() == (97 * 3)
G = nx.barabasi_albert_graph(100, 3, seed, nx.complete_graph(5))
assert G.number_of_edges() == (10 + 95 * 3)
G = nx.extended_barabasi_albert_graph(100, 1, 0, 0, seed)
assert G.number_of_edges() == 99
G = nx.extended_barabasi_albert_graph(100, 3, 0, 0, seed)
assert G.number_of_edges() == 97 * 3
G = nx.extended_barabasi_albert_graph(100, 1, 0, 0.5, seed)
assert G.number_of_edges() == 99
G = nx.extended_barabasi_albert_graph(100, 2, 0.5, 0, seed)
assert G.number_of_edges() > 100 * 3
assert G.number_of_edges() < 100 * 4
G = nx.extended_barabasi_albert_graph(100, 2, 0.3, 0.3, seed)
assert G.number_of_edges() > 100 * 2
assert G.number_of_edges() < 100 * 4
G = nx.powerlaw_cluster_graph(100, 1, 1.0, seed)
G = nx.powerlaw_cluster_graph(100, 3, 0.0, seed)
assert G.number_of_edges() == (97 * 3)
G = nx.random_regular_graph(10, 20, seed)
pytest.raises(nx.NetworkXError, nx.random_regular_graph, 3, 21)
pytest.raises(nx.NetworkXError, nx.random_regular_graph, 33, 21)
constructor = [(10, 20, 0.8), (20, 40, 0.8)]
G = nx.random_shell_graph(constructor, seed)
def is_caterpillar(g):
"""
A tree is a caterpillar iff all nodes of degree >=3 are surrounded
by at most two nodes of degree two or greater.
ref: http://mathworld.wolfram.com/CaterpillarGraph.html
"""
deg_over_3 = [n for n in g if g.degree(n) >= 3]
for n in deg_over_3:
nbh_deg_over_2 = [nbh for nbh in g.neighbors(n) if g.degree(nbh) >= 2]
if not len(nbh_deg_over_2) <= 2:
return False
return True
def is_lobster(g):
"""
A tree is a lobster if it has the property that the removal of leaf
nodes leaves a caterpillar graph (Gallian 2007)
ref: http://mathworld.wolfram.com/LobsterGraph.html
"""
non_leafs = [n for n in g if g.degree(n) > 1]
return is_caterpillar(g.subgraph(non_leafs))
G = nx.random_lobster(10, 0.1, 0.5, seed)
assert max(G.degree(n) for n in G.nodes()) > 3
assert is_lobster(G)
pytest.raises(nx.NetworkXError, nx.random_lobster, 10, 0.1, 1, seed)
pytest.raises(nx.NetworkXError, nx.random_lobster, 10, 1, 1, seed)
pytest.raises(nx.NetworkXError, nx.random_lobster, 10, 1, 0.5, seed)
# docstring says this should be a caterpillar
G = nx.random_lobster(10, 0.1, 0.0, seed)
assert is_caterpillar(G)
# difficult to find seed that requires few tries
seq = nx.random_powerlaw_tree_sequence(10, 3, seed=14, tries=1)
G = nx.random_powerlaw_tree(10, 3, seed=14, tries=1)
def test_dual_barabasi_albert(self, m1=1, m2=4, p=0.5):
"""
Tests that the dual BA random graph generated behaves consistently.
Tests the exceptions are raised as expected.
The graphs generation are repeated several times to prevent lucky shots
"""
seeds = [42, 314, 2718]
initial_graph = nx.complete_graph(10)
for seed in seeds:
# This should be BA with m = m1
BA1 = nx.barabasi_albert_graph(100, m1, seed)
DBA1 = nx.dual_barabasi_albert_graph(100, m1, m2, 1, seed)
assert BA1.edges() == DBA1.edges()
# This should be BA with m = m2
BA2 = nx.barabasi_albert_graph(100, m2, seed)
DBA2 = nx.dual_barabasi_albert_graph(100, m1, m2, 0, seed)
assert BA2.edges() == DBA2.edges()
BA3 = nx.barabasi_albert_graph(100, m1, seed)
DBA3 = nx.dual_barabasi_albert_graph(100, m1, m1, p, seed)
# We can't compare edges here since randomness is "consumed" when drawing
# between m1 and m2
assert BA3.size() == DBA3.size()
DBA = nx.dual_barabasi_albert_graph(100, m1, m2, p, seed, initial_graph)
BA1 = nx.barabasi_albert_graph(100, m1, seed, initial_graph)
BA2 = nx.barabasi_albert_graph(100, m2, seed, initial_graph)
assert (
min(BA1.size(), BA2.size()) <= DBA.size() <= max(BA1.size(), BA2.size())
)
# Testing exceptions
dbag = nx.dual_barabasi_albert_graph
pytest.raises(nx.NetworkXError, dbag, m1, m1, m2, 0)
pytest.raises(nx.NetworkXError, dbag, m2, m1, m2, 0)
pytest.raises(nx.NetworkXError, dbag, 100, m1, m2, -0.5)
pytest.raises(nx.NetworkXError, dbag, 100, m1, m2, 1.5)
initial = nx.complete_graph(max(m1, m2) - 1)
pytest.raises(nx.NetworkXError, dbag, 100, m1, m2, p, initial_graph=initial)
def test_extended_barabasi_albert(self, m=2):
"""
Tests that the extended BA random graph generated behaves consistently.
Tests the exceptions are raised as expected.
The graphs generation are repeated several times to prevent lucky-shots
"""
seeds = [42, 314, 2718]
for seed in seeds:
BA_model = nx.barabasi_albert_graph(100, m, seed)
BA_model_edges = BA_model.number_of_edges()
# This behaves just like BA, the number of edges must be the same
G1 = nx.extended_barabasi_albert_graph(100, m, 0, 0, seed)
assert G1.size() == BA_model_edges
# More than twice more edges should have been added
G1 = nx.extended_barabasi_albert_graph(100, m, 0.8, 0, seed)
assert G1.size() > BA_model_edges * 2
# Only edge rewiring, so the number of edges less than original
G2 = nx.extended_barabasi_albert_graph(100, m, 0, 0.8, seed)
assert G2.size() == BA_model_edges
# Mixed scenario: less edges than G1 and more edges than G2
G3 = nx.extended_barabasi_albert_graph(100, m, 0.3, 0.3, seed)
assert G3.size() > G2.size()
assert G3.size() < G1.size()
# Testing exceptions
ebag = nx.extended_barabasi_albert_graph
pytest.raises(nx.NetworkXError, ebag, m, m, 0, 0)
pytest.raises(nx.NetworkXError, ebag, 1, 0.5, 0, 0)
pytest.raises(nx.NetworkXError, ebag, 100, 2, 0.5, 0.5)
def test_random_zero_regular_graph(self):
"""Tests that a 0-regular graph has the correct number of nodes and
edges.
"""
seed = 42
G = nx.random_regular_graph(0, 10, seed)
assert len(G) == 10
assert G.number_of_edges() == 0
def test_gnm(self):
G = nx.gnm_random_graph(10, 3)
assert len(G) == 10
assert G.number_of_edges() == 3
G = nx.gnm_random_graph(10, 3, seed=42)
assert len(G) == 10
assert G.number_of_edges() == 3
G = nx.gnm_random_graph(10, 100)
assert len(G) == 10
assert G.number_of_edges() == 45
G = nx.gnm_random_graph(10, 100, directed=True)
assert len(G) == 10
assert G.number_of_edges() == 90
G = nx.gnm_random_graph(10, -1.1)
assert len(G) == 10
assert G.number_of_edges() == 0
def test_watts_strogatz_big_k(self):
# Test to make sure than n <= k
pytest.raises(nx.NetworkXError, nx.watts_strogatz_graph, 10, 11, 0.25)
pytest.raises(nx.NetworkXError, nx.newman_watts_strogatz_graph, 10, 11, 0.25)
# could create an infinite loop, now doesn't
# infinite loop used to occur when a node has degree n-1 and needs to rewire
nx.watts_strogatz_graph(10, 9, 0.25, seed=0)
nx.newman_watts_strogatz_graph(10, 9, 0.5, seed=0)
# Test k==n scenario
nx.watts_strogatz_graph(10, 10, 0.25, seed=0)
nx.newman_watts_strogatz_graph(10, 10, 0.25, seed=0)
def test_random_kernel_graph(self):
def integral(u, w, z):
return c * (z - w)
def root(u, w, r):
return r / c + w
c = 1
graph = nx.random_kernel_graph(1000, integral, root)
graph = nx.random_kernel_graph(1000, integral, root, seed=42)
assert len(graph) == 1000
| [
1,
9995,
8325,
6987,
363,
278,
584,
1545,
18078,
11618,
29916,
29889,
4738,
4097,
29889,
8172,
29918,
4262,
29879,
29952,
3883,
1213,
15945,
13,
5215,
3564,
29916,
408,
302,
29916,
13,
5215,
11451,
1688,
13,
13,
13,
29918,
5138,
29886,
29918,
4738,
4097,
353,
518,
13,
1678,
302,
29916,
29889,
5138,
29886,
29918,
8172,
29918,
4262,
29892,
13,
1678,
302,
29916,
29889,
11255,
29918,
5138,
29886,
29918,
8172,
29918,
4262,
29892,
13,
1678,
302,
29916,
29889,
2109,
7615,
29918,
4262,
29892,
13,
1678,
302,
29916,
29889,
2018,
359,
29918,
1267,
25675,
29918,
4262,
29892,
13,
29962,
13,
13,
13,
29992,
2272,
1688,
29889,
3502,
29889,
3207,
300,
374,
911,
703,
27959,
613,
903,
5138,
29886,
29918,
4738,
4097,
29897,
13,
29992,
2272,
1688,
29889,
3502,
29889,
3207,
300,
374,
911,
703,
11851,
287,
613,
313,
5574,
29892,
7700,
876,
13,
1753,
1243,
29918,
5138,
29886,
29918,
4738,
4097,
29918,
22198,
29918,
12864,
29918,
22795,
3097,
29898,
27959,
29892,
10624,
1125,
13,
1678,
9995,
3644,
278,
7636,
6976,
421,
29886,
29952,
338,
5277,
29900,
29892,
278,
9819,
3983,
881,
505,
694,
12770,
1213,
15945,
13,
1678,
402,
353,
15299,
29898,
29896,
29900,
29892,
448,
29896,
29889,
29896,
29892,
10624,
29922,
11851,
287,
29897,
13,
1678,
4974,
7431,
29898,
29954,
29897,
1275,
29871,
29896,
29900,
13,
1678,
4974,
402,
29889,
4537,
29918,
974,
29918,
287,
2710,
580,
1275,
29871,
29900,
13,
1678,
4974,
402,
29889,
275,
29918,
11851,
287,
580,
1275,
10624,
13,
13,
13,
29992,
2272,
1688,
29889,
3502,
29889,
3207,
300,
374,
911,
703,
27959,
613,
903,
5138,
29886,
29918,
4738,
4097,
29897,
13,
29992,
2272,
1688,
29889,
3502,
29889,
3207,
300,
374,
911,
29898,
13,
1678,
4852,
11851,
287,
613,
376,
9684,
29918,
1949,
29918,
287,
2710,
4968,
13,
1678,
17288,
8824,
29892,
29871,
29946,
29945,
511,
313,
5574,
29892,
29871,
29929,
29900,
29897,
1402,
13,
29897,
13,
1753,
1243,
29918,
5138,
29886,
29918,
4738,
4097,
29918,
7979,
1008,
29918,
27603,
29918,
29896,
29918,
12864,
29918,
22795,
3097,
29898,
13,
1678,
15299,
29892,
10624,
29892,
3806,
29918,
1949,
29918,
287,
2710,
13,
1125,
13,
1678,
9995,
3644,
278,
7636,
6976,
421,
29886,
29952,
338,
6736,
29896,
29892,
278,
9819,
3983,
881,
367,
4866,
1213,
15945,
13,
1678,
402,
353,
15299,
29898,
29896,
29900,
29892,
29871,
29896,
29889,
29896,
29892,
10624,
29922,
11851,
287,
29897,
13,
1678,
4974,
7431,
29898,
29954,
29897,
1275,
29871,
29896,
29900,
13,
1678,
4974,
402,
29889,
4537,
29918,
974,
29918,
287,
2710,
580,
1275,
3806,
29918,
1949,
29918,
287,
2710,
13,
1678,
4974,
402,
29889,
275,
29918,
11851,
287,
580,
1275,
10624,
13,
13,
13,
29992,
2272,
1688,
29889,
3502,
29889,
3207,
300,
374,
911,
703,
27959,
613,
903,
5138,
29886,
29918,
4738,
4097,
29897,
13,
29992,
2272,
1688,
29889,
3502,
29889,
3207,
300,
374,
911,
703,
11851,
287,
613,
313,
5574,
29892,
7700,
876,
13,
1753,
1243,
29918,
5138,
29886,
29918,
4738,
4097,
29918,
16121,
29898,
27959,
29892,
10624,
1125,
13,
1678,
9995,
3644,
278,
7636,
6976,
421,
29886,
29952,
338,
1405,
29900,
322,
529,
29896,
29892,
1243,
871,
278,
6996,
4426,
1213,
15945,
13,
1678,
402,
353,
15299,
29898,
29896,
29900,
29892,
29871,
29900,
29889,
29896,
29892,
10624,
29922,
11851,
287,
29897,
13,
1678,
4974,
7431,
29898,
29954,
29897,
1275,
29871,
29896,
29900,
13,
1678,
4974,
402,
29889,
275,
29918,
11851,
287,
580,
1275,
10624,
13,
13,
13,
29992,
2272,
1688,
29889,
3502,
29889,
3207,
300,
374,
911,
703,
27959,
613,
903,
5138,
29886,
29918,
4738,
4097,
29897,
13,
1753,
1243,
29918,
5138,
29886,
29918,
4738,
4097,
29918,
1454,
29918,
29886,
29918,
5358,
29918,
517,
29918,
29896,
29898,
27959,
1125,
13,
1678,
9995,
3644,
278,
7636,
6976,
421,
29886,
29952,
338,
3802,
304,
29871,
29896,
29892,
278,
9819,
3983,
881,
505,
599,
12770,
1213,
15945,
13,
1678,
6057,
353,
29871,
29896,
29900,
29900,
13,
1678,
12770,
353,
2533,
29898,
13,
4706,
15299,
29898,
29896,
29900,
29892,
29871,
29900,
29889,
29929,
29929,
29929,
29929,
29929,
29892,
10624,
29922,
5574,
467,
4537,
29918,
974,
29918,
287,
2710,
580,
363,
903,
297,
3464,
29898,
3389,
29879,
29897,
13,
1678,
1723,
13,
1678,
4974,
6425,
29898,
287,
2710,
847,
5785,
29898,
3389,
29879,
29897,
448,
29871,
29929,
29900,
29897,
5277,
6057,
334,
29871,
29906,
29889,
29900,
847,
29871,
29896,
29900,
29900,
13,
13,
13,
29992,
2272,
1688,
29889,
3502,
29889,
3207,
300,
374,
911,
703,
27959,
613,
903,
5138,
29886,
29918,
4738,
4097,
29897,
13,
29992,
2272,
1688,
29889,
3502,
29889,
3207,
300,
374,
911,
703,
29886,
613,
313,
29900,
29889,
29906,
29892,
29871,
29900,
29889,
29947,
876,
13,
29992,
2272,
1688,
29889,
3502,
29889,
3207,
300,
374,
911,
703,
11851,
287,
613,
313,
5574,
29892,
7700,
876,
13,
1753,
1243,
29918,
5138,
29886,
29918,
4738,
4097,
29918,
12864,
29918,
22795,
3097,
29898,
27959,
29892,
282,
29892,
10624,
1125,
13,
1678,
9995,
3057,
393,
330,
9302,
1176,
4097,
5706,
12770,
5034,
304,
278,
1009,
6976,
421,
29886,
29952,
1213,
15945,
13,
1678,
6057,
353,
29871,
29945,
29900,
29900,
29900,
13,
1678,
302,
353,
29871,
29945,
13,
1678,
7636,
29918,
2798,
29879,
353,
5519,
29900,
29962,
334,
302,
363,
903,
297,
3464,
29898,
29876,
4638,
13,
1678,
363,
474,
297,
3464,
29898,
3389,
29879,
1125,
13,
4706,
402,
353,
15299,
29898,
29876,
29892,
282,
29892,
10624,
29922,
11851,
287,
29897,
13,
4706,
363,
313,
29894,
29892,
281,
29897,
297,
402,
29889,
287,
2710,
29901,
13,
9651,
7636,
29918,
2798,
29879,
29961,
29894,
3816,
29893,
29962,
4619,
29871,
29896,
13,
9651,
565,
451,
10624,
29901,
13,
18884,
7636,
29918,
2798,
29879,
29961,
29893,
3816,
29894,
29962,
4619,
29871,
29896,
13,
1678,
363,
325,
297,
3464,
29898,
29876,
1125,
13,
4706,
363,
281,
297,
3464,
29898,
29876,
1125,
13,
9651,
565,
325,
1275,
281,
29901,
13,
18884,
396,
1670,
881,
367,
694,
12104,
13,
18884,
4974,
7636,
29918,
2798,
29879,
29961,
29894,
3816,
29893,
29962,
1275,
29871,
29900,
13,
9651,
1683,
29901,
13,
18884,
396,
7806,
7636,
881,
505,
1063,
5759,
411,
6976,
3802,
304,
282,
13,
18884,
4974,
6425,
29898,
12864,
29918,
2798,
29879,
29961,
29894,
3816,
29893,
29962,
847,
5785,
29898,
3389,
29879,
29897,
448,
282,
29897,
5277,
29871,
29900,
29889,
29900,
29941,
13,
13,
13,
29992,
2272,
1688,
29889,
3502,
29889,
3207,
300,
374,
911,
29898,
13,
1678,
376,
27959,
613,
518,
23818,
29889,
5138,
29886,
29918,
8172,
29918,
4262,
29892,
302,
29916,
29889,
2109,
7615,
29918,
4262,
29892,
302,
29916,
29889,
2018,
359,
29918,
1267,
25675,
29918,
4262,
29962,
13,
29897,
13,
29992,
2272,
1688,
29889,
3502,
29889,
3207,
300,
374,
911,
29898,
13,
1678,
4852,
26776,
613,
376,
11851,
287,
613,
376,
9684,
29918,
1949,
29918,
287,
2710,
4968,
13,
1678,
17288,
29946,
29906,
29892,
7700,
29892,
29871,
29896,
29906,
29896,
29929,
511,
313,
29946,
29906,
29892,
5852,
29892,
29871,
29906,
29946,
29945,
29946,
511,
313,
29941,
29896,
29946,
29892,
7700,
29892,
29871,
29896,
29906,
29946,
29955,
511,
313,
29941,
29896,
29946,
29892,
5852,
29892,
29871,
29906,
29946,
29955,
29953,
29897,
1402,
13,
29897,
13,
1753,
1243,
29918,
5138,
29886,
29918,
8172,
29918,
4262,
29918,
2606,
2129,
29898,
27959,
29892,
16717,
29892,
10624,
29892,
3806,
29918,
1949,
29918,
287,
2710,
1125,
13,
1678,
9995,
3057,
393,
14430,
2129,
2367,
278,
1021,
1121,
411,
278,
1021,
16717,
1213,
15945,
13,
1678,
402,
353,
15299,
29898,
29896,
29900,
29900,
29892,
29871,
29900,
29889,
29906,
29945,
29892,
16717,
29922,
26776,
29892,
10624,
29922,
11851,
287,
29897,
13,
1678,
4974,
7431,
29898,
29954,
29897,
1275,
29871,
29896,
29900,
29900,
13,
1678,
4974,
402,
29889,
4537,
29918,
974,
29918,
287,
2710,
580,
1275,
3806,
29918,
1949,
29918,
287,
2710,
13,
1678,
4974,
402,
29889,
275,
29918,
11851,
287,
580,
1275,
10624,
13,
13,
13,
1990,
4321,
5631,
4097,
17875,
29901,
13,
1678,
822,
1243,
29918,
8172,
29918,
4262,
29898,
1311,
1125,
13,
4706,
16717,
353,
29871,
29946,
29906,
13,
4706,
402,
353,
302,
29916,
29889,
5138,
29885,
29918,
8172,
29918,
4262,
29898,
29896,
29900,
29900,
29892,
29871,
29906,
29900,
29892,
16717,
29897,
13,
4706,
402,
353,
302,
29916,
29889,
5138,
29885,
29918,
8172,
29918,
4262,
29898,
29896,
29900,
29900,
29892,
29871,
29906,
29900,
29892,
16717,
29892,
10624,
29922,
5574,
29897,
13,
4706,
402,
353,
302,
29916,
29889,
1145,
344,
29918,
5138,
29885,
29918,
8172,
29918,
4262,
29898,
29896,
29900,
29900,
29892,
29871,
29906,
29900,
29892,
16717,
29897,
13,
13,
4706,
402,
353,
302,
29916,
29889,
29893,
1131,
29879,
29918,
303,
9102,
4101,
29918,
4262,
29898,
29896,
29900,
29892,
29871,
29906,
29892,
29871,
29900,
29889,
29906,
29945,
29892,
16717,
29897,
13,
4706,
4974,
7431,
29898,
29954,
29897,
1275,
29871,
29896,
29900,
13,
4706,
4974,
402,
29889,
4537,
29918,
974,
29918,
287,
2710,
580,
1275,
29871,
29896,
29900,
13,
13,
4706,
402,
353,
302,
29916,
29889,
18045,
29918,
29893,
1131,
29879,
29918,
303,
9102,
4101,
29918,
4262,
29898,
29896,
29900,
29892,
29871,
29906,
29892,
29871,
29900,
29889,
29896,
29892,
14335,
29922,
29896,
29900,
29892,
16717,
29922,
26776,
29897,
13,
4706,
4974,
7431,
29898,
29954,
29897,
1275,
29871,
29896,
29900,
13,
4706,
4974,
402,
29889,
4537,
29918,
974,
29918,
287,
2710,
580,
1275,
29871,
29896,
29900,
13,
4706,
11451,
1688,
29889,
336,
4637,
29898,
13,
9651,
302,
29916,
29889,
13724,
29990,
2392,
29892,
302,
29916,
29889,
18045,
29918,
29893,
1131,
29879,
29918,
303,
9102,
4101,
29918,
4262,
29892,
29871,
29896,
29900,
29892,
29871,
29906,
29892,
29871,
29900,
29889,
29896,
29892,
14335,
29922,
29900,
13,
4706,
1723,
13,
13,
4706,
402,
353,
302,
29916,
29889,
29893,
1131,
29879,
29918,
303,
9102,
4101,
29918,
4262,
29898,
29896,
29900,
29892,
29871,
29946,
29892,
29871,
29900,
29889,
29906,
29945,
29892,
16717,
29897,
13,
4706,
4974,
7431,
29898,
29954,
29897,
1275,
29871,
29896,
29900,
13,
4706,
4974,
402,
29889,
4537,
29918,
974,
29918,
287,
2710,
580,
1275,
29871,
29906,
29900,
13,
13,
4706,
402,
353,
302,
29916,
29889,
1482,
1171,
29918,
29893,
1131,
29879,
29918,
303,
9102,
4101,
29918,
4262,
29898,
29896,
29900,
29892,
29871,
29906,
29892,
29871,
29900,
29889,
29900,
29892,
16717,
29897,
13,
4706,
4974,
7431,
29898,
29954,
29897,
1275,
29871,
29896,
29900,
13,
4706,
4974,
402,
29889,
4537,
29918,
974,
29918,
287,
2710,
580,
1275,
29871,
29896,
29900,
13,
13,
4706,
402,
353,
302,
29916,
29889,
1482,
1171,
29918,
29893,
1131,
29879,
29918,
303,
9102,
4101,
29918,
4262,
29898,
29896,
29900,
29892,
29871,
29946,
29892,
29871,
29900,
29889,
29906,
29945,
29892,
16717,
29897,
13,
4706,
4974,
7431,
29898,
29954,
29897,
1275,
29871,
29896,
29900,
13,
4706,
4974,
402,
29889,
4537,
29918,
974,
29918,
287,
2710,
580,
6736,
29871,
29906,
29900,
13,
13,
4706,
402,
353,
302,
29916,
29889,
1646,
370,
6840,
29918,
284,
2151,
29918,
4262,
29898,
29896,
29900,
29900,
29892,
29871,
29896,
29892,
16717,
29897,
13,
4706,
402,
353,
302,
29916,
29889,
1646,
370,
6840,
29918,
284,
2151,
29918,
4262,
29898,
29896,
29900,
29900,
29892,
29871,
29941,
29892,
16717,
29897,
13,
4706,
4974,
402,
29889,
4537,
29918,
974,
29918,
287,
2710,
580,
1275,
313,
29929,
29955,
334,
29871,
29941,
29897,
13,
13,
4706,
402,
353,
302,
29916,
29889,
1646,
370,
6840,
29918,
284,
2151,
29918,
4262,
29898,
29896,
29900,
29900,
29892,
29871,
29941,
29892,
16717,
29892,
302,
29916,
29889,
8835,
29918,
4262,
29898,
29945,
876,
13,
4706,
4974,
402,
29889,
4537,
29918,
974,
29918,
287,
2710,
580,
1275,
313,
29896,
29900,
718,
29871,
29929,
29945,
334,
29871,
29941,
29897,
13,
13,
4706,
402,
353,
302,
29916,
29889,
1062,
2760,
29918,
1646,
370,
6840,
29918,
284,
2151,
29918,
4262,
29898,
29896,
29900,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
16717,
29897,
13,
4706,
4974,
402,
29889,
4537,
29918,
974,
29918,
287,
2710,
580,
1275,
29871,
29929,
29929,
13,
4706,
402,
353,
302,
29916,
29889,
1062,
2760,
29918,
1646,
370,
6840,
29918,
284,
2151,
29918,
4262,
29898,
29896,
29900,
29900,
29892,
29871,
29941,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
16717,
29897,
13,
4706,
4974,
402,
29889,
4537,
29918,
974,
29918,
287,
2710,
580,
1275,
29871,
29929,
29955,
334,
29871,
29941,
13,
4706,
402,
353,
302,
29916,
29889,
1062,
2760,
29918,
1646,
370,
6840,
29918,
284,
2151,
29918,
4262,
29898,
29896,
29900,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29889,
29945,
29892,
16717,
29897,
13,
4706,
4974,
402,
29889,
4537,
29918,
974,
29918,
287,
2710,
580,
1275,
29871,
29929,
29929,
13,
4706,
402,
353,
302,
29916,
29889,
1062,
2760,
29918,
1646,
370,
6840,
29918,
284,
2151,
29918,
4262,
29898,
29896,
29900,
29900,
29892,
29871,
29906,
29892,
29871,
29900,
29889,
29945,
29892,
29871,
29900,
29892,
16717,
29897,
13,
4706,
4974,
402,
29889,
4537,
29918,
974,
29918,
287,
2710,
580,
1405,
29871,
29896,
29900,
29900,
334,
29871,
29941,
13,
4706,
4974,
402,
29889,
4537,
29918,
974,
29918,
287,
2710,
580,
529,
29871,
29896,
29900,
29900,
334,
29871,
29946,
13,
13,
4706,
402,
353,
302,
29916,
29889,
1062,
2760,
29918,
1646,
370,
6840,
29918,
284,
2151,
29918,
4262,
29898,
29896,
29900,
29900,
29892,
29871,
29906,
29892,
29871,
29900,
29889,
29941,
29892,
29871,
29900,
29889,
29941,
29892,
16717,
29897,
13,
4706,
4974,
402,
29889,
4537,
29918,
974,
29918,
287,
2710,
580,
1405,
29871,
29896,
29900,
29900,
334,
29871,
29906,
13,
4706,
4974,
402,
29889,
4537,
29918,
974,
29918,
287,
2710,
580,
529,
29871,
29896,
29900,
29900,
334,
29871,
29946,
13,
13,
4706,
402,
353,
302,
29916,
29889,
13519,
10653,
29918,
19594,
29918,
4262,
29898,
29896,
29900,
29900,
29892,
29871,
29896,
29892,
29871,
29896,
29889,
29900,
29892,
16717,
29897,
13,
4706,
402,
353,
302,
29916,
29889,
13519,
10653,
29918,
19594,
29918,
4262,
29898,
29896,
29900,
29900,
29892,
29871,
29941,
29892,
29871,
29900,
29889,
29900,
29892,
16717,
29897,
13,
4706,
4974,
402,
29889,
4537,
29918,
974,
29918,
287,
2710,
580,
1275,
313,
29929,
29955,
334,
29871,
29941,
29897,
13,
13,
4706,
402,
353,
302,
29916,
29889,
8172,
29918,
15227,
29918,
4262,
29898,
29896,
29900,
29892,
29871,
29906,
29900,
29892,
16717,
29897,
13,
13,
4706,
11451,
1688,
29889,
336,
4637,
29898,
23818,
29889,
13724,
29990,
2392,
29892,
302,
29916,
29889,
8172,
29918,
15227,
29918,
4262,
29892,
29871,
29941,
29892,
29871,
29906,
29896,
29897,
13,
4706,
11451,
1688,
29889,
336,
4637,
29898,
23818,
29889,
13724,
29990,
2392,
29892,
302,
29916,
29889,
8172,
29918,
15227,
29918,
4262,
29892,
29871,
29941,
29941,
29892,
29871,
29906,
29896,
29897,
13,
13,
4706,
5823,
353,
17288,
29896,
29900,
29892,
29871,
29906,
29900,
29892,
29871,
29900,
29889,
29947,
511,
313,
29906,
29900,
29892,
29871,
29946,
29900,
29892,
29871,
29900,
29889,
29947,
4638,
13,
4706,
402,
353,
302,
29916,
29889,
8172,
29918,
15903,
29918,
4262,
29898,
27821,
29892,
16717,
29897,
13,
13,
4706,
822,
338,
29918,
29883,
1008,
29886,
453,
279,
29898,
29887,
1125,
13,
9651,
9995,
13,
9651,
319,
5447,
338,
263,
274,
1008,
29886,
453,
279,
565,
29888,
599,
7573,
310,
7426,
6736,
29941,
526,
22047,
13,
9651,
491,
472,
1556,
1023,
7573,
310,
7426,
1023,
470,
7621,
29889,
13,
9651,
2143,
29901,
1732,
597,
755,
11526,
29889,
24437,
22328,
29889,
510,
29914,
29907,
1008,
29886,
453,
279,
9527,
29889,
1420,
13,
9651,
9995,
13,
9651,
3587,
29918,
957,
29918,
29941,
353,
518,
29876,
363,
302,
297,
330,
565,
330,
29889,
12163,
929,
29898,
29876,
29897,
6736,
29871,
29941,
29962,
13,
9651,
363,
302,
297,
3587,
29918,
957,
29918,
29941,
29901,
13,
18884,
302,
29890,
29882,
29918,
12163,
29918,
957,
29918,
29906,
353,
518,
9877,
29882,
363,
302,
29890,
29882,
297,
330,
29889,
484,
1141,
29890,
943,
29898,
29876,
29897,
565,
330,
29889,
12163,
929,
29898,
9877,
29882,
29897,
6736,
29871,
29906,
29962,
13,
18884,
565,
451,
7431,
29898,
9877,
29882,
29918,
12163,
29918,
957,
29918,
29906,
29897,
5277,
29871,
29906,
29901,
13,
462,
1678,
736,
7700,
13,
9651,
736,
5852,
13,
13,
4706,
822,
338,
29918,
2127,
2475,
29898,
29887,
1125,
13,
9651,
9995,
13,
9651,
319,
5447,
338,
263,
658,
29890,
2475,
565,
372,
756,
278,
2875,
393,
278,
28744,
310,
20447,
13,
9651,
7573,
11308,
263,
274,
1008,
29886,
453,
279,
3983,
313,
29954,
284,
492,
273,
29871,
29906,
29900,
29900,
29955,
29897,
13,
9651,
2143,
29901,
1732,
597,
755,
11526,
29889,
24437,
22328,
29889,
510,
29914,
29931,
711,
2475,
9527,
29889,
1420,
13,
9651,
9995,
13,
9651,
1661,
29918,
29500,
29879,
353,
518,
29876,
363,
302,
297,
330,
565,
330,
29889,
12163,
929,
29898,
29876,
29897,
1405,
29871,
29896,
29962,
13,
9651,
736,
338,
29918,
29883,
1008,
29886,
453,
279,
29898,
29887,
29889,
1491,
4262,
29898,
5464,
29918,
29500,
29879,
876,
13,
13,
4706,
402,
353,
302,
29916,
29889,
8172,
29918,
2127,
2475,
29898,
29896,
29900,
29892,
29871,
29900,
29889,
29896,
29892,
29871,
29900,
29889,
29945,
29892,
16717,
29897,
13,
4706,
4974,
4236,
29898,
29954,
29889,
12163,
929,
29898,
29876,
29897,
363,
302,
297,
402,
29889,
18010,
3101,
1405,
29871,
29941,
13,
4706,
4974,
338,
29918,
2127,
2475,
29898,
29954,
29897,
13,
4706,
11451,
1688,
29889,
336,
4637,
29898,
23818,
29889,
13724,
29990,
2392,
29892,
302,
29916,
29889,
8172,
29918,
2127,
2475,
29892,
29871,
29896,
29900,
29892,
29871,
29900,
29889,
29896,
29892,
29871,
29896,
29892,
16717,
29897,
13,
4706,
11451,
1688,
29889,
336,
4637,
29898,
23818,
29889,
13724,
29990,
2392,
29892,
302,
29916,
29889,
8172,
29918,
2127,
2475,
29892,
29871,
29896,
29900,
29892,
29871,
29896,
29892,
29871,
29896,
29892,
16717,
29897,
13,
4706,
11451,
1688,
29889,
336,
4637,
29898,
23818,
29889,
13724,
29990,
2392,
29892,
302,
29916,
29889,
8172,
29918,
2127,
2475,
29892,
29871,
29896,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29889,
29945,
29892,
16717,
29897,
13,
13,
4706,
396,
1574,
1807,
4083,
445,
881,
367,
263,
274,
1008,
29886,
453,
279,
13,
4706,
402,
353,
302,
29916,
29889,
8172,
29918,
2127,
2475,
29898,
29896,
29900,
29892,
29871,
29900,
29889,
29896,
29892,
29871,
29900,
29889,
29900,
29892,
16717,
29897,
13,
4706,
4974,
338,
29918,
29883,
1008,
29886,
453,
279,
29898,
29954,
29897,
13,
13,
4706,
396,
5189,
304,
1284,
16717,
393,
6858,
2846,
14335,
13,
4706,
19359,
353,
302,
29916,
29889,
8172,
29918,
13519,
10653,
29918,
8336,
29918,
16506,
29898,
29896,
29900,
29892,
29871,
29941,
29892,
16717,
29922,
29896,
29946,
29892,
14335,
29922,
29896,
29897,
13,
4706,
402,
353,
302,
29916,
29889,
8172,
29918,
13519,
10653,
29918,
8336,
29898,
29896,
29900,
29892,
29871,
29941,
29892,
16717,
29922,
29896,
29946,
29892,
14335,
29922,
29896,
29897,
13,
13,
1678,
822,
1243,
29918,
700,
284,
29918,
1646,
370,
6840,
29918,
284,
2151,
29898,
1311,
29892,
286,
29896,
29922,
29896,
29892,
286,
29906,
29922,
29946,
29892,
282,
29922,
29900,
29889,
29945,
1125,
13,
4706,
9995,
13,
4706,
4321,
29879,
393,
278,
14581,
350,
29909,
4036,
3983,
5759,
4010,
267,
5718,
2705,
29889,
13,
13,
4706,
4321,
29879,
278,
15283,
526,
10425,
408,
3806,
29889,
13,
13,
4706,
450,
18445,
12623,
526,
10324,
3196,
3064,
304,
5557,
9885,
29891,
528,
1862,
13,
13,
4706,
9995,
13,
4706,
409,
5779,
353,
518,
29946,
29906,
29892,
29871,
29941,
29896,
29946,
29892,
29871,
29906,
29955,
29896,
29947,
29962,
13,
4706,
2847,
29918,
4262,
353,
302,
29916,
29889,
8835,
29918,
4262,
29898,
29896,
29900,
29897,
13,
13,
4706,
363,
16717,
297,
409,
5779,
29901,
13,
13,
9651,
396,
910,
881,
367,
350,
29909,
411,
286,
353,
286,
29896,
13,
9651,
350,
29909,
29896,
353,
302,
29916,
29889,
1646,
370,
6840,
29918,
284,
2151,
29918,
4262,
29898,
29896,
29900,
29900,
29892,
286,
29896,
29892,
16717,
29897,
13,
9651,
360,
5688,
29896,
353,
302,
29916,
29889,
700,
284,
29918,
1646,
370,
6840,
29918,
284,
2151,
29918,
4262,
29898,
29896,
29900,
29900,
29892,
286,
29896,
29892,
286,
29906,
29892,
29871,
29896,
29892,
16717,
29897,
13,
9651,
4974,
350,
29909,
29896,
29889,
287,
2710,
580,
1275,
360,
5688,
29896,
29889,
287,
2710,
580,
13,
13,
9651,
396,
910,
881,
367,
350,
29909,
411,
286,
353,
286,
29906,
13,
9651,
350,
29909,
29906,
353,
302,
29916,
29889,
1646,
370,
6840,
29918,
284,
2151,
29918,
4262,
29898,
29896,
29900,
29900,
29892,
286,
29906,
29892,
16717,
29897,
13,
9651,
360,
5688,
29906,
353,
302,
29916,
29889,
700,
284,
29918,
1646,
370,
6840,
29918,
284,
2151,
29918,
4262,
29898,
29896,
29900,
29900,
29892,
286,
29896,
29892,
286,
29906,
29892,
29871,
29900,
29892,
16717,
29897,
13,
9651,
4974,
350,
29909,
29906,
29889,
287,
2710,
580,
1275,
360,
5688,
29906,
29889,
287,
2710,
580,
13,
13,
9651,
350,
29909,
29941,
353,
302,
29916,
29889,
1646,
370,
6840,
29918,
284,
2151,
29918,
4262,
29898,
29896,
29900,
29900,
29892,
286,
29896,
29892,
16717,
29897,
13,
9651,
360,
5688,
29941,
353,
302,
29916,
29889,
700,
284,
29918,
1646,
370,
6840,
29918,
284,
2151,
29918,
4262,
29898,
29896,
29900,
29900,
29892,
286,
29896,
29892,
286,
29896,
29892,
282,
29892,
16717,
29897,
13,
9651,
396,
1334,
508,
29915,
29873,
7252,
12770,
1244,
1951,
4036,
2264,
338,
376,
25978,
287,
29908,
746,
11580,
13,
9651,
396,
1546,
286,
29896,
322,
286,
29906,
13,
9651,
4974,
350,
29909,
29941,
29889,
2311,
580,
1275,
360,
5688,
29941,
29889,
2311,
580,
13,
13,
9651,
360,
5688,
353,
302,
29916,
29889,
700,
284,
29918,
1646,
370,
6840,
29918,
284,
2151,
29918,
4262,
29898,
29896,
29900,
29900,
29892,
286,
29896,
29892,
286,
29906,
29892,
282,
29892,
16717,
29892,
2847,
29918,
4262,
29897,
13,
9651,
350,
29909,
29896,
353,
302,
29916,
29889,
1646,
370,
6840,
29918,
284,
2151,
29918,
4262,
29898,
29896,
29900,
29900,
29892,
286,
29896,
29892,
16717,
29892,
2847,
29918,
4262,
29897,
13,
9651,
350,
29909,
29906,
353,
302,
29916,
29889,
1646,
370,
6840,
29918,
284,
2151,
29918,
4262,
29898,
29896,
29900,
29900,
29892,
286,
29906,
29892,
16717,
29892,
2847,
29918,
4262,
29897,
13,
9651,
4974,
313,
13,
18884,
1375,
29898,
5688,
29896,
29889,
2311,
3285,
350,
29909,
29906,
29889,
2311,
3101,
5277,
360,
5688,
29889,
2311,
580,
5277,
4236,
29898,
5688,
29896,
29889,
2311,
3285,
350,
29909,
29906,
29889,
2311,
3101,
13,
9651,
1723,
13,
13,
4706,
396,
4321,
292,
15283,
13,
4706,
4833,
351,
353,
302,
29916,
29889,
700,
284,
29918,
1646,
370,
6840,
29918,
284,
2151,
29918,
4262,
13,
4706,
11451,
1688,
29889,
336,
4637,
29898,
23818,
29889,
13724,
29990,
2392,
29892,
4833,
351,
29892,
286,
29896,
29892,
286,
29896,
29892,
286,
29906,
29892,
29871,
29900,
29897,
13,
4706,
11451,
1688,
29889,
336,
4637,
29898,
23818,
29889,
13724,
29990,
2392,
29892,
4833,
351,
29892,
286,
29906,
29892,
286,
29896,
29892,
286,
29906,
29892,
29871,
29900,
29897,
13,
4706,
11451,
1688,
29889,
336,
4637,
29898,
23818,
29889,
13724,
29990,
2392,
29892,
4833,
351,
29892,
29871,
29896,
29900,
29900,
29892,
286,
29896,
29892,
286,
29906,
29892,
448,
29900,
29889,
29945,
29897,
13,
4706,
11451,
1688,
29889,
336,
4637,
29898,
23818,
29889,
13724,
29990,
2392,
29892,
4833,
351,
29892,
29871,
29896,
29900,
29900,
29892,
286,
29896,
29892,
286,
29906,
29892,
29871,
29896,
29889,
29945,
29897,
13,
4706,
2847,
353,
302,
29916,
29889,
8835,
29918,
4262,
29898,
3317,
29898,
29885,
29896,
29892,
286,
29906,
29897,
448,
29871,
29896,
29897,
13,
4706,
11451,
1688,
29889,
336,
4637,
29898,
23818,
29889,
13724,
29990,
2392,
29892,
4833,
351,
29892,
29871,
29896,
29900,
29900,
29892,
286,
29896,
29892,
286,
29906,
29892,
282,
29892,
2847,
29918,
4262,
29922,
11228,
29897,
13,
13,
1678,
822,
1243,
29918,
1062,
2760,
29918,
1646,
370,
6840,
29918,
284,
2151,
29898,
1311,
29892,
286,
29922,
29906,
1125,
13,
4706,
9995,
13,
4706,
4321,
29879,
393,
278,
10410,
350,
29909,
4036,
3983,
5759,
4010,
267,
5718,
2705,
29889,
13,
13,
4706,
4321,
29879,
278,
15283,
526,
10425,
408,
3806,
29889,
13,
13,
4706,
450,
18445,
12623,
526,
10324,
3196,
3064,
304,
5557,
9885,
29891,
29899,
845,
1862,
13,
13,
4706,
9995,
13,
4706,
409,
5779,
353,
518,
29946,
29906,
29892,
29871,
29941,
29896,
29946,
29892,
29871,
29906,
29955,
29896,
29947,
29962,
13,
13,
4706,
363,
16717,
297,
409,
5779,
29901,
13,
9651,
350,
29909,
29918,
4299,
353,
302,
29916,
29889,
1646,
370,
6840,
29918,
284,
2151,
29918,
4262,
29898,
29896,
29900,
29900,
29892,
286,
29892,
16717,
29897,
13,
9651,
350,
29909,
29918,
4299,
29918,
287,
2710,
353,
350,
29909,
29918,
4299,
29889,
4537,
29918,
974,
29918,
287,
2710,
580,
13,
13,
9651,
396,
910,
4010,
267,
925,
763,
350,
29909,
29892,
278,
1353,
310,
12770,
1818,
367,
278,
1021,
13,
9651,
402,
29896,
353,
302,
29916,
29889,
1062,
2760,
29918,
1646,
370,
6840,
29918,
284,
2151,
29918,
4262,
29898,
29896,
29900,
29900,
29892,
286,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
16717,
29897,
13,
9651,
4974,
402,
29896,
29889,
2311,
580,
1275,
350,
29909,
29918,
4299,
29918,
287,
2710,
13,
13,
9651,
396,
5853,
1135,
8951,
901,
12770,
881,
505,
1063,
2715,
13,
9651,
402,
29896,
353,
302,
29916,
29889,
1062,
2760,
29918,
1646,
370,
6840,
29918,
284,
2151,
29918,
4262,
29898,
29896,
29900,
29900,
29892,
286,
29892,
29871,
29900,
29889,
29947,
29892,
29871,
29900,
29892,
16717,
29897,
13,
9651,
4974,
402,
29896,
29889,
2311,
580,
1405,
350,
29909,
29918,
4299,
29918,
287,
2710,
334,
29871,
29906,
13,
13,
9651,
396,
9333,
7636,
337,
29893,
8491,
29892,
577,
278,
1353,
310,
12770,
3109,
1135,
2441,
13,
9651,
402,
29906,
353,
302,
29916,
29889,
1062,
2760,
29918,
1646,
370,
6840,
29918,
284,
2151,
29918,
4262,
29898,
29896,
29900,
29900,
29892,
286,
29892,
29871,
29900,
29892,
29871,
29900,
29889,
29947,
29892,
16717,
29897,
13,
9651,
4974,
402,
29906,
29889,
2311,
580,
1275,
350,
29909,
29918,
4299,
29918,
287,
2710,
13,
13,
9651,
396,
341,
11925,
10483,
29901,
3109,
12770,
1135,
402,
29896,
322,
901,
12770,
1135,
402,
29906,
13,
9651,
402,
29941,
353,
302,
29916,
29889,
1062,
2760,
29918,
1646,
370,
6840,
29918,
284,
2151,
29918,
4262,
29898,
29896,
29900,
29900,
29892,
286,
29892,
29871,
29900,
29889,
29941,
29892,
29871,
29900,
29889,
29941,
29892,
16717,
29897,
13,
9651,
4974,
402,
29941,
29889,
2311,
580,
1405,
402,
29906,
29889,
2311,
580,
13,
9651,
4974,
402,
29941,
29889,
2311,
580,
529,
402,
29896,
29889,
2311,
580,
13,
13,
4706,
396,
4321,
292,
15283,
13,
4706,
18230,
351,
353,
302,
29916,
29889,
1062,
2760,
29918,
1646,
370,
6840,
29918,
284,
2151,
29918,
4262,
13,
4706,
11451,
1688,
29889,
336,
4637,
29898,
23818,
29889,
13724,
29990,
2392,
29892,
18230,
351,
29892,
286,
29892,
286,
29892,
29871,
29900,
29892,
29871,
29900,
29897,
13,
4706,
11451,
1688,
29889,
336,
4637,
29898,
23818,
29889,
13724,
29990,
2392,
29892,
18230,
351,
29892,
29871,
29896,
29892,
29871,
29900,
29889,
29945,
29892,
29871,
29900,
29892,
29871,
29900,
29897,
13,
4706,
11451,
1688,
29889,
336,
4637,
29898,
23818,
29889,
13724,
29990,
2392,
29892,
18230,
351,
29892,
29871,
29896,
29900,
29900,
29892,
29871,
29906,
29892,
29871,
29900,
29889,
29945,
29892,
29871,
29900,
29889,
29945,
29897,
13,
13,
1678,
822,
1243,
29918,
8172,
29918,
9171,
29918,
15227,
29918,
4262,
29898,
1311,
1125,
13,
4706,
9995,
24376,
393,
263,
29871,
29900,
29899,
15227,
3983,
756,
278,
1959,
1353,
310,
7573,
322,
13,
4706,
12770,
29889,
13,
13,
4706,
9995,
13,
4706,
16717,
353,
29871,
29946,
29906,
13,
4706,
402,
353,
302,
29916,
29889,
8172,
29918,
15227,
29918,
4262,
29898,
29900,
29892,
29871,
29896,
29900,
29892,
16717,
29897,
13,
4706,
4974,
7431,
29898,
29954,
29897,
1275,
29871,
29896,
29900,
13,
4706,
4974,
402,
29889,
4537,
29918,
974,
29918,
287,
2710,
580,
1275,
29871,
29900,
13,
13,
1678,
822,
1243,
29918,
5138,
29885,
29898,
1311,
1125,
13,
4706,
402,
353,
302,
29916,
29889,
5138,
29885,
29918,
8172,
29918,
4262,
29898,
29896,
29900,
29892,
29871,
29941,
29897,
13,
4706,
4974,
7431,
29898,
29954,
29897,
1275,
29871,
29896,
29900,
13,
4706,
4974,
402,
29889,
4537,
29918,
974,
29918,
287,
2710,
580,
1275,
29871,
29941,
13,
13,
4706,
402,
353,
302,
29916,
29889,
5138,
29885,
29918,
8172,
29918,
4262,
29898,
29896,
29900,
29892,
29871,
29941,
29892,
16717,
29922,
29946,
29906,
29897,
13,
4706,
4974,
7431,
29898,
29954,
29897,
1275,
29871,
29896,
29900,
13,
4706,
4974,
402,
29889,
4537,
29918,
974,
29918,
287,
2710,
580,
1275,
29871,
29941,
13,
13,
4706,
402,
353,
302,
29916,
29889,
5138,
29885,
29918,
8172,
29918,
4262,
29898,
29896,
29900,
29892,
29871,
29896,
29900,
29900,
29897,
13,
4706,
4974,
7431,
29898,
29954,
29897,
1275,
29871,
29896,
29900,
13,
4706,
4974,
402,
29889,
4537,
29918,
974,
29918,
287,
2710,
580,
1275,
29871,
29946,
29945,
13,
13,
4706,
402,
353,
302,
29916,
29889,
5138,
29885,
29918,
8172,
29918,
4262,
29898,
29896,
29900,
29892,
29871,
29896,
29900,
29900,
29892,
10624,
29922,
5574,
29897,
13,
4706,
4974,
7431,
29898,
29954,
29897,
1275,
29871,
29896,
29900,
13,
4706,
4974,
402,
29889,
4537,
29918,
974,
29918,
287,
2710,
580,
1275,
29871,
29929,
29900,
13,
13,
4706,
402,
353,
302,
29916,
29889,
5138,
29885,
29918,
8172,
29918,
4262,
29898,
29896,
29900,
29892,
448,
29896,
29889,
29896,
29897,
13,
4706,
4974,
7431,
29898,
29954,
29897,
1275,
29871,
29896,
29900,
13,
4706,
4974,
402,
29889,
4537,
29918,
974,
29918,
287,
2710,
580,
1275,
29871,
29900,
13,
13,
1678,
822,
1243,
29918,
29893,
1131,
29879,
29918,
303,
9102,
4101,
29918,
3752,
29918,
29895,
29898,
1311,
1125,
13,
4706,
396,
4321,
304,
1207,
1854,
1135,
302,
5277,
413,
13,
4706,
11451,
1688,
29889,
336,
4637,
29898,
23818,
29889,
13724,
29990,
2392,
29892,
302,
29916,
29889,
29893,
1131,
29879,
29918,
303,
9102,
4101,
29918,
4262,
29892,
29871,
29896,
29900,
29892,
29871,
29896,
29896,
29892,
29871,
29900,
29889,
29906,
29945,
29897,
13,
4706,
11451,
1688,
29889,
336,
4637,
29898,
23818,
29889,
13724,
29990,
2392,
29892,
302,
29916,
29889,
1482,
1171,
29918,
29893,
1131,
29879,
29918,
303,
9102,
4101,
29918,
4262,
29892,
29871,
29896,
29900,
29892,
29871,
29896,
29896,
29892,
29871,
29900,
29889,
29906,
29945,
29897,
13,
13,
4706,
396,
1033,
1653,
385,
10362,
2425,
29892,
1286,
1838,
29915,
29873,
13,
4706,
396,
10362,
2425,
1304,
304,
6403,
746,
263,
2943,
756,
7426,
302,
29899,
29896,
322,
4225,
304,
337,
22376,
13,
4706,
302,
29916,
29889,
29893,
1131,
29879,
29918,
303,
9102,
4101,
29918,
4262,
29898,
29896,
29900,
29892,
29871,
29929,
29892,
29871,
29900,
29889,
29906,
29945,
29892,
16717,
29922,
29900,
29897,
13,
4706,
302,
29916,
29889,
1482,
1171,
29918,
29893,
1131,
29879,
29918,
303,
9102,
4101,
29918,
4262,
29898,
29896,
29900,
29892,
29871,
29929,
29892,
29871,
29900,
29889,
29945,
29892,
16717,
29922,
29900,
29897,
13,
13,
4706,
396,
4321,
413,
1360,
29876,
10483,
13,
4706,
302,
29916,
29889,
29893,
1131,
29879,
29918,
303,
9102,
4101,
29918,
4262,
29898,
29896,
29900,
29892,
29871,
29896,
29900,
29892,
29871,
29900,
29889,
29906,
29945,
29892,
16717,
29922,
29900,
29897,
13,
4706,
302,
29916,
29889,
1482,
1171,
29918,
29893,
1131,
29879,
29918,
303,
9102,
4101,
29918,
4262,
29898,
29896,
29900,
29892,
29871,
29896,
29900,
29892,
29871,
29900,
29889,
29906,
29945,
29892,
16717,
29922,
29900,
29897,
13,
13,
1678,
822,
1243,
29918,
8172,
29918,
17460,
29918,
4262,
29898,
1311,
1125,
13,
4706,
822,
10160,
29898,
29884,
29892,
281,
29892,
503,
1125,
13,
9651,
736,
274,
334,
313,
29920,
448,
281,
29897,
13,
13,
4706,
822,
3876,
29898,
29884,
29892,
281,
29892,
364,
1125,
13,
9651,
736,
364,
847,
274,
718,
281,
13,
13,
4706,
274,
353,
29871,
29896,
13,
4706,
3983,
353,
302,
29916,
29889,
8172,
29918,
17460,
29918,
4262,
29898,
29896,
29900,
29900,
29900,
29892,
10160,
29892,
3876,
29897,
13,
4706,
3983,
353,
302,
29916,
29889,
8172,
29918,
17460,
29918,
4262,
29898,
29896,
29900,
29900,
29900,
29892,
10160,
29892,
3876,
29892,
16717,
29922,
29946,
29906,
29897,
13,
4706,
4974,
7431,
29898,
4262,
29897,
1275,
29871,
29896,
29900,
29900,
29900,
13,
2
] |
Problem116.py | Cleancode404/ProjectEuler | 0 | 132878 | <filename>Problem116.py
"""
Red, green or blue tiles
"""
def f(m, n):
ways = [0] * (n + 1)
for i in range(m):
ways[i] = 1
for i in range(m, n + 1):
ways[i] += ways[i - 1] + ways[i - m]
return ways[n] - 1
if __name__ == '__main__':
print(f(2, 50) + f(3, 50) + f(4, 50)) | [
1,
529,
9507,
29958,
26604,
29896,
29896,
29953,
29889,
2272,
13,
15945,
29908,
13,
9039,
29892,
7933,
470,
7254,
260,
5475,
13,
15945,
29908,
13,
13,
1753,
285,
29898,
29885,
29892,
302,
1125,
13,
1678,
5837,
353,
518,
29900,
29962,
334,
313,
29876,
718,
29871,
29896,
29897,
13,
1678,
363,
474,
297,
3464,
29898,
29885,
1125,
13,
4706,
5837,
29961,
29875,
29962,
353,
29871,
29896,
13,
1678,
363,
474,
297,
3464,
29898,
29885,
29892,
302,
718,
29871,
29896,
1125,
13,
4706,
5837,
29961,
29875,
29962,
4619,
5837,
29961,
29875,
448,
29871,
29896,
29962,
718,
5837,
29961,
29875,
448,
286,
29962,
13,
1678,
736,
5837,
29961,
29876,
29962,
448,
29871,
29896,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
1596,
29898,
29888,
29898,
29906,
29892,
29871,
29945,
29900,
29897,
718,
285,
29898,
29941,
29892,
29871,
29945,
29900,
29897,
718,
285,
29898,
29946,
29892,
29871,
29945,
29900,
876,
2
] |
app.py | ialjumah/python-helloworld | 0 | 40486 | <filename>app.py
Volume in drive C has no label.
Volume Serial Number is 30AD-FC05
Directory of C:\Users\HP\Documents\nd064_course_1-main\solutions\python-helloworld
13/07/2021 14:33 <DIR> .
13/07/2021 14:33 <DIR> ..
13/07/2021 14:34 0 app.log
13/07/2021 14:34 0 app.py
10/07/2021 23:21 175 Dockerfile
13/07/2021 14:33 159 listing
11/07/2021 13:34 485 requirements.txt
10/07/2021 23:21 94 test_with_pytest.py
11/07/2021 00:22 <DIR> __pycache__
6 File(s) 913 bytes
3 Dir(s) 42,745,831,424 bytes free
| [
1,
529,
9507,
29958,
932,
29889,
2272,
13,
16934,
297,
7899,
315,
756,
694,
3858,
22993,
13,
16934,
18896,
9681,
338,
29871,
29941,
29900,
3035,
29899,
8610,
29900,
29945,
30004,
13,
30004,
13,
18862,
310,
315,
3583,
5959,
29905,
3954,
29905,
20128,
29905,
299,
29900,
29953,
29946,
29918,
15775,
29918,
29896,
29899,
3396,
29905,
2929,
17925,
29905,
4691,
29899,
29882,
4743,
1613,
30004,
13,
30004,
13,
29896,
29941,
29914,
29900,
29955,
29914,
29906,
29900,
29906,
29896,
259,
29896,
29946,
29901,
29941,
29941,
1678,
529,
9464,
29958,
3986,
869,
30004,
13,
29896,
29941,
29914,
29900,
29955,
29914,
29906,
29900,
29906,
29896,
259,
29896,
29946,
29901,
29941,
29941,
1678,
529,
9464,
29958,
3986,
6317,
30004,
13,
29896,
29941,
29914,
29900,
29955,
29914,
29906,
29900,
29906,
29896,
259,
29896,
29946,
29901,
29941,
29946,
462,
29871,
29900,
623,
29889,
1188,
30004,
13,
29896,
29941,
29914,
29900,
29955,
29914,
29906,
29900,
29906,
29896,
259,
29896,
29946,
29901,
29941,
29946,
462,
29871,
29900,
623,
29889,
2272,
30004,
13,
29896,
29900,
29914,
29900,
29955,
29914,
29906,
29900,
29906,
29896,
259,
29906,
29941,
29901,
29906,
29896,
18884,
29896,
29955,
29945,
20868,
1445,
30004,
13,
29896,
29941,
29914,
29900,
29955,
29914,
29906,
29900,
29906,
29896,
259,
29896,
29946,
29901,
29941,
29941,
18884,
29896,
29945,
29929,
18028,
30004,
13,
29896,
29896,
29914,
29900,
29955,
29914,
29906,
29900,
29906,
29896,
259,
29896,
29941,
29901,
29941,
29946,
18884,
29946,
29947,
29945,
11780,
29889,
3945,
30004,
13,
29896,
29900,
29914,
29900,
29955,
29914,
29906,
29900,
29906,
29896,
259,
29906,
29941,
29901,
29906,
29896,
462,
29929,
29946,
1243,
29918,
2541,
29918,
2272,
1688,
29889,
2272,
30004,
13,
29896,
29896,
29914,
29900,
29955,
29914,
29906,
29900,
29906,
29896,
259,
29900,
29900,
29901,
29906,
29906,
1678,
529,
9464,
29958,
3986,
4770,
2272,
8173,
1649,
30004,
13,
18884,
29953,
3497,
29898,
29879,
29897,
632,
29929,
29896,
29941,
6262,
30004,
13,
18884,
29941,
19378,
29898,
29879,
29897,
259,
29946,
29906,
29892,
29955,
29946,
29945,
29892,
29947,
29941,
29896,
29892,
29946,
29906,
29946,
6262,
3889,
30004,
13,
2
] |
grafana/common/dashboards/aggregated/client_subnet_statistics_detail.py | MikeAT/visualizer | 6 | 11476 | # Copyright 2021 Internet Corporation for Assigned Names and Numbers.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, you can obtain one at https://mozilla.org/MPL/2.0/.
#
# Developed by Sinodun IT (sinodun.com)
#
# Aggregation client subnet statistics
import textwrap
import grafanalib.core as GCore
import grafanacommon as GCommon
def query_classification_chart(chart_title, yaxis_label, prefix_field, agginfo, nodesel):
return GCommon.BarChart(
title = chart_title,
orientation = GCommon.BAR_CHART_ORIENTATION_HORIZONTAL,
layout = GCommon.BarChartLayout(
barmode = GCommon.BAR_CHART_LAYOUT_MODE_STACK,
showlegend = True,
xaxis = GCommon.BarChartAxis(
title = 'Queries per second',
),
yaxis = GCommon.BarChartAxis(
autotick = False,
axtype = GCommon.BAR_CHART_AXIS_TYPE_CATEGORY,
tickmargin = 110,
title = yaxis_label,
),
),
traces = [
GCommon.BarChartTrace(
name = 'AForA',
x = 'AForA',
y = 'AForAPrefix',
text = 'AForA',
),
GCommon.BarChartTrace(
name = 'AForRoot',
x = 'AForRoot',
y = 'AForRootPrefix',
text = 'AForRoot',
),
GCommon.BarChartTrace(
name = 'FunnyQueryClass',
x = 'FunnyQueryClass',
y = 'FunnyQueryClassPrefix',
text = 'FunnyQueryClass',
),
GCommon.BarChartTrace(
name = 'FunnyQueryType',
x = 'FunnyQueryType',
y = 'FunnyQueryTypePrefix',
text = 'FunnyQueryType',
),
GCommon.BarChartTrace(
name = 'Localhost',
x = 'Localhost',
y = 'LocalhostPrefix',
text = 'Localhost',
),
GCommon.BarChartTrace(
name = 'NonAuthTld',
x = 'NonAuthTld',
y = 'NonAuthTldPrefix',
text = 'NonAuthTld',
),
GCommon.BarChartTrace(
name = 'Ok',
x = 'Ok',
y = 'OkPrefix',
text = 'Ok',
),
GCommon.BarChartTrace(
name = 'RFC1918Ptr',
x = 'RFC1918Ptr',
y = 'RFC1918PtrPrefix',
text = 'RFC1918Ptr',
),
GCommon.BarChartTrace(
name = 'RootServersNet',
x = 'RootServersNet',
y = 'RootServersNetPrefix',
text = 'RootServersNet',
),
GCommon.BarChartTrace(
name = 'SrcPortZero',
x = 'SrcPortZero',
y = 'SrcPortZeroPrefix',
text = 'SrcPortZero',
),
],
targets = [
GCommon.ClickHouseTableTarget(
database = agginfo['database'],
table = 'QueryClassifications' + agginfo['table_suffix'],
round = agginfo['round'],
query = textwrap.dedent("""\
SELECT
Prefix AS AForAPrefix,
AForA,
Count
FROM
(
SELECT
{prefix_field} AS Prefix,
sum(Count) AS Count,
sum(AForACount)/($to - $from) AS AForA
FROM $table
WHERE $timeFilter
AND NodeID IN {nodesel}
GROUP BY Prefix
ORDER BY Count DESC
LIMIT 40
)
ORDER BY Count ASC
""".format(
prefix_field=prefix_field,
nodesel=nodesel,
nodeinfo_database=agginfo['nodeinfo_database'])),
refId = 'A'
),
GCommon.ClickHouseTableTarget(
database = agginfo['database'],
table = 'QueryClassifications' + agginfo['table_suffix'],
round = agginfo['round'],
query = textwrap.dedent("""\
SELECT
Prefix AS AForRootPrefix,
AForRoot,
Count
FROM
(
SELECT
{prefix_field} AS Prefix,
sum(Count) AS Count,
sum(AForRootCount)/($to - $from) AS AForRoot
FROM $table
WHERE $timeFilter
AND NodeID IN {nodesel}
GROUP BY Prefix
ORDER BY Count DESC
LIMIT 40
)
ORDER BY Count ASC
""".format(
prefix_field=prefix_field,
nodesel=nodesel,
nodeinfo_database=agginfo['nodeinfo_database'])),
refId = 'B'
),
GCommon.ClickHouseTableTarget(
database = agginfo['database'],
table = 'QueryClassifications' + agginfo['table_suffix'],
round = agginfo['round'],
query = textwrap.dedent("""\
SELECT
Prefix AS FunnyQueryClassPrefix,
FunnyQueryClass,
Count
FROM
(
SELECT
{prefix_field} AS Prefix,
sum(Count) AS Count,
sum(FunnyQueryClassCount)/($to - $from) AS FunnyQueryClass
FROM $table
WHERE $timeFilter
AND NodeID IN {nodesel}
GROUP BY Prefix
ORDER BY Count DESC
LIMIT 40
)
ORDER BY Count ASC
""".format(
prefix_field=prefix_field,
nodesel=nodesel,
nodeinfo_database=agginfo['nodeinfo_database'])),
refId = 'C'
),
GCommon.ClickHouseTableTarget(
database = agginfo['database'],
table = 'QueryClassifications' + agginfo['table_suffix'],
round = agginfo['round'],
query = textwrap.dedent("""\
SELECT
Prefix AS FunnyQueryTypePrefix,
FunnyQueryType,
Count
FROM
(
SELECT
{prefix_field} AS Prefix,
sum(Count) AS Count,
sum(FunnyQueryTypeCount)/($to - $from) AS FunnyQueryType
FROM $table
WHERE $timeFilter
AND NodeID IN {nodesel}
GROUP BY Prefix
ORDER BY Count DESC
LIMIT 40
)
ORDER BY Count DESC
""".format(
prefix_field=prefix_field,
nodesel=nodesel,
nodeinfo_database=agginfo['nodeinfo_database'])),
refId = 'D'
),
GCommon.ClickHouseTableTarget(
database = agginfo['database'],
table = 'QueryClassifications' + agginfo['table_suffix'],
round = agginfo['round'],
query = textwrap.dedent("""\
SELECT
Prefix AS LocalhostPrefix,
Localhost,
Count
FROM
(
SELECT
{prefix_field} AS Prefix,
sum(Count) AS Count,
sum(LocalhostCount)/($to - $from) AS Localhost
FROM $table
WHERE $timeFilter
AND NodeID IN {nodesel}
GROUP BY Prefix
ORDER BY Count DESC
LIMIT 40
)
ORDER BY Count ASC
""".format(
prefix_field=prefix_field,
nodesel=nodesel,
nodeinfo_database=agginfo['nodeinfo_database'])),
refId = 'E'
),
GCommon.ClickHouseTableTarget(
database = agginfo['database'],
table = 'QueryClassifications' + agginfo['table_suffix'],
round = agginfo['round'],
query = textwrap.dedent("""\
SELECT
Prefix AS NonAuthTldPrefix,
NonAuthTld,
Count
FROM
(
SELECT
{prefix_field} AS Prefix,
sum(Count) AS Count,
sum(NonAuthTldCount)/($to - $from) AS NonAuthTld
FROM $table
WHERE $timeFilter
AND NodeID IN {nodesel}
GROUP BY Prefix
ORDER BY Count DESC
LIMIT 40
)
ORDER BY Count ASC
""".format(
prefix_field=prefix_field,
nodesel=nodesel,
nodeinfo_database=agginfo['nodeinfo_database'])),
refId = 'F'
),
GCommon.ClickHouseTableTarget(
database = agginfo['database'],
table = 'QueryClassifications' + agginfo['table_suffix'],
round = agginfo['round'],
query = textwrap.dedent("""\
SELECT
Prefix AS OkPrefix,
Ok,
TotalCount
FROM
(
SELECT
{prefix_field} AS Prefix,
sum(Count) AS TotalCount,
sum(Count -
(AForACount +
AForRootCount +
FunnyQueryClassCount +
FunnyQueryTypeCount +
LocalhostCount +
NonAuthTldCount +
RFC1918PtrCount +
RootServersNetCount +
SrcPortZeroCount))/($to - $from) AS Ok
FROM $table
WHERE $timeFilter
AND NodeID IN {nodesel}
GROUP BY Prefix
ORDER BY TotalCount DESC
LIMIT 40
)
ORDER BY TotalCount ASC
""".format(
prefix_field=prefix_field,
nodesel=nodesel,
nodeinfo_database=agginfo['nodeinfo_database'])),
refId = 'G'
),
GCommon.ClickHouseTableTarget(
database = agginfo['database'],
table = 'QueryClassifications' + agginfo['table_suffix'],
round = agginfo['round'],
query = textwrap.dedent("""\
SELECT
Prefix AS RFC1918PtrPrefix,
RFC1918Ptr,
Count
FROM
(
SELECT
{prefix_field} AS Prefix,
sum(Count) AS Count,
sum(RFC1918PtrCount)/($to - $from) AS RFC1918Ptr
FROM $table
WHERE $timeFilter
AND NodeID IN {nodesel}
GROUP BY Prefix
ORDER BY Count DESC
LIMIT 40
)
ORDER BY Count ASC
""".format(
prefix_field=prefix_field,
nodesel=nodesel,
nodeinfo_database=agginfo['nodeinfo_database'])),
refId = 'H'
),
GCommon.ClickHouseTableTarget(
database = agginfo['database'],
table = 'QueryClassifications' + agginfo['table_suffix'],
round = agginfo['round'],
query = textwrap.dedent("""\
SELECT
Prefix AS RootServersNetPrefix,
RootServersNet,
Count
FROM
(
SELECT
{prefix_field} AS Prefix,
sum(Count) AS Count,
sum(RootServersNetCount)/($to - $from) AS RootServersNet
FROM $table
WHERE $timeFilter
AND NodeID IN {nodesel}
GROUP BY Prefix
ORDER BY Count DESC
LIMIT 40
)
ORDER BY Count ASC
""".format(
prefix_field=prefix_field,
nodesel=nodesel,
nodeinfo_database=agginfo['nodeinfo_database'])),
refId = 'I'
),
GCommon.ClickHouseTableTarget(
database = agginfo['database'],
table = 'QueryClassifications' + agginfo['table_suffix'],
round = agginfo['round'],
query = textwrap.dedent("""\
SELECT
Prefix AS SrcPortZeroPrefix,
SrcPortZero,
Count
FROM
(
SELECT
{prefix_field} AS Prefix,
sum(Count) AS Count,
sum(SrcPortZeroCount)/($to - $from) AS SrcPortZero
FROM $table
WHERE $timeFilter
AND NodeID IN {nodesel}
GROUP BY Prefix
ORDER BY Count DESC
LIMIT 40
)
ORDER BY Count ASC
""".format(
prefix_field=prefix_field,
nodesel=nodesel,
nodeinfo_database=agginfo['nodeinfo_database'])),
refId = 'J'
),
],
)
def dash(myuid, agginfo, nodesel, **kwargs):
return GCommon.Dashboard(
title = "Client subnet statistics detail",
tags = [
agginfo['graph_tag']
],
uid = myuid,
rows = [
GCore.Row(
height = GCore.Pixels(50),
panels = [
GCommon.HTMLPanel('grafana/common/dashboards/aggregated/client_subnet_statistics_header.html', transparent=True),
],
),
GCore.Row(
height = GCore.Pixels(GCore.DEFAULT_ROW_HEIGHT.num * 2),
panels = [
GCommon.BarChart(
title = 'Clients by fixed subnet',
orientation = GCommon.BAR_CHART_ORIENTATION_HORIZONTAL,
layout = GCommon.BarChartLayout(
xaxis = GCommon.BarChartAxis(
title = 'Queries per second',
),
yaxis = GCommon.BarChartAxis(
autotick = False,
axtype = GCommon.BAR_CHART_AXIS_TYPE_CATEGORY,
tickmargin = 110,
title = 'Fixed Subnet',
),
),
traces = [
GCommon.BarChartTrace(
name = 'Subnet',
color = '#A352CC',
x = 'QPS',
y = 'Subnet',
text = 'QPS',
),
],
targets = [
GCommon.ClickHouseTableTarget(
database = agginfo['database'],
table = 'BusiestClientSubnets' + agginfo['table_suffix'],
round = agginfo['round'],
query = textwrap.dedent("""\
SELECT
Subnet,
QPS
FROM
(
SELECT
Prefix AS Subnet,
sum(Count)/($to - $from) AS QPS
FROM $table
WHERE $timeFilter
AND NodeID IN {nodesel}
GROUP BY Prefix
ORDER BY QPS DESC
LIMIT 30
)
ORDER BY QPS ASC""".format(
nodesel=nodesel)),
refId = 'A'
)
],
),
],
),
GCore.Row(
height = GCore.Pixels(GCore.DEFAULT_ROW_HEIGHT.num * 2),
panels = [
GCommon.BarChart(
title = 'RCODE by clients by ASN',
orientation = GCommon.BAR_CHART_ORIENTATION_HORIZONTAL,
layout = GCommon.BarChartLayout(
barmode = GCommon.BAR_CHART_LAYOUT_MODE_STACK,
showlegend = True,
xaxis = GCommon.BarChartAxis(
title = 'Queries per second',
),
yaxis = GCommon.BarChartAxis(
autotick = False,
axtype = GCommon.BAR_CHART_AXIS_TYPE_CATEGORY,
tickmargin = 110,
title = 'ASN',
),
),
autotrace = True,
targets = [
GCommon.ClickHouseTableTarget(
database = agginfo['database'],
table = 'BusiestClientSubnets' + agginfo['table_suffix'],
round = agginfo['round'],
query = textwrap.dedent("""\
SELECT
notEmpty(rcodeText) ? rcodeText : concat('RCODE', toString(rcode)) AS DisplayRcode,
sum(rcodeCount) / ($to - $from) AS rcodeCount,
ClientASN
FROM
(
SELECT
ClientASN,
rcode,
sum(rcodeCount) AS rcodeCount,
any(sCount) AS sCount
FROM
(
SELECT
ClientASN,
sum(RcodeMap.Count) AS sCount
FROM $table
ARRAY JOIN RcodeMap
WHERE $timeFilter
AND NodeID IN {nodesel}
GROUP BY
ClientASN
ORDER BY sCount DESC, ClientASN ASC
LIMIT 30
) AS ClientASNCounts
ALL LEFT JOIN
(
SELECT
ClientASN,
RcodeMap.ResponseRcode AS rcode,
sum(RcodeMap.Count) AS rcodeCount
FROM $table
ARRAY JOIN RcodeMap
WHERE
$timeFilter
AND NodeID IN {nodesel}
GROUP BY
ClientASN,
rcode
UNION ALL
(
SELECT
ClientASN,
rcode,
CAST(0 AS UInt64) AS rcodeCount
FROM
(
SELECT
0 AS Zero,
ClientASN
FROM $table
WHERE
$timeFilter
AND NodeID IN {nodesel}
GROUP BY ClientASN
) AS ZeroClientASN
ALL LEFT JOIN
(
SELECT
0 AS Zero,
RcodeMap.ResponseRcode AS rcode
FROM $table
ARRAY JOIN RcodeMap
WHERE
$timeFilter
AND NodeID IN {nodesel}
GROUP BY rcode
) AS ZeroRcode USING Zero
)
) AS ClientASNRcodeCounts USING ClientASN
GROUP BY
ClientASN,
rcode
) AS ClientASNRcodeCountsTotal
ALL INNER JOIN
(
SELECT
value_name AS rcodeText,
toUInt16(value) AS rcode
FROM {nodeinfo_database}.iana_text
WHERE registry_name = 'RCODE'
) AS ClientASNNameCountsTotal USING rcode
GROUP BY
ClientASN,
rcode,
rcodeText
ORDER BY
sum(sCount) ASC,
rcodeText ASC,
ClientASN DESC""".format(
nodesel=nodesel,
nodeinfo_database=agginfo['nodeinfo_database'])),
refId = 'A'
)
],
),
],
),
GCore.Row(
height = GCore.Pixels(GCore.DEFAULT_ROW_HEIGHT.num * 2),
panels = [
GCommon.BarChart(
title = 'RCODE by clients by AS subnet',
orientation = GCommon.BAR_CHART_ORIENTATION_HORIZONTAL,
layout = GCommon.BarChartLayout(
barmode = GCommon.BAR_CHART_LAYOUT_MODE_STACK,
showlegend = True,
xaxis = GCommon.BarChartAxis(
title = 'Queries per second',
),
yaxis = GCommon.BarChartAxis(
autotick = False,
axtype = GCommon.BAR_CHART_AXIS_TYPE_CATEGORY,
tickmargin = 110,
title = 'AS Subnet',
),
),
autotrace = True,
targets = [
GCommon.ClickHouseTableTarget(
database = agginfo['database'],
table = 'BGPPrefix' + agginfo['table_suffix'],
round = agginfo['round'],
query = textwrap.dedent("""\
SELECT
notEmpty(rcodeText) ? rcodeText : concat('RCODE', toString(rcode)) AS DisplayRcode,
sum(rcodeCount) / ($to - $from) AS rcodeCount,
Prefix
FROM
(
SELECT
Prefix,
rcode,
sum(rcodeCount) AS rcodeCount,
any(sCount) AS sCount
FROM
(
SELECT
Prefix,
sum(RcodeMap.Count) AS sCount
FROM $table
ARRAY JOIN RcodeMap
WHERE $timeFilter
AND NodeID IN {nodesel}
GROUP BY
Prefix
ORDER BY sCount DESC, Prefix ASC
LIMIT 30
) AS PrefixCount
ALL LEFT JOIN
(
SELECT
Prefix,
RcodeMap.ResponseRcode AS rcode,
sum(RcodeMap.Count) AS rcodeCount
FROM $table
ARRAY JOIN RcodeMap
WHERE
$timeFilter
AND NodeID IN {nodesel}
GROUP BY
Prefix,
rcode
UNION ALL
(
SELECT
Prefix,
rcode,
CAST(0 AS UInt64) AS rcodeCount
FROM
(
SELECT
0 AS Zero,
Prefix
FROM $table
WHERE
$timeFilter
AND NodeID IN {nodesel}
GROUP BY Prefix
) AS ZeroPrefox
ALL LEFT JOIN
(
SELECT
0 AS Zero,
RcodeMap.ResponseRcode AS rcode
FROM $table
ARRAY JOIN RcodeMap
WHERE
$timeFilter
AND NodeID IN {nodesel}
GROUP BY rcode
) AS ZeroRcode USING Zero
)
) AS PrefixRcodeCounts USING Prefix
GROUP BY
Prefix,
rcode
) AS PrefixRcodeCountsTotal
ALL INNER JOIN
(
SELECT
value_name AS rcodeText,
toUInt16(value) AS rcode
FROM {nodeinfo_database}.iana_text
WHERE registry_name = 'RCODE'
) AS PrefixNameCountsTotal USING rcode
GROUP BY
Prefix,
rcode,
rcodeText
ORDER BY
sum(sCount) ASC,
rcodeText ASC,
Prefix DESC""".format(
nodesel=nodesel,
nodeinfo_database=agginfo['nodeinfo_database'])),
refId = 'A'
)
],
),
],
),
GCore.Row(
height = GCore.Pixels(GCore.DEFAULT_ROW_HEIGHT.num * 2),
panels = [
GCommon.BarChart(
title = 'RCODE by clients by fixed subnet',
orientation = GCommon.BAR_CHART_ORIENTATION_HORIZONTAL,
layout = GCommon.BarChartLayout(
barmode = GCommon.BAR_CHART_LAYOUT_MODE_STACK,
showlegend = True,
xaxis = GCommon.BarChartAxis(
title = 'Queries per second',
),
yaxis = GCommon.BarChartAxis(
autotick = False,
axtype = GCommon.BAR_CHART_AXIS_TYPE_CATEGORY,
tickmargin = 110,
title = 'Fixed Subnet',
),
),
autotrace = True,
targets = [
GCommon.ClickHouseTableTarget(
database = agginfo['database'],
table = 'BusiestClientSubnets' + agginfo['table_suffix'],
round = agginfo['round'],
query = textwrap.dedent("""\
SELECT
notEmpty(rcodeText) ? rcodeText : concat('RCODE', toString(rcode)) AS DisplayRcode,
sum(rcodeCount) / ($to - $from) AS rcodeCount,
Prefix
FROM
(
SELECT
Prefix,
rcode,
sum(rcodeCount) AS rcodeCount,
any(sCount) AS sCount
FROM
(
SELECT
Prefix,
sum(RcodeMap.Count) AS sCount
FROM $table
ARRAY JOIN RcodeMap
WHERE $timeFilter
AND NodeID IN {nodesel}
GROUP BY
Prefix
ORDER BY sCount DESC, Prefix ASC
LIMIT 30
) AS PrefixCount
ALL LEFT JOIN
(
SELECT
Prefix,
RcodeMap.ResponseRcode AS rcode,
sum(RcodeMap.Count) AS rcodeCount
FROM $table
ARRAY JOIN RcodeMap
WHERE
$timeFilter
AND NodeID IN {nodesel}
GROUP BY
Prefix,
rcode
UNION ALL
(
SELECT
Prefix,
rcode,
CAST(0 AS UInt64) AS rcodeCount
FROM
(
SELECT
0 AS Zero,
Prefix
FROM $table
WHERE
$timeFilter
AND NodeID IN {nodesel}
GROUP BY Prefix
) AS ZeroPrefix
ALL LEFT JOIN
(
SELECT
0 AS Zero,
RcodeMap.ResponseRcode AS rcode
FROM $table
ARRAY JOIN RcodeMap
WHERE
$timeFilter
AND NodeID IN {nodesel}
GROUP BY rcode
) AS ZeroRcode USING Zero
)
) AS PrefixRcodeCounts USING Prefix
GROUP BY
Prefix,
rcode
) AS PrefixRcodeCountsTotal
ALL INNER JOIN
(
SELECT
value_name AS rcodeText,
toUInt16(value) AS rcode
FROM {nodeinfo_database}.iana_text
WHERE registry_name = 'RCODE'
) AS PrefixNameCountsTotal USING rcode
GROUP BY
Prefix,
rcode,
rcodeText
ORDER BY
sum(sCount) ASC,
rcodeText ASC,
Prefix DESC""".format(
nodesel=nodesel,
nodeinfo_database=agginfo['nodeinfo_database'])),
refId = 'A'
)
],
),
],
),
GCore.Row(
height = GCore.Pixels(GCore.DEFAULT_ROW_HEIGHT.num * 2),
panels = [
GCommon.BarChart(
title = 'Root abusers by fixed subnet',
orientation = GCommon.BAR_CHART_ORIENTATION_HORIZONTAL,
layout = GCommon.BarChartLayout(
xaxis = GCommon.BarChartAxis(
title = 'Queries per second',
),
yaxis = GCommon.BarChartAxis(
autotick = False,
axtype = GCommon.BAR_CHART_AXIS_TYPE_CATEGORY,
tickmargin = 110,
title = 'Fixed Subnet',
),
),
traces = [
GCommon.BarChartTrace(
name = 'Subnet',
color = '#A352CC',
x = 'QPS',
y = 'Subnet',
text = 'QPS',
),
],
targets = [
GCommon.ClickHouseTableTarget(
database = agginfo['database'],
table = 'QueryClassifications' + agginfo['table_suffix'],
round = agginfo['round'],
query = textwrap.dedent("""\
SELECT
Subnet,
QPS
FROM
(
SELECT
FixedPrefix AS Subnet,
sum(RootAbuseCount)/($to - $from) AS QPS
FROM $table
WHERE $timeFilter
AND NodeID IN {nodesel}
GROUP BY FixedPrefix
ORDER BY QPS DESC
LIMIT 40
)
ORDER BY QPS ASC""".format(
nodesel=nodesel)),
refId = 'A'
)
],
),
],
),
GCore.Row(
height = GCore.Pixels(GCore.DEFAULT_ROW_HEIGHT.num * 2),
panels = [
query_classification_chart(
'Query classification by busiest fixed subnet',
'Fixed Subnet',
'FixedPrefix',
agginfo,
nodesel)
],
),
GCore.Row(
height = GCore.Pixels(GCore.DEFAULT_ROW_HEIGHT.num * 2),
panels = [
query_classification_chart(
'Query classification by busiest ASN',
'ASN',
'ClientASN',
agginfo,
nodesel)
],
),
GCore.Row(
height = GCore.Pixels(GCore.DEFAULT_ROW_HEIGHT.num * 2),
panels = [
query_classification_chart(
'Query classification by busiest AS subnet',
'AS subnet',
'ASPrefix',
agginfo,
nodesel)
],
),
]
)
| [
1,
396,
14187,
1266,
29871,
29906,
29900,
29906,
29896,
4685,
15025,
363,
4007,
12961,
14706,
322,
11848,
2596,
29889,
13,
29937,
13,
29937,
910,
7562,
5920,
3812,
338,
4967,
304,
278,
4958,
310,
278,
18129,
2911,
5236,
13,
29937,
19245,
29892,
325,
29889,
29871,
29906,
29889,
29900,
29889,
960,
263,
3509,
310,
278,
341,
7390,
471,
451,
13235,
411,
445,
13,
29937,
934,
29892,
366,
508,
4017,
697,
472,
2045,
597,
13025,
29889,
990,
29914,
3580,
29931,
29914,
29906,
29889,
29900,
6294,
13,
29937,
13,
29937,
10682,
287,
491,
8882,
397,
348,
13315,
313,
5223,
397,
348,
29889,
510,
29897,
13,
29937,
13,
29937,
319,
26127,
362,
3132,
1014,
1212,
13964,
13,
13,
5215,
1426,
6312,
13,
13,
5215,
22956,
7054,
747,
29889,
3221,
408,
402,
9203,
13,
13,
5215,
22956,
1648,
9435,
408,
402,
18877,
13,
13,
1753,
2346,
29918,
1990,
2450,
29918,
15425,
29898,
15425,
29918,
3257,
29892,
343,
8990,
29918,
1643,
29892,
10944,
29918,
2671,
29892,
946,
29887,
3888,
29892,
7573,
295,
1125,
13,
1678,
736,
402,
18877,
29889,
4297,
14732,
29898,
13,
4706,
3611,
353,
8727,
29918,
3257,
29892,
13,
4706,
19843,
353,
402,
18877,
29889,
29933,
1718,
29918,
3210,
8322,
29918,
1955,
29902,
3919,
8098,
29918,
29950,
1955,
26664,
1164,
29911,
1964,
29892,
13,
4706,
5912,
353,
402,
18877,
29889,
4297,
14732,
3453,
29898,
13,
9651,
2594,
8513,
353,
402,
18877,
29889,
29933,
1718,
29918,
3210,
8322,
29918,
18799,
12015,
29918,
20387,
29918,
1254,
11375,
29892,
13,
9651,
1510,
26172,
353,
5852,
29892,
13,
9651,
921,
8990,
353,
402,
18877,
29889,
4297,
14732,
16070,
29898,
13,
18884,
3611,
353,
525,
2182,
6358,
639,
1473,
742,
13,
9651,
10353,
13,
9651,
343,
8990,
353,
402,
18877,
29889,
4297,
14732,
16070,
29898,
13,
18884,
1120,
327,
860,
353,
7700,
29892,
13,
18884,
263,
486,
668,
353,
402,
18877,
29889,
29933,
1718,
29918,
3210,
8322,
29918,
6604,
3235,
29918,
11116,
29918,
29907,
3040,
29954,
18929,
29892,
13,
18884,
16892,
9264,
353,
29871,
29896,
29896,
29900,
29892,
13,
18884,
3611,
353,
343,
8990,
29918,
1643,
29892,
13,
9651,
10353,
13,
4706,
10353,
13,
4706,
26695,
353,
518,
13,
9651,
402,
18877,
29889,
4297,
14732,
11591,
29898,
13,
18884,
1024,
353,
525,
29909,
2831,
29909,
742,
13,
18884,
921,
353,
525,
29909,
2831,
29909,
742,
13,
18884,
343,
353,
525,
29909,
2831,
3301,
9569,
742,
13,
18884,
1426,
353,
525,
29909,
2831,
29909,
742,
13,
9651,
10353,
13,
9651,
402,
18877,
29889,
4297,
14732,
11591,
29898,
13,
18884,
1024,
353,
525,
29909,
2831,
10303,
742,
13,
18884,
921,
353,
525,
29909,
2831,
10303,
742,
13,
18884,
343,
353,
525,
29909,
2831,
10303,
23095,
742,
13,
18884,
1426,
353,
525,
29909,
2831,
10303,
742,
13,
9651,
10353,
13,
9651,
402,
18877,
29889,
4297,
14732,
11591,
29898,
13,
18884,
1024,
353,
525,
25394,
1460,
3010,
2385,
742,
13,
18884,
921,
353,
525,
25394,
1460,
3010,
2385,
742,
13,
18884,
343,
353,
525,
25394,
1460,
3010,
2385,
23095,
742,
13,
18884,
1426,
353,
525,
25394,
1460,
3010,
2385,
742,
13,
9651,
10353,
13,
9651,
402,
18877,
29889,
4297,
14732,
11591,
29898,
13,
18884,
1024,
353,
525,
25394,
1460,
3010,
1542,
742,
13,
18884,
921,
353,
525,
25394,
1460,
3010,
1542,
742,
13,
18884,
343,
353,
525,
25394,
1460,
3010,
1542,
23095,
742,
13,
18884,
1426,
353,
525,
25394,
1460,
3010,
1542,
742,
13,
9651,
10353,
13,
9651,
402,
18877,
29889,
4297,
14732,
11591,
29898,
13,
18884,
1024,
353,
525,
7717,
3069,
742,
13,
18884,
921,
353,
525,
7717,
3069,
742,
13,
18884,
343,
353,
525,
7717,
3069,
23095,
742,
13,
18884,
1426,
353,
525,
7717,
3069,
742,
13,
9651,
10353,
13,
9651,
402,
18877,
29889,
4297,
14732,
11591,
29898,
13,
18884,
1024,
353,
525,
12283,
6444,
29911,
430,
742,
13,
18884,
921,
353,
525,
12283,
6444,
29911,
430,
742,
13,
18884,
343,
353,
525,
12283,
6444,
29911,
430,
23095,
742,
13,
18884,
1426,
353,
525,
12283,
6444,
29911,
430,
742,
13,
9651,
10353,
13,
9651,
402,
18877,
29889,
4297,
14732,
11591,
29898,
13,
18884,
1024,
353,
525,
20434,
742,
13,
18884,
921,
353,
525,
20434,
742,
13,
18884,
343,
353,
525,
20434,
23095,
742,
13,
18884,
1426,
353,
525,
20434,
742,
13,
9651,
10353,
13,
9651,
402,
18877,
29889,
4297,
14732,
11591,
29898,
13,
18884,
1024,
353,
525,
29934,
8610,
29896,
29929,
29896,
29947,
12058,
742,
13,
18884,
921,
353,
525,
29934,
8610,
29896,
29929,
29896,
29947,
12058,
742,
13,
18884,
343,
353,
525,
29934,
8610,
29896,
29929,
29896,
29947,
12058,
23095,
742,
13,
18884,
1426,
353,
525,
29934,
8610,
29896,
29929,
29896,
29947,
12058,
742,
13,
9651,
10353,
13,
9651,
402,
18877,
29889,
4297,
14732,
11591,
29898,
13,
18884,
1024,
353,
525,
10303,
1748,
874,
6779,
742,
13,
18884,
921,
353,
525,
10303,
1748,
874,
6779,
742,
13,
18884,
343,
353,
525,
10303,
1748,
874,
6779,
23095,
742,
13,
18884,
1426,
353,
525,
10303,
1748,
874,
6779,
742,
13,
9651,
10353,
13,
9651,
402,
18877,
29889,
4297,
14732,
11591,
29898,
13,
18884,
1024,
353,
525,
29903,
2214,
2290,
24214,
742,
13,
18884,
921,
353,
525,
29903,
2214,
2290,
24214,
742,
13,
18884,
343,
353,
525,
29903,
2214,
2290,
24214,
23095,
742,
13,
18884,
1426,
353,
525,
29903,
2214,
2290,
24214,
742,
13,
9651,
10353,
13,
4706,
21251,
13,
4706,
22525,
353,
518,
13,
9651,
402,
18877,
29889,
4164,
29950,
1709,
3562,
8667,
29898,
13,
18884,
2566,
353,
946,
29887,
3888,
1839,
9803,
7464,
13,
18884,
1591,
353,
525,
3010,
2385,
8232,
29915,
718,
946,
29887,
3888,
1839,
2371,
29918,
2146,
600,
861,
7464,
13,
18884,
4513,
353,
946,
29887,
3888,
1839,
14486,
7464,
13,
18884,
2346,
353,
1426,
6312,
29889,
7176,
296,
703,
15945,
29905,
13,
462,
29871,
5097,
13,
462,
1678,
349,
9569,
3339,
319,
2831,
3301,
9569,
29892,
13,
462,
1678,
319,
2831,
29909,
29892,
13,
462,
1678,
3917,
13,
462,
29871,
3895,
13,
462,
29871,
313,
13,
462,
1678,
5097,
13,
462,
418,
426,
13506,
29918,
2671,
29913,
3339,
349,
9569,
29892,
13,
462,
418,
2533,
29898,
3981,
29897,
3339,
3917,
29892,
13,
462,
418,
2533,
29898,
29909,
2831,
2477,
792,
6802,
1566,
517,
448,
395,
3166,
29897,
3339,
319,
2831,
29909,
13,
462,
1678,
3895,
395,
2371,
13,
462,
1678,
5754,
395,
2230,
5072,
13,
462,
1678,
5300,
9071,
1367,
2672,
426,
18010,
295,
29913,
13,
462,
1678,
15345,
6770,
349,
9569,
13,
462,
1678,
15606,
6770,
3917,
23050,
13,
462,
1678,
27848,
29871,
29946,
29900,
13,
462,
29871,
1723,
13,
462,
29871,
15606,
6770,
3917,
18188,
13,
462,
29871,
5124,
1642,
4830,
29898,
13,
462,
3986,
10944,
29918,
2671,
29922,
13506,
29918,
2671,
29892,
13,
462,
3986,
7573,
295,
29922,
18010,
295,
29892,
13,
462,
3986,
2943,
3888,
29918,
9803,
29922,
16170,
3888,
1839,
3177,
3888,
29918,
9803,
2033,
8243,
13,
18884,
2143,
1204,
353,
525,
29909,
29915,
13,
9651,
10353,
13,
9651,
402,
18877,
29889,
4164,
29950,
1709,
3562,
8667,
29898,
13,
18884,
2566,
353,
946,
29887,
3888,
1839,
9803,
7464,
13,
18884,
1591,
353,
525,
3010,
2385,
8232,
29915,
718,
946,
29887,
3888,
1839,
2371,
29918,
2146,
600,
861,
7464,
13,
18884,
4513,
353,
946,
29887,
3888,
1839,
14486,
7464,
13,
18884,
2346,
353,
1426,
6312,
29889,
7176,
296,
703,
15945,
29905,
13,
462,
29871,
5097,
13,
462,
1678,
349,
9569,
3339,
319,
2831,
10303,
23095,
29892,
13,
462,
1678,
319,
2831,
10303,
29892,
13,
462,
1678,
3917,
13,
462,
29871,
3895,
13,
462,
29871,
313,
13,
462,
1678,
5097,
13,
462,
418,
426,
13506,
29918,
2671,
29913,
3339,
349,
9569,
29892,
13,
462,
418,
2533,
29898,
3981,
29897,
3339,
3917,
29892,
13,
462,
418,
2533,
29898,
29909,
2831,
10303,
3981,
6802,
1566,
517,
448,
395,
3166,
29897,
3339,
319,
2831,
10303,
13,
462,
1678,
3895,
395,
2371,
13,
462,
1678,
5754,
395,
2230,
5072,
13,
462,
1678,
5300,
9071,
1367,
2672,
426,
18010,
295,
29913,
13,
462,
1678,
15345,
6770,
349,
9569,
13,
462,
1678,
15606,
6770,
3917,
23050,
13,
462,
1678,
27848,
29871,
29946,
29900,
13,
462,
29871,
1723,
13,
462,
29871,
15606,
6770,
3917,
18188,
13,
462,
29871,
5124,
1642,
4830,
29898,
13,
462,
3986,
10944,
29918,
2671,
29922,
13506,
29918,
2671,
29892,
13,
462,
3986,
7573,
295,
29922,
18010,
295,
29892,
13,
462,
3986,
2943,
3888,
29918,
9803,
29922,
16170,
3888,
1839,
3177,
3888,
29918,
9803,
2033,
8243,
13,
18884,
2143,
1204,
353,
525,
29933,
29915,
13,
9651,
10353,
13,
9651,
402,
18877,
29889,
4164,
29950,
1709,
3562,
8667,
29898,
13,
18884,
2566,
353,
946,
29887,
3888,
1839,
9803,
7464,
13,
18884,
1591,
353,
525,
3010,
2385,
8232,
29915,
718,
946,
29887,
3888,
1839,
2371,
29918,
2146,
600,
861,
7464,
13,
18884,
4513,
353,
946,
29887,
3888,
1839,
14486,
7464,
13,
18884,
2346,
353,
1426,
6312,
29889,
7176,
296,
703,
15945,
29905,
13,
462,
29871,
5097,
13,
462,
1678,
349,
9569,
3339,
13811,
1460,
3010,
2385,
23095,
29892,
13,
462,
1678,
13811,
1460,
3010,
2385,
29892,
13,
462,
1678,
3917,
13,
462,
29871,
3895,
13,
462,
29871,
313,
13,
462,
1678,
5097,
13,
462,
418,
426,
13506,
29918,
2671,
29913,
3339,
349,
9569,
29892,
13,
462,
418,
2533,
29898,
3981,
29897,
3339,
3917,
29892,
13,
462,
418,
2533,
29898,
25394,
1460,
3010,
2385,
3981,
6802,
1566,
517,
448,
395,
3166,
29897,
3339,
13811,
1460,
3010,
2385,
13,
462,
1678,
3895,
395,
2371,
13,
462,
1678,
5754,
395,
2230,
5072,
13,
462,
1678,
5300,
9071,
1367,
2672,
426,
18010,
295,
29913,
13,
462,
1678,
15345,
6770,
349,
9569,
13,
462,
1678,
15606,
6770,
3917,
23050,
13,
462,
1678,
27848,
29871,
29946,
29900,
13,
462,
29871,
1723,
13,
462,
29871,
15606,
6770,
3917,
18188,
13,
462,
29871,
5124,
1642,
4830,
29898,
13,
462,
3986,
10944,
29918,
2671,
29922,
13506,
29918,
2671,
29892,
13,
462,
3986,
7573,
295,
29922,
18010,
295,
29892,
13,
462,
3986,
2943,
3888,
29918,
9803,
29922,
16170,
3888,
1839,
3177,
3888,
29918,
9803,
2033,
8243,
13,
18884,
2143,
1204,
353,
525,
29907,
29915,
13,
9651,
10353,
13,
9651,
402,
18877,
29889,
4164,
29950,
1709,
3562,
8667,
29898,
13,
18884,
2566,
353,
946,
29887,
3888,
1839,
9803,
7464,
13,
18884,
1591,
353,
525,
3010,
2385,
8232,
29915,
718,
946,
29887,
3888,
1839,
2371,
29918,
2146,
600,
861,
7464,
13,
18884,
4513,
353,
946,
29887,
3888,
1839,
14486,
7464,
13,
18884,
2346,
353,
1426,
6312,
29889,
7176,
296,
703,
15945,
29905,
13,
462,
29871,
5097,
13,
462,
1678,
349,
9569,
3339,
13811,
1460,
3010,
1542,
23095,
29892,
13,
462,
1678,
13811,
1460,
3010,
1542,
29892,
13,
462,
1678,
3917,
13,
462,
29871,
3895,
13,
462,
29871,
313,
13,
462,
1678,
5097,
13,
462,
418,
426,
13506,
29918,
2671,
29913,
3339,
349,
9569,
29892,
13,
462,
418,
2533,
29898,
3981,
29897,
3339,
3917,
29892,
13,
462,
418,
2533,
29898,
25394,
1460,
3010,
1542,
3981,
6802,
1566,
517,
448,
395,
3166,
29897,
3339,
13811,
1460,
3010,
1542,
13,
462,
1678,
3895,
395,
2371,
13,
462,
1678,
5754,
395,
2230,
5072,
13,
462,
1678,
5300,
9071,
1367,
2672,
426,
18010,
295,
29913,
13,
462,
1678,
15345,
6770,
349,
9569,
13,
462,
1678,
15606,
6770,
3917,
23050,
13,
462,
1678,
27848,
29871,
29946,
29900,
13,
462,
29871,
1723,
13,
462,
29871,
15606,
6770,
3917,
23050,
13,
462,
29871,
5124,
1642,
4830,
29898,
13,
462,
3986,
10944,
29918,
2671,
29922,
13506,
29918,
2671,
29892,
13,
462,
3986,
7573,
295,
29922,
18010,
295,
29892,
13,
462,
3986,
2943,
3888,
29918,
9803,
29922,
16170,
3888,
1839,
3177,
3888,
29918,
9803,
2033,
8243,
13,
18884,
2143,
1204,
353,
525,
29928,
29915,
13,
9651,
10353,
13,
9651,
402,
18877,
29889,
4164,
29950,
1709,
3562,
8667,
29898,
13,
18884,
2566,
353,
946,
29887,
3888,
1839,
9803,
7464,
13,
18884,
1591,
353,
525,
3010,
2385,
8232,
29915,
718,
946,
29887,
3888,
1839,
2371,
29918,
2146,
600,
861,
7464,
13,
18884,
4513,
353,
946,
29887,
3888,
1839,
14486,
7464,
13,
18884,
2346,
353,
1426,
6312,
29889,
7176,
296,
703,
15945,
29905,
13,
462,
29871,
5097,
13,
462,
1678,
349,
9569,
3339,
9959,
3069,
23095,
29892,
13,
462,
1678,
9959,
3069,
29892,
13,
462,
1678,
3917,
13,
462,
29871,
3895,
13,
462,
29871,
313,
13,
462,
1678,
5097,
13,
462,
418,
426,
13506,
29918,
2671,
29913,
3339,
349,
9569,
29892,
13,
462,
418,
2533,
29898,
3981,
29897,
3339,
3917,
29892,
13,
462,
418,
2533,
29898,
7717,
3069,
3981,
6802,
1566,
517,
448,
395,
3166,
29897,
3339,
9959,
3069,
13,
462,
1678,
3895,
395,
2371,
13,
462,
1678,
5754,
395,
2230,
5072,
13,
462,
1678,
5300,
9071,
1367,
2672,
426,
18010,
295,
29913,
13,
462,
1678,
15345,
6770,
349,
9569,
13,
462,
1678,
15606,
6770,
3917,
23050,
13,
462,
1678,
27848,
29871,
29946,
29900,
13,
462,
29871,
1723,
13,
462,
29871,
15606,
6770,
3917,
18188,
13,
462,
29871,
5124,
1642,
4830,
29898,
13,
462,
3986,
10944,
29918,
2671,
29922,
13506,
29918,
2671,
29892,
13,
462,
3986,
7573,
295,
29922,
18010,
295,
29892,
13,
462,
3986,
2943,
3888,
29918,
9803,
29922,
16170,
3888,
1839,
3177,
3888,
29918,
9803,
2033,
8243,
13,
18884,
2143,
1204,
353,
525,
29923,
29915,
13,
9651,
10353,
13,
9651,
402,
18877,
29889,
4164,
29950,
1709,
3562,
8667,
29898,
13,
18884,
2566,
353,
946,
29887,
3888,
1839,
9803,
7464,
13,
18884,
1591,
353,
525,
3010,
2385,
8232,
29915,
718,
946,
29887,
3888,
1839,
2371,
29918,
2146,
600,
861,
7464,
13,
18884,
4513,
353,
946,
29887,
3888,
1839,
14486,
7464,
13,
18884,
2346,
353,
1426,
6312,
29889,
7176,
296,
703,
15945,
29905,
13,
462,
29871,
5097,
13,
462,
1678,
349,
9569,
3339,
10050,
6444,
29911,
430,
23095,
29892,
13,
462,
1678,
10050,
6444,
29911,
430,
29892,
13,
462,
1678,
3917,
13,
462,
29871,
3895,
13,
462,
29871,
313,
13,
462,
1678,
5097,
13,
462,
418,
426,
13506,
29918,
2671,
29913,
3339,
349,
9569,
29892,
13,
462,
418,
2533,
29898,
3981,
29897,
3339,
3917,
29892,
13,
462,
418,
2533,
29898,
12283,
6444,
29911,
430,
3981,
6802,
1566,
517,
448,
395,
3166,
29897,
3339,
10050,
6444,
29911,
430,
13,
462,
1678,
3895,
395,
2371,
13,
462,
1678,
5754,
395,
2230,
5072,
13,
462,
1678,
5300,
9071,
1367,
2672,
426,
18010,
295,
29913,
13,
462,
1678,
15345,
6770,
349,
9569,
13,
462,
1678,
15606,
6770,
3917,
23050,
13,
462,
1678,
27848,
29871,
29946,
29900,
13,
462,
29871,
1723,
13,
462,
29871,
15606,
6770,
3917,
18188,
13,
462,
29871,
5124,
1642,
4830,
29898,
13,
462,
3986,
10944,
29918,
2671,
29922,
13506,
29918,
2671,
29892,
13,
462,
3986,
7573,
295,
29922,
18010,
295,
29892,
13,
462,
3986,
2943,
3888,
29918,
9803,
29922,
16170,
3888,
1839,
3177,
3888,
29918,
9803,
2033,
8243,
13,
18884,
2143,
1204,
353,
525,
29943,
29915,
13,
9651,
10353,
13,
9651,
402,
18877,
29889,
4164,
29950,
1709,
3562,
8667,
29898,
13,
18884,
2566,
353,
946,
29887,
3888,
1839,
9803,
7464,
13,
18884,
1591,
353,
525,
3010,
2385,
8232,
29915,
718,
946,
29887,
3888,
1839,
2371,
29918,
2146,
600,
861,
7464,
13,
18884,
4513,
353,
946,
29887,
3888,
1839,
14486,
7464,
13,
18884,
2346,
353,
1426,
6312,
29889,
7176,
296,
703,
15945,
29905,
13,
462,
29871,
5097,
13,
462,
1678,
349,
9569,
3339,
3674,
23095,
29892,
13,
462,
1678,
3674,
29892,
13,
462,
1678,
14990,
3981,
13,
462,
29871,
3895,
13,
462,
29871,
313,
13,
462,
1678,
5097,
13,
462,
418,
426,
13506,
29918,
2671,
29913,
3339,
349,
9569,
29892,
13,
462,
418,
2533,
29898,
3981,
29897,
3339,
14990,
3981,
29892,
13,
462,
418,
2533,
29898,
3981,
448,
13,
462,
9651,
313,
29909,
2831,
2477,
792,
718,
13,
462,
632,
319,
2831,
10303,
3981,
718,
13,
462,
632,
13811,
1460,
3010,
2385,
3981,
718,
13,
462,
632,
13811,
1460,
3010,
1542,
3981,
718,
13,
462,
632,
9959,
3069,
3981,
718,
13,
462,
632,
10050,
6444,
29911,
430,
3981,
718,
13,
462,
632,
390,
8610,
29896,
29929,
29896,
29947,
12058,
3981,
718,
13,
462,
632,
28272,
1748,
874,
6779,
3981,
718,
13,
462,
632,
317,
2214,
2290,
24214,
3981,
876,
29914,
1566,
517,
448,
395,
3166,
29897,
3339,
3674,
13,
462,
1678,
3895,
395,
2371,
13,
462,
1678,
5754,
395,
2230,
5072,
13,
462,
1678,
5300,
9071,
1367,
2672,
426,
18010,
295,
29913,
13,
462,
1678,
15345,
6770,
349,
9569,
13,
462,
1678,
15606,
6770,
14990,
3981,
23050,
13,
462,
1678,
27848,
29871,
29946,
29900,
13,
462,
29871,
1723,
13,
462,
29871,
15606,
6770,
14990,
3981,
18188,
13,
462,
29871,
5124,
1642,
4830,
29898,
13,
462,
3986,
10944,
29918,
2671,
29922,
13506,
29918,
2671,
29892,
13,
462,
3986,
7573,
295,
29922,
18010,
295,
29892,
13,
462,
3986,
2943,
3888,
29918,
9803,
29922,
16170,
3888,
1839,
3177,
3888,
29918,
9803,
2033,
8243,
13,
18884,
2143,
1204,
353,
525,
29954,
29915,
13,
9651,
10353,
13,
9651,
402,
18877,
29889,
4164,
29950,
1709,
3562,
8667,
29898,
13,
18884,
2566,
353,
946,
29887,
3888,
1839,
9803,
7464,
13,
18884,
1591,
353,
525,
3010,
2385,
8232,
29915,
718,
946,
29887,
3888,
1839,
2371,
29918,
2146,
600,
861,
7464,
13,
18884,
4513,
353,
946,
29887,
3888,
1839,
14486,
7464,
13,
18884,
2346,
353,
1426,
6312,
29889,
7176,
296,
703,
15945,
29905,
13,
462,
29871,
5097,
13,
462,
1678,
349,
9569,
3339,
390,
8610,
29896,
29929,
29896,
29947,
12058,
23095,
29892,
13,
462,
1678,
390,
8610,
29896,
29929,
29896,
29947,
12058,
29892,
13,
462,
1678,
3917,
13,
462,
29871,
3895,
13,
462,
29871,
313,
13,
462,
1678,
5097,
13,
462,
418,
426,
13506,
29918,
2671,
29913,
3339,
349,
9569,
29892,
13,
462,
418,
2533,
29898,
3981,
29897,
3339,
3917,
29892,
13,
462,
418,
2533,
29898,
29934,
8610,
29896,
29929,
29896,
29947,
12058,
3981,
6802,
1566,
517,
448,
395,
3166,
29897,
3339,
390,
8610,
29896,
29929,
29896,
29947,
12058,
13,
462,
1678,
3895,
395,
2371,
13,
462,
1678,
5754,
395,
2230,
5072,
13,
462,
1678,
5300,
9071,
1367,
2672,
426,
18010,
295,
29913,
13,
462,
1678,
15345,
6770,
349,
9569,
13,
462,
1678,
15606,
6770,
3917,
23050,
13,
462,
1678,
27848,
29871,
29946,
29900,
13,
462,
29871,
1723,
13,
462,
29871,
15606,
6770,
3917,
18188,
13,
462,
29871,
5124,
1642,
4830,
29898,
13,
462,
3986,
10944,
29918,
2671,
29922,
13506,
29918,
2671,
29892,
13,
462,
3986,
7573,
295,
29922,
18010,
295,
29892,
13,
462,
3986,
2943,
3888,
29918,
9803,
29922,
16170,
3888,
1839,
3177,
3888,
29918,
9803,
2033,
8243,
13,
18884,
2143,
1204,
353,
525,
29950,
29915,
13,
9651,
10353,
13,
9651,
402,
18877,
29889,
4164,
29950,
1709,
3562,
8667,
29898,
13,
18884,
2566,
353,
946,
29887,
3888,
1839,
9803,
7464,
13,
18884,
1591,
353,
525,
3010,
2385,
8232,
29915,
718,
946,
29887,
3888,
1839,
2371,
29918,
2146,
600,
861,
7464,
13,
18884,
4513,
353,
946,
29887,
3888,
1839,
14486,
7464,
13,
18884,
2346,
353,
1426,
6312,
29889,
7176,
296,
703,
15945,
29905,
13,
462,
29871,
5097,
13,
462,
1678,
349,
9569,
3339,
28272,
1748,
874,
6779,
23095,
29892,
13,
462,
1678,
28272,
1748,
874,
6779,
29892,
13,
462,
1678,
3917,
13,
462,
29871,
3895,
13,
462,
29871,
313,
13,
462,
1678,
5097,
13,
462,
418,
426,
13506,
29918,
2671,
29913,
3339,
349,
9569,
29892,
13,
462,
418,
2533,
29898,
3981,
29897,
3339,
3917,
29892,
13,
462,
418,
2533,
29898,
10303,
1748,
874,
6779,
3981,
6802,
1566,
517,
448,
395,
3166,
29897,
3339,
28272,
1748,
874,
6779,
13,
462,
1678,
3895,
395,
2371,
13,
462,
1678,
5754,
395,
2230,
5072,
13,
462,
1678,
5300,
9071,
1367,
2672,
426,
18010,
295,
29913,
13,
462,
1678,
15345,
6770,
349,
9569,
13,
462,
1678,
15606,
6770,
3917,
23050,
13,
462,
1678,
27848,
29871,
29946,
29900,
13,
462,
29871,
1723,
13,
462,
29871,
15606,
6770,
3917,
18188,
13,
462,
29871,
5124,
1642,
4830,
29898,
13,
462,
3986,
10944,
29918,
2671,
29922,
13506,
29918,
2671,
29892,
13,
462,
3986,
7573,
295,
29922,
18010,
295,
29892,
13,
462,
3986,
2943,
3888,
29918,
9803,
29922,
16170,
3888,
1839,
3177,
3888,
29918,
9803,
2033,
8243,
13,
18884,
2143,
1204,
353,
525,
29902,
29915,
13,
9651,
10353,
13,
9651,
402,
18877,
29889,
4164,
29950,
1709,
3562,
8667,
29898,
13,
18884,
2566,
353,
946,
29887,
3888,
1839,
9803,
7464,
13,
18884,
1591,
353,
525,
3010,
2385,
8232,
29915,
718,
946,
29887,
3888,
1839,
2371,
29918,
2146,
600,
861,
7464,
13,
18884,
4513,
353,
946,
29887,
3888,
1839,
14486,
7464,
13,
18884,
2346,
353,
1426,
6312,
29889,
7176,
296,
703,
15945,
29905,
13,
462,
29871,
5097,
13,
462,
1678,
349,
9569,
3339,
317,
2214,
2290,
24214,
23095,
29892,
13,
462,
1678,
317,
2214,
2290,
24214,
29892,
13,
462,
1678,
3917,
13,
462,
29871,
3895,
13,
462,
29871,
313,
13,
462,
1678,
5097,
13,
462,
418,
426,
13506,
29918,
2671,
29913,
3339,
349,
9569,
29892,
13,
462,
418,
2533,
29898,
3981,
29897,
3339,
3917,
29892,
13,
462,
418,
2533,
29898,
29903,
2214,
2290,
24214,
3981,
6802,
1566,
517,
448,
395,
3166,
29897,
3339,
317,
2214,
2290,
24214,
13,
462,
1678,
3895,
395,
2371,
13,
462,
1678,
5754,
395,
2230,
5072,
13,
462,
1678,
5300,
9071,
1367,
2672,
426,
18010,
295,
29913,
13,
462,
1678,
15345,
6770,
349,
9569,
13,
462,
1678,
15606,
6770,
3917,
23050,
13,
462,
1678,
27848,
29871,
29946,
29900,
13,
462,
29871,
1723,
13,
462,
29871,
15606,
6770,
3917,
18188,
13,
462,
29871,
5124,
1642,
4830,
29898,
13,
462,
3986,
10944,
29918,
2671,
29922,
13506,
29918,
2671,
29892,
13,
462,
3986,
7573,
295,
29922,
18010,
295,
29892,
13,
462,
3986,
2943,
3888,
29918,
9803,
29922,
16170,
3888,
1839,
3177,
3888,
29918,
9803,
2033,
8243,
13,
18884,
2143,
1204,
353,
525,
29967,
29915,
13,
9651,
10353,
13,
4706,
21251,
13,
1678,
1723,
13,
13,
13,
1753,
12569,
29898,
1357,
5416,
29892,
946,
29887,
3888,
29892,
7573,
295,
29892,
3579,
19290,
1125,
13,
1678,
736,
402,
18877,
29889,
29928,
1161,
3377,
29898,
13,
4706,
3611,
353,
376,
4032,
1014,
1212,
13964,
9493,
613,
13,
4706,
8282,
353,
518,
13,
9651,
946,
29887,
3888,
1839,
4262,
29918,
4039,
2033,
13,
4706,
21251,
13,
4706,
318,
333,
353,
590,
5416,
29892,
13,
4706,
4206,
353,
518,
13,
9651,
402,
9203,
29889,
4301,
29898,
13,
18884,
3171,
353,
402,
9203,
29889,
29925,
861,
1379,
29898,
29945,
29900,
511,
13,
18884,
7243,
1379,
353,
518,
13,
462,
1678,
402,
18877,
29889,
7020,
7490,
877,
29887,
1929,
1648,
29914,
9435,
29914,
14592,
24691,
29914,
26193,
630,
29914,
4645,
29918,
1491,
1212,
29918,
6112,
6765,
29918,
6672,
29889,
1420,
742,
17772,
29922,
5574,
511,
13,
462,
1678,
21251,
13,
9651,
10353,
13,
9651,
402,
9203,
29889,
4301,
29898,
13,
18884,
3171,
353,
402,
9203,
29889,
29925,
861,
1379,
29898,
8766,
487,
29889,
23397,
29918,
25180,
29918,
9606,
22530,
29889,
1949,
334,
29871,
29906,
511,
13,
18884,
7243,
1379,
353,
518,
13,
462,
1678,
402,
18877,
29889,
4297,
14732,
29898,
13,
462,
4706,
3611,
353,
525,
29907,
492,
1237,
491,
4343,
1014,
1212,
742,
13,
462,
4706,
19843,
353,
402,
18877,
29889,
29933,
1718,
29918,
3210,
8322,
29918,
1955,
29902,
3919,
8098,
29918,
29950,
1955,
26664,
1164,
29911,
1964,
29892,
13,
462,
4706,
5912,
353,
402,
18877,
29889,
4297,
14732,
3453,
29898,
13,
462,
9651,
921,
8990,
353,
402,
18877,
29889,
4297,
14732,
16070,
29898,
13,
462,
18884,
3611,
353,
525,
2182,
6358,
639,
1473,
742,
13,
462,
9651,
10353,
13,
462,
9651,
343,
8990,
353,
402,
18877,
29889,
4297,
14732,
16070,
29898,
13,
462,
18884,
1120,
327,
860,
353,
7700,
29892,
13,
462,
18884,
263,
486,
668,
353,
402,
18877,
29889,
29933,
1718,
29918,
3210,
8322,
29918,
6604,
3235,
29918,
11116,
29918,
29907,
3040,
29954,
18929,
29892,
13,
462,
18884,
16892,
9264,
353,
29871,
29896,
29896,
29900,
29892,
13,
462,
18884,
3611,
353,
525,
26262,
3323,
1212,
742,
13,
462,
9651,
10353,
13,
462,
4706,
10353,
13,
462,
4706,
26695,
353,
518,
13,
462,
9651,
402,
18877,
29889,
4297,
14732,
11591,
29898,
13,
462,
18884,
1024,
353,
525,
4035,
1212,
742,
13,
462,
18884,
2927,
353,
16321,
29909,
29941,
29945,
29906,
4174,
742,
13,
462,
18884,
921,
353,
525,
29984,
7024,
742,
13,
462,
18884,
343,
353,
525,
4035,
1212,
742,
13,
462,
18884,
1426,
353,
525,
29984,
7024,
742,
13,
462,
9651,
10353,
13,
462,
4706,
21251,
13,
462,
4706,
22525,
353,
518,
13,
462,
9651,
402,
18877,
29889,
4164,
29950,
1709,
3562,
8667,
29898,
13,
462,
18884,
2566,
353,
946,
29887,
3888,
1839,
9803,
7464,
13,
462,
18884,
1591,
353,
525,
16890,
12239,
4032,
4035,
1212,
29879,
29915,
718,
946,
29887,
3888,
1839,
2371,
29918,
2146,
600,
861,
7464,
13,
462,
18884,
4513,
353,
946,
29887,
3888,
1839,
14486,
7464,
13,
462,
18884,
2346,
353,
1426,
6312,
29889,
7176,
296,
703,
15945,
29905,
13,
462,
462,
29871,
5097,
13,
462,
462,
418,
3323,
1212,
29892,
13,
462,
462,
418,
660,
7024,
13,
462,
462,
29871,
3895,
13,
462,
462,
29871,
313,
13,
462,
462,
418,
5097,
13,
462,
462,
3986,
349,
9569,
3339,
3323,
1212,
29892,
13,
462,
462,
3986,
2533,
29898,
3981,
6802,
1566,
517,
448,
395,
3166,
29897,
3339,
660,
7024,
13,
462,
462,
418,
3895,
395,
2371,
13,
462,
462,
418,
5754,
395,
2230,
5072,
13,
462,
462,
3986,
5300,
9071,
1367,
2672,
426,
18010,
295,
29913,
13,
462,
462,
418,
15345,
6770,
349,
9569,
13,
462,
462,
418,
15606,
6770,
660,
7024,
23050,
13,
462,
462,
418,
27848,
29871,
29941,
29900,
13,
462,
462,
29871,
1723,
13,
462,
462,
29871,
15606,
6770,
660,
7024,
18188,
15945,
1642,
4830,
29898,
13,
462,
462,
418,
7573,
295,
29922,
18010,
295,
8243,
13,
462,
18884,
2143,
1204,
353,
525,
29909,
29915,
13,
462,
9651,
1723,
13,
462,
4706,
21251,
13,
462,
1678,
10353,
13,
18884,
21251,
13,
9651,
10353,
13,
9651,
402,
9203,
29889,
4301,
29898,
13,
18884,
3171,
353,
402,
9203,
29889,
29925,
861,
1379,
29898,
8766,
487,
29889,
23397,
29918,
25180,
29918,
9606,
22530,
29889,
1949,
334,
29871,
29906,
511,
13,
18884,
7243,
1379,
353,
518,
13,
462,
1678,
402,
18877,
29889,
4297,
14732,
29898,
13,
462,
4706,
3611,
353,
525,
29934,
16524,
491,
13154,
491,
3339,
29940,
742,
13,
462,
4706,
19843,
353,
402,
18877,
29889,
29933,
1718,
29918,
3210,
8322,
29918,
1955,
29902,
3919,
8098,
29918,
29950,
1955,
26664,
1164,
29911,
1964,
29892,
13,
462,
4706,
5912,
353,
402,
18877,
29889,
4297,
14732,
3453,
29898,
13,
462,
9651,
2594,
8513,
353,
402,
18877,
29889,
29933,
1718,
29918,
3210,
8322,
29918,
18799,
12015,
29918,
20387,
29918,
1254,
11375,
29892,
13,
462,
9651,
1510,
26172,
353,
5852,
29892,
13,
462,
9651,
921,
8990,
353,
402,
18877,
29889,
4297,
14732,
16070,
29898,
13,
462,
18884,
3611,
353,
525,
2182,
6358,
639,
1473,
742,
13,
462,
9651,
10353,
13,
462,
9651,
343,
8990,
353,
402,
18877,
29889,
4297,
14732,
16070,
29898,
13,
462,
18884,
1120,
327,
860,
353,
7700,
29892,
13,
462,
18884,
263,
486,
668,
353,
402,
18877,
29889,
29933,
1718,
29918,
3210,
8322,
29918,
6604,
3235,
29918,
11116,
29918,
29907,
3040,
29954,
18929,
29892,
13,
462,
18884,
16892,
9264,
353,
29871,
29896,
29896,
29900,
29892,
13,
462,
18884,
3611,
353,
525,
3289,
29940,
742,
13,
462,
9651,
10353,
13,
462,
4706,
10353,
13,
462,
4706,
1120,
327,
25525,
353,
5852,
29892,
13,
462,
4706,
22525,
353,
518,
13,
462,
9651,
402,
18877,
29889,
4164,
29950,
1709,
3562,
8667,
29898,
13,
462,
18884,
2566,
353,
946,
29887,
3888,
1839,
9803,
7464,
13,
462,
18884,
1591,
353,
525,
16890,
12239,
4032,
4035,
1212,
29879,
29915,
718,
946,
29887,
3888,
1839,
2371,
29918,
2146,
600,
861,
7464,
13,
462,
18884,
4513,
353,
946,
29887,
3888,
1839,
14486,
7464,
13,
462,
18884,
2346,
353,
1426,
6312,
29889,
7176,
296,
703,
15945,
29905,
13,
462,
462,
29871,
5097,
13,
462,
462,
418,
451,
8915,
29898,
29878,
401,
1626,
29897,
1577,
364,
401,
1626,
584,
3022,
271,
877,
29934,
16524,
742,
304,
1231,
29898,
29878,
401,
876,
3339,
17440,
29934,
401,
29892,
13,
462,
462,
418,
2533,
29898,
29878,
401,
3981,
29897,
847,
3255,
517,
448,
395,
3166,
29897,
3339,
364,
401,
3981,
29892,
13,
462,
462,
418,
12477,
3289,
29940,
13,
462,
462,
29871,
3895,
13,
462,
462,
29871,
313,
13,
462,
462,
418,
5097,
13,
462,
462,
3986,
12477,
3289,
29940,
29892,
13,
462,
462,
3986,
364,
401,
29892,
13,
462,
462,
3986,
2533,
29898,
29878,
401,
3981,
29897,
3339,
364,
401,
3981,
29892,
13,
462,
462,
3986,
738,
29898,
29879,
3981,
29897,
3339,
269,
3981,
13,
462,
462,
418,
3895,
13,
462,
462,
418,
313,
13,
462,
462,
3986,
5097,
13,
462,
462,
795,
12477,
3289,
29940,
29892,
13,
462,
462,
795,
2533,
29898,
29934,
401,
3388,
29889,
3981,
29897,
3339,
269,
3981,
13,
462,
462,
3986,
3895,
395,
2371,
13,
462,
462,
3986,
9033,
22800,
8780,
390,
401,
3388,
13,
462,
462,
3986,
5754,
395,
2230,
5072,
13,
462,
462,
795,
5300,
9071,
1367,
2672,
426,
18010,
295,
29913,
13,
462,
462,
3986,
15345,
6770,
13,
462,
462,
795,
12477,
3289,
29940,
13,
462,
462,
3986,
15606,
6770,
269,
3981,
23050,
29892,
12477,
3289,
29940,
18188,
13,
462,
462,
3986,
27848,
29871,
29941,
29900,
13,
462,
462,
418,
1723,
3339,
12477,
3289,
29940,
3981,
29879,
13,
462,
462,
418,
15149,
19246,
8780,
13,
462,
462,
418,
313,
13,
462,
462,
3986,
5097,
13,
462,
462,
795,
12477,
3289,
29940,
29892,
13,
462,
462,
795,
390,
401,
3388,
29889,
5103,
29934,
401,
3339,
364,
401,
29892,
13,
462,
462,
795,
2533,
29898,
29934,
401,
3388,
29889,
3981,
29897,
3339,
364,
401,
3981,
13,
462,
462,
3986,
3895,
395,
2371,
13,
462,
462,
3986,
9033,
22800,
8780,
390,
401,
3388,
13,
462,
462,
3986,
5754,
13,
462,
462,
795,
395,
2230,
5072,
13,
462,
462,
795,
5300,
9071,
1367,
2672,
426,
18010,
295,
29913,
13,
462,
462,
3986,
15345,
6770,
13,
462,
462,
795,
12477,
3289,
29940,
29892,
13,
462,
462,
795,
364,
401,
13,
462,
462,
3986,
25919,
15149,
13,
462,
462,
3986,
313,
13,
462,
462,
795,
5097,
13,
462,
462,
462,
29871,
12477,
3289,
29940,
29892,
13,
462,
462,
462,
29871,
364,
401,
29892,
13,
462,
462,
462,
29871,
12766,
1254,
29898,
29900,
3339,
501,
2928,
29953,
29946,
29897,
3339,
364,
401,
3981,
13,
462,
462,
795,
3895,
13,
462,
462,
795,
313,
13,
462,
462,
462,
29871,
5097,
13,
462,
462,
462,
539,
29900,
3339,
28933,
29892,
13,
462,
462,
462,
418,
12477,
3289,
29940,
13,
462,
462,
462,
29871,
3895,
395,
2371,
13,
462,
462,
462,
29871,
5754,
13,
462,
462,
462,
418,
395,
2230,
5072,
13,
462,
462,
462,
418,
5300,
9071,
1367,
2672,
426,
18010,
295,
29913,
13,
462,
462,
462,
29871,
15345,
6770,
12477,
3289,
29940,
13,
462,
462,
795,
1723,
3339,
28933,
4032,
3289,
29940,
13,
462,
462,
795,
15149,
19246,
8780,
13,
462,
462,
795,
313,
13,
462,
462,
462,
29871,
5097,
13,
462,
462,
462,
539,
29900,
3339,
28933,
29892,
13,
462,
462,
462,
418,
390,
401,
3388,
29889,
5103,
29934,
401,
3339,
364,
401,
13,
462,
462,
462,
29871,
3895,
395,
2371,
13,
462,
462,
462,
29871,
9033,
22800,
8780,
390,
401,
3388,
13,
462,
462,
462,
29871,
5754,
13,
462,
462,
462,
1678,
395,
2230,
5072,
13,
462,
462,
462,
1678,
5300,
9071,
1367,
2672,
426,
18010,
295,
29913,
13,
462,
462,
462,
29871,
15345,
6770,
364,
401,
13,
462,
462,
795,
1723,
3339,
28933,
29934,
401,
3148,
4214,
28933,
13,
462,
462,
3986,
1723,
13,
462,
462,
418,
1723,
3339,
12477,
3289,
16514,
401,
3981,
29879,
3148,
4214,
12477,
3289,
29940,
13,
462,
462,
418,
15345,
6770,
13,
462,
462,
3986,
12477,
3289,
29940,
29892,
13,
462,
462,
3986,
364,
401,
13,
462,
462,
29871,
1723,
3339,
12477,
3289,
16514,
401,
3981,
29879,
11536,
13,
462,
462,
29871,
15149,
20735,
8780,
13,
462,
462,
29871,
313,
13,
462,
462,
418,
5097,
13,
462,
462,
3986,
995,
29918,
978,
3339,
364,
401,
1626,
29892,
13,
462,
462,
3986,
304,
29965,
2928,
29896,
29953,
29898,
1767,
29897,
3339,
364,
401,
13,
462,
462,
418,
3895,
426,
3177,
3888,
29918,
9803,
1836,
3857,
29918,
726,
13,
462,
462,
418,
5754,
21235,
29918,
978,
353,
525,
29934,
16524,
29915,
13,
462,
462,
29871,
1723,
3339,
12477,
3289,
29940,
1170,
3981,
29879,
11536,
3148,
4214,
364,
401,
13,
462,
462,
29871,
15345,
6770,
13,
462,
462,
418,
12477,
3289,
29940,
29892,
13,
462,
462,
418,
364,
401,
29892,
13,
462,
462,
418,
364,
401,
1626,
13,
462,
462,
29871,
15606,
6770,
13,
462,
462,
418,
2533,
29898,
29879,
3981,
29897,
18188,
29892,
13,
462,
462,
418,
364,
401,
1626,
18188,
29892,
13,
462,
462,
418,
12477,
3289,
29940,
23050,
15945,
1642,
4830,
29898,
13,
462,
462,
3986,
7573,
295,
29922,
18010,
295,
29892,
13,
462,
462,
3986,
2943,
3888,
29918,
9803,
29922,
16170,
3888,
1839,
3177,
3888,
29918,
9803,
2033,
8243,
13,
462,
18884,
2143,
1204,
353,
525,
29909,
29915,
13,
462,
9651,
1723,
13,
462,
4706,
21251,
13,
462,
1678,
10353,
13,
18884,
21251,
13,
9651,
10353,
13,
9651,
402,
9203,
29889,
4301,
29898,
13,
18884,
3171,
353,
402,
9203,
29889,
29925,
861,
1379,
29898,
8766,
487,
29889,
23397,
29918,
25180,
29918,
9606,
22530,
29889,
1949,
334,
29871,
29906,
511,
13,
18884,
7243,
1379,
353,
518,
13,
462,
1678,
402,
18877,
29889,
4297,
14732,
29898,
13,
462,
4706,
3611,
353,
525,
29934,
16524,
491,
13154,
491,
3339,
1014,
1212,
742,
13,
462,
4706,
19843,
353,
402,
18877,
29889,
29933,
1718,
29918,
3210,
8322,
29918,
1955,
29902,
3919,
8098,
29918,
29950,
1955,
26664,
1164,
29911,
1964,
29892,
13,
462,
4706,
5912,
353,
402,
18877,
29889,
4297,
14732,
3453,
29898,
13,
462,
9651,
2594,
8513,
353,
402,
18877,
29889,
29933,
1718,
29918,
3210,
8322,
29918,
18799,
12015,
29918,
20387,
29918,
1254,
11375,
29892,
13,
462,
9651,
1510,
26172,
353,
5852,
29892,
13,
462,
9651,
921,
8990,
353,
402,
18877,
29889,
4297,
14732,
16070,
29898,
13,
462,
18884,
3611,
353,
525,
2182,
6358,
639,
1473,
742,
13,
462,
9651,
10353,
13,
462,
9651,
343,
8990,
353,
402,
18877,
29889,
4297,
14732,
16070,
29898,
13,
462,
18884,
1120,
327,
860,
353,
7700,
29892,
13,
462,
18884,
263,
486,
668,
353,
402,
18877,
29889,
29933,
1718,
29918,
3210,
8322,
29918,
6604,
3235,
29918,
11116,
29918,
29907,
3040,
29954,
18929,
29892,
13,
462,
18884,
16892,
9264,
353,
29871,
29896,
29896,
29900,
29892,
13,
462,
18884,
3611,
353,
525,
3289,
3323,
1212,
742,
13,
462,
9651,
10353,
13,
462,
4706,
10353,
13,
462,
4706,
1120,
327,
25525,
353,
5852,
29892,
13,
462,
4706,
22525,
353,
518,
13,
462,
9651,
402,
18877,
29889,
4164,
29950,
1709,
3562,
8667,
29898,
13,
462,
18884,
2566,
353,
946,
29887,
3888,
1839,
9803,
7464,
13,
462,
18884,
1591,
353,
525,
29933,
29954,
18009,
9569,
29915,
718,
946,
29887,
3888,
1839,
2371,
29918,
2146,
600,
861,
7464,
13,
462,
18884,
4513,
353,
946,
29887,
3888,
1839,
14486,
7464,
13,
462,
18884,
2346,
353,
1426,
6312,
29889,
7176,
296,
703,
15945,
29905,
13,
462,
462,
29871,
5097,
13,
462,
462,
418,
451,
8915,
29898,
29878,
401,
1626,
29897,
1577,
364,
401,
1626,
584,
3022,
271,
877,
29934,
16524,
742,
304,
1231,
29898,
29878,
401,
876,
3339,
17440,
29934,
401,
29892,
13,
462,
462,
418,
2533,
29898,
29878,
401,
3981,
29897,
847,
3255,
517,
448,
395,
3166,
29897,
3339,
364,
401,
3981,
29892,
13,
462,
462,
418,
349,
9569,
13,
462,
462,
29871,
3895,
13,
462,
462,
29871,
313,
13,
462,
462,
418,
5097,
13,
462,
462,
3986,
349,
9569,
29892,
13,
462,
462,
3986,
364,
401,
29892,
13,
462,
462,
3986,
2533,
29898,
29878,
401,
3981,
29897,
3339,
364,
401,
3981,
29892,
13,
462,
462,
3986,
738,
29898,
29879,
3981,
29897,
3339,
269,
3981,
13,
462,
462,
418,
3895,
13,
462,
462,
418,
313,
13,
462,
462,
3986,
5097,
13,
462,
462,
795,
349,
9569,
29892,
13,
462,
462,
795,
2533,
29898,
29934,
401,
3388,
29889,
3981,
29897,
3339,
269,
3981,
13,
462,
462,
3986,
3895,
395,
2371,
13,
462,
462,
3986,
9033,
22800,
8780,
390,
401,
3388,
13,
462,
462,
3986,
5754,
395,
2230,
5072,
13,
462,
462,
795,
5300,
9071,
1367,
2672,
426,
18010,
295,
29913,
13,
462,
462,
3986,
15345,
6770,
13,
462,
462,
795,
349,
9569,
13,
462,
462,
3986,
15606,
6770,
269,
3981,
23050,
29892,
349,
9569,
18188,
13,
462,
462,
3986,
27848,
29871,
29941,
29900,
13,
462,
462,
418,
1723,
3339,
349,
9569,
3981,
13,
462,
462,
418,
15149,
19246,
8780,
13,
462,
462,
418,
313,
13,
462,
462,
3986,
5097,
13,
462,
462,
795,
349,
9569,
29892,
13,
462,
462,
795,
390,
401,
3388,
29889,
5103,
29934,
401,
3339,
364,
401,
29892,
13,
462,
462,
795,
2533,
29898,
29934,
401,
3388,
29889,
3981,
29897,
3339,
364,
401,
3981,
13,
462,
462,
3986,
3895,
395,
2371,
13,
462,
462,
3986,
9033,
22800,
8780,
390,
401,
3388,
13,
462,
462,
3986,
5754,
13,
462,
462,
795,
395,
2230,
5072,
13,
462,
462,
795,
5300,
9071,
1367,
2672,
426,
18010,
295,
29913,
13,
462,
462,
3986,
15345,
6770,
13,
462,
462,
795,
349,
9569,
29892,
13,
462,
462,
795,
364,
401,
13,
462,
462,
3986,
25919,
15149,
13,
462,
462,
3986,
313,
13,
462,
462,
795,
5097,
13,
462,
462,
462,
29871,
349,
9569,
29892,
13,
462,
462,
462,
29871,
364,
401,
29892,
13,
462,
462,
462,
29871,
12766,
1254,
29898,
29900,
3339,
501,
2928,
29953,
29946,
29897,
3339,
364,
401,
3981,
13,
462,
462,
795,
3895,
13,
462,
462,
795,
313,
13,
462,
462,
462,
29871,
5097,
13,
462,
462,
462,
539,
29900,
3339,
28933,
29892,
13,
462,
462,
462,
418,
349,
9569,
13,
462,
462,
462,
29871,
3895,
395,
2371,
13,
462,
462,
462,
29871,
5754,
13,
462,
462,
462,
418,
395,
2230,
5072,
13,
462,
462,
462,
418,
5300,
9071,
1367,
2672,
426,
18010,
295,
29913,
13,
462,
462,
462,
29871,
15345,
6770,
349,
9569,
13,
462,
462,
795,
1723,
3339,
28933,
29925,
999,
2251,
13,
462,
462,
795,
15149,
19246,
8780,
13,
462,
462,
795,
313,
13,
462,
462,
462,
29871,
5097,
13,
462,
462,
462,
539,
29900,
3339,
28933,
29892,
13,
462,
462,
462,
418,
390,
401,
3388,
29889,
5103,
29934,
401,
3339,
364,
401,
13,
462,
462,
462,
29871,
3895,
395,
2371,
13,
462,
462,
462,
29871,
9033,
22800,
8780,
390,
401,
3388,
13,
462,
462,
462,
29871,
5754,
13,
462,
462,
462,
1678,
395,
2230,
5072,
13,
462,
462,
462,
1678,
5300,
9071,
1367,
2672,
426,
18010,
295,
29913,
13,
462,
462,
462,
29871,
15345,
6770,
364,
401,
13,
462,
462,
795,
1723,
3339,
28933,
29934,
401,
3148,
4214,
28933,
13,
462,
462,
3986,
1723,
13,
462,
462,
418,
1723,
3339,
349,
9569,
29934,
401,
3981,
29879,
3148,
4214,
349,
9569,
13,
462,
462,
418,
15345,
6770,
13,
462,
462,
3986,
349,
9569,
29892,
13,
462,
462,
3986,
364,
401,
13,
462,
462,
29871,
1723,
3339,
349,
9569,
29934,
401,
3981,
29879,
11536,
13,
462,
462,
29871,
15149,
20735,
8780,
13,
462,
462,
29871,
313,
13,
462,
462,
418,
5097,
13,
462,
462,
3986,
995,
29918,
978,
3339,
364,
401,
1626,
29892,
13,
462,
462,
3986,
304,
29965,
2928,
29896,
29953,
29898,
1767,
29897,
3339,
364,
401,
13,
462,
462,
418,
3895,
426,
3177,
3888,
29918,
9803,
1836,
3857,
29918,
726,
13,
462,
462,
418,
5754,
21235,
29918,
978,
353,
525,
29934,
16524,
29915,
13,
462,
462,
29871,
1723,
3339,
349,
9569,
1170,
3981,
29879,
11536,
3148,
4214,
364,
401,
13,
462,
462,
29871,
15345,
6770,
13,
462,
462,
418,
349,
9569,
29892,
13,
462,
462,
418,
364,
401,
29892,
13,
462,
462,
418,
364,
401,
1626,
13,
462,
462,
29871,
15606,
6770,
13,
462,
462,
418,
2533,
29898,
29879,
3981,
29897,
18188,
29892,
13,
462,
462,
418,
364,
401,
1626,
18188,
29892,
13,
462,
462,
418,
349,
9569,
23050,
15945,
1642,
4830,
29898,
13,
462,
462,
3986,
7573,
295,
29922,
18010,
295,
29892,
13,
462,
462,
3986,
2943,
3888,
29918,
9803,
29922,
16170,
3888,
1839,
3177,
3888,
29918,
9803,
2033,
8243,
13,
462,
18884,
2143,
1204,
353,
525,
29909,
29915,
13,
462,
9651,
1723,
13,
462,
4706,
21251,
13,
462,
1678,
10353,
13,
18884,
21251,
13,
9651,
10353,
13,
9651,
402,
9203,
29889,
4301,
29898,
13,
18884,
3171,
353,
402,
9203,
29889,
29925,
861,
1379,
29898,
8766,
487,
29889,
23397,
29918,
25180,
29918,
9606,
22530,
29889,
1949,
334,
29871,
29906,
511,
13,
18884,
7243,
1379,
353,
518,
13,
462,
1678,
402,
18877,
29889,
4297,
14732,
29898,
13,
462,
4706,
3611,
353,
525,
29934,
16524,
491,
13154,
491,
4343,
1014,
1212,
742,
13,
462,
4706,
19843,
353,
402,
18877,
29889,
29933,
1718,
29918,
3210,
8322,
29918,
1955,
29902,
3919,
8098,
29918,
29950,
1955,
26664,
1164,
29911,
1964,
29892,
13,
462,
4706,
5912,
353,
402,
18877,
29889,
4297,
14732,
3453,
29898,
13,
462,
9651,
2594,
8513,
353,
402,
18877,
29889,
29933,
1718,
29918,
3210,
8322,
29918,
18799,
12015,
29918,
20387,
29918,
1254,
11375,
29892,
13,
462,
9651,
1510,
26172,
353,
5852,
29892,
13,
462,
9651,
921,
8990,
353,
402,
18877,
29889,
4297,
14732,
16070,
29898,
13,
462,
18884,
3611,
353,
525,
2182,
6358,
639,
1473,
742,
13,
462,
9651,
10353,
13,
462,
9651,
343,
8990,
353,
402,
18877,
29889,
4297,
14732,
16070,
29898,
13,
462,
18884,
1120,
327,
860,
353,
7700,
29892,
13,
462,
18884,
263,
486,
668,
353,
402,
18877,
29889,
29933,
1718,
29918,
3210,
8322,
29918,
6604,
3235,
29918,
11116,
29918,
29907,
3040,
29954,
18929,
29892,
13,
462,
18884,
16892,
9264,
353,
29871,
29896,
29896,
29900,
29892,
13,
462,
18884,
3611,
353,
525,
26262,
3323,
1212,
742,
13,
462,
9651,
10353,
13,
462,
4706,
10353,
13,
462,
4706,
1120,
327,
25525,
353,
5852,
29892,
13,
462,
4706,
22525,
353,
518,
13,
462,
9651,
402,
18877,
29889,
4164,
29950,
1709,
3562,
8667,
29898,
13,
462,
18884,
2566,
353,
946,
29887,
3888,
1839,
9803,
7464,
13,
462,
18884,
1591,
353,
525,
16890,
12239,
4032,
4035,
1212,
29879,
29915,
718,
946,
29887,
3888,
1839,
2371,
29918,
2146,
600,
861,
7464,
13,
462,
18884,
4513,
353,
946,
29887,
3888,
1839,
14486,
7464,
13,
462,
18884,
2346,
353,
1426,
6312,
29889,
7176,
296,
703,
15945,
29905,
13,
462,
462,
29871,
5097,
13,
462,
462,
418,
451,
8915,
29898,
29878,
401,
1626,
29897,
1577,
364,
401,
1626,
584,
3022,
271,
877,
29934,
16524,
742,
304,
1231,
29898,
29878,
401,
876,
3339,
17440,
29934,
401,
29892,
13,
462,
462,
418,
2533,
29898,
29878,
401,
3981,
29897,
847,
3255,
517,
448,
395,
3166,
29897,
3339,
364,
401,
3981,
29892,
13,
462,
462,
418,
349,
9569,
13,
462,
462,
29871,
3895,
13,
462,
462,
29871,
313,
13,
462,
462,
418,
5097,
13,
462,
462,
3986,
349,
9569,
29892,
13,
462,
462,
3986,
364,
401,
29892,
13,
462,
462,
3986,
2533,
29898,
29878,
401,
3981,
29897,
3339,
364,
401,
3981,
29892,
13,
462,
462,
3986,
738,
29898,
29879,
3981,
29897,
3339,
269,
3981,
13,
462,
462,
418,
3895,
13,
462,
462,
418,
313,
13,
462,
462,
3986,
5097,
13,
462,
462,
795,
349,
9569,
29892,
13,
462,
462,
795,
2533,
29898,
29934,
401,
3388,
29889,
3981,
29897,
3339,
269,
3981,
13,
462,
462,
3986,
3895,
395,
2371,
13,
462,
462,
3986,
9033,
22800,
8780,
390,
401,
3388,
13,
462,
462,
3986,
5754,
395,
2230,
5072,
13,
462,
462,
795,
5300,
9071,
1367,
2672,
426,
18010,
295,
29913,
13,
462,
462,
3986,
15345,
6770,
13,
462,
462,
795,
349,
9569,
13,
462,
462,
3986,
15606,
6770,
269,
3981,
23050,
29892,
349,
9569,
18188,
13,
462,
462,
3986,
27848,
29871,
29941,
29900,
13,
462,
462,
418,
1723,
3339,
349,
9569,
3981,
13,
462,
462,
418,
15149,
19246,
8780,
13,
462,
462,
418,
313,
13,
462,
462,
3986,
5097,
13,
462,
462,
795,
349,
9569,
29892,
13,
462,
462,
795,
390,
401,
3388,
29889,
5103,
29934,
401,
3339,
364,
401,
29892,
13,
462,
462,
795,
2533,
29898,
29934,
401,
3388,
29889,
3981,
29897,
3339,
364,
401,
3981,
13,
462,
462,
3986,
3895,
395,
2371,
13,
462,
462,
3986,
9033,
22800,
8780,
390,
401,
3388,
13,
462,
462,
3986,
5754,
13,
462,
462,
795,
395,
2230,
5072,
13,
462,
462,
795,
5300,
9071,
1367,
2672,
426,
18010,
295,
29913,
13,
462,
462,
3986,
15345,
6770,
13,
462,
462,
795,
349,
9569,
29892,
13,
462,
462,
795,
364,
401,
13,
462,
462,
3986,
25919,
15149,
13,
462,
462,
3986,
313,
13,
462,
462,
795,
5097,
13,
462,
462,
462,
29871,
349,
9569,
29892,
13,
462,
462,
462,
29871,
364,
401,
29892,
13,
462,
462,
462,
29871,
12766,
1254,
29898,
29900,
3339,
501,
2928,
29953,
29946,
29897,
3339,
364,
401,
3981,
13,
462,
462,
795,
3895,
13,
462,
462,
795,
313,
13,
462,
462,
462,
29871,
5097,
13,
462,
462,
462,
539,
29900,
3339,
28933,
29892,
13,
462,
462,
462,
418,
349,
9569,
13,
462,
462,
462,
29871,
3895,
395,
2371,
13,
462,
462,
462,
29871,
5754,
13,
462,
462,
462,
418,
395,
2230,
5072,
13,
462,
462,
462,
418,
5300,
9071,
1367,
2672,
426,
18010,
295,
29913,
13,
462,
462,
462,
29871,
15345,
6770,
349,
9569,
13,
462,
462,
795,
1723,
3339,
28933,
23095,
13,
462,
462,
795,
15149,
19246,
8780,
13,
462,
462,
795,
313,
13,
462,
462,
462,
29871,
5097,
13,
462,
462,
462,
539,
29900,
3339,
28933,
29892,
13,
462,
462,
462,
418,
390,
401,
3388,
29889,
5103,
29934,
401,
3339,
364,
401,
13,
462,
462,
462,
29871,
3895,
395,
2371,
13,
462,
462,
462,
29871,
9033,
22800,
8780,
390,
401,
3388,
13,
462,
462,
462,
29871,
5754,
13,
462,
462,
462,
1678,
395,
2230,
5072,
13,
462,
462,
462,
1678,
5300,
9071,
1367,
2672,
426,
18010,
295,
29913,
13,
462,
462,
462,
29871,
15345,
6770,
364,
401,
13,
462,
462,
795,
1723,
3339,
28933,
29934,
401,
3148,
4214,
28933,
13,
462,
462,
3986,
1723,
13,
462,
462,
418,
1723,
3339,
349,
9569,
29934,
401,
3981,
29879,
3148,
4214,
349,
9569,
13,
462,
462,
418,
15345,
6770,
13,
462,
462,
3986,
349,
9569,
29892,
13,
462,
462,
3986,
364,
401,
13,
462,
462,
29871,
1723,
3339,
349,
9569,
29934,
401,
3981,
29879,
11536,
13,
462,
462,
29871,
15149,
20735,
8780,
13,
462,
462,
29871,
313,
13,
462,
462,
418,
5097,
13,
462,
462,
3986,
995,
29918,
978,
3339,
364,
401,
1626,
29892,
13,
462,
462,
3986,
304,
29965,
2928,
29896,
29953,
29898,
1767,
29897,
3339,
364,
401,
13,
462,
462,
418,
3895,
426,
3177,
3888,
29918,
9803,
1836,
3857,
29918,
726,
13,
462,
462,
418,
5754,
21235,
29918,
978,
353,
525,
29934,
16524,
29915,
13,
462,
462,
29871,
1723,
3339,
349,
9569,
1170,
3981,
29879,
11536,
3148,
4214,
364,
401,
13,
462,
462,
29871,
15345,
6770,
13,
462,
462,
418,
349,
9569,
29892,
13,
462,
462,
418,
364,
401,
29892,
13,
462,
462,
418,
364,
401,
1626,
13,
462,
462,
29871,
15606,
6770,
13,
462,
462,
418,
2533,
29898,
29879,
3981,
29897,
18188,
29892,
13,
462,
462,
418,
364,
401,
1626,
18188,
29892,
13,
462,
462,
418,
349,
9569,
23050,
15945,
1642,
4830,
29898,
13,
462,
462,
3986,
7573,
295,
29922,
18010,
295,
29892,
13,
462,
462,
3986,
2943,
3888,
29918,
9803,
29922,
16170,
3888,
1839,
3177,
3888,
29918,
9803,
2033,
8243,
13,
462,
18884,
2143,
1204,
353,
525,
29909,
29915,
13,
462,
9651,
1723,
13,
462,
4706,
21251,
13,
462,
1678,
10353,
13,
18884,
21251,
13,
9651,
10353,
13,
9651,
402,
9203,
29889,
4301,
29898,
13,
18884,
3171,
353,
402,
9203,
29889,
29925,
861,
1379,
29898,
8766,
487,
29889,
23397,
29918,
25180,
29918,
9606,
22530,
29889,
1949,
334,
29871,
29906,
511,
13,
18884,
7243,
1379,
353,
518,
13,
462,
1678,
402,
18877,
29889,
4297,
14732,
29898,
13,
462,
4706,
3611,
353,
525,
10303,
633,
7193,
491,
4343,
1014,
1212,
742,
13,
462,
4706,
19843,
353,
402,
18877,
29889,
29933,
1718,
29918,
3210,
8322,
29918,
1955,
29902,
3919,
8098,
29918,
29950,
1955,
26664,
1164,
29911,
1964,
29892,
13,
462,
4706,
5912,
353,
402,
18877,
29889,
4297,
14732,
3453,
29898,
13,
462,
9651,
921,
8990,
353,
402,
18877,
29889,
4297,
14732,
16070,
29898,
13,
462,
18884,
3611,
353,
525,
2182,
6358,
639,
1473,
742,
13,
462,
9651,
10353,
13,
462,
9651,
343,
8990,
353,
402,
18877,
29889,
4297,
14732,
16070,
29898,
13,
462,
18884,
1120,
327,
860,
353,
7700,
29892,
13,
462,
18884,
263,
486,
668,
353,
402,
18877,
29889,
29933,
1718,
29918,
3210,
8322,
29918,
6604,
3235,
29918,
11116,
29918,
29907,
3040,
29954,
18929,
29892,
13,
462,
18884,
16892,
9264,
353,
29871,
29896,
29896,
29900,
29892,
13,
462,
18884,
3611,
353,
525,
26262,
3323,
1212,
742,
13,
462,
9651,
10353,
13,
462,
4706,
10353,
13,
462,
4706,
26695,
353,
518,
13,
462,
9651,
402,
18877,
29889,
4297,
14732,
11591,
29898,
13,
462,
18884,
1024,
353,
525,
4035,
1212,
742,
13,
462,
18884,
2927,
353,
16321,
29909,
29941,
29945,
29906,
4174,
742,
13,
462,
18884,
921,
353,
525,
29984,
7024,
742,
13,
462,
18884,
343,
353,
525,
4035,
1212,
742,
13,
462,
18884,
1426,
353,
525,
29984,
7024,
742,
13,
462,
9651,
10353,
13,
462,
4706,
21251,
13,
462,
4706,
22525,
353,
518,
13,
462,
9651,
402,
18877,
29889,
4164,
29950,
1709,
3562,
8667,
29898,
13,
462,
18884,
2566,
353,
946,
29887,
3888,
1839,
9803,
7464,
13,
462,
18884,
1591,
353,
525,
3010,
2385,
8232,
29915,
718,
946,
29887,
3888,
1839,
2371,
29918,
2146,
600,
861,
7464,
13,
462,
18884,
4513,
353,
946,
29887,
3888,
1839,
14486,
7464,
13,
462,
18884,
2346,
353,
1426,
6312,
29889,
7176,
296,
703,
15945,
29905,
13,
462,
462,
29871,
5097,
13,
462,
462,
418,
3323,
1212,
29892,
13,
462,
462,
418,
660,
7024,
13,
462,
462,
29871,
3895,
13,
462,
462,
29871,
313,
13,
462,
462,
418,
5097,
13,
462,
462,
3986,
383,
11925,
23095,
3339,
3323,
1212,
29892,
13,
462,
462,
3986,
2533,
29898,
10303,
4920,
1509,
3981,
6802,
1566,
517,
448,
395,
3166,
29897,
3339,
660,
7024,
13,
462,
462,
418,
3895,
395,
2371,
13,
462,
462,
418,
5754,
395,
2230,
5072,
13,
462,
462,
3986,
5300,
9071,
1367,
2672,
426,
18010,
295,
29913,
13,
462,
462,
418,
15345,
6770,
383,
11925,
23095,
13,
462,
462,
418,
15606,
6770,
660,
7024,
23050,
13,
462,
462,
418,
27848,
29871,
29946,
29900,
13,
462,
462,
29871,
1723,
13,
462,
462,
29871,
15606,
6770,
660,
7024,
18188,
15945,
1642,
4830,
29898,
13,
462,
462,
418,
7573,
295,
29922,
18010,
295,
8243,
13,
462,
18884,
2143,
1204,
353,
525,
29909,
29915,
13,
462,
9651,
1723,
13,
462,
4706,
21251,
13,
462,
1678,
10353,
13,
18884,
21251,
13,
9651,
10353,
13,
9651,
402,
9203,
29889,
4301,
29898,
13,
18884,
3171,
353,
402,
9203,
29889,
29925,
861,
1379,
29898,
8766,
487,
29889,
23397,
29918,
25180,
29918,
9606,
22530,
29889,
1949,
334,
29871,
29906,
511,
13,
18884,
7243,
1379,
353,
518,
13,
462,
1678,
2346,
29918,
1990,
2450,
29918,
15425,
29898,
13,
462,
4706,
525,
3010,
12965,
491,
3593,
12239,
4343,
1014,
1212,
742,
13,
462,
4706,
525,
26262,
3323,
1212,
742,
13,
462,
4706,
525,
26262,
23095,
742,
13,
462,
4706,
946,
29887,
3888,
29892,
13,
462,
4706,
7573,
295,
29897,
13,
18884,
21251,
13,
9651,
10353,
13,
9651,
402,
9203,
29889,
4301,
29898,
13,
18884,
3171,
353,
402,
9203,
29889,
29925,
861,
1379,
29898,
8766,
487,
29889,
23397,
29918,
25180,
29918,
9606,
22530,
29889,
1949,
334,
29871,
29906,
511,
13,
18884,
7243,
1379,
353,
518,
13,
462,
1678,
2346,
29918,
1990,
2450,
29918,
15425,
29898,
13,
462,
4706,
525,
3010,
12965,
491,
3593,
12239,
3339,
29940,
742,
13,
462,
4706,
525,
3289,
29940,
742,
13,
462,
4706,
525,
4032,
3289,
29940,
742,
13,
462,
4706,
946,
29887,
3888,
29892,
13,
462,
4706,
7573,
295,
29897,
13,
18884,
21251,
13,
9651,
10353,
13,
9651,
402,
9203,
29889,
4301,
29898,
13,
18884,
3171,
353,
402,
9203,
29889,
29925,
861,
1379,
29898,
8766,
487,
29889,
23397,
29918,
25180,
29918,
9606,
22530,
29889,
1949,
334,
29871,
29906,
511,
13,
18884,
7243,
1379,
353,
518,
13,
462,
1678,
2346,
29918,
1990,
2450,
29918,
15425,
29898,
13,
462,
4706,
525,
3010,
12965,
491,
3593,
12239,
3339,
1014,
1212,
742,
13,
462,
4706,
525,
3289,
1014,
1212,
742,
13,
462,
4706,
525,
3289,
23095,
742,
13,
462,
4706,
946,
29887,
3888,
29892,
13,
462,
4706,
7573,
295,
29897,
13,
18884,
21251,
13,
9651,
10353,
13,
4706,
4514,
13,
1678,
1723,
13,
2
] |
era_interim/Save_Min_Geop_Height_in_area_polygon_and_Above_Oro_era_i.py | peterwilletts24/Python-Scripts | 4 | 1614619 | import cPickle as pickle
from shapely.geometry import Point, Polygon
import numpy as np
from netCDF4 import Dataset
from scipy.interpolate import griddata
p_lev = 925
geopotential, longitude_dom, latitude_dom, time_dom, time_hour = pickle.load\
(open('/nfs/a90/eepdw/Data/Saved_data/era_i/era_i_emb_time_update_large_geopotential.p', 'rb'))
pressure_levels = pickle.load(open('/nfs/a90/eepdw/Data/Saved_data/era_i/era_i_emb_pressure_levels.p', 'rb'))
# Monsoon Trough and Ganga Basin combined
polygon = Polygon(((73., 21.), (83., 16.), (87., 22.), (90.,22.), (90.,23.8), (83., 24.2), (76.3, 28.)))
# Ganga Basin
#polygon = Polygon(((87., 22), (75., 27), (76.3, 30.), (83, 26.2), (90, 25.8), (90., 22)))
lons_data= longitude_dom[0]
lats_data = latitude_dom[0]
lons_data,lats_data = np.meshgrid(lons_data, lats_data)
# Find points that are within defined polygon
points = np.array([[long,lat] for long, lat in zip(lons_data.flatten(), lats_data.flatten())])
intersects = np.array(map(polygon.intersects, map(Point, points))).reshape(lons_data.shape)
p_lev_idx = np.where(pressure_levels==p_lev)
geopotential_polygon = geopotential[:, p_lev_idx, intersects]
# Do the same for surface geopotential (still in netcdf format)
#nc = Dataset('/nfs/a90/eepdw/Data/Era_Interim/LandSeaMask/Land_Sea_Mask.nc')
nc = Dataset('/nfs/a90/eepdw/Data/Era_Interim/Orography/era_i_geopotential.nc')
'''
ECMWF give orography as geopotential, which is apparently converted to height by using the WMO gravity constant
9.80665. Ithought latitude would affect it as well but no mention
http://www.ecmwf.int/en/geopotential-defined-units-m2/s2-both-pressure-levels-and-surface-orography-how-can-height-metres
'''
lons,lats = np.meshgrid(nc.variables['longitude'][:], nc.variables['latitude'][:])
oro_regrid = griddata((lats.flatten(), lons.flatten()), nc.variables['z'][:].flatten(), (lats_data,lons_data), method='linear')
oro_polygon = oro_regrid[intersects]
vals = np.where(geopotential_polygon>(oro_polygon/9.80665), geopotential_polygon, np.nan)
min_geop_full_time = np.min(vals,axis=-1)[:,0]
day_mean_min_geop = [np.mean(min_geop_full_time[np.where(time_dom==day)]) for day in np.unique(time_dom)]
np.savez(
'/nfs/a90/eepdw/Data/Era_Interim/Era_interim_TimeVar_on_p_levs_mean_by_day_land_domain_'\
'constrain__and_oro_not_greater_than_data_monsoon_trough_%s' % p_lev,
data=day_mean_min_geop, time_coords=np.unique(time_dom), pressures=pressure_levels[p_lev_idx])
| [
1,
1053,
274,
29925,
860,
280,
408,
5839,
280,
13,
13,
3166,
528,
481,
873,
29889,
19156,
1053,
8984,
29892,
2043,
17125,
13,
13,
5215,
12655,
408,
7442,
13,
13,
3166,
7787,
29907,
4037,
29946,
1053,
13373,
24541,
13,
13,
3166,
4560,
2272,
29889,
1639,
3733,
403,
1053,
6856,
1272,
13,
13,
29886,
29918,
2608,
353,
29871,
29929,
29906,
29945,
13,
13,
479,
459,
327,
2556,
29892,
28745,
29918,
3129,
29892,
26271,
29918,
3129,
29892,
931,
29918,
3129,
29892,
931,
29918,
18721,
29871,
353,
5839,
280,
29889,
1359,
29905,
13,
462,
462,
632,
313,
3150,
11219,
29876,
5847,
29914,
29874,
29929,
29900,
29914,
29872,
1022,
28012,
29914,
1469,
29914,
29903,
10511,
29918,
1272,
29914,
1572,
29918,
29875,
29914,
1572,
29918,
29875,
29918,
1590,
29918,
2230,
29918,
5504,
29918,
16961,
29918,
479,
459,
327,
2556,
29889,
29886,
742,
525,
6050,
8785,
13,
13,
2139,
545,
29918,
5563,
29879,
353,
29871,
5839,
280,
29889,
1359,
29898,
3150,
11219,
29876,
5847,
29914,
29874,
29929,
29900,
29914,
29872,
1022,
28012,
29914,
1469,
29914,
29903,
10511,
29918,
1272,
29914,
1572,
29918,
29875,
29914,
1572,
29918,
29875,
29918,
1590,
29918,
2139,
545,
29918,
5563,
29879,
29889,
29886,
742,
525,
6050,
8785,
13,
13,
29937,
2598,
578,
265,
1605,
820,
322,
402,
12686,
4886,
262,
12420,
13,
3733,
17125,
353,
2043,
17125,
3552,
29898,
29955,
29941,
1696,
29871,
29906,
29896,
9774,
313,
29947,
29941,
1696,
29871,
29896,
29953,
9774,
313,
29947,
29955,
1696,
29871,
29906,
29906,
9774,
313,
29929,
29900,
1696,
29906,
29906,
9774,
313,
29929,
29900,
1696,
29906,
29941,
29889,
29947,
511,
313,
29947,
29941,
1696,
29871,
29906,
29946,
29889,
29906,
511,
313,
29955,
29953,
29889,
29941,
29892,
29871,
29906,
29947,
29889,
4961,
29871,
13,
13,
29937,
402,
12686,
4886,
262,
13,
29937,
3733,
17125,
353,
2043,
17125,
3552,
29898,
29947,
29955,
1696,
29871,
29906,
29906,
511,
313,
29955,
29945,
1696,
29871,
29906,
29955,
511,
313,
29955,
29953,
29889,
29941,
29892,
29871,
29941,
29900,
9774,
313,
29947,
29941,
29892,
29871,
29906,
29953,
29889,
29906,
511,
313,
29929,
29900,
29892,
29871,
29906,
29945,
29889,
29947,
511,
313,
29929,
29900,
1696,
29871,
29906,
29906,
4961,
13,
13,
29880,
787,
29918,
1272,
29922,
28745,
29918,
3129,
29961,
29900,
29962,
13,
29880,
1446,
29918,
1272,
353,
26271,
29918,
3129,
29961,
29900,
29962,
13,
29880,
787,
29918,
1272,
29892,
29880,
1446,
29918,
1272,
353,
7442,
29889,
4467,
29882,
7720,
29898,
29880,
787,
29918,
1272,
29892,
301,
1446,
29918,
1272,
29897,
13,
13,
29937,
29871,
10987,
3291,
393,
526,
2629,
3342,
29807,
13,
13,
9748,
353,
7442,
29889,
2378,
4197,
29961,
5426,
29892,
5066,
29962,
363,
1472,
29892,
3405,
297,
14319,
29898,
29880,
787,
29918,
1272,
29889,
1579,
8606,
3285,
301,
1446,
29918,
1272,
29889,
1579,
8606,
3101,
2314,
13,
1639,
8803,
29879,
353,
7442,
29889,
2378,
29898,
1958,
29898,
3733,
17125,
29889,
1639,
8803,
29879,
29892,
2910,
29898,
5228,
29892,
3291,
876,
467,
690,
14443,
29898,
29880,
787,
29918,
1272,
29889,
12181,
29897,
13,
13,
29886,
29918,
2608,
29918,
13140,
353,
7442,
29889,
3062,
29898,
2139,
545,
29918,
5563,
29879,
1360,
29886,
29918,
2608,
29897,
13,
479,
459,
327,
2556,
29918,
3733,
17125,
353,
1737,
459,
327,
2556,
7503,
29892,
282,
29918,
2608,
29918,
13140,
29892,
25869,
29879,
29962,
13,
13,
13,
29937,
1938,
278,
1021,
363,
7101,
1737,
459,
327,
2556,
29871,
313,
303,
453,
297,
302,
7070,
2176,
3402,
29897,
13,
13,
29937,
17608,
353,
13373,
24541,
11219,
29876,
5847,
29914,
29874,
29929,
29900,
29914,
29872,
1022,
28012,
29914,
1469,
29914,
29923,
336,
29918,
4074,
326,
29914,
22677,
2008,
29874,
19832,
29914,
22677,
29918,
2008,
29874,
29918,
19832,
29889,
17608,
1495,
13,
17608,
353,
13373,
24541,
11219,
29876,
5847,
29914,
29874,
29929,
29900,
29914,
29872,
1022,
28012,
29914,
1469,
29914,
29923,
336,
29918,
4074,
326,
29914,
29949,
307,
4262,
29891,
29914,
1572,
29918,
29875,
29918,
479,
459,
327,
2556,
29889,
17608,
1495,
13,
13,
12008,
13,
11206,
25365,
29943,
2367,
470,
5275,
408,
1737,
459,
327,
2556,
29892,
607,
338,
13229,
11543,
304,
3171,
491,
773,
278,
399,
6720,
20953,
4868,
13,
29929,
29889,
29947,
29900,
29953,
29953,
29945,
29889,
29871,
306,
386,
1774,
26271,
723,
6602,
372,
408,
1532,
541,
694,
3585,
13,
1124,
597,
1636,
29889,
687,
29885,
29893,
29888,
29889,
524,
29914,
264,
29914,
479,
459,
327,
2556,
29899,
12119,
29899,
348,
1169,
29899,
29885,
29906,
29914,
29879,
29906,
29899,
20313,
29899,
2139,
545,
29899,
5563,
29879,
29899,
392,
29899,
7610,
2161,
29899,
272,
5275,
29899,
3525,
29899,
3068,
29899,
3545,
29899,
2527,
690,
13,
12008,
13,
13,
29880,
787,
29892,
29880,
1446,
353,
7442,
29889,
4467,
29882,
7720,
29898,
17608,
29889,
20897,
1839,
5426,
4279,
2033,
7503,
1402,
302,
29883,
29889,
20897,
1839,
5066,
4279,
2033,
7503,
2314,
13,
5801,
29918,
276,
7720,
353,
6856,
1272,
3552,
29880,
1446,
29889,
1579,
8606,
3285,
301,
787,
29889,
1579,
8606,
25739,
302,
29883,
29889,
20897,
1839,
29920,
2033,
7503,
1822,
1579,
8606,
3285,
313,
29880,
1446,
29918,
1272,
29892,
29880,
787,
29918,
1272,
511,
1158,
2433,
10660,
1495,
13,
13,
5801,
29918,
3733,
17125,
353,
28979,
29918,
276,
7720,
29961,
1639,
8803,
29879,
29962,
13,
13,
791,
29879,
353,
7442,
29889,
3062,
29898,
479,
459,
327,
2556,
29918,
3733,
17125,
5961,
5801,
29918,
3733,
17125,
29914,
29929,
29889,
29947,
29900,
29953,
29953,
29945,
511,
1737,
459,
327,
2556,
29918,
3733,
17125,
29892,
7442,
29889,
13707,
29897,
13,
13,
1195,
29918,
479,
459,
29918,
8159,
29918,
2230,
353,
7442,
29889,
1195,
29898,
791,
29879,
29892,
8990,
10457,
29896,
29897,
7503,
29892,
29900,
29962,
13,
3250,
29918,
12676,
29918,
1195,
29918,
479,
459,
353,
518,
9302,
29889,
12676,
29898,
1195,
29918,
479,
459,
29918,
8159,
29918,
2230,
29961,
9302,
29889,
3062,
29898,
2230,
29918,
3129,
1360,
3250,
29897,
2314,
363,
2462,
297,
7442,
29889,
13092,
29898,
2230,
29918,
3129,
4638,
13,
13,
9302,
29889,
7620,
29920,
29898,
13,
1678,
8207,
29876,
5847,
29914,
29874,
29929,
29900,
29914,
29872,
1022,
28012,
29914,
1469,
29914,
29923,
336,
29918,
4074,
326,
29914,
29923,
336,
29918,
1639,
326,
29918,
2481,
9037,
29918,
265,
29918,
29886,
29918,
2608,
29879,
29918,
12676,
29918,
1609,
29918,
3250,
29918,
1049,
29918,
7247,
29918,
12764,
13,
1678,
525,
3075,
6038,
1649,
392,
29918,
5801,
29918,
1333,
29918,
7979,
1008,
29918,
27603,
29918,
1272,
29918,
3712,
578,
265,
29918,
509,
820,
29918,
29995,
29879,
29915,
1273,
282,
29918,
2608,
29892,
29871,
13,
1678,
848,
29922,
3250,
29918,
12676,
29918,
1195,
29918,
479,
459,
29892,
931,
29918,
1111,
4339,
29922,
9302,
29889,
13092,
29898,
2230,
29918,
3129,
511,
3965,
1973,
29922,
2139,
545,
29918,
5563,
29879,
29961,
29886,
29918,
2608,
29918,
13140,
2314,
13,
13,
13,
13,
13,
2
] |
tests/test_show.py | domi007/pigskin | 6 | 10398 | from collections import OrderedDict
import pytest
import vcr
try: # Python 2.7
# requests's ``json()`` function returns strings as unicode (as per the
# JSON spec). In 2.7, those are of type unicode rather than str. basestring
# was created to help with that.
# https://docs.python.org/2/library/functions.html#basestring
basestring = basestring
except NameError:
basestring = str
@pytest.mark.incremental
class TestShow(object):
"""These don't require authentication to Game Pass."""
@vcr.use_cassette('public_API/europe_show.yaml')
@staticmethod
def test_desc(gp):
shows = gp.shows
for s in shows:
show = shows[s]
isinstance(show.desc, basestring)
# content is not required
@vcr.use_cassette('public_API/europe_show.yaml')
@staticmethod
def test_logo(gp):
shows = gp.shows
for s in shows:
show = shows[s]
isinstance(show.logo, basestring)
assert show.logo
@vcr.use_cassette('public_API/europe_show.yaml')
@staticmethod
def test_name(gp):
shows = gp.shows
for s in shows:
show = shows[s]
isinstance(show.name, basestring)
assert show.name
@vcr.use_cassette('public_API/europe_show_seasons.yaml')
@staticmethod
def test_seasons(gp):
shows = gp.shows
for s in shows:
show = shows[s]
assert type(show.seasons) is OrderedDict
assert show.seasons
prev = 9999
for s in show.seasons:
season = show.seasons[s]
# TODO: assert it has content
# TODO: assert is type season
# make sure the years look sane-ish
assert int(s) > 2000 and int(s) < 2050
# make sure it's sorted high to low
assert int(prev) > int(s)
prev = s
| [
1,
515,
16250,
1053,
8170,
287,
21533,
13,
13,
5215,
11451,
1688,
13,
5215,
325,
7283,
13,
13,
13,
2202,
29901,
29871,
396,
5132,
29871,
29906,
29889,
29955,
13,
1678,
396,
7274,
29915,
29879,
4954,
3126,
2555,
29952,
740,
3639,
6031,
408,
29104,
313,
294,
639,
278,
13,
1678,
396,
4663,
1580,
467,
512,
29871,
29906,
29889,
29955,
29892,
1906,
526,
310,
1134,
29104,
3265,
1135,
851,
29889,
2362,
342,
5393,
13,
1678,
396,
471,
2825,
304,
1371,
411,
393,
29889,
13,
1678,
396,
2045,
597,
2640,
29889,
4691,
29889,
990,
29914,
29906,
29914,
5258,
29914,
12171,
29889,
1420,
29937,
6500,
342,
5393,
13,
1678,
2362,
342,
5393,
353,
2362,
342,
5393,
13,
19499,
4408,
2392,
29901,
13,
1678,
2362,
342,
5393,
353,
851,
13,
13,
13,
29992,
2272,
1688,
29889,
3502,
29889,
25629,
284,
13,
1990,
4321,
8964,
29898,
3318,
1125,
13,
1678,
9995,
1349,
968,
1016,
29915,
29873,
1996,
10760,
304,
8448,
6978,
1213,
15945,
13,
1678,
732,
7071,
29878,
29889,
1509,
29918,
29883,
465,
2353,
877,
3597,
29918,
8787,
29914,
29872,
3214,
29918,
4294,
29889,
25162,
1495,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
1243,
29918,
14273,
29898,
29887,
29886,
1125,
13,
4706,
3697,
353,
330,
29886,
29889,
845,
1242,
13,
13,
4706,
363,
269,
297,
3697,
29901,
13,
9651,
1510,
353,
3697,
29961,
29879,
29962,
13,
13,
9651,
338,
8758,
29898,
4294,
29889,
14273,
29892,
2362,
342,
5393,
29897,
13,
9651,
396,
2793,
338,
451,
3734,
13,
13,
13,
1678,
732,
7071,
29878,
29889,
1509,
29918,
29883,
465,
2353,
877,
3597,
29918,
8787,
29914,
29872,
3214,
29918,
4294,
29889,
25162,
1495,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
1243,
29918,
14569,
29898,
29887,
29886,
1125,
13,
4706,
3697,
353,
330,
29886,
29889,
845,
1242,
13,
13,
4706,
363,
269,
297,
3697,
29901,
13,
9651,
1510,
353,
3697,
29961,
29879,
29962,
13,
13,
9651,
338,
8758,
29898,
4294,
29889,
14569,
29892,
2362,
342,
5393,
29897,
13,
9651,
4974,
1510,
29889,
14569,
13,
13,
13,
1678,
732,
7071,
29878,
29889,
1509,
29918,
29883,
465,
2353,
877,
3597,
29918,
8787,
29914,
29872,
3214,
29918,
4294,
29889,
25162,
1495,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
1243,
29918,
978,
29898,
29887,
29886,
1125,
13,
4706,
3697,
353,
330,
29886,
29889,
845,
1242,
13,
13,
4706,
363,
269,
297,
3697,
29901,
13,
9651,
1510,
353,
3697,
29961,
29879,
29962,
13,
13,
9651,
338,
8758,
29898,
4294,
29889,
978,
29892,
2362,
342,
5393,
29897,
13,
9651,
4974,
1510,
29889,
978,
13,
13,
13,
1678,
732,
7071,
29878,
29889,
1509,
29918,
29883,
465,
2353,
877,
3597,
29918,
8787,
29914,
29872,
3214,
29918,
4294,
29918,
344,
7040,
29889,
25162,
1495,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
1243,
29918,
344,
7040,
29898,
29887,
29886,
1125,
13,
4706,
3697,
353,
330,
29886,
29889,
845,
1242,
13,
13,
4706,
363,
269,
297,
3697,
29901,
13,
9651,
1510,
353,
3697,
29961,
29879,
29962,
13,
13,
9651,
4974,
1134,
29898,
4294,
29889,
344,
7040,
29897,
338,
8170,
287,
21533,
13,
9651,
4974,
1510,
29889,
344,
7040,
13,
13,
9651,
12379,
353,
29871,
29929,
29929,
29929,
29929,
13,
9651,
363,
269,
297,
1510,
29889,
344,
7040,
29901,
13,
18884,
4259,
353,
1510,
29889,
344,
7040,
29961,
29879,
29962,
13,
13,
18884,
396,
14402,
29901,
4974,
372,
756,
2793,
13,
18884,
396,
14402,
29901,
4974,
338,
1134,
4259,
13,
13,
18884,
396,
1207,
1854,
278,
2440,
1106,
269,
1662,
29899,
728,
13,
18884,
4974,
938,
29898,
29879,
29897,
1405,
29871,
29906,
29900,
29900,
29900,
322,
938,
29898,
29879,
29897,
529,
29871,
29906,
29900,
29945,
29900,
13,
13,
18884,
396,
1207,
1854,
372,
29915,
29879,
12705,
1880,
304,
4482,
13,
18884,
4974,
938,
29898,
16304,
29897,
1405,
938,
29898,
29879,
29897,
13,
18884,
12379,
353,
269,
13,
2
] |
backend/app/utils/fields/project.py | LiXuanqi/NuaaOversea-flask-react | 0 | 154739 | #!/usr/bin/env python
# encoding: utf-8
"""
File name: project.py
Function Des: ...
~~~~~~~~~~
author: 1_x7 <<EMAIL>> <http://lixuanqi.github.io>
"""
from flask_restful import fields
project_single_fields = {
'id': fields.Integer,
'name': fields.String,
'value': fields.Integer
}
projects_fields = {
'projects': fields.List(fields.Nested(project_single_fields))
}
| [
1,
18787,
4855,
29914,
2109,
29914,
6272,
3017,
13,
29937,
8025,
29901,
23616,
29899,
29947,
13,
13,
15945,
29908,
13,
1678,
3497,
1024,
29901,
2060,
29889,
2272,
13,
1678,
6680,
2726,
29901,
2023,
13,
1678,
3695,
26594,
30022,
13,
13,
1678,
4148,
29901,
29871,
29896,
29918,
29916,
29955,
3532,
26862,
6227,
6778,
529,
1124,
597,
492,
29916,
12323,
26461,
29889,
3292,
29889,
601,
29958,
13,
13,
15945,
29908,
13,
13,
3166,
29784,
29918,
5060,
1319,
1053,
4235,
13,
13,
4836,
29918,
14369,
29918,
9621,
353,
426,
13,
1678,
525,
333,
2396,
4235,
29889,
7798,
29892,
13,
1678,
525,
978,
2396,
4235,
29889,
1231,
29892,
13,
1678,
525,
1767,
2396,
4235,
29889,
7798,
13,
29913,
13,
13,
16418,
29918,
9621,
353,
426,
13,
1678,
525,
16418,
2396,
4235,
29889,
1293,
29898,
9621,
29889,
29940,
2868,
29898,
4836,
29918,
14369,
29918,
9621,
876,
13,
29913,
13,
2
] |
apps/backend/tests/components/collections/agent/utils.py | ZhuoZhuoCrayon/bk-nodeman | 0 | 135061 | # -*- coding: utf-8 -*-
"""
TencentBlueKing is pleased to support the open source community by making 蓝鲸智云-节点管理(BlueKing-BK-NODEMAN) available.
Copyright (C) 2017-2021 THL A29 Limited, 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 https://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 copy
from django.conf import settings
from mock import MagicMock
from apps.backend.api.constants import JobDataStatus, JobIPStatus
from apps.backend.subscription import tools
from apps.node_man import constants as const
from apps.node_man import models
DEFAULT_CREATOR = "admin"
DEFAULT_BIZ_ID_NAME = {"bk_biz_id": "10", "bk_biz_name": "测试Pipeline原子专用"}
DEFAULT_CLOUD_NAME = "直连区域"
DEFAULT_AP_ID = const.DEFAULT_AP_ID
DEFAULT_NODE_TYPE = "INSTANCE"
DEFAULT_OBJ_TYPE = "HOST"
DEFAULT_INSTANCE_ID = "host|instance|host|127.0.0.1-0-0"
CALLBACK_URL = "http://127.0.0.1/backend"
# ---------订阅任务id参数--------------
SUBSCRIPTION_ID = 61
SUBSCRIPTION_INSTANCE_RECORD_ID = 95
SUBSCRIPTION_TASK_ID = 91
JOB_ID = 56
JOB_TASK_ID = 100
BK_HOST_ID = 23333
# 当前原子任务id
JOB_TASK_PIPELINE_ID = "1ae89ce9deec319bbd8727a0c4b2ca82"
# 安装线的pipeline id
INSTANCE_RECORD_ROOT_PIPELINE_ID = "98d467d07e453e1b9f24e77c8c6743fb"
# 测试伪造ip
TEST_IP = "127.0.0.1"
# Job作业实例id
JOB_INSTANCE_ID = 10000
# ---------mock path--------------
SSH_MAN_MOCK_PATH = "apps.backend.components.collections.agent.SshMan"
CLIENT_V2_MOCK_PATH = "apps.backend.components.collections.agent.client_v2"
JOB_CLIENT_MOCK_PATH = "apps.backend.api.job.get_client_by_user"
JOB_VERSION_MOCK_PATH = "apps.backend.api.job.settings.JOB_VERSION"
POLLING_TIMEOUT_MOCK_PATH = "apps.backend.components.collections.job.POLLING_TIMEOUT"
# 目标主机信息
INSTANCE_INFO = {
"key": "",
"port": 22,
"ap_id": const.DEFAULT_AP_ID,
"account": "root",
"os_type": const.OsType.LINUX,
"login_ip": "",
"password": "<PASSWORD>",
"username": DEFAULT_CREATOR,
"auth_type": const.AuthType.PASSWORD,
"bk_biz_id": DEFAULT_BIZ_ID_NAME["bk_biz_id"],
"is_manual": False,
"retention": 1,
"bk_os_type": const.BK_OS_TYPE[const.OsType.LINUX],
"bk_biz_name": DEFAULT_BIZ_ID_NAME["bk_biz_name"],
"bk_cloud_id": const.DEFAULT_CLOUD,
"bk_cloud_name": DEFAULT_CLOUD_NAME,
"host_node_type": const.NodeType.AGENT,
"bk_host_innerip": TEST_IP,
"bk_host_outerip": "",
"bk_supplier_account": "0",
"peer_exchange_switch_for_agent": 1,
}
ACT_INPUTS = {
"host_info": dict(list(INSTANCE_INFO.items()) + [("bt_speed_limit", "None")]),
# 注册后会填充该值
"bk_host_id": "",
"description": "安装....",
"blueking_language": "zh-hans",
}
HOST_PARAMS = {
"bk_host_id": BK_HOST_ID,
"bk_biz_id": DEFAULT_BIZ_ID_NAME["bk_biz_id"],
"bk_cloud_id": const.DEFAULT_CLOUD,
"inner_ip": TEST_IP,
"outer_ip": None,
"login_ip": TEST_IP,
"data_ip": None,
"os_type": "LINUX",
"node_type": const.NodeType.AGENT,
"node_from": "NODE_MAN",
"ap_id": const.DEFAULT_AP_ID,
"upstream_nodes": [],
"is_manual": 0,
"extra_data": {"bt_speed_limit": None, "peer_exchange_switch_for_agent": 1},
}
IDENTITY_DATA_PARAMS = {
"bk_host_id": BK_HOST_ID,
"auth_type": const.AuthType.PASSWORD,
"account": "root",
"password": "<PASSWORD>",
"port": 22,
"key": "aes_str:::LXqh",
"extra_data": {},
"retention": 1,
}
SUBSCRIPTION_PARAMS = {
"id": SUBSCRIPTION_ID,
"object_type": DEFAULT_OBJ_TYPE,
"node_type": DEFAULT_NODE_TYPE,
# 对于Pipeline原子的测试都只用一台主机
"nodes": [
{
"ip": INSTANCE_INFO["bk_host_innerip"],
"bk_cloud_id": const.DEFAULT_CLOUD,
"instance_info": INSTANCE_INFO,
"bk_supplier_account": "0",
}
],
"creator": DEFAULT_CREATOR,
}
SUBSCRIPTION_TASK_PARAMS = {
"id": SUBSCRIPTION_TASK_ID,
"subscription_id": SUBSCRIPTION_ID, # 根据实际创建进行修改
"scope": {
"nodes": [
{
"ip": INSTANCE_INFO["bk_host_innerip"],
"bk_cloud_id": const.DEFAULT_CLOUD,
"instance_info": INSTANCE_INFO,
"bk_supplier_account": "0",
}
],
"node_type": DEFAULT_NODE_TYPE,
"object_type": DEFAULT_OBJ_TYPE,
"need_register": True,
},
"actions": {
# 每台主机都有一个实例id,最后根据补参重新生成
DEFAULT_INSTANCE_ID: {
# 默认安装任务
"agent": const.JobType.INSTALL_AGENT
}
},
# 是否为自动触发
"is_auto_trigger": 0,
}
JOB_PARAMS = {
"id": JOB_ID,
"created_by": DEFAULT_CREATOR,
"job_type": const.JobType.INSTALL_AGENT,
"subscription_id": SUBSCRIPTION_ID, # 根据实际创建进行修改
# Pipeline原子默认只有一个安装任务
"task_id_list": [SUBSCRIPTION_TASK_ID],
"status": const.JobStatusType.RUNNING,
"global_params": {},
"statistics": {"total_count": 1, "failed_count": 0, "pending_count": 1, "running_count": 0, "success_count": 0},
"bk_biz_scope": [DEFAULT_BIZ_ID_NAME["bk_biz_id"]],
"error_hosts": [],
}
JOB_TASK_PARAMS = {
"id": JOB_TASK_ID,
"job_id": JOB_ID,
# 没有注册到cmdb之前是空
"bk_host_id": BK_HOST_ID,
"instance_id": DEFAULT_INSTANCE_ID,
"pipeline_id": JOB_TASK_PIPELINE_ID,
"status": const.StatusType.RUNNING,
"current_step": "正在安装",
}
SUBSCRIPTION_INSTANCE_RECORD_PARAMS = {
"id": SUBSCRIPTION_INSTANCE_RECORD_ID,
"task_id": SUBSCRIPTION_TASK_ID,
"subscription_id": SUBSCRIPTION_ID,
"instance_id": DEFAULT_INSTANCE_ID,
# 安装时,注册到cmdb后会插入bk_host_id
"instance_info": {"host": INSTANCE_INFO},
"steps": [
{
"id": "agent",
"type": const.NodeType.AGENT,
"action": const.JobType.INSTALL_AGENT,
"extra_info": {},
"pipeline_id": "3341978fe1f33b2b99615818df5c7a89",
}
],
"pipeline_id": INSTANCE_RECORD_ROOT_PIPELINE_ID,
}
JOB_INSTANCE_ID_METHOD_RETURN = {
"result": True,
"code": 0,
"message": "success",
"data": {"job_instance_name": "API Quick Distribution File1521101427176", "job_instance_id": JOB_INSTANCE_ID},
}
JOB_GET_INSTANCE_LOG_RETURN = {
"result": True,
"code": 0,
"message": "",
"data": [
{
"is_finished": True,
"step_instance_id": 90000,
"name": "test",
"status": JobDataStatus.SUCCESS,
"step_results": [
{
"ip_status": JobIPStatus.SUCCESS,
"tag": "xxx",
"ip_logs": [
{
"retry_count": 0,
"total_time": 60.599,
"start_time": "2020-08-05 14:39:30 +0800",
"end_time": "2020-08-05 14:40:31 +0800",
"ip": TEST_IP,
"bk_cloud_id": 0,
"error_code": 0,
"exit_code": 0,
"log_content": "success",
}
],
}
],
}
],
}
GET_JOB_INSTANCE_STATUS_V2_C_RETURN = {
"is_finished": False,
"job_instance": {
"job_instance_id": JOB_INSTANCE_ID,
"bk_biz_id": DEFAULT_BIZ_ID_NAME["bk_biz_id"],
"name": "API Quick execution script1521089795887",
"operator": DEFAULT_CREATOR,
"bk_job_id": 4355,
"create_time": "2018-03-15 12:56:35 +0800",
"status": JobDataStatus.PENDING,
},
}
# 适用于 client_v2
JOB_INSTANCE_ID_METHOD_V2_C_RETURN = JOB_INSTANCE_ID_METHOD_RETURN["data"]
class SshManMockClient:
def __init__(
self,
get_and_set_prompt_return=None,
send_cmd_return_return=None,
safe_close_return=None,
ssh_return=None,
):
self.get_and_set_prompt = MagicMock(return_value=get_and_set_prompt_return)
self.send_cmd = MagicMock(return_value=send_cmd_return_return)
self.safe_close = MagicMock(return_value=safe_close_return)
self.ssh = MagicMock(return_value=ssh_return)
class GseMockClient:
def __init__(self, get_agent_status_return=None, get_agent_info_return=None):
self.gse = MagicMock()
self.gse.get_agent_status = MagicMock(return_value=get_agent_status_return)
self.gse.get_agent_info = MagicMock(return_value=get_agent_info_return)
class CMDBMockClient:
def __init__(
self,
add_host_to_resource_result=None,
search_business_result=None,
list_biz_hosts_result=None,
list_hosts_without_biz_result=None,
find_host_biz_relations_result=None,
):
self.cc = MagicMock()
self.cc.add_host_to_resource = MagicMock(return_value=add_host_to_resource_result)
self.cc.search_business = MagicMock(return_value=search_business_result)
self.cc.list_biz_hosts = MagicMock(return_value=list_biz_hosts_result)
self.cc.list_hosts_without_biz = MagicMock(return_value=list_hosts_without_biz_result)
self.cc.find_host_biz_relations = MagicMock(return_value=find_host_biz_relations_result)
class JobMockClient:
def __init__(
self,
fast_execute_script_return=None,
get_job_instance_log_return=None,
fast_push_file_return=None,
push_config_file_return=None,
get_job_instance_status_return=None,
):
self.job = MagicMock()
self.job.fast_execute_script = MagicMock(return_value=fast_execute_script_return)
self.job.get_job_instance_log = MagicMock(return_value=get_job_instance_log_return)
self.job.fast_push_file = MagicMock(return_value=fast_push_file_return)
self.job.push_config_file = MagicMock(return_value=push_config_file_return)
self.job.get_job_instance_status = MagicMock(return_value=get_job_instance_status_return)
class AgentTestObjFactory:
@classmethod
def replace_obj_attr_values(cls, obj, obj_attr_values):
# 原地修改
if obj_attr_values is None:
return obj
for attr, value in obj_attr_values.items():
if attr not in obj:
continue
obj[attr] = value
@classmethod
def inputs(cls, attr_values=None, instance_info_attr_values=None):
instance_info = copy.deepcopy(INSTANCE_INFO)
inputs = copy.deepcopy(ACT_INPUTS)
cls.replace_obj_attr_values(instance_info, instance_info_attr_values)
inputs["host_info"] = dict(list(instance_info.items()) + [("bt_speed_limit", "None")])
if "bt_speed_limit" in instance_info_attr_values:
inputs["host_info"]["bt_speed_limit"] = instance_info_attr_values["bt_speed_limit"]
cls.replace_obj_attr_values(inputs, attr_values)
return inputs
@classmethod
def subscription_obj(cls, obj_attr_values=None, instance_info_attr_values=None, is_obj=False):
instance_info = copy.deepcopy(INSTANCE_INFO)
subscription_params = copy.deepcopy(SUBSCRIPTION_PARAMS)
cls.replace_obj_attr_values(instance_info, instance_info_attr_values)
if instance_info_attr_values is not None:
subscription_params["nodes"][0]["instance_info"] = instance_info
subscription_params["nodes"][0]["ip"] = instance_info["bk_host_innerip"]
cls.replace_obj_attr_values(subscription_params, obj_attr_values)
if not is_obj:
subscription_params.pop("id", None)
return models.Subscription(**subscription_params) if is_obj else subscription_params
@classmethod
def subscription_task_obj(cls, obj_attr_values=None, instance_info_attr_values=None, is_obj=False):
instance_info = copy.deepcopy(INSTANCE_INFO)
subscription_task_params = copy.deepcopy(SUBSCRIPTION_TASK_PARAMS)
cls.replace_obj_attr_values(instance_info, instance_info_attr_values)
if instance_info_attr_values is not None:
subscription_task_params["scope"]["nodes"][0]["instance_info"] = instance_info
subscription_task_params["scope"]["nodes"][0]["ip"] = instance_info["bk_host_innerip"]
instance_id = tools.create_node_id(
{
"object_type": DEFAULT_OBJ_TYPE,
"node_type": DEFAULT_NODE_TYPE,
"bk_cloud_id": instance_info["bk_cloud_id"],
"ip": instance_info["bk_host_innerip"],
}
)
subscription_task_params["actions"].pop(DEFAULT_INSTANCE_ID)
subscription_task_params["actions"] = {instance_id: {"agent": const.JobType.INSTALL_AGENT}}
cls.replace_obj_attr_values(subscription_task_params, obj_attr_values)
if not is_obj:
subscription_task_params.pop("id", None)
return models.SubscriptionTask(**subscription_task_params) if is_obj else subscription_task_params
@classmethod
def subscription_instance_record_obj(cls, obj_attr_values=None, instance_info_attr_values=None, is_obj=False):
instance_info = copy.deepcopy(INSTANCE_INFO)
subscription_instance_record_params = copy.deepcopy(SUBSCRIPTION_INSTANCE_RECORD_PARAMS)
cls.replace_obj_attr_values(instance_info, instance_info_attr_values)
if instance_info_attr_values is not None:
subscription_instance_record_params["instance_info"]["host"] = instance_info
subscription_instance_record_params["instance_id"] = tools.create_node_id(
{
"object_type": DEFAULT_OBJ_TYPE,
"node_type": DEFAULT_NODE_TYPE,
"bk_cloud_id": instance_info["bk_cloud_id"],
"ip": instance_info["bk_host_innerip"],
}
)
cls.replace_obj_attr_values(subscription_instance_record_params, obj_attr_values)
return (
models.SubscriptionInstanceRecord(**subscription_instance_record_params)
if is_obj
else subscription_instance_record_params
)
@classmethod
def job_obj(cls, obj_attr_values=None, is_obj=False):
job_params = copy.deepcopy(JOB_PARAMS)
cls.replace_obj_attr_values(job_params, obj_attr_values)
if not is_obj:
job_params.pop("id", None)
return models.Job(**job_params) if is_obj else job_params
@classmethod
def job_task_obj(cls, obj_attr_values=None, is_obj=False):
job_task_params = copy.deepcopy(JOB_TASK_PARAMS)
cls.replace_obj_attr_values(job_task_params, obj_attr_values)
if not is_obj:
job_task_params.pop("id", None)
return models.JobTask(**job_task_params) if is_obj else job_task_params
@classmethod
def identity_data_obj(cls, obj_attr_values=None, is_obj=False):
identity_data_params = copy.deepcopy(IDENTITY_DATA_PARAMS)
cls.replace_obj_attr_values(identity_data_params, obj_attr_values)
if not is_obj:
identity_data_params.pop("id", None)
return models.IdentityData(**identity_data_params) if is_obj else identity_data_params
@classmethod
def host_obj(cls, obj_attr_values=None, is_obj=False):
host_params = copy.deepcopy(HOST_PARAMS)
cls.replace_obj_attr_values(host_params, obj_attr_values)
if not is_obj:
host_params.pop("id", None)
return models.Host(**host_params) if is_obj else host_params
@classmethod
def init_db(cls):
# 初始化callback_url
settings.BKAPP_NODEMAN_CALLBACK_URL = CALLBACK_URL
settings.BKAPP_NODEMAN_OUTER_CALLBACK_URL = CALLBACK_URL
subscription_params = cls.subscription_obj()
subscription = models.Subscription.objects.create(**subscription_params)
subscription_task_params = cls.subscription_task_obj(obj_attr_values={"subscription_id": subscription.id})
subscription_task = models.SubscriptionTask.objects.create(**subscription_task_params)
subscription_instance_record_params = cls.subscription_instance_record_obj(
obj_attr_values={"subscription_id": subscription.id, "task_id": subscription_task.id}
)
subscription_instance_record = models.SubscriptionInstanceRecord.objects.create(
**subscription_instance_record_params
)
job_params = cls.job_obj(
obj_attr_values={"subscription_id": subscription.id, "task_id_list": [subscription_task.id]}
)
job = models.Job.objects.create(**job_params)
job_task_params = cls.job_task_obj({"job_id": job.id})
job_task = models.JobTask.objects.create(**job_task_params)
host_params = cls.host_obj()
host = models.Host.objects.create(**host_params)
identity_data_params = cls.identity_data_obj()
models.IdentityData.objects.create(**identity_data_params)
return {
"subscription_id": subscription.id,
"subscription_task_id": subscription_task.id,
"subscription_instance_record_id": subscription_instance_record.id,
"job_id": job.id,
"job_task_id": job_task.id,
"bk_host_id": host.bk_host_id,
}
| [
1,
396,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
15945,
29908,
13,
29911,
264,
1760,
21319,
29968,
292,
338,
22301,
304,
2304,
278,
1722,
2752,
7881,
491,
3907,
29871,
235,
150,
160,
236,
181,
187,
31676,
31784,
29899,
31669,
30940,
31624,
30687,
29898,
21319,
29968,
292,
29899,
29933,
29968,
29899,
6632,
2287,
27616,
29897,
3625,
29889,
13,
11882,
1266,
313,
29907,
29897,
29871,
29906,
29900,
29896,
29955,
29899,
29906,
29900,
29906,
29896,
3446,
29931,
319,
29906,
29929,
28873,
29892,
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,
2045,
597,
22156,
1167,
29889,
990,
29914,
506,
11259,
29914,
26349,
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,
3509,
13,
13,
3166,
9557,
29889,
5527,
1053,
6055,
13,
3166,
11187,
1053,
26494,
18680,
13,
13,
3166,
11446,
29889,
27852,
29889,
2754,
29889,
3075,
1934,
1053,
17163,
1469,
5709,
29892,
17163,
5690,
5709,
13,
3166,
11446,
29889,
27852,
29889,
1491,
22371,
1053,
8492,
13,
3166,
11446,
29889,
3177,
29918,
1171,
1053,
17727,
408,
1040,
13,
3166,
11446,
29889,
3177,
29918,
1171,
1053,
4733,
13,
13,
23397,
29918,
22245,
1299,
1955,
353,
376,
6406,
29908,
13,
13,
23397,
29918,
12809,
29999,
29918,
1367,
29918,
5813,
353,
8853,
29890,
29895,
29918,
29890,
466,
29918,
333,
1115,
376,
29896,
29900,
613,
376,
29890,
29895,
29918,
29890,
466,
29918,
978,
1115,
376,
31851,
31787,
29925,
23828,
30667,
30319,
31756,
30406,
9092,
13,
13,
23397,
29918,
29907,
3927,
15789,
29918,
5813,
353,
376,
31157,
31903,
30467,
232,
162,
162,
29908,
13,
13,
23397,
29918,
3301,
29918,
1367,
353,
1040,
29889,
23397,
29918,
3301,
29918,
1367,
13,
13,
23397,
29918,
6632,
2287,
29918,
11116,
353,
376,
25580,
23219,
29908,
13,
13,
23397,
29918,
14824,
29967,
29918,
11116,
353,
376,
20832,
29908,
13,
13,
23397,
29918,
25580,
23219,
29918,
1367,
353,
376,
3069,
29989,
8758,
29989,
3069,
29989,
29896,
29906,
29955,
29889,
29900,
29889,
29900,
29889,
29896,
29899,
29900,
29899,
29900,
29908,
13,
13,
29907,
9818,
29933,
11375,
29918,
4219,
353,
376,
1124,
597,
29896,
29906,
29955,
29889,
29900,
29889,
29900,
29889,
29896,
29914,
27852,
29908,
13,
13,
29937,
448,
1378,
235,
177,
165,
236,
155,
136,
31450,
31358,
333,
31125,
30354,
9072,
489,
13,
20633,
7187,
24290,
2725,
29918,
1367,
353,
29871,
29953,
29896,
13,
13,
20633,
7187,
24290,
2725,
29918,
25580,
23219,
29918,
1525,
29907,
25593,
29918,
1367,
353,
29871,
29929,
29945,
13,
13,
20633,
7187,
24290,
2725,
29918,
29911,
3289,
29968,
29918,
1367,
353,
29871,
29929,
29896,
13,
13,
29967,
14824,
29918,
1367,
353,
29871,
29945,
29953,
13,
13,
29967,
14824,
29918,
29911,
3289,
29968,
29918,
1367,
353,
29871,
29896,
29900,
29900,
13,
13,
29933,
29968,
29918,
20832,
29918,
1367,
353,
29871,
29906,
29941,
29941,
29941,
29941,
13,
13,
29937,
29871,
30948,
30658,
30667,
30319,
31450,
31358,
333,
13,
29967,
14824,
29918,
29911,
3289,
29968,
29918,
2227,
4162,
18521,
29918,
1367,
353,
376,
29896,
3660,
29947,
29929,
346,
29929,
311,
687,
29941,
29896,
29929,
1327,
29881,
29947,
29955,
29906,
29955,
29874,
29900,
29883,
29946,
29890,
29906,
1113,
29947,
29906,
29908,
13,
13,
29937,
29871,
30670,
31905,
31532,
30210,
13096,
5570,
1178,
13,
25580,
23219,
29918,
1525,
29907,
25593,
29918,
21289,
29918,
2227,
4162,
18521,
29918,
1367,
353,
376,
29929,
29947,
29881,
29946,
29953,
29955,
29881,
29900,
29955,
29872,
29946,
29945,
29941,
29872,
29896,
29890,
29929,
29888,
29906,
29946,
29872,
29955,
29955,
29883,
29947,
29883,
29953,
29955,
29946,
29941,
14943,
29908,
13,
13,
29937,
29871,
31851,
31787,
231,
191,
173,
31420,
666,
13,
18267,
29918,
5690,
353,
376,
29896,
29906,
29955,
29889,
29900,
29889,
29900,
29889,
29896,
29908,
13,
13,
29937,
17163,
30732,
31729,
31195,
31507,
333,
13,
29967,
14824,
29918,
25580,
23219,
29918,
1367,
353,
29871,
29896,
29900,
29900,
29900,
29900,
13,
13,
29937,
448,
1378,
17640,
2224,
9072,
489,
13,
1799,
29950,
29918,
27616,
29918,
6720,
7077,
29918,
10145,
353,
376,
13371,
29889,
27852,
29889,
14036,
29889,
29027,
29889,
14748,
29889,
29903,
845,
2517,
29908,
13,
13,
27205,
3919,
29918,
29963,
29906,
29918,
6720,
7077,
29918,
10145,
353,
376,
13371,
29889,
27852,
29889,
14036,
29889,
29027,
29889,
14748,
29889,
4645,
29918,
29894,
29906,
29908,
13,
13,
29967,
14824,
29918,
27205,
3919,
29918,
6720,
7077,
29918,
10145,
353,
376,
13371,
29889,
27852,
29889,
2754,
29889,
9057,
29889,
657,
29918,
4645,
29918,
1609,
29918,
1792,
29908,
13,
13,
29967,
14824,
29918,
16358,
29918,
6720,
7077,
29918,
10145,
353,
376,
13371,
29889,
27852,
29889,
2754,
29889,
9057,
29889,
11027,
29889,
29967,
14824,
29918,
16358,
29908,
13,
13,
13152,
2208,
4214,
29918,
15307,
12015,
29918,
6720,
7077,
29918,
10145,
353,
376,
13371,
29889,
27852,
29889,
14036,
29889,
29027,
29889,
9057,
29889,
13152,
2208,
4214,
29918,
15307,
12015,
29908,
13,
13,
13,
29937,
29871,
30895,
31062,
30888,
31429,
30689,
31021,
13,
25580,
23219,
29918,
11690,
353,
426,
13,
1678,
376,
1989,
1115,
12633,
13,
1678,
376,
637,
1115,
29871,
29906,
29906,
29892,
13,
1678,
376,
481,
29918,
333,
1115,
1040,
29889,
23397,
29918,
3301,
29918,
1367,
29892,
13,
1678,
376,
10149,
1115,
376,
4632,
613,
13,
1678,
376,
359,
29918,
1853,
1115,
1040,
29889,
24768,
1542,
29889,
23714,
29965,
29990,
29892,
13,
1678,
376,
7507,
29918,
666,
1115,
12633,
13,
1678,
376,
5630,
1115,
9872,
25711,
17013,
28341,
13,
1678,
376,
6786,
1115,
22236,
29918,
22245,
1299,
1955,
29892,
13,
1678,
376,
5150,
29918,
1853,
1115,
1040,
29889,
6444,
1542,
29889,
25711,
17013,
29892,
13,
1678,
376,
29890,
29895,
29918,
29890,
466,
29918,
333,
1115,
22236,
29918,
12809,
29999,
29918,
1367,
29918,
5813,
3366,
29890,
29895,
29918,
29890,
466,
29918,
333,
12436,
13,
1678,
376,
275,
29918,
11288,
1115,
7700,
29892,
13,
1678,
376,
2267,
2509,
1115,
29871,
29896,
29892,
13,
1678,
376,
29890,
29895,
29918,
359,
29918,
1853,
1115,
1040,
29889,
29933,
29968,
29918,
3267,
29918,
11116,
29961,
3075,
29889,
24768,
1542,
29889,
23714,
29965,
29990,
1402,
13,
1678,
376,
29890,
29895,
29918,
29890,
466,
29918,
978,
1115,
22236,
29918,
12809,
29999,
29918,
1367,
29918,
5813,
3366,
29890,
29895,
29918,
29890,
466,
29918,
978,
12436,
13,
1678,
376,
29890,
29895,
29918,
9274,
29918,
333,
1115,
1040,
29889,
23397,
29918,
29907,
3927,
15789,
29892,
13,
1678,
376,
29890,
29895,
29918,
9274,
29918,
978,
1115,
22236,
29918,
29907,
3927,
15789,
29918,
5813,
29892,
13,
1678,
376,
3069,
29918,
3177,
29918,
1853,
1115,
1040,
29889,
4247,
1542,
29889,
10051,
3919,
29892,
13,
1678,
376,
29890,
29895,
29918,
3069,
29918,
3993,
666,
1115,
17067,
1254,
29918,
5690,
29892,
13,
1678,
376,
29890,
29895,
29918,
3069,
29918,
5561,
666,
1115,
12633,
13,
1678,
376,
29890,
29895,
29918,
19303,
4926,
29918,
10149,
1115,
376,
29900,
613,
13,
1678,
376,
412,
261,
29918,
6543,
29918,
15123,
29918,
1454,
29918,
14748,
1115,
29871,
29896,
29892,
13,
29913,
13,
13,
17923,
29918,
1177,
12336,
29903,
353,
426,
13,
1678,
376,
3069,
29918,
3888,
1115,
9657,
29898,
1761,
29898,
25580,
23219,
29918,
11690,
29889,
7076,
3101,
718,
518,
703,
3116,
29918,
19322,
29918,
13400,
613,
376,
8516,
1159,
11724,
13,
1678,
396,
29871,
31368,
232,
137,
143,
30822,
30437,
232,
164,
174,
232,
136,
136,
31751,
30959,
13,
1678,
376,
29890,
29895,
29918,
3069,
29918,
333,
1115,
12633,
13,
1678,
376,
8216,
1115,
376,
30670,
31905,
3045,
613,
13,
1678,
376,
9539,
9292,
29918,
11675,
1115,
376,
17599,
29899,
29882,
550,
613,
13,
29913,
13,
13,
20832,
29918,
16320,
29909,
4345,
353,
426,
13,
1678,
376,
29890,
29895,
29918,
3069,
29918,
333,
1115,
350,
29968,
29918,
20832,
29918,
1367,
29892,
13,
1678,
376,
29890,
29895,
29918,
29890,
466,
29918,
333,
1115,
22236,
29918,
12809,
29999,
29918,
1367,
29918,
5813,
3366,
29890,
29895,
29918,
29890,
466,
29918,
333,
12436,
13,
1678,
376,
29890,
29895,
29918,
9274,
29918,
333,
1115,
1040,
29889,
23397,
29918,
29907,
3927,
15789,
29892,
13,
1678,
376,
3993,
29918,
666,
1115,
17067,
1254,
29918,
5690,
29892,
13,
1678,
376,
5561,
29918,
666,
1115,
6213,
29892,
13,
1678,
376,
7507,
29918,
666,
1115,
17067,
1254,
29918,
5690,
29892,
13,
1678,
376,
1272,
29918,
666,
1115,
6213,
29892,
13,
1678,
376,
359,
29918,
1853,
1115,
376,
23714,
29965,
29990,
613,
13,
1678,
376,
3177,
29918,
1853,
1115,
1040,
29889,
4247,
1542,
29889,
10051,
3919,
29892,
13,
1678,
376,
3177,
29918,
3166,
1115,
376,
6632,
2287,
29918,
27616,
613,
13,
1678,
376,
481,
29918,
333,
1115,
1040,
29889,
23397,
29918,
3301,
29918,
1367,
29892,
13,
1678,
376,
786,
5461,
29918,
18010,
1115,
19997,
13,
1678,
376,
275,
29918,
11288,
1115,
29871,
29900,
29892,
13,
1678,
376,
17833,
29918,
1272,
1115,
8853,
3116,
29918,
19322,
29918,
13400,
1115,
6213,
29892,
376,
412,
261,
29918,
6543,
29918,
15123,
29918,
1454,
29918,
14748,
1115,
29871,
29896,
1118,
13,
29913,
13,
13,
1367,
3919,
11937,
29918,
14573,
29918,
16320,
29909,
4345,
353,
426,
13,
1678,
376,
29890,
29895,
29918,
3069,
29918,
333,
1115,
350,
29968,
29918,
20832,
29918,
1367,
29892,
13,
1678,
376,
5150,
29918,
1853,
1115,
1040,
29889,
6444,
1542,
29889,
25711,
17013,
29892,
13,
1678,
376,
10149,
1115,
376,
4632,
613,
13,
1678,
376,
5630,
1115,
9872,
25711,
17013,
28341,
13,
1678,
376,
637,
1115,
29871,
29906,
29906,
29892,
13,
1678,
376,
1989,
1115,
376,
28628,
29918,
710,
1057,
29901,
29931,
29990,
29939,
29882,
613,
13,
1678,
376,
17833,
29918,
1272,
1115,
24335,
13,
1678,
376,
2267,
2509,
1115,
29871,
29896,
29892,
13,
29913,
13,
13,
20633,
7187,
24290,
2725,
29918,
16320,
29909,
4345,
353,
426,
13,
1678,
376,
333,
1115,
27092,
7187,
24290,
2725,
29918,
1367,
29892,
13,
1678,
376,
3318,
29918,
1853,
1115,
22236,
29918,
14824,
29967,
29918,
11116,
29892,
13,
1678,
376,
3177,
29918,
1853,
1115,
22236,
29918,
6632,
2287,
29918,
11116,
29892,
13,
1678,
396,
29871,
30783,
30909,
29925,
23828,
30667,
30319,
30210,
31851,
31787,
30769,
31557,
30406,
30287,
31037,
30888,
31429,
13,
1678,
376,
18010,
1115,
518,
13,
4706,
426,
13,
9651,
376,
666,
1115,
2672,
1254,
23219,
29918,
11690,
3366,
29890,
29895,
29918,
3069,
29918,
3993,
666,
12436,
13,
9651,
376,
29890,
29895,
29918,
9274,
29918,
333,
1115,
1040,
29889,
23397,
29918,
29907,
3927,
15789,
29892,
13,
9651,
376,
8758,
29918,
3888,
1115,
2672,
1254,
23219,
29918,
11690,
29892,
13,
9651,
376,
29890,
29895,
29918,
19303,
4926,
29918,
10149,
1115,
376,
29900,
613,
13,
4706,
500,
13,
1678,
21251,
13,
1678,
376,
1037,
1061,
1115,
22236,
29918,
22245,
1299,
1955,
29892,
13,
29913,
13,
13,
20633,
7187,
24290,
2725,
29918,
29911,
3289,
29968,
29918,
16320,
29909,
4345,
353,
426,
13,
1678,
376,
333,
1115,
27092,
7187,
24290,
2725,
29918,
29911,
3289,
29968,
29918,
1367,
29892,
13,
1678,
376,
1491,
22371,
29918,
333,
1115,
27092,
7187,
24290,
2725,
29918,
1367,
29892,
29871,
396,
29871,
31393,
30763,
31195,
236,
156,
136,
31441,
30886,
31174,
30448,
31273,
31264,
13,
1678,
376,
6078,
1115,
426,
13,
4706,
376,
18010,
1115,
518,
13,
9651,
426,
13,
18884,
376,
666,
1115,
2672,
1254,
23219,
29918,
11690,
3366,
29890,
29895,
29918,
3069,
29918,
3993,
666,
12436,
13,
18884,
376,
29890,
29895,
29918,
9274,
29918,
333,
1115,
1040,
29889,
23397,
29918,
29907,
3927,
15789,
29892,
13,
18884,
376,
8758,
29918,
3888,
1115,
2672,
1254,
23219,
29918,
11690,
29892,
13,
18884,
376,
29890,
29895,
29918,
19303,
4926,
29918,
10149,
1115,
376,
29900,
613,
13,
9651,
500,
13,
4706,
21251,
13,
4706,
376,
3177,
29918,
1853,
1115,
22236,
29918,
6632,
2287,
29918,
11116,
29892,
13,
4706,
376,
3318,
29918,
1853,
1115,
22236,
29918,
14824,
29967,
29918,
11116,
29892,
13,
4706,
376,
26180,
29918,
9573,
1115,
5852,
29892,
13,
1678,
2981,
13,
1678,
376,
7387,
1115,
426,
13,
4706,
396,
29871,
31951,
31037,
30888,
31429,
30769,
30417,
30287,
30502,
31195,
31507,
333,
30214,
30878,
30822,
31393,
30763,
235,
164,
168,
31125,
30908,
30374,
30486,
30494,
13,
4706,
22236,
29918,
25580,
23219,
29918,
1367,
29901,
426,
13,
9651,
396,
29871,
31735,
31439,
30670,
31905,
31450,
31358,
13,
9651,
376,
14748,
1115,
1040,
29889,
11947,
1542,
29889,
25580,
9818,
29918,
10051,
3919,
13,
4706,
500,
13,
1678,
2981,
13,
1678,
396,
29871,
30392,
31191,
30573,
30688,
30846,
235,
170,
169,
30910,
13,
1678,
376,
275,
29918,
6921,
29918,
21001,
1115,
29871,
29900,
29892,
13,
29913,
13,
13,
29967,
14824,
29918,
16320,
29909,
4345,
353,
426,
13,
1678,
376,
333,
1115,
435,
14824,
29918,
1367,
29892,
13,
1678,
376,
11600,
29918,
1609,
1115,
22236,
29918,
22245,
1299,
1955,
29892,
13,
1678,
376,
9057,
29918,
1853,
1115,
1040,
29889,
11947,
1542,
29889,
25580,
9818,
29918,
10051,
3919,
29892,
13,
1678,
376,
1491,
22371,
29918,
333,
1115,
27092,
7187,
24290,
2725,
29918,
1367,
29892,
29871,
396,
29871,
31393,
30763,
31195,
236,
156,
136,
31441,
30886,
31174,
30448,
31273,
31264,
13,
1678,
396,
349,
23828,
30667,
30319,
31735,
31439,
31557,
30417,
30287,
30502,
30670,
31905,
31450,
31358,
13,
1678,
376,
7662,
29918,
333,
29918,
1761,
1115,
518,
20633,
7187,
24290,
2725,
29918,
29911,
3289,
29968,
29918,
1367,
1402,
13,
1678,
376,
4882,
1115,
1040,
29889,
11947,
5709,
1542,
29889,
29934,
3904,
29940,
4214,
29892,
13,
1678,
376,
10945,
29918,
7529,
1115,
24335,
13,
1678,
376,
6112,
6765,
1115,
8853,
7827,
29918,
2798,
1115,
29871,
29896,
29892,
376,
26061,
29918,
2798,
1115,
29871,
29900,
29892,
376,
29886,
2548,
29918,
2798,
1115,
29871,
29896,
29892,
376,
21094,
29918,
2798,
1115,
29871,
29900,
29892,
376,
8698,
29918,
2798,
1115,
29871,
29900,
1118,
13,
1678,
376,
29890,
29895,
29918,
29890,
466,
29918,
6078,
1115,
518,
23397,
29918,
12809,
29999,
29918,
1367,
29918,
5813,
3366,
29890,
29895,
29918,
29890,
466,
29918,
333,
3108,
1402,
13,
1678,
376,
2704,
29918,
23525,
1115,
19997,
13,
29913,
13,
13,
29967,
14824,
29918,
29911,
3289,
29968,
29918,
16320,
29909,
4345,
353,
426,
13,
1678,
376,
333,
1115,
435,
14824,
29918,
29911,
3289,
29968,
29918,
1367,
29892,
13,
1678,
376,
9057,
29918,
333,
1115,
435,
14824,
29918,
1367,
29892,
13,
1678,
396,
29871,
31423,
30417,
31368,
232,
137,
143,
30780,
4912,
2585,
30577,
30658,
30392,
30816,
13,
1678,
376,
29890,
29895,
29918,
3069,
29918,
333,
1115,
350,
29968,
29918,
20832,
29918,
1367,
29892,
13,
1678,
376,
8758,
29918,
333,
1115,
22236,
29918,
25580,
23219,
29918,
1367,
29892,
13,
1678,
376,
13096,
5570,
29918,
333,
1115,
435,
14824,
29918,
29911,
3289,
29968,
29918,
2227,
4162,
18521,
29918,
1367,
29892,
13,
1678,
376,
4882,
1115,
1040,
29889,
5709,
1542,
29889,
29934,
3904,
29940,
4214,
29892,
13,
1678,
376,
3784,
29918,
10568,
1115,
376,
30724,
30505,
30670,
31905,
613,
13,
29913,
13,
13,
20633,
7187,
24290,
2725,
29918,
25580,
23219,
29918,
1525,
29907,
25593,
29918,
16320,
29909,
4345,
353,
426,
13,
1678,
376,
333,
1115,
27092,
7187,
24290,
2725,
29918,
25580,
23219,
29918,
1525,
29907,
25593,
29918,
1367,
29892,
13,
1678,
376,
7662,
29918,
333,
1115,
27092,
7187,
24290,
2725,
29918,
29911,
3289,
29968,
29918,
1367,
29892,
13,
1678,
376,
1491,
22371,
29918,
333,
1115,
27092,
7187,
24290,
2725,
29918,
1367,
29892,
13,
1678,
376,
8758,
29918,
333,
1115,
22236,
29918,
25580,
23219,
29918,
1367,
29892,
13,
1678,
396,
29871,
30670,
31905,
30594,
30214,
31368,
232,
137,
143,
30780,
4912,
2585,
30822,
30437,
233,
146,
149,
30752,
29890,
29895,
29918,
3069,
29918,
333,
13,
1678,
376,
8758,
29918,
3888,
1115,
8853,
3069,
1115,
2672,
1254,
23219,
29918,
11690,
1118,
13,
1678,
376,
24530,
1115,
518,
13,
4706,
426,
13,
9651,
376,
333,
1115,
376,
14748,
613,
13,
9651,
376,
1853,
1115,
1040,
29889,
4247,
1542,
29889,
10051,
3919,
29892,
13,
9651,
376,
2467,
1115,
1040,
29889,
11947,
1542,
29889,
25580,
9818,
29918,
10051,
3919,
29892,
13,
9651,
376,
17833,
29918,
3888,
1115,
24335,
13,
9651,
376,
13096,
5570,
29918,
333,
1115,
376,
29941,
29941,
29946,
29896,
29929,
29955,
29947,
1725,
29896,
29888,
29941,
29941,
29890,
29906,
29890,
29929,
29929,
29953,
29896,
29945,
29947,
29896,
29947,
2176,
29945,
29883,
29955,
29874,
29947,
29929,
613,
13,
4706,
500,
13,
1678,
21251,
13,
1678,
376,
13096,
5570,
29918,
333,
1115,
2672,
1254,
23219,
29918,
1525,
29907,
25593,
29918,
21289,
29918,
2227,
4162,
18521,
29918,
1367,
29892,
13,
29913,
13,
13,
29967,
14824,
29918,
25580,
23219,
29918,
1367,
29918,
2303,
4690,
13668,
29918,
1525,
29911,
24015,
353,
426,
13,
1678,
376,
2914,
1115,
5852,
29892,
13,
1678,
376,
401,
1115,
29871,
29900,
29892,
13,
1678,
376,
4906,
1115,
376,
8698,
613,
13,
1678,
376,
1272,
1115,
8853,
9057,
29918,
8758,
29918,
978,
1115,
376,
8787,
26141,
17740,
3497,
29896,
29945,
29906,
29896,
29896,
29900,
29896,
29946,
29906,
29955,
29896,
29955,
29953,
613,
376,
9057,
29918,
8758,
29918,
333,
1115,
435,
14824,
29918,
25580,
23219,
29918,
1367,
1118,
13,
29913,
13,
13,
29967,
14824,
29918,
7194,
29918,
25580,
23219,
29918,
14480,
29918,
1525,
29911,
24015,
353,
426,
13,
1678,
376,
2914,
1115,
5852,
29892,
13,
1678,
376,
401,
1115,
29871,
29900,
29892,
13,
1678,
376,
4906,
1115,
12633,
13,
1678,
376,
1272,
1115,
518,
13,
4706,
426,
13,
9651,
376,
275,
29918,
4951,
3276,
1115,
5852,
29892,
13,
9651,
376,
10568,
29918,
8758,
29918,
333,
1115,
29871,
29929,
29900,
29900,
29900,
29900,
29892,
13,
9651,
376,
978,
1115,
376,
1688,
613,
13,
9651,
376,
4882,
1115,
17163,
1469,
5709,
29889,
14605,
26925,
29892,
13,
9651,
376,
10568,
29918,
9902,
1115,
518,
13,
18884,
426,
13,
462,
1678,
376,
666,
29918,
4882,
1115,
17163,
5690,
5709,
29889,
14605,
26925,
29892,
13,
462,
1678,
376,
4039,
1115,
376,
12353,
613,
13,
462,
1678,
376,
666,
29918,
20756,
1115,
518,
13,
462,
4706,
426,
13,
462,
9651,
376,
276,
2202,
29918,
2798,
1115,
29871,
29900,
29892,
13,
462,
9651,
376,
7827,
29918,
2230,
1115,
29871,
29953,
29900,
29889,
29945,
29929,
29929,
29892,
13,
462,
9651,
376,
2962,
29918,
2230,
1115,
376,
29906,
29900,
29906,
29900,
29899,
29900,
29947,
29899,
29900,
29945,
29871,
29896,
29946,
29901,
29941,
29929,
29901,
29941,
29900,
718,
29900,
29947,
29900,
29900,
613,
13,
462,
9651,
376,
355,
29918,
2230,
1115,
376,
29906,
29900,
29906,
29900,
29899,
29900,
29947,
29899,
29900,
29945,
29871,
29896,
29946,
29901,
29946,
29900,
29901,
29941,
29896,
718,
29900,
29947,
29900,
29900,
613,
13,
462,
9651,
376,
666,
1115,
17067,
1254,
29918,
5690,
29892,
13,
462,
9651,
376,
29890,
29895,
29918,
9274,
29918,
333,
1115,
29871,
29900,
29892,
13,
462,
9651,
376,
2704,
29918,
401,
1115,
29871,
29900,
29892,
13,
462,
9651,
376,
13322,
29918,
401,
1115,
29871,
29900,
29892,
13,
462,
9651,
376,
1188,
29918,
3051,
1115,
376,
8698,
613,
13,
462,
4706,
500,
13,
462,
1678,
21251,
13,
18884,
500,
13,
9651,
21251,
13,
4706,
500,
13,
1678,
21251,
13,
29913,
13,
13,
7194,
29918,
29967,
14824,
29918,
25580,
23219,
29918,
27047,
29918,
29963,
29906,
29918,
29907,
29918,
1525,
29911,
24015,
353,
426,
13,
1678,
376,
275,
29918,
4951,
3276,
1115,
7700,
29892,
13,
1678,
376,
9057,
29918,
8758,
1115,
426,
13,
4706,
376,
9057,
29918,
8758,
29918,
333,
1115,
435,
14824,
29918,
25580,
23219,
29918,
1367,
29892,
13,
4706,
376,
29890,
29895,
29918,
29890,
466,
29918,
333,
1115,
22236,
29918,
12809,
29999,
29918,
1367,
29918,
5813,
3366,
29890,
29895,
29918,
29890,
466,
29918,
333,
12436,
13,
4706,
376,
978,
1115,
376,
8787,
26141,
8225,
2471,
29896,
29945,
29906,
29896,
29900,
29947,
29929,
29955,
29929,
29945,
29947,
29947,
29955,
613,
13,
4706,
376,
6891,
1115,
22236,
29918,
22245,
1299,
1955,
29892,
13,
4706,
376,
29890,
29895,
29918,
9057,
29918,
333,
1115,
29871,
29946,
29941,
29945,
29945,
29892,
13,
4706,
376,
3258,
29918,
2230,
1115,
376,
29906,
29900,
29896,
29947,
29899,
29900,
29941,
29899,
29896,
29945,
29871,
29896,
29906,
29901,
29945,
29953,
29901,
29941,
29945,
718,
29900,
29947,
29900,
29900,
613,
13,
4706,
376,
4882,
1115,
17163,
1469,
5709,
29889,
29925,
11794,
4214,
29892,
13,
1678,
2981,
13,
29913,
13,
13,
13,
29937,
29871,
236,
131,
133,
30406,
30909,
3132,
29918,
29894,
29906,
13,
29967,
14824,
29918,
25580,
23219,
29918,
1367,
29918,
2303,
4690,
13668,
29918,
29963,
29906,
29918,
29907,
29918,
1525,
29911,
24015,
353,
435,
14824,
29918,
25580,
23219,
29918,
1367,
29918,
2303,
4690,
13668,
29918,
1525,
29911,
24015,
3366,
1272,
3108,
13,
13,
13,
1990,
317,
845,
2517,
18680,
4032,
29901,
13,
1678,
822,
4770,
2344,
12035,
13,
4706,
1583,
29892,
13,
4706,
679,
29918,
392,
29918,
842,
29918,
14032,
415,
29918,
2457,
29922,
8516,
29892,
13,
4706,
3638,
29918,
9006,
29918,
2457,
29918,
2457,
29922,
8516,
29892,
13,
4706,
9109,
29918,
5358,
29918,
2457,
29922,
8516,
29892,
13,
4706,
13927,
29918,
2457,
29922,
8516,
29892,
13,
268,
1125,
13,
4706,
1583,
29889,
657,
29918,
392,
29918,
842,
29918,
14032,
415,
353,
26494,
18680,
29898,
2457,
29918,
1767,
29922,
657,
29918,
392,
29918,
842,
29918,
14032,
415,
29918,
2457,
29897,
13,
4706,
1583,
29889,
6717,
29918,
9006,
353,
26494,
18680,
29898,
2457,
29918,
1767,
29922,
6717,
29918,
9006,
29918,
2457,
29918,
2457,
29897,
13,
4706,
1583,
29889,
11177,
29918,
5358,
353,
26494,
18680,
29898,
2457,
29918,
1767,
29922,
11177,
29918,
5358,
29918,
2457,
29897,
13,
4706,
1583,
29889,
15269,
353,
26494,
18680,
29898,
2457,
29918,
1767,
29922,
15269,
29918,
2457,
29897,
13,
13,
13,
1990,
402,
344,
18680,
4032,
29901,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
679,
29918,
14748,
29918,
4882,
29918,
2457,
29922,
8516,
29892,
679,
29918,
14748,
29918,
3888,
29918,
2457,
29922,
8516,
1125,
13,
4706,
1583,
29889,
29887,
344,
353,
26494,
18680,
580,
13,
4706,
1583,
29889,
29887,
344,
29889,
657,
29918,
14748,
29918,
4882,
353,
26494,
18680,
29898,
2457,
29918,
1767,
29922,
657,
29918,
14748,
29918,
4882,
29918,
2457,
29897,
13,
4706,
1583,
29889,
29887,
344,
29889,
657,
29918,
14748,
29918,
3888,
353,
26494,
18680,
29898,
2457,
29918,
1767,
29922,
657,
29918,
14748,
29918,
3888,
29918,
2457,
29897,
13,
13,
13,
1990,
315,
29924,
4051,
18680,
4032,
29901,
13,
1678,
822,
4770,
2344,
12035,
13,
4706,
1583,
29892,
13,
4706,
788,
29918,
3069,
29918,
517,
29918,
10314,
29918,
2914,
29922,
8516,
29892,
13,
4706,
2740,
29918,
8262,
3335,
29918,
2914,
29922,
8516,
29892,
13,
4706,
1051,
29918,
29890,
466,
29918,
23525,
29918,
2914,
29922,
8516,
29892,
13,
4706,
1051,
29918,
23525,
29918,
14037,
29918,
29890,
466,
29918,
2914,
29922,
8516,
29892,
13,
4706,
1284,
29918,
3069,
29918,
29890,
466,
29918,
2674,
800,
29918,
2914,
29922,
8516,
29892,
13,
268,
1125,
13,
4706,
1583,
29889,
617,
353,
26494,
18680,
580,
13,
4706,
1583,
29889,
617,
29889,
1202,
29918,
3069,
29918,
517,
29918,
10314,
353,
26494,
18680,
29898,
2457,
29918,
1767,
29922,
1202,
29918,
3069,
29918,
517,
29918,
10314,
29918,
2914,
29897,
13,
4706,
1583,
29889,
617,
29889,
4478,
29918,
8262,
3335,
353,
26494,
18680,
29898,
2457,
29918,
1767,
29922,
4478,
29918,
8262,
3335,
29918,
2914,
29897,
13,
4706,
1583,
29889,
617,
29889,
1761,
29918,
29890,
466,
29918,
23525,
353,
26494,
18680,
29898,
2457,
29918,
1767,
29922,
1761,
29918,
29890,
466,
29918,
23525,
29918,
2914,
29897,
13,
4706,
1583,
29889,
617,
29889,
1761,
29918,
23525,
29918,
14037,
29918,
29890,
466,
353,
26494,
18680,
29898,
2457,
29918,
1767,
29922,
1761,
29918,
23525,
29918,
14037,
29918,
29890,
466,
29918,
2914,
29897,
13,
4706,
1583,
29889,
617,
29889,
2886,
29918,
3069,
29918,
29890,
466,
29918,
2674,
800,
353,
26494,
18680,
29898,
2457,
29918,
1767,
29922,
2886,
29918,
3069,
29918,
29890,
466,
29918,
2674,
800,
29918,
2914,
29897,
13,
13,
13,
1990,
17163,
18680,
4032,
29901,
13,
1678,
822,
4770,
2344,
12035,
13,
4706,
1583,
29892,
13,
4706,
5172,
29918,
7978,
29918,
2154,
29918,
2457,
29922,
8516,
29892,
13,
4706,
679,
29918,
9057,
29918,
8758,
29918,
1188,
29918,
2457,
29922,
8516,
29892,
13,
4706,
5172,
29918,
5910,
29918,
1445,
29918,
2457,
29922,
8516,
29892,
13,
4706,
5503,
29918,
2917,
29918,
1445,
29918,
2457,
29922,
8516,
29892,
13,
4706,
679,
29918,
9057,
29918,
8758,
29918,
4882,
29918,
2457,
29922,
8516,
29892,
13,
268,
1125,
13,
4706,
1583,
29889,
9057,
353,
26494,
18680,
580,
13,
4706,
1583,
29889,
9057,
29889,
11255,
29918,
7978,
29918,
2154,
353,
26494,
18680,
29898,
2457,
29918,
1767,
29922,
11255,
29918,
7978,
29918,
2154,
29918,
2457,
29897,
13,
4706,
1583,
29889,
9057,
29889,
657,
29918,
9057,
29918,
8758,
29918,
1188,
353,
26494,
18680,
29898,
2457,
29918,
1767,
29922,
657,
29918,
9057,
29918,
8758,
29918,
1188,
29918,
2457,
29897,
13,
4706,
1583,
29889,
9057,
29889,
11255,
29918,
5910,
29918,
1445,
353,
26494,
18680,
29898,
2457,
29918,
1767,
29922,
11255,
29918,
5910,
29918,
1445,
29918,
2457,
29897,
13,
4706,
1583,
29889,
9057,
29889,
5910,
29918,
2917,
29918,
1445,
353,
26494,
18680,
29898,
2457,
29918,
1767,
29922,
5910,
29918,
2917,
29918,
1445,
29918,
2457,
29897,
13,
4706,
1583,
29889,
9057,
29889,
657,
29918,
9057,
29918,
8758,
29918,
4882,
353,
26494,
18680,
29898,
2457,
29918,
1767,
29922,
657,
29918,
9057,
29918,
8758,
29918,
4882,
29918,
2457,
29897,
13,
13,
13,
1990,
28330,
3057,
9930,
5126,
29901,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
5191,
29918,
5415,
29918,
5552,
29918,
5975,
29898,
25932,
29892,
5446,
29892,
5446,
29918,
5552,
29918,
5975,
1125,
13,
4706,
396,
29871,
30667,
30533,
31273,
31264,
13,
4706,
565,
5446,
29918,
5552,
29918,
5975,
338,
6213,
29901,
13,
9651,
736,
5446,
13,
4706,
363,
12421,
29892,
995,
297,
5446,
29918,
5552,
29918,
5975,
29889,
7076,
7295,
13,
9651,
565,
12421,
451,
297,
5446,
29901,
13,
18884,
6773,
13,
9651,
5446,
29961,
5552,
29962,
353,
995,
13,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
10970,
29898,
25932,
29892,
12421,
29918,
5975,
29922,
8516,
29892,
2777,
29918,
3888,
29918,
5552,
29918,
5975,
29922,
8516,
1125,
13,
4706,
2777,
29918,
3888,
353,
3509,
29889,
24535,
8552,
29898,
25580,
23219,
29918,
11690,
29897,
13,
4706,
10970,
353,
3509,
29889,
24535,
8552,
29898,
17923,
29918,
1177,
12336,
29903,
29897,
13,
4706,
1067,
29879,
29889,
6506,
29918,
5415,
29918,
5552,
29918,
5975,
29898,
8758,
29918,
3888,
29892,
2777,
29918,
3888,
29918,
5552,
29918,
5975,
29897,
13,
4706,
10970,
3366,
3069,
29918,
3888,
3108,
353,
9657,
29898,
1761,
29898,
8758,
29918,
3888,
29889,
7076,
3101,
718,
518,
703,
3116,
29918,
19322,
29918,
13400,
613,
376,
8516,
1159,
2314,
13,
4706,
565,
376,
3116,
29918,
19322,
29918,
13400,
29908,
297,
2777,
29918,
3888,
29918,
5552,
29918,
5975,
29901,
13,
9651,
10970,
3366,
3069,
29918,
3888,
3108,
3366,
3116,
29918,
19322,
29918,
13400,
3108,
353,
2777,
29918,
3888,
29918,
5552,
29918,
5975,
3366,
3116,
29918,
19322,
29918,
13400,
3108,
13,
4706,
1067,
29879,
29889,
6506,
29918,
5415,
29918,
5552,
29918,
5975,
29898,
2080,
29879,
29892,
12421,
29918,
5975,
29897,
13,
4706,
736,
10970,
13,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
25691,
29918,
5415,
29898,
25932,
29892,
5446,
29918,
5552,
29918,
5975,
29922,
8516,
29892,
2777,
29918,
3888,
29918,
5552,
29918,
5975,
29922,
8516,
29892,
338,
29918,
5415,
29922,
8824,
1125,
13,
4706,
2777,
29918,
3888,
353,
3509,
29889,
24535,
8552,
29898,
25580,
23219,
29918,
11690,
29897,
13,
4706,
25691,
29918,
7529,
353,
3509,
29889,
24535,
8552,
29898,
20633,
7187,
24290,
2725,
29918,
16320,
29909,
4345,
29897,
13,
13,
4706,
1067,
29879,
29889,
6506,
29918,
5415,
29918,
5552,
29918,
5975,
29898,
8758,
29918,
3888,
29892,
2777,
29918,
3888,
29918,
5552,
29918,
5975,
29897,
13,
4706,
565,
2777,
29918,
3888,
29918,
5552,
29918,
5975,
338,
451,
6213,
29901,
13,
9651,
25691,
29918,
7529,
3366,
18010,
3108,
29961,
29900,
29962,
3366,
8758,
29918,
3888,
3108,
353,
2777,
29918,
3888,
13,
9651,
25691,
29918,
7529,
3366,
18010,
3108,
29961,
29900,
29962,
3366,
666,
3108,
353,
2777,
29918,
3888,
3366,
29890,
29895,
29918,
3069,
29918,
3993,
666,
3108,
13,
13,
4706,
1067,
29879,
29889,
6506,
29918,
5415,
29918,
5552,
29918,
5975,
29898,
1491,
22371,
29918,
7529,
29892,
5446,
29918,
5552,
29918,
5975,
29897,
13,
4706,
565,
451,
338,
29918,
5415,
29901,
13,
9651,
25691,
29918,
7529,
29889,
7323,
703,
333,
613,
6213,
29897,
13,
4706,
736,
4733,
29889,
4035,
22371,
29898,
1068,
1491,
22371,
29918,
7529,
29897,
565,
338,
29918,
5415,
1683,
25691,
29918,
7529,
13,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
25691,
29918,
7662,
29918,
5415,
29898,
25932,
29892,
5446,
29918,
5552,
29918,
5975,
29922,
8516,
29892,
2777,
29918,
3888,
29918,
5552,
29918,
5975,
29922,
8516,
29892,
338,
29918,
5415,
29922,
8824,
1125,
13,
4706,
2777,
29918,
3888,
353,
3509,
29889,
24535,
8552,
29898,
25580,
23219,
29918,
11690,
29897,
13,
4706,
25691,
29918,
7662,
29918,
7529,
353,
3509,
29889,
24535,
8552,
29898,
20633,
7187,
24290,
2725,
29918,
29911,
3289,
29968,
29918,
16320,
29909,
4345,
29897,
13,
13,
4706,
1067,
29879,
29889,
6506,
29918,
5415,
29918,
5552,
29918,
5975,
29898,
8758,
29918,
3888,
29892,
2777,
29918,
3888,
29918,
5552,
29918,
5975,
29897,
13,
4706,
565,
2777,
29918,
3888,
29918,
5552,
29918,
5975,
338,
451,
6213,
29901,
13,
9651,
25691,
29918,
7662,
29918,
7529,
3366,
6078,
3108,
3366,
18010,
3108,
29961,
29900,
29962,
3366,
8758,
29918,
3888,
3108,
353,
2777,
29918,
3888,
13,
9651,
25691,
29918,
7662,
29918,
7529,
3366,
6078,
3108,
3366,
18010,
3108,
29961,
29900,
29962,
3366,
666,
3108,
353,
2777,
29918,
3888,
3366,
29890,
29895,
29918,
3069,
29918,
3993,
666,
3108,
13,
13,
4706,
2777,
29918,
333,
353,
8492,
29889,
3258,
29918,
3177,
29918,
333,
29898,
13,
9651,
426,
13,
18884,
376,
3318,
29918,
1853,
1115,
22236,
29918,
14824,
29967,
29918,
11116,
29892,
13,
18884,
376,
3177,
29918,
1853,
1115,
22236,
29918,
6632,
2287,
29918,
11116,
29892,
13,
18884,
376,
29890,
29895,
29918,
9274,
29918,
333,
1115,
2777,
29918,
3888,
3366,
29890,
29895,
29918,
9274,
29918,
333,
12436,
13,
18884,
376,
666,
1115,
2777,
29918,
3888,
3366,
29890,
29895,
29918,
3069,
29918,
3993,
666,
12436,
13,
9651,
500,
13,
4706,
1723,
13,
4706,
25691,
29918,
7662,
29918,
7529,
3366,
7387,
16862,
7323,
29898,
23397,
29918,
25580,
23219,
29918,
1367,
29897,
13,
4706,
25691,
29918,
7662,
29918,
7529,
3366,
7387,
3108,
353,
426,
8758,
29918,
333,
29901,
8853,
14748,
1115,
1040,
29889,
11947,
1542,
29889,
25580,
9818,
29918,
10051,
3919,
930,
13,
4706,
1067,
29879,
29889,
6506,
29918,
5415,
29918,
5552,
29918,
5975,
29898,
1491,
22371,
29918,
7662,
29918,
7529,
29892,
5446,
29918,
5552,
29918,
5975,
29897,
13,
4706,
565,
451,
338,
29918,
5415,
29901,
13,
9651,
25691,
29918,
7662,
29918,
7529,
29889,
7323,
703,
333,
613,
6213,
29897,
13,
4706,
736,
4733,
29889,
4035,
22371,
5398,
29898,
1068,
1491,
22371,
29918,
7662,
29918,
7529,
29897,
565,
338,
29918,
5415,
1683,
25691,
29918,
7662,
29918,
7529,
13,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
25691,
29918,
8758,
29918,
11651,
29918,
5415,
29898,
25932,
29892,
5446,
29918,
5552,
29918,
5975,
29922,
8516,
29892,
2777,
29918,
3888,
29918,
5552,
29918,
5975,
29922,
8516,
29892,
338,
29918,
5415,
29922,
8824,
1125,
13,
4706,
2777,
29918,
3888,
353,
3509,
29889,
24535,
8552,
29898,
25580,
23219,
29918,
11690,
29897,
13,
4706,
25691,
29918,
8758,
29918,
11651,
29918,
7529,
353,
3509,
29889,
24535,
8552,
29898,
20633,
7187,
24290,
2725,
29918,
25580,
23219,
29918,
1525,
29907,
25593,
29918,
16320,
29909,
4345,
29897,
13,
4706,
1067,
29879,
29889,
6506,
29918,
5415,
29918,
5552,
29918,
5975,
29898,
8758,
29918,
3888,
29892,
2777,
29918,
3888,
29918,
5552,
29918,
5975,
29897,
13,
4706,
565,
2777,
29918,
3888,
29918,
5552,
29918,
5975,
338,
451,
6213,
29901,
13,
9651,
25691,
29918,
8758,
29918,
11651,
29918,
7529,
3366,
8758,
29918,
3888,
3108,
3366,
3069,
3108,
353,
2777,
29918,
3888,
13,
13,
4706,
25691,
29918,
8758,
29918,
11651,
29918,
7529,
3366,
8758,
29918,
333,
3108,
353,
8492,
29889,
3258,
29918,
3177,
29918,
333,
29898,
13,
9651,
426,
13,
18884,
376,
3318,
29918,
1853,
1115,
22236,
29918,
14824,
29967,
29918,
11116,
29892,
13,
18884,
376,
3177,
29918,
1853,
1115,
22236,
29918,
6632,
2287,
29918,
11116,
29892,
13,
18884,
376,
29890,
29895,
29918,
9274,
29918,
333,
1115,
2777,
29918,
3888,
3366,
29890,
29895,
29918,
9274,
29918,
333,
12436,
13,
18884,
376,
666,
1115,
2777,
29918,
3888,
3366,
29890,
29895,
29918,
3069,
29918,
3993,
666,
12436,
13,
9651,
500,
13,
4706,
1723,
13,
4706,
1067,
29879,
29889,
6506,
29918,
5415,
29918,
5552,
29918,
5975,
29898,
1491,
22371,
29918,
8758,
29918,
11651,
29918,
7529,
29892,
5446,
29918,
5552,
29918,
5975,
29897,
13,
4706,
736,
313,
13,
9651,
4733,
29889,
4035,
22371,
4998,
9182,
29898,
1068,
1491,
22371,
29918,
8758,
29918,
11651,
29918,
7529,
29897,
13,
9651,
565,
338,
29918,
5415,
13,
9651,
1683,
25691,
29918,
8758,
29918,
11651,
29918,
7529,
13,
4706,
1723,
13,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
4982,
29918,
5415,
29898,
25932,
29892,
5446,
29918,
5552,
29918,
5975,
29922,
8516,
29892,
338,
29918,
5415,
29922,
8824,
1125,
13,
4706,
4982,
29918,
7529,
353,
3509,
29889,
24535,
8552,
29898,
29967,
14824,
29918,
16320,
29909,
4345,
29897,
13,
4706,
1067,
29879,
29889,
6506,
29918,
5415,
29918,
5552,
29918,
5975,
29898,
9057,
29918,
7529,
29892,
5446,
29918,
5552,
29918,
5975,
29897,
13,
4706,
565,
451,
338,
29918,
5415,
29901,
13,
9651,
4982,
29918,
7529,
29889,
7323,
703,
333,
613,
6213,
29897,
13,
4706,
736,
4733,
29889,
11947,
29898,
1068,
9057,
29918,
7529,
29897,
565,
338,
29918,
5415,
1683,
4982,
29918,
7529,
13,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
4982,
29918,
7662,
29918,
5415,
29898,
25932,
29892,
5446,
29918,
5552,
29918,
5975,
29922,
8516,
29892,
338,
29918,
5415,
29922,
8824,
1125,
13,
4706,
4982,
29918,
7662,
29918,
7529,
353,
3509,
29889,
24535,
8552,
29898,
29967,
14824,
29918,
29911,
3289,
29968,
29918,
16320,
29909,
4345,
29897,
13,
4706,
1067,
29879,
29889,
6506,
29918,
5415,
29918,
5552,
29918,
5975,
29898,
9057,
29918,
7662,
29918,
7529,
29892,
5446,
29918,
5552,
29918,
5975,
29897,
13,
4706,
565,
451,
338,
29918,
5415,
29901,
13,
9651,
4982,
29918,
7662,
29918,
7529,
29889,
7323,
703,
333,
613,
6213,
29897,
13,
4706,
736,
4733,
29889,
11947,
5398,
29898,
1068,
9057,
29918,
7662,
29918,
7529,
29897,
565,
338,
29918,
5415,
1683,
4982,
29918,
7662,
29918,
7529,
13,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
10110,
29918,
1272,
29918,
5415,
29898,
25932,
29892,
5446,
29918,
5552,
29918,
5975,
29922,
8516,
29892,
338,
29918,
5415,
29922,
8824,
1125,
13,
4706,
10110,
29918,
1272,
29918,
7529,
353,
3509,
29889,
24535,
8552,
29898,
1367,
3919,
11937,
29918,
14573,
29918,
16320,
29909,
4345,
29897,
13,
4706,
1067,
29879,
29889,
6506,
29918,
5415,
29918,
5552,
29918,
5975,
29898,
22350,
29918,
1272,
29918,
7529,
29892,
5446,
29918,
5552,
29918,
5975,
29897,
13,
4706,
565,
451,
338,
29918,
5415,
29901,
13,
9651,
10110,
29918,
1272,
29918,
7529,
29889,
7323,
703,
333,
613,
6213,
29897,
13,
4706,
736,
4733,
29889,
18415,
1469,
29898,
1068,
22350,
29918,
1272,
29918,
7529,
29897,
565,
338,
29918,
5415,
1683,
10110,
29918,
1272,
29918,
7529,
13,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
3495,
29918,
5415,
29898,
25932,
29892,
5446,
29918,
5552,
29918,
5975,
29922,
8516,
29892,
338,
29918,
5415,
29922,
8824,
1125,
13,
4706,
3495,
29918,
7529,
353,
3509,
29889,
24535,
8552,
29898,
20832,
29918,
16320,
29909,
4345,
29897,
13,
4706,
1067,
29879,
29889,
6506,
29918,
5415,
29918,
5552,
29918,
5975,
29898,
3069,
29918,
7529,
29892,
5446,
29918,
5552,
29918,
5975,
29897,
13,
4706,
565,
451,
338,
29918,
5415,
29901,
13,
9651,
3495,
29918,
7529,
29889,
7323,
703,
333,
613,
6213,
29897,
13,
4706,
736,
4733,
29889,
8514,
29898,
1068,
3069,
29918,
7529,
29897,
565,
338,
29918,
5415,
1683,
3495,
29918,
7529,
13,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
2069,
29918,
2585,
29898,
25932,
1125,
13,
4706,
396,
29871,
31120,
31020,
30705,
14035,
29918,
2271,
13,
4706,
6055,
29889,
29933,
29968,
20576,
29918,
6632,
2287,
27616,
29918,
29907,
9818,
29933,
11375,
29918,
4219,
353,
315,
9818,
29933,
11375,
29918,
4219,
13,
4706,
6055,
29889,
29933,
29968,
20576,
29918,
6632,
2287,
27616,
29918,
12015,
1001,
29918,
29907,
9818,
29933,
11375,
29918,
4219,
353,
315,
9818,
29933,
11375,
29918,
4219,
13,
13,
4706,
25691,
29918,
7529,
353,
1067,
29879,
29889,
1491,
22371,
29918,
5415,
580,
13,
4706,
25691,
353,
4733,
29889,
4035,
22371,
29889,
12650,
29889,
3258,
29898,
1068,
1491,
22371,
29918,
7529,
29897,
13,
13,
4706,
25691,
29918,
7662,
29918,
7529,
353,
1067,
29879,
29889,
1491,
22371,
29918,
7662,
29918,
5415,
29898,
5415,
29918,
5552,
29918,
5975,
3790,
29908,
1491,
22371,
29918,
333,
1115,
25691,
29889,
333,
1800,
13,
4706,
25691,
29918,
7662,
353,
4733,
29889,
4035,
22371,
5398,
29889,
12650,
29889,
3258,
29898,
1068,
1491,
22371,
29918,
7662,
29918,
7529,
29897,
13,
13,
4706,
25691,
29918,
8758,
29918,
11651,
29918,
7529,
353,
1067,
29879,
29889,
1491,
22371,
29918,
8758,
29918,
11651,
29918,
5415,
29898,
13,
9651,
5446,
29918,
5552,
29918,
5975,
3790,
29908,
1491,
22371,
29918,
333,
1115,
25691,
29889,
333,
29892,
376,
7662,
29918,
333,
1115,
25691,
29918,
7662,
29889,
333,
29913,
13,
4706,
1723,
13,
4706,
25691,
29918,
8758,
29918,
11651,
353,
4733,
29889,
4035,
22371,
4998,
9182,
29889,
12650,
29889,
3258,
29898,
13,
9651,
3579,
1491,
22371,
29918,
8758,
29918,
11651,
29918,
7529,
13,
4706,
1723,
13,
13,
4706,
4982,
29918,
7529,
353,
1067,
29879,
29889,
9057,
29918,
5415,
29898,
13,
9651,
5446,
29918,
5552,
29918,
5975,
3790,
29908,
1491,
22371,
29918,
333,
1115,
25691,
29889,
333,
29892,
376,
7662,
29918,
333,
29918,
1761,
1115,
518,
1491,
22371,
29918,
7662,
29889,
333,
12258,
13,
4706,
1723,
13,
4706,
4982,
353,
4733,
29889,
11947,
29889,
12650,
29889,
3258,
29898,
1068,
9057,
29918,
7529,
29897,
13,
13,
4706,
4982,
29918,
7662,
29918,
7529,
353,
1067,
29879,
29889,
9057,
29918,
7662,
29918,
5415,
3319,
29908,
9057,
29918,
333,
1115,
4982,
29889,
333,
1800,
13,
4706,
4982,
29918,
7662,
353,
4733,
29889,
11947,
5398,
29889,
12650,
29889,
3258,
29898,
1068,
9057,
29918,
7662,
29918,
7529,
29897,
13,
13,
4706,
3495,
29918,
7529,
353,
1067,
29879,
29889,
3069,
29918,
5415,
580,
13,
4706,
3495,
353,
4733,
29889,
8514,
29889,
12650,
29889,
3258,
29898,
1068,
3069,
29918,
7529,
29897,
13,
13,
4706,
10110,
29918,
1272,
29918,
7529,
353,
1067,
29879,
29889,
22350,
29918,
1272,
29918,
5415,
580,
13,
4706,
4733,
29889,
18415,
1469,
29889,
12650,
29889,
3258,
29898,
1068,
22350,
29918,
1272,
29918,
7529,
29897,
13,
13,
4706,
736,
426,
13,
9651,
376,
1491,
22371,
29918,
333,
1115,
25691,
29889,
333,
29892,
13,
9651,
376,
1491,
22371,
29918,
7662,
29918,
333,
1115,
25691,
29918,
7662,
29889,
333,
29892,
13,
9651,
376,
1491,
22371,
29918,
8758,
29918,
11651,
29918,
333,
1115,
25691,
29918,
8758,
29918,
11651,
29889,
333,
29892,
13,
9651,
376,
9057,
29918,
333,
1115,
4982,
29889,
333,
29892,
13,
9651,
376,
9057,
29918,
7662,
29918,
333,
1115,
4982,
29918,
7662,
29889,
333,
29892,
13,
9651,
376,
29890,
29895,
29918,
3069,
29918,
333,
1115,
3495,
29889,
29890,
29895,
29918,
3069,
29918,
333,
29892,
13,
4706,
500,
13,
2
] |
dsharpy/tools.py | parttimenerd/dsharpy | 1 | 94166 | """ Utilities not directly related to formulas or CNFs """
import logging
import math
import os
import re
import shutil
import subprocess
import tempfile
from typing import TYPE_CHECKING, Dict, Set, Tuple, Iterable
from dsharpy.preprocess import preprocess_c_code
from pathlib import Path
from tempfile import NamedTemporaryFile
from typing import List, Union, Any
logging.basicConfig(level=logging.WARNING)
def pprint(x: Any):
import prettyprinter
prettyprinter.install_extras(exclude=['ipython', 'ipython_repr_pretty'])
prettyprinter.pprint(x)
class Tool:
OUTPUT_PREFIX = "__out"
def __init__(self, name: str, binary: str):
self.name = name
self.binary_path = Path(binary.replace("TOOLS", str(Path(__file__).parent.parent.absolute() / "tools")))
assert self._check_binary(), f"Binary for {name} ({self.binary_path}) not found"
def _check_binary(self):
try:
subprocess.run([str(self.binary_path), "-h"], check=True, capture_output=False,
stdout=subprocess.DEVNULL)
return True
except subprocess.CalledProcessError:
return False
def _process(self, arguments: List[Any], env_vars: Dict[str, Any], interpreter: str = None,
cwd: Path = None) -> str:
env = os.environ.copy()
for key, value in env_vars.items():
env[key] = str(value)
cmd = ([interpreter] if interpreter else []) + [str(self.binary_path)] + [str(x) for x in arguments]
logging.info(cmd)
res = subprocess.run(cmd,
stdout=subprocess.PIPE, bufsize=-1, stderr=subprocess.PIPE, env=env,
cwd=str(cwd) if cwd else os.getcwd())
err = res.stderr.decode()
out = res.stdout.decode()
if "Failed" in err or "Usage" in err or "ERROR" in err or "exception" in err \
or " failed" in err or "segmentation fault" in err \
or "segmentation fault" in out or res.returncode != 0:
logging.error(out)
logging.error(err)
for argument in arguments:
if str(argument).endswith(".cpp") and isinstance(argument, Path) and argument.exists():
logging.error(argument.read_text())
raise RuntimeError(f"{self.name}: " + err)
return out
@staticmethod
def _preprocess(tmp_dir: Path, code: Union[str, Path]) -> Path:
code: str = code if isinstance(code, str) else code.read_text()
with NamedTemporaryFile(suffix=".cpp", dir=tmp_dir, delete=False) as f:
f.write(preprocess_c_code(code, Tool.OUTPUT_PREFIX).encode())
f.flush()
return Path(f.name)
class ModelChecker(Tool):
def __init__(self, name: str, binary: str, unwind: int, bit_width: int = 32):
super(ModelChecker, self).__init__(name, binary)
self.unwind = unwind
self.bit_width = bit_width
self._problem_line_re = re.compile('((p cnf)|(c __rel__ p)) [0-9]+ [0-9]+\n')
def setup_for(self, lc: "LeakageComputer"):
pass
def _is_problem_line(self, line: str) -> bool:
return bool(self._problem_line_re.match(line))
def _filter_lines(self, lines: List[str]) -> Iterable[str]:
has_seen_problem_line = False
for line in lines:
if not has_seen_problem_line:
if self._is_problem_line(line):
yield line
has_seen_problem_line = True
continue
if line.startswith("c ") or line.endswith(" 0\n"):
yield line
def process(self, tmp_dir: Path, code: Union[str, Path]) -> Path:
code = Tool._preprocess(tmp_dir, code)
with NamedTemporaryFile(suffix=".cnf", dir=tmp_dir, delete=False) as f:
f.writelines(l.encode() for l in self._filter_lines(self._process(self._arguments(code), self._env_vars(code)).splitlines(keepends=True)))
return Path(f.name)
def _env_vars(self, code: Path) -> Dict[str, Any]:
return {}
def _arguments(self, code: Path) -> List[Any]:
return []
class CBMCBase(ModelChecker):
def __init__(self, name: str, unwind: int = 32, bit_width: int = 32):
super(CBMCBase, self).__init__(name, f"TOOLS/{name}/build/bin/cbmc", unwind, bit_width)
def setup_for(self, lc: "LeakageComputer"):
assert not lc.requires_rel()
def _env_vars(self, code: Path) -> Dict[str, Any]:
return {}
def _arguments(self, code: Path) -> List[Any]:
return [code, f"--{self.bit_width}", "--unwind", self.unwind, "--dimacs", "--partial-loops"]
class CBMC(CBMCBase):
def __init__(self, unwind: int = 32, bit_width: int = 32):
super(CBMC, self).__init__("cbmc", unwind, bit_width)
class ModifiedCBMC(CBMCBase):
""" CBMC with loop and recursion approximation """
def __init__(self, unwind: int = 32, bit_width: int = 32):
super(ModifiedCBMC, self).__init__("modified_cbmc", unwind + 2, bit_width)
assert self.unwind >= 1
self.real_unwind = unwind
self.only_rel = False
def setup_for(self, lc: "LeakageComputer"):
self.only_rel = lc.requires_rel()
def _env_vars(self, code: Path) -> Dict[str, Any]:
return {"REC": self.real_unwind - 1, **({"RELATIONS": "1", "OMIT_SAT": "1"} if self.only_rel else {})}
class LeakageComputer(Tool):
def __init__(self, name: str, binary: str, output_method: str = "main"):
super(LeakageComputer, self).__init__(name, binary)
self.output_method = output_method
def requires_rel(self) -> bool:
raise NotImplementedError()
def process(self, cnf_file: Path) -> float:
return self._parse_output(self._process(self._arguments(cnf_file), env_vars={}))
def _arguments(self, cnf_file: Path) -> List[Any]:
raise NotImplementedError()
def _parse_output(self, out: str) -> float:
raise NotImplementedError()
class RelationsCutter(LeakageComputer):
def __init__(self, output_method: str = "main", input_prefixes: List[str] = None):
super(RelationsCutter, self).__init__("relationscutter", "TOOLS/relationscutter/build/relationscutter",
output_method)
self.input_prefixes = input_prefixes or ["symex::nondet"]
def requires_rel(self) -> bool:
return True
def _arguments(self, cnf_file: Path) -> List[Any]:
return [cnf_file, "--method", self.output_method, "--input", ",".join(self.input_prefixes), "--output",
Tool.OUTPUT_PREFIX]
def _parse_output(self, out: str) -> float:
return float(out.split("Leakage: ")[1].split("\n")[0])
class ApproxFlow(LeakageComputer):
"""
Reimplementation of ApproxFlow, it is far simpler as the code preprocessing is simpler
Based on https://github.com/parttimenerd/approxflow/blob/master/ApproxFlow.py
"""
def __init__(self, output_method: str = "main", epsilon: float = 0.8, delta: float = 0.2):
super(ApproxFlow, self).__init__("approxflow", "TOOLS/approxmc", output_method)
self.delta = delta
self.epsilon = epsilon
def requires_rel(self) -> bool:
return False
def _get_ind_vars(self, cnf_file: Path) -> Set[int]:
# based on https://github.com/parttimenerd/approxflow/blob/master/ApproxFlow.py
# search for __out…!i@j#k, and assume only k changes
re_to_match = re.compile(f"({Tool.OUTPUT_PREFIX}[0-9]*)![0-9]+@[0-9]+#[0-9]+")
variables: Dict[str, Tuple[int, Set[int]]] = {}
max_lits = None
for line in cnf_file.open():
if line.startswith("c") and (" " + self.output_method + "::") in line:
match = re_to_match.search(line)
if match:
assert (len(match.groups()) == 1)
variable, ijk = match.group(0).split(Tool.OUTPUT_PREFIX, maxsplit=1)[1].split("!", maxsplit=1)
new_k = int(ijk.split("#")[1])
old_k = variables[variable][0] if variable in variables else -1
sat_vars = {abs(int(var)) for var in line.split()[2:] if var.lower() not in ["true", "false"]}
if new_k > old_k:
variables[variable] = (new_k, sat_vars)
if new_k == old_k:
variables[variable][1].update(sat_vars)
return {x for _, v in variables.items() for x in v[1]}
def _arguments(self, cnf_file: Path) -> List[Any]:
with NamedTemporaryFile(suffix=".cnf", dir=cnf_file.parent, delete=False) as f:
shutil.copy(cnf_file, f.name)
with Path(f.name).open("a") as of:
of.write(f"c ind {' '.join(map(str, self._get_ind_vars(cnf_file)))} 0\n")
return ["--input", f.name]
def _parse_output(self, out: str) -> float:
[multiplier, power] = out.split("Number of solutions is:")[1].split("\n")[0].split("*", 1)
[base, exponent] = power.split("**")
multiplier = int(multiplier)
base = int(base)
exponent = int(exponent)
solutions = multiplier * base ** exponent
return math.log(solutions, 2)
def process(model_checker: ModelChecker, leakage_computer: LeakageComputer, code: Union[str, Path]) -> float:
model_checker.setup_for(leakage_computer)
with tempfile.TemporaryDirectory() as tmp_dir:
return leakage_computer.process(model_checker.process(tmp_dir, code))
MODEL_CHECKERS = {
"modified_cbmc": lambda unwind, **kwargs: ModifiedCBMC(unwind, **kwargs),
"cbmc": lambda unwind, **kwargs: CBMC(unwind, **kwargs)
}
LEAKAGE_COMPUTERS = {
"approxflow": lambda **kwargs: ApproxFlow(**kwargs),
"relationscutter": lambda **kwargs: RelationsCutter(**kwargs)
}
| [
1,
9995,
22310,
1907,
451,
4153,
4475,
304,
26760,
470,
315,
22498,
29879,
9995,
13,
5215,
12183,
13,
5215,
5844,
13,
5215,
2897,
13,
5215,
337,
13,
5215,
528,
4422,
13,
5215,
1014,
5014,
13,
5215,
5694,
1445,
13,
3166,
19229,
1053,
323,
6959,
29918,
3210,
16658,
4214,
29892,
360,
919,
29892,
3789,
29892,
12603,
552,
29892,
20504,
519,
13,
13,
3166,
270,
845,
279,
2272,
29889,
1457,
5014,
1053,
758,
5014,
29918,
29883,
29918,
401,
13,
13,
3166,
2224,
1982,
1053,
10802,
13,
3166,
5694,
1445,
1053,
405,
2795,
5776,
1971,
653,
2283,
13,
3166,
19229,
1053,
2391,
29892,
7761,
29892,
3139,
13,
13,
21027,
29889,
16121,
3991,
29898,
5563,
29922,
21027,
29889,
29956,
25614,
29897,
13,
13,
13,
1753,
282,
2158,
29898,
29916,
29901,
3139,
1125,
13,
1678,
1053,
5051,
558,
1639,
13,
1678,
5051,
558,
1639,
29889,
6252,
29918,
1062,
3417,
29898,
735,
2325,
29922,
1839,
666,
1656,
742,
525,
666,
1656,
29918,
276,
558,
29918,
1457,
4349,
11287,
13,
1678,
5051,
558,
1639,
29889,
407,
29878,
524,
29898,
29916,
29897,
13,
13,
13,
1990,
21704,
29901,
13,
1678,
19474,
12336,
29918,
15094,
25634,
353,
376,
1649,
449,
29908,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1024,
29901,
851,
29892,
7581,
29901,
851,
1125,
13,
4706,
1583,
29889,
978,
353,
1024,
13,
4706,
1583,
29889,
19541,
29918,
2084,
353,
10802,
29898,
19541,
29889,
6506,
703,
4986,
5607,
29903,
613,
851,
29898,
2605,
22168,
1445,
1649,
467,
3560,
29889,
3560,
29889,
23552,
580,
847,
376,
8504,
29908,
4961,
13,
4706,
4974,
1583,
3032,
3198,
29918,
19541,
3285,
285,
29908,
25196,
363,
426,
978,
29913,
21313,
1311,
29889,
19541,
29918,
2084,
1800,
451,
1476,
29908,
13,
13,
1678,
822,
903,
3198,
29918,
19541,
29898,
1311,
1125,
13,
4706,
1018,
29901,
13,
9651,
1014,
5014,
29889,
3389,
4197,
710,
29898,
1311,
29889,
19541,
29918,
2084,
511,
11663,
29882,
12436,
1423,
29922,
5574,
29892,
10446,
29918,
4905,
29922,
8824,
29892,
13,
462,
965,
27591,
29922,
1491,
5014,
29889,
2287,
29963,
10074,
29897,
13,
9651,
736,
5852,
13,
4706,
5174,
1014,
5014,
29889,
29907,
4212,
7032,
2392,
29901,
13,
9651,
736,
7700,
13,
13,
1678,
822,
903,
5014,
29898,
1311,
29892,
6273,
29901,
2391,
29961,
10773,
1402,
8829,
29918,
16908,
29901,
360,
919,
29961,
710,
29892,
3139,
1402,
26997,
29901,
851,
353,
6213,
29892,
13,
462,
274,
9970,
29901,
10802,
353,
6213,
29897,
1599,
851,
29901,
13,
4706,
8829,
353,
2897,
29889,
21813,
29889,
8552,
580,
13,
4706,
363,
1820,
29892,
995,
297,
8829,
29918,
16908,
29889,
7076,
7295,
13,
9651,
8829,
29961,
1989,
29962,
353,
851,
29898,
1767,
29897,
13,
4706,
9920,
353,
9310,
1639,
1457,
357,
29962,
565,
26997,
1683,
518,
2314,
718,
518,
710,
29898,
1311,
29889,
19541,
29918,
2084,
4638,
718,
518,
710,
29898,
29916,
29897,
363,
921,
297,
6273,
29962,
13,
4706,
12183,
29889,
3888,
29898,
9006,
29897,
13,
4706,
620,
353,
1014,
5014,
29889,
3389,
29898,
9006,
29892,
13,
462,
632,
27591,
29922,
1491,
5014,
29889,
2227,
4162,
29892,
18392,
2311,
10457,
29896,
29892,
380,
20405,
29922,
1491,
5014,
29889,
2227,
4162,
29892,
8829,
29922,
6272,
29892,
13,
462,
632,
274,
9970,
29922,
710,
29898,
29883,
9970,
29897,
565,
274,
9970,
1683,
2897,
29889,
657,
29883,
9970,
3101,
13,
4706,
4589,
353,
620,
29889,
303,
20405,
29889,
13808,
580,
13,
4706,
714,
353,
620,
29889,
25393,
29889,
13808,
580,
13,
4706,
565,
376,
17776,
29908,
297,
4589,
470,
376,
27573,
29908,
297,
4589,
470,
376,
11432,
29908,
297,
4589,
470,
376,
11739,
29908,
297,
4589,
320,
13,
18884,
470,
376,
5229,
29908,
297,
4589,
470,
376,
28192,
362,
12570,
29908,
297,
4589,
320,
13,
18884,
470,
376,
28192,
362,
12570,
29908,
297,
714,
470,
620,
29889,
2457,
401,
2804,
29871,
29900,
29901,
13,
9651,
12183,
29889,
2704,
29898,
449,
29897,
13,
9651,
12183,
29889,
2704,
29898,
3127,
29897,
13,
9651,
363,
2980,
297,
6273,
29901,
13,
18884,
565,
851,
29898,
23516,
467,
1975,
2541,
17350,
8223,
1159,
322,
338,
8758,
29898,
23516,
29892,
10802,
29897,
322,
2980,
29889,
9933,
7295,
13,
462,
1678,
12183,
29889,
2704,
29898,
23516,
29889,
949,
29918,
726,
3101,
13,
9651,
12020,
24875,
2392,
29898,
29888,
29908,
29912,
1311,
29889,
978,
6177,
376,
718,
4589,
29897,
13,
13,
4706,
736,
714,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
903,
1457,
5014,
29898,
7050,
29918,
3972,
29901,
10802,
29892,
775,
29901,
7761,
29961,
710,
29892,
10802,
2314,
1599,
10802,
29901,
13,
4706,
775,
29901,
851,
353,
775,
565,
338,
8758,
29898,
401,
29892,
851,
29897,
1683,
775,
29889,
949,
29918,
726,
580,
13,
4706,
411,
405,
2795,
5776,
1971,
653,
2283,
29898,
2146,
600,
861,
29569,
8223,
613,
4516,
29922,
7050,
29918,
3972,
29892,
5217,
29922,
8824,
29897,
408,
285,
29901,
13,
9651,
285,
29889,
3539,
29898,
1457,
5014,
29918,
29883,
29918,
401,
29898,
401,
29892,
21704,
29889,
12015,
12336,
29918,
15094,
25634,
467,
12508,
3101,
13,
9651,
285,
29889,
23126,
580,
13,
9651,
736,
10802,
29898,
29888,
29889,
978,
29897,
13,
13,
13,
1990,
8125,
5596,
261,
29898,
12229,
1125,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1024,
29901,
851,
29892,
7581,
29901,
851,
29892,
443,
14800,
29901,
938,
29892,
2586,
29918,
2103,
29901,
938,
353,
29871,
29941,
29906,
1125,
13,
4706,
2428,
29898,
3195,
5596,
261,
29892,
1583,
467,
1649,
2344,
12035,
978,
29892,
7581,
29897,
13,
4706,
1583,
29889,
348,
14800,
353,
443,
14800,
13,
4706,
1583,
29889,
2966,
29918,
2103,
353,
2586,
29918,
2103,
13,
4706,
1583,
3032,
17199,
29918,
1220,
29918,
276,
353,
337,
29889,
12198,
877,
3552,
29886,
274,
29876,
29888,
10531,
29898,
29883,
4770,
2674,
1649,
282,
876,
518,
29900,
29899,
29929,
10062,
518,
29900,
29899,
29929,
29962,
3124,
29876,
1495,
13,
13,
1678,
822,
6230,
29918,
1454,
29898,
1311,
29892,
301,
29883,
29901,
376,
3226,
557,
482,
20606,
261,
29908,
1125,
13,
4706,
1209,
13,
13,
1678,
822,
903,
275,
29918,
17199,
29918,
1220,
29898,
1311,
29892,
1196,
29901,
851,
29897,
1599,
6120,
29901,
13,
4706,
736,
6120,
29898,
1311,
3032,
17199,
29918,
1220,
29918,
276,
29889,
4352,
29898,
1220,
876,
13,
13,
1678,
822,
903,
4572,
29918,
9012,
29898,
1311,
29892,
3454,
29901,
2391,
29961,
710,
2314,
1599,
20504,
519,
29961,
710,
5387,
13,
4706,
756,
29918,
28026,
29918,
17199,
29918,
1220,
353,
7700,
13,
4706,
363,
1196,
297,
3454,
29901,
13,
9651,
565,
451,
756,
29918,
28026,
29918,
17199,
29918,
1220,
29901,
13,
18884,
565,
1583,
3032,
275,
29918,
17199,
29918,
1220,
29898,
1220,
1125,
13,
462,
1678,
7709,
1196,
13,
462,
1678,
756,
29918,
28026,
29918,
17199,
29918,
1220,
353,
5852,
13,
18884,
6773,
13,
9651,
565,
1196,
29889,
27382,
2541,
703,
29883,
16521,
470,
1196,
29889,
1975,
2541,
703,
29871,
29900,
29905,
29876,
29908,
1125,
13,
18884,
7709,
1196,
13,
13,
1678,
822,
1889,
29898,
1311,
29892,
13128,
29918,
3972,
29901,
10802,
29892,
775,
29901,
7761,
29961,
710,
29892,
10802,
2314,
1599,
10802,
29901,
13,
4706,
775,
353,
21704,
3032,
1457,
5014,
29898,
7050,
29918,
3972,
29892,
775,
29897,
13,
4706,
411,
405,
2795,
5776,
1971,
653,
2283,
29898,
2146,
600,
861,
29569,
18038,
29888,
613,
4516,
29922,
7050,
29918,
3972,
29892,
5217,
29922,
8824,
29897,
408,
285,
29901,
13,
9651,
285,
29889,
8231,
24210,
29898,
29880,
29889,
12508,
580,
363,
301,
297,
1583,
3032,
4572,
29918,
9012,
29898,
1311,
3032,
5014,
29898,
1311,
3032,
25699,
29898,
401,
511,
1583,
3032,
6272,
29918,
16908,
29898,
401,
8106,
5451,
9012,
29898,
17462,
1975,
29922,
5574,
4961,
13,
9651,
736,
10802,
29898,
29888,
29889,
978,
29897,
13,
13,
1678,
822,
903,
6272,
29918,
16908,
29898,
1311,
29892,
775,
29901,
10802,
29897,
1599,
360,
919,
29961,
710,
29892,
3139,
5387,
13,
4706,
736,
6571,
13,
13,
1678,
822,
903,
25699,
29898,
1311,
29892,
775,
29901,
10802,
29897,
1599,
2391,
29961,
10773,
5387,
13,
4706,
736,
5159,
13,
13,
13,
1990,
315,
29933,
12513,
5160,
29898,
3195,
5596,
261,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1024,
29901,
851,
29892,
443,
14800,
29901,
938,
353,
29871,
29941,
29906,
29892,
2586,
29918,
2103,
29901,
938,
353,
29871,
29941,
29906,
1125,
13,
4706,
2428,
29898,
21685,
12513,
5160,
29892,
1583,
467,
1649,
2344,
12035,
978,
29892,
285,
29908,
4986,
5607,
29903,
19248,
978,
6822,
4282,
29914,
2109,
29914,
29883,
5838,
29883,
613,
443,
14800,
29892,
2586,
29918,
2103,
29897,
13,
13,
1678,
822,
6230,
29918,
1454,
29898,
1311,
29892,
301,
29883,
29901,
376,
3226,
557,
482,
20606,
261,
29908,
1125,
13,
4706,
4974,
451,
301,
29883,
29889,
276,
339,
2658,
29918,
2674,
580,
13,
13,
1678,
822,
903,
6272,
29918,
16908,
29898,
1311,
29892,
775,
29901,
10802,
29897,
1599,
360,
919,
29961,
710,
29892,
3139,
5387,
13,
4706,
736,
6571,
13,
13,
1678,
822,
903,
25699,
29898,
1311,
29892,
775,
29901,
10802,
29897,
1599,
2391,
29961,
10773,
5387,
13,
4706,
736,
518,
401,
29892,
285,
29908,
489,
29912,
1311,
29889,
2966,
29918,
2103,
17671,
376,
489,
348,
14800,
613,
1583,
29889,
348,
14800,
29892,
376,
489,
6229,
16815,
613,
376,
489,
3846,
29899,
417,
3554,
3108,
13,
13,
13,
1990,
315,
29933,
12513,
29898,
21685,
12513,
5160,
1125,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
443,
14800,
29901,
938,
353,
29871,
29941,
29906,
29892,
2586,
29918,
2103,
29901,
938,
353,
29871,
29941,
29906,
1125,
13,
4706,
2428,
29898,
21685,
12513,
29892,
1583,
467,
1649,
2344,
1649,
703,
29883,
5838,
29883,
613,
443,
14800,
29892,
2586,
29918,
2103,
29897,
13,
13,
13,
1990,
3382,
2164,
21685,
12513,
29898,
21685,
12513,
5160,
1125,
13,
1678,
9995,
315,
29933,
12513,
411,
2425,
322,
20437,
16845,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
443,
14800,
29901,
938,
353,
29871,
29941,
29906,
29892,
2586,
29918,
2103,
29901,
938,
353,
29871,
29941,
29906,
1125,
13,
4706,
2428,
29898,
2111,
2164,
21685,
12513,
29892,
1583,
467,
1649,
2344,
1649,
703,
1545,
2164,
29918,
29883,
5838,
29883,
613,
443,
14800,
718,
29871,
29906,
29892,
2586,
29918,
2103,
29897,
13,
4706,
4974,
1583,
29889,
348,
14800,
6736,
29871,
29896,
13,
4706,
1583,
29889,
6370,
29918,
348,
14800,
353,
443,
14800,
13,
4706,
1583,
29889,
6194,
29918,
2674,
353,
7700,
13,
13,
1678,
822,
6230,
29918,
1454,
29898,
1311,
29892,
301,
29883,
29901,
376,
3226,
557,
482,
20606,
261,
29908,
1125,
13,
4706,
1583,
29889,
6194,
29918,
2674,
353,
301,
29883,
29889,
276,
339,
2658,
29918,
2674,
580,
13,
13,
1678,
822,
903,
6272,
29918,
16908,
29898,
1311,
29892,
775,
29901,
10802,
29897,
1599,
360,
919,
29961,
710,
29892,
3139,
5387,
13,
4706,
736,
8853,
1525,
29907,
1115,
1583,
29889,
6370,
29918,
348,
14800,
448,
29871,
29896,
29892,
3579,
3319,
29908,
1525,
29931,
8098,
29903,
1115,
376,
29896,
613,
376,
6488,
1806,
29918,
29903,
1299,
1115,
376,
29896,
9092,
565,
1583,
29889,
6194,
29918,
2674,
1683,
426,
1800,
29913,
13,
13,
13,
1990,
951,
557,
482,
20606,
261,
29898,
12229,
1125,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1024,
29901,
851,
29892,
7581,
29901,
851,
29892,
1962,
29918,
5696,
29901,
851,
353,
376,
3396,
29908,
1125,
13,
4706,
2428,
29898,
3226,
557,
482,
20606,
261,
29892,
1583,
467,
1649,
2344,
12035,
978,
29892,
7581,
29897,
13,
4706,
1583,
29889,
4905,
29918,
5696,
353,
1962,
29918,
5696,
13,
13,
1678,
822,
6858,
29918,
2674,
29898,
1311,
29897,
1599,
6120,
29901,
13,
4706,
12020,
2216,
1888,
2037,
287,
2392,
580,
13,
13,
1678,
822,
1889,
29898,
1311,
29892,
274,
29876,
29888,
29918,
1445,
29901,
10802,
29897,
1599,
5785,
29901,
13,
4706,
736,
1583,
3032,
5510,
29918,
4905,
29898,
1311,
3032,
5014,
29898,
1311,
3032,
25699,
29898,
18038,
29888,
29918,
1445,
511,
8829,
29918,
16908,
3790,
20073,
13,
13,
1678,
822,
903,
25699,
29898,
1311,
29892,
274,
29876,
29888,
29918,
1445,
29901,
10802,
29897,
1599,
2391,
29961,
10773,
5387,
13,
4706,
12020,
2216,
1888,
2037,
287,
2392,
580,
13,
13,
1678,
822,
903,
5510,
29918,
4905,
29898,
1311,
29892,
714,
29901,
851,
29897,
1599,
5785,
29901,
13,
4706,
12020,
2216,
1888,
2037,
287,
2392,
580,
13,
13,
13,
1990,
6376,
800,
29907,
6463,
29898,
3226,
557,
482,
20606,
261,
1125,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1962,
29918,
5696,
29901,
851,
353,
376,
3396,
613,
1881,
29918,
13506,
267,
29901,
2391,
29961,
710,
29962,
353,
6213,
1125,
13,
4706,
2428,
29898,
9662,
800,
29907,
6463,
29892,
1583,
467,
1649,
2344,
1649,
703,
2674,
800,
29883,
6463,
613,
376,
4986,
5607,
29903,
29914,
2674,
800,
29883,
6463,
29914,
4282,
29914,
2674,
800,
29883,
6463,
613,
13,
462,
462,
795,
1962,
29918,
5696,
29897,
13,
4706,
1583,
29889,
2080,
29918,
13506,
267,
353,
1881,
29918,
13506,
267,
470,
6796,
11967,
735,
1057,
29876,
898,
300,
3108,
13,
13,
1678,
822,
6858,
29918,
2674,
29898,
1311,
29897,
1599,
6120,
29901,
13,
4706,
736,
5852,
13,
13,
1678,
822,
903,
25699,
29898,
1311,
29892,
274,
29876,
29888,
29918,
1445,
29901,
10802,
29897,
1599,
2391,
29961,
10773,
5387,
13,
4706,
736,
518,
18038,
29888,
29918,
1445,
29892,
376,
489,
5696,
613,
1583,
29889,
4905,
29918,
5696,
29892,
376,
489,
2080,
613,
9162,
1642,
7122,
29898,
1311,
29889,
2080,
29918,
13506,
267,
511,
376,
489,
4905,
613,
13,
18884,
21704,
29889,
12015,
12336,
29918,
15094,
25634,
29962,
13,
13,
1678,
822,
903,
5510,
29918,
4905,
29898,
1311,
29892,
714,
29901,
851,
29897,
1599,
5785,
29901,
13,
4706,
736,
5785,
29898,
449,
29889,
5451,
703,
3226,
557,
482,
29901,
376,
9601,
29896,
1822,
5451,
14182,
29876,
1159,
29961,
29900,
2314,
13,
13,
13,
1990,
28268,
29916,
17907,
29898,
3226,
557,
482,
20606,
261,
1125,
13,
1678,
9995,
13,
1678,
830,
21382,
310,
28268,
29916,
17907,
29892,
372,
338,
2215,
13682,
408,
278,
775,
758,
19170,
338,
13682,
13,
13,
1678,
16564,
373,
2045,
597,
3292,
29889,
510,
29914,
1595,
9346,
759,
29881,
29914,
14850,
1731,
29914,
10054,
29914,
6207,
29914,
2052,
307,
29916,
17907,
29889,
2272,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1962,
29918,
5696,
29901,
851,
353,
376,
3396,
613,
321,
3232,
29901,
5785,
353,
29871,
29900,
29889,
29947,
29892,
19471,
29901,
5785,
353,
29871,
29900,
29889,
29906,
1125,
13,
4706,
2428,
29898,
2052,
307,
29916,
17907,
29892,
1583,
467,
1649,
2344,
1649,
703,
14850,
1731,
613,
376,
4986,
5607,
29903,
29914,
14850,
14047,
613,
1962,
29918,
5696,
29897,
13,
4706,
1583,
29889,
4181,
353,
19471,
13,
4706,
1583,
29889,
5463,
353,
321,
3232,
13,
13,
1678,
822,
6858,
29918,
2674,
29898,
1311,
29897,
1599,
6120,
29901,
13,
4706,
736,
7700,
13,
13,
1678,
822,
903,
657,
29918,
513,
29918,
16908,
29898,
1311,
29892,
274,
29876,
29888,
29918,
1445,
29901,
10802,
29897,
1599,
3789,
29961,
524,
5387,
13,
4706,
396,
2729,
373,
2045,
597,
3292,
29889,
510,
29914,
1595,
9346,
759,
29881,
29914,
14850,
1731,
29914,
10054,
29914,
6207,
29914,
2052,
307,
29916,
17907,
29889,
2272,
13,
4706,
396,
2740,
363,
4770,
449,
30098,
29991,
29875,
29992,
29926,
29937,
29895,
29892,
322,
5251,
871,
413,
3620,
13,
4706,
337,
29918,
517,
29918,
4352,
353,
337,
29889,
12198,
29898,
29888,
29908,
3319,
12229,
29889,
12015,
12336,
29918,
15094,
25634,
4400,
29900,
29899,
29929,
29962,
7528,
21298,
29900,
29899,
29929,
10062,
29992,
29961,
29900,
29899,
29929,
10062,
29937,
29961,
29900,
29899,
29929,
10062,
1159,
13,
4706,
3651,
29901,
360,
919,
29961,
710,
29892,
12603,
552,
29961,
524,
29892,
3789,
29961,
524,
5262,
29962,
353,
6571,
13,
4706,
4236,
29918,
29880,
1169,
353,
6213,
13,
4706,
363,
1196,
297,
274,
29876,
29888,
29918,
1445,
29889,
3150,
7295,
13,
9651,
565,
1196,
29889,
27382,
2541,
703,
29883,
1159,
322,
4852,
376,
718,
1583,
29889,
4905,
29918,
5696,
718,
376,
1057,
1159,
297,
1196,
29901,
13,
18884,
1993,
353,
337,
29918,
517,
29918,
4352,
29889,
4478,
29898,
1220,
29897,
13,
18884,
565,
1993,
29901,
13,
462,
1678,
4974,
313,
2435,
29898,
4352,
29889,
13155,
3101,
1275,
29871,
29896,
29897,
13,
462,
1678,
2286,
29892,
474,
25467,
353,
1993,
29889,
2972,
29898,
29900,
467,
5451,
29898,
12229,
29889,
12015,
12336,
29918,
15094,
25634,
29892,
4236,
5451,
29922,
29896,
9601,
29896,
1822,
5451,
703,
29991,
613,
4236,
5451,
29922,
29896,
29897,
13,
462,
1678,
716,
29918,
29895,
353,
938,
29898,
13535,
29889,
5451,
14822,
1159,
29961,
29896,
2314,
13,
462,
1678,
2030,
29918,
29895,
353,
3651,
29961,
11918,
3816,
29900,
29962,
565,
2286,
297,
3651,
1683,
448,
29896,
13,
462,
1678,
3290,
29918,
16908,
353,
426,
6897,
29898,
524,
29898,
1707,
876,
363,
722,
297,
1196,
29889,
5451,
580,
29961,
29906,
17531,
565,
722,
29889,
13609,
580,
451,
297,
6796,
3009,
613,
376,
4541,
3108,
29913,
13,
462,
1678,
565,
716,
29918,
29895,
1405,
2030,
29918,
29895,
29901,
13,
462,
4706,
3651,
29961,
11918,
29962,
353,
313,
1482,
29918,
29895,
29892,
3290,
29918,
16908,
29897,
13,
462,
1678,
565,
716,
29918,
29895,
1275,
2030,
29918,
29895,
29901,
13,
462,
4706,
3651,
29961,
11918,
3816,
29896,
1822,
5504,
29898,
29879,
271,
29918,
16908,
29897,
13,
4706,
736,
426,
29916,
363,
17117,
325,
297,
3651,
29889,
7076,
580,
363,
921,
297,
325,
29961,
29896,
12258,
13,
13,
1678,
822,
903,
25699,
29898,
1311,
29892,
274,
29876,
29888,
29918,
1445,
29901,
10802,
29897,
1599,
2391,
29961,
10773,
5387,
13,
4706,
411,
405,
2795,
5776,
1971,
653,
2283,
29898,
2146,
600,
861,
29569,
18038,
29888,
613,
4516,
29922,
18038,
29888,
29918,
1445,
29889,
3560,
29892,
5217,
29922,
8824,
29897,
408,
285,
29901,
13,
9651,
528,
4422,
29889,
8552,
29898,
18038,
29888,
29918,
1445,
29892,
285,
29889,
978,
29897,
13,
9651,
411,
10802,
29898,
29888,
29889,
978,
467,
3150,
703,
29874,
1159,
408,
310,
29901,
13,
18884,
310,
29889,
3539,
29898,
29888,
29908,
29883,
1399,
11117,
15300,
7122,
29898,
1958,
29898,
710,
29892,
1583,
3032,
657,
29918,
513,
29918,
16908,
29898,
18038,
29888,
29918,
1445,
876,
2915,
29871,
29900,
29905,
29876,
1159,
13,
9651,
736,
6796,
489,
2080,
613,
285,
29889,
978,
29962,
13,
13,
1678,
822,
903,
5510,
29918,
4905,
29898,
1311,
29892,
714,
29901,
851,
29897,
1599,
5785,
29901,
13,
4706,
518,
18056,
4926,
29892,
3081,
29962,
353,
714,
29889,
5451,
703,
4557,
310,
6851,
338,
29901,
1159,
29961,
29896,
1822,
5451,
14182,
29876,
1159,
29961,
29900,
1822,
5451,
703,
29930,
613,
29871,
29896,
29897,
13,
4706,
518,
3188,
29892,
28869,
29962,
353,
3081,
29889,
5451,
703,
1068,
1159,
13,
4706,
6674,
4926,
353,
938,
29898,
18056,
4926,
29897,
13,
4706,
2967,
353,
938,
29898,
3188,
29897,
13,
4706,
28869,
353,
938,
29898,
735,
3296,
29897,
13,
4706,
6851,
353,
6674,
4926,
334,
2967,
3579,
28869,
13,
4706,
736,
5844,
29889,
1188,
29898,
2929,
17925,
29892,
29871,
29906,
29897,
13,
13,
13,
1753,
1889,
29898,
4299,
29918,
3198,
261,
29901,
8125,
5596,
261,
29892,
24993,
482,
29918,
12097,
261,
29901,
951,
557,
482,
20606,
261,
29892,
775,
29901,
7761,
29961,
710,
29892,
10802,
2314,
1599,
5785,
29901,
13,
1678,
1904,
29918,
3198,
261,
29889,
14669,
29918,
1454,
29898,
280,
557,
482,
29918,
12097,
261,
29897,
13,
1678,
411,
5694,
1445,
29889,
5776,
1971,
653,
9882,
580,
408,
13128,
29918,
3972,
29901,
13,
4706,
736,
24993,
482,
29918,
12097,
261,
29889,
5014,
29898,
4299,
29918,
3198,
261,
29889,
5014,
29898,
7050,
29918,
3972,
29892,
775,
876,
13,
13,
13,
20387,
29931,
29918,
3210,
16658,
23598,
353,
426,
13,
1678,
376,
1545,
2164,
29918,
29883,
5838,
29883,
1115,
14013,
443,
14800,
29892,
3579,
19290,
29901,
3382,
2164,
21685,
12513,
29898,
348,
14800,
29892,
3579,
19290,
511,
13,
1678,
376,
29883,
5838,
29883,
1115,
14013,
443,
14800,
29892,
3579,
19290,
29901,
315,
29933,
12513,
29898,
348,
14800,
29892,
3579,
19290,
29897,
13,
29913,
13,
13,
13,
1307,
22311,
10461,
29918,
21514,
2692,
23598,
353,
426,
13,
1678,
376,
14850,
1731,
1115,
14013,
3579,
19290,
29901,
28268,
29916,
17907,
29898,
1068,
19290,
511,
13,
1678,
376,
2674,
800,
29883,
6463,
1115,
14013,
3579,
19290,
29901,
6376,
800,
29907,
6463,
29898,
1068,
19290,
29897,
13,
29913,
13,
2
] |
os_migrate/plugins/modules/import_workload_create_instance.py | jbadiapa/os-migrate | 35 | 13458 | #!/usr/bin/python
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'
}
DOCUMENTATION = '''
---
module: import_workload_create_instance
short_description: Create NBD exports of OpenStack volumes
extends_documentation_fragment: openstack
version_added: "2.9.0"
author: "OpenStack tenant migration tools (@os-migrate)"
description:
- "Take an instance from an OS-Migrate YAML structure, and export its volumes over NBD."
options:
auth:
description:
- Dictionary with parameters for chosen auth type on the destination cloud.
required: true
type: dict
auth_type:
description:
- Auth type plugin for destination OpenStack cloud. Can be omitted if using password authentication.
required: false
type: str
region_name:
description:
- Destination OpenStack region name. Can be omitted if using default region.
required: false
type: str
availability_zone:
description:
- Availability zone.
required: false
type: str
cloud:
description:
- Ignored. Present for backwards compatibility.
required: false
type: raw
validate_certs:
description:
- Validate HTTPS certificates when logging in to OpenStack.
required: false
type: bool
data:
description:
- Data structure with server parameters as loaded from OS-Migrate workloads YAML file.
required: true
type: dict
block_device_mapping:
description:
- A block_device_mapping_v2 structure from the transfer_volumes module.
- Used to attach destination volumes to the new instance in the right order.
required: true
type: list
elements: dict
'''
EXAMPLES = '''
main.yml:
- name: validate loaded resources
os_migrate.os_migrate.validate_resource_files:
paths:
- "{{ os_migrate_data_dir }}/workloads.yml"
register: workloads_file_validation
when: import_workloads_validate_file
- name: read workloads resource file
os_migrate.os_migrate.read_resources:
path: "{{ os_migrate_data_dir }}/workloads.yml"
register: read_workloads
- name: get source conversion host address
os_migrate.os_migrate.os_conversion_host_info:
auth:
auth_url: https://src-osp:13000/v3
username: migrate
password: <PASSWORD>
project_domain_id: default
project_name: migration-source
user_domain_id: default
server_id: ce4dda96-5d8e-4b67-aee2-9845cdc943fe
register: os_src_conversion_host_info
- name: get destination conversion host address
os_migrate.os_migrate.os_conversion_host_info:
auth:
auth_url: https://dest-osp:13000/v3
username: migrate
password: <PASSWORD>
project_domain_id: default
project_name: migration-destination
user_domain_id: default
server_id: 2d2afe57-ace5-4187-8fca-5f10f9059ba1
register: os_dst_conversion_host_info
- name: import workloads
include_tasks: workload.yml
loop: "{{ read_workloads.resources }}"
workload.yml:
- block:
- name: preliminary setup for workload import
os_migrate.os_migrate.import_workload_prelim:
auth:
auth_url: https://dest-osp:13000/v3
username: migrate
password: <PASSWORD>
project_domain_id: default
project_name: migration-destination
user_domain_id: default
validate_certs: False
src_conversion_host: "{{ os_src_conversion_host_info.openstack_conversion_host }}"
src_auth:
auth_url: https://src-osp:13000/v3
username: migrate
password: <PASSWORD>
project_domain_id: default
project_name: migration-source
user_domain_id: default
src_validate_certs: False
data: "{{ item }}"
data_dir: "{{ os_migrate_data_dir }}"
register: prelim
- debug:
msg:
- "{{ prelim.server_name }} log file: {{ prelim.log_file }}"
- "{{ prelim.server_name }} progress file: {{ prelim.state_file }}"
when: prelim.changed
- name: expose source volumes
os_migrate.os_migrate.import_workload_export_volumes:
auth: "{{ os_migrate_src_auth }}"
auth_type: "{{ os_migrate_src_auth_type|default(omit) }}"
region_name: "{{ os_migrate_src_region_name|default(omit) }}"
validate_certs: "{{ os_migrate_src_validate_certs|default(omit) }}"
ca_cert: "{{ os_migrate_src_ca_cert|default(omit) }}"
client_cert: "{{ os_migrate_src_client_cert|default(omit) }}"
client_key: "{{ os_migrate_src_client_key|default(omit) }}"
conversion_host:
"{{ os_src_conversion_host_info.openstack_conversion_host }}"
data: "{{ item }}"
log_file: "{{ os_migrate_data_dir }}/{{ prelim.server_name }}.log"
state_file: "{{ os_migrate_data_dir }}/{{ prelim.server_name }}.state"
ssh_key_path: "{{ os_migrate_conversion_keypair_private_path }}"
register: exports
when: prelim.changed
- name: transfer volumes to destination
os_migrate.os_migrate.import_workload_transfer_volumes:
auth: "{{ os_migrate_dst_auth }}"
auth_type: "{{ os_migrate_dst_auth_type|default(omit) }}"
region_name: "{{ os_migrate_dst_region_name|default(omit) }}"
validate_certs: "{{ os_migrate_dst_validate_certs|default(omit) }}"
ca_cert: "{{ os_migrate_dst_ca_cert|default(omit) }}"
client_cert: "{{ os_migrate_dst_client_cert|default(omit) }}"
client_key: "{{ os_migrate_dst_client_key|default(omit) }}"
data: "{{ item }}"
conversion_host:
"{{ os_dst_conversion_host_info.openstack_conversion_host }}"
ssh_key_path: "{{ os_migrate_conversion_keypair_private_path }}"
transfer_uuid: "{{ exports.transfer_uuid }}"
src_conversion_host_address:
"{{ os_src_conversion_host_info.openstack_conversion_host.address }}"
volume_map: "{{ exports.volume_map }}"
state_file: "{{ os_migrate_data_dir }}/{{ prelim.server_name }}.state"
log_file: "{{ os_migrate_data_dir }}/{{ prelim.server_name }}.log"
register: transfer
when: prelim.changed
- name: create destination instance
os_migrate.os_migrate.import_workload_create_instance:
auth: "{{ os_migrate_dst_auth }}"
auth_type: "{{ os_migrate_dst_auth_type|default(omit) }}"
region_name: "{{ os_migrate_dst_region_name|default(omit) }}"
validate_certs: "{{ os_migrate_dst_validate_certs|default(omit) }}"
ca_cert: "{{ os_migrate_dst_ca_cert|default(omit) }}"
client_cert: "{{ os_migrate_dst_client_cert|default(omit) }}"
client_key: "{{ os_migrate_dst_client_key|default(omit) }}"
data: "{{ item }}"
block_device_mapping: "{{ transfer.block_device_mapping }}"
register: os_migrate_destination_instance
when: prelim.changed
rescue:
- fail:
msg: "Failed to import {{ item.params.name }}!"
'''
RETURN = '''
server_id:
description: The ID of the newly created server.
returned: On successful creation of migrated server on destination cloud.
type: str
sample: 059635b7-451f-4a64-978a-7c2e9e4c15ff
'''
from ansible.module_utils.basic import AnsibleModule
# Import openstack module utils from ansible_collections.openstack.cloud.plugins as per ansible 3+
try:
from ansible_collections.openstack.cloud.plugins.module_utils.openstack \
import openstack_full_argument_spec, openstack_cloud_from_module
except ImportError:
# If this fails fall back to ansible < 3 imports
from ansible.module_utils.openstack \
import openstack_full_argument_spec, openstack_cloud_from_module
from ansible_collections.os_migrate.os_migrate.plugins.module_utils import server
def run_module():
argument_spec = openstack_full_argument_spec(
auth=dict(type='dict', no_log=True, required=True),
data=dict(type='dict', required=True),
block_device_mapping=dict(type='list', required=True, elements='dict'),
)
result = dict(
changed=False,
)
module = AnsibleModule(
argument_spec=argument_spec,
)
sdk, conn = openstack_cloud_from_module(module)
block_device_mapping = module.params['block_device_mapping']
ser_server = server.Server.from_data(module.params['data'])
sdk_server = ser_server.create(conn, block_device_mapping)
# Some info (e.g. flavor ID) will only become available after the
# server is in ACTIVE state, we need to wait for it.
sdk_server = conn.compute.wait_for_server(sdk_server, failures=['ERROR'], wait=600)
dst_ser_server = server.Server.from_sdk(conn, sdk_server)
if sdk_server:
result['changed'] = True
result['server'] = dst_ser_server.data
result['server_id'] = sdk_server.id
module.exit_json(**result)
def main():
run_module()
if __name__ == '__main__':
main()
| [
1,
18787,
4855,
29914,
2109,
29914,
4691,
13,
13,
13,
3166,
4770,
29888,
9130,
1649,
1053,
313,
23552,
29918,
5215,
29892,
8542,
29892,
1596,
29918,
2220,
29897,
13,
1649,
2527,
562,
605,
1649,
353,
1134,
13,
13,
2190,
5425,
29933,
1307,
29918,
2303,
29911,
3035,
8254,
353,
426,
13,
1678,
525,
19635,
29918,
3259,
2396,
525,
29896,
29889,
29896,
742,
13,
1678,
525,
4882,
2396,
6024,
25347,
7464,
13,
1678,
525,
23765,
29918,
1609,
2396,
525,
23834,
29915,
13,
29913,
13,
13,
28665,
5005,
3919,
8098,
353,
14550,
13,
5634,
13,
5453,
29901,
1053,
29918,
1287,
1359,
29918,
3258,
29918,
8758,
13,
13,
12759,
29918,
8216,
29901,
6204,
405,
29121,
29586,
310,
4673,
7264,
18167,
13,
13,
1062,
1975,
29918,
12663,
29918,
20777,
29901,
1722,
1429,
13,
13,
3259,
29918,
23959,
29901,
376,
29906,
29889,
29929,
29889,
29900,
29908,
13,
13,
8921,
29901,
376,
6585,
7264,
3006,
424,
20332,
8492,
20164,
359,
29899,
26983,
403,
5513,
13,
13,
8216,
29901,
13,
29871,
448,
376,
26772,
385,
2777,
515,
385,
6570,
29899,
29924,
4481,
403,
612,
23956,
3829,
29892,
322,
5609,
967,
18167,
975,
405,
29121,
1213,
13,
13,
6768,
29901,
13,
29871,
4817,
29901,
13,
1678,
6139,
29901,
13,
418,
448,
13343,
411,
4128,
363,
10434,
4817,
1134,
373,
278,
12551,
9570,
29889,
13,
1678,
3734,
29901,
1565,
13,
1678,
1134,
29901,
9657,
13,
29871,
4817,
29918,
1853,
29901,
13,
1678,
6139,
29901,
13,
418,
448,
13189,
1134,
7079,
363,
12551,
4673,
7264,
9570,
29889,
1815,
367,
25811,
565,
773,
4800,
10760,
29889,
13,
1678,
3734,
29901,
2089,
13,
1678,
1134,
29901,
851,
13,
29871,
5120,
29918,
978,
29901,
13,
1678,
6139,
29901,
13,
418,
448,
15435,
3381,
4673,
7264,
5120,
1024,
29889,
1815,
367,
25811,
565,
773,
2322,
5120,
29889,
13,
1678,
3734,
29901,
2089,
13,
1678,
1134,
29901,
851,
13,
29871,
20847,
3097,
29918,
8028,
29901,
13,
1678,
6139,
29901,
13,
418,
448,
7740,
737,
3097,
10640,
29889,
13,
1678,
3734,
29901,
2089,
13,
1678,
1134,
29901,
851,
13,
29871,
9570,
29901,
13,
1678,
6139,
29901,
13,
418,
448,
18076,
4395,
29889,
4360,
296,
363,
28953,
24521,
29889,
13,
1678,
3734,
29901,
2089,
13,
1678,
1134,
29901,
10650,
13,
29871,
12725,
29918,
6327,
29879,
29901,
13,
1678,
6139,
29901,
13,
418,
448,
15758,
403,
7331,
29903,
23199,
1078,
746,
12183,
297,
304,
4673,
7264,
29889,
13,
1678,
3734,
29901,
2089,
13,
1678,
1134,
29901,
6120,
13,
29871,
848,
29901,
13,
1678,
6139,
29901,
13,
418,
448,
3630,
3829,
411,
1923,
4128,
408,
7500,
515,
6570,
29899,
29924,
4481,
403,
664,
18132,
612,
23956,
934,
29889,
13,
1678,
3734,
29901,
1565,
13,
1678,
1134,
29901,
9657,
13,
29871,
2908,
29918,
10141,
29918,
20698,
29901,
13,
1678,
6139,
29901,
13,
418,
448,
319,
2908,
29918,
10141,
29918,
20698,
29918,
29894,
29906,
3829,
515,
278,
6782,
29918,
1555,
9351,
3883,
29889,
13,
418,
448,
501,
8485,
304,
10641,
12551,
18167,
304,
278,
716,
2777,
297,
278,
1492,
1797,
29889,
13,
1678,
3734,
29901,
1565,
13,
1678,
1134,
29901,
1051,
13,
1678,
3161,
29901,
9657,
13,
12008,
13,
13,
5746,
19297,
17101,
353,
14550,
13,
3396,
29889,
21053,
29901,
13,
13,
29899,
1024,
29901,
12725,
7500,
7788,
13,
29871,
2897,
29918,
26983,
403,
29889,
359,
29918,
26983,
403,
29889,
15480,
29918,
10314,
29918,
5325,
29901,
13,
1678,
10898,
29901,
13,
418,
448,
376,
6224,
2897,
29918,
26983,
403,
29918,
1272,
29918,
3972,
500,
6822,
1287,
18132,
29889,
21053,
29908,
13,
29871,
6036,
29901,
664,
18132,
29918,
1445,
29918,
18157,
13,
29871,
746,
29901,
1053,
29918,
1287,
18132,
29918,
15480,
29918,
1445,
13,
13,
29899,
1024,
29901,
1303,
664,
18132,
6503,
934,
13,
29871,
2897,
29918,
26983,
403,
29889,
359,
29918,
26983,
403,
29889,
949,
29918,
13237,
29901,
13,
1678,
2224,
29901,
376,
6224,
2897,
29918,
26983,
403,
29918,
1272,
29918,
3972,
500,
6822,
1287,
18132,
29889,
21053,
29908,
13,
29871,
6036,
29901,
1303,
29918,
1287,
18132,
13,
13,
29899,
1024,
29901,
679,
2752,
11301,
3495,
3211,
13,
29871,
2897,
29918,
26983,
403,
29889,
359,
29918,
26983,
403,
29889,
359,
29918,
535,
3259,
29918,
3069,
29918,
3888,
29901,
13,
1678,
4817,
29901,
13,
4706,
4817,
29918,
2271,
29901,
2045,
597,
4351,
29899,
4705,
29901,
29896,
29941,
29900,
29900,
29900,
29914,
29894,
29941,
13,
4706,
8952,
29901,
9725,
403,
13,
4706,
4800,
29901,
529,
25711,
17013,
29958,
13,
4706,
2060,
29918,
7247,
29918,
333,
29901,
2322,
13,
4706,
2060,
29918,
978,
29901,
20332,
29899,
4993,
13,
4706,
1404,
29918,
7247,
29918,
333,
29901,
2322,
13,
1678,
1923,
29918,
333,
29901,
2257,
29946,
1289,
29874,
29929,
29953,
29899,
29945,
29881,
29947,
29872,
29899,
29946,
29890,
29953,
29955,
29899,
3660,
29872,
29906,
29899,
29929,
29947,
29946,
29945,
2252,
29883,
29929,
29946,
29941,
1725,
13,
29871,
6036,
29901,
2897,
29918,
4351,
29918,
535,
3259,
29918,
3069,
29918,
3888,
13,
13,
29899,
1024,
29901,
679,
12551,
11301,
3495,
3211,
13,
29871,
2897,
29918,
26983,
403,
29889,
359,
29918,
26983,
403,
29889,
359,
29918,
535,
3259,
29918,
3069,
29918,
3888,
29901,
13,
1678,
4817,
29901,
13,
4706,
4817,
29918,
2271,
29901,
2045,
597,
7854,
29899,
4705,
29901,
29896,
29941,
29900,
29900,
29900,
29914,
29894,
29941,
13,
4706,
8952,
29901,
9725,
403,
13,
4706,
4800,
29901,
529,
25711,
17013,
29958,
13,
4706,
2060,
29918,
7247,
29918,
333,
29901,
2322,
13,
4706,
2060,
29918,
978,
29901,
20332,
29899,
23848,
13,
4706,
1404,
29918,
7247,
29918,
333,
29901,
2322,
13,
1678,
1923,
29918,
333,
29901,
29871,
29906,
29881,
29906,
29874,
1725,
29945,
29955,
29899,
815,
29945,
29899,
29946,
29896,
29947,
29955,
29899,
29947,
29888,
1113,
29899,
29945,
29888,
29896,
29900,
29888,
29929,
29900,
29945,
29929,
2291,
29896,
13,
29871,
6036,
29901,
2897,
29918,
22992,
29918,
535,
3259,
29918,
3069,
29918,
3888,
13,
13,
29899,
1024,
29901,
1053,
664,
18132,
13,
29871,
3160,
29918,
20673,
29901,
664,
1359,
29889,
21053,
13,
29871,
2425,
29901,
376,
6224,
1303,
29918,
1287,
18132,
29889,
13237,
500,
5038,
13,
13,
13,
13,
1287,
1359,
29889,
21053,
29901,
13,
13,
29899,
2908,
29901,
13,
29871,
448,
1024,
29901,
758,
2576,
3821,
6230,
363,
664,
1359,
1053,
13,
1678,
2897,
29918,
26983,
403,
29889,
359,
29918,
26983,
403,
29889,
5215,
29918,
1287,
1359,
29918,
1457,
2576,
29901,
13,
418,
4817,
29901,
13,
3986,
4817,
29918,
2271,
29901,
2045,
597,
7854,
29899,
4705,
29901,
29896,
29941,
29900,
29900,
29900,
29914,
29894,
29941,
13,
3986,
8952,
29901,
9725,
403,
13,
3986,
4800,
29901,
529,
25711,
17013,
29958,
13,
3986,
2060,
29918,
7247,
29918,
333,
29901,
2322,
13,
3986,
2060,
29918,
978,
29901,
20332,
29899,
23848,
13,
3986,
1404,
29918,
7247,
29918,
333,
29901,
2322,
13,
418,
12725,
29918,
6327,
29879,
29901,
7700,
13,
418,
4765,
29918,
535,
3259,
29918,
3069,
29901,
376,
6224,
2897,
29918,
4351,
29918,
535,
3259,
29918,
3069,
29918,
3888,
29889,
3150,
1429,
29918,
535,
3259,
29918,
3069,
500,
5038,
13,
418,
4765,
29918,
5150,
29901,
13,
3986,
4817,
29918,
2271,
29901,
2045,
597,
4351,
29899,
4705,
29901,
29896,
29941,
29900,
29900,
29900,
29914,
29894,
29941,
13,
3986,
8952,
29901,
9725,
403,
13,
3986,
4800,
29901,
529,
25711,
17013,
29958,
13,
3986,
2060,
29918,
7247,
29918,
333,
29901,
2322,
13,
3986,
2060,
29918,
978,
29901,
20332,
29899,
4993,
13,
3986,
1404,
29918,
7247,
29918,
333,
29901,
2322,
13,
418,
4765,
29918,
15480,
29918,
6327,
29879,
29901,
7700,
13,
418,
848,
29901,
376,
6224,
2944,
500,
5038,
13,
418,
848,
29918,
3972,
29901,
376,
6224,
2897,
29918,
26983,
403,
29918,
1272,
29918,
3972,
500,
5038,
13,
1678,
6036,
29901,
758,
2576,
13,
13,
29871,
448,
4744,
29901,
13,
418,
10191,
29901,
13,
4706,
448,
376,
6224,
758,
2576,
29889,
2974,
29918,
978,
9156,
1480,
934,
29901,
8620,
758,
2576,
29889,
1188,
29918,
1445,
500,
5038,
13,
4706,
448,
376,
6224,
758,
2576,
29889,
2974,
29918,
978,
9156,
6728,
934,
29901,
8620,
758,
2576,
29889,
3859,
29918,
1445,
500,
5038,
13,
1678,
746,
29901,
758,
2576,
29889,
15033,
13,
13,
29871,
448,
1024,
29901,
24396,
2752,
18167,
13,
1678,
2897,
29918,
26983,
403,
29889,
359,
29918,
26983,
403,
29889,
5215,
29918,
1287,
1359,
29918,
15843,
29918,
1555,
9351,
29901,
13,
418,
4817,
29901,
376,
6224,
2897,
29918,
26983,
403,
29918,
4351,
29918,
5150,
500,
5038,
13,
418,
4817,
29918,
1853,
29901,
376,
6224,
2897,
29918,
26983,
403,
29918,
4351,
29918,
5150,
29918,
1853,
29989,
4381,
29898,
290,
277,
29897,
500,
5038,
13,
418,
5120,
29918,
978,
29901,
376,
6224,
2897,
29918,
26983,
403,
29918,
4351,
29918,
12803,
29918,
978,
29989,
4381,
29898,
290,
277,
29897,
500,
5038,
13,
418,
12725,
29918,
6327,
29879,
29901,
376,
6224,
2897,
29918,
26983,
403,
29918,
4351,
29918,
15480,
29918,
6327,
29879,
29989,
4381,
29898,
290,
277,
29897,
500,
5038,
13,
418,
5777,
29918,
6327,
29901,
376,
6224,
2897,
29918,
26983,
403,
29918,
4351,
29918,
1113,
29918,
6327,
29989,
4381,
29898,
290,
277,
29897,
500,
5038,
13,
418,
3132,
29918,
6327,
29901,
376,
6224,
2897,
29918,
26983,
403,
29918,
4351,
29918,
4645,
29918,
6327,
29989,
4381,
29898,
290,
277,
29897,
500,
5038,
13,
418,
3132,
29918,
1989,
29901,
376,
6224,
2897,
29918,
26983,
403,
29918,
4351,
29918,
4645,
29918,
1989,
29989,
4381,
29898,
290,
277,
29897,
500,
5038,
13,
418,
11301,
29918,
3069,
29901,
13,
4706,
376,
6224,
2897,
29918,
4351,
29918,
535,
3259,
29918,
3069,
29918,
3888,
29889,
3150,
1429,
29918,
535,
3259,
29918,
3069,
500,
5038,
13,
418,
848,
29901,
376,
6224,
2944,
500,
5038,
13,
418,
1480,
29918,
1445,
29901,
376,
6224,
2897,
29918,
26983,
403,
29918,
1272,
29918,
3972,
500,
6822,
6224,
758,
2576,
29889,
2974,
29918,
978,
500,
1836,
1188,
29908,
13,
418,
2106,
29918,
1445,
29901,
376,
6224,
2897,
29918,
26983,
403,
29918,
1272,
29918,
3972,
500,
6822,
6224,
758,
2576,
29889,
2974,
29918,
978,
500,
1836,
3859,
29908,
13,
418,
13927,
29918,
1989,
29918,
2084,
29901,
376,
6224,
2897,
29918,
26983,
403,
29918,
535,
3259,
29918,
446,
1478,
1466,
29918,
9053,
29918,
2084,
500,
5038,
13,
1678,
6036,
29901,
29586,
13,
1678,
746,
29901,
758,
2576,
29889,
15033,
13,
13,
29871,
448,
1024,
29901,
6782,
18167,
304,
12551,
13,
1678,
2897,
29918,
26983,
403,
29889,
359,
29918,
26983,
403,
29889,
5215,
29918,
1287,
1359,
29918,
3286,
571,
29918,
1555,
9351,
29901,
13,
418,
4817,
29901,
376,
6224,
2897,
29918,
26983,
403,
29918,
22992,
29918,
5150,
500,
5038,
13,
418,
4817,
29918,
1853,
29901,
376,
6224,
2897,
29918,
26983,
403,
29918,
22992,
29918,
5150,
29918,
1853,
29989,
4381,
29898,
290,
277,
29897,
500,
5038,
13,
418,
5120,
29918,
978,
29901,
376,
6224,
2897,
29918,
26983,
403,
29918,
22992,
29918,
12803,
29918,
978,
29989,
4381,
29898,
290,
277,
29897,
500,
5038,
13,
418,
12725,
29918,
6327,
29879,
29901,
376,
6224,
2897,
29918,
26983,
403,
29918,
22992,
29918,
15480,
29918,
6327,
29879,
29989,
4381,
29898,
290,
277,
29897,
500,
5038,
13,
418,
5777,
29918,
6327,
29901,
376,
6224,
2897,
29918,
26983,
403,
29918,
22992,
29918,
1113,
29918,
6327,
29989,
4381,
29898,
290,
277,
29897,
500,
5038,
13,
418,
3132,
29918,
6327,
29901,
376,
6224,
2897,
29918,
26983,
403,
29918,
22992,
29918,
4645,
29918,
6327,
29989,
4381,
29898,
290,
277,
29897,
500,
5038,
13,
418,
3132,
29918,
1989,
29901,
376,
6224,
2897,
29918,
26983,
403,
29918,
22992,
29918,
4645,
29918,
1989,
29989,
4381,
29898,
290,
277,
29897,
500,
5038,
13,
418,
848,
29901,
376,
6224,
2944,
500,
5038,
13,
418,
11301,
29918,
3069,
29901,
13,
4706,
376,
6224,
2897,
29918,
22992,
29918,
535,
3259,
29918,
3069,
29918,
3888,
29889,
3150,
1429,
29918,
535,
3259,
29918,
3069,
500,
5038,
13,
418,
13927,
29918,
1989,
29918,
2084,
29901,
376,
6224,
2897,
29918,
26983,
403,
29918,
535,
3259,
29918,
446,
1478,
1466,
29918,
9053,
29918,
2084,
500,
5038,
13,
418,
6782,
29918,
25118,
29901,
376,
6224,
29586,
29889,
3286,
571,
29918,
25118,
500,
5038,
13,
418,
4765,
29918,
535,
3259,
29918,
3069,
29918,
7328,
29901,
13,
4706,
376,
6224,
2897,
29918,
4351,
29918,
535,
3259,
29918,
3069,
29918,
3888,
29889,
3150,
1429,
29918,
535,
3259,
29918,
3069,
29889,
7328,
500,
5038,
13,
418,
7977,
29918,
1958,
29901,
376,
6224,
29586,
29889,
24623,
29918,
1958,
500,
5038,
13,
418,
2106,
29918,
1445,
29901,
376,
6224,
2897,
29918,
26983,
403,
29918,
1272,
29918,
3972,
500,
6822,
6224,
758,
2576,
29889,
2974,
29918,
978,
500,
1836,
3859,
29908,
13,
418,
1480,
29918,
1445,
29901,
376,
6224,
2897,
29918,
26983,
403,
29918,
1272,
29918,
3972,
500,
6822,
6224,
758,
2576,
29889,
2974,
29918,
978,
500,
1836,
1188,
29908,
13,
1678,
6036,
29901,
6782,
13,
1678,
746,
29901,
758,
2576,
29889,
15033,
13,
13,
29871,
448,
1024,
29901,
1653,
12551,
2777,
13,
1678,
2897,
29918,
26983,
403,
29889,
359,
29918,
26983,
403,
29889,
5215,
29918,
1287,
1359,
29918,
3258,
29918,
8758,
29901,
13,
418,
4817,
29901,
376,
6224,
2897,
29918,
26983,
403,
29918,
22992,
29918,
5150,
500,
5038,
13,
418,
4817,
29918,
1853,
29901,
376,
6224,
2897,
29918,
26983,
403,
29918,
22992,
29918,
5150,
29918,
1853,
29989,
4381,
29898,
290,
277,
29897,
500,
5038,
13,
418,
5120,
29918,
978,
29901,
376,
6224,
2897,
29918,
26983,
403,
29918,
22992,
29918,
12803,
29918,
978,
29989,
4381,
29898,
290,
277,
29897,
500,
5038,
13,
418,
12725,
29918,
6327,
29879,
29901,
376,
6224,
2897,
29918,
26983,
403,
29918,
22992,
29918,
15480,
29918,
6327,
29879,
29989,
4381,
29898,
290,
277,
29897,
500,
5038,
13,
418,
5777,
29918,
6327,
29901,
376,
6224,
2897,
29918,
26983,
403,
29918,
22992,
29918,
1113,
29918,
6327,
29989,
4381,
29898,
290,
277,
29897,
500,
5038,
13,
418,
3132,
29918,
6327,
29901,
376,
6224,
2897,
29918,
26983,
403,
29918,
22992,
29918,
4645,
29918,
6327,
29989,
4381,
29898,
290,
277,
29897,
500,
5038,
13,
418,
3132,
29918,
1989,
29901,
376,
6224,
2897,
29918,
26983,
403,
29918,
22992,
29918,
4645,
29918,
1989,
29989,
4381,
29898,
290,
277,
29897,
500,
5038,
13,
418,
848,
29901,
376,
6224,
2944,
500,
5038,
13,
418,
2908,
29918,
10141,
29918,
20698,
29901,
376,
6224,
6782,
29889,
1271,
29918,
10141,
29918,
20698,
500,
5038,
13,
1678,
6036,
29901,
2897,
29918,
26983,
403,
29918,
23848,
29918,
8758,
13,
1678,
746,
29901,
758,
2576,
29889,
15033,
13,
13,
29871,
26429,
29901,
13,
1678,
448,
4418,
29901,
13,
4706,
10191,
29901,
376,
17776,
304,
1053,
8620,
2944,
29889,
7529,
29889,
978,
9156,
3850,
13,
12008,
13,
13,
1525,
29911,
24015,
353,
14550,
13,
2974,
29918,
333,
29901,
13,
29871,
6139,
29901,
450,
3553,
310,
278,
15141,
2825,
1923,
29889,
13,
29871,
4133,
29901,
1551,
9150,
11265,
310,
9725,
630,
1923,
373,
12551,
9570,
29889,
13,
29871,
1134,
29901,
851,
13,
29871,
4559,
29901,
29871,
29900,
29945,
29929,
29953,
29941,
29945,
29890,
29955,
29899,
29946,
29945,
29896,
29888,
29899,
29946,
29874,
29953,
29946,
29899,
29929,
29955,
29947,
29874,
29899,
29955,
29883,
29906,
29872,
29929,
29872,
29946,
29883,
29896,
29945,
600,
13,
12008,
13,
13,
3166,
385,
1687,
29889,
5453,
29918,
13239,
29889,
16121,
1053,
530,
1687,
7355,
13,
29937,
16032,
1722,
1429,
3883,
3667,
29879,
515,
385,
1687,
29918,
29027,
29889,
3150,
1429,
29889,
9274,
29889,
12800,
408,
639,
385,
1687,
29871,
29941,
29974,
13,
2202,
29901,
13,
1678,
515,
385,
1687,
29918,
29027,
29889,
3150,
1429,
29889,
9274,
29889,
12800,
29889,
5453,
29918,
13239,
29889,
3150,
1429,
320,
13,
4706,
1053,
1722,
1429,
29918,
8159,
29918,
23516,
29918,
6550,
29892,
1722,
1429,
29918,
9274,
29918,
3166,
29918,
5453,
13,
19499,
16032,
2392,
29901,
13,
1678,
396,
960,
445,
8465,
6416,
1250,
304,
385,
1687,
529,
29871,
29941,
24802,
13,
1678,
515,
385,
1687,
29889,
5453,
29918,
13239,
29889,
3150,
1429,
320,
13,
4706,
1053,
1722,
1429,
29918,
8159,
29918,
23516,
29918,
6550,
29892,
1722,
1429,
29918,
9274,
29918,
3166,
29918,
5453,
13,
13,
3166,
385,
1687,
29918,
29027,
29889,
359,
29918,
26983,
403,
29889,
359,
29918,
26983,
403,
29889,
12800,
29889,
5453,
29918,
13239,
1053,
1923,
13,
13,
13,
1753,
1065,
29918,
5453,
7295,
13,
1678,
2980,
29918,
6550,
353,
1722,
1429,
29918,
8159,
29918,
23516,
29918,
6550,
29898,
13,
4706,
4817,
29922,
8977,
29898,
1853,
2433,
8977,
742,
694,
29918,
1188,
29922,
5574,
29892,
3734,
29922,
5574,
511,
13,
4706,
848,
29922,
8977,
29898,
1853,
2433,
8977,
742,
3734,
29922,
5574,
511,
13,
4706,
2908,
29918,
10141,
29918,
20698,
29922,
8977,
29898,
1853,
2433,
1761,
742,
3734,
29922,
5574,
29892,
3161,
2433,
8977,
5477,
13,
1678,
1723,
13,
13,
1678,
1121,
353,
9657,
29898,
13,
4706,
3939,
29922,
8824,
29892,
13,
1678,
1723,
13,
13,
1678,
3883,
353,
530,
1687,
7355,
29898,
13,
4706,
2980,
29918,
6550,
29922,
23516,
29918,
6550,
29892,
13,
1678,
1723,
13,
13,
1678,
269,
8181,
29892,
11009,
353,
1722,
1429,
29918,
9274,
29918,
3166,
29918,
5453,
29898,
5453,
29897,
13,
1678,
2908,
29918,
10141,
29918,
20698,
353,
3883,
29889,
7529,
1839,
1271,
29918,
10141,
29918,
20698,
2033,
13,
13,
1678,
724,
29918,
2974,
353,
1923,
29889,
6004,
29889,
3166,
29918,
1272,
29898,
5453,
29889,
7529,
1839,
1272,
11287,
13,
1678,
269,
8181,
29918,
2974,
353,
724,
29918,
2974,
29889,
3258,
29898,
13082,
29892,
2908,
29918,
10141,
29918,
20698,
29897,
13,
1678,
396,
3834,
5235,
313,
29872,
29889,
29887,
29889,
21054,
272,
3553,
29897,
674,
871,
4953,
3625,
1156,
278,
13,
1678,
396,
1923,
338,
297,
319,
1783,
18474,
2106,
29892,
591,
817,
304,
4480,
363,
372,
29889,
13,
1678,
269,
8181,
29918,
2974,
353,
11009,
29889,
26017,
29889,
10685,
29918,
1454,
29918,
2974,
29898,
15348,
29918,
2974,
29892,
4418,
1973,
29922,
1839,
11432,
7464,
4480,
29922,
29953,
29900,
29900,
29897,
13,
1678,
29743,
29918,
643,
29918,
2974,
353,
1923,
29889,
6004,
29889,
3166,
29918,
15348,
29898,
13082,
29892,
269,
8181,
29918,
2974,
29897,
13,
13,
1678,
565,
269,
8181,
29918,
2974,
29901,
13,
4706,
1121,
1839,
15033,
2033,
353,
5852,
13,
4706,
1121,
1839,
2974,
2033,
353,
29743,
29918,
643,
29918,
2974,
29889,
1272,
13,
4706,
1121,
1839,
2974,
29918,
333,
2033,
353,
269,
8181,
29918,
2974,
29889,
333,
13,
13,
1678,
3883,
29889,
13322,
29918,
3126,
29898,
1068,
2914,
29897,
13,
13,
13,
1753,
1667,
7295,
13,
1678,
1065,
29918,
5453,
580,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
1667,
580,
13,
2
] |
pathlib__examples/syntax_path.py | DazEB2/SimplePyScripts | 117 | 187826 | <filename>pathlib__examples/syntax_path.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
# C:\Windows\System32\Boot
import pathlib
path = pathlib.Path('C:/') / 'Windows' / 'System32' / 'Boot'
print(path) # C:\Windows\System32\Boot
| [
1,
529,
9507,
29958,
2084,
1982,
1649,
19057,
29914,
29562,
29918,
2084,
29889,
2272,
13,
29937,
14708,
4855,
29914,
2109,
29914,
6272,
3017,
29941,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
13,
1649,
8921,
1649,
353,
525,
666,
18184,
1161,
29915,
13,
13,
13,
29937,
315,
3583,
7685,
29905,
3924,
29941,
29906,
29905,
20967,
13,
13,
5215,
2224,
1982,
13,
2084,
353,
2224,
1982,
29889,
2605,
877,
29907,
8419,
1495,
847,
525,
7685,
29915,
847,
525,
3924,
29941,
29906,
29915,
847,
525,
20967,
29915,
13,
2158,
29898,
2084,
29897,
29871,
396,
315,
3583,
7685,
29905,
3924,
29941,
29906,
29905,
20967,
13,
2
] |
dialogs/mmread.py | swprojects/Serial-Sequence-Creator | 1 | 192505 | <gh_stars>1-10
"""
Description:
Requirements: pySerial, wxPython Phoenix
glossary and of other descriptions:
DMM - digital multimeter
PSU - power supply
SBC - single board computer
INS - general instrument commands
GEN - general sequence instructions
"""
import json
import logging
import serial
import serialfunctions as sf
import sys
import time
import wx
import theme
from wx.lib.pubsub import setuparg1
from wx.lib.pubsub import pub
import base
# from wx.lib.agw import spinctrl
OHM = "Ω"
MULTIMETER_SCPI = [(),
(),
(),
(),]
INSTRUCTIONS = [("DMM", "Voltage", "Read Voltage"),
("INS", "General", "Reset Instrument"),
("INS", "General", "Power Off Instrument"),
("PSU", "Current", "Set Current Limit"),
("PSU", "Voltage", "Set Voltage"),
("PSU", "Voltage", "Step Voltage"),
("SBC", "CAN", "Send Message")]
#------------------------------------------------#
# add action to sequence pop-up frames
#------------------------------------------------#
class AddStepVoltage(wx.Dialog):
def __init__(self, parent):
wx.Dialog.__init__(self,
parent,
title="Step Voltage")
panel = wx.Panel(self)
sizer = wx.BoxSizer(wx.VERTICAL)
hsizer = wx.BoxSizer(wx.HORIZONTAL)
sbox = wx.StaticBox(panel, label="Test Setup: Step Voltage")
sbox_sizer = wx.StaticBoxSizer(sbox, wx.HORIZONTAL)
grid = wx.GridBagSizer(5,5)
row = 0
row += 1 #let's start at 1, to give some space
lbl_psu = wx.StaticText(panel, label="Power Supply:")
choices = []
self.cbox_psu = wx.ComboBox(panel, choices=choices)
grid.Add(lbl_psu, pos=(row,0), flag=wx.ALL|wx.EXPAND, border=5)
grid.Add(self.cbox_psu, pos=(row,1), span=(0,3), flag=wx.ALL|wx.EXPAND, border=5)
grid.AddGrowableCol(1)
row += 1
lbl_initial = wx.StaticText(panel, label="Initial Voltage:")
self.spin_initial = wx.SpinCtrl(panel, max=30, min=0, size=(50, -1))
self.spin_initial2 = wx.SpinCtrl(panel, max=99, min=0, size=(50, -1))
self.spin_initial.Bind(wx.EVT_SPINCTRL, self.OnSpinInitial)
self.spin_initial2.Bind(wx.EVT_SPINCTRL, self.OnSpinInitial)
self.lbl_voltage = wx.StaticText(panel, label="0.0v")
grid.Add(lbl_initial, pos=(row,0), flag=wx.ALL|wx.EXPAND, border=5)
grid.Add(self.spin_initial, pos=(row,1), flag=wx.ALL, border=5)
grid.Add(self.spin_initial2, pos=(row,2), flag=wx.ALL, border=5)
grid.Add(self.lbl_voltage, pos=(row,3), flag=wx.ALL, border=5)
row += 1
lbl_final = wx.StaticText(panel, label="Final Voltage (Limit):")
self.spin_final = wx.SpinCtrl(panel, max=30, min=0, size=(50, -1))
self.spin_final2 = wx.SpinCtrl(panel, max=99, min=0, size=(50, -1))
self.spin_final.Bind(wx.EVT_SPINCTRL, self.OnSpinFinal)
self.spin_final2.Bind(wx.EVT_SPINCTRL, self.OnSpinFinal)
self.lbl_voltage2 = wx.StaticText(panel, label="0.0v")
grid.Add(lbl_final, pos=(row,0), flag=wx.ALL|wx.EXPAND, border=5)
grid.Add(self.spin_final, pos=(row,1), flag=wx.ALL, border=5)
grid.Add(self.spin_final2, pos=(row,2), flag=wx.ALL, border=5)
grid.Add(self.lbl_voltage2, pos=(row,3), flag=wx.ALL, border=5)
row += 1
lbl_step = wx.StaticText(panel, label="Voltage Increment/Decrement:")
self.spin_step = wx.SpinCtrl(panel, max=30, min=0, size=(50, -1))
self.spin_step2 = wx.SpinCtrl(panel, max=30, min=0, size=(50, -1))
self.spin_step.Bind(wx.EVT_SPINCTRL, self.OnSpinStep)
self.spin_step2.Bind(wx.EVT_SPINCTRL, self.OnSpinStep)
self.lbl_step2 = wx.StaticText(panel, label="0.0v")
grid.Add(lbl_step, pos=(row,0), flag=wx.ALL|wx.EXPAND, border=5)
grid.Add(self.spin_step, pos=(row,1), flag=wx.ALL, border=5)
grid.Add(self.spin_step2, pos=(row,2), flag=wx.ALL, border=5)
grid.Add(self.lbl_step2, pos=(row,3), flag=wx.ALL, border=5)
row += 1
lbl_step_delay = wx.StaticText(panel, label="Increment/decrement delay (ms):")
self.spin_step_delay = wx.SpinCtrl(panel, max=0, min=0, size=(50, -1))
grid.Add(lbl_step_delay, pos=(row,0), flag=wx.ALL|wx.EXPAND, border=5)
grid.Add(self.spin_step_delay, pos=(row,1), span=(0,2), flag=wx.ALL, border=5)
row += 1
lbl_repeat = wx.StaticText(panel, label="Repeat:")
spin_repeat = wx.SpinCtrl(panel, max=999, min=0, size=(50, -1))
grid.Add(lbl_repeat, pos=(row,0), flag=wx.ALL|wx.EXPAND, border=5)
grid.Add(spin_repeat, pos=(row,1), flag=wx.ALL|wx.EXPAND, border=5)
row += 1
# hsizer = wx.BoxSizer(wx.HORIZONTAL)
lbl_read = wx.StaticText(panel, label="Read Voltage:")
choices = ["Choose on execution"]
self.cbox_read = wx.ComboBox(panel, choices=choices, value=choices[0])
grid.Add(lbl_read, pos=(row,0), flag=wx.ALL|wx.EXPAND, border=5)
grid.Add(self.cbox_read, pos=(row,1), span=(0,3), flag=wx.ALL|wx.EXPAND, border=5)
sbox_sizer.Add(grid, 1, wx.ALL|wx.EXPAND, 0)
sbox_sizer.AddSpacer(20)
#rhs staticboxsizer
sbox2 = wx.StaticBox(panel, label="Pass/Fail Condition")
sbox_sizer2 = wx.StaticBoxSizer(sbox2, wx.HORIZONTAL)
vsizer = wx.BoxSizer(wx.VERTICAL)
vsizer.AddSpacer(20)
grid2 = wx.GridBagSizer(2,2)
row = 0
vars = ["V - Voltage reading (V)",
"I - Current reading (A)",
"R - Resistance reading (%s)" %OHM]
conditions = ["in range",
"not in range",
"in % range",
"not in % range",
"> (greater than)",
">= (greater than/equal to)",
"< (less than)",
"<= (less than/equal to)"]
self.cbox_var = wx.ComboBox(panel, choices=vars, name="reading", style=wx.CB_READONLY)
self.cbox_var.Bind(wx.EVT_COMBOBOX, self.OnComboBox)
self.cbox_var.SetSelection(0)
self.cbox_conditions = wx.ComboBox(panel, choices=conditions, name="condition", style=wx.CB_READONLY)
self.cbox_conditions.Bind(wx.EVT_COMBOBOX, self.OnComboBox)
self.cbox_conditions.SetSelection(0)
grid2.Add(self.cbox_var, pos=(row,1), span=(0, 0), flag=wx.ALL|wx.EXPAND, border=5)
grid2.Add(self.cbox_conditions, pos=(row,2), span=(0, 0), flag=wx.ALL|wx.EXPAND, border=5)
row += 1
lbl_testvar_a = wx.StaticText(panel, label="Value 1:")
self.spin_var_a = wx.SpinCtrl(panel, max=30, min=0, size=(50, -1))
self.spin_var_a.Bind(wx.EVT_SPINCTRL, self.OnSpinVarA)
self.spin_var_a2 = wx.SpinCtrl(panel, max=30, min=0, size=(50, -1))
self.spin_var_a2.Bind(wx.EVT_SPINCTRL, self.OnSpinVarA)
self.lbl_var_a = wx.StaticText(panel, label="0.0V")
grid2.Add(lbl_testvar_a, pos=(row,0), flag=wx.ALL|wx.EXPAND, border=5)
grid2.Add(self.spin_var_a, pos=(row,1), flag=wx.ALL|wx.EXPAND, border=5)
grid2.Add(self.spin_var_a2, pos=(row,2), flag=wx.ALL|wx.EXPAND, border=5)
grid2.Add(self.lbl_var_a, pos=(row,3), flag=wx.ALL|wx.EXPAND, border=5)
row += 1
lbl_testvar_b = wx.StaticText(panel, label="Value 2:")
self.spin_var_b = wx.SpinCtrl(panel, max=30, min=0, size=(50, -1))
self.spin_var_b.Bind(wx.EVT_SPINCTRL, self.OnSpinVarB)
self.spin_var_b2 = wx.SpinCtrl(panel, max=30, min=0, size=(50, -1))
self.spin_var_b2.Bind(wx.EVT_SPINCTRL, self.OnSpinVarB)
self.lbl_var_b = wx.StaticText(panel, label="0.0V")
grid2.Add(lbl_testvar_b, pos=(row,0), flag=wx.ALL|wx.EXPAND, border=5)
grid2.Add(self.spin_var_b, pos=(row,1), flag=wx.ALL|wx.EXPAND, border=5)
grid2.Add(self.spin_var_b2, pos=(row,2), flag=wx.ALL|wx.EXPAND, border=5)
grid2.Add(self.lbl_var_b, pos=(row,3), flag=wx.ALL|wx.EXPAND, border=5)
grid2.AddGrowableCol(0)
vsizer.Add(grid2, 0, wx.ALL|wx.EXPAND, 5)
vsizer.Add(wx.StaticLine(panel), 0, wx.ALL|wx.EXPAND, 5)
hsizer_radios = wx.BoxSizer(wx.HORIZONTAL)
lbl_fail = wx.StaticText(panel, label="On Test Failure:")
hsizer_radios.Add(lbl_fail, 0, wx.ALL|wx.EXPAND, 5)
for label in ["Continue", "Stop", "Ask on failure"]:
radio = wx.RadioButton(panel, label=label)
radio.Bind(wx.EVT_RADIOBUTTON, self.OnRadioButton)
hsizer_radios.Add(radio, 0, wx.ALL|wx.EXPAND, 5)
vsizer.Add(hsizer_radios, 0, wx.ALL|wx.EXPAND, 5)
sbox_sizer2.Add(vsizer, 1, wx.ALL|wx.EXPAND, 5)
# add static boxes to hsizer
hsizer.Add(sbox_sizer, 0, wx.ALL|wx.EXPAND, 5)
hsizer.Add(sbox_sizer2, 0, wx.ALL|wx.EXPAND, 5)
#-----
hsizer2 = wx.BoxSizer(wx.HORIZONTAL)
hsizer2.AddStretchSpacer()
btn_cancel = wx.Button(panel, label="Cancel")
btn_cancel.Bind(wx.EVT_BUTTON, self.OnButton)
btn_confirm = wx.Button(panel, label="Confirm")
btn_confirm.Bind(wx.EVT_BUTTON, self.OnButton)
hsizer2.Add(btn_cancel, 0, wx.ALL|wx.EXPAND, 5)
hsizer2.Add(btn_confirm, 0, wx.ALL|wx.EXPAND, 5)
#add to main sizer
sizer.Add(hsizer, 0, wx.ALL|wx.EXPAND, 2)
sizer.Add(hsizer2, 0, wx.ALL|wx.EXPAND, 5)
panel.SetSizer(sizer)
w, h = sizer.Fit(self)
# self.SetSize((w, h*1.5))
# self.SetMinSize((w, h*1.5))
# self.SetMaxSize(sizer.Fit(self))
try:
self.SetIcon(theme.GetIcon("psu_png"))
except:
pass
# self.Bind(wx.EVT_KEY)
def OnSpinInitial(self, event=None):
v0 = self.spin_initial.GetValue()
v1 = self.spin_initial2.GetValue()
label = str(v0) + "." + str(v1) + "v"
self.lbl_voltage.SetLabel(label)
def OnSpinFinal(self, event=None):
v0 = self.spin_final.GetValue()
v1 = self.spin_final2.GetValue()
label = str(v0) + "." + str(v1) + "v"
self.lbl_voltage2.SetLabel(label)
def OnSpinVarA(self, event):
v0 = self.spin_var_a.GetValue()
v1 = self.spin_var_a2.GetValue()
unit = self.lbl_var_a.GetLabel()[-1]
label = str(v0) + "." + str(v1) + unit
self.lbl_var_a.SetLabel(label)
def OnSpinVarB(self, event):
v0 = self.spin_var_b.GetValue()
v1 = self.spin_var_b2.GetValue()
unit = self.lbl_var_b.GetLabel()[-1]
label = str(v0) + "." + str(v1) + unit
self.lbl_var_b.SetLabel(label)
def OnSpinStep(self, event=None):
v0 = self.spin_step.GetValue()
v1 = self.spin_step2.GetValue()
label = str(v0) + "." + str(v1) + "v"
self.lbl_step2.SetLabel(label)
def OnComboBox(self, event):
e = event.GetEventObject()
name = e.GetName()
value = e.GetStringSelection()
if name == "reading":
if "Voltage" in value:
unit = "V"
elif "Current" in value:
unit = "A"
elif "Resistance" in value:
unit = OHM
#change unit accordingly
label = self.lbl_var_a.GetLabel()
if label[-1] == "%":
return
label = label[:-1] + unit
self.lbl_var_a.SetLabel(label)
label = self.lbl_var_b.GetLabel()
label = label[:-1] + unit
self.lbl_var_b.SetLabel(label)
elif name == "condition":
if "%" in value:
self.spin_var_b.Disable()
self.spin_var_b2.Disable()
label = self.lbl_var_a.GetLabel()
if not label.endswith("%"):
label = label[:-1] + "%"
self.lbl_var_a.SetLabel(label)
label = self.lbl_var_b.GetLabel()
if not label.endswith("%"):
label = label[:-1] + "%"
self.lbl_var_b.SetLabel(label)
return
elif value in ["in range","not in range"]:
self.spin_var_b.Enable()
self.spin_var_b2.Enable()
else:
self.spin_var_b.Disable()
self.spin_var_b2.Disable()
label = self.lbl_var_a.GetLabel()
if label.endswith("%"):
value = self.cbox_var.GetStringSelection()
if "Voltage" in value:
unit = "V"
elif "Current" in value:
unit = "A"
elif "Resistance" in value:
unit = OHM
label = label[:-1] + unit
self.lbl_var_a.SetLabel(label)
label = self.lbl_var_b.GetLabel()
label = label[:-1] + unit
self.lbl_var_b.SetLabel(label)
def OnRadioButton(self, event):
e = event.GetEventObject()
label = e.GetLabel()
self.on_failure = label
def OnButton(self, event):
e = event.GetEventObject()
label = e.GetLabel()
id = e.GetId()
if label == "Add":
test = self.cbox_conditions.GetValue()
test += self.lbl_var_a.GetLabel()
test += self.lbl_var_b.GetLabel()
failure = self.on_failure
self.list_passfail.Append([test,failure])
if label == "Cancel":
self.EndModal(id)
elif label == "Confirm":
data = {"action": "Step Voltage",
"psu":self.cbox_psu.GetValue(),
"v0":self.lbl_voltage.GetLabel()[1:-1],
"v1":self.lbl_voltage2.GetLabel()[1:-1],
"step":self.lbl_step2.GetLabel()[3:-1],
"delay":self.spin_step_delay.GetValue(),
"repeat":self.cbox_read.GetValue(),
"read":self.cbox_read.GetValue()}
self.EndModal(id)
class AddSetVoltage(wx.Frame):
def __init__(self):
wx.Frame.__init__(self,
parent=None,
title="Set Voltage")
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
15945,
29908,
13,
9868,
29901,
29871,
13,
1123,
1548,
1860,
29901,
11451,
9125,
29892,
26437,
11980,
29715,
13,
13,
3820,
2209,
653,
322,
310,
916,
2342,
1980,
29901,
13,
13,
29928,
7428,
448,
13436,
1773,
14772,
13,
7024,
29965,
448,
3081,
11421,
13,
1744,
29907,
448,
2323,
7613,
6601,
13,
13,
1177,
29903,
448,
2498,
11395,
8260,
13,
13,
24647,
448,
2498,
5665,
11994,
13,
13,
15945,
29908,
13,
13,
13,
5215,
4390,
13,
5215,
12183,
13,
5215,
7797,
13,
5215,
7797,
12171,
408,
18668,
13,
5215,
10876,
13,
5215,
931,
13,
5215,
26437,
13,
5215,
10929,
13,
3166,
26437,
29889,
1982,
29889,
5467,
1491,
1053,
6230,
1191,
29896,
13,
3166,
26437,
29889,
1982,
29889,
5467,
1491,
1053,
2529,
13,
5215,
2967,
13,
29937,
515,
26437,
29889,
1982,
29889,
351,
29893,
1053,
805,
5562,
2096,
13,
13,
23170,
29924,
353,
376,
30357,
29908,
13,
29924,
8647,
8890,
4945,
29918,
7187,
2227,
353,
518,
3285,
13,
462,
259,
313,
511,
13,
462,
259,
313,
511,
13,
462,
259,
313,
511,
29962,
13,
462,
1678,
13,
1177,
10810,
29965,
9838,
29903,
353,
518,
703,
29928,
7428,
613,
376,
13072,
29873,
482,
613,
376,
6359,
3684,
29873,
482,
4968,
13,
18884,
4852,
1177,
29903,
613,
376,
15263,
613,
376,
27175,
2799,
15461,
4968,
13,
18884,
4852,
1177,
29903,
613,
376,
15263,
613,
376,
21472,
5947,
2799,
15461,
4968,
13,
18884,
4852,
7024,
29965,
613,
376,
7583,
613,
376,
2697,
9626,
9628,
277,
4968,
13,
18884,
4852,
7024,
29965,
613,
376,
13072,
29873,
482,
613,
376,
2697,
3684,
29873,
482,
4968,
462,
13,
18884,
4852,
7024,
29965,
613,
376,
13072,
29873,
482,
613,
376,
14448,
3684,
29873,
482,
4968,
13,
18884,
4852,
1744,
29907,
613,
376,
29907,
2190,
613,
376,
12600,
7777,
13531,
13,
13,
13,
29937,
2683,
2683,
2683,
29937,
13,
29937,
788,
3158,
304,
5665,
1835,
29899,
786,
16608,
13,
29937,
2683,
2683,
2683,
29937,
13,
13,
1990,
3462,
14448,
13072,
29873,
482,
29898,
23310,
29889,
7647,
1125,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
3847,
1125,
13,
268,
13,
4706,
26437,
29889,
7647,
17255,
2344,
12035,
1311,
29892,
13,
462,
965,
3847,
29892,
13,
462,
965,
3611,
543,
14448,
3684,
29873,
482,
1159,
13,
308,
13,
4706,
9451,
353,
26437,
29889,
7490,
29898,
1311,
29897,
29871,
13,
4706,
269,
3950,
353,
26437,
29889,
3313,
29903,
3950,
29898,
23310,
29889,
5348,
29911,
2965,
1964,
29897,
13,
308,
13,
4706,
298,
29879,
3950,
353,
26437,
29889,
3313,
29903,
3950,
29898,
23310,
29889,
29950,
1955,
26664,
1164,
29911,
1964,
29897,
13,
4706,
269,
1884,
353,
26437,
29889,
17046,
3313,
29898,
15119,
29892,
3858,
543,
3057,
3789,
786,
29901,
16696,
3684,
29873,
482,
1159,
308,
13,
4706,
269,
1884,
29918,
29879,
3950,
353,
26437,
29889,
17046,
3313,
29903,
3950,
29898,
29879,
1884,
29892,
26437,
29889,
29950,
1955,
26664,
1164,
29911,
1964,
29897,
13,
4706,
6856,
353,
26437,
29889,
5756,
23544,
29903,
3950,
29898,
29945,
29892,
29945,
29897,
13,
308,
13,
4706,
1948,
353,
29871,
29900,
13,
4706,
1948,
4619,
29871,
29896,
396,
1026,
29915,
29879,
1369,
472,
29871,
29896,
29892,
304,
2367,
777,
2913,
13,
308,
13,
4706,
301,
2204,
29918,
567,
29884,
353,
26437,
29889,
17046,
1626,
29898,
15119,
29892,
3858,
543,
21472,
9179,
368,
29901,
1159,
13,
4706,
19995,
353,
5159,
13,
4706,
1583,
29889,
29883,
1884,
29918,
567,
29884,
353,
26437,
29889,
26628,
29898,
15119,
29892,
19995,
29922,
1859,
1575,
29897,
13,
4706,
6856,
29889,
2528,
29898,
26648,
29918,
567,
29884,
29892,
926,
7607,
798,
29892,
29900,
511,
7353,
29922,
23310,
29889,
9818,
29989,
23310,
29889,
5746,
29925,
9468,
29892,
5139,
29922,
29945,
29897,
13,
4706,
6856,
29889,
2528,
29898,
1311,
29889,
29883,
1884,
29918,
567,
29884,
29892,
926,
7607,
798,
29892,
29896,
511,
10638,
7607,
29900,
29892,
29941,
511,
7353,
29922,
23310,
29889,
9818,
29989,
23310,
29889,
5746,
29925,
9468,
29892,
5139,
29922,
29945,
29897,
13,
4706,
6856,
29889,
2528,
29954,
798,
519,
1625,
29898,
29896,
29897,
13,
4706,
1948,
4619,
29871,
29896,
13,
4706,
301,
2204,
29918,
11228,
353,
26437,
29889,
17046,
1626,
29898,
15119,
29892,
3858,
543,
15514,
3684,
29873,
482,
29901,
1159,
13,
4706,
1583,
29889,
1028,
262,
29918,
11228,
353,
26437,
29889,
5592,
262,
18069,
29898,
15119,
29892,
4236,
29922,
29941,
29900,
29892,
1375,
29922,
29900,
29892,
2159,
7607,
29945,
29900,
29892,
448,
29896,
876,
13,
4706,
1583,
29889,
1028,
262,
29918,
11228,
29906,
353,
26437,
29889,
5592,
262,
18069,
29898,
15119,
29892,
4236,
29922,
29929,
29929,
29892,
1375,
29922,
29900,
29892,
2159,
7607,
29945,
29900,
29892,
448,
29896,
876,
13,
4706,
1583,
29889,
1028,
262,
29918,
11228,
29889,
15708,
29898,
23310,
29889,
22240,
29911,
29918,
5550,
28852,
2241,
29892,
1583,
29889,
2951,
5592,
262,
15514,
29897,
13,
4706,
1583,
29889,
1028,
262,
29918,
11228,
29906,
29889,
15708,
29898,
23310,
29889,
22240,
29911,
29918,
5550,
28852,
2241,
29892,
1583,
29889,
2951,
5592,
262,
15514,
29897,
13,
4706,
1583,
29889,
26648,
29918,
1555,
29873,
482,
353,
26437,
29889,
17046,
1626,
29898,
15119,
29892,
3858,
543,
29900,
29889,
29900,
29894,
1159,
13,
4706,
6856,
29889,
2528,
29898,
26648,
29918,
11228,
29892,
926,
7607,
798,
29892,
29900,
511,
7353,
29922,
23310,
29889,
9818,
29989,
23310,
29889,
5746,
29925,
9468,
29892,
5139,
29922,
29945,
29897,
13,
4706,
6856,
29889,
2528,
29898,
1311,
29889,
1028,
262,
29918,
11228,
29892,
926,
7607,
798,
29892,
29896,
511,
7353,
29922,
23310,
29889,
9818,
29892,
5139,
29922,
29945,
29897,
13,
4706,
6856,
29889,
2528,
29898,
1311,
29889,
1028,
262,
29918,
11228,
29906,
29892,
926,
7607,
798,
29892,
29906,
511,
7353,
29922,
23310,
29889,
9818,
29892,
5139,
29922,
29945,
29897,
13,
4706,
6856,
29889,
2528,
29898,
1311,
29889,
26648,
29918,
1555,
29873,
482,
29892,
926,
7607,
798,
29892,
29941,
511,
7353,
29922,
23310,
29889,
9818,
29892,
5139,
29922,
29945,
29897,
13,
308,
13,
4706,
1948,
4619,
29871,
29896,
13,
4706,
301,
2204,
29918,
8394,
353,
26437,
29889,
17046,
1626,
29898,
15119,
29892,
3858,
543,
15790,
3684,
29873,
482,
313,
24445,
1125,
1159,
13,
4706,
1583,
29889,
1028,
262,
29918,
8394,
353,
26437,
29889,
5592,
262,
18069,
29898,
15119,
29892,
4236,
29922,
29941,
29900,
29892,
1375,
29922,
29900,
29892,
2159,
7607,
29945,
29900,
29892,
448,
29896,
876,
13,
4706,
1583,
29889,
1028,
262,
29918,
8394,
29906,
353,
26437,
29889,
5592,
262,
18069,
29898,
15119,
29892,
4236,
29922,
29929,
29929,
29892,
1375,
29922,
29900,
29892,
2159,
7607,
29945,
29900,
29892,
448,
29896,
876,
13,
4706,
1583,
29889,
1028,
262,
29918,
8394,
29889,
15708,
29898,
23310,
29889,
22240,
29911,
29918,
5550,
28852,
2241,
29892,
1583,
29889,
2951,
5592,
262,
15790,
29897,
13,
4706,
1583,
29889,
1028,
262,
29918,
8394,
29906,
29889,
15708,
29898,
23310,
29889,
22240,
29911,
29918,
5550,
28852,
2241,
29892,
1583,
29889,
2951,
5592,
262,
15790,
29897,
13,
4706,
1583,
29889,
26648,
29918,
1555,
29873,
482,
29906,
353,
26437,
29889,
17046,
1626,
29898,
15119,
29892,
3858,
543,
29900,
29889,
29900,
29894,
1159,
13,
4706,
6856,
29889,
2528,
29898,
26648,
29918,
8394,
29892,
926,
7607,
798,
29892,
29900,
511,
7353,
29922,
23310,
29889,
9818,
29989,
23310,
29889,
5746,
29925,
9468,
29892,
5139,
29922,
29945,
29897,
13,
4706,
6856,
29889,
2528,
29898,
1311,
29889,
1028,
262,
29918,
8394,
29892,
926,
7607,
798,
29892,
29896,
511,
7353,
29922,
23310,
29889,
9818,
29892,
5139,
29922,
29945,
29897,
13,
4706,
6856,
29889,
2528,
29898,
1311,
29889,
1028,
262,
29918,
8394,
29906,
29892,
926,
7607,
798,
29892,
29906,
511,
7353,
29922,
23310,
29889,
9818,
29892,
5139,
29922,
29945,
29897,
13,
4706,
6856,
29889,
2528,
29898,
1311,
29889,
26648,
29918,
1555,
29873,
482,
29906,
29892,
926,
7607,
798,
29892,
29941,
511,
7353,
29922,
23310,
29889,
9818,
29892,
5139,
29922,
29945,
29897,
13,
308,
13,
4706,
1948,
4619,
29871,
29896,
13,
4706,
301,
2204,
29918,
10568,
353,
26437,
29889,
17046,
1626,
29898,
15119,
29892,
3858,
543,
13072,
29873,
482,
512,
17053,
29914,
6185,
276,
358,
29901,
1159,
13,
4706,
1583,
29889,
1028,
262,
29918,
10568,
353,
26437,
29889,
5592,
262,
18069,
29898,
15119,
29892,
4236,
29922,
29941,
29900,
29892,
1375,
29922,
29900,
29892,
2159,
7607,
29945,
29900,
29892,
448,
29896,
876,
13,
4706,
1583,
29889,
1028,
262,
29918,
10568,
29906,
353,
26437,
29889,
5592,
262,
18069,
29898,
15119,
29892,
4236,
29922,
29941,
29900,
29892,
1375,
29922,
29900,
29892,
2159,
7607,
29945,
29900,
29892,
448,
29896,
876,
13,
4706,
1583,
29889,
1028,
262,
29918,
10568,
29889,
15708,
29898,
23310,
29889,
22240,
29911,
29918,
5550,
28852,
2241,
29892,
1583,
29889,
2951,
5592,
262,
14448,
29897,
13,
4706,
1583,
29889,
1028,
262,
29918,
10568,
29906,
29889,
15708,
29898,
23310,
29889,
22240,
29911,
29918,
5550,
28852,
2241,
29892,
1583,
29889,
2951,
5592,
262,
14448,
29897,
13,
4706,
1583,
29889,
26648,
29918,
10568,
29906,
353,
26437,
29889,
17046,
1626,
29898,
15119,
29892,
3858,
543,
29900,
29889,
29900,
29894,
1159,
13,
4706,
6856,
29889,
2528,
29898,
26648,
29918,
10568,
29892,
926,
7607,
798,
29892,
29900,
511,
7353,
29922,
23310,
29889,
9818,
29989,
23310,
29889,
5746,
29925,
9468,
29892,
5139,
29922,
29945,
29897,
13,
4706,
6856,
29889,
2528,
29898,
1311,
29889,
1028,
262,
29918,
10568,
29892,
926,
7607,
798,
29892,
29896,
511,
7353,
29922,
23310,
29889,
9818,
29892,
5139,
29922,
29945,
29897,
13,
4706,
6856,
29889,
2528,
29898,
1311,
29889,
1028,
262,
29918,
10568,
29906,
29892,
926,
7607,
798,
29892,
29906,
511,
7353,
29922,
23310,
29889,
9818,
29892,
5139,
29922,
29945,
29897,
13,
4706,
6856,
29889,
2528,
29898,
1311,
29889,
26648,
29918,
10568,
29906,
29892,
926,
7607,
798,
29892,
29941,
511,
7353,
29922,
23310,
29889,
9818,
29892,
5139,
29922,
29945,
29897,
13,
308,
13,
4706,
1948,
4619,
29871,
29896,
13,
4706,
301,
2204,
29918,
10568,
29918,
18829,
353,
26437,
29889,
17046,
1626,
29898,
15119,
29892,
3858,
543,
797,
17053,
29914,
311,
17053,
9055,
313,
1516,
1125,
1159,
13,
4706,
1583,
29889,
1028,
262,
29918,
10568,
29918,
18829,
353,
26437,
29889,
5592,
262,
18069,
29898,
15119,
29892,
4236,
29922,
29900,
29892,
1375,
29922,
29900,
29892,
2159,
7607,
29945,
29900,
29892,
448,
29896,
876,
13,
4706,
6856,
29889,
2528,
29898,
26648,
29918,
10568,
29918,
18829,
29892,
926,
7607,
798,
29892,
29900,
511,
7353,
29922,
23310,
29889,
9818,
29989,
23310,
29889,
5746,
29925,
9468,
29892,
5139,
29922,
29945,
29897,
13,
4706,
6856,
29889,
2528,
29898,
1311,
29889,
1028,
262,
29918,
10568,
29918,
18829,
29892,
926,
7607,
798,
29892,
29896,
511,
10638,
7607,
29900,
29892,
29906,
511,
7353,
29922,
23310,
29889,
9818,
29892,
5139,
29922,
29945,
29897,
13,
308,
13,
4706,
1948,
4619,
29871,
29896,
13,
4706,
301,
2204,
29918,
14358,
353,
26437,
29889,
17046,
1626,
29898,
15119,
29892,
3858,
543,
1123,
11666,
29901,
1159,
13,
4706,
10917,
29918,
14358,
353,
26437,
29889,
5592,
262,
18069,
29898,
15119,
29892,
4236,
29922,
29929,
29929,
29929,
29892,
1375,
29922,
29900,
29892,
2159,
7607,
29945,
29900,
29892,
448,
29896,
876,
13,
4706,
6856,
29889,
2528,
29898,
26648,
29918,
14358,
29892,
926,
7607,
798,
29892,
29900,
511,
7353,
29922,
23310,
29889,
9818,
29989,
23310,
29889,
5746,
29925,
9468,
29892,
5139,
29922,
29945,
29897,
13,
4706,
6856,
29889,
2528,
29898,
1028,
262,
29918,
14358,
29892,
926,
7607,
798,
29892,
29896,
511,
7353,
29922,
23310,
29889,
9818,
29989,
23310,
29889,
5746,
29925,
9468,
29892,
5139,
29922,
29945,
29897,
13,
308,
13,
4706,
1948,
4619,
29871,
29896,
13,
4706,
396,
298,
29879,
3950,
353,
26437,
29889,
3313,
29903,
3950,
29898,
23310,
29889,
29950,
1955,
26664,
1164,
29911,
1964,
29897,
13,
4706,
301,
2204,
29918,
949,
353,
26437,
29889,
17046,
1626,
29898,
15119,
29892,
3858,
543,
6359,
3684,
29873,
482,
29901,
1159,
13,
4706,
19995,
353,
6796,
15954,
852,
373,
8225,
3108,
13,
4706,
1583,
29889,
29883,
1884,
29918,
949,
353,
26437,
29889,
26628,
29898,
15119,
29892,
19995,
29922,
1859,
1575,
29892,
995,
29922,
1859,
1575,
29961,
29900,
2314,
13,
4706,
6856,
29889,
2528,
29898,
26648,
29918,
949,
29892,
926,
7607,
798,
29892,
29900,
511,
7353,
29922,
23310,
29889,
9818,
29989,
23310,
29889,
5746,
29925,
9468,
29892,
5139,
29922,
29945,
29897,
13,
4706,
6856,
29889,
2528,
29898,
1311,
29889,
29883,
1884,
29918,
949,
29892,
926,
7607,
798,
29892,
29896,
511,
10638,
7607,
29900,
29892,
29941,
511,
7353,
29922,
23310,
29889,
9818,
29989,
23310,
29889,
5746,
29925,
9468,
29892,
5139,
29922,
29945,
29897,
13,
462,
13,
4706,
269,
1884,
29918,
29879,
3950,
29889,
2528,
29898,
7720,
29892,
29871,
29896,
29892,
26437,
29889,
9818,
29989,
23310,
29889,
5746,
29925,
9468,
29892,
29871,
29900,
29897,
13,
4706,
269,
1884,
29918,
29879,
3950,
29889,
2528,
5592,
562,
261,
29898,
29906,
29900,
29897,
13,
308,
13,
4706,
396,
29878,
9499,
2294,
1884,
29879,
3950,
13,
4706,
269,
1884,
29906,
353,
26437,
29889,
17046,
3313,
29898,
15119,
29892,
3858,
543,
7129,
29914,
16243,
11790,
654,
1159,
13,
4706,
269,
1884,
29918,
29879,
3950,
29906,
353,
26437,
29889,
17046,
3313,
29903,
3950,
29898,
29879,
1884,
29906,
29892,
26437,
29889,
29950,
1955,
26664,
1164,
29911,
1964,
29897,
13,
462,
13,
4706,
7186,
3950,
353,
26437,
29889,
3313,
29903,
3950,
29898,
23310,
29889,
5348,
29911,
2965,
1964,
29897,
13,
4706,
7186,
3950,
29889,
2528,
5592,
562,
261,
29898,
29906,
29900,
29897,
13,
308,
13,
4706,
6856,
29906,
353,
26437,
29889,
5756,
23544,
29903,
3950,
29898,
29906,
29892,
29906,
29897,
13,
4706,
1948,
353,
29871,
29900,
9651,
13,
4706,
24987,
353,
6796,
29963,
448,
3684,
29873,
482,
5183,
313,
29963,
19123,
13,
18884,
376,
29902,
448,
9626,
5183,
313,
29909,
19123,
13,
18884,
376,
29934,
448,
2538,
21558,
5183,
313,
29995,
29879,
5513,
1273,
23170,
29924,
29962,
13,
4706,
5855,
353,
6796,
262,
3464,
613,
13,
462,
1678,
376,
1333,
297,
3464,
613,
13,
462,
1678,
376,
262,
1273,
3464,
613,
13,
462,
1678,
376,
1333,
297,
1273,
3464,
613,
13,
462,
1678,
376,
29958,
313,
7979,
1008,
1135,
19123,
13,
462,
1678,
376,
18572,
313,
7979,
1008,
1135,
29914,
11745,
304,
19123,
13,
462,
1678,
9872,
313,
2222,
1135,
19123,
13,
462,
1678,
9872,
29922,
313,
2222,
1135,
29914,
11745,
304,
29897,
3108,
308,
13,
4706,
1583,
29889,
29883,
1884,
29918,
1707,
353,
26437,
29889,
26628,
29898,
15119,
29892,
19995,
29922,
16908,
29892,
1024,
543,
19715,
613,
3114,
29922,
23310,
29889,
21685,
29918,
16310,
1164,
16786,
29897,
13,
4706,
1583,
29889,
29883,
1884,
29918,
1707,
29889,
15708,
29898,
23310,
29889,
22240,
29911,
29918,
19795,
8456,
8456,
29990,
29892,
1583,
29889,
2951,
26628,
29897,
13,
4706,
1583,
29889,
29883,
1884,
29918,
1707,
29889,
2697,
15097,
29898,
29900,
29897,
13,
4706,
1583,
29889,
29883,
1884,
29918,
1116,
2187,
353,
26437,
29889,
26628,
29898,
15119,
29892,
19995,
29922,
1116,
2187,
29892,
1024,
543,
16122,
613,
3114,
29922,
23310,
29889,
21685,
29918,
16310,
1164,
16786,
29897,
259,
13,
4706,
1583,
29889,
29883,
1884,
29918,
1116,
2187,
29889,
15708,
29898,
23310,
29889,
22240,
29911,
29918,
19795,
8456,
8456,
29990,
29892,
1583,
29889,
2951,
26628,
29897,
13,
4706,
1583,
29889,
29883,
1884,
29918,
1116,
2187,
29889,
2697,
15097,
29898,
29900,
29897,
13,
308,
13,
4706,
6856,
29906,
29889,
2528,
29898,
1311,
29889,
29883,
1884,
29918,
1707,
29892,
926,
7607,
798,
29892,
29896,
511,
10638,
7607,
29900,
29892,
29871,
29900,
511,
7353,
29922,
23310,
29889,
9818,
29989,
23310,
29889,
5746,
29925,
9468,
29892,
5139,
29922,
29945,
29897,
13,
4706,
6856,
29906,
29889,
2528,
29898,
1311,
29889,
29883,
1884,
29918,
1116,
2187,
29892,
926,
7607,
798,
29892,
29906,
511,
10638,
7607,
29900,
29892,
29871,
29900,
511,
7353,
29922,
23310,
29889,
9818,
29989,
23310,
29889,
5746,
29925,
9468,
29892,
5139,
29922,
29945,
29897,
13,
308,
13,
4706,
1948,
4619,
29871,
29896,
1678,
13,
4706,
301,
2204,
29918,
1688,
1707,
29918,
29874,
353,
26437,
29889,
17046,
1626,
29898,
15119,
29892,
3858,
543,
1917,
29871,
29896,
29901,
1159,
13,
4706,
1583,
29889,
1028,
262,
29918,
1707,
29918,
29874,
353,
26437,
29889,
5592,
262,
18069,
29898,
15119,
29892,
4236,
29922,
29941,
29900,
29892,
1375,
29922,
29900,
29892,
2159,
7607,
29945,
29900,
29892,
448,
29896,
876,
13,
4706,
1583,
29889,
1028,
262,
29918,
1707,
29918,
29874,
29889,
15708,
29898,
23310,
29889,
22240,
29911,
29918,
5550,
28852,
2241,
29892,
1583,
29889,
2951,
5592,
262,
9037,
29909,
29897,
13,
4706,
1583,
29889,
1028,
262,
29918,
1707,
29918,
29874,
29906,
353,
26437,
29889,
5592,
262,
18069,
29898,
15119,
29892,
4236,
29922,
29941,
29900,
29892,
1375,
29922,
29900,
29892,
2159,
7607,
29945,
29900,
29892,
448,
29896,
876,
13,
4706,
1583,
29889,
1028,
262,
29918,
1707,
29918,
29874,
29906,
29889,
15708,
29898,
23310,
29889,
22240,
29911,
29918,
5550,
28852,
2241,
29892,
1583,
29889,
2951,
5592,
262,
9037,
29909,
29897,
13,
4706,
1583,
29889,
26648,
29918,
1707,
29918,
29874,
353,
26437,
29889,
17046,
1626,
29898,
15119,
29892,
3858,
543,
29900,
29889,
29900,
29963,
1159,
308,
13,
308,
13,
4706,
6856,
29906,
29889,
2528,
29898,
26648,
29918,
1688,
1707,
29918,
29874,
29892,
926,
7607,
798,
29892,
29900,
511,
7353,
29922,
23310,
29889,
9818,
29989,
23310,
29889,
5746,
29925,
9468,
29892,
5139,
29922,
29945,
29897,
13,
4706,
6856,
29906,
29889,
2528,
29898,
1311,
29889,
1028,
262,
29918,
1707,
29918,
29874,
29892,
926,
7607,
798,
29892,
29896,
511,
7353,
29922,
23310,
29889,
9818,
29989,
23310,
29889,
5746,
29925,
9468,
29892,
5139,
29922,
29945,
29897,
308,
13,
4706,
6856,
29906,
29889,
2528,
29898,
1311,
29889,
1028,
262,
29918,
1707,
29918,
29874,
29906,
29892,
926,
7607,
798,
29892,
29906,
511,
7353,
29922,
23310,
29889,
9818,
29989,
23310,
29889,
5746,
29925,
9468,
29892,
5139,
29922,
29945,
29897,
13,
4706,
6856,
29906,
29889,
2528,
29898,
1311,
29889,
26648,
29918,
1707,
29918,
29874,
29892,
926,
7607,
798,
29892,
29941,
511,
7353,
29922,
23310,
29889,
9818,
29989,
23310,
29889,
5746,
29925,
9468,
29892,
5139,
29922,
29945,
29897,
965,
13,
308,
13,
4706,
1948,
4619,
29871,
29896,
1678,
13,
4706,
301,
2204,
29918,
1688,
1707,
29918,
29890,
353,
26437,
29889,
17046,
1626,
29898,
15119,
29892,
3858,
543,
1917,
29871,
29906,
29901,
1159,
13,
4706,
1583,
29889,
1028,
262,
29918,
1707,
29918,
29890,
353,
26437,
29889,
5592,
262,
18069,
29898,
15119,
29892,
4236,
29922,
29941,
29900,
29892,
1375,
29922,
29900,
29892,
2159,
7607,
29945,
29900,
29892,
448,
29896,
876,
13,
4706,
1583,
29889,
1028,
262,
29918,
1707,
29918,
29890,
29889,
15708,
29898,
23310,
29889,
22240,
29911,
29918,
5550,
28852,
2241,
29892,
1583,
29889,
2951,
5592,
262,
9037,
29933,
29897,
13,
4706,
1583,
29889,
1028,
262,
29918,
1707,
29918,
29890,
29906,
353,
26437,
29889,
5592,
262,
18069,
29898,
15119,
29892,
4236,
29922,
29941,
29900,
29892,
1375,
29922,
29900,
29892,
2159,
7607,
29945,
29900,
29892,
448,
29896,
876,
13,
4706,
1583,
29889,
1028,
262,
29918,
1707,
29918,
29890,
29906,
29889,
15708,
29898,
23310,
29889,
22240,
29911,
29918,
5550,
28852,
2241,
29892,
1583,
29889,
2951,
5592,
262,
9037,
29933,
29897,
13,
4706,
1583,
29889,
26648,
29918,
1707,
29918,
29890,
353,
26437,
29889,
17046,
1626,
29898,
15119,
29892,
3858,
543,
29900,
29889,
29900,
29963,
1159,
308,
13,
308,
13,
4706,
6856,
29906,
29889,
2528,
29898,
26648,
29918,
1688,
1707,
29918,
29890,
29892,
926,
7607,
798,
29892,
29900,
511,
7353,
29922,
23310,
29889,
9818,
29989,
23310,
29889,
5746,
29925,
9468,
29892,
5139,
29922,
29945,
29897,
13,
4706,
6856,
29906,
29889,
2528,
29898,
1311,
29889,
1028,
262,
29918,
1707,
29918,
29890,
29892,
926,
7607,
798,
29892,
29896,
511,
7353,
29922,
23310,
29889,
9818,
29989,
23310,
29889,
5746,
29925,
9468,
29892,
5139,
29922,
29945,
29897,
308,
13,
4706,
6856,
29906,
29889,
2528,
29898,
1311,
29889,
1028,
262,
29918,
1707,
29918,
29890,
29906,
29892,
926,
7607,
798,
29892,
29906,
511,
7353,
29922,
23310,
29889,
9818,
29989,
23310,
29889,
5746,
29925,
9468,
29892,
5139,
29922,
29945,
29897,
1678,
13,
4706,
6856,
29906,
29889,
2528,
29898,
1311,
29889,
26648,
29918,
1707,
29918,
29890,
29892,
926,
7607,
798,
29892,
29941,
511,
7353,
29922,
23310,
29889,
9818,
29989,
23310,
29889,
5746,
29925,
9468,
29892,
5139,
29922,
29945,
29897,
1678,
13,
308,
13,
4706,
6856,
29906,
29889,
2528,
29954,
798,
519,
1625,
29898,
29900,
29897,
13,
4706,
7186,
3950,
29889,
2528,
29898,
7720,
29906,
29892,
29871,
29900,
29892,
26437,
29889,
9818,
29989,
23310,
29889,
5746,
29925,
9468,
29892,
29871,
29945,
29897,
13,
308,
13,
4706,
7186,
3950,
29889,
2528,
29898,
23310,
29889,
17046,
3542,
29898,
15119,
511,
29871,
29900,
29892,
26437,
29889,
9818,
29989,
23310,
29889,
5746,
29925,
9468,
29892,
29871,
29945,
29897,
13,
308,
13,
4706,
298,
29879,
3950,
29918,
3665,
2363,
353,
26437,
29889,
3313,
29903,
3950,
29898,
23310,
29889,
29950,
1955,
26664,
1164,
29911,
1964,
29897,
1678,
13,
4706,
301,
2204,
29918,
14057,
353,
26437,
29889,
17046,
1626,
29898,
15119,
29892,
3858,
543,
2951,
4321,
29098,
545,
29901,
1159,
13,
4706,
298,
29879,
3950,
29918,
3665,
2363,
29889,
2528,
29898,
26648,
29918,
14057,
29892,
29871,
29900,
29892,
26437,
29889,
9818,
29989,
23310,
29889,
5746,
29925,
9468,
29892,
29871,
29945,
29897,
13,
4706,
363,
3858,
297,
6796,
1323,
14150,
613,
376,
16329,
613,
376,
29909,
808,
373,
10672,
3108,
29901,
308,
13,
9651,
7155,
353,
26437,
29889,
21818,
3125,
29898,
15119,
29892,
3858,
29922,
1643,
29897,
13,
9651,
7155,
29889,
15708,
29898,
23310,
29889,
22240,
29911,
29918,
29934,
3035,
5971,
29933,
2692,
29911,
1164,
29892,
1583,
29889,
2951,
21818,
3125,
29897,
13,
9651,
298,
29879,
3950,
29918,
3665,
2363,
29889,
2528,
29898,
13399,
29892,
29871,
29900,
29892,
26437,
29889,
9818,
29989,
23310,
29889,
5746,
29925,
9468,
29892,
29871,
29945,
29897,
308,
13,
4706,
7186,
3950,
29889,
2528,
29898,
9499,
3950,
29918,
3665,
2363,
29892,
29871,
29900,
29892,
26437,
29889,
9818,
29989,
23310,
29889,
5746,
29925,
9468,
29892,
29871,
29945,
29897,
259,
13,
308,
13,
308,
13,
308,
13,
4706,
269,
1884,
29918,
29879,
3950,
29906,
29889,
2528,
29898,
4270,
3950,
29892,
29871,
29896,
29892,
26437,
29889,
9818,
29989,
23310,
29889,
5746,
29925,
9468,
29892,
29871,
29945,
29897,
13,
308,
13,
4706,
396,
788,
2294,
16273,
304,
298,
29879,
3950,
13,
4706,
298,
29879,
3950,
29889,
2528,
29898,
29879,
1884,
29918,
29879,
3950,
29892,
29871,
29900,
29892,
26437,
29889,
9818,
29989,
23310,
29889,
5746,
29925,
9468,
29892,
29871,
29945,
29897,
13,
4706,
298,
29879,
3950,
29889,
2528,
29898,
29879,
1884,
29918,
29879,
3950,
29906,
29892,
29871,
29900,
29892,
26437,
29889,
9818,
29989,
23310,
29889,
5746,
29925,
9468,
29892,
29871,
29945,
29897,
13,
308,
13,
4706,
396,
23648,
13,
4706,
298,
29879,
3950,
29906,
353,
26437,
29889,
3313,
29903,
3950,
29898,
23310,
29889,
29950,
1955,
26664,
1164,
29911,
1964,
29897,
13,
4706,
298,
29879,
3950,
29906,
29889,
2528,
855,
10301,
5592,
562,
261,
580,
13,
4706,
9503,
29918,
20713,
353,
26437,
29889,
3125,
29898,
15119,
29892,
3858,
543,
19420,
1159,
13,
4706,
9503,
29918,
20713,
29889,
15708,
29898,
23310,
29889,
22240,
29911,
29918,
29933,
2692,
29911,
1164,
29892,
1583,
29889,
2951,
3125,
29897,
13,
4706,
9503,
29918,
26897,
353,
26437,
29889,
3125,
29898,
15119,
29892,
3858,
543,
16376,
3568,
1159,
13,
4706,
9503,
29918,
26897,
29889,
15708,
29898,
23310,
29889,
22240,
29911,
29918,
29933,
2692,
29911,
1164,
29892,
1583,
29889,
2951,
3125,
29897,
13,
4706,
298,
29879,
3950,
29906,
29889,
2528,
29898,
7290,
29918,
20713,
29892,
29871,
29900,
29892,
26437,
29889,
9818,
29989,
23310,
29889,
5746,
29925,
9468,
29892,
29871,
29945,
29897,
13,
4706,
298,
29879,
3950,
29906,
29889,
2528,
29898,
7290,
29918,
26897,
29892,
29871,
29900,
29892,
26437,
29889,
9818,
29989,
23310,
29889,
5746,
29925,
9468,
29892,
29871,
29945,
29897,
13,
462,
308,
13,
4706,
396,
1202,
304,
1667,
269,
3950,
13,
4706,
269,
3950,
29889,
2528,
29898,
9499,
3950,
29892,
29871,
29900,
29892,
26437,
29889,
9818,
29989,
23310,
29889,
5746,
29925,
9468,
29892,
29871,
29906,
29897,
13,
4706,
269,
3950,
29889,
2528,
29898,
9499,
3950,
29906,
29892,
29871,
29900,
29892,
26437,
29889,
9818,
29989,
23310,
29889,
5746,
29925,
9468,
29892,
29871,
29945,
29897,
13,
308,
13,
4706,
9451,
29889,
2697,
29903,
3950,
29898,
29879,
3950,
29897,
259,
13,
308,
13,
4706,
281,
29892,
298,
353,
269,
3950,
29889,
29943,
277,
29898,
1311,
29897,
259,
13,
4706,
396,
1583,
29889,
2697,
3505,
3552,
29893,
29892,
298,
29930,
29896,
29889,
29945,
876,
13,
4706,
396,
1583,
29889,
2697,
8140,
3505,
3552,
29893,
29892,
298,
29930,
29896,
29889,
29945,
876,
13,
308,
13,
4706,
396,
1583,
29889,
2697,
7976,
3505,
29898,
29879,
3950,
29889,
29943,
277,
29898,
1311,
876,
13,
308,
13,
4706,
1018,
29901,
13,
9651,
1583,
29889,
2697,
12492,
29898,
18193,
29889,
2577,
12492,
703,
567,
29884,
29918,
2732,
5783,
13,
4706,
5174,
29901,
13,
9651,
1209,
13,
632,
13,
4706,
396,
1583,
29889,
15708,
29898,
23310,
29889,
22240,
29911,
29918,
10818,
29897,
268,
13,
268,
13,
1678,
822,
1551,
5592,
262,
15514,
29898,
1311,
29892,
1741,
29922,
8516,
1125,
13,
4706,
325,
29900,
353,
1583,
29889,
1028,
262,
29918,
11228,
29889,
2577,
1917,
580,
13,
4706,
325,
29896,
353,
1583,
29889,
1028,
262,
29918,
11228,
29906,
29889,
2577,
1917,
580,
13,
308,
13,
4706,
3858,
353,
851,
29898,
29894,
29900,
29897,
718,
376,
1213,
718,
851,
29898,
29894,
29896,
29897,
718,
376,
29894,
29908,
13,
4706,
1583,
29889,
26648,
29918,
1555,
29873,
482,
29889,
2697,
4775,
29898,
1643,
29897,
13,
308,
13,
1678,
822,
1551,
5592,
262,
15790,
29898,
1311,
29892,
1741,
29922,
8516,
1125,
13,
4706,
325,
29900,
353,
1583,
29889,
1028,
262,
29918,
8394,
29889,
2577,
1917,
580,
13,
4706,
325,
29896,
353,
1583,
29889,
1028,
262,
29918,
8394,
29906,
29889,
2577,
1917,
580,
13,
308,
13,
4706,
3858,
353,
851,
29898,
29894,
29900,
29897,
718,
376,
1213,
718,
851,
29898,
29894,
29896,
29897,
718,
376,
29894,
29908,
13,
4706,
1583,
29889,
26648,
29918,
1555,
29873,
482,
29906,
29889,
2697,
4775,
29898,
1643,
29897,
13,
308,
13,
1678,
822,
1551,
5592,
262,
9037,
29909,
29898,
1311,
29892,
1741,
1125,
13,
4706,
325,
29900,
353,
1583,
29889,
1028,
262,
29918,
1707,
29918,
29874,
29889,
2577,
1917,
580,
13,
4706,
325,
29896,
353,
1583,
29889,
1028,
262,
29918,
1707,
29918,
29874,
29906,
29889,
2577,
1917,
580,
13,
308,
13,
4706,
5190,
353,
1583,
29889,
26648,
29918,
1707,
29918,
29874,
29889,
2577,
4775,
580,
14352,
29896,
29962,
308,
13,
4706,
3858,
353,
851,
29898,
29894,
29900,
29897,
718,
376,
1213,
718,
851,
29898,
29894,
29896,
29897,
718,
5190,
13,
4706,
1583,
29889,
26648,
29918,
1707,
29918,
29874,
29889,
2697,
4775,
29898,
1643,
29897,
13,
308,
13,
1678,
822,
1551,
5592,
262,
9037,
29933,
29898,
1311,
29892,
1741,
1125,
13,
4706,
325,
29900,
353,
1583,
29889,
1028,
262,
29918,
1707,
29918,
29890,
29889,
2577,
1917,
580,
13,
4706,
325,
29896,
353,
1583,
29889,
1028,
262,
29918,
1707,
29918,
29890,
29906,
29889,
2577,
1917,
580,
13,
308,
13,
4706,
5190,
353,
1583,
29889,
26648,
29918,
1707,
29918,
29890,
29889,
2577,
4775,
580,
14352,
29896,
29962,
13,
4706,
3858,
353,
851,
29898,
29894,
29900,
29897,
718,
376,
1213,
718,
851,
29898,
29894,
29896,
29897,
718,
5190,
13,
4706,
1583,
29889,
26648,
29918,
1707,
29918,
29890,
29889,
2697,
4775,
29898,
1643,
29897,
13,
308,
13,
1678,
822,
1551,
5592,
262,
14448,
29898,
1311,
29892,
1741,
29922,
8516,
1125,
13,
4706,
325,
29900,
353,
1583,
29889,
1028,
262,
29918,
10568,
29889,
2577,
1917,
580,
13,
4706,
325,
29896,
353,
1583,
29889,
1028,
262,
29918,
10568,
29906,
29889,
2577,
1917,
580,
13,
308,
13,
4706,
3858,
353,
851,
29898,
29894,
29900,
29897,
718,
376,
1213,
718,
851,
29898,
29894,
29896,
29897,
718,
376,
29894,
29908,
13,
4706,
1583,
29889,
26648,
29918,
10568,
29906,
29889,
2697,
4775,
29898,
1643,
29897,
13,
268,
13,
1678,
822,
1551,
26628,
29898,
1311,
29892,
1741,
1125,
13,
4706,
321,
353,
1741,
29889,
2577,
2624,
2061,
580,
13,
4706,
1024,
353,
321,
29889,
2577,
1170,
580,
13,
4706,
995,
353,
321,
29889,
2577,
1231,
15097,
580,
18884,
13,
13,
4706,
565,
1024,
1275,
376,
19715,
1115,
13,
9651,
565,
376,
13072,
29873,
482,
29908,
297,
995,
29901,
13,
18884,
5190,
353,
376,
29963,
29908,
13,
9651,
25342,
376,
7583,
29908,
297,
995,
29901,
13,
18884,
5190,
353,
376,
29909,
29908,
13,
9651,
25342,
376,
1666,
21558,
29908,
297,
995,
29901,
13,
18884,
5190,
353,
438,
29950,
29924,
13,
462,
13,
9651,
396,
3167,
5190,
16205,
13,
9651,
3858,
353,
1583,
29889,
26648,
29918,
1707,
29918,
29874,
29889,
2577,
4775,
580,
13,
9651,
565,
3858,
14352,
29896,
29962,
1275,
11860,
1115,
13,
18884,
736,
13,
9651,
3858,
353,
3858,
7503,
29899,
29896,
29962,
718,
5190,
13,
9651,
1583,
29889,
26648,
29918,
1707,
29918,
29874,
29889,
2697,
4775,
29898,
1643,
29897,
13,
632,
13,
9651,
3858,
353,
1583,
29889,
26648,
29918,
1707,
29918,
29890,
29889,
2577,
4775,
580,
13,
9651,
3858,
353,
3858,
7503,
29899,
29896,
29962,
718,
5190,
13,
9651,
1583,
29889,
26648,
29918,
1707,
29918,
29890,
29889,
2697,
4775,
29898,
1643,
29897,
13,
462,
13,
4706,
25342,
1024,
1275,
376,
16122,
1115,
632,
13,
9651,
565,
11860,
29908,
297,
995,
29901,
13,
18884,
1583,
29889,
1028,
262,
29918,
1707,
29918,
29890,
29889,
4205,
519,
580,
13,
18884,
1583,
29889,
1028,
262,
29918,
1707,
29918,
29890,
29906,
29889,
4205,
519,
580,
13,
462,
13,
18884,
3858,
353,
1583,
29889,
26648,
29918,
1707,
29918,
29874,
29889,
2577,
4775,
580,
13,
18884,
565,
451,
3858,
29889,
1975,
2541,
11702,
29908,
1125,
462,
418,
13,
462,
1678,
3858,
353,
3858,
7503,
29899,
29896,
29962,
718,
11860,
29908,
462,
13,
18884,
1583,
29889,
26648,
29918,
1707,
29918,
29874,
29889,
2697,
4775,
29898,
1643,
29897,
13,
462,
13,
18884,
3858,
353,
1583,
29889,
26648,
29918,
1707,
29918,
29890,
29889,
2577,
4775,
580,
13,
18884,
565,
451,
3858,
29889,
1975,
2541,
11702,
29908,
1125,
462,
418,
13,
462,
1678,
3858,
353,
3858,
7503,
29899,
29896,
29962,
718,
11860,
29908,
462,
13,
18884,
1583,
29889,
26648,
29918,
1707,
29918,
29890,
29889,
2697,
4775,
29898,
1643,
29897,
13,
18884,
736,
462,
13,
9651,
25342,
995,
297,
6796,
262,
3464,
3284,
1333,
297,
3464,
3108,
29901,
13,
18884,
1583,
29889,
1028,
262,
29918,
1707,
29918,
29890,
29889,
20701,
580,
13,
18884,
1583,
29889,
1028,
262,
29918,
1707,
29918,
29890,
29906,
29889,
20701,
580,
13,
9651,
1683,
29901,
13,
18884,
1583,
29889,
1028,
262,
29918,
1707,
29918,
29890,
29889,
4205,
519,
580,
13,
18884,
1583,
29889,
1028,
262,
29918,
1707,
29918,
29890,
29906,
29889,
4205,
519,
580,
13,
632,
13,
9651,
3858,
353,
1583,
29889,
26648,
29918,
1707,
29918,
29874,
29889,
2577,
4775,
580,
13,
9651,
565,
3858,
29889,
1975,
2541,
11702,
29908,
1125,
462,
268,
13,
18884,
995,
353,
1583,
29889,
29883,
1884,
29918,
1707,
29889,
2577,
1231,
15097,
580,
13,
18884,
565,
376,
13072,
29873,
482,
29908,
297,
995,
29901,
13,
462,
1678,
5190,
353,
376,
29963,
29908,
13,
18884,
25342,
376,
7583,
29908,
297,
995,
29901,
13,
462,
1678,
5190,
353,
376,
29909,
29908,
13,
18884,
25342,
376,
1666,
21558,
29908,
297,
995,
29901,
13,
462,
1678,
5190,
353,
438,
29950,
29924,
13,
462,
462,
539,
13,
18884,
3858,
353,
3858,
7503,
29899,
29896,
29962,
718,
5190,
13,
18884,
1583,
29889,
26648,
29918,
1707,
29918,
29874,
29889,
2697,
4775,
29898,
1643,
29897,
13,
462,
13,
18884,
3858,
353,
1583,
29889,
26648,
29918,
1707,
29918,
29890,
29889,
2577,
4775,
580,
13,
18884,
3858,
353,
3858,
7503,
29899,
29896,
29962,
718,
5190,
13,
18884,
1583,
29889,
26648,
29918,
1707,
29918,
29890,
29889,
2697,
4775,
29898,
1643,
29897,
13,
268,
13,
1678,
822,
1551,
21818,
3125,
29898,
1311,
29892,
1741,
1125,
13,
4706,
321,
353,
1741,
29889,
2577,
2624,
2061,
580,
13,
4706,
3858,
353,
321,
29889,
2577,
4775,
580,
13,
4706,
1583,
29889,
265,
29918,
14057,
545,
353,
3858,
13,
308,
13,
1678,
822,
1551,
3125,
29898,
1311,
29892,
1741,
1125,
13,
4706,
321,
353,
1741,
29889,
2577,
2624,
2061,
580,
13,
4706,
3858,
353,
321,
29889,
2577,
4775,
580,
13,
4706,
1178,
353,
321,
29889,
2577,
1204,
580,
13,
308,
13,
4706,
565,
3858,
1275,
376,
2528,
1115,
13,
9651,
1243,
353,
1583,
29889,
29883,
1884,
29918,
1116,
2187,
29889,
2577,
1917,
580,
13,
9651,
1243,
4619,
1583,
29889,
26648,
29918,
1707,
29918,
29874,
29889,
2577,
4775,
580,
29871,
13,
9651,
1243,
4619,
1583,
29889,
26648,
29918,
1707,
29918,
29890,
29889,
2577,
4775,
580,
13,
9651,
10672,
353,
1583,
29889,
265,
29918,
14057,
545,
13,
9651,
1583,
29889,
1761,
29918,
3364,
14057,
29889,
18277,
4197,
1688,
29892,
14057,
545,
2314,
13,
632,
13,
4706,
565,
3858,
1275,
376,
19420,
1115,
13,
9651,
1583,
29889,
5044,
19751,
29898,
333,
29897,
13,
632,
13,
4706,
25342,
3858,
1275,
376,
16376,
3568,
1115,
13,
9651,
848,
353,
8853,
2467,
1115,
376,
14448,
3684,
29873,
482,
613,
13,
462,
1678,
376,
567,
29884,
1115,
1311,
29889,
29883,
1884,
29918,
567,
29884,
29889,
2577,
1917,
3285,
13,
462,
1678,
376,
29894,
29900,
1115,
1311,
29889,
26648,
29918,
1555,
29873,
482,
29889,
2577,
4775,
580,
29961,
29896,
13018,
29896,
1402,
13,
462,
1678,
376,
29894,
29896,
1115,
1311,
29889,
26648,
29918,
1555,
29873,
482,
29906,
29889,
2577,
4775,
580,
29961,
29896,
13018,
29896,
1402,
13,
462,
1678,
376,
10568,
1115,
1311,
29889,
26648,
29918,
10568,
29906,
29889,
2577,
4775,
580,
29961,
29941,
13018,
29896,
1402,
13,
462,
1678,
376,
18829,
1115,
1311,
29889,
1028,
262,
29918,
10568,
29918,
18829,
29889,
2577,
1917,
3285,
13,
462,
1678,
376,
14358,
1115,
1311,
29889,
29883,
1884,
29918,
949,
29889,
2577,
1917,
3285,
13,
462,
1678,
376,
949,
1115,
1311,
29889,
29883,
1884,
29918,
949,
29889,
2577,
1917,
28296,
13,
9651,
1583,
29889,
5044,
19751,
29898,
333,
29897,
13,
13,
632,
13,
1990,
3462,
2697,
13072,
29873,
482,
29898,
23310,
29889,
4308,
1125,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
268,
13,
4706,
26437,
29889,
4308,
17255,
2344,
12035,
1311,
29892,
13,
462,
3986,
3847,
29922,
8516,
29892,
13,
462,
3986,
3611,
543,
2697,
3684,
29873,
482,
1159,
13,
462,
965,
2
] |
test/test_jit_disabled.py | xiaohanhuang/pytorch | 183 | 136402 | # Owner(s): ["oncall: jit"]
import sys
import os
import contextlib
import subprocess
from torch.testing._internal.common_utils import TestCase, run_tests, TemporaryFileName
@contextlib.contextmanager
def _jit_disabled():
cur_env = os.environ.get("PYTORCH_JIT", "1")
os.environ["PYTORCH_JIT"] = "0"
try:
yield
finally:
os.environ["PYTORCH_JIT"] = cur_env
class TestJitDisabled(TestCase):
"""
These tests are separate from the rest of the JIT tests because we need
run a new subprocess and `import torch` with the correct environment
variables set.
"""
def compare_enabled_disabled(self, src):
"""
Runs the script in `src` with PYTORCH_JIT enabled and disabled and
compares their stdout for equality.
"""
# Write `src` out to a temporary so our source inspection logic works
# correctly.
with TemporaryFileName() as fname:
with open(fname, 'w') as f:
f.write(src)
with _jit_disabled():
out_disabled = subprocess.check_output([
sys.executable,
fname])
out_enabled = subprocess.check_output([
sys.executable,
fname])
self.assertEqual(out_disabled, out_enabled)
def test_attribute(self):
_program_string = """
import torch
class Foo(torch.jit.ScriptModule):
def __init__(self, x):
super(Foo, self).__init__()
self.x = torch.jit.Attribute(x, torch.Tensor)
def forward(self, input):
return input
s = Foo(torch.ones(2, 3))
print(s.x)
"""
self.compare_enabled_disabled(_program_string)
def test_script_module_construction(self):
_program_string = """
import torch
class AModule(torch.jit.ScriptModule):
def __init__(self):
super(AModule, self).__init__()
@torch.jit.script_method
def forward(self, input):
pass
AModule()
print("Didn't throw exception")
"""
self.compare_enabled_disabled(_program_string)
def test_recursive_script(self):
_program_string = """
import torch
class AModule(torch.nn.Module):
def __init__(self):
super(AModule, self).__init__()
def forward(self, input):
pass
sm = torch.jit.script(AModule())
print("Didn't throw exception")
"""
self.compare_enabled_disabled(_program_string)
if __name__ == '__main__':
run_tests()
| [
1,
396,
438,
23007,
29898,
29879,
1125,
6796,
265,
4804,
29901,
432,
277,
3108,
13,
13,
5215,
10876,
13,
5215,
2897,
13,
5215,
3030,
1982,
13,
5215,
1014,
5014,
13,
3166,
4842,
305,
29889,
13424,
3032,
7564,
29889,
9435,
29918,
13239,
1053,
4321,
8259,
29892,
1065,
29918,
21150,
29892,
6789,
1971,
653,
17020,
13,
13,
13,
29992,
4703,
1982,
29889,
4703,
12847,
13,
1753,
903,
29926,
277,
29918,
18279,
7295,
13,
1678,
3151,
29918,
6272,
353,
2897,
29889,
21813,
29889,
657,
703,
20055,
29911,
1955,
3210,
29918,
29967,
1806,
613,
376,
29896,
1159,
13,
1678,
2897,
29889,
21813,
3366,
20055,
29911,
1955,
3210,
29918,
29967,
1806,
3108,
353,
376,
29900,
29908,
13,
1678,
1018,
29901,
13,
4706,
7709,
13,
1678,
7146,
29901,
13,
4706,
2897,
29889,
21813,
3366,
20055,
29911,
1955,
3210,
29918,
29967,
1806,
3108,
353,
3151,
29918,
6272,
13,
13,
13,
1990,
4321,
29967,
277,
4205,
3606,
29898,
3057,
8259,
1125,
13,
1678,
9995,
13,
1678,
4525,
6987,
526,
5004,
515,
278,
1791,
310,
278,
435,
1806,
6987,
1363,
591,
817,
13,
1678,
1065,
263,
716,
1014,
5014,
322,
421,
5215,
4842,
305,
29952,
411,
278,
1959,
5177,
13,
1678,
3651,
731,
29889,
13,
1678,
9995,
13,
13,
1678,
822,
7252,
29918,
17590,
29918,
18279,
29898,
1311,
29892,
4765,
1125,
13,
4706,
9995,
13,
4706,
390,
6948,
278,
2471,
297,
421,
4351,
29952,
411,
349,
29979,
29911,
1955,
3210,
29918,
29967,
1806,
9615,
322,
12708,
322,
13,
4706,
752,
5114,
1009,
27591,
363,
17193,
29889,
13,
4706,
9995,
13,
4706,
396,
14350,
421,
4351,
29952,
714,
304,
263,
13201,
577,
1749,
2752,
1663,
27988,
5900,
1736,
13,
4706,
396,
5149,
29889,
13,
4706,
411,
6789,
1971,
653,
17020,
580,
408,
285,
978,
29901,
13,
9651,
411,
1722,
29898,
29888,
978,
29892,
525,
29893,
1495,
408,
285,
29901,
13,
18884,
285,
29889,
3539,
29898,
4351,
29897,
13,
18884,
411,
903,
29926,
277,
29918,
18279,
7295,
13,
462,
1678,
714,
29918,
18279,
353,
1014,
5014,
29889,
3198,
29918,
4905,
4197,
13,
462,
4706,
10876,
29889,
4258,
9246,
29892,
13,
462,
4706,
285,
978,
2314,
13,
18884,
714,
29918,
17590,
353,
1014,
5014,
29889,
3198,
29918,
4905,
4197,
13,
462,
1678,
10876,
29889,
4258,
9246,
29892,
13,
462,
1678,
285,
978,
2314,
13,
18884,
1583,
29889,
9294,
9843,
29898,
449,
29918,
18279,
29892,
714,
29918,
17590,
29897,
13,
13,
1678,
822,
1243,
29918,
12715,
29898,
1311,
1125,
13,
4706,
903,
8860,
29918,
1807,
353,
9995,
13,
5215,
4842,
305,
13,
1990,
13679,
29898,
7345,
305,
29889,
29926,
277,
29889,
4081,
7355,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
921,
1125,
13,
4706,
2428,
29898,
14016,
29892,
1583,
467,
1649,
2344,
1649,
580,
13,
4706,
1583,
29889,
29916,
353,
4842,
305,
29889,
29926,
277,
29889,
6708,
29898,
29916,
29892,
4842,
305,
29889,
29911,
6073,
29897,
13,
13,
1678,
822,
6375,
29898,
1311,
29892,
1881,
1125,
13,
4706,
736,
1881,
13,
13,
29879,
353,
13679,
29898,
7345,
305,
29889,
2873,
29898,
29906,
29892,
29871,
29941,
876,
13,
2158,
29898,
29879,
29889,
29916,
29897,
13,
15945,
29908,
13,
4706,
1583,
29889,
18307,
29918,
17590,
29918,
18279,
7373,
8860,
29918,
1807,
29897,
13,
13,
1678,
822,
1243,
29918,
2154,
29918,
5453,
29918,
3075,
4080,
29898,
1311,
1125,
13,
4706,
903,
8860,
29918,
1807,
353,
9995,
13,
5215,
4842,
305,
13,
13,
1990,
319,
7355,
29898,
7345,
305,
29889,
29926,
277,
29889,
4081,
7355,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
2428,
29898,
29909,
7355,
29892,
1583,
467,
1649,
2344,
1649,
580,
13,
1678,
732,
7345,
305,
29889,
29926,
277,
29889,
2154,
29918,
5696,
13,
1678,
822,
6375,
29898,
1311,
29892,
1881,
1125,
13,
4706,
1209,
13,
13,
29909,
7355,
580,
13,
2158,
703,
9260,
29876,
29915,
29873,
3183,
3682,
1159,
13,
15945,
29908,
13,
4706,
1583,
29889,
18307,
29918,
17590,
29918,
18279,
7373,
8860,
29918,
1807,
29897,
13,
13,
1678,
822,
1243,
29918,
3757,
25397,
29918,
2154,
29898,
1311,
1125,
13,
4706,
903,
8860,
29918,
1807,
353,
9995,
13,
5215,
4842,
305,
13,
13,
1990,
319,
7355,
29898,
7345,
305,
29889,
15755,
29889,
7355,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
2428,
29898,
29909,
7355,
29892,
1583,
467,
1649,
2344,
1649,
580,
13,
13,
1678,
822,
6375,
29898,
1311,
29892,
1881,
1125,
13,
4706,
1209,
13,
13,
3844,
353,
4842,
305,
29889,
29926,
277,
29889,
2154,
29898,
29909,
7355,
3101,
13,
2158,
703,
9260,
29876,
29915,
29873,
3183,
3682,
1159,
13,
15945,
29908,
13,
4706,
1583,
29889,
18307,
29918,
17590,
29918,
18279,
7373,
8860,
29918,
1807,
29897,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
1065,
29918,
21150,
580,
13,
2
] |
scripts/repo-format.py | vxfury/tabulate | 28 | 195288 | #!/usr/local/bin/python3
# -*- coding: UTF-8 -*-
import os
import re
import sys
import time
import subprocess
import multiprocessing
import git
import typing
import itertools
import argparse
import string
import math
import tty
import ctypes
import termios
import xml.etree.ElementTree as ET
COPYRIGHT = b"""/**
* Copyright 2022 <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
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/\n\n"""
# tqdm has bugs.
# CSI sequence: https://www.liquisearch.com/ansi_escape_code/csi_codes
class ProgressBar:
"""
Progress Bar
...
Attributes
----------
disable: bool
True to disable progress bar (default False)
position: tuple(int, int)
the number of legs the animal has (default 4)
progress: float[0.0, 100.0]
percentage of progress
max_width: int
max width of entire progress bar (default terminal.columns)
bar_width: int
bar width of progress bar (default max_width // 2)
Methods
-------
advance(progress)
Inc progress and refresh display
set_progress(progress)
Set progress and refresh display
set_args(**kwargs)
Set arguments and refresh display
add_args(**kwargs)
Add arguments and refresh display
clear()
Clear display once time
"""
def __init__(
self,
format: str = "{progress} {elapsed} | {bar} | {remaining}",
position: tuple[int, int] = None,
disable: bool = False,
leave: bool = True,
total: float = 100.0,
max_width: int = 0,
bar_width: int = 0,
file=sys.stdout,
keep_cursor_hidden: bool = False,
manager: multiprocessing.Manager = None,
**kwargs,
):
"""
format: progress bar format, internal keys: progress, elapsed, bar, remaining
position: position of bar
disable: True to hide the progress bar
leave: True to leave the progress bar after exit
total: max size to advance
max_width: max width of entire progress bar
bar_width: bar width
file: destination of progress bar (default sys.stdout)
keep_cursor_hidden: True to keep cursor hidden after exit
manager: multiprocessing support
kwargs: custom key-value pairs
"""
self.__file = file
self.__leave = leave
self.__total = total
self.__format = format
self.__kwargs = kwargs
self.__starttime = time.time()
self.__keep_cursor_hidden = keep_cursor_hidden
self.__lock = None if manager is None else manager.Lock()
self.__progress = 0.0 if manager is None else manager.Value(ctypes.c_float, 0.0)
self.disable = disable
self.position = position
self.max_width = max_width if max_width else os.get_terminal_size().columns - 8
self.bar_width = bar_width if bar_width != 0 and bar_width < self.max_width else self.max_width // 2
self.__display() # CSI?25l: Hides the cursor
def __del__(self):
if not self.disable:
outputs = ""
if self.position:
# `CSI n ; m H`: Moves the cursor to row n, column m
outputs += f"\x1B[{self.position[0]};{self.position[1]}H"
if not self.__leave:
# `CSI n k`: Erases part of the line
outputs += "\x1B[2K" # n=2, clear entire line
else:
outputs += "\x1B[E"
if not self.__keep_cursor_hidden:
# `CSI ? 25 h``: Shows the cursor
outputs += "\x1B[?25h"
self.__write(outputs + "\r")
def clear(self):
"""
clear display once time
"""
if not self.disable:
outputs = ""
if self.position:
# `CSI n ; m H`: Moves the cursor to row n, column m
outputs += f"\x1B[{self.position[0]};{self.position[1]}H"
outputs += "\x1B[2K\r" # n=2, clear entire line
self.__write(outputs)
def advance(self, step):
"""
advance progress by <100.0 * step / total>
"""
if self.__lock:
self.__lock.acquire()
last_progress = self.progress
if last_progress != self.__inc_progress(100.0 * step / self.__total):
self.__display()
if self.__lock:
self.__lock.release()
@property
def progress(self):
"""
get progress
"""
if isinstance(self.__progress, float):
return self.__progress
else:
return self.__progress.value
@progress.setter
def progress(self, val):
self.set_progress(val)
def __set_progress(self, progress):
if isinstance(self.__progress, float):
self.__progress = min(progress, 100.0)
return self.__progress
else:
self.__progress.value = min(progress, 100.0)
return self.__progress.value
def __inc_progress(self, progress):
if isinstance(self.__progress, float):
self.__progress = min(self.__progress + progress, 100.0)
return self.__progress
else:
self.__progress.value = min(self.__progress.value + progress, 100.0)
return self.__progress.value
def set_progress(self, progress):
"""
set progress to <progress>
"""
if self.__lock:
self.__lock.acquire()
if self.progress != self.__set_progress(progress):
self.__display()
if self.__lock:
self.__lock.release()
def set_args(self, **kwargs):
if kwargs != self.__kwargs:
self.__kwargs = kwargs
self.__display()
def add_args(self, **kwargs):
self.__kwargs.update(kwargs)
self.__display()
def __display(self):
def format_time(t):
"""
Formats a number of seconds as a clock time, [H:]MM:SS
"""
mins, s = divmod(int(t), 60)
h, m = divmod(mins, 60)
if mins == 0 and t > 0.1 and s == 0:
s = 1
if h:
return "{0:d}:{1:02d}:{2:02d}".format(h, m, s)
else:
return "{0:02d}:{1:02d}".format(m, s)
def format_bar(p, w):
l = int(w * p / 100.0) if p < 99.9 else w
return ">" * l + " " * (w - l)
def format_all(format, **kwargs):
class BlankFormatter(string.Formatter):
def __init__(self, default=""):
self.default = default
def get_value(self, key, args, kwds):
if isinstance(key, str):
return kwds.get(key, self.default)
else:
return string.Formatter.get_value(key, args, kwds)
text = BlankFormatter().format(format, **kwargs).rstrip()
while text.endswith(":"):
text = text[: len(text) - 1].rstrip()
return text
if not self.disable:
now = time.time()
self.__kwargs["progress"] = "{0:5.1f}%".format(self.progress)
self.__kwargs["bar"] = format_bar(self.progress, self.bar_width)
self.__kwargs["elapsed"] = format_time(now - self.__starttime)
self.__kwargs["remaining"] = (
format_time((now - self.__starttime) * (100 - self.progress) / self.progress)
if self.progress
else "--:--"
)
outputs = "\x1B[?25l"
if self.position:
# `CSIn;mH`: Moves the cursor to row n, column m
outputs += f"\x1B[s\x1B[{self.position[0]};{self.position[1]}H"
else:
outputs += "\r"
line = format_all(self.__format, **self.__kwargs)
if self.max_width != 0:
if len(line) > self.max_width:
truncated = "..."
if self.max_width >= len(truncated):
line = line[: (self.max_width - len(truncated))] + truncated + "\x1b[0m"
else:
line = line[: self.max_width] + "\x1b[0m"
outputs += line + "\x1B[0K"
if self.position:
outputs += "\x1B[u"
self.__write(outputs)
def __write(self, str):
file = self.__file if self.__file else sys.stdout
file.write(str)
file.flush()
@staticmethod
def getpos():
buf = ""
stdin = sys.stdin.fileno()
tattr = termios.tcgetattr(stdin)
try:
tty.setcbreak(stdin, termios.TCSANOW)
sys.stdout.write("\x1b[6n")
sys.stdout.flush()
while True:
buf += sys.stdin.read(1)
if buf[-1] == "R":
break
finally:
termios.tcsetattr(stdin, termios.TCSANOW, tattr)
# reading the actual values, but what if a keystroke appears while reading
# from stdin? As dirty work around, getpos() returns if this fails: None
try:
matches = re.match(r"^\x1b\[(\d*);(\d*)R", buf)
groups = matches.groups()
except AttributeError:
return None
return (int(groups[0]), int(groups[1]))
class ProgressBars:
def __init__(
self,
format,
size,
max_width=os.get_terminal_size().columns,
bar_width=0,
disable=False,
leave=False,
initial_pos=None,
overall_total=0,
manager: multiprocessing.Manager = None,
):
offset = 0
if overall_total != 0:
self.overall = ProgressBar(
leave=True,
disable=disable,
total=overall_total,
file=None,
max_width=max_width,
bar_width=bar_width,
position=initial_pos,
keep_cursor_hidden=True,
manager=manager,
)
offset = 1
else:
self.overall = None
self.bars = [
ProgressBar(
format,
disable=disable,
file=None,
max_width=max_width,
bar_width=bar_width,
leave=True, # keep bar if not all bars end
position=((initial_pos[0] + i), initial_pos[1]) if initial_pos else None,
keep_cursor_hidden=True,
manager=manager,
)
for i in range(offset, size + offset)
]
self.__leave = leave
self.disable = disable
self.initial_pos = initial_pos
def __del__(self):
off = 0 if self.overall is None else 1
if self.__leave:
off += len(self.bars)
self.bars = []
else:
[bar.clear() for bar in self.bars]
if not self.disable:
outputs = ""
if self.initial_pos:
# `CSI n ; m H`: Moves the cursor to row n, column m
outputs += f"\x1B[2K\x1B[{self.initial_pos[0] + off};{self.initial_pos[1]}H"
outputs += "\x1B[?25h"
sys.stdout.write(outputs)
sys.stdout.flush()
def __getitem__(self, index):
return self.bars[index % len(self.bars)]
"""a replacement instance within a single file"""
class Replacement:
def __init__(self, offset, length, content, path=None):
self.offset = offset
self.length = length
self.content = content
self.path = path
def __hash__(self):
return hash((self.offset, self.length))
def __eq__(self, other):
return (self.offset, self.length) == (other.offset, other.length)
def __repr__(self):
return f"offset={self.offset} " f"length={self.length} content={self.content}"
def get_affected_commit(self, file, repo: git.Repo, blame_info, bar: ProgressBar):
def offset_to_line(file, offset):
file.seek(0)
content = file.read(offset)
return content.decode("utf-8", "ignore").count("\n") + 1
def map_of_line_commit(blame_info):
result = {}
current_line = 0
for one_blame in blame_info:
for one_line in one_blame[1]:
current_line += 1
result[current_line] = one_blame
return result
first_line_offset = offset_to_line(file, self.offset)
last_line_offset = offset_to_line(file, max(self.offset, self.offset + self.length - 1))
# fetch blame information for this replacement.
original_blames = []
line_commit_map = map_of_line_commit(blame_info)
for i in range(first_line_offset, last_line_offset + 1):
if i >= len(line_commit_map):
# apply blame of first line if out of range, the last line mostly
original_blames.append(line_commit_map[1][0])
continue
if line_commit_map[i][0] not in original_blames:
original_blames.append(line_commit_map[i][0])
if len(original_blames) > 1 and original_blames[0].author != original_blames[1].author:
bar.add_args(
desc=f"\x1B[33m{first_line_offset}-{last_line_offset} modified by {list(map(lambda b: str(b.author), original_blames))}. regard as modified by {original_blames[-1].author}\x1B[0m"
)
return original_blames[-1]
"""apply replacement onto file."""
def apply(self, file):
# seek to offset + length where content is untouched by self
file.seek(self.offset + self.length)
# read till the EOF
b = file.read()
# then insert 'content' at the start and write back
file.seek(self.offset)
file.write(self.content + b)
# truncate unnecessary content in case content is shorter than origin
file.truncate()
def _filter_trivial_blame(self, blame):
for line in blame[1]:
if not line.isspace() and len(line) and not self.filter_trivial_line(line):
return True
return False
"""tells base class if given source line is considered trivial"""
def filter_trivial_line(self, line):
return False
class ReplacementGenerator:
"""generates replacements for a file."""
def generate(self, file, *args, **kwargs) -> typing.List[Replacement]:
pass
class ClangFormatReplacement(Replacement):
trivial_line_pattern = re.compile(r"^[\{\}\[\]\(\);]+$")
def filter_trivial_line(self, line):
# in C-like languages, braces ({}), brackets ([]), parentheses (())
# and semicolon (;) are often arranged into a single line in favor of
# some codestyles, on which blame infomation is usually useless.
l = line.translate(dict.fromkeys(map(ord, string.whitespace)))
return self.__class__.trivial_line_pattern.match(l)
class ClangFormatXMLReplacementGenerator(ReplacementGenerator):
def generate(self, file, bar: ProgressBar) -> typing.List[Replacement]:
file.seek(0, os.SEEK_END)
size = file.tell()
bar.add_args(desc="generate clang-format XML replacements ...")
output = subprocess.check_output(
("clang-format", "--output-replacements-xml", "--style=file", file.name)
).decode("utf-8")
bar.set_progress(100 * (1024 + size * 2 / 4) / (1024 + size + 4096))
def add_copyrigth_auto(file, result):
file.seek(0)
if len(COPYRIGHT) > 0 and b"Copyright" not in file.read(300):
if len(result) > 0 and result[0].offset == 0:
result[0].content = COPYRIGHT + result[0].content
else:
r = ClangFormatReplacement(0, 0, COPYRIGHT)
result.insert(0, r)
result = []
xml_root = ET.fromstring(output)
for r in xml_root.iterfind("replacement"):
offset = int(r.get("offset"))
length = int(r.get("length"))
byte_content = bytes(r.text or "", encoding="utf-8")
bar.add_args(desc=f"replacement of lines {offset}-{offset + length}")
bar.set_progress(100 * (1024 + (offset + length) * 3 / 5) / (1024 + size + 4096))
# clang-format produces replacements overlapped with original text, which results in
# multi-commit blame results. remove overlapped areas for better result.
i = len(byte_content)
if i > 0:
i = i - 1
file.seek(offset + length - 1)
while i >= 0 and length > 0 and file.read(1)[0] == byte_content[i]:
i = i - 1
length = length - 1
file.seek(offset + length - 1)
byte_content = byte_content[: i + 1]
i = 0
file.seek(offset)
while i < len(byte_content) and length > 0 and file.read(1)[0] == byte_content[i]:
i = i + 1
length = length - 1
offset = offset + 1
file.seek(offset)
byte_content = byte_content[i:]
result.append(ClangFormatReplacement(offset, length, byte_content))
add_copyrigth_auto(file, result)
bar.set_progress(100 * (1024 + size * 3 / 5) / (1024 + size + 4096))
return result
# binary search
def binary_search(arr, comparator):
return _binary_search(arr, 0, len(arr) - 1, comparator)
def _binary_search(arr, l, r, comparator):
if r < l:
return -1
mid = int(l + (r - l) / 2)
compare = comparator(arr[mid])
if compare == 0:
return mid
elif compare < 0:
return _binary_search(arr, l, mid - 1, comparator)
else:
return _binary_search(arr, mid + 1, r, comparator)
def generate_replacements(repo: git.Repo, path, limit, bar: ProgressBar, overall_bar: ProgressBar):
replacements_by_paths = {}
replacements_by_affected_commits = {}
bar.set_args(
file=f"{os.path.relpath(path, os.path.dirname(repo.common_dir) if repo else os.getcwd())}",
desc="...",
)
try:
size = os.path.getsize(path)
if size > limit * 1024:
bar.add_args(desc=f"\x1B[33m{size // 1024}KB, more than {limit} KB, skipped\x1B[0m")
return None, None
if size <= 1:
bar.add_args(desc=f"\x1B[33mempty file, skipped\x1B[0m")
return None, None
bar.set_progress(100 * 1024 / (1024 + size / 4096))
with open(path, mode="rb") as file:
bar.add_args(desc=f"generate replacements")
replacements_for_cur_file = ClangFormatXMLReplacementGenerator().generate(file, bar=bar)
if not replacements_for_cur_file:
bar.add_args(desc=f"no replacements found")
return None, None
replacements_for_cur_file.sort(key=lambda r: r.offset)
replacements_by_paths[path] = replacements_for_cur_file
if repo:
try:
blame_info = repo.blame(repo.head.commit, file.name)
except git.exc.GitCommandError as e:
if "is outside repository" in e.stderr:
# file not in repository, ignore
bar.add_args(desc="outside repository")
return replacements_by_paths, None
else:
return replacements_by_paths, None
# fetch blame information for each replacement,
# then make a <affected_commits> -> <replacements> map.
for r in replacements_for_cur_file:
r.path = path
affected_commit = r.get_affected_commit(file, repo, blame_info, bar)
# affected_commits = blame_result[1] if len(blame_result[1]) else blame_result[0]
# affected_commits = list(map(lambda b: b[0].binsha.hex(), affected_commits))
affected_commit = affected_commit.binsha.hex()
replacements = replacements_by_affected_commits.get(affected_commit, [])
replacements.append(r)
replacements_by_affected_commits[affected_commit] = replacements
except PermissionError as e:
bar.add_args(desc=f"\x1B[33mpermission denied, skipped\x1B[0m")
finally:
overall_bar.advance(1)
bar.set_progress(100.0)
return (
replacements_by_paths,
replacements_by_affected_commits if len(replacements_by_affected_commits) != 0 else None,
)
def repo_format_main(initial_pos):
starttime = time.time()
# arguments parser
parser = argparse.ArgumentParser(
description="Generate and apply replacements for existing Git "
"repository, without altering future blame results"
)
parser.add_argument("--repo", required=False, help="path to git repository, sub-path is acceptable")
parser.add_argument("--path", required=False, help="path to format, default is path to repo")
parser.add_argument("--exclude", required=False, help="directory don't format")
parser.add_argument("--no-commit", "-n", action="store_true", help="no commit, just format file")
parser.add_argument("--copyright", required=False, help="copyright")
parser.add_argument(
"--dry-run",
required=False,
default=False,
action="store_true",
help="calculate files those will be formated but no formating actually",
)
parser.add_argument(
"--jobs", "-j", required=False, default=multiprocessing.cpu_count(), help="jobs to do formatting"
)
parser.add_argument("--limit", required=False, default=256, help="max KB of file to format")
parser.add_argument(
"--quiet",
required=False,
default=False,
action="store_true",
help="quiet mode",
)
parser.add_argument("--author", required=False, default=os.getlogin(), help="author for unkown commits")
parser.add_argument(
"--filter-by-author", required=False, default=None, help="only format commits by specified author"
)
# BEGIN OF MAIN: validate given arguments.
args = parser.parse_args()
if args.copyright is not None:
COPYRIGHT = args.copyright
repo = git.Repo(args.repo, search_parent_directories=True) if args.repo else None
format_path = os.path.expanduser(args.repo if args.path is None else args.path)
if not os.path.isabs(format_path):
format_path = os.path.join(os.getcwd(), format_path)
files = []
if os.path.isdir(format_path):
for root, dirs, file_list in os.walk(format_path):
def need_exclude(root, excludes):
for dir in excludes:
if os.path.abspath(os.path.join(format_path, dir)).startswith(
os.path.abspath(os.path.expanduser(root))
):
return True
return False
if args.exclude and need_exclude(root, args.exclude.split(",")):
# print(f"Exclude {root}, {args.exclude}")
continue
for filename in file_list:
if filename.endswith((".cpp", ".cc", ".h", ".hpp", ".c")):
files.append(os.path.join(root, filename))
elif os.path.isfile(format_path):
files.append(format_path)
# process files specified in arguments. new commits will be created during processing,
# so we cache current head for accurate blaming results.
with multiprocessing.Pool(processes=int(args.jobs)) as pool:
manager = multiprocessing.Manager()
size = min(int(args.jobs), multiprocessing.cpu_count() // 2, len(files))
bars = ProgressBars(
"{progress} {elapsed} | {file}: {desc}",
size,
leave=False,
disable=bool(args.quiet),
initial_pos=(initial_pos[0] + 1, initial_pos[1]),
overall_total=len(files),
manager=manager,
)
results = pool.starmap_async(
generate_replacements,
[(repo, path, int(args.limit), bars[i], bars.overall) for i, path in enumerate(files)],
).get()
pool.close()
pool.join()
del bars # delete bars for elegant print
replacements_by_paths = {}
replacements_by_paths_only = {}
replacements_by_affected_commits = {}
for replacements_by_path, replacements_by_affected_commit in results:
if replacements_by_path and replacements_by_affected_commit is None:
replacements_by_paths_only.update(replacements_by_path)
else:
if replacements_by_path:
replacements_by_paths.update(replacements_by_path)
if replacements_by_affected_commit:
for affected_commit in replacements_by_affected_commit.keys():
if not affected_commit in replacements_by_affected_commits.keys():
replacements_by_affected_commits[affected_commit] = []
replacements_by_affected_commits[affected_commit].extend(
replacements_by_affected_commit[affected_commit]
)
if repo and not args.dry_run:
# combine affected commits with same author.
replacements_by_authors = {}
affected_commits_by_authors = {}
for commit_hex, replacements in replacements_by_affected_commits.items():
first_commit = repo.commit(commit_hex)
author = first_commit.author
affected_commits = affected_commits_by_authors.get(author, set())
affected_commits.add(commit_hex)
affected_commits_by_authors[author] = affected_commits
for author, commits_by_author in affected_commits_by_authors.items():
affected_commits = set()
replacements = []
if args.filter_by_author and author != author:
continue
for one_commit in commits_by_author:
affected_commits.add(one_commit)
replacements.extend(replacements_by_affected_commits[one_commit])
replacements_by_authors[tuple(affected_commits)] = replacements
# apply replacements, one affected commit(s) by one.
for commits, replacements in replacements_by_authors.items():
file_paths = set()
for r in replacements:
with open(r.path, mode="rb+") as file:
r.apply(file)
file_paths.add(file.name)
length_delta = len(r.content) - r.length
replacements_in_same_file = replacements_by_paths[r.path]
if length_delta != 0 and len(replacements_in_same_file):
# apply replacement each time, and adjuest offset of replacements after it
index = binary_search(replacements_in_same_file, lambda re: r.offset - re.offset)
for re in itertools.islice(replacements_in_same_file, index, None):
re.offset = re.offset + length_delta
# remove current replacement for future better search performance.
del replacements_in_same_file[index]
replacements_by_paths[r.path] = replacements_in_same_file
if not args.no_commit and len(file_paths) != 0:
repo.index.add(file_paths, False)
# done with current commit, make new one
first_commit = repo.commit(commits[0])
# multiple commits are affected:
# lossless replacement is impossible (automatically).
# explicitly create a new commit and try to retain infomation
# from original commits as much as possible.
commit_msg = f"repo-format: reformat and keep blame info"
repo.index.commit(commit_msg, author=first_commit.author)
if not args.dry_run and replacements_by_paths_only:
file_paths = set(replacements_by_paths_only.keys())
for path, replacements in replacements_by_paths_only.items():
for r in replacements:
with open(path, mode="rb+") as file:
r.apply(file)
file_paths.add(file.name)
length_delta = len(r.content) - r.length
replacements_in_same_file = replacements_by_paths_only[path]
if length_delta != 0 and len(replacements_in_same_file):
# apply replacement each time, and adjuest offset of replacements after it
index = binary_search(replacements_in_same_file, lambda re: r.offset - re.offset)
for re in itertools.islice(replacements_in_same_file, index, None):
re.offset = re.offset + length_delta
# remove current replacement for future better search performance.
del replacements_in_same_file[index]
replacements_by_paths[path] = replacements_in_same_file
if repo and not args.no_commit and len(file_paths) != 0:
repo.index.add(file_paths, False)
commit_msg = f"repo-format: format uncommit codes"
repo.git.commit("-m", commit_msg, author=args.author)
print(
f"Time elapsed: {round(time.time() - starttime, 2)} s."
+ f" {len(list(filter(lambda r: r[0] is not None, results)))} of {len(files)} file(s) "
+ ("can be formatted." if args.dry_run else "formatted.")
)
import random
def progress_bar_main():
bar = ProgressBar(leave=True, widht=90, total=500, bar_width=60)
for i in range(0, 500):
bar.advance(1)
time.sleep(0.005)
def progress_bar_test(length, bar, overall_bar):
remain = length
while remain > 0:
len = random.randint(0, remain)
remain -= len
time.sleep(0.001)
bar.set_progress(100 * (length - remain) / length)
overall_bar.advance(1)
def progress_bars_main(initial_pos):
manager = multiprocessing.Manager()
with multiprocessing.Pool(processes=6) as pool:
size = 3
total = 10000
initial_pos = initial_pos
bars = ProgressBars(
"{progress} {elapsed} | {bar} | {remaining}",
size,
leave=True,
initial_pos=(initial_pos[0] + 1, initial_pos[1]),
overall_total=total,
manager=manager,
)
pool.starmap_async(
progress_bar_test,
[(random.randint(1000, 10000), bars[i], bars.overall) for i in range(total)],
).get()
pool.close()
pool.join()
if __name__ == "__main__":
initial_pos = ProgressBar.getpos()
# initial_pos = (initial_pos[0] - 1, initial_pos[1])
repo_format_main(initial_pos)
# progress_bar_main()
# progress_bars_main(initial_pos)
""" .clang-format
---
Language: Cpp
AccessModifierOffset: '-2'
AlignAfterOpenBracket: Align
AlignConsecutiveMacros: 'true'
AlignConsecutiveAssignments: 'false'
AlignConsecutiveDeclarations: 'false'
AlignEscapedNewlines: Left
AlignOperands: 'true'
AlignTrailingComments: 'true'
AllowAllArgumentsOnNextLine: 'true'
AllowAllConstructorInitializersOnNextLine: 'true'
AllowAllParametersOfDeclarationOnNextLine: 'true'
AllowShortBlocksOnASingleLine: 'false'
AllowShortCaseLabelsOnASingleLine: 'false'
AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: WithoutElse
AllowShortLambdasOnASingleLine: None
AllowShortLoopsOnASingleLine: 'true'
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: 'false'
AlwaysBreakTemplateDeclarations: 'Yes'
BinPackArguments: 'true'
BinPackParameters: 'true'
BraceWrapping:
AfterCaseLabel: 'false'
AfterClass: 'false'
AfterControlStatement: 'false'
AfterEnum: 'false'
AfterFunction: 'true'
AfterNamespace: 'true'
AfterObjCDeclaration: 'false'
AfterStruct: 'false'
AfterUnion: 'false'
AfterExternBlock: 'false'
BeforeCatch: 'false'
BeforeElse: 'false'
IndentBraces: 'false'
SplitEmptyFunction: 'true'
SplitEmptyRecord: 'true'
SplitEmptyNamespace: 'true'
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeBraces: Custom
BreakBeforeTernaryOperators: 'true'
BreakConstructorInitializers: BeforeColon
BreakInheritanceList: BeforeColon
BreakStringLiterals: 'true'
ColumnLimit: '120'
CompactNamespaces: 'false'
ConstructorInitializerAllOnOneLineOrOnePerLine: 'true'
ConstructorInitializerIndentWidth: '4'
ContinuationIndentWidth: '4'
Cpp11BracedListStyle: 'true'
DerivePointerAlignment: 'false'
DisableFormat: 'false'
ExperimentalAutoDetectBinPacking: 'false'
FixNamespaceComments: 'true'
ForEachMacros: ['foreach', 'FOREACH', 'RANGES_FOR', 'hlist_for_each_entry_continue', 'hlist_for_each_entry', 'hlist_for_each_entry_from', 'hlist_for_each_entry_safe', 'hlist_for_each_safe', 'list_for_each_entry', 'list_for_each_entry_continue', 'list_for_each_entry_continue_reverse', 'list_for_each_entry_from', 'list_for_each_entry_reverse', 'list_for_each_entry_safe', 'list_for_each_entry_safe_continue', 'list_for_each_entry_safe_from', 'list_for_each_entry_safe_reverse', 'list_for_each_from', 'list_for_each_prev', 'list_for_each_prev_safe', 'list_for_each_safe']
TypenameMacros: ['STACK_OF', 'LIST']
IncludeBlocks: Regroup
IncludeIsMainRegex: '([-_](test|unittest))?$'
IndentCaseLabels: 'true'
IndentPPDirectives: None
IndentWidth: '4'
IndentWrappedFunctionNames: 'false'
KeepEmptyLinesAtTheStartOfBlocks: 'false'
MaxEmptyLinesToKeep: '3'
NamespaceIndentation: None
PenaltyBreakAssignment: '2'
PenaltyBreakBeforeFirstCallParameter: '1'
PenaltyBreakComment: '300'
PenaltyBreakFirstLessLess: '120'
PenaltyBreakString: '1000'
PenaltyBreakTemplateDeclaration: '10'
PenaltyExcessCharacter: '1000000'
PenaltyReturnTypeOnItsOwnLine: '500'
PointerAlignment: Right
RawStringFormats:
- Language: Cpp
Delimiters:
- 'cc'
- 'CC'
- 'cpp'
- 'Cpp'
- 'CPP'
- 'c++'
- 'C++'
CanonicalDelimiter: ''
BasedOnStyle: google
- Language: TextProto
Delimiters:
- 'pb'
- 'PB'
- 'proto'
- 'PROTO'
EnclosingFunctions:
- EqualsProto
- EquivToProto
- PARSE_PARTIAL_TEXT_PROTO
- PARSE_TEST_PROTO
- PARSE_TEXT_PROTO
- ParseTextOrDie
- ParseTextProtoOrDie
CanonicalDelimiter: ''
BasedOnStyle: google
ReflowComments: 'true'
SortIncludes: 'false'
SortUsingDeclarations: 'false'
SpaceAfterCStyleCast: 'false'
SpaceAfterLogicalNot: 'false'
SpaceAfterTemplateKeyword: 'true'
SpaceBeforeAssignmentOperators: 'true'
SpaceBeforeCpp11BracedList: 'false'
SpaceBeforeCtorInitializerColon: 'true'
SpaceBeforeInheritanceColon: 'true'
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: 'true'
SpaceInEmptyParentheses: 'false'
SpacesBeforeTrailingComments: '1'
SpacesInAngles: 'false'
SpacesInCStyleCastParentheses: 'false'
SpacesInContainerLiterals: 'false'
SpacesInParentheses: 'false'
SpacesInSquareBrackets: 'false'
Standard: Auto
StatementMacros: ['__maybe_unused']
TabWidth: '4'
UseTab: Never
...
"""
| [
1,
18787,
4855,
29914,
2997,
29914,
2109,
29914,
4691,
29941,
13,
29937,
448,
29930,
29899,
14137,
29901,
18351,
29899,
29947,
448,
29930,
29899,
13,
13,
5215,
2897,
13,
5215,
337,
13,
5215,
10876,
13,
5215,
931,
13,
5215,
1014,
5014,
13,
5215,
6674,
307,
985,
292,
13,
5215,
6315,
13,
5215,
19229,
13,
5215,
4256,
8504,
13,
5215,
1852,
5510,
13,
5215,
1347,
13,
5215,
5844,
13,
5215,
260,
1017,
13,
5215,
274,
8768,
13,
5215,
1840,
2363,
13,
5215,
4903,
29889,
300,
929,
29889,
2642,
9643,
408,
382,
29911,
13,
13,
3217,
20055,
22789,
3912,
353,
289,
15945,
29908,
7918,
13,
334,
14187,
1266,
29871,
29906,
29900,
29906,
29906,
529,
5813,
5961,
29966,
26862,
6227,
12948,
13,
334,
13,
334,
10413,
21144,
1090,
278,
13380,
19245,
29892,
10079,
29871,
29906,
29889,
29900,
313,
1552,
376,
29931,
293,
1947,
1496,
13,
334,
366,
1122,
451,
671,
445,
934,
5174,
297,
752,
13036,
411,
278,
19245,
29889,
13,
334,
887,
1122,
4017,
263,
3509,
310,
278,
19245,
472,
13,
334,
13,
334,
418,
2045,
597,
1636,
29889,
4288,
29889,
990,
29914,
506,
11259,
29914,
27888,
1430,
1660,
29899,
29906,
29889,
29900,
13,
334,
13,
334,
25870,
3734,
491,
22903,
4307,
470,
15502,
304,
297,
5007,
29892,
7047,
13,
334,
13235,
1090,
278,
19245,
338,
13235,
373,
385,
376,
3289,
8519,
29908,
350,
3289,
3235,
29892,
13,
334,
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,
334,
2823,
278,
19245,
363,
278,
2702,
4086,
14765,
1076,
11239,
322,
13,
334,
27028,
1090,
278,
19245,
29889,
13,
3776,
29905,
29876,
29905,
29876,
15945,
29908,
13,
13,
13,
29937,
260,
29939,
18933,
756,
24557,
29889,
13,
29937,
315,
5425,
5665,
29901,
2045,
597,
1636,
29889,
492,
7680,
2842,
29889,
510,
29914,
550,
29875,
29918,
21587,
29918,
401,
29914,
29883,
1039,
29918,
18137,
13,
1990,
20018,
4297,
29901,
13,
1678,
9995,
13,
1678,
20018,
2261,
13,
13,
1678,
2023,
13,
13,
1678,
6212,
5026,
13,
1678,
448,
1378,
29899,
13,
1678,
11262,
29901,
6120,
13,
4706,
5852,
304,
11262,
6728,
2594,
313,
4381,
7700,
29897,
13,
1678,
2602,
29901,
18761,
29898,
524,
29892,
938,
29897,
13,
4706,
278,
1353,
310,
21152,
278,
13019,
756,
313,
4381,
29871,
29946,
29897,
13,
1678,
6728,
29901,
5785,
29961,
29900,
29889,
29900,
29892,
29871,
29896,
29900,
29900,
29889,
29900,
29962,
13,
4706,
19649,
310,
6728,
13,
1678,
4236,
29918,
2103,
29901,
938,
13,
4706,
4236,
2920,
310,
4152,
6728,
2594,
313,
4381,
8638,
29889,
13099,
29897,
13,
1678,
2594,
29918,
2103,
29901,
938,
13,
4706,
2594,
2920,
310,
6728,
2594,
313,
4381,
4236,
29918,
2103,
849,
29871,
29906,
29897,
13,
13,
1678,
8108,
29879,
13,
1678,
448,
22158,
13,
1678,
6564,
29898,
18035,
29897,
13,
4706,
9266,
6728,
322,
11086,
2479,
13,
1678,
731,
29918,
18035,
29898,
18035,
29897,
13,
4706,
3789,
6728,
322,
11086,
2479,
13,
1678,
731,
29918,
5085,
29898,
1068,
19290,
29897,
13,
4706,
3789,
6273,
322,
11086,
2479,
13,
1678,
788,
29918,
5085,
29898,
1068,
19290,
29897,
13,
4706,
3462,
6273,
322,
11086,
2479,
13,
1678,
2821,
580,
13,
4706,
17732,
2479,
2748,
931,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
13,
4706,
1583,
29892,
13,
4706,
3402,
29901,
851,
353,
29850,
18035,
29913,
426,
295,
28170,
29913,
891,
426,
1646,
29913,
891,
426,
1745,
17225,
17671,
13,
4706,
2602,
29901,
18761,
29961,
524,
29892,
938,
29962,
353,
6213,
29892,
13,
4706,
11262,
29901,
6120,
353,
7700,
29892,
13,
4706,
5967,
29901,
6120,
353,
5852,
29892,
13,
4706,
3001,
29901,
5785,
353,
29871,
29896,
29900,
29900,
29889,
29900,
29892,
13,
4706,
4236,
29918,
2103,
29901,
938,
353,
29871,
29900,
29892,
13,
4706,
2594,
29918,
2103,
29901,
938,
353,
29871,
29900,
29892,
13,
4706,
934,
29922,
9675,
29889,
25393,
29892,
13,
4706,
3013,
29918,
18127,
29918,
10892,
29901,
6120,
353,
7700,
29892,
13,
4706,
8455,
29901,
6674,
307,
985,
292,
29889,
3260,
353,
6213,
29892,
13,
4706,
3579,
19290,
29892,
13,
268,
1125,
13,
4706,
9995,
13,
4706,
3402,
29901,
6728,
2594,
3402,
29892,
7463,
6611,
29901,
6728,
29892,
560,
28170,
29892,
2594,
29892,
9886,
13,
4706,
2602,
29901,
2602,
310,
2594,
13,
4706,
11262,
29901,
5852,
304,
9563,
278,
6728,
2594,
13,
4706,
5967,
29901,
5852,
304,
5967,
278,
6728,
2594,
1156,
6876,
13,
4706,
3001,
29901,
4236,
2159,
304,
6564,
13,
4706,
4236,
29918,
2103,
29901,
4236,
2920,
310,
4152,
6728,
2594,
13,
4706,
2594,
29918,
2103,
29901,
2594,
2920,
13,
4706,
934,
29901,
12551,
310,
6728,
2594,
313,
4381,
10876,
29889,
25393,
29897,
13,
4706,
3013,
29918,
18127,
29918,
10892,
29901,
5852,
304,
3013,
10677,
7934,
1156,
6876,
13,
4706,
8455,
29901,
6674,
307,
985,
292,
2304,
13,
4706,
9049,
5085,
29901,
2888,
1820,
29899,
1767,
11000,
13,
4706,
9995,
13,
4706,
1583,
17255,
1445,
353,
934,
13,
4706,
1583,
17255,
280,
1351,
353,
5967,
13,
4706,
1583,
17255,
7827,
353,
3001,
13,
4706,
1583,
17255,
4830,
353,
3402,
13,
4706,
1583,
17255,
19290,
353,
9049,
5085,
13,
4706,
1583,
17255,
2962,
2230,
353,
931,
29889,
2230,
580,
13,
4706,
1583,
17255,
17462,
29918,
18127,
29918,
10892,
353,
3013,
29918,
18127,
29918,
10892,
13,
4706,
1583,
17255,
908,
353,
6213,
565,
8455,
338,
6213,
1683,
8455,
29889,
16542,
580,
13,
4706,
1583,
17255,
18035,
353,
29871,
29900,
29889,
29900,
565,
8455,
338,
6213,
1683,
8455,
29889,
1917,
29898,
312,
7384,
29889,
29883,
29918,
7411,
29892,
29871,
29900,
29889,
29900,
29897,
13,
13,
4706,
1583,
29889,
20472,
353,
11262,
13,
4706,
1583,
29889,
3283,
353,
2602,
13,
4706,
1583,
29889,
3317,
29918,
2103,
353,
4236,
29918,
2103,
565,
4236,
29918,
2103,
1683,
2897,
29889,
657,
29918,
8489,
979,
29918,
2311,
2141,
13099,
448,
29871,
29947,
13,
4706,
1583,
29889,
1646,
29918,
2103,
353,
2594,
29918,
2103,
565,
2594,
29918,
2103,
2804,
29871,
29900,
322,
2594,
29918,
2103,
529,
1583,
29889,
3317,
29918,
2103,
1683,
1583,
29889,
3317,
29918,
2103,
849,
29871,
29906,
13,
13,
4706,
1583,
17255,
4990,
580,
29871,
396,
315,
5425,
29973,
29906,
29945,
29880,
29901,
379,
2247,
278,
10677,
13,
13,
1678,
822,
4770,
6144,
12035,
1311,
1125,
13,
4706,
565,
451,
1583,
29889,
20472,
29901,
13,
9651,
14391,
353,
5124,
13,
9651,
565,
1583,
29889,
3283,
29901,
13,
18884,
396,
421,
29907,
5425,
302,
2056,
286,
379,
6998,
14104,
267,
278,
10677,
304,
1948,
302,
29892,
1897,
286,
13,
18884,
14391,
4619,
285,
26732,
29916,
29896,
29933,
19660,
1311,
29889,
3283,
29961,
29900,
29962,
3400,
29912,
1311,
29889,
3283,
29961,
29896,
12258,
29950,
29908,
13,
9651,
565,
451,
1583,
17255,
280,
1351,
29901,
13,
18884,
396,
421,
29907,
5425,
302,
413,
6998,
1425,
2129,
760,
310,
278,
1196,
13,
18884,
14391,
4619,
6634,
29916,
29896,
29933,
29961,
29906,
29968,
29908,
29871,
396,
302,
29922,
29906,
29892,
2821,
4152,
1196,
13,
9651,
1683,
29901,
13,
18884,
14391,
4619,
6634,
29916,
29896,
29933,
29961,
29923,
29908,
13,
9651,
565,
451,
1583,
17255,
17462,
29918,
18127,
29918,
10892,
29901,
13,
18884,
396,
421,
29907,
5425,
1577,
29871,
29906,
29945,
298,
29952,
6998,
1383,
1242,
278,
10677,
13,
18884,
14391,
4619,
6634,
29916,
29896,
29933,
29961,
29973,
29906,
29945,
29882,
29908,
13,
9651,
1583,
17255,
3539,
29898,
4905,
29879,
718,
6634,
29878,
1159,
13,
13,
1678,
822,
2821,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
2821,
2479,
2748,
931,
13,
4706,
9995,
13,
4706,
565,
451,
1583,
29889,
20472,
29901,
13,
9651,
14391,
353,
5124,
13,
9651,
565,
1583,
29889,
3283,
29901,
13,
18884,
396,
421,
29907,
5425,
302,
2056,
286,
379,
6998,
14104,
267,
278,
10677,
304,
1948,
302,
29892,
1897,
286,
13,
18884,
14391,
4619,
285,
26732,
29916,
29896,
29933,
19660,
1311,
29889,
3283,
29961,
29900,
29962,
3400,
29912,
1311,
29889,
3283,
29961,
29896,
12258,
29950,
29908,
13,
9651,
14391,
4619,
6634,
29916,
29896,
29933,
29961,
29906,
29968,
29905,
29878,
29908,
29871,
396,
302,
29922,
29906,
29892,
2821,
4152,
1196,
13,
9651,
1583,
17255,
3539,
29898,
4905,
29879,
29897,
13,
13,
1678,
822,
6564,
29898,
1311,
29892,
4331,
1125,
13,
4706,
9995,
13,
4706,
6564,
6728,
491,
529,
29896,
29900,
29900,
29889,
29900,
334,
4331,
847,
3001,
29958,
13,
4706,
9995,
13,
4706,
565,
1583,
17255,
908,
29901,
13,
9651,
1583,
17255,
908,
29889,
562,
1548,
580,
13,
4706,
1833,
29918,
18035,
353,
1583,
29889,
18035,
13,
4706,
565,
1833,
29918,
18035,
2804,
1583,
17255,
3742,
29918,
18035,
29898,
29896,
29900,
29900,
29889,
29900,
334,
4331,
847,
1583,
17255,
7827,
1125,
13,
9651,
1583,
17255,
4990,
580,
13,
4706,
565,
1583,
17255,
908,
29901,
13,
9651,
1583,
17255,
908,
29889,
14096,
580,
13,
13,
1678,
732,
6799,
13,
1678,
822,
6728,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
679,
6728,
13,
4706,
9995,
13,
4706,
565,
338,
8758,
29898,
1311,
17255,
18035,
29892,
5785,
1125,
13,
9651,
736,
1583,
17255,
18035,
13,
4706,
1683,
29901,
13,
9651,
736,
1583,
17255,
18035,
29889,
1767,
13,
13,
1678,
732,
18035,
29889,
842,
357,
13,
1678,
822,
6728,
29898,
1311,
29892,
659,
1125,
13,
4706,
1583,
29889,
842,
29918,
18035,
29898,
791,
29897,
13,
13,
1678,
822,
4770,
842,
29918,
18035,
29898,
1311,
29892,
6728,
1125,
13,
4706,
565,
338,
8758,
29898,
1311,
17255,
18035,
29892,
5785,
1125,
13,
9651,
1583,
17255,
18035,
353,
1375,
29898,
18035,
29892,
29871,
29896,
29900,
29900,
29889,
29900,
29897,
13,
9651,
736,
1583,
17255,
18035,
13,
4706,
1683,
29901,
13,
9651,
1583,
17255,
18035,
29889,
1767,
353,
1375,
29898,
18035,
29892,
29871,
29896,
29900,
29900,
29889,
29900,
29897,
13,
9651,
736,
1583,
17255,
18035,
29889,
1767,
13,
13,
1678,
822,
4770,
3742,
29918,
18035,
29898,
1311,
29892,
6728,
1125,
13,
4706,
565,
338,
8758,
29898,
1311,
17255,
18035,
29892,
5785,
1125,
13,
9651,
1583,
17255,
18035,
353,
1375,
29898,
1311,
17255,
18035,
718,
6728,
29892,
29871,
29896,
29900,
29900,
29889,
29900,
29897,
13,
9651,
736,
1583,
17255,
18035,
13,
4706,
1683,
29901,
13,
9651,
1583,
17255,
18035,
29889,
1767,
353,
1375,
29898,
1311,
17255,
18035,
29889,
1767,
718,
6728,
29892,
29871,
29896,
29900,
29900,
29889,
29900,
29897,
13,
9651,
736,
1583,
17255,
18035,
29889,
1767,
13,
13,
1678,
822,
731,
29918,
18035,
29898,
1311,
29892,
6728,
1125,
13,
4706,
9995,
13,
4706,
731,
6728,
304,
529,
18035,
29958,
13,
4706,
9995,
13,
4706,
565,
1583,
17255,
908,
29901,
13,
9651,
1583,
17255,
908,
29889,
562,
1548,
580,
13,
4706,
565,
1583,
29889,
18035,
2804,
1583,
17255,
842,
29918,
18035,
29898,
18035,
1125,
13,
9651,
1583,
17255,
4990,
580,
13,
4706,
565,
1583,
17255,
908,
29901,
13,
9651,
1583,
17255,
908,
29889,
14096,
580,
13,
13,
1678,
822,
731,
29918,
5085,
29898,
1311,
29892,
3579,
19290,
1125,
13,
4706,
565,
9049,
5085,
2804,
1583,
17255,
19290,
29901,
13,
9651,
1583,
17255,
19290,
353,
9049,
5085,
13,
9651,
1583,
17255,
4990,
580,
13,
13,
1678,
822,
788,
29918,
5085,
29898,
1311,
29892,
3579,
19290,
1125,
13,
4706,
1583,
17255,
19290,
29889,
5504,
29898,
19290,
29897,
13,
4706,
1583,
17255,
4990,
580,
13,
13,
1678,
822,
4770,
4990,
29898,
1311,
1125,
13,
4706,
822,
3402,
29918,
2230,
29898,
29873,
1125,
13,
9651,
9995,
13,
9651,
3812,
1446,
263,
1353,
310,
6923,
408,
263,
12006,
931,
29892,
518,
29950,
17531,
7428,
29901,
1799,
13,
9651,
9995,
13,
9651,
286,
1144,
29892,
269,
353,
1933,
1545,
29898,
524,
29898,
29873,
511,
29871,
29953,
29900,
29897,
13,
9651,
298,
29892,
286,
353,
1933,
1545,
29898,
29885,
1144,
29892,
29871,
29953,
29900,
29897,
13,
9651,
565,
286,
1144,
1275,
29871,
29900,
322,
260,
1405,
29871,
29900,
29889,
29896,
322,
269,
1275,
29871,
29900,
29901,
13,
18884,
269,
353,
29871,
29896,
13,
9651,
565,
298,
29901,
13,
18884,
736,
29850,
29900,
29901,
29881,
6177,
29912,
29896,
29901,
29900,
29906,
29881,
6177,
29912,
29906,
29901,
29900,
29906,
29881,
29913,
1642,
4830,
29898,
29882,
29892,
286,
29892,
269,
29897,
13,
9651,
1683,
29901,
13,
18884,
736,
29850,
29900,
29901,
29900,
29906,
29881,
6177,
29912,
29896,
29901,
29900,
29906,
29881,
29913,
1642,
4830,
29898,
29885,
29892,
269,
29897,
13,
13,
4706,
822,
3402,
29918,
1646,
29898,
29886,
29892,
281,
1125,
13,
9651,
301,
353,
938,
29898,
29893,
334,
282,
847,
29871,
29896,
29900,
29900,
29889,
29900,
29897,
565,
282,
529,
29871,
29929,
29929,
29889,
29929,
1683,
281,
13,
9651,
736,
376,
11903,
334,
301,
718,
376,
376,
334,
313,
29893,
448,
301,
29897,
13,
13,
4706,
822,
3402,
29918,
497,
29898,
4830,
29892,
3579,
19290,
1125,
13,
9651,
770,
3164,
804,
18522,
29898,
1807,
29889,
18522,
1125,
13,
18884,
822,
4770,
2344,
12035,
1311,
29892,
2322,
13776,
1125,
13,
462,
1678,
1583,
29889,
4381,
353,
2322,
13,
13,
18884,
822,
679,
29918,
1767,
29898,
1311,
29892,
1820,
29892,
6389,
29892,
9049,
6289,
1125,
13,
462,
1678,
565,
338,
8758,
29898,
1989,
29892,
851,
1125,
13,
462,
4706,
736,
9049,
6289,
29889,
657,
29898,
1989,
29892,
1583,
29889,
4381,
29897,
13,
462,
1678,
1683,
29901,
13,
462,
4706,
736,
1347,
29889,
18522,
29889,
657,
29918,
1767,
29898,
1989,
29892,
6389,
29892,
9049,
6289,
29897,
13,
13,
9651,
1426,
353,
3164,
804,
18522,
2141,
4830,
29898,
4830,
29892,
3579,
19290,
467,
29878,
17010,
580,
13,
9651,
1550,
1426,
29889,
1975,
2541,
703,
6160,
1125,
13,
18884,
1426,
353,
1426,
7503,
7431,
29898,
726,
29897,
448,
29871,
29896,
1822,
29878,
17010,
580,
13,
9651,
736,
1426,
13,
13,
4706,
565,
451,
1583,
29889,
20472,
29901,
13,
9651,
1286,
353,
931,
29889,
2230,
580,
13,
9651,
1583,
17255,
19290,
3366,
18035,
3108,
353,
29850,
29900,
29901,
29945,
29889,
29896,
29888,
10560,
1642,
4830,
29898,
1311,
29889,
18035,
29897,
13,
9651,
1583,
17255,
19290,
3366,
1646,
3108,
353,
3402,
29918,
1646,
29898,
1311,
29889,
18035,
29892,
1583,
29889,
1646,
29918,
2103,
29897,
13,
13,
9651,
1583,
17255,
19290,
3366,
295,
28170,
3108,
353,
3402,
29918,
2230,
29898,
3707,
448,
1583,
17255,
2962,
2230,
29897,
13,
9651,
1583,
17255,
19290,
3366,
1745,
17225,
3108,
353,
313,
13,
18884,
3402,
29918,
2230,
3552,
3707,
448,
1583,
17255,
2962,
2230,
29897,
334,
313,
29896,
29900,
29900,
448,
1583,
29889,
18035,
29897,
847,
1583,
29889,
18035,
29897,
13,
18884,
565,
1583,
29889,
18035,
13,
18884,
1683,
376,
489,
29901,
13869,
13,
9651,
1723,
13,
13,
9651,
14391,
353,
6634,
29916,
29896,
29933,
29961,
29973,
29906,
29945,
29880,
29908,
13,
9651,
565,
1583,
29889,
3283,
29901,
13,
18884,
396,
421,
9295,
797,
29936,
29885,
29950,
6998,
14104,
267,
278,
10677,
304,
1948,
302,
29892,
1897,
286,
13,
18884,
14391,
4619,
285,
26732,
29916,
29896,
29933,
29961,
29879,
29905,
29916,
29896,
29933,
19660,
1311,
29889,
3283,
29961,
29900,
29962,
3400,
29912,
1311,
29889,
3283,
29961,
29896,
12258,
29950,
29908,
13,
9651,
1683,
29901,
13,
18884,
14391,
4619,
6634,
29878,
29908,
13,
13,
9651,
1196,
353,
3402,
29918,
497,
29898,
1311,
17255,
4830,
29892,
3579,
1311,
17255,
19290,
29897,
13,
9651,
565,
1583,
29889,
3317,
29918,
2103,
2804,
29871,
29900,
29901,
13,
18884,
565,
7431,
29898,
1220,
29897,
1405,
1583,
29889,
3317,
29918,
2103,
29901,
13,
462,
1678,
21022,
630,
353,
376,
17794,
13,
462,
1678,
565,
1583,
29889,
3317,
29918,
2103,
6736,
7431,
29898,
509,
4661,
630,
1125,
13,
462,
4706,
1196,
353,
1196,
7503,
313,
1311,
29889,
3317,
29918,
2103,
448,
7431,
29898,
509,
4661,
630,
28166,
718,
21022,
630,
718,
6634,
29916,
29896,
29890,
29961,
29900,
29885,
29908,
13,
462,
1678,
1683,
29901,
13,
462,
4706,
1196,
353,
1196,
7503,
1583,
29889,
3317,
29918,
2103,
29962,
718,
6634,
29916,
29896,
29890,
29961,
29900,
29885,
29908,
13,
9651,
14391,
4619,
1196,
718,
6634,
29916,
29896,
29933,
29961,
29900,
29968,
29908,
13,
9651,
565,
1583,
29889,
3283,
29901,
13,
18884,
14391,
4619,
6634,
29916,
29896,
29933,
29961,
29884,
29908,
13,
9651,
1583,
17255,
3539,
29898,
4905,
29879,
29897,
13,
13,
1678,
822,
4770,
3539,
29898,
1311,
29892,
851,
1125,
13,
4706,
934,
353,
1583,
17255,
1445,
565,
1583,
17255,
1445,
1683,
10876,
29889,
25393,
13,
4706,
934,
29889,
3539,
29898,
710,
29897,
13,
4706,
934,
29889,
23126,
580,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
679,
1066,
7295,
13,
4706,
18392,
353,
5124,
13,
4706,
3659,
262,
353,
10876,
29889,
4172,
262,
29889,
1777,
8154,
580,
13,
4706,
260,
5552,
353,
1840,
2363,
29889,
14246,
657,
5552,
29898,
4172,
262,
29897,
13,
13,
4706,
1018,
29901,
13,
9651,
260,
1017,
29889,
842,
29883,
8690,
29898,
4172,
262,
29892,
1840,
2363,
29889,
29911,
9295,
2190,
9806,
29897,
13,
9651,
10876,
29889,
25393,
29889,
3539,
14182,
29916,
29896,
29890,
29961,
29953,
29876,
1159,
13,
9651,
10876,
29889,
25393,
29889,
23126,
580,
13,
13,
9651,
1550,
5852,
29901,
13,
18884,
18392,
4619,
10876,
29889,
4172,
262,
29889,
949,
29898,
29896,
29897,
13,
18884,
565,
18392,
14352,
29896,
29962,
1275,
376,
29934,
1115,
13,
462,
1678,
2867,
13,
13,
4706,
7146,
29901,
13,
9651,
1840,
2363,
29889,
14246,
842,
5552,
29898,
4172,
262,
29892,
1840,
2363,
29889,
29911,
9295,
2190,
9806,
29892,
260,
5552,
29897,
13,
13,
4706,
396,
5183,
278,
3935,
1819,
29892,
541,
825,
565,
263,
1589,
858,
10946,
5692,
1550,
5183,
13,
4706,
396,
515,
3659,
262,
29973,
1094,
26616,
664,
2820,
29892,
679,
1066,
580,
3639,
565,
445,
8465,
29901,
6213,
13,
4706,
1018,
29901,
13,
9651,
7087,
353,
337,
29889,
4352,
29898,
29878,
29908,
3823,
29916,
29896,
29890,
29905,
29961,
1194,
29881,
29930,
416,
1194,
29881,
7528,
29934,
613,
18392,
29897,
13,
9651,
6471,
353,
7087,
29889,
13155,
580,
13,
4706,
5174,
23833,
2392,
29901,
13,
9651,
736,
6213,
13,
13,
4706,
736,
313,
524,
29898,
13155,
29961,
29900,
11724,
938,
29898,
13155,
29961,
29896,
12622,
13,
13,
13,
1990,
20018,
29933,
1503,
29901,
13,
1678,
822,
4770,
2344,
12035,
13,
4706,
1583,
29892,
13,
4706,
3402,
29892,
13,
4706,
2159,
29892,
13,
4706,
4236,
29918,
2103,
29922,
359,
29889,
657,
29918,
8489,
979,
29918,
2311,
2141,
13099,
29892,
13,
4706,
2594,
29918,
2103,
29922,
29900,
29892,
13,
4706,
11262,
29922,
8824,
29892,
13,
4706,
5967,
29922,
8824,
29892,
13,
4706,
2847,
29918,
1066,
29922,
8516,
29892,
13,
4706,
12463,
29918,
7827,
29922,
29900,
29892,
13,
4706,
8455,
29901,
6674,
307,
985,
292,
29889,
3260,
353,
6213,
29892,
13,
268,
1125,
13,
4706,
9210,
353,
29871,
29900,
13,
4706,
565,
12463,
29918,
7827,
2804,
29871,
29900,
29901,
13,
9651,
1583,
29889,
957,
497,
353,
20018,
4297,
29898,
13,
18884,
5967,
29922,
5574,
29892,
13,
18884,
11262,
29922,
20472,
29892,
13,
18884,
3001,
29922,
957,
497,
29918,
7827,
29892,
13,
18884,
934,
29922,
8516,
29892,
13,
18884,
4236,
29918,
2103,
29922,
3317,
29918,
2103,
29892,
13,
18884,
2594,
29918,
2103,
29922,
1646,
29918,
2103,
29892,
13,
18884,
2602,
29922,
11228,
29918,
1066,
29892,
13,
18884,
3013,
29918,
18127,
29918,
10892,
29922,
5574,
29892,
13,
18884,
8455,
29922,
12847,
29892,
13,
9651,
1723,
13,
9651,
9210,
353,
29871,
29896,
13,
4706,
1683,
29901,
13,
9651,
1583,
29889,
957,
497,
353,
6213,
13,
13,
4706,
1583,
29889,
28408,
353,
518,
13,
9651,
20018,
4297,
29898,
13,
18884,
3402,
29892,
13,
18884,
11262,
29922,
20472,
29892,
13,
18884,
934,
29922,
8516,
29892,
13,
18884,
4236,
29918,
2103,
29922,
3317,
29918,
2103,
29892,
13,
18884,
2594,
29918,
2103,
29922,
1646,
29918,
2103,
29892,
13,
18884,
5967,
29922,
5574,
29892,
29871,
396,
3013,
2594,
565,
451,
599,
22306,
1095,
13,
18884,
2602,
29922,
3552,
11228,
29918,
1066,
29961,
29900,
29962,
718,
474,
511,
2847,
29918,
1066,
29961,
29896,
2314,
565,
2847,
29918,
1066,
1683,
6213,
29892,
13,
18884,
3013,
29918,
18127,
29918,
10892,
29922,
5574,
29892,
13,
18884,
8455,
29922,
12847,
29892,
13,
9651,
1723,
13,
9651,
363,
474,
297,
3464,
29898,
10289,
29892,
2159,
718,
9210,
29897,
13,
4706,
4514,
13,
4706,
1583,
17255,
280,
1351,
353,
5967,
13,
4706,
1583,
29889,
20472,
353,
11262,
13,
4706,
1583,
29889,
11228,
29918,
1066,
353,
2847,
29918,
1066,
13,
13,
1678,
822,
4770,
6144,
12035,
1311,
1125,
13,
4706,
1283,
353,
29871,
29900,
565,
1583,
29889,
957,
497,
338,
6213,
1683,
29871,
29896,
13,
4706,
565,
1583,
17255,
280,
1351,
29901,
13,
9651,
1283,
4619,
7431,
29898,
1311,
29889,
28408,
29897,
13,
9651,
1583,
29889,
28408,
353,
5159,
13,
4706,
1683,
29901,
13,
9651,
518,
1646,
29889,
8551,
580,
363,
2594,
297,
1583,
29889,
28408,
29962,
13,
13,
4706,
565,
451,
1583,
29889,
20472,
29901,
13,
9651,
14391,
353,
5124,
13,
9651,
565,
1583,
29889,
11228,
29918,
1066,
29901,
13,
18884,
396,
421,
29907,
5425,
302,
2056,
286,
379,
6998,
14104,
267,
278,
10677,
304,
1948,
302,
29892,
1897,
286,
13,
18884,
14391,
4619,
285,
26732,
29916,
29896,
29933,
29961,
29906,
29968,
29905,
29916,
29896,
29933,
19660,
1311,
29889,
11228,
29918,
1066,
29961,
29900,
29962,
718,
1283,
3400,
29912,
1311,
29889,
11228,
29918,
1066,
29961,
29896,
12258,
29950,
29908,
13,
13,
9651,
14391,
4619,
6634,
29916,
29896,
29933,
29961,
29973,
29906,
29945,
29882,
29908,
13,
9651,
10876,
29889,
25393,
29889,
3539,
29898,
4905,
29879,
29897,
13,
9651,
10876,
29889,
25393,
29889,
23126,
580,
13,
13,
1678,
822,
4770,
657,
667,
12035,
1311,
29892,
2380,
1125,
13,
4706,
736,
1583,
29889,
28408,
29961,
2248,
1273,
7431,
29898,
1311,
29889,
28408,
4638,
13,
13,
13,
15945,
29908,
29874,
16920,
2777,
2629,
263,
2323,
934,
15945,
29908,
13,
13,
13,
1990,
10088,
9552,
29901,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
9210,
29892,
3309,
29892,
2793,
29892,
2224,
29922,
8516,
1125,
13,
4706,
1583,
29889,
10289,
353,
9210,
13,
4706,
1583,
29889,
2848,
353,
3309,
13,
4706,
1583,
29889,
3051,
353,
2793,
13,
4706,
1583,
29889,
2084,
353,
2224,
13,
13,
1678,
822,
4770,
8568,
12035,
1311,
1125,
13,
4706,
736,
6608,
3552,
1311,
29889,
10289,
29892,
1583,
29889,
2848,
876,
13,
13,
1678,
822,
4770,
1837,
12035,
1311,
29892,
916,
1125,
13,
4706,
736,
313,
1311,
29889,
10289,
29892,
1583,
29889,
2848,
29897,
1275,
313,
1228,
29889,
10289,
29892,
916,
29889,
2848,
29897,
13,
13,
1678,
822,
4770,
276,
558,
12035,
1311,
1125,
13,
4706,
736,
285,
29908,
10289,
3790,
1311,
29889,
10289,
29913,
376,
285,
29908,
2848,
3790,
1311,
29889,
2848,
29913,
2793,
3790,
1311,
29889,
3051,
5038,
13,
13,
1678,
822,
679,
29918,
3470,
26458,
29918,
15060,
29898,
1311,
29892,
934,
29892,
13761,
29901,
6315,
29889,
5612,
29877,
29892,
1999,
420,
29918,
3888,
29892,
2594,
29901,
20018,
4297,
1125,
13,
4706,
822,
9210,
29918,
517,
29918,
1220,
29898,
1445,
29892,
9210,
1125,
13,
9651,
934,
29889,
344,
1416,
29898,
29900,
29897,
13,
9651,
2793,
353,
934,
29889,
949,
29898,
10289,
29897,
13,
9651,
736,
2793,
29889,
13808,
703,
9420,
29899,
29947,
613,
376,
17281,
2564,
2798,
14182,
29876,
1159,
718,
29871,
29896,
13,
13,
4706,
822,
2910,
29918,
974,
29918,
1220,
29918,
15060,
29898,
2204,
420,
29918,
3888,
1125,
13,
9651,
1121,
353,
6571,
13,
9651,
1857,
29918,
1220,
353,
29871,
29900,
13,
9651,
363,
697,
29918,
2204,
420,
297,
1999,
420,
29918,
3888,
29901,
13,
18884,
363,
697,
29918,
1220,
297,
697,
29918,
2204,
420,
29961,
29896,
5387,
13,
462,
1678,
1857,
29918,
1220,
4619,
29871,
29896,
13,
462,
1678,
1121,
29961,
3784,
29918,
1220,
29962,
353,
697,
29918,
2204,
420,
13,
9651,
736,
1121,
13,
13,
4706,
937,
29918,
1220,
29918,
10289,
353,
9210,
29918,
517,
29918,
1220,
29898,
1445,
29892,
1583,
29889,
10289,
29897,
13,
4706,
1833,
29918,
1220,
29918,
10289,
353,
9210,
29918,
517,
29918,
1220,
29898,
1445,
29892,
4236,
29898,
1311,
29889,
10289,
29892,
1583,
29889,
10289,
718,
1583,
29889,
2848,
448,
29871,
29896,
876,
13,
13,
4706,
396,
6699,
1999,
420,
2472,
363,
445,
16920,
29889,
13,
4706,
2441,
29918,
2204,
1280,
353,
5159,
13,
4706,
1196,
29918,
15060,
29918,
1958,
353,
2910,
29918,
974,
29918,
1220,
29918,
15060,
29898,
2204,
420,
29918,
3888,
29897,
13,
13,
4706,
363,
474,
297,
3464,
29898,
4102,
29918,
1220,
29918,
10289,
29892,
1833,
29918,
1220,
29918,
10289,
718,
29871,
29896,
1125,
13,
9651,
565,
474,
6736,
7431,
29898,
1220,
29918,
15060,
29918,
1958,
1125,
13,
18884,
396,
3394,
1999,
420,
310,
937,
1196,
565,
714,
310,
3464,
29892,
278,
1833,
1196,
11149,
13,
18884,
2441,
29918,
2204,
1280,
29889,
4397,
29898,
1220,
29918,
15060,
29918,
1958,
29961,
29896,
3816,
29900,
2314,
13,
18884,
6773,
13,
13,
9651,
565,
1196,
29918,
15060,
29918,
1958,
29961,
29875,
3816,
29900,
29962,
451,
297,
2441,
29918,
2204,
1280,
29901,
13,
18884,
2441,
29918,
2204,
1280,
29889,
4397,
29898,
1220,
29918,
15060,
29918,
1958,
29961,
29875,
3816,
29900,
2314,
13,
13,
4706,
565,
7431,
29898,
13492,
29918,
2204,
1280,
29897,
1405,
29871,
29896,
322,
2441,
29918,
2204,
1280,
29961,
29900,
1822,
8921,
2804,
2441,
29918,
2204,
1280,
29961,
29896,
1822,
8921,
29901,
13,
9651,
2594,
29889,
1202,
29918,
5085,
29898,
13,
18884,
5153,
29922,
29888,
26732,
29916,
29896,
29933,
29961,
29941,
29941,
29885,
29912,
4102,
29918,
1220,
29918,
10289,
7402,
29912,
4230,
29918,
1220,
29918,
10289,
29913,
9120,
491,
426,
1761,
29898,
1958,
29898,
2892,
289,
29901,
851,
29898,
29890,
29889,
8921,
511,
2441,
29918,
2204,
1280,
876,
1836,
4880,
408,
9120,
491,
426,
13492,
29918,
2204,
1280,
14352,
29896,
1822,
8921,
1012,
29916,
29896,
29933,
29961,
29900,
29885,
29908,
13,
9651,
1723,
13,
13,
4706,
736,
2441,
29918,
2204,
1280,
14352,
29896,
29962,
13,
13,
1678,
9995,
7302,
16920,
11480,
934,
1213,
15945,
13,
13,
1678,
822,
3394,
29898,
1311,
29892,
934,
1125,
13,
4706,
396,
16508,
304,
9210,
718,
3309,
988,
2793,
338,
443,
16747,
287,
491,
1583,
13,
4706,
934,
29889,
344,
1416,
29898,
1311,
29889,
10289,
718,
1583,
29889,
2848,
29897,
13,
13,
4706,
396,
1303,
3428,
278,
382,
9800,
13,
4706,
289,
353,
934,
29889,
949,
580,
13,
13,
4706,
396,
769,
4635,
525,
3051,
29915,
472,
278,
1369,
322,
2436,
1250,
13,
4706,
934,
29889,
344,
1416,
29898,
1311,
29889,
10289,
29897,
13,
4706,
934,
29889,
3539,
29898,
1311,
29889,
3051,
718,
289,
29897,
13,
13,
4706,
396,
21022,
403,
19039,
2793,
297,
1206,
2793,
338,
20511,
1135,
3978,
13,
4706,
934,
29889,
509,
4661,
403,
580,
13,
13,
1678,
822,
903,
4572,
29918,
29873,
9473,
29918,
2204,
420,
29898,
1311,
29892,
1999,
420,
1125,
13,
4706,
363,
1196,
297,
1999,
420,
29961,
29896,
5387,
13,
9651,
565,
451,
1196,
29889,
790,
3535,
580,
322,
7431,
29898,
1220,
29897,
322,
451,
1583,
29889,
4572,
29918,
29873,
9473,
29918,
1220,
29898,
1220,
1125,
13,
18884,
736,
5852,
13,
4706,
736,
7700,
13,
13,
1678,
9995,
29873,
10071,
2967,
770,
565,
2183,
2752,
1196,
338,
5545,
12604,
15945,
29908,
13,
13,
1678,
822,
4175,
29918,
29873,
9473,
29918,
1220,
29898,
1311,
29892,
1196,
1125,
13,
4706,
736,
7700,
13,
13,
13,
1990,
10088,
9552,
21575,
29901,
13,
1678,
9995,
4738,
1078,
1634,
4620,
4110,
363,
263,
934,
1213,
15945,
13,
13,
1678,
822,
5706,
29898,
1311,
29892,
934,
29892,
334,
5085,
29892,
3579,
19290,
29897,
1599,
19229,
29889,
1293,
29961,
5612,
9552,
5387,
13,
4706,
1209,
13,
13,
13,
1990,
2233,
574,
5809,
5612,
9552,
29898,
5612,
9552,
1125,
13,
1678,
12604,
29918,
1220,
29918,
11037,
353,
337,
29889,
12198,
29898,
29878,
29908,
29985,
7110,
741,
1012,
7110,
10725,
1194,
416,
10062,
29938,
1159,
13,
13,
1678,
822,
4175,
29918,
29873,
9473,
29918,
1220,
29898,
1311,
29892,
1196,
1125,
13,
4706,
396,
297,
315,
29899,
4561,
10276,
29892,
4105,
778,
313,
8875,
511,
20476,
313,
2636,
511,
29494,
313,
3101,
13,
4706,
396,
322,
3031,
5283,
265,
313,
29936,
29897,
526,
4049,
21050,
964,
263,
2323,
1196,
297,
7853,
310,
13,
4706,
396,
777,
15234,
342,
5577,
29892,
373,
607,
1999,
420,
3041,
290,
362,
338,
5491,
19315,
29889,
13,
4706,
301,
353,
1196,
29889,
21652,
29898,
8977,
29889,
3166,
8149,
29898,
1958,
29898,
536,
29892,
1347,
29889,
1332,
3246,
3535,
4961,
13,
4706,
736,
1583,
17255,
1990,
26914,
29873,
9473,
29918,
1220,
29918,
11037,
29889,
4352,
29898,
29880,
29897,
13,
13,
13,
1990,
2233,
574,
5809,
9165,
5612,
9552,
21575,
29898,
5612,
9552,
21575,
1125,
13,
1678,
822,
5706,
29898,
1311,
29892,
934,
29892,
2594,
29901,
20018,
4297,
29897,
1599,
19229,
29889,
1293,
29961,
5612,
9552,
5387,
13,
4706,
934,
29889,
344,
1416,
29898,
29900,
29892,
2897,
29889,
22048,
29968,
29918,
11794,
29897,
13,
4706,
2159,
353,
934,
29889,
29873,
514,
580,
13,
4706,
2594,
29889,
1202,
29918,
5085,
29898,
14273,
543,
17158,
1067,
574,
29899,
4830,
6560,
1634,
4620,
4110,
2023,
1159,
13,
4706,
1962,
353,
1014,
5014,
29889,
3198,
29918,
4905,
29898,
13,
9651,
4852,
695,
574,
29899,
4830,
613,
376,
489,
4905,
29899,
3445,
4620,
4110,
29899,
3134,
613,
376,
489,
3293,
29922,
1445,
613,
934,
29889,
978,
29897,
13,
4706,
13742,
13808,
703,
9420,
29899,
29947,
1159,
13,
4706,
2594,
29889,
842,
29918,
18035,
29898,
29896,
29900,
29900,
334,
313,
29896,
29900,
29906,
29946,
718,
2159,
334,
29871,
29906,
847,
29871,
29946,
29897,
847,
313,
29896,
29900,
29906,
29946,
718,
2159,
718,
29871,
29946,
29900,
29929,
29953,
876,
13,
13,
4706,
822,
788,
29918,
8552,
8966,
386,
29918,
6921,
29898,
1445,
29892,
1121,
1125,
13,
9651,
934,
29889,
344,
1416,
29898,
29900,
29897,
13,
9651,
565,
7431,
29898,
3217,
20055,
22789,
3912,
29897,
1405,
29871,
29900,
322,
289,
29908,
11882,
1266,
29908,
451,
297,
934,
29889,
949,
29898,
29941,
29900,
29900,
1125,
13,
18884,
565,
7431,
29898,
2914,
29897,
1405,
29871,
29900,
322,
1121,
29961,
29900,
1822,
10289,
1275,
29871,
29900,
29901,
13,
462,
1678,
1121,
29961,
29900,
1822,
3051,
353,
315,
4590,
29979,
22789,
3912,
718,
1121,
29961,
29900,
1822,
3051,
13,
18884,
1683,
29901,
13,
462,
1678,
364,
353,
2233,
574,
5809,
5612,
9552,
29898,
29900,
29892,
29871,
29900,
29892,
315,
4590,
29979,
22789,
3912,
29897,
13,
462,
1678,
1121,
29889,
7851,
29898,
29900,
29892,
364,
29897,
13,
13,
4706,
1121,
353,
5159,
13,
4706,
4903,
29918,
4632,
353,
382,
29911,
29889,
3166,
1807,
29898,
4905,
29897,
13,
4706,
363,
364,
297,
4903,
29918,
4632,
29889,
1524,
2886,
703,
3445,
9552,
29908,
1125,
13,
9651,
9210,
353,
938,
29898,
29878,
29889,
657,
703,
10289,
5783,
13,
9651,
3309,
353,
938,
29898,
29878,
29889,
657,
703,
2848,
5783,
13,
9651,
7023,
29918,
3051,
353,
6262,
29898,
29878,
29889,
726,
470,
12633,
8025,
543,
9420,
29899,
29947,
1159,
13,
9651,
2594,
29889,
1202,
29918,
5085,
29898,
14273,
29922,
29888,
29908,
3445,
9552,
310,
3454,
426,
10289,
7402,
29912,
10289,
718,
3309,
27195,
13,
9651,
2594,
29889,
842,
29918,
18035,
29898,
29896,
29900,
29900,
334,
313,
29896,
29900,
29906,
29946,
718,
313,
10289,
718,
3309,
29897,
334,
29871,
29941,
847,
29871,
29945,
29897,
847,
313,
29896,
29900,
29906,
29946,
718,
2159,
718,
29871,
29946,
29900,
29929,
29953,
876,
13,
13,
9651,
396,
1067,
574,
29899,
4830,
13880,
1634,
4620,
4110,
975,
433,
2986,
411,
2441,
1426,
29892,
607,
2582,
297,
13,
9651,
396,
2473,
29899,
15060,
1999,
420,
2582,
29889,
3349,
975,
433,
2986,
10161,
363,
2253,
1121,
29889,
13,
9651,
474,
353,
7431,
29898,
10389,
29918,
3051,
29897,
13,
13,
9651,
565,
474,
1405,
29871,
29900,
29901,
13,
18884,
474,
353,
474,
448,
29871,
29896,
13,
18884,
934,
29889,
344,
1416,
29898,
10289,
718,
3309,
448,
29871,
29896,
29897,
13,
13,
18884,
1550,
474,
6736,
29871,
29900,
322,
3309,
1405,
29871,
29900,
322,
934,
29889,
949,
29898,
29896,
9601,
29900,
29962,
1275,
7023,
29918,
3051,
29961,
29875,
5387,
13,
462,
1678,
474,
353,
474,
448,
29871,
29896,
13,
462,
1678,
3309,
353,
3309,
448,
29871,
29896,
13,
462,
1678,
934,
29889,
344,
1416,
29898,
10289,
718,
3309,
448,
29871,
29896,
29897,
13,
13,
18884,
7023,
29918,
3051,
353,
7023,
29918,
3051,
7503,
474,
718,
29871,
29896,
29962,
13,
13,
18884,
474,
353,
29871,
29900,
13,
18884,
934,
29889,
344,
1416,
29898,
10289,
29897,
13,
18884,
1550,
474,
529,
7431,
29898,
10389,
29918,
3051,
29897,
322,
3309,
1405,
29871,
29900,
322,
934,
29889,
949,
29898,
29896,
9601,
29900,
29962,
1275,
7023,
29918,
3051,
29961,
29875,
5387,
13,
462,
1678,
474,
353,
474,
718,
29871,
29896,
13,
462,
1678,
3309,
353,
3309,
448,
29871,
29896,
13,
462,
1678,
9210,
353,
9210,
718,
29871,
29896,
13,
462,
1678,
934,
29889,
344,
1416,
29898,
10289,
29897,
13,
13,
18884,
7023,
29918,
3051,
353,
7023,
29918,
3051,
29961,
29875,
17531,
13,
13,
9651,
1121,
29889,
4397,
29898,
29907,
3893,
5809,
5612,
9552,
29898,
10289,
29892,
3309,
29892,
7023,
29918,
3051,
876,
13,
13,
4706,
788,
29918,
8552,
8966,
386,
29918,
6921,
29898,
1445,
29892,
1121,
29897,
13,
4706,
2594,
29889,
842,
29918,
18035,
29898,
29896,
29900,
29900,
334,
313,
29896,
29900,
29906,
29946,
718,
2159,
334,
29871,
29941,
847,
29871,
29945,
29897,
847,
313,
29896,
29900,
29906,
29946,
718,
2159,
718,
29871,
29946,
29900,
29929,
29953,
876,
13,
13,
4706,
736,
1121,
13,
13,
13,
29937,
7581,
2740,
13,
1753,
7581,
29918,
4478,
29898,
2749,
29892,
5734,
1061,
1125,
13,
1678,
736,
903,
19541,
29918,
4478,
29898,
2749,
29892,
29871,
29900,
29892,
7431,
29898,
2749,
29897,
448,
29871,
29896,
29892,
5734,
1061,
29897,
13,
13,
13,
1753,
903,
19541,
29918,
4478,
29898,
2749,
29892,
301,
29892,
364,
29892,
5734,
1061,
1125,
13,
1678,
565,
364,
529,
301,
29901,
13,
4706,
736,
448,
29896,
13,
13,
1678,
7145,
353,
938,
29898,
29880,
718,
313,
29878,
448,
301,
29897,
847,
29871,
29906,
29897,
13,
1678,
7252,
353,
5734,
1061,
29898,
2749,
29961,
6563,
2314,
13,
13,
1678,
565,
7252,
1275,
29871,
29900,
29901,
13,
4706,
736,
7145,
13,
1678,
25342,
7252,
529,
29871,
29900,
29901,
13,
4706,
736,
903,
19541,
29918,
4478,
29898,
2749,
29892,
301,
29892,
7145,
448,
29871,
29896,
29892,
5734,
1061,
29897,
13,
1678,
1683,
29901,
13,
4706,
736,
903,
19541,
29918,
4478,
29898,
2749,
29892,
7145,
718,
29871,
29896,
29892,
364,
29892,
5734,
1061,
29897,
13,
13,
13,
1753,
5706,
29918,
3445,
4620,
4110,
29898,
20095,
29901,
6315,
29889,
5612,
29877,
29892,
2224,
29892,
4046,
29892,
2594,
29901,
20018,
4297,
29892,
12463,
29918,
1646,
29901,
20018,
4297,
1125,
13,
1678,
1634,
4620,
4110,
29918,
1609,
29918,
24772,
353,
6571,
13,
1678,
1634,
4620,
4110,
29918,
1609,
29918,
3470,
26458,
29918,
2055,
1169,
353,
6571,
13,
1678,
2594,
29889,
842,
29918,
5085,
29898,
13,
4706,
934,
29922,
29888,
29908,
29912,
359,
29889,
2084,
29889,
2674,
2084,
29898,
2084,
29892,
2897,
29889,
2084,
29889,
25721,
29898,
20095,
29889,
9435,
29918,
3972,
29897,
565,
13761,
1683,
2897,
29889,
657,
29883,
9970,
580,
2915,
613,
13,
4706,
5153,
543,
856,
613,
13,
1678,
1723,
13,
1678,
1018,
29901,
13,
4706,
2159,
353,
2897,
29889,
2084,
29889,
657,
2311,
29898,
2084,
29897,
13,
13,
4706,
565,
2159,
1405,
4046,
334,
29871,
29896,
29900,
29906,
29946,
29901,
13,
9651,
2594,
29889,
1202,
29918,
5085,
29898,
14273,
29922,
29888,
26732,
29916,
29896,
29933,
29961,
29941,
29941,
29885,
29912,
2311,
849,
29871,
29896,
29900,
29906,
29946,
29913,
26067,
29892,
901,
1135,
426,
13400,
29913,
476,
29933,
29892,
14993,
2986,
29905,
29916,
29896,
29933,
29961,
29900,
29885,
1159,
13,
9651,
736,
6213,
29892,
6213,
13,
4706,
565,
2159,
5277,
29871,
29896,
29901,
13,
9651,
2594,
29889,
1202,
29918,
5085,
29898,
14273,
29922,
29888,
26732,
29916,
29896,
29933,
29961,
29941,
29941,
29885,
6310,
934,
29892,
14993,
2986,
29905,
29916,
29896,
29933,
29961,
29900,
29885,
1159,
13,
9651,
736,
6213,
29892,
6213,
13,
13,
4706,
2594,
29889,
842,
29918,
18035,
29898,
29896,
29900,
29900,
334,
29871,
29896,
29900,
29906,
29946,
847,
313,
29896,
29900,
29906,
29946,
718,
2159,
847,
29871,
29946,
29900,
29929,
29953,
876,
13,
4706,
411,
1722,
29898,
2084,
29892,
4464,
543,
6050,
1159,
408,
934,
29901,
13,
9651,
2594,
29889,
1202,
29918,
5085,
29898,
14273,
29922,
29888,
29908,
17158,
1634,
4620,
4110,
1159,
13,
9651,
1634,
4620,
4110,
29918,
1454,
29918,
2764,
29918,
1445,
353,
2233,
574,
5809,
9165,
5612,
9552,
21575,
2141,
17158,
29898,
1445,
29892,
2594,
29922,
1646,
29897,
13,
13,
9651,
565,
451,
1634,
4620,
4110,
29918,
1454,
29918,
2764,
29918,
1445,
29901,
13,
18884,
2594,
29889,
1202,
29918,
5085,
29898,
14273,
29922,
29888,
29908,
1217,
1634,
4620,
4110,
1476,
1159,
13,
18884,
736,
6213,
29892,
6213,
13,
13,
9651,
1634,
4620,
4110,
29918,
1454,
29918,
2764,
29918,
1445,
29889,
6605,
29898,
1989,
29922,
2892,
364,
29901,
364,
29889,
10289,
29897,
13,
9651,
1634,
4620,
4110,
29918,
1609,
29918,
24772,
29961,
2084,
29962,
353,
1634,
4620,
4110,
29918,
1454,
29918,
2764,
29918,
1445,
13,
13,
9651,
565,
13761,
29901,
13,
18884,
1018,
29901,
13,
462,
1678,
1999,
420,
29918,
3888,
353,
13761,
29889,
2204,
420,
29898,
20095,
29889,
2813,
29889,
15060,
29892,
934,
29889,
978,
29897,
13,
18884,
5174,
6315,
29889,
735,
29883,
29889,
28712,
6255,
2392,
408,
321,
29901,
13,
462,
1678,
565,
376,
275,
5377,
9810,
29908,
297,
321,
29889,
303,
20405,
29901,
13,
462,
4706,
396,
934,
451,
297,
9810,
29892,
11455,
13,
462,
4706,
2594,
29889,
1202,
29918,
5085,
29898,
14273,
543,
449,
2975,
9810,
1159,
13,
462,
4706,
736,
1634,
4620,
4110,
29918,
1609,
29918,
24772,
29892,
6213,
13,
462,
1678,
1683,
29901,
13,
462,
4706,
736,
1634,
4620,
4110,
29918,
1609,
29918,
24772,
29892,
6213,
13,
13,
18884,
396,
6699,
1999,
420,
2472,
363,
1269,
16920,
29892,
13,
18884,
396,
769,
1207,
263,
529,
3470,
26458,
29918,
2055,
1169,
29958,
1599,
529,
3445,
4620,
4110,
29958,
2910,
29889,
13,
18884,
363,
364,
297,
1634,
4620,
4110,
29918,
1454,
29918,
2764,
29918,
1445,
29901,
13,
462,
1678,
364,
29889,
2084,
353,
2224,
13,
462,
1678,
15201,
29918,
15060,
353,
364,
29889,
657,
29918,
3470,
26458,
29918,
15060,
29898,
1445,
29892,
13761,
29892,
1999,
420,
29918,
3888,
29892,
2594,
29897,
13,
13,
462,
1678,
396,
15201,
29918,
2055,
1169,
353,
1999,
420,
29918,
2914,
29961,
29896,
29962,
565,
7431,
29898,
2204,
420,
29918,
2914,
29961,
29896,
2314,
1683,
1999,
420,
29918,
2914,
29961,
29900,
29962,
13,
462,
1678,
396,
15201,
29918,
2055,
1169,
353,
1051,
29898,
1958,
29898,
2892,
289,
29901,
289,
29961,
29900,
1822,
2109,
17051,
29889,
20970,
3285,
15201,
29918,
2055,
1169,
876,
13,
462,
1678,
15201,
29918,
15060,
353,
15201,
29918,
15060,
29889,
2109,
17051,
29889,
20970,
580,
13,
13,
462,
1678,
1634,
4620,
4110,
353,
1634,
4620,
4110,
29918,
1609,
29918,
3470,
26458,
29918,
2055,
1169,
29889,
657,
29898,
3470,
26458,
29918,
15060,
29892,
518,
2314,
13,
462,
1678,
1634,
4620,
4110,
29889,
4397,
29898,
29878,
29897,
13,
462,
1678,
1634,
4620,
4110,
29918,
1609,
29918,
3470,
26458,
29918,
2055,
1169,
29961,
3470,
26458,
29918,
15060,
29962,
353,
1634,
4620,
4110,
13,
1678,
5174,
20894,
2333,
2392,
408,
321,
29901,
13,
4706,
2594,
29889,
1202,
29918,
5085,
29898,
14273,
29922,
29888,
26732,
29916,
29896,
29933,
29961,
29941,
29941,
29885,
16074,
17935,
29892,
14993,
2986,
29905,
29916,
29896,
29933,
29961,
29900,
29885,
1159,
13,
1678,
7146,
29901,
13,
4706,
12463,
29918,
1646,
29889,
17263,
749,
29898,
29896,
29897,
13,
4706,
2594,
29889,
842,
29918,
18035,
29898,
29896,
29900,
29900,
29889,
29900,
29897,
13,
13,
1678,
736,
313,
13,
4706,
1634,
4620,
4110,
29918,
1609,
29918,
24772,
29892,
13,
4706,
1634,
4620,
4110,
29918,
1609,
29918,
3470,
26458,
29918,
2055,
1169,
565,
7431,
29898,
3445,
4620,
4110,
29918,
1609,
29918,
3470,
26458,
29918,
2055,
1169,
29897,
2804,
29871,
29900,
1683,
6213,
29892,
13,
1678,
1723,
13,
13,
13,
1753,
13761,
29918,
4830,
29918,
3396,
29898,
11228,
29918,
1066,
1125,
13,
1678,
1369,
2230,
353,
931,
29889,
2230,
580,
13,
13,
1678,
396,
6273,
13812,
13,
1678,
13812,
353,
1852,
5510,
29889,
15730,
11726,
29898,
13,
4706,
6139,
543,
5631,
403,
322,
3394,
1634,
4620,
4110,
363,
5923,
11786,
376,
13,
4706,
376,
19033,
29892,
1728,
10551,
292,
5434,
1999,
420,
2582,
29908,
13,
1678,
1723,
13,
13,
1678,
13812,
29889,
1202,
29918,
23516,
703,
489,
20095,
613,
3734,
29922,
8824,
29892,
1371,
543,
2084,
304,
6315,
9810,
29892,
1014,
29899,
2084,
338,
22691,
1159,
13,
1678,
13812,
29889,
1202,
29918,
23516,
703,
489,
2084,
613,
3734,
29922,
8824,
29892,
1371,
543,
2084,
304,
3402,
29892,
2322,
338,
2224,
304,
13761,
1159,
13,
1678,
13812,
29889,
1202,
29918,
23516,
703,
489,
735,
2325,
613,
3734,
29922,
8824,
29892,
1371,
543,
12322,
1016,
29915,
29873,
3402,
1159,
13,
13,
1678,
13812,
29889,
1202,
29918,
23516,
703,
489,
1217,
29899,
15060,
613,
11663,
29876,
613,
3158,
543,
8899,
29918,
3009,
613,
1371,
543,
1217,
9063,
29892,
925,
3402,
934,
1159,
13,
13,
1678,
13812,
29889,
1202,
29918,
23516,
703,
489,
8552,
1266,
613,
3734,
29922,
8824,
29892,
1371,
543,
8552,
1266,
1159,
13,
1678,
13812,
29889,
1202,
29918,
23516,
29898,
13,
4706,
376,
489,
29881,
719,
29899,
3389,
613,
13,
4706,
3734,
29922,
8824,
29892,
13,
4706,
2322,
29922,
8824,
29892,
13,
4706,
3158,
543,
8899,
29918,
3009,
613,
13,
4706,
1371,
543,
15807,
403,
2066,
1906,
674,
367,
883,
630,
541,
694,
883,
1218,
2869,
613,
13,
1678,
1723,
13,
1678,
13812,
29889,
1202,
29918,
23516,
29898,
13,
4706,
376,
489,
9057,
29879,
613,
11663,
29926,
613,
3734,
29922,
8824,
29892,
2322,
29922,
18056,
307,
985,
292,
29889,
21970,
29918,
2798,
3285,
1371,
543,
9057,
29879,
304,
437,
15998,
29908,
13,
1678,
1723,
13,
1678,
13812,
29889,
1202,
29918,
23516,
703,
489,
13400,
613,
3734,
29922,
8824,
29892,
2322,
29922,
29906,
29945,
29953,
29892,
1371,
543,
3317,
476,
29933,
310,
934,
304,
3402,
1159,
13,
1678,
13812,
29889,
1202,
29918,
23516,
29898,
13,
4706,
376,
489,
339,
2035,
613,
13,
4706,
3734,
29922,
8824,
29892,
13,
4706,
2322,
29922,
8824,
29892,
13,
4706,
3158,
543,
8899,
29918,
3009,
613,
13,
4706,
1371,
543,
339,
2035,
4464,
613,
13,
1678,
1723,
13,
1678,
13812,
29889,
1202,
29918,
23516,
703,
489,
8921,
613,
3734,
29922,
8824,
29892,
2322,
29922,
359,
29889,
657,
7507,
3285,
1371,
543,
8921,
363,
443,
29895,
776,
25741,
1159,
13,
1678,
13812,
29889,
1202,
29918,
23516,
29898,
13,
4706,
376,
489,
4572,
29899,
1609,
29899,
8921,
613,
3734,
29922,
8824,
29892,
2322,
29922,
8516,
29892,
1371,
543,
6194,
3402,
25741,
491,
6790,
4148,
29908,
13,
1678,
1723,
13,
13,
1678,
396,
22815,
8079,
14861,
1177,
29901,
12725,
2183,
6273,
29889,
13,
1678,
6389,
353,
13812,
29889,
5510,
29918,
5085,
580,
13,
1678,
565,
6389,
29889,
8552,
1266,
338,
451,
6213,
29901,
13,
4706,
315,
4590,
29979,
22789,
3912,
353,
6389,
29889,
8552,
1266,
13,
13,
1678,
13761,
353,
6315,
29889,
5612,
29877,
29898,
5085,
29889,
20095,
29892,
2740,
29918,
3560,
29918,
11851,
3842,
29922,
5574,
29897,
565,
6389,
29889,
20095,
1683,
6213,
13,
1678,
3402,
29918,
2084,
353,
2897,
29889,
2084,
29889,
18837,
1792,
29898,
5085,
29889,
20095,
565,
6389,
29889,
2084,
338,
6213,
1683,
6389,
29889,
2084,
29897,
13,
1678,
565,
451,
2897,
29889,
2084,
29889,
275,
6897,
29898,
4830,
29918,
2084,
1125,
13,
4706,
3402,
29918,
2084,
353,
2897,
29889,
2084,
29889,
7122,
29898,
359,
29889,
657,
29883,
9970,
3285,
3402,
29918,
2084,
29897,
13,
13,
1678,
2066,
353,
5159,
13,
1678,
565,
2897,
29889,
2084,
29889,
275,
3972,
29898,
4830,
29918,
2084,
1125,
13,
4706,
363,
3876,
29892,
4516,
29879,
29892,
934,
29918,
1761,
297,
2897,
29889,
20919,
29898,
4830,
29918,
2084,
1125,
13,
13,
9651,
822,
817,
29918,
735,
2325,
29898,
4632,
29892,
429,
27722,
1125,
13,
18884,
363,
4516,
297,
429,
27722,
29901,
13,
462,
1678,
565,
2897,
29889,
2084,
29889,
370,
1028,
493,
29898,
359,
29889,
2084,
29889,
7122,
29898,
4830,
29918,
2084,
29892,
4516,
8106,
27382,
2541,
29898,
13,
462,
4706,
2897,
29889,
2084,
29889,
370,
1028,
493,
29898,
359,
29889,
2084,
29889,
18837,
1792,
29898,
4632,
876,
13,
462,
268,
1125,
13,
462,
4706,
736,
5852,
13,
13,
18884,
736,
7700,
13,
13,
9651,
565,
6389,
29889,
735,
2325,
322,
817,
29918,
735,
2325,
29898,
4632,
29892,
6389,
29889,
735,
2325,
29889,
5451,
29898,
3284,
22164,
13,
18884,
396,
1596,
29898,
29888,
29908,
1252,
2325,
426,
4632,
1118,
426,
5085,
29889,
735,
2325,
27195,
13,
18884,
6773,
13,
13,
9651,
363,
10422,
297,
934,
29918,
1761,
29901,
13,
18884,
565,
10422,
29889,
1975,
2541,
29898,
17350,
8223,
613,
11393,
617,
613,
11393,
29882,
613,
11393,
29623,
613,
11393,
29883,
5783,
29901,
13,
462,
1678,
2066,
29889,
4397,
29898,
359,
29889,
2084,
29889,
7122,
29898,
4632,
29892,
10422,
876,
13,
13,
1678,
25342,
2897,
29889,
2084,
29889,
275,
1445,
29898,
4830,
29918,
2084,
1125,
13,
4706,
2066,
29889,
4397,
29898,
4830,
29918,
2084,
29897,
13,
13,
1678,
396,
1889,
2066,
6790,
297,
6273,
29889,
716,
25741,
674,
367,
2825,
2645,
9068,
29892,
13,
1678,
396,
577,
591,
7090,
1857,
2343,
363,
16232,
1999,
11500,
2582,
29889,
13,
1678,
411,
6674,
307,
985,
292,
29889,
11426,
29898,
5014,
267,
29922,
524,
29898,
5085,
29889,
9057,
29879,
876,
408,
11565,
29901,
13,
4706,
8455,
353,
6674,
307,
985,
292,
29889,
3260,
580,
13,
4706,
2159,
353,
1375,
29898,
524,
29898,
5085,
29889,
9057,
29879,
511,
6674,
307,
985,
292,
29889,
21970,
29918,
2798,
580,
849,
29871,
29906,
29892,
7431,
29898,
5325,
876,
13,
4706,
22306,
353,
20018,
29933,
1503,
29898,
13,
9651,
29850,
18035,
29913,
426,
295,
28170,
29913,
891,
426,
1445,
6177,
426,
14273,
17671,
13,
9651,
2159,
29892,
13,
9651,
5967,
29922,
8824,
29892,
13,
9651,
11262,
29922,
11227,
29898,
5085,
29889,
339,
2035,
511,
13,
9651,
2847,
29918,
1066,
7607,
11228,
29918,
1066,
29961,
29900,
29962,
718,
29871,
29896,
29892,
2847,
29918,
1066,
29961,
29896,
11724,
13,
9651,
12463,
29918,
7827,
29922,
2435,
29898,
5325,
511,
13,
9651,
8455,
29922,
12847,
29892,
13,
4706,
1723,
13,
13,
4706,
2582,
353,
11565,
29889,
8508,
1958,
29918,
12674,
29898,
13,
9651,
5706,
29918,
3445,
4620,
4110,
29892,
13,
9651,
17288,
20095,
29892,
2224,
29892,
938,
29898,
5085,
29889,
13400,
511,
22306,
29961,
29875,
1402,
22306,
29889,
957,
497,
29897,
363,
474,
29892,
2224,
297,
26985,
29898,
5325,
29897,
1402,
13,
4706,
13742,
657,
580,
13,
4706,
11565,
29889,
5358,
580,
13,
4706,
11565,
29889,
7122,
580,
13,
4706,
628,
22306,
29871,
396,
5217,
22306,
363,
19232,
1596,
13,
13,
1678,
1634,
4620,
4110,
29918,
1609,
29918,
24772,
353,
6571,
13,
1678,
1634,
4620,
4110,
29918,
1609,
29918,
24772,
29918,
6194,
353,
6571,
13,
1678,
1634,
4620,
4110,
29918,
1609,
29918,
3470,
26458,
29918,
2055,
1169,
353,
6571,
13,
1678,
363,
1634,
4620,
4110,
29918,
1609,
29918,
2084,
29892,
1634,
4620,
4110,
29918,
1609,
29918,
3470,
26458,
29918,
15060,
297,
2582,
29901,
13,
4706,
565,
1634,
4620,
4110,
29918,
1609,
29918,
2084,
322,
1634,
4620,
4110,
29918,
1609,
29918,
3470,
26458,
29918,
15060,
338,
6213,
29901,
13,
9651,
1634,
4620,
4110,
29918,
1609,
29918,
24772,
29918,
6194,
29889,
5504,
29898,
3445,
4620,
4110,
29918,
1609,
29918,
2084,
29897,
13,
4706,
1683,
29901,
13,
9651,
565,
1634,
4620,
4110,
29918,
1609,
29918,
2084,
29901,
13,
18884,
1634,
4620,
4110,
29918,
1609,
29918,
24772,
29889,
5504,
29898,
3445,
4620,
4110,
29918,
1609,
29918,
2084,
29897,
13,
9651,
565,
1634,
4620,
4110,
29918,
1609,
29918,
3470,
26458,
29918,
15060,
29901,
13,
18884,
363,
15201,
29918,
15060,
297,
1634,
4620,
4110,
29918,
1609,
29918,
3470,
26458,
29918,
15060,
29889,
8149,
7295,
13,
462,
1678,
565,
451,
15201,
29918,
15060,
297,
1634,
4620,
4110,
29918,
1609,
29918,
3470,
26458,
29918,
2055,
1169,
29889,
8149,
7295,
13,
462,
4706,
1634,
4620,
4110,
29918,
1609,
29918,
3470,
26458,
29918,
2055,
1169,
29961,
3470,
26458,
29918,
15060,
29962,
353,
5159,
13,
462,
1678,
1634,
4620,
4110,
29918,
1609,
29918,
3470,
26458,
29918,
2055,
1169,
29961,
3470,
26458,
29918,
15060,
1822,
21843,
29898,
13,
462,
4706,
1634,
4620,
4110,
29918,
1609,
29918,
3470,
26458,
29918,
15060,
29961,
3470,
26458,
29918,
15060,
29962,
13,
462,
1678,
1723,
13,
13,
1678,
565,
13761,
322,
451,
6389,
29889,
29881,
719,
29918,
3389,
29901,
13,
4706,
396,
14405,
15201,
25741,
411,
1021,
4148,
29889,
13,
4706,
1634,
4620,
4110,
29918,
1609,
29918,
5150,
943,
353,
6571,
13,
4706,
15201,
29918,
2055,
1169,
29918,
1609,
29918,
5150,
943,
353,
6571,
13,
13,
4706,
363,
9063,
29918,
20970,
29892,
1634,
4620,
4110,
297,
1634,
4620,
4110,
29918,
1609,
29918,
3470,
26458,
29918,
2055,
1169,
29889,
7076,
7295,
13,
9651,
937,
29918,
15060,
353,
13761,
29889,
15060,
29898,
15060,
29918,
20970,
29897,
13,
9651,
4148,
353,
937,
29918,
15060,
29889,
8921,
13,
9651,
15201,
29918,
2055,
1169,
353,
15201,
29918,
2055,
1169,
29918,
1609,
29918,
5150,
943,
29889,
657,
29898,
8921,
29892,
731,
3101,
13,
9651,
15201,
29918,
2055,
1169,
29889,
1202,
29898,
15060,
29918,
20970,
29897,
13,
9651,
15201,
29918,
2055,
1169,
29918,
1609,
29918,
5150,
943,
29961,
8921,
29962,
353,
15201,
29918,
2055,
1169,
13,
13,
4706,
363,
4148,
29892,
25741,
29918,
1609,
29918,
8921,
297,
15201,
29918,
2055,
1169,
29918,
1609,
29918,
5150,
943,
29889,
7076,
7295,
13,
9651,
15201,
29918,
2055,
1169,
353,
731,
580,
13,
9651,
1634,
4620,
4110,
353,
5159,
13,
9651,
565,
6389,
29889,
4572,
29918,
1609,
29918,
8921,
322,
4148,
2804,
4148,
29901,
13,
18884,
6773,
13,
9651,
363,
697,
29918,
15060,
297,
25741,
29918,
1609,
29918,
8921,
29901,
13,
18884,
15201,
29918,
2055,
1169,
29889,
1202,
29898,
650,
29918,
15060,
29897,
13,
18884,
1634,
4620,
4110,
29889,
21843,
29898,
3445,
4620,
4110,
29918,
1609,
29918,
3470,
26458,
29918,
2055,
1169,
29961,
650,
29918,
15060,
2314,
13,
9651,
1634,
4620,
4110,
29918,
1609,
29918,
5150,
943,
29961,
23583,
29898,
3470,
26458,
29918,
2055,
1169,
4638,
353,
1634,
4620,
4110,
13,
13,
4706,
396,
3394,
1634,
4620,
4110,
29892,
697,
15201,
9063,
29898,
29879,
29897,
491,
697,
29889,
13,
4706,
363,
25741,
29892,
1634,
4620,
4110,
297,
1634,
4620,
4110,
29918,
1609,
29918,
5150,
943,
29889,
7076,
7295,
13,
9651,
934,
29918,
24772,
353,
731,
580,
13,
9651,
363,
364,
297,
1634,
4620,
4110,
29901,
13,
18884,
411,
1722,
29898,
29878,
29889,
2084,
29892,
4464,
543,
6050,
29974,
1159,
408,
934,
29901,
13,
462,
1678,
364,
29889,
7302,
29898,
1445,
29897,
13,
462,
1678,
934,
29918,
24772,
29889,
1202,
29898,
1445,
29889,
978,
29897,
13,
13,
18884,
3309,
29918,
4181,
353,
7431,
29898,
29878,
29889,
3051,
29897,
448,
364,
29889,
2848,
13,
18884,
1634,
4620,
4110,
29918,
262,
29918,
17642,
29918,
1445,
353,
1634,
4620,
4110,
29918,
1609,
29918,
24772,
29961,
29878,
29889,
2084,
29962,
13,
18884,
565,
3309,
29918,
4181,
2804,
29871,
29900,
322,
7431,
29898,
3445,
4620,
4110,
29918,
262,
29918,
17642,
29918,
1445,
1125,
13,
462,
1678,
396,
3394,
16920,
1269,
931,
29892,
322,
594,
4900,
342,
9210,
310,
1634,
4620,
4110,
1156,
372,
13,
462,
1678,
2380,
353,
7581,
29918,
4478,
29898,
3445,
4620,
4110,
29918,
262,
29918,
17642,
29918,
1445,
29892,
14013,
337,
29901,
364,
29889,
10289,
448,
337,
29889,
10289,
29897,
13,
462,
1678,
363,
337,
297,
4256,
8504,
29889,
275,
5897,
29898,
3445,
4620,
4110,
29918,
262,
29918,
17642,
29918,
1445,
29892,
2380,
29892,
6213,
1125,
13,
462,
4706,
337,
29889,
10289,
353,
337,
29889,
10289,
718,
3309,
29918,
4181,
13,
13,
462,
1678,
396,
3349,
1857,
16920,
363,
5434,
2253,
2740,
4180,
29889,
13,
462,
1678,
628,
1634,
4620,
4110,
29918,
262,
29918,
17642,
29918,
1445,
29961,
2248,
29962,
13,
462,
1678,
1634,
4620,
4110,
29918,
1609,
29918,
24772,
29961,
29878,
29889,
2084,
29962,
353,
1634,
4620,
4110,
29918,
262,
29918,
17642,
29918,
1445,
13,
13,
9651,
565,
451,
6389,
29889,
1217,
29918,
15060,
322,
7431,
29898,
1445,
29918,
24772,
29897,
2804,
29871,
29900,
29901,
13,
18884,
13761,
29889,
2248,
29889,
1202,
29898,
1445,
29918,
24772,
29892,
7700,
29897,
13,
13,
18884,
396,
2309,
411,
1857,
9063,
29892,
1207,
716,
697,
13,
18884,
937,
29918,
15060,
353,
13761,
29889,
15060,
29898,
2055,
1169,
29961,
29900,
2314,
13,
13,
18884,
396,
2999,
25741,
526,
15201,
29901,
13,
18884,
396,
6410,
2222,
16920,
338,
9301,
313,
17405,
19574,
467,
13,
18884,
396,
9479,
1653,
263,
716,
9063,
322,
1018,
304,
11551,
3041,
290,
362,
13,
18884,
396,
515,
2441,
25741,
408,
1568,
408,
1950,
29889,
13,
18884,
9063,
29918,
7645,
353,
285,
29908,
20095,
29899,
4830,
29901,
337,
4830,
322,
3013,
1999,
420,
5235,
29908,
13,
18884,
13761,
29889,
2248,
29889,
15060,
29898,
15060,
29918,
7645,
29892,
4148,
29922,
4102,
29918,
15060,
29889,
8921,
29897,
13,
13,
1678,
565,
451,
6389,
29889,
29881,
719,
29918,
3389,
322,
1634,
4620,
4110,
29918,
1609,
29918,
24772,
29918,
6194,
29901,
13,
4706,
934,
29918,
24772,
353,
731,
29898,
3445,
4620,
4110,
29918,
1609,
29918,
24772,
29918,
6194,
29889,
8149,
3101,
13,
4706,
363,
2224,
29892,
1634,
4620,
4110,
297,
1634,
4620,
4110,
29918,
1609,
29918,
24772,
29918,
6194,
29889,
7076,
7295,
13,
9651,
363,
364,
297,
1634,
4620,
4110,
29901,
13,
18884,
411,
1722,
29898,
2084,
29892,
4464,
543,
6050,
29974,
1159,
408,
934,
29901,
13,
462,
1678,
364,
29889,
7302,
29898,
1445,
29897,
13,
462,
1678,
934,
29918,
24772,
29889,
1202,
29898,
1445,
29889,
978,
29897,
13,
13,
18884,
3309,
29918,
4181,
353,
7431,
29898,
29878,
29889,
3051,
29897,
448,
364,
29889,
2848,
13,
18884,
1634,
4620,
4110,
29918,
262,
29918,
17642,
29918,
1445,
353,
1634,
4620,
4110,
29918,
1609,
29918,
24772,
29918,
6194,
29961,
2084,
29962,
13,
18884,
565,
3309,
29918,
4181,
2804,
29871,
29900,
322,
7431,
29898,
3445,
4620,
4110,
29918,
262,
29918,
17642,
29918,
1445,
1125,
13,
462,
1678,
396,
3394,
16920,
1269,
931,
29892,
322,
594,
4900,
342,
9210,
310,
1634,
4620,
4110,
1156,
372,
13,
462,
1678,
2380,
353,
7581,
29918,
4478,
29898,
3445,
4620,
4110,
29918,
262,
29918,
17642,
29918,
1445,
29892,
14013,
337,
29901,
364,
29889,
10289,
448,
337,
29889,
10289,
29897,
13,
462,
1678,
363,
337,
297,
4256,
8504,
29889,
275,
5897,
29898,
3445,
4620,
4110,
29918,
262,
29918,
17642,
29918,
1445,
29892,
2380,
29892,
6213,
1125,
13,
462,
4706,
337,
29889,
10289,
353,
337,
29889,
10289,
718,
3309,
29918,
4181,
13,
13,
462,
1678,
396,
3349,
1857,
16920,
363,
5434,
2253,
2740,
4180,
29889,
13,
462,
1678,
628,
1634,
4620,
4110,
29918,
262,
29918,
17642,
29918,
1445,
29961,
2248,
29962,
13,
462,
1678,
1634,
4620,
4110,
29918,
1609,
29918,
24772,
29961,
2084,
29962,
353,
1634,
4620,
4110,
29918,
262,
29918,
17642,
29918,
1445,
13,
13,
4706,
565,
13761,
322,
451,
6389,
29889,
1217,
29918,
15060,
322,
7431,
29898,
1445,
29918,
24772,
29897,
2804,
29871,
29900,
29901,
13,
9651,
13761,
29889,
2248,
29889,
1202,
29898,
1445,
29918,
24772,
29892,
7700,
29897,
13,
9651,
9063,
29918,
7645,
353,
285,
29908,
20095,
29899,
4830,
29901,
3402,
443,
15060,
11561,
29908,
13,
9651,
13761,
29889,
5559,
29889,
15060,
703,
29899,
29885,
613,
9063,
29918,
7645,
29892,
4148,
29922,
5085,
29889,
8921,
29897,
13,
13,
1678,
1596,
29898,
13,
4706,
285,
29908,
2481,
560,
28170,
29901,
426,
14486,
29898,
2230,
29889,
2230,
580,
448,
1369,
2230,
29892,
29871,
29906,
2915,
269,
1213,
13,
4706,
718,
285,
29908,
426,
2435,
29898,
1761,
29898,
4572,
29898,
2892,
364,
29901,
364,
29961,
29900,
29962,
338,
451,
6213,
29892,
2582,
876,
2915,
310,
426,
2435,
29898,
5325,
2915,
934,
29898,
29879,
29897,
376,
13,
4706,
718,
4852,
3068,
367,
20917,
1213,
565,
6389,
29889,
29881,
719,
29918,
3389,
1683,
376,
689,
19667,
23157,
13,
1678,
1723,
13,
13,
13,
5215,
4036,
13,
13,
13,
1753,
6728,
29918,
1646,
29918,
3396,
7295,
13,
1678,
2594,
353,
20018,
4297,
29898,
280,
1351,
29922,
5574,
29892,
9449,
400,
29922,
29929,
29900,
29892,
3001,
29922,
29945,
29900,
29900,
29892,
2594,
29918,
2103,
29922,
29953,
29900,
29897,
13,
1678,
363,
474,
297,
3464,
29898,
29900,
29892,
29871,
29945,
29900,
29900,
1125,
13,
4706,
2594,
29889,
17263,
749,
29898,
29896,
29897,
13,
4706,
931,
29889,
17059,
29898,
29900,
29889,
29900,
29900,
29945,
29897,
13,
13,
13,
1753,
6728,
29918,
1646,
29918,
1688,
29898,
2848,
29892,
2594,
29892,
12463,
29918,
1646,
1125,
13,
1678,
3933,
353,
3309,
13,
1678,
1550,
3933,
1405,
29871,
29900,
29901,
13,
4706,
7431,
353,
4036,
29889,
9502,
524,
29898,
29900,
29892,
3933,
29897,
13,
4706,
3933,
22361,
7431,
13,
4706,
931,
29889,
17059,
29898,
29900,
29889,
29900,
29900,
29896,
29897,
13,
4706,
2594,
29889,
842,
29918,
18035,
29898,
29896,
29900,
29900,
334,
313,
2848,
448,
3933,
29897,
847,
3309,
29897,
13,
1678,
12463,
29918,
1646,
29889,
17263,
749,
29898,
29896,
29897,
13,
13,
13,
1753,
6728,
29918,
28408,
29918,
3396,
29898,
11228,
29918,
1066,
1125,
13,
1678,
8455,
353,
6674,
307,
985,
292,
29889,
3260,
580,
13,
1678,
411,
6674,
307,
985,
292,
29889,
11426,
29898,
5014,
267,
29922,
29953,
29897,
408,
11565,
29901,
13,
4706,
2159,
353,
29871,
29941,
13,
4706,
3001,
353,
29871,
29896,
29900,
29900,
29900,
29900,
13,
4706,
2847,
29918,
1066,
353,
2847,
29918,
1066,
13,
4706,
22306,
353,
20018,
29933,
1503,
29898,
13,
9651,
29850,
18035,
29913,
426,
295,
28170,
29913,
891,
426,
1646,
29913,
891,
426,
1745,
17225,
17671,
13,
9651,
2159,
29892,
13,
9651,
5967,
29922,
5574,
29892,
13,
9651,
2847,
29918,
1066,
7607,
11228,
29918,
1066,
29961,
29900,
29962,
718,
29871,
29896,
29892,
2847,
29918,
1066,
29961,
29896,
11724,
13,
9651,
12463,
29918,
7827,
29922,
7827,
29892,
13,
9651,
8455,
29922,
12847,
29892,
13,
4706,
1723,
13,
13,
4706,
11565,
29889,
8508,
1958,
29918,
12674,
29898,
13,
9651,
6728,
29918,
1646,
29918,
1688,
29892,
13,
9651,
17288,
8172,
29889,
9502,
524,
29898,
29896,
29900,
29900,
29900,
29892,
29871,
29896,
29900,
29900,
29900,
29900,
511,
22306,
29961,
29875,
1402,
22306,
29889,
957,
497,
29897,
363,
474,
297,
3464,
29898,
7827,
29897,
1402,
13,
4706,
13742,
657,
580,
13,
4706,
11565,
29889,
5358,
580,
13,
4706,
11565,
29889,
7122,
580,
13,
13,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
1678,
2847,
29918,
1066,
353,
20018,
4297,
29889,
657,
1066,
580,
13,
1678,
396,
2847,
29918,
1066,
353,
313,
11228,
29918,
1066,
29961,
29900,
29962,
448,
29871,
29896,
29892,
2847,
29918,
1066,
29961,
29896,
2314,
13,
1678,
13761,
29918,
4830,
29918,
3396,
29898,
11228,
29918,
1066,
29897,
13,
1678,
396,
6728,
29918,
1646,
29918,
3396,
580,
13,
1678,
396,
6728,
29918,
28408,
29918,
3396,
29898,
11228,
29918,
1066,
29897,
13,
13,
15945,
29908,
869,
695,
574,
29899,
4830,
13,
5634,
13,
21233,
29901,
315,
407,
13,
6638,
2111,
3709,
10302,
29901,
17411,
29906,
29915,
13,
2499,
647,
13555,
6585,
28183,
3522,
29901,
838,
647,
13,
2499,
647,
1168,
3471,
11067,
15735,
1883,
29901,
525,
3009,
29915,
13,
2499,
647,
1168,
3471,
11067,
7900,
647,
1860,
29901,
525,
4541,
29915,
13,
2499,
647,
1168,
3471,
11067,
6185,
4675,
800,
29901,
525,
4541,
29915,
13,
2499,
647,
29923,
1557,
10501,
4373,
9012,
29901,
19941,
13,
2499,
647,
7094,
4167,
29901,
525,
3009,
29915,
13,
2499,
647,
5323,
6504,
1523,
1860,
29901,
525,
3009,
29915,
13,
15930,
3596,
26915,
2951,
9190,
3542,
29901,
525,
3009,
29915,
13,
15930,
3596,
23770,
15514,
19427,
2951,
9190,
3542,
29901,
525,
3009,
29915,
13,
15930,
3596,
11507,
2776,
6185,
23838,
2951,
9190,
3542,
29901,
525,
3009,
29915,
13,
15930,
21322,
7445,
29879,
2951,
3289,
292,
280,
3542,
29901,
525,
4541,
29915,
13,
15930,
21322,
8259,
4775,
29879,
2951,
3289,
292,
280,
3542,
29901,
525,
4541,
29915,
13,
15930,
21322,
6678,
29879,
2951,
3289,
292,
280,
3542,
29901,
2812,
2349,
13,
15930,
21322,
3644,
9513,
4110,
2951,
3289,
292,
280,
3542,
29901,
13932,
27406,
13,
15930,
21322,
29931,
1117,
17370,
2951,
3289,
292,
280,
3542,
29901,
6213,
13,
15930,
21322,
3410,
3554,
2951,
3289,
292,
280,
3542,
29901,
525,
3009,
29915,
13,
2499,
1994,
20130,
557,
13555,
14683,
11609,
1542,
29901,
6213,
13,
2499,
1994,
20130,
557,
13555,
11609,
1542,
29901,
6213,
13,
2499,
1994,
20130,
557,
18743,
6857,
309,
457,
26545,
29901,
525,
4541,
29915,
13,
2499,
1994,
20130,
557,
6733,
6185,
4675,
800,
29901,
525,
8241,
29915,
13,
29933,
262,
16638,
26915,
29901,
525,
3009,
29915,
13,
29933,
262,
16638,
11507,
29901,
525,
3009,
29915,
13,
29933,
25525,
29956,
336,
3262,
29901,
13,
29871,
2860,
8259,
4775,
29901,
525,
4541,
29915,
13,
29871,
2860,
2385,
29901,
525,
4541,
29915,
13,
29871,
2860,
4809,
14473,
29901,
525,
4541,
29915,
13,
29871,
2860,
16854,
29901,
525,
4541,
29915,
13,
29871,
2860,
6678,
29901,
525,
3009,
29915,
13,
29871,
2860,
23335,
29901,
525,
3009,
29915,
13,
29871,
2860,
9930,
29907,
6185,
23838,
29901,
525,
4541,
29915,
13,
29871,
2860,
19560,
29901,
525,
4541,
29915,
13,
29871,
2860,
19986,
29901,
525,
4541,
29915,
13,
29871,
2860,
1252,
725,
7445,
29901,
525,
4541,
29915,
13,
29871,
10949,
29907,
905,
29901,
525,
4541,
29915,
13,
29871,
10949,
27406,
29901,
525,
4541,
29915,
13,
29871,
1894,
296,
28183,
778,
29901,
525,
4541,
29915,
13,
29871,
26178,
8915,
6678,
29901,
525,
3009,
29915,
13,
29871,
26178,
8915,
9182,
29901,
525,
3009,
29915,
13,
29871,
26178,
8915,
23335,
29901,
525,
3009,
29915,
13,
20130,
557,
18743,
25196,
7094,
4097,
29901,
10050,
7900,
10194,
13,
20130,
557,
18743,
28183,
778,
29901,
8701,
13,
20130,
557,
18743,
29911,
824,
653,
7094,
4097,
29901,
525,
3009,
29915,
13,
20130,
557,
23770,
15514,
19427,
29901,
10949,
1625,
265,
13,
20130,
557,
797,
27069,
749,
1293,
29901,
10949,
1625,
265,
13,
20130,
557,
1231,
24938,
1338,
29901,
525,
3009,
29915,
13,
4409,
24445,
29901,
525,
29896,
29906,
29900,
29915,
13,
6843,
627,
8659,
22459,
29901,
525,
4541,
29915,
13,
23770,
15514,
3950,
3596,
2951,
6716,
3542,
2816,
6716,
5894,
3542,
29901,
525,
3009,
29915,
13,
23770,
15514,
3950,
2568,
296,
6110,
29901,
525,
29946,
29915,
13,
1323,
8675,
362,
2568,
296,
6110,
29901,
525,
29946,
29915,
13,
29907,
407,
29896,
29896,
29933,
945,
287,
1293,
5568,
29901,
525,
3009,
29915,
13,
15383,
573,
14516,
14658,
29901,
525,
4541,
29915,
13,
4205,
519,
5809,
29901,
525,
4541,
29915,
13,
1252,
27910,
12300,
6362,
522,
29933,
262,
16638,
292,
29901,
525,
4541,
29915,
13,
29943,
861,
23335,
1523,
1860,
29901,
525,
3009,
29915,
13,
2831,
9760,
15735,
1883,
29901,
6024,
13150,
742,
525,
5800,
1525,
2477,
29950,
742,
525,
29934,
24336,
29903,
29918,
22051,
742,
525,
29882,
1761,
29918,
1454,
29918,
4204,
29918,
8269,
29918,
19878,
742,
525,
29882,
1761,
29918,
1454,
29918,
4204,
29918,
8269,
742,
525,
29882,
1761,
29918,
1454,
29918,
4204,
29918,
8269,
29918,
3166,
742,
525,
29882,
1761,
29918,
1454,
29918,
4204,
29918,
8269,
29918,
11177,
742,
525,
29882,
1761,
29918,
1454,
29918,
4204,
29918,
11177,
742,
525,
1761,
29918,
1454,
29918,
4204,
29918,
8269,
742,
525,
1761,
29918,
1454,
29918,
4204,
29918,
8269,
29918,
19878,
742,
525,
1761,
29918,
1454,
29918,
4204,
29918,
8269,
29918,
19878,
29918,
24244,
742,
525,
1761,
29918,
1454,
29918,
4204,
29918,
8269,
29918,
3166,
742,
525,
1761,
29918,
1454,
29918,
4204,
29918,
8269,
29918,
24244,
742,
525,
1761,
29918,
1454,
29918,
4204,
29918,
8269,
29918,
11177,
742,
525,
1761,
29918,
1454,
29918,
4204,
29918,
8269,
29918,
11177,
29918,
19878,
742,
525,
1761,
29918,
1454,
29918,
4204,
29918,
8269,
29918,
11177,
29918,
3166,
742,
525,
1761,
29918,
1454,
29918,
4204,
29918,
8269,
29918,
11177,
29918,
24244,
742,
525,
1761,
29918,
1454,
29918,
4204,
29918,
3166,
742,
525,
1761,
29918,
1454,
29918,
4204,
29918,
16304,
742,
525,
1761,
29918,
1454,
29918,
4204,
29918,
16304,
29918,
11177,
742,
525,
1761,
29918,
1454,
29918,
4204,
29918,
11177,
2033,
13,
24933,
3871,
15735,
1883,
29901,
6024,
1254,
11375,
29918,
9800,
742,
525,
24360,
2033,
13,
29419,
7445,
29879,
29901,
2169,
29878,
1132,
13,
29419,
3624,
6330,
4597,
735,
29901,
525,
4197,
29899,
29918,
850,
1688,
29989,
348,
27958,
876,
29973,
29938,
29915,
13,
2568,
296,
8259,
4775,
29879,
29901,
525,
3009,
29915,
13,
2568,
296,
18009,
17392,
3145,
29901,
6213,
13,
2568,
296,
6110,
29901,
525,
29946,
29915,
13,
2568,
296,
29956,
336,
2986,
6678,
8659,
29901,
525,
4541,
29915,
13,
9598,
1022,
8915,
20261,
4178,
1576,
4763,
2776,
7445,
29879,
29901,
525,
4541,
29915,
13,
7976,
8915,
20261,
1762,
9598,
1022,
29901,
525,
29941,
29915,
13,
23335,
2568,
9233,
29901,
6213,
13,
29925,
264,
18745,
20130,
557,
7900,
10194,
29901,
525,
29906,
29915,
13,
29925,
264,
18745,
20130,
557,
18743,
6730,
5594,
9329,
29901,
525,
29896,
29915,
13,
29925,
264,
18745,
20130,
557,
20001,
29901,
525,
29941,
29900,
29900,
29915,
13,
29925,
264,
18745,
20130,
557,
6730,
29931,
404,
29931,
404,
29901,
525,
29896,
29906,
29900,
29915,
13,
29925,
264,
18745,
20130,
557,
1231,
29901,
525,
29896,
29900,
29900,
29900,
29915,
13,
29925,
264,
18745,
20130,
557,
6733,
6185,
23838,
29901,
525,
29896,
29900,
29915,
13,
29925,
264,
18745,
1252,
985,
20755,
29901,
525,
29896,
29900,
29900,
29900,
29900,
29900,
29900,
29915,
13,
29925,
264,
18745,
11609,
1542,
2951,
29902,
1372,
29949,
1233,
3542,
29901,
525,
29945,
29900,
29900,
29915,
13,
14516,
14658,
29901,
10428,
13,
22131,
1231,
2500,
1446,
29901,
13,
29871,
448,
17088,
29901,
315,
407,
13,
1678,
5556,
13083,
414,
29901,
13,
418,
448,
525,
617,
29915,
13,
418,
448,
525,
4174,
29915,
13,
418,
448,
525,
8223,
29915,
13,
418,
448,
525,
29907,
407,
29915,
13,
418,
448,
525,
6271,
29925,
29915,
13,
418,
448,
525,
29883,
1817,
29915,
13,
418,
448,
525,
29907,
1817,
29915,
13,
1678,
1815,
265,
936,
13157,
19657,
29901,
6629,
13,
1678,
16564,
2951,
5568,
29901,
5386,
13,
29871,
448,
17088,
29901,
3992,
1184,
517,
13,
1678,
5556,
13083,
414,
29901,
13,
418,
448,
525,
24381,
29915,
13,
418,
448,
525,
29925,
29933,
29915,
13,
418,
448,
525,
17529,
29915,
13,
418,
448,
525,
8618,
4986,
29915,
13,
1678,
1174,
11291,
292,
6678,
29879,
29901,
13,
418,
448,
11243,
1338,
1184,
517,
13,
418,
448,
11243,
440,
1762,
1184,
517,
13,
418,
448,
349,
1718,
1660,
29918,
26092,
25758,
29918,
16975,
29918,
8618,
4986,
13,
418,
448,
349,
1718,
1660,
29918,
18267,
29918,
8618,
4986,
13,
418,
448,
349,
1718,
1660,
29918,
16975,
29918,
8618,
4986,
13,
418,
448,
20969,
1626,
2816,
16334,
13,
418,
448,
20969,
1626,
1184,
517,
2816,
16334,
13,
1678,
1815,
265,
936,
13157,
19657,
29901,
6629,
13,
1678,
16564,
2951,
5568,
29901,
5386,
13,
1123,
1731,
1523,
1860,
29901,
525,
3009,
29915,
13,
13685,
797,
27722,
29901,
525,
4541,
29915,
13,
13685,
15156,
6185,
4675,
800,
29901,
525,
4541,
29915,
13,
14936,
13555,
29907,
5568,
15738,
29901,
525,
4541,
29915,
13,
14936,
13555,
3403,
936,
3664,
29901,
525,
4541,
29915,
13,
14936,
13555,
6733,
2558,
1742,
29901,
525,
3009,
29915,
13,
14936,
18743,
7900,
10194,
7094,
4097,
29901,
525,
3009,
29915,
13,
14936,
18743,
29907,
407,
29896,
29896,
29933,
945,
287,
1293,
29901,
525,
4541,
29915,
13,
14936,
18743,
29907,
7345,
15514,
3950,
1625,
265,
29901,
525,
3009,
29915,
13,
14936,
18743,
797,
27069,
749,
1625,
265,
29901,
525,
3009,
29915,
13,
14936,
18743,
2177,
575,
29901,
11264,
9513,
4110,
13,
14936,
18743,
6069,
29933,
1463,
2831,
18405,
1625,
265,
29901,
525,
3009,
29915,
13,
14936,
797,
8915,
2177,
9097,
21523,
29901,
525,
4541,
29915,
13,
5592,
3302,
18743,
5323,
6504,
1523,
1860,
29901,
525,
29896,
29915,
13,
5592,
3302,
797,
9928,
793,
29901,
525,
4541,
29915,
13,
5592,
3302,
797,
29907,
5568,
15738,
2177,
9097,
21523,
29901,
525,
4541,
29915,
13,
5592,
3302,
797,
7895,
24938,
1338,
29901,
525,
4541,
29915,
13,
5592,
3302,
797,
2177,
9097,
21523,
29901,
525,
4541,
29915,
13,
5592,
3302,
797,
29903,
4718,
28183,
9737,
29901,
525,
4541,
29915,
13,
15449,
29901,
11133,
13,
14473,
15735,
1883,
29901,
6024,
1649,
26026,
29918,
348,
3880,
2033,
13,
8863,
6110,
29901,
525,
29946,
29915,
13,
11403,
8863,
29901,
12391,
13,
856,
13,
15945,
29908,
13,
2
] |
Python programming/tail.py | fredffsixty/Medical_Imaging | 0 | 179038 | """
tail.py stringa [-c] carattere | [-]numero stampa la sottostringa a partire dall'ultima occorrenza
di carattere, opzionalmente specificato con il parametro '-c', ovvero stampa la sottostringa a partire
dalla posizione specificata da numero eventualmente anche negativo
"""
import sys
def lastIndexOf(s, c):
"""
lastIndexOf(stringa, carattere) restituisce un intero
nell'intervallo 0 - len(stringa) che corrisponde all'indice dell'ultima
occorrenza di carattere in stringa. Se il risultato è esattamente
len(stringa) allora carattere non è presente in stringa.
"""
index = s[::-1].find(c)
if index == -1:
return len(s)
else:
return len(s) - 1 - index
def main():
if (len(sys.argv) < 3 or len(sys.argv) > 4):
print('Argomenti errati\n\nUtilizzo: tail2.py stringa [-c] carattere | [-]numero')
sys.exit()
elif len(sys.argv) == 3 and \
not(sys.argv[2].isdigit() or (sys.argv[2][0]=='-' and sys.argv[2][1::].isdigit())) and \
len(sys.argv[2])!=1:
print('Argomenti errati\n\nUtilizzo: tail2.py stringa [-c] carattere | [-]numero')
sys.exit()
elif len(sys.argv) == 4 and sys.argv[2]!='-c':
print('Argomenti errati\n\nUtilizzo: tail2.py stringa [-c] carattere | [-]numero')
sys.exit()
else:
if sys.argv[2].isdigit() or (sys.argv[2][0]=='-' and sys.argv[2][1::].isdigit()):
index = int(sys.argv[2])
if index < -len(sys.argv[1]) or index >= len(sys.argv[1]):
print('Indice specificato fuori dal range\n\n')
sys.exit()
else:
print(sys.argv[1][index::])
else:
if sys.argv[2] == '-c':
position = lastIndexOf(sys.argv[1],sys.argv[3])
else:
position = lastIndexOf(sys.argv[1],sys.argv[2])
if position == len(sys.argv[1]):
print('Il carattere non è presente nella stringa\n\n')
sys.exit()
else:
print(sys.argv[1][position::])
if __name__ == '__main__':
main() | [
1,
9995,
13,
18237,
29889,
2272,
1347,
29874,
21069,
29883,
29962,
20044,
29872,
891,
21069,
29962,
1949,
1489,
380,
20056,
425,
17217,
1807,
29874,
263,
760,
533,
8912,
29915,
499,
2946,
2179,
272,
1267,
1362,
13,
6051,
20044,
29872,
29892,
1015,
29920,
1848,
2689,
2702,
1219,
378,
980,
25011,
307,
17411,
29883,
742,
15397,
369,
29877,
380,
20056,
425,
17217,
1807,
29874,
263,
760,
533,
13,
29881,
9864,
926,
8447,
2702,
532,
1146,
17910,
1741,
14162,
5978,
3480,
11692,
13,
15945,
29908,
13,
13,
5215,
10876,
13,
13,
13,
1753,
1833,
3220,
2776,
29898,
29879,
29892,
274,
1125,
13,
1678,
9995,
13,
1678,
1833,
3220,
2776,
29898,
1807,
29874,
29892,
20044,
29872,
29897,
1791,
1981,
17438,
443,
1006,
29877,
13,
1678,
10099,
29915,
19207,
417,
29871,
29900,
448,
7431,
29898,
1807,
29874,
29897,
923,
1034,
3780,
1112,
311,
599,
29915,
513,
625,
3572,
29915,
499,
2946,
13,
1678,
2179,
272,
1267,
1362,
652,
20044,
29872,
297,
1347,
29874,
29889,
922,
980,
24119,
1219,
2077,
831,
1131,
2503,
29871,
13,
1678,
7431,
29898,
1807,
29874,
29897,
599,
2207,
20044,
29872,
1661,
2077,
20753,
297,
1347,
29874,
29889,
13,
1678,
9995,
13,
13,
1678,
2380,
353,
269,
29961,
1057,
29899,
29896,
1822,
2886,
29898,
29883,
29897,
13,
13,
1678,
565,
2380,
1275,
448,
29896,
29901,
13,
4706,
736,
7431,
29898,
29879,
29897,
13,
1678,
1683,
29901,
13,
4706,
736,
7431,
29898,
29879,
29897,
448,
29871,
29896,
448,
2380,
13,
13,
13,
1753,
1667,
7295,
13,
13,
1678,
565,
313,
2435,
29898,
9675,
29889,
19218,
29897,
529,
29871,
29941,
470,
7431,
29898,
9675,
29889,
19218,
29897,
1405,
29871,
29946,
1125,
29871,
13,
4706,
1596,
877,
8559,
2932,
29875,
4589,
2219,
29905,
29876,
29905,
29876,
7270,
466,
2502,
29901,
12464,
29906,
29889,
2272,
1347,
29874,
21069,
29883,
29962,
20044,
29872,
891,
21069,
29962,
1949,
1489,
1495,
13,
4706,
10876,
29889,
13322,
580,
13,
1678,
25342,
7431,
29898,
9675,
29889,
19218,
29897,
1275,
29871,
29941,
322,
320,
13,
4706,
451,
29898,
9675,
29889,
19218,
29961,
29906,
1822,
275,
26204,
580,
470,
313,
9675,
29889,
19218,
29961,
29906,
3816,
29900,
29962,
1360,
28560,
29915,
322,
10876,
29889,
19218,
29961,
29906,
3816,
29896,
1057,
1822,
275,
26204,
22130,
322,
320,
13,
4706,
7431,
29898,
9675,
29889,
19218,
29961,
29906,
2314,
19216,
29896,
29901,
13,
4706,
1596,
877,
8559,
2932,
29875,
4589,
2219,
29905,
29876,
29905,
29876,
7270,
466,
2502,
29901,
12464,
29906,
29889,
2272,
1347,
29874,
21069,
29883,
29962,
20044,
29872,
891,
21069,
29962,
1949,
1489,
1495,
13,
4706,
10876,
29889,
13322,
580,
13,
1678,
25342,
7431,
29898,
9675,
29889,
19218,
29897,
1275,
29871,
29946,
322,
10876,
29889,
19218,
29961,
29906,
29962,
29991,
2433,
29899,
29883,
2396,
13,
4706,
1596,
877,
8559,
2932,
29875,
4589,
2219,
29905,
29876,
29905,
29876,
7270,
466,
2502,
29901,
12464,
29906,
29889,
2272,
1347,
29874,
21069,
29883,
29962,
20044,
29872,
891,
21069,
29962,
1949,
1489,
1495,
13,
4706,
10876,
29889,
13322,
580,
13,
1678,
1683,
29901,
13,
4706,
565,
10876,
29889,
19218,
29961,
29906,
1822,
275,
26204,
580,
470,
313,
9675,
29889,
19218,
29961,
29906,
3816,
29900,
29962,
1360,
28560,
29915,
322,
10876,
29889,
19218,
29961,
29906,
3816,
29896,
1057,
1822,
275,
26204,
580,
1125,
13,
9651,
2380,
353,
938,
29898,
9675,
29889,
19218,
29961,
29906,
2314,
13,
9651,
565,
2380,
529,
448,
2435,
29898,
9675,
29889,
19218,
29961,
29896,
2314,
470,
2380,
6736,
7431,
29898,
9675,
29889,
19218,
29961,
29896,
29962,
1125,
13,
18884,
1596,
877,
2568,
625,
2702,
1219,
4084,
4170,
2959,
3464,
29905,
29876,
29905,
29876,
1495,
13,
18884,
10876,
29889,
13322,
580,
13,
9651,
1683,
29901,
13,
18884,
1596,
29898,
9675,
29889,
19218,
29961,
29896,
3816,
2248,
1057,
2314,
13,
4706,
1683,
29901,
13,
9651,
565,
10876,
29889,
19218,
29961,
29906,
29962,
1275,
17411,
29883,
2396,
13,
18884,
2602,
353,
1833,
3220,
2776,
29898,
9675,
29889,
19218,
29961,
29896,
1402,
9675,
29889,
19218,
29961,
29941,
2314,
13,
9651,
1683,
29901,
13,
18884,
2602,
353,
1833,
3220,
2776,
29898,
9675,
29889,
19218,
29961,
29896,
1402,
9675,
29889,
19218,
29961,
29906,
2314,
13,
9651,
565,
2602,
1275,
7431,
29898,
9675,
29889,
19218,
29961,
29896,
29962,
1125,
13,
18884,
1596,
877,
14126,
20044,
29872,
1661,
2077,
20753,
4952,
1347,
29874,
29905,
29876,
29905,
29876,
1495,
13,
18884,
10876,
29889,
13322,
580,
13,
9651,
1683,
29901,
13,
18884,
1596,
29898,
9675,
29889,
19218,
29961,
29896,
3816,
3283,
1057,
2314,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
1667,
580,
2
] |
readthedocs/core/history.py | ashlyrclark/readthedocs.org | 0 | 83195 | <gh_stars>0
import logging
from functools import partial
from django import forms
from django.db import models
from django.utils.translation import ugettext_lazy as _
from simple_history.admin import SimpleHistoryAdmin
from simple_history.models import HistoricalRecords
from simple_history.utils import update_change_reason
log = logging.getLogger(__name__)
def set_change_reason(instance, reason):
"""
Set the change reason for the historical record created from the instance.
This method should be called before calling ``save()`` or ``delete``.
It sets `reason` to the `_change_reason` attribute of the instance,
that's used to create the historical record on the save/delete signals.
https://django-simple-history.readthedocs.io/en/latest/historical_model.html#change-reason # noqa
"""
instance._change_reason = reason
def safe_update_change_reason(instance, reason):
"""
Wrapper around update_change_reason to catch exceptions.
.. warning::
The implementation of django-simple-history's `update_change_reason`
is very brittle, as it queries for a previous historical record
that matches the attributes of the instance to update the ``change_reason``,
which could end up updating the wrong record, or not finding it.
If you already have control over the object, use `set_change_reason`
before updating/deleting the object instead.
That's more safe, since the attribute is passed to the signal
and used at the creation time of the record.
https://django-simple-history.readthedocs.io/en/latest/historical_model.html#change-reason # noqa
"""
try:
update_change_reason(instance=instance, reason=reason)
except Exception:
log.exception(
'An error occurred while updating the change reason of the instance: obj=%s',
instance,
)
class ExtraFieldsHistoricalModel(models.Model):
"""
Abstract model to allow history models track extra data.
Extra data includes:
- User information to retain after they have been deleted
- IP & browser
"""
extra_history_user_id = models.IntegerField(
_('ID'),
blank=True,
null=True,
db_index=True,
)
extra_history_user_username = models.CharField(
_('username'),
max_length=150,
null=True,
db_index=True,
)
extra_history_ip = models.CharField(
_('IP address'),
blank=True,
null=True,
max_length=250,
)
extra_history_browser = models.CharField(
_('Browser user-agent'),
max_length=250,
blank=True,
null=True,
)
class Meta:
abstract = True
ExtraHistoricalRecords = partial(HistoricalRecords, bases=[ExtraFieldsHistoricalModel])
"""Helper partial to use instead of HistoricalRecords."""
class ExtraSimpleHistoryAdmin(SimpleHistoryAdmin):
"""Set the change_reason on the model changed through this admin view."""
change_reason = None
def get_change_reason(self):
if self.change_reason:
return self.change_reason
klass = self.__class__.__name__
return f'origin=admin class={klass}'
def save_model(self, request, obj, form, change):
if obj:
set_change_reason(obj, self.get_change_reason())
super().save_model(request, obj, form, change)
def delete_model(self, request, obj):
if obj:
set_change_reason(obj, self.get_change_reason())
super().delete_model(request, obj)
class SimpleHistoryModelForm(forms.ModelForm):
"""Set the change_reason on the model changed through this form."""
change_reason = None
def get_change_reason(self):
if self.change_reason:
return self.change_reason
klass = self.__class__.__name__
return f'origin=form class={klass}'
def save(self, commit=True):
if self.instance:
set_change_reason(self.instance, self.get_change_reason())
return super().save(commit=commit)
class UpdateChangeReasonPostView:
"""
Set the change_reason on the model changed through the POST method of this view.
Use this class for views that don't use a form, like ``DeleteView``.
"""
change_reason = None
def get_change_reason(self):
if self.change_reason:
return self.change_reason
klass = self.__class__.__name__
return f'origin=form class={klass}'
def get_object(self):
obj = super().get_object()
set_change_reason(obj, self.get_change_reason())
return obj
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
5215,
12183,
13,
3166,
2090,
312,
8789,
1053,
7687,
13,
13,
3166,
9557,
1053,
7190,
13,
3166,
9557,
29889,
2585,
1053,
4733,
13,
3166,
9557,
29889,
13239,
29889,
3286,
18411,
1053,
318,
657,
726,
29918,
433,
1537,
408,
903,
13,
3166,
2560,
29918,
18434,
29889,
6406,
1053,
12545,
20570,
12754,
13,
3166,
2560,
29918,
18434,
29889,
9794,
1053,
20315,
4789,
4339,
13,
3166,
2560,
29918,
18434,
29889,
13239,
1053,
2767,
29918,
3167,
29918,
23147,
13,
13,
1188,
353,
12183,
29889,
657,
16363,
22168,
978,
1649,
29897,
13,
13,
13,
1753,
731,
29918,
3167,
29918,
23147,
29898,
8758,
29892,
2769,
1125,
13,
1678,
9995,
13,
1678,
3789,
278,
1735,
2769,
363,
278,
15839,
2407,
2825,
515,
278,
2777,
29889,
13,
13,
1678,
910,
1158,
881,
367,
2000,
1434,
5432,
4954,
7620,
2555,
29952,
470,
4954,
8143,
29952,
1412,
13,
1678,
739,
6166,
421,
23147,
29952,
304,
278,
19392,
3167,
29918,
23147,
29952,
5352,
310,
278,
2777,
29892,
13,
1678,
393,
29915,
29879,
1304,
304,
1653,
278,
15839,
2407,
373,
278,
4078,
29914,
8143,
18470,
29889,
13,
13,
1678,
2045,
597,
14095,
29899,
12857,
29899,
18434,
29889,
949,
386,
287,
12332,
29889,
601,
29914,
264,
29914,
12333,
29914,
16211,
936,
29918,
4299,
29889,
1420,
29937,
3167,
29899,
23147,
29871,
396,
694,
25621,
13,
1678,
9995,
13,
1678,
2777,
3032,
3167,
29918,
23147,
353,
2769,
13,
13,
13,
1753,
9109,
29918,
5504,
29918,
3167,
29918,
23147,
29898,
8758,
29892,
2769,
1125,
13,
1678,
9995,
13,
1678,
399,
6794,
2820,
2767,
29918,
3167,
29918,
23147,
304,
4380,
15283,
29889,
13,
13,
1678,
6317,
9177,
1057,
13,
13,
539,
450,
5314,
310,
9557,
29899,
12857,
29899,
18434,
29915,
29879,
421,
5504,
29918,
3167,
29918,
23147,
29952,
13,
539,
338,
1407,
6791,
29873,
280,
29892,
408,
372,
9365,
363,
263,
3517,
15839,
2407,
13,
539,
393,
7087,
278,
8393,
310,
278,
2777,
304,
2767,
278,
4954,
3167,
29918,
23147,
29952,
1673,
13,
539,
607,
1033,
1095,
701,
13271,
278,
2743,
2407,
29892,
470,
451,
9138,
372,
29889,
13,
13,
539,
960,
366,
2307,
505,
2761,
975,
278,
1203,
29892,
671,
421,
842,
29918,
3167,
29918,
23147,
29952,
13,
539,
1434,
13271,
29914,
311,
1026,
292,
278,
1203,
2012,
29889,
13,
539,
2193,
29915,
29879,
901,
9109,
29892,
1951,
278,
5352,
338,
4502,
304,
278,
7182,
13,
539,
322,
1304,
472,
278,
11265,
931,
310,
278,
2407,
29889,
13,
13,
4706,
2045,
597,
14095,
29899,
12857,
29899,
18434,
29889,
949,
386,
287,
12332,
29889,
601,
29914,
264,
29914,
12333,
29914,
16211,
936,
29918,
4299,
29889,
1420,
29937,
3167,
29899,
23147,
29871,
396,
694,
25621,
13,
1678,
9995,
13,
1678,
1018,
29901,
13,
4706,
2767,
29918,
3167,
29918,
23147,
29898,
8758,
29922,
8758,
29892,
2769,
29922,
23147,
29897,
13,
1678,
5174,
8960,
29901,
13,
4706,
1480,
29889,
11739,
29898,
13,
9651,
525,
2744,
1059,
10761,
1550,
13271,
278,
1735,
2769,
310,
278,
2777,
29901,
5446,
16328,
29879,
742,
13,
9651,
2777,
29892,
13,
4706,
1723,
13,
13,
13,
1990,
7338,
336,
14256,
29950,
2118,
936,
3195,
29898,
9794,
29889,
3195,
1125,
13,
13,
1678,
9995,
13,
1678,
25513,
1904,
304,
2758,
4955,
4733,
5702,
4805,
848,
29889,
13,
13,
1678,
7338,
336,
848,
7805,
29901,
13,
13,
1678,
448,
4911,
2472,
304,
11551,
1156,
896,
505,
1063,
11132,
13,
1678,
448,
5641,
669,
4714,
13,
1678,
9995,
13,
13,
1678,
4805,
29918,
18434,
29918,
1792,
29918,
333,
353,
4733,
29889,
7798,
3073,
29898,
13,
4706,
903,
877,
1367,
5477,
13,
4706,
9654,
29922,
5574,
29892,
13,
4706,
1870,
29922,
5574,
29892,
13,
4706,
4833,
29918,
2248,
29922,
5574,
29892,
13,
1678,
1723,
13,
1678,
4805,
29918,
18434,
29918,
1792,
29918,
6786,
353,
4733,
29889,
27890,
29898,
13,
4706,
903,
877,
6786,
5477,
13,
4706,
4236,
29918,
2848,
29922,
29896,
29945,
29900,
29892,
13,
4706,
1870,
29922,
5574,
29892,
13,
4706,
4833,
29918,
2248,
29922,
5574,
29892,
13,
1678,
1723,
13,
1678,
4805,
29918,
18434,
29918,
666,
353,
4733,
29889,
27890,
29898,
13,
4706,
903,
877,
5690,
3211,
5477,
13,
4706,
9654,
29922,
5574,
29892,
13,
4706,
1870,
29922,
5574,
29892,
13,
4706,
4236,
29918,
2848,
29922,
29906,
29945,
29900,
29892,
13,
1678,
1723,
13,
1678,
4805,
29918,
18434,
29918,
15965,
353,
4733,
29889,
27890,
29898,
13,
4706,
903,
877,
21537,
1404,
29899,
14748,
5477,
13,
4706,
4236,
29918,
2848,
29922,
29906,
29945,
29900,
29892,
13,
4706,
9654,
29922,
5574,
29892,
13,
4706,
1870,
29922,
5574,
29892,
13,
1678,
1723,
13,
13,
1678,
770,
20553,
29901,
13,
4706,
9846,
353,
5852,
13,
13,
13,
18126,
29950,
2118,
936,
4789,
4339,
353,
7687,
29898,
29950,
2118,
936,
4789,
4339,
29892,
22561,
11759,
18126,
14256,
29950,
2118,
936,
3195,
2314,
13,
15945,
29908,
10739,
7687,
304,
671,
2012,
310,
20315,
4789,
4339,
1213,
15945,
13,
13,
13,
1990,
7338,
336,
15427,
20570,
12754,
29898,
15427,
20570,
12754,
1125,
13,
13,
1678,
9995,
2697,
278,
1735,
29918,
23147,
373,
278,
1904,
3939,
1549,
445,
4113,
1776,
1213,
15945,
13,
13,
1678,
1735,
29918,
23147,
353,
6213,
13,
13,
1678,
822,
679,
29918,
3167,
29918,
23147,
29898,
1311,
1125,
13,
4706,
565,
1583,
29889,
3167,
29918,
23147,
29901,
13,
9651,
736,
1583,
29889,
3167,
29918,
23147,
13,
4706,
22902,
353,
1583,
17255,
1990,
1649,
17255,
978,
1649,
13,
4706,
736,
285,
29915,
12574,
29922,
6406,
770,
3790,
29895,
605,
10162,
13,
13,
1678,
822,
4078,
29918,
4299,
29898,
1311,
29892,
2009,
29892,
5446,
29892,
883,
29892,
1735,
1125,
13,
4706,
565,
5446,
29901,
13,
9651,
731,
29918,
3167,
29918,
23147,
29898,
5415,
29892,
1583,
29889,
657,
29918,
3167,
29918,
23147,
3101,
13,
4706,
2428,
2141,
7620,
29918,
4299,
29898,
3827,
29892,
5446,
29892,
883,
29892,
1735,
29897,
13,
13,
1678,
822,
5217,
29918,
4299,
29898,
1311,
29892,
2009,
29892,
5446,
1125,
13,
4706,
565,
5446,
29901,
13,
9651,
731,
29918,
3167,
29918,
23147,
29898,
5415,
29892,
1583,
29889,
657,
29918,
3167,
29918,
23147,
3101,
13,
4706,
2428,
2141,
8143,
29918,
4299,
29898,
3827,
29892,
5446,
29897,
13,
13,
13,
1990,
12545,
20570,
3195,
2500,
29898,
9514,
29889,
3195,
2500,
1125,
13,
13,
1678,
9995,
2697,
278,
1735,
29918,
23147,
373,
278,
1904,
3939,
1549,
445,
883,
1213,
15945,
13,
13,
1678,
1735,
29918,
23147,
353,
6213,
13,
13,
1678,
822,
679,
29918,
3167,
29918,
23147,
29898,
1311,
1125,
13,
4706,
565,
1583,
29889,
3167,
29918,
23147,
29901,
13,
9651,
736,
1583,
29889,
3167,
29918,
23147,
13,
4706,
22902,
353,
1583,
17255,
1990,
1649,
17255,
978,
1649,
13,
4706,
736,
285,
29915,
12574,
29922,
689,
770,
3790,
29895,
605,
10162,
13,
13,
1678,
822,
4078,
29898,
1311,
29892,
9063,
29922,
5574,
1125,
13,
4706,
565,
1583,
29889,
8758,
29901,
13,
9651,
731,
29918,
3167,
29918,
23147,
29898,
1311,
29889,
8758,
29892,
1583,
29889,
657,
29918,
3167,
29918,
23147,
3101,
13,
4706,
736,
2428,
2141,
7620,
29898,
15060,
29922,
15060,
29897,
13,
13,
13,
1990,
10318,
7277,
1123,
1658,
6747,
1043,
29901,
13,
13,
1678,
9995,
13,
1678,
3789,
278,
1735,
29918,
23147,
373,
278,
1904,
3939,
1549,
278,
11971,
1158,
310,
445,
1776,
29889,
13,
13,
1678,
4803,
445,
770,
363,
8386,
393,
1016,
29915,
29873,
671,
263,
883,
29892,
763,
4954,
12498,
1043,
29952,
1412,
13,
1678,
9995,
13,
13,
1678,
1735,
29918,
23147,
353,
6213,
13,
13,
1678,
822,
679,
29918,
3167,
29918,
23147,
29898,
1311,
1125,
13,
4706,
565,
1583,
29889,
3167,
29918,
23147,
29901,
13,
9651,
736,
1583,
29889,
3167,
29918,
23147,
13,
4706,
22902,
353,
1583,
17255,
1990,
1649,
17255,
978,
1649,
13,
4706,
736,
285,
29915,
12574,
29922,
689,
770,
3790,
29895,
605,
10162,
13,
13,
1678,
822,
679,
29918,
3318,
29898,
1311,
1125,
13,
4706,
5446,
353,
2428,
2141,
657,
29918,
3318,
580,
13,
4706,
731,
29918,
3167,
29918,
23147,
29898,
5415,
29892,
1583,
29889,
657,
29918,
3167,
29918,
23147,
3101,
13,
4706,
736,
5446,
13,
2
] |
src/dagos/core/package_managers.py | DAG-OS/dagos | 0 | 165812 | from __future__ import annotations
import os
import textwrap
import typing as t
from dagos.platform.command_runner import CommandRunner
class PackageManagerRegistry(type):
"""A metaclass responsible for registering supported package managers."""
managers: t.List[PackageManager] = []
def __call__(cls, *args: t.Any, **kwds: t.Any) -> t.Any:
manager = super().__call__(*args, **kwds)
if cls not in cls.managers:
cls.managers.append(manager)
return manager
@classmethod
def find(cls, name: str) -> t.Optional[PackageManager]:
for manager in cls.managers:
# TODO: Use a classproperty from boltons?
if manager.name() == name:
return manager
return None
class PackageManager(metaclass=PackageManagerRegistry):
"""A base class for all supported package managers.
Since the package manager may reside on a remote platform, e.g., within a
container image, implementing classes should not interact with the system
themselves but rather return commands to influence it."""
@classmethod
def name(cls) -> str:
"""The name of the package manager, defaults to the lower case class name."""
return str(cls.__name__).lower()
def install(self, packages: t.List[str], command_runner: CommandRunner) -> None:
"""Install the provided packages via the provided command_runner.
Args:
packages (t.List[str]): A list of packages to install.
command_runner (CommandRunner): A command runner instance to use for installing.
"""
# TODO: Check root privileges? Enable/disable via flag in class?
raise NotImplementedError
def clean(self, command_runner: CommandRunner) -> None:
"""Generate command line call for cleaning any redundant files of this
manager."""
return None
def refresh(self, command_runner: CommandRunner) -> None:
"""Refresh metadata from remote repository."""
raise NotImplementedError
class Apt(PackageManager):
def install(self, packages: t.List[str], command_runner: CommandRunner) -> None:
self.refresh(command_runner)
command_runner.run(
f"apt install -y --no-install-recommends {' '.join(packages)}"
)
def clean(self, command_runner: CommandRunner) -> None:
command_runner.run("apt clean")
def refresh(self, command_runner: CommandRunner) -> None:
command_runner.run("apt update")
class Dnf(PackageManager):
def install(self, packages: t.List[str], command_runner: CommandRunner) -> None:
command_runner.run(f"dnf install -y {' '.join(packages)}")
def clean(self, command_runner: CommandRunner) -> None:
command_runner.run("dnf clean all")
class Yum(PackageManager):
def install(self, packages: t.List[str], command_runner: CommandRunner) -> None:
command_runner.run(f"yum install -y {' '.join(packages)}")
class Pip(PackageManager):
def install(self, packages: t.List[str], command_runner: CommandRunner) -> None:
# TODO: How to handle different python versions?
command_runner.run(f"pip install {' '.join(packages)}")
class Choco(PackageManager):
def install(self, packages: t.List[str], command_runner: CommandRunner) -> None:
command_runner.run(f"choco install --yes {' '.join(packages)}")
class Sdkman(PackageManager):
@classmethod
def name(cls) -> str:
return "sdk"
def install(self, packages: t.List[str], command_runner: CommandRunner) -> None:
# In order to use sdk from the command line one needs to source its init script.
# This is not possible through the subprocess module. Therefore we use a temporary
# bash script in its stead.
tmp_file = f"/tmp/sdk-install-script-{os.getpid()}.sh"
script = textwrap.dedent(
f"""\
#!/bin/bash
source $HOME/.sdkman/bin/sdkman-init.sh
"""
)
for package in packages:
script += f"sdk install {package}\n"
command_runner.run(f"""bash -c 'echo "{script}" > {tmp_file}'""")
command_runner.run(f"chmod +x {tmp_file}")
command_runner.run(f".{tmp_file}")
command_runner.run(f"rm {tmp_file}")
Apt()
Dnf()
Yum()
Sdkman()
| [
1,
515,
4770,
29888,
9130,
1649,
1053,
25495,
13,
13,
5215,
2897,
13,
5215,
1426,
6312,
13,
5215,
19229,
408,
260,
13,
13,
3166,
12136,
359,
29889,
12120,
29889,
6519,
29918,
27492,
1053,
10516,
16802,
13,
13,
13,
1990,
22029,
3260,
22579,
29898,
1853,
1125,
13,
1678,
9995,
29909,
1539,
562,
605,
14040,
363,
6036,
292,
6969,
3577,
767,
18150,
1213,
15945,
13,
13,
1678,
767,
18150,
29901,
260,
29889,
1293,
29961,
14459,
3260,
29962,
353,
5159,
13,
13,
1678,
822,
4770,
4804,
12035,
25932,
29892,
334,
5085,
29901,
260,
29889,
10773,
29892,
3579,
11022,
6289,
29901,
260,
29889,
10773,
29897,
1599,
260,
29889,
10773,
29901,
13,
4706,
8455,
353,
2428,
2141,
1649,
4804,
1649,
10456,
5085,
29892,
3579,
11022,
6289,
29897,
13,
13,
4706,
565,
1067,
29879,
451,
297,
1067,
29879,
29889,
1171,
18150,
29901,
13,
9651,
1067,
29879,
29889,
1171,
18150,
29889,
4397,
29898,
12847,
29897,
13,
13,
4706,
736,
8455,
13,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
1284,
29898,
25932,
29892,
1024,
29901,
851,
29897,
1599,
260,
29889,
27636,
29961,
14459,
3260,
5387,
13,
4706,
363,
8455,
297,
1067,
29879,
29889,
1171,
18150,
29901,
13,
9651,
396,
14402,
29901,
4803,
263,
770,
6799,
515,
15772,
7453,
29973,
13,
9651,
565,
8455,
29889,
978,
580,
1275,
1024,
29901,
13,
18884,
736,
8455,
13,
4706,
736,
6213,
13,
13,
13,
1990,
22029,
3260,
29898,
2527,
562,
605,
29922,
14459,
3260,
22579,
1125,
13,
1678,
9995,
29909,
2967,
770,
363,
599,
6969,
3577,
767,
18150,
29889,
13,
13,
1678,
4001,
278,
3577,
8455,
1122,
620,
680,
373,
263,
7592,
7481,
29892,
321,
29889,
29887,
1696,
2629,
263,
13,
1678,
5639,
1967,
29892,
16049,
4413,
881,
451,
16254,
411,
278,
1788,
13,
1678,
6053,
541,
3265,
736,
8260,
304,
9949,
372,
1213,
15945,
13,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
1024,
29898,
25932,
29897,
1599,
851,
29901,
13,
4706,
9995,
1576,
1024,
310,
278,
3577,
8455,
29892,
21274,
304,
278,
5224,
1206,
770,
1024,
1213,
15945,
13,
4706,
736,
851,
29898,
25932,
17255,
978,
1649,
467,
13609,
580,
13,
13,
1678,
822,
2601,
29898,
1311,
29892,
9741,
29901,
260,
29889,
1293,
29961,
710,
1402,
1899,
29918,
27492,
29901,
10516,
16802,
29897,
1599,
6213,
29901,
13,
4706,
9995,
23271,
278,
4944,
9741,
3025,
278,
4944,
1899,
29918,
27492,
29889,
13,
13,
4706,
826,
3174,
29901,
13,
9651,
9741,
313,
29873,
29889,
1293,
29961,
710,
29962,
1125,
319,
1051,
310,
9741,
304,
2601,
29889,
13,
9651,
1899,
29918,
27492,
313,
6255,
16802,
1125,
319,
1899,
28877,
2777,
304,
671,
363,
15476,
29889,
13,
4706,
9995,
13,
4706,
396,
14402,
29901,
5399,
3876,
28091,
29973,
1174,
519,
29914,
20472,
3025,
7353,
297,
770,
29973,
13,
4706,
12020,
2216,
1888,
2037,
287,
2392,
13,
13,
1678,
822,
5941,
29898,
1311,
29892,
1899,
29918,
27492,
29901,
10516,
16802,
29897,
1599,
6213,
29901,
13,
4706,
9995,
5631,
403,
1899,
1196,
1246,
363,
5941,
292,
738,
28005,
2066,
310,
445,
13,
4706,
8455,
1213,
15945,
13,
4706,
736,
6213,
13,
13,
1678,
822,
11086,
29898,
1311,
29892,
1899,
29918,
27492,
29901,
10516,
16802,
29897,
1599,
6213,
29901,
13,
4706,
9995,
27132,
15562,
515,
7592,
9810,
1213,
15945,
13,
4706,
12020,
2216,
1888,
2037,
287,
2392,
13,
13,
13,
1990,
319,
415,
29898,
14459,
3260,
1125,
13,
1678,
822,
2601,
29898,
1311,
29892,
9741,
29901,
260,
29889,
1293,
29961,
710,
1402,
1899,
29918,
27492,
29901,
10516,
16802,
29897,
1599,
6213,
29901,
13,
4706,
1583,
29889,
22379,
29898,
6519,
29918,
27492,
29897,
13,
4706,
1899,
29918,
27492,
29889,
3389,
29898,
13,
9651,
285,
29908,
2156,
2601,
448,
29891,
1192,
1217,
29899,
6252,
29899,
276,
2055,
1975,
11117,
15300,
7122,
29898,
8318,
2915,
29908,
13,
4706,
1723,
13,
13,
1678,
822,
5941,
29898,
1311,
29892,
1899,
29918,
27492,
29901,
10516,
16802,
29897,
1599,
6213,
29901,
13,
4706,
1899,
29918,
27492,
29889,
3389,
703,
2156,
5941,
1159,
13,
13,
1678,
822,
11086,
29898,
1311,
29892,
1899,
29918,
27492,
29901,
10516,
16802,
29897,
1599,
6213,
29901,
13,
4706,
1899,
29918,
27492,
29889,
3389,
703,
2156,
2767,
1159,
13,
13,
13,
1990,
360,
29876,
29888,
29898,
14459,
3260,
1125,
13,
1678,
822,
2601,
29898,
1311,
29892,
9741,
29901,
260,
29889,
1293,
29961,
710,
1402,
1899,
29918,
27492,
29901,
10516,
16802,
29897,
1599,
6213,
29901,
13,
4706,
1899,
29918,
27492,
29889,
3389,
29898,
29888,
29908,
5200,
29888,
2601,
448,
29891,
11117,
15300,
7122,
29898,
8318,
2915,
1159,
13,
13,
1678,
822,
5941,
29898,
1311,
29892,
1899,
29918,
27492,
29901,
10516,
16802,
29897,
1599,
6213,
29901,
13,
4706,
1899,
29918,
27492,
29889,
3389,
703,
5200,
29888,
5941,
599,
1159,
13,
13,
13,
1990,
612,
398,
29898,
14459,
3260,
1125,
13,
1678,
822,
2601,
29898,
1311,
29892,
9741,
29901,
260,
29889,
1293,
29961,
710,
1402,
1899,
29918,
27492,
29901,
10516,
16802,
29897,
1599,
6213,
29901,
13,
4706,
1899,
29918,
27492,
29889,
3389,
29898,
29888,
29908,
29891,
398,
2601,
448,
29891,
11117,
15300,
7122,
29898,
8318,
2915,
1159,
13,
13,
13,
1990,
349,
666,
29898,
14459,
3260,
1125,
13,
1678,
822,
2601,
29898,
1311,
29892,
9741,
29901,
260,
29889,
1293,
29961,
710,
1402,
1899,
29918,
27492,
29901,
10516,
16802,
29897,
1599,
6213,
29901,
13,
4706,
396,
14402,
29901,
1128,
304,
4386,
1422,
3017,
6910,
29973,
13,
4706,
1899,
29918,
27492,
29889,
3389,
29898,
29888,
29908,
13096,
2601,
11117,
15300,
7122,
29898,
8318,
2915,
1159,
13,
13,
13,
1990,
678,
6235,
29898,
14459,
3260,
1125,
13,
1678,
822,
2601,
29898,
1311,
29892,
9741,
29901,
260,
29889,
1293,
29961,
710,
1402,
1899,
29918,
27492,
29901,
10516,
16802,
29897,
1599,
6213,
29901,
13,
4706,
1899,
29918,
27492,
29889,
3389,
29898,
29888,
29908,
305,
6235,
2601,
1192,
3582,
11117,
15300,
7122,
29898,
8318,
2915,
1159,
13,
13,
13,
1990,
317,
8181,
1171,
29898,
14459,
3260,
1125,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
1024,
29898,
25932,
29897,
1599,
851,
29901,
13,
4706,
736,
376,
15348,
29908,
13,
13,
1678,
822,
2601,
29898,
1311,
29892,
9741,
29901,
260,
29889,
1293,
29961,
710,
1402,
1899,
29918,
27492,
29901,
10516,
16802,
29897,
1599,
6213,
29901,
13,
4706,
396,
512,
1797,
304,
671,
269,
8181,
515,
278,
1899,
1196,
697,
4225,
304,
2752,
967,
2069,
2471,
29889,
13,
4706,
396,
910,
338,
451,
1950,
1549,
278,
1014,
5014,
3883,
29889,
7857,
591,
671,
263,
13201,
13,
4706,
396,
10891,
2471,
297,
967,
28325,
29889,
13,
4706,
13128,
29918,
1445,
353,
285,
23901,
7050,
29914,
15348,
29899,
6252,
29899,
2154,
29899,
29912,
359,
29889,
657,
5935,
580,
1836,
845,
29908,
13,
4706,
2471,
353,
1426,
6312,
29889,
7176,
296,
29898,
13,
9651,
285,
15945,
26732,
13,
9651,
18787,
2109,
29914,
13067,
13,
9651,
2752,
395,
17353,
6294,
15348,
1171,
29914,
2109,
29914,
15348,
1171,
29899,
2344,
29889,
845,
13,
9651,
9995,
13,
4706,
1723,
13,
4706,
363,
3577,
297,
9741,
29901,
13,
9651,
2471,
4619,
285,
29908,
15348,
2601,
426,
5113,
1012,
29876,
29908,
13,
4706,
1899,
29918,
27492,
29889,
3389,
29898,
29888,
15945,
29908,
13067,
448,
29883,
525,
8057,
29850,
2154,
5038,
1405,
426,
7050,
29918,
1445,
10162,
15945,
1159,
13,
4706,
1899,
29918,
27492,
29889,
3389,
29898,
29888,
29908,
305,
1545,
718,
29916,
426,
7050,
29918,
1445,
27195,
13,
4706,
1899,
29918,
27492,
29889,
3389,
29898,
29888,
1642,
29912,
7050,
29918,
1445,
27195,
13,
4706,
1899,
29918,
27492,
29889,
3389,
29898,
29888,
29908,
1758,
426,
7050,
29918,
1445,
27195,
13,
13,
13,
29909,
415,
580,
13,
29928,
29876,
29888,
580,
13,
29979,
398,
580,
13,
29019,
1171,
580,
13,
2
] |
infobip/api/model/sms/mt/logs/SMSLog.py | ubidreams/infobip-api-python-client | 0 | 1609322 | # -*- coding: utf-8 -*-
"""This is a generated class and is not intended for modification!
"""
from datetime import datetime
from infobip.util.models import DefaultObject, serializable
from infobip.api.model.Error import Error
from infobip.api.model.Status import Status
from infobip.api.model.Price import Price
class SMSLog(DefaultObject):
@property
@serializable(name="bulkId", type='basestring')
def bulk_id(self):
"""
Property is of type: 'basestring'
"""
return self.get_field_value("bulk_id")
@bulk_id.setter
def bulk_id(self, bulk_id):
"""
Property is of type: 'basestring'
"""
self.set_field_value("bulk_id", bulk_id)
def set_bulk_id(self, bulk_id):
self.bulk_id = bulk_id
return self
@property
@serializable(name="messageId", type='basestring')
def message_id(self):
"""
Property is of type: 'basestring'
"""
return self.get_field_value("message_id")
@message_id.setter
def message_id(self, message_id):
"""
Property is of type: 'basestring'
"""
self.set_field_value("message_id", message_id)
def set_message_id(self, message_id):
self.message_id = message_id
return self
@property
@serializable(name="to", type='basestring')
def to(self):
"""
Property is of type: 'basestring'
"""
return self.get_field_value("to")
@to.setter
def to(self, to):
"""
Property is of type: 'basestring'
"""
self.set_field_value("to", to)
def set_to(self, to):
self.to = to
return self
@property
@serializable(name="from", type='basestring')
def from_(self):
"""
Property is of type: 'basestring'
"""
return self.get_field_value("from_")
@from_.setter
def from_(self, from_):
"""
Property is of type: 'basestring'
"""
self.set_field_value("from_", from_)
def set_from_(self, from_):
self.from_ = from_
return self
@property
@serializable(name="text", type='basestring')
def text(self):
"""
Property is of type: 'basestring'
"""
return self.get_field_value("text")
@text.setter
def text(self, text):
"""
Property is of type: 'basestring'
"""
self.set_field_value("text", text)
def set_text(self, text):
self.text = text
return self
@property
@serializable(name="sentAt", type=datetime)
def sent_at(self):
"""
Property is of type: datetime
"""
return self.get_field_value("sent_at")
@sent_at.setter
def sent_at(self, sent_at):
"""
Property is of type: datetime
"""
self.set_field_value("sent_at", sent_at)
def set_sent_at(self, sent_at):
self.sent_at = sent_at
return self
@property
@serializable(name="doneAt", type=datetime)
def done_at(self):
"""
Property is of type: datetime
"""
return self.get_field_value("done_at")
@done_at.setter
def done_at(self, done_at):
"""
Property is of type: datetime
"""
self.set_field_value("done_at", done_at)
def set_done_at(self, done_at):
self.done_at = done_at
return self
@property
@serializable(name="smsCount", type=int)
def sms_count(self):
"""
Property is of type: int
"""
return self.get_field_value("sms_count")
@sms_count.setter
def sms_count(self, sms_count):
"""
Property is of type: int
"""
self.set_field_value("sms_count", sms_count)
def set_sms_count(self, sms_count):
self.sms_count = sms_count
return self
@property
@serializable(name="mccMnc", type='basestring')
def mcc_mnc(self):
"""
Property is of type: 'basestring'
"""
return self.get_field_value("mcc_mnc")
@mcc_mnc.setter
def mcc_mnc(self, mcc_mnc):
"""
Property is of type: 'basestring'
"""
self.set_field_value("mcc_mnc", mcc_mnc)
def set_mcc_mnc(self, mcc_mnc):
self.mcc_mnc = mcc_mnc
return self
@property
@serializable(name="price", type=Price)
def price(self):
"""
Property is of type: Price
"""
return self.get_field_value("price")
@price.setter
def price(self, price):
"""
Property is of type: Price
"""
self.set_field_value("price", price)
def set_price(self, price):
self.price = price
return self
@property
@serializable(name="status", type=Status)
def status(self):
"""
Property is of type: Status
"""
return self.get_field_value("status")
@status.setter
def status(self, status):
"""
Property is of type: Status
"""
self.set_field_value("status", status)
def set_status(self, status):
self.status = status
return self
@property
@serializable(name="error", type=Error)
def error(self):
"""
Property is of type: Error
"""
return self.get_field_value("error")
@error.setter
def error(self, error):
"""
Property is of type: Error
"""
self.set_field_value("error", error)
def set_error(self, error):
self.error = error
return self
@property
@serializable(name="callbackData", type='basestring')
def callback_data(self):
"""
Property is of type: 'basestring'
"""
return self.get_field_value("callback_data")
@callback_data.setter
def callback_data(self, callback_data):
"""
Property is of type: 'basestring'
"""
self.set_field_value("callback_data", callback_data)
def set_callback_data(self, callback_data):
self.callback_data = callback_data
return self | [
1,
396,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
15945,
29908,
4013,
338,
263,
5759,
770,
322,
338,
451,
9146,
363,
21733,
29991,
13,
15945,
29908,
13,
13,
13,
3166,
12865,
1053,
12865,
13,
3166,
3041,
711,
666,
29889,
4422,
29889,
9794,
1053,
13109,
2061,
29892,
7797,
13902,
13,
3166,
3041,
711,
666,
29889,
2754,
29889,
4299,
29889,
2392,
1053,
4829,
13,
3166,
3041,
711,
666,
29889,
2754,
29889,
4299,
29889,
5709,
1053,
16034,
13,
3166,
3041,
711,
666,
29889,
2754,
29889,
4299,
29889,
13026,
1053,
20743,
13,
13,
13,
1990,
317,
4345,
3403,
29898,
4592,
2061,
1125,
13,
1678,
732,
6799,
13,
1678,
732,
15550,
13902,
29898,
978,
543,
8645,
29895,
1204,
613,
1134,
2433,
6500,
342,
5393,
1495,
13,
1678,
822,
21610,
29918,
333,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
9079,
338,
310,
1134,
29901,
525,
6500,
342,
5393,
29915,
13,
4706,
9995,
13,
4706,
736,
1583,
29889,
657,
29918,
2671,
29918,
1767,
703,
8645,
29895,
29918,
333,
1159,
13,
13,
1678,
732,
8645,
29895,
29918,
333,
29889,
842,
357,
13,
1678,
822,
21610,
29918,
333,
29898,
1311,
29892,
21610,
29918,
333,
1125,
13,
4706,
9995,
13,
4706,
9079,
338,
310,
1134,
29901,
525,
6500,
342,
5393,
29915,
13,
4706,
9995,
13,
4706,
1583,
29889,
842,
29918,
2671,
29918,
1767,
703,
8645,
29895,
29918,
333,
613,
21610,
29918,
333,
29897,
13,
13,
1678,
822,
731,
29918,
8645,
29895,
29918,
333,
29898,
1311,
29892,
21610,
29918,
333,
1125,
13,
4706,
1583,
29889,
8645,
29895,
29918,
333,
353,
21610,
29918,
333,
13,
4706,
736,
1583,
13,
13,
1678,
732,
6799,
13,
1678,
732,
15550,
13902,
29898,
978,
543,
4906,
1204,
613,
1134,
2433,
6500,
342,
5393,
1495,
13,
1678,
822,
2643,
29918,
333,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
9079,
338,
310,
1134,
29901,
525,
6500,
342,
5393,
29915,
13,
4706,
9995,
13,
4706,
736,
1583,
29889,
657,
29918,
2671,
29918,
1767,
703,
4906,
29918,
333,
1159,
13,
13,
1678,
732,
4906,
29918,
333,
29889,
842,
357,
13,
1678,
822,
2643,
29918,
333,
29898,
1311,
29892,
2643,
29918,
333,
1125,
13,
4706,
9995,
13,
4706,
9079,
338,
310,
1134,
29901,
525,
6500,
342,
5393,
29915,
13,
4706,
9995,
13,
4706,
1583,
29889,
842,
29918,
2671,
29918,
1767,
703,
4906,
29918,
333,
613,
2643,
29918,
333,
29897,
13,
13,
1678,
822,
731,
29918,
4906,
29918,
333,
29898,
1311,
29892,
2643,
29918,
333,
1125,
13,
4706,
1583,
29889,
4906,
29918,
333,
353,
2643,
29918,
333,
13,
4706,
736,
1583,
13,
13,
1678,
732,
6799,
13,
1678,
732,
15550,
13902,
29898,
978,
543,
517,
613,
1134,
2433,
6500,
342,
5393,
1495,
13,
1678,
822,
304,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
9079,
338,
310,
1134,
29901,
525,
6500,
342,
5393,
29915,
13,
4706,
9995,
13,
4706,
736,
1583,
29889,
657,
29918,
2671,
29918,
1767,
703,
517,
1159,
13,
13,
1678,
732,
517,
29889,
842,
357,
13,
1678,
822,
304,
29898,
1311,
29892,
304,
1125,
13,
4706,
9995,
13,
4706,
9079,
338,
310,
1134,
29901,
525,
6500,
342,
5393,
29915,
13,
4706,
9995,
13,
4706,
1583,
29889,
842,
29918,
2671,
29918,
1767,
703,
517,
613,
304,
29897,
13,
13,
1678,
822,
731,
29918,
517,
29898,
1311,
29892,
304,
1125,
13,
4706,
1583,
29889,
517,
353,
304,
13,
4706,
736,
1583,
13,
13,
1678,
732,
6799,
13,
1678,
732,
15550,
13902,
29898,
978,
543,
3166,
613,
1134,
2433,
6500,
342,
5393,
1495,
13,
1678,
822,
515,
23538,
1311,
1125,
13,
4706,
9995,
13,
4706,
9079,
338,
310,
1134,
29901,
525,
6500,
342,
5393,
29915,
13,
4706,
9995,
13,
4706,
736,
1583,
29889,
657,
29918,
2671,
29918,
1767,
703,
3166,
29918,
1159,
13,
13,
1678,
732,
3166,
5396,
842,
357,
13,
1678,
822,
515,
23538,
1311,
29892,
515,
29918,
1125,
13,
4706,
9995,
13,
4706,
9079,
338,
310,
1134,
29901,
525,
6500,
342,
5393,
29915,
13,
4706,
9995,
13,
4706,
1583,
29889,
842,
29918,
2671,
29918,
1767,
703,
3166,
29918,
613,
515,
19925,
13,
13,
1678,
822,
731,
29918,
3166,
23538,
1311,
29892,
515,
29918,
1125,
13,
4706,
1583,
29889,
3166,
29918,
353,
515,
29918,
13,
4706,
736,
1583,
13,
13,
1678,
732,
6799,
13,
1678,
732,
15550,
13902,
29898,
978,
543,
726,
613,
1134,
2433,
6500,
342,
5393,
1495,
13,
1678,
822,
1426,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
9079,
338,
310,
1134,
29901,
525,
6500,
342,
5393,
29915,
13,
4706,
9995,
13,
4706,
736,
1583,
29889,
657,
29918,
2671,
29918,
1767,
703,
726,
1159,
13,
13,
1678,
732,
726,
29889,
842,
357,
13,
1678,
822,
1426,
29898,
1311,
29892,
1426,
1125,
13,
4706,
9995,
13,
4706,
9079,
338,
310,
1134,
29901,
525,
6500,
342,
5393,
29915,
13,
4706,
9995,
13,
4706,
1583,
29889,
842,
29918,
2671,
29918,
1767,
703,
726,
613,
1426,
29897,
13,
13,
1678,
822,
731,
29918,
726,
29898,
1311,
29892,
1426,
1125,
13,
4706,
1583,
29889,
726,
353,
1426,
13,
4706,
736,
1583,
13,
13,
1678,
732,
6799,
13,
1678,
732,
15550,
13902,
29898,
978,
543,
18616,
4178,
613,
1134,
29922,
12673,
29897,
13,
1678,
822,
2665,
29918,
271,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
9079,
338,
310,
1134,
29901,
12865,
13,
4706,
9995,
13,
4706,
736,
1583,
29889,
657,
29918,
2671,
29918,
1767,
703,
18616,
29918,
271,
1159,
13,
13,
1678,
732,
18616,
29918,
271,
29889,
842,
357,
13,
1678,
822,
2665,
29918,
271,
29898,
1311,
29892,
2665,
29918,
271,
1125,
13,
4706,
9995,
13,
4706,
9079,
338,
310,
1134,
29901,
12865,
13,
4706,
9995,
13,
4706,
1583,
29889,
842,
29918,
2671,
29918,
1767,
703,
18616,
29918,
271,
613,
2665,
29918,
271,
29897,
13,
13,
1678,
822,
731,
29918,
18616,
29918,
271,
29898,
1311,
29892,
2665,
29918,
271,
1125,
13,
4706,
1583,
29889,
18616,
29918,
271,
353,
2665,
29918,
271,
13,
4706,
736,
1583,
13,
13,
1678,
732,
6799,
13,
1678,
732,
15550,
13902,
29898,
978,
543,
15091,
4178,
613,
1134,
29922,
12673,
29897,
13,
1678,
822,
2309,
29918,
271,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
9079,
338,
310,
1134,
29901,
12865,
13,
4706,
9995,
13,
4706,
736,
1583,
29889,
657,
29918,
2671,
29918,
1767,
703,
15091,
29918,
271,
1159,
13,
13,
1678,
732,
15091,
29918,
271,
29889,
842,
357,
13,
1678,
822,
2309,
29918,
271,
29898,
1311,
29892,
2309,
29918,
271,
1125,
13,
4706,
9995,
13,
4706,
9079,
338,
310,
1134,
29901,
12865,
13,
4706,
9995,
13,
4706,
1583,
29889,
842,
29918,
2671,
29918,
1767,
703,
15091,
29918,
271,
613,
2309,
29918,
271,
29897,
13,
13,
1678,
822,
731,
29918,
15091,
29918,
271,
29898,
1311,
29892,
2309,
29918,
271,
1125,
13,
4706,
1583,
29889,
15091,
29918,
271,
353,
2309,
29918,
271,
13,
4706,
736,
1583,
13,
13,
1678,
732,
6799,
13,
1678,
732,
15550,
13902,
29898,
978,
543,
29879,
1516,
3981,
613,
1134,
29922,
524,
29897,
13,
1678,
822,
269,
1516,
29918,
2798,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
9079,
338,
310,
1134,
29901,
938,
13,
4706,
9995,
13,
4706,
736,
1583,
29889,
657,
29918,
2671,
29918,
1767,
703,
29879,
1516,
29918,
2798,
1159,
13,
13,
1678,
732,
29879,
1516,
29918,
2798,
29889,
842,
357,
13,
1678,
822,
269,
1516,
29918,
2798,
29898,
1311,
29892,
269,
1516,
29918,
2798,
1125,
13,
4706,
9995,
13,
4706,
9079,
338,
310,
1134,
29901,
938,
13,
4706,
9995,
13,
4706,
1583,
29889,
842,
29918,
2671,
29918,
1767,
703,
29879,
1516,
29918,
2798,
613,
269,
1516,
29918,
2798,
29897,
13,
13,
1678,
822,
731,
29918,
29879,
1516,
29918,
2798,
29898,
1311,
29892,
269,
1516,
29918,
2798,
1125,
13,
4706,
1583,
29889,
29879,
1516,
29918,
2798,
353,
269,
1516,
29918,
2798,
13,
4706,
736,
1583,
13,
13,
1678,
732,
6799,
13,
1678,
732,
15550,
13902,
29898,
978,
543,
29885,
617,
29924,
17608,
613,
1134,
2433,
6500,
342,
5393,
1495,
13,
1678,
822,
286,
617,
29918,
29885,
17608,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
9079,
338,
310,
1134,
29901,
525,
6500,
342,
5393,
29915,
13,
4706,
9995,
13,
4706,
736,
1583,
29889,
657,
29918,
2671,
29918,
1767,
703,
29885,
617,
29918,
29885,
17608,
1159,
13,
13,
1678,
732,
29885,
617,
29918,
29885,
17608,
29889,
842,
357,
13,
1678,
822,
286,
617,
29918,
29885,
17608,
29898,
1311,
29892,
286,
617,
29918,
29885,
17608,
1125,
13,
4706,
9995,
13,
4706,
9079,
338,
310,
1134,
29901,
525,
6500,
342,
5393,
29915,
13,
4706,
9995,
13,
4706,
1583,
29889,
842,
29918,
2671,
29918,
1767,
703,
29885,
617,
29918,
29885,
17608,
613,
286,
617,
29918,
29885,
17608,
29897,
13,
13,
1678,
822,
731,
29918,
29885,
617,
29918,
29885,
17608,
29898,
1311,
29892,
286,
617,
29918,
29885,
17608,
1125,
13,
4706,
1583,
29889,
29885,
617,
29918,
29885,
17608,
353,
286,
617,
29918,
29885,
17608,
13,
4706,
736,
1583,
13,
13,
1678,
732,
6799,
13,
1678,
732,
15550,
13902,
29898,
978,
543,
9175,
613,
1134,
29922,
13026,
29897,
13,
1678,
822,
8666,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
9079,
338,
310,
1134,
29901,
20743,
13,
4706,
9995,
13,
4706,
736,
1583,
29889,
657,
29918,
2671,
29918,
1767,
703,
9175,
1159,
13,
13,
1678,
732,
9175,
29889,
842,
357,
13,
1678,
822,
8666,
29898,
1311,
29892,
8666,
1125,
13,
4706,
9995,
13,
4706,
9079,
338,
310,
1134,
29901,
20743,
13,
4706,
9995,
13,
4706,
1583,
29889,
842,
29918,
2671,
29918,
1767,
703,
9175,
613,
8666,
29897,
13,
13,
1678,
822,
731,
29918,
9175,
29898,
1311,
29892,
8666,
1125,
13,
4706,
1583,
29889,
9175,
353,
8666,
13,
4706,
736,
1583,
13,
13,
1678,
732,
6799,
13,
1678,
732,
15550,
13902,
29898,
978,
543,
4882,
613,
1134,
29922,
5709,
29897,
13,
1678,
822,
4660,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
9079,
338,
310,
1134,
29901,
16034,
13,
4706,
9995,
13,
4706,
736,
1583,
29889,
657,
29918,
2671,
29918,
1767,
703,
4882,
1159,
13,
13,
1678,
732,
4882,
29889,
842,
357,
13,
1678,
822,
4660,
29898,
1311,
29892,
4660,
1125,
13,
4706,
9995,
13,
4706,
9079,
338,
310,
1134,
29901,
16034,
13,
4706,
9995,
13,
4706,
1583,
29889,
842,
29918,
2671,
29918,
1767,
703,
4882,
613,
4660,
29897,
13,
13,
1678,
822,
731,
29918,
4882,
29898,
1311,
29892,
4660,
1125,
13,
4706,
1583,
29889,
4882,
353,
4660,
13,
4706,
736,
1583,
13,
13,
1678,
732,
6799,
13,
1678,
732,
15550,
13902,
29898,
978,
543,
2704,
613,
1134,
29922,
2392,
29897,
13,
1678,
822,
1059,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
9079,
338,
310,
1134,
29901,
4829,
13,
4706,
9995,
13,
4706,
736,
1583,
29889,
657,
29918,
2671,
29918,
1767,
703,
2704,
1159,
13,
13,
1678,
732,
2704,
29889,
842,
357,
13,
1678,
822,
1059,
29898,
1311,
29892,
1059,
1125,
13,
4706,
9995,
13,
4706,
9079,
338,
310,
1134,
29901,
4829,
13,
4706,
9995,
13,
4706,
1583,
29889,
842,
29918,
2671,
29918,
1767,
703,
2704,
613,
1059,
29897,
13,
13,
1678,
822,
731,
29918,
2704,
29898,
1311,
29892,
1059,
1125,
13,
4706,
1583,
29889,
2704,
353,
1059,
13,
4706,
736,
1583,
13,
13,
1678,
732,
6799,
13,
1678,
732,
15550,
13902,
29898,
978,
543,
14035,
1469,
613,
1134,
2433,
6500,
342,
5393,
1495,
13,
1678,
822,
6939,
29918,
1272,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
9079,
338,
310,
1134,
29901,
525,
6500,
342,
5393,
29915,
13,
4706,
9995,
13,
4706,
736,
1583,
29889,
657,
29918,
2671,
29918,
1767,
703,
14035,
29918,
1272,
1159,
13,
13,
1678,
732,
14035,
29918,
1272,
29889,
842,
357,
13,
1678,
822,
6939,
29918,
1272,
29898,
1311,
29892,
6939,
29918,
1272,
1125,
13,
4706,
9995,
13,
4706,
9079,
338,
310,
1134,
29901,
525,
6500,
342,
5393,
29915,
13,
4706,
9995,
13,
4706,
1583,
29889,
842,
29918,
2671,
29918,
1767,
703,
14035,
29918,
1272,
613,
6939,
29918,
1272,
29897,
13,
13,
1678,
822,
731,
29918,
14035,
29918,
1272,
29898,
1311,
29892,
6939,
29918,
1272,
1125,
13,
4706,
1583,
29889,
14035,
29918,
1272,
353,
6939,
29918,
1272,
13,
4706,
736,
1583,
2
] |
envec/multipart.py | jwodder/envec | 0 | 130164 | from enum import Enum
import itertools
import json
import warnings
from ._util import cheap_repr, for_json
class CardClass(Enum):
normal = 1
split = 2
flip = 3
double_faced = 4
BFM = 5
def for_json(self):
return self.name
class MultipartDB:
DEFAULT_DATAFILE = 'data/multipart.json'
def __init__(self, infile=None):
if infile is None:
infile = open(self.DEFAULT_DATAFILE)
with infile:
data = json.load(infile)
self.sourcefile = infile.name
self.byName = {}
self.byClass = {}
for cclass in CardClass:
if cclass == CardClass.normal:
continue
classed = data.get(cclass.name, [])
self.byClass[cclass] = classed
for entry in classed:
entry["cardClass"] = cclass
for name in (entry["primary"], entry["secondary"]):
if name in self.byName:
warnings.warn('%s: name appears more than once in'
' multipart file; subsequent appearance'
' ignored' % (name,))
else:
self.byName[name] = entry
def cardClass(self, name):
try:
entry = self.byName[name]
except KeyError:
return CardClass.normal
else:
return entry["cardClass"]
def isPrimary(self, name):
try:
return self.byName[name]["primary"] == name
except KeyError:
return False
def isSecondary(self, name):
try:
return self.byName[name]["secondary"] == name
except KeyError:
return False
def isSplit(self, name):
return self.cardClass(name) == CardClass.split
def isFlip(self, name):
return self.cardClass(name) == CardClass.flip
def isDouble(self, name):
return self.cardClass(name) == CardClass.double_faced
def isMultipart(self, name):
return self.cardClass(name) != CardClass.normal
def primaries(self):
for entry in self:
yield entry["primary"]
def secondaries(self):
for entry in self:
yield entry["secondary"]
def alternate(self, name):
try:
entry = self.byName[name]
except KeyError:
return None
else:
return entry["secondary" if entry["primary"] == name else "primary"]
def __iter__(self):
return itertools.chain.from_iterable(self.byClass.values())
def __len__(self):
return sum(map(len, self.byClass.values()))
def __repr__(self):
return cheap_repr(self)
def for_json(self):
return for_json(vars(self), trim=True)
| [
1,
515,
259,
14115,
268,
1053,
1174,
398,
13,
5215,
4256,
8504,
13,
5215,
4390,
13,
5215,
18116,
13,
3166,
259,
869,
29918,
4422,
259,
1053,
28773,
29918,
276,
558,
29892,
363,
29918,
3126,
13,
13,
1990,
9160,
2385,
29898,
16854,
1125,
13,
1678,
4226,
539,
353,
29871,
29896,
13,
1678,
6219,
4706,
353,
29871,
29906,
13,
1678,
285,
3466,
308,
353,
29871,
29941,
13,
1678,
3765,
29918,
17470,
287,
353,
29871,
29946,
13,
1678,
350,
22192,
3986,
353,
29871,
29945,
13,
13,
1678,
822,
363,
29918,
3126,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
978,
13,
13,
13,
1990,
9683,
27494,
4051,
29901,
13,
1678,
22236,
29918,
14573,
7724,
353,
525,
1272,
29914,
18056,
442,
29889,
3126,
29915,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
297,
1445,
29922,
8516,
1125,
13,
4706,
565,
297,
1445,
338,
6213,
29901,
13,
9651,
297,
1445,
353,
1722,
29898,
1311,
29889,
23397,
29918,
14573,
7724,
29897,
13,
4706,
411,
297,
1445,
29901,
13,
9651,
848,
353,
4390,
29889,
1359,
29898,
262,
1445,
29897,
13,
4706,
1583,
29889,
4993,
1445,
353,
297,
1445,
29889,
978,
13,
4706,
1583,
29889,
1609,
1170,
353,
6571,
13,
4706,
1583,
29889,
1609,
2385,
353,
6571,
13,
4706,
363,
274,
1990,
297,
9160,
2385,
29901,
13,
9651,
565,
274,
1990,
1275,
9160,
2385,
29889,
8945,
29901,
13,
18884,
6773,
13,
9651,
770,
287,
353,
848,
29889,
657,
29898,
617,
605,
29889,
978,
29892,
518,
2314,
13,
9651,
1583,
29889,
1609,
2385,
29961,
617,
605,
29962,
353,
770,
287,
13,
9651,
363,
6251,
297,
770,
287,
29901,
13,
18884,
6251,
3366,
7543,
2385,
3108,
353,
274,
1990,
13,
18884,
363,
1024,
297,
313,
8269,
3366,
16072,
12436,
6251,
3366,
7496,
653,
3108,
1125,
13,
462,
1678,
565,
1024,
297,
1583,
29889,
1609,
1170,
29901,
13,
462,
4706,
18116,
29889,
25442,
877,
29995,
29879,
29901,
1024,
5692,
901,
1135,
2748,
297,
29915,
13,
462,
462,
418,
525,
6674,
442,
934,
29936,
15352,
10097,
29915,
13,
462,
462,
418,
525,
17262,
29915,
1273,
313,
978,
29892,
876,
13,
462,
1678,
1683,
29901,
13,
462,
4706,
1583,
29889,
1609,
1170,
29961,
978,
29962,
353,
6251,
13,
13,
1678,
822,
5881,
2385,
29898,
1311,
29892,
1024,
1125,
13,
4706,
1018,
29901,
13,
9651,
6251,
353,
1583,
29889,
1609,
1170,
29961,
978,
29962,
13,
4706,
5174,
7670,
2392,
29901,
13,
9651,
736,
9160,
2385,
29889,
8945,
13,
4706,
1683,
29901,
13,
9651,
736,
6251,
3366,
7543,
2385,
3108,
13,
13,
1678,
822,
338,
26666,
29898,
1311,
29892,
1024,
1125,
13,
4706,
1018,
29901,
13,
9651,
736,
1583,
29889,
1609,
1170,
29961,
978,
29962,
3366,
16072,
3108,
1275,
1024,
13,
4706,
5174,
7670,
2392,
29901,
13,
9651,
736,
7700,
13,
13,
1678,
822,
338,
11863,
653,
29898,
1311,
29892,
1024,
1125,
13,
4706,
1018,
29901,
13,
9651,
736,
1583,
29889,
1609,
1170,
29961,
978,
29962,
3366,
7496,
653,
3108,
1275,
1024,
13,
4706,
5174,
7670,
2392,
29901,
13,
9651,
736,
7700,
13,
13,
1678,
822,
338,
18772,
29898,
1311,
29892,
1024,
1125,
13,
4706,
736,
1583,
29889,
7543,
2385,
29898,
978,
29897,
1275,
9160,
2385,
29889,
5451,
13,
13,
1678,
822,
338,
29943,
3466,
29898,
1311,
29892,
1024,
1125,
13,
4706,
736,
1583,
29889,
7543,
2385,
29898,
978,
29897,
1275,
9160,
2385,
29889,
29888,
3466,
13,
13,
1678,
822,
338,
11843,
29898,
1311,
29892,
1024,
1125,
13,
4706,
736,
1583,
29889,
7543,
2385,
29898,
978,
29897,
1275,
9160,
2385,
29889,
8896,
29918,
17470,
287,
13,
13,
1678,
822,
338,
6857,
27494,
29898,
1311,
29892,
1024,
1125,
13,
4706,
736,
1583,
29889,
7543,
2385,
29898,
978,
29897,
2804,
9160,
2385,
29889,
8945,
13,
13,
1678,
822,
1903,
4314,
29898,
1311,
1125,
13,
4706,
363,
6251,
297,
1583,
29901,
13,
9651,
7709,
6251,
3366,
16072,
3108,
13,
13,
1678,
822,
1473,
4314,
29898,
1311,
1125,
13,
4706,
363,
6251,
297,
1583,
29901,
13,
9651,
7709,
6251,
3366,
7496,
653,
3108,
13,
13,
1678,
822,
25010,
29898,
1311,
29892,
1024,
1125,
13,
4706,
1018,
29901,
13,
9651,
6251,
353,
1583,
29889,
1609,
1170,
29961,
978,
29962,
13,
4706,
5174,
7670,
2392,
29901,
13,
9651,
736,
6213,
13,
4706,
1683,
29901,
13,
9651,
736,
6251,
3366,
7496,
653,
29908,
565,
6251,
3366,
16072,
3108,
1275,
1024,
1683,
376,
16072,
3108,
13,
13,
1678,
822,
4770,
1524,
12035,
1311,
1125,
13,
4706,
736,
4256,
8504,
29889,
14153,
29889,
3166,
29918,
1524,
519,
29898,
1311,
29889,
1609,
2385,
29889,
5975,
3101,
13,
13,
1678,
822,
4770,
2435,
12035,
1311,
1125,
13,
4706,
736,
2533,
29898,
1958,
29898,
2435,
29892,
1583,
29889,
1609,
2385,
29889,
5975,
22130,
13,
13,
1678,
822,
4770,
276,
558,
12035,
1311,
1125,
13,
4706,
736,
28773,
29918,
276,
558,
29898,
1311,
29897,
13,
13,
1678,
822,
363,
29918,
3126,
29898,
1311,
1125,
13,
4706,
736,
363,
29918,
3126,
29898,
16908,
29898,
1311,
511,
17151,
29922,
5574,
29897,
13,
2
] |
splot.py | delvallem/specDS | 0 | 184444 | '''
Spectra plottings
'''
import numpy as np
import matplotlib.pyplot as plt
def singles(wn, spec):
'''
Individual spectra plot.
Parameters
----------
wn : ndarray
Wavenumber of shape [n_points].
spec : ndarray
Spectra of shape [n_spectra, n_points].
Returns
-------
None.
'''
fig, ax = plt.subplots()
plt.xlabel('Wavenumber ($\mathrm{cm^{-1}}$)')
plt.ylabel('Absorbance')
plt.xlim(np.ceil(wn.max()), np.floor(wn.min()))
plt.plot(wn, spec.T)
plt.grid(False)
def means(wn, spec, label=False, std=False):
'''
Mean spectra plot.
If label is passed, one mean per group.
If std, plot mean + standard deviation.
Parameters
----------
wn : ndarray
Wavenumber of shape [n_points].
spec : ndarray
Spectra of shape [n_spectra, n_points].
label : list of str, optional
Labels of shape [n_sepctra]. The default is False.
std : boolean, optional
If True, plot mean + standard deviation. The default is False.
Returns
-------
None.
'''
if label:
label_set = list(set(label))
specmean = []
specstd = []
for i in range(len(label_set)):
mask = [None]*len(label)
for j in range(len(label)):
mask[j] = (label[j] == label_set[i])
specmean += [np.mean(spec[mask,:], axis=0)]
specstd += [np.std(spec[mask,:], axis=0)]
specmean = np.array(specmean)
specstd = np.array(specstd)
else:
specmean = np.mean(spec, axis=0)
specstd = np.std(spec, axis=0)
fig, ax = plt.subplots()
plt.grid()
plt.xlabel('Wavenumber ($\mathrm{cm^{-1}}$)')
plt.ylabel('Absorbance')
plt.xlim(np.ceil(wn.max()), np.floor(wn.min()))
plt.plot(wn, specmean.T)
if std:
if len(specstd.shape) == 1:
plt.fill_between(wn, (specmean-1*specstd), (specmean+1*specstd), alpha=0.25)
else:
for i in range(specstd.shape[0]):
plt.fill_between(wn, (specmean[i,:]-1*specstd[i,:]), (specmean[i,:]+1*specstd[i,:]), alpha=0.25)
if label:
plt.legend(label_set)
plt.grid(False)
def img(values, n_sample, fpa_size):
'''
Plot images given values such as area, intensities.
Parameters
----------
values : ndarray
Values to be plotted as image
n_sample : int
Sample to be plotted
fpa_size : int
Size of the FPA.
Returns
-------
None.
'''
# Reshape to an image of shape fpa_size x fpa_size
values_img = np.reshape(
values[0+(fpa_size*fpa_size*n_sample)
:fpa_size*fpa_size+(fpa_size*fpa_size*n_sample)],
(fpa_size,fpa_size)
)
# Define zero (outliers) as black
cmap = plt.cm.jet
cmap.set_under(color='black')
# Define the scale min as the values_img min
vmin = np.min(values_img[np.nonzero(values_img)])-0.000001
# Plot image
fig, ax = plt.subplots()
plt.imshow(values_img, cmap=cmap, vmin=vmin)
ax.axes.get_xaxis().set_visible(False)
ax.axes.get_yaxis().set_visible(False)
plt.colorbar()
| [
1,
14550,
13,
29903,
1103,
336,
715,
1501,
886,
13,
12008,
13,
13,
5215,
12655,
408,
7442,
13,
5215,
22889,
29889,
2272,
5317,
408,
14770,
13,
13,
13,
1753,
22102,
29898,
1233,
29892,
1580,
1125,
13,
1678,
14550,
13,
1678,
1894,
23352,
6683,
336,
6492,
29889,
29871,
13,
13,
1678,
12662,
2699,
13,
1678,
448,
1378,
29899,
13,
1678,
281,
29876,
584,
29871,
299,
2378,
29871,
13,
4706,
399,
3496,
2807,
310,
8267,
518,
29876,
29918,
9748,
1822,
13,
1678,
1580,
584,
29871,
299,
2378,
13,
4706,
27738,
336,
310,
8267,
518,
29876,
29918,
21494,
336,
29892,
302,
29918,
9748,
1822,
13,
13,
1678,
16969,
13,
1678,
448,
22158,
13,
1678,
6213,
29889,
13,
13,
1678,
14550,
13,
268,
13,
1678,
2537,
29892,
4853,
353,
14770,
29889,
1491,
26762,
580,
13,
1678,
14770,
29889,
29916,
1643,
877,
29956,
3496,
2807,
20430,
3141,
29912,
4912,
3426,
29896,
7920,
29897,
1495,
13,
1678,
14770,
29889,
29891,
1643,
877,
4920,
29879,
11831,
749,
1495,
13,
1678,
14770,
29889,
29916,
2576,
29898,
9302,
29889,
27696,
29898,
1233,
29889,
3317,
25739,
7442,
29889,
14939,
29898,
1233,
29889,
1195,
22130,
13,
1678,
14770,
29889,
5317,
29898,
1233,
29892,
1580,
29889,
29911,
29897,
13,
1678,
14770,
29889,
7720,
29898,
8824,
29897,
29871,
13,
13,
13,
1753,
2794,
29898,
1233,
29892,
1580,
29892,
3858,
29922,
8824,
29892,
3659,
29922,
8824,
1125,
13,
1678,
14550,
13,
1678,
16316,
6683,
336,
6492,
29889,
29871,
13,
1678,
960,
3858,
338,
4502,
29892,
697,
2099,
639,
2318,
29889,
13,
1678,
960,
3659,
29892,
6492,
2099,
718,
3918,
29522,
29889,
13,
13,
1678,
12662,
2699,
13,
1678,
448,
1378,
29899,
13,
1678,
281,
29876,
584,
29871,
299,
2378,
29871,
13,
4706,
399,
3496,
2807,
310,
8267,
518,
29876,
29918,
9748,
1822,
13,
1678,
1580,
584,
29871,
299,
2378,
13,
4706,
27738,
336,
310,
8267,
518,
29876,
29918,
21494,
336,
29892,
302,
29918,
9748,
1822,
13,
1678,
3858,
584,
1051,
310,
851,
29892,
13136,
13,
4706,
15796,
29879,
310,
8267,
518,
29876,
29918,
19570,
312,
336,
1822,
450,
2322,
338,
7700,
29889,
13,
1678,
3659,
584,
7223,
29892,
13136,
13,
4706,
960,
5852,
29892,
6492,
2099,
718,
3918,
29522,
29889,
450,
2322,
338,
7700,
29889,
13,
13,
1678,
16969,
13,
1678,
448,
22158,
13,
1678,
6213,
29889,
13,
13,
1678,
14550,
13,
13,
1678,
565,
3858,
29901,
13,
4706,
3858,
29918,
842,
353,
1051,
29898,
842,
29898,
1643,
876,
13,
4706,
1580,
12676,
353,
5159,
13,
4706,
1580,
4172,
353,
5159,
13,
4706,
363,
474,
297,
3464,
29898,
2435,
29898,
1643,
29918,
842,
22164,
13,
9651,
11105,
353,
518,
8516,
14178,
2435,
29898,
1643,
29897,
13,
9651,
363,
432,
297,
3464,
29898,
2435,
29898,
1643,
22164,
13,
18884,
11105,
29961,
29926,
29962,
353,
313,
1643,
29961,
29926,
29962,
1275,
3858,
29918,
842,
29961,
29875,
2314,
13,
9651,
1580,
12676,
4619,
518,
9302,
29889,
12676,
29898,
6550,
29961,
13168,
29892,
29901,
1402,
9685,
29922,
29900,
4638,
13,
9651,
1580,
4172,
4619,
518,
9302,
29889,
4172,
29898,
6550,
29961,
13168,
29892,
29901,
1402,
9685,
29922,
29900,
4638,
13,
4706,
1580,
12676,
353,
7442,
29889,
2378,
29898,
6550,
12676,
29897,
418,
13,
4706,
1580,
4172,
353,
7442,
29889,
2378,
29898,
6550,
4172,
29897,
259,
13,
13,
1678,
1683,
29901,
13,
4706,
1580,
12676,
353,
7442,
29889,
12676,
29898,
6550,
29892,
9685,
29922,
29900,
29897,
13,
4706,
1580,
4172,
353,
7442,
29889,
4172,
29898,
6550,
29892,
9685,
29922,
29900,
29897,
13,
462,
4706,
13,
1678,
2537,
29892,
4853,
353,
14770,
29889,
1491,
26762,
580,
13,
1678,
14770,
29889,
7720,
580,
13,
1678,
14770,
29889,
29916,
1643,
877,
29956,
3496,
2807,
20430,
3141,
29912,
4912,
3426,
29896,
7920,
29897,
1495,
13,
1678,
14770,
29889,
29891,
1643,
877,
4920,
29879,
11831,
749,
1495,
13,
1678,
14770,
29889,
29916,
2576,
29898,
9302,
29889,
27696,
29898,
1233,
29889,
3317,
25739,
7442,
29889,
14939,
29898,
1233,
29889,
1195,
22130,
13,
1678,
14770,
29889,
5317,
29898,
1233,
29892,
1580,
12676,
29889,
29911,
29897,
13,
1678,
565,
3659,
29901,
13,
4706,
565,
7431,
29898,
6550,
4172,
29889,
12181,
29897,
1275,
29871,
29896,
29901,
13,
9651,
14770,
29889,
5589,
29918,
14811,
29898,
1233,
29892,
313,
6550,
12676,
29899,
29896,
29930,
6550,
4172,
511,
313,
6550,
12676,
29974,
29896,
29930,
6550,
4172,
511,
15595,
29922,
29900,
29889,
29906,
29945,
29897,
13,
4706,
1683,
29901,
13,
9651,
363,
474,
297,
3464,
29898,
6550,
4172,
29889,
12181,
29961,
29900,
29962,
1125,
13,
18884,
14770,
29889,
5589,
29918,
14811,
29898,
1233,
29892,
313,
6550,
12676,
29961,
29875,
29892,
17531,
29899,
29896,
29930,
6550,
4172,
29961,
29875,
29892,
29901,
11724,
313,
6550,
12676,
29961,
29875,
29892,
29901,
10062,
29896,
29930,
6550,
4172,
29961,
29875,
29892,
29901,
11724,
15595,
29922,
29900,
29889,
29906,
29945,
29897,
13,
1678,
565,
3858,
29901,
13,
4706,
14770,
29889,
26172,
29898,
1643,
29918,
842,
29897,
13,
1678,
14770,
29889,
7720,
29898,
8824,
29897,
1678,
13,
268,
13,
268,
13,
1753,
10153,
29898,
5975,
29892,
302,
29918,
11249,
29892,
285,
3274,
29918,
2311,
1125,
13,
1678,
14550,
13,
1678,
18399,
4558,
2183,
1819,
1316,
408,
4038,
29892,
12838,
1907,
29889,
13,
13,
1678,
12662,
2699,
13,
1678,
448,
1378,
29899,
13,
1678,
1819,
584,
29871,
299,
2378,
13,
4706,
2630,
1041,
304,
367,
715,
15048,
408,
1967,
13,
1678,
302,
29918,
11249,
584,
938,
13,
4706,
21029,
304,
367,
715,
15048,
13,
1678,
285,
3274,
29918,
2311,
584,
938,
13,
4706,
21179,
310,
278,
383,
7228,
29889,
13,
13,
1678,
16969,
13,
1678,
448,
22158,
13,
1678,
6213,
29889,
13,
13,
1678,
14550,
13,
13,
1678,
396,
2538,
14443,
304,
385,
1967,
310,
8267,
285,
3274,
29918,
2311,
921,
285,
3274,
29918,
2311,
13,
1678,
1819,
29918,
2492,
353,
7442,
29889,
690,
14443,
29898,
13,
4706,
1819,
29961,
29900,
17108,
29888,
3274,
29918,
2311,
29930,
29888,
3274,
29918,
2311,
29930,
29876,
29918,
11249,
29897,
13,
1669,
584,
29888,
3274,
29918,
2311,
29930,
29888,
3274,
29918,
2311,
17108,
29888,
3274,
29918,
2311,
29930,
29888,
3274,
29918,
2311,
29930,
29876,
29918,
11249,
29897,
1402,
13,
4706,
313,
29888,
3274,
29918,
2311,
29892,
29888,
3274,
29918,
2311,
29897,
13,
4706,
1723,
13,
268,
13,
1678,
396,
22402,
5225,
313,
449,
27801,
29897,
408,
4628,
13,
1678,
274,
1958,
353,
14770,
29889,
4912,
29889,
4026,
13,
1678,
274,
1958,
29889,
842,
29918,
5062,
29898,
2780,
2433,
8517,
1495,
259,
13,
268,
13,
1678,
396,
22402,
278,
6287,
1375,
408,
278,
1819,
29918,
2492,
1375,
13,
1678,
325,
1195,
353,
7442,
29889,
1195,
29898,
5975,
29918,
2492,
29961,
9302,
29889,
5464,
9171,
29898,
5975,
29918,
2492,
29897,
2314,
29899,
29900,
29889,
29900,
29900,
29900,
29900,
29900,
29896,
13,
268,
13,
1678,
396,
18399,
1967,
13,
1678,
2537,
29892,
4853,
353,
14770,
29889,
1491,
26762,
580,
13,
1678,
14770,
29889,
326,
4294,
29898,
5975,
29918,
2492,
29892,
274,
1958,
29922,
29883,
1958,
29892,
325,
1195,
29922,
29894,
1195,
29897,
13,
1678,
4853,
29889,
1165,
267,
29889,
657,
29918,
29916,
8990,
2141,
842,
29918,
12872,
29898,
8824,
29897,
13,
1678,
4853,
29889,
1165,
267,
29889,
657,
29918,
29891,
8990,
2141,
842,
29918,
12872,
29898,
8824,
29897,
13,
1678,
14770,
29889,
2780,
1646,
580,
13,
268,
13,
268,
2
] |
simple_object_detection/utils/video/sequence.py | RubenEu/simple-object-detection | 0 | 82467 | <gh_stars>0
from typing import List, Tuple, Optional
import cv2
from simple_object_detection.exceptions import SimpleObjectDetectionException
from simple_object_detection.typing import Image, VideoProperties
class StreamSequence:
"""Clase para cargar los frames de una secuencia de vídeo.
Se utiliza la notación de acceso a un objeto ``object[item]``. Así se puede ir cargando
el vídeo poco a poco sin llegar a saturar la memoria RAM.
TODO:
- Ir marcando los que se han visto.
- Crear un hilo que vaya trayendo los nuevos a memoria.
- Etc. Etc. Optimizar esto!
- Implementar __iter__. (PEP 234)
- Configuración de espacio de color (RGB actualmente).
"""
def __init__(self, video_path: str, cache_size: int = 100):
# Abrir el stream con OpenCV.
self.stream = self._open_video_stream(video_path)
# Información del vídeo.
self.width: int = int(self.stream.get(cv2.CAP_PROP_FRAME_WIDTH))
self.height: int = int(self.stream.get(cv2.CAP_PROP_FRAME_HEIGHT))
self._fps: float = float(self.stream.get(cv2.CAP_PROP_FPS))
self._num_frames_available: int = int(self.stream.get(cv2.CAP_PROP_FRAME_COUNT))
# Caching (Almacena el número del frame y la imagen).
self._cache: List[Tuple[int, Image]] = [(..., ...)] * cache_size
# Inicio y fin del vídeo.
self._start_frame = 0
self._end_frame = self._num_frames_available - 1
def __del__(self) -> None:
"""Libera el recurso del vídeo cargado y elimina el objeto también.
"""
if hasattr(self, 'stream') and self.stream.isOpened():
self.stream.release()
del self.stream
def __getitem__(self, item: int) -> Image:
"""Obtiene el frame item-ésimo.
Si se ha establecido un frame inicial o final distinto con los métodos ``set_start_frame``
o ``set_end_frame``, el frame 0 será el del límite inferior y el frame último el del límite
superior, actuando como si el stream de vídeo introducido estuviese acotado por ellos y no
por los originales.
TODO: Cachear. Cargar chunk. Etc. Etc. Mostrar rendimiento haciendo caching.
https://medium.com/fintechexplained/advanced-python-how-to-implement-caching-in-python-application-9d0a4136b845
TODO: Añadir slicing:
https://www.geeksforgeeks.org/implementing-slicing-in-__getitem__/#:~:text=slice%20is%20a%20constructor%20in,can%20be%20defined%20inside%20it.&text=Parameter%3A,constructor%20to%20create%20slice%20object.
"""
# Comprobación del ítem.
if not isinstance(item, int):
raise TypeError()
# Calcular el índice del frame.
fid = self._calculate_frame_index(item)
# Extraer el frame buscado.
frame_bgr = self._get_frame(fid)
# Comprobar el valor de salida.
frame_rgb = cv2.cvtColor(frame_bgr, cv2.COLOR_BGR2RGB)
return frame_rgb
def __len__(self) -> int:
"""Devuelve el número de frames de la secuencia (usando los limites establecidos o
iniciales)
"""
return self.num_frames
def set_start_frame(self, frame: int) -> None:
"""Establece el frame inicial.
Realiza la comprobación de que sea superior a 0 y que no sea superior o igual al frame
final.
:param frame: frame inicial.
:return: None.
"""
if frame < 0:
raise SimpleObjectDetectionException('No se puede establecer un frame inicial inferior'
'a 0.')
elif frame >= self._end_frame:
raise SimpleObjectDetectionException('No se puede establecer un frame igual o superior'
'al frame final.')
self._start_frame = frame
def set_end_frame(self, frame: int) -> None:
"""Establece el frame final.
Realiza la comprobación de que no sea superior o igual a la cantidad de frames disponibles.
Además comprueba también que no sea inferior o igual al frame inicial.
:param frame: frame final.
:return: None.
"""
if frame >= self._num_frames_available:
raise SimpleObjectDetectionException('No se puede establecer un frame final superior o'
'igual a la cantidad de frames disponibles.')
elif frame <= self._start_frame:
raise SimpleObjectDetectionException('No se puede establecer un frame final menor o'
'igual que el frame inicial.')
self._end_frame = frame
def _calculate_frame_index(self, fid: int) -> int:
"""Si se ha establecido un límite inferior o superior distinto, recalcula.
Comprueba que el índice está entre 0 y el número de frames disponibles.
:param fid:
:return: índice calculado del frame.
"""
calculated_fid = self._start_frame + fid
# Comprobar que está en el intervalo especificado.
if not self._start_frame <= calculated_fid <= self._end_frame:
raise IndexError(f'El frame {calculated_fid} está fuera del intervalo'
f'[{self._start_frame}, {self._end_frame}].')
return calculated_fid
def _get_frame(self, fid: int) -> Image:
"""Extrae el frame fid-ésimo de la secuencia de vídeo.
Primeramente busca si está en caché, si lo encuentra, lo devuelve.
Si se produce un *miss*, trae a caché el tamaño de bloque epecificado por ``cache_size`` y
devuelve el frame buscado.
:param fid: número del frame.
:return: frame.
"""
# Comprobación del índice.
if fid >= self.num_frames_available:
raise IndexError('Se ha excedido el límite.')
# Buscar en caché primero.
cached = self._search_in_cache(fid)
if cached is None:
return self._pull_to_cache(fid)
return cached
def _search_in_cache(self, fid: int) -> Optional[Image]:
"""Busca en la caché el frame especificado.
Si no lo encuentra, devuelve None.
:param fid: número del frame.
:return: frame buscado si es encontrado, si no, None.
"""
expected_index = fid % len(self._cache)
frame_id, frame = self._cache[expected_index]
if frame_id == fid:
return frame
return None
def _pull_to_cache(self, fid: int) -> Image:
"""Trae a caché el lote de frames donde se encuentra el frame fid-ésimo. Además, devuelve el
frame fid-ésimo.
:param fid: número del frame para traer a caché.
:return: frame fid-ésimo.
"""
# Establecer en el frame que se busca.
retval = self.stream.set(cv2.CAP_PROP_POS_FRAMES, float(fid))
if not retval:
raise Exception('Ocurrió un error al posicionar el número de frame.')
# Iterar mientras haya frames disponibles.from
actual_frame_id = fid
# Añadir los siguientes frames que quepan la caché.
while actual_frame_id < self.num_frames_available:
# Capturar frame a frame.
actual_frame_id = int(self.stream.get(cv2.CAP_PROP_POS_FRAMES))
ret, frame = self.stream.read()
# Comprobar si se ha leído el frame correctamente.
if not ret:
break
# Añadir a la caché
self._cache[actual_frame_id % len(self._cache)] = (actual_frame_id, frame)
# Comprobar si se ha rellenado la caché.
if (actual_frame_id + 1) % len(self._cache) == 0:
break
# Devolver el frame que se buscaba.
return self._cache[fid % len(self._cache)][1]
@staticmethod
def _open_video_stream(video_path: str) -> cv2.VideoCapture:
"""Abre el streaming del vídeo.
:param video_path: ruta al archivo del vídeo.
:return: stream del vídeo.
"""
cap = cv2.VideoCapture(video_path)
# Comprobar si el vídeo está disponible.
if not cap.isOpened():
raise Exception(f'The {video_path} can\'t be opened or doesn\'t exists.')
return cap
@property
def fps(self) -> float:
"""Número de frames por segundo de la secuencia de vídeo."""
return self._fps
@fps.setter
def fps(self, value: float) -> None:
"""Modificar el número de frames por segundo de la secuencia de vídeo.
Utilizar únicamente para labores de depuración. Modificar este valor puede llevar a
comportamientos inesperados.
:param value: nuevo valor de fps.
:return: None.
"""
self._fps = value
@property
def num_frames_available(self) -> int:
"""Número de frames total disponibles en la secuencia de vídeo.
:return: número de frames total disponible
"""
return self._num_frames_available
@num_frames_available.setter
def num_frames_available(self, value: int) -> None:
"""Establecer el número de frames disponibles.
Utilizar úniacmente para labores de depuración.
:param value: cantidad de frames disponibles.
:return:
"""
self._num_frames_available = value
@property
def num_frames(self) -> int:
"""Cálculo del número de frames teniendo en cuenta el frame inicial y final establecido.
:return: número de frames con los límites establecidos.
"""
return self._end_frame - self._start_frame + 1
def properties(self) -> VideoProperties:
"""Devuelve una tupla con las propiedades del vídeo.
La tupla tiene la estructura (width, height, fps, num_frames).
:return: propiedades del vídeo.
"""
return VideoProperties(self.width, self.height, self.fps, self.num_frames)
class StreamSequenceWriter:
"""Clase para la escritura de una secuencia de imágenes en un archivo de vídeo.
"""
def __init__(self, file_output: str, properties: VideoProperties):
fourcc = cv2.VideoWriter_fourcc(*'DIVX')
width, height, fps, _ = properties
self._stream = cv2.VideoWriter(file_output, fourcc, fps, (width, height))
def __del__(self):
"""Cierra la conexión con el archivo y elimina la instancia del stream.
"""
self.release()
del self._stream
def write(self, frame: Image) -> None:
"""Escribe un frame al final de la secuencia de vídeo.
:param frame: imagen para escribir.
:return: None.
"""
# Convertir la imagen a BGR porque cv2 trabaja con ese espacio de colores.
frame = cv2.cvtColor(frame, cv2.COLOR_RGB2BGR)
# Escribir el frame.
self._stream.write(frame)
def release(self) -> None:
"""Cierra la conexión con el archivo.
"""
if hasattr(self, '_stream') and self._stream.isOpened():
self._stream.release()
@staticmethod
def save_sequence(sequence: StreamSequence,
file_output: str,
properties: VideoProperties = None) -> None:
"""Guarda una secuencia de vídeo frame a frame en un archivo.
En esencia, lo que hace es copiar lo que entra por un stream de entrada y guardarlo en un
archivo a través de un stream de salida.
Este método tiene propósito de depuración y comprobación.
:param sequence: secuencia de vídeo.
:param file_output: archivo de salida.
:param properties: propiedades del vídeo de salida. Si es None se obtienen de la secuencia
de entrada.
:return: None.
"""
# Si no se pasaron propiedades, obtenerlas de la secuencia
properties = sequence.properties()
# Abrir el stream.
output_stream = StreamSequenceWriter(file_output, properties)
# Guardar todos los frames de la secuencia.
for frame in sequence:
output_stream.write(frame)
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
3166,
19229,
1053,
2391,
29892,
12603,
552,
29892,
28379,
13,
13,
5215,
13850,
29906,
13,
13,
3166,
2560,
29918,
3318,
29918,
29881,
2650,
428,
29889,
11739,
29879,
1053,
12545,
2061,
29928,
2650,
428,
2451,
13,
3166,
2560,
29918,
3318,
29918,
29881,
2650,
428,
29889,
1017,
15702,
1053,
7084,
29892,
13987,
11857,
13,
13,
13,
1990,
13763,
20529,
29901,
13,
1678,
9995,
6821,
559,
1702,
274,
1191,
279,
1232,
16608,
316,
1185,
5226,
3837,
1512,
316,
15207,
311,
29877,
29889,
13,
13,
1678,
922,
3667,
6619,
425,
451,
2709,
316,
1035,
20135,
263,
443,
13413,
29877,
4954,
3318,
29961,
667,
7961,
1412,
1094,
29983,
409,
11493,
3805,
274,
1191,
1743,
13,
1678,
560,
15207,
311,
29877,
14534,
263,
14534,
4457,
10953,
279,
263,
269,
1337,
279,
425,
2626,
4108,
18113,
29889,
13,
13,
1678,
14402,
29901,
13,
1678,
448,
6600,
25335,
1743,
1232,
712,
409,
5905,
29025,
29889,
13,
1678,
448,
6760,
279,
443,
298,
7820,
712,
325,
9010,
260,
764,
2765,
1232,
8005,
23517,
263,
2626,
4108,
29889,
13,
1678,
448,
8748,
29883,
29889,
8748,
29883,
29889,
20693,
326,
15356,
18261,
29991,
13,
1678,
448,
1954,
2037,
279,
4770,
1524,
26914,
313,
4162,
29925,
29871,
29906,
29941,
29946,
29897,
13,
1678,
448,
12782,
2002,
1290,
316,
9015,
3934,
316,
2927,
313,
28212,
3935,
2689,
467,
13,
1678,
9995,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
4863,
29918,
2084,
29901,
851,
29892,
7090,
29918,
2311,
29901,
938,
353,
29871,
29896,
29900,
29900,
1125,
13,
4706,
396,
1976,
12416,
560,
4840,
378,
4673,
15633,
29889,
13,
4706,
1583,
29889,
5461,
353,
1583,
3032,
3150,
29918,
9641,
29918,
5461,
29898,
9641,
29918,
2084,
29897,
13,
4706,
396,
15162,
2709,
628,
15207,
311,
29877,
29889,
13,
4706,
1583,
29889,
2103,
29901,
938,
353,
938,
29898,
1311,
29889,
5461,
29889,
657,
29898,
11023,
29906,
29889,
29907,
3301,
29918,
8618,
29925,
29918,
29943,
4717,
2303,
29918,
22574,
876,
13,
4706,
1583,
29889,
3545,
29901,
938,
353,
938,
29898,
1311,
29889,
5461,
29889,
657,
29898,
11023,
29906,
29889,
29907,
3301,
29918,
8618,
29925,
29918,
29943,
4717,
2303,
29918,
9606,
22530,
876,
13,
4706,
1583,
3032,
29888,
567,
29901,
5785,
353,
5785,
29898,
1311,
29889,
5461,
29889,
657,
29898,
11023,
29906,
29889,
29907,
3301,
29918,
8618,
29925,
29918,
29943,
7024,
876,
13,
4706,
1583,
3032,
1949,
29918,
19935,
29918,
16515,
29901,
938,
353,
938,
29898,
1311,
29889,
5461,
29889,
657,
29898,
11023,
29906,
29889,
29907,
3301,
29918,
8618,
29925,
29918,
29943,
4717,
2303,
29918,
18736,
876,
13,
4706,
396,
315,
9733,
313,
2499,
8628,
2386,
560,
13831,
628,
3515,
343,
425,
527,
5370,
467,
13,
4706,
1583,
3032,
8173,
29901,
2391,
29961,
23215,
552,
29961,
524,
29892,
7084,
5262,
353,
17288,
16361,
2023,
4638,
334,
7090,
29918,
2311,
13,
4706,
396,
512,
11088,
343,
1436,
628,
15207,
311,
29877,
29889,
13,
4706,
1583,
3032,
2962,
29918,
2557,
353,
29871,
29900,
13,
4706,
1583,
3032,
355,
29918,
2557,
353,
1583,
3032,
1949,
29918,
19935,
29918,
16515,
448,
29871,
29896,
13,
13,
1678,
822,
4770,
6144,
12035,
1311,
29897,
1599,
6213,
29901,
13,
4706,
9995,
29931,
12347,
29874,
560,
1162,
332,
578,
628,
15207,
311,
29877,
274,
1191,
912,
343,
29007,
1099,
560,
13413,
29877,
6196,
29889,
13,
4706,
9995,
13,
4706,
565,
756,
5552,
29898,
1311,
29892,
525,
5461,
1495,
322,
1583,
29889,
5461,
29889,
275,
6585,
287,
7295,
13,
9651,
1583,
29889,
5461,
29889,
14096,
580,
13,
9651,
628,
1583,
29889,
5461,
13,
13,
1678,
822,
4770,
657,
667,
12035,
1311,
29892,
2944,
29901,
938,
29897,
1599,
7084,
29901,
13,
4706,
9995,
29949,
3116,
3530,
560,
3515,
2944,
29899,
743,
4200,
29889,
13,
13,
4706,
6101,
409,
447,
19692,
13321,
443,
3515,
24879,
288,
2186,
1320,
8941,
378,
1232,
11510,
24463,
4954,
842,
29918,
2962,
29918,
2557,
16159,
13,
4706,
288,
4954,
842,
29918,
355,
29918,
2557,
29952,
1673,
560,
3515,
29871,
29900,
724,
29976,
560,
628,
301,
5487,
568,
20773,
343,
560,
3515,
20195,
560,
628,
301,
5487,
568,
13,
4706,
11558,
29892,
20331,
1743,
1986,
1354,
560,
4840,
316,
15207,
311,
29877,
4547,
13321,
707,
4090,
21928,
1274,
327,
912,
1277,
21135,
343,
694,
13,
4706,
1277,
1232,
2441,
267,
29889,
13,
13,
4706,
14402,
29901,
315,
496,
799,
29889,
315,
1191,
279,
19875,
29889,
8748,
29883,
29889,
8748,
29883,
29889,
7849,
13678,
7697,
9043,
447,
27182,
22488,
29889,
13,
4706,
2045,
597,
27891,
29889,
510,
29914,
4951,
11345,
4548,
433,
1312,
29914,
328,
16858,
29899,
4691,
29899,
3525,
29899,
517,
29899,
326,
2037,
29899,
29883,
9733,
29899,
262,
29899,
4691,
29899,
6214,
29899,
29929,
29881,
29900,
29874,
29946,
29896,
29941,
29953,
29890,
29947,
29946,
29945,
13,
4706,
14402,
29901,
319,
30046,
328,
381,
269,
506,
292,
29901,
13,
4706,
2045,
597,
1636,
29889,
479,
14541,
20324,
14541,
29889,
990,
29914,
326,
2037,
292,
29899,
29879,
506,
292,
29899,
262,
29899,
1649,
657,
667,
1649,
8484,
29901,
30022,
29901,
726,
29922,
18337,
29995,
29906,
29900,
275,
29995,
29906,
29900,
29874,
29995,
29906,
29900,
27821,
29995,
29906,
29900,
262,
29892,
3068,
29995,
29906,
29900,
915,
29995,
29906,
29900,
12119,
29995,
29906,
29900,
26102,
29995,
29906,
29900,
277,
29889,
29987,
726,
29922,
9329,
29995,
29941,
29909,
29892,
27821,
29995,
29906,
29900,
517,
29995,
29906,
29900,
3258,
29995,
29906,
29900,
18337,
29995,
29906,
29900,
3318,
29889,
13,
4706,
9995,
13,
4706,
396,
422,
771,
2291,
1290,
628,
14468,
1356,
29889,
13,
4706,
565,
451,
338,
8758,
29898,
667,
29892,
938,
1125,
13,
9651,
12020,
20948,
580,
13,
4706,
396,
3037,
16637,
560,
14468,
299,
625,
628,
3515,
29889,
13,
4706,
25947,
353,
1583,
3032,
15807,
403,
29918,
2557,
29918,
2248,
29898,
667,
29897,
13,
4706,
396,
7338,
336,
261,
560,
3515,
3593,
29883,
912,
29889,
13,
4706,
3515,
29918,
29890,
629,
353,
1583,
3032,
657,
29918,
2557,
29898,
29888,
333,
29897,
13,
4706,
396,
422,
771,
1646,
560,
16497,
316,
4497,
1458,
29889,
13,
4706,
3515,
29918,
23973,
353,
13850,
29906,
29889,
11023,
29873,
3306,
29898,
2557,
29918,
29890,
629,
29892,
13850,
29906,
29889,
15032,
1955,
29918,
29933,
14345,
29906,
28212,
29897,
13,
4706,
736,
3515,
29918,
23973,
13,
13,
1678,
822,
4770,
2435,
12035,
1311,
29897,
1599,
938,
29901,
13,
4706,
9995,
16618,
2491,
345,
560,
13831,
316,
16608,
316,
425,
5226,
3837,
1512,
313,
375,
1743,
1232,
2485,
3246,
19692,
29883,
4396,
288,
13,
4706,
24879,
267,
29897,
13,
4706,
9995,
13,
4706,
736,
1583,
29889,
1949,
29918,
19935,
13,
13,
1678,
822,
731,
29918,
2962,
29918,
2557,
29898,
1311,
29892,
3515,
29901,
938,
29897,
1599,
6213,
29901,
13,
4706,
9995,
12787,
519,
346,
560,
3515,
24879,
29889,
13,
13,
4706,
8195,
6619,
425,
752,
307,
2291,
1290,
316,
712,
7205,
11558,
263,
29871,
29900,
343,
712,
694,
7205,
11558,
288,
21432,
394,
3515,
13,
4706,
2186,
29889,
13,
13,
4706,
584,
3207,
3515,
29901,
3515,
24879,
29889,
13,
4706,
584,
2457,
29901,
6213,
29889,
13,
4706,
9995,
13,
4706,
565,
3515,
529,
29871,
29900,
29901,
13,
9651,
12020,
12545,
2061,
29928,
2650,
428,
2451,
877,
3782,
409,
11493,
19692,
2265,
443,
3515,
24879,
20773,
29915,
13,
462,
462,
462,
525,
29874,
29871,
29900,
29889,
1495,
13,
4706,
25342,
3515,
6736,
1583,
3032,
355,
29918,
2557,
29901,
13,
9651,
12020,
12545,
2061,
29928,
2650,
428,
2451,
877,
3782,
409,
11493,
19692,
2265,
443,
3515,
21432,
288,
11558,
29915,
13,
462,
462,
462,
525,
284,
3515,
2186,
29889,
1495,
13,
4706,
1583,
3032,
2962,
29918,
2557,
353,
3515,
13,
13,
1678,
822,
731,
29918,
355,
29918,
2557,
29898,
1311,
29892,
3515,
29901,
938,
29897,
1599,
6213,
29901,
13,
4706,
9995,
12787,
519,
346,
560,
3515,
2186,
29889,
13,
13,
4706,
8195,
6619,
425,
752,
307,
2291,
1290,
316,
712,
694,
7205,
11558,
288,
21432,
263,
425,
5107,
2368,
316,
16608,
14458,
13876,
29889,
13,
4706,
25279,
7199,
434,
2291,
6196,
712,
694,
7205,
20773,
288,
21432,
394,
3515,
24879,
29889,
13,
13,
4706,
584,
3207,
3515,
29901,
3515,
2186,
29889,
13,
4706,
584,
2457,
29901,
6213,
29889,
13,
4706,
9995,
13,
4706,
565,
3515,
6736,
1583,
3032,
1949,
29918,
19935,
29918,
16515,
29901,
13,
9651,
12020,
12545,
2061,
29928,
2650,
428,
2451,
877,
3782,
409,
11493,
19692,
2265,
443,
3515,
2186,
11558,
288,
29915,
13,
462,
462,
462,
525,
335,
950,
263,
425,
5107,
2368,
316,
16608,
14458,
13876,
29889,
1495,
13,
4706,
25342,
3515,
5277,
1583,
3032,
2962,
29918,
2557,
29901,
13,
9651,
12020,
12545,
2061,
29928,
2650,
428,
2451,
877,
3782,
409,
11493,
19692,
2265,
443,
3515,
2186,
26764,
288,
29915,
13,
462,
462,
462,
525,
335,
950,
712,
560,
3515,
24879,
29889,
1495,
13,
4706,
1583,
3032,
355,
29918,
2557,
353,
3515,
13,
13,
1678,
822,
903,
15807,
403,
29918,
2557,
29918,
2248,
29898,
1311,
29892,
25947,
29901,
938,
29897,
1599,
938,
29901,
13,
4706,
9995,
25598,
409,
447,
19692,
13321,
443,
301,
5487,
568,
20773,
288,
11558,
1320,
8941,
29892,
337,
15807,
29874,
29889,
13,
13,
4706,
422,
558,
434,
2291,
712,
560,
14468,
299,
625,
7919,
2637,
29871,
29900,
343,
560,
13831,
316,
16608,
14458,
13876,
29889,
13,
13,
4706,
584,
3207,
25947,
29901,
13,
4706,
584,
2457,
29901,
14468,
299,
625,
3408,
912,
628,
3515,
29889,
13,
4706,
9995,
13,
4706,
12833,
29918,
29888,
333,
353,
1583,
3032,
2962,
29918,
2557,
718,
25947,
13,
4706,
396,
422,
771,
1646,
712,
7919,
427,
560,
7292,
29877,
13894,
928,
912,
29889,
13,
4706,
565,
451,
1583,
3032,
2962,
29918,
2557,
5277,
12833,
29918,
29888,
333,
5277,
1583,
3032,
355,
29918,
2557,
29901,
13,
9651,
12020,
11374,
2392,
29898,
29888,
29915,
6489,
3515,
426,
15807,
630,
29918,
29888,
333,
29913,
7919,
28271,
628,
7292,
29877,
29915,
13,
462,
632,
285,
29915,
19660,
1311,
3032,
2962,
29918,
2557,
1118,
426,
1311,
3032,
355,
29918,
2557,
29913,
1822,
1495,
13,
4706,
736,
12833,
29918,
29888,
333,
13,
13,
1678,
822,
903,
657,
29918,
2557,
29898,
1311,
29892,
25947,
29901,
938,
29897,
1599,
7084,
29901,
13,
4706,
9995,
18126,
29872,
560,
3515,
25947,
29899,
743,
4200,
316,
425,
5226,
3837,
1512,
316,
15207,
311,
29877,
29889,
13,
13,
4706,
1588,
4193,
2503,
3593,
1113,
1354,
7919,
427,
274,
496,
29948,
29892,
1354,
658,
14647,
29892,
658,
2906,
2491,
345,
29889,
13,
13,
4706,
6101,
409,
7738,
443,
334,
9894,
15966,
1020,
29872,
263,
274,
496,
29948,
560,
260,
3304,
8266,
316,
6668,
802,
321,
3135,
928,
912,
1277,
4954,
8173,
29918,
2311,
16159,
343,
13,
4706,
2906,
2491,
345,
560,
3515,
3593,
29883,
912,
29889,
13,
13,
4706,
584,
3207,
25947,
29901,
13831,
628,
3515,
29889,
13,
4706,
584,
2457,
29901,
3515,
29889,
13,
4706,
9995,
13,
4706,
396,
422,
771,
2291,
1290,
628,
14468,
299,
625,
29889,
13,
4706,
565,
25947,
6736,
1583,
29889,
1949,
29918,
19935,
29918,
16515,
29901,
13,
9651,
12020,
11374,
2392,
877,
2008,
447,
429,
1133,
1941,
560,
301,
5487,
568,
29889,
1495,
13,
4706,
396,
8406,
4287,
427,
274,
496,
29948,
1903,
1489,
29889,
13,
4706,
22152,
353,
1583,
3032,
4478,
29918,
262,
29918,
8173,
29898,
29888,
333,
29897,
13,
4706,
565,
22152,
338,
6213,
29901,
13,
9651,
736,
1583,
3032,
26746,
29918,
517,
29918,
8173,
29898,
29888,
333,
29897,
13,
4706,
736,
22152,
13,
13,
1678,
822,
903,
4478,
29918,
262,
29918,
8173,
29898,
1311,
29892,
25947,
29901,
938,
29897,
1599,
28379,
29961,
2940,
5387,
13,
4706,
9995,
16890,
1113,
427,
425,
274,
496,
29948,
560,
3515,
13894,
928,
912,
29889,
13,
13,
4706,
6101,
694,
658,
14647,
29892,
2906,
2491,
345,
6213,
29889,
13,
13,
4706,
584,
3207,
25947,
29901,
13831,
628,
3515,
29889,
13,
4706,
584,
2457,
29901,
3515,
3593,
29883,
912,
1354,
831,
14567,
912,
29892,
1354,
694,
29892,
6213,
29889,
13,
4706,
9995,
13,
4706,
3806,
29918,
2248,
353,
25947,
1273,
7431,
29898,
1311,
3032,
8173,
29897,
13,
4706,
3515,
29918,
333,
29892,
3515,
353,
1583,
3032,
8173,
29961,
9684,
29918,
2248,
29962,
13,
4706,
565,
3515,
29918,
333,
1275,
25947,
29901,
13,
9651,
736,
3515,
13,
4706,
736,
6213,
13,
13,
1678,
822,
903,
26746,
29918,
517,
29918,
8173,
29898,
1311,
29892,
25947,
29901,
938,
29897,
1599,
7084,
29901,
13,
4706,
9995,
5323,
29872,
263,
274,
496,
29948,
560,
301,
866,
316,
16608,
8334,
409,
14647,
560,
3515,
25947,
29899,
743,
4200,
29889,
25279,
29892,
2906,
2491,
345,
560,
13,
4706,
3515,
25947,
29899,
743,
4200,
29889,
13,
13,
4706,
584,
3207,
25947,
29901,
13831,
628,
3515,
1702,
1020,
261,
263,
274,
496,
29948,
29889,
13,
4706,
584,
2457,
29901,
3515,
25947,
29899,
743,
4200,
29889,
13,
4706,
9995,
13,
4706,
396,
2661,
519,
2265,
427,
560,
3515,
712,
409,
3593,
1113,
29889,
13,
4706,
3240,
791,
353,
1583,
29889,
5461,
29889,
842,
29898,
11023,
29906,
29889,
29907,
3301,
29918,
8618,
29925,
29918,
24815,
29918,
29943,
4717,
2303,
29903,
29892,
5785,
29898,
29888,
333,
876,
13,
4706,
565,
451,
3240,
791,
29901,
13,
9651,
12020,
8960,
877,
29949,
2764,
24584,
443,
1059,
394,
926,
15353,
279,
560,
13831,
316,
3515,
29889,
1495,
13,
4706,
396,
20504,
279,
17947,
298,
9010,
16608,
14458,
13876,
29889,
3166,
13,
4706,
3935,
29918,
2557,
29918,
333,
353,
25947,
13,
4706,
396,
319,
30046,
328,
381,
1232,
29673,
16608,
712,
712,
8357,
425,
274,
496,
29948,
29889,
13,
4706,
1550,
3935,
29918,
2557,
29918,
333,
529,
1583,
29889,
1949,
29918,
19935,
29918,
16515,
29901,
13,
9651,
396,
8868,
332,
279,
3515,
263,
3515,
29889,
13,
9651,
3935,
29918,
2557,
29918,
333,
353,
938,
29898,
1311,
29889,
5461,
29889,
657,
29898,
11023,
29906,
29889,
29907,
3301,
29918,
8618,
29925,
29918,
24815,
29918,
29943,
4717,
2303,
29903,
876,
13,
9651,
3240,
29892,
3515,
353,
1583,
29889,
5461,
29889,
949,
580,
13,
9651,
396,
422,
771,
1646,
1354,
409,
447,
454,
27806,
560,
3515,
1959,
2503,
29889,
13,
9651,
565,
451,
3240,
29901,
13,
18884,
2867,
13,
9651,
396,
319,
30046,
328,
381,
263,
425,
274,
496,
29948,
13,
9651,
1583,
3032,
8173,
29961,
19304,
29918,
2557,
29918,
333,
1273,
7431,
29898,
1311,
3032,
8173,
4638,
353,
313,
19304,
29918,
2557,
29918,
333,
29892,
3515,
29897,
13,
9651,
396,
422,
771,
1646,
1354,
409,
447,
337,
645,
264,
912,
425,
274,
496,
29948,
29889,
13,
9651,
565,
313,
19304,
29918,
2557,
29918,
333,
718,
29871,
29896,
29897,
1273,
7431,
29898,
1311,
3032,
8173,
29897,
1275,
29871,
29900,
29901,
13,
18884,
2867,
13,
4706,
396,
897,
1555,
369,
560,
3515,
712,
409,
3593,
29883,
5363,
29889,
13,
4706,
736,
1583,
3032,
8173,
29961,
29888,
333,
1273,
7431,
29898,
1311,
3032,
8173,
29897,
3816,
29896,
29962,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
903,
3150,
29918,
9641,
29918,
5461,
29898,
9641,
29918,
2084,
29901,
851,
29897,
1599,
13850,
29906,
29889,
15167,
21133,
545,
29901,
13,
4706,
9995,
29909,
1030,
560,
24820,
628,
15207,
311,
29877,
29889,
13,
13,
4706,
584,
3207,
4863,
29918,
2084,
29901,
364,
6637,
394,
3190,
4243,
628,
15207,
311,
29877,
29889,
13,
4706,
584,
2457,
29901,
4840,
628,
15207,
311,
29877,
29889,
13,
4706,
9995,
13,
4706,
2117,
353,
13850,
29906,
29889,
15167,
21133,
545,
29898,
9641,
29918,
2084,
29897,
13,
4706,
396,
422,
771,
1646,
1354,
560,
15207,
311,
29877,
7919,
26318,
29889,
13,
4706,
565,
451,
2117,
29889,
275,
6585,
287,
7295,
13,
9651,
12020,
8960,
29898,
29888,
29915,
1576,
426,
9641,
29918,
2084,
29913,
508,
20333,
29873,
367,
6496,
470,
1838,
20333,
29873,
4864,
29889,
1495,
13,
4706,
736,
2117,
13,
13,
1678,
732,
6799,
13,
1678,
822,
285,
567,
29898,
1311,
29897,
1599,
5785,
29901,
13,
4706,
9995,
29940,
30030,
1050,
29877,
316,
16608,
1277,
14729,
316,
425,
5226,
3837,
1512,
316,
15207,
311,
29877,
1213,
15945,
13,
4706,
736,
1583,
3032,
29888,
567,
13,
13,
1678,
732,
29888,
567,
29889,
842,
357,
13,
1678,
822,
285,
567,
29898,
1311,
29892,
995,
29901,
5785,
29897,
1599,
6213,
29901,
13,
4706,
9995,
2111,
928,
279,
560,
13831,
316,
16608,
1277,
14729,
316,
425,
5226,
3837,
1512,
316,
15207,
311,
29877,
29889,
13,
13,
4706,
22310,
15356,
3720,
7823,
2503,
1702,
9775,
2361,
316,
1401,
2002,
1290,
29889,
3382,
928,
279,
4404,
16497,
11493,
19804,
1707,
263,
13,
4706,
20299,
314,
14948,
297,
27749,
2255,
29889,
13,
13,
4706,
584,
3207,
995,
29901,
15671,
16497,
316,
285,
567,
29889,
13,
4706,
584,
2457,
29901,
6213,
29889,
13,
4706,
9995,
13,
4706,
1583,
3032,
29888,
567,
353,
995,
13,
13,
1678,
732,
6799,
13,
1678,
822,
954,
29918,
19935,
29918,
16515,
29898,
1311,
29897,
1599,
938,
29901,
13,
4706,
9995,
29940,
30030,
1050,
29877,
316,
16608,
3001,
14458,
13876,
427,
425,
5226,
3837,
1512,
316,
15207,
311,
29877,
29889,
13,
13,
4706,
584,
2457,
29901,
13831,
316,
16608,
3001,
26318,
13,
4706,
9995,
13,
4706,
736,
1583,
3032,
1949,
29918,
19935,
29918,
16515,
13,
13,
1678,
732,
1949,
29918,
19935,
29918,
16515,
29889,
842,
357,
13,
1678,
822,
954,
29918,
19935,
29918,
16515,
29898,
1311,
29892,
995,
29901,
938,
29897,
1599,
6213,
29901,
13,
4706,
9995,
12787,
519,
2265,
560,
13831,
316,
16608,
14458,
13876,
29889,
13,
13,
4706,
22310,
15356,
3720,
3915,
29883,
2689,
1702,
9775,
2361,
316,
1401,
2002,
1290,
29889,
13,
13,
4706,
584,
3207,
995,
29901,
5107,
2368,
316,
16608,
14458,
13876,
29889,
13,
4706,
584,
2457,
29901,
13,
4706,
9995,
13,
4706,
1583,
3032,
1949,
29918,
19935,
29918,
16515,
353,
995,
13,
13,
1678,
732,
6799,
13,
1678,
822,
954,
29918,
19935,
29898,
1311,
29897,
1599,
938,
29901,
13,
4706,
9995,
29907,
2464,
17227,
628,
13831,
316,
16608,
3006,
17008,
427,
21052,
560,
3515,
24879,
343,
2186,
19692,
13321,
29889,
13,
13,
4706,
584,
2457,
29901,
13831,
316,
16608,
378,
1232,
10263,
2415,
267,
19692,
29883,
4396,
29889,
13,
4706,
9995,
13,
4706,
736,
1583,
3032,
355,
29918,
2557,
448,
1583,
3032,
2962,
29918,
2557,
718,
29871,
29896,
13,
13,
1678,
822,
4426,
29898,
1311,
29897,
1599,
13987,
11857,
29901,
13,
4706,
9995,
16618,
2491,
345,
1185,
260,
786,
433,
378,
1869,
3107,
1000,
3076,
628,
15207,
311,
29877,
29889,
13,
13,
4706,
997,
260,
786,
433,
10258,
425,
26530,
2002,
313,
2103,
29892,
3171,
29892,
285,
567,
29892,
954,
29918,
19935,
467,
13,
13,
4706,
584,
2457,
29901,
3107,
1000,
3076,
628,
15207,
311,
29877,
29889,
13,
4706,
9995,
13,
4706,
736,
13987,
11857,
29898,
1311,
29889,
2103,
29892,
1583,
29889,
3545,
29892,
1583,
29889,
29888,
567,
29892,
1583,
29889,
1949,
29918,
19935,
29897,
13,
13,
13,
1990,
13763,
20529,
10507,
29901,
13,
1678,
9995,
6821,
559,
1702,
425,
14377,
2002,
316,
1185,
5226,
3837,
1512,
316,
527,
29976,
1885,
267,
427,
443,
3190,
4243,
316,
15207,
311,
29877,
29889,
13,
1678,
9995,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
934,
29918,
4905,
29901,
851,
29892,
4426,
29901,
13987,
11857,
1125,
13,
4706,
3023,
617,
353,
13850,
29906,
29889,
15167,
10507,
29918,
17823,
617,
10456,
29915,
4571,
29963,
29990,
1495,
13,
4706,
2920,
29892,
3171,
29892,
285,
567,
29892,
903,
353,
4426,
13,
4706,
1583,
3032,
5461,
353,
13850,
29906,
29889,
15167,
10507,
29898,
1445,
29918,
4905,
29892,
3023,
617,
29892,
285,
567,
29892,
313,
2103,
29892,
3171,
876,
13,
13,
1678,
822,
4770,
6144,
12035,
1311,
1125,
13,
4706,
9995,
29907,
11617,
425,
378,
735,
3175,
378,
560,
3190,
4243,
343,
29007,
1099,
425,
832,
14006,
628,
4840,
29889,
13,
4706,
9995,
13,
4706,
1583,
29889,
14096,
580,
13,
4706,
628,
1583,
3032,
5461,
13,
13,
1678,
822,
2436,
29898,
1311,
29892,
3515,
29901,
7084,
29897,
1599,
6213,
29901,
13,
4706,
9995,
29923,
13086,
443,
3515,
394,
2186,
316,
425,
5226,
3837,
1512,
316,
15207,
311,
29877,
29889,
13,
13,
4706,
584,
3207,
3515,
29901,
527,
5370,
1702,
21415,
20397,
29889,
13,
4706,
584,
2457,
29901,
6213,
29889,
13,
4706,
9995,
13,
4706,
396,
14806,
381,
425,
527,
5370,
263,
350,
14345,
17485,
13850,
29906,
10565,
9919,
378,
15371,
9015,
3934,
316,
784,
2361,
29889,
13,
4706,
3515,
353,
13850,
29906,
29889,
11023,
29873,
3306,
29898,
2557,
29892,
13850,
29906,
29889,
15032,
1955,
29918,
28212,
29906,
29933,
14345,
29897,
13,
4706,
396,
3423,
699,
20397,
560,
3515,
29889,
13,
4706,
1583,
3032,
5461,
29889,
3539,
29898,
2557,
29897,
13,
13,
1678,
822,
6507,
29898,
1311,
29897,
1599,
6213,
29901,
13,
4706,
9995,
29907,
11617,
425,
378,
735,
3175,
378,
560,
3190,
4243,
29889,
13,
4706,
9995,
13,
4706,
565,
756,
5552,
29898,
1311,
29892,
22868,
5461,
1495,
322,
1583,
3032,
5461,
29889,
275,
6585,
287,
7295,
13,
9651,
1583,
3032,
5461,
29889,
14096,
580,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
4078,
29918,
16506,
29898,
16506,
29901,
13763,
20529,
29892,
13,
462,
418,
934,
29918,
4905,
29901,
851,
29892,
13,
462,
418,
4426,
29901,
13987,
11857,
353,
6213,
29897,
1599,
6213,
29901,
13,
4706,
9995,
9485,
23144,
1185,
5226,
3837,
1512,
316,
15207,
311,
29877,
3515,
263,
3515,
427,
443,
3190,
4243,
29889,
13,
13,
4706,
1174,
831,
5760,
29892,
658,
712,
20470,
831,
5614,
4447,
658,
712,
17424,
1277,
443,
4840,
316,
9953,
1114,
343,
8372,
22431,
427,
443,
13,
4706,
3190,
4243,
263,
18198,
316,
443,
4840,
316,
4497,
1458,
29889,
13,
13,
4706,
12723,
11510,
8144,
10258,
3107,
7173,
2049,
316,
1401,
2002,
1290,
343,
752,
307,
2291,
1290,
29889,
13,
13,
4706,
584,
3207,
5665,
29901,
5226,
3837,
1512,
316,
15207,
311,
29877,
29889,
13,
4706,
584,
3207,
934,
29918,
4905,
29901,
3190,
4243,
316,
4497,
1458,
29889,
13,
4706,
584,
3207,
4426,
29901,
3107,
1000,
3076,
628,
15207,
311,
29877,
316,
4497,
1458,
29889,
6101,
831,
6213,
409,
14403,
12980,
316,
425,
5226,
3837,
1512,
13,
4706,
316,
9953,
1114,
29889,
13,
4706,
584,
2457,
29901,
6213,
29889,
13,
4706,
9995,
13,
4706,
396,
6101,
694,
409,
2331,
5022,
3107,
1000,
3076,
29892,
14403,
759,
3333,
316,
425,
5226,
3837,
1512,
13,
4706,
4426,
353,
5665,
29889,
11330,
580,
13,
4706,
396,
1976,
12416,
560,
4840,
29889,
13,
4706,
1962,
29918,
5461,
353,
13763,
20529,
10507,
29898,
1445,
29918,
4905,
29892,
4426,
29897,
13,
4706,
396,
13211,
279,
10843,
1232,
16608,
316,
425,
5226,
3837,
1512,
29889,
13,
4706,
363,
3515,
297,
5665,
29901,
13,
9651,
1962,
29918,
5461,
29889,
3539,
29898,
2557,
29897,
13,
2
] |
scripts/elements_monitoring.py | LoSk-p/robonomics_vacuum | 0 | 176955 | #!/usr/bin/env python3
import rospy
import rospkg
import typing as tp
import yaml
from robonomics_vacuum.srv import Element
from std_msgs.msg import String
from miio import RoborockVacuum
import os
import datetime
from robonomics_vacuum.utils import read_config
class ElementsMonitoring:
def __init__(self) -> None:
rospy.init_node("elements_monitoring")
address = rospy.get_param("~address")
token = rospy.get_param("~token")
self.config_name = rospy.get_param("~config_name")
self.vacuum = RoborockVacuum(address, token)
history = self.vacuum.clean_history()
rospack = rospkg.RosPack()
self.path = rospack.get_path('robonomics_vacuum')
self.default_elements = read_config(f"{self.path}/config/config{self.config_name}.yaml")
if not os.path.exists(f"{self.path}/data/cleaning_info{self.config_name}.yaml"):
elements = {'number_cleaning': history.count, 'elements': []}
for element in self.default_elements['elements']:
elements['elements'].append({'name': element['name'], 'time_from_last_replace': 0})
self.rewrite_yaml(path=f"{self.path}/data/cleaning_info{self.config_name}.yaml", data=elements)
rospy.Service("replace_element", Element, self.replace_element)
self.pub_datalog = rospy.Publisher("datalog", String, queue_size=10)
def rewrite_yaml(self, path: str, data: tp.List) -> None:
with open(path, 'w') as f:
yaml.dump(data, f, default_flow_style=False)
def replace_element(self, req) -> None:
rospy.loginfo(f"type req: {type(req)}")
elements = read_config(f"{self.path}/data/cleaning_info{self.config_name}.yaml")
for element in elements['elements']:
if element['name'] == req.element:
element['time_from_last_replace'] = 0
self.rewrite_yaml(path=f"{self.path}/data/cleaning_info{self.config_name}.yaml", data=elements)
return "OK"
def spin(self) -> None:
rate = rospy.Rate(1)
while not rospy.is_shutdown():
rate.sleep()
history = self.vacuum.clean_history()
config = read_config(f"{self.path}/data/cleaning_info{self.config_name}.yaml")
clean_time = datetime.timedelta(hours=0, minutes=0, seconds=0)
if history.count > config['number_cleaning']:
for i in range(history.count - config['number_cleaning']):
clean = self.vacuum.clean_details(history.ids[-1-i])
clean_time += clean.duration
elements = config
for element in elements['elements']:
last_delta = int(element['time_from_last_replace'])
last_delta += clean_time.seconds
element['time_from_last_replace'] = last_delta
for default_element in self.default_elements['elements']:
if element['name'] == default_element['name']:
if element['time_from_last_replace']/3600 > default_element['working_time']:
self.pub_datalog.publish(f"You should replace element {element['name']}")
elements['number_cleaning'] = history.count
self.rewrite_yaml(path=f"{self.path}/data/cleaning_info{self.config_name}.yaml", data=elements)
if __name__ == '__main__':
ElementsMonitoring().spin() | [
1,
18787,
4855,
29914,
2109,
29914,
6272,
3017,
29941,
13,
13,
5215,
696,
1028,
29891,
13,
5215,
696,
1028,
9415,
13,
5215,
19229,
408,
260,
29886,
13,
5215,
343,
8807,
13,
3166,
10832,
4917,
1199,
29918,
29894,
22061,
398,
29889,
29879,
15291,
1053,
10619,
13,
3166,
3659,
29918,
1516,
3174,
29889,
7645,
1053,
1714,
13,
3166,
3737,
601,
1053,
6417,
272,
1698,
29963,
22061,
398,
13,
5215,
2897,
13,
5215,
12865,
13,
3166,
10832,
4917,
1199,
29918,
29894,
22061,
398,
29889,
13239,
1053,
1303,
29918,
2917,
13,
13,
1990,
10619,
29879,
7185,
2105,
292,
29901,
13,
1678,
822,
4770,
2344,
12035,
1311,
29897,
1599,
6213,
29901,
13,
4706,
696,
1028,
29891,
29889,
2344,
29918,
3177,
703,
17664,
29918,
3712,
2105,
292,
1159,
13,
4706,
3211,
353,
696,
1028,
29891,
29889,
657,
29918,
3207,
703,
30022,
7328,
1159,
13,
4706,
5993,
353,
696,
1028,
29891,
29889,
657,
29918,
3207,
703,
30022,
6979,
1159,
13,
4706,
1583,
29889,
2917,
29918,
978,
353,
696,
1028,
29891,
29889,
657,
29918,
3207,
703,
30022,
2917,
29918,
978,
1159,
13,
4706,
1583,
29889,
29894,
22061,
398,
353,
6417,
272,
1698,
29963,
22061,
398,
29898,
7328,
29892,
5993,
29897,
13,
4706,
4955,
353,
1583,
29889,
29894,
22061,
398,
29889,
14941,
29918,
18434,
580,
13,
4706,
696,
1028,
547,
353,
696,
1028,
9415,
29889,
29934,
359,
16638,
580,
13,
4706,
1583,
29889,
2084,
353,
696,
1028,
547,
29889,
657,
29918,
2084,
877,
13716,
4917,
1199,
29918,
29894,
22061,
398,
1495,
13,
4706,
1583,
29889,
4381,
29918,
17664,
353,
1303,
29918,
2917,
29898,
29888,
29908,
29912,
1311,
29889,
2084,
6822,
2917,
29914,
2917,
29912,
1311,
29889,
2917,
29918,
978,
1836,
25162,
1159,
13,
4706,
565,
451,
2897,
29889,
2084,
29889,
9933,
29898,
29888,
29908,
29912,
1311,
29889,
2084,
6822,
1272,
29914,
14941,
292,
29918,
3888,
29912,
1311,
29889,
2917,
29918,
978,
1836,
25162,
29908,
1125,
13,
9651,
3161,
353,
11117,
4537,
29918,
14941,
292,
2396,
4955,
29889,
2798,
29892,
525,
17664,
2396,
5159,
29913,
13,
9651,
363,
1543,
297,
1583,
29889,
4381,
29918,
17664,
1839,
17664,
2033,
29901,
13,
18884,
3161,
1839,
17664,
13359,
4397,
3319,
29915,
978,
2396,
1543,
1839,
978,
7464,
525,
2230,
29918,
3166,
29918,
4230,
29918,
6506,
2396,
29871,
29900,
1800,
13,
9651,
1583,
29889,
23174,
29918,
25162,
29898,
2084,
29922,
29888,
29908,
29912,
1311,
29889,
2084,
6822,
1272,
29914,
14941,
292,
29918,
3888,
29912,
1311,
29889,
2917,
29918,
978,
1836,
25162,
613,
848,
29922,
17664,
29897,
13,
4706,
696,
1028,
29891,
29889,
3170,
703,
6506,
29918,
5029,
613,
10619,
29892,
1583,
29889,
6506,
29918,
5029,
29897,
13,
4706,
1583,
29889,
5467,
29918,
29881,
3968,
353,
696,
1028,
29891,
29889,
21076,
1674,
261,
703,
29881,
3968,
613,
1714,
29892,
9521,
29918,
2311,
29922,
29896,
29900,
29897,
13,
268,
13,
1678,
822,
10683,
29918,
25162,
29898,
1311,
29892,
2224,
29901,
851,
29892,
848,
29901,
260,
29886,
29889,
1293,
29897,
1599,
6213,
29901,
13,
4706,
411,
1722,
29898,
2084,
29892,
525,
29893,
1495,
408,
285,
29901,
13,
9651,
343,
8807,
29889,
15070,
29898,
1272,
29892,
285,
29892,
2322,
29918,
1731,
29918,
3293,
29922,
8824,
29897,
13,
13,
1678,
822,
5191,
29918,
5029,
29898,
1311,
29892,
12428,
29897,
1599,
6213,
29901,
13,
4706,
696,
1028,
29891,
29889,
1188,
3888,
29898,
29888,
29908,
1853,
12428,
29901,
426,
1853,
29898,
7971,
2915,
1159,
13,
4706,
3161,
353,
1303,
29918,
2917,
29898,
29888,
29908,
29912,
1311,
29889,
2084,
6822,
1272,
29914,
14941,
292,
29918,
3888,
29912,
1311,
29889,
2917,
29918,
978,
1836,
25162,
1159,
13,
4706,
363,
1543,
297,
3161,
1839,
17664,
2033,
29901,
13,
9651,
565,
1543,
1839,
978,
2033,
1275,
12428,
29889,
5029,
29901,
13,
18884,
1543,
1839,
2230,
29918,
3166,
29918,
4230,
29918,
6506,
2033,
353,
29871,
29900,
13,
4706,
1583,
29889,
23174,
29918,
25162,
29898,
2084,
29922,
29888,
29908,
29912,
1311,
29889,
2084,
6822,
1272,
29914,
14941,
292,
29918,
3888,
29912,
1311,
29889,
2917,
29918,
978,
1836,
25162,
613,
848,
29922,
17664,
29897,
13,
4706,
736,
376,
8949,
29908,
13,
268,
13,
1678,
822,
10917,
29898,
1311,
29897,
1599,
6213,
29901,
13,
4706,
6554,
353,
696,
1028,
29891,
29889,
19907,
29898,
29896,
29897,
13,
4706,
1550,
451,
696,
1028,
29891,
29889,
275,
29918,
845,
329,
3204,
7295,
13,
9651,
6554,
29889,
17059,
580,
13,
9651,
4955,
353,
1583,
29889,
29894,
22061,
398,
29889,
14941,
29918,
18434,
580,
13,
9651,
2295,
353,
1303,
29918,
2917,
29898,
29888,
29908,
29912,
1311,
29889,
2084,
6822,
1272,
29914,
14941,
292,
29918,
3888,
29912,
1311,
29889,
2917,
29918,
978,
1836,
25162,
1159,
13,
9651,
5941,
29918,
2230,
353,
12865,
29889,
9346,
287,
2554,
29898,
29882,
2470,
29922,
29900,
29892,
6233,
29922,
29900,
29892,
6923,
29922,
29900,
29897,
13,
9651,
565,
4955,
29889,
2798,
1405,
2295,
1839,
4537,
29918,
14941,
292,
2033,
29901,
29871,
13,
18884,
363,
474,
297,
3464,
29898,
18434,
29889,
2798,
448,
2295,
1839,
4537,
29918,
14941,
292,
2033,
1125,
13,
462,
1678,
5941,
353,
1583,
29889,
29894,
22061,
398,
29889,
14941,
29918,
14144,
29898,
18434,
29889,
4841,
14352,
29896,
29899,
29875,
2314,
13,
462,
1678,
5941,
29918,
2230,
4619,
5941,
29889,
19708,
13,
18884,
3161,
353,
2295,
13,
18884,
363,
1543,
297,
3161,
1839,
17664,
2033,
29901,
13,
462,
1678,
1833,
29918,
4181,
353,
938,
29898,
5029,
1839,
2230,
29918,
3166,
29918,
4230,
29918,
6506,
11287,
13,
462,
1678,
1833,
29918,
4181,
4619,
5941,
29918,
2230,
29889,
23128,
13,
462,
1678,
1543,
1839,
2230,
29918,
3166,
29918,
4230,
29918,
6506,
2033,
353,
1833,
29918,
4181,
13,
462,
1678,
363,
2322,
29918,
5029,
297,
1583,
29889,
4381,
29918,
17664,
1839,
17664,
2033,
29901,
13,
462,
4706,
565,
1543,
1839,
978,
2033,
1275,
2322,
29918,
5029,
1839,
978,
2033,
29901,
13,
462,
9651,
565,
1543,
1839,
2230,
29918,
3166,
29918,
4230,
29918,
6506,
2033,
29914,
29941,
29953,
29900,
29900,
1405,
2322,
29918,
5029,
1839,
22899,
29918,
2230,
2033,
29901,
13,
462,
18884,
1583,
29889,
5467,
29918,
29881,
3968,
29889,
23679,
29898,
29888,
29908,
3492,
881,
5191,
1543,
426,
5029,
1839,
978,
2033,
27195,
13,
18884,
3161,
1839,
4537,
29918,
14941,
292,
2033,
353,
4955,
29889,
2798,
13,
18884,
1583,
29889,
23174,
29918,
25162,
29898,
2084,
29922,
29888,
29908,
29912,
1311,
29889,
2084,
6822,
1272,
29914,
14941,
292,
29918,
3888,
29912,
1311,
29889,
2917,
29918,
978,
1836,
25162,
613,
848,
29922,
17664,
29897,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
10619,
29879,
7185,
2105,
292,
2141,
1028,
262,
580,
2
] |
mgmt/src/constants.py | pcaruana/sombrio | 0 | 1122 | #! /usr/bin/env python3
"""
constants.py - Contains all constants used by the device manager
Author:
- <NAME> (<EMAIL> at <EMAIL> dot <EMAIL>)
Date: 12/3/2016
"""
number_of_rows = 3 # total number rows of Index Servers
number_of_links = 5 # number of links to be sent to Crawler
number_of_chunks = 5 # number of chunks to be sent to Index Builder
number_of_comps = 10 # number of components managed by each watchdog
| [
1,
396,
29991,
847,
4855,
29914,
2109,
29914,
6272,
3017,
29941,
13,
15945,
29908,
13,
1678,
17727,
29889,
2272,
448,
2866,
2708,
599,
17727,
1304,
491,
278,
4742,
8455,
13,
1678,
13361,
29901,
13,
4706,
448,
529,
5813,
29958,
313,
29966,
26862,
6227,
29958,
472,
529,
26862,
6227,
29958,
8329,
529,
26862,
6227,
12948,
13,
1678,
4712,
29901,
29871,
29896,
29906,
29914,
29941,
29914,
29906,
29900,
29896,
29953,
13,
15945,
29908,
13,
13,
4537,
29918,
974,
29918,
5727,
353,
29871,
29941,
795,
396,
3001,
1353,
4206,
310,
11374,
1816,
874,
13,
4537,
29918,
974,
29918,
4965,
353,
29871,
29945,
632,
396,
1353,
310,
2988,
304,
367,
2665,
304,
315,
1610,
1358,
13,
4537,
29918,
974,
29918,
305,
18801,
353,
29871,
29945,
9651,
396,
1353,
310,
521,
18801,
304,
367,
2665,
304,
11374,
5373,
2700,
13,
4537,
29918,
974,
29918,
510,
567,
353,
29871,
29896,
29900,
9651,
396,
1353,
310,
7117,
8745,
491,
1269,
6505,
26169,
13,
2
] |
handle.py | zhuangdx/timer_deleter | 0 | 132418 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Time : 2018/10/31 16:32
# @Author : duoxuan·zhuang
# @File : handle.py
"""
从配置文件读取指定路径,删除超过时间的过期指定类型文件 (适用于linux)
逻辑:
1.读取配置文件---多个路径
2.遍历路径,读取类型,时间
3.获取过期文件数量-删除文件
4.获取空文件夹数量-删除空文件夹
"""
import datetime
import json
import logging
import logging.config
import os
import sys
from utils import os_tools
logging.config.fileConfig("./conf/log.conf")
# 获取文件数量
check_file_count = ' | wc -l'
day_find = ' -mtime +%s '
# 获取7天前的文件
get_file_s = "find %s"
# 指定文件类型
filter_type = ' -name "%s" '
# 筛选空文件夹
empty_folder = " -maxdepth 1 -type d -empty "
# 删除
delete_cmd = " -exec rm -rf {} \;"
class CosSyncConfig(object):
"""从本地json文件读取配置"""
def __init__(self, config_path=u'config.json'):
if not os.path.isfile(config_path):
self.init_config_err = u'配置文件 %s 不存在' % config_path
self.init_config_flag = False
return
config_file = open(config_path, 'r', encoding="utf-8")
try:
config_str = config_file.read()
self.config_json = json.loads(config_str)
except json.decoder.JSONDecodeError:
self.init_config_err = u'配置文件格式无法识别'
self.init_config_flag = False
return
finally:
config_file.close()
valid_config_key_arr = ['路径', '文件类型', '过期时间']
for json1 in self.config_json:
for config_key in valid_config_key_arr:
if config_key not in json1.keys():
self.init_config_err = u'没有配置key %s' % config_key
self.init_config_flag = False
return
self.init_config_flag = True
self.init_config_err = u''
def is_valid_config(self):
return self.init_config_flag
def get_err_msg(self):
return self.init_config_err
def run_shell_8_result(shell_str):
"""
运行命令行,返回运行结果
:param shell_str:
:return:
"""
return os_tools.run_cmd_block(shell_str)
def get_cmd_count(cmd_str):
"""
获取该命令的结果行数--int
:param cmd_str:
:return:
"""
cmd_str_count = cmd_str + check_file_count
rr = run_shell_8_result(cmd_str_count)
rr_list = rr.split()
return int(rr_list[0])
def get_file_7_day(path, _type='', day='7'):
"""
筛选过期文件,1.先获取文件并删除 2.查找空文件夹并删除
:param path:
:param _type:
:param day:
:return:
"""
if day == '0':
cmd_str = get_file_s % path + filter_type % _type
else:
cmd_str = get_file_s % path + day_find % day + filter_type % _type
logging.info(cmd_str)
count_f = get_cmd_count(cmd_str)
if count_f:
logging.info('文件数量:%d', count_f)
logging.info('过期文件:')
logging.info('\n' + run_shell_8_result(cmd_str))
logging.info('\n' + run_shell_8_result(cmd_str + delete_cmd))
# 删除空文件夹
cmd_str_empty = get_file_s % path + empty_folder
count_f = get_cmd_count(cmd_str_empty)
if len(os.listdir(path)) > 0 and count_f:
logging.info('空文件夹数量:%d', count_f)
logging.info('具体文件夹:')
logging.info('\n' + run_shell_8_result(cmd_str_empty))
logging.info('\n' + run_shell_8_result(cmd_str_empty + delete_cmd))
def main(conf_file="conf/config.json"):
logging.info('** %s', datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S'))
config = CosSyncConfig(conf_file)
if not config.is_valid_config():
logging.error('wrong config: ' + config.get_err_msg())
logging.info("\n\n")
sys.exit(1)
for onejson in config.config_json:
folder_path = onejson['路径']
file_type = onejson['文件类型']
file_time = onejson['过期时间']
if os.path.exists(folder_path):
get_file_7_day(path=folder_path, _type=file_type, day=file_time)
else:
logging.warning("不存在 %s", folder_path)
logging.info("\n\n")
if __name__ == "__main__":
main()
| [
1,
29871,
30143,
29937,
14708,
4855,
29914,
2109,
29914,
6272,
3017,
29941,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
29937,
732,
2481,
1678,
584,
29871,
29906,
29900,
29896,
29947,
29914,
29896,
29900,
29914,
29941,
29896,
29871,
29896,
29953,
29901,
29941,
29906,
13,
29937,
732,
13720,
29871,
584,
868,
2251,
12323,
30064,
29920,
6905,
574,
13,
29937,
732,
2283,
1678,
584,
4386,
29889,
2272,
13,
15945,
29908,
13,
31594,
31361,
30669,
30333,
30631,
235,
178,
190,
30683,
31084,
30495,
30874,
232,
193,
135,
30214,
31916,
31152,
31480,
31138,
30594,
31016,
30210,
31138,
31117,
31084,
30495,
30832,
30883,
30333,
30631,
29871,
30419,
236,
131,
133,
30406,
30909,
9389,
30409,
13,
236,
131,
190,
235,
193,
148,
30383,
13,
29896,
29889,
235,
178,
190,
30683,
31361,
30669,
30333,
30631,
5634,
30923,
30502,
30874,
232,
193,
135,
13,
29906,
29889,
236,
132,
144,
232,
145,
137,
30874,
232,
193,
135,
30214,
235,
178,
190,
30683,
30832,
30883,
30214,
30594,
31016,
13,
29941,
29889,
31024,
30683,
31138,
31117,
30333,
30631,
30354,
31180,
29899,
31916,
31152,
30333,
30631,
13,
29946,
29889,
31024,
30683,
30816,
30333,
30631,
232,
167,
188,
30354,
31180,
29899,
31916,
31152,
30816,
30333,
30631,
232,
167,
188,
13,
15945,
29908,
13,
5215,
12865,
13,
5215,
4390,
13,
5215,
12183,
13,
5215,
12183,
29889,
2917,
13,
13,
5215,
2897,
13,
5215,
10876,
13,
13,
3166,
3667,
29879,
1053,
2897,
29918,
8504,
13,
13,
21027,
29889,
2917,
29889,
1445,
3991,
703,
6904,
5527,
29914,
1188,
29889,
5527,
1159,
13,
13,
13,
29937,
29871,
31024,
30683,
30333,
30631,
30354,
31180,
13,
3198,
29918,
1445,
29918,
2798,
353,
525,
891,
28678,
448,
29880,
29915,
13,
3250,
29918,
2886,
353,
525,
448,
29885,
2230,
718,
29995,
29879,
525,
13,
29937,
29871,
31024,
30683,
29955,
30408,
30658,
30210,
30333,
30631,
13,
657,
29918,
1445,
29918,
29879,
353,
376,
2886,
1273,
29879,
29908,
13,
29937,
29871,
31084,
30495,
30333,
30631,
30832,
30883,
13,
4572,
29918,
1853,
353,
525,
448,
978,
11860,
29879,
29908,
525,
13,
29937,
29871,
234,
176,
158,
31333,
30816,
30333,
30631,
232,
167,
188,
13,
6310,
29918,
12083,
353,
376,
448,
3317,
19488,
29871,
29896,
448,
1853,
270,
448,
6310,
376,
13,
29937,
29871,
31916,
31152,
13,
8143,
29918,
9006,
353,
376,
448,
4258,
20241,
448,
9600,
6571,
320,
15458,
13,
13,
13,
1990,
13526,
21077,
3991,
29898,
3318,
1125,
13,
1678,
9995,
31594,
30346,
30533,
3126,
30333,
30631,
235,
178,
190,
30683,
31361,
30669,
15945,
29908,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
2295,
29918,
2084,
29922,
29884,
29915,
2917,
29889,
3126,
29374,
13,
4706,
565,
451,
2897,
29889,
2084,
29889,
275,
1445,
29898,
2917,
29918,
2084,
1125,
13,
9651,
1583,
29889,
2344,
29918,
2917,
29918,
3127,
353,
318,
29915,
31361,
30669,
30333,
30631,
1273,
29879,
29871,
30413,
30946,
30505,
29915,
1273,
2295,
29918,
2084,
13,
9651,
1583,
29889,
2344,
29918,
2917,
29918,
15581,
353,
7700,
13,
9651,
736,
13,
13,
4706,
2295,
29918,
1445,
353,
1722,
29898,
2917,
29918,
2084,
29892,
525,
29878,
742,
8025,
543,
9420,
29899,
29947,
1159,
13,
4706,
1018,
29901,
13,
9651,
2295,
29918,
710,
353,
2295,
29918,
1445,
29889,
949,
580,
13,
9651,
1583,
29889,
2917,
29918,
3126,
353,
4390,
29889,
18132,
29898,
2917,
29918,
710,
29897,
13,
4706,
5174,
4390,
29889,
7099,
6119,
29889,
7249,
2772,
401,
2392,
29901,
13,
9651,
1583,
29889,
2344,
29918,
2917,
29918,
3127,
353,
318,
29915,
31361,
30669,
30333,
30631,
31168,
30607,
31352,
30545,
235,
178,
137,
232,
139,
174,
29915,
13,
9651,
1583,
29889,
2344,
29918,
2917,
29918,
15581,
353,
7700,
13,
9651,
736,
13,
4706,
7146,
29901,
13,
9651,
2295,
29918,
1445,
29889,
5358,
580,
13,
13,
4706,
2854,
29918,
2917,
29918,
1989,
29918,
2749,
353,
6024,
30874,
232,
193,
135,
742,
525,
30333,
30631,
30832,
30883,
742,
525,
31138,
31117,
30594,
31016,
2033,
13,
13,
4706,
363,
4390,
29896,
297,
1583,
29889,
2917,
29918,
3126,
29901,
13,
9651,
363,
2295,
29918,
1989,
297,
2854,
29918,
2917,
29918,
1989,
29918,
2749,
29901,
13,
18884,
565,
2295,
29918,
1989,
451,
297,
4390,
29896,
29889,
8149,
7295,
13,
462,
1678,
1583,
29889,
2344,
29918,
2917,
29918,
3127,
353,
318,
29915,
31423,
30417,
31361,
30669,
1989,
1273,
29879,
29915,
1273,
2295,
29918,
1989,
13,
462,
1678,
1583,
29889,
2344,
29918,
2917,
29918,
15581,
353,
7700,
13,
462,
1678,
736,
13,
13,
4706,
1583,
29889,
2344,
29918,
2917,
29918,
15581,
353,
5852,
13,
4706,
1583,
29889,
2344,
29918,
2917,
29918,
3127,
353,
318,
4907,
13,
13,
1678,
822,
338,
29918,
3084,
29918,
2917,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
2344,
29918,
2917,
29918,
15581,
13,
13,
1678,
822,
679,
29918,
3127,
29918,
7645,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
2344,
29918,
2917,
29918,
3127,
13,
13,
13,
1753,
1065,
29918,
15903,
29918,
29947,
29918,
2914,
29898,
15903,
29918,
710,
1125,
13,
1678,
9995,
13,
268,
31894,
30448,
31237,
31650,
30448,
30214,
31086,
30742,
31894,
30448,
31320,
30801,
13,
1678,
584,
3207,
6473,
29918,
710,
29901,
13,
1678,
584,
2457,
29901,
13,
1678,
9995,
13,
1678,
736,
2897,
29918,
8504,
29889,
3389,
29918,
9006,
29918,
1271,
29898,
15903,
29918,
710,
29897,
13,
13,
13,
1753,
679,
29918,
9006,
29918,
2798,
29898,
9006,
29918,
710,
1125,
13,
1678,
9995,
13,
268,
31024,
30683,
31751,
31237,
31650,
30210,
31320,
30801,
30448,
30354,
489,
524,
13,
1678,
584,
3207,
9920,
29918,
710,
29901,
13,
1678,
584,
2457,
29901,
13,
1678,
9995,
13,
1678,
9920,
29918,
710,
29918,
2798,
353,
9920,
29918,
710,
718,
1423,
29918,
1445,
29918,
2798,
13,
1678,
364,
29878,
353,
1065,
29918,
15903,
29918,
29947,
29918,
2914,
29898,
9006,
29918,
710,
29918,
2798,
29897,
13,
1678,
364,
29878,
29918,
1761,
353,
364,
29878,
29889,
5451,
580,
13,
1678,
736,
938,
29898,
21478,
29918,
1761,
29961,
29900,
2314,
13,
13,
13,
1753,
679,
29918,
1445,
29918,
29955,
29918,
3250,
29898,
2084,
29892,
903,
1853,
2433,
742,
2462,
2433,
29955,
29374,
13,
1678,
9995,
13,
268,
234,
176,
158,
31333,
31138,
31117,
30333,
30631,
30214,
29896,
29889,
31244,
31024,
30683,
30333,
30631,
31666,
31916,
31152,
29871,
29906,
29889,
31213,
233,
140,
193,
30816,
30333,
30631,
232,
167,
188,
31666,
31916,
31152,
13,
1678,
584,
3207,
2224,
29901,
13,
1678,
584,
3207,
903,
1853,
29901,
13,
1678,
584,
3207,
2462,
29901,
13,
1678,
584,
2457,
29901,
13,
1678,
9995,
13,
1678,
565,
2462,
1275,
525,
29900,
2396,
13,
4706,
9920,
29918,
710,
353,
679,
29918,
1445,
29918,
29879,
1273,
2224,
718,
4175,
29918,
1853,
1273,
903,
1853,
13,
1678,
1683,
29901,
13,
4706,
9920,
29918,
710,
353,
679,
29918,
1445,
29918,
29879,
1273,
2224,
718,
2462,
29918,
2886,
1273,
2462,
718,
4175,
29918,
1853,
1273,
903,
1853,
13,
1678,
12183,
29889,
3888,
29898,
9006,
29918,
710,
29897,
13,
1678,
2302,
29918,
29888,
353,
679,
29918,
9006,
29918,
2798,
29898,
9006,
29918,
710,
29897,
13,
1678,
565,
2302,
29918,
29888,
29901,
13,
4706,
12183,
29889,
3888,
877,
30333,
30631,
30354,
31180,
30383,
29995,
29881,
742,
2302,
29918,
29888,
29897,
13,
4706,
12183,
29889,
3888,
877,
31138,
31117,
30333,
30631,
30383,
1495,
13,
4706,
12183,
29889,
3888,
28909,
29876,
29915,
718,
1065,
29918,
15903,
29918,
29947,
29918,
2914,
29898,
9006,
29918,
710,
876,
13,
4706,
12183,
29889,
3888,
28909,
29876,
29915,
718,
1065,
29918,
15903,
29918,
29947,
29918,
2914,
29898,
9006,
29918,
710,
718,
5217,
29918,
9006,
876,
13,
13,
1678,
396,
29871,
31916,
31152,
30816,
30333,
30631,
232,
167,
188,
13,
1678,
9920,
29918,
710,
29918,
6310,
353,
679,
29918,
1445,
29918,
29879,
1273,
2224,
718,
4069,
29918,
12083,
13,
1678,
2302,
29918,
29888,
353,
679,
29918,
9006,
29918,
2798,
29898,
9006,
29918,
710,
29918,
6310,
29897,
13,
1678,
565,
7431,
29898,
359,
29889,
1761,
3972,
29898,
2084,
876,
1405,
29871,
29900,
322,
2302,
29918,
29888,
29901,
13,
4706,
12183,
29889,
3888,
877,
30816,
30333,
30631,
232,
167,
188,
30354,
31180,
30383,
29995,
29881,
742,
2302,
29918,
29888,
29897,
13,
4706,
12183,
29889,
3888,
877,
232,
136,
186,
30988,
30333,
30631,
232,
167,
188,
30383,
1495,
13,
4706,
12183,
29889,
3888,
28909,
29876,
29915,
718,
1065,
29918,
15903,
29918,
29947,
29918,
2914,
29898,
9006,
29918,
710,
29918,
6310,
876,
13,
4706,
12183,
29889,
3888,
28909,
29876,
29915,
718,
1065,
29918,
15903,
29918,
29947,
29918,
2914,
29898,
9006,
29918,
710,
29918,
6310,
718,
5217,
29918,
9006,
876,
13,
13,
13,
1753,
1667,
29898,
5527,
29918,
1445,
543,
5527,
29914,
2917,
29889,
3126,
29908,
1125,
13,
1678,
12183,
29889,
3888,
877,
1068,
29871,
1273,
29879,
742,
12865,
29889,
12673,
29889,
3707,
2141,
710,
615,
603,
877,
29995,
29979,
19222,
29885,
19222,
29881,
1273,
29950,
16664,
29924,
16664,
29903,
8785,
13,
1678,
2295,
353,
13526,
21077,
3991,
29898,
5527,
29918,
1445,
29897,
13,
13,
1678,
565,
451,
2295,
29889,
275,
29918,
3084,
29918,
2917,
7295,
13,
4706,
12183,
29889,
2704,
877,
15866,
549,
2295,
29901,
525,
718,
2295,
29889,
657,
29918,
3127,
29918,
7645,
3101,
13,
4706,
12183,
29889,
3888,
14182,
29876,
29905,
29876,
1159,
13,
4706,
10876,
29889,
13322,
29898,
29896,
29897,
13,
13,
1678,
363,
697,
3126,
297,
2295,
29889,
2917,
29918,
3126,
29901,
13,
4706,
4138,
29918,
2084,
353,
697,
3126,
1839,
30874,
232,
193,
135,
2033,
13,
4706,
934,
29918,
1853,
353,
697,
3126,
1839,
30333,
30631,
30832,
30883,
2033,
13,
4706,
934,
29918,
2230,
353,
697,
3126,
1839,
31138,
31117,
30594,
31016,
2033,
13,
4706,
565,
2897,
29889,
2084,
29889,
9933,
29898,
12083,
29918,
2084,
1125,
13,
9651,
679,
29918,
1445,
29918,
29955,
29918,
3250,
29898,
2084,
29922,
12083,
29918,
2084,
29892,
903,
1853,
29922,
1445,
29918,
1853,
29892,
2462,
29922,
1445,
29918,
2230,
29897,
13,
4706,
1683,
29901,
13,
9651,
12183,
29889,
27392,
703,
30413,
30946,
30505,
1273,
29879,
613,
4138,
29918,
2084,
29897,
13,
1678,
12183,
29889,
3888,
14182,
29876,
29905,
29876,
1159,
13,
13,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
1678,
1667,
580,
13,
2
] |
salesforce/campaign.py | DemocracyLab/DemocracyLab-CivicTechExchange | 0 | 67808 | from common.helpers.collections import omit_falsy
from common.models import Tag
from .client import SalesforceClient
import json
import requests
import threading
''' Project model maps to the Campaign object in Salesforce '''
client = SalesforceClient()
def run(request):
response = SalesforceClient().send(request)
def save(project: object):
data = {
"ownerid": client.owner_id,
"Project_Owner__r":
{
"platform_id__c": project.project_creator.id
},
"recordtypeid": "01246000000uOeRAAU",
"name": project.project_name,
"isactive": project.is_searchable,
"project_url__c": project.project_url,
"description_action__c": project.project_description_actions,
"description_solution__c": project.project_description_solution,
"short_description__c": project.project_short_description,
"description": project.project_description,
"issue_area__c": Tag.tags_field_descriptions(project.project_issue_area),
"stage__c": Tag.tags_field_descriptions(project.project_stage),
"type": Tag.tags_field_descriptions(project.project_organization_type),
"technologies__c": Tag.tags_field_descriptions(project.project_technologies)
}
if project.project_date_created:
data['startdate'] = project.project_date_created.strftime('%Y-%m-%d')
req = requests.Request(
method="PATCH",
url=f'{client.campaign_endpoint}/platform_id__c/{project.id}',
data=json.dumps(data)
)
thread = threading.Thread(target=run, args=(req,))
thread.daemon = True
thread.start()
def delete(project: object):
req = requests.Request(
method="DELETE",
url=f'{client.campaign_endpoint}/platform_id__c/{project.id}'
)
thread = threading.Thread(target=run, args=(req,))
thread.daemon = True
thread.start()
| [
1,
515,
3619,
29889,
3952,
6774,
29889,
29027,
1053,
288,
2415,
29918,
29888,
1338,
29891,
13,
3166,
3619,
29889,
9794,
1053,
10522,
13,
3166,
869,
4645,
1053,
28389,
10118,
4032,
13,
5215,
4390,
13,
5215,
7274,
13,
5215,
3244,
292,
13,
12008,
8010,
1904,
11053,
304,
278,
7259,
8729,
1203,
297,
28389,
10118,
14550,
13,
4645,
353,
28389,
10118,
4032,
580,
13,
13,
13,
1753,
1065,
29898,
3827,
1125,
13,
1678,
2933,
353,
28389,
10118,
4032,
2141,
6717,
29898,
3827,
29897,
13,
13,
13,
1753,
4078,
29898,
4836,
29901,
1203,
1125,
13,
1678,
848,
353,
426,
13,
4706,
376,
20348,
333,
1115,
3132,
29889,
20348,
29918,
333,
29892,
13,
4706,
376,
7653,
29918,
28213,
1649,
29878,
1115,
13,
9651,
426,
13,
18884,
376,
12120,
29918,
333,
1649,
29883,
1115,
2060,
29889,
4836,
29918,
1037,
1061,
29889,
333,
13,
9651,
2981,
13,
4706,
376,
11651,
1853,
333,
1115,
376,
29900,
29896,
29906,
29946,
29953,
29900,
29900,
29900,
29900,
29900,
29900,
29884,
29949,
29872,
4717,
25951,
613,
13,
4706,
376,
978,
1115,
2060,
29889,
4836,
29918,
978,
29892,
13,
4706,
376,
275,
4925,
1115,
2060,
29889,
275,
29918,
4478,
519,
29892,
13,
4706,
376,
4836,
29918,
2271,
1649,
29883,
1115,
2060,
29889,
4836,
29918,
2271,
29892,
13,
4706,
376,
8216,
29918,
2467,
1649,
29883,
1115,
2060,
29889,
4836,
29918,
8216,
29918,
7387,
29892,
13,
4706,
376,
8216,
29918,
2929,
918,
1649,
29883,
1115,
2060,
29889,
4836,
29918,
8216,
29918,
2929,
918,
29892,
13,
4706,
376,
12759,
29918,
8216,
1649,
29883,
1115,
2060,
29889,
4836,
29918,
12759,
29918,
8216,
29892,
13,
4706,
376,
8216,
1115,
2060,
29889,
4836,
29918,
8216,
29892,
13,
4706,
376,
15118,
29918,
6203,
1649,
29883,
1115,
10522,
29889,
11338,
29918,
2671,
29918,
2783,
699,
1980,
29898,
4836,
29889,
4836,
29918,
15118,
29918,
6203,
511,
13,
4706,
376,
19190,
1649,
29883,
1115,
10522,
29889,
11338,
29918,
2671,
29918,
2783,
699,
1980,
29898,
4836,
29889,
4836,
29918,
19190,
511,
13,
4706,
376,
1853,
1115,
10522,
29889,
11338,
29918,
2671,
29918,
2783,
699,
1980,
29898,
4836,
29889,
4836,
29918,
6388,
2133,
29918,
1853,
511,
13,
4706,
376,
21695,
11763,
1649,
29883,
1115,
10522,
29889,
11338,
29918,
2671,
29918,
2783,
699,
1980,
29898,
4836,
29889,
4836,
29918,
21695,
11763,
29897,
13,
1678,
500,
13,
13,
1678,
565,
2060,
29889,
4836,
29918,
1256,
29918,
11600,
29901,
13,
4706,
848,
1839,
2962,
1256,
2033,
353,
2060,
29889,
4836,
29918,
1256,
29918,
11600,
29889,
710,
615,
603,
877,
29995,
29979,
19222,
29885,
19222,
29881,
1495,
13,
13,
1678,
12428,
353,
7274,
29889,
3089,
29898,
13,
4706,
1158,
543,
29925,
14789,
613,
13,
4706,
3142,
29922,
29888,
29915,
29912,
4645,
29889,
24821,
8729,
29918,
29734,
6822,
12120,
29918,
333,
1649,
29883,
19248,
4836,
29889,
333,
29913,
742,
13,
4706,
848,
29922,
3126,
29889,
29881,
17204,
29898,
1272,
29897,
13,
1678,
1723,
13,
1678,
3244,
353,
3244,
292,
29889,
4899,
29898,
5182,
29922,
3389,
29892,
6389,
7607,
7971,
29892,
876,
13,
1678,
3244,
29889,
1388,
9857,
353,
5852,
13,
1678,
3244,
29889,
2962,
580,
13,
13,
13,
1753,
5217,
29898,
4836,
29901,
1203,
1125,
13,
1678,
12428,
353,
7274,
29889,
3089,
29898,
13,
4706,
1158,
543,
2287,
18476,
613,
13,
4706,
3142,
29922,
29888,
29915,
29912,
4645,
29889,
24821,
8729,
29918,
29734,
6822,
12120,
29918,
333,
1649,
29883,
19248,
4836,
29889,
333,
10162,
13,
1678,
1723,
13,
1678,
3244,
353,
3244,
292,
29889,
4899,
29898,
5182,
29922,
3389,
29892,
6389,
7607,
7971,
29892,
876,
13,
1678,
3244,
29889,
1388,
9857,
353,
5852,
13,
1678,
3244,
29889,
2962,
580,
13,
2
] |
exercise/ch04/mini_batch.py | HFTshoon/deep-learning-from-scratch | 0 | 189872 | <reponame>HFTshoon/deep-learning-from-scratch
import sys,os
sys.path.append(os.pardir)
from dataset.mnist import load_mnist
import numpy as np
(x_train,t_train),(x_test,t_test)=load_mnist(normalize=True,one_hot_label=True)
print(x_train.shape)
print(t_train.shape)
train_size = x_train.shape[0]
batch_size=10
batch_mask=np.random.choice(train_size,batch_size)
print(batch_mask)
x_batch=x_train[batch_mask]
t_batch=t_train[batch_mask]
| [
1,
529,
276,
1112,
420,
29958,
29950,
7818,
845,
6150,
29914,
24535,
29899,
21891,
29899,
3166,
29899,
10526,
905,
13,
5215,
10876,
29892,
359,
13,
9675,
29889,
2084,
29889,
4397,
29898,
359,
29889,
29886,
538,
381,
29897,
13,
3166,
8783,
29889,
23521,
391,
1053,
2254,
29918,
23521,
391,
13,
13,
5215,
12655,
408,
7442,
13,
13,
29898,
29916,
29918,
14968,
29892,
29873,
29918,
14968,
21336,
29916,
29918,
1688,
29892,
29873,
29918,
1688,
3892,
1359,
29918,
23521,
391,
29898,
8945,
675,
29922,
5574,
29892,
650,
29918,
8711,
29918,
1643,
29922,
5574,
29897,
13,
13,
2158,
29898,
29916,
29918,
14968,
29889,
12181,
29897,
13,
2158,
29898,
29873,
29918,
14968,
29889,
12181,
29897,
13,
13,
14968,
29918,
2311,
353,
921,
29918,
14968,
29889,
12181,
29961,
29900,
29962,
13,
16175,
29918,
2311,
29922,
29896,
29900,
13,
16175,
29918,
13168,
29922,
9302,
29889,
8172,
29889,
16957,
29898,
14968,
29918,
2311,
29892,
16175,
29918,
2311,
29897,
13,
2158,
29898,
16175,
29918,
13168,
29897,
13,
13,
29916,
29918,
16175,
29922,
29916,
29918,
14968,
29961,
16175,
29918,
13168,
29962,
13,
29873,
29918,
16175,
29922,
29873,
29918,
14968,
29961,
16175,
29918,
13168,
29962,
13,
2
] |
avatar2/protocols/jlink.py | ispras/avatar2 | 415 | 115861 | import sys
import pylink
from time import sleep
from threading import Thread, Event, Condition
import logging
import re
if sys.version_info < (3, 0):
import Queue as queue
# __class__ = instance.__class__
else:
import queue
from avatar2.archs.arm import ARM
from avatar2.targets import TargetStates
from avatar2.message import AvatarMessage, UpdateStateMessage, BreakpointHitMessage
class JLinkProtocol(Thread):
"""Main class for the JLink bprotocol, via pylink-square
:ivar serial: The serial number of the JLink to connect to
:ivar device: The JLink device name for the target
:ivar avatar: the avatar object
:ivar origin: the target utilizing this protocol
"""
def __init__(self, serial="12345678", device="ARM7", avatar=None, origin=None):
self._shutdown = Event()
self.avatar = avatar
self.origin = origin
self.jlink = pylink.JLink()
self.jlink.open(serial)
self.log = logging.getLogger('%s.%s' %
(origin.log.name, self.__class__.__name__)
) if origin else \
logging.getLogger(self.__class__.__name__)
Thread.__init__(self)
self.connect(device=device)
def __del__(self):
self.shutdown()
def connect(self, device="ARM7"):
# Todo add a time out here
while True:
try:
self.jlink.connect(device, verbose=True)
self.jlink.ir_len()
break
except pylink.errors.JLinkException:
self.log.info("Connection failed, trying again...")
sleep(0.25)
self.log.info("Connected to JLink target")
self.start()
return True
def reset(self, halt=True):
self.log.info("Resetting target")
return self.jlink.reset(halt=halt)
def shutdown(self):
self._shutdown.set()
def update_target_regs(self):
"""
This function will try to update the TargetRegs based on the list of
registers known to gdb.
"""
regs = {}
for idx in self.jlink.register_list():
name = self.jlink.register_name(idx)
regs[name] = idx
if hasattr(self.origin, 'regs'):
self.origin.regs._update(regs)
def run(self):
# Target state management thread
# This thread needs to poll for the halted state
# of the target
# JLink is lame and doesn't let you do this asynch
# Also, not all targets produce a "moe" (Mode of Entry)
# so we have to actually do that here.
try:
while not self._shutdown.is_set():
is_halted = self.jlink.halted()
if is_halted and self.origin.state == TargetStates.RUNNING:
# We just halted
# But did we hit a BP?
self.log.debug("JLink Target is halting...")
avatar_msg = UpdateStateMessage(self.origin, TargetStates.STOPPED)
self.avatar.fast_queue.put(avatar_msg)
self.origin.wait()
self.log.debug("JLink target has halted")
pc = self.get_pc()
if self.jlink.breakpoint_find(pc):
self.log.debug("JLink Target hit breakpoint %d" % self.jlink.breakpoint_find(pc))
avatar_msg = BreakpointHitMessage(self.origin, self.jlink.breakpoint_find(pc), pc)
self.avatar.queue.put(avatar_msg)
elif not is_halted and self.origin.state == TargetStates.STOPPED:
self.log.debug("About to resume target.")
avatar_msg = UpdateStateMessage(self.origin, TargetStates.RUNNING)
self.avatar.fast_queue.put(avatar_msg)
while self.origin.state != TargetStates.RUNNING:
pass
self.log.debug("JLink target has resumed")
except:
self.log.exception("JLink target errored")
finally:
self.log.info("JLink target exiting")
self.jlink.close()
def set_breakpoint(self, line,
hardware=False,
temporary=False,
regex=False,
condition=None,
ignore_count=0,
thread=0,
pending=False):
"""Inserts a breakpoint
:param bool hardware: Hardware breakpoint
:param bool temporary: Tempory breakpoint
:param str regex: If set, inserts breakpoints matching the regex
:param str condition: If set, inserts a breakpoint with specified condition
:param int ignore_count: Amount of times the bp should be ignored
:param int thread: Threadno in which this breakpoints should be added
:returns: The number of the breakpoint
"""
# TODO: Hw/Sw breakpoint control
self.log.info("Setting breakpoint at %#08x" % line)
ret = self.jlink.breakpoint_set(line)
self.log.info("Got BP ID %d" % ret)
return ret
def set_watchpoint(self, variable, write=True, read=False):
return self.jlink.watchpoint_set(variable, write=write, read=read)
def remove_breakpoint(self, bkpt):
"""Deletes a breakpoint"""
# TODO: Check this
return self.jlink.breakpoint_clear(bkpt)
def write_memory(self, address, wordsize, val, num_words=1, raw=False):
"""Writes memory
:param address: Address to write to
:param wordsize: the size of the write (1, 2, 4 or 8)
:param val: the written value
:type val: int if num_words == 1 and raw == False
list if num_words > 1 and raw == False
str or byte if raw == True
:param num_words: The amount of words to read
:param raw: Specifies whether to write in raw or word mode
:returns: True on success else False
"""
if raw:
new_val = []
if not len(val):
raise ValueError("val had zero length")
new_val = [ord(v) for v in val]
val = new_val
try:
self.jlink.memory_write(address, contents)
return True
except pylink.JLinkException:
return False
def read_memory(self, address, wordsize=4, num_words=1, raw=False):
"""reads memory
:param address: Address to write to
:param wordsize: the size of a read word (1, 2, 4 or 8)
:param num_words: the amount of read words
:param raw: Whether the read memory should be returned unprocessed
:return: The read memory
"""
ret = self.jlink.memory_read(address, num_units=num_words, nbits=wordsize)
if raw:
raw_mem = "".join([newint.to_bytes(i, length=int(math.ceil(i.bit_length() / 8.0))) for i in ret])
return raw_mem
return ret
def read_register(self, reg):
the_reg = tolower(reg)
the_idx = -1
for idx in self.jlink.register_list():
if the_reg == self.jlink.register_name(idx):
the_idx = idx
break
return self.register_read(the_idx)
def get_pc(self):
# Get PC a shitty way
for idx in self.jlink.register_list():
if "PC" in self.jlink.register_name(idx):
return self.jlink.register_read(idx)
def write_register(self, reg, val):
"""Set one register on the target
:returns: True on success"""
the_reg = tolower(reg)
the_idx = -1
for idx in self.jlink.register_list():
if the_reg == self.jlink.register_name(idx):
the_idx = idx
break
return self.jlink.register_write(the_idx, val)
def step(self):
"""Step one instruction on the target
:returns: True on success"""
return self.jlink.step()
def cont(self):
"""Continues the execution of the target
:returns: True on success"""
self.log.info("Resuming target...")
return self.jlink.restart()
def stop(self):
"""Stops execution of the target
:returns: True on success"""
self.log.info("Stopping target...")
return self.jlink.halt()
def set_endianness(self, endianness='little'):
if 'little' in endianness:
self.jlink.set_little_endian()
elif "big" in endianness:
self.jlink.set_big_endian()
| [
1,
1053,
10876,
13,
5215,
11451,
2324,
13,
3166,
931,
1053,
8709,
13,
3166,
3244,
292,
1053,
10480,
29892,
6864,
29892,
11790,
654,
13,
5215,
12183,
13,
5215,
337,
13,
13,
361,
10876,
29889,
3259,
29918,
3888,
529,
313,
29941,
29892,
29871,
29900,
1125,
13,
1678,
1053,
5462,
434,
408,
9521,
13,
1678,
396,
4770,
1990,
1649,
353,
2777,
17255,
1990,
1649,
13,
2870,
29901,
13,
1678,
1053,
9521,
13,
13,
3166,
1029,
14873,
29906,
29889,
1279,
29879,
29889,
2817,
1053,
9033,
29924,
13,
3166,
1029,
14873,
29906,
29889,
5182,
29879,
1053,
17157,
855,
1078,
13,
3166,
1029,
14873,
29906,
29889,
4906,
1053,
7740,
14873,
3728,
29892,
10318,
2792,
3728,
29892,
28301,
3149,
29950,
277,
3728,
13,
13,
13,
1990,
435,
6595,
17830,
29898,
4899,
1125,
13,
1678,
9995,
6330,
770,
363,
278,
435,
6595,
289,
20464,
29892,
3025,
11451,
2324,
29899,
17619,
13,
1678,
584,
440,
279,
7797,
29901,
450,
7797,
1353,
310,
278,
435,
6595,
304,
4511,
304,
13,
1678,
584,
440,
279,
4742,
29901,
450,
435,
6595,
4742,
1024,
363,
278,
3646,
13,
1678,
584,
440,
279,
1029,
14873,
29901,
259,
278,
1029,
14873,
1203,
13,
1678,
584,
440,
279,
3978,
29901,
259,
278,
3646,
3667,
5281,
445,
9608,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
7797,
543,
29896,
29906,
29941,
29946,
29945,
29953,
29955,
29947,
613,
4742,
543,
1718,
29924,
29955,
613,
1029,
14873,
29922,
8516,
29892,
3978,
29922,
8516,
1125,
13,
4706,
1583,
3032,
845,
329,
3204,
353,
6864,
580,
13,
4706,
1583,
29889,
485,
14873,
353,
1029,
14873,
13,
4706,
1583,
29889,
12574,
353,
3978,
13,
4706,
1583,
29889,
29926,
2324,
353,
11451,
2324,
29889,
29967,
6595,
580,
13,
4706,
1583,
29889,
29926,
2324,
29889,
3150,
29898,
15550,
29897,
13,
4706,
1583,
29889,
1188,
353,
12183,
29889,
657,
16363,
877,
29995,
29879,
29889,
29995,
29879,
29915,
1273,
13,
462,
462,
268,
313,
12574,
29889,
1188,
29889,
978,
29892,
1583,
17255,
1990,
1649,
17255,
978,
1649,
29897,
13,
462,
462,
268,
1723,
565,
3978,
1683,
320,
13,
9651,
12183,
29889,
657,
16363,
29898,
1311,
17255,
1990,
1649,
17255,
978,
1649,
29897,
13,
4706,
10480,
17255,
2344,
12035,
1311,
29897,
13,
4706,
1583,
29889,
6915,
29898,
10141,
29922,
10141,
29897,
13,
13,
1678,
822,
4770,
6144,
12035,
1311,
1125,
13,
4706,
1583,
29889,
845,
329,
3204,
580,
13,
13,
1678,
822,
4511,
29898,
1311,
29892,
4742,
543,
1718,
29924,
29955,
29908,
1125,
13,
4706,
396,
7561,
29877,
788,
263,
931,
714,
1244,
13,
4706,
1550,
5852,
29901,
13,
9651,
1018,
29901,
13,
18884,
1583,
29889,
29926,
2324,
29889,
6915,
29898,
10141,
29892,
26952,
29922,
5574,
29897,
13,
18884,
1583,
29889,
29926,
2324,
29889,
381,
29918,
2435,
580,
13,
18884,
2867,
13,
9651,
5174,
11451,
2324,
29889,
12523,
29889,
29967,
6595,
2451,
29901,
13,
18884,
1583,
29889,
1188,
29889,
3888,
703,
5350,
5229,
29892,
1811,
1449,
856,
1159,
13,
18884,
8709,
29898,
29900,
29889,
29906,
29945,
29897,
13,
4706,
1583,
29889,
1188,
29889,
3888,
703,
20971,
2954,
304,
435,
6595,
3646,
1159,
13,
4706,
1583,
29889,
2962,
580,
13,
4706,
736,
5852,
13,
13,
1678,
822,
10092,
29898,
1311,
29892,
25212,
29922,
5574,
1125,
13,
4706,
1583,
29889,
1188,
29889,
3888,
703,
27175,
1259,
3646,
1159,
13,
4706,
736,
1583,
29889,
29926,
2324,
29889,
12071,
29898,
10647,
29922,
10647,
29897,
13,
13,
1678,
822,
12522,
3204,
29898,
1311,
1125,
13,
4706,
1583,
3032,
845,
329,
3204,
29889,
842,
580,
13,
308,
13,
1678,
822,
2767,
29918,
5182,
29918,
1727,
29879,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
910,
740,
674,
1018,
304,
2767,
278,
17157,
4597,
29879,
2729,
373,
278,
1051,
310,
13,
4706,
28975,
2998,
304,
330,
2585,
29889,
13,
4706,
9995,
13,
4706,
1072,
29879,
353,
6571,
13,
4706,
363,
22645,
297,
1583,
29889,
29926,
2324,
29889,
9573,
29918,
1761,
7295,
13,
9651,
1024,
353,
1583,
29889,
29926,
2324,
29889,
9573,
29918,
978,
29898,
13140,
29897,
13,
9651,
1072,
29879,
29961,
978,
29962,
353,
22645,
13,
13,
4706,
565,
756,
5552,
29898,
1311,
29889,
12574,
29892,
525,
1727,
29879,
29374,
13,
9651,
1583,
29889,
12574,
29889,
1727,
29879,
3032,
5504,
29898,
1727,
29879,
29897,
13,
13,
1678,
822,
1065,
29898,
1311,
1125,
13,
4706,
396,
17157,
2106,
10643,
3244,
13,
4706,
396,
910,
3244,
4225,
304,
21180,
363,
278,
25212,
287,
2106,
13,
4706,
396,
310,
278,
3646,
13,
4706,
396,
435,
6595,
338,
301,
420,
322,
1838,
29915,
29873,
1235,
366,
437,
445,
408,
948,
305,
13,
4706,
396,
3115,
29892,
451,
599,
22525,
7738,
263,
376,
4346,
29872,
29908,
313,
6818,
310,
28236,
29897,
29871,
13,
4706,
396,
577,
591,
505,
304,
2869,
437,
393,
1244,
29889,
13,
4706,
1018,
29901,
13,
9651,
1550,
451,
1583,
3032,
845,
329,
3204,
29889,
275,
29918,
842,
7295,
13,
18884,
338,
29918,
10647,
287,
353,
1583,
29889,
29926,
2324,
29889,
10647,
287,
580,
13,
18884,
565,
338,
29918,
10647,
287,
322,
1583,
29889,
12574,
29889,
3859,
1275,
17157,
855,
1078,
29889,
29934,
3904,
29940,
4214,
29901,
13,
462,
1678,
396,
1334,
925,
25212,
287,
13,
462,
1678,
396,
1205,
1258,
591,
7124,
263,
350,
29925,
29973,
13,
462,
1678,
1583,
29889,
1188,
29889,
8382,
703,
29967,
6595,
17157,
338,
8870,
1259,
856,
1159,
13,
462,
1678,
1029,
14873,
29918,
7645,
353,
10318,
2792,
3728,
29898,
1311,
29889,
12574,
29892,
17157,
855,
1078,
29889,
1254,
4590,
29925,
3352,
29897,
13,
462,
1678,
1583,
29889,
485,
14873,
29889,
11255,
29918,
9990,
29889,
649,
29898,
485,
14873,
29918,
7645,
29897,
13,
462,
1678,
1583,
29889,
12574,
29889,
10685,
580,
13,
462,
1678,
1583,
29889,
1188,
29889,
8382,
703,
29967,
6595,
3646,
756,
25212,
287,
1159,
13,
462,
1678,
22844,
353,
1583,
29889,
657,
29918,
6739,
580,
13,
462,
1678,
565,
1583,
29889,
29926,
2324,
29889,
8690,
3149,
29918,
2886,
29898,
6739,
1125,
13,
462,
4706,
1583,
29889,
1188,
29889,
8382,
703,
29967,
6595,
17157,
7124,
2867,
3149,
1273,
29881,
29908,
1273,
1583,
29889,
29926,
2324,
29889,
8690,
3149,
29918,
2886,
29898,
6739,
876,
13,
462,
4706,
1029,
14873,
29918,
7645,
353,
28301,
3149,
29950,
277,
3728,
29898,
1311,
29889,
12574,
29892,
1583,
29889,
29926,
2324,
29889,
8690,
3149,
29918,
2886,
29898,
6739,
511,
22844,
29897,
13,
462,
4706,
1583,
29889,
485,
14873,
29889,
9990,
29889,
649,
29898,
485,
14873,
29918,
7645,
29897,
13,
13,
18884,
25342,
451,
338,
29918,
10647,
287,
322,
1583,
29889,
12574,
29889,
3859,
1275,
17157,
855,
1078,
29889,
1254,
4590,
29925,
3352,
29901,
13,
462,
1678,
1583,
29889,
1188,
29889,
8382,
703,
28173,
304,
620,
2017,
3646,
23157,
13,
462,
1678,
1029,
14873,
29918,
7645,
353,
10318,
2792,
3728,
29898,
1311,
29889,
12574,
29892,
17157,
855,
1078,
29889,
29934,
3904,
29940,
4214,
29897,
13,
462,
1678,
1583,
29889,
485,
14873,
29889,
11255,
29918,
9990,
29889,
649,
29898,
485,
14873,
29918,
7645,
29897,
13,
462,
1678,
1550,
1583,
29889,
12574,
29889,
3859,
2804,
17157,
855,
1078,
29889,
29934,
3904,
29940,
4214,
29901,
13,
462,
4706,
1209,
13,
462,
1678,
1583,
29889,
1188,
29889,
8382,
703,
29967,
6595,
3646,
756,
620,
21571,
1159,
13,
4706,
5174,
29901,
13,
9651,
1583,
29889,
1188,
29889,
11739,
703,
29967,
6595,
3646,
1059,
287,
1159,
13,
4706,
7146,
29901,
13,
9651,
1583,
29889,
1188,
29889,
3888,
703,
29967,
6595,
3646,
6876,
292,
1159,
13,
9651,
1583,
29889,
29926,
2324,
29889,
5358,
580,
13,
13,
1678,
822,
731,
29918,
8690,
3149,
29898,
1311,
29892,
1196,
29892,
13,
462,
539,
12837,
29922,
8824,
29892,
13,
462,
539,
13201,
29922,
8824,
29892,
13,
462,
539,
6528,
29922,
8824,
29892,
13,
462,
539,
4195,
29922,
8516,
29892,
13,
462,
539,
11455,
29918,
2798,
29922,
29900,
29892,
13,
462,
539,
3244,
29922,
29900,
29892,
13,
462,
539,
28235,
29922,
8824,
1125,
13,
4706,
9995,
797,
643,
1372,
263,
2867,
3149,
13,
13,
4706,
584,
3207,
6120,
12837,
29901,
10999,
2519,
2867,
3149,
13,
4706,
584,
3207,
6120,
13201,
29901,
29871,
21121,
706,
2867,
3149,
13,
4706,
584,
3207,
851,
6528,
29901,
268,
960,
731,
29892,
13534,
1372,
2867,
9748,
9686,
278,
6528,
13,
4706,
584,
3207,
851,
4195,
29901,
960,
731,
29892,
13534,
1372,
263,
2867,
3149,
411,
6790,
4195,
13,
4706,
584,
3207,
938,
11455,
29918,
2798,
29901,
1913,
792,
310,
3064,
278,
289,
29886,
881,
367,
17262,
13,
4706,
584,
3207,
938,
3244,
29901,
1678,
10480,
1217,
297,
607,
445,
2867,
9748,
881,
367,
2715,
13,
4706,
584,
18280,
29901,
632,
450,
1353,
310,
278,
2867,
3149,
13,
4706,
9995,
13,
4706,
396,
14402,
29901,
379,
29893,
29914,
10840,
2867,
3149,
2761,
13,
4706,
1583,
29889,
1188,
29889,
3888,
703,
29020,
2867,
3149,
472,
1273,
29937,
29900,
29947,
29916,
29908,
1273,
1196,
29897,
13,
4706,
3240,
353,
1583,
29889,
29926,
2324,
29889,
8690,
3149,
29918,
842,
29898,
1220,
29897,
13,
4706,
1583,
29889,
1188,
29889,
3888,
703,
29954,
327,
350,
29925,
3553,
1273,
29881,
29908,
1273,
3240,
29897,
13,
4706,
736,
3240,
13,
13,
1678,
822,
731,
29918,
12344,
3149,
29898,
1311,
29892,
2286,
29892,
2436,
29922,
5574,
29892,
1303,
29922,
8824,
1125,
13,
4706,
736,
1583,
29889,
29926,
2324,
29889,
12344,
3149,
29918,
842,
29898,
11918,
29892,
2436,
29922,
3539,
29892,
1303,
29922,
949,
29897,
13,
13,
1678,
822,
3349,
29918,
8690,
3149,
29898,
1311,
29892,
289,
29895,
415,
1125,
13,
4706,
9995,
2772,
1026,
267,
263,
2867,
3149,
15945,
29908,
13,
4706,
396,
14402,
29901,
5399,
445,
13,
4706,
736,
1583,
29889,
29926,
2324,
29889,
8690,
3149,
29918,
8551,
29898,
29890,
29895,
415,
29897,
13,
13,
1678,
822,
2436,
29918,
14834,
29898,
1311,
29892,
3211,
29892,
1734,
2311,
29892,
659,
29892,
954,
29918,
9303,
29922,
29896,
29892,
10650,
29922,
8824,
1125,
13,
4706,
9995,
29956,
768,
267,
3370,
13,
13,
4706,
584,
3207,
3211,
29901,
259,
16428,
304,
2436,
304,
13,
4706,
584,
3207,
1734,
2311,
29901,
29871,
278,
2159,
310,
278,
2436,
313,
29896,
29892,
29871,
29906,
29892,
29871,
29946,
470,
29871,
29947,
29897,
13,
4706,
584,
3207,
659,
29901,
539,
278,
3971,
995,
13,
4706,
584,
1853,
659,
29901,
4706,
938,
565,
954,
29918,
9303,
1275,
29871,
29896,
322,
10650,
1275,
7700,
13,
462,
3986,
1051,
565,
954,
29918,
9303,
1405,
29871,
29896,
322,
10650,
1275,
7700,
13,
462,
3986,
851,
470,
7023,
565,
10650,
1275,
5852,
13,
4706,
584,
3207,
954,
29918,
9303,
29901,
450,
5253,
310,
3838,
304,
1303,
13,
4706,
584,
3207,
10650,
29901,
539,
12048,
11057,
3692,
304,
2436,
297,
10650,
470,
1734,
4464,
13,
4706,
584,
18280,
29901,
308,
5852,
373,
2551,
1683,
7700,
13,
4706,
9995,
13,
4706,
565,
10650,
29901,
13,
9651,
716,
29918,
791,
353,
5159,
13,
9651,
565,
451,
7431,
29898,
791,
1125,
13,
18884,
12020,
7865,
2392,
703,
791,
750,
5225,
3309,
1159,
13,
9651,
716,
29918,
791,
353,
518,
536,
29898,
29894,
29897,
363,
325,
297,
659,
29962,
13,
9651,
659,
353,
716,
29918,
791,
13,
4706,
1018,
29901,
13,
9651,
1583,
29889,
29926,
2324,
29889,
14834,
29918,
3539,
29898,
7328,
29892,
8118,
29897,
13,
9651,
736,
5852,
13,
4706,
5174,
11451,
2324,
29889,
29967,
6595,
2451,
29901,
13,
9651,
736,
7700,
13,
13,
1678,
822,
1303,
29918,
14834,
29898,
1311,
29892,
3211,
29892,
1734,
2311,
29922,
29946,
29892,
954,
29918,
9303,
29922,
29896,
29892,
10650,
29922,
8824,
1125,
13,
4706,
9995,
949,
29879,
3370,
13,
13,
4706,
584,
3207,
3211,
29901,
259,
16428,
304,
2436,
304,
13,
4706,
584,
3207,
1734,
2311,
29901,
29871,
278,
2159,
310,
263,
1303,
1734,
313,
29896,
29892,
29871,
29906,
29892,
29871,
29946,
470,
29871,
29947,
29897,
29871,
13,
4706,
584,
3207,
954,
29918,
9303,
29901,
278,
5253,
310,
1303,
3838,
13,
4706,
584,
3207,
10650,
29901,
539,
26460,
278,
1303,
3370,
881,
367,
4133,
443,
5014,
287,
13,
4706,
584,
2457,
29901,
3986,
450,
1303,
3370,
13,
4706,
9995,
13,
13,
4706,
3240,
353,
1583,
29889,
29926,
2324,
29889,
14834,
29918,
949,
29898,
7328,
29892,
954,
29918,
348,
1169,
29922,
1949,
29918,
9303,
29892,
302,
14836,
29922,
1742,
2311,
29897,
13,
13,
4706,
565,
10650,
29901,
13,
9651,
10650,
29918,
6954,
353,
376,
1642,
7122,
4197,
1482,
524,
29889,
517,
29918,
13193,
29898,
29875,
29892,
3309,
29922,
524,
29898,
755,
29889,
27696,
29898,
29875,
29889,
2966,
29918,
2848,
580,
847,
29871,
29947,
29889,
29900,
4961,
363,
474,
297,
3240,
2314,
13,
9651,
736,
10650,
29918,
6954,
13,
4706,
736,
3240,
13,
13,
1678,
822,
1303,
29918,
9573,
29898,
1311,
29892,
1072,
1125,
13,
4706,
278,
29918,
1727,
353,
304,
13609,
29898,
1727,
29897,
13,
4706,
278,
29918,
13140,
353,
448,
29896,
13,
4706,
363,
22645,
297,
1583,
29889,
29926,
2324,
29889,
9573,
29918,
1761,
7295,
13,
9651,
565,
278,
29918,
1727,
1275,
1583,
29889,
29926,
2324,
29889,
9573,
29918,
978,
29898,
13140,
1125,
13,
18884,
278,
29918,
13140,
353,
22645,
13,
18884,
2867,
13,
4706,
736,
1583,
29889,
9573,
29918,
949,
29898,
1552,
29918,
13140,
29897,
13,
13,
1678,
822,
679,
29918,
6739,
29898,
1311,
1125,
13,
4706,
396,
3617,
9609,
263,
528,
986,
29891,
982,
13,
4706,
363,
22645,
297,
1583,
29889,
29926,
2324,
29889,
9573,
29918,
1761,
7295,
13,
9651,
565,
376,
9026,
29908,
297,
1583,
29889,
29926,
2324,
29889,
9573,
29918,
978,
29898,
13140,
1125,
13,
18884,
736,
1583,
29889,
29926,
2324,
29889,
9573,
29918,
949,
29898,
13140,
29897,
13,
13,
1678,
822,
2436,
29918,
9573,
29898,
1311,
29892,
1072,
29892,
659,
1125,
13,
4706,
9995,
2697,
697,
6036,
373,
278,
3646,
13,
4706,
584,
18280,
29901,
5852,
373,
2551,
15945,
29908,
13,
4706,
278,
29918,
1727,
353,
304,
13609,
29898,
1727,
29897,
13,
4706,
278,
29918,
13140,
353,
448,
29896,
13,
4706,
363,
22645,
297,
1583,
29889,
29926,
2324,
29889,
9573,
29918,
1761,
7295,
13,
9651,
565,
278,
29918,
1727,
1275,
1583,
29889,
29926,
2324,
29889,
9573,
29918,
978,
29898,
13140,
1125,
13,
18884,
278,
29918,
13140,
353,
22645,
13,
18884,
2867,
13,
4706,
736,
1583,
29889,
29926,
2324,
29889,
9573,
29918,
3539,
29898,
1552,
29918,
13140,
29892,
659,
29897,
13,
308,
13,
1678,
822,
4331,
29898,
1311,
1125,
13,
4706,
9995,
14448,
697,
15278,
373,
278,
3646,
13,
4706,
584,
18280,
29901,
5852,
373,
2551,
15945,
29908,
13,
4706,
736,
1583,
29889,
29926,
2324,
29889,
10568,
580,
13,
13,
1678,
822,
640,
29898,
1311,
1125,
13,
4706,
9995,
1323,
262,
1041,
278,
8225,
310,
278,
3646,
13,
4706,
584,
18280,
29901,
5852,
373,
2551,
15945,
29908,
13,
4706,
1583,
29889,
1188,
29889,
3888,
703,
1666,
9929,
3646,
856,
1159,
13,
4706,
736,
1583,
29889,
29926,
2324,
29889,
5060,
442,
580,
13,
13,
1678,
822,
5040,
29898,
1311,
1125,
13,
4706,
9995,
855,
3554,
8225,
310,
278,
3646,
13,
4706,
584,
18280,
29901,
5852,
373,
2551,
15945,
29908,
13,
4706,
1583,
29889,
1188,
29889,
3888,
703,
20754,
3262,
3646,
856,
1159,
13,
4706,
736,
1583,
29889,
29926,
2324,
29889,
10647,
580,
13,
13,
1678,
822,
731,
29918,
355,
713,
2264,
29898,
1311,
29892,
1095,
713,
2264,
2433,
29880,
1992,
29374,
13,
4706,
565,
525,
29880,
1992,
29915,
297,
1095,
713,
2264,
29901,
13,
9651,
1583,
29889,
29926,
2324,
29889,
842,
29918,
29880,
1992,
29918,
355,
713,
580,
13,
4706,
25342,
376,
3752,
29908,
297,
1095,
713,
2264,
29901,
13,
9651,
1583,
29889,
29926,
2324,
29889,
842,
29918,
3752,
29918,
355,
713,
580,
13,
13,
12,
12,
13,
2
] |
pollapp/forms.py | pesusieni999/mtgwebsite | 0 | 175085 | <reponame>pesusieni999/mtgwebsite<filename>pollapp/forms.py
"""
Define forms for Polls application.
"""
from django import forms
from .models import Poll, PollAnswer
__author__ = "pesusieni999"
__copyright__ = "Copyright 2017, MtG website Project"
__credits__ = ["pesusieni999"]
__license__ = "MIT"
__version__ = "0.0.1"
__maintainer__ = "pesusieni999"
__email__ = "<EMAIL>"
__status__ = "Development"
class PollForm(forms.ModelForm):
"""
Form for creating and modifying Polls.
"""
class Meta:
model = Poll
POLL_TYPE_CHOICES = ((True, 'Single selection'), (False, 'Multiple selection'))
POLL_PUBLIC_CHOICES = ((True, 'Public'), (False, 'Private'))
fields = ('name', 'question', 'single_selection', 'public')
labels = {
'single_selection': 'Vote type',
'public': 'Vote publicity'
}
widgets = {
'name': forms.TextInput(attrs={'class': 'form-control form-field'}),
'question': forms.Textarea(attrs={'class': 'form-control form-field'}),
'public': forms.Select(
choices=POLL_PUBLIC_CHOICES,
attrs={'class': 'form-control form-field'}
),
'single_selection': forms.Select(
choices=POLL_TYPE_CHOICES,
attrs={'class': 'form-control form-field'}
),
# 'end_time': forms.DateTimeInput(attrs={'class': 'datetimepicker'}),
}
class PollOptionForm(forms.Form):
"""
Form for defining poll options (that can be voted).
"""
text = forms.CharField(
max_length=128,
label="Option",
widget=forms.TextInput(attrs={'class': 'form-control form-field'})
)
class VoteForm(forms.Form):
"""
Form for voting.
"""
def __init__(self, *args, **kwargs):
# TODO: Add initialization with polls options.
# TODO: Need poll options, and if poll allows multiple choices.
super(VoteForm, self).__init__(*args, **kwargs)
| [
1,
529,
276,
1112,
420,
29958,
5547,
375,
819,
29875,
29929,
29929,
29929,
29914,
4378,
29887,
22942,
29966,
9507,
29958,
3733,
433,
407,
29914,
9514,
29889,
2272,
13,
15945,
29908,
13,
3206,
457,
7190,
363,
2043,
3137,
2280,
29889,
13,
15945,
29908,
13,
13,
3166,
9557,
1053,
7190,
13,
13,
3166,
869,
9794,
1053,
2043,
29880,
29892,
2043,
29880,
22550,
13,
13,
13,
1649,
8921,
1649,
353,
376,
5547,
375,
819,
29875,
29929,
29929,
29929,
29908,
13,
1649,
8552,
1266,
1649,
353,
376,
11882,
1266,
29871,
29906,
29900,
29896,
29955,
29892,
341,
29873,
29954,
4700,
8010,
29908,
13,
1649,
11944,
1169,
1649,
353,
6796,
5547,
375,
819,
29875,
29929,
29929,
29929,
3108,
13,
1649,
506,
1947,
1649,
353,
376,
26349,
29908,
13,
1649,
3259,
1649,
353,
376,
29900,
29889,
29900,
29889,
29896,
29908,
13,
1649,
29885,
2365,
4008,
1649,
353,
376,
5547,
375,
819,
29875,
29929,
29929,
29929,
29908,
13,
1649,
5269,
1649,
353,
9872,
26862,
6227,
11903,
13,
1649,
4882,
1649,
353,
376,
21956,
358,
29908,
13,
13,
13,
1990,
2043,
29880,
2500,
29898,
9514,
29889,
3195,
2500,
1125,
13,
1678,
9995,
13,
1678,
3812,
363,
4969,
322,
23815,
2043,
3137,
29889,
13,
1678,
9995,
13,
1678,
770,
20553,
29901,
13,
4706,
1904,
353,
2043,
29880,
13,
13,
4706,
21521,
2208,
29918,
11116,
29918,
3210,
29949,
2965,
2890,
353,
5135,
5574,
29892,
525,
15771,
9262,
5477,
313,
8824,
29892,
525,
15329,
552,
9262,
8785,
13,
4706,
21521,
2208,
29918,
7056,
13367,
2965,
29918,
3210,
29949,
2965,
2890,
353,
5135,
5574,
29892,
525,
19858,
5477,
313,
8824,
29892,
525,
25207,
8785,
13,
13,
4706,
4235,
353,
6702,
978,
742,
525,
12470,
742,
525,
14369,
29918,
21731,
742,
525,
3597,
1495,
13,
4706,
11073,
353,
426,
13,
9651,
525,
14369,
29918,
21731,
2396,
525,
29963,
866,
1134,
742,
13,
9651,
525,
3597,
2396,
525,
29963,
866,
970,
537,
29915,
13,
4706,
500,
13,
4706,
11109,
29879,
353,
426,
13,
9651,
525,
978,
2396,
7190,
29889,
1626,
4290,
29898,
5552,
29879,
3790,
29915,
1990,
2396,
525,
689,
29899,
6451,
883,
29899,
2671,
29915,
9594,
13,
9651,
525,
12470,
2396,
7190,
29889,
1626,
6203,
29898,
5552,
29879,
3790,
29915,
1990,
2396,
525,
689,
29899,
6451,
883,
29899,
2671,
29915,
9594,
13,
9651,
525,
3597,
2396,
7190,
29889,
3549,
29898,
13,
18884,
19995,
29922,
13152,
2208,
29918,
7056,
13367,
2965,
29918,
3210,
29949,
2965,
2890,
29892,
13,
18884,
12421,
29879,
3790,
29915,
1990,
2396,
525,
689,
29899,
6451,
883,
29899,
2671,
10827,
13,
9651,
10353,
13,
9651,
525,
14369,
29918,
21731,
2396,
7190,
29889,
3549,
29898,
13,
18884,
19995,
29922,
13152,
2208,
29918,
11116,
29918,
3210,
29949,
2965,
2890,
29892,
13,
18884,
12421,
29879,
3790,
29915,
1990,
2396,
525,
689,
29899,
6451,
883,
29899,
2671,
10827,
13,
9651,
10353,
13,
9651,
396,
525,
355,
29918,
2230,
2396,
7190,
29889,
11384,
4290,
29898,
5552,
29879,
3790,
29915,
1990,
2396,
525,
12673,
13908,
29915,
9594,
13,
4706,
500,
13,
13,
13,
1990,
2043,
29880,
8375,
2500,
29898,
9514,
29889,
2500,
1125,
13,
1678,
9995,
13,
1678,
3812,
363,
16184,
21180,
3987,
313,
5747,
508,
367,
24854,
467,
13,
1678,
9995,
13,
1678,
1426,
353,
7190,
29889,
27890,
29898,
13,
4706,
4236,
29918,
2848,
29922,
29896,
29906,
29947,
29892,
13,
4706,
3858,
543,
8375,
613,
13,
4706,
11109,
29922,
9514,
29889,
1626,
4290,
29898,
5552,
29879,
3790,
29915,
1990,
2396,
525,
689,
29899,
6451,
883,
29899,
2671,
29915,
1800,
13,
1678,
1723,
13,
13,
13,
1990,
478,
866,
2500,
29898,
9514,
29889,
2500,
1125,
13,
1678,
9995,
13,
1678,
3812,
363,
28931,
29889,
13,
1678,
9995,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
334,
5085,
29892,
3579,
19290,
1125,
13,
4706,
396,
14402,
29901,
3462,
17865,
411,
1248,
3137,
3987,
29889,
13,
4706,
396,
14402,
29901,
20768,
21180,
3987,
29892,
322,
565,
21180,
6511,
2999,
19995,
29889,
13,
4706,
2428,
29898,
29963,
866,
2500,
29892,
1583,
467,
1649,
2344,
1649,
10456,
5085,
29892,
3579,
19290,
29897,
13,
13,
13,
13,
2
] |
crisiscleanup/calls/migrations/0011_merge_20180122_2308.py | CrisisCleanup/wcicp-call-service | 0 | 13871 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2018-01-22 23:08
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('calls', '0010_auto_20180119_2117'),
('calls', '0007_auto_20180122_2157'),
]
operations = [
]
| [
1,
396,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
29937,
3251,
630,
491,
15337,
29871,
29896,
29889,
29896,
29896,
29889,
29953,
373,
29871,
29906,
29900,
29896,
29947,
29899,
29900,
29896,
29899,
29906,
29906,
29871,
29906,
29941,
29901,
29900,
29947,
13,
3166,
4770,
29888,
9130,
1649,
1053,
29104,
29918,
20889,
1338,
13,
13,
3166,
9557,
29889,
2585,
1053,
9725,
800,
13,
13,
13,
1990,
341,
16783,
29898,
26983,
800,
29889,
29924,
16783,
1125,
13,
13,
1678,
9962,
353,
518,
13,
4706,
6702,
29883,
4293,
742,
525,
29900,
29900,
29896,
29900,
29918,
6921,
29918,
29906,
29900,
29896,
29947,
29900,
29896,
29896,
29929,
29918,
29906,
29896,
29896,
29955,
5477,
13,
4706,
6702,
29883,
4293,
742,
525,
29900,
29900,
29900,
29955,
29918,
6921,
29918,
29906,
29900,
29896,
29947,
29900,
29896,
29906,
29906,
29918,
29906,
29896,
29945,
29955,
5477,
13,
1678,
4514,
13,
13,
1678,
6931,
353,
518,
13,
1678,
4514,
13,
2
] |
kitsune/gallery/models.py | jgmize/kitsune | 0 | 25810 | <gh_stars>0
from datetime import datetime
from django.conf import settings
from django.contrib.auth.models import User
from django.db import models
from kitsune.sumo.models import ModelBase, LocaleField
from kitsune.sumo.urlresolvers import reverse
from kitsune.sumo.utils import auto_delete_files
class Media(ModelBase):
"""Generic model for media"""
title = models.CharField(max_length=255, db_index=True)
created = models.DateTimeField(default=datetime.now, db_index=True)
updated = models.DateTimeField(default=datetime.now, db_index=True)
updated_by = models.ForeignKey(User, null=True)
description = models.TextField(max_length=10000)
locale = LocaleField(default=settings.GALLERY_DEFAULT_LANGUAGE,
db_index=True)
is_draft = models.NullBooleanField(default=None, null=True, editable=False)
class Meta(object):
abstract = True
ordering = ['-created']
unique_together = (('locale', 'title'), ('is_draft', 'creator'))
def __unicode__(self):
return '[%s] %s' % (self.locale, self.title)
@auto_delete_files
class Image(Media):
creator = models.ForeignKey(User, related_name='gallery_images')
file = models.ImageField(upload_to=settings.GALLERY_IMAGE_PATH,
max_length=settings.MAX_FILEPATH_LENGTH)
thumbnail = models.ImageField(
upload_to=settings.GALLERY_IMAGE_THUMBNAIL_PATH, null=True,
max_length=settings.MAX_FILEPATH_LENGTH)
def get_absolute_url(self):
return reverse('gallery.media', args=['image', self.id])
def thumbnail_url_if_set(self):
"""Returns self.thumbnail, if set, else self.file"""
return self.thumbnail.url if self.thumbnail else self.file.url
@auto_delete_files
class Video(Media):
creator = models.ForeignKey(User, related_name='gallery_videos')
webm = models.FileField(upload_to=settings.GALLERY_VIDEO_PATH, null=True,
max_length=settings.MAX_FILEPATH_LENGTH)
ogv = models.FileField(upload_to=settings.GALLERY_VIDEO_PATH, null=True,
max_length=settings.MAX_FILEPATH_LENGTH)
flv = models.FileField(upload_to=settings.GALLERY_VIDEO_PATH, null=True,
max_length=settings.MAX_FILEPATH_LENGTH)
poster = models.ImageField(upload_to=settings.GALLERY_VIDEO_THUMBNAIL_PATH,
max_length=settings.MAX_FILEPATH_LENGTH,
null=True)
thumbnail = models.ImageField(
upload_to=settings.GALLERY_VIDEO_THUMBNAIL_PATH, null=True,
max_length=settings.MAX_FILEPATH_LENGTH)
def get_absolute_url(self):
return reverse('gallery.media', args=['video', self.id])
def thumbnail_url_if_set(self):
"""Returns self.thumbnail.url, if set, else default thumbnail URL"""
progress_url = settings.GALLERY_VIDEO_THUMBNAIL_PROGRESS_URL
return self.thumbnail.url if self.thumbnail else progress_url
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
3166,
12865,
1053,
12865,
13,
13,
3166,
9557,
29889,
5527,
1053,
6055,
13,
3166,
9557,
29889,
21570,
29889,
5150,
29889,
9794,
1053,
4911,
13,
3166,
9557,
29889,
2585,
1053,
4733,
13,
13,
3166,
413,
1169,
1540,
29889,
2083,
29877,
29889,
9794,
1053,
8125,
5160,
29892,
5976,
744,
3073,
13,
3166,
413,
1169,
1540,
29889,
2083,
29877,
29889,
2271,
9778,
874,
1053,
11837,
13,
3166,
413,
1169,
1540,
29889,
2083,
29877,
29889,
13239,
1053,
4469,
29918,
8143,
29918,
5325,
13,
13,
13,
1990,
8213,
29898,
3195,
5160,
1125,
13,
1678,
9995,
15809,
1904,
363,
5745,
15945,
29908,
13,
1678,
3611,
353,
4733,
29889,
27890,
29898,
3317,
29918,
2848,
29922,
29906,
29945,
29945,
29892,
4833,
29918,
2248,
29922,
5574,
29897,
13,
1678,
2825,
353,
4733,
29889,
11384,
3073,
29898,
4381,
29922,
12673,
29889,
3707,
29892,
4833,
29918,
2248,
29922,
5574,
29897,
13,
1678,
4784,
353,
4733,
29889,
11384,
3073,
29898,
4381,
29922,
12673,
29889,
3707,
29892,
4833,
29918,
2248,
29922,
5574,
29897,
13,
1678,
4784,
29918,
1609,
353,
4733,
29889,
27755,
2558,
29898,
2659,
29892,
1870,
29922,
5574,
29897,
13,
1678,
6139,
353,
4733,
29889,
15778,
29898,
3317,
29918,
2848,
29922,
29896,
29900,
29900,
29900,
29900,
29897,
13,
1678,
15068,
353,
5976,
744,
3073,
29898,
4381,
29922,
11027,
29889,
29954,
9818,
24422,
29918,
23397,
29918,
29931,
19453,
29965,
10461,
29892,
13,
462,
308,
4833,
29918,
2248,
29922,
5574,
29897,
13,
1678,
338,
29918,
29881,
4154,
353,
4733,
29889,
7327,
18146,
3073,
29898,
4381,
29922,
8516,
29892,
1870,
29922,
5574,
29892,
3863,
519,
29922,
8824,
29897,
13,
13,
1678,
770,
20553,
29898,
3318,
1125,
13,
4706,
9846,
353,
5852,
13,
4706,
20520,
353,
6024,
29899,
11600,
2033,
13,
4706,
5412,
29918,
29873,
12966,
353,
313,
877,
23337,
742,
525,
3257,
5477,
6702,
275,
29918,
29881,
4154,
742,
525,
1037,
1061,
8785,
13,
13,
1678,
822,
4770,
2523,
356,
12035,
1311,
1125,
13,
4706,
736,
525,
29961,
29995,
29879,
29962,
1273,
29879,
29915,
1273,
313,
1311,
29889,
23337,
29892,
1583,
29889,
3257,
29897,
13,
13,
13,
29992,
6921,
29918,
8143,
29918,
5325,
13,
1990,
7084,
29898,
10572,
1125,
13,
1678,
907,
1061,
353,
4733,
29889,
27755,
2558,
29898,
2659,
29892,
4475,
29918,
978,
2433,
29887,
23365,
29918,
8346,
1495,
13,
1678,
934,
353,
4733,
29889,
2940,
3073,
29898,
9009,
29918,
517,
29922,
11027,
29889,
29954,
9818,
24422,
29918,
2382,
29918,
10145,
29892,
13,
462,
632,
4236,
29918,
2848,
29922,
11027,
29889,
12648,
29918,
7724,
10145,
29918,
19433,
29897,
13,
1678,
266,
21145,
353,
4733,
29889,
2940,
3073,
29898,
13,
4706,
6441,
29918,
517,
29922,
11027,
29889,
29954,
9818,
24422,
29918,
2382,
29918,
4690,
5005,
29933,
3521,
6227,
29918,
10145,
29892,
1870,
29922,
5574,
29892,
13,
4706,
4236,
29918,
2848,
29922,
11027,
29889,
12648,
29918,
7724,
10145,
29918,
19433,
29897,
13,
13,
1678,
822,
679,
29918,
23552,
29918,
2271,
29898,
1311,
1125,
13,
4706,
736,
11837,
877,
29887,
23365,
29889,
9799,
742,
6389,
29922,
1839,
3027,
742,
1583,
29889,
333,
2314,
13,
13,
1678,
822,
266,
21145,
29918,
2271,
29918,
361,
29918,
842,
29898,
1311,
1125,
13,
4706,
9995,
11609,
29879,
1583,
29889,
386,
21145,
29892,
565,
731,
29892,
1683,
1583,
29889,
1445,
15945,
29908,
13,
4706,
736,
1583,
29889,
386,
21145,
29889,
2271,
565,
1583,
29889,
386,
21145,
1683,
1583,
29889,
1445,
29889,
2271,
13,
13,
13,
29992,
6921,
29918,
8143,
29918,
5325,
13,
1990,
13987,
29898,
10572,
1125,
13,
1678,
907,
1061,
353,
4733,
29889,
27755,
2558,
29898,
2659,
29892,
4475,
29918,
978,
2433,
29887,
23365,
29918,
29894,
7958,
1495,
13,
1678,
1856,
29885,
353,
4733,
29889,
2283,
3073,
29898,
9009,
29918,
517,
29922,
11027,
29889,
29954,
9818,
24422,
29918,
13044,
29923,
29949,
29918,
10145,
29892,
1870,
29922,
5574,
29892,
13,
462,
9651,
4236,
29918,
2848,
29922,
11027,
29889,
12648,
29918,
7724,
10145,
29918,
19433,
29897,
13,
1678,
3671,
29894,
353,
4733,
29889,
2283,
3073,
29898,
9009,
29918,
517,
29922,
11027,
29889,
29954,
9818,
24422,
29918,
13044,
29923,
29949,
29918,
10145,
29892,
1870,
29922,
5574,
29892,
13,
462,
965,
4236,
29918,
2848,
29922,
11027,
29889,
12648,
29918,
7724,
10145,
29918,
19433,
29897,
13,
1678,
1652,
29894,
353,
4733,
29889,
2283,
3073,
29898,
9009,
29918,
517,
29922,
11027,
29889,
29954,
9818,
24422,
29918,
13044,
29923,
29949,
29918,
10145,
29892,
1870,
29922,
5574,
29892,
13,
462,
965,
4236,
29918,
2848,
29922,
11027,
29889,
12648,
29918,
7724,
10145,
29918,
19433,
29897,
13,
1678,
10368,
353,
4733,
29889,
2940,
3073,
29898,
9009,
29918,
517,
29922,
11027,
29889,
29954,
9818,
24422,
29918,
13044,
29923,
29949,
29918,
4690,
5005,
29933,
3521,
6227,
29918,
10145,
29892,
13,
462,
1669,
4236,
29918,
2848,
29922,
11027,
29889,
12648,
29918,
7724,
10145,
29918,
19433,
29892,
13,
462,
1669,
1870,
29922,
5574,
29897,
13,
1678,
266,
21145,
353,
4733,
29889,
2940,
3073,
29898,
13,
4706,
6441,
29918,
517,
29922,
11027,
29889,
29954,
9818,
24422,
29918,
13044,
29923,
29949,
29918,
4690,
5005,
29933,
3521,
6227,
29918,
10145,
29892,
1870,
29922,
5574,
29892,
13,
4706,
4236,
29918,
2848,
29922,
11027,
29889,
12648,
29918,
7724,
10145,
29918,
19433,
29897,
13,
13,
1678,
822,
679,
29918,
23552,
29918,
2271,
29898,
1311,
1125,
13,
4706,
736,
11837,
877,
29887,
23365,
29889,
9799,
742,
6389,
29922,
1839,
9641,
742,
1583,
29889,
333,
2314,
13,
13,
1678,
822,
266,
21145,
29918,
2271,
29918,
361,
29918,
842,
29898,
1311,
1125,
13,
4706,
9995,
11609,
29879,
1583,
29889,
386,
21145,
29889,
2271,
29892,
565,
731,
29892,
1683,
2322,
266,
21145,
3988,
15945,
29908,
13,
4706,
6728,
29918,
2271,
353,
6055,
29889,
29954,
9818,
24422,
29918,
13044,
29923,
29949,
29918,
4690,
5005,
29933,
3521,
6227,
29918,
8618,
29954,
26785,
29918,
4219,
13,
4706,
736,
1583,
29889,
386,
21145,
29889,
2271,
565,
1583,
29889,
386,
21145,
1683,
6728,
29918,
2271,
13,
2
] |
tests/test020_get_webhooks.py | Sila-Money/sila-sdk-python | 4 | 189321 | <gh_stars>1-10
import unittest
from silasdk.users import User
from tests.test_config import (app, user_handle, eth_private_key)
class Test020GetWebhooksTest(unittest.TestCase):
def test_001_get_webhooks_200(self):
payload = {
"user_handle": user_handle
}
response = User.get_webhooks(app, payload, eth_private_key)
self.assertTrue(response["success"])
def test_002_get_webhooks_400(self):
payload = {
"user_handle": ''
}
response = User.get_webhooks(app, payload, eth_private_key)
self.assertFalse(response["success"])
def test_001_retry_webhook_200(self):
payload = {
"user_handle": user_handle
}
response = User.get_webhooks(app, payload, eth_private_key)
if response.get("webhooks"):
event_uuid = response["webhooks"][0].get("uuid")
payload = {
"user_handle": user_handle,
"message": "header_msg",
"event_uuid":event_uuid
}
response = User.retry_webhook(app, payload, eth_private_key)
self.assertTrue(response["success"])
if __name__ == "__main__":
unittest.main()
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
5215,
443,
27958,
13,
3166,
4047,
294,
8181,
29889,
7193,
1053,
4911,
13,
3166,
6987,
29889,
1688,
29918,
2917,
1053,
313,
932,
29892,
1404,
29918,
8411,
29892,
11314,
29918,
9053,
29918,
1989,
29897,
13,
13,
13,
1990,
4321,
29900,
29906,
29900,
2577,
3609,
1251,
12117,
3057,
29898,
348,
27958,
29889,
3057,
8259,
1125,
13,
1678,
822,
1243,
29918,
29900,
29900,
29896,
29918,
657,
29918,
2676,
1251,
12117,
29918,
29906,
29900,
29900,
29898,
1311,
1125,
13,
4706,
20092,
353,
426,
13,
9651,
376,
1792,
29918,
8411,
1115,
1404,
29918,
8411,
632,
13,
4706,
500,
13,
4706,
2933,
353,
4911,
29889,
657,
29918,
2676,
1251,
12117,
29898,
932,
29892,
20092,
29892,
11314,
29918,
9053,
29918,
1989,
29897,
13,
4706,
1583,
29889,
9294,
5574,
29898,
5327,
3366,
8698,
20068,
13,
268,
13,
1678,
822,
1243,
29918,
29900,
29900,
29906,
29918,
657,
29918,
2676,
1251,
12117,
29918,
29946,
29900,
29900,
29898,
1311,
1125,
13,
4706,
20092,
353,
426,
13,
9651,
376,
1792,
29918,
8411,
1115,
6629,
632,
13,
4706,
500,
13,
4706,
2933,
353,
4911,
29889,
657,
29918,
2676,
1251,
12117,
29898,
932,
29892,
20092,
29892,
11314,
29918,
9053,
29918,
1989,
29897,
13,
4706,
1583,
29889,
9294,
8824,
29898,
5327,
3366,
8698,
20068,
13,
13,
1678,
822,
1243,
29918,
29900,
29900,
29896,
29918,
276,
2202,
29918,
2676,
20849,
29918,
29906,
29900,
29900,
29898,
1311,
1125,
13,
4706,
20092,
353,
426,
13,
9651,
376,
1792,
29918,
8411,
1115,
1404,
29918,
8411,
632,
13,
4706,
500,
13,
4706,
2933,
353,
4911,
29889,
657,
29918,
2676,
1251,
12117,
29898,
932,
29892,
20092,
29892,
11314,
29918,
9053,
29918,
1989,
29897,
13,
4706,
565,
2933,
29889,
657,
703,
2676,
1251,
12117,
29908,
1125,
13,
9651,
1741,
29918,
25118,
353,
2933,
3366,
2676,
1251,
12117,
3108,
29961,
29900,
1822,
657,
703,
25118,
1159,
13,
9651,
20092,
353,
426,
13,
18884,
376,
1792,
29918,
8411,
1115,
1404,
29918,
8411,
29892,
13,
18884,
376,
4906,
1115,
376,
6672,
29918,
7645,
613,
13,
18884,
376,
3696,
29918,
25118,
1115,
3696,
29918,
25118,
308,
13,
9651,
500,
13,
9651,
2933,
353,
4911,
29889,
276,
2202,
29918,
2676,
20849,
29898,
932,
29892,
20092,
29892,
11314,
29918,
9053,
29918,
1989,
29897,
13,
9651,
1583,
29889,
9294,
5574,
29898,
5327,
3366,
8698,
20068,
13,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
1678,
443,
27958,
29889,
3396,
580,
13,
2
] |
weaver/execute.py | crim-ca/weaver | 16 | 85689 | EXECUTE_MODE_AUTO = "auto"
EXECUTE_MODE_ASYNC = "async"
EXECUTE_MODE_SYNC = "sync"
EXECUTE_MODE_OPTIONS = frozenset([
EXECUTE_MODE_AUTO,
EXECUTE_MODE_ASYNC,
EXECUTE_MODE_SYNC,
])
EXECUTE_CONTROL_OPTION_ASYNC = "async-execute"
EXECUTE_CONTROL_OPTION_SYNC = "sync-execute"
EXECUTE_CONTROL_OPTIONS = frozenset([
EXECUTE_CONTROL_OPTION_ASYNC,
EXECUTE_CONTROL_OPTION_SYNC,
])
EXECUTE_RESPONSE_RAW = "raw"
EXECUTE_RESPONSE_DOCUMENT = "document"
EXECUTE_RESPONSE_OPTIONS = frozenset([
EXECUTE_RESPONSE_RAW,
EXECUTE_RESPONSE_DOCUMENT,
])
EXECUTE_TRANSMISSION_MODE_VALUE = "value"
EXECUTE_TRANSMISSION_MODE_REFERENCE = "reference"
EXECUTE_TRANSMISSION_MODE_OPTIONS = frozenset([
EXECUTE_TRANSMISSION_MODE_VALUE,
EXECUTE_TRANSMISSION_MODE_REFERENCE,
])
| [
1,
8528,
11206,
26027,
29918,
20387,
29918,
20656,
29949,
353,
376,
6921,
29908,
13,
5746,
11206,
26027,
29918,
20387,
29918,
3289,
29979,
15868,
353,
376,
12674,
29908,
13,
5746,
11206,
26027,
29918,
20387,
29918,
14816,
15868,
353,
376,
16593,
29908,
13,
13,
5746,
11206,
26027,
29918,
20387,
29918,
14094,
27946,
353,
14671,
29920,
575,
300,
4197,
13,
1678,
8528,
11206,
26027,
29918,
20387,
29918,
20656,
29949,
29892,
13,
1678,
8528,
11206,
26027,
29918,
20387,
29918,
3289,
29979,
15868,
29892,
13,
1678,
8528,
11206,
26027,
29918,
20387,
29918,
14816,
15868,
29892,
13,
2314,
13,
13,
5746,
11206,
26027,
29918,
22412,
1672,
29931,
29918,
14094,
2725,
29918,
3289,
29979,
15868,
353,
376,
12674,
29899,
7978,
29908,
13,
5746,
11206,
26027,
29918,
22412,
1672,
29931,
29918,
14094,
2725,
29918,
14816,
15868,
353,
376,
16593,
29899,
7978,
29908,
13,
13,
5746,
11206,
26027,
29918,
22412,
1672,
29931,
29918,
14094,
27946,
353,
14671,
29920,
575,
300,
4197,
13,
1678,
8528,
11206,
26027,
29918,
22412,
1672,
29931,
29918,
14094,
2725,
29918,
3289,
29979,
15868,
29892,
13,
1678,
8528,
11206,
26027,
29918,
22412,
1672,
29931,
29918,
14094,
2725,
29918,
14816,
15868,
29892,
13,
2314,
13,
13,
5746,
11206,
26027,
29918,
1525,
5550,
1164,
1660,
29918,
4717,
29956,
353,
376,
1610,
29908,
13,
5746,
11206,
26027,
29918,
1525,
5550,
1164,
1660,
29918,
28665,
5005,
3919,
353,
376,
3225,
29908,
13,
13,
5746,
11206,
26027,
29918,
1525,
5550,
1164,
1660,
29918,
14094,
27946,
353,
14671,
29920,
575,
300,
4197,
13,
1678,
8528,
11206,
26027,
29918,
1525,
5550,
1164,
1660,
29918,
4717,
29956,
29892,
13,
1678,
8528,
11206,
26027,
29918,
1525,
5550,
1164,
1660,
29918,
28665,
5005,
3919,
29892,
13,
2314,
13,
13,
5746,
11206,
26027,
29918,
26813,
29903,
10403,
13507,
29918,
20387,
29918,
19143,
353,
376,
1767,
29908,
13,
5746,
11206,
26027,
29918,
26813,
29903,
10403,
13507,
29918,
20387,
29918,
25866,
1001,
1430,
4741,
353,
376,
5679,
29908,
13,
13,
5746,
11206,
26027,
29918,
26813,
29903,
10403,
13507,
29918,
20387,
29918,
14094,
27946,
353,
14671,
29920,
575,
300,
4197,
13,
1678,
8528,
11206,
26027,
29918,
26813,
29903,
10403,
13507,
29918,
20387,
29918,
19143,
29892,
13,
1678,
8528,
11206,
26027,
29918,
26813,
29903,
10403,
13507,
29918,
20387,
29918,
25866,
1001,
1430,
4741,
29892,
13,
2314,
13,
2
] |
venv/lib/python3.6/site-packages/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/static_routes/static_routes.py | usegalaxy-no/usegalaxy | 1 | 128880 | #
# -*- coding: utf-8 -*-
# Copyright 2019 Red Hat
# GNU General Public License v3.0+
# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
"""
The iosxr static_routes fact class
It is in this file the configuration is collected from the device
for a given resource, parsed, and the facts tree is populated
based on the configuration.
"""
from __future__ import absolute_import, division, print_function
__metaclass__ = type
import re
from copy import deepcopy
from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import (
utils,
)
from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.argspec.static_routes.static_routes import (
Static_routesArgs,
)
class Static_routesFacts(object):
""" The iosxr static_routes fact class
"""
def __init__(self, module, subspec="config", options="options"):
self._module = module
self.argument_spec = Static_routesArgs.argument_spec
spec = deepcopy(self.argument_spec)
if subspec:
if options:
facts_argument_spec = spec[subspec][options]
else:
facts_argument_spec = spec[subspec]
else:
facts_argument_spec = spec
self.generated_spec = utils.generate_dict(facts_argument_spec)
def get_device_data(self, connection):
return connection.get_config(flags="router static")
def populate_facts(self, connection, ansible_facts, data=None):
""" Populate the facts for static_routes
:param connection: the device connection
:param ansible_facts: Facts dictionary
:param data: previously collected conf
:rtype: dictionary
:returns: facts
"""
if not data:
data = self.get_device_data(connection)
objs = []
if "No such configuration" not in data:
for entry in re.compile(r"(\s) vrf").split(data):
obj = self.render_config(self.generated_spec, entry)
if obj:
objs.append(obj)
ansible_facts["ansible_network_resources"].pop("static_routes", None)
facts = {}
facts["static_routes"] = []
params = utils.validate_config(self.argument_spec, {"config": objs})
for cfg in params["config"]:
facts["static_routes"].append(utils.remove_empties(cfg))
ansible_facts["ansible_network_resources"].update(facts)
return ansible_facts
def render_config(self, spec, conf):
"""
Render config as dictionary structure and delete keys
from spec for null values
:param spec: The facts tree, generated from the argspec
:param conf: The configuration
:rtype: dictionary
:returns: The generated config
"""
config = deepcopy(spec)
entry_list = conf.split(" address-family")
config["address_families"] = []
if "router static" not in entry_list[0]:
config["vrf"] = entry_list[0].replace("!", "").strip()
for item in entry_list[1:]:
routes = []
address_family = {"routes": []}
address_family["afi"], address_family["safi"] = self.parse_af(item)
destinations = re.findall(r"((?:\S+)/(?:\d+)) (?:.*)", item, re.M)
for dest in set(destinations):
route = {"next_hops": []}
route["dest"] = dest
regex = r"%s .+$" % dest
cfg = re.findall(regex, item, re.M)
for route_entry in cfg:
exit_point = {}
exit_point["forward_router_address"] = self.parse_faddr(
route_entry
)
exit_point["interface"] = self.parse_intf(route_entry)
exit_point["admin_distance"] = self.parse_admin_distance(
route_entry
)
for x in [
"tag",
"tunnel-id",
"metric",
"description",
"track",
"vrflabel",
"dest_vrf",
]:
exit_point[x.replace("-", "_")] = self.parse_attrib(
route_entry, x.replace("dest_vrf", "vrf")
)
route["next_hops"].append(exit_point)
routes.append(route)
address_family["routes"] = sorted(
routes, key=lambda i: i["dest"]
)
config["address_families"].append(address_family)
return utils.remove_empties(config)
def parse_af(self, item):
match = re.search(r"(?:\s*)(\w+)(?:\s*)(\w+)", item, re.M)
if match:
return match.group(1), match.group(2)
def parse_faddr(self, item):
for x in item.split(" "):
if (":" in x or "." in x) and "/" not in x:
return x
def parse_intf(self, item):
inf_search_strs = [
r" ((\w+)((?:\d)/(?:\d)/(?:\d)/(?:\d+)))",
r" (([a-zA-Z]+)(?:\d+))",
]
for i in inf_search_strs:
match = re.search(i, item, re.M)
if match:
return match.group(1)
def parse_attrib(self, item, attrib):
match = re.search(r" %s (\S+)" % attrib, item)
if match:
val = match.group(1).strip("'")
if attrib in ["tunnel-id", "vrflabel", "tag", "metric"]:
val = int(val)
return val
def parse_admin_distance(self, item):
split_item = item.split(" ")
for item in [
"vrf",
"metric",
"tunnel-id",
"vrflabel",
"track",
"tag",
"description",
]:
try:
del split_item[split_item.index(item) + 1]
del split_item[split_item.index(item)]
except ValueError:
continue
try:
return [
i
for i in split_item
if "." not in i
and ":" not in i
and ord(i[0]) > 48
and ord(i[0]) < 57
][0]
except IndexError:
return None
| [
1,
396,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
29937,
14187,
1266,
29871,
29906,
29900,
29896,
29929,
4367,
25966,
13,
29937,
15143,
4593,
5236,
19245,
325,
29941,
29889,
29900,
29974,
13,
29937,
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,
15945,
29908,
13,
1576,
10615,
29916,
29878,
2294,
29918,
27894,
2114,
770,
13,
3112,
338,
297,
445,
934,
278,
5285,
338,
16531,
515,
278,
4742,
13,
1454,
263,
2183,
6503,
29892,
21213,
29892,
322,
278,
17099,
5447,
338,
24146,
13,
6707,
373,
278,
5285,
29889,
13,
15945,
29908,
13,
13,
3166,
4770,
29888,
9130,
1649,
1053,
8380,
29918,
5215,
29892,
8542,
29892,
1596,
29918,
2220,
13,
13,
1649,
2527,
562,
605,
1649,
353,
1134,
13,
13,
13,
5215,
337,
13,
3166,
3509,
1053,
6483,
8552,
13,
3166,
385,
1687,
29918,
29027,
29889,
550,
1821,
29889,
1212,
9435,
29889,
12800,
29889,
5453,
29918,
13239,
29889,
11618,
29889,
9435,
1053,
313,
13,
1678,
3667,
29879,
29892,
13,
29897,
13,
3166,
385,
1687,
29918,
29027,
29889,
3476,
1111,
29889,
2363,
29916,
29878,
29889,
12800,
29889,
5453,
29918,
13239,
29889,
11618,
29889,
2363,
29916,
29878,
29889,
5085,
3135,
29889,
7959,
29918,
27894,
29889,
7959,
29918,
27894,
1053,
313,
13,
1678,
624,
2454,
29918,
27894,
7883,
29892,
13,
29897,
13,
13,
13,
1990,
624,
2454,
29918,
27894,
20738,
29879,
29898,
3318,
1125,
13,
1678,
9995,
450,
10615,
29916,
29878,
2294,
29918,
27894,
2114,
770,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
3883,
29892,
1014,
6550,
543,
2917,
613,
3987,
543,
6768,
29908,
1125,
13,
4706,
1583,
3032,
5453,
353,
3883,
13,
4706,
1583,
29889,
23516,
29918,
6550,
353,
624,
2454,
29918,
27894,
7883,
29889,
23516,
29918,
6550,
13,
4706,
1580,
353,
6483,
8552,
29898,
1311,
29889,
23516,
29918,
6550,
29897,
13,
4706,
565,
1014,
6550,
29901,
13,
9651,
565,
3987,
29901,
13,
18884,
17099,
29918,
23516,
29918,
6550,
353,
1580,
29961,
1491,
6550,
3816,
6768,
29962,
13,
9651,
1683,
29901,
13,
18884,
17099,
29918,
23516,
29918,
6550,
353,
1580,
29961,
1491,
6550,
29962,
13,
4706,
1683,
29901,
13,
9651,
17099,
29918,
23516,
29918,
6550,
353,
1580,
13,
13,
4706,
1583,
29889,
13525,
29918,
6550,
353,
3667,
29879,
29889,
17158,
29918,
8977,
29898,
17028,
29879,
29918,
23516,
29918,
6550,
29897,
13,
13,
1678,
822,
679,
29918,
10141,
29918,
1272,
29898,
1311,
29892,
3957,
1125,
13,
4706,
736,
3957,
29889,
657,
29918,
2917,
29898,
15764,
543,
15140,
2294,
1159,
13,
13,
1678,
822,
19450,
29918,
17028,
29879,
29898,
1311,
29892,
3957,
29892,
385,
1687,
29918,
17028,
29879,
29892,
848,
29922,
8516,
1125,
13,
4706,
9995,
6977,
5987,
278,
17099,
363,
2294,
29918,
27894,
13,
4706,
584,
3207,
3957,
29901,
278,
4742,
3957,
13,
4706,
584,
3207,
385,
1687,
29918,
17028,
29879,
29901,
26748,
29879,
8600,
13,
4706,
584,
3207,
848,
29901,
9251,
16531,
1970,
13,
4706,
584,
29878,
1853,
29901,
8600,
13,
4706,
584,
18280,
29901,
17099,
13,
4706,
9995,
13,
4706,
565,
451,
848,
29901,
13,
9651,
848,
353,
1583,
29889,
657,
29918,
10141,
29918,
1272,
29898,
9965,
29897,
13,
13,
4706,
704,
1315,
353,
5159,
13,
13,
4706,
565,
376,
3782,
1316,
5285,
29908,
451,
297,
848,
29901,
13,
9651,
363,
6251,
297,
337,
29889,
12198,
29898,
29878,
29908,
1194,
29879,
29897,
325,
9600,
2564,
5451,
29898,
1272,
1125,
13,
18884,
5446,
353,
1583,
29889,
9482,
29918,
2917,
29898,
1311,
29889,
13525,
29918,
6550,
29892,
6251,
29897,
13,
18884,
565,
5446,
29901,
13,
462,
1678,
704,
1315,
29889,
4397,
29898,
5415,
29897,
13,
13,
4706,
385,
1687,
29918,
17028,
29879,
3366,
550,
1821,
29918,
11618,
29918,
13237,
16862,
7323,
703,
7959,
29918,
27894,
613,
6213,
29897,
13,
4706,
17099,
353,
6571,
13,
13,
4706,
17099,
3366,
7959,
29918,
27894,
3108,
353,
5159,
13,
4706,
8636,
353,
3667,
29879,
29889,
15480,
29918,
2917,
29898,
1311,
29889,
23516,
29918,
6550,
29892,
8853,
2917,
1115,
704,
1315,
1800,
13,
4706,
363,
274,
16434,
297,
8636,
3366,
2917,
3108,
29901,
13,
9651,
17099,
3366,
7959,
29918,
27894,
16862,
4397,
29898,
13239,
29889,
5992,
29918,
3456,
583,
29898,
16859,
876,
13,
13,
4706,
385,
1687,
29918,
17028,
29879,
3366,
550,
1821,
29918,
11618,
29918,
13237,
16862,
5504,
29898,
17028,
29879,
29897,
13,
4706,
736,
385,
1687,
29918,
17028,
29879,
13,
13,
1678,
822,
4050,
29918,
2917,
29898,
1311,
29892,
1580,
29892,
1970,
1125,
13,
4706,
9995,
13,
4706,
26000,
2295,
408,
8600,
3829,
322,
5217,
6611,
13,
3986,
515,
1580,
363,
1870,
1819,
13,
13,
4706,
584,
3207,
1580,
29901,
450,
17099,
5447,
29892,
5759,
515,
278,
6389,
3135,
13,
4706,
584,
3207,
1970,
29901,
450,
5285,
13,
4706,
584,
29878,
1853,
29901,
8600,
13,
4706,
584,
18280,
29901,
450,
5759,
2295,
13,
4706,
9995,
13,
4706,
2295,
353,
6483,
8552,
29898,
6550,
29897,
13,
4706,
6251,
29918,
1761,
353,
1970,
29889,
5451,
703,
3211,
29899,
11922,
1159,
13,
4706,
2295,
3366,
7328,
29918,
8302,
583,
3108,
353,
5159,
13,
13,
4706,
565,
376,
15140,
2294,
29908,
451,
297,
6251,
29918,
1761,
29961,
29900,
5387,
13,
9651,
2295,
3366,
29894,
9600,
3108,
353,
6251,
29918,
1761,
29961,
29900,
1822,
6506,
703,
29991,
613,
376,
2564,
17010,
580,
13,
13,
4706,
363,
2944,
297,
6251,
29918,
1761,
29961,
29896,
29901,
5387,
13,
9651,
12049,
353,
5159,
13,
9651,
3211,
29918,
11922,
353,
8853,
27894,
1115,
5159,
29913,
13,
9651,
3211,
29918,
11922,
3366,
2142,
29875,
12436,
3211,
29918,
11922,
3366,
29879,
2142,
29875,
3108,
353,
1583,
29889,
5510,
29918,
2142,
29898,
667,
29897,
13,
13,
9651,
15422,
800,
353,
337,
29889,
2886,
497,
29898,
29878,
29908,
3552,
29973,
3583,
29903,
29974,
6802,
10780,
3583,
29881,
29974,
876,
22308,
29901,
5575,
19123,
2944,
29892,
337,
29889,
29924,
29897,
13,
9651,
363,
2731,
297,
731,
29898,
7854,
262,
800,
1125,
13,
18884,
5782,
353,
8853,
4622,
29918,
29882,
3554,
1115,
5159,
29913,
13,
18884,
5782,
3366,
7854,
3108,
353,
2731,
13,
13,
18884,
6528,
353,
364,
29908,
29995,
29879,
869,
24035,
29908,
1273,
2731,
13,
18884,
274,
16434,
353,
337,
29889,
2886,
497,
29898,
13087,
29892,
2944,
29892,
337,
29889,
29924,
29897,
13,
13,
18884,
363,
5782,
29918,
8269,
297,
274,
16434,
29901,
13,
462,
1678,
6876,
29918,
3149,
353,
6571,
13,
462,
1678,
6876,
29918,
3149,
3366,
11333,
29918,
15140,
29918,
7328,
3108,
353,
1583,
29889,
5510,
29918,
29888,
10030,
29898,
13,
462,
4706,
5782,
29918,
8269,
13,
462,
1678,
1723,
13,
462,
1678,
6876,
29918,
3149,
3366,
13248,
3108,
353,
1583,
29889,
5510,
29918,
524,
29888,
29898,
13134,
29918,
8269,
29897,
13,
462,
1678,
6876,
29918,
3149,
3366,
6406,
29918,
19244,
3108,
353,
1583,
29889,
5510,
29918,
6406,
29918,
19244,
29898,
13,
462,
4706,
5782,
29918,
8269,
13,
462,
1678,
1723,
13,
13,
462,
1678,
363,
921,
297,
518,
13,
462,
4706,
376,
4039,
613,
13,
462,
4706,
376,
29873,
16163,
29899,
333,
613,
13,
462,
4706,
376,
16414,
613,
13,
462,
4706,
376,
8216,
613,
13,
462,
4706,
376,
11294,
613,
13,
462,
4706,
376,
13416,
1579,
1107,
613,
13,
462,
4706,
376,
7854,
29918,
29894,
9600,
613,
13,
462,
1678,
4514,
29901,
13,
462,
4706,
6876,
29918,
3149,
29961,
29916,
29889,
6506,
703,
29899,
613,
11119,
13531,
353,
1583,
29889,
5510,
29918,
1131,
1091,
29898,
13,
462,
9651,
5782,
29918,
8269,
29892,
921,
29889,
6506,
703,
7854,
29918,
29894,
9600,
613,
376,
29894,
9600,
1159,
13,
462,
4706,
1723,
13,
13,
462,
1678,
5782,
3366,
4622,
29918,
29882,
3554,
16862,
4397,
29898,
13322,
29918,
3149,
29897,
13,
13,
18884,
12049,
29889,
4397,
29898,
13134,
29897,
13,
18884,
3211,
29918,
11922,
3366,
27894,
3108,
353,
12705,
29898,
13,
462,
1678,
12049,
29892,
1820,
29922,
2892,
474,
29901,
474,
3366,
7854,
3108,
13,
18884,
1723,
13,
9651,
2295,
3366,
7328,
29918,
8302,
583,
16862,
4397,
29898,
7328,
29918,
11922,
29897,
13,
13,
4706,
736,
3667,
29879,
29889,
5992,
29918,
3456,
583,
29898,
2917,
29897,
13,
13,
1678,
822,
6088,
29918,
2142,
29898,
1311,
29892,
2944,
1125,
13,
4706,
1993,
353,
337,
29889,
4478,
29898,
29878,
29908,
10780,
3583,
29879,
7528,
1194,
29893,
29974,
5033,
29973,
3583,
29879,
7528,
1194,
29893,
29974,
19123,
2944,
29892,
337,
29889,
29924,
29897,
13,
4706,
565,
1993,
29901,
13,
9651,
736,
1993,
29889,
2972,
29898,
29896,
511,
1993,
29889,
2972,
29898,
29906,
29897,
13,
13,
1678,
822,
6088,
29918,
29888,
10030,
29898,
1311,
29892,
2944,
1125,
13,
4706,
363,
921,
297,
2944,
29889,
5451,
703,
376,
1125,
13,
9651,
565,
313,
4710,
297,
921,
470,
376,
1213,
297,
921,
29897,
322,
5591,
29908,
451,
297,
921,
29901,
13,
18884,
736,
921,
13,
13,
1678,
822,
6088,
29918,
524,
29888,
29898,
1311,
29892,
2944,
1125,
13,
4706,
3041,
29918,
4478,
29918,
710,
29879,
353,
518,
13,
9651,
364,
29908,
313,
1194,
29893,
28135,
3552,
29973,
3583,
29881,
6802,
10780,
3583,
29881,
6802,
10780,
3583,
29881,
6802,
10780,
3583,
29881,
29974,
4961,
613,
13,
9651,
364,
29908,
313,
4197,
29874,
29899,
25265,
29899,
29999,
10062,
5033,
29973,
3583,
29881,
29974,
876,
613,
13,
4706,
4514,
13,
4706,
363,
474,
297,
3041,
29918,
4478,
29918,
710,
29879,
29901,
13,
9651,
1993,
353,
337,
29889,
4478,
29898,
29875,
29892,
2944,
29892,
337,
29889,
29924,
29897,
13,
9651,
565,
1993,
29901,
13,
18884,
736,
1993,
29889,
2972,
29898,
29896,
29897,
13,
13,
1678,
822,
6088,
29918,
1131,
1091,
29898,
1311,
29892,
2944,
29892,
1098,
1091,
1125,
13,
4706,
1993,
353,
337,
29889,
4478,
29898,
29878,
29908,
1273,
29879,
3441,
29903,
29974,
5513,
1273,
1098,
1091,
29892,
2944,
29897,
13,
4706,
565,
1993,
29901,
13,
9651,
659,
353,
1993,
29889,
2972,
29898,
29896,
467,
17010,
703,
29915,
1159,
13,
9651,
565,
1098,
1091,
297,
6796,
29873,
16163,
29899,
333,
613,
376,
13416,
1579,
1107,
613,
376,
4039,
613,
376,
16414,
3108,
29901,
13,
18884,
659,
353,
938,
29898,
791,
29897,
13,
9651,
736,
659,
13,
13,
1678,
822,
6088,
29918,
6406,
29918,
19244,
29898,
1311,
29892,
2944,
1125,
13,
4706,
6219,
29918,
667,
353,
2944,
29889,
5451,
703,
16521,
13,
4706,
363,
2944,
297,
518,
13,
9651,
376,
29894,
9600,
613,
13,
9651,
376,
16414,
613,
13,
9651,
376,
29873,
16163,
29899,
333,
613,
13,
9651,
376,
13416,
1579,
1107,
613,
13,
9651,
376,
11294,
613,
13,
9651,
376,
4039,
613,
13,
9651,
376,
8216,
613,
13,
4706,
4514,
29901,
13,
9651,
1018,
29901,
13,
18884,
628,
6219,
29918,
667,
29961,
5451,
29918,
667,
29889,
2248,
29898,
667,
29897,
718,
29871,
29896,
29962,
13,
18884,
628,
6219,
29918,
667,
29961,
5451,
29918,
667,
29889,
2248,
29898,
667,
4638,
13,
9651,
5174,
7865,
2392,
29901,
13,
18884,
6773,
13,
4706,
1018,
29901,
13,
9651,
736,
518,
13,
18884,
474,
13,
18884,
363,
474,
297,
6219,
29918,
667,
13,
18884,
565,
376,
1213,
451,
297,
474,
13,
18884,
322,
376,
6160,
451,
297,
474,
13,
18884,
322,
4356,
29898,
29875,
29961,
29900,
2314,
1405,
29871,
29946,
29947,
13,
18884,
322,
4356,
29898,
29875,
29961,
29900,
2314,
529,
29871,
29945,
29955,
13,
632,
3816,
29900,
29962,
13,
4706,
5174,
11374,
2392,
29901,
13,
9651,
736,
6213,
13,
2
] |
ex066.py | thiagobachiega/python | 0 | 115502 | <reponame>thiagobachiega/python
num = soma = cont = 0
while True:
num = int(input('Digite um número: '))
if num == 999:
break
soma = soma + num
cont = cont + 1
print(f'A soma dos {cont} números digitados é: {soma}')
| [
1,
529,
276,
1112,
420,
29958,
386,
29875,
351,
711,
496,
347,
3249,
29914,
4691,
13,
1949,
353,
1047,
29874,
353,
640,
353,
29871,
29900,
13,
13,
8000,
5852,
29901,
13,
1678,
954,
353,
938,
29898,
2080,
877,
14991,
568,
1922,
13831,
29901,
525,
876,
13,
1678,
565,
954,
1275,
29871,
29929,
29929,
29929,
29901,
13,
4706,
2867,
13,
1678,
1047,
29874,
353,
1047,
29874,
718,
954,
13,
1678,
640,
353,
640,
718,
29871,
29896,
13,
13,
2158,
29898,
29888,
29915,
29909,
1047,
29874,
3248,
426,
1285,
29913,
12158,
359,
13615,
2255,
904,
29901,
426,
29879,
4125,
29913,
1495,
13,
2
] |
streams/blog/migrations/0012_auto_20200928_1212.py | Engerrs/ckan.org | 1 | 9300 | <filename>streams/blog/migrations/0012_auto_20200928_1212.py
# Generated by Django 3.1.1 on 2020-09-28 12:12
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('blog', '0011_blogpostpage_featured'),
]
operations = [
migrations.RemoveField(
model_name='blogpostpage',
name='date',
),
migrations.AddField(
model_name='blogpostpage',
name='created',
field=models.DateTimeField(blank=True, default=datetime.datetime.now),
),
]
| [
1,
529,
9507,
29958,
5461,
29879,
29914,
7312,
29914,
26983,
800,
29914,
29900,
29900,
29896,
29906,
29918,
6921,
29918,
29906,
29900,
29906,
29900,
29900,
29929,
29906,
29947,
29918,
29896,
29906,
29896,
29906,
29889,
2272,
13,
29937,
3251,
630,
491,
15337,
29871,
29941,
29889,
29896,
29889,
29896,
373,
29871,
29906,
29900,
29906,
29900,
29899,
29900,
29929,
29899,
29906,
29947,
29871,
29896,
29906,
29901,
29896,
29906,
13,
13,
5215,
12865,
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,
7312,
742,
525,
29900,
29900,
29896,
29896,
29918,
7312,
2490,
3488,
29918,
14394,
29881,
5477,
13,
1678,
4514,
13,
13,
1678,
6931,
353,
518,
13,
4706,
9725,
800,
29889,
15941,
3073,
29898,
13,
9651,
1904,
29918,
978,
2433,
7312,
2490,
3488,
742,
13,
9651,
1024,
2433,
1256,
742,
13,
4706,
10353,
13,
4706,
9725,
800,
29889,
2528,
3073,
29898,
13,
9651,
1904,
29918,
978,
2433,
7312,
2490,
3488,
742,
13,
9651,
1024,
2433,
11600,
742,
13,
9651,
1746,
29922,
9794,
29889,
11384,
3073,
29898,
19465,
29922,
5574,
29892,
2322,
29922,
12673,
29889,
12673,
29889,
3707,
511,
13,
4706,
10353,
13,
1678,
4514,
13,
2
] |
sitri/providers/contrib/ini.py | Elastoo-Team/sitri | 11 | 12172 | import configparser
import os
import typing
from sitri.providers.base import ConfigProvider
class IniConfigProvider(ConfigProvider):
"""Config provider for Initialization file (Ini)."""
provider_code = "ini"
def __init__(
self,
ini_path: str = "./config.ini",
):
"""
:param ini_path: path to ini file
"""
self.configparser = configparser.ConfigParser()
with open(os.path.abspath(ini_path)) as f:
self.configparser.read_file(f)
self._sections = None
@property
def sections(self):
if not self._sections:
self._sections = list(self.configparser.keys())
return self._sections
def get(self, key: str, section: str, **kwargs) -> typing.Optional[typing.Any]: # type: ignore
"""Get value from ini file.
:param key: key or path for search
:param section: section of ini file
"""
if section not in self.sections:
return None
return self.configparser[section].get(key)
def keys(self, section: str, **kwargs) -> typing.List[str]: # type: ignore
"""Get keys of section.
:param section: section of ini file
"""
if section not in self.sections:
return []
return list(self.configparser[section].keys())
| [
1,
1053,
2295,
16680,
13,
5215,
2897,
13,
5215,
19229,
13,
13,
3166,
7845,
374,
29889,
771,
29454,
29889,
3188,
1053,
12782,
6980,
13,
13,
13,
1990,
512,
29875,
3991,
6980,
29898,
3991,
6980,
1125,
13,
1678,
9995,
3991,
13113,
363,
17250,
2133,
934,
313,
797,
29875,
467,
15945,
29908,
13,
13,
1678,
13113,
29918,
401,
353,
376,
2172,
29908,
13,
13,
1678,
822,
4770,
2344,
12035,
13,
4706,
1583,
29892,
13,
4706,
297,
29875,
29918,
2084,
29901,
851,
353,
376,
6904,
2917,
29889,
2172,
613,
13,
268,
1125,
13,
4706,
9995,
13,
13,
4706,
584,
3207,
297,
29875,
29918,
2084,
29901,
2224,
304,
297,
29875,
934,
13,
4706,
9995,
13,
4706,
1583,
29889,
2917,
16680,
353,
2295,
16680,
29889,
3991,
11726,
580,
13,
13,
4706,
411,
1722,
29898,
359,
29889,
2084,
29889,
370,
1028,
493,
29898,
2172,
29918,
2084,
876,
408,
285,
29901,
13,
9651,
1583,
29889,
2917,
16680,
29889,
949,
29918,
1445,
29898,
29888,
29897,
13,
13,
4706,
1583,
3032,
27117,
353,
6213,
13,
13,
1678,
732,
6799,
13,
1678,
822,
13926,
29898,
1311,
1125,
13,
4706,
565,
451,
1583,
3032,
27117,
29901,
13,
9651,
1583,
3032,
27117,
353,
1051,
29898,
1311,
29889,
2917,
16680,
29889,
8149,
3101,
13,
13,
4706,
736,
1583,
3032,
27117,
13,
13,
1678,
822,
679,
29898,
1311,
29892,
1820,
29901,
851,
29892,
4004,
29901,
851,
29892,
3579,
19290,
29897,
1599,
19229,
29889,
27636,
29961,
1017,
15702,
29889,
10773,
5387,
29871,
396,
1134,
29901,
11455,
13,
4706,
9995,
2577,
995,
515,
297,
29875,
934,
29889,
13,
13,
4706,
584,
3207,
1820,
29901,
1820,
470,
2224,
363,
2740,
13,
4706,
584,
3207,
4004,
29901,
4004,
310,
297,
29875,
934,
13,
4706,
9995,
13,
4706,
565,
4004,
451,
297,
1583,
29889,
27117,
29901,
13,
9651,
736,
6213,
13,
13,
4706,
736,
1583,
29889,
2917,
16680,
29961,
2042,
1822,
657,
29898,
1989,
29897,
13,
13,
1678,
822,
6611,
29898,
1311,
29892,
4004,
29901,
851,
29892,
3579,
19290,
29897,
1599,
19229,
29889,
1293,
29961,
710,
5387,
29871,
396,
1134,
29901,
11455,
13,
4706,
9995,
2577,
6611,
310,
4004,
29889,
13,
13,
4706,
584,
3207,
4004,
29901,
4004,
310,
297,
29875,
934,
13,
4706,
9995,
13,
4706,
565,
4004,
451,
297,
1583,
29889,
27117,
29901,
13,
9651,
736,
5159,
13,
13,
4706,
736,
1051,
29898,
1311,
29889,
2917,
16680,
29961,
2042,
1822,
8149,
3101,
13,
2
] |
LocStat/pipelines/output.py | nhtoshiaki/LocStat | 0 | 15359 | # -*- coding: utf-8 -*-
import items
class TxtFileWriter:
"""
Write the repository representation in the file.
"""
def __init__(self, file_path):
self.file_path = file_path
def __enter__(self):
self.file = open(self.file_path, 'w', encoding='utf-8')
return self
def __exit__(self, *args):
if self.file and not self.file.closed:
self.file.close()
@property
def file_path(self):
return self._file_path
@file_path.setter
def file_path(self, file_path):
self._file_path = file_path
@property
def file(self):
return self._file
@file.setter
def file(self, file):
self._file = file
@property
def closed(self):
if self.file:
return self.file.closed
else:
return True
def write(self, root_dir_item):
if self.file and not self.file.closed:
self.file.write(f'Repositorio: '
f'{root_dir_item["repository_relurl"]}\n')
self.file.write(f'Total de linhas: '
f'{root_dir_item["amount_lines"]}\n')
self.file.write(f'Total de bytes: '
f'{root_dir_item["amount_bytes"]}\n')
self.file.write('\n')
self.write_extension_statistic(root_dir_item)
self.file.write('\n')
self.write_tree_structure(root_dir_item)
def write_extension_statistic(self, root_dir_item):
"""
Writes the table with the number of lines and bytes for each file
extension.
"""
if self.file and not self.file.closed:
self.file.write(f'{"Extensao":<10} | {"Linhas":^15} | '
f'{"Bytes":^15}\n')
self.file.write(f'{"":=<11}|{"":=^17}|{"":=^16}\n')
if 'index' in root_dir_item:
for ext, info in root_dir_item['index'].items():
if len(ext) == 0:
ext = '<outros>'
amount_lines, amount_bytes = 0, 0
perc_lines, perc_bytes = 0, 0
if 'amount_lines' in info:
amount_lines = info['amount_lines']
if 'amount_bytes' in info:
amount_bytes = info['amount_bytes']
if 'amount_lines' in root_dir_item and \
root_dir_item['amount_lines'] != 0:
perc_lines = int(100 * amount_lines
/ root_dir_item['amount_lines'])
if 'amount_bytes' in root_dir_item and \
root_dir_item['amount_bytes'] != 0:
perc_bytes = int(100 * amount_bytes
/ root_dir_item['amount_bytes'])
self.file.write(f'{ext:<10} | {amount_lines:>7} '
f'({perc_lines:>3} %) | '
f'{amount_bytes:>6} '
f'({perc_bytes:>3} %)\n')
def write_tree_structure(self, root_dir_item):
"""
Writes the repository file structure.
"""
def _tree_structure(file_item, depth):
"""
Recursive function to create the file structure.
"""
structure = ''
for i in range(depth - 1):
structure += '| '
structure += '|-- '
if 'name' in file_item:
if isinstance(file_item, items.DirectoryItem):
structure += f'[{file_item["name"]}]\n'
if 'children' in file_item \
and type(file_item['children']) is list:
for child in file_item['children']:
structure += \
_tree_structure(child, depth + 1)
elif isinstance(file_item, items.TextFileItem):
structure += f'{file_item["name"]}'
if 'amount_lines' in file_item:
structure += f' ({file_item["amount_lines"]} linhas)'
structure += '\n'
return structure
if self.file and not self.file.closed:
structure = ''
if 'repository_name' in root_dir_item:
structure += f'[{root_dir_item["repository_name"]}]\n'
if 'children' in root_dir_item and type(root_dir_item['children'])\
is list:
for child in root_dir_item['children']:
structure += _tree_structure(child, 1)
self.file.write(structure)
| [
1,
396,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
13,
5215,
4452,
13,
13,
13,
1990,
323,
486,
2283,
10507,
29901,
13,
1678,
9995,
13,
1678,
14350,
278,
9810,
8954,
297,
278,
934,
29889,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
934,
29918,
2084,
1125,
13,
4706,
1583,
29889,
1445,
29918,
2084,
353,
934,
29918,
2084,
13,
13,
1678,
822,
4770,
5893,
12035,
1311,
1125,
13,
4706,
1583,
29889,
1445,
353,
1722,
29898,
1311,
29889,
1445,
29918,
2084,
29892,
525,
29893,
742,
8025,
2433,
9420,
29899,
29947,
1495,
13,
4706,
736,
1583,
13,
13,
1678,
822,
4770,
13322,
12035,
1311,
29892,
334,
5085,
1125,
13,
4706,
565,
1583,
29889,
1445,
322,
451,
1583,
29889,
1445,
29889,
15603,
29901,
13,
9651,
1583,
29889,
1445,
29889,
5358,
580,
13,
13,
1678,
732,
6799,
13,
1678,
822,
934,
29918,
2084,
29898,
1311,
1125,
13,
4706,
736,
1583,
3032,
1445,
29918,
2084,
13,
13,
1678,
732,
1445,
29918,
2084,
29889,
842,
357,
13,
1678,
822,
934,
29918,
2084,
29898,
1311,
29892,
934,
29918,
2084,
1125,
13,
4706,
1583,
3032,
1445,
29918,
2084,
353,
934,
29918,
2084,
13,
13,
1678,
732,
6799,
13,
1678,
822,
934,
29898,
1311,
1125,
13,
4706,
736,
1583,
3032,
1445,
13,
13,
1678,
732,
1445,
29889,
842,
357,
13,
1678,
822,
934,
29898,
1311,
29892,
934,
1125,
13,
4706,
1583,
3032,
1445,
353,
934,
13,
13,
1678,
732,
6799,
13,
1678,
822,
5764,
29898,
1311,
1125,
13,
4706,
565,
1583,
29889,
1445,
29901,
13,
9651,
736,
1583,
29889,
1445,
29889,
15603,
13,
4706,
1683,
29901,
13,
9651,
736,
5852,
13,
13,
1678,
822,
2436,
29898,
1311,
29892,
3876,
29918,
3972,
29918,
667,
1125,
13,
4706,
565,
1583,
29889,
1445,
322,
451,
1583,
29889,
1445,
29889,
15603,
29901,
13,
9651,
1583,
29889,
1445,
29889,
3539,
29898,
29888,
29915,
10913,
2105,
601,
29901,
525,
13,
462,
9651,
285,
29915,
29912,
4632,
29918,
3972,
29918,
667,
3366,
19033,
29918,
2674,
2271,
3108,
1012,
29876,
1495,
13,
9651,
1583,
29889,
1445,
29889,
3539,
29898,
29888,
29915,
11536,
316,
6276,
5349,
29901,
525,
13,
462,
9651,
285,
29915,
29912,
4632,
29918,
3972,
29918,
667,
3366,
14506,
29918,
9012,
3108,
1012,
29876,
1495,
13,
9651,
1583,
29889,
1445,
29889,
3539,
29898,
29888,
29915,
11536,
316,
6262,
29901,
525,
13,
462,
9651,
285,
29915,
29912,
4632,
29918,
3972,
29918,
667,
3366,
14506,
29918,
13193,
3108,
1012,
29876,
1495,
13,
9651,
1583,
29889,
1445,
29889,
3539,
28909,
29876,
1495,
13,
9651,
1583,
29889,
3539,
29918,
17588,
29918,
6112,
4695,
29898,
4632,
29918,
3972,
29918,
667,
29897,
13,
9651,
1583,
29889,
1445,
29889,
3539,
28909,
29876,
1495,
13,
9651,
1583,
29889,
3539,
29918,
8336,
29918,
23905,
29898,
4632,
29918,
3972,
29918,
667,
29897,
13,
13,
1678,
822,
2436,
29918,
17588,
29918,
6112,
4695,
29898,
1311,
29892,
3876,
29918,
3972,
29918,
667,
1125,
13,
4706,
9995,
13,
4706,
16849,
267,
278,
1591,
411,
278,
1353,
310,
3454,
322,
6262,
363,
1269,
934,
13,
3986,
6081,
29889,
13,
4706,
9995,
13,
4706,
565,
1583,
29889,
1445,
322,
451,
1583,
29889,
1445,
29889,
15603,
29901,
13,
9651,
1583,
29889,
1445,
29889,
3539,
29898,
29888,
29915,
6377,
5647,
575,
6241,
1115,
29966,
29896,
29900,
29913,
891,
8853,
11667,
5349,
1115,
29985,
29896,
29945,
29913,
891,
525,
13,
462,
9651,
285,
29915,
6377,
11207,
1115,
29985,
29896,
29945,
1012,
29876,
1495,
13,
9651,
1583,
29889,
1445,
29889,
3539,
29898,
29888,
29915,
6377,
1115,
29922,
29966,
29896,
29896,
11079,
6377,
1115,
29922,
29985,
29896,
29955,
11079,
6377,
1115,
29922,
29985,
29896,
29953,
1012,
29876,
1495,
13,
9651,
565,
525,
2248,
29915,
297,
3876,
29918,
3972,
29918,
667,
29901,
13,
18884,
363,
1294,
29892,
5235,
297,
3876,
29918,
3972,
29918,
667,
1839,
2248,
13359,
7076,
7295,
13,
462,
1678,
565,
7431,
29898,
1062,
29897,
1275,
29871,
29900,
29901,
13,
462,
4706,
1294,
353,
12801,
449,
1883,
16299,
13,
462,
1678,
5253,
29918,
9012,
29892,
5253,
29918,
13193,
353,
29871,
29900,
29892,
29871,
29900,
13,
462,
1678,
639,
29883,
29918,
9012,
29892,
639,
29883,
29918,
13193,
353,
29871,
29900,
29892,
29871,
29900,
13,
462,
1678,
565,
525,
14506,
29918,
9012,
29915,
297,
5235,
29901,
13,
462,
4706,
5253,
29918,
9012,
353,
5235,
1839,
14506,
29918,
9012,
2033,
13,
462,
1678,
565,
525,
14506,
29918,
13193,
29915,
297,
5235,
29901,
13,
462,
4706,
5253,
29918,
13193,
353,
5235,
1839,
14506,
29918,
13193,
2033,
13,
462,
1678,
565,
525,
14506,
29918,
9012,
29915,
297,
3876,
29918,
3972,
29918,
667,
322,
320,
13,
462,
9651,
3876,
29918,
3972,
29918,
667,
1839,
14506,
29918,
9012,
2033,
2804,
29871,
29900,
29901,
13,
462,
4706,
639,
29883,
29918,
9012,
353,
938,
29898,
29896,
29900,
29900,
334,
5253,
29918,
9012,
13,
462,
462,
308,
847,
3876,
29918,
3972,
29918,
667,
1839,
14506,
29918,
9012,
11287,
13,
462,
1678,
565,
525,
14506,
29918,
13193,
29915,
297,
3876,
29918,
3972,
29918,
667,
322,
320,
13,
462,
9651,
3876,
29918,
3972,
29918,
667,
1839,
14506,
29918,
13193,
2033,
2804,
29871,
29900,
29901,
13,
462,
4706,
639,
29883,
29918,
13193,
353,
938,
29898,
29896,
29900,
29900,
334,
5253,
29918,
13193,
13,
462,
462,
308,
847,
3876,
29918,
3972,
29918,
667,
1839,
14506,
29918,
13193,
11287,
13,
462,
1678,
1583,
29889,
1445,
29889,
3539,
29898,
29888,
29915,
29912,
1062,
29901,
29966,
29896,
29900,
29913,
891,
426,
14506,
29918,
9012,
29901,
29958,
29955,
29913,
525,
13,
462,
462,
1678,
285,
29915,
3319,
546,
29883,
29918,
9012,
29901,
29958,
29941,
29913,
28233,
891,
525,
13,
462,
462,
1678,
285,
29915,
29912,
14506,
29918,
13193,
29901,
29958,
29953,
29913,
525,
13,
462,
462,
1678,
285,
29915,
3319,
546,
29883,
29918,
13193,
29901,
29958,
29941,
29913,
1273,
2144,
29876,
1495,
13,
13,
1678,
822,
2436,
29918,
8336,
29918,
23905,
29898,
1311,
29892,
3876,
29918,
3972,
29918,
667,
1125,
13,
4706,
9995,
13,
4706,
16849,
267,
278,
9810,
934,
3829,
29889,
13,
4706,
9995,
13,
4706,
822,
903,
8336,
29918,
23905,
29898,
1445,
29918,
667,
29892,
10809,
1125,
13,
9651,
9995,
13,
9651,
3599,
25397,
740,
304,
1653,
278,
934,
3829,
29889,
13,
9651,
9995,
13,
9651,
3829,
353,
6629,
13,
9651,
363,
474,
297,
3464,
29898,
19488,
448,
29871,
29896,
1125,
13,
18884,
3829,
4619,
525,
29989,
259,
525,
13,
9651,
3829,
4619,
525,
29989,
489,
525,
13,
9651,
565,
525,
978,
29915,
297,
934,
29918,
667,
29901,
13,
18884,
565,
338,
8758,
29898,
1445,
29918,
667,
29892,
4452,
29889,
9882,
2001,
1125,
13,
462,
1678,
3829,
4619,
285,
29915,
19660,
1445,
29918,
667,
3366,
978,
3108,
6525,
29905,
29876,
29915,
13,
462,
1678,
565,
525,
11991,
29915,
297,
934,
29918,
667,
320,
13,
462,
9651,
322,
1134,
29898,
1445,
29918,
667,
1839,
11991,
11287,
338,
1051,
29901,
13,
462,
4706,
363,
2278,
297,
934,
29918,
667,
1839,
11991,
2033,
29901,
13,
462,
9651,
3829,
4619,
320,
13,
462,
18884,
903,
8336,
29918,
23905,
29898,
5145,
29892,
10809,
718,
29871,
29896,
29897,
13,
18884,
25342,
338,
8758,
29898,
1445,
29918,
667,
29892,
4452,
29889,
1626,
2283,
2001,
1125,
13,
462,
1678,
3829,
4619,
285,
29915,
29912,
1445,
29918,
667,
3366,
978,
3108,
10162,
13,
462,
1678,
565,
525,
14506,
29918,
9012,
29915,
297,
934,
29918,
667,
29901,
13,
462,
4706,
3829,
4619,
285,
29915,
21313,
1445,
29918,
667,
3366,
14506,
29918,
9012,
3108,
29913,
6276,
5349,
16029,
13,
462,
1678,
3829,
4619,
11297,
29876,
29915,
13,
9651,
736,
3829,
13,
13,
4706,
565,
1583,
29889,
1445,
322,
451,
1583,
29889,
1445,
29889,
15603,
29901,
13,
9651,
3829,
353,
6629,
13,
9651,
565,
525,
19033,
29918,
978,
29915,
297,
3876,
29918,
3972,
29918,
667,
29901,
13,
18884,
3829,
4619,
285,
29915,
19660,
4632,
29918,
3972,
29918,
667,
3366,
19033,
29918,
978,
3108,
6525,
29905,
29876,
29915,
13,
9651,
565,
525,
11991,
29915,
297,
3876,
29918,
3972,
29918,
667,
322,
1134,
29898,
4632,
29918,
3972,
29918,
667,
1839,
11991,
2033,
2144,
13,
462,
1678,
338,
1051,
29901,
13,
18884,
363,
2278,
297,
3876,
29918,
3972,
29918,
667,
1839,
11991,
2033,
29901,
13,
462,
1678,
3829,
4619,
903,
8336,
29918,
23905,
29898,
5145,
29892,
29871,
29896,
29897,
13,
9651,
1583,
29889,
1445,
29889,
3539,
29898,
23905,
29897,
13,
2
] |
获取新冠肺炎实时数据/paqufeiyang.py | 13060923171/xianmu | 29 | 1616487 | <filename>获取新冠肺炎实时数据/paqufeiyang.py<gh_stars>10-100
import requests
from lxml import etree
import json
import time
import threading
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.62 Safari/537.36"
}
News_set = set()
#单线程版,获取网易新闻里面新冠肺炎的实时数据
def getData():
url = "https://wp.m.163.com/163/page/news/virus_report/index.html?_nw_=1&_anw_=1"
html = requests.get(url,headers=headers)
soup = etree.HTML(html.text)
#先是获取相应数据,这里是时间和数据
current_time =soup.xpath('//div[@class = "cover_time"]/text()')[0]
cover_data = soup.xpath('//div[@class = "cover_data_china"]/div[starts-with(@class,"cover")]')
#开始一个无限循环
while 1:
#进行不断爬取,从而达到我们的目的,实时获取数据
for cover in cover_data:
title = cover.xpath('h4/text()')[0]
number = cover.xpath('div[@class = "number"]/text()')[0]
result = current_time+" "+title+" "+ number
if result not in News_set:
News_set.add(result)
print(result,end=" ")
#间隔时间为60秒
time.sleep(60)
#多线程版,百度版新冠肺炎实时数据
def getNews():
url = "https://opendata.baidu.com/data/inner?tn=reserved_all_res_tn&dspName=iphone&from_sf=1&dsp=iphone&resource_id=28565&alr=1&query=%E8%82%BA%E7%82%8E&cb=jsonp_1588237477067_8878"
html = requests.get(url,headers=headers)
html_text = html.text
#用获取json开始的位置
start = html_text.find('{"ResultCode"')
#获取json末尾的位置
end = html_text.find(r'recall_srcids\u0000\u0000"}')+len(r'recall_srcids\u0000\u0000"}')
#把json给拼接起来,并且把json转化为python的形式
json_data = json.loads(html_text[start:end])
#最新的数据,用json来定位
data_new = json_data['Result'][0]["DisplayData"]["result"]['items']
#写一个循环函数来达到我们的目的
while 1:
for data in data_new:
new_title = data["eventDescription"]
new_time = data["eventTime"]
new_url = data['eventUrl']
local_time = time.localtime(int(new_time))
current_time = time.strftime("%Y-%m-%d %H-%M-%S",local_time)
result = new_title+current_time+" "+new_url
if result not in News_set:
News_set.add(result)
print(result)
time.sleep(60)
def xingXi():
print("新冠肺炎情况:")
#单线程开启网易新闻的新冠肺炎的实时情况
print("实时新闻:")
getNews()
#多线程开启百度新冠肺炎的实时情况
print("百度提供实时新闻")
threading.Thread(target=getNews().start())
if __name__ == '__main__':
xingXi()
| [
1,
529,
9507,
29958,
31024,
30683,
30374,
232,
137,
163,
235,
133,
189,
234,
133,
145,
31195,
30594,
30354,
30763,
29914,
3274,
339,
1725,
19881,
574,
29889,
2272,
29966,
12443,
29918,
303,
1503,
29958,
29896,
29900,
29899,
29896,
29900,
29900,
13,
5215,
7274,
13,
3166,
301,
3134,
1053,
634,
929,
13,
5215,
4390,
13,
5215,
931,
13,
5215,
3244,
292,
13,
13662,
353,
426,
13,
1678,
376,
1792,
29899,
14748,
1115,
376,
29924,
2112,
2911,
29914,
29945,
29889,
29900,
313,
7685,
405,
29911,
29871,
29896,
29900,
29889,
29900,
29936,
8892,
29953,
29946,
29936,
921,
29953,
29946,
29897,
12113,
3609,
13117,
29914,
29945,
29941,
29955,
29889,
29941,
29953,
313,
29968,
7020,
29892,
763,
1879,
27604,
29897,
10228,
29914,
29947,
29896,
29889,
29900,
29889,
29946,
29900,
29946,
29946,
29889,
29953,
29906,
24544,
29914,
29945,
29941,
29955,
29889,
29941,
29953,
29908,
13,
29913,
13,
29328,
29918,
842,
353,
731,
580,
13,
29937,
31166,
31532,
31101,
30845,
30214,
31024,
30683,
31222,
233,
155,
150,
30374,
236,
154,
190,
30755,
30806,
30374,
232,
137,
163,
235,
133,
189,
234,
133,
145,
30210,
31195,
30594,
30354,
30763,
13,
1753,
679,
1469,
7295,
13,
1678,
3142,
353,
376,
991,
597,
11912,
29889,
29885,
29889,
29896,
29953,
29941,
29889,
510,
29914,
29896,
29953,
29941,
29914,
3488,
29914,
15753,
29914,
2405,
375,
29918,
12276,
29914,
2248,
29889,
1420,
29973,
29918,
29876,
29893,
29918,
29922,
29896,
29987,
29918,
273,
29893,
29918,
29922,
29896,
29908,
13,
1678,
3472,
353,
7274,
29889,
657,
29898,
2271,
29892,
13662,
29922,
13662,
29897,
13,
1678,
22300,
353,
634,
929,
29889,
7020,
29898,
1420,
29889,
726,
29897,
13,
1678,
396,
31244,
30392,
31024,
30683,
30990,
31370,
30354,
30763,
30214,
30810,
30755,
30392,
30594,
31016,
30503,
30354,
30763,
13,
1678,
1857,
29918,
2230,
353,
29879,
1132,
29889,
23635,
877,
458,
4563,
17548,
1990,
353,
376,
11911,
29918,
2230,
3108,
29914,
726,
580,
29861,
29900,
29962,
13,
1678,
4612,
29918,
1272,
353,
22300,
29889,
23635,
877,
458,
4563,
17548,
1990,
353,
376,
11911,
29918,
1272,
29918,
305,
1099,
3108,
29914,
4563,
29961,
27382,
29899,
2541,
10394,
1990,
1699,
11911,
13531,
1495,
13,
1678,
396,
31026,
31020,
30287,
30502,
31352,
31175,
232,
193,
173,
234,
145,
178,
13,
1678,
1550,
29871,
29896,
29901,
13,
4706,
396,
31174,
30448,
30413,
31683,
234,
139,
175,
30683,
30214,
31594,
31325,
31798,
30780,
30672,
31381,
30210,
30895,
30210,
30214,
31195,
30594,
31024,
30683,
30354,
30763,
13,
4706,
363,
4612,
297,
4612,
29918,
1272,
29901,
13,
9651,
3611,
353,
4612,
29889,
23635,
877,
29882,
29946,
29914,
726,
580,
29861,
29900,
29962,
13,
9651,
1353,
353,
4612,
29889,
23635,
877,
4563,
17548,
1990,
353,
376,
4537,
3108,
29914,
726,
580,
29861,
29900,
29962,
13,
9651,
1121,
353,
1857,
29918,
2230,
13578,
15691,
3257,
13578,
15691,
1353,
13,
9651,
565,
1121,
451,
297,
10130,
29918,
842,
29901,
13,
18884,
10130,
29918,
842,
29889,
1202,
29898,
2914,
29897,
13,
18884,
1596,
29898,
2914,
29892,
355,
543,
16521,
13,
18884,
396,
31016,
236,
157,
151,
30594,
31016,
30573,
29953,
29900,
234,
170,
149,
13,
4706,
931,
29889,
17059,
29898,
29953,
29900,
29897,
13,
29937,
30923,
31532,
31101,
30845,
30214,
31047,
30898,
30845,
30374,
232,
137,
163,
235,
133,
189,
234,
133,
145,
31195,
30594,
30354,
30763,
13,
1753,
679,
29328,
7295,
13,
1678,
3142,
353,
376,
991,
597,
459,
355,
532,
29889,
2291,
333,
29884,
29889,
510,
29914,
1272,
29914,
3993,
29973,
6277,
29922,
690,
9841,
29918,
497,
29918,
690,
29918,
6277,
29987,
29881,
1028,
1170,
29922,
29875,
6710,
29987,
3166,
29918,
4668,
29922,
29896,
29987,
29881,
1028,
29922,
29875,
6710,
29987,
10314,
29918,
333,
29922,
29906,
29947,
29945,
29953,
29945,
29987,
284,
29878,
29922,
29896,
29987,
1972,
16328,
29923,
29947,
29995,
29947,
29906,
29995,
5688,
29995,
29923,
29955,
29995,
29947,
29906,
29995,
29947,
29923,
29987,
10702,
29922,
3126,
29886,
29918,
29896,
29945,
29947,
29947,
29906,
29941,
29955,
29946,
29955,
29955,
29900,
29953,
29955,
29918,
29947,
29947,
29955,
29947,
29908,
13,
1678,
3472,
353,
7274,
29889,
657,
29898,
2271,
29892,
13662,
29922,
13662,
29897,
13,
1678,
3472,
29918,
726,
353,
3472,
29889,
726,
13,
1678,
396,
30406,
31024,
30683,
3126,
31026,
31020,
30210,
30956,
30669,
13,
1678,
1369,
353,
3472,
29918,
726,
29889,
2886,
877,
6377,
3591,
3399,
29908,
1495,
13,
1678,
396,
31024,
30683,
3126,
233,
159,
174,
31631,
30210,
30956,
30669,
13,
1678,
1095,
353,
3472,
29918,
726,
29889,
2886,
29898,
29878,
29915,
3757,
497,
29918,
4351,
4841,
29905,
29884,
29900,
29900,
29900,
29900,
29905,
29884,
29900,
29900,
29900,
29900,
9092,
1495,
29974,
2435,
29898,
29878,
29915,
3757,
497,
29918,
4351,
4841,
29905,
29884,
29900,
29900,
29900,
29900,
29905,
29884,
29900,
29900,
29900,
29900,
9092,
1495,
13,
1678,
396,
233,
141,
141,
3126,
31999,
233,
142,
191,
31092,
31558,
30805,
30214,
31666,
231,
187,
151,
233,
141,
141,
3126,
31415,
30705,
30573,
4691,
30210,
31305,
30607,
13,
1678,
4390,
29918,
1272,
353,
4390,
29889,
18132,
29898,
1420,
29918,
726,
29961,
2962,
29901,
355,
2314,
13,
1678,
396,
30878,
30374,
30210,
30354,
30763,
30214,
30406,
3126,
30805,
30495,
30956,
13,
1678,
848,
29918,
1482,
353,
4390,
29918,
1272,
1839,
3591,
2033,
29961,
29900,
29962,
3366,
9323,
1469,
3108,
3366,
2914,
3108,
1839,
7076,
2033,
13,
1678,
396,
31479,
30287,
30502,
232,
193,
173,
234,
145,
178,
31629,
30354,
30805,
31798,
30780,
30672,
31381,
30210,
30895,
30210,
13,
1678,
1550,
29871,
29896,
29901,
13,
4706,
363,
848,
297,
848,
29918,
1482,
29901,
13,
9651,
716,
29918,
3257,
353,
848,
3366,
3696,
9868,
3108,
13,
9651,
716,
29918,
2230,
353,
848,
3366,
3696,
2481,
3108,
13,
9651,
716,
29918,
2271,
353,
848,
1839,
3696,
5983,
2033,
13,
9651,
1887,
29918,
2230,
353,
931,
29889,
2997,
2230,
29898,
524,
29898,
1482,
29918,
2230,
876,
13,
9651,
1857,
29918,
2230,
353,
931,
29889,
710,
615,
603,
11702,
29979,
19222,
29885,
19222,
29881,
1273,
29950,
19222,
29924,
19222,
29903,
613,
2997,
29918,
2230,
29897,
13,
9651,
1121,
353,
716,
29918,
3257,
29974,
3784,
29918,
2230,
13578,
15691,
1482,
29918,
2271,
13,
9651,
565,
1121,
451,
297,
10130,
29918,
842,
29901,
13,
18884,
10130,
29918,
842,
29889,
1202,
29898,
2914,
29897,
13,
18884,
1596,
29898,
2914,
29897,
13,
4706,
931,
29889,
17059,
29898,
29953,
29900,
29897,
13,
1753,
921,
292,
29990,
29875,
7295,
13,
1678,
1596,
703,
30374,
232,
137,
163,
235,
133,
189,
234,
133,
145,
30993,
232,
137,
184,
30383,
1159,
13,
1678,
396,
31166,
31532,
31101,
31026,
232,
147,
178,
31222,
233,
155,
150,
30374,
236,
154,
190,
30210,
30374,
232,
137,
163,
235,
133,
189,
234,
133,
145,
30210,
31195,
30594,
30993,
232,
137,
184,
13,
1678,
1596,
703,
31195,
30594,
30374,
236,
154,
190,
29901,
1159,
13,
1678,
679,
29328,
580,
13,
1678,
396,
30923,
31532,
31101,
31026,
232,
147,
178,
31047,
30898,
30374,
232,
137,
163,
235,
133,
189,
234,
133,
145,
30210,
31195,
30594,
30993,
232,
137,
184,
13,
1678,
1596,
703,
31047,
30898,
31302,
231,
193,
158,
31195,
30594,
30374,
236,
154,
190,
1159,
13,
1678,
3244,
292,
29889,
4899,
29898,
5182,
29922,
657,
29328,
2141,
2962,
3101,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
921,
292,
29990,
29875,
580,
13,
2
] |
salt/matchers/nodegroup_match.py | casselt/salt | 0 | 1603574 | # -*- coding: utf-8 -*-
'''
This is the default nodegroup matcher.
'''
from __future__ import absolute_import, print_function, unicode_literals
import salt.utils.minions # pylint: disable=3rd-party-module-not-gated
import salt.loader
def match(tgt, nodegroups):
'''
This is a compatibility matcher and is NOT called when using
nodegroups for remote execution, but is called when the nodegroups
matcher is used in states
'''
if tgt in nodegroups:
matchers = salt.loader.matchers(__opts__)
return matchers['compound_match.match'](
salt.utils.minions.nodegroup_comp(tgt, nodegroups)
)
return False
| [
1,
396,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
12008,
13,
4013,
338,
278,
2322,
2943,
2972,
1993,
261,
29889,
13,
12008,
13,
3166,
4770,
29888,
9130,
1649,
1053,
8380,
29918,
5215,
29892,
1596,
29918,
2220,
29892,
29104,
29918,
20889,
1338,
13,
13,
5215,
15795,
29889,
13239,
29889,
1195,
1080,
259,
396,
282,
2904,
524,
29901,
11262,
29922,
29941,
5499,
29899,
22633,
29899,
5453,
29899,
1333,
29899,
29887,
630,
13,
5215,
15795,
29889,
12657,
13,
13,
13,
1753,
1993,
29898,
29873,
4141,
29892,
2943,
13155,
1125,
13,
1678,
14550,
13,
1678,
910,
338,
263,
24521,
1993,
261,
322,
338,
6058,
2000,
746,
773,
13,
1678,
2943,
13155,
363,
7592,
8225,
29892,
541,
338,
2000,
746,
278,
2943,
13155,
13,
1678,
1993,
261,
338,
1304,
297,
5922,
13,
1678,
14550,
13,
1678,
565,
260,
4141,
297,
2943,
13155,
29901,
13,
4706,
1993,
414,
353,
15795,
29889,
12657,
29889,
4352,
414,
22168,
25707,
1649,
29897,
13,
4706,
736,
1993,
414,
1839,
2388,
618,
29918,
4352,
29889,
4352,
29915,
850,
13,
9651,
15795,
29889,
13239,
29889,
1195,
1080,
29889,
3177,
2972,
29918,
2388,
29898,
29873,
4141,
29892,
2943,
13155,
29897,
13,
4706,
1723,
13,
1678,
736,
7700,
13,
2
] |
tests/integration/test_github.py | Hojang2/ogr | 0 | 133628 | <gh_stars>0
import os
import unittest
import pytest
from github import GithubException
from ogr import GithubService
from ogr.abstract import PRStatus, IssueStatus
from ogr.persistent_storage import PersistentObjectStorage
from ogr.exceptions import GithubAPIException
DATA_DIR = "test_data"
PERSISTENT_DATA_PREFIX = os.path.join(
os.path.dirname(os.path.realpath(__file__)), DATA_DIR
)
class GithubTests(unittest.TestCase):
def setUp(self):
self.token = os.environ.get("GITHUB_TOKEN")
self.user = os.environ.get("GITHUB_USER")
test_name = self.id() or "all"
persistent_data_file = os.path.join(
PERSISTENT_DATA_PREFIX, f"test_github_data_{test_name}.yaml"
)
PersistentObjectStorage().storage_file = persistent_data_file
if PersistentObjectStorage().is_write_mode and (
not self.user or not self.token
):
raise EnvironmentError("please set GITHUB_TOKEN GITHUB_USER env variables")
self.service = GithubService(token=self.token)
self.ogr_project = self.service.get_project(
namespace="packit-service", repo="ogr"
)
self.ogr_fork = self.service.get_project(
namespace="packit-service", repo="ogr", is_fork=True
)
self.hello_world_project = self.service.get_project(
namespace="packit-service", repo="hello-world"
)
self.not_forked_project = self.service.get_project(
namespace="fedora-modularity", repo="fed-to-brew"
)
def tearDown(self):
PersistentObjectStorage().dump()
class Comments(GithubTests):
def test_pr_comments(self):
pr_comments = self.ogr_project.get_pr_comments(9)
assert pr_comments
assert len(pr_comments) == 2
assert pr_comments[0].comment.endswith("fixed")
assert pr_comments[1].comment.startswith("LGTM")
def test_pr_comments_reversed(self):
pr_comments = self.ogr_project.get_pr_comments(9, reverse=True)
assert pr_comments
assert len(pr_comments) == 2
assert pr_comments[0].comment.startswith("LGTM")
def test_pr_comments_filter(self):
pr_comments = self.ogr_project.get_pr_comments(9, filter_regex="fixed")
assert pr_comments
assert len(pr_comments) == 1
assert pr_comments[0].comment.startswith("@TomasTomecek")
pr_comments = self.ogr_project.get_pr_comments(
9, filter_regex="LGTM, nicely ([a-z]*)"
)
assert pr_comments
assert len(pr_comments) == 1
assert pr_comments[0].comment.endswith("done!")
def test_pr_comments_search(self):
comment_match = self.ogr_project.search_in_pr(9, filter_regex="LGTM")
assert comment_match
assert comment_match[0] == "LGTM"
comment_match = self.ogr_project.search_in_pr(
9, filter_regex="LGTM, nicely ([a-z]*)"
)
assert comment_match
assert comment_match[0] == "LGTM, nicely done"
class GenericCommands(GithubTests):
def test_description(self):
description = self.ogr_project.get_description()
assert description.startswith("One Git library to Rule")
def test_branches(self):
branches = self.ogr_project.get_branches()
assert branches
assert set(branches) == {"master"}
def test_git_urls(self):
urls = self.ogr_project.get_git_urls()
assert urls
assert len(urls) == 2
assert "git" in urls
assert "ssh" in urls
assert urls["git"] == "https://github.com/packit-service/ogr.git"
assert urls["ssh"].endswith("[email protected]:packit-service/ogr.git")
def test_username(self):
# changed to check just lenght, because it is based who regenerated data files
assert len(self.service.user.get_username()) > 3
def test_email(self):
test_str = self.service.user.get_email()
assert test_str
assert len(test_str) > 0
assert "@" in test_str
assert "." in test_str
def test_get_file(self):
file_content = self.ogr_project.get_file_content(".git_archival.txt")
assert file_content
assert isinstance(file_content, str)
assert "ref-names:" in file_content
def test_nonexisting_file(self):
with self.assertRaises(FileNotFoundError):
self.ogr_project.get_file_content(".blablabla_nonexisting_file")
def test_parent_project(self):
assert self.ogr_fork.parent.namespace == "packit-service"
assert self.ogr_fork.parent.repo == "ogr"
@unittest.skip("get_commit_flags not implemented")
def test_commit_flags(self):
flags = self.ogr_project.get_commit_flags(
commit="29ca3caefc781b4b41245df3e01086ffa4b4639e"
)
assert isinstance(flags, list)
assert len(flags) == 0
def test_get_sha_from_tag(self):
assert (
self.ogr_project.get_sha_from_tag("0.0.1")
== "29ca3caefc781b4b41245df3e01086ffa4b4639e"
)
with pytest.raises(GithubAPIException) as ex:
self.ogr_project.get_sha_from_tag("future")
assert "not found" in str(ex.value)
def test_get_tag_from_tag_name(self):
tag = self.ogr_project.get_tag_from_tag_name("0.0.1")
assert tag.name == "0.0.1"
assert tag.commit_sha == "29ca3caefc781b4b41245df3e01086ffa4b4639e"
def test_get_tag_from_nonexisting_tag_name(self):
assert not self.ogr_project.get_tag_from_tag_name("future")
def test_get_owners(self):
owners = self.ogr_project.get_owners()
assert ["packit-service"] == owners
def test_issue_permissions(self):
users = self.ogr_project.who_can_close_issue()
assert "lachmanfrantisek" in users
issue = self.ogr_project.get_issue_info(1)
assert self.ogr_project.can_close_issue("lachmanfrantisek", issue)
assert not self.ogr_project.can_close_issue("marusinm", issue)
def test_pr_permissions(self):
users = self.ogr_project.who_can_merge_pr()
assert "lachmanfrantisek" in users
assert self.ogr_project.can_merge_pr("lachmanfrantisek")
assert not self.ogr_project.can_merge_pr("marusinm")
class Issues(GithubTests):
def test_issue_list(self):
issue_list = self.ogr_fork.get_issue_list()
assert isinstance(issue_list, list)
assert not issue_list
issue_list_all = self.ogr_project.get_issue_list(status=IssueStatus.all)
assert issue_list_all
assert len(issue_list_all) >= 45
issue_list_closed = self.ogr_project.get_issue_list(status=IssueStatus.closed)
assert issue_list_closed
assert len(issue_list_closed) >= 35
issue_list = self.ogr_project.get_issue_list()
assert issue_list
assert len(issue_list) >= 3
def test_issue_info(self):
issue_info = self.ogr_project.get_issue_info(issue_id=4)
assert issue_info
assert issue_info.title.startswith("Better name")
assert issue_info.status == IssueStatus.closed
def test_issue_labels(self):
labels = self.ogr_project.get_issue_labels(issue_id=4)
assert not labels
self.ogr_project.add_issue_labels(issue_id=4, labels=["test_lb1", "test_lb2"])
labels = self.ogr_project.get_issue_labels(issue_id=4)
assert len(labels) == 2
assert labels[0].name == "test_lb1"
assert labels[1].name == "test_lb2"
class PullRequests(GithubTests):
def test_pr_list(self):
pr_list = self.ogr_fork.get_pr_list()
assert isinstance(pr_list, list)
pr_list_all = self.ogr_project.get_pr_list(status=PRStatus.all)
assert pr_list_all
assert len(pr_list_all) >= 75
pr_list_closed = self.ogr_project.get_pr_list(status=PRStatus.closed)
assert pr_list_closed
assert len(pr_list_closed) >= 70
closed_pr_numbers = []
for closed_pr in pr_list_closed:
closed_pr_numbers.append(closed_pr.id)
assert 93 in closed_pr_numbers
pr_list_merged = self.ogr_project.get_pr_list(status=PRStatus.merged)
assert pr_list_merged
assert len(pr_list_merged) >= 1
closed_pr_numbers = []
for closed_pr in pr_list_merged:
closed_pr_numbers.append(closed_pr.id)
assert 93 not in closed_pr_numbers
pr_list = self.ogr_project.get_pr_list()
assert pr_list
assert len(pr_list) >= 1
def test_pr_info(self):
pr_info = self.ogr_project.get_pr_info(pr_id=1)
assert pr_info
assert pr_info.title == "WIP: API"
assert pr_info.status == PRStatus.merged
def test_all_pr_commits(self):
commits = self.ogr_project.get_all_pr_commits(pr_id=1)
assert len(commits) == 3
assert commits[0] == "431f4a7c5cce24c3035b17c5131a3918ab989bd0"
assert commits[2] == "5d6cc05d30ef0a0d69bb42bdcaad187408a070b0"
def test_update_pr_info(self):
pr_info = self.ogr_project.get_pr_info(pr_id=1)
orig_title = pr_info.title
orig_description = pr_info.description
self.ogr_project.update_pr_info(
pr_id=1, title="changed", description="changed description"
)
pr_info = self.ogr_project.get_pr_info(pr_id=1)
assert pr_info.title == "changed"
assert pr_info.description == "changed description"
self.ogr_project.update_pr_info(
pr_id=1, title=orig_title, description=orig_description
)
pr_info = self.ogr_project.get_pr_info(pr_id=1)
assert pr_info.title == orig_title
assert pr_info.description == orig_description
def test_pr_labels(self):
labels = self.ogr_project.get_pr_labels(pr_id=1)
assert not labels
self.ogr_project.add_pr_labels(pr_id=1, labels=["test_lb1", "test_lb2"])
labels = self.ogr_project.get_pr_labels(pr_id=1)
assert len(labels) == 2
assert labels[0].name == "test_lb1"
assert labels[1].name == "test_lb2"
class Releases(GithubTests):
def test_get_release(self):
release = self.hello_world_project.get_release(tag_name="0.4.1")
assert release.title == "test"
assert release.body == "testing release"
def test_get_releases(self):
releases = self.ogr_project.get_releases()
assert releases
assert len(releases) >= 9
def test_create_release(self):
count_before = len(self.hello_world_project.get_releases())
release = self.hello_world_project.create_release(
tag="0.5.0", name="test", message="testing release"
)
count_after = len(self.hello_world_project.get_releases())
assert release.tag_name == "0.5.0"
assert release.title == "test"
assert release.body == "testing release"
assert count_before + 1 == count_after
def test_edit_release(self):
release = self.hello_world_project.get_release(tag_name="0.1.0")
origin_name = release.title
origin_message = release.body
release.edit_release(
name=f"{origin_name}-changed", message=f"{origin_message}-changed"
)
assert release.title == f"{origin_name}-changed"
assert release.body == f"{origin_message}-changed"
def test_latest_release(self):
release = self.ogr_project.get_latest_release()
assert release.tag_name == "0.5.0"
assert release.title == "0.5.0"
assert "New Features" in release.body
class Forks(GithubTests):
def test_fork(self):
assert self.ogr_fork.is_fork is True
fork_description = self.ogr_fork.get_description()
assert fork_description
@unittest.skip(
"not working with yaml file because it check exception within setup"
)
def test_nonexisting_fork(self):
self.ogr_nonexisting_fork = self.service.get_project(
repo="omfeprkfmwpefmwpefkmwpeofjwepof", is_fork=True
)
with self.assertRaises(GithubException) as ex:
self.ogr_nonexisting_fork.get_description()
s = str(ex.value.args)
assert "Not Found" in s
assert "404" in s
def test_get_fork(self):
fork = self.ogr_project.get_fork()
assert fork
assert fork.get_description()
def test_is_fork(self):
assert not self.ogr_project.is_fork
is_forked = self.ogr_project.is_forked()
assert isinstance(is_forked, bool)
# `is True` is here on purpose: we want to be sure that .is_forked() returns True object
# because Tomas had his crazy ideas and wanted to return GitProject directly,
# stop that madman
assert is_forked is True
fork = self.ogr_project.get_fork(create=False)
assert fork
assert fork.is_fork
def test_create_fork(self):
not_existing_fork = self.not_forked_project.get_fork(create=False)
assert not not_existing_fork
assert not self.not_forked_project.is_forked()
old_forks = self.not_forked_project.service.user.get_forks()
self.not_forked_project.fork_create()
assert self.not_forked_project.get_fork().get_description()
assert self.not_forked_project.is_forked()
new_forks = self.not_forked_project.service.user.get_forks()
assert len(old_forks) == len(new_forks) - 1
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
5215,
2897,
13,
5215,
443,
27958,
13,
5215,
11451,
1688,
13,
13,
3166,
18546,
1053,
402,
2985,
2451,
13,
13,
3166,
288,
629,
1053,
402,
2985,
3170,
13,
3166,
288,
629,
29889,
16595,
1053,
12089,
5709,
29892,
26246,
5709,
13,
3166,
288,
629,
29889,
6774,
9696,
29918,
12925,
1053,
9034,
9696,
2061,
10486,
13,
3166,
288,
629,
29889,
11739,
29879,
1053,
402,
2985,
8787,
2451,
13,
13,
14573,
29918,
9464,
353,
376,
1688,
29918,
1272,
29908,
13,
13171,
5425,
1254,
3919,
29918,
14573,
29918,
15094,
25634,
353,
2897,
29889,
2084,
29889,
7122,
29898,
13,
1678,
2897,
29889,
2084,
29889,
25721,
29898,
359,
29889,
2084,
29889,
6370,
2084,
22168,
1445,
1649,
8243,
360,
8254,
29918,
9464,
13,
29897,
13,
13,
13,
1990,
402,
2985,
24376,
29898,
348,
27958,
29889,
3057,
8259,
1125,
13,
1678,
822,
731,
3373,
29898,
1311,
1125,
13,
4706,
1583,
29889,
6979,
353,
2897,
29889,
21813,
29889,
657,
703,
29954,
13054,
7466,
29918,
4986,
29968,
1430,
1159,
13,
4706,
1583,
29889,
1792,
353,
2897,
29889,
21813,
29889,
657,
703,
29954,
13054,
7466,
29918,
11889,
1159,
13,
4706,
1243,
29918,
978,
353,
1583,
29889,
333,
580,
470,
376,
497,
29908,
13,
13,
4706,
28152,
29918,
1272,
29918,
1445,
353,
2897,
29889,
2084,
29889,
7122,
29898,
13,
9651,
349,
1001,
5425,
1254,
3919,
29918,
14573,
29918,
15094,
25634,
29892,
285,
29908,
1688,
29918,
3292,
29918,
1272,
648,
1688,
29918,
978,
1836,
25162,
29908,
13,
4706,
1723,
13,
4706,
9034,
9696,
2061,
10486,
2141,
12925,
29918,
1445,
353,
28152,
29918,
1272,
29918,
1445,
13,
13,
4706,
565,
9034,
9696,
2061,
10486,
2141,
275,
29918,
3539,
29918,
8513,
322,
313,
13,
9651,
451,
1583,
29889,
1792,
470,
451,
1583,
29889,
6979,
13,
308,
1125,
13,
9651,
12020,
16738,
2392,
703,
552,
559,
731,
402,
13054,
7466,
29918,
4986,
29968,
1430,
402,
13054,
7466,
29918,
11889,
8829,
3651,
1159,
13,
13,
4706,
1583,
29889,
5509,
353,
402,
2985,
3170,
29898,
6979,
29922,
1311,
29889,
6979,
29897,
13,
13,
4706,
1583,
29889,
468,
29878,
29918,
4836,
353,
1583,
29889,
5509,
29889,
657,
29918,
4836,
29898,
13,
9651,
7397,
543,
4058,
277,
29899,
5509,
613,
13761,
543,
468,
29878,
29908,
13,
4706,
1723,
13,
13,
4706,
1583,
29889,
468,
29878,
29918,
29888,
548,
353,
1583,
29889,
5509,
29889,
657,
29918,
4836,
29898,
13,
9651,
7397,
543,
4058,
277,
29899,
5509,
613,
13761,
543,
468,
29878,
613,
338,
29918,
29888,
548,
29922,
5574,
13,
4706,
1723,
13,
13,
4706,
1583,
29889,
12199,
29918,
11526,
29918,
4836,
353,
1583,
29889,
5509,
29889,
657,
29918,
4836,
29898,
13,
9651,
7397,
543,
4058,
277,
29899,
5509,
613,
13761,
543,
12199,
29899,
11526,
29908,
13,
4706,
1723,
13,
13,
4706,
1583,
29889,
1333,
29918,
29888,
548,
287,
29918,
4836,
353,
1583,
29889,
5509,
29889,
657,
29918,
4836,
29898,
13,
9651,
7397,
543,
29888,
287,
2207,
29899,
1545,
1070,
537,
613,
13761,
543,
29888,
287,
29899,
517,
29899,
1030,
29893,
29908,
13,
4706,
1723,
13,
13,
1678,
822,
734,
279,
6767,
29898,
1311,
1125,
13,
4706,
9034,
9696,
2061,
10486,
2141,
15070,
580,
13,
13,
13,
1990,
461,
29879,
29898,
29954,
2985,
24376,
1125,
13,
1678,
822,
1243,
29918,
558,
29918,
21032,
29898,
1311,
1125,
13,
4706,
544,
29918,
21032,
353,
1583,
29889,
468,
29878,
29918,
4836,
29889,
657,
29918,
558,
29918,
21032,
29898,
29929,
29897,
13,
4706,
4974,
544,
29918,
21032,
13,
4706,
4974,
7431,
29898,
558,
29918,
21032,
29897,
1275,
29871,
29906,
13,
13,
4706,
4974,
544,
29918,
21032,
29961,
29900,
1822,
9342,
29889,
1975,
2541,
703,
20227,
1159,
13,
4706,
4974,
544,
29918,
21032,
29961,
29896,
1822,
9342,
29889,
27382,
2541,
703,
29931,
29954,
23081,
1159,
13,
13,
1678,
822,
1243,
29918,
558,
29918,
21032,
29918,
276,
874,
287,
29898,
1311,
1125,
13,
4706,
544,
29918,
21032,
353,
1583,
29889,
468,
29878,
29918,
4836,
29889,
657,
29918,
558,
29918,
21032,
29898,
29929,
29892,
11837,
29922,
5574,
29897,
13,
4706,
4974,
544,
29918,
21032,
13,
4706,
4974,
7431,
29898,
558,
29918,
21032,
29897,
1275,
29871,
29906,
13,
4706,
4974,
544,
29918,
21032,
29961,
29900,
1822,
9342,
29889,
27382,
2541,
703,
29931,
29954,
23081,
1159,
13,
13,
1678,
822,
1243,
29918,
558,
29918,
21032,
29918,
4572,
29898,
1311,
1125,
13,
4706,
544,
29918,
21032,
353,
1583,
29889,
468,
29878,
29918,
4836,
29889,
657,
29918,
558,
29918,
21032,
29898,
29929,
29892,
4175,
29918,
13087,
543,
20227,
1159,
13,
4706,
4974,
544,
29918,
21032,
13,
4706,
4974,
7431,
29898,
558,
29918,
21032,
29897,
1275,
29871,
29896,
13,
4706,
4974,
544,
29918,
21032,
29961,
29900,
1822,
9342,
29889,
27382,
2541,
29475,
29911,
18902,
29911,
608,
346,
29895,
1159,
13,
13,
4706,
544,
29918,
21032,
353,
1583,
29889,
468,
29878,
29918,
4836,
29889,
657,
29918,
558,
29918,
21032,
29898,
13,
632,
29929,
29892,
4175,
29918,
13087,
543,
29931,
29954,
23081,
29892,
28138,
9310,
29874,
29899,
29920,
14178,
5513,
13,
4706,
1723,
13,
4706,
4974,
544,
29918,
21032,
13,
4706,
4974,
7431,
29898,
558,
29918,
21032,
29897,
1275,
29871,
29896,
13,
4706,
4974,
544,
29918,
21032,
29961,
29900,
1822,
9342,
29889,
1975,
2541,
703,
15091,
29991,
1159,
13,
13,
1678,
822,
1243,
29918,
558,
29918,
21032,
29918,
4478,
29898,
1311,
1125,
13,
4706,
3440,
29918,
4352,
353,
1583,
29889,
468,
29878,
29918,
4836,
29889,
4478,
29918,
262,
29918,
558,
29898,
29929,
29892,
4175,
29918,
13087,
543,
29931,
29954,
23081,
1159,
13,
4706,
4974,
3440,
29918,
4352,
13,
4706,
4974,
3440,
29918,
4352,
29961,
29900,
29962,
1275,
376,
29931,
29954,
23081,
29908,
13,
13,
4706,
3440,
29918,
4352,
353,
1583,
29889,
468,
29878,
29918,
4836,
29889,
4478,
29918,
262,
29918,
558,
29898,
13,
632,
29929,
29892,
4175,
29918,
13087,
543,
29931,
29954,
23081,
29892,
28138,
9310,
29874,
29899,
29920,
14178,
5513,
13,
4706,
1723,
13,
4706,
4974,
3440,
29918,
4352,
13,
4706,
4974,
3440,
29918,
4352,
29961,
29900,
29962,
1275,
376,
29931,
29954,
23081,
29892,
28138,
2309,
29908,
13,
13,
13,
1990,
3251,
293,
5261,
4167,
29898,
29954,
2985,
24376,
1125,
13,
1678,
822,
1243,
29918,
8216,
29898,
1311,
1125,
13,
4706,
6139,
353,
1583,
29889,
468,
29878,
29918,
4836,
29889,
657,
29918,
8216,
580,
13,
4706,
4974,
6139,
29889,
27382,
2541,
703,
6716,
11786,
3489,
304,
27308,
1159,
13,
13,
1678,
822,
1243,
29918,
17519,
267,
29898,
1311,
1125,
13,
4706,
14202,
353,
1583,
29889,
468,
29878,
29918,
4836,
29889,
657,
29918,
17519,
267,
580,
13,
4706,
4974,
14202,
13,
4706,
4974,
731,
29898,
17519,
267,
29897,
1275,
8853,
6207,
9092,
13,
13,
1678,
822,
1243,
29918,
5559,
29918,
26045,
29898,
1311,
1125,
13,
4706,
23942,
353,
1583,
29889,
468,
29878,
29918,
4836,
29889,
657,
29918,
5559,
29918,
26045,
580,
13,
4706,
4974,
23942,
13,
4706,
4974,
7431,
29898,
26045,
29897,
1275,
29871,
29906,
13,
4706,
4974,
376,
5559,
29908,
297,
23942,
13,
4706,
4974,
376,
15269,
29908,
297,
23942,
13,
4706,
4974,
23942,
3366,
5559,
3108,
1275,
376,
991,
597,
3292,
29889,
510,
29914,
4058,
277,
29899,
5509,
29914,
468,
29878,
29889,
5559,
29908,
13,
4706,
4974,
23942,
3366,
15269,
16862,
1975,
2541,
703,
5559,
29992,
3292,
29889,
510,
29901,
4058,
277,
29899,
5509,
29914,
468,
29878,
29889,
5559,
1159,
13,
13,
1678,
822,
1243,
29918,
6786,
29898,
1311,
1125,
13,
4706,
396,
3939,
304,
1423,
925,
28537,
400,
29892,
1363,
372,
338,
2729,
1058,
1072,
759,
630,
848,
2066,
13,
4706,
4974,
7431,
29898,
1311,
29889,
5509,
29889,
1792,
29889,
657,
29918,
6786,
3101,
1405,
29871,
29941,
13,
13,
1678,
822,
1243,
29918,
5269,
29898,
1311,
1125,
13,
4706,
1243,
29918,
710,
353,
1583,
29889,
5509,
29889,
1792,
29889,
657,
29918,
5269,
580,
13,
4706,
4974,
1243,
29918,
710,
13,
4706,
4974,
7431,
29898,
1688,
29918,
710,
29897,
1405,
29871,
29900,
13,
4706,
4974,
376,
5507,
297,
1243,
29918,
710,
13,
4706,
4974,
376,
1213,
297,
1243,
29918,
710,
13,
13,
1678,
822,
1243,
29918,
657,
29918,
1445,
29898,
1311,
1125,
13,
4706,
934,
29918,
3051,
353,
1583,
29889,
468,
29878,
29918,
4836,
29889,
657,
29918,
1445,
29918,
3051,
17350,
5559,
29918,
1279,
2561,
29889,
3945,
1159,
13,
4706,
4974,
934,
29918,
3051,
13,
4706,
4974,
338,
8758,
29898,
1445,
29918,
3051,
29892,
851,
29897,
13,
4706,
4974,
376,
999,
29899,
7039,
6160,
297,
934,
29918,
3051,
13,
13,
1678,
822,
1243,
29918,
9290,
29916,
15423,
29918,
1445,
29898,
1311,
1125,
13,
4706,
411,
1583,
29889,
9294,
29934,
1759,
267,
29898,
2283,
17413,
2392,
1125,
13,
9651,
1583,
29889,
468,
29878,
29918,
4836,
29889,
657,
29918,
1445,
29918,
3051,
17350,
2204,
370,
8205,
433,
29918,
9290,
29916,
15423,
29918,
1445,
1159,
13,
13,
1678,
822,
1243,
29918,
3560,
29918,
4836,
29898,
1311,
1125,
13,
4706,
4974,
1583,
29889,
468,
29878,
29918,
29888,
548,
29889,
3560,
29889,
22377,
1275,
376,
4058,
277,
29899,
5509,
29908,
13,
4706,
4974,
1583,
29889,
468,
29878,
29918,
29888,
548,
29889,
3560,
29889,
20095,
1275,
376,
468,
29878,
29908,
13,
13,
1678,
732,
348,
27958,
29889,
11014,
703,
657,
29918,
15060,
29918,
15764,
451,
8762,
1159,
13,
1678,
822,
1243,
29918,
15060,
29918,
15764,
29898,
1311,
1125,
13,
4706,
13449,
353,
1583,
29889,
468,
29878,
29918,
4836,
29889,
657,
29918,
15060,
29918,
15764,
29898,
13,
9651,
9063,
543,
29906,
29929,
1113,
29941,
1113,
1389,
29883,
29955,
29947,
29896,
29890,
29946,
29890,
29946,
29896,
29906,
29946,
29945,
2176,
29941,
29872,
29900,
29896,
29900,
29947,
29953,
600,
29874,
29946,
29890,
29946,
29953,
29941,
29929,
29872,
29908,
13,
4706,
1723,
13,
4706,
4974,
338,
8758,
29898,
15764,
29892,
1051,
29897,
13,
4706,
4974,
7431,
29898,
15764,
29897,
1275,
29871,
29900,
13,
13,
1678,
822,
1243,
29918,
657,
29918,
17051,
29918,
3166,
29918,
4039,
29898,
1311,
1125,
13,
4706,
4974,
313,
13,
9651,
1583,
29889,
468,
29878,
29918,
4836,
29889,
657,
29918,
17051,
29918,
3166,
29918,
4039,
703,
29900,
29889,
29900,
29889,
29896,
1159,
13,
9651,
1275,
376,
29906,
29929,
1113,
29941,
1113,
1389,
29883,
29955,
29947,
29896,
29890,
29946,
29890,
29946,
29896,
29906,
29946,
29945,
2176,
29941,
29872,
29900,
29896,
29900,
29947,
29953,
600,
29874,
29946,
29890,
29946,
29953,
29941,
29929,
29872,
29908,
13,
4706,
1723,
13,
4706,
411,
11451,
1688,
29889,
336,
4637,
29898,
29954,
2985,
8787,
2451,
29897,
408,
429,
29901,
13,
9651,
1583,
29889,
468,
29878,
29918,
4836,
29889,
657,
29918,
17051,
29918,
3166,
29918,
4039,
703,
29888,
9130,
1159,
13,
4706,
4974,
376,
1333,
1476,
29908,
297,
851,
29898,
735,
29889,
1767,
29897,
13,
13,
1678,
822,
1243,
29918,
657,
29918,
4039,
29918,
3166,
29918,
4039,
29918,
978,
29898,
1311,
1125,
13,
4706,
4055,
353,
1583,
29889,
468,
29878,
29918,
4836,
29889,
657,
29918,
4039,
29918,
3166,
29918,
4039,
29918,
978,
703,
29900,
29889,
29900,
29889,
29896,
1159,
13,
4706,
4974,
4055,
29889,
978,
1275,
376,
29900,
29889,
29900,
29889,
29896,
29908,
13,
4706,
4974,
4055,
29889,
15060,
29918,
17051,
1275,
376,
29906,
29929,
1113,
29941,
1113,
1389,
29883,
29955,
29947,
29896,
29890,
29946,
29890,
29946,
29896,
29906,
29946,
29945,
2176,
29941,
29872,
29900,
29896,
29900,
29947,
29953,
600,
29874,
29946,
29890,
29946,
29953,
29941,
29929,
29872,
29908,
13,
13,
1678,
822,
1243,
29918,
657,
29918,
4039,
29918,
3166,
29918,
9290,
29916,
15423,
29918,
4039,
29918,
978,
29898,
1311,
1125,
13,
4706,
4974,
451,
1583,
29889,
468,
29878,
29918,
4836,
29889,
657,
29918,
4039,
29918,
3166,
29918,
4039,
29918,
978,
703,
29888,
9130,
1159,
13,
13,
1678,
822,
1243,
29918,
657,
29918,
776,
414,
29898,
1311,
1125,
13,
4706,
1914,
414,
353,
1583,
29889,
468,
29878,
29918,
4836,
29889,
657,
29918,
776,
414,
580,
13,
4706,
4974,
6796,
4058,
277,
29899,
5509,
3108,
1275,
1914,
414,
13,
13,
1678,
822,
1243,
29918,
15118,
29918,
17858,
6847,
29898,
1311,
1125,
13,
4706,
4160,
353,
1583,
29889,
468,
29878,
29918,
4836,
29889,
15970,
29918,
3068,
29918,
5358,
29918,
15118,
580,
13,
4706,
4974,
376,
22617,
1171,
1341,
424,
895,
29895,
29908,
297,
4160,
13,
13,
4706,
2228,
353,
1583,
29889,
468,
29878,
29918,
4836,
29889,
657,
29918,
15118,
29918,
3888,
29898,
29896,
29897,
13,
4706,
4974,
1583,
29889,
468,
29878,
29918,
4836,
29889,
3068,
29918,
5358,
29918,
15118,
703,
22617,
1171,
1341,
424,
895,
29895,
613,
2228,
29897,
13,
4706,
4974,
451,
1583,
29889,
468,
29878,
29918,
4836,
29889,
3068,
29918,
5358,
29918,
15118,
703,
3034,
375,
262,
29885,
613,
2228,
29897,
13,
13,
1678,
822,
1243,
29918,
558,
29918,
17858,
6847,
29898,
1311,
1125,
13,
4706,
4160,
353,
1583,
29889,
468,
29878,
29918,
4836,
29889,
15970,
29918,
3068,
29918,
14634,
29918,
558,
580,
13,
4706,
4974,
376,
22617,
1171,
1341,
424,
895,
29895,
29908,
297,
4160,
13,
13,
4706,
4974,
1583,
29889,
468,
29878,
29918,
4836,
29889,
3068,
29918,
14634,
29918,
558,
703,
22617,
1171,
1341,
424,
895,
29895,
1159,
13,
4706,
4974,
451,
1583,
29889,
468,
29878,
29918,
4836,
29889,
3068,
29918,
14634,
29918,
558,
703,
3034,
375,
262,
29885,
1159,
13,
13,
13,
1990,
16982,
1041,
29898,
29954,
2985,
24376,
1125,
13,
1678,
822,
1243,
29918,
15118,
29918,
1761,
29898,
1311,
1125,
13,
4706,
2228,
29918,
1761,
353,
1583,
29889,
468,
29878,
29918,
29888,
548,
29889,
657,
29918,
15118,
29918,
1761,
580,
13,
4706,
4974,
338,
8758,
29898,
15118,
29918,
1761,
29892,
1051,
29897,
13,
4706,
4974,
451,
2228,
29918,
1761,
13,
13,
4706,
2228,
29918,
1761,
29918,
497,
353,
1583,
29889,
468,
29878,
29918,
4836,
29889,
657,
29918,
15118,
29918,
1761,
29898,
4882,
29922,
29902,
893,
434,
5709,
29889,
497,
29897,
13,
4706,
4974,
2228,
29918,
1761,
29918,
497,
13,
4706,
4974,
7431,
29898,
15118,
29918,
1761,
29918,
497,
29897,
6736,
29871,
29946,
29945,
13,
13,
4706,
2228,
29918,
1761,
29918,
15603,
353,
1583,
29889,
468,
29878,
29918,
4836,
29889,
657,
29918,
15118,
29918,
1761,
29898,
4882,
29922,
29902,
893,
434,
5709,
29889,
15603,
29897,
13,
4706,
4974,
2228,
29918,
1761,
29918,
15603,
13,
4706,
4974,
7431,
29898,
15118,
29918,
1761,
29918,
15603,
29897,
6736,
29871,
29941,
29945,
13,
13,
4706,
2228,
29918,
1761,
353,
1583,
29889,
468,
29878,
29918,
4836,
29889,
657,
29918,
15118,
29918,
1761,
580,
13,
4706,
4974,
2228,
29918,
1761,
13,
4706,
4974,
7431,
29898,
15118,
29918,
1761,
29897,
6736,
29871,
29941,
13,
13,
1678,
822,
1243,
29918,
15118,
29918,
3888,
29898,
1311,
1125,
13,
4706,
2228,
29918,
3888,
353,
1583,
29889,
468,
29878,
29918,
4836,
29889,
657,
29918,
15118,
29918,
3888,
29898,
15118,
29918,
333,
29922,
29946,
29897,
13,
4706,
4974,
2228,
29918,
3888,
13,
4706,
4974,
2228,
29918,
3888,
29889,
3257,
29889,
27382,
2541,
703,
29933,
19036,
1024,
1159,
13,
4706,
4974,
2228,
29918,
3888,
29889,
4882,
1275,
26246,
5709,
29889,
15603,
13,
13,
1678,
822,
1243,
29918,
15118,
29918,
21134,
29898,
1311,
1125,
13,
4706,
11073,
353,
1583,
29889,
468,
29878,
29918,
4836,
29889,
657,
29918,
15118,
29918,
21134,
29898,
15118,
29918,
333,
29922,
29946,
29897,
13,
13,
4706,
4974,
451,
11073,
13,
4706,
1583,
29889,
468,
29878,
29918,
4836,
29889,
1202,
29918,
15118,
29918,
21134,
29898,
15118,
29918,
333,
29922,
29946,
29892,
11073,
29922,
3366,
1688,
29918,
27728,
29896,
613,
376,
1688,
29918,
27728,
29906,
20068,
13,
4706,
11073,
353,
1583,
29889,
468,
29878,
29918,
4836,
29889,
657,
29918,
15118,
29918,
21134,
29898,
15118,
29918,
333,
29922,
29946,
29897,
13,
4706,
4974,
7431,
29898,
21134,
29897,
1275,
29871,
29906,
13,
4706,
4974,
11073,
29961,
29900,
1822,
978,
1275,
376,
1688,
29918,
27728,
29896,
29908,
13,
4706,
4974,
11073,
29961,
29896,
1822,
978,
1275,
376,
1688,
29918,
27728,
29906,
29908,
13,
13,
13,
1990,
349,
913,
3089,
29879,
29898,
29954,
2985,
24376,
1125,
13,
1678,
822,
1243,
29918,
558,
29918,
1761,
29898,
1311,
1125,
13,
4706,
544,
29918,
1761,
353,
1583,
29889,
468,
29878,
29918,
29888,
548,
29889,
657,
29918,
558,
29918,
1761,
580,
13,
4706,
4974,
338,
8758,
29898,
558,
29918,
1761,
29892,
1051,
29897,
13,
13,
4706,
544,
29918,
1761,
29918,
497,
353,
1583,
29889,
468,
29878,
29918,
4836,
29889,
657,
29918,
558,
29918,
1761,
29898,
4882,
29922,
10593,
5709,
29889,
497,
29897,
13,
4706,
4974,
544,
29918,
1761,
29918,
497,
13,
4706,
4974,
7431,
29898,
558,
29918,
1761,
29918,
497,
29897,
6736,
29871,
29955,
29945,
13,
13,
4706,
544,
29918,
1761,
29918,
15603,
353,
1583,
29889,
468,
29878,
29918,
4836,
29889,
657,
29918,
558,
29918,
1761,
29898,
4882,
29922,
10593,
5709,
29889,
15603,
29897,
13,
4706,
4974,
544,
29918,
1761,
29918,
15603,
13,
4706,
4974,
7431,
29898,
558,
29918,
1761,
29918,
15603,
29897,
6736,
29871,
29955,
29900,
13,
13,
4706,
5764,
29918,
558,
29918,
20326,
353,
5159,
13,
4706,
363,
5764,
29918,
558,
297,
544,
29918,
1761,
29918,
15603,
29901,
13,
9651,
5764,
29918,
558,
29918,
20326,
29889,
4397,
29898,
15603,
29918,
558,
29889,
333,
29897,
13,
4706,
4974,
29871,
29929,
29941,
297,
5764,
29918,
558,
29918,
20326,
13,
13,
4706,
544,
29918,
1761,
29918,
1050,
3192,
353,
1583,
29889,
468,
29878,
29918,
4836,
29889,
657,
29918,
558,
29918,
1761,
29898,
4882,
29922,
10593,
5709,
29889,
1050,
3192,
29897,
13,
4706,
4974,
544,
29918,
1761,
29918,
1050,
3192,
13,
4706,
4974,
7431,
29898,
558,
29918,
1761,
29918,
1050,
3192,
29897,
6736,
29871,
29896,
13,
4706,
5764,
29918,
558,
29918,
20326,
353,
5159,
13,
4706,
363,
5764,
29918,
558,
297,
544,
29918,
1761,
29918,
1050,
3192,
29901,
13,
9651,
5764,
29918,
558,
29918,
20326,
29889,
4397,
29898,
15603,
29918,
558,
29889,
333,
29897,
13,
4706,
4974,
29871,
29929,
29941,
451,
297,
5764,
29918,
558,
29918,
20326,
13,
13,
4706,
544,
29918,
1761,
353,
1583,
29889,
468,
29878,
29918,
4836,
29889,
657,
29918,
558,
29918,
1761,
580,
13,
4706,
4974,
544,
29918,
1761,
13,
4706,
4974,
7431,
29898,
558,
29918,
1761,
29897,
6736,
29871,
29896,
13,
13,
1678,
822,
1243,
29918,
558,
29918,
3888,
29898,
1311,
1125,
13,
4706,
544,
29918,
3888,
353,
1583,
29889,
468,
29878,
29918,
4836,
29889,
657,
29918,
558,
29918,
3888,
29898,
558,
29918,
333,
29922,
29896,
29897,
13,
4706,
4974,
544,
29918,
3888,
13,
4706,
4974,
544,
29918,
3888,
29889,
3257,
1275,
376,
29956,
5690,
29901,
3450,
29908,
13,
4706,
4974,
544,
29918,
3888,
29889,
4882,
1275,
12089,
5709,
29889,
1050,
3192,
13,
13,
1678,
822,
1243,
29918,
497,
29918,
558,
29918,
2055,
1169,
29898,
1311,
1125,
13,
4706,
25741,
353,
1583,
29889,
468,
29878,
29918,
4836,
29889,
657,
29918,
497,
29918,
558,
29918,
2055,
1169,
29898,
558,
29918,
333,
29922,
29896,
29897,
13,
4706,
4974,
7431,
29898,
2055,
1169,
29897,
1275,
29871,
29941,
13,
4706,
4974,
25741,
29961,
29900,
29962,
1275,
376,
29946,
29941,
29896,
29888,
29946,
29874,
29955,
29883,
29945,
29883,
346,
29906,
29946,
29883,
29941,
29900,
29941,
29945,
29890,
29896,
29955,
29883,
29945,
29896,
29941,
29896,
29874,
29941,
29929,
29896,
29947,
370,
29929,
29947,
29929,
6448,
29900,
29908,
13,
4706,
4974,
25741,
29961,
29906,
29962,
1275,
376,
29945,
29881,
29953,
617,
29900,
29945,
29881,
29941,
29900,
1389,
29900,
29874,
29900,
29881,
29953,
29929,
1327,
29946,
29906,
6448,
1113,
328,
29896,
29947,
29955,
29946,
29900,
29947,
29874,
29900,
29955,
29900,
29890,
29900,
29908,
13,
13,
1678,
822,
1243,
29918,
5504,
29918,
558,
29918,
3888,
29898,
1311,
1125,
13,
4706,
544,
29918,
3888,
353,
1583,
29889,
468,
29878,
29918,
4836,
29889,
657,
29918,
558,
29918,
3888,
29898,
558,
29918,
333,
29922,
29896,
29897,
13,
4706,
1677,
29918,
3257,
353,
544,
29918,
3888,
29889,
3257,
13,
4706,
1677,
29918,
8216,
353,
544,
29918,
3888,
29889,
8216,
13,
13,
4706,
1583,
29889,
468,
29878,
29918,
4836,
29889,
5504,
29918,
558,
29918,
3888,
29898,
13,
9651,
544,
29918,
333,
29922,
29896,
29892,
3611,
543,
15033,
613,
6139,
543,
15033,
6139,
29908,
13,
4706,
1723,
13,
4706,
544,
29918,
3888,
353,
1583,
29889,
468,
29878,
29918,
4836,
29889,
657,
29918,
558,
29918,
3888,
29898,
558,
29918,
333,
29922,
29896,
29897,
13,
4706,
4974,
544,
29918,
3888,
29889,
3257,
1275,
376,
15033,
29908,
13,
4706,
4974,
544,
29918,
3888,
29889,
8216,
1275,
376,
15033,
6139,
29908,
13,
13,
4706,
1583,
29889,
468,
29878,
29918,
4836,
29889,
5504,
29918,
558,
29918,
3888,
29898,
13,
9651,
544,
29918,
333,
29922,
29896,
29892,
3611,
29922,
12683,
29918,
3257,
29892,
6139,
29922,
12683,
29918,
8216,
13,
4706,
1723,
13,
4706,
544,
29918,
3888,
353,
1583,
29889,
468,
29878,
29918,
4836,
29889,
657,
29918,
558,
29918,
3888,
29898,
558,
29918,
333,
29922,
29896,
29897,
13,
4706,
4974,
544,
29918,
3888,
29889,
3257,
1275,
1677,
29918,
3257,
13,
4706,
4974,
544,
29918,
3888,
29889,
8216,
1275,
1677,
29918,
8216,
13,
13,
1678,
822,
1243,
29918,
558,
29918,
21134,
29898,
1311,
1125,
13,
4706,
11073,
353,
1583,
29889,
468,
29878,
29918,
4836,
29889,
657,
29918,
558,
29918,
21134,
29898,
558,
29918,
333,
29922,
29896,
29897,
13,
4706,
4974,
451,
11073,
13,
4706,
1583,
29889,
468,
29878,
29918,
4836,
29889,
1202,
29918,
558,
29918,
21134,
29898,
558,
29918,
333,
29922,
29896,
29892,
11073,
29922,
3366,
1688,
29918,
27728,
29896,
613,
376,
1688,
29918,
27728,
29906,
20068,
13,
4706,
11073,
353,
1583,
29889,
468,
29878,
29918,
4836,
29889,
657,
29918,
558,
29918,
21134,
29898,
558,
29918,
333,
29922,
29896,
29897,
13,
4706,
4974,
7431,
29898,
21134,
29897,
1275,
29871,
29906,
13,
4706,
4974,
11073,
29961,
29900,
1822,
978,
1275,
376,
1688,
29918,
27728,
29896,
29908,
13,
4706,
4974,
11073,
29961,
29896,
1822,
978,
1275,
376,
1688,
29918,
27728,
29906,
29908,
13,
13,
13,
1990,
830,
17836,
29898,
29954,
2985,
24376,
1125,
13,
1678,
822,
1243,
29918,
657,
29918,
14096,
29898,
1311,
1125,
13,
4706,
6507,
353,
1583,
29889,
12199,
29918,
11526,
29918,
4836,
29889,
657,
29918,
14096,
29898,
4039,
29918,
978,
543,
29900,
29889,
29946,
29889,
29896,
1159,
13,
4706,
4974,
6507,
29889,
3257,
1275,
376,
1688,
29908,
13,
4706,
4974,
6507,
29889,
2587,
1275,
376,
13424,
6507,
29908,
13,
13,
1678,
822,
1243,
29918,
657,
29918,
276,
17836,
29898,
1311,
1125,
13,
4706,
27474,
353,
1583,
29889,
468,
29878,
29918,
4836,
29889,
657,
29918,
276,
17836,
580,
13,
4706,
4974,
27474,
13,
13,
4706,
4974,
7431,
29898,
276,
17836,
29897,
6736,
29871,
29929,
13,
13,
1678,
822,
1243,
29918,
3258,
29918,
14096,
29898,
1311,
1125,
13,
4706,
2302,
29918,
11083,
353,
7431,
29898,
1311,
29889,
12199,
29918,
11526,
29918,
4836,
29889,
657,
29918,
276,
17836,
3101,
13,
4706,
6507,
353,
1583,
29889,
12199,
29918,
11526,
29918,
4836,
29889,
3258,
29918,
14096,
29898,
13,
9651,
4055,
543,
29900,
29889,
29945,
29889,
29900,
613,
1024,
543,
1688,
613,
2643,
543,
13424,
6507,
29908,
13,
4706,
1723,
13,
4706,
2302,
29918,
7045,
353,
7431,
29898,
1311,
29889,
12199,
29918,
11526,
29918,
4836,
29889,
657,
29918,
276,
17836,
3101,
13,
4706,
4974,
6507,
29889,
4039,
29918,
978,
1275,
376,
29900,
29889,
29945,
29889,
29900,
29908,
13,
4706,
4974,
6507,
29889,
3257,
1275,
376,
1688,
29908,
13,
4706,
4974,
6507,
29889,
2587,
1275,
376,
13424,
6507,
29908,
13,
4706,
4974,
2302,
29918,
11083,
718,
29871,
29896,
1275,
2302,
29918,
7045,
13,
13,
1678,
822,
1243,
29918,
5628,
29918,
14096,
29898,
1311,
1125,
13,
4706,
6507,
353,
1583,
29889,
12199,
29918,
11526,
29918,
4836,
29889,
657,
29918,
14096,
29898,
4039,
29918,
978,
543,
29900,
29889,
29896,
29889,
29900,
1159,
13,
4706,
3978,
29918,
978,
353,
6507,
29889,
3257,
13,
4706,
3978,
29918,
4906,
353,
6507,
29889,
2587,
13,
13,
4706,
6507,
29889,
5628,
29918,
14096,
29898,
13,
9651,
1024,
29922,
29888,
29908,
29912,
12574,
29918,
978,
7402,
15033,
613,
2643,
29922,
29888,
29908,
29912,
12574,
29918,
4906,
7402,
15033,
29908,
13,
4706,
1723,
13,
4706,
4974,
6507,
29889,
3257,
1275,
285,
29908,
29912,
12574,
29918,
978,
7402,
15033,
29908,
13,
4706,
4974,
6507,
29889,
2587,
1275,
285,
29908,
29912,
12574,
29918,
4906,
7402,
15033,
29908,
13,
13,
1678,
822,
1243,
29918,
12333,
29918,
14096,
29898,
1311,
1125,
13,
4706,
6507,
353,
1583,
29889,
468,
29878,
29918,
4836,
29889,
657,
29918,
12333,
29918,
14096,
580,
13,
4706,
4974,
6507,
29889,
4039,
29918,
978,
1275,
376,
29900,
29889,
29945,
29889,
29900,
29908,
13,
4706,
4974,
6507,
29889,
3257,
1275,
376,
29900,
29889,
29945,
29889,
29900,
29908,
13,
4706,
4974,
376,
4373,
5169,
3698,
29908,
297,
6507,
29889,
2587,
13,
13,
13,
1990,
383,
548,
29879,
29898,
29954,
2985,
24376,
1125,
13,
1678,
822,
1243,
29918,
29888,
548,
29898,
1311,
1125,
13,
4706,
4974,
1583,
29889,
468,
29878,
29918,
29888,
548,
29889,
275,
29918,
29888,
548,
338,
5852,
13,
4706,
27350,
29918,
8216,
353,
1583,
29889,
468,
29878,
29918,
29888,
548,
29889,
657,
29918,
8216,
580,
13,
4706,
4974,
27350,
29918,
8216,
13,
13,
1678,
732,
348,
27958,
29889,
11014,
29898,
13,
4706,
376,
1333,
1985,
411,
343,
8807,
934,
1363,
372,
29871,
1423,
3682,
2629,
6230,
29908,
13,
1678,
1723,
13,
1678,
822,
1243,
29918,
9290,
29916,
15423,
29918,
29888,
548,
29898,
1311,
1125,
13,
4706,
1583,
29889,
468,
29878,
29918,
9290,
29916,
15423,
29918,
29888,
548,
353,
1583,
29889,
5509,
29889,
657,
29918,
4836,
29898,
13,
9651,
13761,
543,
290,
1725,
558,
29895,
24826,
29893,
412,
24826,
29893,
412,
29888,
8848,
29893,
412,
974,
29926,
705,
29886,
974,
613,
338,
29918,
29888,
548,
29922,
5574,
13,
4706,
1723,
13,
4706,
411,
1583,
29889,
9294,
29934,
1759,
267,
29898,
29954,
2985,
2451,
29897,
408,
429,
29901,
13,
9651,
1583,
29889,
468,
29878,
29918,
9290,
29916,
15423,
29918,
29888,
548,
29889,
657,
29918,
8216,
580,
13,
4706,
269,
353,
851,
29898,
735,
29889,
1767,
29889,
5085,
29897,
13,
4706,
4974,
376,
3664,
7460,
29908,
297,
269,
13,
4706,
4974,
376,
29946,
29900,
29946,
29908,
297,
269,
13,
13,
1678,
822,
1243,
29918,
657,
29918,
29888,
548,
29898,
1311,
1125,
13,
4706,
27350,
353,
1583,
29889,
468,
29878,
29918,
4836,
29889,
657,
29918,
29888,
548,
580,
13,
4706,
4974,
27350,
13,
4706,
4974,
27350,
29889,
657,
29918,
8216,
580,
13,
13,
1678,
822,
1243,
29918,
275,
29918,
29888,
548,
29898,
1311,
1125,
13,
4706,
4974,
451,
1583,
29889,
468,
29878,
29918,
4836,
29889,
275,
29918,
29888,
548,
13,
4706,
338,
29918,
29888,
548,
287,
353,
1583,
29889,
468,
29878,
29918,
4836,
29889,
275,
29918,
29888,
548,
287,
580,
13,
4706,
4974,
338,
8758,
29898,
275,
29918,
29888,
548,
287,
29892,
6120,
29897,
13,
4706,
396,
421,
275,
5852,
29952,
338,
1244,
373,
6437,
29901,
591,
864,
304,
367,
1854,
393,
869,
275,
29918,
29888,
548,
287,
580,
3639,
5852,
1203,
13,
4706,
396,
1363,
4335,
294,
750,
670,
12220,
1537,
7014,
322,
5131,
304,
736,
11786,
7653,
4153,
29892,
13,
4706,
396,
5040,
393,
10395,
1171,
13,
4706,
4974,
338,
29918,
29888,
548,
287,
338,
5852,
13,
4706,
27350,
353,
1583,
29889,
468,
29878,
29918,
4836,
29889,
657,
29918,
29888,
548,
29898,
3258,
29922,
8824,
29897,
13,
4706,
4974,
27350,
13,
4706,
4974,
27350,
29889,
275,
29918,
29888,
548,
13,
13,
1678,
822,
1243,
29918,
3258,
29918,
29888,
548,
29898,
1311,
1125,
13,
4706,
451,
29918,
735,
15423,
29918,
29888,
548,
353,
1583,
29889,
1333,
29918,
29888,
548,
287,
29918,
4836,
29889,
657,
29918,
29888,
548,
29898,
3258,
29922,
8824,
29897,
13,
4706,
4974,
451,
451,
29918,
735,
15423,
29918,
29888,
548,
13,
4706,
4974,
451,
1583,
29889,
1333,
29918,
29888,
548,
287,
29918,
4836,
29889,
275,
29918,
29888,
548,
287,
580,
13,
13,
4706,
2030,
29918,
29888,
548,
29879,
353,
1583,
29889,
1333,
29918,
29888,
548,
287,
29918,
4836,
29889,
5509,
29889,
1792,
29889,
657,
29918,
29888,
548,
29879,
580,
13,
13,
4706,
1583,
29889,
1333,
29918,
29888,
548,
287,
29918,
4836,
29889,
29888,
548,
29918,
3258,
580,
13,
13,
4706,
4974,
1583,
29889,
1333,
29918,
29888,
548,
287,
29918,
4836,
29889,
657,
29918,
29888,
548,
2141,
657,
29918,
8216,
580,
13,
4706,
4974,
1583,
29889,
1333,
29918,
29888,
548,
287,
29918,
4836,
29889,
275,
29918,
29888,
548,
287,
580,
13,
13,
4706,
716,
29918,
29888,
548,
29879,
353,
1583,
29889,
1333,
29918,
29888,
548,
287,
29918,
4836,
29889,
5509,
29889,
1792,
29889,
657,
29918,
29888,
548,
29879,
580,
13,
4706,
4974,
7431,
29898,
1025,
29918,
29888,
548,
29879,
29897,
1275,
7431,
29898,
1482,
29918,
29888,
548,
29879,
29897,
448,
29871,
29896,
13,
2
] |
day05/05_hydrothermal_venture.py | KDawid/AdventOfCode2021 | 0 | 1608832 | import re
class LineSegment:
X1_GROUP = 'x1'
X2_GROUP = 'x2'
Y1_GROUP = 'y1'
Y2_GROUP = 'y2'
INPUT_PATTERN = rf'(?P<{X1_GROUP}>\d+),(?P<{Y1_GROUP}>\d+) -> (?P<{X2_GROUP}>\d+),(?P<{Y2_GROUP}>\d+)'
MATCHER = re.compile(INPUT_PATTERN)
def __init__(self, str):
m = self.MATCHER.match(str)
if m:
self.x1 = int(m.group(self.X1_GROUP))
self.x2 = int(m.group(self.X2_GROUP))
self.y1 = int(m.group(self.Y1_GROUP))
self.y2 = int(m.group(self.Y2_GROUP))
else:
raise IOError(f'Could not parse input: {str}')
def get_points(self):
raise NotImplementedError('This method shall be implemented')
@staticmethod
def _generate_straight_line_points(point1, point2):
p1, p2 = (point1, point2) if point1 < point2 else (point2, point1)
return [num for num in range(p1, p2+1)]
def __str__(self):
return f'({self.x1}, {self.y1}) -> ({self.x2}, {self.y2})'
class StraightLineSegment(LineSegment):
def __init__(self, str):
super().__init__(str)
def get_points(self):
if self.x1 == self.x2:
return [(self.x1, y) for y in self._generate_straight_line_points(self.y1, self.y2)]
if self.y1 == self.y2:
return [(x, self.y1) for x in self._generate_straight_line_points(self.x1, self.x2)]
print('Points only can be generated for straight lines')
return []
class DiagonalLineSegment(LineSegment):
def __init__(self, str):
super().__init__(str)
def get_points(self):
if self.x1 == self.x2:
return [(self.x1, y) for y in self._generate_straight_line_points(self.y1, self.y2)]
if self.y1 == self.y2:
return [(x, self.y1) for x in self._generate_straight_line_points(self.x1, self.x2)]
return self.__generate_diagonal_points()
def __generate_diagonal_points(self):
if abs(self.x2 - self.x1) != abs(self.y2 - self.y1):
print(f'Error! This does ot seem diagonal: {self}')
x, y = self.x1, self.y1
x_direction = 1 if self.x1 < self.x2 else -1
y_direction = 1 if self.y1 < self.y2 else -1
res = [(x, y)]
for _ in range(abs(self.x1-self.x2)):
x += x_direction
y += y_direction
res.append((x, y))
return res
class OceanMap:
def __init__(self):
self.points = dict()
def add(self, coordinates):
if coordinates not in self.points:
self.points[coordinates] = 1
else:
self.points[coordinates] += 1
def get_dangerous_num(self, level=2):
return sum(value >= level for value in self.points.values())
def __str__(self):
x_max = max([p[0] for p in self.points])
y_max = max([p[1] for p in self.points])
res = ''
for y in range(y_max+1):
line = ''
for x in range(x_max+1):
line += str(self.points[(x, y)]) if (x, y) in self.points else '.'
res += line + '\n'
return res
def first_task(file_path):
data = read_straight_line_data(file_path)
map = OceanMap()
for d in data:
for point in d.get_points():
map.add(point)
# print(map)
return map.get_dangerous_num(level=2)
def read_straight_line_data(file_path):
with open(file_path) as f:
return [StraightLineSegment(line.strip()) for line in f.readlines()]
def second_task(file_path):
data = read_data(file_path)
map = OceanMap()
for d in data:
for point in d.get_points():
map.add(point)
# print(map)
return map.get_dangerous_num(level=2)
def read_data(file_path):
with open(file_path) as f:
return [DiagonalLineSegment(line.strip()) for line in f.readlines()]
if __name__ == '__main__':
FILE_PATH = 'input.txt'
res_1 = first_task(FILE_PATH)
print(res_1)
res_2 = second_task(FILE_PATH)
print(res_2)
| [
1,
1053,
337,
13,
13,
13,
1990,
7407,
17669,
358,
29901,
13,
1678,
1060,
29896,
29918,
26284,
353,
525,
29916,
29896,
29915,
13,
1678,
1060,
29906,
29918,
26284,
353,
525,
29916,
29906,
29915,
13,
1678,
612,
29896,
29918,
26284,
353,
525,
29891,
29896,
29915,
13,
1678,
612,
29906,
29918,
26284,
353,
525,
29891,
29906,
29915,
13,
13,
1678,
2672,
12336,
29918,
29925,
1299,
4945,
29940,
353,
364,
29888,
29915,
10780,
29925,
29966,
29912,
29990,
29896,
29918,
26284,
29913,
14247,
29881,
29974,
511,
10780,
29925,
29966,
29912,
29979,
29896,
29918,
26284,
29913,
14247,
29881,
28135,
1599,
22308,
29925,
29966,
29912,
29990,
29906,
29918,
26284,
29913,
14247,
29881,
29974,
511,
10780,
29925,
29966,
29912,
29979,
29906,
29918,
26284,
29913,
14247,
29881,
29974,
16029,
13,
1678,
341,
14789,
1001,
353,
337,
29889,
12198,
29898,
1177,
12336,
29918,
29925,
1299,
4945,
29940,
29897,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
851,
1125,
13,
4706,
286,
353,
1583,
29889,
29924,
14789,
1001,
29889,
4352,
29898,
710,
29897,
13,
4706,
565,
286,
29901,
13,
9651,
1583,
29889,
29916,
29896,
353,
938,
29898,
29885,
29889,
2972,
29898,
1311,
29889,
29990,
29896,
29918,
26284,
876,
13,
9651,
1583,
29889,
29916,
29906,
353,
938,
29898,
29885,
29889,
2972,
29898,
1311,
29889,
29990,
29906,
29918,
26284,
876,
13,
9651,
1583,
29889,
29891,
29896,
353,
938,
29898,
29885,
29889,
2972,
29898,
1311,
29889,
29979,
29896,
29918,
26284,
876,
13,
9651,
1583,
29889,
29891,
29906,
353,
938,
29898,
29885,
29889,
2972,
29898,
1311,
29889,
29979,
29906,
29918,
26284,
876,
13,
4706,
1683,
29901,
13,
9651,
12020,
10663,
2392,
29898,
29888,
29915,
23323,
451,
6088,
1881,
29901,
426,
710,
29913,
1495,
13,
13,
1678,
822,
679,
29918,
9748,
29898,
1311,
1125,
13,
4706,
12020,
2216,
1888,
2037,
287,
2392,
877,
4013,
1158,
4091,
367,
8762,
1495,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
903,
17158,
29918,
4151,
523,
29918,
1220,
29918,
9748,
29898,
3149,
29896,
29892,
1298,
29906,
1125,
13,
4706,
282,
29896,
29892,
282,
29906,
353,
313,
3149,
29896,
29892,
1298,
29906,
29897,
565,
1298,
29896,
529,
1298,
29906,
1683,
313,
3149,
29906,
29892,
1298,
29896,
29897,
13,
4706,
736,
518,
1949,
363,
954,
297,
3464,
29898,
29886,
29896,
29892,
282,
29906,
29974,
29896,
4638,
13,
13,
1678,
822,
4770,
710,
12035,
1311,
1125,
13,
4706,
736,
285,
29915,
3319,
1311,
29889,
29916,
29896,
1118,
426,
1311,
29889,
29891,
29896,
1800,
1599,
21313,
1311,
29889,
29916,
29906,
1118,
426,
1311,
29889,
29891,
29906,
1800,
29915,
13,
13,
13,
1990,
7357,
523,
3542,
17669,
358,
29898,
3542,
17669,
358,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
851,
1125,
13,
4706,
2428,
2141,
1649,
2344,
12035,
710,
29897,
13,
13,
1678,
822,
679,
29918,
9748,
29898,
1311,
1125,
13,
4706,
565,
1583,
29889,
29916,
29896,
1275,
1583,
29889,
29916,
29906,
29901,
13,
9651,
736,
17288,
1311,
29889,
29916,
29896,
29892,
343,
29897,
363,
343,
297,
1583,
3032,
17158,
29918,
4151,
523,
29918,
1220,
29918,
9748,
29898,
1311,
29889,
29891,
29896,
29892,
1583,
29889,
29891,
29906,
4638,
13,
4706,
565,
1583,
29889,
29891,
29896,
1275,
1583,
29889,
29891,
29906,
29901,
13,
9651,
736,
17288,
29916,
29892,
1583,
29889,
29891,
29896,
29897,
363,
921,
297,
1583,
3032,
17158,
29918,
4151,
523,
29918,
1220,
29918,
9748,
29898,
1311,
29889,
29916,
29896,
29892,
1583,
29889,
29916,
29906,
4638,
13,
4706,
1596,
877,
20325,
871,
508,
367,
5759,
363,
7812,
3454,
1495,
13,
4706,
736,
5159,
13,
13,
13,
1990,
4671,
351,
7177,
3542,
17669,
358,
29898,
3542,
17669,
358,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
851,
1125,
13,
4706,
2428,
2141,
1649,
2344,
12035,
710,
29897,
13,
13,
1678,
822,
679,
29918,
9748,
29898,
1311,
1125,
13,
4706,
565,
1583,
29889,
29916,
29896,
1275,
1583,
29889,
29916,
29906,
29901,
13,
9651,
736,
17288,
1311,
29889,
29916,
29896,
29892,
343,
29897,
363,
343,
297,
1583,
3032,
17158,
29918,
4151,
523,
29918,
1220,
29918,
9748,
29898,
1311,
29889,
29891,
29896,
29892,
1583,
29889,
29891,
29906,
4638,
13,
4706,
565,
1583,
29889,
29891,
29896,
1275,
1583,
29889,
29891,
29906,
29901,
13,
9651,
736,
17288,
29916,
29892,
1583,
29889,
29891,
29896,
29897,
363,
921,
297,
1583,
3032,
17158,
29918,
4151,
523,
29918,
1220,
29918,
9748,
29898,
1311,
29889,
29916,
29896,
29892,
1583,
29889,
29916,
29906,
4638,
13,
4706,
736,
1583,
17255,
17158,
29918,
6051,
351,
7177,
29918,
9748,
580,
13,
13,
1678,
822,
4770,
17158,
29918,
6051,
351,
7177,
29918,
9748,
29898,
1311,
1125,
13,
4706,
565,
6425,
29898,
1311,
29889,
29916,
29906,
448,
1583,
29889,
29916,
29896,
29897,
2804,
6425,
29898,
1311,
29889,
29891,
29906,
448,
1583,
29889,
29891,
29896,
1125,
13,
9651,
1596,
29898,
29888,
29915,
2392,
29991,
910,
947,
4932,
2833,
19640,
29901,
426,
1311,
29913,
1495,
13,
4706,
921,
29892,
343,
353,
1583,
29889,
29916,
29896,
29892,
1583,
29889,
29891,
29896,
13,
4706,
921,
29918,
20845,
353,
29871,
29896,
565,
1583,
29889,
29916,
29896,
529,
1583,
29889,
29916,
29906,
1683,
448,
29896,
13,
4706,
343,
29918,
20845,
353,
29871,
29896,
565,
1583,
29889,
29891,
29896,
529,
1583,
29889,
29891,
29906,
1683,
448,
29896,
13,
4706,
620,
353,
17288,
29916,
29892,
343,
4638,
13,
4706,
363,
903,
297,
3464,
29898,
6897,
29898,
1311,
29889,
29916,
29896,
29899,
1311,
29889,
29916,
29906,
22164,
13,
9651,
921,
4619,
921,
29918,
20845,
13,
9651,
343,
4619,
343,
29918,
20845,
13,
9651,
620,
29889,
4397,
3552,
29916,
29892,
343,
876,
13,
4706,
736,
620,
13,
13,
13,
1990,
21091,
3388,
29901,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
1583,
29889,
9748,
353,
9657,
580,
13,
13,
1678,
822,
788,
29898,
1311,
29892,
10350,
1125,
13,
4706,
565,
10350,
451,
297,
1583,
29889,
9748,
29901,
13,
9651,
1583,
29889,
9748,
29961,
1111,
24266,
29962,
353,
29871,
29896,
13,
4706,
1683,
29901,
13,
9651,
1583,
29889,
9748,
29961,
1111,
24266,
29962,
4619,
29871,
29896,
13,
13,
1678,
822,
679,
29918,
29881,
4600,
681,
29918,
1949,
29898,
1311,
29892,
3233,
29922,
29906,
1125,
13,
4706,
736,
2533,
29898,
1767,
6736,
3233,
363,
995,
297,
1583,
29889,
9748,
29889,
5975,
3101,
13,
13,
1678,
822,
4770,
710,
12035,
1311,
1125,
13,
4706,
921,
29918,
3317,
353,
4236,
4197,
29886,
29961,
29900,
29962,
363,
282,
297,
1583,
29889,
9748,
2314,
13,
4706,
343,
29918,
3317,
353,
4236,
4197,
29886,
29961,
29896,
29962,
363,
282,
297,
1583,
29889,
9748,
2314,
13,
13,
4706,
620,
353,
6629,
13,
4706,
363,
343,
297,
3464,
29898,
29891,
29918,
3317,
29974,
29896,
1125,
13,
9651,
1196,
353,
6629,
13,
9651,
363,
921,
297,
3464,
29898,
29916,
29918,
3317,
29974,
29896,
1125,
13,
18884,
1196,
4619,
851,
29898,
1311,
29889,
9748,
15625,
29916,
29892,
343,
29897,
2314,
565,
313,
29916,
29892,
343,
29897,
297,
1583,
29889,
9748,
1683,
525,
6169,
13,
9651,
620,
4619,
1196,
718,
11297,
29876,
29915,
13,
4706,
736,
620,
13,
13,
13,
1753,
937,
29918,
7662,
29898,
1445,
29918,
2084,
1125,
13,
1678,
848,
353,
1303,
29918,
4151,
523,
29918,
1220,
29918,
1272,
29898,
1445,
29918,
2084,
29897,
13,
1678,
2910,
353,
21091,
3388,
580,
13,
1678,
363,
270,
297,
848,
29901,
13,
4706,
363,
1298,
297,
270,
29889,
657,
29918,
9748,
7295,
13,
9651,
2910,
29889,
1202,
29898,
3149,
29897,
13,
1678,
396,
1596,
29898,
1958,
29897,
13,
1678,
736,
2910,
29889,
657,
29918,
29881,
4600,
681,
29918,
1949,
29898,
5563,
29922,
29906,
29897,
13,
13,
13,
1753,
1303,
29918,
4151,
523,
29918,
1220,
29918,
1272,
29898,
1445,
29918,
2084,
1125,
13,
1678,
411,
1722,
29898,
1445,
29918,
2084,
29897,
408,
285,
29901,
13,
4706,
736,
518,
855,
336,
523,
3542,
17669,
358,
29898,
1220,
29889,
17010,
3101,
363,
1196,
297,
285,
29889,
949,
9012,
580,
29962,
13,
13,
13,
1753,
1473,
29918,
7662,
29898,
1445,
29918,
2084,
1125,
13,
1678,
848,
353,
1303,
29918,
1272,
29898,
1445,
29918,
2084,
29897,
13,
1678,
2910,
353,
21091,
3388,
580,
13,
1678,
363,
270,
297,
848,
29901,
13,
4706,
363,
1298,
297,
270,
29889,
657,
29918,
9748,
7295,
13,
9651,
2910,
29889,
1202,
29898,
3149,
29897,
13,
1678,
396,
1596,
29898,
1958,
29897,
13,
1678,
736,
2910,
29889,
657,
29918,
29881,
4600,
681,
29918,
1949,
29898,
5563,
29922,
29906,
29897,
13,
13,
13,
1753,
1303,
29918,
1272,
29898,
1445,
29918,
2084,
1125,
13,
1678,
411,
1722,
29898,
1445,
29918,
2084,
29897,
408,
285,
29901,
13,
4706,
736,
518,
12130,
351,
7177,
3542,
17669,
358,
29898,
1220,
29889,
17010,
3101,
363,
1196,
297,
285,
29889,
949,
9012,
580,
29962,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
24080,
29918,
10145,
353,
525,
2080,
29889,
3945,
29915,
13,
1678,
620,
29918,
29896,
353,
937,
29918,
7662,
29898,
7724,
29918,
10145,
29897,
13,
1678,
1596,
29898,
690,
29918,
29896,
29897,
13,
1678,
620,
29918,
29906,
353,
1473,
29918,
7662,
29898,
7724,
29918,
10145,
29897,
13,
1678,
1596,
29898,
690,
29918,
29906,
29897,
13,
2
] |
data_io/export_camera_poses.py | tumcms/aerial2pdsm | 0 | 20670 | <gh_stars>0
import plyfile
from config import SparseModel, project_path
from colmap_scripts.read_model import Image
import numpy as np
project = SparseModel("/home/felix/pointclouds/_working/2019_11_07_Muenchen_26_10_2018",
model_path="/home/felix/pointclouds/_working/2019_11_07_Muenchen_26_10_2018/sparse/1")
images = project.images
cameras = project.cameras
poses = []
dt = np.dtype([('x', np.float64), ('y', np.float64), ('z', np.float64), ('img', np.int32)])
for nr, img in images.items():
R = img.qvec2rotmat()
T = img.tvec
cp = np.dot(-R.T, T)
pose = (cp[0], cp[1], cp[2], nr)
poses.append(pose)
vertex = np.array(poses, dtype=dt)
v = plyfile.PlyElement.describe(vertex, "vertices")
plyfile.PlyData([v], text=True).write(project.model_path + "/camera_locations.ply")
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
5215,
282,
368,
1445,
13,
13,
3166,
2295,
1053,
317,
5510,
3195,
29892,
2060,
29918,
2084,
13,
3166,
784,
1958,
29918,
16713,
29889,
949,
29918,
4299,
1053,
7084,
13,
5215,
12655,
408,
7442,
13,
13,
4836,
353,
317,
5510,
3195,
11974,
5184,
29914,
13287,
861,
29914,
3149,
9274,
29879,
19891,
22899,
29914,
29906,
29900,
29896,
29929,
29918,
29896,
29896,
29918,
29900,
29955,
29918,
29924,
3837,
2724,
29918,
29906,
29953,
29918,
29896,
29900,
29918,
29906,
29900,
29896,
29947,
613,
13,
462,
418,
1904,
29918,
2084,
13802,
5184,
29914,
13287,
861,
29914,
3149,
9274,
29879,
19891,
22899,
29914,
29906,
29900,
29896,
29929,
29918,
29896,
29896,
29918,
29900,
29955,
29918,
29924,
3837,
2724,
29918,
29906,
29953,
29918,
29896,
29900,
29918,
29906,
29900,
29896,
29947,
29914,
29879,
5510,
29914,
29896,
1159,
13,
13,
8346,
353,
2060,
29889,
8346,
13,
29883,
4183,
294,
353,
2060,
29889,
29883,
4183,
294,
13,
13,
10590,
353,
5159,
13,
6008,
353,
7442,
29889,
29881,
1853,
4197,
877,
29916,
742,
7442,
29889,
7411,
29953,
29946,
511,
6702,
29891,
742,
7442,
29889,
7411,
29953,
29946,
511,
6702,
29920,
742,
7442,
29889,
7411,
29953,
29946,
511,
6702,
2492,
742,
7442,
29889,
524,
29941,
29906,
29897,
2314,
13,
1454,
17114,
29892,
10153,
297,
4558,
29889,
7076,
7295,
13,
1678,
390,
353,
10153,
29889,
29939,
2003,
29906,
5450,
2922,
580,
13,
1678,
323,
353,
10153,
29889,
29873,
2003,
13,
1678,
21447,
353,
7442,
29889,
6333,
6278,
29934,
29889,
29911,
29892,
323,
29897,
13,
1678,
18593,
353,
313,
6814,
29961,
29900,
1402,
21447,
29961,
29896,
1402,
21447,
29961,
29906,
1402,
17114,
29897,
13,
1678,
926,
267,
29889,
4397,
29898,
4220,
29897,
13,
13,
369,
4776,
353,
7442,
29889,
2378,
29898,
10590,
29892,
26688,
29922,
6008,
29897,
13,
29894,
353,
282,
368,
1445,
29889,
29925,
368,
2642,
29889,
2783,
29581,
29898,
369,
4776,
29892,
376,
1765,
1575,
1159,
13,
17632,
1445,
29889,
29925,
368,
1469,
4197,
29894,
1402,
1426,
29922,
5574,
467,
3539,
29898,
4836,
29889,
4299,
29918,
2084,
718,
5591,
26065,
29918,
2029,
800,
29889,
17632,
1159,
13,
2
] |
easytoken/blob.py | sayanmondal2098/tokenizer | 3 | 40386 | import sys
import json
import nltk
import nltk
from nltk.corpus import stopwords
from nltk.tokenize import word_tokenize, sent_tokenize
class Partsofspeech():
def pos(txt):
tokens = nltk.word_tokenize(txt)
return (nltk.pos_tag(tokens))
# stop_words = set(stopwords.words('english')) | [
1,
1053,
10876,
13,
5215,
4390,
13,
13,
5215,
302,
1896,
29895,
13,
13,
5215,
302,
1896,
29895,
29871,
13,
3166,
302,
1896,
29895,
29889,
2616,
13364,
1053,
5040,
9303,
29871,
13,
3166,
302,
1896,
29895,
29889,
6979,
675,
1053,
1734,
29918,
6979,
675,
29892,
2665,
29918,
6979,
675,
29871,
13,
13,
13,
1990,
3455,
578,
5847,
412,
5309,
7295,
13,
13,
1678,
822,
926,
29898,
3945,
1125,
13,
4706,
18897,
353,
302,
1896,
29895,
29889,
1742,
29918,
6979,
675,
29898,
3945,
29897,
13,
4706,
736,
313,
29876,
1896,
29895,
29889,
1066,
29918,
4039,
29898,
517,
12360,
876,
13,
4706,
396,
5040,
29918,
9303,
353,
731,
29898,
9847,
9303,
29889,
9303,
877,
996,
1674,
8785,
2
] |
predix/admin/eventhub.py | BLaurent/predixpy | 28 | 52388 | <gh_stars>10-100
import os
import predix.config
import predix.security.uaa
import predix.admin.service
import predix.data.eventhub
class EventHub(object):
"""
Event Hub is a publisher/subscriber framework for getting information in, out and around the predix cloud
"""
def __init__(self, plan_name=None, name=None, uaa=None, *args, **kwargs):
self.service_name = 'predix-event-hub'
self.plan_name = plan_name or 'Tiered'
self.use_class = predix.data.eventhub.Eventhub
self.service = predix.admin.service.PredixService(self.service_name,
self.plan_name, name=name, uaa=uaa)
def exists(self):
"""
Returns whether or not this service already exists.
"""
return self.service.exists()
def create(self):
"""
Create an instance of the Time Series Service with the typical
starting settings.
"""
self.service.create()
os.environ[predix.config.get_env_key(self.use_class, 'host')] = self.get_eventhub_host()
os.environ[predix.config.get_env_key(self.use_class, 'port')] = self.get_eventhub_grpc_port()
os.environ[predix.config.get_env_key(self.use_class, 'wss_publish_uri')] = self.get_publish_wss_uri()
os.environ[predix.config.get_env_key(self.use_class, 'zone_id')] = self.get_zone_id()
def grant_client(self, client_id, publish=False, subscribe=False, publish_protocol=None, publish_topics=None,
subscribe_topics=None, scope_prefix='predix-event-hub', **kwargs):
"""
Grant the given client id all the scopes and authorities
needed to work with the eventhub service.
"""
scopes = ['openid']
authorities = ['uaa.resource']
zone_id = self.get_zone_id()
# always must be part of base user scope
scopes.append('%s.zones.%s.user' % (scope_prefix, zone_id))
authorities.append('%s.zones.%s.user' % (scope_prefix, zone_id))
if publish_topics is not None or subscribe_topics is not None:
raise Exception("multiple topics are not currently available in preidx-py")
if publish_topics is None:
publish_topics = ['topic']
if subscribe_topics is None:
subscribe_topics = ['topic']
if publish:
# we are granting just the default topic
if publish_protocol is None:
scopes.append('%s.zones.%s.grpc.publish' % (scope_prefix, zone_id))
authorities.append('%s.zones.%s.grpc.publish' % (scope_prefix, zone_id))
scopes.append('%s.zones.%s.wss.publish' % (scope_prefix, zone_id))
authorities.append('%s.zones.%s.wss.publish' % (scope_prefix, zone_id))
else:
scopes.append('%s.zones.%s.%s.publish' % (scope_prefix, zone_id, publish_protocol))
authorities.append('%s.zones.%s.%s.publish' % (scope_prefix, zone_id, publish_protocol))
# we are requesting multiple topics
for topic in publish_topics:
if publish_protocol is None:
scopes.append('%s.zones.%s.%s.grpc.publish' % (scope_prefix, zone_id, topic))
scopes.append('%s.zones.%s.%s.wss.publish' % (scope_prefix, zone_id, topic))
scopes.append('%s.zones.%s.%s.user' % (scope_prefix, zone_id, topic))
authorities.append('%s.zones.%s.%s.grpc.publish' % (scope_prefix, zone_id, topic))
authorities.append('%s.zones.%s.%s.wss.publish' % (scope_prefix, zone_id, topic))
authorities.append('%s.zones.%s.%s.user' % (scope_prefix, zone_id, topic))
else:
scopes.append('%s.zones.%s.%s.%s.publish' % (scope_prefix, zone_id, topic, publish_protocol))
authorities.append('%s.zones.%s.%s.%s.publish' % (scope_prefix, zone_id, topic, publish_protocol))
if subscribe:
# we are granting just the default topic
scopes.append('%s.zones.%s.grpc.subscribe' % (scope_prefix, zone_id))
authorities.append('%s.zones.%s.grpc.subscribe' % (scope_prefix, zone_id))
# we are requesting multiple topics
for topic in subscribe_topics:
scopes.append('%s.zones.%s.%s.grpc.subscribe' % (scope_prefix, zone_id, topic))
authorities.append('%s.zones.%s.%s.grpc.subscribe' % (scope_prefix, zone_id, topic))
self.service.uaa.uaac.update_client_grants(client_id, scope=scopes,
authorities=authorities)
return self.service.uaa.uaac.get_client(client_id)
def get_eventhub_host(self):
"""
returns the publish grpc endpoint for ingestion.
"""
for protocol in self.service.settings.data['publish']['protocol_details']:
if protocol['protocol'] == 'grpc':
return protocol['uri'][0:protocol['uri'].index(':')]
def get_eventhub_grpc_port(self):
for protocol in self.service.settings.data['publish']['protocol_details']:
if protocol['protocol'] == 'grpc':
return str(protocol['uri'][(protocol['uri'].index(':') + 1):])
def get_publish_wss_uri(self):
"""
returns the publish grpc endpoint for ingestion.
"""
for protocol in self.service.settings.data['publish']['protocol_details']:
if protocol['protocol'] == 'wss':
return protocol['uri']
def get_zone_id(self):
return self.service.settings.data['publish']['zone-http-header-value']
def get_subscribe_uri(self):
return self.service.settings.data['subscribe']['protocol_details'][0]['uri']
def make_topic(self, broker_uri, topic_name):
raise Exception('make topic has not been implemented yet')
def add_to_manifest(self, manifest):
"""
Add useful details to the manifest about this service
so that it can be used in an application.
:param manifest: An predix.admin.app.Manifest object
instance that manages reading/writing manifest config
for a cloud foundry app.
"""
# Add this service to list of services
manifest.add_service(self.service.name)
# Add environment variables
manifest.add_env_var(predix.config.get_env_key(self.use_class, 'host'), self.get_eventhub_host())
manifest.add_env_var(predix.config.get_env_key(self.use_class, 'port'), self.get_eventhub_grpc_port())
manifest.add_env_var(predix.config.get_env_key(self.use_class, 'wss_publish_uri'), self.get_publish_wss_uri())
manifest.add_env_var(predix.config.get_env_key(self.use_class, 'zone_id'), self.get_zone_id())
manifest.write_manifest()
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29900,
29899,
29896,
29900,
29900,
13,
5215,
2897,
13,
13,
5215,
4450,
861,
29889,
2917,
13,
5215,
4450,
861,
29889,
8926,
29889,
3357,
29874,
13,
5215,
4450,
861,
29889,
6406,
29889,
5509,
13,
5215,
4450,
861,
29889,
1272,
29889,
3696,
29882,
431,
13,
13,
13,
1990,
6864,
16046,
29898,
3318,
1125,
13,
1678,
9995,
13,
259,
6864,
14533,
338,
263,
9805,
261,
29914,
1491,
7588,
495,
6890,
363,
2805,
2472,
297,
29892,
714,
322,
2820,
278,
4450,
861,
9570,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
3814,
29918,
978,
29922,
8516,
29892,
1024,
29922,
8516,
29892,
318,
7340,
29922,
8516,
29892,
334,
5085,
29892,
3579,
19290,
1125,
13,
4706,
1583,
29889,
5509,
29918,
978,
353,
525,
11965,
861,
29899,
3696,
29899,
29882,
431,
29915,
13,
4706,
1583,
29889,
9018,
29918,
978,
353,
3814,
29918,
978,
470,
525,
29911,
631,
287,
29915,
13,
4706,
1583,
29889,
1509,
29918,
1990,
353,
4450,
861,
29889,
1272,
29889,
3696,
29882,
431,
29889,
2624,
29882,
431,
13,
13,
4706,
1583,
29889,
5509,
353,
4450,
861,
29889,
6406,
29889,
5509,
29889,
23084,
861,
3170,
29898,
1311,
29889,
5509,
29918,
978,
29892,
13,
462,
462,
462,
3986,
1583,
29889,
9018,
29918,
978,
29892,
1024,
29922,
978,
29892,
318,
7340,
29922,
3357,
29874,
29897,
13,
13,
1678,
822,
4864,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
16969,
3692,
470,
451,
445,
2669,
2307,
4864,
29889,
13,
4706,
9995,
13,
4706,
736,
1583,
29889,
5509,
29889,
9933,
580,
13,
13,
1678,
822,
1653,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
6204,
385,
2777,
310,
278,
5974,
10488,
6692,
411,
278,
15662,
13,
4706,
6257,
6055,
29889,
13,
4706,
9995,
13,
4706,
1583,
29889,
5509,
29889,
3258,
580,
13,
13,
4706,
2897,
29889,
21813,
29961,
11965,
861,
29889,
2917,
29889,
657,
29918,
6272,
29918,
1989,
29898,
1311,
29889,
1509,
29918,
1990,
29892,
525,
3069,
1495,
29962,
353,
1583,
29889,
657,
29918,
3696,
29882,
431,
29918,
3069,
580,
13,
4706,
2897,
29889,
21813,
29961,
11965,
861,
29889,
2917,
29889,
657,
29918,
6272,
29918,
1989,
29898,
1311,
29889,
1509,
29918,
1990,
29892,
525,
637,
1495,
29962,
353,
1583,
29889,
657,
29918,
3696,
29882,
431,
29918,
629,
6739,
29918,
637,
580,
13,
4706,
2897,
29889,
21813,
29961,
11965,
861,
29889,
2917,
29889,
657,
29918,
6272,
29918,
1989,
29898,
1311,
29889,
1509,
29918,
1990,
29892,
525,
29893,
893,
29918,
23679,
29918,
5338,
1495,
29962,
353,
1583,
29889,
657,
29918,
23679,
29918,
29893,
893,
29918,
5338,
580,
13,
4706,
2897,
29889,
21813,
29961,
11965,
861,
29889,
2917,
29889,
657,
29918,
6272,
29918,
1989,
29898,
1311,
29889,
1509,
29918,
1990,
29892,
525,
8028,
29918,
333,
1495,
29962,
353,
1583,
29889,
657,
29918,
8028,
29918,
333,
580,
13,
13,
1678,
822,
16690,
29918,
4645,
29898,
1311,
29892,
3132,
29918,
333,
29892,
9805,
29922,
8824,
29892,
1014,
13086,
29922,
8824,
29892,
9805,
29918,
20464,
29922,
8516,
29892,
9805,
29918,
3332,
1199,
29922,
8516,
29892,
13,
462,
268,
1014,
13086,
29918,
3332,
1199,
29922,
8516,
29892,
6874,
29918,
13506,
2433,
11965,
861,
29899,
3696,
29899,
29882,
431,
742,
3579,
19290,
1125,
13,
4706,
9995,
13,
4706,
18102,
278,
2183,
3132,
1178,
599,
278,
16505,
267,
322,
21142,
13,
4706,
4312,
304,
664,
411,
278,
1741,
29882,
431,
2669,
29889,
13,
4706,
9995,
13,
4706,
16505,
267,
353,
6024,
3150,
333,
2033,
13,
4706,
21142,
353,
6024,
3357,
29874,
29889,
10314,
2033,
13,
13,
4706,
10640,
29918,
333,
353,
1583,
29889,
657,
29918,
8028,
29918,
333,
580,
13,
4706,
396,
2337,
1818,
367,
760,
310,
2967,
1404,
6874,
13,
4706,
16505,
267,
29889,
4397,
877,
29995,
29879,
29889,
29920,
2873,
29889,
29995,
29879,
29889,
1792,
29915,
1273,
313,
6078,
29918,
13506,
29892,
10640,
29918,
333,
876,
13,
4706,
21142,
29889,
4397,
877,
29995,
29879,
29889,
29920,
2873,
29889,
29995,
29879,
29889,
1792,
29915,
1273,
313,
6078,
29918,
13506,
29892,
10640,
29918,
333,
876,
13,
13,
4706,
565,
9805,
29918,
3332,
1199,
338,
451,
6213,
470,
1014,
13086,
29918,
3332,
1199,
338,
451,
6213,
29901,
13,
9651,
12020,
8960,
703,
20787,
23820,
526,
451,
5279,
3625,
297,
758,
13140,
29899,
2272,
1159,
13,
13,
4706,
565,
9805,
29918,
3332,
1199,
338,
6213,
29901,
13,
9651,
9805,
29918,
3332,
1199,
353,
6024,
13010,
2033,
13,
13,
4706,
565,
1014,
13086,
29918,
3332,
1199,
338,
6213,
29901,
13,
9651,
1014,
13086,
29918,
3332,
1199,
353,
6024,
13010,
2033,
13,
13,
4706,
565,
9805,
29901,
13,
9651,
396,
591,
526,
16690,
292,
925,
278,
2322,
11261,
13,
9651,
565,
9805,
29918,
20464,
338,
6213,
29901,
13,
18884,
16505,
267,
29889,
4397,
877,
29995,
29879,
29889,
29920,
2873,
29889,
29995,
29879,
29889,
629,
6739,
29889,
23679,
29915,
1273,
313,
6078,
29918,
13506,
29892,
10640,
29918,
333,
876,
13,
18884,
21142,
29889,
4397,
877,
29995,
29879,
29889,
29920,
2873,
29889,
29995,
29879,
29889,
629,
6739,
29889,
23679,
29915,
1273,
313,
6078,
29918,
13506,
29892,
10640,
29918,
333,
876,
13,
18884,
16505,
267,
29889,
4397,
877,
29995,
29879,
29889,
29920,
2873,
29889,
29995,
29879,
29889,
29893,
893,
29889,
23679,
29915,
1273,
313,
6078,
29918,
13506,
29892,
10640,
29918,
333,
876,
13,
18884,
21142,
29889,
4397,
877,
29995,
29879,
29889,
29920,
2873,
29889,
29995,
29879,
29889,
29893,
893,
29889,
23679,
29915,
1273,
313,
6078,
29918,
13506,
29892,
10640,
29918,
333,
876,
13,
13,
9651,
1683,
29901,
13,
18884,
16505,
267,
29889,
4397,
877,
29995,
29879,
29889,
29920,
2873,
29889,
29995,
29879,
29889,
29995,
29879,
29889,
23679,
29915,
1273,
313,
6078,
29918,
13506,
29892,
10640,
29918,
333,
29892,
9805,
29918,
20464,
876,
13,
18884,
21142,
29889,
4397,
877,
29995,
29879,
29889,
29920,
2873,
29889,
29995,
29879,
29889,
29995,
29879,
29889,
23679,
29915,
1273,
313,
6078,
29918,
13506,
29892,
10640,
29918,
333,
29892,
9805,
29918,
20464,
876,
13,
13,
9651,
396,
591,
526,
2009,
292,
2999,
23820,
13,
9651,
363,
11261,
297,
9805,
29918,
3332,
1199,
29901,
13,
18884,
565,
9805,
29918,
20464,
338,
6213,
29901,
13,
462,
1678,
16505,
267,
29889,
4397,
877,
29995,
29879,
29889,
29920,
2873,
29889,
29995,
29879,
29889,
29995,
29879,
29889,
629,
6739,
29889,
23679,
29915,
1273,
313,
6078,
29918,
13506,
29892,
10640,
29918,
333,
29892,
11261,
876,
13,
462,
1678,
16505,
267,
29889,
4397,
877,
29995,
29879,
29889,
29920,
2873,
29889,
29995,
29879,
29889,
29995,
29879,
29889,
29893,
893,
29889,
23679,
29915,
1273,
313,
6078,
29918,
13506,
29892,
10640,
29918,
333,
29892,
11261,
876,
13,
462,
1678,
16505,
267,
29889,
4397,
877,
29995,
29879,
29889,
29920,
2873,
29889,
29995,
29879,
29889,
29995,
29879,
29889,
1792,
29915,
1273,
313,
6078,
29918,
13506,
29892,
10640,
29918,
333,
29892,
11261,
876,
13,
462,
1678,
21142,
29889,
4397,
877,
29995,
29879,
29889,
29920,
2873,
29889,
29995,
29879,
29889,
29995,
29879,
29889,
629,
6739,
29889,
23679,
29915,
1273,
313,
6078,
29918,
13506,
29892,
10640,
29918,
333,
29892,
11261,
876,
13,
462,
1678,
21142,
29889,
4397,
877,
29995,
29879,
29889,
29920,
2873,
29889,
29995,
29879,
29889,
29995,
29879,
29889,
29893,
893,
29889,
23679,
29915,
1273,
313,
6078,
29918,
13506,
29892,
10640,
29918,
333,
29892,
11261,
876,
13,
462,
1678,
21142,
29889,
4397,
877,
29995,
29879,
29889,
29920,
2873,
29889,
29995,
29879,
29889,
29995,
29879,
29889,
1792,
29915,
1273,
313,
6078,
29918,
13506,
29892,
10640,
29918,
333,
29892,
11261,
876,
13,
18884,
1683,
29901,
13,
462,
1678,
16505,
267,
29889,
4397,
877,
29995,
29879,
29889,
29920,
2873,
29889,
29995,
29879,
29889,
29995,
29879,
29889,
29995,
29879,
29889,
23679,
29915,
1273,
313,
6078,
29918,
13506,
29892,
10640,
29918,
333,
29892,
11261,
29892,
9805,
29918,
20464,
876,
13,
462,
1678,
21142,
29889,
4397,
877,
29995,
29879,
29889,
29920,
2873,
29889,
29995,
29879,
29889,
29995,
29879,
29889,
29995,
29879,
29889,
23679,
29915,
1273,
313,
6078,
29918,
13506,
29892,
10640,
29918,
333,
29892,
11261,
29892,
9805,
29918,
20464,
876,
13,
4706,
565,
1014,
13086,
29901,
13,
9651,
396,
591,
526,
16690,
292,
925,
278,
2322,
11261,
13,
9651,
16505,
267,
29889,
4397,
877,
29995,
29879,
29889,
29920,
2873,
29889,
29995,
29879,
29889,
629,
6739,
29889,
19496,
29915,
1273,
313,
6078,
29918,
13506,
29892,
10640,
29918,
333,
876,
13,
9651,
21142,
29889,
4397,
877,
29995,
29879,
29889,
29920,
2873,
29889,
29995,
29879,
29889,
629,
6739,
29889,
19496,
29915,
1273,
313,
6078,
29918,
13506,
29892,
10640,
29918,
333,
876,
13,
13,
9651,
396,
591,
526,
2009,
292,
2999,
23820,
13,
9651,
363,
11261,
297,
1014,
13086,
29918,
3332,
1199,
29901,
13,
18884,
16505,
267,
29889,
4397,
877,
29995,
29879,
29889,
29920,
2873,
29889,
29995,
29879,
29889,
29995,
29879,
29889,
629,
6739,
29889,
19496,
29915,
1273,
313,
6078,
29918,
13506,
29892,
10640,
29918,
333,
29892,
11261,
876,
13,
18884,
21142,
29889,
4397,
877,
29995,
29879,
29889,
29920,
2873,
29889,
29995,
29879,
29889,
29995,
29879,
29889,
629,
6739,
29889,
19496,
29915,
1273,
313,
6078,
29918,
13506,
29892,
10640,
29918,
333,
29892,
11261,
876,
13,
13,
4706,
1583,
29889,
5509,
29889,
3357,
29874,
29889,
3357,
562,
29889,
5504,
29918,
4645,
29918,
629,
1934,
29898,
4645,
29918,
333,
29892,
6874,
29922,
21785,
267,
29892,
13,
462,
462,
462,
259,
21142,
29922,
8921,
1907,
29897,
13,
13,
4706,
736,
1583,
29889,
5509,
29889,
3357,
29874,
29889,
3357,
562,
29889,
657,
29918,
4645,
29898,
4645,
29918,
333,
29897,
13,
13,
1678,
822,
679,
29918,
3696,
29882,
431,
29918,
3069,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
3639,
278,
9805,
867,
6739,
16248,
363,
2348,
602,
29889,
13,
4706,
9995,
13,
4706,
363,
9608,
297,
1583,
29889,
5509,
29889,
11027,
29889,
1272,
1839,
23679,
16215,
20464,
29918,
14144,
2033,
29901,
13,
9651,
565,
9608,
1839,
20464,
2033,
1275,
525,
629,
6739,
2396,
13,
18884,
736,
9608,
1839,
5338,
2033,
29961,
29900,
29901,
20464,
1839,
5338,
13359,
2248,
877,
29901,
1495,
29962,
13,
13,
1678,
822,
679,
29918,
3696,
29882,
431,
29918,
629,
6739,
29918,
637,
29898,
1311,
1125,
13,
4706,
363,
9608,
297,
1583,
29889,
5509,
29889,
11027,
29889,
1272,
1839,
23679,
16215,
20464,
29918,
14144,
2033,
29901,
13,
9651,
565,
9608,
1839,
20464,
2033,
1275,
525,
629,
6739,
2396,
13,
18884,
736,
851,
29898,
20464,
1839,
5338,
2033,
15625,
20464,
1839,
5338,
13359,
2248,
877,
29901,
1495,
718,
29871,
29896,
1125,
2314,
13,
13,
1678,
822,
679,
29918,
23679,
29918,
29893,
893,
29918,
5338,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
3639,
278,
9805,
867,
6739,
16248,
363,
2348,
602,
29889,
13,
13,
4706,
9995,
13,
4706,
363,
9608,
297,
1583,
29889,
5509,
29889,
11027,
29889,
1272,
1839,
23679,
16215,
20464,
29918,
14144,
2033,
29901,
13,
9651,
565,
9608,
1839,
20464,
2033,
1275,
525,
29893,
893,
2396,
13,
18884,
736,
9608,
1839,
5338,
2033,
13,
13,
1678,
822,
679,
29918,
8028,
29918,
333,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
5509,
29889,
11027,
29889,
1272,
1839,
23679,
16215,
8028,
29899,
1124,
29899,
6672,
29899,
1767,
2033,
13,
13,
1678,
822,
679,
29918,
19496,
29918,
5338,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
5509,
29889,
11027,
29889,
1272,
1839,
19496,
16215,
20464,
29918,
14144,
2033,
29961,
29900,
22322,
5338,
2033,
13,
13,
1678,
822,
1207,
29918,
13010,
29898,
1311,
29892,
2545,
3946,
29918,
5338,
29892,
11261,
29918,
978,
1125,
13,
4706,
12020,
8960,
877,
5675,
11261,
756,
451,
1063,
8762,
3447,
1495,
13,
13,
1678,
822,
788,
29918,
517,
29918,
29135,
29898,
1311,
29892,
10419,
1125,
13,
4706,
9995,
13,
4706,
3462,
5407,
4902,
304,
278,
10419,
1048,
445,
2669,
13,
4706,
577,
393,
372,
508,
367,
1304,
297,
385,
2280,
29889,
13,
13,
4706,
584,
3207,
10419,
29901,
530,
4450,
861,
29889,
6406,
29889,
932,
29889,
2517,
7004,
1203,
13,
9651,
2777,
393,
767,
1179,
5183,
29914,
16554,
10419,
2295,
13,
9651,
363,
263,
9570,
1476,
719,
623,
29889,
13,
4706,
9995,
13,
4706,
396,
3462,
445,
2669,
304,
1051,
310,
5786,
13,
4706,
10419,
29889,
1202,
29918,
5509,
29898,
1311,
29889,
5509,
29889,
978,
29897,
13,
13,
4706,
396,
3462,
5177,
3651,
13,
4706,
10419,
29889,
1202,
29918,
6272,
29918,
1707,
29898,
11965,
861,
29889,
2917,
29889,
657,
29918,
6272,
29918,
1989,
29898,
1311,
29889,
1509,
29918,
1990,
29892,
525,
3069,
5477,
1583,
29889,
657,
29918,
3696,
29882,
431,
29918,
3069,
3101,
13,
4706,
10419,
29889,
1202,
29918,
6272,
29918,
1707,
29898,
11965,
861,
29889,
2917,
29889,
657,
29918,
6272,
29918,
1989,
29898,
1311,
29889,
1509,
29918,
1990,
29892,
525,
637,
5477,
1583,
29889,
657,
29918,
3696,
29882,
431,
29918,
629,
6739,
29918,
637,
3101,
13,
4706,
10419,
29889,
1202,
29918,
6272,
29918,
1707,
29898,
11965,
861,
29889,
2917,
29889,
657,
29918,
6272,
29918,
1989,
29898,
1311,
29889,
1509,
29918,
1990,
29892,
525,
29893,
893,
29918,
23679,
29918,
5338,
5477,
1583,
29889,
657,
29918,
23679,
29918,
29893,
893,
29918,
5338,
3101,
13,
4706,
10419,
29889,
1202,
29918,
6272,
29918,
1707,
29898,
11965,
861,
29889,
2917,
29889,
657,
29918,
6272,
29918,
1989,
29898,
1311,
29889,
1509,
29918,
1990,
29892,
525,
8028,
29918,
333,
5477,
1583,
29889,
657,
29918,
8028,
29918,
333,
3101,
13,
13,
4706,
10419,
29889,
3539,
29918,
29135,
580,
13,
2
] |
tnp/__init__.py | hydiant/tnp | 295 | 1609886 | version = '0.1.1'
| [
1,
1873,
353,
525,
29900,
29889,
29896,
29889,
29896,
29915,
13,
2
] |
aos/external_systems.py | azdolinski/apstra-api-python | 1 | 96144 | <filename>aos/external_systems.py
# Copyright 2020-present, Apstra, Inc. All rights reserved.
#
# This source code is licensed under End User License Agreement found in the
# LICENSE file at http://www.apstra.com/eula
import logging
from dataclasses import dataclass
from .aos import AosSubsystem
from typing import Optional, List, Generator
logger = logging.getLogger(__name__)
class AosExternalSystems(AosSubsystem):
"""
Management of AOS Resource elements:
- Providers
- External Routers
- Virtual Infra Managers
"""
def __init__(self, rest):
super().__init__(rest)
self.external_router = AosExternalRouter(rest)
# Resources
@dataclass
class AosResource:
display_name: str
id: str
@dataclass
class ExternalRouter(AosResource):
asn: int
address: str
@classmethod
def from_json(cls, d):
if d is None:
return None
return ExternalRouter(
id=d["id"],
display_name=d.get("display_name", ""),
asn=d.get("asn"),
address=d.get("address"),
)
class AosExternalRouter(AosSubsystem):
def create(self, name: str, asn: int, address: str) -> ExternalRouter:
ext_rtr = {
"display_name": name,
"id": name,
"asn": asn,
"address": address,
}
created = self.rest.json_resp_post(
"/api/resources/external-routers", data=ext_rtr
)
return self.get(created["id"])
def delete(self, ext_rtr_id: str) -> None:
self.rest.delete(f"/api/resources/external-routers/{ext_rtr_id}")
def get(self, rtr_id: str) -> Optional[ExternalRouter]:
return ExternalRouter.from_json(
self.rest.json_resp_get(f"/api/resources/external-routers/{rtr_id}")
)
def iter_all(self) -> Generator[ExternalRouter, None, None]:
rtrs = self.rest.json_resp_get("/api/resources/external-routers")
if rtrs:
for r in rtrs["items"]:
yield ExternalRouter.from_json(r)
def find_by_name(self, rtr_name: str) -> List[ExternalRouter]:
return [r for r in self.iter_all() if r.display_name == rtr_name]
| [
1,
529,
9507,
29958,
29874,
359,
29914,
23176,
29918,
5205,
29879,
29889,
2272,
13,
29937,
14187,
1266,
29871,
29906,
29900,
29906,
29900,
29899,
6338,
29892,
6225,
4151,
29892,
9266,
29889,
2178,
10462,
21676,
29889,
13,
29937,
13,
29937,
910,
2752,
775,
338,
7794,
21144,
1090,
2796,
4911,
19245,
4059,
276,
882,
1476,
297,
278,
13,
29937,
365,
2965,
1430,
1660,
934,
472,
1732,
597,
1636,
29889,
481,
4151,
29889,
510,
29914,
29872,
2497,
13,
5215,
12183,
13,
3166,
848,
13203,
1053,
848,
1990,
13,
3166,
869,
29874,
359,
1053,
319,
359,
4035,
5205,
13,
3166,
19229,
1053,
28379,
29892,
2391,
29892,
3251,
1061,
13,
13,
21707,
353,
12183,
29889,
657,
16363,
22168,
978,
1649,
29897,
13,
13,
13,
1990,
319,
359,
25865,
3924,
29879,
29898,
29909,
359,
4035,
5205,
1125,
13,
1678,
9995,
13,
1678,
15057,
310,
319,
3267,
18981,
3161,
29901,
13,
1678,
448,
1019,
29454,
13,
1678,
448,
3985,
15915,
2153,
13,
1678,
448,
19181,
9969,
336,
2315,
18150,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1791,
1125,
13,
4706,
2428,
2141,
1649,
2344,
12035,
5060,
29897,
13,
4706,
1583,
29889,
23176,
29918,
15140,
353,
319,
359,
25865,
23971,
29898,
5060,
29897,
13,
13,
13,
29937,
27562,
13,
29992,
1272,
1990,
13,
1990,
319,
359,
6848,
29901,
13,
1678,
2479,
29918,
978,
29901,
851,
13,
1678,
1178,
29901,
851,
13,
13,
13,
29992,
1272,
1990,
13,
1990,
3985,
23971,
29898,
29909,
359,
6848,
1125,
13,
1678,
408,
29876,
29901,
938,
13,
1678,
3211,
29901,
851,
13,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
515,
29918,
3126,
29898,
25932,
29892,
270,
1125,
13,
4706,
565,
270,
338,
6213,
29901,
13,
9651,
736,
6213,
13,
4706,
736,
3985,
23971,
29898,
13,
9651,
1178,
29922,
29881,
3366,
333,
12436,
13,
9651,
2479,
29918,
978,
29922,
29881,
29889,
657,
703,
4990,
29918,
978,
613,
376,
4968,
13,
9651,
408,
29876,
29922,
29881,
29889,
657,
703,
294,
29876,
4968,
13,
9651,
3211,
29922,
29881,
29889,
657,
703,
7328,
4968,
13,
4706,
1723,
13,
13,
13,
1990,
319,
359,
25865,
23971,
29898,
29909,
359,
4035,
5205,
1125,
13,
1678,
822,
1653,
29898,
1311,
29892,
1024,
29901,
851,
29892,
408,
29876,
29901,
938,
29892,
3211,
29901,
851,
29897,
1599,
3985,
23971,
29901,
13,
4706,
1294,
29918,
29878,
509,
353,
426,
13,
9651,
376,
4990,
29918,
978,
1115,
1024,
29892,
13,
9651,
376,
333,
1115,
1024,
29892,
13,
9651,
376,
294,
29876,
1115,
408,
29876,
29892,
13,
9651,
376,
7328,
1115,
3211,
29892,
13,
4706,
500,
13,
13,
4706,
2825,
353,
1583,
29889,
5060,
29889,
3126,
29918,
13713,
29918,
2490,
29898,
13,
9651,
5591,
2754,
29914,
13237,
29914,
23176,
29899,
27537,
2153,
613,
848,
29922,
1062,
29918,
29878,
509,
13,
4706,
1723,
13,
4706,
736,
1583,
29889,
657,
29898,
11600,
3366,
333,
20068,
13,
13,
1678,
822,
5217,
29898,
1311,
29892,
1294,
29918,
29878,
509,
29918,
333,
29901,
851,
29897,
1599,
6213,
29901,
13,
4706,
1583,
29889,
5060,
29889,
8143,
29898,
29888,
23901,
2754,
29914,
13237,
29914,
23176,
29899,
27537,
2153,
19248,
1062,
29918,
29878,
509,
29918,
333,
27195,
13,
13,
1678,
822,
679,
29898,
1311,
29892,
364,
509,
29918,
333,
29901,
851,
29897,
1599,
28379,
29961,
25865,
23971,
5387,
13,
4706,
736,
3985,
23971,
29889,
3166,
29918,
3126,
29898,
13,
9651,
1583,
29889,
5060,
29889,
3126,
29918,
13713,
29918,
657,
29898,
29888,
23901,
2754,
29914,
13237,
29914,
23176,
29899,
27537,
2153,
19248,
29878,
509,
29918,
333,
27195,
13,
4706,
1723,
13,
13,
1678,
822,
4256,
29918,
497,
29898,
1311,
29897,
1599,
3251,
1061,
29961,
25865,
23971,
29892,
6213,
29892,
6213,
5387,
13,
4706,
364,
509,
29879,
353,
1583,
29889,
5060,
29889,
3126,
29918,
13713,
29918,
657,
11974,
2754,
29914,
13237,
29914,
23176,
29899,
27537,
2153,
1159,
13,
4706,
565,
364,
509,
29879,
29901,
13,
9651,
363,
364,
297,
364,
509,
29879,
3366,
7076,
3108,
29901,
13,
18884,
7709,
3985,
23971,
29889,
3166,
29918,
3126,
29898,
29878,
29897,
13,
13,
1678,
822,
1284,
29918,
1609,
29918,
978,
29898,
1311,
29892,
364,
509,
29918,
978,
29901,
851,
29897,
1599,
2391,
29961,
25865,
23971,
5387,
13,
4706,
736,
518,
29878,
363,
364,
297,
1583,
29889,
1524,
29918,
497,
580,
565,
364,
29889,
4990,
29918,
978,
1275,
364,
509,
29918,
978,
29962,
13,
2
] |
art/attacks/fast_gradient.py | yalechang/adversarial-robustness-toolbox | 1 | 156793 | <reponame>yalechang/adversarial-robustness-toolbox
# MIT License
#
# Copyright (C) IBM Corporation 2018
#
# 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.
from __future__ import absolute_import, division, print_function, unicode_literals
from keras import backend as k
import numpy as np
import tensorflow as tf
from art.attacks.attack import Attack
class FastGradientMethod(Attack):
"""
This attack was originally implemented by Goodfellow et al. (2015) with the infinity norm (and is known as the "Fast
Gradient Sign Method"). This implementation extends the attack to other norms, and is therefore called the Fast
Gradient Method. Paper link: https://arxiv.org/abs/1412.6572
"""
attack_params = ['ord', 'eps', 'y', 'y_val', 'targeted', 'clip_min', 'clip_max']
def __init__(self, classifier, sess=None, ord=np.inf, eps=.3, y=None, targeted=False, clip_min=0, clip_max=1):
"""
Create a FastGradientMethod instance.
:param classifier: A trained model.
:type classifier: :class:`Classifier`
:param sess: The session to run graphs in.
:type sess: `tf.Session`
:param ord: Order of the norm. Possible values: np.inf, 1 or 2.
:type ord: `int`
:param eps: Attack step size (input variation)
:type eps: `float`
:param y: A placeholder for the model labels. Only provide this parameter if you'd like to use true
labels when crafting adversarial samples. Otherwise, model predictions are used as labels to avoid the
"label leaking" effect (explained in this paper: https://arxiv.org/abs/1611.01236). Default is `None`.
Labels should be one-hot-encoded.
:type y: `np.ndarray`
:param targeted: Should the attack target one specific class
:type targeted: `bool`
:param clip_min: Minimum input component value.
:type clip_min: `float`
:param clip_max: Maximum input component value.
:type clip_max: `float`
"""
super(FastGradientMethod, self).__init__(classifier, sess)
kwargs = {'ord': ord, 'eps': eps, 'targeted': targeted, 'clip_min': clip_min, 'clip_max': clip_max, 'y': y}
self.set_params(**kwargs)
def generate_graph(self, x_op, eps_op, **kwargs):
"""
Generate symbolic graph for adversarial examples and return.
:param x_op: The model's symbolic inputs.
:type x_op: `tf.Placeholder`
:param eps_op: The placeholder for input variation (noise amplitude)
:type eps_op: `tf.Placeholder`
:param ord: Order of the norm (mimics Numpy). Possible values: np.inf, 1 or 2.
:type ord: `int`
:param y: (optional) A placeholder for the model labels. Only provide this parameter if you'd like to use true
labels when crafting adversarial samples. Otherwise, model predictions are used as labels to avoid the
"label leaking" effect (explained in this paper: https://arxiv.org/abs/1611.01236). Default is `None`.
Labels should be one-hot-encoded.
:type y: `np.ndarray`
:param clip_min: Minimum input component value.
:type clip_min: `float`
:param clip_max: Maximum input component value.
:type clip_max: `float`
:return: The computation graph for producing adversarial examples.
:rtype: `tf.Tensor`
"""
self.set_params(**kwargs)
preds = self.classifier._get_predictions(x_op, log=False)
if not hasattr(self, 'y') or self.y is None:
# Use model predictions as correct outputs
preds_max = tf.reduce_max(preds, 1, keep_dims=True)
y = tf.to_float(tf.equal(preds, preds_max))
y = tf.stop_gradient(y)
else:
y = self.y
y = y / tf.reduce_sum(y, 1, keep_dims=True)
loss = tf.nn.softmax_cross_entropy_with_logits(logits=preds, labels=y)
if self.targeted:
loss = -loss
grad, = tf.gradients(loss, x_op)
# Apply norm bound
if self.ord == np.inf:
grad = tf.sign(grad)
elif self.ord == 1:
ind = list(range(1, len(x_op.get_shape())))
grad = grad / tf.reduce_sum(tf.abs(grad), reduction_indices=ind, keep_dims=True)
elif self.ord == 2:
ind = list(range(1, len(x_op.get_shape())))
grad = grad / tf.sqrt(tf.reduce_sum(tf.square(grad), reduction_indices=ind, keep_dims=True))
# Apply perturbation and clip
x_adv_op = x_op + eps_op * grad
if self.clip_min is not None and self.clip_max is not None:
x_adv_op = tf.clip_by_value(x_adv_op, self.clip_min, self.clip_max)
return x_adv_op
def minimal_perturbations(self, x, x_val, eps_step=0.1, eps_max=1., **kwargs):
"""Iteratively compute the minimal perturbation necessary to make the class prediction change. Stop when the
first adversarial example was found.
:param x: A placeholder for the input.
:type x: `tf.Placeholder`
:param x_val: An array with the original inputs.
:type x_val: `np.ndarray`
:param eps_step: The increase in the perturbation for each iteration
:type eps_step: `float`
:param eps_max: The maximum accepted perturbation
:type eps_max: `float`
:param kwargs: Other parameters to send to `generate_graph`
:type kwargs: `dict`
:return: An array holding the adversarial examples.
:rtype: `np.ndarray`
"""
k.set_learning_phase(0)
y = np.argmax(self.model.predict(x_val), 1)
adv_x = x_val.copy()
curr_indexes = np.arange(len(adv_x))
eps = tf.placeholder(tf.float32, None)
adv_x_op = self.generate_graph(x, eps, **kwargs)
adv_y = tf.argmax(self.model(adv_x_op), 1)
eps_val = eps_step
while len(curr_indexes) != 0 and eps_val <= eps_max:
# Adversarial crafting
new_adv_x, new_y = self.sess.run([adv_x_op, adv_y], {x: x_val[curr_indexes], eps: eps_val})
# Update
adv_x[curr_indexes] = new_adv_x
curr_indexes = np.where(y[curr_indexes] == new_y)[0]
eps_val += eps_step
return adv_x
def generate(self, x_val, **kwargs):
"""Generate adversarial samples and return them in an array.
:param x_val: An array with the original inputs.
:type x_val: `np.ndarray`
:param eps: Attack step size (input variation)
:type eps: `float`
:param ord: Order of the norm (mimics Numpy). Possible values: np.inf, 1 or 2.
:type ord: `int`
:param y: A placeholder for the model labels. Only provide this parameter if you'd like to use true
labels when crafting adversarial samples. Otherwise, model predictions are used as labels to avoid the
"label leaking" effect (explained in this paper: https://arxiv.org/abs/1611.01236). Default is None.
Labels should be one-hot-encoded.
:type y: `np.ndarray`
:param clip_min: Minimum input component value.
:type clip_min: `float`
:param clip_max: Maximum input component value.
:type clip_max: `float`
:return: An array holding the adversarial examples.
:rtype: `np.ndarray`
"""
input_shape = [None] + list(x_val.shape[1:])
self._x = tf.placeholder(tf.float32, shape=input_shape)
k.set_learning_phase(0)
# Return adversarial examples computed with minimal perturbation if option is active
if "minimal" in kwargs and kwargs["minimal"]:
return self.minimal_perturbations(self._x, x_val, **kwargs)
# Generate computation graph
eps = tf.placeholder(tf.float32, None)
self._x_adv = self.generate_graph(self._x, eps, **kwargs)
# Run symbolic graph without or with true labels
if 'y_val' not in kwargs or kwargs['y_val'] is None:
feed_dict = {self._x: x_val, eps: self.eps}
else:
# Verify label placeholder was given in params if using true labels
if self.y is None:
raise Exception("True labels given but label placeholder not given.")
feed_dict = {self._x: x_val, self.y: kwargs['y_val'], eps: self.eps}
return self.sess.run(self._x_adv, feed_dict=feed_dict)
def set_params(self, **kwargs):
"""Take in a dictionary of parameters and applies attack-specific checks
before saving them as attributes.
:param ord: Order of the norm. Possible values: np.inf, 1 or 2.
:type ord: `int`
:param eps: Attack step size (input variation)
:type eps: `float`
:param y: (optional) A placeholder for the model labels. Only provide this parameter if you'd like to use true
labels when crafting adversarial samples. Otherwise, model predictions are used as labels to avoid the
"label leaking" effect (explained in this paper: https://arxiv.org/abs/1611.01236). Default is None.
Labels should be one-hot-encoded.
:type y: `np.ndarray`
:param targeted: Should the attack target one specific class
:type targeted: `bool`
:param clip_min: Minimum input component value.
:type clip_min: `float`
:param clip_max: Maximum input component value.
:type clip_max: `float`
"""
# Save attack-specific parameters
super(FastGradientMethod, self).set_params(**kwargs)
# Check if order of the norm is acceptable given current implementation
if self.ord not in [np.inf, int(1), int(2)]:
raise ValueError("Norm order must be either np.inf, 1, or 2.")
if self.clip_min is not None and self.clip_max is not None:
if self.eps <= self.clip_min or self.eps > self.clip_max:
raise ValueError('The amount of perturbation has to be in the data range.')
return True
| [
1,
529,
276,
1112,
420,
29958,
29891,
744,
305,
574,
29914,
328,
874,
27521,
29899,
13716,
504,
2264,
29899,
10154,
1884,
13,
29937,
341,
1806,
19245,
13,
29937,
13,
29937,
14187,
1266,
313,
29907,
29897,
27955,
15025,
29871,
29906,
29900,
29896,
29947,
13,
29937,
13,
29937,
20894,
2333,
338,
1244,
1609,
16896,
29892,
3889,
310,
8323,
29892,
304,
738,
2022,
4017,
292,
263,
3509,
310,
445,
7047,
322,
6942,
13,
29937,
5106,
2066,
313,
1552,
376,
6295,
14093,
4968,
304,
5376,
297,
278,
18540,
1728,
24345,
29892,
3704,
1728,
29485,
278,
13,
29937,
10462,
304,
671,
29892,
3509,
29892,
6623,
29892,
10366,
29892,
9805,
29892,
1320,
2666,
29892,
269,
803,
1947,
29892,
322,
29914,
272,
19417,
14591,
310,
278,
18540,
29892,
322,
304,
14257,
13,
29937,
12407,
304,
6029,
278,
18540,
338,
15252,
3276,
304,
437,
577,
29892,
4967,
304,
278,
1494,
5855,
29901,
13,
29937,
13,
29937,
450,
2038,
3509,
1266,
8369,
322,
445,
10751,
8369,
4091,
367,
5134,
297,
599,
14591,
470,
23228,
2011,
1080,
310,
278,
13,
29937,
18540,
29889,
13,
29937,
13,
29937,
6093,
7791,
7818,
12982,
1525,
8519,
13756,
13044,
3352,
376,
3289,
8519,
613,
399,
1806,
8187,
2692,
399,
1718,
29934,
13566,
29979,
8079,
13764,
29979,
476,
22255,
29892,
8528,
15094,
1799,
6323,
306,
3580,
5265,
3352,
29892,
2672,
6154,
15789,
4214,
350,
2692,
6058,
27848,
3352,
7495,
6093,
13,
29937,
399,
1718,
29934,
13566,
29059,
8079,
341,
1001,
3210,
13566,
2882,
6227,
11937,
29892,
383,
1806,
8186,
1799,
15842,
319,
349,
8322,
2965,
13309,
1718,
349,
4574,
13152,
1660,
5300,
405,
1164,
1177,
15860,
1177,
1692,
13780,
29889,
2672,
11698,
382,
29963,
3919,
24972,
9818,
6093,
13,
29937,
26524,
29950,
24125,
6323,
315,
4590,
29979,
22789,
3912,
379,
5607,
8032,
29903,
20700,
17705,
6181,
15842,
13764,
29979,
315,
4375,
7833,
29892,
21330,
1529,
1692,
29903,
6323,
438,
29911,
4448,
17705,
2882,
6227,
11937,
29892,
12317,
2544,
4448,
2672,
13764,
319,
9838,
8079,
8707,
29911,
4717,
1783,
29892,
13,
29937,
323,
8476,
6323,
438,
29911,
4448,
22119,
1660,
29892,
9033,
3235,
4214,
3895,
29892,
19474,
8079,
6323,
2672,
8707,
8186,
9838,
22659,
6093,
7791,
7818,
12982,
1525,
6323,
6093,
501,
1660,
6323,
438,
29911,
4448,
5012,
1964,
4214,
29903,
2672,
6093,
13,
29937,
7791,
7818,
12982,
1525,
29889,
13,
3166,
4770,
29888,
9130,
1649,
1053,
8380,
29918,
5215,
29892,
8542,
29892,
1596,
29918,
2220,
29892,
29104,
29918,
20889,
1338,
13,
13,
3166,
13023,
294,
1053,
14998,
408,
413,
13,
5215,
12655,
408,
7442,
13,
5215,
26110,
408,
15886,
13,
13,
3166,
1616,
29889,
1131,
26514,
29889,
1131,
547,
1053,
6212,
547,
13,
13,
13,
1990,
23786,
25584,
993,
4062,
29898,
4165,
547,
1125,
13,
1678,
9995,
13,
1678,
910,
5337,
471,
10437,
8762,
491,
7197,
29888,
4743,
634,
394,
29889,
313,
29906,
29900,
29896,
29945,
29897,
411,
278,
27971,
6056,
313,
392,
338,
2998,
408,
278,
376,
29943,
579,
13,
1678,
19295,
993,
9954,
8108,
2564,
910,
5314,
4988,
278,
5337,
304,
916,
6056,
29879,
29892,
322,
338,
5480,
2000,
278,
23786,
13,
1678,
19295,
993,
8108,
29889,
349,
7202,
1544,
29901,
2045,
597,
279,
26560,
29889,
990,
29914,
6897,
29914,
29896,
29946,
29896,
29906,
29889,
29953,
29945,
29955,
29906,
13,
1678,
9995,
13,
1678,
5337,
29918,
7529,
353,
6024,
536,
742,
525,
8961,
742,
525,
29891,
742,
525,
29891,
29918,
791,
742,
525,
5182,
287,
742,
525,
24049,
29918,
1195,
742,
525,
24049,
29918,
3317,
2033,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
770,
3709,
29892,
27937,
29922,
8516,
29892,
4356,
29922,
9302,
29889,
7192,
29892,
321,
567,
21098,
29941,
29892,
343,
29922,
8516,
29892,
3646,
287,
29922,
8824,
29892,
20102,
29918,
1195,
29922,
29900,
29892,
20102,
29918,
3317,
29922,
29896,
1125,
13,
4706,
9995,
13,
4706,
6204,
263,
23786,
25584,
993,
4062,
2777,
29889,
13,
13,
4706,
584,
3207,
770,
3709,
29901,
319,
16370,
1904,
29889,
13,
4706,
584,
1853,
770,
3709,
29901,
584,
1990,
18078,
2385,
3709,
29952,
13,
4706,
584,
3207,
27937,
29901,
450,
4867,
304,
1065,
18445,
297,
29889,
13,
4706,
584,
1853,
27937,
29901,
421,
13264,
29889,
7317,
29952,
13,
4706,
584,
3207,
4356,
29901,
8170,
310,
278,
6056,
29889,
20049,
1819,
29901,
7442,
29889,
7192,
29892,
29871,
29896,
470,
29871,
29906,
29889,
13,
4706,
584,
1853,
4356,
29901,
421,
524,
29952,
13,
4706,
584,
3207,
321,
567,
29901,
6212,
547,
4331,
2159,
313,
2080,
19262,
29897,
13,
4706,
584,
1853,
321,
567,
29901,
421,
7411,
29952,
13,
4706,
584,
3207,
343,
29901,
319,
12983,
363,
278,
1904,
11073,
29889,
9333,
3867,
445,
3443,
565,
366,
29915,
29881,
763,
304,
671,
1565,
13,
462,
29871,
11073,
746,
25554,
292,
19901,
27521,
11916,
29889,
13466,
29892,
1904,
27303,
526,
1304,
408,
11073,
304,
4772,
278,
13,
462,
29871,
376,
1643,
454,
5086,
29908,
2779,
313,
4548,
433,
1312,
297,
445,
5650,
29901,
2045,
597,
279,
26560,
29889,
990,
29914,
6897,
29914,
29896,
29953,
29896,
29896,
29889,
29900,
29896,
29906,
29941,
29953,
467,
13109,
338,
421,
8516,
1412,
13,
462,
29871,
15796,
29879,
881,
367,
697,
29899,
8711,
29899,
26716,
29889,
13,
4706,
584,
1853,
343,
29901,
421,
9302,
29889,
299,
2378,
29952,
13,
4706,
584,
3207,
3646,
287,
29901,
10575,
278,
5337,
3646,
697,
2702,
770,
13,
4706,
584,
1853,
3646,
287,
29901,
421,
11227,
29952,
13,
4706,
584,
3207,
20102,
29918,
1195,
29901,
3080,
12539,
1881,
4163,
995,
29889,
13,
4706,
584,
1853,
20102,
29918,
1195,
29901,
421,
7411,
29952,
13,
4706,
584,
3207,
20102,
29918,
3317,
29901,
5918,
12539,
1881,
4163,
995,
29889,
13,
4706,
584,
1853,
20102,
29918,
3317,
29901,
421,
7411,
29952,
13,
4706,
9995,
13,
4706,
2428,
29898,
29943,
579,
25584,
993,
4062,
29892,
1583,
467,
1649,
2344,
12035,
1990,
3709,
29892,
27937,
29897,
13,
13,
4706,
9049,
5085,
353,
11117,
536,
2396,
4356,
29892,
525,
8961,
2396,
321,
567,
29892,
525,
5182,
287,
2396,
3646,
287,
29892,
525,
24049,
29918,
1195,
2396,
20102,
29918,
1195,
29892,
525,
24049,
29918,
3317,
2396,
20102,
29918,
3317,
29892,
525,
29891,
2396,
343,
29913,
13,
4706,
1583,
29889,
842,
29918,
7529,
29898,
1068,
19290,
29897,
13,
13,
1678,
822,
5706,
29918,
4262,
29898,
1311,
29892,
921,
29918,
459,
29892,
321,
567,
29918,
459,
29892,
3579,
19290,
1125,
13,
4706,
9995,
13,
4706,
3251,
403,
5829,
293,
3983,
363,
19901,
27521,
6455,
322,
736,
29889,
13,
13,
4706,
584,
3207,
921,
29918,
459,
29901,
450,
1904,
29915,
29879,
5829,
293,
10970,
29889,
13,
4706,
584,
1853,
921,
29918,
459,
29901,
421,
13264,
29889,
22150,
7694,
29952,
13,
4706,
584,
3207,
321,
567,
29918,
459,
29901,
450,
12983,
363,
1881,
19262,
313,
1217,
895,
28347,
29897,
13,
4706,
584,
1853,
321,
567,
29918,
459,
29901,
421,
13264,
29889,
22150,
7694,
29952,
13,
4706,
584,
3207,
4356,
29901,
8170,
310,
278,
6056,
313,
29885,
326,
1199,
11848,
2272,
467,
20049,
1819,
29901,
7442,
29889,
7192,
29892,
29871,
29896,
470,
29871,
29906,
29889,
13,
4706,
584,
1853,
4356,
29901,
421,
524,
29952,
13,
4706,
584,
3207,
343,
29901,
313,
25253,
29897,
319,
12983,
363,
278,
1904,
11073,
29889,
9333,
3867,
445,
3443,
565,
366,
29915,
29881,
763,
304,
671,
1565,
13,
462,
29871,
11073,
746,
25554,
292,
19901,
27521,
11916,
29889,
13466,
29892,
1904,
27303,
526,
1304,
408,
11073,
304,
4772,
278,
13,
462,
29871,
376,
1643,
454,
5086,
29908,
2779,
313,
4548,
433,
1312,
297,
445,
5650,
29901,
2045,
597,
279,
26560,
29889,
990,
29914,
6897,
29914,
29896,
29953,
29896,
29896,
29889,
29900,
29896,
29906,
29941,
29953,
467,
13109,
338,
421,
8516,
1412,
13,
462,
29871,
15796,
29879,
881,
367,
697,
29899,
8711,
29899,
26716,
29889,
13,
4706,
584,
1853,
343,
29901,
421,
9302,
29889,
299,
2378,
29952,
13,
4706,
584,
3207,
20102,
29918,
1195,
29901,
3080,
12539,
1881,
4163,
995,
29889,
13,
4706,
584,
1853,
20102,
29918,
1195,
29901,
421,
7411,
29952,
13,
4706,
584,
3207,
20102,
29918,
3317,
29901,
5918,
12539,
1881,
4163,
995,
29889,
13,
4706,
584,
1853,
20102,
29918,
3317,
29901,
421,
7411,
29952,
13,
4706,
584,
2457,
29901,
450,
16287,
3983,
363,
20811,
19901,
27521,
6455,
29889,
13,
4706,
584,
29878,
1853,
29901,
421,
13264,
29889,
29911,
6073,
29952,
13,
4706,
9995,
13,
4706,
1583,
29889,
842,
29918,
7529,
29898,
1068,
19290,
29897,
13,
13,
4706,
4450,
29879,
353,
1583,
29889,
1990,
3709,
3032,
657,
29918,
27711,
1080,
29898,
29916,
29918,
459,
29892,
1480,
29922,
8824,
29897,
13,
13,
4706,
565,
451,
756,
5552,
29898,
1311,
29892,
525,
29891,
1495,
470,
1583,
29889,
29891,
338,
6213,
29901,
13,
9651,
396,
4803,
1904,
27303,
408,
1959,
14391,
13,
9651,
4450,
29879,
29918,
3317,
353,
15886,
29889,
17469,
29918,
3317,
29898,
11965,
29879,
29892,
29871,
29896,
29892,
3013,
29918,
6229,
29879,
29922,
5574,
29897,
13,
9651,
343,
353,
15886,
29889,
517,
29918,
7411,
29898,
13264,
29889,
11745,
29898,
11965,
29879,
29892,
4450,
29879,
29918,
3317,
876,
13,
9651,
343,
353,
15886,
29889,
9847,
29918,
24970,
29898,
29891,
29897,
13,
4706,
1683,
29901,
13,
9651,
343,
353,
1583,
29889,
29891,
13,
4706,
343,
353,
343,
847,
15886,
29889,
17469,
29918,
2083,
29898,
29891,
29892,
29871,
29896,
29892,
3013,
29918,
6229,
29879,
29922,
5574,
29897,
13,
13,
4706,
6410,
353,
15886,
29889,
15755,
29889,
2695,
3317,
29918,
19128,
29918,
296,
14441,
29918,
2541,
29918,
1188,
1169,
29898,
1188,
1169,
29922,
11965,
29879,
29892,
11073,
29922,
29891,
29897,
13,
4706,
565,
1583,
29889,
5182,
287,
29901,
13,
9651,
6410,
353,
448,
6758,
13,
4706,
4656,
29892,
353,
15886,
29889,
5105,
10070,
29898,
6758,
29892,
921,
29918,
459,
29897,
13,
13,
4706,
396,
2401,
368,
6056,
3216,
13,
4706,
565,
1583,
29889,
536,
1275,
7442,
29889,
7192,
29901,
13,
9651,
4656,
353,
15886,
29889,
4530,
29898,
5105,
29897,
13,
4706,
25342,
1583,
29889,
536,
1275,
29871,
29896,
29901,
13,
9651,
1399,
353,
1051,
29898,
3881,
29898,
29896,
29892,
7431,
29898,
29916,
29918,
459,
29889,
657,
29918,
12181,
580,
4961,
13,
9651,
4656,
353,
4656,
847,
15886,
29889,
17469,
29918,
2083,
29898,
13264,
29889,
6897,
29898,
5105,
511,
20376,
29918,
513,
1575,
29922,
513,
29892,
3013,
29918,
6229,
29879,
29922,
5574,
29897,
13,
4706,
25342,
1583,
29889,
536,
1275,
29871,
29906,
29901,
13,
9651,
1399,
353,
1051,
29898,
3881,
29898,
29896,
29892,
7431,
29898,
29916,
29918,
459,
29889,
657,
29918,
12181,
580,
4961,
13,
9651,
4656,
353,
4656,
847,
15886,
29889,
3676,
29898,
13264,
29889,
17469,
29918,
2083,
29898,
13264,
29889,
17619,
29898,
5105,
511,
20376,
29918,
513,
1575,
29922,
513,
29892,
3013,
29918,
6229,
29879,
29922,
5574,
876,
13,
13,
4706,
396,
2401,
368,
22786,
362,
322,
20102,
13,
4706,
921,
29918,
17263,
29918,
459,
353,
921,
29918,
459,
718,
321,
567,
29918,
459,
334,
4656,
13,
4706,
565,
1583,
29889,
24049,
29918,
1195,
338,
451,
6213,
322,
1583,
29889,
24049,
29918,
3317,
338,
451,
6213,
29901,
13,
9651,
921,
29918,
17263,
29918,
459,
353,
15886,
29889,
24049,
29918,
1609,
29918,
1767,
29898,
29916,
29918,
17263,
29918,
459,
29892,
1583,
29889,
24049,
29918,
1195,
29892,
1583,
29889,
24049,
29918,
3317,
29897,
13,
13,
4706,
736,
921,
29918,
17263,
29918,
459,
13,
13,
1678,
822,
13114,
29918,
10700,
9265,
800,
29898,
1311,
29892,
921,
29892,
921,
29918,
791,
29892,
321,
567,
29918,
10568,
29922,
29900,
29889,
29896,
29892,
321,
567,
29918,
3317,
29922,
29896,
1696,
3579,
19290,
1125,
13,
4706,
9995,
13463,
6703,
10272,
278,
13114,
22786,
362,
5181,
304,
1207,
278,
770,
18988,
1735,
29889,
22303,
746,
278,
13,
4706,
937,
19901,
27521,
1342,
471,
1476,
29889,
13,
13,
4706,
584,
3207,
921,
29901,
319,
12983,
363,
278,
1881,
29889,
13,
4706,
584,
1853,
921,
29901,
421,
13264,
29889,
22150,
7694,
29952,
13,
4706,
584,
3207,
921,
29918,
791,
29901,
530,
1409,
411,
278,
2441,
10970,
29889,
13,
4706,
584,
1853,
921,
29918,
791,
29901,
421,
9302,
29889,
299,
2378,
29952,
13,
4706,
584,
3207,
321,
567,
29918,
10568,
29901,
450,
7910,
297,
278,
22786,
362,
363,
1269,
12541,
13,
4706,
584,
1853,
321,
567,
29918,
10568,
29901,
421,
7411,
29952,
13,
4706,
584,
3207,
321,
567,
29918,
3317,
29901,
450,
7472,
9259,
22786,
362,
13,
4706,
584,
1853,
321,
567,
29918,
3317,
29901,
421,
7411,
29952,
13,
4706,
584,
3207,
9049,
5085,
29901,
5901,
4128,
304,
3638,
304,
421,
17158,
29918,
4262,
29952,
13,
4706,
584,
1853,
9049,
5085,
29901,
421,
8977,
29952,
13,
4706,
584,
2457,
29901,
530,
1409,
13587,
278,
19901,
27521,
6455,
29889,
13,
4706,
584,
29878,
1853,
29901,
421,
9302,
29889,
299,
2378,
29952,
13,
4706,
9995,
13,
4706,
413,
29889,
842,
29918,
21891,
29918,
21646,
29898,
29900,
29897,
13,
4706,
343,
353,
7442,
29889,
1191,
3317,
29898,
1311,
29889,
4299,
29889,
27711,
29898,
29916,
29918,
791,
511,
29871,
29896,
29897,
13,
4706,
3061,
29918,
29916,
353,
921,
29918,
791,
29889,
8552,
580,
13,
13,
4706,
16256,
29918,
2248,
267,
353,
7442,
29889,
279,
927,
29898,
2435,
29898,
17263,
29918,
29916,
876,
13,
4706,
321,
567,
353,
15886,
29889,
27074,
29898,
13264,
29889,
7411,
29941,
29906,
29892,
6213,
29897,
13,
4706,
3061,
29918,
29916,
29918,
459,
353,
1583,
29889,
17158,
29918,
4262,
29898,
29916,
29892,
321,
567,
29892,
3579,
19290,
29897,
13,
4706,
3061,
29918,
29891,
353,
15886,
29889,
1191,
3317,
29898,
1311,
29889,
4299,
29898,
17263,
29918,
29916,
29918,
459,
511,
29871,
29896,
29897,
13,
4706,
321,
567,
29918,
791,
353,
321,
567,
29918,
10568,
13,
13,
4706,
1550,
7431,
29898,
21962,
29918,
2248,
267,
29897,
2804,
29871,
29900,
322,
321,
567,
29918,
791,
5277,
321,
567,
29918,
3317,
29901,
13,
9651,
396,
2087,
874,
27521,
25554,
292,
13,
9651,
716,
29918,
17263,
29918,
29916,
29892,
716,
29918,
29891,
353,
1583,
29889,
29879,
404,
29889,
3389,
4197,
17263,
29918,
29916,
29918,
459,
29892,
3061,
29918,
29891,
1402,
426,
29916,
29901,
921,
29918,
791,
29961,
21962,
29918,
2248,
267,
1402,
321,
567,
29901,
321,
567,
29918,
791,
1800,
13,
13,
9651,
396,
10318,
13,
9651,
3061,
29918,
29916,
29961,
21962,
29918,
2248,
267,
29962,
353,
716,
29918,
17263,
29918,
29916,
13,
9651,
16256,
29918,
2248,
267,
353,
7442,
29889,
3062,
29898,
29891,
29961,
21962,
29918,
2248,
267,
29962,
1275,
716,
29918,
29891,
9601,
29900,
29962,
13,
9651,
321,
567,
29918,
791,
4619,
321,
567,
29918,
10568,
13,
13,
4706,
736,
3061,
29918,
29916,
13,
13,
1678,
822,
5706,
29898,
1311,
29892,
921,
29918,
791,
29892,
3579,
19290,
1125,
13,
4706,
9995,
5631,
403,
19901,
27521,
11916,
322,
736,
963,
297,
385,
1409,
29889,
13,
13,
4706,
584,
3207,
921,
29918,
791,
29901,
530,
1409,
411,
278,
2441,
10970,
29889,
13,
4706,
584,
1853,
921,
29918,
791,
29901,
421,
9302,
29889,
299,
2378,
29952,
13,
4706,
584,
3207,
321,
567,
29901,
6212,
547,
4331,
2159,
313,
2080,
19262,
29897,
13,
4706,
584,
1853,
321,
567,
29901,
421,
7411,
29952,
13,
4706,
584,
3207,
4356,
29901,
8170,
310,
278,
6056,
313,
29885,
326,
1199,
11848,
2272,
467,
20049,
1819,
29901,
7442,
29889,
7192,
29892,
29871,
29896,
470,
29871,
29906,
29889,
13,
4706,
584,
1853,
4356,
29901,
421,
524,
29952,
13,
4706,
584,
3207,
343,
29901,
319,
12983,
363,
278,
1904,
11073,
29889,
9333,
3867,
445,
3443,
565,
366,
29915,
29881,
763,
304,
671,
1565,
13,
462,
29871,
11073,
746,
25554,
292,
19901,
27521,
11916,
29889,
13466,
29892,
1904,
27303,
526,
1304,
408,
11073,
304,
4772,
278,
13,
462,
29871,
376,
1643,
454,
5086,
29908,
2779,
313,
4548,
433,
1312,
297,
445,
5650,
29901,
2045,
597,
279,
26560,
29889,
990,
29914,
6897,
29914,
29896,
29953,
29896,
29896,
29889,
29900,
29896,
29906,
29941,
29953,
467,
13109,
338,
6213,
29889,
13,
462,
29871,
15796,
29879,
881,
367,
697,
29899,
8711,
29899,
26716,
29889,
13,
4706,
584,
1853,
343,
29901,
421,
9302,
29889,
299,
2378,
29952,
13,
4706,
584,
3207,
20102,
29918,
1195,
29901,
3080,
12539,
1881,
4163,
995,
29889,
13,
4706,
584,
1853,
20102,
29918,
1195,
29901,
421,
7411,
29952,
13,
4706,
584,
3207,
20102,
29918,
3317,
29901,
5918,
12539,
1881,
4163,
995,
29889,
13,
4706,
584,
1853,
20102,
29918,
3317,
29901,
421,
7411,
29952,
13,
4706,
584,
2457,
29901,
530,
1409,
13587,
278,
19901,
27521,
6455,
29889,
13,
4706,
584,
29878,
1853,
29901,
421,
9302,
29889,
299,
2378,
29952,
13,
4706,
9995,
13,
13,
4706,
1881,
29918,
12181,
353,
518,
8516,
29962,
718,
1051,
29898,
29916,
29918,
791,
29889,
12181,
29961,
29896,
29901,
2314,
13,
4706,
1583,
3032,
29916,
353,
15886,
29889,
27074,
29898,
13264,
29889,
7411,
29941,
29906,
29892,
8267,
29922,
2080,
29918,
12181,
29897,
13,
4706,
413,
29889,
842,
29918,
21891,
29918,
21646,
29898,
29900,
29897,
13,
13,
4706,
396,
7106,
19901,
27521,
6455,
15712,
411,
13114,
22786,
362,
565,
2984,
338,
6136,
13,
4706,
565,
376,
1195,
3039,
29908,
297,
9049,
5085,
322,
9049,
5085,
3366,
1195,
3039,
3108,
29901,
13,
9651,
736,
1583,
29889,
1195,
3039,
29918,
10700,
9265,
800,
29898,
1311,
3032,
29916,
29892,
921,
29918,
791,
29892,
3579,
19290,
29897,
13,
13,
4706,
396,
3251,
403,
16287,
3983,
13,
4706,
321,
567,
353,
15886,
29889,
27074,
29898,
13264,
29889,
7411,
29941,
29906,
29892,
6213,
29897,
13,
4706,
1583,
3032,
29916,
29918,
17263,
353,
1583,
29889,
17158,
29918,
4262,
29898,
1311,
3032,
29916,
29892,
321,
567,
29892,
3579,
19290,
29897,
13,
13,
4706,
396,
7525,
5829,
293,
3983,
1728,
470,
411,
1565,
11073,
13,
4706,
565,
525,
29891,
29918,
791,
29915,
451,
297,
9049,
5085,
470,
9049,
5085,
1839,
29891,
29918,
791,
2033,
338,
6213,
29901,
13,
9651,
8343,
29918,
8977,
353,
426,
1311,
3032,
29916,
29901,
921,
29918,
791,
29892,
321,
567,
29901,
1583,
29889,
8961,
29913,
13,
4706,
1683,
29901,
13,
9651,
396,
1798,
1598,
3858,
12983,
471,
2183,
297,
8636,
565,
773,
1565,
11073,
13,
9651,
565,
1583,
29889,
29891,
338,
6213,
29901,
13,
18884,
12020,
8960,
703,
5574,
11073,
2183,
541,
3858,
12983,
451,
2183,
23157,
13,
9651,
8343,
29918,
8977,
353,
426,
1311,
3032,
29916,
29901,
921,
29918,
791,
29892,
1583,
29889,
29891,
29901,
9049,
5085,
1839,
29891,
29918,
791,
7464,
321,
567,
29901,
1583,
29889,
8961,
29913,
13,
13,
4706,
736,
1583,
29889,
29879,
404,
29889,
3389,
29898,
1311,
3032,
29916,
29918,
17263,
29892,
8343,
29918,
8977,
29922,
18798,
29918,
8977,
29897,
13,
13,
1678,
822,
731,
29918,
7529,
29898,
1311,
29892,
3579,
19290,
1125,
13,
4706,
9995,
26772,
297,
263,
8600,
310,
4128,
322,
16058,
5337,
29899,
14940,
12747,
13,
4706,
1434,
14238,
963,
408,
8393,
29889,
13,
13,
4706,
584,
3207,
4356,
29901,
8170,
310,
278,
6056,
29889,
20049,
1819,
29901,
7442,
29889,
7192,
29892,
29871,
29896,
470,
29871,
29906,
29889,
13,
4706,
584,
1853,
4356,
29901,
421,
524,
29952,
13,
4706,
584,
3207,
321,
567,
29901,
6212,
547,
4331,
2159,
313,
2080,
19262,
29897,
13,
4706,
584,
1853,
321,
567,
29901,
421,
7411,
29952,
13,
4706,
584,
3207,
343,
29901,
313,
25253,
29897,
319,
12983,
363,
278,
1904,
11073,
29889,
9333,
3867,
445,
3443,
565,
366,
29915,
29881,
763,
304,
671,
1565,
13,
462,
29871,
11073,
746,
25554,
292,
19901,
27521,
11916,
29889,
13466,
29892,
1904,
27303,
526,
1304,
408,
11073,
304,
4772,
278,
13,
462,
29871,
376,
1643,
454,
5086,
29908,
2779,
313,
4548,
433,
1312,
297,
445,
5650,
29901,
2045,
597,
279,
26560,
29889,
990,
29914,
6897,
29914,
29896,
29953,
29896,
29896,
29889,
29900,
29896,
29906,
29941,
29953,
467,
13109,
338,
6213,
29889,
13,
462,
29871,
15796,
29879,
881,
367,
697,
29899,
8711,
29899,
26716,
29889,
13,
4706,
584,
1853,
343,
29901,
421,
9302,
29889,
299,
2378,
29952,
13,
4706,
584,
3207,
3646,
287,
29901,
10575,
278,
5337,
3646,
697,
2702,
770,
13,
4706,
584,
1853,
3646,
287,
29901,
421,
11227,
29952,
13,
4706,
584,
3207,
20102,
29918,
1195,
29901,
3080,
12539,
1881,
4163,
995,
29889,
13,
4706,
584,
1853,
20102,
29918,
1195,
29901,
421,
7411,
29952,
13,
4706,
584,
3207,
20102,
29918,
3317,
29901,
5918,
12539,
1881,
4163,
995,
29889,
13,
4706,
584,
1853,
20102,
29918,
3317,
29901,
421,
7411,
29952,
13,
4706,
9995,
13,
4706,
396,
16913,
5337,
29899,
14940,
4128,
13,
4706,
2428,
29898,
29943,
579,
25584,
993,
4062,
29892,
1583,
467,
842,
29918,
7529,
29898,
1068,
19290,
29897,
13,
13,
4706,
396,
5399,
565,
1797,
310,
278,
6056,
338,
22691,
2183,
1857,
5314,
13,
4706,
565,
1583,
29889,
536,
451,
297,
518,
9302,
29889,
7192,
29892,
938,
29898,
29896,
511,
938,
29898,
29906,
4638,
29901,
13,
9651,
12020,
7865,
2392,
703,
29940,
555,
1797,
1818,
367,
2845,
7442,
29889,
7192,
29892,
29871,
29896,
29892,
470,
29871,
29906,
23157,
13,
13,
4706,
565,
1583,
29889,
24049,
29918,
1195,
338,
451,
6213,
322,
1583,
29889,
24049,
29918,
3317,
338,
451,
6213,
29901,
13,
9651,
565,
1583,
29889,
8961,
5277,
1583,
29889,
24049,
29918,
1195,
470,
1583,
29889,
8961,
1405,
1583,
29889,
24049,
29918,
3317,
29901,
13,
18884,
12020,
7865,
2392,
877,
1576,
5253,
310,
22786,
362,
756,
304,
367,
297,
278,
848,
3464,
29889,
1495,
13,
13,
4706,
736,
5852,
13,
2
] |
scripts/m2.py | byu-iot-security/cheeziot_webserver | 2 | 67220 | import pymongo
import os
import datetime
from base64 import decodestring
from bson.objectid import ObjectId
from pymongo import MongoClient
config_file = open("config", 'r')
collection = ''
database = ''
#Parse the configuration (config) file
for line in config_file:
field,val = line.split("=")
if(field == "COLLECTION"):
collection = val.rstrip()
elif(field == "DATABASE"):
database = val.rstrip()
print collection
print database
client = MongoClient('localhost', 27017)
# TODO: Only retrieve records with image data
# Assume that all records have an image, for now
# Get a hardcoded entry
# entry = client[database][collection].find_one({"_id": ObjectId("58a61687870a765994850d5a")})
# Sort from newest to oldest based on the kaa timestamp, and return the newest record
# For sorting nested fields, see http://stackoverflow.com/questions/12031507/mongodb-sorting-by-nested-object-value
entry = client[database][collection].find().sort("header.timestamp", pymongo.DESCENDING).limit(1)[0]
# Get the most recent image record according to _id
# The _id field will contain an implicit timestamp in it
# See http://stackoverflow.com/questions/4421207/mongodb-how-to-get-the-last-n-records
# entry = client[database][collection].find().sort("_id", pymongo.DESCENDING).limit(1)[0]
# NOTE: find_one() and find().limit(1) aren't perfectly interchangeable
# See http://dba.stackexchange.com/questions/7573/difference-between-mongodbs-find-and-findone-calls
# # Other tests
# cursor = client[database][collection].find().sort("_id", pymongo.DESCENDING)
# cursor = client[database][collection].find()
# print cursor[0].get("_id")
print "-----------------------"
print entry.get("_id")
person_name = entry.get("event").get("person_name")
if person_name:
name = person_name.rstrip()
else:
name = "?"
if os.path.isfile("public/faces.html"):
os.remove("public/faces.html")
#construct the faces.html page to be served to a client.
last_seen = open("public/faces.html", "w")
last_seen.write("<!doctype html>\n")
last_seen.write(" <head>\n")
last_seen.write(" <title>Faces of the Clyde</title>\n")
last_seen.write(" </head>\n")
last_seen.write(" <body>\n")
last_seen.write(" <img src=\"images/faces.png\">\n")
last_seen.write(" <div>\n")
last_seen.write(" <img src=\"images/test_out.bmp\" width=\"200\" height=\"200\">\n")
name_string = " <font size = \"6\" face=\"Courier New\">" + name + "</b>\n"
last_seen.write(" </div>\n")
last_seen.write(" <div>\n")
last_seen.write(name_string)
last_seen.write(" </div>\n")
last_seen.write(" </body>\n")
last_seen.write("</html>\n")
last_seen.close()
raw_image_data = entry.get("event").get("image_data")
#if test_out.bmp already exists, delete it
if os.path.isfile("public/images/test_out.bmp"):
os.remove("public/images/test_out.bmp")
f = file("public/images/test_out.bmp", "wb")
for i in raw_image_data:
f.write(decodestring(i))
| [
1,
1053,
282,
962,
7443,
13,
5215,
2897,
13,
5215,
12865,
13,
3166,
2967,
29953,
29946,
1053,
1602,
397,
342,
5393,
13,
13,
3166,
289,
1100,
29889,
3318,
333,
1053,
4669,
1204,
13,
13,
3166,
282,
962,
7443,
1053,
18294,
4032,
13,
13,
2917,
29918,
1445,
353,
1722,
703,
2917,
613,
525,
29878,
1495,
13,
13,
10855,
353,
6629,
13,
9803,
353,
6629,
13,
13,
29937,
12914,
278,
5285,
313,
2917,
29897,
934,
13,
1454,
1196,
297,
2295,
29918,
1445,
29901,
13,
12,
2671,
29892,
791,
353,
1196,
29889,
5451,
703,
543,
29897,
13,
12,
361,
29898,
2671,
1275,
376,
15032,
3281,
2725,
29908,
1125,
13,
12,
12,
10855,
353,
659,
29889,
29878,
17010,
580,
13,
12,
23681,
29898,
2671,
1275,
376,
25832,
27982,
29908,
1125,
13,
12,
12,
9803,
353,
659,
29889,
29878,
17010,
580,
13,
13,
2158,
4333,
13,
2158,
2566,
13,
13,
13,
4645,
353,
18294,
4032,
877,
7640,
742,
29871,
29906,
29955,
29900,
29896,
29955,
29897,
13,
13,
29937,
14402,
29901,
9333,
10563,
6475,
411,
1967,
848,
13,
29937,
22680,
393,
599,
6475,
505,
385,
1967,
29892,
363,
1286,
13,
13,
13,
13,
29937,
3617,
263,
2898,
29659,
6251,
13,
29937,
6251,
353,
3132,
29961,
9803,
3816,
10855,
1822,
2886,
29918,
650,
3319,
29908,
29918,
333,
1115,
4669,
1204,
703,
29945,
29947,
29874,
29953,
29896,
29953,
29947,
29955,
29947,
29955,
29900,
29874,
29955,
29953,
29945,
29929,
29929,
29946,
29947,
29945,
29900,
29881,
29945,
29874,
1159,
1800,
13,
13,
29937,
20025,
515,
716,
342,
304,
23947,
2729,
373,
278,
413,
7340,
14334,
29892,
322,
736,
278,
716,
342,
2407,
13,
29937,
1152,
16548,
9322,
4235,
29892,
1074,
1732,
597,
2417,
29889,
510,
29914,
2619,
29914,
29896,
29906,
29900,
29941,
29896,
29945,
29900,
29955,
29914,
23264,
29899,
6605,
292,
29899,
1609,
29899,
27420,
29899,
3318,
29899,
1767,
13,
8269,
353,
3132,
29961,
9803,
3816,
10855,
1822,
2886,
2141,
6605,
703,
6672,
29889,
16394,
613,
282,
962,
7443,
29889,
2287,
7187,
11794,
4214,
467,
13400,
29898,
29896,
9601,
29900,
29962,
13,
13,
29937,
3617,
278,
1556,
7786,
1967,
2407,
5034,
304,
903,
333,
13,
29937,
450,
903,
333,
1746,
674,
1712,
385,
12235,
14334,
297,
372,
13,
29937,
2823,
1732,
597,
2417,
29889,
510,
29914,
2619,
29914,
29946,
29946,
29906,
29896,
29906,
29900,
29955,
29914,
23264,
29899,
3525,
29899,
517,
29899,
657,
29899,
1552,
29899,
4230,
29899,
29876,
29899,
3757,
4339,
13,
29937,
6251,
353,
3132,
29961,
9803,
3816,
10855,
1822,
2886,
2141,
6605,
703,
29918,
333,
613,
282,
962,
7443,
29889,
2287,
7187,
11794,
4214,
467,
13400,
29898,
29896,
9601,
29900,
29962,
13,
13,
29937,
6058,
29923,
29901,
1284,
29918,
650,
580,
322,
1284,
2141,
13400,
29898,
29896,
29897,
9455,
29915,
29873,
7970,
1006,
3167,
519,
13,
29937,
2823,
1732,
597,
29881,
2291,
29889,
7041,
29889,
510,
29914,
2619,
29914,
29955,
29945,
29955,
29941,
29914,
29881,
17678,
29899,
14811,
29899,
29885,
549,
397,
5824,
29899,
2886,
29899,
392,
29899,
2886,
650,
29899,
29883,
4293,
13,
13,
29937,
396,
5901,
6987,
13,
29937,
10677,
353,
3132,
29961,
9803,
3816,
10855,
1822,
2886,
2141,
6605,
703,
29918,
333,
613,
282,
962,
7443,
29889,
2287,
7187,
11794,
4214,
29897,
13,
29937,
10677,
353,
3132,
29961,
9803,
3816,
10855,
1822,
2886,
580,
13,
29937,
1596,
10677,
29961,
29900,
1822,
657,
703,
29918,
333,
1159,
13,
13,
13,
2158,
376,
2683,
26589,
29908,
13,
2158,
6251,
29889,
657,
703,
29918,
333,
1159,
13,
13,
10532,
29918,
978,
353,
6251,
29889,
657,
703,
3696,
2564,
657,
703,
10532,
29918,
978,
1159,
13,
361,
2022,
29918,
978,
29901,
13,
1678,
1024,
353,
2022,
29918,
978,
29889,
29878,
17010,
580,
13,
2870,
29901,
13,
1678,
1024,
353,
376,
3026,
13,
13,
361,
2897,
29889,
2084,
29889,
275,
1445,
703,
3597,
29914,
8726,
29889,
1420,
29908,
1125,
13,
12,
359,
29889,
5992,
703,
3597,
29914,
8726,
29889,
1420,
1159,
13,
13,
29937,
11433,
278,
17240,
29889,
1420,
1813,
304,
367,
6766,
304,
263,
3132,
29889,
13,
4230,
29918,
28026,
353,
1722,
703,
3597,
29914,
8726,
29889,
1420,
613,
376,
29893,
1159,
13,
4230,
29918,
28026,
29889,
3539,
28945,
29991,
1867,
312,
668,
3472,
14247,
29876,
1159,
13,
4230,
29918,
28026,
29889,
3539,
703,
29871,
529,
2813,
14247,
29876,
1159,
13,
4230,
29918,
28026,
29889,
3539,
703,
1678,
529,
3257,
29958,
29943,
3302,
310,
278,
315,
368,
311,
829,
3257,
14247,
29876,
1159,
13,
4230,
29918,
28026,
29889,
3539,
703,
29871,
1533,
2813,
14247,
29876,
1159,
13,
4230,
29918,
28026,
29889,
3539,
703,
29871,
529,
2587,
14247,
29876,
1159,
13,
4230,
29918,
28026,
29889,
3539,
703,
1678,
529,
2492,
4765,
14672,
8346,
29914,
8726,
29889,
2732,
29905,
1013,
29905,
29876,
1159,
13,
4230,
29918,
28026,
29889,
3539,
703,
1678,
529,
4563,
14247,
29876,
1159,
13,
4230,
29918,
28026,
29889,
3539,
703,
418,
529,
2492,
4765,
14672,
8346,
29914,
1688,
29918,
449,
29889,
29890,
1526,
5931,
2920,
14672,
29906,
29900,
29900,
5931,
3171,
14672,
29906,
29900,
29900,
29905,
1013,
29905,
29876,
1159,
13,
978,
29918,
1807,
353,
259,
376,
418,
529,
5657,
2159,
353,
13218,
29953,
5931,
3700,
14672,
29907,
283,
4336,
1570,
29905,
1013,
29908,
718,
1024,
718,
25225,
29890,
14247,
29876,
29908,
13,
4230,
29918,
28026,
29889,
3539,
703,
1678,
1533,
4563,
14247,
29876,
1159,
13,
4230,
29918,
28026,
29889,
3539,
703,
1678,
529,
4563,
14247,
29876,
1159,
13,
4230,
29918,
28026,
29889,
3539,
29898,
978,
29918,
1807,
29897,
13,
4230,
29918,
28026,
29889,
3539,
703,
1678,
1533,
4563,
14247,
29876,
1159,
13,
4230,
29918,
28026,
29889,
3539,
703,
29871,
1533,
2587,
14247,
29876,
1159,
13,
4230,
29918,
28026,
29889,
3539,
703,
829,
1420,
14247,
29876,
1159,
13,
4230,
29918,
28026,
29889,
5358,
580,
13,
13,
13,
1610,
29918,
3027,
29918,
1272,
353,
6251,
29889,
657,
703,
3696,
2564,
657,
703,
3027,
29918,
1272,
1159,
13,
13,
29937,
361,
1243,
29918,
449,
29889,
29890,
1526,
2307,
4864,
29892,
5217,
372,
13,
361,
2897,
29889,
2084,
29889,
275,
1445,
703,
3597,
29914,
8346,
29914,
1688,
29918,
449,
29889,
29890,
1526,
29908,
1125,
13,
12,
359,
29889,
5992,
703,
3597,
29914,
8346,
29914,
1688,
29918,
449,
29889,
29890,
1526,
1159,
13,
13,
29888,
353,
934,
703,
3597,
29914,
8346,
29914,
1688,
29918,
449,
29889,
29890,
1526,
613,
376,
29893,
29890,
1159,
13,
1454,
474,
297,
10650,
29918,
3027,
29918,
1272,
29901,
13,
12,
29888,
29889,
3539,
29898,
7099,
397,
342,
5393,
29898,
29875,
876,
13,
13,
2
] |
examples/python/EventBuilder.py | jstrube/lcio | 0 | 132809 | <filename>examples/python/EventBuilder.py
'''
Created on May 17, 2013
Example for creating LCIO events and filling them with MCParticles and SimTrackerHits.
@author: <a href="mailto:<EMAIL>"><NAME></a>
'''
from pyLCIO import EVENT, IMPL, IOIMPL, UTIL
from ROOT import TVector3, TLorentzVector, TRandom3, TMath
from time import time
import sys, math
def generateEvents( outputFileName, nEvents ):
random = TRandom3( 12345 )
# define a particle source
sourcePosition = TVector3( 0., 0., 0. )
sourceSpreadXY = 10.
pdgid = 13
charge = -1.
mass = 0.105658
momentum = TVector3( 0.3, 0.1, 10. )
runNumber = 321
# define a detector with positions for the tracker planes
detectorName = 'ToyTracker'
trackerPlanePositions = []
hitResolution = 0.01
planeNormal = TVector3( 0., 0., 1. )
for planeZ in [ 100., 250., 480., 510., 640. ]:
trackerPlanePositions.append( TVector3( 0., 0., planeZ ) )
# create a writer and open the output file
writer = IOIMPL.LCFactory.getInstance().createLCWriter()
writer.open( outputFileName, EVENT.LCIO.WRITE_NEW )
# create a run header and add it to the file (optional)
run = IMPL.LCRunHeaderImpl()
run.setRunNumber( runNumber )
run.setDetectorName( detectorName )
run.setDescription( 'This is a test run' )
writer.writeRunHeader( run )
for iEvent in xrange( nEvents ):
# create an event and set its parameters
event = IMPL.LCEventImpl()
event.setEventNumber( iEvent )
event.setDetectorName( detectorName )
event.setRunNumber( runNumber )
event.setTimeStamp( int( time() * 1000000000. ) )
# create the mc particle collection
mcParticles = IMPL.LCCollectionVec( EVENT.LCIO.MCPARTICLE )
# calculate the origin of the particle
x = random.Gaus( sourcePosition.x(), sourceSpreadXY )
y = random.Gaus( sourcePosition.y(), sourceSpreadXY )
z = sourcePosition.z()
origin = TVector3( x, y, z )
# create a particle
mcParticle = IMPL.MCParticleImpl()
mcParticle.setPDG( pdgid )
mcParticle.setMass( mass )
mcParticle.setMomentumVec( momentum )
mcParticle.setGeneratorStatus( 1 )
mcParticle.setVertexVec( origin )
mcParticle.setTime( 0. )
mcParticles.addElement( mcParticle )
# create a tracker hit collection
trackerHits = IMPL.LCCollectionVec( EVENT.LCIO.SIMTRACKERHIT )
trackerHits.setFlag( UTIL.set_bit( trackerHits.getFlag(), EVENT.LCIO.THBIT_MOMENTUM ) )
# create an IDEncoder to store hit IDs
# defines the tags and the number of bits for the different bit fields
encodingString = 'system:3,layer:6'
idEncoder = UTIL.CellIDEncoder( IMPL.SimTrackerHitImpl )( encodingString, trackerHits )
# add a hit for each layer
for planePosition in trackerPlanePositions:
# calculate the intersection with the plane
distance = ( planePosition - origin ).Dot( planeNormal ) / momentum.Dot( planeNormal )
intersect = TVector3( momentum )
intersect.SetMag( distance )
# smear the hit position with the resolution
hitX = random.Gaus( intersect.x(), hitResolution )
hitY = random.Gaus( intersect.x(), hitResolution )
hitPosition = TVector3( hitX, hitY, intersect.z() )
# build the tracker hit
trackerHit = IMPL.SimTrackerHitImpl()
trackerHit.setPositionVec( hitPosition )
trackerHit.setMomentumVec( momentum )
trackerHit.setMCParticle( mcParticle )
trackerHit.setTime( distance / TMath.C() )
trackerHit.setEDep( 0.1 )
# set the cell ID
idEncoder.reset()
idEncoder['layer'] = trackerPlanePositions.index( planePosition )
idEncoder['system'] = 1
idEncoder.setCellID( trackerHit )
trackerHits.addElement( trackerHit )
event.addCollection( mcParticles, EVENT.LCIO.MCPARTICLE )
event.addCollection( trackerHits, 'SimTrackerHits' )
writer.writeEvent( event )
writer.flush()
writer.close()
def usage():
print 'Generates an MCParticle with associated SimTrackerHits for each event'
print 'Usage:\n python %s <outputFile> <nEvents>' % ( sys.argv[0] )
if __name__ == '__main__':
if len( sys.argv ) < 3:
usage()
sys.exit( 1 )
generateEvents( sys.argv[1], int( sys.argv[2] ) )
| [
1,
529,
9507,
29958,
19057,
29914,
4691,
29914,
2624,
5627,
29889,
2272,
13,
12008,
13,
20399,
373,
2610,
29871,
29896,
29955,
29892,
29871,
29906,
29900,
29896,
29941,
13,
13,
14023,
363,
4969,
365,
29907,
5971,
4959,
322,
27523,
963,
411,
341,
6271,
18569,
322,
3439,
5323,
4937,
29950,
1169,
29889,
13,
13,
29992,
8921,
29901,
529,
29874,
2822,
543,
2549,
517,
29901,
29966,
26862,
6227,
29958,
3254,
5813,
2565,
29874,
29958,
13,
12008,
13,
13,
3166,
11451,
12182,
5971,
1053,
382,
29963,
3919,
29892,
306,
3580,
29931,
29892,
10663,
29902,
3580,
29931,
29892,
501,
29911,
6227,
13,
3166,
16641,
2891,
1053,
5648,
3019,
29941,
29892,
323,
29931,
272,
296,
29920,
12877,
29892,
10014,
2685,
29941,
29892,
323,
11309,
13,
3166,
931,
1053,
931,
13,
13,
5215,
10876,
29892,
5844,
13,
13,
1753,
5706,
13634,
29898,
1962,
17020,
29892,
302,
13634,
29871,
1125,
13,
268,
13,
1678,
4036,
353,
10014,
2685,
29941,
29898,
29871,
29896,
29906,
29941,
29946,
29945,
1723,
13,
268,
13,
1678,
396,
4529,
263,
16445,
2752,
13,
1678,
2752,
8003,
353,
5648,
3019,
29941,
29898,
29871,
29900,
1696,
29871,
29900,
1696,
29871,
29900,
29889,
1723,
13,
1678,
2752,
5592,
949,
18454,
353,
29871,
29896,
29900,
29889,
13,
1678,
10518,
29887,
333,
353,
29871,
29896,
29941,
13,
1678,
8323,
353,
448,
29896,
29889,
13,
1678,
4158,
353,
29871,
29900,
29889,
29896,
29900,
29945,
29953,
29945,
29947,
13,
1678,
19399,
353,
5648,
3019,
29941,
29898,
29871,
29900,
29889,
29941,
29892,
29871,
29900,
29889,
29896,
29892,
29871,
29896,
29900,
29889,
1723,
13,
1678,
1065,
4557,
353,
29871,
29941,
29906,
29896,
13,
268,
13,
1678,
396,
4529,
263,
1439,
3019,
411,
11909,
363,
278,
1020,
4937,
3814,
267,
13,
1678,
1439,
3019,
1170,
353,
525,
1762,
29891,
5323,
4937,
29915,
13,
1678,
1020,
4937,
3247,
1662,
9135,
2187,
353,
5159,
13,
1678,
7124,
12375,
918,
353,
29871,
29900,
29889,
29900,
29896,
13,
1678,
10694,
19077,
353,
5648,
3019,
29941,
29898,
29871,
29900,
1696,
29871,
29900,
1696,
29871,
29896,
29889,
1723,
13,
1678,
363,
10694,
29999,
297,
518,
29871,
29896,
29900,
29900,
1696,
29871,
29906,
29945,
29900,
1696,
29871,
29946,
29947,
29900,
1696,
29871,
29945,
29896,
29900,
1696,
29871,
29953,
29946,
29900,
29889,
4514,
29901,
13,
4706,
1020,
4937,
3247,
1662,
9135,
2187,
29889,
4397,
29898,
5648,
3019,
29941,
29898,
29871,
29900,
1696,
29871,
29900,
1696,
10694,
29999,
1723,
1723,
13,
268,
13,
1678,
396,
1653,
263,
9227,
322,
1722,
278,
1962,
934,
13,
1678,
9227,
353,
10663,
29902,
3580,
29931,
29889,
12182,
5126,
29889,
20958,
2141,
3258,
12182,
10507,
580,
13,
1678,
9227,
29889,
3150,
29898,
1962,
17020,
29892,
382,
29963,
3919,
29889,
12182,
5971,
29889,
16365,
29918,
28577,
1723,
13,
268,
13,
1678,
396,
1653,
263,
1065,
4839,
322,
788,
372,
304,
278,
934,
313,
25253,
29897,
13,
1678,
1065,
353,
306,
3580,
29931,
29889,
12182,
6558,
7850,
6647,
580,
13,
1678,
1065,
29889,
842,
6558,
4557,
29898,
1065,
4557,
1723,
13,
1678,
1065,
29889,
842,
6362,
3019,
1170,
29898,
1439,
3019,
1170,
1723,
13,
1678,
1065,
29889,
842,
9868,
29898,
525,
4013,
338,
263,
1243,
1065,
29915,
1723,
13,
1678,
9227,
29889,
3539,
6558,
7850,
29898,
1065,
1723,
13,
268,
13,
1678,
363,
474,
2624,
297,
921,
3881,
29898,
302,
13634,
29871,
1125,
13,
308,
13,
4706,
396,
1653,
385,
1741,
322,
731,
967,
4128,
13,
4706,
1741,
353,
306,
3580,
29931,
29889,
12182,
2624,
6647,
580,
13,
4706,
1741,
29889,
842,
2624,
4557,
29898,
474,
2624,
1723,
13,
4706,
1741,
29889,
842,
6362,
3019,
1170,
29898,
1439,
3019,
1170,
1723,
13,
4706,
1741,
29889,
842,
6558,
4557,
29898,
1065,
4557,
1723,
13,
4706,
1741,
29889,
842,
2481,
855,
1160,
29898,
938,
29898,
931,
580,
334,
29871,
29896,
29900,
29900,
29900,
29900,
29900,
29900,
29900,
29900,
29900,
29889,
1723,
1723,
13,
308,
13,
4706,
396,
1653,
278,
286,
29883,
16445,
4333,
13,
4706,
286,
29883,
7439,
4027,
353,
306,
3580,
29931,
29889,
12182,
7196,
25987,
29898,
382,
29963,
3919,
29889,
12182,
5971,
29889,
29924,
6271,
8322,
2965,
1307,
1723,
13,
308,
13,
4706,
396,
8147,
278,
3978,
310,
278,
16445,
13,
4706,
921,
353,
4036,
29889,
29954,
1485,
29898,
2752,
8003,
29889,
29916,
3285,
2752,
5592,
949,
18454,
1723,
13,
4706,
343,
353,
4036,
29889,
29954,
1485,
29898,
2752,
8003,
29889,
29891,
3285,
2752,
5592,
949,
18454,
1723,
13,
4706,
503,
353,
2752,
8003,
29889,
29920,
580,
13,
4706,
3978,
353,
5648,
3019,
29941,
29898,
921,
29892,
343,
29892,
503,
1723,
13,
308,
13,
4706,
396,
1653,
263,
16445,
13,
4706,
286,
29883,
7439,
2512,
353,
306,
3580,
29931,
29889,
29924,
6271,
7914,
6647,
580,
13,
4706,
286,
29883,
7439,
2512,
29889,
842,
25014,
29954,
29898,
10518,
29887,
333,
1723,
13,
4706,
286,
29883,
7439,
2512,
29889,
842,
29924,
465,
29898,
4158,
1723,
13,
4706,
286,
29883,
7439,
2512,
29889,
842,
29924,
2932,
398,
25987,
29898,
19399,
1723,
13,
4706,
286,
29883,
7439,
2512,
29889,
842,
21575,
5709,
29898,
29871,
29896,
1723,
13,
4706,
286,
29883,
7439,
2512,
29889,
842,
22479,
25987,
29898,
3978,
1723,
13,
4706,
286,
29883,
7439,
2512,
29889,
842,
2481,
29898,
29871,
29900,
29889,
1723,
13,
4706,
286,
29883,
7439,
4027,
29889,
1202,
2642,
29898,
286,
29883,
7439,
2512,
1723,
13,
308,
13,
4706,
396,
1653,
263,
1020,
4937,
7124,
4333,
13,
4706,
1020,
4937,
29950,
1169,
353,
306,
3580,
29931,
29889,
12182,
7196,
25987,
29898,
382,
29963,
3919,
29889,
12182,
5971,
29889,
5425,
29924,
5659,
11375,
1001,
29950,
1806,
1723,
13,
4706,
1020,
4937,
29950,
1169,
29889,
842,
21979,
29898,
501,
29911,
6227,
29889,
842,
29918,
2966,
29898,
1020,
4937,
29950,
1169,
29889,
657,
21979,
3285,
382,
29963,
3919,
29889,
12182,
5971,
29889,
4690,
22698,
29918,
29924,
6488,
3919,
5005,
1723,
1723,
13,
308,
13,
4706,
396,
1653,
385,
15004,
17608,
6119,
304,
3787,
7124,
23481,
13,
4706,
396,
17645,
278,
8282,
322,
278,
1353,
310,
9978,
363,
278,
1422,
2586,
4235,
13,
4706,
8025,
1231,
353,
525,
5205,
29901,
29941,
29892,
13148,
29901,
29953,
29915,
13,
4706,
1178,
8566,
6119,
353,
501,
29911,
6227,
29889,
4617,
1367,
8566,
6119,
29898,
306,
3580,
29931,
29889,
8942,
5323,
4937,
29950,
277,
6647,
1723,
29898,
8025,
1231,
29892,
1020,
4937,
29950,
1169,
1723,
13,
308,
13,
4706,
396,
788,
263,
7124,
363,
1269,
7546,
13,
4706,
363,
10694,
8003,
297,
1020,
4937,
3247,
1662,
9135,
2187,
29901,
13,
9651,
396,
8147,
278,
17686,
411,
278,
10694,
13,
9651,
5418,
353,
313,
10694,
8003,
448,
3978,
13742,
29928,
327,
29898,
10694,
19077,
1723,
847,
19399,
29889,
29928,
327,
29898,
10694,
19077,
1723,
13,
9651,
25869,
353,
5648,
3019,
29941,
29898,
19399,
1723,
13,
9651,
25869,
29889,
2697,
19095,
29898,
5418,
1723,
13,
13,
9651,
396,
1560,
799,
278,
7124,
2602,
411,
278,
10104,
632,
13,
9651,
7124,
29990,
353,
4036,
29889,
29954,
1485,
29898,
25869,
29889,
29916,
3285,
7124,
12375,
918,
1723,
13,
9651,
7124,
29979,
353,
4036,
29889,
29954,
1485,
29898,
25869,
29889,
29916,
3285,
7124,
12375,
918,
1723,
13,
9651,
7124,
8003,
353,
5648,
3019,
29941,
29898,
7124,
29990,
29892,
7124,
29979,
29892,
25869,
29889,
29920,
580,
1723,
13,
632,
13,
9651,
396,
2048,
278,
1020,
4937,
7124,
13,
9651,
1020,
4937,
29950,
277,
353,
306,
3580,
29931,
29889,
8942,
5323,
4937,
29950,
277,
6647,
580,
13,
9651,
1020,
4937,
29950,
277,
29889,
842,
8003,
25987,
29898,
7124,
8003,
1723,
13,
9651,
1020,
4937,
29950,
277,
29889,
842,
29924,
2932,
398,
25987,
29898,
19399,
1723,
13,
9651,
1020,
4937,
29950,
277,
29889,
842,
29924,
6271,
7914,
29898,
286,
29883,
7439,
2512,
1723,
13,
9651,
1020,
4937,
29950,
277,
29889,
842,
2481,
29898,
5418,
847,
323,
11309,
29889,
29907,
580,
1723,
13,
9651,
1020,
4937,
29950,
277,
29889,
842,
3352,
1022,
29898,
29871,
29900,
29889,
29896,
1723,
13,
632,
13,
9651,
396,
731,
278,
3038,
3553,
13,
9651,
1178,
8566,
6119,
29889,
12071,
580,
13,
9651,
1178,
8566,
6119,
1839,
13148,
2033,
353,
1020,
4937,
3247,
1662,
9135,
2187,
29889,
2248,
29898,
10694,
8003,
1723,
13,
9651,
1178,
8566,
6119,
1839,
5205,
2033,
353,
29871,
29896,
13,
9651,
1178,
8566,
6119,
29889,
842,
4617,
1367,
29898,
1020,
4937,
29950,
277,
1723,
13,
632,
13,
9651,
1020,
4937,
29950,
1169,
29889,
1202,
2642,
29898,
1020,
4937,
29950,
277,
1723,
13,
308,
13,
4706,
1741,
29889,
1202,
7196,
29898,
286,
29883,
7439,
4027,
29892,
382,
29963,
3919,
29889,
12182,
5971,
29889,
29924,
6271,
8322,
2965,
1307,
1723,
13,
4706,
1741,
29889,
1202,
7196,
29898,
1020,
4937,
29950,
1169,
29892,
525,
8942,
5323,
4937,
29950,
1169,
29915,
1723,
13,
308,
13,
4706,
9227,
29889,
3539,
2624,
29898,
1741,
1723,
13,
268,
13,
1678,
9227,
29889,
23126,
580,
13,
1678,
9227,
29889,
5358,
580,
13,
308,
13,
13,
1753,
8744,
7295,
13,
1678,
1596,
525,
5631,
1078,
385,
341,
6271,
7914,
411,
6942,
3439,
5323,
4937,
29950,
1169,
363,
1269,
1741,
29915,
13,
1678,
1596,
525,
27573,
3583,
29876,
29871,
3017,
1273,
29879,
529,
4905,
2283,
29958,
529,
29876,
13634,
16299,
1273,
313,
10876,
29889,
19218,
29961,
29900,
29962,
1723,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
565,
7431,
29898,
10876,
29889,
19218,
1723,
529,
29871,
29941,
29901,
13,
4706,
8744,
580,
13,
4706,
10876,
29889,
13322,
29898,
29871,
29896,
1723,
13,
1678,
5706,
13634,
29898,
10876,
29889,
19218,
29961,
29896,
1402,
938,
29898,
10876,
29889,
19218,
29961,
29906,
29962,
1723,
1723,
13,
2
] |
759/Employee Free Time.py | cccccccccccccc/Myleetcode | 0 | 20318 | <filename>759/Employee Free Time.py<gh_stars>0
from typing import List
import heapq
# Definition for an Interval.
class Interval:
def __init__(self, start: int = None, end: int = None):
self.start = start
self.end = end
class Solution:
def employeeFreeTime(self, schedule: '[[Interval]]') -> '[Interval]':
allinterval = []
heapq.heapify(allinterval)
ans = []
for i,e in enumerate(schedule):
heapq.heappush(allinterval,(e[0].start,e[0].end,i,0))
interval = Interval()
flag = False
freetime = []
while len(allinterval)>0:
cur = heapq.heappop(allinterval)
id = cur[2]
idx = cur[3]
if flag == False:
interval = Interval(cur[0],cur[1])
flag = True
else:
if cur[0]>interval.end:
freetime.append(Interval(interval.end,cur[0]))
interval.start = cur[0]
interval.end = cur[1]
else:
interval.end = max(interval.end,cur[1])
if len(schedule[id])-1>idx:
heapq.heappush(allinterval,(schedule[id][idx+1].start,schedule[id][idx+1].end,id,idx+1))
return freetime
i1 = Interval(1,2)
i2 = Interval(6,7)
i3 = Interval(2,4)
i4 = Interval(2,5)
i5 = Interval(9,12)
A = Solution()
print(A.employeeFreeTime([[i1,i2],[i3],[i4,i5]])) | [
1,
529,
9507,
29958,
29955,
29945,
29929,
29914,
19461,
12362,
5974,
29889,
2272,
29966,
12443,
29918,
303,
1503,
29958,
29900,
13,
3166,
19229,
1053,
2391,
13,
5215,
16947,
29939,
13,
29937,
21940,
363,
385,
4124,
791,
29889,
13,
1990,
4124,
791,
29901,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1369,
29901,
938,
353,
6213,
29892,
1095,
29901,
938,
353,
6213,
1125,
13,
4706,
1583,
29889,
2962,
353,
1369,
13,
4706,
1583,
29889,
355,
353,
1095,
13,
13,
13,
1990,
24380,
29901,
13,
1678,
822,
19001,
20475,
2481,
29898,
1311,
29892,
20410,
29901,
525,
8999,
12506,
5262,
1495,
1599,
525,
29961,
12506,
29962,
2396,
13,
4706,
599,
19207,
353,
5159,
13,
4706,
16947,
29939,
29889,
354,
481,
1598,
29898,
497,
19207,
29897,
13,
4706,
6063,
353,
5159,
13,
4706,
363,
474,
29892,
29872,
297,
26985,
29898,
816,
11272,
1125,
13,
9651,
16947,
29939,
29889,
354,
932,
1878,
29898,
497,
19207,
22657,
29872,
29961,
29900,
1822,
2962,
29892,
29872,
29961,
29900,
1822,
355,
29892,
29875,
29892,
29900,
876,
13,
4706,
7292,
353,
4124,
791,
580,
13,
4706,
7353,
353,
7700,
13,
4706,
3005,
5410,
353,
5159,
13,
4706,
1550,
7431,
29898,
497,
19207,
15410,
29900,
29901,
13,
9651,
3151,
353,
16947,
29939,
29889,
354,
932,
459,
29898,
497,
19207,
29897,
13,
9651,
1178,
353,
3151,
29961,
29906,
29962,
13,
9651,
22645,
353,
3151,
29961,
29941,
29962,
13,
9651,
565,
7353,
1275,
7700,
29901,
13,
18884,
7292,
353,
4124,
791,
29898,
2764,
29961,
29900,
1402,
2764,
29961,
29896,
2314,
13,
18884,
7353,
353,
5852,
13,
9651,
1683,
29901,
13,
18884,
565,
3151,
29961,
29900,
29962,
29958,
19207,
29889,
355,
29901,
13,
462,
1678,
3005,
5410,
29889,
4397,
29898,
12506,
29898,
19207,
29889,
355,
29892,
2764,
29961,
29900,
12622,
13,
462,
1678,
7292,
29889,
2962,
353,
3151,
29961,
29900,
29962,
13,
462,
1678,
7292,
29889,
355,
353,
3151,
29961,
29896,
29962,
13,
18884,
1683,
29901,
13,
462,
1678,
7292,
29889,
355,
353,
4236,
29898,
19207,
29889,
355,
29892,
2764,
29961,
29896,
2314,
13,
9651,
565,
7431,
29898,
816,
11272,
29961,
333,
2314,
29899,
29896,
29958,
13140,
29901,
13,
18884,
16947,
29939,
29889,
354,
932,
1878,
29898,
497,
19207,
22657,
816,
11272,
29961,
333,
3816,
13140,
29974,
29896,
1822,
2962,
29892,
816,
11272,
29961,
333,
3816,
13140,
29974,
29896,
1822,
355,
29892,
333,
29892,
13140,
29974,
29896,
876,
13,
4706,
736,
3005,
5410,
13,
13,
29875,
29896,
353,
4124,
791,
29898,
29896,
29892,
29906,
29897,
13,
29875,
29906,
353,
4124,
791,
29898,
29953,
29892,
29955,
29897,
13,
29875,
29941,
353,
4124,
791,
29898,
29906,
29892,
29946,
29897,
13,
29875,
29946,
353,
4124,
791,
29898,
29906,
29892,
29945,
29897,
13,
29875,
29945,
353,
4124,
791,
29898,
29929,
29892,
29896,
29906,
29897,
13,
29909,
353,
24380,
580,
13,
2158,
29898,
29909,
29889,
26143,
20475,
2481,
4197,
29961,
29875,
29896,
29892,
29875,
29906,
16272,
29875,
29941,
16272,
29875,
29946,
29892,
29875,
29945,
5262,
876,
2
] |
tests/data/Kind/Operations.py | aalireza/arep | 1 | 162098 | x = 1 + 2 * 3 - 3 ** 5 / 2
y = 3 ** 5 - 2
z = x / y
zz = x // y
z -= z
zz += zz
xx = -x
xx %= 10
if type(x) is int:
print(x and y)
| [
1,
921,
353,
29871,
29896,
718,
29871,
29906,
334,
29871,
29941,
448,
29871,
29941,
3579,
29871,
29945,
847,
29871,
29906,
13,
13,
29891,
353,
29871,
29941,
3579,
29871,
29945,
448,
29871,
29906,
13,
13,
29920,
353,
921,
847,
343,
13,
5617,
353,
921,
849,
343,
13,
13,
29920,
22361,
503,
13,
5617,
4619,
503,
29920,
13,
13,
4419,
353,
448,
29916,
13,
13,
4419,
1273,
29922,
29871,
29896,
29900,
13,
13,
361,
1134,
29898,
29916,
29897,
338,
938,
29901,
13,
1678,
1596,
29898,
29916,
322,
343,
29897,
13,
2
] |
voxel_globe/websockets/views.py | ngageoint/voxel-globe | 28 | 150204 | from django.shortcuts import render
### Rest API setup
import rest_framework.routers
import rest_framework.viewsets
import rest_framework.filters
from voxel_globe.websockets.serializers import LogMessageSerializer
from voxel_globe.websockets.models import LogMessage
router = rest_framework.routers.DefaultRouter()
class LogMessageViewSet(rest_framework.viewsets.ModelViewSet):
queryset = LogMessage.objects.all()
serializer_class = LogMessageSerializer
filter_backends = (rest_framework.filters.DjangoFilterBackend,)
filter_fields = ['message_text', 'message_type', 'task_id']
def get_queryset(self):
return super(LogMessageViewSet, self).get_queryset().filter(owner=self.request.user)
| [
1,
515,
9557,
29889,
12759,
7582,
29879,
1053,
4050,
13,
13,
2277,
29937,
11654,
3450,
6230,
13,
5215,
1791,
29918,
4468,
29889,
27537,
2153,
13,
5215,
1791,
29918,
4468,
29889,
1493,
7224,
13,
5215,
1791,
29918,
4468,
29889,
26705,
13,
3166,
992,
29916,
295,
29918,
29887,
417,
915,
29889,
2676,
578,
9737,
29889,
15550,
19427,
1053,
4522,
3728,
17679,
13,
3166,
992,
29916,
295,
29918,
29887,
417,
915,
29889,
2676,
578,
9737,
29889,
9794,
1053,
4522,
3728,
13,
13,
15140,
353,
1791,
29918,
4468,
29889,
27537,
2153,
29889,
4592,
23971,
580,
13,
13,
1990,
4522,
3728,
1043,
2697,
29898,
5060,
29918,
4468,
29889,
1493,
7224,
29889,
3195,
1043,
2697,
1125,
13,
29871,
2346,
842,
353,
4522,
3728,
29889,
12650,
29889,
497,
580,
13,
29871,
7797,
3950,
29918,
1990,
353,
4522,
3728,
17679,
13,
29871,
4175,
29918,
1627,
1975,
353,
313,
5060,
29918,
4468,
29889,
26705,
29889,
29928,
5364,
5072,
5841,
355,
29892,
29897,
13,
29871,
4175,
29918,
9621,
353,
6024,
4906,
29918,
726,
742,
525,
4906,
29918,
1853,
742,
525,
7662,
29918,
333,
2033,
13,
13,
29871,
822,
679,
29918,
1972,
842,
29898,
1311,
1125,
13,
1678,
736,
2428,
29898,
3403,
3728,
1043,
2697,
29892,
1583,
467,
657,
29918,
1972,
842,
2141,
4572,
29898,
20348,
29922,
1311,
29889,
3827,
29889,
1792,
29897,
13,
2
] |
twistedlilypad/packets/message_event_packet.py | flaminscotsman/TwistedLilypad | 1 | 60939 | <reponame>flaminscotsman/TwistedLilypad
from codecs import lookup
from struct import unpack_from, pack
from .abstract_packet import AbstractPacket, AbstractPacketCodec
from twistedlilypad.utilities import varint_prefixed_string_encoder, varint_prefixed_string_parser
utf8_decoder = lookup('UTF_8').decode
utf8_encoder = lookup('UTF_8').encode
class PacketMessageEvent(AbstractPacket):
opcode = 0x03
_message = None
def __init__(self, sender, channel, payload):
self.sender = sender
self.channel = channel
self.payload = payload
def __eq__(self, other):
if not isinstance(other, PacketMessageEvent):
return NotImplemented
return self.sender == other.sender and \
self.channel == other.channel and \
self.payload == other.payload
@property
def payloadSize(self):
return len(self.payload)
@property
def message(self):
if self._message is None:
self._message = utf8_decoder(self.payload)[0]
return self._message
@message.setter
def message(self, message):
self._message = message
self.payload = utf8_encoder(message)[0]
class PacketMessageEventCodec(AbstractPacketCodec):
@staticmethod
def encode(packet):
return varint_prefixed_string_encoder(packet.sender) + \
varint_prefixed_string_encoder(packet.channel) + \
pack('>H', packet.payloadSize) + \
packet.payload
@staticmethod
def decode(payload):
sender, payload = varint_prefixed_string_parser(payload)
channel, payload = varint_prefixed_string_parser(payload)
payloadSize = unpack_from('>H', payload)[0]
payload = payload[2:2 + payloadSize]
return PacketMessageEvent(sender, channel, payload)
| [
1,
529,
276,
1112,
420,
29958,
1579,
314,
1144,
29883,
1862,
1171,
29914,
27418,
12652,
29931,
309,
1478,
328,
13,
3166,
775,
2395,
1053,
16280,
13,
3166,
2281,
1053,
443,
4058,
29918,
3166,
29892,
4870,
13,
13,
3166,
869,
16595,
29918,
4058,
300,
1053,
25513,
16638,
300,
29892,
25513,
16638,
300,
3399,
29883,
13,
3166,
3252,
12652,
29880,
309,
1478,
328,
29889,
4422,
1907,
1053,
722,
524,
29918,
13506,
287,
29918,
1807,
29918,
3977,
6119,
29892,
722,
524,
29918,
13506,
287,
29918,
1807,
29918,
16680,
13,
13,
13,
9420,
29947,
29918,
7099,
6119,
353,
16280,
877,
10496,
29918,
29947,
2824,
13808,
13,
9420,
29947,
29918,
3977,
6119,
353,
16280,
877,
10496,
29918,
29947,
2824,
12508,
13,
13,
13,
1990,
18744,
300,
3728,
2624,
29898,
9118,
16638,
300,
1125,
13,
1678,
1015,
401,
353,
29871,
29900,
29916,
29900,
29941,
13,
1678,
903,
4906,
353,
6213,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
10004,
29892,
8242,
29892,
20092,
1125,
13,
4706,
1583,
29889,
15452,
353,
10004,
13,
4706,
1583,
29889,
12719,
353,
8242,
13,
4706,
1583,
29889,
23813,
353,
20092,
13,
13,
1678,
822,
4770,
1837,
12035,
1311,
29892,
916,
1125,
13,
4706,
565,
451,
338,
8758,
29898,
1228,
29892,
18744,
300,
3728,
2624,
1125,
13,
9651,
736,
2216,
1888,
2037,
287,
13,
4706,
736,
1583,
29889,
15452,
1275,
916,
29889,
15452,
322,
320,
13,
9651,
1583,
29889,
12719,
1275,
916,
29889,
12719,
322,
320,
13,
9651,
1583,
29889,
23813,
1275,
916,
29889,
23813,
13,
13,
1678,
732,
6799,
13,
1678,
822,
20092,
3505,
29898,
1311,
1125,
13,
4706,
736,
7431,
29898,
1311,
29889,
23813,
29897,
13,
13,
1678,
732,
6799,
13,
1678,
822,
2643,
29898,
1311,
1125,
13,
4706,
565,
1583,
3032,
4906,
338,
6213,
29901,
13,
9651,
1583,
3032,
4906,
353,
23616,
29947,
29918,
7099,
6119,
29898,
1311,
29889,
23813,
9601,
29900,
29962,
13,
4706,
736,
1583,
3032,
4906,
13,
13,
1678,
732,
4906,
29889,
842,
357,
13,
1678,
822,
2643,
29898,
1311,
29892,
2643,
1125,
13,
4706,
1583,
3032,
4906,
353,
2643,
13,
4706,
1583,
29889,
23813,
353,
23616,
29947,
29918,
3977,
6119,
29898,
4906,
9601,
29900,
29962,
13,
13,
13,
1990,
18744,
300,
3728,
2624,
3399,
29883,
29898,
9118,
16638,
300,
3399,
29883,
1125,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
19750,
29898,
4058,
300,
1125,
13,
4706,
736,
722,
524,
29918,
13506,
287,
29918,
1807,
29918,
3977,
6119,
29898,
4058,
300,
29889,
15452,
29897,
718,
320,
13,
1669,
722,
524,
29918,
13506,
287,
29918,
1807,
29918,
3977,
6119,
29898,
4058,
300,
29889,
12719,
29897,
718,
320,
13,
1669,
4870,
877,
29958,
29950,
742,
18203,
29889,
23813,
3505,
29897,
718,
320,
13,
1669,
18203,
29889,
23813,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
21822,
29898,
23813,
1125,
13,
4706,
10004,
29892,
20092,
353,
722,
524,
29918,
13506,
287,
29918,
1807,
29918,
16680,
29898,
23813,
29897,
13,
4706,
8242,
29892,
20092,
353,
722,
524,
29918,
13506,
287,
29918,
1807,
29918,
16680,
29898,
23813,
29897,
13,
4706,
20092,
3505,
353,
443,
4058,
29918,
3166,
877,
29958,
29950,
742,
20092,
9601,
29900,
29962,
13,
4706,
20092,
353,
20092,
29961,
29906,
29901,
29906,
718,
20092,
3505,
29962,
13,
13,
4706,
736,
18744,
300,
3728,
2624,
29898,
15452,
29892,
8242,
29892,
20092,
29897,
13,
2
] |
spiral.py | Shubhra1906/pyturtle | 0 | 133165 | <gh_stars>0
import turtle
import colorsys
t=turtle.Turtle()
s=turtle.Screen()
s.bgcolor('black')
t.speed(0)
n=36
h=0
for i in range(360):
c=colorsys.hsv_to_rgb(h, 1, 0.8)
h+=1/n
t.color(c)
t.circle(180)
t.left(10) | [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
5215,
260,
4227,
280,
13,
5215,
11955,
952,
13,
13,
29873,
29922,
29873,
4227,
280,
29889,
29911,
4227,
280,
580,
13,
29879,
29922,
29873,
4227,
280,
29889,
11357,
580,
13,
29879,
29889,
16264,
2780,
877,
8517,
1495,
13,
29873,
29889,
19322,
29898,
29900,
29897,
13,
29876,
29922,
29941,
29953,
13,
29882,
29922,
29900,
13,
1454,
474,
297,
3464,
29898,
29941,
29953,
29900,
1125,
13,
1678,
274,
29922,
27703,
952,
29889,
29882,
4501,
29918,
517,
29918,
23973,
29898,
29882,
29892,
29871,
29896,
29892,
29871,
29900,
29889,
29947,
29897,
13,
1678,
298,
23661,
29896,
29914,
29876,
13,
1678,
260,
29889,
2780,
29898,
29883,
29897,
13,
1678,
260,
29889,
16622,
29898,
29896,
29947,
29900,
29897,
13,
1678,
260,
29889,
1563,
29898,
29896,
29900,
29897,
2
] |
jj/middlewares/_base_middleware.py | TeoDV/jj | 0 | 92336 | from typing import Type, Union
from ..apps import AbstractApp
from ..handlers import HandlerFunction
from ._abstract_middleware import AbstractMiddleware
from ._middleware_type import MiddlewareType
__all__ = ("BaseMiddleware", "AppOrHandler",)
AppOrHandler = Union[Type[AbstractApp], HandlerFunction]
class BaseMiddleware(AbstractMiddleware):
def on_app(self, app: Type[AbstractApp]) -> None:
pass
def on_handler(self, handler: HandlerFunction) -> None:
pass
def _call_hooks(self, app_or_handler: AppOrHandler) -> None:
if isinstance(app_or_handler, type) and issubclass(app_or_handler, AbstractApp):
return self.on_app(app_or_handler)
return self.on_handler(app_or_handler)
def _register_middleware(self,
app_or_handler: AppOrHandler, middleware: MiddlewareType) -> None:
old_middlewares = self._resolver.get_attribute("middlewares", app_or_handler, [])
new_middlewares = old_middlewares + [middleware]
self._resolver.register_attribute("middlewares", new_middlewares, app_or_handler)
def __call__(self, app_or_handler: AppOrHandler) -> AppOrHandler:
self._call_hooks(app_or_handler)
self._register_middleware(app_or_handler, self._do)
return app_or_handler
| [
1,
515,
19229,
1053,
5167,
29892,
7761,
13,
13,
3166,
6317,
13371,
1053,
25513,
2052,
13,
3166,
6317,
3179,
9306,
1053,
5166,
1358,
6678,
13,
3166,
869,
29918,
16595,
29918,
17662,
2519,
1053,
25513,
25411,
2519,
13,
3166,
869,
29918,
17662,
2519,
29918,
1853,
1053,
14253,
2519,
1542,
13,
13,
1649,
497,
1649,
353,
4852,
5160,
25411,
2519,
613,
376,
2052,
2816,
4598,
613,
29897,
13,
13,
13,
2052,
2816,
4598,
353,
7761,
29961,
1542,
29961,
9118,
2052,
1402,
5166,
1358,
6678,
29962,
13,
13,
13,
1990,
7399,
25411,
2519,
29898,
9118,
25411,
2519,
1125,
13,
1678,
822,
373,
29918,
932,
29898,
1311,
29892,
623,
29901,
5167,
29961,
9118,
2052,
2314,
1599,
6213,
29901,
13,
4706,
1209,
13,
13,
1678,
822,
373,
29918,
13789,
29898,
1311,
29892,
7834,
29901,
5166,
1358,
6678,
29897,
1599,
6213,
29901,
13,
4706,
1209,
13,
13,
1678,
822,
903,
4804,
29918,
1251,
12117,
29898,
1311,
29892,
623,
29918,
272,
29918,
13789,
29901,
2401,
2816,
4598,
29897,
1599,
6213,
29901,
13,
4706,
565,
338,
8758,
29898,
932,
29918,
272,
29918,
13789,
29892,
1134,
29897,
322,
338,
1491,
1990,
29898,
932,
29918,
272,
29918,
13789,
29892,
25513,
2052,
1125,
13,
9651,
736,
1583,
29889,
265,
29918,
932,
29898,
932,
29918,
272,
29918,
13789,
29897,
13,
4706,
736,
1583,
29889,
265,
29918,
13789,
29898,
932,
29918,
272,
29918,
13789,
29897,
13,
13,
1678,
822,
903,
9573,
29918,
17662,
2519,
29898,
1311,
29892,
13,
462,
632,
623,
29918,
272,
29918,
13789,
29901,
2401,
2816,
4598,
29892,
7256,
2519,
29901,
14253,
2519,
1542,
29897,
1599,
6213,
29901,
13,
4706,
2030,
29918,
17662,
4495,
267,
353,
1583,
3032,
9778,
369,
29889,
657,
29918,
12715,
703,
17662,
4495,
267,
613,
623,
29918,
272,
29918,
13789,
29892,
518,
2314,
13,
4706,
716,
29918,
17662,
4495,
267,
353,
2030,
29918,
17662,
4495,
267,
718,
518,
17662,
2519,
29962,
13,
4706,
1583,
3032,
9778,
369,
29889,
9573,
29918,
12715,
703,
17662,
4495,
267,
613,
716,
29918,
17662,
4495,
267,
29892,
623,
29918,
272,
29918,
13789,
29897,
13,
13,
1678,
822,
4770,
4804,
12035,
1311,
29892,
623,
29918,
272,
29918,
13789,
29901,
2401,
2816,
4598,
29897,
1599,
2401,
2816,
4598,
29901,
13,
4706,
1583,
3032,
4804,
29918,
1251,
12117,
29898,
932,
29918,
272,
29918,
13789,
29897,
13,
4706,
1583,
3032,
9573,
29918,
17662,
2519,
29898,
932,
29918,
272,
29918,
13789,
29892,
1583,
3032,
1867,
29897,
13,
4706,
736,
623,
29918,
272,
29918,
13789,
13,
2
] |
rrs/tools/rrs_maintainer_history.py | WindRiver-OpenSourceLabs/layerindex-web | 0 | 13540 | #!/usr/bin/env python3
# Standalone script which rebuilds the history of maintainership
#
# Copyright (C) 2015 Intel Corporation
# Author: <NAME> <<EMAIL>>
#
# Licensed under the MIT license, see COPYING.MIT for details
import sys
import os.path
import optparse
import logging
sys.path.insert(0, os.path.realpath(os.path.join(os.path.dirname(__file__))))
from common import common_setup, get_logger, DryRunRollbackException
common_setup()
from layerindex import utils, recipeparse
utils.setup_django()
from django.db import transaction
import settings
from layerindex.models import Recipe, LayerBranch, LayerItem
from rrs.models import MaintenancePlan, Maintainer, RecipeMaintainerHistory, RecipeMaintainer, RecipeMaintenanceLink
from django.core.exceptions import ObjectDoesNotExist
# FIXME we shouldn't be hardcoded to expect RECIPE_MAINTAINER to be set in this file,
# as it may be in the recipe in future
MAINTAINERS_INCLUDE_PATH = 'conf/distro/include/maintainers.inc'
"""
Try to get recipe maintainer from line, if not found return None
"""
def get_recipe_maintainer(line, logger):
import re
regex = re.compile('^RECIPE_MAINTAINER_pn-(?P<pn>.*)\s=\s"(?P<name>.+) <(?P<email>.*)>"$')
match = regex.search(line)
if match:
return (match.group('pn'), match.group('name'), match.group('email'))
else:
logger.debug("line (%s) don\'t match" % (line))
return None
"""
Get commit information from text.
Returns author_name, author_email, date and title.
"""
def get_commit_info(info, logger):
import re
from datetime import datetime
from email.utils import parsedate_tz, mktime_tz
author_regex = re.compile("^Author: (?P<name>.*) <(?P<email>.*)>$")
date_regex = re.compile("^Date: (?P<date>.*)$")
title_regex = re.compile("^ (?P<title>.*)$")
lines = info.split('\n')
author_name = author_regex.search(lines[1]).group('name')
author_email = author_regex.search(lines[1]).group('email')
date_str = date_regex.search(lines[2]).group('date')
date = datetime.utcfromtimestamp(mktime_tz(parsedate_tz(date_str)))
title = title_regex.search(lines[4]).group('title')
return (author_name, author_email, date, title)
def maintainers_inc_history(options, logger, maintplan, layerbranch, repodir, layerdir):
maintainers_full_path = os.path.join(layerdir, MAINTAINERS_INCLUDE_PATH)
if not os.path.exists(maintainers_full_path):
logger.warning('Maintainer style is maintainers.inc for plan %s but no maintainers.inc exists in for %s' % (maintplan, layerbranch))
return
logger.debug('Checking maintainers.inc history for %s' % layerbranch)
commits = utils.runcmd("git log --format='%%H' --reverse --date=rfc origin/master %s"
% os.path.join(layerbranch.vcs_subdir, MAINTAINERS_INCLUDE_PATH),
repodir, logger=logger)
no_maintainer, _ = Maintainer.objects.get_or_create(name='No maintainer')
try:
with transaction.atomic():
for commit in commits.strip().split("\n"):
if RecipeMaintainerHistory.objects.filter(layerbranch=layerbranch, sha1=commit):
continue
logger.debug("Analysing commit %s ..." % (commit))
(author_name, author_email, date, title) = \
get_commit_info(utils.runcmd("git show " + commit, repodir,
logger=logger), logger)
author = Maintainer.create_or_update(author_name, author_email)
rms = RecipeMaintainerHistory(title=title, date=date, author=author,
sha1=commit, layerbranch=layerbranch)
rms.save()
utils.runcmd("git checkout %s -f" % commit,
repodir, logger=logger)
lines = [line.strip() for line in open(maintainers_full_path)]
for line in lines:
res = get_recipe_maintainer(line, logger)
if res:
(pn, name, email) = res
qry = Recipe.objects.filter(pn = pn, layerbranch = layerbranch)
if qry:
m = Maintainer.create_or_update(name, email)
rm = RecipeMaintainer()
rm.recipe = qry[0]
rm.maintainer = m
rm.history = rms
rm.save()
logger.debug("%s: Change maintainer to %s in commit %s." % \
(pn, m.name, commit))
else:
logger.debug("%s: Not found in %s." % \
(pn, layerbranch))
# set missing recipes to no maintainer
for recipe in layerbranch.recipe_set.all():
if not RecipeMaintainer.objects.filter(recipe = recipe, history = rms):
rm = RecipeMaintainer()
rm.recipe = recipe
link_maintainer = RecipeMaintenanceLink.link_maintainer(recipe.pn, rms)
if link_maintainer:
rm.maintainer = link_maintainer.maintainer
else:
rm.maintainer = no_maintainer
rm.history = rms
rm.save()
if link_maintainer:
logger.debug("%s: linked to maintainer for %s" % (recipe.pn, link_maintainer.recipe.pn))
else:
logger.debug("%s: Not found maintainer in commit %s set to 'No maintainer'." % \
(recipe.pn, rms.sha1))
# set new recipes to no maintainer if don't have one
rms = RecipeMaintainerHistory.get_last(layerbranch)
for recipe in layerbranch.recipe_set.all():
if not RecipeMaintainer.objects.filter(recipe = recipe, history = rms):
rm = RecipeMaintainer()
rm.recipe = recipe
link_maintainer = RecipeMaintenanceLink.link_maintainer(recipe.pn, rms)
if link_maintainer:
rm.maintainer = link_maintainer.maintainer
else:
rm.maintainer = no_maintainer
rm.history = rms
rm.save()
if link_maintainer:
logger.debug("%s: New recipe linked to maintainer for %s" % (recipe.pn, link_maintainer.recipe.pn))
else:
logger.debug("%s: New recipe not found maintainer set to 'No maintainer'." % \
(recipe.pn))
if options.dry_run:
raise DryRunRollbackException
except DryRunRollbackException:
pass
"""
Recreate Maintainership history from the beginning
"""
def maintainer_history(options, logger):
fetchdir = settings.LAYER_FETCH_DIR
if options.plan:
maintplans = MaintenancePlan.objects.filter(id=int(options.plan))
if not maintplans.exists():
logger.error('No maintenance plan with ID %s found' % options.plan)
sys.exit(1)
else:
maintplans = MaintenancePlan.objects.filter(updates_enabled=True)
if not maintplans.exists():
logger.error('No enabled maintenance plans found')
sys.exit(1)
lockfn = os.path.join(fetchdir, "layerindex.lock")
lockfile = utils.lock_file(lockfn)
if not lockfile:
logger.error("Layer index lock timeout expired")
sys.exit(1)
try:
for maintplan in maintplans:
for item in maintplan.maintenanceplanlayerbranch_set.all():
layerbranch = item.layerbranch
if options.fullreload and not options.dry_run:
RecipeMaintainerHistory.objects.filter(layerbranch=layerbranch).delete()
urldir = str(layerbranch.layer.get_fetch_dir())
repodir = os.path.join(fetchdir, urldir)
layerdir = os.path.join(repodir, layerbranch.vcs_subdir)
if maintplan.maintainer_style == 'I':
# maintainers.inc
maintainers_inc_history(options, logger, maintplan, layerbranch, repodir, layerdir)
elif maintplan.maintainer_style == 'L':
# Layer-wide, don't need to do anything
logger.debug('Skipping maintainer processing for %s - plan %s maintainer style is layer-wide' % (layerbranch, maintplan))
else:
raise Exception('Unknown maintainer style %s for maintenance plan %s' % (maintplan.maintainer_style, maintplan))
finally:
utils.unlock_file(lockfile)
if __name__=="__main__":
parser = optparse.OptionParser(usage = """%prog [options]""")
parser.add_option("-p", "--plan",
help="Specify maintenance plan to operate on (default is all plans that have updates enabled)",
action="store", dest="plan", default=None)
parser.add_option("--fullreload",
help="Reload upgrade data from scratch",
action="store_true", dest="fullreload", default=False)
parser.add_option("-d", "--debug",
help = "Enable debug output",
action="store_const", const=logging.DEBUG, dest="loglevel",
default=logging.INFO)
parser.add_option("--dry-run",
help = "Do not write any data back to the database",
action="store_true", dest="dry_run", default=False)
logger = get_logger("MaintainerUpdate", settings)
options, args = parser.parse_args(sys.argv)
logger.setLevel(options.loglevel)
maintainer_history(options, logger)
| [
1,
18787,
4855,
29914,
2109,
29914,
6272,
3017,
29941,
13,
13,
29937,
6679,
18785,
2471,
607,
337,
4282,
29879,
278,
4955,
310,
7344,
10475,
13,
29937,
13,
29937,
14187,
1266,
313,
29907,
29897,
29871,
29906,
29900,
29896,
29945,
18555,
15025,
13,
29937,
13361,
29901,
529,
5813,
29958,
3532,
26862,
6227,
6778,
13,
29937,
13,
29937,
10413,
21144,
1090,
278,
341,
1806,
19405,
29892,
1074,
315,
4590,
29979,
4214,
29889,
26349,
363,
4902,
13,
13,
5215,
10876,
13,
5215,
2897,
29889,
2084,
13,
5215,
3523,
5510,
13,
5215,
12183,
13,
13,
9675,
29889,
2084,
29889,
7851,
29898,
29900,
29892,
2897,
29889,
2084,
29889,
6370,
2084,
29898,
359,
29889,
2084,
29889,
7122,
29898,
359,
29889,
2084,
29889,
25721,
22168,
1445,
1649,
13697,
13,
3166,
3619,
1053,
3619,
29918,
14669,
29892,
679,
29918,
21707,
29892,
360,
719,
6558,
29934,
3028,
1627,
2451,
13,
9435,
29918,
14669,
580,
13,
3166,
7546,
2248,
1053,
3667,
29879,
29892,
9522,
412,
5510,
13,
13,
13239,
29889,
14669,
29918,
14095,
580,
13,
3166,
9557,
29889,
2585,
1053,
10804,
13,
5215,
6055,
13,
13,
3166,
7546,
2248,
29889,
9794,
1053,
830,
24044,
29892,
365,
2747,
29933,
4014,
29892,
365,
2747,
2001,
13,
3166,
364,
2288,
29889,
9794,
1053,
4241,
841,
749,
20334,
29892,
341,
2365,
4008,
29892,
830,
24044,
29924,
2365,
4008,
20570,
29892,
830,
24044,
29924,
2365,
4008,
29892,
830,
24044,
6330,
841,
749,
6595,
13,
3166,
9557,
29889,
3221,
29889,
11739,
29879,
1053,
4669,
25125,
3664,
1252,
391,
13,
13,
29937,
383,
6415,
2303,
591,
9273,
29915,
29873,
367,
2898,
29659,
304,
2149,
5195,
8426,
4162,
29918,
29032,
6040,
1177,
1001,
304,
367,
731,
297,
445,
934,
29892,
13,
29937,
408,
372,
1122,
367,
297,
278,
9522,
412,
297,
5434,
13,
29032,
6040,
1177,
23598,
29918,
1177,
6154,
29965,
2287,
29918,
10145,
353,
525,
5527,
29914,
5721,
307,
29914,
2856,
29914,
29885,
2365,
475,
414,
29889,
3742,
29915,
13,
13,
13,
15945,
29908,
13,
1678,
3967,
304,
679,
9522,
412,
7344,
261,
515,
1196,
29892,
565,
451,
1476,
736,
6213,
13,
15945,
29908,
13,
1753,
679,
29918,
4361,
412,
29918,
29885,
2365,
4008,
29898,
1220,
29892,
17927,
1125,
13,
1678,
1053,
337,
13,
1678,
6528,
353,
337,
29889,
12198,
877,
29985,
1525,
8426,
4162,
29918,
29032,
6040,
1177,
1001,
29918,
21257,
29899,
10780,
29925,
29966,
21257,
29958,
5575,
2144,
29879,
2013,
29879,
29908,
10780,
29925,
29966,
978,
15513,
28135,
529,
10780,
29925,
29966,
5269,
29958,
5575,
29897,
11903,
29938,
1495,
13,
13,
1678,
1993,
353,
6528,
29889,
4478,
29898,
1220,
29897,
13,
1678,
565,
1993,
29901,
13,
4706,
736,
313,
4352,
29889,
2972,
877,
21257,
5477,
1993,
29889,
2972,
877,
978,
5477,
1993,
29889,
2972,
877,
5269,
8785,
13,
1678,
1683,
29901,
13,
4706,
17927,
29889,
8382,
703,
1220,
313,
29995,
29879,
29897,
1016,
20333,
29873,
1993,
29908,
1273,
313,
1220,
876,
13,
4706,
736,
6213,
13,
13,
15945,
29908,
13,
1678,
3617,
9063,
2472,
515,
1426,
29889,
13,
1678,
16969,
4148,
29918,
978,
29892,
4148,
29918,
5269,
29892,
2635,
322,
3611,
29889,
13,
15945,
29908,
13,
1753,
679,
29918,
15060,
29918,
3888,
29898,
3888,
29892,
17927,
1125,
13,
1678,
1053,
337,
13,
1678,
515,
12865,
1053,
12865,
13,
1678,
515,
4876,
29889,
13239,
1053,
21213,
403,
29918,
17559,
29892,
286,
1193,
603,
29918,
17559,
13,
13,
1678,
4148,
29918,
13087,
353,
337,
29889,
12198,
703,
29985,
13720,
29901,
22308,
29925,
29966,
978,
29958,
5575,
29897,
529,
10780,
29925,
29966,
5269,
29958,
5575,
15410,
29938,
1159,
13,
1678,
2635,
29918,
13087,
353,
337,
29889,
12198,
703,
29985,
2539,
29901,
259,
22308,
29925,
29966,
1256,
29958,
5575,
1262,
1159,
13,
1678,
3611,
29918,
13087,
353,
337,
29889,
12198,
703,
29985,
1678,
22308,
29925,
29966,
3257,
29958,
5575,
1262,
1159,
13,
13,
1678,
3454,
353,
5235,
29889,
5451,
28909,
29876,
1495,
13,
13,
1678,
4148,
29918,
978,
353,
4148,
29918,
13087,
29889,
4478,
29898,
9012,
29961,
29896,
14664,
2972,
877,
978,
1495,
13,
1678,
4148,
29918,
5269,
353,
4148,
29918,
13087,
29889,
4478,
29898,
9012,
29961,
29896,
14664,
2972,
877,
5269,
1495,
13,
1678,
2635,
29918,
710,
353,
2635,
29918,
13087,
29889,
4478,
29898,
9012,
29961,
29906,
14664,
2972,
877,
1256,
1495,
13,
1678,
2635,
353,
12865,
29889,
329,
29883,
3166,
16394,
29898,
29885,
1193,
603,
29918,
17559,
29898,
862,
8485,
403,
29918,
17559,
29898,
1256,
29918,
710,
4961,
13,
1678,
3611,
353,
3611,
29918,
13087,
29889,
4478,
29898,
9012,
29961,
29946,
14664,
2972,
877,
3257,
1495,
13,
13,
1678,
736,
313,
8921,
29918,
978,
29892,
4148,
29918,
5269,
29892,
2635,
29892,
3611,
29897,
13,
13,
13,
1753,
7344,
414,
29918,
3742,
29918,
18434,
29898,
6768,
29892,
17927,
29892,
1667,
29873,
9018,
29892,
7546,
17519,
29892,
1634,
397,
381,
29892,
6568,
2018,
381,
1125,
13,
1678,
7344,
414,
29918,
8159,
29918,
2084,
353,
2897,
29889,
2084,
29889,
7122,
29898,
8387,
2018,
381,
29892,
14861,
1177,
6040,
1177,
23598,
29918,
1177,
6154,
29965,
2287,
29918,
10145,
29897,
13,
1678,
565,
451,
2897,
29889,
2084,
29889,
9933,
29898,
29885,
2365,
475,
414,
29918,
8159,
29918,
2084,
1125,
13,
4706,
17927,
29889,
27392,
877,
29924,
2365,
4008,
3114,
338,
7344,
414,
29889,
3742,
363,
3814,
1273,
29879,
541,
694,
7344,
414,
29889,
3742,
4864,
297,
363,
1273,
29879,
29915,
1273,
313,
29885,
2365,
9018,
29892,
7546,
17519,
876,
13,
4706,
736,
13,
13,
1678,
17927,
29889,
8382,
877,
5596,
292,
7344,
414,
29889,
3742,
4955,
363,
1273,
29879,
29915,
1273,
7546,
17519,
29897,
13,
13,
1678,
25741,
353,
3667,
29879,
29889,
3389,
9006,
703,
5559,
1480,
1192,
4830,
2433,
7686,
29950,
29915,
1192,
24244,
1192,
1256,
29922,
9600,
29883,
3978,
29914,
6207,
1273,
29879,
29908,
13,
462,
4706,
1273,
2897,
29889,
2084,
29889,
7122,
29898,
13148,
17519,
29889,
29894,
2395,
29918,
1491,
3972,
29892,
14861,
1177,
6040,
1177,
23598,
29918,
1177,
6154,
29965,
2287,
29918,
10145,
511,
13,
462,
4706,
1634,
397,
381,
29892,
17927,
29922,
21707,
29897,
13,
13,
1678,
694,
29918,
29885,
2365,
4008,
29892,
903,
353,
341,
2365,
4008,
29889,
12650,
29889,
657,
29918,
272,
29918,
3258,
29898,
978,
2433,
3782,
7344,
261,
1495,
13,
13,
1678,
1018,
29901,
13,
4706,
411,
10804,
29889,
21641,
7295,
13,
9651,
363,
9063,
297,
25741,
29889,
17010,
2141,
5451,
14182,
29876,
29908,
1125,
13,
18884,
565,
830,
24044,
29924,
2365,
4008,
20570,
29889,
12650,
29889,
4572,
29898,
13148,
17519,
29922,
13148,
17519,
29892,
528,
29874,
29896,
29922,
15060,
1125,
13,
462,
1678,
6773,
13,
13,
18884,
17927,
29889,
8382,
703,
21067,
952,
292,
9063,
1273,
29879,
2023,
29908,
1273,
313,
15060,
876,
13,
13,
18884,
313,
8921,
29918,
978,
29892,
4148,
29918,
5269,
29892,
2635,
29892,
3611,
29897,
353,
320,
13,
462,
1678,
679,
29918,
15060,
29918,
3888,
29898,
13239,
29889,
3389,
9006,
703,
5559,
1510,
376,
718,
9063,
29892,
1634,
397,
381,
29892,
13,
462,
4706,
17927,
29922,
21707,
511,
17927,
29897,
13,
13,
18884,
4148,
353,
341,
2365,
4008,
29889,
3258,
29918,
272,
29918,
5504,
29898,
8921,
29918,
978,
29892,
4148,
29918,
5269,
29897,
13,
18884,
364,
1516,
353,
830,
24044,
29924,
2365,
4008,
20570,
29898,
3257,
29922,
3257,
29892,
2635,
29922,
1256,
29892,
4148,
29922,
8921,
29892,
13,
462,
4706,
528,
29874,
29896,
29922,
15060,
29892,
7546,
17519,
29922,
13148,
17519,
29897,
13,
18884,
364,
1516,
29889,
7620,
580,
13,
13,
18884,
3667,
29879,
29889,
3389,
9006,
703,
5559,
24808,
1273,
29879,
448,
29888,
29908,
1273,
9063,
29892,
13,
462,
4706,
1634,
397,
381,
29892,
17927,
29922,
21707,
29897,
13,
13,
18884,
3454,
353,
518,
1220,
29889,
17010,
580,
363,
1196,
297,
1722,
29898,
29885,
2365,
475,
414,
29918,
8159,
29918,
2084,
4638,
13,
18884,
363,
1196,
297,
3454,
29901,
13,
462,
1678,
620,
353,
679,
29918,
4361,
412,
29918,
29885,
2365,
4008,
29898,
1220,
29892,
17927,
29897,
13,
462,
1678,
565,
620,
29901,
13,
462,
4706,
313,
21257,
29892,
1024,
29892,
4876,
29897,
353,
620,
13,
462,
4706,
3855,
719,
353,
830,
24044,
29889,
12650,
29889,
4572,
29898,
21257,
353,
282,
29876,
29892,
7546,
17519,
353,
7546,
17519,
29897,
13,
13,
462,
4706,
565,
3855,
719,
29901,
13,
462,
9651,
286,
353,
341,
2365,
4008,
29889,
3258,
29918,
272,
29918,
5504,
29898,
978,
29892,
4876,
29897,
13,
13,
462,
9651,
20241,
353,
830,
24044,
29924,
2365,
4008,
580,
13,
462,
9651,
20241,
29889,
4361,
412,
353,
3855,
719,
29961,
29900,
29962,
13,
462,
9651,
20241,
29889,
29885,
2365,
4008,
353,
286,
13,
462,
9651,
20241,
29889,
18434,
353,
364,
1516,
13,
462,
9651,
20241,
29889,
7620,
580,
13,
13,
462,
9651,
17927,
29889,
8382,
11702,
29879,
29901,
10726,
7344,
261,
304,
1273,
29879,
297,
9063,
1273,
29879,
1213,
1273,
320,
13,
462,
462,
1678,
313,
21257,
29892,
286,
29889,
978,
29892,
9063,
876,
13,
462,
4706,
1683,
29901,
13,
462,
9651,
17927,
29889,
8382,
11702,
29879,
29901,
2216,
1476,
297,
1273,
29879,
1213,
1273,
320,
13,
462,
462,
1678,
313,
21257,
29892,
7546,
17519,
876,
13,
13,
18884,
396,
731,
4567,
9522,
5547,
304,
694,
7344,
261,
13,
18884,
363,
9522,
412,
297,
7546,
17519,
29889,
4361,
412,
29918,
842,
29889,
497,
7295,
13,
462,
1678,
565,
451,
830,
24044,
29924,
2365,
4008,
29889,
12650,
29889,
4572,
29898,
4361,
412,
353,
9522,
412,
29892,
4955,
353,
364,
1516,
1125,
13,
462,
4706,
20241,
353,
830,
24044,
29924,
2365,
4008,
580,
13,
462,
4706,
20241,
29889,
4361,
412,
353,
9522,
412,
13,
462,
4706,
1544,
29918,
29885,
2365,
4008,
353,
830,
24044,
6330,
841,
749,
6595,
29889,
2324,
29918,
29885,
2365,
4008,
29898,
4361,
412,
29889,
21257,
29892,
364,
1516,
29897,
13,
462,
4706,
565,
1544,
29918,
29885,
2365,
4008,
29901,
13,
462,
9651,
20241,
29889,
29885,
2365,
4008,
353,
1544,
29918,
29885,
2365,
4008,
29889,
29885,
2365,
4008,
13,
462,
4706,
1683,
29901,
13,
462,
9651,
20241,
29889,
29885,
2365,
4008,
353,
694,
29918,
29885,
2365,
4008,
13,
462,
4706,
20241,
29889,
18434,
353,
364,
1516,
13,
462,
4706,
20241,
29889,
7620,
580,
13,
462,
4706,
565,
1544,
29918,
29885,
2365,
4008,
29901,
13,
462,
9651,
17927,
29889,
8382,
11702,
29879,
29901,
9024,
304,
7344,
261,
363,
1273,
29879,
29908,
1273,
313,
4361,
412,
29889,
21257,
29892,
1544,
29918,
29885,
2365,
4008,
29889,
4361,
412,
29889,
21257,
876,
13,
462,
4706,
1683,
29901,
13,
462,
9651,
17927,
29889,
8382,
11702,
29879,
29901,
2216,
1476,
7344,
261,
297,
9063,
1273,
29879,
731,
304,
525,
3782,
7344,
261,
29915,
1213,
1273,
320,
13,
462,
462,
9651,
313,
4361,
412,
29889,
21257,
29892,
364,
1516,
29889,
17051,
29896,
876,
13,
13,
9651,
396,
731,
716,
9522,
5547,
304,
694,
7344,
261,
565,
1016,
29915,
29873,
505,
697,
13,
9651,
364,
1516,
353,
830,
24044,
29924,
2365,
4008,
20570,
29889,
657,
29918,
4230,
29898,
13148,
17519,
29897,
13,
9651,
363,
9522,
412,
297,
7546,
17519,
29889,
4361,
412,
29918,
842,
29889,
497,
7295,
13,
18884,
565,
451,
830,
24044,
29924,
2365,
4008,
29889,
12650,
29889,
4572,
29898,
4361,
412,
353,
9522,
412,
29892,
4955,
353,
364,
1516,
1125,
13,
462,
1678,
20241,
353,
830,
24044,
29924,
2365,
4008,
580,
13,
462,
1678,
20241,
29889,
4361,
412,
353,
9522,
412,
13,
462,
1678,
1544,
29918,
29885,
2365,
4008,
353,
830,
24044,
6330,
841,
749,
6595,
29889,
2324,
29918,
29885,
2365,
4008,
29898,
4361,
412,
29889,
21257,
29892,
364,
1516,
29897,
13,
462,
1678,
565,
1544,
29918,
29885,
2365,
4008,
29901,
13,
462,
4706,
20241,
29889,
29885,
2365,
4008,
353,
1544,
29918,
29885,
2365,
4008,
29889,
29885,
2365,
4008,
13,
462,
1678,
1683,
29901,
13,
462,
4706,
20241,
29889,
29885,
2365,
4008,
353,
694,
29918,
29885,
2365,
4008,
13,
462,
1678,
20241,
29889,
18434,
353,
364,
1516,
13,
462,
1678,
20241,
29889,
7620,
580,
13,
462,
1678,
565,
1544,
29918,
29885,
2365,
4008,
29901,
13,
462,
4706,
17927,
29889,
8382,
11702,
29879,
29901,
1570,
9522,
412,
9024,
304,
7344,
261,
363,
1273,
29879,
29908,
1273,
313,
4361,
412,
29889,
21257,
29892,
1544,
29918,
29885,
2365,
4008,
29889,
4361,
412,
29889,
21257,
876,
13,
462,
1678,
1683,
29901,
13,
462,
4706,
17927,
29889,
8382,
11702,
29879,
29901,
1570,
9522,
412,
451,
1476,
7344,
261,
731,
304,
525,
3782,
7344,
261,
29915,
1213,
1273,
320,
13,
462,
462,
1678,
313,
4361,
412,
29889,
21257,
876,
13,
4706,
565,
3987,
29889,
29881,
719,
29918,
3389,
29901,
13,
9651,
12020,
360,
719,
6558,
29934,
3028,
1627,
2451,
13,
1678,
5174,
360,
719,
6558,
29934,
3028,
1627,
2451,
29901,
13,
4706,
1209,
13,
13,
15945,
29908,
13,
1678,
3599,
3015,
341,
2365,
475,
10475,
4955,
515,
278,
6763,
13,
15945,
29908,
13,
1753,
7344,
261,
29918,
18434,
29898,
6768,
29892,
17927,
1125,
13,
1678,
6699,
3972,
353,
6055,
29889,
18799,
1001,
29918,
29943,
2544,
3210,
29918,
9464,
13,
1678,
565,
3987,
29889,
9018,
29901,
13,
4706,
1667,
29873,
572,
550,
353,
4241,
841,
749,
20334,
29889,
12650,
29889,
4572,
29898,
333,
29922,
524,
29898,
6768,
29889,
9018,
876,
13,
4706,
565,
451,
1667,
29873,
572,
550,
29889,
9933,
7295,
13,
9651,
17927,
29889,
2704,
877,
3782,
25413,
3814,
411,
3553,
1273,
29879,
1476,
29915,
1273,
3987,
29889,
9018,
29897,
13,
9651,
10876,
29889,
13322,
29898,
29896,
29897,
13,
1678,
1683,
29901,
13,
4706,
1667,
29873,
572,
550,
353,
4241,
841,
749,
20334,
29889,
12650,
29889,
4572,
29898,
786,
15190,
29918,
17590,
29922,
5574,
29897,
13,
4706,
565,
451,
1667,
29873,
572,
550,
29889,
9933,
7295,
13,
9651,
17927,
29889,
2704,
877,
3782,
9615,
25413,
13900,
1476,
1495,
13,
9651,
10876,
29889,
13322,
29898,
29896,
29897,
13,
13,
1678,
7714,
9144,
353,
2897,
29889,
2084,
29889,
7122,
29898,
9155,
3972,
29892,
376,
13148,
2248,
29889,
908,
1159,
13,
1678,
7714,
1445,
353,
3667,
29879,
29889,
908,
29918,
1445,
29898,
908,
9144,
29897,
13,
1678,
565,
451,
7714,
1445,
29901,
13,
4706,
17927,
29889,
2704,
703,
14420,
2380,
7714,
11815,
1518,
2859,
1159,
13,
4706,
10876,
29889,
13322,
29898,
29896,
29897,
13,
1678,
1018,
29901,
13,
4706,
363,
1667,
29873,
9018,
297,
1667,
29873,
572,
550,
29901,
13,
9651,
363,
2944,
297,
1667,
29873,
9018,
29889,
3396,
841,
749,
9018,
13148,
17519,
29918,
842,
29889,
497,
7295,
13,
18884,
7546,
17519,
353,
2944,
29889,
13148,
17519,
13,
18884,
565,
3987,
29889,
8159,
28120,
322,
451,
3987,
29889,
29881,
719,
29918,
3389,
29901,
13,
462,
1678,
830,
24044,
29924,
2365,
4008,
20570,
29889,
12650,
29889,
4572,
29898,
13148,
17519,
29922,
13148,
17519,
467,
8143,
580,
13,
18884,
5065,
430,
381,
353,
851,
29898,
13148,
17519,
29889,
13148,
29889,
657,
29918,
9155,
29918,
3972,
3101,
13,
18884,
1634,
397,
381,
353,
2897,
29889,
2084,
29889,
7122,
29898,
9155,
3972,
29892,
5065,
430,
381,
29897,
13,
18884,
6568,
2018,
381,
353,
2897,
29889,
2084,
29889,
7122,
29898,
3445,
397,
381,
29892,
7546,
17519,
29889,
29894,
2395,
29918,
1491,
3972,
29897,
13,
13,
18884,
565,
1667,
29873,
9018,
29889,
29885,
2365,
4008,
29918,
3293,
1275,
525,
29902,
2396,
13,
462,
1678,
396,
7344,
414,
29889,
3742,
13,
462,
1678,
7344,
414,
29918,
3742,
29918,
18434,
29898,
6768,
29892,
17927,
29892,
1667,
29873,
9018,
29892,
7546,
17519,
29892,
1634,
397,
381,
29892,
6568,
2018,
381,
29897,
13,
18884,
25342,
1667,
29873,
9018,
29889,
29885,
2365,
4008,
29918,
3293,
1275,
525,
29931,
2396,
13,
462,
1678,
396,
365,
2747,
29899,
8157,
29892,
1016,
29915,
29873,
817,
304,
437,
3099,
13,
462,
1678,
17927,
29889,
8382,
877,
29903,
1984,
3262,
7344,
261,
9068,
363,
1273,
29879,
448,
3814,
1273,
29879,
7344,
261,
3114,
338,
7546,
29899,
8157,
29915,
1273,
313,
13148,
17519,
29892,
1667,
29873,
9018,
876,
13,
18884,
1683,
29901,
13,
462,
1678,
12020,
8960,
877,
14148,
7344,
261,
3114,
1273,
29879,
363,
25413,
3814,
1273,
29879,
29915,
1273,
313,
29885,
2365,
9018,
29889,
29885,
2365,
4008,
29918,
3293,
29892,
1667,
29873,
9018,
876,
13,
1678,
7146,
29901,
13,
4706,
3667,
29879,
29889,
348,
908,
29918,
1445,
29898,
908,
1445,
29897,
13,
13,
361,
4770,
978,
1649,
26359,
1649,
3396,
1649,
1115,
13,
1678,
13812,
353,
3523,
5510,
29889,
8375,
11726,
29898,
21125,
353,
9995,
29995,
29097,
518,
6768,
29962,
15945,
1159,
13,
13,
1678,
13812,
29889,
1202,
29918,
3385,
703,
29899,
29886,
613,
376,
489,
9018,
613,
13,
9651,
1371,
543,
10299,
1598,
25413,
3814,
304,
21994,
373,
313,
4381,
338,
599,
13900,
393,
505,
11217,
9615,
19123,
13,
9651,
3158,
543,
8899,
613,
2731,
543,
9018,
613,
2322,
29922,
8516,
29897,
13,
13,
1678,
13812,
29889,
1202,
29918,
3385,
703,
489,
8159,
28120,
613,
13,
9651,
1371,
543,
29934,
7078,
328,
14955,
848,
515,
22728,
613,
13,
9651,
3158,
543,
8899,
29918,
3009,
613,
2731,
543,
8159,
28120,
613,
2322,
29922,
8824,
29897,
13,
13,
1678,
13812,
29889,
1202,
29918,
3385,
703,
29899,
29881,
613,
376,
489,
8382,
613,
13,
9651,
1371,
353,
376,
20701,
4744,
1962,
613,
13,
9651,
3158,
543,
8899,
29918,
3075,
613,
1040,
29922,
21027,
29889,
18525,
29892,
2731,
543,
1188,
5563,
613,
13,
9651,
2322,
29922,
21027,
29889,
11690,
29897,
13,
13,
1678,
13812,
29889,
1202,
29918,
3385,
703,
489,
29881,
719,
29899,
3389,
613,
13,
9651,
1371,
353,
376,
6132,
451,
2436,
738,
848,
1250,
304,
278,
2566,
613,
13,
9651,
3158,
543,
8899,
29918,
3009,
613,
2731,
543,
29881,
719,
29918,
3389,
613,
2322,
29922,
8824,
29897,
13,
13,
1678,
17927,
353,
679,
29918,
21707,
703,
29924,
2365,
4008,
6422,
613,
6055,
29897,
13,
1678,
3987,
29892,
6389,
353,
13812,
29889,
5510,
29918,
5085,
29898,
9675,
29889,
19218,
29897,
13,
1678,
17927,
29889,
842,
10108,
29898,
6768,
29889,
1188,
5563,
29897,
13,
13,
1678,
7344,
261,
29918,
18434,
29898,
6768,
29892,
17927,
29897,
13,
2
] |
data/logs_model/logs_producer/kafka_logs_producer.py | anwarchk/quay | 1 | 195823 | import logging
from kafka.errors import KafkaError, KafkaTimeoutError
from kafka import KafkaProducer
from data.logs_model.shared import epoch_ms
from data.logs_model.logs_producer.interface import LogProducerInterface
from data.logs_model.logs_producer.util import logs_json_serializer
from data.logs_model.logs_producer import LogSendException
logger = logging.getLogger(__name__)
DEFAULT_MAX_BLOCK_SECONDS = 5
class KafkaLogsProducer(LogProducerInterface):
""" Log producer writing log entries to a Kafka stream. """
def __init__(self, bootstrap_servers=None, topic=None, client_id=None, max_block_seconds=None):
self.bootstrap_servers = bootstrap_servers
self.topic = topic
self.client_id = client_id
self.max_block_ms = (max_block_seconds or DEFAULT_MAX_BLOCK_SECONDS) * 1000
self._producer = KafkaProducer(bootstrap_servers=self.bootstrap_servers,
client_id=self.client_id,
max_block_ms=self.max_block_ms,
value_serializer=logs_json_serializer)
def send(self, logentry):
try:
# send() has a (max_block_ms) timeout and get() has a (max_block_ms) timeout
# for an upper bound of 2x(max_block_ms) before guaranteed delivery
future = self._producer.send(self.topic, logentry.to_dict(), timestamp_ms=epoch_ms(logentry.datetime))
record_metadata = future.get(timeout=self.max_block_ms)
assert future.succeeded
except KafkaTimeoutError as kte:
logger.exception('KafkaLogsProducer timeout sending log to Kafka: %s', kte)
raise LogSendException('KafkaLogsProducer timeout sending log to Kafka: %s' % kte)
except KafkaError as ke:
logger.exception('KafkaLogsProducer error sending log to Kafka: %s', ke)
raise LogSendException('KafkaLogsProducer error sending log to Kafka: %s' % ke)
except Exception as e:
logger.exception('KafkaLogsProducer exception sending log to Kafka: %s', e)
raise LogSendException('KafkaLogsProducer exception sending log to Kafka: %s' % e)
| [
1,
1053,
12183,
13,
13,
3166,
413,
20817,
29889,
12523,
1053,
476,
20817,
2392,
29892,
476,
20817,
10851,
2392,
13,
3166,
413,
20817,
1053,
476,
20817,
23665,
2265,
13,
13,
3166,
848,
29889,
20756,
29918,
4299,
29889,
12366,
1053,
21502,
305,
29918,
1516,
13,
3166,
848,
29889,
20756,
29918,
4299,
29889,
20756,
29918,
5498,
2265,
29889,
13248,
1053,
4522,
23665,
2265,
10448,
13,
3166,
848,
29889,
20756,
29918,
4299,
29889,
20756,
29918,
5498,
2265,
29889,
4422,
1053,
10748,
29918,
3126,
29918,
15550,
3950,
13,
3166,
848,
29889,
20756,
29918,
4299,
29889,
20756,
29918,
5498,
2265,
1053,
4522,
12600,
2451,
13,
13,
13,
21707,
353,
12183,
29889,
657,
16363,
22168,
978,
1649,
29897,
13,
13,
23397,
29918,
12648,
29918,
29933,
21339,
29918,
1660,
6007,
8452,
353,
29871,
29945,
13,
13,
13,
1990,
476,
20817,
3403,
29879,
23665,
2265,
29898,
3403,
23665,
2265,
10448,
1125,
13,
29871,
9995,
4522,
14297,
5007,
1480,
9976,
304,
263,
476,
20817,
4840,
29889,
9995,
13,
29871,
822,
4770,
2344,
12035,
1311,
29892,
16087,
29918,
643,
874,
29922,
8516,
29892,
11261,
29922,
8516,
29892,
3132,
29918,
333,
29922,
8516,
29892,
4236,
29918,
1271,
29918,
23128,
29922,
8516,
1125,
13,
1678,
1583,
29889,
8704,
29918,
643,
874,
353,
16087,
29918,
643,
874,
13,
1678,
1583,
29889,
13010,
353,
11261,
13,
1678,
1583,
29889,
4645,
29918,
333,
353,
3132,
29918,
333,
13,
1678,
1583,
29889,
3317,
29918,
1271,
29918,
1516,
353,
313,
3317,
29918,
1271,
29918,
23128,
470,
22236,
29918,
12648,
29918,
29933,
21339,
29918,
1660,
6007,
8452,
29897,
334,
29871,
29896,
29900,
29900,
29900,
13,
13,
1678,
1583,
3032,
5498,
2265,
353,
476,
20817,
23665,
2265,
29898,
8704,
29918,
643,
874,
29922,
1311,
29889,
8704,
29918,
643,
874,
29892,
13,
462,
462,
259,
3132,
29918,
333,
29922,
1311,
29889,
4645,
29918,
333,
29892,
13,
462,
462,
259,
4236,
29918,
1271,
29918,
1516,
29922,
1311,
29889,
3317,
29918,
1271,
29918,
1516,
29892,
13,
462,
462,
259,
995,
29918,
15550,
3950,
29922,
20756,
29918,
3126,
29918,
15550,
3950,
29897,
13,
13,
29871,
822,
3638,
29898,
1311,
29892,
1480,
8269,
1125,
13,
1678,
1018,
29901,
13,
418,
396,
3638,
580,
756,
263,
313,
3317,
29918,
1271,
29918,
1516,
29897,
11815,
322,
679,
580,
756,
263,
313,
3317,
29918,
1271,
29918,
1516,
29897,
11815,
13,
418,
396,
363,
385,
7568,
3216,
310,
29871,
29906,
29916,
29898,
3317,
29918,
1271,
29918,
1516,
29897,
1434,
22688,
28289,
13,
418,
5434,
353,
1583,
3032,
5498,
2265,
29889,
6717,
29898,
1311,
29889,
13010,
29892,
1480,
8269,
29889,
517,
29918,
8977,
3285,
14334,
29918,
1516,
29922,
1022,
2878,
29918,
1516,
29898,
1188,
8269,
29889,
12673,
876,
13,
418,
2407,
29918,
19635,
353,
5434,
29889,
657,
29898,
15619,
29922,
1311,
29889,
3317,
29918,
1271,
29918,
1516,
29897,
13,
418,
4974,
5434,
29889,
29879,
1682,
3947,
287,
13,
1678,
5174,
476,
20817,
10851,
2392,
408,
413,
371,
29901,
13,
418,
17927,
29889,
11739,
877,
29968,
20817,
3403,
29879,
23665,
2265,
11815,
9348,
1480,
304,
476,
20817,
29901,
1273,
29879,
742,
413,
371,
29897,
13,
418,
12020,
4522,
12600,
2451,
877,
29968,
20817,
3403,
29879,
23665,
2265,
11815,
9348,
1480,
304,
476,
20817,
29901,
1273,
29879,
29915,
1273,
413,
371,
29897,
13,
1678,
5174,
476,
20817,
2392,
408,
1589,
29901,
13,
418,
17927,
29889,
11739,
877,
29968,
20817,
3403,
29879,
23665,
2265,
1059,
9348,
1480,
304,
476,
20817,
29901,
1273,
29879,
742,
1589,
29897,
13,
418,
12020,
4522,
12600,
2451,
877,
29968,
20817,
3403,
29879,
23665,
2265,
1059,
9348,
1480,
304,
476,
20817,
29901,
1273,
29879,
29915,
1273,
1589,
29897,
13,
1678,
5174,
8960,
408,
321,
29901,
13,
418,
17927,
29889,
11739,
877,
29968,
20817,
3403,
29879,
23665,
2265,
3682,
9348,
1480,
304,
476,
20817,
29901,
1273,
29879,
742,
321,
29897,
13,
418,
12020,
4522,
12600,
2451,
877,
29968,
20817,
3403,
29879,
23665,
2265,
3682,
9348,
1480,
304,
476,
20817,
29901,
1273,
29879,
29915,
1273,
321,
29897,
13,
2
] |
Character.py | AvenirX/Meicraft | 0 | 170075 | # toImpr remove import?
from Skill import the_skill
class Hero:
def __init__(self, name, type_):
self.name = name
self.type_ = type_
self.level = 1
self.EXP = 0
self.__HP = 5
# self.__STR = 2
# self.__AGI = 1
# self.__INT = 1
self.__STA = 1
self.HP = 0
# self.STR = 0
# self.AGI = 0
# self.INT = 0
self.STA = 0
self.SKILLBOOK = ['attack', 'prep', 'defend']
self.money = 0
self.equipments = {
# 'weapon': None,
# 'armour': None,
# 'jewelry': None
}
self.inventory = []
self.loot = self.inventory
self.reset_status()
self.alive = True
def __repr__(self):
return self.name
def change_name(self, new_name):
self.name = new_name
def reset_status(self):
# self.STR = self.__STR
# self.AGI = self.__AGI
# self.INT = self.__INT
self.STA = self.__STA
self.HP = self.__HP + self.STA * 1
def is_alive(self):
return True if self.alive else False
def increase_hp(self, amount):
self.HP += amount
def add_exp(self, amount):
self.EXP += amount
print('{p} gets {e} EXP'.format(p=self.name, e=amount))
# self.level_up()
#
# def level_up(self):
# while self.EXP > level_exp[self.level]:
# self.EXP -= level_exp[self.level]
# self.level += 1
#
# self.__HP += 1
# self.__STR += 2
# self.__AGI += 1
# self.__INT += 1
# self.__STA += 1
#
# self.reset_status()
# print('\t\t\t\t\t\t\t\t\t\tHERO [{p}] LEVEL UP!'.format(p=self.name))
# return
# def acquire_item(self, item_id):
# item = the_item(item_id)()
# self.put_in_item(item)
def put_in_item(self, item):
if item not in self.inventory:
self.inventory.append(item)
def take_out_item(self, item):
self.inventory.remove(item)
def equip_item(self, item):
if item in self.inventory and item.equipment:
self.take_out_item(item)
self.equipments[item.category] = item
def unequip_item(self, item):
if self.equipments[item.category]:
self.equipments[item.category] = None
self.put_in_item(item)
# def increase_level(self, n):
# self.level += n
# print('{p} level is increased by {n}'.format(p=self.name, n=n))
# toImpr new report according to new inventory
# def report_wealth(self):
# print('{p} has {e} EXP, {m} money'.format(
# p=self.name,
# e=self.EXP,
# m=self.money
# ))
#
# print('Bag:\n-----------')
# if self.inventory:
# for item in self.inventory:
# print('{i} x {n}'.format(i=item, n=self.inventory[item]))
# else:
# print('Empty')
# print('-----------')
def add_money(self, amount):
self.money += amount
print('{p} gets {m} money'.format(p=self.name, m=amount))
#
# level_exp = {
# 1: 20,
# 2: 40,
# 3: 80,
# 4: 160
# }
class Fighter(Hero):
def __init__(self, name, type_='STR', is_npc=False):
super(Fighter, self).__init__(name, type_)
self.PHASE = ''
self.MP = 0
self.BATTLESKILLBOOK = {}
self.is_npc = is_npc
self.died_turn = 9999
self.lethal_projectiles = []
self.score = 0
self.kills = 0
self.survive_turns = 0
self.last_move = None
self.incoming_projectiles = None
self.init_turn()
print('Fighter [{name}({type_})] initialized'.format(
name=self.name,
type_=self.type_), end=' ')
print(self.BATTLESKILLBOOK)
def init_battle(self):
self.load_battle_skills()
self.score = 0
self.kills = 0
self.survive_turns = 0
def load_battle_skills(self):
for skill_id in self.SKILLBOOK:
skill = the_skill(skill_id)(self)
self.BATTLESKILLBOOK[skill.key] = skill
for category, equipment in self.equipments.items():
if category in ['weapon', 'armour', 'jewelry']:
skill_id = equipment.skill
skill = the_skill(skill_id)(self)
self.BATTLESKILLBOOK[skill.key] = skill
# def init_skills(self):
# self.BATTLESKILLBOOK = {'A': the_skill('attack')(self),
# 'A2': the_skill('attack2')(self),
# 'D': the_skill('defend')(self),
# 'P': the_skill('prep')(self)}
def init_turn(self):
self.incoming_projectiles = {
'potion': {'heal': [], 'damage': [], 'fill': [], 'drain': []},
'arrow': {'heal': [], 'damage': [], 'fill': [], 'drain': []}
}
self.last_move = '...'
if self.is_alive():
self.survive_turns += 1
# toImpr move to turns over
self.gain_score(1)
def get_available_skills(self):
available_skills = []
for skill_key in self.BATTLESKILLBOOK:
if self.BATTLESKILLBOOK[skill_key].is_available():
available_skills.append(skill_key)
else:
continue
return available_skills
# toImpr move to Hero
def increase_mp(self, amount):
self.MP += amount
def gain_score(self, amount):
self.score += amount
def set_phase(self, phase_type):
self.PHASE = phase_type
def killed_someone(self):
# toImpr move magical nb to global setting
# toImpr scoring move to turns over?
self.gain_score(3)
self.kills += 1
def go_die(self, turn):
self.alive = False
self.died_turn = turn
self.lethal_projectiles = self.incoming_projectiles['arrow']['damage']
def report_status(self):
print('[{n}]: {hp} HP {mp} MP {s}'
.format(n=self.name, hp=self.HP, mp=self.MP, s=str(self.BATTLESKILLBOOK.keys())))
| [
1,
396,
304,
1888,
558,
3349,
1053,
29973,
30004,
13,
3166,
4971,
453,
1053,
278,
29918,
808,
453,
30004,
13,
30004,
13,
30004,
13,
1990,
22167,
29901,
30004,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1024,
29892,
1134,
29918,
1125,
30004,
13,
4706,
1583,
29889,
978,
353,
1024,
30004,
13,
4706,
1583,
29889,
1853,
29918,
353,
1134,
29918,
30004,
13,
30004,
13,
4706,
1583,
29889,
5563,
353,
29871,
29896,
30004,
13,
4706,
1583,
29889,
5746,
29925,
353,
29871,
29900,
30004,
13,
30004,
13,
4706,
1583,
17255,
3954,
353,
29871,
29945,
30004,
13,
4706,
396,
1583,
17255,
10810,
353,
29871,
29906,
30004,
13,
4706,
396,
1583,
17255,
10051,
29902,
353,
29871,
29896,
30004,
13,
4706,
396,
1583,
17255,
10192,
353,
29871,
29896,
30004,
13,
4706,
1583,
17255,
1254,
29909,
353,
29871,
29896,
30004,
13,
30004,
13,
4706,
1583,
29889,
3954,
353,
29871,
29900,
30004,
13,
4706,
396,
1583,
29889,
10810,
353,
29871,
29900,
30004,
13,
4706,
396,
1583,
29889,
10051,
29902,
353,
29871,
29900,
30004,
13,
4706,
396,
1583,
29889,
10192,
353,
29871,
29900,
30004,
13,
4706,
1583,
29889,
1254,
29909,
353,
29871,
29900,
30004,
13,
30004,
13,
4706,
1583,
29889,
16033,
24071,
8456,
8949,
353,
6024,
1131,
547,
742,
525,
15287,
742,
525,
1753,
355,
2033,
30004,
13,
30004,
13,
4706,
1583,
29889,
29885,
4992,
353,
29871,
29900,
30004,
13,
4706,
1583,
29889,
1686,
666,
1860,
353,
3336,
13,
9651,
396,
525,
705,
481,
265,
2396,
6213,
11167,
13,
9651,
396,
525,
2817,
473,
2396,
6213,
11167,
13,
9651,
396,
525,
29926,
809,
295,
719,
2396,
6213,
30004,
13,
4706,
4970,
13,
30004,
13,
4706,
1583,
29889,
262,
23886,
353,
5159,
30004,
13,
4706,
1583,
29889,
417,
327,
353,
1583,
29889,
262,
23886,
30004,
13,
30004,
13,
4706,
1583,
29889,
12071,
29918,
4882,
26471,
13,
30004,
13,
4706,
1583,
29889,
284,
573,
353,
5852,
30004,
13,
30004,
13,
1678,
822,
4770,
276,
558,
12035,
1311,
1125,
30004,
13,
4706,
736,
1583,
29889,
978,
30004,
13,
30004,
13,
1678,
822,
1735,
29918,
978,
29898,
1311,
29892,
716,
29918,
978,
1125,
30004,
13,
4706,
1583,
29889,
978,
353,
716,
29918,
978,
30004,
13,
30004,
13,
1678,
822,
10092,
29918,
4882,
29898,
1311,
1125,
30004,
13,
4706,
396,
1583,
29889,
10810,
353,
1583,
17255,
10810,
30004,
13,
4706,
396,
1583,
29889,
10051,
29902,
353,
1583,
17255,
10051,
29902,
30004,
13,
4706,
396,
1583,
29889,
10192,
353,
1583,
17255,
10192,
30004,
13,
4706,
1583,
29889,
1254,
29909,
353,
1583,
17255,
1254,
29909,
30004,
13,
30004,
13,
4706,
1583,
29889,
3954,
353,
1583,
17255,
3954,
718,
1583,
29889,
1254,
29909,
334,
29871,
29896,
30004,
13,
30004,
13,
1678,
822,
338,
29918,
284,
573,
29898,
1311,
1125,
30004,
13,
4706,
736,
5852,
565,
1583,
29889,
284,
573,
1683,
7700,
30004,
13,
30004,
13,
1678,
822,
7910,
29918,
28887,
29898,
1311,
29892,
5253,
1125,
30004,
13,
4706,
1583,
29889,
3954,
4619,
5253,
30004,
13,
30004,
13,
1678,
822,
788,
29918,
4548,
29898,
1311,
29892,
5253,
1125,
30004,
13,
4706,
1583,
29889,
5746,
29925,
4619,
5253,
30004,
13,
4706,
1596,
877,
29912,
29886,
29913,
4947,
426,
29872,
29913,
8528,
29925,
4286,
4830,
29898,
29886,
29922,
1311,
29889,
978,
29892,
321,
29922,
14506,
876,
30004,
13,
4706,
396,
1583,
29889,
5563,
29918,
786,
26471,
13,
1678,
396,
30004,
13,
1678,
396,
822,
3233,
29918,
786,
29898,
1311,
1125,
30004,
13,
1678,
396,
268,
1550,
1583,
29889,
5746,
29925,
1405,
3233,
29918,
4548,
29961,
1311,
29889,
5563,
5387,
30004,
13,
1678,
396,
308,
1583,
29889,
5746,
29925,
22361,
3233,
29918,
4548,
29961,
1311,
29889,
5563,
29962,
30004,
13,
1678,
396,
308,
1583,
29889,
5563,
4619,
29871,
29896,
30004,
13,
1678,
396,
30004,
13,
1678,
396,
308,
1583,
17255,
3954,
4619,
29871,
29896,
30004,
13,
1678,
396,
308,
1583,
17255,
10810,
4619,
29871,
29906,
30004,
13,
1678,
396,
308,
1583,
17255,
10051,
29902,
4619,
29871,
29896,
30004,
13,
1678,
396,
308,
1583,
17255,
10192,
4619,
29871,
29896,
30004,
13,
1678,
396,
308,
1583,
17255,
1254,
29909,
4619,
29871,
29896,
30004,
13,
1678,
396,
30004,
13,
1678,
396,
308,
1583,
29889,
12071,
29918,
4882,
26471,
13,
1678,
396,
308,
1596,
28909,
29873,
29905,
29873,
29905,
29873,
29905,
29873,
29905,
29873,
29905,
29873,
29905,
29873,
29905,
29873,
29905,
29873,
29905,
29873,
4448,
29949,
15974,
29886,
6525,
11060,
29963,
6670,
11901,
29991,
4286,
4830,
29898,
29886,
29922,
1311,
29889,
978,
876,
30004,
13,
1678,
396,
268,
736,
30004,
13,
30004,
13,
1678,
396,
822,
1274,
1548,
29918,
667,
29898,
1311,
29892,
2944,
29918,
333,
1125,
30004,
13,
1678,
396,
268,
2944,
353,
278,
29918,
667,
29898,
667,
29918,
333,
29897,
26471,
13,
1678,
396,
268,
1583,
29889,
649,
29918,
262,
29918,
667,
29898,
667,
8443,
13,
30004,
13,
1678,
822,
1925,
29918,
262,
29918,
667,
29898,
1311,
29892,
2944,
1125,
30004,
13,
4706,
565,
2944,
451,
297,
1583,
29889,
262,
23886,
29901,
30004,
13,
9651,
1583,
29889,
262,
23886,
29889,
4397,
29898,
667,
8443,
13,
30004,
13,
1678,
822,
2125,
29918,
449,
29918,
667,
29898,
1311,
29892,
2944,
1125,
30004,
13,
4706,
1583,
29889,
262,
23886,
29889,
5992,
29898,
667,
8443,
13,
30004,
13,
1678,
822,
7462,
29918,
667,
29898,
1311,
29892,
2944,
1125,
30004,
13,
4706,
565,
2944,
297,
1583,
29889,
262,
23886,
322,
2944,
29889,
1686,
666,
358,
29901,
30004,
13,
9651,
1583,
29889,
19730,
29918,
449,
29918,
667,
29898,
667,
8443,
13,
9651,
1583,
29889,
1686,
666,
1860,
29961,
667,
29889,
7320,
29962,
353,
2944,
30004,
13,
30004,
13,
1678,
822,
1597,
14254,
29918,
667,
29898,
1311,
29892,
2944,
1125,
30004,
13,
4706,
565,
1583,
29889,
1686,
666,
1860,
29961,
667,
29889,
7320,
5387,
30004,
13,
9651,
1583,
29889,
1686,
666,
1860,
29961,
667,
29889,
7320,
29962,
353,
6213,
30004,
13,
9651,
1583,
29889,
649,
29918,
262,
29918,
667,
29898,
667,
8443,
13,
30004,
13,
1678,
396,
822,
7910,
29918,
5563,
29898,
1311,
29892,
302,
1125,
30004,
13,
1678,
396,
268,
1583,
29889,
5563,
4619,
302,
30004,
13,
1678,
396,
268,
1596,
877,
29912,
29886,
29913,
3233,
338,
11664,
491,
426,
29876,
29913,
4286,
4830,
29898,
29886,
29922,
1311,
29889,
978,
29892,
302,
29922,
29876,
876,
30004,
13,
30004,
13,
1678,
396,
304,
1888,
558,
716,
3461,
5034,
304,
716,
11817,
706,
30004,
13,
1678,
396,
822,
3461,
29918,
24447,
29898,
1311,
1125,
30004,
13,
1678,
396,
268,
1596,
877,
29912,
29886,
29913,
756,
426,
29872,
29913,
8528,
29925,
29892,
426,
29885,
29913,
6909,
4286,
4830,
29898,
30004,
13,
1678,
396,
308,
282,
29922,
1311,
29889,
978,
11167,
13,
1678,
396,
308,
321,
29922,
1311,
29889,
5746,
29925,
11167,
13,
1678,
396,
308,
286,
29922,
1311,
29889,
29885,
4992,
30004,
13,
1678,
396,
418,
876,
30004,
13,
1678,
396,
30004,
13,
1678,
396,
268,
1596,
877,
23544,
3583,
29876,
1378,
5634,
1495,
30004,
13,
1678,
396,
268,
565,
1583,
29889,
262,
23886,
29901,
30004,
13,
1678,
396,
308,
363,
2944,
297,
1583,
29889,
262,
23886,
29901,
30004,
13,
1678,
396,
632,
1596,
877,
29912,
29875,
29913,
921,
426,
29876,
29913,
4286,
4830,
29898,
29875,
29922,
667,
29892,
302,
29922,
1311,
29889,
262,
23886,
29961,
667,
12622,
30004,
13,
1678,
396,
268,
1683,
29901,
30004,
13,
1678,
396,
308,
1596,
877,
8915,
1495,
30004,
13,
1678,
396,
268,
1596,
877,
1378,
5634,
1495,
30004,
13,
30004,
13,
1678,
822,
788,
29918,
29885,
4992,
29898,
1311,
29892,
5253,
1125,
30004,
13,
4706,
1583,
29889,
29885,
4992,
4619,
5253,
30004,
13,
4706,
1596,
877,
29912,
29886,
29913,
4947,
426,
29885,
29913,
6909,
4286,
4830,
29898,
29886,
29922,
1311,
29889,
978,
29892,
286,
29922,
14506,
876,
30004,
13,
30004,
13,
29937,
30004,
13,
29937,
3233,
29918,
4548,
353,
3336,
13,
29937,
418,
29896,
29901,
29871,
29906,
29900,
11167,
13,
29937,
418,
29906,
29901,
29871,
29946,
29900,
11167,
13,
29937,
418,
29941,
29901,
29871,
29947,
29900,
11167,
13,
29937,
418,
29946,
29901,
29871,
29896,
29953,
29900,
30004,
13,
29937,
4970,
13,
30004,
13,
30004,
13,
1990,
383,
14643,
29898,
29950,
1489,
1125,
30004,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1024,
29892,
1134,
29918,
2433,
10810,
742,
338,
29918,
29876,
6739,
29922,
8824,
1125,
30004,
13,
4706,
2428,
29898,
29943,
14643,
29892,
1583,
467,
1649,
2344,
12035,
978,
29892,
1134,
29918,
8443,
13,
4706,
1583,
29889,
19689,
8127,
353,
6629,
30004,
13,
4706,
1583,
29889,
3580,
353,
29871,
29900,
30004,
13,
4706,
1583,
29889,
29933,
1299,
29911,
1307,
16033,
24071,
8456,
8949,
353,
6571,
30004,
13,
30004,
13,
4706,
1583,
29889,
275,
29918,
29876,
6739,
353,
338,
29918,
29876,
6739,
30004,
13,
4706,
1583,
29889,
29881,
1000,
29918,
685,
353,
29871,
29929,
29929,
29929,
29929,
30004,
13,
4706,
1583,
29889,
280,
386,
284,
29918,
4836,
5475,
353,
5159,
30004,
13,
4706,
1583,
29889,
13628,
353,
29871,
29900,
30004,
13,
4706,
1583,
29889,
29895,
6090,
353,
29871,
29900,
30004,
13,
4706,
1583,
29889,
7610,
29894,
573,
29918,
685,
29879,
353,
29871,
29900,
30004,
13,
30004,
13,
4706,
1583,
29889,
4230,
29918,
11631,
353,
6213,
30004,
13,
4706,
1583,
29889,
262,
11506,
29918,
4836,
5475,
353,
6213,
30004,
13,
4706,
1583,
29889,
2344,
29918,
685,
26471,
13,
30004,
13,
4706,
1596,
877,
29943,
14643,
15974,
978,
2119,
29912,
1853,
29918,
1800,
29962,
16601,
4286,
4830,
29898,
30004,
13,
9651,
1024,
29922,
1311,
29889,
978,
11167,
13,
9651,
1134,
29918,
29922,
1311,
29889,
1853,
29918,
511,
1095,
2433,
525,
8443,
13,
4706,
1596,
29898,
1311,
29889,
29933,
1299,
29911,
1307,
16033,
24071,
8456,
8949,
8443,
13,
30004,
13,
1678,
822,
2069,
29918,
29890,
5315,
29898,
1311,
1125,
30004,
13,
4706,
1583,
29889,
1359,
29918,
29890,
5315,
29918,
808,
6090,
26471,
13,
4706,
1583,
29889,
13628,
353,
29871,
29900,
30004,
13,
4706,
1583,
29889,
29895,
6090,
353,
29871,
29900,
30004,
13,
4706,
1583,
29889,
7610,
29894,
573,
29918,
685,
29879,
353,
29871,
29900,
30004,
13,
30004,
13,
1678,
822,
2254,
29918,
29890,
5315,
29918,
808,
6090,
29898,
1311,
1125,
30004,
13,
4706,
363,
19911,
29918,
333,
297,
1583,
29889,
16033,
24071,
8456,
8949,
29901,
30004,
13,
9651,
19911,
353,
278,
29918,
808,
453,
29898,
808,
453,
29918,
333,
5033,
1311,
8443,
13,
9651,
1583,
29889,
29933,
1299,
29911,
1307,
16033,
24071,
8456,
8949,
29961,
808,
453,
29889,
1989,
29962,
353,
19911,
30004,
13,
30004,
13,
4706,
363,
7663,
29892,
21083,
297,
1583,
29889,
1686,
666,
1860,
29889,
7076,
7295,
30004,
13,
9651,
565,
7663,
297,
6024,
705,
481,
265,
742,
525,
2817,
473,
742,
525,
29926,
809,
295,
719,
2033,
29901,
30004,
13,
18884,
19911,
29918,
333,
353,
21083,
29889,
808,
453,
30004,
13,
18884,
19911,
353,
278,
29918,
808,
453,
29898,
808,
453,
29918,
333,
5033,
1311,
8443,
13,
18884,
1583,
29889,
29933,
1299,
29911,
1307,
16033,
24071,
8456,
8949,
29961,
808,
453,
29889,
1989,
29962,
353,
19911,
30004,
13,
30004,
13,
1678,
396,
822,
2069,
29918,
808,
6090,
29898,
1311,
1125,
30004,
13,
1678,
396,
268,
1583,
29889,
29933,
1299,
29911,
1307,
16033,
24071,
8456,
8949,
353,
11117,
29909,
2396,
278,
29918,
808,
453,
877,
1131,
547,
1495,
29898,
1311,
511,
30004,
13,
1678,
396,
462,
632,
525,
29909,
29906,
2396,
278,
29918,
808,
453,
877,
1131,
547,
29906,
1495,
29898,
1311,
511,
30004,
13,
1678,
396,
462,
632,
525,
29928,
2396,
278,
29918,
808,
453,
877,
1753,
355,
1495,
29898,
1311,
511,
30004,
13,
1678,
396,
462,
632,
525,
29925,
2396,
278,
29918,
808,
453,
877,
15287,
1495,
29898,
1311,
2915,
30004,
13,
30004,
13,
1678,
822,
2069,
29918,
685,
29898,
1311,
1125,
30004,
13,
4706,
1583,
29889,
262,
11506,
29918,
4836,
5475,
353,
3336,
13,
9651,
525,
29886,
8194,
2396,
11117,
354,
284,
2396,
19997,
525,
16846,
482,
2396,
19997,
525,
5589,
2396,
19997,
525,
29881,
6038,
2396,
5159,
1118,
30004,
13,
9651,
525,
2936,
2396,
11117,
354,
284,
2396,
19997,
525,
16846,
482,
2396,
19997,
525,
5589,
2396,
19997,
525,
29881,
6038,
2396,
5159,
8117,
13,
4706,
4970,
13,
4706,
1583,
29889,
4230,
29918,
11631,
353,
525,
856,
29915,
30004,
13,
4706,
565,
1583,
29889,
275,
29918,
284,
573,
7295,
30004,
13,
9651,
1583,
29889,
7610,
29894,
573,
29918,
685,
29879,
4619,
29871,
29896,
30004,
13,
9651,
396,
304,
1888,
558,
4337,
304,
12169,
975,
30004,
13,
9651,
1583,
29889,
29887,
475,
29918,
13628,
29898,
29896,
8443,
13,
30004,
13,
1678,
822,
679,
29918,
16515,
29918,
808,
6090,
29898,
1311,
1125,
30004,
13,
4706,
3625,
29918,
808,
6090,
353,
5159,
30004,
13,
4706,
363,
19911,
29918,
1989,
297,
1583,
29889,
29933,
1299,
29911,
1307,
16033,
24071,
8456,
8949,
29901,
30004,
13,
9651,
565,
1583,
29889,
29933,
1299,
29911,
1307,
16033,
24071,
8456,
8949,
29961,
808,
453,
29918,
1989,
1822,
275,
29918,
16515,
7295,
30004,
13,
18884,
3625,
29918,
808,
6090,
29889,
4397,
29898,
808,
453,
29918,
1989,
8443,
13,
9651,
1683,
29901,
30004,
13,
18884,
6773,
30004,
13,
4706,
736,
3625,
29918,
808,
6090,
30004,
13,
30004,
13,
1678,
396,
304,
1888,
558,
4337,
304,
22167,
30004,
13,
1678,
822,
7910,
29918,
1526,
29898,
1311,
29892,
5253,
1125,
30004,
13,
4706,
1583,
29889,
3580,
4619,
5253,
30004,
13,
30004,
13,
1678,
822,
11581,
29918,
13628,
29898,
1311,
29892,
5253,
1125,
30004,
13,
4706,
1583,
29889,
13628,
4619,
5253,
30004,
13,
30004,
13,
1678,
822,
731,
29918,
21646,
29898,
1311,
29892,
8576,
29918,
1853,
1125,
30004,
13,
4706,
1583,
29889,
19689,
8127,
353,
8576,
29918,
1853,
30004,
13,
30004,
13,
1678,
822,
9445,
29918,
5372,
650,
29898,
1311,
1125,
30004,
13,
4706,
396,
304,
1888,
558,
4337,
2320,
936,
302,
29890,
304,
5534,
4444,
30004,
13,
4706,
396,
304,
1888,
558,
26654,
4337,
304,
12169,
975,
29973,
30004,
13,
4706,
1583,
29889,
29887,
475,
29918,
13628,
29898,
29941,
8443,
13,
4706,
1583,
29889,
29895,
6090,
4619,
29871,
29896,
30004,
13,
30004,
13,
1678,
822,
748,
29918,
16217,
29898,
1311,
29892,
2507,
1125,
30004,
13,
4706,
1583,
29889,
284,
573,
353,
7700,
30004,
13,
4706,
1583,
29889,
29881,
1000,
29918,
685,
353,
2507,
30004,
13,
4706,
1583,
29889,
280,
386,
284,
29918,
4836,
5475,
353,
1583,
29889,
262,
11506,
29918,
4836,
5475,
1839,
2936,
16215,
16846,
482,
2033,
30004,
13,
30004,
13,
1678,
822,
3461,
29918,
4882,
29898,
1311,
1125,
30004,
13,
4706,
1596,
877,
19660,
29876,
29913,
5387,
426,
28887,
29913,
379,
29925,
426,
1526,
29913,
16379,
426,
29879,
10162,
30004,
13,
795,
869,
4830,
29898,
29876,
29922,
1311,
29889,
978,
29892,
298,
29886,
29922,
1311,
29889,
3954,
29892,
22326,
29922,
1311,
29889,
3580,
29892,
269,
29922,
710,
29898,
1311,
29889,
29933,
1299,
29911,
1307,
16033,
24071,
8456,
8949,
29889,
8149,
580,
4961,
30004,
13,
30004,
13,
30004,
13,
30004,
13,
30004,
13,
30004,
13,
30004,
13,
30004,
13,
2
] |
apps/views.py | Edwardhgj/meiduo | 0 | 7292 | <reponame>Edwardhgj/meiduo
from django.shortcuts import render
from django.http import HttpResponse
from django.contrib.auth.hashers import check_password, make_password
from django.views import View
from utils.response_code import RET, error_map
from rest_framework.views import APIView
from rest_framework.response import Response
from apps.serializers import *
from datetime import datetime
# Create your views here.
# 展示登陆页
def login(request):
return render(request, 'admin/login.html')
# 提交登陆
import json
class SubmitLogin(View):
def post(self, request): #反射
mes = {}
name = request.POST.get('name')
passwd = request.POST.get('passwd')
# print(name,passwd)
if not all([name, passwd]):
mes['code'] = RET.DATAERR
mes['message'] = error_map[RET.DATAERR]
else:
# 查询name
admin = Sadmin.objects.filter(username=name).first()
print(admin.username)
if admin:
# 比较密码
if check_password(passwd, admin.password):
# 登陆成功
request.session['admin_id'] = admin.id
mes['code'] = RET.OK
mes['message'] = error_map[RET.OK]
else:
mes['code'] = RET.PWDERR
mes['message'] = error_map[RET.PWDERR]
else:
mes['code'] = RET.USERERR
mes['message'] = error_map[RET.USERERR]
print('sdfsdfssdf')
return HttpResponse(json.dumps(mes))
# 注册
def reg(request):
password = <PASSWORD>_password('<PASSWORD>')
admin = Sadmin(username='admin', password=password, is_admin=True)
admin.save()
return HttpResponse('ok')
# 展示首页
def index(request):
admin_id = request.session.get('admin_id')
if admin_id:
admin = Sadmin.objects.get(id=admin_id)
return render(request, 'admin/index.html', locals())
# 展示分类页面
def showCate(request):
return render(request, "admin/cate_list.html")
# 展示新闻页面
def showNews(request):
return render(request, "admin/news_list.html")
#展示焦点图页面
def bannersCate(request):
return render(request, "admin/point_list.html")
#展示标签页面
def tagCate(request):
return render(request, "admin/tag_list.html")
#展示商品页面
def goodsCate(request):
return render(request, "admin/goods_list.html")
#展示商品页面
def newsCate(request):
return render(request, "admin/news_list.html")
#展示焦点图页面
def bannersCate(request):
return render(request, "admin/point_list.html")
# 分类列表
class CateList(APIView):
def get(self, request):
cate = Cate.objects.all()
c = CateModelSerializer(cate, many=True)
mes = {}
mes['code'] = RET.OK
mes['cateList'] = c.data
return Response(mes)
#标签列表
class TagList(APIView):
def get(self, request):
tags = Tags.objects.all()
c = TagModelSerializer(tags, many=True)
mes = {}
mes['code'] = RET.OK
mes['tagList'] = c.data
return Response(mes)
# 商品列表
class GoodsList(APIView):
def get(self, request):
goods = Goods.objects.all()
g = GoodsModelSerializer(goods, many=True)
mes = {}
mes['code'] = RET.OK
mes['goodsList'] = g.data
return Response(mes)
#新闻列表
class NewsList(APIView):
def get(self, request):
news = News.objects.all()
n=NewsModelSerializer(news,many=True)
mes = {}
mes['code'] = RET.OK
mes['newsList'] = n.data
return Response(mes)
#焦点图列表
class BannersList(APIView):
def get(self, request):
banners = Banners.objects.all()
n=BannersModelSerializer(banners,many=True)
mes = {}
mes['code'] = RET.OK
mes['bannersList'] = n.data
return Response(mes)
# 添加分类页面
def addCate(request):
# 获取一级分类
cate = Cate.objects.filter(pid=0).all()
id=request.GET.get('id')
try:
#修改
one_cate=Cate.objects.get(id=id)
print(one_cate)
except:
id=""
return render(request, "admin/add_cate.html", locals())
# 添加标签页面
def addTag(request):
# print('sdf')
cate_list = Cate.objects.all()
id=request.GET.get('id')
try:
#修改
one_tag=Tags.objects.get(id=id)
except:
id=""
return render(request, "admin/add_tag.html", locals())
# 添加商品页面
def addGoods(request):
# print('ceshi')
# 获取所有商品
goods = Goods.objects.all()
cates = Cate.objects.all()
tag_list=Tags.objects.all()
id=request.GET.get('id')
print(id)
try:
one_goods=Goods.objects.get(id=id)
# print(one_goods)
except:
id=""
return render(request, "admin/add_goods.html", locals())
# 添加商品页面
def addNews(request):
# print('ceshi')
# 获取所有商品
news = News.objects.all()
#修改时需要传id
id=request.GET.get('id')
print(id)
try:
one_news=News.objects.get(id=id)
# print(one_goods)
except:
id=""
return render(request, "admin/add_news.html", locals())
# 添加焦点图页面
def addBanners(request):
# print('ceshi')
# 获取所有商品
banners = Banners.objects.all()
#修改时需要传id
id=request.GET.get('id')
print(id)
try:
one_banner=Banners.objects.get(id=id)
# print(one_goods)
except:
id=""
return render(request, "admin/add_banners.html", locals())
from day01.settings import UPLOADFILES
import os
# 上传图片方法
def upload_img(img):
if img:
f = open(os.path.join(UPLOADFILES, '', img.name),'wb')
for chunk in img.chunks():
f.write(chunk)
f.close()
img=datetime.now().strftime("%Y-%m-%d-%H-%M-%S")+img.name
return 'http://127.0.0.1:8000/static/upload/'+img
return ' '
#富文本上传图片
def addnews_upload(request):
files = request.FILES.get('file')
path = upload_img(files)
mes = {
'path': path,
'error': False
}
return HttpResponse(json.dumps(mes))
# 增加分类接口
class SubmitAddCate(APIView):
def post(self, request):
content = request.data
print(content)
# 上传图片
img = request.FILES.get('img')
path=upload_img(img)
content['picture']=path
try:
pid=int(content['pid'])
except:
pid=0
# 通过pic构造top_id,type
if pid == 0:
type = 1
top_id = 0
else:
cate = Cate.objects.get(id=pid)
type = cate.type + 1
if cate.top_id==0:
top_id = cate.id
else:
top_id = cate.top_id
print(top_id,pid,type)
content['type'] = type
content['top_id'] = top_id
try:
id=int(content['id'])
except:
id=0
if id>0:
cc=Cate.objects.get(id=id)
c=CateSerializer(cc,data=content)
#修改
else:
c = CateSerializer(data=content)
mes={}
if c.is_valid():
try:
c.save()
mes['code'] = RET.OK
except:
mes['code'] = RET.DATAERR
else:
print(c.errors)
mes['code'] = RET.DATAERR
return Response(mes)
#删除分类
def deleteCate(request):
id=request.GET.get('id')
Cate.objects.get(id=id).delete()
return render(request, "admin/cate_list.html")
# 增加标签接口
class SubmitAddTag(APIView):
def post(self, request):
content = request.data
print(content)
try:
id = int(content['id']) # 取出id
print(id)
print('di 到这了')
except:
id = 0
if id > 0:
dd = Tags.objects.get(id=id)
d = TagSerializer(dd, data=content)
# 修改
else:
d = TagSerializer(data=content)
mes = {}
if d.is_valid():
try:
d.save()
mes['code'] = RET.OK
except:
mes['code'] = RET.DATAERR
else:
mes['code'] = RET.DATAERR
return Response(mes)
#删除标签
def deleteTag(request):
id=request.GET.get('id')
Cate.objects.get(id=id).delete()
return render(request, "admin/tag_list.html")
# 增加商品接口
class SubmitAddGoods(APIView):
def post(self, request):
# print('eerw')
content = request.data
print(content)
print(content['id'])
print(content['cid_id'])
# 上传图片
img = request.FILES.get('img')
path=upload_img(img)
content['picture']=path
one_cate=Cate.objects.get(id=int(content['cid_id']))
print(one_cate)
content['top_id'] = one_cate.top_id
try:
print('测试代码')
id=int(content['id'])
print(id)
except:
id=0
if id>0:
# 修改商品
instance = Goods.objects.get(id=id)
c = GoodsSerializer(instance, data=content)
else:
c = GoodsSerializer(data=content)
mes={}
if c.is_valid():
c.save()
mes['code'] = RET.OK
else:
print(c.errors)
mes['code'] = RET.DATAERR
return Response(mes)
#删除商品
def deleteGoods(request):
id=request.GET.get('id')
Goods.objects.get(id=id).delete()
return render(request, "admin/goods_list.html")
#添加新闻接口
class SubmitAddNews(APIView):
def post(self,request):
content=request.data
print(content)
try:
id = int(content['id']) # 取出id
except:
id = 0
if id > 0:
print(id)
nn = News.objects.get(id=id)
d = NewsSerializer(nn, data=content)
# 修改
else:
d = NewsSerializer(data=content)
mes = {}
if d.is_valid():
try:
d.save()
mes['code'] = RET.OK
except:
mes['code'] = RET.DATAERR
else:
mes['code'] = RET.DATAERR
return Response(mes)
#删除新闻
def deleteNews(request):
id=request.GET.get('id')
News.objects.get(id=id).delete()
return render(request,"admin/news_list.html")
#删除焦点图
def deleteBanners(request):
id=request.GET.get('id')
Banners.objects.get(id=id).delete()
return render(request,"admin/point_list.html")
#添加焦点图接口
class SubmitAddBanner(APIView):
def post(self,request):
content=request.data
print(content)
try:
id = int(content['id']) # 取出id
except:
id = 0
if id > 0:
print(id)
nn = Banners.objects.get(id=id)
d = BannersSerializer(nn, data=content)
# 修改
else:
d = BannersSerializer(data=content)
mes = {}
if d.is_valid():
try:
d.save()
mes['code'] = RET.OK
except:
mes['code'] = RET.DATAERR
else:
mes['code'] = RET.DATAERR
return Response(mes)
def user_count(request):
return render(request,'admin/user_count.html')
| [
1,
529,
276,
1112,
420,
29958,
3853,
1328,
29882,
29887,
29926,
29914,
1004,
333,
25608,
13,
3166,
9557,
29889,
12759,
7582,
29879,
1053,
4050,
13,
3166,
9557,
29889,
1124,
1053,
9056,
5103,
13,
13,
3166,
9557,
29889,
21570,
29889,
5150,
29889,
8568,
414,
1053,
1423,
29918,
5630,
29892,
1207,
29918,
5630,
13,
3166,
9557,
29889,
7406,
1053,
4533,
13,
3166,
3667,
29879,
29889,
5327,
29918,
401,
1053,
28081,
29892,
1059,
29918,
1958,
13,
3166,
1791,
29918,
4468,
29889,
7406,
1053,
3450,
1043,
13,
3166,
1791,
29918,
4468,
29889,
5327,
1053,
13291,
13,
3166,
11446,
29889,
15550,
19427,
1053,
334,
13,
3166,
12865,
1053,
12865,
13,
13,
29937,
6204,
596,
8386,
1244,
29889,
13,
13,
13,
29937,
29871,
31599,
30858,
31451,
236,
156,
137,
31610,
13,
1753,
6464,
29898,
3827,
1125,
13,
1678,
736,
4050,
29898,
3827,
29892,
525,
6406,
29914,
7507,
29889,
1420,
1495,
13,
13,
29937,
29871,
31302,
31398,
31451,
236,
156,
137,
13,
5215,
4390,
13,
13,
13,
1990,
3323,
2415,
11049,
29898,
1043,
1125,
13,
1678,
822,
1400,
29898,
1311,
29892,
2009,
1125,
29871,
396,
31908,
232,
179,
135,
13,
13,
4706,
4883,
353,
6571,
13,
4706,
1024,
353,
2009,
29889,
5438,
29889,
657,
877,
978,
1495,
13,
4706,
1209,
9970,
353,
2009,
29889,
5438,
29889,
657,
877,
3364,
9970,
1495,
13,
4706,
396,
1596,
29898,
978,
29892,
3364,
9970,
29897,
13,
13,
4706,
565,
451,
599,
4197,
978,
29892,
1209,
9970,
29962,
1125,
13,
9651,
4883,
1839,
401,
2033,
353,
28081,
29889,
14573,
21662,
13,
9651,
4883,
1839,
4906,
2033,
353,
1059,
29918,
1958,
29961,
1525,
29911,
29889,
14573,
21662,
29962,
13,
4706,
1683,
29901,
13,
9651,
396,
29871,
31213,
235,
178,
165,
978,
13,
13,
9651,
4113,
353,
317,
6406,
29889,
12650,
29889,
4572,
29898,
6786,
29922,
978,
467,
4102,
580,
13,
9651,
1596,
29898,
6406,
29889,
6786,
29897,
13,
9651,
565,
4113,
29901,
13,
18884,
396,
29871,
31419,
235,
193,
134,
31461,
31183,
13,
18884,
565,
1423,
29918,
5630,
29898,
3364,
9970,
29892,
4113,
29889,
5630,
1125,
13,
462,
1678,
396,
29871,
31451,
236,
156,
137,
30494,
31134,
13,
462,
1678,
2009,
29889,
7924,
1839,
6406,
29918,
333,
2033,
353,
4113,
29889,
333,
13,
462,
1678,
4883,
1839,
401,
2033,
353,
28081,
29889,
8949,
13,
462,
1678,
4883,
1839,
4906,
2033,
353,
1059,
29918,
1958,
29961,
1525,
29911,
29889,
8949,
29962,
13,
18884,
1683,
29901,
13,
462,
1678,
4883,
1839,
401,
2033,
353,
28081,
29889,
29925,
29956,
8032,
29934,
13,
462,
1678,
4883,
1839,
4906,
2033,
353,
1059,
29918,
1958,
29961,
1525,
29911,
29889,
29925,
29956,
8032,
29934,
29962,
13,
9651,
1683,
29901,
13,
18884,
4883,
1839,
401,
2033,
353,
28081,
29889,
11889,
21662,
13,
18884,
4883,
1839,
4906,
2033,
353,
1059,
29918,
1958,
29961,
1525,
29911,
29889,
11889,
21662,
29962,
13,
9651,
1596,
877,
29879,
29069,
2176,
893,
2176,
1495,
13,
4706,
736,
9056,
5103,
29898,
3126,
29889,
29881,
17204,
29898,
4467,
876,
13,
13,
13,
29937,
29871,
31368,
232,
137,
143,
13,
1753,
1072,
29898,
3827,
1125,
13,
1678,
4800,
353,
529,
25711,
17013,
29958,
29918,
5630,
877,
29966,
25711,
17013,
29958,
1495,
13,
1678,
4113,
353,
317,
6406,
29898,
6786,
2433,
6406,
742,
4800,
29922,
5630,
29892,
338,
29918,
6406,
29922,
5574,
29897,
13,
1678,
4113,
29889,
7620,
580,
13,
1678,
736,
9056,
5103,
877,
554,
1495,
13,
13,
13,
29937,
29871,
31599,
30858,
31688,
31610,
13,
1753,
2380,
29898,
3827,
1125,
13,
1678,
4113,
29918,
333,
353,
2009,
29889,
7924,
29889,
657,
877,
6406,
29918,
333,
1495,
13,
1678,
565,
4113,
29918,
333,
29901,
13,
4706,
4113,
353,
317,
6406,
29889,
12650,
29889,
657,
29898,
333,
29922,
6406,
29918,
333,
29897,
13,
1678,
736,
4050,
29898,
3827,
29892,
525,
6406,
29914,
2248,
29889,
1420,
742,
1180,
1338,
3101,
13,
13,
13,
29937,
29871,
31599,
30858,
30748,
30832,
31610,
30806,
13,
1753,
1510,
29907,
403,
29898,
3827,
1125,
13,
1678,
736,
4050,
29898,
3827,
29892,
376,
6406,
29914,
29883,
403,
29918,
1761,
29889,
1420,
1159,
13,
13,
13,
29937,
29871,
31599,
30858,
30374,
236,
154,
190,
31610,
30806,
13,
1753,
1510,
29328,
29898,
3827,
1125,
13,
1678,
736,
4050,
29898,
3827,
29892,
376,
6406,
29914,
15753,
29918,
1761,
29889,
1420,
1159,
13,
13,
13,
29937,
31599,
30858,
234,
135,
169,
30940,
30861,
31610,
30806,
13,
1753,
289,
812,
414,
29907,
403,
29898,
3827,
1125,
13,
1678,
736,
4050,
29898,
3827,
29892,
376,
6406,
29914,
3149,
29918,
1761,
29889,
1420,
1159,
13,
13,
29937,
31599,
30858,
31062,
234,
176,
193,
31610,
30806,
13,
1753,
4055,
29907,
403,
29898,
3827,
1125,
13,
1678,
736,
4050,
29898,
3827,
29892,
376,
6406,
29914,
4039,
29918,
1761,
29889,
1420,
1159,
13,
13,
29937,
31599,
30858,
31427,
31399,
31610,
30806,
13,
1753,
22535,
29907,
403,
29898,
3827,
1125,
13,
1678,
736,
4050,
29898,
3827,
29892,
376,
6406,
29914,
16773,
29879,
29918,
1761,
29889,
1420,
1159,
13,
13,
29937,
31599,
30858,
31427,
31399,
31610,
30806,
13,
1753,
9763,
29907,
403,
29898,
3827,
1125,
13,
1678,
736,
4050,
29898,
3827,
29892,
376,
6406,
29914,
15753,
29918,
1761,
29889,
1420,
1159,
13,
13,
29937,
31599,
30858,
234,
135,
169,
30940,
30861,
31610,
30806,
13,
1753,
289,
812,
414,
29907,
403,
29898,
3827,
1125,
13,
1678,
736,
4050,
29898,
3827,
29892,
376,
6406,
29914,
3149,
29918,
1761,
29889,
1420,
1159,
13,
13,
29937,
29871,
30748,
30832,
31025,
30746,
13,
1990,
315,
403,
1293,
29898,
8787,
1043,
1125,
13,
1678,
822,
679,
29898,
1311,
29892,
2009,
1125,
13,
4706,
274,
403,
353,
315,
403,
29889,
12650,
29889,
497,
580,
13,
4706,
274,
353,
315,
403,
3195,
17679,
29898,
29883,
403,
29892,
1784,
29922,
5574,
29897,
13,
4706,
4883,
353,
6571,
13,
4706,
4883,
1839,
401,
2033,
353,
28081,
29889,
8949,
13,
4706,
4883,
1839,
29883,
403,
1293,
2033,
353,
274,
29889,
1272,
13,
4706,
736,
13291,
29898,
4467,
29897,
13,
13,
13,
13,
29937,
31062,
234,
176,
193,
31025,
30746,
13,
1990,
10522,
1293,
29898,
8787,
1043,
1125,
13,
1678,
822,
679,
29898,
1311,
29892,
2009,
1125,
13,
4706,
8282,
353,
917,
29889,
12650,
29889,
497,
580,
13,
4706,
274,
353,
10522,
3195,
17679,
29898,
11338,
29892,
1784,
29922,
5574,
29897,
13,
4706,
4883,
353,
6571,
13,
4706,
4883,
1839,
401,
2033,
353,
28081,
29889,
8949,
13,
4706,
4883,
1839,
4039,
1293,
2033,
353,
274,
29889,
1272,
13,
4706,
736,
13291,
29898,
4467,
29897,
13,
13,
13,
29937,
29871,
31427,
31399,
31025,
30746,
13,
1990,
7197,
29879,
1293,
29898,
8787,
1043,
1125,
13,
1678,
822,
679,
29898,
1311,
29892,
2009,
1125,
13,
4706,
22535,
353,
7197,
29879,
29889,
12650,
29889,
497,
580,
13,
13,
4706,
330,
353,
7197,
29879,
3195,
17679,
29898,
16773,
29879,
29892,
1784,
29922,
5574,
29897,
13,
4706,
4883,
353,
6571,
13,
4706,
4883,
1839,
401,
2033,
353,
28081,
29889,
8949,
13,
4706,
4883,
1839,
16773,
29879,
1293,
2033,
353,
330,
29889,
1272,
13,
4706,
736,
13291,
29898,
4467,
29897,
13,
13,
29937,
30374,
236,
154,
190,
31025,
30746,
13,
1990,
10130,
1293,
29898,
8787,
1043,
1125,
13,
1678,
822,
679,
29898,
1311,
29892,
2009,
1125,
13,
4706,
9763,
353,
10130,
29889,
12650,
29889,
497,
580,
13,
13,
4706,
302,
29922,
29328,
3195,
17679,
29898,
15753,
29892,
13011,
29922,
5574,
29897,
13,
4706,
4883,
353,
6571,
13,
4706,
4883,
1839,
401,
2033,
353,
28081,
29889,
8949,
13,
4706,
4883,
1839,
15753,
1293,
2033,
353,
302,
29889,
1272,
13,
4706,
736,
13291,
29898,
4467,
29897,
13,
13,
13,
29937,
234,
135,
169,
30940,
30861,
31025,
30746,
13,
1990,
350,
812,
414,
1293,
29898,
8787,
1043,
1125,
13,
1678,
822,
679,
29898,
1311,
29892,
2009,
1125,
13,
4706,
289,
812,
414,
353,
350,
812,
414,
29889,
12650,
29889,
497,
580,
13,
13,
4706,
302,
29922,
29933,
812,
414,
3195,
17679,
29898,
29890,
812,
414,
29892,
13011,
29922,
5574,
29897,
13,
4706,
4883,
353,
6571,
13,
4706,
4883,
1839,
401,
2033,
353,
28081,
29889,
8949,
13,
4706,
4883,
1839,
29890,
812,
414,
1293,
2033,
353,
302,
29889,
1272,
13,
4706,
736,
13291,
29898,
4467,
29897,
13,
13,
13,
13,
13,
13,
29937,
29871,
31538,
30666,
30748,
30832,
31610,
30806,
13,
1753,
788,
29907,
403,
29898,
3827,
1125,
13,
1678,
396,
29871,
31024,
30683,
30287,
234,
189,
170,
30748,
30832,
13,
1678,
274,
403,
353,
315,
403,
29889,
12650,
29889,
4572,
29898,
5935,
29922,
29900,
467,
497,
580,
13,
1678,
1178,
29922,
3827,
29889,
7194,
29889,
657,
877,
333,
1495,
13,
1678,
1018,
29901,
13,
4706,
396,
31273,
31264,
13,
4706,
697,
29918,
29883,
403,
29922,
29907,
403,
29889,
12650,
29889,
657,
29898,
333,
29922,
333,
29897,
13,
4706,
1596,
29898,
650,
29918,
29883,
403,
29897,
13,
1678,
5174,
29901,
13,
4706,
1178,
13776,
13,
1678,
736,
4050,
29898,
3827,
29892,
376,
6406,
29914,
1202,
29918,
29883,
403,
29889,
1420,
613,
1180,
1338,
3101,
13,
13,
13,
13,
29937,
29871,
31538,
30666,
31062,
234,
176,
193,
31610,
30806,
13,
1753,
788,
8176,
29898,
3827,
1125,
13,
1678,
396,
1596,
877,
29879,
2176,
1495,
13,
1678,
274,
403,
29918,
1761,
353,
315,
403,
29889,
12650,
29889,
497,
580,
13,
1678,
1178,
29922,
3827,
29889,
7194,
29889,
657,
877,
333,
1495,
13,
1678,
1018,
29901,
13,
4706,
396,
31273,
31264,
13,
4706,
697,
29918,
4039,
29922,
28089,
29889,
12650,
29889,
657,
29898,
333,
29922,
333,
29897,
13,
1678,
5174,
29901,
13,
4706,
1178,
13776,
13,
1678,
736,
4050,
29898,
3827,
29892,
376,
6406,
29914,
1202,
29918,
4039,
29889,
1420,
613,
1180,
1338,
3101,
13,
13,
13,
29937,
29871,
31538,
30666,
31427,
31399,
31610,
30806,
13,
1753,
788,
18420,
29879,
29898,
3827,
1125,
13,
1678,
396,
1596,
877,
778,
2918,
1495,
13,
1678,
396,
29871,
31024,
30683,
30744,
30417,
31427,
31399,
13,
1678,
22535,
353,
7197,
29879,
29889,
12650,
29889,
497,
580,
13,
1678,
274,
1078,
353,
315,
403,
29889,
12650,
29889,
497,
580,
13,
1678,
4055,
29918,
1761,
29922,
28089,
29889,
12650,
29889,
497,
580,
13,
1678,
1178,
29922,
3827,
29889,
7194,
29889,
657,
877,
333,
1495,
13,
1678,
1596,
29898,
333,
29897,
13,
1678,
1018,
29901,
13,
4706,
697,
29918,
16773,
29879,
29922,
18420,
29879,
29889,
12650,
29889,
657,
29898,
333,
29922,
333,
29897,
13,
4706,
396,
1596,
29898,
650,
29918,
16773,
29879,
29897,
13,
1678,
5174,
29901,
13,
4706,
1178,
13776,
13,
1678,
736,
4050,
29898,
3827,
29892,
376,
6406,
29914,
1202,
29918,
16773,
29879,
29889,
1420,
613,
1180,
1338,
3101,
13,
13,
13,
29937,
29871,
31538,
30666,
31427,
31399,
31610,
30806,
13,
1753,
788,
29328,
29898,
3827,
1125,
13,
1678,
396,
1596,
877,
778,
2918,
1495,
13,
1678,
396,
29871,
31024,
30683,
30744,
30417,
31427,
31399,
13,
1678,
9763,
353,
10130,
29889,
12650,
29889,
497,
580,
13,
1678,
396,
31273,
31264,
30594,
31383,
30698,
31471,
333,
13,
1678,
1178,
29922,
3827,
29889,
7194,
29889,
657,
877,
333,
1495,
13,
1678,
1596,
29898,
333,
29897,
13,
1678,
1018,
29901,
13,
4706,
697,
29918,
15753,
29922,
29328,
29889,
12650,
29889,
657,
29898,
333,
29922,
333,
29897,
13,
4706,
396,
1596,
29898,
650,
29918,
16773,
29879,
29897,
13,
1678,
5174,
29901,
13,
4706,
1178,
13776,
13,
1678,
736,
4050,
29898,
3827,
29892,
376,
6406,
29914,
1202,
29918,
15753,
29889,
1420,
613,
1180,
1338,
3101,
13,
13,
13,
13,
29937,
29871,
31538,
30666,
234,
135,
169,
30940,
30861,
31610,
30806,
13,
1753,
788,
29933,
812,
414,
29898,
3827,
1125,
13,
1678,
396,
1596,
877,
778,
2918,
1495,
13,
1678,
396,
29871,
31024,
30683,
30744,
30417,
31427,
31399,
13,
1678,
289,
812,
414,
353,
350,
812,
414,
29889,
12650,
29889,
497,
580,
13,
1678,
396,
31273,
31264,
30594,
31383,
30698,
31471,
333,
13,
1678,
1178,
29922,
3827,
29889,
7194,
29889,
657,
877,
333,
1495,
13,
1678,
1596,
29898,
333,
29897,
13,
1678,
1018,
29901,
13,
4706,
697,
29918,
29890,
7310,
29922,
29933,
812,
414,
29889,
12650,
29889,
657,
29898,
333,
29922,
333,
29897,
13,
4706,
396,
1596,
29898,
650,
29918,
16773,
29879,
29897,
13,
1678,
5174,
29901,
13,
4706,
1178,
13776,
13,
1678,
736,
4050,
29898,
3827,
29892,
376,
6406,
29914,
1202,
29918,
29890,
812,
414,
29889,
1420,
613,
1180,
1338,
3101,
13,
13,
13,
13,
13,
3166,
2462,
29900,
29896,
29889,
11027,
1053,
11901,
29428,
24483,
13,
5215,
2897,
13,
13,
13,
29937,
29871,
30429,
31471,
30861,
31122,
30525,
30545,
13,
1753,
6441,
29918,
2492,
29898,
2492,
1125,
13,
1678,
565,
10153,
29901,
13,
4706,
285,
353,
1722,
29898,
359,
29889,
2084,
29889,
7122,
29898,
4897,
29428,
24483,
29892,
15516,
10153,
29889,
978,
511,
29915,
29893,
29890,
1495,
13,
4706,
363,
19875,
297,
10153,
29889,
305,
18801,
7295,
13,
9651,
285,
29889,
3539,
29898,
29812,
29897,
13,
4706,
285,
29889,
5358,
580,
13,
4706,
10153,
29922,
12673,
29889,
3707,
2141,
710,
615,
603,
11702,
29979,
19222,
29885,
19222,
29881,
19222,
29950,
19222,
29924,
19222,
29903,
1159,
29974,
2492,
29889,
978,
13,
4706,
736,
525,
1124,
597,
29896,
29906,
29955,
29889,
29900,
29889,
29900,
29889,
29896,
29901,
29947,
29900,
29900,
29900,
29914,
7959,
29914,
9009,
29914,
18717,
2492,
13,
1678,
736,
525,
525,
13,
13,
13,
29937,
31730,
30333,
30346,
30429,
31471,
30861,
31122,
13,
1753,
788,
15753,
29918,
9009,
29898,
3827,
1125,
13,
1678,
2066,
353,
2009,
29889,
24483,
29889,
657,
877,
1445,
1495,
13,
1678,
2224,
353,
6441,
29918,
2492,
29898,
5325,
29897,
13,
1678,
4883,
353,
426,
13,
4706,
525,
2084,
2396,
2224,
29892,
13,
4706,
525,
2704,
2396,
7700,
13,
1678,
500,
13,
1678,
736,
9056,
5103,
29898,
3126,
29889,
29881,
17204,
29898,
4467,
876,
13,
13,
13,
13,
29937,
29871,
232,
165,
161,
30666,
30748,
30832,
31092,
30856,
13,
1990,
3323,
2415,
2528,
29907,
403,
29898,
8787,
1043,
1125,
13,
1678,
822,
1400,
29898,
1311,
29892,
2009,
1125,
13,
4706,
2793,
353,
2009,
29889,
1272,
13,
13,
4706,
1596,
29898,
3051,
29897,
13,
4706,
396,
29871,
30429,
31471,
30861,
31122,
13,
4706,
10153,
353,
2009,
29889,
24483,
29889,
657,
877,
2492,
1495,
13,
4706,
2224,
29922,
9009,
29918,
2492,
29898,
2492,
29897,
13,
4706,
2793,
1839,
12095,
2033,
29922,
2084,
13,
4706,
1018,
29901,
13,
9651,
23107,
29922,
524,
29898,
3051,
1839,
5935,
11287,
13,
4706,
5174,
29901,
13,
9651,
23107,
29922,
29900,
13,
4706,
396,
29871,
30768,
31138,
16447,
31901,
31420,
3332,
29918,
333,
30214,
1853,
13,
4706,
565,
23107,
1275,
29871,
29900,
29901,
13,
9651,
1134,
353,
29871,
29896,
13,
9651,
2246,
29918,
333,
353,
29871,
29900,
13,
4706,
1683,
29901,
13,
9651,
274,
403,
353,
315,
403,
29889,
12650,
29889,
657,
29898,
333,
29922,
5935,
29897,
13,
9651,
1134,
353,
274,
403,
29889,
1853,
718,
29871,
29896,
13,
9651,
565,
274,
403,
29889,
3332,
29918,
333,
1360,
29900,
29901,
13,
18884,
2246,
29918,
333,
353,
274,
403,
29889,
333,
13,
9651,
1683,
29901,
13,
18884,
2246,
29918,
333,
353,
274,
403,
29889,
3332,
29918,
333,
13,
13,
4706,
1596,
29898,
3332,
29918,
333,
29892,
5935,
29892,
1853,
29897,
13,
4706,
2793,
1839,
1853,
2033,
353,
1134,
13,
4706,
2793,
1839,
3332,
29918,
333,
2033,
353,
2246,
29918,
333,
13,
4706,
1018,
29901,
13,
9651,
1178,
29922,
524,
29898,
3051,
1839,
333,
11287,
13,
4706,
5174,
29901,
13,
9651,
1178,
29922,
29900,
13,
13,
4706,
565,
1178,
29958,
29900,
29901,
13,
9651,
21759,
29922,
29907,
403,
29889,
12650,
29889,
657,
29898,
333,
29922,
333,
29897,
13,
9651,
274,
29922,
29907,
403,
17679,
29898,
617,
29892,
1272,
29922,
3051,
29897,
13,
9651,
396,
31273,
31264,
13,
13,
4706,
1683,
29901,
13,
9651,
274,
353,
315,
403,
17679,
29898,
1272,
29922,
3051,
29897,
13,
4706,
4883,
3790,
29913,
13,
4706,
565,
274,
29889,
275,
29918,
3084,
7295,
13,
9651,
1018,
29901,
13,
18884,
274,
29889,
7620,
580,
13,
18884,
4883,
1839,
401,
2033,
353,
28081,
29889,
8949,
13,
9651,
5174,
29901,
13,
18884,
4883,
1839,
401,
2033,
353,
28081,
29889,
14573,
21662,
13,
4706,
1683,
29901,
13,
9651,
1596,
29898,
29883,
29889,
12523,
29897,
13,
9651,
4883,
1839,
401,
2033,
353,
28081,
29889,
14573,
21662,
13,
4706,
736,
13291,
29898,
4467,
29897,
13,
13,
29937,
31916,
31152,
30748,
30832,
13,
1753,
5217,
29907,
403,
29898,
3827,
1125,
13,
1678,
1178,
29922,
3827,
29889,
7194,
29889,
657,
877,
333,
1495,
13,
1678,
315,
403,
29889,
12650,
29889,
657,
29898,
333,
29922,
333,
467,
8143,
580,
13,
1678,
736,
4050,
29898,
3827,
29892,
376,
6406,
29914,
29883,
403,
29918,
1761,
29889,
1420,
1159,
13,
13,
13,
13,
13,
13,
13,
29937,
29871,
232,
165,
161,
30666,
31062,
234,
176,
193,
31092,
30856,
13,
1990,
3323,
2415,
2528,
8176,
29898,
8787,
1043,
1125,
13,
1678,
822,
1400,
29898,
1311,
29892,
2009,
1125,
13,
4706,
2793,
353,
2009,
29889,
1272,
13,
13,
4706,
1596,
29898,
3051,
29897,
13,
4706,
1018,
29901,
13,
9651,
1178,
353,
938,
29898,
3051,
1839,
333,
11287,
396,
29871,
30683,
30544,
333,
13,
9651,
1596,
29898,
333,
29897,
13,
9651,
1596,
877,
6051,
29871,
30780,
30810,
30743,
1495,
13,
4706,
5174,
29901,
13,
9651,
1178,
353,
29871,
29900,
13,
13,
13,
4706,
565,
1178,
1405,
29871,
29900,
29901,
13,
9651,
24488,
353,
917,
29889,
12650,
29889,
657,
29898,
333,
29922,
333,
29897,
13,
9651,
270,
353,
10522,
17679,
29898,
1289,
29892,
848,
29922,
3051,
29897,
13,
9651,
396,
29871,
31273,
31264,
13,
13,
4706,
1683,
29901,
13,
9651,
270,
353,
10522,
17679,
29898,
1272,
29922,
3051,
29897,
13,
13,
4706,
4883,
353,
6571,
13,
13,
4706,
565,
270,
29889,
275,
29918,
3084,
7295,
13,
9651,
1018,
29901,
13,
18884,
270,
29889,
7620,
580,
13,
18884,
4883,
1839,
401,
2033,
353,
28081,
29889,
8949,
13,
13,
9651,
5174,
29901,
13,
18884,
4883,
1839,
401,
2033,
353,
28081,
29889,
14573,
21662,
13,
4706,
1683,
29901,
13,
13,
9651,
4883,
1839,
401,
2033,
353,
28081,
29889,
14573,
21662,
13,
13,
4706,
736,
13291,
29898,
4467,
29897,
13,
13,
13,
13,
13,
29937,
31916,
31152,
31062,
234,
176,
193,
13,
1753,
5217,
8176,
29898,
3827,
1125,
13,
1678,
1178,
29922,
3827,
29889,
7194,
29889,
657,
877,
333,
1495,
13,
1678,
315,
403,
29889,
12650,
29889,
657,
29898,
333,
29922,
333,
467,
8143,
580,
13,
1678,
736,
4050,
29898,
3827,
29892,
376,
6406,
29914,
4039,
29918,
1761,
29889,
1420,
1159,
13,
13,
13,
13,
29937,
29871,
232,
165,
161,
30666,
31427,
31399,
31092,
30856,
13,
13,
1990,
3323,
2415,
2528,
18420,
29879,
29898,
8787,
1043,
1125,
13,
1678,
822,
1400,
29898,
1311,
29892,
2009,
1125,
13,
4706,
396,
1596,
877,
29872,
261,
29893,
1495,
13,
4706,
2793,
353,
2009,
29889,
1272,
13,
4706,
1596,
29898,
3051,
29897,
13,
4706,
1596,
29898,
3051,
1839,
333,
11287,
13,
4706,
1596,
29898,
3051,
1839,
25232,
29918,
333,
11287,
13,
4706,
396,
29871,
30429,
31471,
30861,
31122,
13,
4706,
10153,
353,
2009,
29889,
24483,
29889,
657,
877,
2492,
1495,
13,
4706,
2224,
29922,
9009,
29918,
2492,
29898,
2492,
29897,
13,
4706,
2793,
1839,
12095,
2033,
29922,
2084,
13,
4706,
697,
29918,
29883,
403,
29922,
29907,
403,
29889,
12650,
29889,
657,
29898,
333,
29922,
524,
29898,
3051,
1839,
25232,
29918,
333,
25901,
13,
4706,
1596,
29898,
650,
29918,
29883,
403,
29897,
13,
4706,
2793,
1839,
3332,
29918,
333,
2033,
353,
697,
29918,
29883,
403,
29889,
3332,
29918,
333,
13,
13,
4706,
1018,
29901,
13,
9651,
1596,
877,
31851,
31787,
30690,
31183,
1495,
13,
9651,
1178,
29922,
524,
29898,
3051,
1839,
333,
11287,
13,
9651,
1596,
29898,
333,
29897,
13,
4706,
5174,
29901,
13,
9651,
1178,
29922,
29900,
13,
13,
4706,
565,
1178,
29958,
29900,
29901,
13,
9651,
396,
29871,
31273,
31264,
31427,
31399,
13,
9651,
2777,
353,
7197,
29879,
29889,
12650,
29889,
657,
29898,
333,
29922,
333,
29897,
13,
9651,
274,
353,
7197,
29879,
17679,
29898,
8758,
29892,
848,
29922,
3051,
29897,
13,
13,
4706,
1683,
29901,
13,
9651,
274,
353,
7197,
29879,
17679,
29898,
1272,
29922,
3051,
29897,
13,
4706,
4883,
3790,
29913,
13,
4706,
565,
274,
29889,
275,
29918,
3084,
7295,
13,
9651,
274,
29889,
7620,
580,
13,
9651,
4883,
1839,
401,
2033,
353,
28081,
29889,
8949,
13,
13,
4706,
1683,
29901,
13,
9651,
1596,
29898,
29883,
29889,
12523,
29897,
13,
9651,
4883,
1839,
401,
2033,
353,
28081,
29889,
14573,
21662,
13,
4706,
736,
13291,
29898,
4467,
29897,
13,
13,
29937,
31916,
31152,
31427,
31399,
13,
1753,
5217,
18420,
29879,
29898,
3827,
1125,
13,
1678,
1178,
29922,
3827,
29889,
7194,
29889,
657,
877,
333,
1495,
13,
1678,
7197,
29879,
29889,
12650,
29889,
657,
29898,
333,
29922,
333,
467,
8143,
580,
13,
1678,
736,
4050,
29898,
3827,
29892,
376,
6406,
29914,
16773,
29879,
29918,
1761,
29889,
1420,
1159,
13,
13,
13,
29937,
31538,
30666,
30374,
236,
154,
190,
31092,
30856,
13,
1990,
3323,
2415,
2528,
29328,
29898,
8787,
1043,
1125,
13,
1678,
822,
1400,
29898,
1311,
29892,
3827,
1125,
13,
4706,
2793,
29922,
3827,
29889,
1272,
13,
4706,
1596,
29898,
3051,
29897,
13,
4706,
1018,
29901,
13,
9651,
1178,
353,
938,
29898,
3051,
1839,
333,
11287,
396,
29871,
30683,
30544,
333,
13,
13,
4706,
5174,
29901,
13,
9651,
1178,
353,
29871,
29900,
13,
13,
13,
4706,
565,
1178,
1405,
29871,
29900,
29901,
13,
9651,
1596,
29898,
333,
29897,
13,
9651,
302,
29876,
353,
10130,
29889,
12650,
29889,
657,
29898,
333,
29922,
333,
29897,
13,
9651,
270,
353,
10130,
17679,
29898,
15755,
29892,
848,
29922,
3051,
29897,
13,
9651,
396,
29871,
31273,
31264,
13,
13,
4706,
1683,
29901,
13,
9651,
270,
353,
10130,
17679,
29898,
1272,
29922,
3051,
29897,
13,
4706,
4883,
353,
6571,
13,
4706,
565,
270,
29889,
275,
29918,
3084,
7295,
13,
9651,
1018,
29901,
13,
18884,
270,
29889,
7620,
580,
13,
18884,
4883,
1839,
401,
2033,
353,
28081,
29889,
8949,
13,
13,
9651,
5174,
29901,
13,
18884,
4883,
1839,
401,
2033,
353,
28081,
29889,
14573,
21662,
13,
4706,
1683,
29901,
13,
13,
9651,
4883,
1839,
401,
2033,
353,
28081,
29889,
14573,
21662,
13,
13,
4706,
736,
13291,
29898,
4467,
29897,
13,
13,
29937,
31916,
31152,
30374,
236,
154,
190,
13,
1753,
5217,
29328,
29898,
3827,
1125,
13,
1678,
1178,
29922,
3827,
29889,
7194,
29889,
657,
877,
333,
1495,
13,
1678,
10130,
29889,
12650,
29889,
657,
29898,
333,
29922,
333,
467,
8143,
580,
13,
1678,
736,
4050,
29898,
3827,
1699,
6406,
29914,
15753,
29918,
1761,
29889,
1420,
1159,
13,
13,
13,
29937,
31916,
31152,
234,
135,
169,
30940,
30861,
13,
1753,
5217,
29933,
812,
414,
29898,
3827,
1125,
13,
1678,
1178,
29922,
3827,
29889,
7194,
29889,
657,
877,
333,
1495,
13,
1678,
350,
812,
414,
29889,
12650,
29889,
657,
29898,
333,
29922,
333,
467,
8143,
580,
13,
1678,
736,
4050,
29898,
3827,
1699,
6406,
29914,
3149,
29918,
1761,
29889,
1420,
1159,
13,
13,
13,
13,
13,
13,
29937,
31538,
30666,
234,
135,
169,
30940,
30861,
31092,
30856,
13,
1990,
3323,
2415,
2528,
29933,
7310,
29898,
8787,
1043,
1125,
13,
1678,
822,
1400,
29898,
1311,
29892,
3827,
1125,
13,
4706,
2793,
29922,
3827,
29889,
1272,
13,
4706,
1596,
29898,
3051,
29897,
13,
4706,
1018,
29901,
13,
9651,
1178,
353,
938,
29898,
3051,
1839,
333,
11287,
396,
29871,
30683,
30544,
333,
13,
13,
4706,
5174,
29901,
13,
9651,
1178,
353,
29871,
29900,
13,
13,
13,
4706,
565,
1178,
1405,
29871,
29900,
29901,
13,
9651,
1596,
29898,
333,
29897,
13,
9651,
302,
29876,
353,
350,
812,
414,
29889,
12650,
29889,
657,
29898,
333,
29922,
333,
29897,
13,
9651,
270,
353,
350,
812,
414,
17679,
29898,
15755,
29892,
848,
29922,
3051,
29897,
13,
9651,
396,
29871,
31273,
31264,
13,
13,
4706,
1683,
29901,
13,
9651,
270,
353,
350,
812,
414,
17679,
29898,
1272,
29922,
3051,
29897,
13,
4706,
4883,
353,
6571,
13,
4706,
565,
270,
29889,
275,
29918,
3084,
7295,
13,
9651,
1018,
29901,
13,
18884,
270,
29889,
7620,
580,
13,
18884,
4883,
1839,
401,
2033,
353,
28081,
29889,
8949,
13,
13,
9651,
5174,
29901,
13,
18884,
4883,
1839,
401,
2033,
353,
28081,
29889,
14573,
21662,
13,
4706,
1683,
29901,
13,
13,
9651,
4883,
1839,
401,
2033,
353,
28081,
29889,
14573,
21662,
13,
13,
4706,
736,
13291,
29898,
4467,
29897,
13,
13,
13,
13,
1753,
1404,
29918,
2798,
29898,
3827,
1125,
13,
13,
1678,
736,
4050,
29898,
3827,
5501,
6406,
29914,
1792,
29918,
2798,
29889,
1420,
1495,
13,
13,
13,
13,
13,
2
] |
n_step_sarsa.py | SuperSaiyan-God/Reinforcement-Learning | 0 | 47375 | import numpy as np
import gym
poleThetaSpace = np.linspace(-0.209, 0.209, 10)
poleThetaVelSpace = np.linspace(-4, 4, 10)
cartPosSpace = np.linspace(-2.4, 2.4, 10)
cartVelSpace = np.linspace(-4, 4, 10)
def get_state(observation):
cartX, cartXdot, cartTheta, cartThetaDot = observation
cartX = int(np.digitize(cartX, cartPosSpace))
cartXdot = int(np.digitize(cartXdot, cartVelSpace))
cartTheta = int(np.digitize(cartTheta, poleThetaSpace))
cartThetaDot = int(np.digitize(cartThetaDot, poleThetaVelSpace))
return (cartX, cartXdot, cartTheta, cartThetaDot)
def choose_action(q, obs, eps, n_actions=2):
state = get_state(obs)
if np.random.random() < eps:
action = np.random.choice([i for i in range(n_actions)])
else:
action_values = [q[(state, a)] for a in range(n_actions)]
action = np.argmax(action_values)
return action
if __name__ == '__main__':
env = gym.make('CartPole-v0')
alpha = 0.1
gamma = 0.9
epsilon = 1.0
states = []
for i in range(len(cartPosSpace)+1):
for j in range(len(cartVelSpace)+1):
for k in range(len(poleThetaSpace)+1):
for l in range(len(poleThetaVelSpace)+1):
states.append((i,j,k,l))
Q = {}
for s in states:
for a in range(2):
Q[(s, a)] = 0.0
n = 16
state_memory = np.zeros((n, 4))
action_memory = np.zeros(n)
reward_memory = np.zeros(n)
scores = []
n_episodes = 50000
for i in range(n_episodes):
done = False
score = 0
t = 0
T = np.inf
observation = env.reset()
action = choose_action(Q, observation, epsilon)
action_memory[t%n] = action
state_memory[t%n] = observation
while not done:
observation, reward, done, info = env.step(action)
score += reward
state_memory[(t+1)%n] = observation
reward_memory[(t+1)%n] = reward
if done:
T = t + 1
#print('episode ends at step', t)
action = choose_action(Q, observation, epsilon)
action_memory[(t+1)%n] = action
tau = t - n + 1
if tau >= 0:
G = [gamma**(j-tau-1)*reward_memory[j%n] \
for j in range(tau+1, min(tau+n, T)+1)]
G = np.sum(G)
if tau + n < T:
s = get_state(state_memory[(tau+n)%n])
a = int(action_memory[(tau+n)%n])
G += gamma**n * Q[(s,a)]
s = get_state(state_memory[tau%n])
a = action_memory[tau%n]
Q[(s,a)] += alpha*(G-Q[(s,a)])
#print('tau ', tau, '| Q %.2f' % \
# Q[(get_state(state_memory[tau%n]), action_memory[tau%n])])
t += 1
for tau in range(t-n+1, T):
G = [gamma**(j-tau-1)*reward_memory[j%n] \
for j in range(tau+1, min(tau+n, T)+1)]
G = np.sum(G)
if tau + n < T:
s = get_state(state_memory[(tau+n)%n])
a = int(action_memory[(tau+n)%n])
G += gamma**n * Q[(s,a)]
s = get_state(state_memory[tau%n])
a = action_memory[tau%n]
Q[(s,a)] += alpha*(G-Q[(s,a)])
#print('tau ', tau, '| Q %.2f' % \
# Q[(get_state(state_memory[tau%n]), action_memory[tau%n])])
scores.append(score)
avg_score = np.mean(scores[-1000:])
epsilon = epsilon -2 / n_episodes if epsilon > 0 else 0
if i % 1000 == 0:
print('episode ', i, 'avg_score %.1f' % avg_score,
'epsilon %.2f' % epsilon)
| [
1,
1053,
12655,
408,
7442,
13,
5215,
330,
962,
13,
13,
15831,
17458,
14936,
353,
7442,
29889,
1915,
3493,
6278,
29900,
29889,
29906,
29900,
29929,
29892,
29871,
29900,
29889,
29906,
29900,
29929,
29892,
29871,
29896,
29900,
29897,
13,
15831,
17458,
29963,
295,
14936,
353,
7442,
29889,
1915,
3493,
6278,
29946,
29892,
29871,
29946,
29892,
29871,
29896,
29900,
29897,
13,
13823,
9135,
14936,
353,
7442,
29889,
1915,
3493,
6278,
29906,
29889,
29946,
29892,
29871,
29906,
29889,
29946,
29892,
29871,
29896,
29900,
29897,
13,
13823,
29963,
295,
14936,
353,
7442,
29889,
1915,
3493,
6278,
29946,
29892,
29871,
29946,
29892,
29871,
29896,
29900,
29897,
13,
13,
1753,
679,
29918,
3859,
29898,
26739,
362,
1125,
13,
1678,
7774,
29990,
29892,
7774,
29990,
6333,
29892,
7774,
17458,
29892,
7774,
17458,
29928,
327,
353,
15500,
13,
1678,
7774,
29990,
353,
938,
29898,
9302,
29889,
26204,
675,
29898,
13823,
29990,
29892,
7774,
9135,
14936,
876,
13,
1678,
7774,
29990,
6333,
353,
938,
29898,
9302,
29889,
26204,
675,
29898,
13823,
29990,
6333,
29892,
7774,
29963,
295,
14936,
876,
13,
1678,
7774,
17458,
353,
938,
29898,
9302,
29889,
26204,
675,
29898,
13823,
17458,
29892,
22775,
17458,
14936,
876,
13,
1678,
7774,
17458,
29928,
327,
353,
938,
29898,
9302,
29889,
26204,
675,
29898,
13823,
17458,
29928,
327,
29892,
22775,
17458,
29963,
295,
14936,
876,
13,
13,
1678,
736,
313,
13823,
29990,
29892,
7774,
29990,
6333,
29892,
7774,
17458,
29892,
7774,
17458,
29928,
327,
29897,
13,
13,
1753,
6755,
29918,
2467,
29898,
29939,
29892,
20881,
29892,
321,
567,
29892,
302,
29918,
7387,
29922,
29906,
1125,
13,
1678,
2106,
353,
679,
29918,
3859,
29898,
26290,
29897,
13,
1678,
565,
7442,
29889,
8172,
29889,
8172,
580,
529,
321,
567,
29901,
13,
4706,
3158,
353,
7442,
29889,
8172,
29889,
16957,
4197,
29875,
363,
474,
297,
3464,
29898,
29876,
29918,
7387,
29897,
2314,
13,
1678,
1683,
29901,
13,
4706,
3158,
29918,
5975,
353,
518,
29939,
15625,
3859,
29892,
263,
4638,
363,
263,
297,
3464,
29898,
29876,
29918,
7387,
4638,
13,
4706,
3158,
353,
7442,
29889,
1191,
3317,
29898,
2467,
29918,
5975,
29897,
13,
1678,
736,
3158,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
8829,
353,
330,
962,
29889,
5675,
877,
25233,
29925,
1772,
29899,
29894,
29900,
1495,
13,
1678,
15595,
353,
29871,
29900,
29889,
29896,
13,
1678,
330,
2735,
353,
29871,
29900,
29889,
29929,
13,
1678,
321,
3232,
353,
29871,
29896,
29889,
29900,
13,
13,
1678,
5922,
353,
5159,
13,
1678,
363,
474,
297,
3464,
29898,
2435,
29898,
13823,
9135,
14936,
7240,
29896,
1125,
13,
4706,
363,
432,
297,
3464,
29898,
2435,
29898,
13823,
29963,
295,
14936,
7240,
29896,
1125,
13,
9651,
363,
413,
297,
3464,
29898,
2435,
29898,
15831,
17458,
14936,
7240,
29896,
1125,
13,
18884,
363,
301,
297,
3464,
29898,
2435,
29898,
15831,
17458,
29963,
295,
14936,
7240,
29896,
1125,
13,
462,
1678,
5922,
29889,
4397,
3552,
29875,
29892,
29926,
29892,
29895,
29892,
29880,
876,
13,
13,
1678,
660,
353,
6571,
13,
1678,
363,
269,
297,
5922,
29901,
13,
4706,
363,
263,
297,
3464,
29898,
29906,
1125,
13,
9651,
660,
15625,
29879,
29892,
263,
4638,
353,
29871,
29900,
29889,
29900,
13,
13,
1678,
302,
353,
29871,
29896,
29953,
13,
1678,
2106,
29918,
14834,
353,
7442,
29889,
3298,
359,
3552,
29876,
29892,
29871,
29946,
876,
13,
1678,
3158,
29918,
14834,
353,
7442,
29889,
3298,
359,
29898,
29876,
29897,
13,
1678,
20751,
29918,
14834,
353,
7442,
29889,
3298,
359,
29898,
29876,
29897,
13,
13,
1678,
19435,
353,
5159,
13,
1678,
302,
29918,
1022,
275,
2631,
353,
29871,
29945,
29900,
29900,
29900,
29900,
13,
1678,
363,
474,
297,
3464,
29898,
29876,
29918,
1022,
275,
2631,
1125,
13,
4706,
2309,
353,
7700,
13,
4706,
8158,
353,
29871,
29900,
13,
4706,
260,
353,
29871,
29900,
13,
4706,
323,
353,
7442,
29889,
7192,
13,
4706,
15500,
353,
8829,
29889,
12071,
580,
13,
4706,
3158,
353,
6755,
29918,
2467,
29898,
29984,
29892,
15500,
29892,
321,
3232,
29897,
13,
4706,
3158,
29918,
14834,
29961,
29873,
29995,
29876,
29962,
353,
3158,
13,
4706,
2106,
29918,
14834,
29961,
29873,
29995,
29876,
29962,
353,
15500,
13,
4706,
1550,
451,
2309,
29901,
13,
9651,
15500,
29892,
20751,
29892,
2309,
29892,
5235,
353,
8829,
29889,
10568,
29898,
2467,
29897,
13,
9651,
8158,
4619,
20751,
13,
9651,
2106,
29918,
14834,
15625,
29873,
29974,
29896,
29897,
29995,
29876,
29962,
353,
15500,
13,
9651,
20751,
29918,
14834,
15625,
29873,
29974,
29896,
29897,
29995,
29876,
29962,
353,
20751,
13,
9651,
565,
2309,
29901,
13,
18884,
323,
353,
260,
718,
29871,
29896,
13,
18884,
396,
2158,
877,
1022,
275,
356,
10614,
472,
4331,
742,
260,
29897,
13,
9651,
3158,
353,
6755,
29918,
2467,
29898,
29984,
29892,
15500,
29892,
321,
3232,
29897,
13,
9651,
3158,
29918,
14834,
15625,
29873,
29974,
29896,
29897,
29995,
29876,
29962,
353,
3158,
13,
9651,
260,
585,
353,
260,
448,
302,
718,
29871,
29896,
13,
9651,
565,
260,
585,
6736,
29871,
29900,
29901,
13,
18884,
402,
353,
518,
4283,
1068,
29898,
29926,
29899,
4722,
29899,
29896,
11877,
276,
1328,
29918,
14834,
29961,
29926,
29995,
29876,
29962,
320,
13,
462,
4706,
363,
432,
297,
3464,
29898,
4722,
29974,
29896,
29892,
1375,
29898,
4722,
29974,
29876,
29892,
323,
7240,
29896,
4638,
13,
18884,
402,
353,
7442,
29889,
2083,
29898,
29954,
29897,
13,
18884,
565,
260,
585,
718,
302,
529,
323,
29901,
13,
462,
1678,
269,
353,
679,
29918,
3859,
29898,
3859,
29918,
14834,
15625,
4722,
29974,
29876,
29897,
29995,
29876,
2314,
13,
462,
1678,
263,
353,
938,
29898,
2467,
29918,
14834,
15625,
4722,
29974,
29876,
29897,
29995,
29876,
2314,
13,
462,
1678,
402,
4619,
330,
2735,
1068,
29876,
334,
660,
15625,
29879,
29892,
29874,
4638,
13,
18884,
269,
353,
679,
29918,
3859,
29898,
3859,
29918,
14834,
29961,
4722,
29995,
29876,
2314,
13,
18884,
263,
353,
3158,
29918,
14834,
29961,
4722,
29995,
29876,
29962,
13,
18884,
660,
15625,
29879,
29892,
29874,
4638,
4619,
15595,
16395,
29954,
29899,
29984,
15625,
29879,
29892,
29874,
29897,
2314,
13,
9651,
396,
2158,
877,
4722,
13420,
260,
585,
29892,
525,
29989,
660,
18695,
29906,
29888,
29915,
1273,
320,
13,
9651,
396,
4706,
660,
15625,
657,
29918,
3859,
29898,
3859,
29918,
14834,
29961,
4722,
29995,
29876,
11724,
3158,
29918,
14834,
29961,
4722,
29995,
29876,
2314,
2314,
13,
13,
9651,
260,
4619,
29871,
29896,
13,
13,
4706,
363,
260,
585,
297,
3464,
29898,
29873,
29899,
29876,
29974,
29896,
29892,
323,
1125,
13,
9651,
402,
353,
518,
4283,
1068,
29898,
29926,
29899,
4722,
29899,
29896,
11877,
276,
1328,
29918,
14834,
29961,
29926,
29995,
29876,
29962,
320,
13,
462,
1678,
363,
432,
297,
3464,
29898,
4722,
29974,
29896,
29892,
1375,
29898,
4722,
29974,
29876,
29892,
323,
7240,
29896,
4638,
13,
9651,
402,
353,
7442,
29889,
2083,
29898,
29954,
29897,
13,
9651,
565,
260,
585,
718,
302,
529,
323,
29901,
13,
18884,
269,
353,
679,
29918,
3859,
29898,
3859,
29918,
14834,
15625,
4722,
29974,
29876,
29897,
29995,
29876,
2314,
13,
18884,
263,
353,
938,
29898,
2467,
29918,
14834,
15625,
4722,
29974,
29876,
29897,
29995,
29876,
2314,
13,
18884,
402,
4619,
330,
2735,
1068,
29876,
334,
660,
15625,
29879,
29892,
29874,
4638,
13,
9651,
269,
353,
679,
29918,
3859,
29898,
3859,
29918,
14834,
29961,
4722,
29995,
29876,
2314,
13,
9651,
263,
353,
3158,
29918,
14834,
29961,
4722,
29995,
29876,
29962,
13,
9651,
660,
15625,
29879,
29892,
29874,
4638,
4619,
15595,
16395,
29954,
29899,
29984,
15625,
29879,
29892,
29874,
29897,
2314,
13,
9651,
396,
2158,
877,
4722,
13420,
260,
585,
29892,
525,
29989,
660,
18695,
29906,
29888,
29915,
1273,
320,
13,
9651,
396,
1678,
660,
15625,
657,
29918,
3859,
29898,
3859,
29918,
14834,
29961,
4722,
29995,
29876,
11724,
3158,
29918,
14834,
29961,
4722,
29995,
29876,
2314,
2314,
13,
4706,
19435,
29889,
4397,
29898,
13628,
29897,
13,
4706,
1029,
29887,
29918,
13628,
353,
7442,
29889,
12676,
29898,
1557,
2361,
14352,
29896,
29900,
29900,
29900,
29901,
2314,
13,
4706,
321,
3232,
353,
321,
3232,
448,
29906,
847,
302,
29918,
1022,
275,
2631,
565,
321,
3232,
1405,
29871,
29900,
1683,
29871,
29900,
13,
4706,
565,
474,
1273,
29871,
29896,
29900,
29900,
29900,
1275,
29871,
29900,
29901,
13,
9651,
1596,
877,
1022,
275,
356,
13420,
474,
29892,
525,
485,
29887,
29918,
13628,
18695,
29896,
29888,
29915,
1273,
1029,
29887,
29918,
13628,
29892,
13,
462,
1678,
525,
5463,
18695,
29906,
29888,
29915,
1273,
321,
3232,
29897,
13,
13,
2
] |
smedl/parser/smedl_semantics.py | PRECISE/SMEDL | 0 | 68114 | # Copyright (c) 2021 The Trustees of the University of Pennsylvania
#
# 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.
"""
SMEDL file semantic actions
"""
from smedl.structures import monitor, expr
from . import common_semantics
from .exceptions import TypeMismatch, NameNotDefined
class SmedlSemantics(common_semantics.CommonSemantics):
"""Semantic actions for SMEDL parsing"""
def __init__(self, path):
"""Do some basic initialization
path - The directory the .smedl file resides in"""
self.path = path
# self.monitor is created in declaration()
def start(self, ast):
"""Return the MonitorSpec object"""
return self.monitor
def declaration(self, ast):
"""Create the MonitorSpec object"""
self.monitor = monitor.MonitorSpec(ast, self.path)
return ast
def helper_definition(self, ast):
"""Add a helper file"""
self.monitor.add_helper(ast)
return ast
def _initial_value_matches(self, var_type, value_type):
if var_type is expr.SmedlType.INT:
# Float is normally permitted for assignment to int, but if used
# for initialization, something is likely wrong.
return value_type in ['int', 'char']
elif var_type is expr.SmedlType.FLOAT:
return value_type in ['float', 'int', 'char']
elif var_type is expr.SmedlType.CHAR:
return value_type in ['char', 'int']
elif var_type is expr.SmedlType.STRING:
return value_type == 'string'
elif var_type is expr.SmedlType.POINTER:
return value_type == 'null'
elif var_type is expr.SmedlType.OPAQUE:
# TODO Should we allow opaques to be initialized like strings?
return False
def state_declaration(self, ast):
"""Add a state variable to the monitor"""
var_name = ast.name
var_type = ast.type
value = ast.value
# Check type of the initial value
if (value is not None and
not self._initial_value_matches(var_type, value.type)):
raise TypeMismatch(
"State var {} initialized to incompatible value {}.".format(
var_name, value.value))
# Add to the monitor (and check if already declared)
if value is None:
self.monitor.add_state_var(var_name, var_type)
else:
self.monitor.add_state_var(var_name, var_type, value.value)
return ast
def event_declaration(self, ast):
"""Add events from an event declaration to the monitor"""
ev_type = ast.type
# One declaration can declare multiple events
for signature in ast.signatures:
ev_name = signature.name
ev_params = signature.params
self.monitor.add_event(ev_type, ev_name, ev_params)
return ast
def scenario(self, ast):
"""Add a scenario to the monitor"""
# Create an empty scenario
scenario = monitor.Scenario(ast.name)
# Populate the states and transitions of the scenario
for transition in ast.transitions:
# Get else state and actions
if transition.else_step is not None:
else_state = transition.else_step.else_state
else_actions = transition.else_step.else_actions
else:
else_state = None
else_actions = None
# Loop over the steps in the transition and add to the scenario
from_state = transition.start_state
for step in transition.steps.step_list[:-1]:
# All steps except the last one go to an implicit state
to_state = scenario.get_implicit_state()
event_name = step.event.name
condition = step.condition
actions = step.actions
scenario.add_step(
from_state, event_name, condition, to_state, actions,
else_state, else_actions)
from_state = to_state
# Do the last iteration separately -
# to_state = transition.end_state
step = transition.steps.step_list[-1]
to_state = transition.steps.end_state
event_name = step.event.name
condition = step.condition
actions = step.actions
scenario.add_step(
from_state, event_name, condition, to_state, actions,
else_state, else_actions)
# If a final state was given, check if it exists and add it
if ast.final_state is not None:
scenario.add_final_state(ast.final_state)
# Add the scenario to the monitor
self.monitor.add_scenario(scenario)
return ast
def step_definition_list(self, ast):
"""Transform the AST into a list of steps (ast.step_list) and an end
state (ast.end_state). Also store whether there is a single or multiple
steps in the transition, as else_preproc will need this to determine
whether to allow else actions to use event parameter bindings."""
step_list = [ast.step]
if ast.rest is None:
self.multiple_steps = False
else:
self.multiple_steps = True
step_list.extend(ast.rest.step_list)
ast['end_state'] = ast.rest.end_state
del ast['rest']
del ast['step']
ast['step_list'] = step_list
return ast
def step_definition(self, ast):
"""Step definitions may not have actions, in which case the actions
key will store None. In that case, convert it to an empty list."""
if ast.actions is None:
ast['actions'] = []
return ast
def else_definition(self, ast):
"""Else definitions may not have actions, in which case the actions
key will store None. In that case, convert it to an empty list."""
if ast.else_actions is None:
ast['else_actions'] = []
return ast
def else_preproc(self, ast):
"""If there are multiple steps in this transition, clear the event
parameter bindings before processing the else actions."""
if self.multiple_steps:
self.current_event = None
self.current_event_params = []
return ast
def step_event_definition(self, ast):
"""Store the parameter name bindings for the current event so they are
available to actions and conditions in this step."""
self.current_event = ast.name
self.current_event_params = ast.params # Will be a list of (str) names
# Verify that event exists and that the parameter count matches
if ast.name in self.monitor.imported_events:
if len(self.monitor.imported_events[ast.name]) != len(ast.params):
raise NameNotDefined("{} event has incorrect number of "
"parameters".format(ast.name))
elif ast.name in self.monitor.internal_events:
if len(self.monitor.internal_events[ast.name]) != len(ast.params):
raise NameNotDefined("{} event has incorrect number of "
"parameters".format(ast.name))
elif ast.name in self.monitor.exported_events:
if len(self.monitor.exported_events[ast.name]) != len(ast.params):
raise NameNotDefined("{} event has incorrect number of "
"parameters".format(ast.name))
else:
raise NameNotDefined("{} event is not an imported, internal, or"
"exported event.".format(ast.name))
return ast
def action_inner_list(self, ast):
"""Convert action_inner_lists into an actual list"""
if ast.first is None:
result = []
else:
result = [ast.first]
if ast.rest is not None:
result.extend(ast.rest)
return result
def assignment(self, ast):
"""Verify that the state variable exists and the type matches the
expression, then create the AssignmentAction"""
# Verify that the state variable exists
try:
state_var = self.monitor.state_vars[ast.target]
except KeyError:
raise NameNotDefined("{} is not a state variable".format(
ast.target))
# Check type
try:
ast.value.assignment_type_check(state_var.type)
except TypeMismatch:
raise TypeMismatch(
"Expression of type {} cannot be assigned to state variable "
"{} of incompatible type {}".format(
ast.value.type, ast.target, state_var.type))
# Create AssignmentAction
return monitor.AssignmentAction(ast.target, ast.value)
def increment(self, ast):
"""Verify that the state variable exists and is numeric or pointer, then
create the IncrementAction"""
# Verify that the state variable exists
try:
state_var = self.monitor.state_vars[ast.target]
except KeyError:
raise NameNotDefined("{} is not a state variable".format(
ast.target))
# Check type
if state_var.type not in [
expr.SmedlType.INT,
expr.SmedlType.FLOAT,
expr.SmedlType.CHAR,
# TODO Allow pointer increment and decrement? If so, should we
# also allow +/- on pointers?
expr.SmedlType.POINTER]:
raise TypeMismatch(
"Cannot increment state variable {} of type {}"
.format(ast.target, state_var.type))
# Create action
return monitor.IncrementAction(ast.target)
def decrement(self, ast):
"""Verify that the state variable exists and is numeric or pointer, then
create the DecrementAction"""
# Verify that the state variable exists
try:
state_var = self.monitor.state_vars[ast.target]
except KeyError:
raise NameNotDefined("{} is not a state variable".format(
ast.target))
# Check type
if state_var.type not in [
expr.SmedlType.INT,
expr.SmedlType.FLOAT,
expr.SmedlType.CHAR,
# TODO Allow pointer increment and decrement? If so, should we
# also allow +/- on pointers?
expr.SmedlType.POINTER]:
raise TypeMismatch(
"Cannot decrement state variable {} of type {}"
.format(ast.target, state_var.type))
# Create action
return monitor.DecrementAction(ast.target)
def raise_stmt(self, ast):
"""Verify that the event is an internal or exported event and do type
checking on the parameters, then create the RaiseAction"""
# Check that the event is internal or exported and the parameter count
# matches
if ast.event in self.monitor.exported_events:
if len(self.monitor.exported_events[ast.event]) != len(ast.params):
raise NameNotDefined("{} event has incorrect number of "
"parameters".format(ast.event))
else:
event_params = self.monitor.exported_events[ast.event]
elif ast.event in self.monitor.internal_events:
if len(self.monitor.internal_events[ast.event]) != len(ast.params):
raise NameNotDefined("{} event has incorrect number of "
"parameters".format(ast.event))
else:
event_params = self.monitor.internal_events[ast.event]
else:
raise NameNotDefined("{} event is not an exported or internal "
"event.".format(ast.event))
# Type check the parameters
for i in range(len(ast.params)):
ast.params[i].assignment_type_check(event_params[i])
# Create the RaiseAction
return monitor.RaiseAction(ast.event, ast.params)
def call_stmt(self, ast):
"""Create the CallAction"""
# Calling a helper function as an action should be discouraged and
# potentially depecated. Its only use would be functions with side
# effects.
# There is little verification we can do besides the type checking
# already done by Expressions, so simply create the action.
return monitor.CallAction(ast.function, ast.params)
# Expressions and type checking ###########################################
# Note: All type_ parameters should be either a SmedlType, "null", or None.
# None if it is a helper function or an expression with a helper function
# (as we cannot type check these); "null" if it is a null pointer (valid
# for either POINTER or OPAQUE types; SmedlType otherwise.
def literal(self, ast):
"""Convert a literal to an expr.Literal"""
if ast.type in ["int", "char"]:
# C treats both of these as int literals
return expr.Literal(ast.value, expr.SmedlType.INT)
elif ast.type == "float":
return expr.Literal(ast.value, expr.SmedlType.FLOAT)
elif ast.type == "string":
return expr.Literal(ast.value, expr.SmedlType.STRING)
elif ast.type == "null":
return expr.Literal(ast.value, "null")
def helper_call(self, ast):
"""Convert a helper function call to an expr.HelperCall"""
return expr.HelperCall(ast.function, ast.params)
def var_or_param(self, ast):
"""Convert a state variable or event parameter to an expr.StateVar or
expr.EventParam"""
try:
param_idx = self.current_event_params.index(ast)
if self.current_event in self.monitor.imported_events:
param_type = self.monitor.imported_events[
self.current_event][param_idx]
elif self.current_event in self.monitor.internal_events:
param_type = self.monitor.internal_events[
self.current_event][param_idx]
return expr.EventParam(param_idx, param_type)
except ValueError:
# Not an event parameter. Must be a state variable.
try:
state_var = self.monitor.state_vars[ast]
type_ = state_var.type
return expr.StateVar(ast, type_)
except KeyError:
raise NameNotDefined("Variable {} is not an event parameter "
"or state variable.".format(ast))
def parenthesized(self, ast):
"""Parenthesize an expression"""
ast.parenthesize()
return ast
def unary_expr(self, ast):
"""Type check the unary_expr and create a UnaryOp"""
if isinstance(ast, expr.Expression):
return ast
# This also does type checking
return expr.UnaryOp(ast[0], ast[1])
def expression(self, ast):
"""Type check all binary expressions and create BinaryOps from them"""
# This will receive a "tree" of 3-tuples where first element is the
# operator, second is the left operand, and third is the right operand.
# This must be processed recursively.
if isinstance(ast, expr.Expression):
return ast
left = self.expression(ast[1])
right = self.expression(ast[2])
# This also does type checking
return expr.BinaryOp(ast[0], left, right)
###########################################################################
def signed_literal(self, ast):
"""Signed literals are only used for state initialization. Join the
signed variants into single strings."""
if ast.type == 'signed_int':
val = ast.value
del ast['type']
del ast['value']
ast['type'] = 'int'
ast['value'] = ''.join(val)
elif ast.type == 'signed_float':
val = ast.value
del ast['type']
del ast['value']
ast['type'] = 'float'
ast['value'] = ''.join(val)
return ast
| [
1,
396,
14187,
1266,
313,
29883,
29897,
29871,
29906,
29900,
29906,
29896,
450,
20692,
12712,
310,
278,
3014,
310,
16636,
13,
29937,
13,
29937,
20894,
2333,
338,
1244,
1609,
16896,
29892,
3889,
310,
8323,
29892,
304,
738,
2022,
4017,
292,
263,
3509,
13,
29937,
310,
445,
7047,
322,
6942,
5106,
2066,
313,
1552,
376,
6295,
14093,
4968,
304,
5376,
13,
29937,
297,
278,
18540,
1728,
24345,
29892,
3704,
1728,
29485,
278,
10462,
13,
29937,
304,
671,
29892,
3509,
29892,
6623,
29892,
10366,
29892,
9805,
29892,
1320,
2666,
29892,
269,
803,
1947,
29892,
322,
29914,
272,
19417,
13,
29937,
14591,
310,
278,
18540,
29892,
322,
304,
14257,
12407,
304,
6029,
278,
18540,
338,
13,
29937,
15252,
3276,
304,
437,
577,
29892,
4967,
304,
278,
1494,
5855,
29901,
13,
29937,
13,
29937,
450,
2038,
3509,
1266,
8369,
322,
445,
10751,
8369,
4091,
367,
5134,
297,
13,
29937,
599,
14591,
470,
23228,
2011,
1080,
310,
278,
18540,
29889,
13,
29937,
13,
29937,
6093,
7791,
7818,
12982,
1525,
8519,
13756,
13044,
3352,
376,
3289,
8519,
613,
399,
1806,
8187,
2692,
399,
1718,
29934,
13566,
29979,
8079,
13764,
29979,
476,
22255,
29892,
8528,
15094,
1799,
6323,
13,
29937,
306,
3580,
5265,
3352,
29892,
2672,
6154,
15789,
4214,
350,
2692,
6058,
27848,
3352,
7495,
6093,
399,
1718,
29934,
13566,
29059,
8079,
341,
1001,
3210,
13566,
2882,
6227,
11937,
29892,
13,
29937,
383,
1806,
8186,
1799,
15842,
319,
349,
8322,
2965,
13309,
1718,
349,
4574,
13152,
1660,
5300,
405,
1164,
1177,
15860,
1177,
1692,
13780,
29889,
2672,
11698,
382,
29963,
3919,
24972,
9818,
6093,
13,
29937,
26524,
29950,
24125,
6323,
315,
4590,
29979,
22789,
3912,
379,
5607,
8032,
29903,
20700,
17705,
6181,
15842,
13764,
29979,
315,
4375,
7833,
29892,
21330,
1529,
1692,
29903,
6323,
438,
29911,
4448,
13,
29937,
17705,
2882,
6227,
11937,
29892,
12317,
2544,
4448,
2672,
13764,
319,
9838,
8079,
8707,
29911,
4717,
1783,
29892,
323,
8476,
6323,
438,
29911,
4448,
22119,
1660,
29892,
9033,
3235,
4214,
3895,
29892,
13,
29937,
19474,
8079,
6323,
2672,
8707,
8186,
9838,
22659,
6093,
7791,
7818,
12982,
1525,
6323,
6093,
501,
1660,
6323,
438,
29911,
4448,
5012,
1964,
4214,
29903,
2672,
6093,
13,
29937,
7791,
7818,
12982,
1525,
29889,
13,
13,
15945,
29908,
13,
29903,
2303,
19558,
934,
28837,
8820,
13,
15945,
29908,
13,
13,
3166,
1560,
287,
29880,
29889,
4984,
1973,
1053,
11819,
29892,
22010,
13,
3166,
869,
1053,
3619,
29918,
12846,
22614,
13,
3166,
869,
11739,
29879,
1053,
5167,
29924,
1608,
905,
29892,
4408,
3664,
3206,
1312,
13,
13,
13,
1990,
317,
2168,
29880,
28516,
22614,
29898,
9435,
29918,
12846,
22614,
29889,
18877,
28516,
22614,
1125,
13,
1678,
9995,
28516,
7716,
8820,
363,
317,
2303,
19558,
13755,
15945,
29908,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
2224,
1125,
13,
4706,
9995,
6132,
777,
6996,
17865,
13,
13,
4706,
2224,
448,
450,
3884,
278,
869,
29879,
2168,
29880,
934,
620,
2247,
297,
15945,
29908,
13,
4706,
1583,
29889,
2084,
353,
2224,
13,
4706,
396,
1583,
29889,
3712,
2105,
338,
2825,
297,
12029,
580,
13,
13,
1678,
822,
1369,
29898,
1311,
29892,
8717,
1125,
13,
4706,
9995,
11609,
278,
2598,
2105,
10299,
1203,
15945,
29908,
13,
4706,
736,
1583,
29889,
3712,
2105,
13,
13,
1678,
822,
12029,
29898,
1311,
29892,
8717,
1125,
13,
4706,
9995,
4391,
278,
2598,
2105,
10299,
1203,
15945,
29908,
13,
4706,
1583,
29889,
3712,
2105,
353,
11819,
29889,
7185,
2105,
10299,
29898,
579,
29892,
1583,
29889,
2084,
29897,
13,
4706,
736,
8717,
13,
13,
1678,
822,
16876,
29918,
16553,
29898,
1311,
29892,
8717,
1125,
13,
4706,
9995,
2528,
263,
16876,
934,
15945,
29908,
13,
4706,
1583,
29889,
3712,
2105,
29889,
1202,
29918,
20907,
29898,
579,
29897,
13,
4706,
736,
8717,
13,
13,
1678,
822,
903,
11228,
29918,
1767,
29918,
20317,
29898,
1311,
29892,
722,
29918,
1853,
29892,
995,
29918,
1853,
1125,
13,
4706,
565,
722,
29918,
1853,
338,
22010,
29889,
29903,
2168,
29880,
1542,
29889,
10192,
29901,
13,
9651,
396,
27842,
338,
12891,
21905,
363,
12827,
304,
938,
29892,
541,
565,
1304,
13,
9651,
396,
363,
17865,
29892,
1554,
338,
5517,
2743,
29889,
13,
9651,
736,
995,
29918,
1853,
297,
6024,
524,
742,
525,
3090,
2033,
13,
4706,
25342,
722,
29918,
1853,
338,
22010,
29889,
29903,
2168,
29880,
1542,
29889,
29943,
3927,
1299,
29901,
13,
9651,
736,
995,
29918,
1853,
297,
6024,
7411,
742,
525,
524,
742,
525,
3090,
2033,
13,
4706,
25342,
722,
29918,
1853,
338,
22010,
29889,
29903,
2168,
29880,
1542,
29889,
11282,
29901,
13,
9651,
736,
995,
29918,
1853,
297,
6024,
3090,
742,
525,
524,
2033,
13,
4706,
25342,
722,
29918,
1853,
338,
22010,
29889,
29903,
2168,
29880,
1542,
29889,
20785,
29901,
13,
9651,
736,
995,
29918,
1853,
1275,
525,
1807,
29915,
13,
4706,
25342,
722,
29918,
1853,
338,
22010,
29889,
29903,
2168,
29880,
1542,
29889,
29925,
6992,
4945,
29901,
13,
9651,
736,
995,
29918,
1853,
1275,
525,
4304,
29915,
13,
4706,
25342,
722,
29918,
1853,
338,
22010,
29889,
29903,
2168,
29880,
1542,
29889,
4590,
29909,
11144,
29901,
13,
9651,
396,
14402,
10575,
591,
2758,
1015,
29874,
1912,
304,
367,
16601,
763,
6031,
29973,
13,
9651,
736,
7700,
13,
13,
1678,
822,
2106,
29918,
311,
16544,
362,
29898,
1311,
29892,
8717,
1125,
13,
4706,
9995,
2528,
263,
2106,
2286,
304,
278,
11819,
15945,
29908,
13,
4706,
722,
29918,
978,
353,
8717,
29889,
978,
13,
4706,
722,
29918,
1853,
353,
8717,
29889,
1853,
13,
4706,
995,
353,
8717,
29889,
1767,
13,
13,
4706,
396,
5399,
1134,
310,
278,
2847,
995,
13,
4706,
565,
313,
1767,
338,
451,
6213,
322,
13,
18884,
451,
1583,
3032,
11228,
29918,
1767,
29918,
20317,
29898,
1707,
29918,
1853,
29892,
995,
29889,
1853,
22164,
13,
9651,
12020,
5167,
29924,
1608,
905,
29898,
13,
18884,
376,
2792,
722,
6571,
16601,
304,
297,
23712,
995,
6571,
1213,
29889,
4830,
29898,
13,
462,
1678,
722,
29918,
978,
29892,
995,
29889,
1767,
876,
13,
13,
4706,
396,
3462,
304,
278,
11819,
313,
392,
1423,
565,
2307,
8052,
29897,
13,
4706,
565,
995,
338,
6213,
29901,
13,
9651,
1583,
29889,
3712,
2105,
29889,
1202,
29918,
3859,
29918,
1707,
29898,
1707,
29918,
978,
29892,
722,
29918,
1853,
29897,
13,
4706,
1683,
29901,
13,
9651,
1583,
29889,
3712,
2105,
29889,
1202,
29918,
3859,
29918,
1707,
29898,
1707,
29918,
978,
29892,
722,
29918,
1853,
29892,
995,
29889,
1767,
29897,
13,
13,
4706,
736,
8717,
13,
13,
1678,
822,
1741,
29918,
311,
16544,
362,
29898,
1311,
29892,
8717,
1125,
13,
4706,
9995,
2528,
4959,
515,
385,
1741,
12029,
304,
278,
11819,
15945,
29908,
13,
4706,
3415,
29918,
1853,
353,
8717,
29889,
1853,
13,
13,
4706,
396,
3118,
12029,
508,
9607,
2999,
4959,
13,
4706,
363,
12608,
297,
8717,
29889,
4530,
3698,
29901,
13,
9651,
3415,
29918,
978,
353,
12608,
29889,
978,
13,
9651,
3415,
29918,
7529,
353,
12608,
29889,
7529,
13,
9651,
1583,
29889,
3712,
2105,
29889,
1202,
29918,
3696,
29898,
5750,
29918,
1853,
29892,
3415,
29918,
978,
29892,
3415,
29918,
7529,
29897,
13,
13,
4706,
736,
8717,
13,
13,
1678,
822,
10483,
29898,
1311,
29892,
8717,
1125,
13,
4706,
9995,
2528,
263,
10483,
304,
278,
11819,
15945,
29908,
13,
4706,
396,
6204,
385,
4069,
10483,
13,
4706,
10483,
353,
11819,
29889,
4421,
24893,
29898,
579,
29889,
978,
29897,
13,
13,
4706,
396,
6977,
5987,
278,
5922,
322,
1301,
2187,
310,
278,
10483,
13,
4706,
363,
9558,
297,
8717,
29889,
3286,
2187,
29901,
13,
9651,
396,
3617,
1683,
2106,
322,
8820,
13,
9651,
565,
9558,
29889,
2870,
29918,
10568,
338,
451,
6213,
29901,
13,
18884,
1683,
29918,
3859,
353,
9558,
29889,
2870,
29918,
10568,
29889,
2870,
29918,
3859,
13,
18884,
1683,
29918,
7387,
353,
9558,
29889,
2870,
29918,
10568,
29889,
2870,
29918,
7387,
13,
9651,
1683,
29901,
13,
18884,
1683,
29918,
3859,
353,
6213,
13,
18884,
1683,
29918,
7387,
353,
6213,
13,
13,
9651,
396,
21493,
975,
278,
6576,
297,
278,
9558,
322,
788,
304,
278,
10483,
13,
9651,
515,
29918,
3859,
353,
9558,
29889,
2962,
29918,
3859,
13,
9651,
363,
4331,
297,
9558,
29889,
24530,
29889,
10568,
29918,
1761,
7503,
29899,
29896,
5387,
13,
18884,
396,
2178,
6576,
5174,
278,
1833,
697,
748,
304,
385,
12235,
2106,
13,
18884,
304,
29918,
3859,
353,
10483,
29889,
657,
29918,
6574,
4019,
29918,
3859,
580,
13,
18884,
1741,
29918,
978,
353,
4331,
29889,
3696,
29889,
978,
13,
18884,
4195,
353,
4331,
29889,
16122,
13,
18884,
8820,
353,
4331,
29889,
7387,
13,
18884,
10483,
29889,
1202,
29918,
10568,
29898,
13,
462,
1678,
515,
29918,
3859,
29892,
1741,
29918,
978,
29892,
4195,
29892,
304,
29918,
3859,
29892,
8820,
29892,
13,
462,
1678,
1683,
29918,
3859,
29892,
1683,
29918,
7387,
29897,
13,
18884,
515,
29918,
3859,
353,
304,
29918,
3859,
13,
9651,
396,
1938,
278,
1833,
12541,
16949,
448,
13,
9651,
396,
259,
304,
29918,
3859,
353,
9558,
29889,
355,
29918,
3859,
13,
9651,
4331,
353,
9558,
29889,
24530,
29889,
10568,
29918,
1761,
14352,
29896,
29962,
13,
9651,
304,
29918,
3859,
353,
9558,
29889,
24530,
29889,
355,
29918,
3859,
13,
9651,
1741,
29918,
978,
353,
4331,
29889,
3696,
29889,
978,
13,
9651,
4195,
353,
4331,
29889,
16122,
13,
9651,
8820,
353,
4331,
29889,
7387,
13,
9651,
10483,
29889,
1202,
29918,
10568,
29898,
13,
18884,
515,
29918,
3859,
29892,
1741,
29918,
978,
29892,
4195,
29892,
304,
29918,
3859,
29892,
8820,
29892,
13,
18884,
1683,
29918,
3859,
29892,
1683,
29918,
7387,
29897,
13,
13,
4706,
396,
960,
263,
2186,
2106,
471,
2183,
29892,
1423,
565,
372,
4864,
322,
788,
372,
13,
4706,
565,
8717,
29889,
8394,
29918,
3859,
338,
451,
6213,
29901,
13,
9651,
10483,
29889,
1202,
29918,
8394,
29918,
3859,
29898,
579,
29889,
8394,
29918,
3859,
29897,
13,
13,
4706,
396,
3462,
278,
10483,
304,
278,
11819,
13,
4706,
1583,
29889,
3712,
2105,
29889,
1202,
29918,
1557,
24893,
29898,
1557,
24893,
29897,
13,
4706,
736,
8717,
13,
13,
1678,
822,
4331,
29918,
16553,
29918,
1761,
29898,
1311,
29892,
8717,
1125,
13,
4706,
9995,
13372,
278,
319,
1254,
964,
263,
1051,
310,
6576,
313,
579,
29889,
10568,
29918,
1761,
29897,
322,
385,
1095,
13,
4706,
2106,
313,
579,
29889,
355,
29918,
3859,
467,
3115,
3787,
3692,
727,
338,
263,
2323,
470,
2999,
13,
4706,
6576,
297,
278,
9558,
29892,
408,
1683,
29918,
1457,
15439,
674,
817,
445,
304,
8161,
13,
4706,
3692,
304,
2758,
1683,
8820,
304,
671,
1741,
3443,
7868,
886,
1213,
15945,
13,
4706,
4331,
29918,
1761,
353,
518,
579,
29889,
10568,
29962,
13,
4706,
565,
8717,
29889,
5060,
338,
6213,
29901,
13,
9651,
1583,
29889,
20787,
29918,
24530,
353,
7700,
13,
4706,
1683,
29901,
13,
9651,
1583,
29889,
20787,
29918,
24530,
353,
5852,
13,
9651,
4331,
29918,
1761,
29889,
21843,
29898,
579,
29889,
5060,
29889,
10568,
29918,
1761,
29897,
13,
9651,
8717,
1839,
355,
29918,
3859,
2033,
353,
8717,
29889,
5060,
29889,
355,
29918,
3859,
13,
9651,
628,
8717,
1839,
5060,
2033,
13,
4706,
628,
8717,
1839,
10568,
2033,
13,
4706,
8717,
1839,
10568,
29918,
1761,
2033,
353,
4331,
29918,
1761,
13,
4706,
736,
8717,
13,
13,
1678,
822,
4331,
29918,
16553,
29898,
1311,
29892,
8717,
1125,
13,
4706,
9995,
14448,
15848,
1122,
451,
505,
8820,
29892,
297,
607,
1206,
278,
8820,
13,
4706,
1820,
674,
3787,
6213,
29889,
512,
393,
1206,
29892,
3588,
372,
304,
385,
4069,
1051,
1213,
15945,
13,
4706,
565,
8717,
29889,
7387,
338,
6213,
29901,
13,
9651,
8717,
1839,
7387,
2033,
353,
5159,
13,
4706,
736,
8717,
13,
13,
1678,
822,
1683,
29918,
16553,
29898,
1311,
29892,
8717,
1125,
13,
4706,
9995,
27406,
15848,
1122,
451,
505,
8820,
29892,
297,
607,
1206,
278,
8820,
13,
4706,
1820,
674,
3787,
6213,
29889,
512,
393,
1206,
29892,
3588,
372,
304,
385,
4069,
1051,
1213,
15945,
13,
4706,
565,
8717,
29889,
2870,
29918,
7387,
338,
6213,
29901,
13,
9651,
8717,
1839,
2870,
29918,
7387,
2033,
353,
5159,
13,
4706,
736,
8717,
13,
13,
1678,
822,
1683,
29918,
1457,
15439,
29898,
1311,
29892,
8717,
1125,
13,
4706,
9995,
3644,
727,
526,
2999,
6576,
297,
445,
9558,
29892,
2821,
278,
1741,
13,
4706,
3443,
7868,
886,
1434,
9068,
278,
1683,
8820,
1213,
15945,
13,
4706,
565,
1583,
29889,
20787,
29918,
24530,
29901,
13,
9651,
1583,
29889,
3784,
29918,
3696,
353,
6213,
13,
9651,
1583,
29889,
3784,
29918,
3696,
29918,
7529,
353,
5159,
13,
4706,
736,
8717,
13,
13,
1678,
822,
4331,
29918,
3696,
29918,
16553,
29898,
1311,
29892,
8717,
1125,
13,
4706,
9995,
9044,
278,
3443,
1024,
7868,
886,
363,
278,
1857,
1741,
577,
896,
526,
13,
4706,
3625,
304,
8820,
322,
5855,
297,
445,
4331,
1213,
15945,
13,
4706,
1583,
29889,
3784,
29918,
3696,
353,
8717,
29889,
978,
13,
4706,
1583,
29889,
3784,
29918,
3696,
29918,
7529,
353,
8717,
29889,
7529,
29871,
396,
2811,
367,
263,
1051,
310,
313,
710,
29897,
2983,
13,
13,
4706,
396,
1798,
1598,
393,
1741,
4864,
322,
393,
278,
3443,
2302,
7087,
13,
4706,
565,
8717,
29889,
978,
297,
1583,
29889,
3712,
2105,
29889,
5215,
287,
29918,
13604,
29901,
13,
9651,
565,
7431,
29898,
1311,
29889,
3712,
2105,
29889,
5215,
287,
29918,
13604,
29961,
579,
29889,
978,
2314,
2804,
7431,
29898,
579,
29889,
7529,
1125,
13,
18884,
12020,
4408,
3664,
3206,
1312,
703,
8875,
1741,
756,
10240,
1353,
310,
376,
13,
462,
462,
268,
376,
16744,
1642,
4830,
29898,
579,
29889,
978,
876,
13,
4706,
25342,
8717,
29889,
978,
297,
1583,
29889,
3712,
2105,
29889,
7564,
29918,
13604,
29901,
13,
9651,
565,
7431,
29898,
1311,
29889,
3712,
2105,
29889,
7564,
29918,
13604,
29961,
579,
29889,
978,
2314,
2804,
7431,
29898,
579,
29889,
7529,
1125,
13,
18884,
12020,
4408,
3664,
3206,
1312,
703,
8875,
1741,
756,
10240,
1353,
310,
376,
13,
462,
462,
268,
376,
16744,
1642,
4830,
29898,
579,
29889,
978,
876,
13,
4706,
25342,
8717,
29889,
978,
297,
1583,
29889,
3712,
2105,
29889,
15843,
287,
29918,
13604,
29901,
13,
9651,
565,
7431,
29898,
1311,
29889,
3712,
2105,
29889,
15843,
287,
29918,
13604,
29961,
579,
29889,
978,
2314,
2804,
7431,
29898,
579,
29889,
7529,
1125,
13,
18884,
12020,
4408,
3664,
3206,
1312,
703,
8875,
1741,
756,
10240,
1353,
310,
376,
13,
462,
462,
268,
376,
16744,
1642,
4830,
29898,
579,
29889,
978,
876,
13,
4706,
1683,
29901,
13,
9651,
12020,
4408,
3664,
3206,
1312,
703,
8875,
1741,
338,
451,
385,
19673,
29892,
7463,
29892,
470,
29908,
13,
462,
462,
376,
15843,
287,
1741,
1213,
29889,
4830,
29898,
579,
29889,
978,
876,
13,
13,
4706,
736,
8717,
13,
13,
1678,
822,
3158,
29918,
3993,
29918,
1761,
29898,
1311,
29892,
8717,
1125,
13,
4706,
9995,
18455,
3158,
29918,
3993,
29918,
21513,
964,
385,
3935,
1051,
15945,
29908,
13,
4706,
565,
8717,
29889,
4102,
338,
6213,
29901,
13,
9651,
1121,
353,
5159,
13,
4706,
1683,
29901,
13,
9651,
1121,
353,
518,
579,
29889,
4102,
29962,
13,
4706,
565,
8717,
29889,
5060,
338,
451,
6213,
29901,
13,
9651,
1121,
29889,
21843,
29898,
579,
29889,
5060,
29897,
13,
4706,
736,
1121,
13,
13,
1678,
822,
12827,
29898,
1311,
29892,
8717,
1125,
13,
4706,
9995,
6565,
1598,
393,
278,
2106,
2286,
4864,
322,
278,
1134,
7087,
278,
13,
4706,
4603,
29892,
769,
1653,
278,
4007,
10194,
4276,
15945,
29908,
13,
4706,
396,
1798,
1598,
393,
278,
2106,
2286,
4864,
13,
4706,
1018,
29901,
13,
9651,
2106,
29918,
1707,
353,
1583,
29889,
3712,
2105,
29889,
3859,
29918,
16908,
29961,
579,
29889,
5182,
29962,
13,
4706,
5174,
7670,
2392,
29901,
13,
9651,
12020,
4408,
3664,
3206,
1312,
703,
8875,
338,
451,
263,
2106,
2286,
1642,
4830,
29898,
13,
18884,
8717,
29889,
5182,
876,
13,
13,
4706,
396,
5399,
1134,
13,
4706,
1018,
29901,
13,
9651,
8717,
29889,
1767,
29889,
465,
10194,
29918,
1853,
29918,
3198,
29898,
3859,
29918,
1707,
29889,
1853,
29897,
13,
4706,
5174,
5167,
29924,
1608,
905,
29901,
13,
9651,
12020,
5167,
29924,
1608,
905,
29898,
13,
18884,
376,
10960,
310,
1134,
6571,
2609,
367,
9859,
304,
2106,
2286,
376,
13,
18884,
376,
8875,
310,
297,
23712,
1134,
6571,
1642,
4830,
29898,
13,
462,
1678,
8717,
29889,
1767,
29889,
1853,
29892,
8717,
29889,
5182,
29892,
2106,
29918,
1707,
29889,
1853,
876,
13,
13,
4706,
396,
6204,
4007,
10194,
4276,
13,
4706,
736,
11819,
29889,
7900,
10194,
4276,
29898,
579,
29889,
5182,
29892,
8717,
29889,
1767,
29897,
13,
13,
1678,
822,
11924,
29898,
1311,
29892,
8717,
1125,
13,
4706,
9995,
6565,
1598,
393,
278,
2106,
2286,
4864,
322,
338,
16985,
470,
4879,
29892,
769,
13,
4706,
1653,
278,
512,
17053,
4276,
15945,
29908,
13,
4706,
396,
1798,
1598,
393,
278,
2106,
2286,
4864,
13,
4706,
1018,
29901,
13,
9651,
2106,
29918,
1707,
353,
1583,
29889,
3712,
2105,
29889,
3859,
29918,
16908,
29961,
579,
29889,
5182,
29962,
13,
4706,
5174,
7670,
2392,
29901,
13,
9651,
12020,
4408,
3664,
3206,
1312,
703,
8875,
338,
451,
263,
2106,
2286,
1642,
4830,
29898,
13,
18884,
8717,
29889,
5182,
876,
13,
13,
4706,
396,
5399,
1134,
13,
4706,
565,
2106,
29918,
1707,
29889,
1853,
451,
297,
518,
13,
18884,
22010,
29889,
29903,
2168,
29880,
1542,
29889,
10192,
29892,
13,
18884,
22010,
29889,
29903,
2168,
29880,
1542,
29889,
29943,
3927,
1299,
29892,
13,
18884,
22010,
29889,
29903,
2168,
29880,
1542,
29889,
11282,
29892,
13,
18884,
396,
14402,
29408,
4879,
11924,
322,
9263,
358,
29973,
960,
577,
29892,
881,
591,
13,
18884,
396,
884,
2758,
718,
24028,
373,
12589,
29973,
13,
18884,
22010,
29889,
29903,
2168,
29880,
1542,
29889,
29925,
6992,
4945,
5387,
13,
9651,
12020,
5167,
29924,
1608,
905,
29898,
13,
18884,
376,
29089,
11924,
2106,
2286,
6571,
310,
1134,
426,
5038,
13,
18884,
869,
4830,
29898,
579,
29889,
5182,
29892,
2106,
29918,
1707,
29889,
1853,
876,
13,
13,
4706,
396,
6204,
3158,
13,
4706,
736,
11819,
29889,
797,
17053,
4276,
29898,
579,
29889,
5182,
29897,
13,
13,
1678,
822,
9263,
358,
29898,
1311,
29892,
8717,
1125,
13,
4706,
9995,
6565,
1598,
393,
278,
2106,
2286,
4864,
322,
338,
16985,
470,
4879,
29892,
769,
13,
4706,
1653,
278,
3826,
276,
358,
4276,
15945,
29908,
13,
4706,
396,
1798,
1598,
393,
278,
2106,
2286,
4864,
13,
4706,
1018,
29901,
13,
9651,
2106,
29918,
1707,
353,
1583,
29889,
3712,
2105,
29889,
3859,
29918,
16908,
29961,
579,
29889,
5182,
29962,
13,
4706,
5174,
7670,
2392,
29901,
13,
9651,
12020,
4408,
3664,
3206,
1312,
703,
8875,
338,
451,
263,
2106,
2286,
1642,
4830,
29898,
13,
18884,
8717,
29889,
5182,
876,
13,
13,
4706,
396,
5399,
1134,
13,
4706,
565,
2106,
29918,
1707,
29889,
1853,
451,
297,
518,
13,
18884,
22010,
29889,
29903,
2168,
29880,
1542,
29889,
10192,
29892,
13,
18884,
22010,
29889,
29903,
2168,
29880,
1542,
29889,
29943,
3927,
1299,
29892,
13,
18884,
22010,
29889,
29903,
2168,
29880,
1542,
29889,
11282,
29892,
13,
18884,
396,
14402,
29408,
4879,
11924,
322,
9263,
358,
29973,
960,
577,
29892,
881,
591,
13,
18884,
396,
884,
2758,
718,
24028,
373,
12589,
29973,
13,
18884,
22010,
29889,
29903,
2168,
29880,
1542,
29889,
29925,
6992,
4945,
5387,
13,
9651,
12020,
5167,
29924,
1608,
905,
29898,
13,
18884,
376,
29089,
9263,
358,
2106,
2286,
6571,
310,
1134,
426,
5038,
13,
18884,
869,
4830,
29898,
579,
29889,
5182,
29892,
2106,
29918,
1707,
29889,
1853,
876,
13,
13,
4706,
396,
6204,
3158,
13,
4706,
736,
11819,
29889,
6185,
276,
358,
4276,
29898,
579,
29889,
5182,
29897,
13,
13,
1678,
822,
12020,
29918,
17868,
29898,
1311,
29892,
8717,
1125,
13,
4706,
9995,
6565,
1598,
393,
278,
1741,
338,
385,
7463,
470,
5609,
287,
1741,
322,
437,
1134,
13,
4706,
8454,
373,
278,
4128,
29892,
769,
1653,
278,
6981,
895,
4276,
15945,
29908,
13,
4706,
396,
5399,
393,
278,
1741,
338,
7463,
470,
5609,
287,
322,
278,
3443,
2302,
13,
4706,
396,
7087,
13,
4706,
565,
8717,
29889,
3696,
297,
1583,
29889,
3712,
2105,
29889,
15843,
287,
29918,
13604,
29901,
13,
9651,
565,
7431,
29898,
1311,
29889,
3712,
2105,
29889,
15843,
287,
29918,
13604,
29961,
579,
29889,
3696,
2314,
2804,
7431,
29898,
579,
29889,
7529,
1125,
13,
18884,
12020,
4408,
3664,
3206,
1312,
703,
8875,
1741,
756,
10240,
1353,
310,
376,
13,
462,
462,
268,
376,
16744,
1642,
4830,
29898,
579,
29889,
3696,
876,
13,
9651,
1683,
29901,
13,
18884,
1741,
29918,
7529,
353,
1583,
29889,
3712,
2105,
29889,
15843,
287,
29918,
13604,
29961,
579,
29889,
3696,
29962,
13,
4706,
25342,
8717,
29889,
3696,
297,
1583,
29889,
3712,
2105,
29889,
7564,
29918,
13604,
29901,
13,
9651,
565,
7431,
29898,
1311,
29889,
3712,
2105,
29889,
7564,
29918,
13604,
29961,
579,
29889,
3696,
2314,
2804,
7431,
29898,
579,
29889,
7529,
1125,
13,
18884,
12020,
4408,
3664,
3206,
1312,
703,
8875,
1741,
756,
10240,
1353,
310,
376,
13,
462,
462,
268,
376,
16744,
1642,
4830,
29898,
579,
29889,
3696,
876,
13,
9651,
1683,
29901,
13,
18884,
1741,
29918,
7529,
353,
1583,
29889,
3712,
2105,
29889,
7564,
29918,
13604,
29961,
579,
29889,
3696,
29962,
13,
4706,
1683,
29901,
13,
9651,
12020,
4408,
3664,
3206,
1312,
703,
8875,
1741,
338,
451,
385,
5609,
287,
470,
7463,
376,
13,
462,
462,
376,
3696,
1213,
29889,
4830,
29898,
579,
29889,
3696,
876,
13,
13,
4706,
396,
5167,
1423,
278,
4128,
13,
4706,
363,
474,
297,
3464,
29898,
2435,
29898,
579,
29889,
7529,
22164,
13,
9651,
8717,
29889,
7529,
29961,
29875,
1822,
465,
10194,
29918,
1853,
29918,
3198,
29898,
3696,
29918,
7529,
29961,
29875,
2314,
13,
13,
4706,
396,
6204,
278,
6981,
895,
4276,
13,
4706,
736,
11819,
29889,
29934,
29874,
895,
4276,
29898,
579,
29889,
3696,
29892,
8717,
29889,
7529,
29897,
13,
13,
1678,
822,
1246,
29918,
17868,
29898,
1311,
29892,
8717,
1125,
13,
4706,
9995,
4391,
278,
8251,
4276,
15945,
29908,
13,
4706,
396,
8251,
292,
263,
16876,
740,
408,
385,
3158,
881,
367,
2313,
283,
1431,
287,
322,
13,
4706,
396,
19998,
316,
3135,
630,
29889,
8011,
871,
671,
723,
367,
3168,
411,
2625,
13,
4706,
396,
9545,
29889,
13,
4706,
396,
1670,
338,
2217,
1147,
2450,
591,
508,
437,
18034,
278,
1134,
8454,
13,
4706,
396,
2307,
2309,
491,
14657,
1080,
29892,
577,
3763,
1653,
278,
3158,
29889,
13,
4706,
736,
11819,
29889,
5594,
4276,
29898,
579,
29889,
2220,
29892,
8717,
29889,
7529,
29897,
13,
13,
1678,
396,
14657,
1080,
322,
1134,
8454,
835,
13383,
13383,
7346,
13,
13,
1678,
396,
3940,
29901,
2178,
1134,
29918,
4128,
881,
367,
2845,
263,
317,
2168,
29880,
1542,
29892,
376,
4304,
613,
470,
6213,
29889,
13,
1678,
396,
6213,
565,
372,
338,
263,
16876,
740,
470,
385,
4603,
411,
263,
16876,
740,
13,
1678,
396,
313,
294,
591,
2609,
1134,
1423,
1438,
416,
376,
4304,
29908,
565,
372,
338,
263,
1870,
4879,
313,
3084,
13,
1678,
396,
363,
2845,
349,
6992,
4945,
470,
6418,
29909,
11144,
4072,
29936,
317,
2168,
29880,
1542,
6467,
29889,
13,
13,
1678,
822,
16333,
29898,
1311,
29892,
8717,
1125,
13,
4706,
9995,
18455,
263,
16333,
304,
385,
22010,
29889,
24938,
284,
15945,
29908,
13,
4706,
565,
8717,
29889,
1853,
297,
6796,
524,
613,
376,
3090,
3108,
29901,
13,
9651,
396,
315,
2578,
1446,
1716,
310,
1438,
408,
938,
4631,
1338,
13,
9651,
736,
22010,
29889,
24938,
284,
29898,
579,
29889,
1767,
29892,
22010,
29889,
29903,
2168,
29880,
1542,
29889,
10192,
29897,
13,
4706,
25342,
8717,
29889,
1853,
1275,
376,
7411,
1115,
13,
9651,
736,
22010,
29889,
24938,
284,
29898,
579,
29889,
1767,
29892,
22010,
29889,
29903,
2168,
29880,
1542,
29889,
29943,
3927,
1299,
29897,
13,
4706,
25342,
8717,
29889,
1853,
1275,
376,
1807,
1115,
13,
9651,
736,
22010,
29889,
24938,
284,
29898,
579,
29889,
1767,
29892,
22010,
29889,
29903,
2168,
29880,
1542,
29889,
20785,
29897,
13,
4706,
25342,
8717,
29889,
1853,
1275,
376,
4304,
1115,
13,
9651,
736,
22010,
29889,
24938,
284,
29898,
579,
29889,
1767,
29892,
376,
4304,
1159,
13,
13,
1678,
822,
16876,
29918,
4804,
29898,
1311,
29892,
8717,
1125,
13,
4706,
9995,
18455,
263,
16876,
740,
1246,
304,
385,
22010,
29889,
10739,
5594,
15945,
29908,
13,
4706,
736,
22010,
29889,
10739,
5594,
29898,
579,
29889,
2220,
29892,
8717,
29889,
7529,
29897,
13,
13,
1678,
822,
722,
29918,
272,
29918,
3207,
29898,
1311,
29892,
8717,
1125,
13,
4706,
9995,
18455,
263,
2106,
2286,
470,
1741,
3443,
304,
385,
22010,
29889,
2792,
9037,
470,
13,
4706,
22010,
29889,
2624,
4736,
15945,
29908,
13,
4706,
1018,
29901,
13,
9651,
1828,
29918,
13140,
353,
1583,
29889,
3784,
29918,
3696,
29918,
7529,
29889,
2248,
29898,
579,
29897,
13,
9651,
565,
1583,
29889,
3784,
29918,
3696,
297,
1583,
29889,
3712,
2105,
29889,
5215,
287,
29918,
13604,
29901,
13,
18884,
1828,
29918,
1853,
353,
1583,
29889,
3712,
2105,
29889,
5215,
287,
29918,
13604,
29961,
13,
462,
1678,
1583,
29889,
3784,
29918,
3696,
3816,
3207,
29918,
13140,
29962,
13,
9651,
25342,
1583,
29889,
3784,
29918,
3696,
297,
1583,
29889,
3712,
2105,
29889,
7564,
29918,
13604,
29901,
13,
18884,
1828,
29918,
1853,
353,
1583,
29889,
3712,
2105,
29889,
7564,
29918,
13604,
29961,
13,
462,
1678,
1583,
29889,
3784,
29918,
3696,
3816,
3207,
29918,
13140,
29962,
13,
9651,
736,
22010,
29889,
2624,
4736,
29898,
3207,
29918,
13140,
29892,
1828,
29918,
1853,
29897,
13,
4706,
5174,
7865,
2392,
29901,
13,
9651,
396,
2216,
385,
1741,
3443,
29889,
19928,
367,
263,
2106,
2286,
29889,
13,
9651,
1018,
29901,
13,
18884,
2106,
29918,
1707,
353,
1583,
29889,
3712,
2105,
29889,
3859,
29918,
16908,
29961,
579,
29962,
13,
18884,
1134,
29918,
353,
2106,
29918,
1707,
29889,
1853,
13,
18884,
736,
22010,
29889,
2792,
9037,
29898,
579,
29892,
1134,
19925,
13,
9651,
5174,
7670,
2392,
29901,
13,
18884,
12020,
4408,
3664,
3206,
1312,
703,
16174,
6571,
338,
451,
385,
1741,
3443,
376,
13,
462,
462,
268,
376,
272,
2106,
2286,
1213,
29889,
4830,
29898,
579,
876,
13,
13,
1678,
822,
28076,
1891,
29898,
1311,
29892,
8717,
1125,
13,
4706,
9995,
2177,
9097,
267,
675,
385,
4603,
15945,
29908,
13,
4706,
8717,
29889,
3560,
13244,
675,
580,
13,
4706,
736,
8717,
13,
13,
1678,
822,
443,
653,
29918,
13338,
29898,
1311,
29892,
8717,
1125,
13,
4706,
9995,
1542,
1423,
278,
443,
653,
29918,
13338,
322,
1653,
263,
853,
653,
11746,
15945,
29908,
13,
4706,
565,
338,
8758,
29898,
579,
29892,
22010,
29889,
10960,
1125,
13,
9651,
736,
8717,
13,
4706,
396,
910,
884,
947,
1134,
8454,
13,
4706,
736,
22010,
29889,
2525,
653,
11746,
29898,
579,
29961,
29900,
1402,
8717,
29961,
29896,
2314,
13,
13,
1678,
822,
4603,
29898,
1311,
29892,
8717,
1125,
13,
4706,
9995,
1542,
1423,
599,
7581,
12241,
322,
1653,
29479,
29949,
567,
515,
963,
15945,
29908,
13,
4706,
396,
910,
674,
7150,
263,
376,
8336,
29908,
310,
29871,
29941,
29899,
9161,
2701,
988,
937,
1543,
338,
278,
13,
4706,
396,
5455,
29892,
1473,
338,
278,
2175,
1751,
392,
29892,
322,
4654,
338,
278,
1492,
1751,
392,
29889,
13,
4706,
396,
910,
1818,
367,
19356,
8304,
3598,
29889,
13,
4706,
565,
338,
8758,
29898,
579,
29892,
22010,
29889,
10960,
1125,
13,
9651,
736,
8717,
13,
13,
4706,
2175,
353,
1583,
29889,
17471,
29898,
579,
29961,
29896,
2314,
13,
4706,
1492,
353,
1583,
29889,
17471,
29898,
579,
29961,
29906,
2314,
13,
13,
4706,
396,
910,
884,
947,
1134,
8454,
13,
4706,
736,
22010,
29889,
25196,
11746,
29898,
579,
29961,
29900,
1402,
2175,
29892,
1492,
29897,
13,
13,
1678,
835,
13383,
13383,
13383,
13383,
7346,
13,
13,
1678,
822,
8794,
29918,
20889,
284,
29898,
1311,
29892,
8717,
1125,
13,
4706,
9995,
10140,
287,
4631,
1338,
526,
871,
1304,
363,
2106,
17865,
29889,
3650,
262,
278,
13,
4706,
8794,
29161,
964,
2323,
6031,
1213,
15945,
13,
4706,
565,
8717,
29889,
1853,
1275,
525,
7433,
29918,
524,
2396,
13,
9651,
659,
353,
8717,
29889,
1767,
13,
9651,
628,
8717,
1839,
1853,
2033,
13,
9651,
628,
8717,
1839,
1767,
2033,
13,
9651,
8717,
1839,
1853,
2033,
353,
525,
524,
29915,
13,
9651,
8717,
1839,
1767,
2033,
353,
525,
4286,
7122,
29898,
791,
29897,
13,
4706,
25342,
8717,
29889,
1853,
1275,
525,
7433,
29918,
7411,
2396,
13,
9651,
659,
353,
8717,
29889,
1767,
13,
9651,
628,
8717,
1839,
1853,
2033,
13,
9651,
628,
8717,
1839,
1767,
2033,
13,
9651,
8717,
1839,
1853,
2033,
353,
525,
7411,
29915,
13,
9651,
8717,
1839,
1767,
2033,
353,
525,
4286,
7122,
29898,
791,
29897,
13,
4706,
736,
8717,
13,
2
] |
client/__init__.py | georgemunyoro/code-jam | 1 | 174772 | """A TUI client to the snake game."""
# This file exists to denote to Python that the folder is a package.
| [
1,
9995,
29909,
323,
3120,
3132,
304,
278,
269,
21040,
3748,
1213,
15945,
13,
13,
29937,
910,
934,
4864,
304,
13530,
304,
5132,
393,
278,
4138,
338,
263,
3577,
29889,
13,
2
] |
PrelimDataAnalysis.py | Cian-Byrne/ML_Yacht_Performance | 0 | 102251 | import seaborn as sns
import pickle
import os
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
%matplotlib qt
sns.set()
# --------------------------------------------------------------------------------------------------
# Import both datasets separately
dfTP = pd.DataFrame()
dfTP = dfTP.append(pd.read_csv(r'Data/Labeled_all_VPP_waves.csv'))
dfTP = dfTP[(dfTP['label'] == 'UW') | (dfTP['label'] == 'DW')]
dfSwan = pd.DataFrame()
dfSwan = dfSwan.append(pd.read_csv(r'Data/Swan45_DataCombined.csv'))
dfSwan = dfSwan[(dfSwan['label'] == 'UW') | (dfSwan['label'] == 'DW')]
# --------------------------------------------------------------------------------------------------
# Plotting functions
def plot_polar_raw(df):
fig = plt.figure(figsize=(12, 8))
ax = fig.add_subplot(111, polar=True)
ax.scatter(df.abs_Twa*np.pi/180, df.Bsp, c=df.Tws, cmap='Blues', label='Raw Data')
ax.set_thetamin(0)
ax.set_thetamax(180)
ax.set_theta_direction(-1)
ax.set_theta_offset(np.pi/2)
ax.set_rmax(df.Bsp.max()+1.5)
plt.legend()
plt.show()
return
def plot_polar_3d(df):
fig = plt.figure(figsize=(10, 8), dpi=100)
ax = fig.add_subplot(111, projection='3d')
ax.scatter(df.Bsp, df.abs_Twa, df.Tws, c='b', label='Polar Plot')
ax.set_xlabel('Bsp', fontsize=12)
ax.set_ylabel('Twa', fontsize=12)
ax.set_zlabel('Tws', fontsize=12)
plt.show()
return
def WindDist_Plot(df,):
# Tp-Hs plot
ax = sns.jointplot(x=df.Tws, y=df.Twa, kind='hex').set_axis_labels("Tws", "Twa")
ax.ax_joint.grid()
ax.ax_joint.set_xlim([5, 25])
ax.ax_joint.set_ylim([-180, 180])
plt.tight_layout()
plt.show()
return
# --------------------------------------------------------------------------------------------------
# Import ORC Swan model
pickleIn = open('Models/ORC_Swan45_Rbf.pickle', 'rb')
rbf_swan = pickle.load(pickleIn)
pickleIn.close()
def ORC(X):
return rbf_swan(X[:, 0], X[:, 1])
# --------------------------------------------------------------------------------------------------
# Plots for the TP52 dataset
# Polar plot colored by TWS
plot_polar_raw(dfTP)
# 3d plot colored by wave parameters
fig = plt.figure(figsize=(8, 3), dpi=100)
ax = fig.add_subplot(141, projection='3d')
ax.scatter(dfTP.Bsp, dfTP.abs_Twa, dfTP.Tws, c=dfTP.Heel_ampl, cmap='Blues', label='Colored by Heel_ampl')
ax.set_xlabel('Bsp', fontsize=12)
ax.set_ylabel('Twa', fontsize=12)
ax.set_zlabel('Tws', fontsize=12)
ax = fig.add_subplot(142, projection='3d')
ax.scatter(dfTP.Bsp, dfTP.abs_Twa, dfTP.Tws, c=dfTP.Trim_ampl, cmap='Reds', label='Colored by Trim_ampl')
ax.set_xlabel('Bsp', fontsize=12)
ax.set_ylabel('Twa', fontsize=12)
ax.set_zlabel('Tws', fontsize=12)
ax = fig.add_subplot(143, projection='3d')
ax.scatter(dfTP.Bsp, dfTP.abs_Twa, dfTP.Tws, c=dfTP.Heel_freq, cmap='Greens', label='Colored by Heel_Freq')
ax.set_xlabel('Bsp', fontsize=12)
ax.set_ylabel('Twa', fontsize=12)
ax.set_zlabel('Tws', fontsize=12)
ax = fig.add_subplot(144, projection='3d')
ax.scatter(dfTP.Bsp, dfTP.abs_Twa, dfTP.Tws, c=dfTP.Trim_freq, cmap='Purples', label='Colored by Trim_freq')
ax.set_xlabel('Bsp', fontsize=12)
ax.set_ylabel('Twa', fontsize=12)
ax.set_zlabel('Tws', fontsize=12)
plt.tight_layout()
plt.legend()
plt.show()
dfTP.columns
# plot model residuals
fig = plt.figure(figsize=(8, 3), dpi=100)
ax = fig.add_subplot(141, projection='3d')
ax.scatter(dfTP.VPP_Bsp_error, dfTP.abs_Twa, dfTP.Tws, c=dfTP.Heel_ampl, cmap='Blues', label='Colored by Heel_ampl')
ax.set_xlabel('Bsp', fontsize=12)
ax.set_ylabel('Twa', fontsize=12)
ax.set_zlabel('Tws', fontsize=12)
ax = fig.add_subplot(142, projection='3d')
ax.scatter(dfTP.VPP_Bsp_error, dfTP.abs_Twa, dfTP.Tws, c=dfTP.Trim_ampl, cmap='Reds', label='Colored by Trim_ampl')
ax.set_xlabel('Bsp', fontsize=12)
ax.set_ylabel('Twa', fontsize=12)
ax.set_zlabel('Tws', fontsize=12)
ax = fig.add_subplot(143, projection='3d')
ax.scatter(dfTP.VPP_Bsp_error, dfTP.abs_Twa, dfTP.Tws, c=dfTP.Heel_freq, cmap='Greens', label='Colored by Heel_Freq')
ax.set_xlabel('Bsp', fontsize=12)
ax.set_ylabel('Twa', fontsize=12)
ax.set_zlabel('Tws', fontsize=12)
ax = fig.add_subplot(144, projection='3d')
ax.scatter(dfTP.VPP_Bsp_error, dfTP.abs_Twa, dfTP.Tws, c=dfTP.Trim_freq, cmap='Purples', label='Colored by Trim_freq')
ax.set_xlabel('Bsp', fontsize=12)
ax.set_ylabel('Twa', fontsize=12)
ax.set_zlabel('Tws', fontsize=12)
plt.tight_layout()
plt.legend()
plt.show()
plt.hist(dfTP.VPP_Bsp_error)
# -------------
# Histogram plots of wave parameters
bins = 50
fig = plt.figure(figsize=(12, 8))
ax = fig.add_subplot(141)
ax.set_title('Heel_ampl')
ax.hist(dfTP.Heel_ampl, bins=bins)
ax = fig.add_subplot(142)
ax.set_title('Heel_freq')
ax.hist(dfTP.Heel_freq, bins=bins)
ax = fig.add_subplot(143)
ax.set_title('Trim_ampl')
ax.hist(dfTP.Trim_ampl, bins=bins)
ax = fig.add_subplot(144)
ax.set_title('Trim_freq')
ax.hist(dfTP.Trim_freq, bins=bins)
# ---------------------------------
# Distribution of wind conditions
WindDist_Plot(dfTP)
# --------------------------------------------------------------------------------------------------
# plots for Swan45 Data
plot_polar_raw(dfSwan)
plot_polar_3d(dfSwan)
WindDist_Plot(dfSwan)
# --------------------------------------------------------------------------------------------------
# --------------------------------------------------------------------------------------------------
# --------------------------------------------------------------------------------------------------
# --------------------------------------------------------------------------------------------------
| [
1,
1053,
409,
370,
1398,
408,
269,
1983,
13,
5215,
5839,
280,
13,
5215,
2897,
13,
5215,
22889,
29889,
2272,
5317,
408,
14770,
13,
5215,
12655,
408,
7442,
13,
5215,
11701,
408,
10518,
13,
29995,
2922,
17357,
3855,
29873,
13,
29879,
1983,
29889,
842,
580,
13,
13,
13,
29937,
448,
2683,
2683,
2683,
2683,
2683,
2683,
29899,
13,
29937,
16032,
1716,
20035,
16949,
13,
2176,
3557,
353,
10518,
29889,
17271,
580,
13,
2176,
3557,
353,
4489,
3557,
29889,
4397,
29898,
15926,
29889,
949,
29918,
7638,
29898,
29878,
29915,
1469,
29914,
29931,
24025,
29918,
497,
29918,
29963,
18009,
29918,
29893,
5989,
29889,
7638,
8785,
13,
13,
2176,
3557,
353,
4489,
3557,
15625,
2176,
3557,
1839,
1643,
2033,
1275,
525,
29965,
29956,
1495,
891,
313,
2176,
3557,
1839,
1643,
2033,
1275,
525,
29928,
29956,
1495,
29962,
13,
13,
2176,
10840,
273,
353,
10518,
29889,
17271,
580,
13,
2176,
10840,
273,
353,
4489,
10840,
273,
29889,
4397,
29898,
15926,
29889,
949,
29918,
7638,
29898,
29878,
29915,
1469,
29914,
10840,
273,
29946,
29945,
29918,
1469,
1523,
29890,
1312,
29889,
7638,
8785,
13,
13,
2176,
10840,
273,
353,
4489,
10840,
273,
15625,
2176,
10840,
273,
1839,
1643,
2033,
1275,
525,
29965,
29956,
1495,
891,
313,
2176,
10840,
273,
1839,
1643,
2033,
1275,
525,
29928,
29956,
1495,
29962,
13,
13,
13,
29937,
448,
2683,
2683,
2683,
2683,
2683,
2683,
29899,
13,
29937,
18399,
1259,
3168,
13,
1753,
6492,
29918,
3733,
279,
29918,
1610,
29898,
2176,
1125,
13,
1678,
2537,
353,
14770,
29889,
4532,
29898,
1003,
2311,
7607,
29896,
29906,
29892,
29871,
29947,
876,
13,
1678,
4853,
353,
2537,
29889,
1202,
29918,
1491,
5317,
29898,
29896,
29896,
29896,
29892,
16755,
29922,
5574,
29897,
13,
1678,
4853,
29889,
1557,
2620,
29898,
2176,
29889,
6897,
29918,
29911,
2766,
29930,
9302,
29889,
1631,
29914,
29896,
29947,
29900,
29892,
4489,
29889,
29933,
1028,
29892,
274,
29922,
2176,
29889,
29911,
5652,
29892,
274,
1958,
2433,
10358,
1041,
742,
3858,
2433,
22131,
3630,
1495,
13,
13,
1678,
4853,
29889,
842,
29918,
386,
300,
9103,
29898,
29900,
29897,
13,
1678,
4853,
29889,
842,
29918,
386,
300,
314,
1165,
29898,
29896,
29947,
29900,
29897,
13,
1678,
4853,
29889,
842,
29918,
3416,
29918,
20845,
6278,
29896,
29897,
13,
1678,
4853,
29889,
842,
29918,
3416,
29918,
10289,
29898,
9302,
29889,
1631,
29914,
29906,
29897,
13,
1678,
4853,
29889,
842,
29918,
29878,
3317,
29898,
2176,
29889,
29933,
1028,
29889,
3317,
580,
29974,
29896,
29889,
29945,
29897,
13,
1678,
14770,
29889,
26172,
580,
13,
1678,
14770,
29889,
4294,
580,
13,
13,
1678,
736,
13,
13,
13,
1753,
6492,
29918,
3733,
279,
29918,
29941,
29881,
29898,
2176,
1125,
13,
1678,
2537,
353,
14770,
29889,
4532,
29898,
1003,
2311,
7607,
29896,
29900,
29892,
29871,
29947,
511,
270,
1631,
29922,
29896,
29900,
29900,
29897,
13,
1678,
4853,
353,
2537,
29889,
1202,
29918,
1491,
5317,
29898,
29896,
29896,
29896,
29892,
18246,
2433,
29941,
29881,
1495,
13,
1678,
4853,
29889,
1557,
2620,
29898,
2176,
29889,
29933,
1028,
29892,
4489,
29889,
6897,
29918,
29911,
2766,
29892,
4489,
29889,
29911,
5652,
29892,
274,
2433,
29890,
742,
3858,
2433,
7713,
279,
18399,
1495,
13,
1678,
4853,
29889,
842,
29918,
29916,
1643,
877,
29933,
1028,
742,
4079,
2311,
29922,
29896,
29906,
29897,
13,
1678,
4853,
29889,
842,
29918,
29891,
1643,
877,
29911,
2766,
742,
4079,
2311,
29922,
29896,
29906,
29897,
13,
1678,
4853,
29889,
842,
29918,
29920,
1643,
877,
29911,
5652,
742,
4079,
2311,
29922,
29896,
29906,
29897,
13,
1678,
14770,
29889,
4294,
580,
13,
13,
1678,
736,
13,
13,
13,
1753,
17311,
13398,
29918,
20867,
29898,
2176,
29892,
1125,
13,
1678,
396,
323,
29886,
29899,
29950,
29879,
6492,
13,
1678,
4853,
353,
269,
1983,
29889,
12090,
5317,
29898,
29916,
29922,
2176,
29889,
29911,
5652,
29892,
343,
29922,
2176,
29889,
29911,
2766,
29892,
2924,
2433,
20970,
2824,
842,
29918,
8990,
29918,
21134,
703,
29911,
5652,
613,
376,
29911,
2766,
1159,
13,
1678,
4853,
29889,
1165,
29918,
12090,
29889,
7720,
580,
13,
1678,
4853,
29889,
1165,
29918,
12090,
29889,
842,
29918,
29916,
2576,
4197,
29945,
29892,
29871,
29906,
29945,
2314,
13,
1678,
4853,
29889,
1165,
29918,
12090,
29889,
842,
29918,
29891,
2576,
4197,
29899,
29896,
29947,
29900,
29892,
29871,
29896,
29947,
29900,
2314,
13,
1678,
14770,
29889,
29873,
523,
29918,
2680,
580,
13,
1678,
14770,
29889,
4294,
580,
13,
13,
1678,
736,
13,
13,
13,
29937,
448,
2683,
2683,
2683,
2683,
2683,
2683,
29899,
13,
29937,
16032,
6323,
29907,
3925,
273,
1904,
13,
23945,
280,
797,
353,
1722,
877,
23785,
29914,
1955,
29907,
29918,
10840,
273,
29946,
29945,
29918,
29934,
1635,
29889,
23945,
280,
742,
525,
6050,
1495,
13,
29878,
1635,
29918,
2774,
273,
353,
5839,
280,
29889,
1359,
29898,
23945,
280,
797,
29897,
13,
23945,
280,
797,
29889,
5358,
580,
13,
13,
13,
1753,
6323,
29907,
29898,
29990,
1125,
13,
1678,
736,
364,
1635,
29918,
2774,
273,
29898,
29990,
7503,
29892,
29871,
29900,
1402,
1060,
7503,
29892,
29871,
29896,
2314,
13,
13,
29937,
448,
2683,
2683,
2683,
2683,
2683,
2683,
29899,
13,
29937,
1858,
1862,
363,
278,
323,
29925,
29945,
29906,
8783,
13,
29937,
2043,
279,
6492,
28684,
491,
323,
7811,
13,
13,
13,
5317,
29918,
3733,
279,
29918,
1610,
29898,
2176,
3557,
29897,
13,
13,
13,
29937,
29871,
29941,
29881,
6492,
28684,
491,
10742,
4128,
13,
1003,
353,
14770,
29889,
4532,
29898,
1003,
2311,
7607,
29947,
29892,
29871,
29941,
511,
270,
1631,
29922,
29896,
29900,
29900,
29897,
13,
1165,
353,
2537,
29889,
1202,
29918,
1491,
5317,
29898,
29896,
29946,
29896,
29892,
18246,
2433,
29941,
29881,
1495,
13,
1165,
29889,
1557,
2620,
29898,
2176,
3557,
29889,
29933,
1028,
29892,
4489,
3557,
29889,
6897,
29918,
29911,
2766,
29892,
4489,
3557,
29889,
29911,
5652,
29892,
274,
29922,
2176,
3557,
29889,
3868,
295,
29918,
314,
572,
29892,
274,
1958,
2433,
10358,
1041,
742,
3858,
2433,
3306,
287,
491,
940,
295,
29918,
314,
572,
1495,
13,
1165,
29889,
842,
29918,
29916,
1643,
877,
29933,
1028,
742,
4079,
2311,
29922,
29896,
29906,
29897,
13,
1165,
29889,
842,
29918,
29891,
1643,
877,
29911,
2766,
742,
4079,
2311,
29922,
29896,
29906,
29897,
13,
1165,
29889,
842,
29918,
29920,
1643,
877,
29911,
5652,
742,
4079,
2311,
29922,
29896,
29906,
29897,
13,
13,
1165,
353,
2537,
29889,
1202,
29918,
1491,
5317,
29898,
29896,
29946,
29906,
29892,
18246,
2433,
29941,
29881,
1495,
13,
1165,
29889,
1557,
2620,
29898,
2176,
3557,
29889,
29933,
1028,
29892,
4489,
3557,
29889,
6897,
29918,
29911,
2766,
29892,
4489,
3557,
29889,
29911,
5652,
29892,
274,
29922,
2176,
3557,
29889,
2308,
326,
29918,
314,
572,
29892,
274,
1958,
2433,
29934,
5779,
742,
3858,
2433,
3306,
287,
491,
1605,
326,
29918,
314,
572,
1495,
13,
1165,
29889,
842,
29918,
29916,
1643,
877,
29933,
1028,
742,
4079,
2311,
29922,
29896,
29906,
29897,
13,
1165,
29889,
842,
29918,
29891,
1643,
877,
29911,
2766,
742,
4079,
2311,
29922,
29896,
29906,
29897,
13,
1165,
29889,
842,
29918,
29920,
1643,
877,
29911,
5652,
742,
4079,
2311,
29922,
29896,
29906,
29897,
13,
13,
1165,
353,
2537,
29889,
1202,
29918,
1491,
5317,
29898,
29896,
29946,
29941,
29892,
18246,
2433,
29941,
29881,
1495,
13,
1165,
29889,
1557,
2620,
29898,
2176,
3557,
29889,
29933,
1028,
29892,
4489,
3557,
29889,
6897,
29918,
29911,
2766,
29892,
4489,
3557,
29889,
29911,
5652,
29892,
274,
29922,
2176,
3557,
29889,
3868,
295,
29918,
29888,
7971,
29892,
274,
1958,
2433,
29954,
11642,
742,
3858,
2433,
3306,
287,
491,
940,
295,
29918,
29943,
7971,
1495,
13,
1165,
29889,
842,
29918,
29916,
1643,
877,
29933,
1028,
742,
4079,
2311,
29922,
29896,
29906,
29897,
13,
1165,
29889,
842,
29918,
29891,
1643,
877,
29911,
2766,
742,
4079,
2311,
29922,
29896,
29906,
29897,
13,
1165,
29889,
842,
29918,
29920,
1643,
877,
29911,
5652,
742,
4079,
2311,
29922,
29896,
29906,
29897,
13,
13,
1165,
353,
2537,
29889,
1202,
29918,
1491,
5317,
29898,
29896,
29946,
29946,
29892,
18246,
2433,
29941,
29881,
1495,
13,
1165,
29889,
1557,
2620,
29898,
2176,
3557,
29889,
29933,
1028,
29892,
4489,
3557,
29889,
6897,
29918,
29911,
2766,
29892,
4489,
3557,
29889,
29911,
5652,
29892,
274,
29922,
2176,
3557,
29889,
2308,
326,
29918,
29888,
7971,
29892,
274,
1958,
2433,
29925,
332,
2701,
742,
3858,
2433,
3306,
287,
491,
1605,
326,
29918,
29888,
7971,
1495,
13,
1165,
29889,
842,
29918,
29916,
1643,
877,
29933,
1028,
742,
4079,
2311,
29922,
29896,
29906,
29897,
13,
1165,
29889,
842,
29918,
29891,
1643,
877,
29911,
2766,
742,
4079,
2311,
29922,
29896,
29906,
29897,
13,
1165,
29889,
842,
29918,
29920,
1643,
877,
29911,
5652,
742,
4079,
2311,
29922,
29896,
29906,
29897,
13,
572,
29873,
29889,
29873,
523,
29918,
2680,
580,
13,
572,
29873,
29889,
26172,
580,
13,
572,
29873,
29889,
4294,
580,
13,
13,
13,
2176,
3557,
29889,
13099,
13,
29937,
6492,
1904,
10995,
27101,
13,
1003,
353,
14770,
29889,
4532,
29898,
1003,
2311,
7607,
29947,
29892,
29871,
29941,
511,
270,
1631,
29922,
29896,
29900,
29900,
29897,
13,
1165,
353,
2537,
29889,
1202,
29918,
1491,
5317,
29898,
29896,
29946,
29896,
29892,
18246,
2433,
29941,
29881,
1495,
13,
1165,
29889,
1557,
2620,
29898,
2176,
3557,
29889,
29963,
18009,
29918,
29933,
1028,
29918,
2704,
29892,
4489,
3557,
29889,
6897,
29918,
29911,
2766,
29892,
4489,
3557,
29889,
29911,
5652,
29892,
274,
29922,
2176,
3557,
29889,
3868,
295,
29918,
314,
572,
29892,
274,
1958,
2433,
10358,
1041,
742,
3858,
2433,
3306,
287,
491,
940,
295,
29918,
314,
572,
1495,
13,
1165,
29889,
842,
29918,
29916,
1643,
877,
29933,
1028,
742,
4079,
2311,
29922,
29896,
29906,
29897,
13,
1165,
29889,
842,
29918,
29891,
1643,
877,
29911,
2766,
742,
4079,
2311,
29922,
29896,
29906,
29897,
13,
1165,
29889,
842,
29918,
29920,
1643,
877,
29911,
5652,
742,
4079,
2311,
29922,
29896,
29906,
29897,
13,
13,
1165,
353,
2537,
29889,
1202,
29918,
1491,
5317,
29898,
29896,
29946,
29906,
29892,
18246,
2433,
29941,
29881,
1495,
13,
1165,
29889,
1557,
2620,
29898,
2176,
3557,
29889,
29963,
18009,
29918,
29933,
1028,
29918,
2704,
29892,
4489,
3557,
29889,
6897,
29918,
29911,
2766,
29892,
4489,
3557,
29889,
29911,
5652,
29892,
274,
29922,
2176,
3557,
29889,
2308,
326,
29918,
314,
572,
29892,
274,
1958,
2433,
29934,
5779,
742,
3858,
2433,
3306,
287,
491,
1605,
326,
29918,
314,
572,
1495,
13,
1165,
29889,
842,
29918,
29916,
1643,
877,
29933,
1028,
742,
4079,
2311,
29922,
29896,
29906,
29897,
13,
1165,
29889,
842,
29918,
29891,
1643,
877,
29911,
2766,
742,
4079,
2311,
29922,
29896,
29906,
29897,
13,
1165,
29889,
842,
29918,
29920,
1643,
877,
29911,
5652,
742,
4079,
2311,
29922,
29896,
29906,
29897,
13,
13,
1165,
353,
2537,
29889,
1202,
29918,
1491,
5317,
29898,
29896,
29946,
29941,
29892,
18246,
2433,
29941,
29881,
1495,
13,
1165,
29889,
1557,
2620,
29898,
2176,
3557,
29889,
29963,
18009,
29918,
29933,
1028,
29918,
2704,
29892,
4489,
3557,
29889,
6897,
29918,
29911,
2766,
29892,
4489,
3557,
29889,
29911,
5652,
29892,
274,
29922,
2176,
3557,
29889,
3868,
295,
29918,
29888,
7971,
29892,
274,
1958,
2433,
29954,
11642,
742,
3858,
2433,
3306,
287,
491,
940,
295,
29918,
29943,
7971,
1495,
13,
1165,
29889,
842,
29918,
29916,
1643,
877,
29933,
1028,
742,
4079,
2311,
29922,
29896,
29906,
29897,
13,
1165,
29889,
842,
29918,
29891,
1643,
877,
29911,
2766,
742,
4079,
2311,
29922,
29896,
29906,
29897,
13,
1165,
29889,
842,
29918,
29920,
1643,
877,
29911,
5652,
742,
4079,
2311,
29922,
29896,
29906,
29897,
13,
13,
1165,
353,
2537,
29889,
1202,
29918,
1491,
5317,
29898,
29896,
29946,
29946,
29892,
18246,
2433,
29941,
29881,
1495,
13,
1165,
29889,
1557,
2620,
29898,
2176,
3557,
29889,
29963,
18009,
29918,
29933,
1028,
29918,
2704,
29892,
4489,
3557,
29889,
6897,
29918,
29911,
2766,
29892,
4489,
3557,
29889,
29911,
5652,
29892,
274,
29922,
2176,
3557,
29889,
2308,
326,
29918,
29888,
7971,
29892,
274,
1958,
2433,
29925,
332,
2701,
742,
3858,
2433,
3306,
287,
491,
1605,
326,
29918,
29888,
7971,
1495,
13,
1165,
29889,
842,
29918,
29916,
1643,
877,
29933,
1028,
742,
4079,
2311,
29922,
29896,
29906,
29897,
13,
1165,
29889,
842,
29918,
29891,
1643,
877,
29911,
2766,
742,
4079,
2311,
29922,
29896,
29906,
29897,
13,
1165,
29889,
842,
29918,
29920,
1643,
877,
29911,
5652,
742,
4079,
2311,
29922,
29896,
29906,
29897,
13,
572,
29873,
29889,
29873,
523,
29918,
2680,
580,
13,
572,
29873,
29889,
26172,
580,
13,
572,
29873,
29889,
4294,
580,
13,
13,
572,
29873,
29889,
29882,
391,
29898,
2176,
3557,
29889,
29963,
18009,
29918,
29933,
1028,
29918,
2704,
29897,
13,
13,
13,
29937,
448,
9072,
13,
29937,
15179,
13342,
24580,
310,
10742,
4128,
13,
29890,
1144,
353,
29871,
29945,
29900,
13,
1003,
353,
14770,
29889,
4532,
29898,
1003,
2311,
7607,
29896,
29906,
29892,
29871,
29947,
876,
13,
1165,
353,
2537,
29889,
1202,
29918,
1491,
5317,
29898,
29896,
29946,
29896,
29897,
13,
1165,
29889,
842,
29918,
3257,
877,
3868,
295,
29918,
314,
572,
1495,
13,
1165,
29889,
29882,
391,
29898,
2176,
3557,
29889,
3868,
295,
29918,
314,
572,
29892,
289,
1144,
29922,
29890,
1144,
29897,
13,
13,
1165,
353,
2537,
29889,
1202,
29918,
1491,
5317,
29898,
29896,
29946,
29906,
29897,
13,
1165,
29889,
842,
29918,
3257,
877,
3868,
295,
29918,
29888,
7971,
1495,
13,
1165,
29889,
29882,
391,
29898,
2176,
3557,
29889,
3868,
295,
29918,
29888,
7971,
29892,
289,
1144,
29922,
29890,
1144,
29897,
13,
13,
1165,
353,
2537,
29889,
1202,
29918,
1491,
5317,
29898,
29896,
29946,
29941,
29897,
13,
1165,
29889,
842,
29918,
3257,
877,
2308,
326,
29918,
314,
572,
1495,
13,
1165,
29889,
29882,
391,
29898,
2176,
3557,
29889,
2308,
326,
29918,
314,
572,
29892,
289,
1144,
29922,
29890,
1144,
29897,
13,
13,
1165,
353,
2537,
29889,
1202,
29918,
1491,
5317,
29898,
29896,
29946,
29946,
29897,
13,
1165,
29889,
842,
29918,
3257,
877,
2308,
326,
29918,
29888,
7971,
1495,
13,
1165,
29889,
29882,
391,
29898,
2176,
3557,
29889,
2308,
326,
29918,
29888,
7971,
29892,
289,
1144,
29922,
29890,
1144,
29897,
13,
13,
29937,
448,
2683,
2683,
13,
29937,
17740,
310,
8805,
5855,
13,
13,
29956,
513,
13398,
29918,
20867,
29898,
2176,
3557,
29897,
13,
13,
13,
29937,
448,
2683,
2683,
2683,
2683,
2683,
2683,
29899,
13,
29937,
24580,
363,
3925,
273,
29946,
29945,
3630,
13,
5317,
29918,
3733,
279,
29918,
1610,
29898,
2176,
10840,
273,
29897,
13,
13,
5317,
29918,
3733,
279,
29918,
29941,
29881,
29898,
2176,
10840,
273,
29897,
13,
13,
29956,
513,
13398,
29918,
20867,
29898,
2176,
10840,
273,
29897,
13,
29937,
448,
2683,
2683,
2683,
2683,
2683,
2683,
29899,
13,
13,
13,
29937,
448,
2683,
2683,
2683,
2683,
2683,
2683,
29899,
13,
29937,
448,
2683,
2683,
2683,
2683,
2683,
2683,
29899,
13,
29937,
448,
2683,
2683,
2683,
2683,
2683,
2683,
29899,
13,
2
] |
covid/migrations/0023_spammer.py | vivekkhimani/LifeNest | 2 | 1604526 | <reponame>vivekkhimani/LifeNest
# Generated by Django 3.2.3 on 2021-05-26 05:24
from django.db import migrations, models
import django.db.models.deletion
import phonenumber_field.modelfields
class Migration(migrations.Migration):
dependencies = [
('covid', '0022_delete_spammer'),
]
operations = [
migrations.CreateModel(
name='Spammer',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('phone', phonenumber_field.modelfields.PhoneNumberField(max_length=20, region=None)),
('reason', models.CharField(help_text='Please explain the reason for marking this number as spam.', max_length=500)),
('reporter', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='covid.participant')),
],
),
]
| [
1,
529,
276,
1112,
420,
29958,
29894,
573,
6859,
26994,
3270,
29914,
26754,
29940,
342,
13,
29937,
3251,
630,
491,
15337,
29871,
29941,
29889,
29906,
29889,
29941,
373,
29871,
29906,
29900,
29906,
29896,
29899,
29900,
29945,
29899,
29906,
29953,
29871,
29900,
29945,
29901,
29906,
29946,
13,
13,
3166,
9557,
29889,
2585,
1053,
9725,
800,
29892,
4733,
13,
5215,
9557,
29889,
2585,
29889,
9794,
29889,
311,
1026,
291,
13,
5215,
1374,
19131,
2807,
29918,
2671,
29889,
1545,
761,
969,
29879,
13,
13,
13,
1990,
341,
16783,
29898,
26983,
800,
29889,
29924,
16783,
1125,
13,
13,
1678,
9962,
353,
518,
13,
4706,
6702,
24542,
333,
742,
525,
29900,
29900,
29906,
29906,
29918,
8143,
29918,
1028,
28527,
5477,
13,
1678,
4514,
13,
13,
1678,
6931,
353,
518,
13,
4706,
9725,
800,
29889,
4391,
3195,
29898,
13,
9651,
1024,
2433,
5592,
28527,
742,
13,
9651,
4235,
11759,
13,
18884,
6702,
333,
742,
4733,
29889,
6970,
12300,
3073,
29898,
6921,
29918,
11600,
29922,
5574,
29892,
7601,
29918,
1989,
29922,
5574,
29892,
28755,
29922,
8824,
29892,
26952,
29918,
978,
2433,
1367,
1495,
511,
13,
18884,
6702,
6710,
742,
1374,
19131,
2807,
29918,
2671,
29889,
1545,
761,
969,
29879,
29889,
9861,
4557,
3073,
29898,
3317,
29918,
2848,
29922,
29906,
29900,
29892,
5120,
29922,
8516,
8243,
13,
18884,
6702,
23147,
742,
4733,
29889,
27890,
29898,
8477,
29918,
726,
2433,
12148,
5649,
278,
2769,
363,
2791,
292,
445,
1353,
408,
805,
314,
29889,
742,
4236,
29918,
2848,
29922,
29945,
29900,
29900,
8243,
13,
18884,
6702,
276,
18505,
742,
4733,
29889,
27755,
2558,
29898,
265,
29918,
8143,
29922,
14095,
29889,
2585,
29889,
9794,
29889,
311,
1026,
291,
29889,
29907,
3289,
5454,
2287,
29892,
304,
2433,
24542,
333,
29889,
1595,
12654,
424,
1495,
511,
13,
9651,
21251,
13,
4706,
10353,
13,
1678,
4514,
13,
2
] |
src/compas_rv2/datastructures/meshmixin.py | tkmmark/compas-RV2 | 0 | 177908 | <filename>src/compas_rv2/datastructures/meshmixin.py
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
# from compas.utilities import pairwise
from compas.geometry import angle_vectors
__all__ = ['MeshMixin']
class MeshMixin(object):
"""Mixin for all mesh-based data structure in RV2."""
def edge_loop(self, uv):
if self.is_edge_on_boundary(*uv):
return self._edge_loop_on_boundary(uv)
edges = []
current, previous = uv
edges.append((previous, current))
while True:
if current == uv[1]:
break
if self.vertex_attribute(current, 'is_fixed'):
break
nbrs = self.vertex_neighbors(current, ordered=True)
if len(nbrs) != 4:
break
i = nbrs.index(previous)
previous = current
current = nbrs[i - 2]
edges.append((previous, current))
edges[:] = [(u, v) for v, u in edges[::-1]]
if edges[0][0] == edges[-1][1]:
return edges
previous, current = uv
while True:
if self.vertex_attribute(current, 'is_fixed'):
break
nbrs = self.vertex_neighbors(current, ordered=True)
if len(nbrs) != 4:
break
i = nbrs.index(previous)
previous = current
current = nbrs[i - 2]
edges.append((previous, current))
return edges
def _edge_loop_on_boundary(self, uv):
edges = []
current, previous = uv
edges.append((previous, current))
while True:
if current == uv[1]:
break
if self.vertex_attribute(current, 'is_fixed'):
break
nbrs = self.vertex_neighbors(current)
if len(nbrs) == 2:
break
nbr = None
for temp in nbrs:
if temp == previous:
continue
if self.is_edge_on_boundary(current, temp):
nbr = temp
break
if nbr is None:
break
previous, current = current, nbr
edges.append((previous, current))
edges[:] = [(u, v) for v, u in edges[::-1]]
if edges[0][0] == edges[-1][1]:
return edges
previous, current = uv
while True:
if self.vertex_attribute(current, 'is_fixed'):
break
nbrs = self.vertex_neighbors(current)
if len(nbrs) == 2:
break
nbr = None
for temp in nbrs:
if temp == previous:
continue
if self.is_edge_on_boundary(current, temp):
nbr = temp
break
if nbr is None:
break
previous, current = current, nbr
edges.append((previous, current))
return edges
def edge_strip(self, uv):
edges = []
v, u = uv
while True:
edges.append((u, v))
fkey = self.halfedge[u][v]
if fkey is None:
break
vertices = self.face_vertices(fkey)
if len(vertices) != 4:
break
i = vertices.index(u)
u = vertices[i - 1]
v = vertices[i - 2]
edges[:] = [(u, v) for v, u in edges[::-1]]
u, v = uv
while True:
fkey = self.halfedge[u][v]
if fkey is None:
break
vertices = self.face_vertices(fkey)
if len(vertices) != 4:
break
i = vertices.index(u)
u = vertices[i - 1]
v = vertices[i - 2]
edges.append((u, v))
return edges
def vertices_on_edge_loop(self, uv):
edges = self.edge_loop(uv)
if len(edges) == 1:
return edges[0]
vertices = [edge[0] for edge in edges]
if edges[-1][1] != edges[0][0]:
vertices.append(edges[-1][1])
return vertices
def corner_vertices(self, tol=160):
vkeys = []
for key in self.vertices_on_boundary():
if self.vertex_degree(key) == 2:
vkeys.append(key)
else:
nbrs = []
for nkey in self.vertex_neighbors(key):
if self.is_edge_on_boundary(key, nkey):
nbrs.append(nkey)
u = (self.edge_vector(key, nbrs[0]))
v = (self.edge_vector(key, nbrs[1]))
if angle_vectors(u, v, deg=True) < tol:
vkeys.append(key)
return vkeys
# def faces_on_edge_loop(self, uv):
# pass
# def faces_on_edge_strip(self, uv):
# pass
# def continuous_vertices_on_boundary(self, uv):
# vertices = []
# current, previous = uv
# vertices.append(current)
# if not self.vertex_attribute(current, 'is_fixed'):
# while True:
# nbrs = self.vertex_neighbors(current)
# for nbr in nbrs:
# if nbr == previous:
# continue
# if self.is_edge_on_boundary(current, nbr):
# vertices.append(nbr)
# break
# if vertices[-1] == vertices[0]:
# break
# if self.vertex_attribute(vertices[-1], 'is_fixed'):
# break
# previous = current
# current = nbr
# vertices[:] = vertices[::-1]
# previous, current = uv
# vertices.append(current)
# if not self.vertex_attribute(current, 'is_fixed'):
# while True:
# nbrs = self.vertex_neighbors(current)
# for nbr in nbrs:
# if nbr == previous:
# continue
# if self.is_edge_on_boundary(current, nbr):
# vertices.append(nbr)
# break
# if vertices[-1] == vertices[0]:
# break
# if self.vertex_attribute(vertices[-1], 'is_fixed'):
# break
# previous = current
# current = nbr
# return vertices
# def continuous_vertices(self, uv):
# """Ordered vertices along the direction of an edge.
# Note that the direction of an edge only makes sense in a quad patch
# of the diagram. Therefore, the search in either direction of the edge
# stops if the next encountered vertex is not 4-valent, or if it is on
# the boundary of the diagram.
# Parameters
# ----------
# uv : tuple
# The edge identifier.
# Returns
# -------
# list
# Ordered vertices along the direction of the edge.
# The first vertex is the vertex at the end of the u-direction.
# The last vertex is the vertex at the end of the v-direction.
# """
# valency = 4
# if self.is_edge_on_boundary(*uv):
# valency = 3
# vertices = []
# current, previous = uv
# while True:
# vertices.append(current)
# nbrs = self.vertex_neighbors(current, ordered=True)
# if len(nbrs) != valency:
# break
# i = nbrs.index(previous)
# previous = current
# current = nbrs[i - 2]
# if valency == 3 and not self.is_edge_on_boundary(previous, current):
# current = nbrs[i - 1]
# vertices[:] = vertices[::-1]
# previous, current = uv
# while True:
# vertices.append(current)
# nbrs = self.vertex_neighbors(current, ordered=True)
# if len(nbrs) != valency:
# break
# i = nbrs.index(previous)
# previous = current
# current = nbrs[i - 2]
# if valency == 3 and not self.is_edge_on_boundary(previous, current):
# current = nbrs[i - 1]
# return vertices
# def continuous_edges(self, uv):
# """Ordered edges along the direction of an edge.
# Note that the direction of an edge only makes sense in a quadpatch
# of the diagram. Therefore, the search in either direction of the edges
# stops if the opposite vertex of the next encountered edge is not
# 4-valent or if it lies on the boundary of the diagram.
# Parameters
# ----------
# uv : tuple
# The edge identifier.
# Returns
# -------
# list
# A list of ordered edge identifiers.
# Edges are aligned head-to-tail.
# Therefore, the orientation of the edges is not necessarily the same as in the diagram.
# The first edge is the edge at the end of the u-direction.
# The last edge is the edge at the end of the
# """
# vertices = self.continuous_vertices(uv)
# return list(pairwise(vertices))
# def parallel_edges(self, uv):
# """Edges parallel to an edge.
# Parallel edges only exist in a quadpatch of the diagram.
# The search in either direction stops as soon as the next edge
# is adjacent to a face that is not a quadrilateral or if it is on
# the boundary of the diagram.
# Parameters
# ----------
# uv : tuple
# The edge identifier.
# Returns
# -------
# list
# A list of parallel edges.
# """
# edges = []
# v, u = uv
# while True:
# fkey = self.halfedge[u][v]
# if fkey is None:
# break
# vertices = self.face_vertices(fkey)
# if len(vertices) != 4:
# break
# edges.append((u, v))
# i = vertices.index(u)
# u = vertices[i - 1]
# v = vertices[i - 2]
# edges[:] = edges[::-1]
# u, v = uv
# while True:
# fkey = self.halfedge[u][v]
# if fkey is None:
# break
# vertices = self.face_vertices(fkey)
# if len(vertices) != 4:
# break
# edges.append((u, v))
# i = vertices.index(u)
# u = vertices[i - 1]
# v = vertices[i - 2]
# return edges
# def parallel_faces(self, uv):
# """The faces along the direction of parallel edges.
# Parameters
# ----------
# uv : tuple
# The edge identifier.
# Returns
# -------
# list
# A list of parallel faces.
# """
# faces = []
# v, u = uv
# while True:
# fkey = self.halfedge[u][v]
# if fkey is None:
# break
# vertices = self.face_vertices(fkey)
# if len(vertices) != 4:
# break
# faces.append(fkey)
# i = vertices.index(u)
# u = vertices[i - 1]
# v = vertices[i - 2]
# faces[:] = faces[::-1]
# u, v = uv
# while True:
# fkey = self.halfedge[u][v]
# if fkey is None:
# break
# vertices = self.face_vertices(fkey)
# if len(vertices) != 4:
# break
# faces.append(fkey)
# i = vertices.index(u)
# u = vertices[i - 1]
# v = vertices[i - 2]
# return faces
# ==============================================================================
# Main
# ==============================================================================
if __name__ == '__main__':
pass
| [
1,
529,
9507,
29958,
4351,
29914,
2388,
294,
29918,
15291,
29906,
29914,
4130,
7614,
5313,
1973,
29914,
4467,
7184,
861,
262,
29889,
2272,
13,
3166,
4770,
29888,
9130,
1649,
1053,
1596,
29918,
2220,
13,
3166,
4770,
29888,
9130,
1649,
1053,
8380,
29918,
5215,
13,
3166,
4770,
29888,
9130,
1649,
1053,
8542,
13,
13,
29937,
515,
752,
294,
29889,
4422,
1907,
1053,
5101,
3538,
13,
3166,
752,
294,
29889,
19156,
1053,
10696,
29918,
345,
14359,
13,
13,
13,
1649,
497,
1649,
353,
6024,
29924,
12094,
29924,
861,
262,
2033,
13,
13,
13,
1990,
341,
12094,
29924,
861,
262,
29898,
3318,
1125,
13,
1678,
9995,
29924,
861,
262,
363,
599,
27716,
29899,
6707,
848,
3829,
297,
390,
29963,
29906,
1213,
15945,
13,
13,
1678,
822,
7636,
29918,
7888,
29898,
1311,
29892,
318,
29894,
1125,
13,
4706,
565,
1583,
29889,
275,
29918,
12864,
29918,
265,
29918,
9917,
653,
10456,
4090,
1125,
13,
9651,
736,
1583,
3032,
12864,
29918,
7888,
29918,
265,
29918,
9917,
653,
29898,
4090,
29897,
13,
13,
4706,
12770,
353,
5159,
13,
4706,
1857,
29892,
3517,
353,
318,
29894,
13,
4706,
12770,
29889,
4397,
3552,
24957,
29892,
1857,
876,
13,
13,
4706,
1550,
5852,
29901,
13,
9651,
565,
1857,
1275,
318,
29894,
29961,
29896,
5387,
13,
18884,
2867,
13,
9651,
565,
1583,
29889,
369,
4776,
29918,
12715,
29898,
3784,
29892,
525,
275,
29918,
20227,
29374,
13,
18884,
2867,
13,
9651,
302,
1182,
29879,
353,
1583,
29889,
369,
4776,
29918,
484,
1141,
29890,
943,
29898,
3784,
29892,
10372,
29922,
5574,
29897,
13,
9651,
565,
7431,
29898,
29876,
1182,
29879,
29897,
2804,
29871,
29946,
29901,
13,
18884,
2867,
13,
9651,
474,
353,
302,
1182,
29879,
29889,
2248,
29898,
24957,
29897,
13,
9651,
3517,
353,
1857,
13,
9651,
1857,
353,
302,
1182,
29879,
29961,
29875,
448,
29871,
29906,
29962,
13,
9651,
12770,
29889,
4397,
3552,
24957,
29892,
1857,
876,
13,
13,
4706,
12770,
7503,
29962,
353,
17288,
29884,
29892,
325,
29897,
363,
325,
29892,
318,
297,
12770,
29961,
1057,
29899,
29896,
5262,
13,
13,
4706,
565,
12770,
29961,
29900,
3816,
29900,
29962,
1275,
12770,
14352,
29896,
3816,
29896,
5387,
13,
9651,
736,
12770,
13,
13,
4706,
3517,
29892,
1857,
353,
318,
29894,
13,
4706,
1550,
5852,
29901,
13,
9651,
565,
1583,
29889,
369,
4776,
29918,
12715,
29898,
3784,
29892,
525,
275,
29918,
20227,
29374,
13,
18884,
2867,
13,
9651,
302,
1182,
29879,
353,
1583,
29889,
369,
4776,
29918,
484,
1141,
29890,
943,
29898,
3784,
29892,
10372,
29922,
5574,
29897,
13,
9651,
565,
7431,
29898,
29876,
1182,
29879,
29897,
2804,
29871,
29946,
29901,
13,
18884,
2867,
13,
9651,
474,
353,
302,
1182,
29879,
29889,
2248,
29898,
24957,
29897,
13,
9651,
3517,
353,
1857,
13,
9651,
1857,
353,
302,
1182,
29879,
29961,
29875,
448,
29871,
29906,
29962,
13,
9651,
12770,
29889,
4397,
3552,
24957,
29892,
1857,
876,
13,
13,
4706,
736,
12770,
13,
13,
1678,
822,
903,
12864,
29918,
7888,
29918,
265,
29918,
9917,
653,
29898,
1311,
29892,
318,
29894,
1125,
13,
4706,
12770,
353,
5159,
13,
4706,
1857,
29892,
3517,
353,
318,
29894,
13,
4706,
12770,
29889,
4397,
3552,
24957,
29892,
1857,
876,
13,
13,
4706,
1550,
5852,
29901,
13,
9651,
565,
1857,
1275,
318,
29894,
29961,
29896,
5387,
13,
18884,
2867,
13,
9651,
565,
1583,
29889,
369,
4776,
29918,
12715,
29898,
3784,
29892,
525,
275,
29918,
20227,
29374,
13,
18884,
2867,
13,
9651,
302,
1182,
29879,
353,
1583,
29889,
369,
4776,
29918,
484,
1141,
29890,
943,
29898,
3784,
29897,
13,
9651,
565,
7431,
29898,
29876,
1182,
29879,
29897,
1275,
29871,
29906,
29901,
13,
18884,
2867,
13,
9651,
302,
1182,
353,
6213,
13,
9651,
363,
5694,
297,
302,
1182,
29879,
29901,
13,
18884,
565,
5694,
1275,
3517,
29901,
13,
462,
1678,
6773,
13,
18884,
565,
1583,
29889,
275,
29918,
12864,
29918,
265,
29918,
9917,
653,
29898,
3784,
29892,
5694,
1125,
13,
462,
1678,
302,
1182,
353,
5694,
13,
462,
1678,
2867,
13,
9651,
565,
302,
1182,
338,
6213,
29901,
13,
18884,
2867,
13,
9651,
3517,
29892,
1857,
353,
1857,
29892,
302,
1182,
13,
9651,
12770,
29889,
4397,
3552,
24957,
29892,
1857,
876,
13,
13,
4706,
12770,
7503,
29962,
353,
17288,
29884,
29892,
325,
29897,
363,
325,
29892,
318,
297,
12770,
29961,
1057,
29899,
29896,
5262,
13,
13,
4706,
565,
12770,
29961,
29900,
3816,
29900,
29962,
1275,
12770,
14352,
29896,
3816,
29896,
5387,
13,
9651,
736,
12770,
13,
13,
4706,
3517,
29892,
1857,
353,
318,
29894,
13,
4706,
1550,
5852,
29901,
13,
9651,
565,
1583,
29889,
369,
4776,
29918,
12715,
29898,
3784,
29892,
525,
275,
29918,
20227,
29374,
13,
18884,
2867,
13,
9651,
302,
1182,
29879,
353,
1583,
29889,
369,
4776,
29918,
484,
1141,
29890,
943,
29898,
3784,
29897,
13,
9651,
565,
7431,
29898,
29876,
1182,
29879,
29897,
1275,
29871,
29906,
29901,
13,
18884,
2867,
13,
9651,
302,
1182,
353,
6213,
13,
9651,
363,
5694,
297,
302,
1182,
29879,
29901,
13,
18884,
565,
5694,
1275,
3517,
29901,
13,
462,
1678,
6773,
13,
18884,
565,
1583,
29889,
275,
29918,
12864,
29918,
265,
29918,
9917,
653,
29898,
3784,
29892,
5694,
1125,
13,
462,
1678,
302,
1182,
353,
5694,
13,
462,
1678,
2867,
13,
9651,
565,
302,
1182,
338,
6213,
29901,
13,
18884,
2867,
13,
9651,
3517,
29892,
1857,
353,
1857,
29892,
302,
1182,
13,
9651,
12770,
29889,
4397,
3552,
24957,
29892,
1857,
876,
13,
13,
4706,
736,
12770,
13,
13,
1678,
822,
7636,
29918,
17010,
29898,
1311,
29892,
318,
29894,
1125,
13,
4706,
12770,
353,
5159,
13,
4706,
325,
29892,
318,
353,
318,
29894,
13,
4706,
1550,
5852,
29901,
13,
9651,
12770,
29889,
4397,
3552,
29884,
29892,
325,
876,
13,
9651,
285,
1989,
353,
1583,
29889,
24498,
12864,
29961,
29884,
3816,
29894,
29962,
13,
9651,
565,
285,
1989,
338,
6213,
29901,
13,
18884,
2867,
13,
9651,
13791,
353,
1583,
29889,
2161,
29918,
1765,
1575,
29898,
29888,
1989,
29897,
13,
9651,
565,
7431,
29898,
1765,
1575,
29897,
2804,
29871,
29946,
29901,
13,
18884,
2867,
13,
9651,
474,
353,
13791,
29889,
2248,
29898,
29884,
29897,
13,
9651,
318,
353,
13791,
29961,
29875,
448,
29871,
29896,
29962,
13,
9651,
325,
353,
13791,
29961,
29875,
448,
29871,
29906,
29962,
13,
4706,
12770,
7503,
29962,
353,
17288,
29884,
29892,
325,
29897,
363,
325,
29892,
318,
297,
12770,
29961,
1057,
29899,
29896,
5262,
13,
4706,
318,
29892,
325,
353,
318,
29894,
13,
4706,
1550,
5852,
29901,
13,
9651,
285,
1989,
353,
1583,
29889,
24498,
12864,
29961,
29884,
3816,
29894,
29962,
13,
9651,
565,
285,
1989,
338,
6213,
29901,
13,
18884,
2867,
13,
9651,
13791,
353,
1583,
29889,
2161,
29918,
1765,
1575,
29898,
29888,
1989,
29897,
13,
9651,
565,
7431,
29898,
1765,
1575,
29897,
2804,
29871,
29946,
29901,
13,
18884,
2867,
13,
9651,
474,
353,
13791,
29889,
2248,
29898,
29884,
29897,
13,
9651,
318,
353,
13791,
29961,
29875,
448,
29871,
29896,
29962,
13,
9651,
325,
353,
13791,
29961,
29875,
448,
29871,
29906,
29962,
13,
9651,
12770,
29889,
4397,
3552,
29884,
29892,
325,
876,
13,
4706,
736,
12770,
13,
13,
1678,
822,
13791,
29918,
265,
29918,
12864,
29918,
7888,
29898,
1311,
29892,
318,
29894,
1125,
13,
4706,
12770,
353,
1583,
29889,
12864,
29918,
7888,
29898,
4090,
29897,
13,
4706,
565,
7431,
29898,
287,
2710,
29897,
1275,
29871,
29896,
29901,
13,
9651,
736,
12770,
29961,
29900,
29962,
13,
4706,
13791,
353,
518,
12864,
29961,
29900,
29962,
363,
7636,
297,
12770,
29962,
13,
4706,
565,
12770,
14352,
29896,
3816,
29896,
29962,
2804,
12770,
29961,
29900,
3816,
29900,
5387,
13,
9651,
13791,
29889,
4397,
29898,
287,
2710,
14352,
29896,
3816,
29896,
2314,
13,
4706,
736,
13791,
13,
13,
1678,
822,
11155,
29918,
1765,
1575,
29898,
1311,
29892,
304,
29880,
29922,
29896,
29953,
29900,
1125,
13,
4706,
325,
8149,
353,
5159,
13,
4706,
363,
1820,
297,
1583,
29889,
1765,
1575,
29918,
265,
29918,
9917,
653,
7295,
13,
9651,
565,
1583,
29889,
369,
4776,
29918,
12163,
929,
29898,
1989,
29897,
1275,
29871,
29906,
29901,
13,
18884,
325,
8149,
29889,
4397,
29898,
1989,
29897,
13,
9651,
1683,
29901,
13,
18884,
302,
1182,
29879,
353,
5159,
13,
18884,
363,
302,
1989,
297,
1583,
29889,
369,
4776,
29918,
484,
1141,
29890,
943,
29898,
1989,
1125,
13,
462,
1678,
565,
1583,
29889,
275,
29918,
12864,
29918,
265,
29918,
9917,
653,
29898,
1989,
29892,
302,
1989,
1125,
13,
462,
4706,
302,
1182,
29879,
29889,
4397,
29898,
29876,
1989,
29897,
13,
18884,
318,
353,
313,
1311,
29889,
12864,
29918,
8111,
29898,
1989,
29892,
302,
1182,
29879,
29961,
29900,
12622,
13,
18884,
325,
353,
313,
1311,
29889,
12864,
29918,
8111,
29898,
1989,
29892,
302,
1182,
29879,
29961,
29896,
12622,
13,
18884,
565,
10696,
29918,
345,
14359,
29898,
29884,
29892,
325,
29892,
3587,
29922,
5574,
29897,
529,
304,
29880,
29901,
13,
462,
1678,
325,
8149,
29889,
4397,
29898,
1989,
29897,
13,
4706,
736,
325,
8149,
13,
13,
1678,
396,
822,
17240,
29918,
265,
29918,
12864,
29918,
7888,
29898,
1311,
29892,
318,
29894,
1125,
13,
1678,
396,
268,
1209,
13,
13,
1678,
396,
822,
17240,
29918,
265,
29918,
12864,
29918,
17010,
29898,
1311,
29892,
318,
29894,
1125,
13,
1678,
396,
268,
1209,
13,
13,
1678,
396,
822,
9126,
29918,
1765,
1575,
29918,
265,
29918,
9917,
653,
29898,
1311,
29892,
318,
29894,
1125,
13,
1678,
396,
268,
13791,
353,
5159,
13,
1678,
396,
268,
1857,
29892,
3517,
353,
318,
29894,
13,
1678,
396,
268,
13791,
29889,
4397,
29898,
3784,
29897,
13,
1678,
396,
268,
565,
451,
1583,
29889,
369,
4776,
29918,
12715,
29898,
3784,
29892,
525,
275,
29918,
20227,
29374,
13,
1678,
396,
308,
1550,
5852,
29901,
13,
1678,
396,
632,
302,
1182,
29879,
353,
1583,
29889,
369,
4776,
29918,
484,
1141,
29890,
943,
29898,
3784,
29897,
13,
1678,
396,
632,
363,
302,
1182,
297,
302,
1182,
29879,
29901,
13,
1678,
396,
462,
565,
302,
1182,
1275,
3517,
29901,
13,
1678,
396,
462,
268,
6773,
13,
1678,
396,
462,
565,
1583,
29889,
275,
29918,
12864,
29918,
265,
29918,
9917,
653,
29898,
3784,
29892,
302,
1182,
1125,
13,
1678,
396,
462,
268,
13791,
29889,
4397,
29898,
29876,
1182,
29897,
13,
1678,
396,
462,
268,
2867,
13,
1678,
396,
632,
565,
13791,
14352,
29896,
29962,
1275,
13791,
29961,
29900,
5387,
13,
1678,
396,
462,
2867,
13,
1678,
396,
632,
565,
1583,
29889,
369,
4776,
29918,
12715,
29898,
1765,
1575,
14352,
29896,
1402,
525,
275,
29918,
20227,
29374,
13,
1678,
396,
462,
2867,
13,
1678,
396,
632,
3517,
353,
1857,
13,
1678,
396,
632,
1857,
353,
302,
1182,
13,
1678,
396,
308,
13791,
7503,
29962,
353,
13791,
29961,
1057,
29899,
29896,
29962,
13,
1678,
396,
268,
3517,
29892,
1857,
353,
318,
29894,
13,
1678,
396,
268,
13791,
29889,
4397,
29898,
3784,
29897,
13,
1678,
396,
268,
565,
451,
1583,
29889,
369,
4776,
29918,
12715,
29898,
3784,
29892,
525,
275,
29918,
20227,
29374,
13,
1678,
396,
308,
1550,
5852,
29901,
13,
1678,
396,
632,
302,
1182,
29879,
353,
1583,
29889,
369,
4776,
29918,
484,
1141,
29890,
943,
29898,
3784,
29897,
13,
1678,
396,
632,
363,
302,
1182,
297,
302,
1182,
29879,
29901,
13,
1678,
396,
462,
565,
302,
1182,
1275,
3517,
29901,
13,
1678,
396,
462,
268,
6773,
13,
1678,
396,
462,
565,
1583,
29889,
275,
29918,
12864,
29918,
265,
29918,
9917,
653,
29898,
3784,
29892,
302,
1182,
1125,
13,
1678,
396,
462,
268,
13791,
29889,
4397,
29898,
29876,
1182,
29897,
13,
1678,
396,
462,
268,
2867,
13,
1678,
396,
632,
565,
13791,
14352,
29896,
29962,
1275,
13791,
29961,
29900,
5387,
13,
1678,
396,
462,
2867,
13,
1678,
396,
632,
565,
1583,
29889,
369,
4776,
29918,
12715,
29898,
1765,
1575,
14352,
29896,
1402,
525,
275,
29918,
20227,
29374,
13,
1678,
396,
462,
2867,
13,
1678,
396,
632,
3517,
353,
1857,
13,
1678,
396,
632,
1857,
353,
302,
1182,
13,
1678,
396,
268,
736,
13791,
13,
13,
1678,
396,
822,
9126,
29918,
1765,
1575,
29898,
1311,
29892,
318,
29894,
1125,
13,
1678,
396,
268,
9995,
7514,
287,
13791,
3412,
278,
5305,
310,
385,
7636,
29889,
13,
13,
1678,
396,
268,
3940,
393,
278,
5305,
310,
385,
7636,
871,
3732,
4060,
297,
263,
18890,
13261,
13,
1678,
396,
268,
310,
278,
13722,
29889,
7857,
29892,
278,
2740,
297,
2845,
5305,
310,
278,
7636,
13,
1678,
396,
268,
17726,
565,
278,
2446,
18169,
12688,
338,
451,
29871,
29946,
29899,
791,
296,
29892,
470,
565,
372,
338,
373,
13,
1678,
396,
268,
278,
10452,
310,
278,
13722,
29889,
13,
13,
1678,
396,
268,
12662,
2699,
13,
1678,
396,
268,
448,
1378,
29899,
13,
1678,
396,
268,
318,
29894,
584,
18761,
13,
1678,
396,
308,
450,
7636,
15882,
29889,
13,
13,
1678,
396,
268,
16969,
13,
1678,
396,
268,
448,
22158,
13,
1678,
396,
268,
1051,
13,
1678,
396,
308,
8170,
287,
13791,
3412,
278,
5305,
310,
278,
7636,
29889,
13,
1678,
396,
308,
450,
937,
12688,
338,
278,
12688,
472,
278,
1095,
310,
278,
318,
29899,
20845,
29889,
13,
1678,
396,
308,
450,
1833,
12688,
338,
278,
12688,
472,
278,
1095,
310,
278,
325,
29899,
20845,
29889,
13,
13,
1678,
396,
268,
9995,
13,
1678,
396,
268,
659,
3819,
353,
29871,
29946,
13,
1678,
396,
268,
565,
1583,
29889,
275,
29918,
12864,
29918,
265,
29918,
9917,
653,
10456,
4090,
1125,
13,
1678,
396,
308,
659,
3819,
353,
29871,
29941,
13,
13,
1678,
396,
268,
13791,
353,
5159,
13,
1678,
396,
268,
1857,
29892,
3517,
353,
318,
29894,
13,
1678,
396,
268,
1550,
5852,
29901,
13,
1678,
396,
308,
13791,
29889,
4397,
29898,
3784,
29897,
13,
1678,
396,
308,
302,
1182,
29879,
353,
1583,
29889,
369,
4776,
29918,
484,
1141,
29890,
943,
29898,
3784,
29892,
10372,
29922,
5574,
29897,
13,
1678,
396,
308,
565,
7431,
29898,
29876,
1182,
29879,
29897,
2804,
659,
3819,
29901,
13,
1678,
396,
632,
2867,
13,
1678,
396,
308,
474,
353,
302,
1182,
29879,
29889,
2248,
29898,
24957,
29897,
13,
1678,
396,
308,
3517,
353,
1857,
13,
1678,
396,
308,
1857,
353,
302,
1182,
29879,
29961,
29875,
448,
29871,
29906,
29962,
13,
1678,
396,
308,
565,
659,
3819,
1275,
29871,
29941,
322,
451,
1583,
29889,
275,
29918,
12864,
29918,
265,
29918,
9917,
653,
29898,
24957,
29892,
1857,
1125,
13,
1678,
396,
632,
1857,
353,
302,
1182,
29879,
29961,
29875,
448,
29871,
29896,
29962,
13,
13,
1678,
396,
268,
13791,
7503,
29962,
353,
13791,
29961,
1057,
29899,
29896,
29962,
13,
13,
1678,
396,
268,
3517,
29892,
1857,
353,
318,
29894,
13,
13,
1678,
396,
268,
1550,
5852,
29901,
13,
1678,
396,
308,
13791,
29889,
4397,
29898,
3784,
29897,
13,
1678,
396,
308,
302,
1182,
29879,
353,
1583,
29889,
369,
4776,
29918,
484,
1141,
29890,
943,
29898,
3784,
29892,
10372,
29922,
5574,
29897,
13,
1678,
396,
308,
565,
7431,
29898,
29876,
1182,
29879,
29897,
2804,
659,
3819,
29901,
13,
1678,
396,
632,
2867,
13,
1678,
396,
308,
474,
353,
302,
1182,
29879,
29889,
2248,
29898,
24957,
29897,
13,
1678,
396,
308,
3517,
353,
1857,
13,
1678,
396,
308,
1857,
353,
302,
1182,
29879,
29961,
29875,
448,
29871,
29906,
29962,
13,
1678,
396,
308,
565,
659,
3819,
1275,
29871,
29941,
322,
451,
1583,
29889,
275,
29918,
12864,
29918,
265,
29918,
9917,
653,
29898,
24957,
29892,
1857,
1125,
13,
1678,
396,
632,
1857,
353,
302,
1182,
29879,
29961,
29875,
448,
29871,
29896,
29962,
13,
13,
1678,
396,
268,
736,
13791,
13,
13,
1678,
396,
822,
9126,
29918,
287,
2710,
29898,
1311,
29892,
318,
29894,
1125,
13,
1678,
396,
268,
9995,
7514,
287,
12770,
3412,
278,
5305,
310,
385,
7636,
29889,
13,
13,
1678,
396,
268,
3940,
393,
278,
5305,
310,
385,
7636,
871,
3732,
4060,
297,
263,
18890,
5041,
13,
1678,
396,
268,
310,
278,
13722,
29889,
7857,
29892,
278,
2740,
297,
2845,
5305,
310,
278,
12770,
13,
1678,
396,
268,
17726,
565,
278,
11564,
12688,
310,
278,
2446,
18169,
7636,
338,
451,
13,
1678,
396,
418,
29946,
29899,
791,
296,
470,
565,
372,
12185,
373,
278,
10452,
310,
278,
13722,
29889,
13,
13,
1678,
396,
268,
12662,
2699,
13,
1678,
396,
268,
448,
1378,
29899,
13,
1678,
396,
268,
318,
29894,
584,
18761,
13,
1678,
396,
308,
450,
7636,
15882,
29889,
13,
13,
1678,
396,
268,
16969,
13,
1678,
396,
268,
448,
22158,
13,
1678,
396,
268,
1051,
13,
1678,
396,
308,
319,
1051,
310,
10372,
7636,
2893,
14903,
29889,
13,
1678,
396,
308,
2155,
2710,
526,
26118,
2343,
29899,
517,
29899,
18237,
29889,
13,
1678,
396,
308,
7857,
29892,
278,
19843,
310,
278,
12770,
338,
451,
12695,
278,
1021,
408,
297,
278,
13722,
29889,
13,
1678,
396,
308,
450,
937,
7636,
338,
278,
7636,
472,
278,
1095,
310,
278,
318,
29899,
20845,
29889,
13,
1678,
396,
308,
450,
1833,
7636,
338,
278,
7636,
472,
278,
1095,
310,
278,
13,
13,
1678,
396,
268,
9995,
13,
1678,
396,
268,
13791,
353,
1583,
29889,
20621,
681,
29918,
1765,
1575,
29898,
4090,
29897,
13,
1678,
396,
268,
736,
1051,
29898,
18784,
3538,
29898,
1765,
1575,
876,
13,
13,
1678,
396,
822,
8943,
29918,
287,
2710,
29898,
1311,
29892,
318,
29894,
1125,
13,
1678,
396,
268,
9995,
3853,
2710,
8943,
304,
385,
7636,
29889,
13,
13,
1678,
396,
268,
1459,
6553,
12770,
871,
1863,
297,
263,
18890,
5041,
310,
278,
13722,
29889,
13,
1678,
396,
268,
450,
2740,
297,
2845,
5305,
17726,
408,
4720,
408,
278,
2446,
7636,
13,
1678,
396,
268,
338,
20114,
304,
263,
3700,
393,
338,
451,
263,
18890,
4115,
1008,
284,
470,
565,
372,
338,
373,
13,
1678,
396,
268,
278,
10452,
310,
278,
13722,
29889,
13,
13,
1678,
396,
268,
12662,
2699,
13,
1678,
396,
268,
448,
1378,
29899,
13,
1678,
396,
268,
318,
29894,
584,
18761,
13,
1678,
396,
308,
450,
7636,
15882,
29889,
13,
13,
1678,
396,
268,
16969,
13,
1678,
396,
268,
448,
22158,
13,
1678,
396,
268,
1051,
13,
1678,
396,
308,
319,
1051,
310,
8943,
12770,
29889,
13,
13,
1678,
396,
268,
9995,
13,
1678,
396,
268,
12770,
353,
5159,
13,
1678,
396,
268,
325,
29892,
318,
353,
318,
29894,
13,
1678,
396,
268,
1550,
5852,
29901,
13,
1678,
396,
308,
285,
1989,
353,
1583,
29889,
24498,
12864,
29961,
29884,
3816,
29894,
29962,
13,
1678,
396,
308,
565,
285,
1989,
338,
6213,
29901,
13,
1678,
396,
632,
2867,
13,
1678,
396,
308,
13791,
353,
1583,
29889,
2161,
29918,
1765,
1575,
29898,
29888,
1989,
29897,
13,
1678,
396,
308,
565,
7431,
29898,
1765,
1575,
29897,
2804,
29871,
29946,
29901,
13,
1678,
396,
632,
2867,
13,
1678,
396,
308,
12770,
29889,
4397,
3552,
29884,
29892,
325,
876,
13,
1678,
396,
308,
474,
353,
13791,
29889,
2248,
29898,
29884,
29897,
13,
1678,
396,
308,
318,
353,
13791,
29961,
29875,
448,
29871,
29896,
29962,
13,
1678,
396,
308,
325,
353,
13791,
29961,
29875,
448,
29871,
29906,
29962,
13,
1678,
396,
268,
12770,
7503,
29962,
353,
12770,
29961,
1057,
29899,
29896,
29962,
13,
1678,
396,
268,
318,
29892,
325,
353,
318,
29894,
13,
1678,
396,
268,
1550,
5852,
29901,
13,
1678,
396,
308,
285,
1989,
353,
1583,
29889,
24498,
12864,
29961,
29884,
3816,
29894,
29962,
13,
1678,
396,
308,
565,
285,
1989,
338,
6213,
29901,
13,
1678,
396,
632,
2867,
13,
1678,
396,
308,
13791,
353,
1583,
29889,
2161,
29918,
1765,
1575,
29898,
29888,
1989,
29897,
13,
1678,
396,
308,
565,
7431,
29898,
1765,
1575,
29897,
2804,
29871,
29946,
29901,
13,
1678,
396,
632,
2867,
13,
1678,
396,
308,
12770,
29889,
4397,
3552,
29884,
29892,
325,
876,
13,
1678,
396,
308,
474,
353,
13791,
29889,
2248,
29898,
29884,
29897,
13,
1678,
396,
308,
318,
353,
13791,
29961,
29875,
448,
29871,
29896,
29962,
13,
1678,
396,
308,
325,
353,
13791,
29961,
29875,
448,
29871,
29906,
29962,
13,
1678,
396,
268,
736,
12770,
13,
13,
1678,
396,
822,
8943,
29918,
8726,
29898,
1311,
29892,
318,
29894,
1125,
13,
1678,
396,
268,
9995,
1576,
17240,
3412,
278,
5305,
310,
8943,
12770,
29889,
13,
13,
1678,
396,
268,
12662,
2699,
13,
1678,
396,
268,
448,
1378,
29899,
13,
1678,
396,
268,
318,
29894,
584,
18761,
13,
1678,
396,
308,
450,
7636,
15882,
29889,
13,
13,
1678,
396,
268,
16969,
13,
1678,
396,
268,
448,
22158,
13,
1678,
396,
268,
1051,
13,
1678,
396,
308,
319,
1051,
310,
8943,
17240,
29889,
13,
13,
1678,
396,
268,
9995,
13,
1678,
396,
268,
17240,
353,
5159,
13,
1678,
396,
268,
325,
29892,
318,
353,
318,
29894,
13,
1678,
396,
268,
1550,
5852,
29901,
13,
1678,
396,
308,
285,
1989,
353,
1583,
29889,
24498,
12864,
29961,
29884,
3816,
29894,
29962,
13,
1678,
396,
308,
565,
285,
1989,
338,
6213,
29901,
13,
1678,
396,
632,
2867,
13,
1678,
396,
308,
13791,
353,
1583,
29889,
2161,
29918,
1765,
1575,
29898,
29888,
1989,
29897,
13,
1678,
396,
308,
565,
7431,
29898,
1765,
1575,
29897,
2804,
29871,
29946,
29901,
13,
1678,
396,
632,
2867,
13,
1678,
396,
308,
17240,
29889,
4397,
29898,
29888,
1989,
29897,
13,
1678,
396,
308,
474,
353,
13791,
29889,
2248,
29898,
29884,
29897,
13,
1678,
396,
308,
318,
353,
13791,
29961,
29875,
448,
29871,
29896,
29962,
13,
1678,
396,
308,
325,
353,
13791,
29961,
29875,
448,
29871,
29906,
29962,
13,
1678,
396,
268,
17240,
7503,
29962,
353,
17240,
29961,
1057,
29899,
29896,
29962,
13,
1678,
396,
268,
318,
29892,
325,
353,
318,
29894,
13,
1678,
396,
268,
1550,
5852,
29901,
13,
1678,
396,
308,
285,
1989,
353,
1583,
29889,
24498,
12864,
29961,
29884,
3816,
29894,
29962,
13,
1678,
396,
308,
565,
285,
1989,
338,
6213,
29901,
13,
1678,
396,
632,
2867,
13,
1678,
396,
308,
13791,
353,
1583,
29889,
2161,
29918,
1765,
1575,
29898,
29888,
1989,
29897,
13,
1678,
396,
308,
565,
7431,
29898,
1765,
1575,
29897,
2804,
29871,
29946,
29901,
13,
1678,
396,
632,
2867,
13,
1678,
396,
308,
17240,
29889,
4397,
29898,
29888,
1989,
29897,
13,
1678,
396,
308,
474,
353,
13791,
29889,
2248,
29898,
29884,
29897,
13,
1678,
396,
308,
318,
353,
13791,
29961,
29875,
448,
29871,
29896,
29962,
13,
1678,
396,
308,
325,
353,
13791,
29961,
29875,
448,
29871,
29906,
29962,
13,
1678,
396,
268,
736,
17240,
13,
13,
13,
29937,
1275,
9166,
9166,
9166,
9166,
4936,
2751,
13,
29937,
4241,
13,
29937,
1275,
9166,
9166,
9166,
9166,
4936,
2751,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
1209,
13,
2
] |
configs/mmdet/detection/detection_tensorrt_static-300x300.py | zhiqwang/mmdeploy | 746 | 774 | <reponame>zhiqwang/mmdeploy
_base_ = ['../_base_/base_tensorrt_static-300x300.py']
| [
1,
529,
276,
1112,
420,
29958,
29920,
2918,
29939,
29893,
574,
29914,
4317,
16519,
13,
29918,
3188,
29918,
353,
6024,
6995,
29918,
3188,
29918,
29914,
3188,
29918,
20158,
2273,
29918,
7959,
29899,
29941,
29900,
29900,
29916,
29941,
29900,
29900,
29889,
2272,
2033,
13,
2
] |
testfile.py | jordanwimb/kbpython | 0 | 86819 | <filename>testfile.py
print("Hellllo")
| [
1,
529,
9507,
29958,
1688,
1445,
29889,
2272,
13,
2158,
703,
29950,
514,
29880,
417,
1159,
13,
2
] |
tests/encoding/test_lib.py | Defense-Cyber-Crime-Center/dfvfs | 2 | 54845 | # -*- coding: utf-8 -*-
"""Shared test cases."""
import unittest
class DecoderTestCase(unittest.TestCase):
"""The unit test case for decoder object implementions."""
| [
1,
396,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
15945,
29908,
21741,
1243,
4251,
1213,
15945,
13,
13,
5215,
443,
27958,
13,
13,
13,
1990,
3826,
6119,
3057,
8259,
29898,
348,
27958,
29889,
3057,
8259,
1125,
13,
29871,
9995,
1576,
5190,
1243,
1206,
363,
1602,
6119,
1203,
2334,
1080,
1213,
15945,
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.